SUBDIRS=images src
-EXTRA_DIST=bootstrap config/depcomp config/cxx_macros.m4 @PACKAGE_TARNAME@-@VERSION@.spec config/project.spec.in config/build.cfg sinfg.kdevprj config/ETL.m4
+EXTRA_DIST=bootstrap config/depcomp config/cxx_macros.m4 @PACKAGE_TARNAME@-@VERSION@.spec config/project.spec.in config/build.cfg synfig.kdevprj config/ETL.m4
# Desktop entry
#desktopdir = $(datadir)/gnome/apps/Graphics
desktopdir = $(prefix)/share/applications
-desktop_DATA = sinfgstudio.desktop
-#desktop_in_files = sinfgstudio.desktop.in
+desktop_DATA = synfigstudio.desktop
+#desktop_in_files = synfigstudio.desktop.in
#desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
# @INTLTOOL_DESKTOP_RULE@
mimedir = $(prefix)/share/mime-info
-mime_DATA = sinfgstudio.keys sinfgstudio.mime
+mime_DATA = synfigstudio.keys synfigstudio.mime
# Icon
icondir = $(datadir)/pixmaps
-icon_DATA = images/sinfg_icon.png images/sif_icon.png
+icon_DATA = images/synfig_icon.png images/sif_icon.png
CVS=cvs
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
-PKG_CHECK_MODULES(SINFG, synfig ETL sigc++-2.0,,[
+PKG_CHECK_MODULES(SYNFIG, synfig ETL sigc++-2.0,,[
AC_MSG_ERROR([ ** Unable to set up dependent libraries])
])
-AC_SUBST(SINFG_CFLAGS)
-AC_SUBST(SINFG_LIBS)
+AC_SUBST(SYNFIG_CFLAGS)
+AC_SUBST(SYNFIG_LIBS)
windowsys="gtkmm"
AC_DEFINE(STUDIO_WINSYS_H,"gtkmm/winsys.h",[blah])
AC_OUTPUT(
Makefile
-sinfgstudio.desktop
-sinfgstudio.mime
-sinfgstudio.keys
+synfigstudio.desktop
+synfigstudio.mime
+synfigstudio.keys
src/Makefile
src/gtkmm/Makefile
-src/sinfgapp/Makefile
+src/synfigapp/Makefile
images/Makefile
win32inst.nsi
pkg-info/macosx/synfig-studio.info
"'$'"CXX ------------------------------> '$CXX'
"'$'"CXXFLAGS -------------------------> '$CXXFLAGS'
"'$'"LDFLAGS --------------------------> '$LDFLAGS'
-"'$'"SINFG_CFLAGS ---------------------> '$SINFG_CFLAGS'
-"'$'"SINFG_LIBS -----------------------> '$SINFG_LIBS'
+"'$'"SYNFIG_CFLAGS ---------------------> '$SYNFIG_CFLAGS'
+"'$'"SYNFIG_LIBS -----------------------> '$SYNFIG_LIBS'
"'$'"GTKMM_CFLAGS ---------------------> '$GTKMM_CFLAGS'
"'$'"GTKMM_LIBS -----------------------> '$GTKMM_LIBS'
"
+++ /dev/null
-# SINFG M4 Macro
-# For GNU Autotools
-# $Id: sinfg.m4,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $
-#
-# By Robert B. Quattlebaum Jr. <darco@users.sf.net>
-#
-
-AC_DEFUN([SINFG_DEPS],
-[
- USING_ETL(,$2)
- AM_PATH_XML2(,,$2)
- AC_CHECK_FUNCS([floor pow sqrt],,$2)
- $1
-])
-
-AC_DEFUN([USING_SINFG],
-[
- AC_ARG_WITH(sinfg-includes,
- [ --with-sinfg-includes Specify location of sinfg headers],[
- CXXFLAGS="$CXXFLAGS -I$withval"
- ])
-
- AC_PATH_PROG(SINFG_CONFIG,sinfg-config,no)
-
- if test "$SINFG_CONFIG" = "no"; then
- no_SINFG_config="yes"
- $2
- else
- AC_MSG_CHECKING([if $SINFG_CONFIG works])
- if $SINFG_CONFIG --libs >/dev/null 2>&1; then
- SINFG_VERSION="`$SINFG_CONFIG --version`"
- AC_MSG_RESULT([yes, $SINFG_VERSION])
- SINFG_CXXFLAGS="`$SINFG_CONFIG --cxxflags`"
- SINFG_CFLAGS="`$SINFG_CONFIG --cflags`"
- SINFG_LIBS="`$SINFG_CONFIG --libs`"
- CXXFLAGS="$CXXFLAGS $SINFG_CXXFLAGS"
- AC_SUBST(SINFG_CXXFLAGS)
- AC_SUBST(SINFG_LIBS)
- AC_SUBST(SINFG_CFLAGS)
- $1
- else
- AC_MSG_RESULT(no)
- no_SINFG_config="yes"
- $2
- fi
- fi
-
- SINFG_DEPS($1,$2)
-])
-
-
--- /dev/null
+# SINFG M4 Macro
+# For GNU Autotools
+# $Id: sinfg.m4,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $
+#
+# By Robert B. Quattlebaum Jr. <darco@users.sf.net>
+#
+
+AC_DEFUN([SINFG_DEPS],
+[
+ USING_ETL(,$2)
+ AM_PATH_XML2(,,$2)
+ AC_CHECK_FUNCS([floor pow sqrt],,$2)
+ $1
+])
+
+AC_DEFUN([USING_SINFG],
+[
+ AC_ARG_WITH(sinfg-includes,
+ [ --with-sinfg-includes Specify location of sinfg headers],[
+ CXXFLAGS="$CXXFLAGS -I$withval"
+ ])
+
+ AC_PATH_PROG(SINFG_CONFIG,sinfg-config,no)
+
+ if test "$SINFG_CONFIG" = "no"; then
+ no_SINFG_config="yes"
+ $2
+ else
+ AC_MSG_CHECKING([if $SINFG_CONFIG works])
+ if $SINFG_CONFIG --libs >/dev/null 2>&1; then
+ SINFG_VERSION="`$SINFG_CONFIG --version`"
+ AC_MSG_RESULT([yes, $SINFG_VERSION])
+ SINFG_CXXFLAGS="`$SINFG_CONFIG --cxxflags`"
+ SINFG_CFLAGS="`$SINFG_CONFIG --cflags`"
+ SINFG_LIBS="`$SINFG_CONFIG --libs`"
+ CXXFLAGS="$CXXFLAGS $SINFG_CXXFLAGS"
+ AC_SUBST(SINFG_CXXFLAGS)
+ AC_SUBST(SINFG_LIBS)
+ AC_SUBST(SINFG_CFLAGS)
+ $1
+ else
+ AC_MSG_RESULT(no)
+ no_SINFG_config="yes"
+ $2
+ fi
+ fi
+
+ SINFG_DEPS($1,$2)
+])
+
+
TEMPFILENAME=~/deleteme.tmp
-for filename in `find . -name '*.[ch]*'` ; do {
- sed '
-s/SigC::Signal./sigc::signal/g;
+SEDSCRIPT='
+s/sinfg/synfig/g;
+s/SINFG/SYNFIG/g;
+s/= S I N F G ===/= S Y N F I G =/g;
+s/Sinfg/Synfig/g;
+';
-' < $filename > $TEMPFILENAME && ( diff -q $TEMPFILENAME $filename || cp $TEMPFILENAME $filename )
+for filename in `find . -name "*sinfg*" -a ! -name '*svn*'` ; do {
+ newfilename=`echo $filename | sed "$SEDSCRIPT"`;
+ echo $filename '=>' $newfilename;
+ svn rename $filename $newfilename || exit 2;
+} ; done
+
+
+#exit 0;
+
+for filename in `find . -name '*.[ch]*' -o -name '*.am' -o -name '*.px' -o -name '*.ac' -o -name '*.nsh' -o -name '*.in' | grep -v .svn` ; do {
+ sed "$SEDSCRIPT" < $filename > $TEMPFILENAME && ( diff -q $TEMPFILENAME $filename || cp $TEMPFILENAME $filename )
} ; done
-SINFG=sinfg
+SYNFIG=synfig
EXT=@imageext@
EXTRA_DIST=studio_about.sif
-IMAGES=mirror_icon.$(EXT) time_track_icon.$(EXT) pastecanvas_icon.$(EXT) group_icon.$(EXT) clear_redo_icon.$(EXT) clear_undo_icon.$(EXT) navigator_icon.$(EXT) info_icon.$(EXT) zoom_icon.$(EXT) meta_data_icon.$(EXT) children_icon.$(EXT) keyframe_icon.$(EXT) swap_colors_icon.$(EXT) rotate_icon.$(EXT) scale_icon.$(EXT) smooth_move_icon.$(EXT) width_icon.$(EXT) rectangle_icon.$(EXT) circle_icon.$(EXT) draw_icon.$(EXT) sketch_icon.$(EXT) fill_icon.$(EXT) normal_icon.$(EXT) sif_icon.$(EXT) sinfg_icon.$(EXT) saveall_icon.$(EXT) bool_icon.$(EXT) integer_icon.$(EXT) angle_icon.$(EXT) segment_icon.$(EXT) blinepoint_icon.$(EXT) list_icon.$(EXT) canvas_pointer_icon.$(EXT) string_icon.$(EXT) eyedrop_icon.$(EXT) about_icon.$(EXT) about_dialog.$(EXT) canvas_icon.$(EXT) vector_icon.$(EXT) real_icon.$(EXT) color_icon.$(EXT) valuenode_icon.$(EXT) polygon_icon.$(EXT) bline_icon.$(EXT) layer_icon.$(EXT) duplicate_icon.$(EXT) gradient_icon.$(EXT) keyframe_lock_all.$(EXT) keyframe_lock_past.$(EXT) keyframe_lock_future.$(EXT) keyframe_lock_none.$(EXT)
+IMAGES=mirror_icon.$(EXT) time_track_icon.$(EXT) pastecanvas_icon.$(EXT) group_icon.$(EXT) clear_redo_icon.$(EXT) clear_undo_icon.$(EXT) navigator_icon.$(EXT) info_icon.$(EXT) zoom_icon.$(EXT) meta_data_icon.$(EXT) children_icon.$(EXT) keyframe_icon.$(EXT) swap_colors_icon.$(EXT) rotate_icon.$(EXT) scale_icon.$(EXT) smooth_move_icon.$(EXT) width_icon.$(EXT) rectangle_icon.$(EXT) circle_icon.$(EXT) draw_icon.$(EXT) sketch_icon.$(EXT) fill_icon.$(EXT) normal_icon.$(EXT) sif_icon.$(EXT) synfig_icon.$(EXT) saveall_icon.$(EXT) bool_icon.$(EXT) integer_icon.$(EXT) angle_icon.$(EXT) segment_icon.$(EXT) blinepoint_icon.$(EXT) list_icon.$(EXT) canvas_pointer_icon.$(EXT) string_icon.$(EXT) eyedrop_icon.$(EXT) about_icon.$(EXT) about_dialog.$(EXT) canvas_icon.$(EXT) vector_icon.$(EXT) real_icon.$(EXT) color_icon.$(EXT) valuenode_icon.$(EXT) polygon_icon.$(EXT) bline_icon.$(EXT) layer_icon.$(EXT) duplicate_icon.$(EXT) gradient_icon.$(EXT) keyframe_lock_all.$(EXT) keyframe_lock_past.$(EXT) keyframe_lock_future.$(EXT) keyframe_lock_none.$(EXT)
CLEANFILES=$(IMAGES)
CONVERT=convert
sif_icon.ico: $(srcdir)/sif_icon.sif
- $(SINFG) $< -w 16 -h 16 -o sif_icon_16.gif sif_icon.sif -w 32 -h 32 -o sif_icon_32.gif sif_icon.sif -w 64 -h 64 -o sif_icon_64.gif
+ $(SYNFIG) $< -w 16 -h 16 -o sif_icon_16.gif sif_icon.sif -w 32 -h 32 -o sif_icon_32.gif sif_icon.sif -w 64 -h 64 -o sif_icon_64.gif
$(CONVERT) sif_icon_16.gif sif_icon_16.png
$(CONVERT) sif_icon_32.gif sif_icon_32.png
$(CONVERT) sif_icon_64.gif sif_icon_64.png
$(RM) $(CLEANFILES)
.sif.bmp:
- $(SINFG) -q $< -o $@ --time 0
+ $(SYNFIG) -q $< -o $@ --time 0
.sif.$(EXT):
- $(SINFG) -q $< -o $@ --time 0
+ $(SYNFIG) -q $< -o $@ --time 0
keyframe_lock_all.$(EXT): $(srcdir)/keyframe_lock_icon.sif
- $(SINFG) -q $< -o $@ --time 0
+ $(SYNFIG) -q $< -o $@ --time 0
keyframe_lock_past.$(EXT): $(srcdir)/keyframe_lock_icon.sif
- $(SINFG) -q $< -o $@ --time 0 -c PastOnly
+ $(SYNFIG) -q $< -o $@ --time 0 -c PastOnly
keyframe_lock_future.$(EXT): $(srcdir)/keyframe_lock_icon.sif
- $(SINFG) -q $< -o $@ --time 0 -c FutureOnly
+ $(SYNFIG) -q $< -o $@ --time 0 -c FutureOnly
keyframe_lock_none.$(EXT): $(srcdir)/keyframe_lock_icon.sif
- $(SINFG) -q $< -o $@ --time 0 -c Disabled
+ $(SYNFIG) -q $< -o $@ --time 0 -c Disabled
#.sif.png:
-# $(SINFG) -q $< -o $@ --time 0
+# $(SYNFIG) -q $< -o $@ --time 0
#datanode_icon.$(EXT): datanode_icon.sif
-# $(SINFG) -q datanode_icon.sif -o datanode_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q datanode_icon.sif -o datanode_icon.$(EXT) -w 128 -h 128 --time 0
#color_icon.$(EXT): color_icon.sif
-# $(SINFG) -q color_icon.sif -o color_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q color_icon.sif -o color_icon.$(EXT) -w 128 -h 128 --time 0
#real_icon.$(EXT): real_icon.sif
-# $(SINFG) -q real_icon.sif -o real_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q real_icon.sif -o real_icon.$(EXT) -w 128 -h 128 --time 0
#vector_icon.$(EXT): vector_icon.sif
-# $(SINFG) -q vector_icon.sif -o vector_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q vector_icon.sif -o vector_icon.$(EXT) -w 128 -h 128 --time 0
#about_dialog.$(EXT): about_dialog.sif
-# $(SINFG) -q about_dialog.sif -o about_dialog.$(EXT) --time 0
+# $(SYNFIG) -q about_dialog.sif -o about_dialog.$(EXT) --time 0
#about_icon.$(EXT): about_icon.sif
-# $(SINFG) -q about_icon.sif -o about_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q about_icon.sif -o about_icon.$(EXT) -w 128 -h 128 --time 0
#canvas_icon.$(EXT): canvas_icon.sif
-# $(SINFG) -q canvas_icon.sif -o canvas_icon.$(EXT) -w 128 -h 128 --time 0
+# $(SYNFIG) -q canvas_icon.sif -o canvas_icon.$(EXT) -w 128 -h 128 --time 0
<y>1.2500000000</y>
</vector>
</param>
- <param name="canvas" use="../images/logo.sif#"/>
+ <param name="canvas" use="logo.sif#"/>
<param name="zoom">
<real value="-0.2999999925"/>
</param>
</color>
</param>
<param name="family">
- <string>times</string>
+ <string guid="ADD7C86FF44B7A2A37637C9E3C8F4315">Times New Roman</string>
</param>
<param name="style">
<integer value="0"/>
</color>
</param>
<param name="family">
- <string>times</string>
+ <string guid="ADD7C86FF44B7A2A37637C9E3C8F4315">Times New Roman</string>
</param>
<param name="style">
<integer value="0"/>
</color>
</param>
<param name="family">
- <string>arialbd</string>
+ <string>Arial</string>
</param>
<param name="style">
<integer value="0"/>
+++ /dev/null
-<?xml version="1.0"?>
-<canvas version="0.1" width="128" height="128" xres="2952.755900" yres="2952.755900" view-box="-2.000000 2.000000 2.000000 -2.000000" antialias="1" fps="30.000" begin-time="0f" end-time="0f" bgcolor="0.500000 0.500000 0.500000 1.000000">
- <name>Untitled0</name>
- <layer type="PasteCanvas" active="true" version="0.1">
- <param name="z_depth">
- <real value="0.0000000000"/>
- </param>
- <param name="amount">
- <real value="1.0000000000"/>
- </param>
- <param name="blend_method">
- <integer value="0"/>
- </param>
- <param name="origin">
- <vector>
- <x>0.0000000000</x>
- <y>0.0500000007</y>
- </vector>
- </param>
- <param name="canvas" use="./././logo.sif#"/>
- <param name="zoom">
- <real value="0.2750000000"/>
- </param>
- <param name="time_offset">
- <time value="0f"/>
- </param>
- </layer>
- <layer type="shade" active="true" version="0.2">
- <param name="z_depth">
- <real value="0.0000000000"/>
- </param>
- <param name="amount">
- <real value="0.7500000000"/>
- </param>
- <param name="blend_method">
- <integer value="12"/>
- </param>
- <param name="color">
- <color>
- <r>0.000000</r>
- <g>0.000000</g>
- <b>0.000000</b>
- <a>1.000000</a>
- </color>
- </param>
- <param name="offset">
- <vector>
- <x>0.1000000015</x>
- <y>-0.1000000015</y>
- </vector>
- </param>
- <param name="size">
- <vector>
- <x>0.2000000030</x>
- <y>0.2000000030</y>
- </vector>
- </param>
- <param name="type">
- <integer value="1"/>
- </param>
- <param name="invert">
- <bool value="false"/>
- </param>
- </layer>
-</canvas>
--- /dev/null
+<?xml version="1.0"?>
+<canvas version="0.1" width="128" height="128" xres="2952.755900" yres="2952.755900" view-box="-2.000000 2.000000 2.000000 -2.000000" antialias="1" fps="30.000" begin-time="0f" end-time="0f" bgcolor="0.500000 0.500000 0.500000 1.000000">
+ <name>Untitled0</name>
+ <layer type="PasteCanvas" active="true" version="0.1">
+ <param name="z_depth">
+ <real value="0.0000000000"/>
+ </param>
+ <param name="amount">
+ <real value="1.0000000000"/>
+ </param>
+ <param name="blend_method">
+ <integer value="0"/>
+ </param>
+ <param name="origin">
+ <vector>
+ <x>0.0000000000</x>
+ <y>0.0500000007</y>
+ </vector>
+ </param>
+ <param name="canvas" use="./././logo.sif#"/>
+ <param name="zoom">
+ <real value="0.2750000000"/>
+ </param>
+ <param name="time_offset">
+ <time value="0f"/>
+ </param>
+ </layer>
+ <layer type="shade" active="true" version="0.2">
+ <param name="z_depth">
+ <real value="0.0000000000"/>
+ </param>
+ <param name="amount">
+ <real value="0.7500000000"/>
+ </param>
+ <param name="blend_method">
+ <integer value="12"/>
+ </param>
+ <param name="color">
+ <color>
+ <r>0.000000</r>
+ <g>0.000000</g>
+ <b>0.000000</b>
+ <a>1.000000</a>
+ </color>
+ </param>
+ <param name="offset">
+ <vector>
+ <x>0.1000000015</x>
+ <y>-0.1000000015</y>
+ </vector>
+ </param>
+ <param name="size">
+ <vector>
+ <x>0.2000000030</x>
+ <y>0.2000000030</y>
+ </vector>
+ </param>
+ <param name="type">
+ <integer value="1"/>
+ </param>
+ <param name="invert">
+ <bool value="false"/>
+ </param>
+ </layer>
+</canvas>
+++ /dev/null
-[Desktop Entry]
-Name=@PACKAGE_NAME@
-Comment=A Powerful 2D Animation and Composition Package
-Exec=@prefix@/bin/sinfgstudio
-Terminal=1
-Type=Application
-Icon=@prefix@/share/pixmaps/sinfg_icon.@imageext@
-Categories=Application;Graphics;
-StartupNotify=true
-Encoding=UTF-8
-MimeType=image/sif
+++ /dev/null
-
-image/sif:
- open=@prefix@/bin/sinfgstudio %f
- view=@prefix@/bin/sinfgstudio %f
- icon-filename=@prefix@/share/pixmaps/sif_icon.@imageext@
- description=SINFG Composition
- default_action_type=application
- short_list_application_ids_for_novice_user_level=sinfgstudio
- short_list_application_ids_for_intermediate_user_level=sinfgstudio
- short_list_application_ids_for_advanced_user_level=sinfgstudio
-# category=Images
-
-
-image/sifz:
- open=@prefix@/bin/sinfgstudio %f
- view=@prefix@/bin/sinfgstudio %f
- icon-filename=@prefix@/share/pixmaps/sif_icon.@imageext@
- description=Compressed SINFG Composition
- default_action_type=application
- short_list_application_ids_for_novice_user_level=sinfgstudio
- short_list_application_ids_for_intermediate_user_level=sinfgstudio
- short_list_application_ids_for_advanced_user_level=sinfgstudio
-# category=Images
+++ /dev/null
-# mime types for sinfg studio
-
-image/sif
- ext: sif SIF
-
-image/sifz
- ext: sifZ SIFZ sif.gz SIF.GZ SIF.gz
MAINTAINERCLEANFILES=Makefile.in
EXTRA_DIST=template.cpp template.h
-SUBDIRS=sinfgapp gtkmm
+SUBDIRS=synfigapp gtkmm
#if WINDOWSYS_GTKMM
#WINDOWSYS_LIBS=$(top_builddir)/src/gtkmm/libwindowsys.a @GTKMM_LIBS@
-#SUBDIRS=sinfgapp gtkmm
+#SUBDIRS=synfigapp gtkmm
#else
#WINDOWSYS_LIBS=$(top_builddir)/src/win32/libwindowsys.a @WIN32_LIBS@
#SUBDIRS=win32
#endif
-#bin_PROGRAMS = sinfgstudio
-#sinfgstudio_SOURCES = main.cpp app.cpp app.h instance.cpp instance.h actions.cpp actions.h toolbox.cpp toolbox.h compview.cpp compview.h canvasview.cpp canvasview.h workarea.cpp workarea.h canvasproperties.cpp canvasproperties.h
+#bin_PROGRAMS = synfigstudio
+#synfigstudio_SOURCES = main.cpp app.cpp app.h instance.cpp instance.h actions.cpp actions.h toolbox.cpp toolbox.h compview.cpp compview.h canvasview.cpp canvasview.h workarea.cpp workarea.h canvasproperties.cpp canvasproperties.h
# view.h view.cpp workarea.cpp workarea.h toolbox.cpp toolbox.h trackview.cpp trackview.h actions.cpp actions.h compview.cpp compview.h
-#sinfgstudio_LDADD = @SINFG_LIBS@ $(WINDOWSYS_LIBS)
-#sinfgstudio_LDFLAGS=-dlopen self
+#synfigstudio_LDADD = @SYNFIG_LIBS@ $(WINDOWSYS_LIBS)
+#synfigstudio_LDFLAGS=-dlopen self
INCLUDES=-I$(top_srcdir)/src
-bin_PROGRAMS = sinfgstudio
-sinfgstudio_SOURCES = $(MOD_MIRROR_CC) $(MOD_MIRROR_HH) $(PALETTE_CC) $(PALETTE_HH) $(WORKAREARENDERER_CC) $(WORKAREARENDERER_HH) $(ACTION_MANAGERS_HH) $(ACTION_MANAGERS_CC) $(DOCK_HH) $(DOCK_CC) $(OTHER_HH) $(OTHER_CC) $(EVENTS_HH) $(EVENTS_CC) $(DUCKTRANSFORM_HH) $(DUCKTRANSFORM_CC) $(TREEVIEW_HH) $(TREEVIEW_CC) $(TREESTORE_HH) $(TREESTORE_CC) $(STATE_CC) $(STATE_HH) $(WIDGET_CC) $(WIDGET_HH) $(DIALOG_HH) $(DIALOG_CC) $(CELLRENDERER_HH) $(CELLRENDERER_CC)
-sinfgstudio_LDADD = -L../sinfgapp -lsinfgapp @SINFG_LIBS@ @GTKMM_LIBS@ @FMOD_LIBS@
-sinfgstudio_LDFLAGS=-dlopen self
-sinfgstudio_CXXFLAGS=@SINFG_CFLAGS@ @GTKMM_CFLAGS@
+bin_PROGRAMS = synfigstudio
+synfigstudio_SOURCES = $(MOD_MIRROR_CC) $(MOD_MIRROR_HH) $(PALETTE_CC) $(PALETTE_HH) $(WORKAREARENDERER_CC) $(WORKAREARENDERER_HH) $(ACTION_MANAGERS_HH) $(ACTION_MANAGERS_CC) $(DOCK_HH) $(DOCK_CC) $(OTHER_HH) $(OTHER_CC) $(EVENTS_HH) $(EVENTS_CC) $(DUCKTRANSFORM_HH) $(DUCKTRANSFORM_CC) $(TREEVIEW_HH) $(TREEVIEW_CC) $(TREESTORE_HH) $(TREESTORE_CC) $(STATE_CC) $(STATE_HH) $(WIDGET_CC) $(WIDGET_HH) $(DIALOG_HH) $(DIALOG_CC) $(CELLRENDERER_HH) $(CELLRENDERER_CC)
+synfigstudio_LDADD = -L../synfigapp -lsynfigapp @SYNFIG_LIBS@ @GTKMM_LIBS@ @FMOD_LIBS@
+synfigstudio_LDFLAGS=-dlopen self
+synfigstudio_CXXFLAGS=@SYNFIG_CFLAGS@ @GTKMM_CFLAGS@
/*! ========================================================================
-** Sinfg
+** Synfig
** Template File
** $Id: about.cpp,v 1.2 2005/01/13 21:11:16 darco Exp $
**
#include <gtkmm/label.h>
#include <gtkmm/fixed.h>
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include "about.h"
#include "app.h"
#ifndef VERSION
#define VERSION "unknown"
-#define PACKAGE "sinfgstudio"
+#define PACKAGE "synfigstudio"
#endif
#ifdef WIN32
/* === P R O C E D U R E S ================================================= */
-class studio::AboutProgress : public sinfg::ProgressCallback
+class studio::AboutProgress : public synfig::ProgressCallback
{
About &about;
Logo->set_padding(0,0);
// Create the Copyright Label
- Gtk::Label *CopyrightLabel = manage(new class Gtk::Label(SINFG_COPYRIGHT));
+ Gtk::Label *CopyrightLabel = manage(new class Gtk::Label(SYNFIG_COPYRIGHT));
CopyrightLabel->set_size_request(image_w,24);
CopyrightLabel->set_alignment(0.5,0.5);
CopyrightLabel->set_padding(0,0);
// Set the version label to contain the correct information
string ver;
ver+="Version "VERSION" ("__DATE__" "__TIME__")\n";
- ver+="Using SINFG ";
- ver+=sinfg::get_version();
+ ver+="Using SYNFIG ";
+ ver+=synfig::get_version();
#ifdef __GNUC__
ver+=strprintf(" and GNU G++ %d.%d.%d",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
#endif
fixed1->put(*tasklabel, 0, image_h);
// Set up the parameters for this pop-up window
- set_title("Sinfg Studio "VERSION);
+ set_title("Synfig Studio "VERSION);
set_modal(false);
property_window_position().set_value(Gtk::WIN_POS_CENTER);
set_resizable(false);
CloseButton->hide();
}
-sinfg::ProgressCallback *
+synfig::ProgressCallback *
About::get_callback()
{
return cb;
/*! ========================================================================
-** Sinfg
+** Synfig
** Template Header File
** $Id: about.h,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_ABOUT_H
-#define __SINFG_GTKMM_ABOUT_H
+#ifndef __SYNFIG_GTKMM_ABOUT_H
+#define __SYNFIG_GTKMM_ABOUT_H
/* === H E A D E R S ======================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfg { class ProgressCallback; };
+namespace synfig { class ProgressCallback; };
namespace studio {
public:
- sinfg::ProgressCallback *get_callback();
+ synfig::ProgressCallback *get_callback();
void set_can_self_destruct(bool x);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file adjust_window.cpp
** \brief Adjustment Window Implementation File
**
using namespace std;
//using namespace etl;
-//using namespace sinfg;
+//using namespace synfig;
using studio::Adjust_Window;
adj_child = child;
- sinfg::info("Adjust: connecting to child signals");
+ synfig::info("Adjust: connecting to child signals");
if(child)
{
childchanged = child->signal_changed().connect(sigc::mem_fun(*this,&Adjust_Window::update_fromchild));
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file adjust_window.h
** \brief Adjustment Window Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_TEMPLATE_H
-#define __SINFG_TEMPLATE_H
+#ifndef __SYNFIG_TEMPLATE_H
+#define __SYNFIG_TEMPLATE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/adjustment.h>
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file app.cpp
** \brief writeme
**
#include <gtk/gtk.h>
-#include <sinfg/loadcanvas.h>
+#include <synfig/loadcanvas.h>
#include "app.h"
#include "about.h"
#include "autorecover.h"
-#include <sinfgapp/settings.h>
+#include <synfigapp/settings.h>
#include "dock_history.h"
#include "dock_canvases.h"
#include "dock_keyframes.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
# define IMAGE_EXT "tif"
#endif
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
/* === S I G N A L S ======================================================= */
int App::Busy::count;
bool App::shutdown_in_progress;
-sinfg::Gamma App::gamma;
+synfig::Gamma App::gamma;
Glib::RefPtr<studio::UIManager> App::ui_manager_;
-sinfg::Distance::System App::distance_system;
+synfig::Distance::System App::distance_system;
studio::Dialog_Setup* App::dialog_setup;
std::list<etl::handle<Instance> > App::instance_list;
-static etl::handle<sinfgapp::UIInterface> ui_interface_;
-const etl::handle<sinfgapp::UIInterface>& App::get_ui_interface() { return ui_interface_; }
+static etl::handle<synfigapp::UIInterface> ui_interface_;
+const etl::handle<synfigapp::UIInterface>& App::get_ui_interface() { return ui_interface_; }
etl::handle<Instance> App::selected_instance;
etl::handle<CanvasView> App::selected_canvas_view;
int studio::App::get_max_recent_files() { return max_recent_files_; }
void studio::App::set_max_recent_files(int x) { max_recent_files_=x; }
-static sinfg::String app_base_path_;
+static synfig::String app_base_path_;
namespace studio {
}; // END of namespace studio
-class GlobalUIInterface : public sinfgapp::UIInterface
+class GlobalUIInterface : public synfigapp::UIInterface
{
public:
fclose(file);
}
else
- sinfg::error("Unable to save license key!");
+ synfig::error("Unable to save license key!");
}
- sinfg::info("License Authenticated -- Serial #%05d",serial);
+ synfig::info("License Authenticated -- Serial #%05d",serial);
return serial;
}
Gtk::UIManager::remove_action_group(action_group);
return;
}
- sinfg::error("Unable to find action group");
+ synfig::error("Unable to find action group");
}
void
DEBUGPOINT();
if(*iter && (*iter)->get_name()!="menus")
{
- sinfg::info("Removing action group "+(*iter)->get_name());
+ synfig::info("Removing action group "+(*iter)->get_name());
ui_manager->remove_action_group(*iter);
}
}
DEBUGPOINT();
}
*/
-class Preferences : public sinfgapp::Settings
+class Preferences : public synfigapp::Settings
{
public:
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const
{
if(key=="gamma")
{
return true;
}
- return sinfgapp::Settings::get_value(key,value);
+ return synfigapp::Settings::get_value(key,value);
}
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value)
+ virtual bool set_value(const synfig::String& key,const synfig::String& value)
{
if(key=="gamma")
{
if(key=="time_format")
{
int i(atoi(value.c_str()));
- App::set_time_format(static_cast<sinfg::Time::Format>(i));
+ App::set_time_format(static_cast<synfig::Time::Format>(i));
return true;
}
if(key=="auto_recover_backup_interval")
return true;
}
- return sinfgapp::Settings::set_value(key,value);
+ return synfigapp::Settings::set_value(key,value);
}
virtual KeyList get_key_list()const
{
- KeyList ret(sinfgapp::Settings::get_key_list());
+ KeyList ret(synfigapp::Settings::get_key_list());
ret.push_back("gamma");
ret.push_back("time_format");
ret.push_back("distance_system");
menus_action_group->add( Gtk::Action::create("menu-state", "State") );
menus_action_group->add( Gtk::Action::create("menu-toolbox", "Toolbox") );
- // Add the sinfgapp actions...
- sinfgapp::Action::Book::iterator iter;
- for(iter=sinfgapp::Action::book().begin();iter!=sinfgapp::Action::book().end();++iter)
+ // Add the synfigapp actions...
+ synfigapp::Action::Book::iterator iter;
+ for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter)
{
actions_action_group->add(Gtk::Action::create(
"action-"+iter->second.name,
#define DEFINE_ACTION_SIG(group,x,stock,sig) { Glib::RefPtr<Gtk::Action> action( Gtk::Action::create(x, stock) ); /*action->set_sensitive(false);*/ group->add(action,sig); }
DEFINE_ACTION2("keyframe-properties", Gtk::StockID("gtk-properties"), _("Keyframe Properties"));
- DEFINE_ACTION("about", Gtk::StockID("sinfg-about"));
+ DEFINE_ACTION("about", Gtk::StockID("synfig-about"));
DEFINE_ACTION("open", Gtk::Stock::OPEN);
DEFINE_ACTION("save", Gtk::Stock::SAVE);
DEFINE_ACTION("save-as", Gtk::Stock::SAVE_AS);
DEFINE_ACTION("revert", Gtk::Stock::REVERT_TO_SAVED);
- DEFINE_ACTION("cvs-add", Gtk::StockID("sinfg-cvs_add"));
- DEFINE_ACTION("cvs-update", Gtk::StockID("sinfg-cvs_update"));
- DEFINE_ACTION("cvs-commit", Gtk::StockID("sinfg-cvs_commit"));
- DEFINE_ACTION("cvs-revert", Gtk::StockID("sinfg-cvs_revert"));
+ DEFINE_ACTION("cvs-add", Gtk::StockID("synfig-cvs_add"));
+ DEFINE_ACTION("cvs-update", Gtk::StockID("synfig-cvs_update"));
+ DEFINE_ACTION("cvs-commit", Gtk::StockID("synfig-cvs_commit"));
+ DEFINE_ACTION("cvs-revert", Gtk::StockID("synfig-cvs_revert"));
DEFINE_ACTION("import", _("Import"));
DEFINE_ACTION("render", _("Render"));
DEFINE_ACTION("preview", _("Preview"));
#undef DEFINE_ACTION
-// Set up sinfgapp actions
+// Set up synfigapp actions
/*{
- sinfgapp::Action::Book::iterator iter;
+ synfigapp::Action::Book::iterator iter;
- for(iter=sinfgapp::Action::book().begin();iter!=sinfgapp::Action::book().end();++iter)
+ for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter)
{
Gtk::StockID stock_id;
- if(!(iter->second.category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->second.category&synfigapp::Action::CATEGORY_HIDDEN))
{
//Gtk::Image* image(manage(new Gtk::Image()));
if(iter->second.task=="raise") stock_id=Gtk::Stock::GO_UP;
else if(iter->second.task=="set_off") stock_id=Gtk::Stock::NO;
//else if(iter->second.task=="duplicate") stock_id=Gtk::Stock::COPY;
else if(iter->second.task=="remove") stock_id=Gtk::Stock::DELETE;
- else stock_id=Gtk::StockID("sinfg-"+iter->second.task);
+ else stock_id=Gtk::StockID("synfig-"+iter->second.task);
actions_action_group->add(Gtk::Action::create(
"action-"+iter->second.name,
}
catch(const Glib::Error& ex)
{
- sinfg::error("building menus and toolbars failed: " + ex.what());
+ synfig::error("building menus and toolbars failed: " + ex.what());
}
// Add default keyboard accelerators
if(mkdir(get_user_app_directory().c_str(),ACCESSPERMS)<0)
{
if(errno!=EEXIST)
- sinfg::error("UNABLE TO CREATE \"%s\"",get_user_app_directory().c_str());
+ synfig::error("UNABLE TO CREATE \"%s\"",get_user_app_directory().c_str());
}
else
{
- sinfg::info("Created directory \"%s\"",get_user_app_directory().c_str());
+ synfig::info("Created directory \"%s\"",get_user_app_directory().c_str());
}
try
{
- if(!SINFG_CHECK_VERSION())
+ if(!SYNFIG_CHECK_VERSION())
{
- cerr<<"FATAL: Sinfg Version Mismatch"<<endl;
- dialog_error_blocking("SINFG Studio",
- "This copy of SINFG Studio was compiled against a\n"
- "different version of libsinfg than what is currently\n"
- "installed. Sinfg Studio will now abort. Try downloading\n"
- "the latest version from the SINFG Development Website at\n"
- "http://dev.sinfg.com/ "
+ cerr<<"FATAL: Synfig Version Mismatch"<<endl;
+ dialog_error_blocking("SYNFIG Studio",
+ "This copy of SYNFIG Studio was compiled against a\n"
+ "different version of libsynfig than what is currently\n"
+ "installed. Synfig Studio will now abort. Try downloading\n"
+ "the latest version from the SYNFIG Development Website at\n"
+ "http://dev.synfig.com/ "
);
throw 40;
}
}
- catch(sinfg::SoftwareExpired)
+ catch(synfig::SoftwareExpired)
{
cerr<<"FATAL: Software Expired"<<endl;
- dialog_error_blocking("SINFG Studio",
- "This copy of SINFG Studio has expired.\n"
+ dialog_error_blocking("SYNFIG Studio",
+ "This copy of SYNFIG Studio has expired.\n"
"Please erase this copy, or download and\n"
- "install the latest copy from the SINFG\n"
- "Development Website at http://dev.sinfg.com/ ."
+ "install the latest copy from the SYNFIG\n"
+ "Development Website at http://dev.synfig.com/ ."
);
throw 39;
}
- Glib::set_application_name(_("SINFG Studio"));
+ Glib::set_application_name(_("SYNFIG Studio"));
About about_window;
about_window.set_can_self_destruct(false);
about_window.show();
shutdown_in_progress=false;
- SuperCallback sinfg_init_cb(about_window.get_callback(),0,9000,10000);
+ SuperCallback synfig_init_cb(about_window.get_callback(),0,9000,10000);
SuperCallback studio_init_cb(about_window.get_callback(),9000,10000,10000);
- // Initialize the Sinfg library
- try { sinfgapp_main=etl::smart_ptr<sinfgapp::Main>(new sinfgapp::Main(etl::dirname((*argv)[0]),&sinfg_init_cb)); }
+ // Initialize the Synfig library
+ try { synfigapp_main=etl::smart_ptr<synfigapp::Main>(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); }
catch(...)
{
- get_ui_interface()->error("Failed to initialize sinfg!");
+ get_ui_interface()->error("Failed to initialize synfig!");
throw;
}
// add the preferences to the settings
- sinfgapp::Main::settings().add_domain(&_preferences,"pref");
+ synfigapp::Main::settings().add_domain(&_preferences,"pref");
try
{
if(
get_ui_interface()->yes_no(
"Auto Recovery",
- "SINFG Studio seems to have crashed\n"
+ "SYNFIG Studio seems to have crashed\n"
"before you could save all your files.\n"
"Would you like to re-open those files\n"
"and recover your unsaved changes?"
- )==sinfgapp::UIInterface::RESPONSE_YES
+ )==synfigapp::UIInterface::RESPONSE_YES
)
{
if(!auto_recover->recover())
}
else
get_ui_interface()->error(
- _("SINFG Studio has attempted to recover\n"
+ _("SYNFIG Studio has attempted to recover\n"
"from a previous crash. The files that it has\n"
"recovered are NOT YET SAVED. It would be a good\n"
"idea to review them and save them now.")
save_settings();
- sinfgapp::Main::settings().remove_domain("pref");
+ synfigapp::Main::settings().remove_domain("pref");
selected_instance=0;
String
App::get_user_app_directory()
{
- return Glib::build_filename(Glib::get_home_dir(),"sinfg");
+#ifdef __APPLE__
+ return Glib::build_filename(Glib::get_home_dir(),"Library/Synfig");
+#else
+ return Glib::build_filename(Glib::get_home_dir(),"Synfig");
+#endif
}
-sinfg::String
-App::get_config_file(const sinfg::String& file)
+synfig::String
+App::get_config_file(const synfig::String& file)
{
return Glib::build_filename(get_user_app_directory(),file);
}
}
void
-App::set_time_format(sinfg::Time::Format x)
+App::set_time_format(synfig::Time::Format x)
{
_App_time_format=x;
}
if(!file)
{
- sinfg::warning("Unable to save %s",filename.c_str());
+ synfig::warning("Unable to save %s",filename.c_str());
break;
}
}while(0);
std::string filename=get_config_file("settings");
- sinfgapp::Main::settings().save_to_file(filename);
+ synfigapp::Main::settings().save_to_file(filename);
}
catch(...)
{
- sinfg::warning("Caught exception when attempting to save settings.");
+ synfig::warning("Caught exception when attempting to save settings.");
}
}
}
}
std::string filename=get_config_file("settings");
- if(!sinfgapp::Main::settings().load_from_file(filename))
+ if(!synfigapp::Main::settings().load_from_file(filename))
{
- //std::string filename=Glib::build_filename(Glib::get_home_dir(),".sinfgrc");
- //if(!sinfgapp::Main::settings().load_from_file(filename))
+ //std::string filename=Glib::build_filename(Glib::get_home_dir(),".synfigrc");
+ //if(!synfigapp::Main::settings().load_from_file(filename))
{
gamma.set_gamma(1.0/2.2);
- sinfgapp::Main::settings().set_value("dock.dialog.1.comp_selector","1");
- sinfgapp::Main::settings().set_value("dock.dialog.1.contents","navigator - info pal_edit pal_browse - tool_options history canvases - layers groups");
- sinfgapp::Main::settings().set_value("dock.dialog.1.contents_size","225 167 207");
- sinfgapp::Main::settings().set_value("dock.dialog.1.pos","1057 32");
- sinfgapp::Main::settings().set_value("dock.dialog.1.size","208 1174");
- sinfgapp::Main::settings().set_value("dock.dialog.2.comp_selector","0");
- sinfgapp::Main::settings().set_value("dock.dialog.2.contents","params children keyframes | timetrack curves meta_data");
- sinfgapp::Main::settings().set_value("dock.dialog.2.contents_size","263");
- sinfgapp::Main::settings().set_value("dock.dialog.2.pos","0 973");
- sinfgapp::Main::settings().set_value("dock.dialog.2.size","1045 235");
- sinfgapp::Main::settings().set_value("pref.distance_system","pt");
- sinfgapp::Main::settings().set_value("pref.use_colorspace_gamma","1");
- sinfgapp::Main::settings().set_value("window.toolbox.pos","4 4");
+ synfigapp::Main::settings().set_value("dock.dialog.1.comp_selector","1");
+ synfigapp::Main::settings().set_value("dock.dialog.1.contents","navigator - info pal_edit pal_browse - tool_options history canvases - layers groups");
+ synfigapp::Main::settings().set_value("dock.dialog.1.contents_size","225 167 207");
+ synfigapp::Main::settings().set_value("dock.dialog.1.pos","1057 32");
+ synfigapp::Main::settings().set_value("dock.dialog.1.size","208 1174");
+ synfigapp::Main::settings().set_value("dock.dialog.2.comp_selector","0");
+ synfigapp::Main::settings().set_value("dock.dialog.2.contents","params children keyframes | timetrack curves meta_data");
+ synfigapp::Main::settings().set_value("dock.dialog.2.contents_size","263");
+ synfigapp::Main::settings().set_value("dock.dialog.2.pos","0 973");
+ synfigapp::Main::settings().set_value("dock.dialog.2.size","1045 235");
+ synfigapp::Main::settings().set_value("pref.distance_system","pt");
+ synfigapp::Main::settings().set_value("pref.use_colorspace_gamma","1");
+ synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
}
}
}
catch(...)
{
- sinfg::warning("Caught exception when attempting to load settings.");
+ synfig::warning("Caught exception when attempting to load settings.");
}
}
return;
/*
- if((*iter)->sinfgapp::Instance::get_action_count())
+ if((*iter)->synfigapp::Instance::get_action_count())
{
- handle<sinfgapp::UIInterface> uim;
+ handle<synfigapp::UIInterface> uim;
uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface();
assert(uim);
string str=strprintf(_("Would you like to save your changes to %s?"),(*iter)->get_file_name().c_str() );
- switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES))
+ switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES))
{
- case sinfgapp::UIInterface::RESPONSE_NO:
+ case synfigapp::UIInterface::RESPONSE_NO:
break;
- case sinfgapp::UIInterface::RESPONSE_YES:
+ case synfigapp::UIInterface::RESPONSE_YES:
(*iter)->save();
break;
- case sinfgapp::UIInterface::RESPONSE_CANCEL:
+ case synfigapp::UIInterface::RESPONSE_CANCEL:
return;
default:
assert(0);
}
- if((*iter)->sinfgapp::Instance::is_modified())
+ if((*iter)->synfigapp::Instance::is_modified())
{
- handle<sinfgapp::UIInterface> uim;
+ handle<synfigapp::UIInterface> uim;
uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface();
assert(uim);
string str=strprintf(_("%s has changes not yet on the CVS repository.\nWould you like to commit these changes?"),(*iter)->get_file_name().c_str() );
- switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES))
+ switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES))
{
- case sinfgapp::UIInterface::RESPONSE_NO:
+ case synfigapp::UIInterface::RESPONSE_NO:
break;
- case sinfgapp::UIInterface::RESPONSE_YES:
+ case synfigapp::UIInterface::RESPONSE_YES:
(*iter)->dialog_cvs_commit();
break;
- case sinfgapp::UIInterface::RESPONSE_CANCEL:
+ case synfigapp::UIInterface::RESPONSE_CANCEL:
return;
default:
assert(0);
return false;
#else
- sinfg::String prev_path;
+ synfig::String prev_path;
if(!_preferences.get_value("curr_path",prev_path))
prev_path=".";
{
OneMoment one_moment;
- etl::handle<sinfg::Canvas> canvas(open_canvas_as(filename,as));
+ etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as));
if(canvas && get_instance(canvas))
{
get_instance(canvas)->find_canvas_view(canvas)->present();
void
App::new_instance()
{
- handle<sinfg::Canvas> canvas=sinfg::Canvas::create();
+ handle<synfig::Canvas> canvas=synfig::Canvas::create();
canvas->set_name(strprintf("Untitled%d",Instance::get_count()));
String file_name(strprintf("untitled%d.sif",Instance::get_count()));
selected_instance->redo();
}
-sinfg::String
+synfig::String
studio::App::get_base_path()
{
return app_base_path_;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file app.h
** \brief writeme
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_APP_H
-#define __SINFG_STUDIO_APP_H
+#ifndef __SYNFIG_STUDIO_APP_H
+#define __SYNFIG_STUDIO_APP_H
/* === H E A D E R S ======================================================= */
#include <ETL/smart_ptr>
-#include <sinfg/distance.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfig/distance.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
#include <gtkmm/uimanager.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/instance.h>
#include "iconcontroler.h"
/* === M A C R O S ========================================================= */
class ActionGroup;
};
-namespace sinfgapp
+namespace synfigapp
{
class UIInterface;
class Main;
*/
private:
- //static etl::handle<sinfgapp::UIInterface> ui_interface_;
+ //static etl::handle<synfigapp::UIInterface> ui_interface_;
//static int max_recent_files;
/*
static IPC *ipc;
*/
- etl::smart_ptr<sinfgapp::Main> sinfgapp_main;
+ etl::smart_ptr<synfigapp::Main> synfigapp_main;
static etl::handle<Instance> selected_instance;
// static Dialog_Palette* dialog_palette;
static Dialog_ToolOptions *dialog_tool_options;
- static sinfg::Distance::System distance_system;
+ static synfig::Distance::System distance_system;
- static sinfg::Gamma gamma;
+ static synfig::Gamma gamma;
static Toolbox *toolbox;
static void add_recent_file(const std::string &filename);
- static sinfg::String get_base_path();
+ static synfig::String get_base_path();
static void save_settings();
static void load_settings();
static const std::list<std::string>& get_recent_files();
- static const etl::handle<sinfgapp::UIInterface>& get_ui_interface();
+ static const etl::handle<synfigapp::UIInterface>& get_ui_interface();
static void set_selected_instance(etl::loose_handle<Instance> instance);
static void set_selected_canvas_view(etl::loose_handle<CanvasView>);
- static etl::loose_handle<Instance> get_instance(etl::handle<sinfg::Canvas> canvas);
+ static etl::loose_handle<Instance> get_instance(etl::handle<synfig::Canvas> canvas);
static etl::loose_handle<Instance> get_selected_instance() { return selected_instance; }
static etl::loose_handle<CanvasView> get_selected_canvas_view() { return selected_canvas_view; }
static void set_max_recent_files(int x);
- static sinfg::Time::Format get_time_format();
- static void set_time_format(sinfg::Time::Format x);
+ static synfig::Time::Format get_time_format();
+ static void set_time_format(synfig::Time::Format x);
static bool shutdown_request(GdkEventAny*bleh=NULL);
static void dialog_not_implemented();
- static sinfg::String get_user_app_directory();
- static sinfg::String get_config_file(const sinfg::String& file);
+ static synfig::String get_user_app_directory();
+ static synfig::String get_config_file(const synfig::String& file);
}; // END of class App
}; // END namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file asyncrenderer.cpp
** \brief Template File
**
#include <signal.h>
#endif
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include <ETL/clock>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
#define BOREDOM_TIMEOUT 50
/* === C L A S S E S ======================================================= */
-class AsyncTarget_Tile : public sinfg::Target_Tile
+class AsyncTarget_Tile : public synfig::Target_Tile
{
public:
- etl::handle<sinfg::Target_Tile> warm_target;
+ etl::handle<synfig::Target_Tile> warm_target;
struct tile_t
{
sigc::connection ready_connection;
public:
- AsyncTarget_Tile(etl::handle<sinfg::Target_Tile> warm_target):
+ AsyncTarget_Tile(etl::handle<synfig::Target_Tile> warm_target):
warm_target(warm_target)
{
set_avoid_time_sync(warm_target->get_avoid_time_sync());
return warm_target->next_frame(time);
}
- virtual bool start_frame(sinfg::ProgressCallback *cb=0)
+ virtual bool start_frame(synfig::ProgressCallback *cb=0)
{
if(!alive_flag)
return false;
return warm_target->start_frame(cb);
}
- virtual bool add_tile(const sinfg::Surface &surface, int gx, int gy)
+ virtual bool add_tile(const synfig::Surface &surface, int gx, int gy)
{
assert(surface);
if(!alive_flag)
-class AsyncTarget_Scanline : public sinfg::Target_Scanline
+class AsyncTarget_Scanline : public synfig::Target_Scanline
{
public:
- etl::handle<sinfg::Target_Scanline> warm_target;
+ etl::handle<synfig::Target_Scanline> warm_target;
int scanline_;
Surface surface;
public:
- AsyncTarget_Scanline(etl::handle<sinfg::Target_Scanline> warm_target):
+ AsyncTarget_Scanline(etl::handle<synfig::Target_Scanline> warm_target):
warm_target(warm_target)
{
set_avoid_time_sync(warm_target->get_avoid_time_sync());
alive_flag=false;
}
- virtual bool start_frame(sinfg::ProgressCallback *cb=0)
+ virtual bool start_frame(synfig::ProgressCallback *cb=0)
{
return alive_flag;
}
/* === M E T H O D S ======================================================= */
-AsyncRenderer::AsyncRenderer(etl::handle<sinfg::Target> target_,sinfg::ProgressCallback *cb):
+AsyncRenderer::AsyncRenderer(etl::handle<synfig::Target> target_,synfig::ProgressCallback *cb):
error(false),
success(false),
cb(cb)
{
render_thread=0;
- if(etl::handle<sinfg::Target_Tile>::cast_dynamic(target_))
+ if(etl::handle<synfig::Target_Tile>::cast_dynamic(target_))
{
etl::handle<AsyncTarget_Tile> wrap_target(
- new AsyncTarget_Tile(etl::handle<sinfg::Target_Tile>::cast_dynamic(target_))
+ new AsyncTarget_Tile(etl::handle<synfig::Target_Tile>::cast_dynamic(target_))
);
signal_stop_.connect(sigc::mem_fun(*wrap_target,&AsyncTarget_Tile::set_dead));
target=wrap_target;
}
- else if(etl::handle<sinfg::Target_Scanline>::cast_dynamic(target_))
+ else if(etl::handle<synfig::Target_Scanline>::cast_dynamic(target_))
{
etl::handle<AsyncTarget_Scanline> wrap_target(
new AsyncTarget_Scanline(
- etl::handle<sinfg::Target_Scanline>::cast_dynamic(target_)
+ etl::handle<synfig::Target_Scanline>::cast_dynamic(target_)
)
);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file asyncrenderer.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_ASYNCRENDERER_H
-#define __SINFG_ASYNCRENDERER_H
+#ifndef __SYNFIG_ASYNCRENDERER_H
+#define __SYNFIG_ASYNCRENDERER_H
/* === H E A D E R S ======================================================= */
#include <sigc++/trackable.h>
#include <sigc++/connection.h>
-#include <sinfg/target_scanline.h>
-#include <sinfg/target_tile.h>
-#include <sinfg/surface.h>
+#include <synfig/target_scanline.h>
+#include <synfig/target_tile.h>
+#include <synfig/surface.h>
#include <glibmm/main.h>
#include <ETL/ref_count>
#include <glibmm/thread.h>
std::list<sigc::connection> activity_connection_list;
- //etl::handle<sinfg::Target_Scanline> target_scanline;
- //etl::handle<sinfg::Target_Tile> target_tile;
- etl::handle<sinfg::Target> target;
+ //etl::handle<synfig::Target_Scanline> target_scanline;
+ //etl::handle<synfig::Target_Tile> target_tile;
+ etl::handle<synfig::Target> target;
bool error;
bool success;
- sinfg::ProgressCallback *cb;
+ synfig::ProgressCallback *cb;
sigc::signal<void> signal_stop_;
*/
public:
- AsyncRenderer(etl::handle<sinfg::Target> target,sinfg::ProgressCallback *cb=0);
+ AsyncRenderer(etl::handle<synfig::Target> target,synfig::ProgressCallback *cb=0);
virtual ~AsyncRenderer();
void start();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file audiocontainer.cpp
** \brief Audio Container implementation File
**
//#include <ETL/thread>
#include <glibmm/thread.h>
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include <glibmm/main.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
#ifdef __WIN32
//trivial rejection...
if(!sample || sps < 1)
{
- sinfg::warning("build_profile: Sample rate was too low or sample was invalid");
+ synfig::warning("build_profile: Sample rate was too low or sample was invalid");
return false;
}
if(sizeall <= 0)
{
- sinfg::warning("ProfileAudio: Sample buffer cannot be size smaller than 1 (%X)",FSOUND_GetError());
+ synfig::warning("ProfileAudio: Sample buffer cannot be size smaller than 1 (%X)",FSOUND_GetError());
return false;
}
float stride = allsamplerate/(float)sps;
//down sampling to 8 bit min/max values
- sinfg::warning("About to downsample from %d Hz to %.1f Hz, sample stride: %f", allsamplerate, sps, stride);
+ synfig::warning("About to downsample from %d Hz to %.1f Hz, sample stride: %f", allsamplerate, sps, stride);
char *sampledata=0,*useless = 0;
unsigned int len1,len2;
{
if(!FSOUND_Sample_Lock(sample,0,sizeall,(void**)&sampledata,(void**)&useless,&len1,&len2))
{
- sinfg::warning("ProfileAudio: Unable to lock the sound buffer... (%X)",FSOUND_GetError());
+ synfig::warning("ProfileAudio: Unable to lock the sound buffer... (%X)",FSOUND_GetError());
return false;
}
- sinfg::warning("Locked: %X: %d bytes, %X: %d bytes",sampledata,len1,useless,len2);
+ synfig::warning("Locked: %X: %d bytes, %X: %d bytes",sampledata,len1,useless,len2);
if(channelsize == 1)
{
int i = 0;
//HACK - to prevent if statement inside inner loop
- //sinfg::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall);
+ //synfig::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall);
while(iter < end)
{
int maxs = 0, mins = 0;
int i = 0;
//HACK - to prevent if statement inside inner loop
- //sinfg::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall);
+ //synfig::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall);
while(iter < end)
{
int maxs = 0, mins = 0;
}
}
- sinfg::warning("Stats: %f seconds with %d bytes now %d bytes", (samples.size()/2)/sps, sizeall, samples.size());
- sinfg::warning(" %f seconds before", numsamples/(float)allsamplerate);
+ synfig::warning("Stats: %f seconds with %d bytes now %d bytes", (samples.size()/2)/sps, sizeall, samples.size());
+ synfig::warning(" %f seconds before", numsamples/(float)allsamplerate);
//we're done yay!, unlock
FSOUND_Sample_Unlock(sample,sampledata,useless,len1,len2);
- sinfg::info("Unlocked");
+ synfig::info("Unlocked");
//FSOUND_PlaySound(FSOUND_FREE,sound); //test
FSOUND_SetPaused(channel,true);
}else
{
- //sinfg::info("DSP f = %d Hz", freq);
+ //synfig::info("DSP f = %d Hz", freq);
FSOUND_SetPaused(channel,false);
if(!FSOUND_SetFrequency(channel,freq))
{
}
}
- //sinfg::info(dsp);
+ //synfig::info(dsp);
return newbuffer;
}
if(!loaded)
{
#ifdef WITH_FMOD
- sinfg::info("Initializing FMOD on demand...");
+ synfig::info("Initializing FMOD on demand...");
{
FSOUND_SetOutput(AUDIO_OUTPUT);
/*int numdrivers = FSOUND_GetNumDrivers();
- sinfg::info("Num FMOD drivers = %d",numdrivers);
- sinfg::info("Current Driver is #%d", FSOUND_GetDriver());
+ synfig::info("Num FMOD drivers = %d",numdrivers);
+ synfig::info("Current Driver is #%d", FSOUND_GetDriver());
for(int i = 0; i < numdrivers; ++i)
{
unsigned int caps = 0;
FSOUND_GetDriverCaps(i,&caps);
- sinfg::info(" Caps for driver %d (%s) = %x",i,FSOUND_GetDriverName(i),caps);
+ synfig::info(" Caps for driver %d (%s) = %x",i,FSOUND_GetDriverName(i),caps);
}
FSOUND_SetDriver(0);*/
if(!FSOUND_Init(44100, 32, 0))
{
- sinfg::warning("Unable to load FMOD");
+ synfig::warning("Unable to load FMOD");
}else
{
loaded = true;
//add to the refcount
++refcount;
- //sinfg::info("Audio: increment fmod refcount %d", refcount);
+ //synfig::info("Audio: increment fmod refcount %d", refcount);
}
void decref()
{
if(refcount <= 0)
{
- sinfg::warning("FMOD refcount is already 0...");
+ synfig::warning("FMOD refcount is already 0...");
}else
{
--refcount;
- //sinfg::info("Audio: decrement fmod refcount %d", refcount);
+ //synfig::info("Audio: decrement fmod refcount %d", refcount);
//NOTE: UNCOMMENT THIS IF YOU WANT FMOD TO UNLOAD ITSELF WHEN IT ISN'T NEEDED ANYMORE...
flush();
if(loaded && refcount <= 0)
{
#ifdef WITH_FMOD
- sinfg::info("Unloading FMOD");
+ synfig::info("Unloading FMOD");
if(scrubdspunit) FSOUND_DSP_Free(scrubdspunit);
FSOUND_Close();
#endif
channel = FSOUND_PlaySoundEx(FSOUND_FREE,sample,0,true);
if(channel < 0 || FSOUND_GetError() != FMOD_ERR_NONE)
{
- sinfg::warning("Could not play the sample...");
+ synfig::warning("Could not play the sample...");
return false;
}
}
//if we already have done our work, then we're good
if(profilevalid && prof)
{
- //sinfg::info("Using already built profile");
+ //synfig::info("Using already built profile");
return prof;
}
- //sinfg::info("Before profile");
+ //synfig::info("Before profile");
//make a new profile at current sample rate
//NOTE: We might want to reuse the structure already there...
if(!prof)
{
- sinfg::warning("Couldn't allocate audioprofile...");
+ synfig::warning("Couldn't allocate audioprofile...");
return handle<studio::AudioProfile>();
}
//setting the info for the sample rate
- //sinfg::info("Setting info...");
+ //synfig::info("Setting info...");
- sinfg::info("Building Profile...");
+ synfig::info("Building Profile...");
prof->samplerate = samplerate;
if(build_profile(imp->sample,prof->samplerate,prof->samples))
{
- sinfg::info(" Success!");
+ synfig::info(" Success!");
profilevalid = true;
return prof;
}else
if(!is_absolute_path(file))
{
file=filedirectory+filename;
- sinfg::warning("Not absolute hoooray");
+ synfig::warning("Not absolute hoooray");
}
- sinfg::info("Loading Audio file: %s", file.c_str());
+ synfig::info("Loading Audio file: %s", file.c_str());
//check to see if file exists
{
struct stat s;
if(stat(file.c_str(),&s) == -1 && errno == ENOENT)
{
- sinfg::info("There was no audio file...");
+ synfig::info("There was no audio file...");
return false;
}
}
//load fmod if we can...
- //sinfg::warning("I'm compiled with FMOD!");
+ //synfig::warning("I'm compiled with FMOD!");
fmodinit.addref();
//load the stream
if(!sm)
{
- sinfg::warning("Could not open the audio file as a sample: %s",file.c_str());
+ synfig::warning("Could not open the audio file as a sample: %s",file.c_str());
goto error;
}
- //sinfg::warning("Opened a file as a sample! :)");
+ //synfig::warning("Opened a file as a sample! :)");
/*{
int bufferlen = FSOUND_DSP_GetBufferLength();
- sinfg::info("Buffer length = %d samples, %.3lf s",bufferlen, bufferlen / (double)FSOUND_GetOutputRate());
+ synfig::info("Buffer length = %d samples, %.3lf s",bufferlen, bufferlen / (double)FSOUND_GetOutputRate());
}*/
//set all the variables since everything has worked out...
FSOUND_Sample_GetDefaults(sm,&sfreq,&volume,0,0);
//double len = length / (double)sfreq;
- //sinfg::info("Sound info: %.2lf s long, %d Hz, %d Vol",(double)length,sfreq,volume);
+ //synfig::info("Sound info: %.2lf s long, %d Hz, %d Vol",(double)length,sfreq,volume);
}
- //sinfg::warning("Got all info, and setting up everything, %.2f sec.", length);
- //sinfg::warning(" BigSample: composed of %d samples", FSOUND_Sample_GetLength(sm));
- sinfg::info("Successfully opened %s as a sample and initialized it.",file.c_str());
+ //synfig::warning("Got all info, and setting up everything, %.2f sec.", length);
+ //synfig::warning(" BigSample: composed of %d samples", FSOUND_Sample_GetLength(sm));
+ synfig::info("Successfully opened %s as a sample and initialized it.",file.c_str());
//set up the playable info
sample = sm;
if(t < 0)
{
unsigned int timeout = (int)floor(-t * 1000 + 0.5);
- //sinfg::info("Playing audio delayed by %d ms",timeout);
+ //synfig::info("Playing audio delayed by %d ms",timeout);
//delay for t seconds...
delaycon = Glib::signal_timeout().connect(
sigc::mem_fun(*this,&studio::AudioContainer::AudioImp::start_playing_now),timeout);
if(position >= FSOUND_Sample_GetLength(sample))
{
- sinfg::warning("Can't play audio when past length...");
+ synfig::warning("Can't play audio when past length...");
return;
}
FSOUND_SetCurrentPosition(channel,position);
FSOUND_SetPaused(channel,false);
- //sinfg::info("Playing audio with position %d samples",position);
+ //synfig::info("Playing audio with position %d samples",position);
#endif
}
void AudioContainer::AudioImp::start_scrubbing(double t)
{
- //sinfg::info("Start scrubbing: %lf", t);
+ //synfig::info("Start scrubbing: %lf", t);
if(playing) stop();
set_scrubbing(true);
scrinfo.pos = curscrubpos;
scrinfo.delaystart = delay_factor*buffer_length_sec;
- //sinfg::info("\tStarting at %d samps, with %d p %.3f delay",
+ //synfig::info("\tStarting at %d samps, with %d p %.3f delay",
// FSOUND_GetCurrentPosition(channel), (int)scrinfo.pos, scrinfo.delaystart);
}
//enable the dsp...
- //sinfg::info("\tActivating DSP");
+ //synfig::info("\tActivating DSP");
FSOUND_DSP_SetActive(scrubdspunit,true);
#endif
}
void AudioContainer::AudioImp::stop_scrubbing()
{
- //sinfg::info("Stop scrubbing");
+ //synfig::info("Stop scrubbing");
if(is_scrubbing())
{
g_scrubdata.scrub = 0;
//stop the dsp...
- //sinfg::info("\tDeactivating DSP");
+ //synfig::info("\tDeactivating DSP");
FSOUND_DSP_SetActive(scrubdspunit,false);
if(FSOUND_IsPlaying(channel)) FSOUND_SetPaused(channel,true);
#endif
void AudioContainer::AudioImp::scrub(double t)
{
#ifdef WITH_FMOD
- //sinfg::info("Scrub to %lf",t);
+ //synfig::info("Scrub to %lf",t);
if(is_scrubbing())
{
//What should we do?
//Outside so completely stopped...
if(newpos < 0 || oldpos >= length)
{
- //sinfg::info("\tOut +");
+ //synfig::info("\tOut +");
if(FSOUND_IsPlaying(channel))
{
FSOUND_SetPaused(channel,true);
init_play();
FSOUND_SetCurrentPosition(channel,0);
- sinfg::info("\tIn + %d", FSOUND_GetCurrentPosition(channel));
+ synfig::info("\tIn + %d", FSOUND_GetCurrentPosition(channel));
scrinfo.Lock();
scrinfo.pos = 0;
//should we restart the delay cycle... (is it done?)
if(!isRunning() || (scrinfo.delaystart <= 0 && scrinfo.deltatime <= 0 && isPaused()))
{
- //sinfg::info("Starting + at %d",(int)newpos);
+ //synfig::info("Starting + at %d",(int)newpos);
scrinfo.deltatime = 0;
scrinfo.delaystart = delay_factor*buffer_length_sec;
scrinfo.Unlock();
//completely stopped...
if(newpos >= length || oldpos < 0)
{
- //sinfg::info("Out -");
+ //synfig::info("Out -");
if(FSOUND_IsPlaying(channel))
{
FSOUND_SetPaused(channel,true);
//going in? - start going backwards at the end...
/*else if(oldpos >= length)
{
- sinfg::info("In -");
+ synfig::info("In -");
//Set up the sound to be playing paused at the start...
init_play();
FSOUND_SetCurrentPosition(channel,length-1);
//should we restart the delay cycle... (is it done?)
if(!isRunning() ||(scrinfo.delaystart <= 0 && scrinfo.deltatime <= 0 && isPaused()))
{
- //sinfg::info("Starting - at %d",(int)newpos);
+ //synfig::info("Starting - at %d",(int)newpos);
scrinfo.deltatime = 0;
scrinfo.delaystart = delay_factor*buffer_length_sec;
scrinfo.Unlock();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file audiocontainer.h
** \brief Sound info header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_AUDIOCONTAINER_H
-#define __SINFG_AUDIOCONTAINER_H
+#ifndef __SYNFIG_AUDIOCONTAINER_H
+#define __SYNFIG_AUDIOCONTAINER_H
/* === H E A D E R S ======================================================= */
#include <sigc++/signal.h>
#include <vector>
#include <string>
-#include <sinfg/time.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
const float DEF_DISPLAYSAMPLERATE = 400;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file autorecover.cpp
** \brief Template File
**
//#include <unistd.h>
#include "app.h"
-#include <sinfg/savecanvas.h>
-#include <sinfg/loadcanvas.h>
+#include <synfig/savecanvas.h>
+#include <synfig/loadcanvas.h>
#include <fstream>
#include <iostream>
#include "instance.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
if(mkdir(get_shadow_directory().c_str(),ACCESSPERMS)<0)
{
if(errno!=EEXIST)
- sinfg::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str());
+ synfig::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str());
}
else
{
- sinfg::info("Created directory \"%s\"",get_shadow_directory().c_str());
+ synfig::info("Created directory \"%s\"",get_shadow_directory().c_str());
}
}
{
}
-sinfg::String
+synfig::String
AutoRecover::get_shadow_directory()
{
return Glib::build_filename(App::get_user_app_directory(),"tmp");
// auto_backup_connect=App::main.get_context()->signal_timeout().connect(sigc::mem_fun(&AutoRecover::auto_backup),timeout);
}
-sinfg::String
-AutoRecover::get_shadow_file_name(const sinfg::String& filename)
+synfig::String
+AutoRecover::get_shadow_file_name(const synfig::String& filename)
{
unsigned int hash1(0xdeadbeef);
unsigned int hash2(0x83502529);
int status=0;
if(waitpid(pid,&status,WNOHANG)==-1)
{
- sinfg::info("PID %d isn't a zombie yet",pid);
+ synfig::info("PID %d isn't a zombie yet",pid);
return true;
}
if(WEXITSTATUS(status)!=0)
{
- sinfg::error("Autobackup seems to have failed! (PID=%d)",pid);
+ synfig::error("Autobackup seems to have failed! (PID=%d)",pid);
}
else
- sinfg::info("PID=%d has been cleaned up",pid);
+ synfig::info("PID=%d has been cleaned up",pid);
#endif
return false;
}
}
if(savecount)
- sinfg::info("AutoRecover::auto_backup(): %d Files backed up.",savecount);
+ synfig::info("AutoRecover::auto_backup(): %d Files backed up.",savecount);
}
catch(...)
{
- sinfg::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN.");
- sinfg::error("AutoRecover::auto_backup(): FILES NOT BACKED UP.");
+ synfig::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN.");
+ synfig::error("AutoRecover::auto_backup(): FILES NOT BACKED UP.");
}
#ifdef HAVE_FORK
}
void
-AutoRecover::clear_backup(sinfg::Canvas::Handle canvas)
+AutoRecover::clear_backup(synfig::Canvas::Handle canvas)
{
if(canvas)
remove(get_shadow_file_name(canvas->get_file_name()).c_str());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file autorecover.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_AUTORECOVER_H
-#define __SINFG_AUTORECOVER_H
+#ifndef __SYNFIG_AUTORECOVER_H
+#define __SYNFIG_AUTORECOVER_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/string.h>
-#include <sinfg/canvas.h>
+#include <synfig/string.h>
+#include <synfig/canvas.h>
#include <sigc++/connection.h>
/* === M A C R O S ========================================================= */
~AutoRecover();
static int pid();
- static sinfg::String get_shadow_file_name(const sinfg::String& filename);
+ static synfig::String get_shadow_file_name(const synfig::String& filename);
static bool auto_backup();
void set_timeout(int milliseconds);
int get_timeout()const { return timeout; }
- static sinfg::String get_shadow_directory();
+ static synfig::String get_shadow_directory();
bool recovery_needed()const;
bool recover();
void normal_shutdown();
- void clear_backup(sinfg::Canvas::Handle canvas);
+ void clear_backup(synfig::Canvas::Handle canvas);
}; // END of class AutoRecover
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasoptions.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasoptions.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_CANVASOPTIONS_H
-#define __SINFG_GTKMM_CANVASOPTIONS_H
+#ifndef __SYNFIG_GTKMM_CANVASOPTIONS_H
+#define __SYNFIG_GTKMM_CANVASOPTIONS_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasproperties.cpp
** \brief Template File
**
#include <gtkmm/table.h>
#include <gtkmm/label.h>
#include <gtkmm/notebook.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include "metadatatreestore.h"
#include <gtkmm/treeview.h>
#include <gtkmm/scrolledwindow.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-CanvasProperties::CanvasProperties(Gtk::Window& parent,handle<sinfgapp::CanvasInterface> canvas_interface):
+CanvasProperties::CanvasProperties(Gtk::Window& parent,handle<synfigapp::CanvasInterface> canvas_interface):
Gtk::Dialog(_("Canvas Properties"),parent,false,true),
canvas_interface_(canvas_interface)
{
void
CanvasProperties::on_button_meta_data_add()
{
- sinfg::String key;
+ synfig::String key;
if(App::dialog_entry("New MetaData Entry", "Please enter the name of the key",key) && !key.empty())
{
canvas_interface_->set_meta_data(key," ");
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasproperties.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_CANVASPROPERTIES_H
-#define __SINFG_GTKMM_CANVASPROPERTIES_H
+#ifndef __SYNFIG_GTKMM_CANVASPROPERTIES_H
+#define __SYNFIG_GTKMM_CANVASPROPERTIES_H
/* === H E A D E R S ======================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
namespace Gtk { class TreeView; };
-namespace sinfgapp { class CanvasInterface; };
+namespace synfigapp { class CanvasInterface; };
namespace studio
{
{
Gtk::Tooltips tooltips;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
Widget_RendDesc widget_rend_desc;
Gtk::Entry entry_id;
Gtk::Entry entry_name;
void on_button_meta_data_delete();
public:
- CanvasProperties(Gtk::Window& parent,etl::handle<sinfgapp::CanvasInterface> canvas_interface);
+ CanvasProperties(Gtk::Window& parent,etl::handle<synfigapp::CanvasInterface> canvas_interface);
~CanvasProperties();
void refresh();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvastreestore.cpp
** \brief Template File
**
#endif
#include "canvastreestore.h"
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
#include "iconcontroler.h"
-#include <sinfg/valuenode_timedswap.h>
-#include <sinfg/valuenode_animated.h>
+#include <synfig/valuenode_timedswap.h>
+#include <synfig/valuenode_animated.h>
#include <gtkmm/button.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/instance.h>
#include "cellrenderer_value.h"
#include "cellrenderer_timetrack.h"
#include <ETL/clock>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return *model;
}
-CanvasTreeStore::CanvasTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+CanvasTreeStore::CanvasTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Gtk::TreeStore(ModelHack()),
canvas_interface_ (canvas_interface_)
{
{
if(column==model.value.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
- Glib::Value<sinfg::ValueBase> x;
+ Glib::Value<synfig::ValueBase> x;
g_value_init(x.gobj(),x.value_type());
if(!value_desc)
x.set((*value_desc.get_value_node())(canvas_interface()->get_time()));
else
{
- sinfg::error(__FILE__":%d: Unable to figure out value",__LINE__);
+ synfig::error(__FILE__":%d: Unable to figure out value",__LINE__);
return;
}
else
if(column==model.is_value_node.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<bool> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.is_shared.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<bool> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.is_exported.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<bool> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.is_canvas.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<bool> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.id.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<Glib::ustring> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.is_editable.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<bool> x;
g_value_init(x.gobj(),x.value_type());
- x.set(!value_desc.is_value_node() || sinfgapp::is_editable(value_desc.get_value_node()));
+ x.set(!value_desc.is_value_node() || synfigapp::is_editable(value_desc.get_value_node()));
g_value_init(value.gobj(),x.value_type());
g_value_copy(x.gobj(),value.gobj());
else
if(column==model.type.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<Glib::ustring> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.label.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::Value<Glib::ustring> x;
g_value_init(x.gobj(),x.value_type());
else
if(column==model.icon.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
if(!value_desc)
return Gtk::TreeStore::get_value_vfunc(iter,column,value);
}
bool
-CanvasTreeStore::find_first_value_desc(const sinfgapp::ValueDesc& value_desc, Gtk::TreeIter& iter)
+CanvasTreeStore::find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter)
{
iter=children().begin();
while(iter && value_desc!=(*iter)[model.value_desc])
}
bool
-CanvasTreeStore::find_next_value_desc(const sinfgapp::ValueDesc& value_desc, Gtk::TreeIter& iter)
+CanvasTreeStore::find_next_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter)
{
if(!iter) return find_first_value_desc(value_desc,iter);
}
void
-CanvasTreeStore::set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc, bool do_children)
+CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children)
{
Gtk::TreeModel::Children children = row.children();
while(!children.empty() && erase(children.begin()));
row[model.value_node] = value_node;
//row[model.is_canvas] = false;
//row[model.is_value_node] = true;
- //row[model.is_editable] = sinfgapp::is_editable(value_node);
+ //row[model.is_editable] = synfigapp::is_editable(value_node);
//row[model.id]=value_node->get_id();
// Set the canvas
child_row[model.link_id] = i;
child_row[model.canvas] = static_cast<Canvas::Handle>(row[model.canvas]);
child_row[model.name] = linkable->link_local_name(i);
- set_row(child_row,sinfgapp::ValueDesc(linkable,i));
+ set_row(child_row,synfigapp::ValueDesc(linkable,i));
}
}
return;
return;
}
}
- catch(sinfg::Exception::IDNotFound x)
+ catch(synfig::Exception::IDNotFound x)
{
- sinfg::error(__FILE__":%d: IDNotFound thrown",__LINE__);
+ synfig::error(__FILE__":%d: IDNotFound thrown",__LINE__);
erase(row);
return;
}
void
CanvasTreeStore::refresh_row(Gtk::TreeModel::Row &row, bool do_children)
{
- sinfgapp::ValueDesc value_desc=row[model.value_desc];
+ synfigapp::ValueDesc value_desc=row[model.value_desc];
if(value_desc)
{
void
CanvasTreeStore::rebuild_row(Gtk::TreeModel::Row &row, bool do_children)
{
- sinfgapp::ValueDesc value_desc=(sinfgapp::ValueDesc)row[model.value_desc];
+ synfigapp::ValueDesc value_desc=(synfigapp::ValueDesc)row[model.value_desc];
if(value_desc && value_desc.get_value_node())
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvastreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_CANVASTREESTORE_H
-#define __SINFG_STUDIO_CANVASTREESTORE_H
+#ifndef __SYNFIG_STUDIO_CANVASTREESTORE_H
+#define __SYNFIG_STUDIO_CANVASTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include <gdkmm/pixbuf.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/value_desc.h>
#include <gtkmm/treeview.h>
/* === M A C R O S ========================================================= */
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> id;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
Gtk::TreeModelColumn<bool> is_canvas;
- Gtk::TreeModelColumn<sinfg::ValueNode::Handle> value_node;
+ Gtk::TreeModelColumn<synfig::ValueNode::Handle> value_node;
Gtk::TreeModelColumn<bool> is_value_node;
- Gtk::TreeModelColumn<sinfg::ValueBase> value;
+ Gtk::TreeModelColumn<synfig::ValueBase> value;
Gtk::TreeModelColumn<Glib::ustring> type;
Gtk::TreeModelColumn<int> link_id;
Gtk::TreeModelColumn<int> link_count;
Gtk::TreeModelColumn<bool> is_shared;
Gtk::TreeModelColumn<bool> is_exported;
- Gtk::TreeModelColumn<sinfgapp::ValueDesc> value_desc;
+ Gtk::TreeModelColumn<synfigapp::ValueDesc> value_desc;
Gtk::TreeModelColumn<Glib::ustring> tooltip;
private:
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
/*
-- ** -- P R I V A T E M E T H O D S ---------------------------------------
public:
- CanvasTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ CanvasTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
~CanvasTreeStore();
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
- etl::loose_handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
+ etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
virtual void rebuild_row(Gtk::TreeModel::Row &row, bool do_children=true);
virtual void refresh_row(Gtk::TreeModel::Row &row, bool do_children=true);
- virtual void set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc, bool do_children=true);
+ virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children=true);
- bool find_first_value_desc(const sinfgapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
- bool find_next_value_desc(const sinfgapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
+ bool find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
+ bool find_next_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
- bool find_first_value_node(const sinfg::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
- bool find_next_value_node(const sinfg::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
+ bool find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
+ bool find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
static CellRenderer_ValueBase* add_cell_renderer_value(Gtk::TreeView::Column* column);
static CellRenderer_TimeTrack* add_cell_renderer_value_node(Gtk::TreeView::Column* column);
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
- virtual void on_value_node_changed(sinfg::ValueNode::Handle value_node)=0;
+ virtual void on_value_node_changed(synfig::ValueNode::Handle value_node)=0;
/*
-- ** -- P R O T E C T E D M E T H O D S -----------------------------------
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasview.cpp
** \brief Template File
**
#include <gtk/gtktreestore.h>
#include <gtk/gtkversion.h>
-#include <sinfg/valuenode_reference.h>
-#include <sinfg/valuenode_subtract.h>
-#include <sinfg/valuenode_linear.h>
-#include <sinfg/valuenode_timedswap.h>
-#include <sinfg/valuenode_scale.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_twotone.h>
-#include <sinfg/valuenode_stripes.h>
-#include <sinfg/layer.h>
-
-#include <sinfgapp/uimanager.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/selectionmanager.h>
-//#include <sinfgapp/action_setwaypoint.h>
-//#include <sinfgapp/action_deletewaypoint.h>
+#include <synfig/valuenode_reference.h>
+#include <synfig/valuenode_subtract.h>
+#include <synfig/valuenode_linear.h>
+#include <synfig/valuenode_timedswap.h>
+#include <synfig/valuenode_scale.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_twotone.h>
+#include <synfig/valuenode_stripes.h>
+#include <synfig/layer.h>
+
+#include <synfigapp/uimanager.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/selectionmanager.h>
+//#include <synfigapp/action_setwaypoint.h>
+//#include <synfigapp/action_deletewaypoint.h>
#include <sigc++/retype_return.h>
#include <sigc++/retype.h>
#include "audiocontainer.h"
#include "widget_timeslider.h"
-#include <sinfgapp/main.h>
-#include <sinfgapp/inputdevice.h>
+#include <synfigapp/main.h>
+#include <synfigapp/inputdevice.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
using namespace SigC;
#define GRAB_HINT_DATA(y) { \
String x; \
- if(sinfgapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
+ if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
{ \
set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \
} \
};
-class studio::CanvasViewUIInterface : public sinfgapp::UIInterface
+class studio::CanvasViewUIInterface : public synfigapp::UIInterface
{
CanvasView *view;
}
};
-class studio::CanvasViewSelectionManager : public sinfgapp::SelectionManager
+class studio::CanvasViewSelectionManager : public synfigapp::SelectionManager
{
CanvasView *view;
CanvasView::LayerTreeModel layer_tree_model;
private:
- void _set_selected_layer(const sinfg::Layer::Handle &layer)
+ void _set_selected_layer(const synfig::Layer::Handle &layer)
{
view->layer_tree->select_layer(layer);
/*
const Gtk::TreeRow row = *(view->layer_tree->get_selection()->get_selected());
// Don't do anything if that layer is already selected
- if(layer == static_cast<sinfg::Layer::Handle>(row[layer_tree_model.layer]))
+ if(layer == static_cast<synfig::Layer::Handle>(row[layer_tree_model.layer]))
return;
}
Gtk::TreeModel::Children::iterator iter;
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); sinfg::error("canvas_view.layer_tree not defined!?"); return LayerList(); }
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return LayerList(); }
return view->layer_tree->get_selected_layers();
}
//! Returns the first layer selected or an empty handle if none are selected.
- virtual sinfg::Layer::Handle get_selected_layer()const
+ virtual synfig::Layer::Handle get_selected_layer()const
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); sinfg::error("canvas_view.layer_tree not defined!?"); return 0; }
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return 0; }
return view->layer_tree->get_selected_layer();
}
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); sinfg::error("canvas_view.layer_tree not defined!?"); return; }
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; }
view->layer_tree->select_layers(layer_list);
//view->get_smach().process_event(EVENT_REFRESH_DUCKS);
}
//! Sets which layer should be selected.
- virtual void set_selected_layer(const sinfg::Layer::Handle &layer)
+ virtual void set_selected_layer(const synfig::Layer::Handle &layer)
{
// assert(view->layer_tree);
- if(!view->layer_tree) { DEBUGPOINT(); sinfg::error("canvas_view.layer_tree not defined!?"); return; }
+ if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; }
view->layer_tree->select_layer(layer);
//view->queue_rebuild_ducks();
}
static inline void __child_grabber(const Gtk::TreeModel::iterator& iter, ChildrenList* ret)
{
const CanvasView::ChildrenTreeModel children_tree_model;
- sinfgapp::ValueDesc value_desc((*iter)[children_tree_model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[children_tree_model.value_desc]);
if(value_desc)
ret->push_back(value_desc);
}
{
Gtk::TreeModel::Row row = *iter;
if(selection->is_selected(row))
- ret.push_back((sinfgapp::ValueDesc)row[children_tree_model.value_desc]);
+ ret.push_back((synfigapp::ValueDesc)row[children_tree_model.value_desc]);
}
*/
return ret;
/* === M E T H O D S ======================================================= */
-CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<sinfgapp::CanvasInterface> canvas_interface_):
+CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigapp::CanvasInterface> canvas_interface_):
smach_ (this),
instance_ (instance),
canvas_interface_ (canvas_interface_),
disp_audio = new Widget_Sound();
- //sinfg::info("Canvasview: Entered constructor");
+ //synfig::info("Canvasview: Entered constructor");
// Minor hack
get_canvas()->set_time(0);
//layer_tree_store_->rebuild();
//notebook->append_page(*create_children_tree(),"Children");
//notebook->append_page(*create_keyframe_tree(),"Keyframes");
- //sinfg::info("Canvasview: Before big chunk of allocation and tabling stuff");
+ //synfig::info("Canvasview: Before big chunk of allocation and tabling stuff");
//create all allocated stuff for this canvas
audio = new AudioContainer();
//set_transient_for(*App::toolbox);
- //sinfg::info("Canvasview: Before Signals");
+ //synfig::info("Canvasview: Before Signals");
/*
-- ** -- Signals -------------------------------------------------------------
*/
}
*/
- //sinfg::info("Canvasview: Before Sound Hookup");
+ //synfig::info("Canvasview: Before Sound Hookup");
//load sound info from meta data
{
- //sinfg::warning("Should load Audio: %s with %s offset",apath.c_str(),aoffset.c_str());
+ //synfig::warning("Should load Audio: %s with %s offset",apath.c_str(),aoffset.c_str());
on_audio_file_notify(); //redundant setting of the metadata, but oh well, it's no big deal :)
on_audio_offset_notify();
//universal_scrubber=std::auto_ptr<UniversalScrubber>(new UniversalScrubber(this));
}
- //sinfg::info("Canvasview: Before Final time set up");
+ //synfig::info("Canvasview: Before Final time set up");
//MORE TIME STUFF
time_window_adjustment().set_value(get_canvas()->rend_desc().get_time_start());
time_window_adjustment().value_changed();
hide_tables();
on_time_changed();
- //sinfg::info("Canvasview: Constructor Done");
+ //synfig::info("Canvasview: Constructor Done");
}
CanvasView::~CanvasView()
hide();
- sinfg::info("CanvasView:~CanvasView(): Destructor Finished");
+ synfig::info("CanvasView:~CanvasView(): Destructor Finished");
}
animatebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_animate_button_pressed));
animatebutton->show();
- NORMAL_BUTTON(keyframebutton,"sinfg-keyframe_lock_all","All Keyframes Locked");
+ NORMAL_BUTTON(keyframebutton,"synfig-keyframe_lock_all","All Keyframes Locked");
keyframebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed));
keyframebutton->show();
CanvasView::create_status_bar()
{
Gtk::Image *icon;
- Gtk::IconSize iconsize=Gtk::IconSize::from_name("sinfg-small_icon");
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
cancel=false;
// Create the status bar at the bottom of the window
//keyframe_tree->show();
//keyframe_tree->set_model(keyframe_tree_store());
keyframe_tree->set_editable(true);
- //keyframe_tree->signal_edited().connect(sigc::hide_return(sigc::mem_fun(*canvas_interface(), &sinfgapp::CanvasInterface::update_keyframe)));
+ //keyframe_tree->signal_edited().connect(sigc::hide_return(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::update_keyframe)));
keyframe_tree->signal_event().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_tree_event));
layout_table->attach(*scroll_layer_tree, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
Gtk::Image *icon;
- Gtk::IconSize iconsize(Gtk::IconSize::from_name("sinfg-small_icon"));
+ Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
NEW_SMALL_BUTTON(button_add,"gtk-add","New Keyframe");
- NEW_SMALL_BUTTON(button_duplicate,"sinfg-duplicate","Duplicate Keyframe");
+ NEW_SMALL_BUTTON(button_duplicate,"synfig-duplicate","Duplicate Keyframe");
NEW_SMALL_BUTTON(button_delete,"gtk-delete","Delete Keyframe");
Gtk::HBox *hbox(manage(new Gtk::HBox()));
action_group->add( Gtk::Action::create("revert", Gtk::Stock::REVERT_TO_SAVED),
sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert))
);
- action_group->add( Gtk::Action::create("cvs-add", Gtk::StockID("sinfg-cvs_add")),
+ action_group->add( Gtk::Action::create("cvs-add", Gtk::StockID("synfig-cvs_add")),
sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add))
);
- action_group->add( Gtk::Action::create("cvs-update", Gtk::StockID("sinfg-cvs_update")),
+ action_group->add( Gtk::Action::create("cvs-update", Gtk::StockID("synfig-cvs_update")),
sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update))
);
- action_group->add( Gtk::Action::create("cvs-revert", Gtk::StockID("sinfg-cvs_revert")),
+ action_group->add( Gtk::Action::create("cvs-revert", Gtk::StockID("synfig-cvs_revert")),
sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_revert))
);
- action_group->add( Gtk::Action::create("cvs-commit", Gtk::StockID("sinfg-cvs_commit")),
+ action_group->add( Gtk::Action::create("cvs-commit", Gtk::StockID("synfig-cvs_commit")),
sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit))
);
action_group->add( Gtk::Action::create("import", _("Import")),
}
}
- action_group->add( Gtk::Action::create("play", Gtk::StockID("sinfg-play")),
+ action_group->add( Gtk::Action::create("play", Gtk::StockID("synfig-play")),
sigc::mem_fun(*this, &studio::CanvasView::play)
);
Glib::RefPtr<Gtk::Action> action;
action=Gtk::Action::create("seek-next-frame", Gtk::Stock::GO_FORWARD,_("Next Frame"),_("Next Frame"));
- action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_frame),1));
+ action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),1));
action=Gtk::Action::create("seek-prev-frame", Gtk::Stock::GO_BACK,_("Prev Frame"),_("Prev Frame"));
- action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_frame),-1));
+ action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),-1));
action=Gtk::Action::create("seek-next-second", Gtk::Stock::GO_FORWARD,_("Seek Foward"),_("Seek Foward"));
- action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_time),Time(1)));
+ action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(1)));
action=Gtk::Action::create("seek-prev-second", Gtk::Stock::GO_BACK,_("Seek Backward"),_("Seek Backward"));
- action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_time),Time(-1)));
+ action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(-1)));
// Broken...!?
/*
action=Gtk::Action::create("seek-end", Gtk::Stock::GOTO_LAST,_("Seek to End"),_("Seek to End"));
- action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_time),Time::end()));
+ action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::end()));
*/
action=Gtk::Action::create("seek-begin", Gtk::Stock::GOTO_FIRST,_("Seek to Begin"),_("Seek to Begin"));
- action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek_time),Time::begin()));
+ action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::begin()));
action=Gtk::Action::create("jump-next-keyframe", Gtk::Stock::GO_FORWARD,_("Jump to Next Keyframe"),_("Jump to Next Keyframe"));
- action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_next_keyframe));
+ action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe));
action=Gtk::Action::create("jump-prev-keyframe", Gtk::Stock::GO_BACK,_("Jump to Prev Keyframe"),_("Jump to Prev Keyframe"));
- action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_prev_keyframe));
+ action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe));
action=Gtk::Action::create("canvas-zoom-in", Gtk::Stock::ZOOM_IN);
action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in));
Glib::RefPtr<Gtk::Action> action;
action=Gtk::Action::create("seek-next-frame", Gtk::StockID("gtk-forward"),_("Next Frame"),_("Next Frame"));
- accel_action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek),1));
+ accel_action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek),1));
action=Gtk::Action::create("seek-prev-frame", Gtk::StockID("gtk-forward"),_("Prev Frame"),_("Prev Frame"));
- accel_action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::seek),-1));
+ accel_action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek),-1));
action=Gtk::Action::create("jump-next-keyframe", Gtk::StockID("gtk-forward"),_("Jump to Next Keyframe"),_("Jump to Next Keyframe"));
- accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_next_keyframe));
+ accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe));
action=Gtk::Action::create("jump-prev-keyframe", Gtk::StockID("gtk-back"),_("Jump to Prev Keyframe"),_("Jump to Prev Keyframe"));
- accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_prev_keyframe));
+ accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe));
action=Gtk::Action::create("canvas-zoom-in", Gtk::StockID("gtk-zoom-in"));
accel_action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in));
filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-revert-to-saved"),hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert))));
filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-cvs_add"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-cvs_update"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update))));
- filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-cvs_commit"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit))));
+ filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_add"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add))));
+ filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_update"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update))));
+ filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_commit"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit))));
filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Import..."),Gtk::AccelKey('I',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::image_import))));
editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0)),SLOT_EVENT(EVENT_STOP)));
editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REFRESH)));
editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-rotoscope_bline"),
+ editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-rotoscope_bline"),
sigc::mem_fun(*this, &studio::CanvasView::do_rotoscope_bline)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-rotoscope_polygon"),
+ editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-rotoscope_polygon"),
sigc::mem_fun(*this, &studio::CanvasView::do_rotoscope_poly)));
- editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-eyedrop"),
+ editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-eyedrop"),
sigc::mem_fun(*this, &studio::CanvasView::do_eyedrop)));
editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),Gtk::AccelKey("F8"),
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",Canvas::Handle(get_canvas()));
param_list.add("canvas_interface",canvas_interface());
- add_actions_to_menu(&canvasmenu, param_list,sinfgapp::Action::CATEGORY_CANVAS);
+ add_actions_to_menu(&canvasmenu, param_list,synfigapp::Action::CATEGORY_CANVAS);
}
viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu));
}
- viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-play"),
+ viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-play"),
sigc::mem_fun(*this, &studio::CanvasView::play)));
viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Flipbook Dialog"),
sigc::mem_fun(*preview_dialog, &studio::Dialog_Preview::present)));
sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out)));
viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Next Keyframe"),Gtk::AccelKey(']',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_next_keyframe)));
+ sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)));
viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Prev Keyframe"),Gtk::AccelKey('[',static_cast<Gdk::ModifierType>(0)),
- sigc::mem_fun(*canvas_interface().get(), &sinfgapp::CanvasInterface::jump_to_prev_keyframe)));
+ sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)));
mainmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_File",filemenu));
filemenu.set_accel_path("<synfig>/File");
editmenu.set_accel_path("<synfig>/Edit");
layermenu.set_accel_path("<synfig>/Layer");
- //mainmenu.set_accel_path("<sinfg-main>");
+ //mainmenu.set_accel_path("<synfig-main>");
canvasmenu.set_accel_path("<synfig>/Canvas");
viewmenu.set_accel_path("<synfig>/View");
duckmaskmenu.set_accel_path("<synfig>/DuckMask");
}
void
-CanvasView::add_layer(sinfg::String x)
+CanvasView::add_layer(synfig::String x)
{
Canvas::Handle canvas;
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
int target_depth(0);
}
void
-CanvasView::popup_layer_menu(sinfg::Layer::Handle layer)
+CanvasView::popup_layer_menu(synfig::Layer::Handle layer)
{
//Gtk::Menu* menu(manage(new Gtk::Menu));
Gtk::Menu* menu(¶mmenu);
menu->items().clear();
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",canvas_interface()->get_time());
param_list.add("canvas",Canvas::Handle(layer->get_canvas()));
param_list.add("canvas_interface",canvas_interface());
));
}
- add_actions_to_menu(menu, param_list,sinfgapp::Action::CATEGORY_LAYER);
+ add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_LAYER);
menu->popup(3,gtk_get_current_event_time());
}
void
-CanvasView::register_layer_type(sinfg::Layer::Book::value_type &lyr,std::map<sinfg::String,Gtk::Menu*>* category_map)
+CanvasView::register_layer_type(synfig::Layer::Book::value_type &lyr,std::map<synfig::String,Gtk::Menu*>* category_map)
{
/* if(lyr.second.category==_("Do Not Use"))
return;
CanvasView::build_new_layer_menu(Gtk::Menu &menu)
{
/*
- std::map<sinfg::String,Gtk::Menu*> category_map;
+ std::map<synfig::String,Gtk::Menu*> category_map;
std::for_each(
- sinfg::Layer::book().begin(),
- sinfg::Layer::book().end(),
+ synfig::Layer::book().begin(),
+ synfig::Layer::book().end(),
sigc::bind(
sigc::mem_fun(
*this,
menu.items().clear();
menu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem());
- std::map<sinfg::String,Gtk::Menu*>::iterator iter;
+ std::map<synfig::String,Gtk::Menu*>::iterator iter;
for(iter=category_map.begin();iter!=category_map.end();++iter)
menu.items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,*iter->second));
}
void
-CanvasView::workarea_layer_selected(sinfg::Layer::Handle layer)
+CanvasView::workarea_layer_selected(synfig::Layer::Handle layer)
{
get_selection_manager()->clear_selected_layers();
if(layer)
//????
- //sinfg::info("Canvasview: Refreshing render desc info");
+ //synfig::info("Canvasview: Refreshing render desc info");
if(!get_time().is_equal(time_adjustment().get_value()))
{
time_adjustment().set_value(get_time());
// Setup the time_window adjustment
time_window_adjustment().set_lower(begin_time);
time_window_adjustment().set_upper(end_time);
- time_window_adjustment().set_step_increment(sinfg::Time(1.0/get_canvas()->rend_desc().get_frame_rate()));
+ time_window_adjustment().set_step_increment(synfig::Time(1.0/get_canvas()->rend_desc().get_frame_rate()));
//Time length(get_canvas()->rend_desc().get_time_end()-get_canvas()->rend_desc().get_time_start());
if(length < time_window_adjustment().get_page_size())
time_window_adjustment().set_page_size(length);
}
- /*sinfg::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
+ /*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
&time_window_adjustment_, time_window_adjustment_.get_lower(),
time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(),
time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment()
// time_adjustment().set_lower(get_canvas()->rend_desc().get_time_start());
// time_adjustment().set_upper(get_canvas()->rend_desc().get_time_end());
- time_adjustment().set_step_increment(sinfg::Time(1.0/get_canvas()->rend_desc().get_frame_rate()));
- time_adjustment().set_page_increment(sinfg::Time(1.0));
+ time_adjustment().set_step_increment(synfig::Time(1.0/get_canvas()->rend_desc().get_frame_rate()));
+ time_adjustment().set_page_increment(synfig::Time(1.0));
time_adjustment().set_page_size(0);
time_adjustment().changed();
- /*sinfg::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
+ /*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n",
&time_window_adjustment_, time_window_adjustment_.get_lower(),
time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(),
time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment()
time_adjustment().value_changed();
}
- /*sinfg::info("Time stats: \n"
+ /*synfig::info("Time stats: \n"
"w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n"
"t: %p - [%.3f,%.3f] %.3f",
&time_window_adjustment_, time_window_adjustment_.get_lower(),
handle<CanvasView>
CanvasView::create(loose_handle<Instance> instance,handle<Canvas> canvas)
{
- etl::handle<studio::CanvasView> view(new CanvasView(instance,instance->sinfgapp::Instance::find_canvas_interface(canvas)));
+ etl::handle<studio::CanvasView> view(new CanvasView(instance,instance->synfigapp::Instance::find_canvas_interface(canvas)));
instance->canvas_view_list().push_front(view);
instance->signal_canvas_view_created()(view.get());
return view;
else
title+='"'+get_canvas()->get_name()+'"';
- if(get_instance()->sinfgapp::Instance::get_action_count())
+ if(get_instance()->synfigapp::Instance::get_action_count())
title+=_(" (Unsaved)");
- if(get_instance()->sinfgapp::Instance::in_repository())
+ if(get_instance()->synfigapp::Instance::in_repository())
{
title+=" (CVS";
- if(get_instance()->sinfgapp::Instance::is_modified())
+ if(get_instance()->synfigapp::Instance::is_modified())
title+=_("-MODIFIED");
- if(get_instance()->sinfgapp::Instance::is_updated())
+ if(get_instance()->synfigapp::Instance::is_updated())
title+=_("-UPDATED");
title+=')';
}
}
void
-CanvasView::on_layer_toggle(sinfg::Layer::Handle layer)
+CanvasView::on_layer_toggle(synfig::Layer::Handle layer)
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_activate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
assert(action);
if(!action)
action->set_param("canvas",Canvas::Handle(layer->get_canvas()));
if(!action->set_param("canvas_interface",canvas_interface()))
// if(!action->set_param("canvas_interface",get_instance()->find_canvas_interface(layer->get_canvas())))
- sinfg::error("LayerActivate didn't like CanvasInterface...?");
+ synfig::error("LayerActivate didn't like CanvasInterface...?");
action->set_param("time",get_time());
action->set_param("layer",layer);
action->set_param("new_status",!layer->active());
void
-CanvasView::popup_param_menu(sinfgapp::ValueDesc value_desc, float location)
+CanvasView::popup_param_menu(synfigapp::ValueDesc value_desc, float location)
{
parammenu.items().clear();
get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location);
}
void
-CanvasView::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list,sinfgapp::Action::Category category)const
+CanvasView::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list,synfigapp::Action::Category category)const
{
get_instance()->add_actions_to_menu(menu, param_list, category);
}
if(column_id==COLUMNID_TIME_TRACK)
return false;
- //sinfgapp::ValueDesc value_desc(row[layer_param_tree_model.value_desc]);
+ //synfigapp::ValueDesc value_desc(row[layer_param_tree_model.value_desc]);
//ValueNode::Handle value_node(row[layer_param_tree_model.value_node]);
//ValueNode::Handle parent_value_node;
//ValueBase value=row[layer_param_tree_model.value];
{
Layer::Handle layer(row[layer_tree_model.layer]);
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",canvas_interface()->get_time());
param_list.add("canvas",Canvas::Handle(row[layer_tree_model.canvas]));
param_list.add("canvas_interface",canvas_interface());
param_list.add("layer",layer);
else
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
));
}
- add_actions_to_menu(¶mmenu, param_list,sinfgapp::Action::CATEGORY_LAYER);
+ add_actions_to_menu(¶mmenu, param_list,synfigapp::Action::CATEGORY_LAYER);
parammenu.popup(button,gtk_get_current_event_time());
return true;
}
/*
- else if(column_id==LayerTree::COLUMNID_TIME_TRACK && value_node && handle<sinfg::ValueNode_Animated>::cast_dynamic(value_node))
+ else if(column_id==LayerTree::COLUMNID_TIME_TRACK && value_node && handle<synfig::ValueNode_Animated>::cast_dynamic(value_node))
{
// Right-click on time track with animated
// trackmenu.popup(0,0);
#if 0
parammenu.items().clear();
parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Connect",
- hide_return(sigc::mem_fun(*canvas_interface().get(),&sinfgapp::CanvasInterface::connect_selected_layer_params))
+ hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::connect_selected_layer_params))
));
parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("Disconnect",
- hide_return(sigc::mem_fun(*canvas_interface().get(),&sinfgapp::CanvasInterface::disconnect_selected_layer_params))
+ hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::disconnect_selected_layer_params))
));
parammenu.popup(0,0);
#endif
return false;
if(!(bool)row[children_tree_model.is_canvas])
{
- sinfgapp::ValueDesc value_desc=row[children_tree_model.value_desc];
+ synfigapp::ValueDesc value_desc=row[children_tree_model.value_desc];
assert(value_desc);
popup_param_menu(value_desc);
return true;
void
CanvasView::time_was_changed()
{
- sinfg::Time time((sinfg::Time)(double)time_adjustment().get_value());
+ synfig::Time time((synfig::Time)(double)time_adjustment().get_value());
set_time(time);
}
void
-CanvasView::on_edited_value(sinfgapp::ValueDesc value_desc,sinfg::ValueBase new_value)
+CanvasView::on_edited_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value)
{
canvas_interface()->change_value(value_desc,new_value);
}
/*
void
-CanvasView::on_children_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value)
+CanvasView::on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value)
{
Gtk::TreePath path(path_string);
assert((bool)row[children_tree_model.is_value_node]);
- sinfgapp::ValueDesc value_desc=row[children_tree_model.value_desc];
+ synfigapp::ValueDesc value_desc=row[children_tree_model.value_desc];
assert(value_desc);
on_edited_value(value_desc,value);
void
-CanvasView::on_mode_changed(sinfgapp::CanvasInterface::Mode mode)
+CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode)
{
// If the aninimate flag was set in mode...
- if(mode&sinfgapp::MODE_ANIMATE)
+ if(mode&synfigapp::MODE_ANIMATE)
{
Gtk::Image *icon;
icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),Gtk::ICON_SIZE_BUTTON));
icon->show();
}
- if((mode&sinfgapp::MODE_ANIMATE_FUTURE) && (mode&sinfgapp::MODE_ANIMATE_PAST))
+ if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-keyframe_lock_all"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_all"),Gtk::ICON_SIZE_BUTTON));
keyframebutton->remove();
keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("All Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
}
- else if((mode&sinfgapp::MODE_ANIMATE_FUTURE) && !(mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if((mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-keyframe_lock_future"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_future"),Gtk::ICON_SIZE_BUTTON));
keyframebutton->remove();
keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("Future Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
}
- else if(!(mode&sinfgapp::MODE_ANIMATE_FUTURE) && (mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-keyframe_lock_past"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_past"),Gtk::ICON_SIZE_BUTTON));
keyframebutton->remove();
keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("Past Keyframes Locked"));
icon->set_padding(0,0);
icon->show();
}
- else if(!(mode&sinfgapp::MODE_ANIMATE_FUTURE) && !(mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
{
Gtk::Image *icon;
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-keyframe_lock_none"),Gtk::ICON_SIZE_BUTTON));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_none"),Gtk::ICON_SIZE_BUTTON));
keyframebutton->remove();
keyframebutton->add(*icon);
tooltips.set_tip(*keyframebutton,_("No Keyframes Locked"));
void
CanvasView::on_animate_button_pressed()
{
- if(get_mode()&sinfgapp::MODE_ANIMATE)
- set_mode(get_mode()-sinfgapp::MODE_ANIMATE);
+ if(get_mode()&synfigapp::MODE_ANIMATE)
+ set_mode(get_mode()-synfigapp::MODE_ANIMATE);
else
- set_mode(get_mode()|sinfgapp::MODE_ANIMATE);
+ set_mode(get_mode()|synfigapp::MODE_ANIMATE);
}
void
CanvasView::on_keyframe_button_pressed()
{
- sinfgapp::CanvasInterface::Mode mode(get_mode());
+ synfigapp::CanvasInterface::Mode mode(get_mode());
- if((mode&sinfgapp::MODE_ANIMATE_FUTURE) && (mode&sinfgapp::MODE_ANIMATE_PAST))
+ if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
{
- set_mode(get_mode()-sinfgapp::MODE_ANIMATE_FUTURE);
+ set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE);
}
- else if(!(mode&sinfgapp::MODE_ANIMATE_FUTURE) && (mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST))
{
- set_mode(get_mode()-sinfgapp::MODE_ANIMATE_PAST|sinfgapp::MODE_ANIMATE_FUTURE);
+ set_mode(get_mode()-synfigapp::MODE_ANIMATE_PAST|synfigapp::MODE_ANIMATE_FUTURE);
}
- else if((mode&sinfgapp::MODE_ANIMATE_FUTURE) && !(mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if((mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
{
- set_mode(get_mode()-sinfgapp::MODE_ANIMATE_FUTURE);
+ set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE);
}
- else if(!(mode&sinfgapp::MODE_ANIMATE_FUTURE) && !(mode&sinfgapp::MODE_ANIMATE_PAST))
+ else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST))
{
- set_mode(get_mode()|sinfgapp::MODE_ANIMATE_FUTURE|sinfgapp::MODE_ANIMATE_PAST);
+ set_mode(get_mode()|synfigapp::MODE_ANIMATE_FUTURE|synfigapp::MODE_ANIMATE_PAST);
}
}
bool
-CanvasView::duck_change_param(const Point &value,sinfg::Layer::Handle layer, sinfg::String param_name)
+CanvasView::duck_change_param(const Point &value,synfig::Layer::Handle layer, synfig::String param_name)
{
- return canvas_interface()->change_value(sinfgapp::ValueDesc(layer,param_name),value);
+ return canvas_interface()->change_value(synfigapp::ValueDesc(layer,param_name),value);
}
bool
-CanvasView::on_duck_changed(const sinfg::Point &value,const sinfgapp::ValueDesc& value_desc)
+CanvasView::on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc)
{
switch(value_desc.get_value_type())
{
void
CanvasView::selected_layer_color_set(Color color)
{
- sinfgapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
// Create the action group
- //sinfgapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Set Colors"));
+ //synfigapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Set Colors"));
Layer::Handle layer;
for(iter=selected_list.begin();iter!=selected_list.end();++iter)
if(*iter==layer)
continue;
layer=*iter;
- on_edited_value(sinfgapp::ValueDesc(layer,"color"),color);
+ on_edited_value(synfigapp::ValueDesc(layer,"color"),color);
}
}
void
-CanvasView::rebuild_ducks_layer_(sinfg::TransformStack& transform_stack, Canvas::Handle canvas, std::set<sinfg::Layer::Handle>& selected_list)
+CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas::Handle canvas, std::set<synfig::Layer::Handle>& selected_list)
{
int transforms(0);
String layer_name;
if(!canvas)
{
- sinfg::warning("CanvasView::rebuild_ducks_layer_(): Layer doesn't have canvas set");
+ synfig::warning("CanvasView::rebuild_ducks_layer_(): Layer doesn't have canvas set");
return;
}
for(Canvas::iterator iter(canvas->begin());iter!=canvas->end();++iter)
{
if(!iter->get_hidden() && !iter->get_invisible_duck())
{
- sinfgapp::ValueDesc value_desc(layer,iter->get_name());
+ synfigapp::ValueDesc value_desc(layer,iter->get_name());
work_area->add_to_ducks(value_desc,this,transform_stack,&*iter);
if(value_desc.is_value_node())
duck_changed_connections.push_back(value_desc.get_value_node()->signal_changed().connect(QUEUE_REBUILD_DUCKS));
/* // Add transforms onto the stack
if(layer_name=="Translate")
{
- transform_stack.push(sinfg::Transform_Translate(layer->get_param("origin").get(Vector())));
+ transform_stack.push(synfig::Transform_Translate(layer->get_param("origin").get(Vector())));
transforms++;
}else
if(layer_name=="Zoom")
{
Vector scale;
scale[0]=scale[1]=exp(layer->get_param("amount").get(Real()));
- transform_stack.push(sinfg::Transform_Scale(scale,layer->get_param("center").get(Vector())));
+ transform_stack.push(synfig::Transform_Scale(scale,layer->get_param("center").get(Vector())));
transforms++;
}else
if(layer_name=="stretch")
{
Vector scale(layer->get_param("amount").get(Vector()));
- transform_stack.push(sinfg::Transform_Scale(scale,layer->get_param("center").get(Vector())));
+ transform_stack.push(synfig::Transform_Scale(scale,layer->get_param("center").get(Vector())));
transforms++;
}else
if(layer_name=="Rotate")
{
- transform_stack.push(sinfg::Transform_Rotate(layer->get_param("amount").get(Angle()),layer->get_param("origin").get(Vector())));
+ transform_stack.push(synfig::Transform_Rotate(layer->get_param("amount").get(Angle()),layer->get_param("origin").get(Vector())));
transforms++;
}
*/
/*static int i=0;
i++;
if(i>30)
- sinfg::info("%d",i/(i-i));
+ synfig::info("%d",i/(i-i));
*/
rebuild_ducks_queued=false;
// First do the layers...
do{
- sinfgapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
- std::set<sinfg::Layer::Handle> layer_set(selected_list.begin(),selected_list.end());
+ synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers());
+ std::set<synfig::Layer::Handle> layer_set(selected_list.begin(),selected_list.end());
if(!layer_set.empty())
not_empty=true;
- sinfg::TransformStack transform_stack;
+ synfig::TransformStack transform_stack;
rebuild_ducks_layer_(transform_stack, get_canvas(), layer_set);
// Now do the children
do{
- sinfgapp::SelectionManager::ChildrenList selected_list(get_selection_manager()->get_selected_children());
- sinfgapp::SelectionManager::ChildrenList::iterator iter;
- sinfg::TransformStack transform_stack;
+ synfigapp::SelectionManager::ChildrenList selected_list(get_selection_manager()->get_selected_children());
+ synfigapp::SelectionManager::ChildrenList::iterator iter;
+ synfig::TransformStack transform_stack;
if(selected_list.empty())
{
Smach::event_result x(process_event_key(EVENT_TABLES_SHOW));
if(x==Smach::RESULT_OK || x==Smach::RESULT_ACCEPT)
{
- Gtk::IconSize iconsize=Gtk::IconSize::from_name("sinfg-small_icon");
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
treetogglebutton->remove();
treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-down"),iconsize)));
treetogglebutton->show_all();
Smach::event_result x(process_event_key(EVENT_TABLES_HIDE));
if(x==Smach::RESULT_OK || x==Smach::RESULT_ACCEPT)
{
- Gtk::IconSize iconsize=Gtk::IconSize::from_name("sinfg-small_icon");
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
treetogglebutton->remove();
treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-up"),iconsize)));
treetogglebutton->show_all();
void
-CanvasView::on_waypoint_clicked(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint,int button)
+CanvasView::on_waypoint_clicked(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint,int button)
{
waypoint_dialog.set_value_desc(value_desc);
waypoint_dialog.set_waypoint(waypoint);
sigc::bind(
sigc::mem_fun(
*canvas_interface(),
- &sinfgapp::CanvasInterface::set_time
+ &synfigapp::CanvasInterface::set_time
),
waypoint.get_time()
)
)
));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-duplicate"),
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-duplicate"),
sigc::bind(
sigc::bind(
sigc::mem_fun(
*canvas_interface(),
- &sinfgapp::CanvasInterface::waypoint_duplicate
+ &synfigapp::CanvasInterface::waypoint_duplicate
),
waypoint
),
sigc::bind(
sigc::mem_fun(
*canvas_interface(),
- &sinfgapp::CanvasInterface::waypoint_remove
+ &synfigapp::CanvasInterface::waypoint_remove
),
waypoint
),
void
CanvasView::on_waypoint_changed()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",get_canvas());
param_list.add("canvas_interface",canvas_interface());
param_list.add("value_node",waypoint_dialog.get_value_desc().get_value_node());
void
CanvasView::on_waypoint_delete()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",get_canvas());
param_list.add("canvas_interface",canvas_interface());
param_list.add("value_node",waypoint_dialog.get_value_desc().get_value_node());
{
// We will make this true once we have a solid drop
bool success(false);
- //sinfg::info("Droped data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("Droped data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ //synfig::info("Droped data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Droped data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("selection=\"%s\"",gdk_atom_name(selection_data->selection));
if ((selection_data_.get_length() >= 0) && (selection_data_.get_format() == 8))
{
- if(sinfg::String(selection_data_.get_data_type())=="STRING")do
+ if(synfig::String(selection_data_.get_data_type())=="STRING")do
{
- sinfg::String selection_data((gchar *)(selection_data_.get_data()));
+ synfig::String selection_data((gchar *)(selection_data_.get_data()));
- Layer::Handle layer(sinfg::Layer::create("Text"));
+ Layer::Handle layer(synfig::Layer::create("Text"));
if(!layer)
break;
if(!layer->set_param("text",ValueBase(selection_data)))
break;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_add"));
assert(action);
if(!action)
success=true;
} while(0); // END of "STRING"
- if(sinfg::String(selection_data_.get_data_type())=="text/plain")
+ if(synfig::String(selection_data_.get_data_type())=="text/plain")
{
- sinfg::String selection_data((gchar *)(selection_data_.get_data()));
+ synfig::String selection_data((gchar *)(selection_data_.get_data()));
// For some reason, GTK hands us a list of URL's seperated
// by not only Carrage-Returns, but also Line-Feeds.
// Line-Feeds will mess us up. Remove all the line-feeds.
- while(selection_data.find_first_of('\r')!=sinfg::String::npos)
+ while(selection_data.find_first_of('\r')!=synfig::String::npos)
selection_data.erase(selection_data.begin()+selection_data.find_first_of('\r'));
std::stringstream stream(selection_data);
- //sinfgapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Insert Image"));
+ //synfigapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Insert Image"));
while(stream)
{
- sinfg::String filename,URI;
+ synfig::String filename,URI;
getline(stream,filename);
// If we don't have a filename, move on.
URI=String(filename.begin(),filename.begin()+sizeof("file://")-1);
if(URI!="file://")
{
- sinfg::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str());
+ synfig::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str());
continue;
}
// Strip the "file://" part from the filename
- filename=sinfg::String(filename.begin()+sizeof("file://")-1,filename.end());
+ filename=synfig::String(filename.begin()+sizeof("file://")-1,filename.end());
String ext;
try{ext=(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));}catch(...){continue;}
void
CanvasView::on_keyframe_add_pressed()
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_add"));
if(!action)
{
}
keyframe=row[model.keyframe];
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_duplicate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_duplicate"));
if(!action)
{
}
keyframe=row[model.keyframe];
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_remove"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_remove"));
if(!action)
{
break;
default:
- sinfg::warning("CanvasView::toggle_duck_mask():Unknown duck type!");
+ synfig::warning("CanvasView::toggle_duck_mask():Unknown duck type!");
break;
}
}
assert(device);
- sinfgapp::InputDevice::Handle input_device;
- input_device=sinfgapp::Main::select_input_device(device->name);
+ synfigapp::InputDevice::Handle input_device;
+ input_device=synfigapp::Main::select_input_device(device->name);
App::toolbox->change_state(input_device->get_state());
process_event_key(EVENT_INPUT_DEVICE_CHANGED);
}
void
CanvasView::on_audio_option()
{
- sinfg::warning("Launching Audio Options");
+ synfig::warning("Launching Audio Options");
sound_dialog->set_global_fps(get_canvas()->rend_desc().get_frame_rate());
sound_dialog->present();
}
if(!audio->load(file,dirname(get_canvas()->get_file_name())+string("/")))
{
- if(file != "") sinfg::warning("Could not load the file: %s", file.c_str());
+ if(file != "") synfig::warning("Could not load the file: %s", file.c_str());
get_canvas()->erase_meta_data("audiofile");
disp_audio->hide();
disp_audio->set_profile(etl::handle<AudioProfile>());
}else
{
//save in canvasview
- sinfg::warning("Getting the profile of the music stuff");
+ synfig::warning("Getting the profile of the music stuff");
//profile specific stuff for the preview widget
//similar for other attachments
if(!prof)
{
- sinfg::warning("Agh, I couldn't build the profile captain!");
+ synfig::warning("Agh, I couldn't build the profile captain!");
}
pd->get_widget().set_audioprofile(prof);
disp_audio->set_profile(audio->get_profile());
disp_audio->show();
- sinfg::warning("successfully set the profiles and stuff");
+ synfig::warning("successfully set the profiles and stuff");
}
disp_audio->queue_draw();
}
sound_dialog->set_offset(t);
disp_audio->queue_draw();
- sinfg::info("CanvasView::on_audio_offset_notify(): offset time set to %s",t.get_string(get_canvas()->rend_desc().get_frame_rate()).c_str());
+ synfig::info("CanvasView::on_audio_offset_notify(): offset time set to %s",t.get_string(get_canvas()->rend_desc().get_frame_rate()).c_str());
}
void
{
if(audio.get())
{
- sinfg::info("Playing audio at %f s",t);
+ synfig::info("Playing audio at %f s",t);
audio->play(t);
}
}
Glib::RefPtr<Glib::ObjectBase>
-CanvasView::get_ref_obj(const sinfg::String& x)
+CanvasView::get_ref_obj(const synfig::String& x)
{
return ref_obj_book_[x];
}
Glib::RefPtr<const Glib::ObjectBase>
-CanvasView::get_ref_obj(const sinfg::String& x)const
+CanvasView::get_ref_obj(const synfig::String& x)const
{
return ref_obj_book_.find(x)->second;
}
void
-CanvasView::set_ref_obj(const sinfg::String& x, Glib::RefPtr<Glib::ObjectBase> y)
+CanvasView::set_ref_obj(const synfig::String& x, Glib::RefPtr<Glib::ObjectBase> y)
{
ref_obj_book_[x]=y;
}
Glib::RefPtr<Gtk::TreeModel>
-CanvasView::get_tree_model(const sinfg::String& x)
+CanvasView::get_tree_model(const synfig::String& x)
{
return Glib::RefPtr<Gtk::TreeModel>::cast_dynamic(ref_obj_book_["_tree_model_"+x]);
}
Glib::RefPtr<const Gtk::TreeModel>
-CanvasView::get_tree_model(const sinfg::String& x)const
+CanvasView::get_tree_model(const synfig::String& x)const
{
return Glib::RefPtr<Gtk::TreeModel>::cast_dynamic(ref_obj_book_.find("_tree_model_"+x)->second);
}
void
-CanvasView::set_tree_model(const sinfg::String& x, Glib::RefPtr<Gtk::TreeModel> y)
+CanvasView::set_tree_model(const synfig::String& x, Glib::RefPtr<Gtk::TreeModel> y)
{
ref_obj_book_["_tree_model_"+x]=Glib::RefPtr<Glib::ObjectBase>::cast_static(y);
}
Gtk::Widget*
-CanvasView::get_ext_widget(const sinfg::String& x)
+CanvasView::get_ext_widget(const synfig::String& x)
{
return ext_widget_book_[x];
}
void
-CanvasView::set_ext_widget(const sinfg::String& x, Gtk::Widget* y)
+CanvasView::set_ext_widget(const synfig::String& x, Gtk::Widget* y)
{
ext_widget_book_[x]=y;
if(x=="layers_cmp")
{
etl::handle<Instance> argh(instance);
instance->safe_close();
- sinfg::info("closed");
+ synfig::info("closed");
return false;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvasview.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_GTKMM_CANVASVIEW_H
-#define __SINFG_STUDIO_GTKMM_CANVASVIEW_H
+#ifndef __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
+#define __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/notebook.h>
#include <gdkmm/device.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/selectionmanager.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/selectionmanager.h>
-#include <sinfg/canvas.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfig/canvas.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
#include "instance.h"
#include "canvasproperties.h"
#include <map>
#include <gtkmm/toggleaction.h>
#include <gtkmm/radioaction.h>
-#include <sinfg/rect.h>
+#include <synfig/rect.h>
#include "adjust_window.h"
-#include <sinfg/transform.h>
+#include <synfig/transform.h>
/* === M A C R O S ========================================================= */
class Dialog_SoundSelect;
class Dialog_Preview;
-class sinfg::TransformStack;
+class synfig::TransformStack;
class Dock_Layers;
class Dock_Children;
class Dock_Keyframes;
};
friend class IsWorking;
- typedef sinfgapp::CanvasInterface::Mode Mode;
+ typedef synfigapp::CanvasInterface::Mode Mode;
/*
-- ** -- P R I V A T E D A T A ---------------------------------------------
WorkArea* get_work_area() { return work_area.get(); }
private:
- sinfg::TransformStack curr_transform_stack;
+ synfig::TransformStack curr_transform_stack;
bool curr_transform_stack_set;
- sinfg::Rect bbox;
+ synfig::Rect bbox;
DEBUGPOINT_CLASS(1);
DEBUGPOINT_CLASS(2);
etl::loose_handle<Instance> instance_;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
DEBUGPOINT_CLASS(3);
DEBUGPOINT_CLASS(5);
- //std::map<sinfg::String,Glib::RefPtr<Gtk::TreeModel> > tree_model_book_;
- std::map<sinfg::String,Glib::RefPtr<Glib::ObjectBase> > ref_obj_book_;
- std::map<sinfg::String,Gtk::Widget*> ext_widget_book_;
+ //std::map<synfig::String,Glib::RefPtr<Gtk::TreeModel> > tree_model_book_;
+ std::map<synfig::String,Glib::RefPtr<Glib::ObjectBase> > ref_obj_book_;
+ std::map<synfig::String,Gtk::Widget*> ext_widget_book_;
//! The time adjustment's scope is defined by the time_window adjustment
Glib::RefPtr<Gtk::ActionGroup> action_group;
- etl::handle<sinfgapp::UIInterface> ui_interface_;
- etl::handle<sinfgapp::SelectionManager> selection_manager_;
+ etl::handle<synfigapp::UIInterface> ui_interface_;
+ etl::handle<synfigapp::SelectionManager> selection_manager_;
bool is_playing_;
private:
// Constructor is private to force the use of the "create()" constructor
- CanvasView(etl::loose_handle<Instance> instance,etl::handle<sinfgapp::CanvasInterface> canvas_interface);
+ CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigapp::CanvasInterface> canvas_interface);
//! Constructor Helper
Gtk::Widget* create_layer_tree();
//! Constructor Helper - Initializes all of the menus
void init_menus();
- bool duck_change_param(const sinfg::Point &value,sinfg::Layer::Handle layer, sinfg::String param_name);
+ bool duck_change_param(const synfig::Point &value,synfig::Layer::Handle layer, synfig::String param_name);
void refresh_time_window();
- void popup_param_menu_bezier(float location, sinfgapp::ValueDesc value_desc)
+ void popup_param_menu_bezier(float location, synfigapp::ValueDesc value_desc)
{ popup_param_menu(value_desc,location); }
- void popup_param_menu(sinfgapp::ValueDesc value_desc, float location=0);
+ void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0);
- void workarea_layer_selected(sinfg::Layer::Handle layer);
+ void workarea_layer_selected(synfig::Layer::Handle layer);
- void selected_layer_color_set(sinfg::Color color);
+ void selected_layer_color_set(synfig::Color color);
- void register_layer_type(sinfg::Layer::Book::value_type &lyr,std::map<sinfg::String,Gtk::Menu*>*);
+ void register_layer_type(synfig::Layer::Book::value_type &lyr,std::map<synfig::String,Gtk::Menu*>*);
//! Rebuilds the "new layer" menu
void build_new_layer_menu(Gtk::Menu &menu);
- void rebuild_ducks_layer_(sinfg::TransformStack& transform_stack, sinfg::Canvas::Handle canvas, std::set<sinfg::Layer::Handle>& selected_list);
+ void rebuild_ducks_layer_(synfig::TransformStack& transform_stack, synfig::Canvas::Handle canvas, std::set<synfig::Layer::Handle>& selected_list);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
*/
public:
- const sinfg::TransformStack& get_curr_transform_stack()const { return curr_transform_stack; }
+ const synfig::TransformStack& get_curr_transform_stack()const { return curr_transform_stack; }
- const sinfg::Rect& get_bbox()const { return bbox; }
+ const synfig::Rect& get_bbox()const { return bbox; }
- Glib::RefPtr<Glib::ObjectBase> get_ref_obj(const sinfg::String& x);
- Glib::RefPtr<const Glib::ObjectBase> get_ref_obj(const sinfg::String& x)const;
- void set_ref_obj(const sinfg::String& x, Glib::RefPtr<Glib::ObjectBase> y);
+ Glib::RefPtr<Glib::ObjectBase> get_ref_obj(const synfig::String& x);
+ Glib::RefPtr<const Glib::ObjectBase> get_ref_obj(const synfig::String& x)const;
+ void set_ref_obj(const synfig::String& x, Glib::RefPtr<Glib::ObjectBase> y);
- Glib::RefPtr<Gtk::TreeModel> get_tree_model(const sinfg::String& x);
- Glib::RefPtr<const Gtk::TreeModel> get_tree_model(const sinfg::String& x)const;
- void set_tree_model(const sinfg::String& x, Glib::RefPtr<Gtk::TreeModel> y);
+ Glib::RefPtr<Gtk::TreeModel> get_tree_model(const synfig::String& x);
+ Glib::RefPtr<const Gtk::TreeModel> get_tree_model(const synfig::String& x)const;
+ void set_tree_model(const synfig::String& x, Glib::RefPtr<Gtk::TreeModel> y);
- Gtk::Widget* get_ext_widget(const sinfg::String& x);
- void set_ext_widget(const sinfg::String& x, Gtk::Widget* y);
+ Gtk::Widget* get_ext_widget(const synfig::String& x);
+ void set_ext_widget(const synfig::String& x, Gtk::Widget* y);
- //std::map<sinfg::String,Gtk::Widget*>& tree_view_book() { return tree_view_book_; }
- //std::map<sinfg::String,Gtk::Widget*>& ext_widget_book() { return tree_view_book_; }
+ //std::map<synfig::String,Gtk::Widget*>& tree_view_book() { return tree_view_book_; }
+ //std::map<synfig::String,Gtk::Widget*>& ext_widget_book() { return tree_view_book_; }
void popup_main_menu();
Smach::event_result process_event_key(EventKey x);
- void popup_layer_menu(sinfg::Layer::Handle layer);
+ void popup_layer_menu(synfig::Layer::Handle layer);
virtual ~CanvasView();
const studio::Adjust_Window &time_window_adjustment()const { return time_window_adjustment_; }
- etl::handle<sinfgapp::UIInterface> get_ui_interface() { return ui_interface_;}
+ etl::handle<synfigapp::UIInterface> get_ui_interface() { return ui_interface_;}
- etl::handle<sinfgapp::SelectionManager> get_selection_manager() { return selection_manager_; }
+ etl::handle<synfigapp::SelectionManager> get_selection_manager() { return selection_manager_; }
Glib::RefPtr<Gtk::TreeModel> layer_tree_store() { return get_tree_model("layers"); }
Glib::RefPtr<const Gtk::TreeModel> keyframe_tree_store()const { return get_tree_model("keyframes"); }
- void set_time(sinfg::Time t) { canvas_interface_->set_time(t); }
+ void set_time(synfig::Time t) { canvas_interface_->set_time(t); }
- sinfg::Time get_time() { return canvas_interface_->get_time(); }
+ synfig::Time get_time() { return canvas_interface_->get_time(); }
- etl::handle<sinfg::Canvas> get_canvas()const { return canvas_interface_->get_canvas(); }
+ etl::handle<synfig::Canvas> get_canvas()const { return canvas_interface_->get_canvas(); }
etl::handle<Instance> get_instance()const { return instance_; }
- etl::handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
+ etl::handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
- etl::handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
+ etl::handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
- void add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list, sinfgapp::Action::Category category=sinfgapp::Action::CATEGORY_ALL)const;
+ void add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const;
//! Updates the title of the window
void update_title();
//! \writeme
void rebuild_ducks();
- //bool add_to_ducks(sinfgapp::ValueDesc value_desc, sinfg::ParamDesc *param_desc=NULL);
+ //bool add_to_ducks(synfigapp::ValueDesc value_desc, synfig::ParamDesc *param_desc=NULL);
//! Starts "playing" the animation in real-time
void play();
void time_zoom_in();
void time_zoom_out();
- void add_layer(sinfg::String x);
+ void add_layer(synfig::String x);
void show_keyframe_dialog();
void image_import();
- void on_waypoint_clicked(sinfgapp::ValueDesc,sinfg::Waypoint, int button);
+ void on_waypoint_clicked(synfigapp::ValueDesc,synfig::Waypoint, int button);
void preview_option() {on_preview_option();}
bool on_keyframe_tree_event(GdkEvent *event);
- //void on_children_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value);
+ //void on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
void on_dirty_preview();
// void on_layer_toggle(const Glib::ustring& path_string, Gtk::TreeModelColumn<bool> column);
- void on_mode_changed(sinfgapp::CanvasInterface::Mode mode);
+ void on_mode_changed(synfigapp::CanvasInterface::Mode mode);
-// void on_layer_waypoint_clicked(const Glib::ustring &, sinfg::ValueNode_Animated::WaypointList::iterator);
+// void on_layer_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator);
- //void on_children_waypoint_clicked(const Glib::ustring &, sinfg::ValueNode_Animated::WaypointList::iterator);
+ //void on_children_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator);
void on_waypoint_changed();
void on_audio_option();
void on_audio_file_change(const std::string &f);
- void on_audio_offset_change(const sinfg::Time &t);
+ void on_audio_offset_change(const synfig::Time &t);
void on_audio_file_notify();
void on_audio_offset_notify();
- bool on_duck_changed(const sinfg::Point &value,const sinfgapp::ValueDesc& value_desc);
+ bool on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc);
- void on_layer_toggle(sinfg::Layer::Handle);
+ void on_layer_toggle(synfig::Layer::Handle);
- void on_edited_value(sinfgapp::ValueDesc,sinfg::ValueBase);
+ void on_edited_value(synfigapp::ValueDesc,synfig::ValueBase);
- //void on_waypoint_clicked(sinfgapp::ValueDesc,sinfg::ValueNode_Animated::WaypointList::iterator, int button);
+ //void on_waypoint_clicked(synfigapp::ValueDesc,synfig::ValueNode_Animated::WaypointList::iterator, int button);
void on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint time);
public:
- static etl::handle<studio::CanvasView> create(etl::loose_handle<Instance> instance,etl::handle<sinfg::Canvas> canvas);
+ static etl::handle<studio::CanvasView> create(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas);
}; // END of class CanvasView
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_gradient.cpp
** \brief Template File
**
using namespace std;
//using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
CellRenderer_Gradient::CellRenderer_Gradient():
Glib::ObjectBase (typeid(CellRenderer_Gradient)),
Gtk::CellRendererText (),
- property_gradient_(*this,"gradient",sinfg::Gradient())
+ property_gradient_(*this,"gradient",synfig::Gradient())
{
//CellRendererText::signal_edited().connect(sigc::mem_fun(*this,&studio::CellRenderer_Gradient::string_edited_));
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_gradient.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_CELLRENDERER_GRADIENT_H
-#define __SINFG_STUDIO_CELLRENDERER_GRADIENT_H
+#ifndef __SYNFIG_STUDIO_CELLRENDERER_GRADIENT_H
+#define __SYNFIG_STUDIO_CELLRENDERER_GRADIENT_H
/* === H E A D E R S ======================================================= */
#include <sigc++/signal.h>
#include <sigc++/slot.h>
-#include <sinfg/gradient.h>
+#include <synfig/gradient.h>
/* === M A C R O S ========================================================= */
class CellRenderer_Gradient : public Gtk::CellRendererText
{
sigc::signal<void, const Glib::ustring&> signal_secondary_click_;
- sigc::signal<void, const Glib::ustring&, sinfg::Gradient> signal_edited_;
+ sigc::signal<void, const Glib::ustring&, synfig::Gradient> signal_edited_;
- Glib::Property<sinfg::Gradient> property_gradient_;
+ Glib::Property<synfig::Gradient> property_gradient_;
public:
- sigc::signal<void, const Glib::ustring&, sinfg::Gradient> &signal_edited()
+ sigc::signal<void, const Glib::ustring&, synfig::Gradient> &signal_edited()
{return signal_edited_; }
- Glib::PropertyProxy<sinfg::Gradient> property_gradient() { return property_gradient_.get_proxy();}
+ Glib::PropertyProxy<synfig::Gradient> property_gradient() { return property_gradient_.get_proxy();}
CellRenderer_Gradient();
~CellRenderer_Gradient();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_time.cpp
** \brief Template File
**
using namespace std;
//using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
CellRenderer_Time::CellRenderer_Time():
Glib::ObjectBase (typeid(CellRenderer_Time)),
Gtk::CellRendererText (),
- property_time_(*this,"time",sinfg::Time(0)),
+ property_time_(*this,"time",synfig::Time(0)),
property_fps_(*this,"fps", float(0))
{
CellRendererText::signal_edited().connect(sigc::mem_fun(*this,&studio::CellRenderer_Time::string_edited_));
CellRenderer_Time::~CellRenderer_Time()
{
- sinfg::info("CellRenderer_Time::~CellRenderer_Time(): deleted");
+ synfig::info("CellRenderer_Time::~CellRenderer_Time(): deleted");
}
void
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_time.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_CELLRENDERER_TIME_H
-#define __SINFG_STUDIO_CELLRENDERER_TIME_H
+#ifndef __SYNFIG_STUDIO_CELLRENDERER_TIME_H
+#define __SYNFIG_STUDIO_CELLRENDERER_TIME_H
/* === H E A D E R S ======================================================= */
#include <sigc++/signal.h>
#include <sigc++/slot.h>
-#include <sinfg/time.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
class CellRenderer_Time : public Gtk::CellRendererText
{
sigc::signal<void, const Glib::ustring&> signal_secondary_click_;
- sigc::signal<void, const Glib::ustring&, sinfg::Time> signal_edited_;
+ sigc::signal<void, const Glib::ustring&, synfig::Time> signal_edited_;
- Glib::Property<sinfg::Time> property_time_;
- Glib::Property<sinfg::Time> property_fps_;
+ Glib::Property<synfig::Time> property_time_;
+ Glib::Property<synfig::Time> property_fps_;
void string_edited_(const Glib::ustring&,const Glib::ustring&);
void on_value_editing_done();
public:
- sigc::signal<void, const Glib::ustring&, sinfg::Time> &signal_edited()
+ sigc::signal<void, const Glib::ustring&, synfig::Time> &signal_edited()
{return signal_edited_; }
- Glib::PropertyProxy<sinfg::Time> property_time() { return property_time_.get_proxy();}
- Glib::PropertyProxy<sinfg::Time> property_fps() { return property_fps_.get_proxy();}
+ Glib::PropertyProxy<synfig::Time> property_time() { return property_time_.get_proxy();}
+ Glib::PropertyProxy<synfig::Time> property_fps() { return property_fps_.get_proxy();}
CellRenderer_Time();
~CellRenderer_Time();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_timetrack.cpp
** \brief Template Header
**
#include "widget_time.h"
#include "widget_timeslider.h"
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include "instance.h"
-#include <sinfg/timepointcollect.h>
+#include <synfig/timepointcollect.h>
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace std;
using namespace etl;
using namespace studio;
Gtk::CellRenderer (),
adjustment_ (10,10,20,0,0,0),
- property_valuedesc_ (*this,"value_desc",sinfgapp::ValueDesc()),
- property_canvas_ (*this,"canvas",sinfg::Canvas::Handle()),
+ property_valuedesc_ (*this,"value_desc",synfigapp::ValueDesc()),
+ property_canvas_ (*this,"canvas",synfig::Canvas::Handle()),
property_adjustment_(*this,"adjustment",&adjustment_),
property_enable_timing_info_(*this,"enable-timing-info", false)
{
CellRenderer_TimeTrack::~CellRenderer_TimeTrack()
{
- sinfg::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): deleted");
+ synfig::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): deleted");
}
void
// x.signal_value_changed().connect(sigc::mem_fun(*this,&Gtk::Widget::queue_draw));
}
-sinfg::Canvas::Handle
+synfig::Canvas::Handle
CellRenderer_TimeTrack::get_canvas()const
{
return const_cast<CellRenderer_TimeTrack*>(this)->property_canvas().get_value();
}
//kind of a hack... pointer is ugly
-const sinfg::Node::time_set *get_times_from_vdesc(const sinfgapp::ValueDesc &v)
+const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v)
{
- if(v.get_value_type() == sinfg::ValueBase::TYPE_CANVAS)
+ if(v.get_value_type() == synfig::ValueBase::TYPE_CANVAS)
{
- sinfg::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle());
+ synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle());
if(canvasparam)
{
return 0;
}
-bool get_closest_time(const sinfg::Node::time_set &tset, const Time &t, const Time &range, Time &out)
+bool get_closest_time(const synfig::Node::time_set &tset, const Time &t, const Time &range, Time &out)
{
Node::time_set::const_iterator i,j,end = tset.end();
inactive_gc->set_stipple(Gdk::Bitmap::create(stipple_xpm,2,2));
inactive_gc->set_fill(Gdk::STIPPLED);
- sinfg::Canvas::Handle canvas(property_canvas().get_value());
+ synfig::Canvas::Handle canvas(property_canvas().get_value());
- sinfgapp::ValueDesc value_desc = property_value_desc().get_value();
- sinfg::ValueNode *base_value = value_desc.get_value_node().get();
- sinfg::ValueNode_Animated *value_node=dynamic_cast<sinfg::ValueNode_Animated*>(base_value);
+ synfigapp::ValueDesc value_desc = property_value_desc().get_value();
+ synfig::ValueNode *base_value = value_desc.get_value_node().get();
+ synfig::ValueNode_Animated *value_node=dynamic_cast<synfig::ValueNode_Animated*>(base_value);
- sinfg::ValueNode_DynamicList *parent_value_node(0);
+ synfig::ValueNode_DynamicList *parent_value_node(0);
if(property_value_desc().get_value().parent_is_value_node())
- parent_value_node=dynamic_cast<sinfg::ValueNode_DynamicList*>(property_value_desc().get_value().get_parent_value_node().get());
+ parent_value_node=dynamic_cast<synfig::ValueNode_DynamicList*>(property_value_desc().get_value().get_parent_value_node().get());
// If the canvas is defined, then load up the keyframes
if(canvas)
{
- const sinfg::KeyframeList& keyframe_list(canvas->keyframe_list());
- sinfg::KeyframeList::const_iterator iter;
+ const synfig::KeyframeList& keyframe_list(canvas->keyframe_list());
+ synfig::KeyframeList::const_iterator iter;
for(iter=keyframe_list.begin();iter!=keyframe_list.end();++iter)
{
//render all the time points that exist
{
- const sinfg::Node::time_set *tset = get_times_from_vdesc(value_desc);
+ const synfig::Node::time_set *tset = get_times_from_vdesc(value_desc);
if(tset)
{
- sinfg::Node::time_set::const_iterator i = tset->begin(), end = tset->end();
+ synfig::Node::time_set::const_iterator i = tset->begin(), end = tset->end();
float lower = adjustment->get_lower(),
upper = adjustment->get_upper();
gc->set_rgb_fg_color(Gdk::Color("#00EEEE"));
}
- //sinfg::info("Displaying time: %.3f s",(float)t);
+ //synfig::info("Displaying time: %.3f s",(float)t);
const int x = (int)((t-lower)*area.get_width()/(upper-lower));
//should draw me a grey filled circle...
if(!t.is_valid())
continue;
- //sinfg::info("Displaying time: %.3f s",(float)t);
+ //synfig::info("Displaying time: %.3f s",(float)t);
const int x = (int)((t-lower)*area.get_width()/(upper-lower));
//should draw me a grey filled circle...
if(value_node)
{
//now render the actual waypoints
- sinfg::ValueNode_Animated::WaypointList::iterator iter;
+ synfig::ValueNode_Animated::WaypointList::iterator iter;
for(
iter=value_node->waypoint_list().begin();
iter!=value_node->waypoint_list().end();
if(parent_value_node)
{
const int index(property_value_desc().get_value().get_index());
- const sinfg::ValueNode_DynamicList::ListEntry& list_entry(parent_value_node->list[index]);
- const sinfg::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(list_entry.timing_info);
- sinfg::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter,next;
+ const synfig::ValueNode_DynamicList::ListEntry& list_entry(parent_value_node->list[index]);
+ const synfig::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(list_entry.timing_info);
+ synfig::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter,next;
bool is_off(false);
if(!activepoint_list.empty())
}
}
-sinfg::ValueNode_Animated::WaypointList::iterator
-CellRenderer_TimeTrack::find_waypoint(const sinfg::Time& t,const sinfg::Time& scope)
+synfig::ValueNode_Animated::WaypointList::iterator
+CellRenderer_TimeTrack::find_waypoint(const synfig::Time& t,const synfig::Time& scope)
{
- sinfg::ValueNode_Animated *value_node=dynamic_cast<sinfg::ValueNode_Animated*>(property_value_desc().get_value().get_value_node().get());
+ synfig::ValueNode_Animated *value_node=dynamic_cast<synfig::ValueNode_Animated*>(property_value_desc().get_value().get_value_node().get());
Time nearest(Time::end());
- sinfg::ValueNode_Animated::WaypointList::iterator iter,ret;
+ synfig::ValueNode_Animated::WaypointList::iterator iter,ret;
if(value_node)
{
Gtk::CellRendererState flags)
{
path=treepath;
- sinfg::ValueNode_Animated::WaypointList::iterator iter;
+ synfig::ValueNode_Animated::WaypointList::iterator iter;
Time nearest=1000000000;
Gtk::Adjustment *adjustment=get_adjustment();
- sinfg::ValueNode_Animated *value_node=dynamic_cast<sinfg::ValueNode_Animated*>(property_value_desc().get_value().get_value_node().get());
+ synfig::ValueNode_Animated *value_node=dynamic_cast<synfig::ValueNode_Animated*>(property_value_desc().get_value().get_value_node().get());
- sinfg::Canvas::Handle canvas(get_canvas());
+ synfig::Canvas::Handle canvas(get_canvas());
- sinfg::ValueNode_DynamicList *parent_value_node(0);
+ synfig::ValueNode_DynamicList *parent_value_node(0);
if(property_value_desc().get_value().parent_is_value_node())
- parent_value_node=dynamic_cast<sinfg::ValueNode_DynamicList*>(property_value_desc().get_value().get_parent_value_node().get());
+ parent_value_node=dynamic_cast<synfig::ValueNode_DynamicList*>(property_value_desc().get_value().get_parent_value_node().get());
Time deltatime = 0;
Time curr_time;
will remove it from the the set if it is included.
*/
- sinfgapp::ValueDesc valdesc = property_value_desc().get_value();
+ synfigapp::ValueDesc valdesc = property_value_desc().get_value();
const Node::time_set *tset = get_times_from_vdesc(valdesc);
bool clickfound = tset && get_closest_time(*tset,actual_time,pixel_width*cell_area.get_height(),stime);
catch(int)
{
selection=false;
- selected=sinfg::UniqueID::nil();
+ selected=synfig::UniqueID::nil();
}
if((!sel_times.empty() || selection) && event->button.button==1)
if(parent_value_node)
{
const int index(property_value_desc().get_value().get_index());
- const sinfg::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(parent_value_node->list[index].timing_info);
- sinfg::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter;
+ const synfig::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(parent_value_node->list[index].timing_info);
+ synfig::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter;
for(iter=activepoint_list.begin();iter!=activepoint_list.end();++iter)
{
if(event->button.button==3)
{
Time stime;
- sinfgapp::ValueDesc valdesc = property_value_desc().get_value();
+ synfigapp::ValueDesc valdesc = property_value_desc().get_value();
const Node::time_set *tset = get_times_from_vdesc(valdesc);
bool clickfound = tset && get_closest_time(*tset,actual_time,pixel_width*cell_area.get_height(),stime);
- etl::handle<sinfg::Node> node;
+ etl::handle<synfig::Node> node;
if(valdesc.get_value(stime).get_type()==ValueBase::TYPE_CANVAS)
{
node=Canvas::Handle(valdesc.get_value(stime).get(Canvas::Handle()));
deltatime = actual_time - actual_dragtime;
if(sel_times.size() != 0 && (delmode || !deltatime.is_equal(Time(0))))
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",canvas_interface()->get_canvas());
param_list.add("canvas_interface",canvas_interface());
- if(sel_value.get_value_type() == sinfg::ValueBase::TYPE_CANVAS)
+ if(sel_value.get_value_type() == synfig::ValueBase::TYPE_CANVAS)
{
param_list.add("addcanvas",sel_value.get_value().get(Canvas::Handle()));
}else
}
set<Time> newset;
- std::set<sinfg::Time>::iterator i = sel_times.begin(), end = sel_times.end();
+ std::set<synfig::Time>::iterator i = sel_times.begin(), end = sel_times.end();
for(; i != end; ++i)
{
param_list.add("addtime",*i);
else
if(event->button.button==1)
{
- sinfg::Waypoint waypoint(*selected_waypoint);
+ synfig::Waypoint waypoint(*selected_waypoint);
Time newtime((waypoint.get_time()+(selected_time-drag_time)).round(canvas->rend_desc().get_frame_rate()));
if(waypoint.get_time()!=newtime)
{
-Glib::PropertyProxy<sinfgapp::ValueDesc>
+Glib::PropertyProxy<synfigapp::ValueDesc>
CellRenderer_TimeTrack::property_value_desc()
{
- return Glib::PropertyProxy<sinfgapp::ValueDesc>(this,"value_desc");
+ return Glib::PropertyProxy<synfigapp::ValueDesc>(this,"value_desc");
}
-Glib::PropertyProxy<sinfg::Canvas::Handle>
+Glib::PropertyProxy<synfig::Canvas::Handle>
CellRenderer_TimeTrack::property_canvas()
{
- return Glib::PropertyProxy<sinfg::Canvas::Handle>(this,"canvas");
+ return Glib::PropertyProxy<synfig::Canvas::Handle>(this,"canvas");
}
Glib::PropertyProxy<Gtk::Adjustment* >
}
void
-CellRenderer_TimeTrack::set_canvas_interface(etl::loose_handle<sinfgapp::CanvasInterface> h)
+CellRenderer_TimeTrack::set_canvas_interface(etl::loose_handle<synfigapp::CanvasInterface> h)
{
canvas_interface_ = h;
}
static void
-set_waypoint_model(std::set<sinfg::Waypoint, std::less<UniqueID> > waypoints, Waypoint::Model model, etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface)
+set_waypoint_model(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints, Waypoint::Model model, etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group"));
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group"));
- std::set<sinfg::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
for(iter=waypoints.begin();iter!=waypoints.end();++iter)
{
Waypoint waypoint(*iter);
waypoint.apply_model(model);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("waypoint_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set"));
assert(action);
}
void
-CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<sinfg::Node>& node, const sinfg::Time& time, Side side)
+CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, Side side)
{
- std::set<sinfg::Waypoint, std::less<UniqueID> > waypoint_set;
+ std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
int n;
- n=sinfg::waypoint_collect(waypoint_set,time,node);
+ n=synfig::waypoint_collect(waypoint_set,time,node);
Gtk::Menu* menu(manage(new Gtk::Menu()));
sigc::bind(
sigc::mem_fun(
*canvas_interface(),
- &sinfgapp::CanvasInterface::set_time
+ &synfigapp::CanvasInterface::set_time
),
time
)
return;
}
else
- sinfg::info("Too many waypoints under me");
+ synfig::info("Too many waypoints under me");
}
else
- sinfg::info("ZERO waypoints under me");
+ synfig::info("ZERO waypoints under me");
if(menu)menu->popup(3,gtk_get_current_event_time());
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_timetrack.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_CELLRENDERER_TIMETRACK_H
-#define __SINFG_GTKMM_CELLRENDERER_TIMETRACK_H
+#ifndef __SYNFIG_GTKMM_CELLRENDERER_TIMETRACK_H
+#define __SYNFIG_GTKMM_CELLRENDERER_TIMETRACK_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/menu.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
Gtk::Adjustment adjustment_;
//! Signal for when the user clicks on a waypoint
- sigc::signal<void, const Glib::ustring&,sinfg::Waypoint, int> signal_waypoint_clicked_;
+ sigc::signal<void, const Glib::ustring&,synfig::Waypoint, int> signal_waypoint_clicked_;
- sigc::signal<void, sinfg::Waypoint, sinfg::ValueNode::Handle> signal_waypoint_changed_;
+ sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> signal_waypoint_changed_;
//! Iterator for selected waypoint. (Should this be an UniqueID instead?)
- sinfg::ValueNode_Animated::WaypointList::iterator selected_waypoint;
+ synfig::ValueNode_Animated::WaypointList::iterator selected_waypoint;
- sinfg::UniqueID selected;
+ synfig::UniqueID selected;
//! selected information for time... (will work for way points etc...)
//TODO: make multiple... on both time and value select...
- std::set<sinfg::Time> sel_times;
- sinfgapp::ValueDesc sel_value;
- sinfg::Time actual_time;
- sinfg::Time actual_dragtime;
+ std::set<synfig::Time> sel_times;
+ synfigapp::ValueDesc sel_value;
+ synfig::Time actual_time;
+ synfig::Time actual_dragtime;
int mode;
//! ???
- sinfg::Time selected_time;
+ synfig::Time selected_time;
//! The path to the current item in the tree model
Glib::ustring path;
bool dragging;
- sinfg::Time drag_time;
+ synfig::Time drag_time;
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
/*
-- ** -- P R O P E R T I E S -------------------------------------------------
private:
//! ValueBase Desc
- Glib::Property<sinfgapp::ValueDesc> property_valuedesc_;
+ Glib::Property<synfigapp::ValueDesc> property_valuedesc_;
//! Canvas
- Glib::Property<sinfg::Canvas::Handle> property_canvas_;
+ Glib::Property<synfig::Canvas::Handle> property_canvas_;
//! ??? \see adjustment_
Glib::Property<Gtk::Adjustment* > property_adjustment_;
public:
- Glib::PropertyProxy<sinfgapp::ValueDesc> property_value_desc();
+ Glib::PropertyProxy<synfigapp::ValueDesc> property_value_desc();
- Glib::PropertyProxy<sinfg::Canvas::Handle> property_canvas();
+ Glib::PropertyProxy<synfig::Canvas::Handle> property_canvas();
Glib::PropertyProxy<Gtk::Adjustment* > property_adjustment();
public:
- sigc::signal<void, const Glib::ustring&,sinfg::Waypoint,int> &signal_waypoint_clicked()
+ sigc::signal<void, const Glib::ustring&,synfig::Waypoint,int> &signal_waypoint_clicked()
{return signal_waypoint_clicked_; }
- sigc::signal<void, sinfg::Waypoint, sinfg::ValueNode::Handle> &signal_waypoint_changed()
+ sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> &signal_waypoint_changed()
{return signal_waypoint_changed_; }
/*
CellRenderer_TimeTrack();
~CellRenderer_TimeTrack();
- void show_timepoint_menu(const etl::handle<sinfg::Node>& node, const sinfg::Time& time, Side side=SIDE_RIGHT);
+ void show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, Side side=SIDE_RIGHT);
void set_adjustment(Gtk::Adjustment &x);
Gtk::Adjustment *get_adjustment();
const Gtk::Adjustment *get_adjustment()const;
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface()const {return canvas_interface_;}
- void set_canvas_interface(etl::loose_handle<sinfgapp::CanvasInterface> h); //this should only be called by smart people
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface()const {return canvas_interface_;}
+ void set_canvas_interface(etl::loose_handle<synfigapp::CanvasInterface> h); //this should only be called by smart people
- sinfg::Canvas::Handle get_canvas()const;
+ synfig::Canvas::Handle get_canvas()const;
- bool is_selected(const sinfg::Waypoint& waypoint)const;
+ bool is_selected(const synfig::Waypoint& waypoint)const;
- sinfg::ValueNode_Animated::WaypointList::iterator find_waypoint(const sinfg::Time& t, const sinfg::Time& scope=sinfg::Time::end());
+ synfig::ValueNode_Animated::WaypointList::iterator find_waypoint(const synfig::Time& t, const synfig::Time& scope=synfig::Time::end());
virtual void
render_vfunc(
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_value.cpp
** \brief Template File
**
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace etl;
using namespace std;
using namespace studio;
}
else
{
- sinfg::error("on_editing_done(): Called twice!");
+ synfig::error("on_editing_done(): Called twice!");
}
}
void set_parent(Gtk::Widget*x) { parent=x; }
{
path=p;
}
- void set_value(const sinfg::ValueBase &data)
+ void set_value(const synfig::ValueBase &data)
{
if(valuewidget)
valuewidget->set_value(data);
//valuewidget->grab_focus();
}
- void set_canvas(const etl::handle<sinfg::Canvas> &data)
+ void set_canvas(const etl::handle<synfig::Canvas> &data)
{
assert(data);
if(valuewidget)
valuewidget->set_canvas(data);
}
- void set_param_desc(const sinfg::ParamDesc &data)
+ void set_param_desc(const synfig::ParamDesc &data)
{
if(valuewidget)
valuewidget->set_param_desc(data);
}
- const sinfg::ValueBase &get_value()
+ const synfig::ValueBase &get_value()
{
if(valuewidget)
return valuewidget->get_value();
- return sinfg::ValueBase();
+ return synfig::ValueBase();
}
const Glib::ustring &get_path()
{
/* === P R O C E D U R E S ================================================= */
-bool get_paragraph(sinfg::String& text)
+bool get_paragraph(synfig::String& text)
{
Gtk::Dialog dialog(
_("Paragraph"), // Title
CellRenderer_ValueBase::CellRenderer_ValueBase():
Glib::ObjectBase (typeid(CellRenderer_ValueBase)),
Gtk::CellRendererText (),
- property_value_ (*this,"value",sinfg::ValueBase()),
- property_canvas_(*this,"canvas",etl::handle<sinfg::Canvas>()),
- property_param_desc_(*this,"param_desc",sinfg::ParamDesc())
+ property_value_ (*this,"value",synfig::ValueBase()),
+ property_canvas_(*this,"canvas",etl::handle<synfig::Canvas>()),
+ property_param_desc_(*this,"param_desc",synfig::ParamDesc())
{
CellRendererText::signal_edited().connect(sigc::mem_fun(*this,&CellRenderer_ValueBase::string_edited_));
value_entry=new ValueBase_Entry();
CellRenderer_ValueBase::~CellRenderer_ValueBase()
{
-// sinfg::info("CellRenderer_ValueBase::~CellRenderer_ValueBase(): deleted");
+// synfig::info("CellRenderer_ValueBase::~CellRenderer_ValueBase(): deleted");
}
void
switch(data.get_type())
{
case ValueBase::TYPE_REAL:
- if(((sinfg::ParamDesc)property_param_desc_).get_is_distance())
+ if(((synfig::ParamDesc)property_param_desc_).get_is_distance())
{
Distance x(data.get(Real()),Distance::SYSTEM_UNITS);
x.convert(App::distance_system,get_canvas()->rend_desc());
property_text()=(Glib::ustring)strprintf("%.2f DEG",(Real)Angle::deg(data.get(Angle())).get());
break;
case ValueBase::TYPE_INTEGER:
- if(((sinfg::ParamDesc)property_param_desc_).get_hint()!="enum")
+ if(((synfig::ParamDesc)property_param_desc_).get_hint()!="enum")
{
property_text()=(Glib::ustring)strprintf("%i",data.get(int()));
}
else
{
property_text()=(Glib::ustring)strprintf("(%i)",data.get(int()));
- std::list<sinfg::ParamDesc::EnumData> enum_list=((sinfg::ParamDesc)property_param_desc_).get_enum_list();
- std::list<sinfg::ParamDesc::EnumData>::iterator iter;
+ std::list<synfig::ParamDesc::EnumData> enum_list=((synfig::ParamDesc)property_param_desc_).get_enum_list();
+ std::list<synfig::ParamDesc::EnumData>::iterator iter;
for(iter=enum_list.begin();iter!=enum_list.end();iter++)
if(iter->value==data.get(int()))
if(data.get_type()==ValueBase::TYPE_STRING)
{
- if(!data.get(sinfg::String()).empty())
- property_text()=static_cast<Glib::ustring>(data.get(sinfg::String()));
+ if(!data.get(synfig::String()).empty())
+ property_text()=static_cast<Glib::ustring>(data.get(synfig::String()));
else
property_text()=Glib::ustring("<empty>");
}
break;
case ValueBase::TYPE_CANVAS:
- if(data.get(etl::handle<sinfg::Canvas>()))
+ if(data.get(etl::handle<synfig::Canvas>()))
{
- if(data.get(etl::handle<sinfg::Canvas>())->is_inline())
+ if(data.get(etl::handle<synfig::Canvas>())->is_inline())
property_text()="<Inline Canvas>";
else
- property_text()=(Glib::ustring)data.get(etl::handle<sinfg::Canvas>())->get_id();
+ property_text()=(Glib::ustring)data.get(etl::handle<synfig::Canvas>())->get_id();
}
else
property_text()="<No Image Selected>";
*/
void
-CellRenderer_ValueBase::gradient_edited(sinfg::Gradient gradient, Glib::ustring path)
+CellRenderer_ValueBase::gradient_edited(synfig::Gradient gradient, Glib::ustring path)
{
ValueBase old_value(property_value_.get_value());
ValueBase value(gradient);
}
void
-CellRenderer_ValueBase::color_edited(sinfg::Color color, Glib::ustring path)
+CellRenderer_ValueBase::color_edited(synfig::Color color, Glib::ustring path)
{
ValueBase old_value(property_value_.get_value());
ValueBase value(color);
case ValueBase::TYPE_STRING:
if(get_param_desc().get_hint()=="paragraph")
{
- sinfg::String string;
+ synfig::String string;
string=data.get(string);
if(get_paragraph(string))
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file cellrenderer_value.cpp
** \brief Template File
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_CELLRENDERER_VALUE_H
-#define __SINFG_GTKMM_CELLRENDERER_VALUE_H
+#ifndef __SYNFIG_GTKMM_CELLRENDERER_VALUE_H
+#define __SYNFIG_GTKMM_CELLRENDERER_VALUE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/colorselection.h>
#include <gtkmm/optionmenu.h>
-//#include <sinfg/sinfg.h>
-#include <sinfg/paramdesc.h>
-#include <sinfg/value.h>
+//#include <synfig/synfig.h>
+#include <synfig/paramdesc.h>
+#include <synfig/value.h>
/* === M A C R O S ========================================================= */
class CellRenderer_ValueBase : public Gtk::CellRendererText
{
sigc::signal<void, const Glib::ustring&> signal_secondary_click_;
- sigc::signal<void, const Glib::ustring&, sinfg::ValueBase> signal_edited_;
+ sigc::signal<void, const Glib::ustring&, synfig::ValueBase> signal_edited_;
- Glib::Property<sinfg::ValueBase> property_value_;
- Glib::Property<etl::handle<sinfg::Canvas> > property_canvas_;
- Glib::Property<sinfg::ParamDesc> property_param_desc_;
+ Glib::Property<synfig::ValueBase> property_value_;
+ Glib::Property<etl::handle<synfig::Canvas> > property_canvas_;
+ Glib::Property<synfig::ParamDesc> property_param_desc_;
void string_edited_(const Glib::ustring&,const Glib::ustring&);
- void gradient_edited(sinfg::Gradient gradient, Glib::ustring path);
- void color_edited(sinfg::Color color, Glib::ustring path);
+ void gradient_edited(synfig::Gradient gradient, Glib::ustring path);
+ void color_edited(synfig::Color color, Glib::ustring path);
public:
sigc::signal<void, const Glib::ustring&> &signal_secondary_click()
{return signal_secondary_click_; }
- sigc::signal<void, const Glib::ustring&, sinfg::ValueBase> &signal_edited()
+ sigc::signal<void, const Glib::ustring&, synfig::ValueBase> &signal_edited()
{return signal_edited_; }
- Glib::PropertyProxy<sinfg::ValueBase> property_value() { return property_value_.get_proxy();}
- Glib::PropertyProxy<etl::handle<sinfg::Canvas> > property_canvas() { return property_canvas_.get_proxy();}
- Glib::PropertyProxy<sinfg::ParamDesc> property_param_desc() { return property_param_desc_.get_proxy(); }
+ Glib::PropertyProxy<synfig::ValueBase> property_value() { return property_value_.get_proxy();}
+ Glib::PropertyProxy<etl::handle<synfig::Canvas> > property_canvas() { return property_canvas_.get_proxy();}
+ Glib::PropertyProxy<synfig::ParamDesc> property_param_desc() { return property_param_desc_.get_proxy(); }
Glib::PropertyProxy<bool> property_inconsistant() { return property_foreground_set(); }
- etl::handle<sinfg::Canvas> get_canvas()const { return property_canvas_; }
- sinfg::ParamDesc get_param_desc()const { return property_param_desc_; }
+ etl::handle<synfig::Canvas> get_canvas()const { return property_canvas_; }
+ synfig::ParamDesc get_param_desc()const { return property_param_desc_; }
CellRenderer_ValueBase();
~CellRenderer_ValueBase();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file childrentree.cpp
** \brief Template File
**
#include "childrentree.h"
#include "cellrenderer_value.h"
#include "cellrenderer_timetrack.h"
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#include <gtkmm/scrolledwindow.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
// Set up the value cell-renderer
cellrenderer_value=ChildrenTreeStore::add_cell_renderer_value(column);
cellrenderer_value->signal_edited().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_edited_value));
- cellrenderer_value->property_value()=sinfg::ValueBase();
+ cellrenderer_value->property_value()=synfig::ValueBase();
// Finish setting up the column
tree_view.append_column(*column);
/*
Gtk::Image *icon;
- //Gtk::IconSize iconsize(Gtk::IconSize::from_name("sinfg-small_icon"));
+ //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
Gtk::IconSize iconsize(Gtk::ICON_SIZE_SMALL_TOOLBAR);
SMALL_BUTTON(button_raise,"gtk-go-up","Raise");
SMALL_BUTTON(button_lower,"gtk-go-down","Lower");
- SMALL_BUTTON(button_duplicate,"sinfg-duplicate","Duplicate");
+ SMALL_BUTTON(button_duplicate,"synfig-duplicate","Duplicate");
SMALL_BUTTON(button_delete,"gtk-delete","Delete");
hbox->pack_start(*button_raise,Gtk::PACK_SHRINK);
void
-ChildrenTree::on_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value)
+ChildrenTree::on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value)
{
Gtk::TreePath path(path_string);
}
void
-ChildrenTree::on_waypoint_clicked(const Glib::ustring &path_string, sinfg::Waypoint waypoint,int button)
+ChildrenTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
{
Gtk::TreePath path(path_string);
const Gtk::TreeRow row = *(tree_view.get_model()->get_iter(path));
- signal_waypoint_clicked()(static_cast<sinfgapp::ValueDesc>(row[model.value_desc]),waypoint,button);
+ signal_waypoint_clicked()(static_cast<synfigapp::ValueDesc>(row[model.value_desc]),waypoint,button);
}
bool
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file childrentree.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_CHILDRENTREE_H
-#define __SINFG_STUDIO_CHILDRENTREE_H
+#ifndef __SYNFIG_STUDIO_CHILDRENTREE_H
+#define __SYNFIG_STUDIO_CHILDRENTREE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/scale.h>
#include <gtkmm/button.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "childrentreestore.h"
-#include <sinfg/valuenode_animated.h>
+#include <synfig/valuenode_animated.h>
#include "widget_value.h"
CellRenderer_ValueBase *cellrenderer_value;
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase> signal_edited_value_;
+ sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase> signal_edited_value_;
sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_user_click_;
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint, int> signal_waypoint_clicked_;
+ sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint, int> signal_waypoint_clicked_;
Gtk::Button *button_raise;
Gtk::Button *button_lower;
private:
- void on_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value);
+ void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
- void on_waypoint_clicked(const Glib::ustring &, sinfg::Waypoint,int button);
+ void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint,int button);
bool on_tree_event(GdkEvent *event);
void set_show_timetrack(bool x=true);
//! Signal called with a value has been edited.
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase>& signal_edited_value() { return signal_edited_value_; }
+ sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase>& signal_edited_value() { return signal_edited_value_; }
sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_user_click() { return signal_user_click_; }
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint, int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
+ sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint, int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
- etl::handle<sinfgapp::SelectionManager> get_selection_manager() { return children_tree_store_->canvas_interface()->get_selection_manager(); }
+ etl::handle<synfigapp::SelectionManager> get_selection_manager() { return children_tree_store_->canvas_interface()->get_selection_manager(); }
}; // END of ChildrenTree
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file childrentreestore.cpp
** \brief Template File
**
#include "childrentreestore.h"
#include "iconcontroler.h"
#include <gtkmm/button.h>
-#include <sinfg/paramdesc.h>
+#include <synfig/paramdesc.h>
#include <ETL/clock>
class Profiler : private etl::clock
const std::string name;
public:
Profiler(const std::string& name):name(name) { reset(); }
- ~Profiler() { float time(operator()()); sinfg::info("%s: took %f msec",name.c_str(),time*1000); }
+ ~Profiler() { float time(operator()()); synfig::info("%s: took %f msec",name.c_str(),time*1000); }
};
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return *model;
}
-ChildrenTreeStore::ChildrenTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+ChildrenTreeStore::ChildrenTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Gtk::TreeStore (ModelHack()),
CanvasTreeStore (canvas_interface_)
{
}
Glib::RefPtr<ChildrenTreeStore>
-ChildrenTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_)
+ChildrenTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_)
{
return Glib::RefPtr<ChildrenTreeStore>(new ChildrenTreeStore(canvas_interface_));
}
{
Gtk::TreeRow row = *(prepend(canvas_row.children()));
- row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("sinfg-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
row[model.id] = canvas->get_id();
row[model.name] = canvas->get_name();
Gtk::TreeRow row = *prepend(value_node_row.children());
- set_row(row,sinfgapp::ValueDesc(canvas_interface()->get_canvas(),value_node->get_id()),false);
+ set_row(row,synfigapp::ValueDesc(canvas_interface()->get_canvas(),value_node->get_id()),false);
}
void
}
void
-ChildrenTreeStore::on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node)
+ChildrenTreeStore::on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node)
{
changed_connection.disconnect();
//if(!execute_changed_queued())
{
if(column==model.value.index())
{
- Glib::Value<sinfg::ValueBase> x;
+ Glib::Value<synfig::ValueBase> x;
g_value_init(x.gobj(),model.value.type());
g_value_copy(value.gobj(),x.gobj());
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
if(value_desc)
{
canvas_interface()->change_value(value_desc,x.get());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file childrentreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_CHILDRENTREESTORE_H
-#define __SINFG_STUDIO_CHILDRENTREESTORE_H
+#ifndef __SYNFIG_STUDIO_CHILDRENTREESTORE_H
+#define __SYNFIG_STUDIO_CHILDRENTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include "canvastreestore.h"
-#include <sinfg/value.h>
-#include <sinfg/valuenode.h>
+#include <synfig/value.h>
+#include <synfig/valuenode.h>
#include <set>
/* === M A C R O S ========================================================= */
Gtk::TreeModel::Row value_node_row;
Gtk::TreeModel::Row canvas_row;
- std::set<sinfg::ValueNode::Handle> changed_set_;
+ std::set<synfig::ValueNode::Handle> changed_set_;
- std::set<sinfg::ValueNode::Handle> replaced_set_;
+ std::set<synfig::ValueNode::Handle> replaced_set_;
/*
-- ** -- P R I V A T E M E T H O D S ---------------------------------------
private:
- void on_value_node_added(sinfg::ValueNode::Handle value_node);
- void on_value_node_deleted(sinfg::ValueNode::Handle value_node);
- void on_value_node_changed(sinfg::ValueNode::Handle value_node);
- void on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node);
- void on_canvas_added(sinfg::Canvas::Handle canvas);
- void on_canvas_removed(sinfg::Canvas::Handle canvas);
+ void on_value_node_added(synfig::ValueNode::Handle value_node);
+ void on_value_node_deleted(synfig::ValueNode::Handle value_node);
+ void on_value_node_changed(synfig::ValueNode::Handle value_node);
+ void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
+ void on_canvas_added(synfig::Canvas::Handle canvas);
+ void on_canvas_removed(synfig::Canvas::Handle canvas);
void set_value_impl(const Gtk::TreeModel::iterator& iter, int column, const Glib::ValueBase& value);
public:
- ChildrenTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ ChildrenTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
~ChildrenTreeStore();
void rebuild();
public:
- static Glib::RefPtr<ChildrenTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ static Glib::RefPtr<ChildrenTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
}; // END of class ChildrenTreeStore
}; // END of namespace studio
/*! ========================================================================
-** Sinfg
+** Synfig
** Template File
** $Id: compview.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
**
#include <sigc++/hide.h>
#include <sigc++/slot.h>
#include "canvasview.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
#define COLUMNID_JUMP (787584)
CompView::init_menu()
{
menu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-canvas_new"),
+ menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-canvas_new"),
sigc::mem_fun(*this,&CompView::menu_new_canvas)));
menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),
sigc::mem_fun(*this,&CompView::menu_delete)));
- menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-rename"),
+ menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-rename"),
sigc::mem_fun(*this,&CompView::menu_rename)));
}
-etl::loose_handle<sinfg::Canvas>
+etl::loose_handle<synfig::Canvas>
CompView::get_selected_canvas()
{
Glib::RefPtr<Gtk::TreeSelection> selection=canvas_tree->get_selection();
studio::Instance::CanvasTreeModel canvas_tree_model;
- return static_cast<etl::handle<sinfg::Canvas> >((*selection->get_selected())[canvas_tree_model.canvas]);
+ return static_cast<etl::handle<synfig::Canvas> >((*selection->get_selected())[canvas_tree_model.canvas]);
}
void
etl::loose_handle<studio::Instance> loose_instance(instance);
- instance->sinfgapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&CompView::refresh_instances));
- instance->sinfgapp::Instance::signal_filename_changed().connect(
+ instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&CompView::refresh_instances));
+ instance->synfigapp::Instance::signal_filename_changed().connect(
sigc::bind<etl::loose_handle<studio::Instance> >(
sigc::mem_fun(*this,&CompView::set_selected_instance),
loose_instance
//signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
{
- etl::handle<sinfgapp::Action::Undoable> action(row[model.action]);
+ etl::handle<synfigapp::Action::Undoable> action(row[model.action]);
if((bool)row[model.is_undo])
{
while(get_selected_instance()->undo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action)
{
menu.items().clear();
- sinfgapp::Action::ParamList param_list;
- param_list.add("canvas",sinfg::Canvas::Handle(get_selected_canvas()));
+ synfigapp::Action::ParamList param_list;
+ param_list.add("canvas",synfig::Canvas::Handle(get_selected_canvas()));
param_list.add("canvas_interface",get_selected_instance()->find_canvas_interface(get_selected_canvas()));
- get_selected_instance()->find_canvas_view(get_selected_canvas())->add_actions_to_menu(&menu, param_list,sinfgapp::Action::CATEGORY_CANVAS);
+ get_selected_instance()->find_canvas_view(get_selected_canvas())->add_actions_to_menu(&menu, param_list,synfigapp::Action::CATEGORY_CANVAS);
menu.popup(0,0);
menu.show();
break;
const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path));
- handle<sinfgapp::Action::Undoable> action=row[history_tree_model.action];
+ handle<synfigapp::Action::Undoable> action=row[history_tree_model.action];
- selected_instance->sinfgapp::Instance::set_action_status(action,!action->is_active());
+ selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active());
}
/*! ========================================================================
-** Sinfg
+** Synfig
** Template Header File
** $Id: compview.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_COMPVIEW_H
-#define __SINFG_COMPVIEW_H
+#ifndef __SYNFIG_COMPVIEW_H
+#define __SYNFIG_COMPVIEW_H
/* === H E A D E R S ======================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfg { class Canvas; };
+namespace synfig { class Canvas; };
namespace studio {
etl::loose_handle<studio::Instance> get_selected_instance() { return selected_instance; }
- etl::loose_handle<sinfg::Canvas> get_selected_canvas();
+ etl::loose_handle<synfig::Canvas> get_selected_canvas();
etl::loose_handle<studio::CanvasView> get_selected_canvas_view();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file devicetracker.cpp
** \brief Template File
**
#include "devicetracker.h"
#include <gdkmm/device.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
GdkDevice* device=reinterpret_cast<GdkDevice*>(iter->data);
gdk_device_set_mode(device,GDK_MODE_SCREEN);
- sinfgapp::InputDevice::Handle input_device;
- input_device=sinfgapp::Main::add_input_device(device->name,sinfgapp::InputDevice::Type(device->source));
- if(input_device->get_type()==sinfgapp::InputDevice::TYPE_MOUSE)
- sinfgapp::Main::select_input_device(input_device);
+ synfigapp::InputDevice::Handle input_device;
+ input_device=synfigapp::Main::add_input_device(device->name,synfigapp::InputDevice::Type(device->source));
+ if(input_device->get_type()==synfigapp::InputDevice::TYPE_MOUSE)
+ synfigapp::Main::select_input_device(input_device);
}
}
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file devicetracker.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DEVICETRACKER_H
-#define __SINFG_DEVICETRACKER_H
+#ifndef __SYNFIG_DEVICETRACKER_H
+#define __SYNFIG_DEVICETRACKER_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_gradient.cpp
** \brief Template File
**
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
-#include <sinfg/general.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfig/general.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "widget_color.h"
#include <gtkmm/spinbutton.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#include <sigc++/retype_return.h>
#include <sigc++/retype.h>
#include <sigc++/hide.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_color.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_COLOR_H
-#define __SINFG_STUDIO_DIALOG_COLOR_H
+#ifndef __SYNFIG_STUDIO_DIALOG_COLOR_H
+#define __SYNFIG_STUDIO_DIALOG_COLOR_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/optionmenu.h>
#include <gtkmm/checkbutton.h>
-#include <sinfg/gamma.h>
-#include <sinfg/time.h>
+#include <synfig/gamma.h>
+#include <synfig/time.h>
#include "widget_coloredit.h"
-#include <sinfgapp/value_desc.h>
-#include <sinfg/time.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/time.h>
#include "dialogsettings.h"
namespace Gtk { class Menu; class SpinButton; class Adjustment; };
-namespace sinfgapp {
+namespace synfigapp {
class CanvasInterface;
};
{
DialogSettings dialog_settings;
- sigc::signal<void,sinfg::Color> signal_edited_;
- //sigc::signal<void,sinfg::Color> signal_apply_;
+ sigc::signal<void,synfig::Color> signal_edited_;
+ //sigc::signal<void,synfig::Color> signal_apply_;
bool on_close_pressed();
void on_apply_pressed();
public:
bool busy()const { return busy_; }
- sigc::signal<void,sinfg::Color>& signal_edited() { return signal_edited_; }
+ sigc::signal<void,synfig::Color>& signal_edited() { return signal_edited_; }
- //sigc::signal<void,sinfg::Color>& signal_apply() { return signal_apply_; }
+ //sigc::signal<void,synfig::Color>& signal_apply() { return signal_apply_; }
- void set_color(const sinfg::Color& x) { widget_color->set_value(x); }
+ void set_color(const synfig::Color& x) { widget_color->set_value(x); }
- sinfg::Color get_color()const { return widget_color->get_value(); }
+ synfig::Color get_color()const { return widget_color->get_value(); }
void reset();
Dialog_Color();
~Dialog_Color();
-// void edit(const sinfgapp::ValueDesc &x, etl::handle<sinfgapp::CanvasInterface> canvas_interface, sinfg::Time x=0);
+// void edit(const synfigapp::ValueDesc &x, etl::handle<synfigapp::CanvasInterface> canvas_interface, synfig::Time x=0);
}; // END of Dialog_Color
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_gradient.cpp
** \brief Template File
**
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
-#include <sinfg/general.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfgapp/main.h>
+#include <synfig/general.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
+#include <synfigapp/main.h>
#include "widget_color.h"
#include <gtkmm/spinbutton.h>
#include "app.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
}
void
-Dialog_Gradient::set_gradient(const sinfg::Gradient& x)
+Dialog_Gradient::set_gradient(const synfig::Gradient& x)
{
widget_gradient->set_value(x);
}
void
Dialog_Gradient::on_grab_pressed()
{
- sinfgapp::Main::set_gradient(get_gradient());
+ synfigapp::Main::set_gradient(get_gradient());
// signal_edited_(get_gradient());
// reset();
// hide();
}
void
-Dialog_Gradient::on_cpoint_selected(sinfg::Gradient::CPoint x)
+Dialog_Gradient::on_cpoint_selected(synfig::Gradient::CPoint x)
{
widget_color->set_value(x.color);
adjustment_pos.set_value(x.pos);
void
Dialog_Gradient::on_values_adjusted()
{
- sinfg::Gradient::CPoint x(widget_gradient->get_selected_cpoint());
+ synfig::Gradient::CPoint x(widget_gradient->get_selected_cpoint());
x.color=widget_color->get_value();
x.pos=adjustment_pos.get_value();
widget_gradient->update_cpoint(x);
}
static void
-dialog_gradient_value_desc_edit(sinfg::Gradient g,sinfgapp::ValueDesc x,handle<sinfgapp::CanvasInterface> canvas_interface)
+dialog_gradient_value_desc_edit(synfig::Gradient g,synfigapp::ValueDesc x,handle<synfigapp::CanvasInterface> canvas_interface)
{
// canvas_interface->connect_value(x,ValueBase(g));
}
void
-Dialog_Gradient::edit(const sinfgapp::ValueDesc &x, etl::handle<sinfgapp::CanvasInterface> canvas_interface, sinfg::Time time)
+Dialog_Gradient::edit(const synfigapp::ValueDesc &x, etl::handle<synfigapp::CanvasInterface> canvas_interface, synfig::Time time)
{
reset();
if(x.is_const())
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_gradient.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_GRADIENT_H
-#define __SINFG_STUDIO_DIALOG_GRADIENT_H
+#ifndef __SYNFIG_STUDIO_DIALOG_GRADIENT_H
+#define __SYNFIG_STUDIO_DIALOG_GRADIENT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/optionmenu.h>
#include <gtkmm/checkbutton.h>
-#include <sinfg/gamma.h>
-#include <sinfg/time.h>
+#include <synfig/gamma.h>
+#include <synfig/time.h>
#include "widget_gradient.h"
#include "widget_coloredit.h"
-#include <sinfgapp/value_desc.h>
-#include <sinfg/time.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/time.h>
#include "dialogsettings.h"
namespace Gtk { class Menu; class SpinButton; class Adjustment; };
-namespace sinfgapp {
+namespace synfigapp {
class CanvasInterface;
};
Gtk::Adjustment adjustment_pos;
- sigc::signal<void,sinfg::Gradient> signal_edited_;
+ sigc::signal<void,synfig::Gradient> signal_edited_;
sigc::connection value_changed_connection;
void on_apply_pressed();
void on_grab_pressed();
- void on_cpoint_selected(sinfg::Gradient::CPoint x);
+ void on_cpoint_selected(synfig::Gradient::CPoint x);
void on_values_adjusted();
Widget_Gradient* widget_gradient;
public:
- sigc::signal<void,sinfg::Gradient>& signal_edited() { return signal_edited_; }
+ sigc::signal<void,synfig::Gradient>& signal_edited() { return signal_edited_; }
- void set_gradient(const sinfg::Gradient& x);
+ void set_gradient(const synfig::Gradient& x);
- const sinfg::Gradient& get_gradient()const { return widget_gradient->get_value(); }
+ const synfig::Gradient& get_gradient()const { return widget_gradient->get_value(); }
void reset();
Dialog_Gradient();
~Dialog_Gradient();
- void edit(const sinfgapp::ValueDesc &x, etl::handle<sinfgapp::CanvasInterface> canvas_interface, sinfg::Time x=0);
+ void edit(const synfigapp::ValueDesc &x, etl::handle<synfigapp::CanvasInterface> canvas_interface, synfig::Time x=0);
}; // END of Dialog_Gradient
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_keyframe.cpp
** \brief Template File
**
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/button.h>
#include "widget_waypointmodel.h"
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent,handle<sinfgapp::CanvasInterface> canvas_interface):
+Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent,handle<synfigapp::CanvasInterface> canvas_interface):
Gtk::Dialog(_("Keyframe Dialog"),parent,false,true),
canvas_interface(canvas_interface)
{
{
}
-const sinfg::Keyframe&
+const synfig::Keyframe&
Dialog_Keyframe::get_keyframe()const
{
return keyframe_;
}
void
-Dialog_Keyframe::set_keyframe(const sinfg::Keyframe& x)
+Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x)
{
keyframe_=x;
}
if(widget_waypoint_model->get_waypoint_model().is_trivial())
return;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_waypoint_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_waypoint_set"));
assert(action);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_keyframe.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_KEYFRAME_H
-#define __SINFG_STUDIO_DIALOG_KEYFRAME_H
+#ifndef __SYNFIG_STUDIO_DIALOG_KEYFRAME_H
+#define __SYNFIG_STUDIO_DIALOG_KEYFRAME_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/table.h>
#include <gtkmm/entry.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
/* === M A C R O S ========================================================= */
class Dialog_Keyframe : public Gtk::Dialog
{
Gtk::Tooltips tooltips_;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface;
- sinfg::Keyframe keyframe_;
+ synfig::Keyframe keyframe_;
Gtk::Entry entry_description;
void on_delete_pressed();
public:
- Dialog_Keyframe(Gtk::Window& parent,etl::handle<sinfgapp::CanvasInterface> canvas_interface);
+ Dialog_Keyframe(Gtk::Window& parent,etl::handle<synfigapp::CanvasInterface> canvas_interface);
~Dialog_Keyframe();
- const sinfg::Keyframe& get_keyframe()const;
- void set_keyframe(const sinfg::Keyframe& x);
+ const synfig::Keyframe& get_keyframe()const;
+ void set_keyframe(const synfig::Keyframe& x);
private:
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_preview.cpp
** \brief Preview dialog File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
using namespace Gtk;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_preview.h
** \brief Preview dialog Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_DIALOG_PREVIEW_H
-#define __SINFG_GTKMM_DIALOG_PREVIEW_H
+#ifndef __SYNFIG_GTKMM_DIALOG_PREVIEW_H
+#define __SYNFIG_GTKMM_DIALOG_PREVIEW_H
/* === H E A D E R S ======================================================= */
Widget_Preview preview;
DialogSettings settings;
- //etl::handle<sinfg::Canvas> canvas;
+ //etl::handle<synfig::Canvas> canvas;
public:
Dialog_Preview();
float get_global_fps() const { return globalfps; }
void set_global_fps(float f);
- sinfg::Time get_begintime() const { return time_begin.get_value(); }
- void set_begintime(const sinfg::Time &t) { time_begin.set_value(t); }
+ synfig::Time get_begintime() const { return time_begin.get_value(); }
+ void set_begintime(const synfig::Time &t) { time_begin.set_value(t); }
- sinfg::Time get_endtime() const { return time_end.get_value(); }
- void set_endtime(const sinfg::Time &t) { time_end.set_value(t); }
+ synfig::Time get_endtime() const { return time_end.get_value(); }
+ void set_endtime(const synfig::Time &t) { time_end.set_value(t); }
bool get_begin_override() const { return check_overbegin.get_active(); }
void set_begin_override(bool o) { check_overbegin.set_active(o); }
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_setup.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dialog_Setup::Dialog_Setup():
- Dialog(_("SINFG Studio Setup"),false,true),
+ Dialog(_("SYNFIG Studio Setup"),false,true),
adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025),
adj_gamma_g(2.2,0.1,3.0,0.025,0.025,0.025),
adj_gamma_b(2.2,0.1,3.0,0.025,0.025,0.025),
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_setup.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_SETUP_H
-#define __SINFG_STUDIO_DIALOG_SETUP_H
+#ifndef __SYNFIG_STUDIO_DIALOG_SETUP_H
+#define __SYNFIG_STUDIO_DIALOG_SETUP_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/optionmenu.h>
#include <gtkmm/checkbutton.h>
-#include <sinfg/gamma.h>
-#include <sinfg/time.h>
+#include <synfig/gamma.h>
+#include <synfig/time.h>
#include <algorithm>
/* === M A C R O S ========================================================= */
Gtk::CheckButton toggle_use_colorspace_gamma;
- sinfg::Time::Format time_format;
+ synfig::Time::Format time_format;
Gtk::Menu *timestamp_menu;
Widget_Enum *widget_enum;
public:
- void set_time_format(sinfg::Time::Format time_format);
+ void set_time_format(synfig::Time::Format time_format);
- const sinfg::Time::Format& get_time_format()const { return time_format; }
+ const synfig::Time::Format& get_time_format()const { return time_format; }
Dialog_Setup();
~Dialog_Setup();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
/* === E N T R Y P O I N T ================================================= */
-studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle<sinfgapp::CanvasInterface> ci)
+studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle<synfigapp::CanvasInterface> ci)
:Dialog(_("Sound Select")),
okbutton(_("Ok")),
canvas_interface(ci)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_soundselect.h
** \brief Sound Select Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DIALOG_SOUNDSELECT_H
-#define __SINFG_DIALOG_SOUNDSELECT_H
+#ifndef __SYNFIG_DIALOG_SOUNDSELECT_H
+#define __SYNFIG_DIALOG_SOUNDSELECT_H
/* === H E A D E R S ======================================================= */
#include "dockdialog.h"
#include "widget_filename.h"
#include "widget_time.h"
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
/* === M A C R O S ========================================================= */
struct AudioBaseInfo
{
std::string file;
- sinfg::Time offset;
+ synfig::Time offset;
};
class Dialog_SoundSelect : public Gtk::Dialog
Widget_Time offset;
Gtk::Button okbutton;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface;
sigc::signal<void,const std::string &> signal_file_changed_;
- sigc::signal<void,const sinfg::Time &> signal_offset_changed_;
+ sigc::signal<void,const synfig::Time &> signal_offset_changed_;
void on_file();
void on_offset();
void on_ok();
public:
- Dialog_SoundSelect(Gtk::Window &parent,etl::handle<sinfgapp::CanvasInterface> ci );
+ Dialog_SoundSelect(Gtk::Window &parent,etl::handle<synfigapp::CanvasInterface> ci );
~Dialog_SoundSelect();
//float get_global_fps() const { return globalfps; }
void set_global_fps(float f);
- sinfg::Time get_offset() const { return offset.get_value(); }
- void set_offset(const sinfg::Time &t) {offset.set_value(t); }
+ synfig::Time get_offset() const { return offset.get_value(); }
+ void set_offset(const synfig::Time &t) {offset.set_value(t); }
std::string get_file() const { return soundfile.get_value(); }
void set_file(const std::string &f) {soundfile.set_value(f); }
sigc::signal<void,const std::string &> &signal_file_changed() { return signal_file_changed_; }
- sigc::signal<void,const sinfg::Time &> &signal_offset_changed() { return signal_offset_changed_; }
+ sigc::signal<void,const synfig::Time &> &signal_offset_changed() { return signal_offset_changed_; }
};
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_tooloptions.cpp
** \brief Template File
**
#include <gtkmm/label.h>
#include <gtkmm/scrolledwindow.h>
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include "dialog_tooloptions.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dialog_ToolOptions::Dialog_ToolOptions():
- Dockable("tool_options",_("Tool Options"),Gtk::StockID("sinfg-normal")),
+ Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-normal")),
empty_label(_("This tool has no options"))
{
//scrolled_.add(sub_vbox_);
set_widget(empty_label);
empty_label.show();
- set_stock_id(Gtk::StockID("sinfg-normal"));
+ set_stock_id(Gtk::StockID("synfig-normal"));
}
void
}
void
-Dialog_ToolOptions::set_name(const sinfg::String& name)
+Dialog_ToolOptions::set_name(const synfig::String& name)
{
- set_stock_id(Gtk::StockID("sinfg-"+name));
+ set_stock_id(Gtk::StockID("synfig-"+name));
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_tooloptions.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_TOOLOPTIONS_H
-#define __SINFG_STUDIO_DIALOG_TOOLOPTIONS_H
+#ifndef __SYNFIG_STUDIO_DIALOG_TOOLOPTIONS_H
+#define __SYNFIG_STUDIO_DIALOG_TOOLOPTIONS_H
/* === H E A D E R S ======================================================= */
void clear();
void set_widget(Gtk::Widget&);
- void set_name(const sinfg::String& name);
+ void set_name(const synfig::String& name);
Dialog_ToolOptions();
~Dialog_ToolOptions();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypoint.cpp
** \brief Template Header
**
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace std;
using namespace etl;
using namespace studio;
/* === M E T H O D S ======================================================= */
-Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle<sinfg::Canvas> canvas):
+Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle<synfig::Canvas> canvas):
Dialog(_("Waypoint Editor"),parent,false,true),
canvas(canvas)
{
}
void
-Dialog_Waypoint::set_waypoint(sinfg::ValueNode_Animated::Waypoint x)
+Dialog_Waypoint::set_waypoint(synfig::ValueNode_Animated::Waypoint x)
{
waypointwidget->set_waypoint(x);
}
-const sinfg::ValueNode_Animated::Waypoint &
+const synfig::ValueNode_Animated::Waypoint &
Dialog_Waypoint::get_waypoint()const
{
return waypointwidget->get_waypoint();
}
void
-Dialog_Waypoint::set_value_desc(sinfgapp::ValueDesc value_desc)
+Dialog_Waypoint::set_value_desc(synfigapp::ValueDesc value_desc)
{
value_desc_=value_desc;
if(value_desc.get_value_node() && value_desc.get_value_node()->get_parent_canvas())
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypoint.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_DIALOG_WAYPOINT_H
-#define __SINFG_GTKMM_DIALOG_WAYPOINT_H
+#ifndef __SYNFIG_GTKMM_DIALOG_WAYPOINT_H
+#define __SYNFIG_GTKMM_DIALOG_WAYPOINT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/menu.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
class Dialog_Waypoint : public Gtk::Dialog
{
Widget_Waypoint *waypointwidget;
- etl::handle<sinfg::Canvas> canvas;
- sinfg::ValueNode_Animated::WaypointList::iterator waypoint;
- sinfgapp::ValueDesc value_desc_;
+ etl::handle<synfig::Canvas> canvas;
+ synfig::ValueNode_Animated::WaypointList::iterator waypoint;
+ synfigapp::ValueDesc value_desc_;
sigc::signal<void> signal_changed_;
void on_delete_pressed();
public:
- Dialog_Waypoint(Gtk::Window& parent,etl::handle<sinfg::Canvas> canvas);
+ Dialog_Waypoint(Gtk::Window& parent,etl::handle<synfig::Canvas> canvas);
~Dialog_Waypoint();
void reset();
- void set_value_desc(sinfgapp::ValueDesc value_desc);
- sinfgapp::ValueDesc get_value_desc()const { return value_desc_; }
+ void set_value_desc(synfigapp::ValueDesc value_desc);
+ synfigapp::ValueDesc get_value_desc()const { return value_desc_; }
- void set_waypoint(sinfg::ValueNode_Animated::Waypoint x);
- const sinfg::ValueNode_Animated::Waypoint &get_waypoint()const;
+ void set_waypoint(synfig::ValueNode_Animated::Waypoint x);
+ const synfig::ValueNode_Animated::Waypoint &get_waypoint()const;
sigc::signal<void> &signal_changed()
{return signal_changed_; }
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialogsettings.cpp
** \brief Template File
**
#endif
#include "dialogsettings.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-DialogSettings::DialogSettings(Gtk::Window* window,const sinfg::String& name):
+DialogSettings::DialogSettings(Gtk::Window* window,const synfig::String& name):
window(window),
name(name)
{
- sinfgapp::Main::settings().add_domain(this,"window."+name);
+ synfigapp::Main::settings().add_domain(this,"window."+name);
}
DialogSettings::~DialogSettings()
{
- sinfgapp::Main::settings().remove_domain("window."+name);
+ synfigapp::Main::settings().remove_domain("window."+name);
}
bool
-DialogSettings::get_value(const sinfg::String& key, sinfg::String& value)const
+DialogSettings::get_value(const synfig::String& key, synfig::String& value)const
{
if(key=="pos")
{
return true;
}
- return sinfgapp::Settings::get_value(key,value);
+ return synfigapp::Settings::get_value(key,value);
}
bool
-DialogSettings::set_value(const sinfg::String& key,const sinfg::String& value)
+DialogSettings::set_value(const synfig::String& key,const synfig::String& value)
{
if(value.empty())
return false;
return true;
}
- return sinfgapp::Settings::set_value(key,value);
+ return synfigapp::Settings::set_value(key,value);
}
-sinfgapp::Settings::KeyList
+synfigapp::Settings::KeyList
DialogSettings::get_key_list()const
{
- sinfgapp::Settings::KeyList ret(sinfgapp::Settings::get_key_list());
+ synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
ret.push_back("size");
ret.push_back("pos");
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialogsettings.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DIALOGSETTINGS_H
-#define __SINFG_DIALOGSETTINGS_H
+#ifndef __SYNFIG_DIALOGSETTINGS_H
+#define __SYNFIG_DIALOGSETTINGS_H
/* === H E A D E R S ======================================================= */
-#include <sinfgapp/settings.h>
+#include <synfigapp/settings.h>
#include <gtkmm/window.h>
/* === M A C R O S ========================================================= */
namespace studio {
-class DialogSettings : public sinfgapp::Settings
+class DialogSettings : public synfigapp::Settings
{
Gtk::Window* window;
- sinfg::String name;
+ synfig::String name;
public:
- DialogSettings(Gtk::Window* window,const sinfg::String& name);
+ DialogSettings(Gtk::Window* window,const synfig::String& name);
virtual ~DialogSettings();
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const;
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value);
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const;
+ virtual bool set_value(const synfig::String& key,const synfig::String& value);
virtual KeyList get_key_list()const;
};
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_history.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_Canvases::Dock_Canvases():
- Dockable("canvases",_("Canvas Browser"),Gtk::StockID("sinfg-canvas"))
+ Dockable("canvases",_("Canvas Browser"),Gtk::StockID("synfig-canvas"))
{
App::signal_instance_created().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::new_instance));
/*
add_button(
- Gtk::StockID("sinfg-canvas_new"),
+ Gtk::StockID("synfig-canvas_new"),
_("Insert a new canvas")
)->signal_clicked().connect(
sigc::mem_fun(
);
add_button(
- Gtk::StockID("sinfg-rename"),
+ Gtk::StockID("synfig-rename"),
_("Rename selected canvas")
)->signal_clicked().connect(
sigc::mem_fun(
return get_selected_instance()->find_canvas_view(get_selected_canvas());
}
-etl::loose_handle<sinfg::Canvas>
+etl::loose_handle<synfig::Canvas>
Dock_Canvases::get_selected_canvas()
{
Glib::RefPtr<Gtk::TreeSelection> selection=canvas_tree->get_selection();
studio::Instance::CanvasTreeModel canvas_tree_model;
- return static_cast<etl::handle<sinfg::Canvas> >((*selection->get_selected())[canvas_tree_model.canvas]);
+ return static_cast<etl::handle<synfig::Canvas> >((*selection->get_selected())[canvas_tree_model.canvas]);
}
etl::loose_handle<studio::Instance> loose_instance(instance);
- instance->sinfgapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Dock_Canvases::refresh_instances));
- instance->sinfgapp::Instance::signal_filename_changed().connect(
+ instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Dock_Canvases::refresh_instances));
+ instance->synfigapp::Instance::signal_filename_changed().connect(
sigc::bind<etl::loose_handle<studio::Instance> >(
sigc::mem_fun(*this,&Dock_Canvases::set_selected_instance),
loose_instance
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_canvases.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_CANVASES_H
-#define __SINFG_STUDIO_DIALOG_CANVASES_H
+#ifndef __SYNFIG_STUDIO_DIALOG_CANVASES_H
+#define __SYNFIG_STUDIO_DIALOG_CANVASES_H
/* === H E A D E R S ======================================================= */
etl::loose_handle<studio::Instance> get_selected_instance() { return selected_instance; }
- etl::loose_handle<sinfg::Canvas> get_selected_canvas();
+ etl::loose_handle<synfig::Canvas> get_selected_canvas();
etl::loose_handle<studio::CanvasView> get_selected_canvas_view();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_canvasspecific.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-Dock_CanvasSpecific::Dock_CanvasSpecific(const sinfg::String& name,const sinfg::String& local_name,Gtk::StockID stock_id_):
+Dock_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
Dockable(name,local_name,stock_id_)
{
App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance));
return App::get_selected_canvas_view();
}
-etl::loose_handle<sinfgapp::CanvasInterface>
+etl::loose_handle<synfigapp::CanvasInterface>
Dock_CanvasSpecific::get_canvas_interface()
{
if(get_canvas_view())
etl::clock timer;timer.reset();
instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view));
init_instance_vfunc(instance);
- sinfg::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer()));
+ synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer()));
}
void
)
);
*/
- sinfg::info("%s init_canvas_view() Starting init...",get_local_name().c_str());
+ synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str());
etl::clock timer;timer.reset();
App::signal_canvas_view_focus().connect(
sigc::hide(
)
);
init_canvas_view_vfunc(canvas_view);
- sinfg::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
+ synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
}
void
*/
#ifdef _DEBUG
- sinfg::info("%s canvas_view_changed: start",get_local_name().c_str());
+ synfig::info("%s canvas_view_changed: start",get_local_name().c_str());
#endif
changed_canvas_view_vfunc(canvas_view);
#ifdef _DEBUG
- sinfg::info("%s canvas_view_changed: end",get_local_name().c_str());
+ synfig::info("%s canvas_view_changed: end",get_local_name().c_str());
#endif
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_canvasspecific.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_CANVASSPECIFIC_H
-#define __SINFG_STUDIO_DOCK_CANVASSPECIFIC_H
+#ifndef __SYNFIG_STUDIO_DOCK_CANVASSPECIFIC_H
+#define __SYNFIG_STUDIO_DOCK_CANVASSPECIFIC_H
/* === H E A D E R S ======================================================= */
public:
etl::loose_handle<studio::CanvasView> get_canvas_view();
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface();
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface();
- Dock_CanvasSpecific(const sinfg::String& name,const sinfg::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
+ Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
virtual ~Dock_CanvasSpecific();
}; // END of Dock_CanvasSpecific
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_children.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_Children::Dock_Children():
- Dock_CanvasSpecific("children",_("Children"),Gtk::StockID("sinfg-children"))
+ Dock_CanvasSpecific("children",_("Children"),Gtk::StockID("synfig-children"))
{
set_use_scrolled(false);
/*
add(*create_action_tree());
add_button(
- Gtk::StockID("sinfg-clear_redo"),
+ Gtk::StockID("synfig-clear_redo"),
_("Clear the REDO Stack")
)->signal_clicked().connect(
sigc::mem_fun(
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_children.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_CHILDREN_H
-#define __SINFG_STUDIO_DOCK_CHILDREN_H
+#ifndef __SYNFIG_STUDIO_DOCK_CHILDREN_H
+#define __SYNFIG_STUDIO_DOCK_CHILDREN_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_params.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_Curves::Dock_Curves():
- Dock_CanvasSpecific("curves",_("Curves"),Gtk::StockID("sinfg-curves"))
+ Dock_CanvasSpecific("curves",_("Curves"),Gtk::StockID("synfig-curves"))
{
last_widget_curves_=0;
table_=0;
return;
}
- std::list<sinfgapp::ValueDesc> value_descs;
+ std::list<synfigapp::ValueDesc> value_descs;
//std::list<Gtk::TreePath> path_list(
//param_tree_view->get_selection()->selected_foreach_iter(tmp);
{
LayerParamTreeStore::Model model;
get_canvas_view()->work_area->set_selected_value_node(
- (sinfg::ValueNode::Handle)(*iter)[model.value_node]
+ (synfig::ValueNode::Handle)(*iter)[model.value_node]
);
}
else
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_curves.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_CURVES_H
-#define __SINFG_STUDIO_DOCK_CURVES_H
+#ifndef __SYNFIG_STUDIO_DOCK_CURVES_H
+#define __SYNFIG_STUDIO_DOCK_CURVES_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_history.cpp
** \brief Template File
**
#include <sigc++/signal.h>
#include <sigc++/hide.h>
#include <sigc++/slot.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "historytreestore.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
action_group->add(Gtk::Action::create(
"clear-undo",
- Gtk::StockID("sinfg-clear_undo"),
+ Gtk::StockID("synfig-clear_undo"),
_("Clear the UNDO Stack"),
_("Clear the UNDO Stack")
),
);
action_group->add(Gtk::Action::create(
"clear-redo",
- Gtk::StockID("sinfg-clear_redo"),
+ Gtk::StockID("synfig-clear_redo"),
_("Clear the REDO Stack"),
_("Clear the REDO Stack")
),
/*
add_button(
- Gtk::StockID("sinfg-clear_undo"),
+ Gtk::StockID("synfig-clear_undo"),
_("Clear the UNDO Stack")
)->signal_clicked().connect(
sigc::mem_fun(
)
);
add_button(
- Gtk::StockID("sinfg-clear_redo"),
+ Gtk::StockID("synfig-clear_redo"),
_("Clear the REDO Stack")
)->signal_clicked().connect(
sigc::mem_fun(
//signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
{
- etl::handle<sinfgapp::Action::Undoable> action(row[model.action]);
+ etl::handle<synfigapp::Action::Undoable> action(row[model.action]);
try{
if((bool)row[model.is_undo])
{
const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path));
- handle<sinfgapp::Action::Undoable> action=row[history_tree_model.action];
+ handle<synfigapp::Action::Undoable> action=row[history_tree_model.action];
- selected_instance->sinfgapp::Instance::set_action_status(action,!action->is_active());
+ selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active());
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_history.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DIALOG_HISTORY_H
-#define __SINFG_STUDIO_DIALOG_HISTORY_H
+#ifndef __SYNFIG_STUDIO_DIALOG_HISTORY_H
+#define __SYNFIG_STUDIO_DIALOG_HISTORY_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_info.cpp
** \brief Dock Info File
**
#include "canvasview.h"
#include "workarea.h"
-#include <sinfg/canvas.h>
-#include <sinfg/context.h>
+#include <synfig/canvas.h>
+#include <synfig/context.h>
#include <gtkmm/separator.h>
#include <gtkmm/invisible.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
#define use_colorspace_gamma() App::use_colorspace_gamma
}
studio::Dock_Info::Dock_Info()
-:Dock_CanvasSpecific("info",_("Info"),Gtk::StockID("sinfg-info"))
+:Dock_CanvasSpecific("info",_("Info"),Gtk::StockID("synfig-info"))
{
set_use_scrolled(false);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_info.h
** \brief Info Dock Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DOCK_INFO_H
-#define __SINFG_DOCK_INFO_H
+#ifndef __SYNFIG_DOCK_INFO_H
+#define __SYNFIG_DOCK_INFO_H
/* === H E A D E R S ======================================================= */
#include "dock_canvasspecific.h"
class Dock_Info : public Dock_CanvasSpecific
{
//bool valid;
- //sinfg::Point pos;
+ //synfig::Point pos;
Gtk::Label r,g,b,a;
Gtk::Label x,y;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_keyframes.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_Keyframes::Dock_Keyframes():
- Dock_CanvasSpecific("keyframes",_("Keyframes"),Gtk::StockID("sinfg-keyframes")),
+ Dock_CanvasSpecific("keyframes",_("Keyframes"),Gtk::StockID("synfig-keyframes")),
action_group(Gtk::ActionGroup::create()),
keyframe_action_manager(new KeyframeActionManager)
{
);
add_button(
- Gtk::StockID("sinfg-duplicate"),
+ Gtk::StockID("synfig-duplicate"),
_("Duplicates the selected keyframe at the current time")
)->signal_clicked().connect(
sigc::mem_fun(
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_keyframes.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_KEYFRAMES_H
-#define __SINFG_STUDIO_DOCK_KEYFRAMES_H
+#ifndef __SYNFIG_STUDIO_DOCK_KEYFRAMES_H
+#define __SYNFIG_STUDIO_DOCK_KEYFRAMES_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_layergroups.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_LayerGroups::Dock_LayerGroups():
- Dock_CanvasSpecific("groups",_("Groups"),Gtk::StockID("sinfg-group")),
+ Dock_CanvasSpecific("groups",_("Groups"),Gtk::StockID("synfig-group")),
action_group_group_ops(Gtk::ActionGroup::create()),
group_action_manager(new GroupActionManager)
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_layergroups.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_LAYERGROUPS_H
-#define __SINFG_STUDIO_DOCK_LAYERGROUPS_H
+#ifndef __SYNFIG_STUDIO_DOCK_LAYERGROUPS_H
+#define __SYNFIG_STUDIO_DOCK_LAYERGROUPS_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_layers.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/*static void do_nothing(reference_counter x)
{
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count());
}*/
/* === M E T H O D S ======================================================= */
Dock_Layers::Dock_Layers():
- Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("sinfg-layer")),
+ Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("synfig-layer")),
// layer_action_manager(0)
layer_action_manager(new LayerActionManager)
{
action_group_new_layers=Gtk::ActionGroup::create();
action_group_layer_ops=Gtk::ActionGroup::create();
- std::map<sinfg::String,sinfg::String> category_map;
+ std::map<synfig::String,synfig::String> category_map;
// Build layer creation actions
- sinfg::Layer::Book::iterator iter;
- for(iter=sinfg::Layer::book().begin();iter!=sinfg::Layer::book().end();++iter)
+ synfig::Layer::Book::iterator iter;
+ for(iter=synfig::Layer::book().begin();iter!=synfig::Layer::book().end();++iter)
{
- sinfg::Layer::Book::value_type lyr(*iter);
+ synfig::Layer::Book::value_type lyr(*iter);
if(lyr.second.category==_("Do Not Use"))
continue;
{
Glib::RefPtr<Gtk::ActionGroup> action_group_categories(Gtk::ActionGroup::create("layer-category"));
- sinfg::String layer_ui_info;
+ synfig::String layer_ui_info;
layer_ui_info+="<ui><menubar action='menu-main'><menu action='menu-layer'><menu action='menu-layer-new'>";
- std::map<sinfg::String,sinfg::String>::iterator iter;
+ std::map<synfig::String,synfig::String>::iterator iter;
for(iter=category_map.begin();iter!=category_map.end();++iter)
{
layer_ui_info+=strprintf("<menu action='%s'>%s</menu>",iter->first.c_str(),iter->second.c_str());
/*
reference_counter ref_count;
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
{
sigc::signal<void> tmp_signal;
)
);
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
tmp_signal();
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
tmp_signal.clear();
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
tmp_signal();
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
tmp_signal.connect(
sigc::bind(
sigc::ptr_fun(do_nothing),
ref_count
)
);
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
}
- sinfg::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
+ synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count());
assert(ref_count.count()==1);
*/
}
layer_tree->signal_edited_value().connect(
sigc::hide_return(
- sigc::mem_fun(*canvas_view->canvas_interface(), &sinfgapp::CanvasInterface::change_value)
+ sigc::mem_fun(*canvas_view->canvas_interface(), &synfigapp::CanvasInterface::change_value)
)
);
}
void
-Dock_Layers::add_layer(sinfg::String id)
+Dock_Layers::add_layer(synfig::String id)
{
etl::loose_handle<CanvasView> canvas_view(get_canvas_view());
if(canvas_view)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_layers.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_LAYERS_H
-#define __SINFG_STUDIO_DOCK_LAYERS_H
+#ifndef __SYNFIG_STUDIO_DOCK_LAYERS_H
+#define __SYNFIG_STUDIO_DOCK_LAYERS_H
/* === H E A D E R S ======================================================= */
private:
- void add_layer(sinfg::String id);
+ void add_layer(synfig::String id);
void increase_amount();
void decrease_amount();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_metadata.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_MetaData::Dock_MetaData():
- Dock_CanvasSpecific("meta_data",_("Canvas MetaData"),Gtk::StockID("sinfg-meta_data")),
+ Dock_CanvasSpecific("meta_data",_("Canvas MetaData"),Gtk::StockID("synfig-meta_data")),
tree_view(manage(new Gtk::TreeView()))
{
MetaDataTreeStore::Model model;
{
if(get_canvas_interface())
{
- sinfg::String key;
+ synfig::String key;
if(App::dialog_entry("New MetaData Entry", "Please enter the name of the key",key) && !key.empty())
{
get_canvas_interface()->set_meta_data(key," ");
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_metadata.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_METADATA_H
-#define __SINFG_STUDIO_DOCK_METADATA_H
+#ifndef __SYNFIG_STUDIO_DOCK_METADATA_H
+#define __SYNFIG_STUDIO_DOCK_METADATA_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_navigator.cpp
** \brief Dock Nagivator File
**
#include "workarea.h"
#include <cassert>
-#include <sinfg/canvas.h>
-#include <sinfg/context.h>
-#include <sinfg/target_scanline.h>
-#include <sinfg/surface.h>
+#include <synfig/canvas.h>
+#include <synfig/context.h>
+#include <synfig/target_scanline.h>
+#include <synfig/surface.h>
#include <gtkmm/separator.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
studio::Widget_NavView::Widget_NavView(CanvasView::LooseHandle cv)
:canvview(cv),
adj_zoom(0,-4,4,1,2),
-surface(new sinfg::Surface)
+surface(new synfig::Surface)
{
attach(drawto,0,4,0,1);
{
if(dirty)
{
- //sinfg::warning("Nav: Starting render");
- //sinfg::warning("Nav: Rendering canvas");
+ //synfig::warning("Nav: Starting render");
+ //synfig::warning("Nav: Rendering canvas");
etl::handle<Target_Scanline> targ = surface_target(surface.get());
targ->set_canvas(get_canvas_view()->get_canvas());
targ->set_remove_alpha();
targ->set_avoid_time_sync();
targ->set_quality(get_canvas_view()->get_work_area()->get_quality());
- //sinfg::info("Set the quality level to: %d", get_canvas_view()->get_work_area()->get_quality());
+ //synfig::info("Set the quality level to: %d", get_canvas_view()->get_work_area()->get_quality());
//this should set it to render a single frame
RendDesc r = get_canvas_view()->get_canvas()->rend_desc();
//this changes the size of the canvas to the closest thing we can find
int sw = r.get_w(), sh = r.get_h();
- //sinfg::warning("Nav: source image is %d x %d", sw,sh);
+ //synfig::warning("Nav: source image is %d x %d", sw,sh);
//resize so largest dimension is 128
int dw = sw > sh ? 128 : sw*128/sh,
dh = sh > sw ? 128 : sh*128/sw;
- //sinfg::warning("Nav: dest image is %d x %d", dw,dh);
+ //synfig::warning("Nav: dest image is %d x %d", dw,dh);
r.set_w(dw);
r.set_h(dh);
//float pw = r.get_pw();
//float ph = r.get_ph();
- //sinfg::warning("Nav: pixel size is %f x %f", pw,ph);
+ //synfig::warning("Nav: pixel size is %f x %f", pw,ph);
//this renders that single frame
targ->set_rend_desc(&r);
- //sinfg::warning("Nav: Building async renderer and starting it...");
+ //synfig::warning("Nav: Building async renderer and starting it...");
renderer = new AsyncRenderer(targ);
renderer->signal_success().connect(sigc::mem_fun(*this,&Widget_NavView::on_finish_render));
//convert it into our pixmap
PixelFormat pf(PF_RGB);
- //sinfg::warning("Nav: It hath succeeded!!!");
+ //synfig::warning("Nav: It hath succeeded!!!");
//assert(renderer && renderer->has_success());
DEBUGPOINT();
- //sinfg::warning("Nav: now we know it really succeeded");
+ //synfig::warning("Nav: now we know it really succeeded");
if(!*surface)
{
- sinfg::warning("dock_navigator: Bad surface");
+ synfig::warning("dock_navigator: Bad surface");
return;
}
if(w != dw || h != dh || !prev)
{
- const int total_bytes(dw*dh*sinfg::channels(pf));
+ const int total_bytes(dw*dh*synfig::channels(pf));
- //sinfg::warning("Nav: Updating the pixbuf to be the right size, etc. (%d bytes)", total_bytes);
+ //synfig::warning("Nav: Updating the pixbuf to be the right size, etc. (%d bytes)", total_bytes);
prev.clear();
guint8 *bytes = new guint8[total_bytes]; //24 bits per pixel
//convert into our buffered dataS
- //sinfg::warning("Nav: converting color format into buffer");
+ //synfig::warning("Nav: converting color format into buffer");
convert_color_format((unsigned char *)bytes, (*surface)[0], dw*dh, pf, App::gamma);
prev =
8, // bits per sample
dw, // width
dh, // height
- dw*sinfg::channels(pf), // stride (pitch)
+ dw*synfig::channels(pf), // stride (pitch)
SigC::slot(freegu8)
);
}
else
{
- //sinfg::warning("Nav: Don't need to resize");
+ //synfig::warning("Nav: Don't need to resize");
//convert into our buffered dataS
- //sinfg::warning("Nav: converting color format into buffer");
+ //synfig::warning("Nav: converting color format into buffer");
if(prev) //just in case we're stupid
{
convert_color_format((unsigned char *)prev->get_pixels(), (*surface)[0], dw*dh, pf, App::gamma);
sx = drawto.get_width() / (float)w;
sy = drawto.get_height() / (float)h;
- //sinfg::warning("Nav redraw: now to scale the bitmap: %.3f x %.3f",sx,sy);
+ //synfig::warning("Nav redraw: now to scale the bitmap: %.3f x %.3f",sx,sy);
//round to smallest scale (fit entire thing in window without distortion)
if(sx > sy) sx = sy;
//draw to drawing area
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(drawto.get_window());
- //sinfg::warning("Nav: Scaling pixmap to off (%d,%d) with size (%d,%d)", offx,offy,nw, nh);
+ //synfig::warning("Nav: Scaling pixmap to off (%d,%d) with size (%d,%d)", offx,offy,nw, nh);
Glib::RefPtr<Gdk::Pixbuf> scalepx = prev->scale_simple(nw,nh,Gdk::INTERP_NEAREST);
- //sinfg::warning("Nav: Drawing scaled bitmap");
+ //synfig::warning("Nav: Drawing scaled bitmap");
drawto.get_window()->draw_pixbuf(
gc, //GC
scalepx, //pixbuf
//coord system:
// tl : (offx,offy)
// axis multipliers = xaxis,yaxis
- //sinfg::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]);
- //sinfg::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]);
- //sinfg::warning("Nav: Drawing Rectangle (%d,%d) with dim (%d,%d)", l,t,rw,rh);
+ //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]);
+ //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]);
+ //synfig::warning("Nav: Drawing Rectangle (%d,%d) with dim (%d,%d)", l,t,rw,rh);
drawto.get_window()->draw_rectangle(gc,false,l,t,rw,rh);
}
{
double z = unit_to_zoom(adj_zoom.get_value());
zoom_print.set_text(strprintf("%.1f%%",z*100.0));
- //sinfg::warning("Updating zoom to %f",adj_zoom.get_value());
+ //synfig::warning("Updating zoom to %f",adj_zoom.get_value());
if(get_canvas_view() && z != get_canvas_view()->get_work_area()->get_zoom())
{
double wz = get_canvas_view()->get_work_area()->get_zoom();
double z = zoom_to_unit(wz);
- //sinfg::warning("Updating zoom to %f -> %f",wz,z);
+ //synfig::warning("Updating zoom to %f -> %f",wz,z);
if(!scrolling && z != adj_zoom.get_value())
{
adj_zoom.set_value(z);
//Navigator Dock Definitions
studio::Dock_Navigator::Dock_Navigator()
-:Dock_CanvasSpecific("navigator",_("Navigator"),Gtk::StockID("sinfg-navigator"))
+:Dock_CanvasSpecific("navigator",_("Navigator"),Gtk::StockID("synfig-navigator"))
{
add(dummy);
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_navigator.h
** \brief Navigator Dock Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DOCK_NAVIGATOR_H
-#define __SINFG_DOCK_NAVIGATOR_H
+#ifndef __SYNFIG_DOCK_NAVIGATOR_H
+#define __SYNFIG_DOCK_NAVIGATOR_H
/* === H E A D E R S ======================================================= */
#include "sigc++/signal.h"
#include <gtkmm/adjustment.h>
#include <gtkmm/label.h>
-#include <sinfg/renddesc.h>
+#include <synfig/renddesc.h>
#include "canvasview.h"
#include "dock_canvasspecific.h"
//asyncronous rendering stuff
etl::handle<AsyncRenderer> renderer;
- etl::smart_ptr<sinfg::Surface> surface;
+ etl::smart_ptr<synfig::Surface> surface;
bool rendering;
//drawing functionality
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_params.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
Dock_Params::Dock_Params():
- Dock_CanvasSpecific("params",_("Params"),Gtk::Stock::INDEX/*Gtk::StockID("sinfg-params")*/),
+ Dock_CanvasSpecific("params",_("Params"),Gtk::Stock::INDEX/*Gtk::StockID("synfig-params")*/),
action_group(Gtk::ActionGroup::create())
{
/*
{
LayerParamTreeStore::Model model;
get_canvas_view()->work_area->set_selected_value_node(
- (sinfg::ValueNode::Handle)(*iter)[model.value_node]
+ (synfig::ValueNode::Handle)(*iter)[model.value_node]
);
}
else
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_params.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_PARAMS_H
-#define __SINFG_STUDIO_DOCK_PARAMS_H
+#ifndef __SYNFIG_STUDIO_DOCK_PARAMS_H
+#define __SYNFIG_STUDIO_DOCK_PARAMS_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_timetrack.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Gtk::TreeView *mimic_tree_view;
public:
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint,int> signal_waypoint_clicked;
+ sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked;
LayerParamTreeStore::Model model;
LayerList layer_list(get_selected_layers());
if(layer_list.size()<=1)
{
- sinfgapp::ValueDesc value_desc(row[model.value_desc]);
+ synfigapp::ValueDesc value_desc(row[model.value_desc]);
Gtk::Menu* menu(manage(new Gtk::Menu()));
App::get_instance(param_tree_store_->canvas_interface()->get_canvas())->make_param_menu(menu,param_tree_store_->canvas_interface()->get_canvas(),value_desc,0.5f);
menu->popup(event->button.button,gtk_get_current_event_time());
return true;
}
Gtk::Menu* menu(manage(new Gtk::Menu()));
- std::list<sinfgapp::ValueDesc> value_desc_list;
+ std::list<synfigapp::ValueDesc> value_desc_list;
ParamDesc param_desc(row[model.param_desc]);
for(;!layer_list.empty();layer_list.pop_back())
- value_desc_list.push_back(sinfgapp::ValueDesc(layer_list.back(),param_desc.get_name()));
+ value_desc_list.push_back(synfigapp::ValueDesc(layer_list.back(),param_desc.get_name()));
App::get_instance(param_tree_store_->canvas_interface()->get_canvas())->make_param_menu(menu,param_tree_store_->canvas_interface()->get_canvas(),value_desc_list);
menu->popup(event->button.button,gtk_get_current_event_time());
return true;
void
queue_draw_msg()
{
- sinfg::info("*************QUEUE_DRAW***************** (time track view)");
+ synfig::info("*************QUEUE_DRAW***************** (time track view)");
Widget::queue_draw();
}
void set_model(Glib::RefPtr<LayerParamTreeStore> store)
}
void
- on_waypoint_changed( sinfg::Waypoint waypoint , sinfg::ValueNode::Handle value_node)
+ on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node)
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",param_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",param_tree_store_->canvas_interface());
param_list.add("value_node",value_node);
}
void
- on_waypoint_clicked(const Glib::ustring &path_string, sinfg::Waypoint waypoint,int button)
+ on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
{
/*
Gtk::TreePath path(path_string);
Gtk::TreeRow row;
if(!param_tree_store_->find_first_value_node(value_node, row))
{
- sinfg::error(__FILE__":%d: Unable to find the valuenode",__LINE__);
+ synfig::error(__FILE__":%d: Unable to find the valuenode",__LINE__);
return;
}
if(!row)
return;
- sinfgapp::ValueDesc value_desc(static_cast<sinfgapp::ValueDesc>(row[model.value_desc]));
+ synfigapp::ValueDesc value_desc(static_cast<synfigapp::ValueDesc>(row[model.value_desc]));
signal_waypoint_clicked(value_desc,waypoint,button);
}
/* === M E T H O D S ======================================================= */
Dock_Timetrack::Dock_Timetrack():
- Dock_CanvasSpecific("timetrack",_("Timetrack"),Gtk::StockID("sinfg-timetrack"))
+ Dock_CanvasSpecific("timetrack",_("Timetrack"),Gtk::StockID("synfig-timetrack"))
{
table_=0;
widget_timeslider_= new Widget_Timeslider();
{
LayerParamTreeStore::Model model;
get_canvas_view()->work_area->set_selected_value_node(
- (sinfg::ValueNode::Handle)(*iter)[model.value_node]
+ (synfig::ValueNode::Handle)(*iter)[model.value_node]
);
}
else
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dock_timetrack.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_TIMETRACK_H
-#define __SINFG_STUDIO_DOCK_TIMETRACK_H
+#ifndef __SYNFIG_STUDIO_DOCK_TIMETRACK_H
+#define __SYNFIG_STUDIO_DOCK_TIMETRACK_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockable.cpp
** \brief Template File
**
#include "dockmanager.h"
#include "dockbook.h"
#include "dockdialog.h"
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include <gtkmm/table.h>
#include <gtk/gtk.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk::StockID stock_id_):
+Dockable::Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
// Gtk::Window(Gtk::WINDOW_TOPLEVEL),
name_(name),
local_name_(local_name),
}
void
-Dockable::set_local_name(const sinfg::String& local_name)
+Dockable::set_local_name(const synfig::String& local_name)
{
//set_title(local_name);
title_label_.set_text(local_name);
}
Gtk::ToolButton*
-Dockable::add_button(const Gtk::StockID& stock_id, const sinfg::String& tooltip)
+Dockable::add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip)
{
if(!toolbar_)
set_toolbar(*manage(new Gtk::Toolbar));
//Gtk::IconSize iconsize(4);
- //Gtk::IconSize iconsize(Gtk::IconSize::from_name("sinfg-small_icon"));
+ //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
Gtk::ToolButton* ret(manage(new Gtk::ToolButton(stock_id)));
//Gtk::Image* icon(manage(new Gtk::Image(stock_id,iconsize)));
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockable.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCKABLE_H
-#define __SINFG_STUDIO_DOCKABLE_H
+#ifndef __SYNFIG_STUDIO_DOCKABLE_H
+#define __SYNFIG_STUDIO_DOCKABLE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/stockid.h>
#include <gtkmm/button.h>
#include "dialogsettings.h"
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include <gtkmm/table.h>
#include <gtkmm/tooltips.h>
#include <gtkmm/label.h>
Gtk::Toolbar *toolbar_;
- sinfg::String name_;
- sinfg::String local_name_;
+ synfig::String name_;
+ synfig::String local_name_;
Gtk::Tooltips tooltips_;
Gtk::Frame frame_;
Gtk::Label title_label_;
void set_use_scrolled(bool x) { use_scrolled_=x; }
- Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
+ Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
~Dockable();
sigc::signal<void>& signal_stock_id_changed() { return signal_stock_id_changed_; }
- const sinfg::String& get_name()const { return name_; }
- const sinfg::String& get_local_name()const { return local_name_; }
+ const synfig::String& get_name()const { return name_; }
+ const synfig::String& get_local_name()const { return local_name_; }
const Gtk::StockID& get_stock_id()const { return stock_id_; }
void set_stock_id(Gtk::StockID x) { stock_id_=x; signal_stock_id_changed()(); }
- void set_local_name(const sinfg::String&);
+ void set_local_name(const synfig::String&);
void clear();
void add(Gtk::Widget& x);
- Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const sinfg::String& tooltip=sinfg::String());
+ Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip=synfig::String());
void detach();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockbook.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
show();
}
-sinfg::String
+synfig::String
DockBook::get_local_contents()const
{
- sinfg::String ret;
+ synfig::String ret;
for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
{
return ret;
}
-sinfg::String
+synfig::String
DockBook::get_contents()const
{
- sinfg::String ret;
+ synfig::String ret;
for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
{
}
void
-DockBook::set_contents(const sinfg::String& x)
+DockBook::set_contents(const synfig::String& x)
{
- sinfg::String str(x);
+ synfig::String str(x);
while(!str.empty())
{
unsigned int separator=str.find_first_of(' ');
- sinfg::String dock;
- if(separator==sinfg::String::npos)
+ synfig::String dock;
+ if(separator==synfig::String::npos)
{
dock=str;
str.clear();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockbook.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCKBOOK_H
-#define __SINFG_STUDIO_DOCKBOOK_H
+#ifndef __SYNFIG_STUDIO_DOCKBOOK_H
+#define __SYNFIG_STUDIO_DOCKBOOK_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/notebook.h>
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include <gtkmm/tooltips.h>
/* === M A C R O S ========================================================= */
void clear();
- sinfg::String get_local_contents()const;
+ synfig::String get_local_contents()const;
- sinfg::String get_contents()const;
- void set_contents(const sinfg::String& x);
+ synfig::String get_contents()const;
+ void set_contents(const synfig::String& x);
void refresh_tabs_headers();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockdialog.cpp
** \brief Template File
**
#include "dockbook.h"
#include "dockmanager.h"
#include "widget_compselect.h"
-#include <sinfg/general.h>
-#include <sinfg/uniqueid.h>
+#include <synfig/general.h>
+#include <synfig/uniqueid.h>
#include <gtkmm/table.h>
#include <sigc++/hide.h>
#include <sigc++/slot.h>
#include "canvasview.h"
#include <gtkmm/paned.h>
#include <gtkmm/box.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
#define GRAB_HINT_DATA(y,default) { \
String x; \
- if(sinfgapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
+ if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
{ \
set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \
} else {\
widget_comp_select=new Widget_CompSelect();
// Give ourselves an ID that is most likely unique
- set_id(sinfg::UniqueID().get_uid()^reinterpret_cast<int>(this));
+ set_id(synfig::UniqueID().get_uid()^reinterpret_cast<int>(this));
set_role(strprintf("dock_dialog_%d",get_id()));
GRAB_HINT_DATA(
}
catch(...)
{
- sinfg::warning("DockDialog::~DockDialog(): Exception thrown when trying to remove from dock manager...?");
+ synfig::warning("DockDialog::~DockDialog(): Exception thrown when trying to remove from dock manager...?");
}
delete widget_comp_select;
void
DockDialog::refresh()
{
- sinfg::info("dock_book_list.size()=%d",dock_book_list.size());
+ synfig::info("dock_book_list.size()=%d",dock_book_list.size());
//remove();
if(dock_book_list.empty())
bool
DockDialog::close()
{
- sinfg::info("DockDialog::close(): DELETED!");
+ synfig::info("DockDialog::close(): DELETED!");
empty_sig.disconnect();
//get_dock_book().clear();
delete this;
}
-sinfg::String
+synfig::String
DockDialog::get_contents()const
{
- sinfg::String ret;
+ synfig::String ret;
std::list<DockBook*>::const_iterator iter;
for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter)
}
void
-DockDialog::set_contents(const sinfg::String& z)
+DockDialog::set_contents(const synfig::String& z)
{
int x,y;
get_size(x,y);
- sinfg::String str(z);
+ synfig::String str(z);
while(!str.empty())
{
unsigned int separator=str.find_first_of('-');
{
unsigned int sep2=str.find_first_of('|');
- if(separator!=sinfg::String::npos || sep2!=sinfg::String::npos)
+ if(separator!=synfig::String::npos || sep2!=synfig::String::npos)
{
- if((separator==sinfg::String::npos || sep2<separator) && sep2!=sinfg::String::npos)
+ if((separator==synfig::String::npos || sep2<separator) && sep2!=synfig::String::npos)
{
separator=sep2;
is_horizontal=true;
}
}
- sinfg::String book_contents;
- if(separator==sinfg::String::npos)
+ synfig::String book_contents;
+ if(separator==synfig::String::npos)
{
book_contents=str;
str.clear();
if(is_deleting)return;
if(dock_book_list.size())
{
- sinfg::String title;
+ synfig::String title;
std::list<DockBook*>::const_iterator iter;
for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockdialog.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_DIALOG_H
-#define __SINFG_STUDIO_DOCK_DIALOG_H
+#ifndef __SYNFIG_STUDIO_DOCK_DIALOG_H
+#define __SYNFIG_STUDIO_DOCK_DIALOG_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/stockid.h>
#include <gtkmm/button.h>
#include "dialogsettings.h"
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include <gtkmm/dialog.h>
#include <gtkmm/tooltips.h>
#include <gtkmm/label.h>
DockBook& get_dock_book();
const DockBook& get_dock_book()const;
- sinfg::String get_contents()const;
- void set_contents(const sinfg::String& x);
+ synfig::String get_contents()const;
+ void set_contents(const synfig::String& x);
}; // END of studio::DockDialog
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockmanager.cpp
** \brief Template File
**
#include <stdexcept>
#include "dockable.h"
#include "dockdialog.h"
-#include <sinfgapp/settings.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/settings.h>
+#include <synfigapp/main.h>
#include <gdkmm/general.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === P R O C E D U R E S ================================================= */
-class studio::DockSettings : public sinfgapp::Settings
+class studio::DockSettings : public synfigapp::Settings
{
DockManager* dock_manager;
public:
DockSettings(DockManager* dock_manager):dock_manager(dock_manager)
{
- sinfgapp::Main::settings().add_domain(this,"dock");
+ synfigapp::Main::settings().add_domain(this,"dock");
}
virtual ~DockSettings()
{
- sinfgapp::Main::settings().remove_domain("dock");
+ synfigapp::Main::settings().remove_domain("dock");
}
#define SCALE_FACTOR (1280)
- virtual bool get_value(const sinfg::String& key_, sinfg::String& value)const
+ virtual bool get_value(const synfig::String& key_, synfig::String& value)const
{
int screen_w(Gdk::screen_width());
int screen_h(Gdk::screen_height());
if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog")try
{
- sinfg::String key(key_.begin()+7,key_.end());
+ synfig::String key(key_.begin()+7,key_.end());
int separator=key.find_first_of('.');
- int id(atoi(sinfg::String(key.begin(),key.begin()+separator).c_str()));
- key=sinfg::String(key.begin()+separator+1,key.end());
+ int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str()));
+ key=synfig::String(key.begin()+separator+1,key.end());
DockDialog& dock_dialog(dock_manager->find_dock_dialog(id));
return true;
}
}catch (...) { return false; }
- return sinfgapp::Settings::get_value(key_,value);
+ return synfigapp::Settings::get_value(key_,value);
}
- virtual bool set_value(const sinfg::String& key_,const sinfg::String& value)
+ virtual bool set_value(const synfig::String& key_,const synfig::String& value)
{
int screen_w(Gdk::screen_width());
int screen_h(Gdk::screen_height());
if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog")
{
- sinfg::String key(key_.begin()+7,key_.end());
+ synfig::String key(key_.begin()+7,key_.end());
int separator=key.find_first_of('.');
- int id(atoi(sinfg::String(key.begin(),key.begin()+separator).c_str()));
- key=sinfg::String(key.begin()+separator+1,key.end());
+ int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str()));
+ key=synfig::String(key.begin()+separator+1,key.end());
DockDialog& dock_dialog(dock_manager->find_dock_dialog(id));
}
catch(...)
{
- sinfg::error("Exception caught!!!");
+ synfig::error("Exception caught!!!");
return false;
}
return true;
return true;
}
}
- return sinfgapp::Settings::set_value(key_,value);
+ return synfigapp::Settings::set_value(key_,value);
}
virtual KeyList get_key_list()const
{
- sinfgapp::Settings::KeyList ret(sinfgapp::Settings::get_key_list());
+ synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
std::list<DockDialog*>::const_iterator iter;
for(iter=dock_manager->dock_dialog_list_.begin();iter!=dock_manager->dock_dialog_list_.end();++iter)
while(!dockable_list_.empty())
{
Dockable* dockable(dockable_list_.back());
- sinfg::info("DockManager::~DockManager(): Deleting dockable \"%s\"",dockable->get_name().c_str());
+ synfig::info("DockManager::~DockManager(): Deleting dockable \"%s\"",dockable->get_name().c_str());
dockable_list_.pop_back();
delete dockable;
}
DockManager::register_dockable(Dockable& x)
{
dockable_list_.push_back(&x);
- sinfg::info("DockManager::register_dockable(): Registered dockable \"%s\"",dockable_list_.back()->get_name().c_str());
+ synfig::info("DockManager::register_dockable(): Registered dockable \"%s\"",dockable_list_.back()->get_name().c_str());
signal_dockable_registered()(&x);
}
{
x.detach();
dockable_list_.erase(iter);
- sinfg::info("DockManager::unregister_dockable(): \"%s\" has been Unregistered",x.get_name().c_str());
+ synfig::info("DockManager::unregister_dockable(): \"%s\" has been Unregistered",x.get_name().c_str());
return true;
}
}
}
Dockable&
-DockManager::find_dockable(const sinfg::String& x)
+DockManager::find_dockable(const synfig::String& x)
{
std::list<Dockable*>::iterator iter;
for(iter=dockable_list_.begin();iter!=dockable_list_.end();++iter)
}
void
-DockManager::present(sinfg::String x)
+DockManager::present(synfig::String x)
{
try
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dockmanager.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DOCKMANAGER_H
-#define __SINFG_DOCKMANAGER_H
+#ifndef __SYNFIG_DOCKMANAGER_H
+#define __SYNFIG_DOCKMANAGER_H
/* === H E A D E R S ======================================================= */
#include <vector>
#include <list>
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include <sigc++/signal.h>
#include <sigc++/object.h>
#include <ETL/smart_ptr>
void register_dockable(Dockable& x);
bool unregister_dockable(Dockable& x);
- Dockable& find_dockable(const sinfg::String& x);
- void present(sinfg::String x);
+ Dockable& find_dockable(const synfig::String& x);
+ void present(synfig::String x);
}; // END of class DockManager
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file duck.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
~_DuckCounter()
{
if(counter)
- sinfg::error("%d ducks not yet deleted!",counter);
+ synfig::error("%d ducks not yet deleted!",counter);
}
} _duck_counter;
tangent_(false)
{ duck_count++; _DuckCounter::counter++; }
-Duck::Duck(const sinfg::Point &point):
+Duck::Duck(const synfig::Point &point):
type_(TYPE_NONE),
point(point),
origin(0,0),
tangent_(false)
{ duck_count++; _DuckCounter::counter++;}
-Duck::Duck(const sinfg::Point &point,const sinfg::Point &origin):
+Duck::Duck(const synfig::Point &point,const synfig::Point &origin):
point(point),
origin(origin),
scalar(1),
Duck::~Duck() { duck_count--; _DuckCounter::counter--;}
-sinfg::GUID
+synfig::GUID
Duck::get_data_guid()const
{
if(value_desc_.is_value_node())
}
void
-Duck::set_name(const sinfg::String &x)
+Duck::set_name(const synfig::String &x)
{
name=x;
if(guid_==GUID::zero())
//(shared_point?*shared_point==*rhs.shared_point:point==rhs.point) ;
}
-sinfg::Point
+synfig::Point
Duck::get_trans_point()const
{
return transform_stack_.perform(get_sub_trans_point());
}
void
-Duck::set_trans_point(const sinfg::Point &x)
+Duck::set_trans_point(const synfig::Point &x)
{
set_sub_trans_point(transform_stack_.unperform(x));
}
//! Sets the origin point.
void
-Duck::set_origin(const sinfg::Point &x)
+Duck::set_origin(const synfig::Point &x)
{
origin=x; origin_duck=0;
}
}
//! Retrieves the origin location
-sinfg::Point
+synfig::Point
Duck::get_origin()const
{
return origin_duck?origin_duck->get_point():origin;
}
//! Retrieves the origin location
-sinfg::Point
+synfig::Point
Duck::get_trans_origin()const
{
return transform_stack_.perform(get_sub_trans_origin());
}
-sinfg::Point
+synfig::Point
Duck::get_sub_trans_point()const
{
return get_point()*get_scalar()+get_sub_trans_origin();
}
void
-Duck::set_sub_trans_point(const sinfg::Point &x)
+Duck::set_sub_trans_point(const synfig::Point &x)
{
set_point((x-get_sub_trans_origin())/get_scalar());
}
-sinfg::Point
+synfig::Point
Duck::get_sub_trans_origin()const
{
return origin_duck?origin_duck->get_sub_trans_point():origin;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file duck.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_DUCKMATIC_DUCK_H
-#define __SINFG_DUCKMATIC_DUCK_H
+#ifndef __SYNFIG_DUCKMATIC_DUCK_H
+#define __SYNFIG_DUCKMATIC_DUCK_H
/* === H E A D E R S ======================================================= */
#include <ETL/smart_ptr>
#include <ETL/handle>
-#include <sinfg/vector.h>
-#include <sinfg/string.h>
-#include <sinfg/real.h>
+#include <synfig/vector.h>
+#include <synfig/string.h>
+#include <synfig/real.h>
#include <sigc++/signal.h>
#include <sigc++/object.h>
-#include <sinfg/time.h>
+#include <synfig/time.h>
#include <ETL/smart_ptr>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/transform.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/transform.h>
/* === M A C R O S ========================================================= */
{
__gnu_cxx::hash<const char*> hasher_;
public:
- size_t operator()(const sinfg::String& x)const
+ size_t operator()(const synfig::String& x)const
{
return hasher_(x.c_str());
}
private:
- sigc::signal<bool,const sinfg::Point &> signal_edited_;
+ sigc::signal<bool,const synfig::Point &> signal_edited_;
sigc::signal<void> signal_user_click_[5];
Type type_;
- sinfg::Point point;
+ synfig::Point point;
- etl::smart_ptr<sinfg::Point> shared_point;
+ etl::smart_ptr<synfig::Point> shared_point;
- sinfg::Point origin;
- sinfg::String name;
- sinfg::Real scalar;
+ synfig::Point origin;
+ synfig::String name;
+ synfig::Real scalar;
etl::handle<Duck> origin_duck;
etl::handle<Duck> connect_duck;
etl::handle<Duck> box_duck;
- sinfg::GUID guid_;
+ synfig::GUID guid_;
// Flags
bool editable;
bool radius_;
bool tangent_;
- sinfg::TransformStack transform_stack_;
+ synfig::TransformStack transform_stack_;
- sinfgapp::ValueDesc value_desc_;
+ synfigapp::ValueDesc value_desc_;
static int duck_count;
public:
Duck();
- Duck(const sinfg::Point &point);
- Duck(const sinfg::Point &point,const sinfg::Point &origin);
+ Duck(const synfig::Point &point);
+ Duck(const synfig::Point &point,const synfig::Point &origin);
~Duck();
- sigc::signal<bool,const sinfg::Point &> &signal_edited() { return signal_edited_; }
+ sigc::signal<bool,const synfig::Point &> &signal_edited() { return signal_edited_; }
sigc::signal<void> &signal_user_click(int i=0) { assert(i>=0); assert(i<5); return signal_user_click_[i]; }
- void set_guid(const sinfg::GUID& x) { guid_=x; }
- const sinfg::GUID& get_guid()const { return guid_; }
+ void set_guid(const synfig::GUID& x) { guid_=x; }
+ const synfig::GUID& get_guid()const { return guid_; }
- sinfg::GUID get_data_guid()const;
+ synfig::GUID get_data_guid()const;
//! Changes the editable flag. If set, the duck will not be able to be moved.
void set_editable(bool x) { editable=x; }
const etl::handle<Duck>& get_connect_duck()const { return connect_duck; }
const etl::handle<Duck>& get_box_duck()const { return box_duck; }
- void set_value_desc(sinfgapp::ValueDesc x) { value_desc_=x; }
+ void set_value_desc(synfigapp::ValueDesc x) { value_desc_=x; }
- sinfgapp::ValueDesc& get_value_desc() { return value_desc_; }
+ synfigapp::ValueDesc& get_value_desc() { return value_desc_; }
- void set_transform_stack(const sinfg::TransformStack& x) { transform_stack_=x; }
+ void set_transform_stack(const synfig::TransformStack& x) { transform_stack_=x; }
- const sinfg::TransformStack& get_transform_stack()const { return transform_stack_; }
+ const synfig::TransformStack& get_transform_stack()const { return transform_stack_; }
//! \writeme
void set_type(Type x) { type_=x; }
Type get_type()const { return type_; }
//! Sets the scalar multiplier for the duck with respect to the origin
- void set_scalar(sinfg::Vector::value_type n) { scalar=n; }
+ void set_scalar(synfig::Vector::value_type n) { scalar=n; }
//! Retrieves the scalar value
- sinfg::Vector::value_type get_scalar()const { return scalar; }
+ synfig::Vector::value_type get_scalar()const { return scalar; }
- void set_shared_point(const etl::smart_ptr<sinfg::Point>&x) { shared_point=x; }
+ void set_shared_point(const etl::smart_ptr<synfig::Point>&x) { shared_point=x; }
//! Sets the location of the duck with respect to the origin
- void set_point(const sinfg::Point &x) { (shared_point?*shared_point:point)=x; }
+ void set_point(const synfig::Point &x) { (shared_point?*shared_point:point)=x; }
//! Returns the location of the duck
- sinfg::Point get_point()const { return shared_point?*shared_point:point; }
+ synfig::Point get_point()const { return shared_point?*shared_point:point; }
- sinfg::Point get_trans_point()const;
+ synfig::Point get_trans_point()const;
- void set_trans_point(const sinfg::Point &x);
+ void set_trans_point(const synfig::Point &x);
- sinfg::Point get_sub_trans_point()const;
- void set_sub_trans_point(const sinfg::Point &x);
- sinfg::Point get_sub_trans_origin()const;
+ synfig::Point get_sub_trans_point()const;
+ void set_sub_trans_point(const synfig::Point &x);
+ synfig::Point get_sub_trans_origin()const;
//! Sets the origin point.
- void set_origin(const sinfg::Point &x);
+ void set_origin(const synfig::Point &x);
//! Sets the origin point as another duck
void set_origin(const etl::handle<Duck> &x);
//! Retrieves the origin location
- sinfg::Point get_origin()const;
+ synfig::Point get_origin()const;
//! Retrieves the origin duck
const etl::handle<Duck> & get_origin_duck() const;
//! Retrieves the origin location
- sinfg::Point get_trans_origin()const;
+ synfig::Point get_trans_origin()const;
void set_radius(bool r) { radius_=r; }
bool is_radius()const { return radius_; }
//! Sets the name of the duck
- void set_name(const sinfg::String &x);
+ void set_name(const synfig::String &x);
//! Retrieves the name of the duck
- sinfg::String get_name()const { return name; }
+ synfig::String get_name()const { return name; }
bool operator==(const Duck &rhs)const;
}; // END of class Duck
class DuckMap : public
#ifdef HASH_MAP_H
-__gnu_cxx::hash_map<sinfg::GUID,etl::handle<studio::Duck>,sinfg::GUIDHash>
+__gnu_cxx::hash_map<synfig::GUID,etl::handle<studio::Duck>,synfig::GUIDHash>
{
- typedef __gnu_cxx::hash_map<sinfg::GUID,etl::handle<studio::Duck>,sinfg::GUIDHash> PARENT_TYPE;
+ typedef __gnu_cxx::hash_map<synfig::GUID,etl::handle<studio::Duck>,synfig::GUIDHash> PARENT_TYPE;
#else
-std::map<sinfg::GUID,etl::handle<studio::Duck> >
+std::map<synfig::GUID,etl::handle<studio::Duck> >
{
- typedef std::map<sinfg::GUID,etl::handle<studio::Duck> > PARENT_TYPE;
+ typedef std::map<synfig::GUID,etl::handle<studio::Duck> > PARENT_TYPE;
#endif
public:
void insert(const Duck::Handle& x) { operator[](x->get_guid())=x; }
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file duckmatic.cpp
** \brief Template File
**
#include <ETL/hermite>
#include "duckmatic.h"
-#include <sinfgapp/value_desc.h>
-#include <sinfg/general.h>
-#include <sinfg/paramdesc.h>
-#include <sinfg/valuenode_timedswap.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_composite.h>
-#include <sinfg/valuenode_scale.h>
-#include <sinfg/valuenode_bline.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/general.h>
+#include <synfig/paramdesc.h>
+#include <synfig/valuenode_timedswap.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_composite.h>
+#include <synfig/valuenode_scale.h>
+#include <synfig/valuenode_bline.h>
-#include <sinfg/curve_helper.h>
+#include <synfig/curve_helper.h>
#include <sigc++/retype_return.h>
#include <sigc++/retype.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Duckmatic::~Duckmatic()
{
clear_ducks();
- //sinfg::info("Duckmatic::~Duckmatic(): Deleted. Duck Count=%d",Duck::duck_count);
+ //synfig::info("Duckmatic::~Duckmatic(): Deleted. Duck Count=%d",Duck::duck_count);
}
void
}
void
-Duckmatic::set_grid_size(const sinfg::Vector &s)
+Duckmatic::set_grid_size(const synfig::Vector &s)
{
if(grid_size!=s)
{
Duckmatic::GuideList::iterator
-Duckmatic::find_guide_x(sinfg::Point pos, float radius)
+Duckmatic::find_guide_x(synfig::Point pos, float radius)
{
GuideList::iterator iter,best(guide_list_x_.end());
float dist(radius);
}
Duckmatic::GuideList::iterator
-Duckmatic::find_guide_y(sinfg::Point pos, float radius)
+Duckmatic::find_guide_y(synfig::Point pos, float radius)
{
GuideList::iterator iter,best(guide_list_y_.end());
float dist(radius);
}
void
-Duckmatic::select_ducks_in_box(const sinfg::Vector& tl,const sinfg::Vector& br)
+Duckmatic::select_ducks_in_box(const synfig::Vector& tl,const synfig::Vector& br)
{
Vector vmin, vmax;
vmin[0]=std::min(tl[0],br[0]);
void
-Duckmatic::translate_selected_ducks(const sinfg::Vector& vector)
+Duckmatic::translate_selected_ducks(const synfig::Vector& vector)
{
if(duck_dragger_)
duck_dragger_->duck_drag(this,vector);
}
void
-Duckmatic::start_duck_drag(const sinfg::Vector& offset)
+Duckmatic::start_duck_drag(const synfig::Vector& offset)
{
if(duck_dragger_)
duck_dragger_->begin_duck_drag(this,offset);
}
void
-DuckDrag_Translate::begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& offset)
+DuckDrag_Translate::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& offset)
{
last_translate_=Vector(0,0);
{
}
void
-DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)
+DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)
{
const DuckList selected_ducks(duckmatic->get_selected_ducks());
DuckList::const_iterator iter;
- sinfg::Vector vect(duckmatic->snap_point_to_grid(vector)-drag_offset_);
+ synfig::Vector vect(duckmatic->snap_point_to_grid(vector)-drag_offset_);
int i;
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
const DuckList ducks(get_selected_ducks());
DuckList::const_iterator iter;
- sinfg::GUIDSet old_set(selected_ducks);
+ synfig::GUIDSet old_set(selected_ducks);
// If we have more than 20 things to move, then display
// something to explain that it may take a moment
}
else
{
- etl::smart_ptr<sinfg::Point> point(new Point(duck->get_point()));
+ etl::smart_ptr<synfig::Point> point(new Point(duck->get_point()));
duck->set_shared_point(point);
duck_data_share_map[duck->get_data_guid()]=point;
}
}
void
-Duckmatic::add_stroke(etl::smart_ptr<std::list<sinfg::Point> > stroke_point_list, const sinfg::Color& color)
+Duckmatic::add_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list, const synfig::Color& color)
{
assert(stroke_point_list);
}
void
-Duckmatic::add_persistant_stroke(etl::smart_ptr<std::list<sinfg::Point> > stroke_point_list, const sinfg::Color& color)
+Duckmatic::add_persistant_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list, const synfig::Color& color)
{
add_stroke(stroke_point_list,color);
persistant_stroke_list_.push_back(stroke_list_.back());
{
if(*iter!=duck && **iter==*duck)
{
- //sinfg::info("Found similar duck! (iter:%08x vs. duck:%08x)",iter->get(), duck.get());
+ //synfig::info("Found similar duck! (iter:%08x vs. duck:%08x)",iter->get(), duck.get());
return *iter;
}
}
return;
}
}
- sinfg::warning("Unable to find bezier to erase!");
+ synfig::warning("Unable to find bezier to erase!");
}
etl::handle<Duckmatic::Duck>
etl::handle<Duckmatic::Duck>
-Duckmatic::find_duck(sinfg::Point point, sinfg::Real radius, Duck::Type type)
+Duckmatic::find_duck(synfig::Point point, synfig::Real radius, Duck::Type type)
{
if(radius==0)radius=10000000;
}
etl::handle<Duckmatic::Bezier>
-Duckmatic::find_bezier(sinfg::Point point, sinfg::Real radius,float* location)
+Duckmatic::find_bezier(synfig::Point point, synfig::Real radius,float* location)
{
return find_bezier(point,radius,radius,location);
}
etl::handle<Duckmatic::Bezier>
-Duckmatic::find_bezier(sinfg::Point pos, sinfg::Real scale, sinfg::Real radius, float* location)
+Duckmatic::find_bezier(synfig::Point pos, synfig::Real scale, synfig::Real radius, float* location)
{
if(radius==0)radius=10000000;
Real closest(10000000);
bool
-Duckmatic::save_sketch(const sinfg::String& filename)const
+Duckmatic::save_sketch(const synfig::String& filename)const
{
std::ofstream file(filename.c_str());
<<(*iter)->color.get_g()<<' '
<<(*iter)->color.get_b()
<<endl;
- std::list<sinfg::Point>::const_iterator viter;
+ std::list<synfig::Point>::const_iterator viter;
for(viter=(*iter)->stroke_data->begin();viter!=(*iter)->stroke_data->end();++viter)
{
file<<"V "
}
bool
-Duckmatic::load_sketch(const sinfg::String& filename)
+Duckmatic::load_sketch(const synfig::String& filename)
{
std::ifstream file(filename.c_str());
if(line!="SKETCH")
{
- sinfg::error("Not a sketch");
+ synfig::error("Not a sketch");
return false;
}
- etl::smart_ptr<std::list<sinfg::Point> > stroke_data;
+ etl::smart_ptr<std::list<synfig::Point> > stroke_data;
while(file)
{
float r,g,b;
if(!strscanf(line,"C %f %f %f",&r, &g, &b))
{
- sinfg::warning("Bad color line \"%s\"",line.c_str());
+ synfig::warning("Bad color line \"%s\"",line.c_str());
r=0;g=0;b=0;
}
- add_persistant_stroke(stroke_data, sinfg::Color(r,g,b));
+ add_persistant_stroke(stroke_data, synfig::Color(r,g,b));
}
break;
case 'V':
if(!stroke_data)
{
stroke_data.spawn();
- add_persistant_stroke(stroke_data, sinfg::Color(0,0,0));
+ add_persistant_stroke(stroke_data, synfig::Color(0,0,0));
}
float x,y;
if(!strscanf(line,"V %f %f",&x, &y))
- sinfg::warning("Bad vertex \"%s\"",line.c_str());
+ synfig::warning("Bad vertex \"%s\"",line.c_str());
else
- stroke_data->push_back(sinfg::Vector(x,y));
+ stroke_data->push_back(synfig::Vector(x,y));
break;
default:
- sinfg::warning("Unexpected sketch token '%c'",line[0]);
+ synfig::warning("Unexpected sketch token '%c'",line[0]);
break;
}
}
-inline String guid_string(const sinfgapp::ValueDesc& x)
+inline String guid_string(const synfigapp::ValueDesc& x)
{
if(x.parent_is_layer_param())
return strprintf("%s",x.get_layer()->get_guid().get_string().c_str())+x.get_param_name();
return strprintf("%s",x.get_value_node()->get_guid().get_string().c_str());
}
-inline GUID calc_duck_guid(const sinfgapp::ValueDesc& x,const sinfg::TransformStack& transform_stack)
+inline GUID calc_duck_guid(const synfigapp::ValueDesc& x,const synfig::TransformStack& transform_stack)
{
GUID ret(0);
/*
Duck::Handle
-Duckmatic::create_duck_from(const sinfgapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const sinfg::TransformStack& transform_stack, int modifier, sinfg::ParamDesc *param_desc)
+Duckmatic::create_duck_from(const synfigapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const synfig::TransformStack& transform_stack, int modifier, synfig::ParamDesc *param_desc)
{
GUID duck_guid(calc_duck_guid(value_desc,transform_stack)^GUID::hasher(modifier));
etl::handle<Duck> duck=new Duck();
*/
bool
-Duckmatic::add_to_ducks(const sinfgapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const sinfg::TransformStack& transform_stack, sinfg::ParamDesc *param_desc, int multiple)
+Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const synfig::TransformStack& transform_stack, synfig::ParamDesc *param_desc, int multiple)
{
ValueBase::Type type=value_desc.get_value_type();
-#define REAL_COOKIE reinterpret_cast<sinfg::ParamDesc*>(28)
+#define REAL_COOKIE reinterpret_cast<synfig::ParamDesc*>(28)
switch(type)
{
case ValueBase::TYPE_REAL:
{
// If the ValueNode can be directly manipulated,
// then set it as so.
- duck->set_editable(sinfgapp::is_editable(value_desc.get_value_node()));
+ duck->set_editable(synfigapp::is_editable(value_desc.get_value_node()));
}
else
{
{
if(!param_desc->get_origin().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
/*
- duck->set_origin(value_desc_origin.get_value(get_time()).get(sinfg::Point()));
+ duck->set_origin(value_desc_origin.get_value(get_time()).get(synfig::Point()));
*/
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
etl::handle<Duck> duck=new Duck();
duck->set_type(Duck::TYPE_ANGLE);
duck->set_transform_stack(transform_stack);
- sinfg::Angle angle;
+ synfig::Angle angle;
angle=value_desc.get_value(get_time()).get(Angle());
duck->set_point(Point(Angle::cos(angle).get(),Angle::sin(angle).get()));
// If the ValueNode can be directly manipulated,
// then set it as so.
- duck->set_editable(sinfgapp::is_editable(value_desc.get_value_node()));
+ duck->set_editable(synfigapp::is_editable(value_desc.get_value_node()));
}
else
{
{
if(!param_desc->get_origin().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
/*
- duck->set_origin(value_desc_origin.get_value(get_time()).get(sinfg::Point()));
+ duck->set_origin(value_desc_origin.get_value(get_time()).get(synfig::Point()));
*/
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
// If the ValueNode can be directly manipulated,
// then set it as so.
- duck->set_editable(sinfgapp::is_editable(value_desc.get_value_node()));
+ duck->set_editable(synfigapp::is_editable(value_desc.get_value_node()));
}
else
{
{
if(!param_desc->get_connect().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_connect());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_connect());
Duck::Handle connect_duck;
if(duck_map.find(calc_duck_guid(value_desc_origin,transform_stack)^GUID::hasher(0))!=duck_map.end())
{
}
if(!param_desc->get_box().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_box());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_box());
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_box_duck(last_duck());
}
// If we have an origin
if(!param_desc->get_origin().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
/*
- duck->set_origin(value_desc_origin.get_value(get_time()).get(sinfg::Point()));
+ duck->set_origin(value_desc_origin.get_value(get_time()).get(synfig::Point()));
*/
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
(value_node=ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
)
{
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,0),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,0),canvas_view,transform_stack))
return false;
bezier->p1=last_duck();
bezier->p1->set_type(Duck::TYPE_VERTEX);
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,1),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,1),canvas_view,transform_stack))
return false;
bezier->c1=last_duck();
bezier->c1->set_type(Duck::TYPE_TANGENT);
bezier->c1->set_tangent(true);
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,2),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,2),canvas_view,transform_stack))
return false;
bezier->p2=last_duck();
bezier->p2->set_type(Duck::TYPE_VERTEX);
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,3),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,3),canvas_view,transform_stack))
return false;
bezier->c2=last_duck();
bezier->c2->set_type(Duck::TYPE_TANGENT);
{
Segment segment=value_desc.get_value();
etl::handle<Duck> duck_p,duck_c;
- sinfg::String name;
+ synfig::String name;
if(param_desc)
{
name=param_desc->get_local_name();
value_node=ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node());
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,0),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,0),canvas_view,transform_stack))
return false;
etl::handle<Duck> vertex_duck(last_duck());
vertex_duck->set_type(Duck::TYPE_VERTEX);
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,4),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,4),canvas_view,transform_stack))
return false;
etl::handle<Duck> t1_duck(last_duck());
// If the tangents are split
if((*value_node->get_link("split"))(get_time()).get(bool()))
{
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,5),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,5),canvas_view,transform_stack))
return false;
t2_duck=last_duck();
t2_duck->set_origin(vertex_duck);
}
else
{
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,4),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,4),canvas_view,transform_stack))
return false;
t2_duck=last_duck();
t2_duck->set_origin(vertex_duck);
// Add the vertex duck
if(vertex_value_node)
{
- if(add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,0),canvas_view,transform_stack))
+ if(add_to_ducks(synfigapp::ValueDesc(vertex_value_node,0),canvas_view,transform_stack))
{
duck=last_duck();
if(i==first)
),
1.0f
),
- sinfgapp::ValueDesc(value_node,i)
+ synfigapp::ValueDesc(value_node,i)
)
);
- duck->set_value_desc(sinfgapp::ValueDesc(value_node,i));
+ duck->set_value_desc(synfigapp::ValueDesc(value_node,i));
if(param_desc)
{
if(!param_desc->get_origin().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
/*
- ValueBase value(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(sinfg::Point()))
- duck->set_origin(value.get(sinfg::Point()));
+ ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
+ if(value.same_as(synfig::Point()))
+ duck->set_origin(value.get(synfig::Point()));
*/
}
}
duck->set_transform_stack(transform_stack);
duck->set_editable(false);
//duck->set_name(strprintf("%x-vertex",value_node->get_link(i).get()));
- duck->set_name(guid_string(sinfgapp::ValueDesc(value_node,i))+".v");
+ duck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".v");
duck->set_type(Duck::TYPE_VERTEX);
if(param_desc)
{
if(!param_desc->get_origin().empty())
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
/*
- ValueBase value(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(sinfg::Point()))
- duck->set_origin(value.get(sinfg::Point()));
+ ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
+ if(value.same_as(synfig::Point()))
+ duck->set_origin(value.get(synfig::Point()));
*/
}
}
- duck->set_guid(calc_duck_guid(sinfgapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".v"));
+ duck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".v"));
duck=add_similar_duck(duck);
// add_duck(duck);
}
if(param_desc && !param_desc->get_hint().empty())
{
etl::handle<Duck> width;
- if(add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,1),canvas_view,transform_stack,REAL_COOKIE))
+ if(add_to_ducks(synfigapp::ValueDesc(vertex_value_node,1),canvas_view,transform_stack,REAL_COOKIE))
{
width=last_duck();
width->set_origin(duck);
width->set_type(Duck::TYPE_WIDTH);
- width->set_name(guid_string(sinfgapp::ValueDesc(value_node,i))+".w");
+ width->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".w");
{
- ValueBase value(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time()));
- if(value.same_as(sinfg::Real()))
- width->set_scalar(value.get(sinfg::Real())*0.5f);
+ ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time()));
+ if(value.same_as(synfig::Real()))
+ width->set_scalar(value.get(synfig::Real())*0.5f);
}
}
else
- sinfg::error("Unable to add width duck!");
+ synfig::error("Unable to add width duck!");
}
if(bezier)
// Add the tangent1 duck
if(vertex_value_node)
{
- if(!add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,4),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(vertex_value_node,4),canvas_view,transform_stack))
return false;
tduck=last_duck();
}
tduck=new Duck(bline_point.get_tangent1());
tduck->set_transform_stack(transform_stack);
tduck->set_editable(false);
- tduck->set_name(guid_string(sinfgapp::ValueDesc(value_node,i))+".t1");
+ tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".t1");
// tduck->set_name(strprintf("%x-tangent1",value_node->get_link(i).get()));
- tduck->set_guid(calc_duck_guid(sinfgapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
tduck=add_similar_duck(tduck);
// add_duck(duck);
}
*canvas_view,
&studio::CanvasView::popup_param_menu_bezier
),
- sinfgapp::ValueDesc(value_node,i)
+ synfigapp::ValueDesc(value_node,i)
)
);
),
1.0f
),
- sinfgapp::ValueDesc(value_node,i)
+ synfigapp::ValueDesc(value_node,i)
)
);
- duck->set_value_desc(sinfgapp::ValueDesc(value_node,i));
+ duck->set_value_desc(synfigapp::ValueDesc(value_node,i));
add_bezier(bezier);
bezier=0;
if(vertex_value_node)
{
int i=bline_point.get_split_tangent_flag()?5:4;
- if(!add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,i),canvas_view,transform_stack,0,2))
+ if(!add_to_ducks(synfigapp::ValueDesc(vertex_value_node,i),canvas_view,transform_stack,0,2))
return false;
tduck=last_duck();
}
tduck=new Duck(bline_point.get_tangent2());
tduck->set_transform_stack(transform_stack);
//tduck->set_name(strprintf("%x-tangent2",value_node->get_link(i).get()));
- tduck->set_name(guid_string(sinfgapp::ValueDesc(value_node,i))+".t2");
- tduck->set_guid(calc_duck_guid(sinfgapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t2"));
+ tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".t2");
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t2"));
}
else
{
tduck=new Duck(bline_point.get_tangent1());
tduck->set_transform_stack(transform_stack);
//tduck->set_name(strprintf("%x-tangent1",value_node->get_link(i).get()));
- tduck->set_name(guid_string(sinfgapp::ValueDesc(value_node,i))+".t1");
- tduck->set_guid(calc_duck_guid(sinfgapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
+ tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".t1");
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
}
tduck->set_editable(false);
tduck=add_similar_duck(tduck);
// add_duck(duck);
if(param_desc)
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
/*
- ValueBase value(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(sinfg::Point()))
- duck->set_origin(value.get(sinfg::Point()));
+ ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
+ if(value.same_as(synfig::Point()))
+ duck->set_origin(value.get(synfig::Point()));
*/
// if(!param_desc->get_origin().empty())
-// duck->set_origin(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()).get(sinfg::Point()));
+// duck->set_origin(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()).get(synfig::Point()));
}
duck->signal_user_click(2).clear();
duck->signal_user_click(2).connect(
),
1.0f
),
- sinfgapp::ValueDesc(value_node,0)
+ synfigapp::ValueDesc(value_node,0)
)
);
- duck->set_value_desc(sinfgapp::ValueDesc(value_node,0));
+ duck->set_value_desc(synfigapp::ValueDesc(value_node,0));
}
/*
if(vertex_value_node)
{
- if(!add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,0),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(vertex_value_node,0),canvas_view,transform_stack))
return false;
duck=last_duck();
if(param_desc)
{
if(!param_desc->get_origin().empty())
- duck->set_origin(value_desc.get_layer()->get_param(param_desc->get_origin()).get(sinfg::Point()));
+ duck->set_origin(value_desc.get_layer()->get_param(param_desc->get_origin()).get(synfig::Point()));
}
duck->set_type(Duck::TYPE_VERTEX);
}
if(param_desc)
{
if(!param_desc->get_origin().empty())
- duck->set_origin(value_desc.get_layer()->get_param(param_desc->get_origin()).get(sinfg::Point()));
+ duck->set_origin(value_desc.get_layer()->get_param(param_desc->get_origin()).get(synfig::Point()));
}
duck->set_editable(false);
duck->set_name(strprintf("%x-vertex",value_node->get_link(first).get()));
// Add the tangent1 duck
if(vertex_value_node)
{
- if(!add_to_ducks(sinfgapp::ValueDesc(vertex_value_node,4),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(vertex_value_node,4),canvas_view,transform_stack))
return false;
tduck=last_duck();
}
tduck=new Duck(bline_point.get_tangent1());
tduck->set_transform_stack(transform_stack);
tduck->set_editable(false);
- tduck->set_name(guid_string(sinfgapp::ValueDesc(value_node,first))+".t1");
+ tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,first))+".t1");
//tduck->set_name(strprintf("%x-tangent1",value_node->get_link(first).get()));
tduck=add_similar_duck(tduck);
- tduck->set_guid(calc_duck_guid(sinfgapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
//add_duck(duck);
}
*canvas_view,
&studio::CanvasView::popup_param_menu_bezier
),
- sinfgapp::ValueDesc(value_node,first)
+ synfigapp::ValueDesc(value_node,first)
)
);
duck->signal_user_click(2).clear();
),
1.0f
),
- sinfgapp::ValueDesc(value_node,first)
+ synfigapp::ValueDesc(value_node,first)
)
);
- duck->set_value_desc(sinfgapp::ValueDesc(value_node,first));
+ duck->set_value_desc(synfigapp::ValueDesc(value_node,first));
add_bezier(bezier);
bezier=0;
{
if(!value_node->list[i].status_at_time(get_time()))
continue;
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,i),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,i),canvas_view,transform_stack))
return false;
etl::handle<Duck> duck(last_duck());
if(param_desc)
{
- sinfgapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
+ synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_origin());
add_to_ducks(value_desc_origin,canvas_view, transform_stack);
duck->set_origin(last_duck());
/*
- ValueBase value(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(sinfg::Point()))
- duck->set_origin(value.get(sinfg::Point()));
+ ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
+ if(value.same_as(synfig::Point()))
+ duck->set_origin(value.get(synfig::Point()));
*/
// if(!param_desc->get_origin().empty())
-// last_duck()->set_origin(sinfgapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()).get(sinfg::Point()));
+// last_duck()->set_origin(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()).get(synfig::Point()));
}
duck->set_type(Duck::TYPE_VERTEX);
bezier.p1=bezier.p2;bezier.c1=bezier.c2;
*canvas_view,
&studio::CanvasView::popup_param_menu_bezier
),
- sinfgapp::ValueDesc(value_node,i)
+ synfigapp::ValueDesc(value_node,i)
)
);
}
{
if(!value_node->list[i].status_at_time(get_time()))
continue;
- if(!add_to_ducks(sinfgapp::ValueDesc(value_node,i),canvas_view,transform_stack))
+ if(!add_to_ducks(synfigapp::ValueDesc(value_node,i),canvas_view,transform_stack))
return false;
}
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file duckmatic.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DUCKMATIC_H
-#define __SINFG_STUDIO_DUCKMATIC_H
+#ifndef __SYNFIG_STUDIO_DUCKMATIC_H
+#define __SYNFIG_STUDIO_DUCKMATIC_H
/* === H E A D E R S ======================================================= */
#include <ETL/smart_ptr>
#include <ETL/handle>
-#include <sinfg/vector.h>
-#include <sinfg/string.h>
-#include <sinfg/real.h>
+#include <synfig/vector.h>
+#include <synfig/string.h>
+#include <synfig/real.h>
#include <sigc++/signal.h>
#include <sigc++/object.h>
-#include <sinfg/time.h>
-#include <sinfg/color.h>
+#include <synfig/time.h>
+#include <synfig/color.h>
#include <ETL/smart_ptr>
#include "duck.h"
-#include <sinfg/color.h>
-#include <sinfg/guidset.h>
+#include <synfig/color.h>
+#include <synfig/guidset.h>
/* === M A C R O S ========================================================= */
{
__gnu_cxx::hash<const char*> hasher_;
public:
- size_t operator()(const sinfg::String& x)const
+ size_t operator()(const synfig::String& x)const
{
return hasher_(x.c_str());
}
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfgapp { class ValueDesc; }
-namespace sinfg { class ParamDesc; }
+namespace synfigapp { class ValueDesc; }
+namespace synfig { class ParamDesc; }
namespace studio
{
class DuckDrag_Base : public etl::shared_object
{
public:
- virtual void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin)=0;
+ virtual void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin)=0;
virtual bool end_duck_drag(Duckmatic* duckmatic)=0;
- virtual void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)=0;
+ virtual void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)=0;
};
class DuckDrag_Translate : public DuckDrag_Base
{
- sinfg::Vector last_translate_;
- sinfg::Vector drag_offset_;
- sinfg::Vector snap;
- std::vector<sinfg::Vector> positions;
+ synfig::Vector last_translate_;
+ synfig::Vector drag_offset_;
+ synfig::Vector snap;
+ std::vector<synfig::Vector> positions;
public:
- void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin);
+ void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin);
bool end_duck_drag(Duckmatic* duckmatic);
- void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector);
+ void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector);
};
/*! \class Duckmatic
public:
#ifdef HASH_MAP_H
-typedef __gnu_cxx::hash_map<sinfg::GUID,etl::smart_ptr<sinfg::Point>,sinfg::GUIDHash> DuckDataMap;
+typedef __gnu_cxx::hash_map<synfig::GUID,etl::smart_ptr<synfig::Point>,synfig::GUIDHash> DuckDataMap;
#else
-typedef std::map<sinfg::GUID,etl::smart_ptr<sinfg::Point> > DuckDataMap;
+typedef std::map<synfig::GUID,etl::smart_ptr<synfig::Point> > DuckDataMap;
#endif
typedef studio::DuckMap DuckMap;
std::list<etl::handle<Stroke> > persistant_stroke_list_;
- sinfg::GUIDSet selected_ducks;
+ synfig::GUIDSet selected_ducks;
- sinfg::GUID last_duck_guid;
+ synfig::GUID last_duck_guid;
std::list<etl::handle<Bezier> > bezier_list_;
//! I cannot recall what this is for
- //sinfg::Vector snap;
+ //synfig::Vector snap;
etl::handle<DuckDrag_Base> duck_dragger_;
GuideList guide_list_x_;
GuideList guide_list_y_;
- mutable sinfg::String sketch_filename_;
+ mutable synfig::String sketch_filename_;
/*
-- ** -- P R O T E C T E D D A T A -----------------------------------------
etl::handle<Bezier> selected_bezier;
- sinfg::Time cur_time;
+ synfig::Time cur_time;
//! This flag is set if operations should snap to the grid
/*! \todo perhaps there should be two of these flags, one for each axis?
//! This vector describes the grid size.
/*! \see grid_snap, show_grid */
- sinfg::Vector grid_size;
+ synfig::Vector grid_size;
bool show_persistant_strokes;
private:
- sinfg::Vector last_translate_;
- sinfg::Vector drag_offset_;
+ synfig::Vector last_translate_;
+ synfig::Vector drag_offset_;
//etl::handle<Duck> selected_duck;
void toggle_grid_snap() { set_grid_snap(!grid_snap); }
- sinfg::Point snap_point_to_grid(const sinfg::Point& x, float radius=0.1)const;
+ synfig::Point snap_point_to_grid(const synfig::Point& x, float radius=0.1)const;
bool get_show_persistant_strokes()const { return show_persistant_strokes; }
void set_show_persistant_strokes(bool x);
//! Sets the size of the grid
- void set_grid_size(const sinfg::Vector &s);
+ void set_grid_size(const synfig::Vector &s);
//! Returns the size of the grid
- const sinfg::Vector &get_grid_size()const { return grid_size; }
+ const synfig::Vector &get_grid_size()const { return grid_size; }
- const sinfg::Time &get_time()const { return cur_time; }
+ const synfig::Time &get_time()const { return cur_time; }
bool get_axis_lock()const { return axis_lock; }
void set_axis_lock(bool x) { axis_lock=x; }
- void set_time(sinfg::Time x) { cur_time=x; }
+ void set_time(synfig::Time x) { cur_time=x; }
bool is_duck_group_selectable(const etl::handle<Duck>& x)const;
void select_duck(const etl::handle<Duck> &duck);
- void select_ducks_in_box(const sinfg::Vector& tl,const sinfg::Vector& br);
+ void select_ducks_in_box(const synfig::Vector& tl,const synfig::Vector& br);
void unselect_duck(const etl::handle<Duck> &duck);
- void start_duck_drag(const sinfg::Vector& offset);
- void translate_selected_ducks(const sinfg::Vector& vector);
+ void start_duck_drag(const synfig::Vector& offset);
+ void translate_selected_ducks(const synfig::Vector& vector);
bool end_duck_drag();
void signal_edited_selected_ducks();
etl::handle<Duck> find_similar_duck(etl::handle<Duck> duck);
etl::handle<Duck> add_similar_duck(etl::handle<Duck> duck);
- void add_stroke(etl::smart_ptr<std::list<sinfg::Point> > stroke_point_list, const sinfg::Color& color=sinfg::Color(0,0,0));
+ void add_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list, const synfig::Color& color=synfig::Color(0,0,0));
- void add_persistant_stroke(etl::smart_ptr<std::list<sinfg::Point> > stroke_point_list, const sinfg::Color& color=sinfg::Color(0,0,0));
+ void add_persistant_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list, const synfig::Color& color=synfig::Color(0,0,0));
void clear_persistant_strokes();
//! \note parameter is in canvas coordinates
/*! A radius of "zero" will have an unlimited radius */
- etl::handle<Duck> find_duck(sinfg::Point pos, sinfg::Real radius=0, Duck::Type type=Duck::TYPE_DEFAULT);
+ etl::handle<Duck> find_duck(synfig::Point pos, synfig::Real radius=0, Duck::Type type=Duck::TYPE_DEFAULT);
- GuideList::iterator find_guide_x(sinfg::Point pos, float radius=0.1);
- GuideList::iterator find_guide_y(sinfg::Point pos, float radius=0.1);
- GuideList::const_iterator find_guide_x(sinfg::Point pos, float radius=0.1)const { return const_cast<Duckmatic*>(this)->find_guide_x(pos,radius); }
- GuideList::const_iterator find_guide_y(sinfg::Point pos, float radius=0.1)const { return const_cast<Duckmatic*>(this)->find_guide_y(pos,radius); }
+ GuideList::iterator find_guide_x(synfig::Point pos, float radius=0.1);
+ GuideList::iterator find_guide_y(synfig::Point pos, float radius=0.1);
+ GuideList::const_iterator find_guide_x(synfig::Point pos, float radius=0.1)const { return const_cast<Duckmatic*>(this)->find_guide_x(pos,radius); }
+ GuideList::const_iterator find_guide_y(synfig::Point pos, float radius=0.1)const { return const_cast<Duckmatic*>(this)->find_guide_y(pos,radius); }
//! \note parameter is in canvas coordinates
/*! A radius of "zero" will have an unlimited radius */
- //etl::handle<Bezier> find_bezier(sinfg::Point pos, sinfg::Real radius=0);
+ //etl::handle<Bezier> find_bezier(synfig::Point pos, synfig::Real radius=0);
//! \note parameter is in canvas coordinates
/*! A radius of "zero" will have an unlimited radius */
- etl::handle<Bezier> find_bezier(sinfg::Point pos, sinfg::Real radius=0, float* location=0);
+ etl::handle<Bezier> find_bezier(synfig::Point pos, synfig::Real radius=0, float* location=0);
- etl::handle<Bezier> find_bezier(sinfg::Point pos, sinfg::Real scale, sinfg::Real radius, float* location=0);
+ etl::handle<Bezier> find_bezier(synfig::Point pos, synfig::Real scale, synfig::Real radius, float* location=0);
- bool add_to_ducks(const sinfgapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const sinfg::TransformStack& transform_stack_, sinfg::ParamDesc *param_desc=0, int multiple=0);
+ bool add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const synfig::TransformStack& transform_stack_, synfig::ParamDesc *param_desc=0, int multiple=0);
//! \writeme
void set_type_mask(Type x) { type_mask=x; }
void clear_ducks();
- bool save_sketch(const sinfg::String& filename)const;
- bool load_sketch(const sinfg::String& filename);
- const sinfg::String& get_sketch_filename()const { return sketch_filename_; }
+ bool save_sketch(const synfig::String& filename)const;
+ bool load_sketch(const synfig::String& filename);
+ const synfig::String& get_sketch_filename()const { return sketch_filename_; }
void set_duck_dragger(etl::handle<DuckDrag_Base> x) { duck_dragger_=x; }
etl::handle<DuckDrag_Base> get_duck_dragger()const { return duck_dragger_; }
sigc::signal<void,float> signal_user_click_[5];
public:
- etl::smart_ptr<std::list<sinfg::Point> > stroke_data;
+ etl::smart_ptr<std::list<synfig::Point> > stroke_data;
- sinfg::Color color;
+ synfig::Color color;
bool is_valid()const { return (bool)stroke_data; }
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
-#define __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
+#ifndef __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
+#define __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
/* === H E A D E R S ======================================================= */
#include "duckmatic.h"
-#include <sinfg/angle.h>
+#include <synfig/angle.h>
/* === M A C R O S ========================================================= */
namespace studio {
-class Transform_Rotate : public sinfg::Transform
+class Transform_Rotate : public synfig::Transform
{
private:
- sinfg::Angle angle;
- sinfg::Vector origin;
- sinfg::Real sin_val;
- sinfg::Real cos_val;
+ synfig::Angle angle;
+ synfig::Vector origin;
+ synfig::Real sin_val;
+ synfig::Real cos_val;
public:
- Transform_Rotate(const sinfg::Angle& angle,const sinfg::Vector& origin=sinfg::Vector(0,0)):
+ Transform_Rotate(const synfig::Angle& angle,const synfig::Vector& origin=synfig::Vector(0,0)):
angle(angle),
origin(origin),
- sin_val(sinfg::Angle::sin(angle).get()),
- cos_val(sinfg::Angle::cos(angle).get())
+ sin_val(synfig::Angle::sin(angle).get()),
+ cos_val(synfig::Angle::cos(angle).get())
{
}
- sinfg::Vector perform(const sinfg::Vector& x)const
+ synfig::Vector perform(const synfig::Vector& x)const
{
- sinfg::Point pos(x-origin);
- return sinfg::Point(cos_val*pos[0]-sin_val*pos[1],sin_val*pos[0]+cos_val*pos[1])+origin;
+ synfig::Point pos(x-origin);
+ return synfig::Point(cos_val*pos[0]-sin_val*pos[1],sin_val*pos[0]+cos_val*pos[1])+origin;
}
- sinfg::Vector unperform(const sinfg::Vector& x)const
+ synfig::Vector unperform(const synfig::Vector& x)const
{
- sinfg::Point pos(x-origin);
- return sinfg::Point(cos_val*pos[0]+sin_val*pos[1],-sin_val*pos[0]+cos_val*pos[1])+origin;
+ synfig::Point pos(x-origin);
+ return synfig::Point(cos_val*pos[0]+sin_val*pos[1],-sin_val*pos[0]+cos_val*pos[1])+origin;
}
};
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DUCK_TRANSFORM_SCALE_H
-#define __SINFG_STUDIO_DUCK_TRANSFORM_SCALE_H
+#ifndef __SYNFIG_STUDIO_DUCK_TRANSFORM_SCALE_H
+#define __SYNFIG_STUDIO_DUCK_TRANSFORM_SCALE_H
/* === H E A D E R S ======================================================= */
namespace studio {
-class Transform_Scale : public sinfg::Transform
+class Transform_Scale : public synfig::Transform
{
private:
- sinfg::Vector scale;
- sinfg::Vector origin;
+ synfig::Vector scale;
+ synfig::Vector origin;
public:
- Transform_Scale(const sinfg::Vector& scale,const sinfg::Vector& origin=sinfg::Vector(0,0)):scale(scale),origin(origin) { }
- sinfg::Vector perform(const sinfg::Vector& x)const { return sinfg::Vector((x[0]-origin[0])*scale[0]+origin[0],(x[1]-origin[1])*scale[1]+origin[1]); }
- sinfg::Vector unperform(const sinfg::Vector& x)const { return sinfg::Vector((x[0]-origin[0])/scale[0]+origin[0],(x[1]-origin[1])/scale[1]+origin[1]); }
+ Transform_Scale(const synfig::Vector& scale,const synfig::Vector& origin=synfig::Vector(0,0)):scale(scale),origin(origin) { }
+ synfig::Vector perform(const synfig::Vector& x)const { return synfig::Vector((x[0]-origin[0])*scale[0]+origin[0],(x[1]-origin[1])*scale[1]+origin[1]); }
+ synfig::Vector unperform(const synfig::Vector& x)const { return synfig::Vector((x[0]-origin[0])/scale[0]+origin[0],(x[1]-origin[1])/scale[1]+origin[1]); }
};
};
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DUCK_TRANSFORM_TRANSLATE_H
-#define __SINFG_STUDIO_DUCK_TRANSFORM_TRANSLATE_H
+#ifndef __SYNFIG_STUDIO_DUCK_TRANSFORM_TRANSLATE_H
+#define __SYNFIG_STUDIO_DUCK_TRANSFORM_TRANSLATE_H
/* === H E A D E R S ======================================================= */
namespace studio {
-class Transform_Translate : public sinfg::Transform
+class Transform_Translate : public synfig::Transform
{
private:
- sinfg::Vector origin;
- std::vector<sinfg::Vector> positions;
+ synfig::Vector origin;
+ std::vector<synfig::Vector> positions;
public:
- Transform_Translate(const sinfg::Vector& origin): origin(origin) { }
- sinfg::Vector perform(const sinfg::Vector& x)const { return x+origin; }
- sinfg::Vector unperform(const sinfg::Vector& x)const { return x-origin; }
-}; // END of class sinfg::Transform_Translate
+ Transform_Translate(const synfig::Vector& origin): origin(origin) { }
+ synfig::Vector perform(const synfig::Vector& x)const { return x+origin; }
+ synfig::Vector unperform(const synfig::Vector& x)const { return x-origin; }
+}; // END of class synfig::Transform_Translate
}; // END of namespace studio
/* === E N D =============================================================== */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file event_layerclick.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_EVENT_LAYERCLICK_H
-#define __SINFG_EVENT_LAYERCLICK_H
+#ifndef __SYNFIG_EVENT_LAYERCLICK_H
+#define __SYNFIG_EVENT_LAYERCLICK_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/vector.h>
+#include <synfig/vector.h>
#include "event_mouse.h"
-#include <sinfg/layer.h>
+#include <synfig/layer.h>
#include "smach.h"
#include <gdkmm/types.h>
struct EventLayerClick : public Smach::event
{
- sinfg::Point pos;
+ synfig::Point pos;
MouseButton button;
- etl::loose_handle<sinfg::Layer> layer;
+ etl::loose_handle<synfig::Layer> layer;
Gdk::ModifierType modifier;
- EventLayerClick(etl::loose_handle<sinfg::Layer> layer, MouseButton button, const sinfg::Point& pos, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
+ EventLayerClick(etl::loose_handle<synfig::Layer> layer, MouseButton button, const synfig::Point& pos, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
Smach::event(EVENT_WORKAREA_LAYER_CLICKED),
pos(pos),
button(button),
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file event_mouse.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_EVENT_MOUSE_H
-#define __SINFG_EVENT_MOUSE_H
+#ifndef __SYNFIG_EVENT_MOUSE_H
+#define __SYNFIG_EVENT_MOUSE_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/vector.h>
+#include <synfig/vector.h>
#include "smach.h"
#include <gdkmm/types.h>
struct EventMouse : public Smach::event
{
- sinfg::Point pos;
+ synfig::Point pos;
MouseButton button;
float pressure;
Gdk::ModifierType modifier;
- EventMouse(EventKey id, MouseButton button, const sinfg::Point& pos, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
+ EventMouse(EventKey id, MouseButton button, const synfig::Point& pos, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
Smach::event(id),
pos(pos),
button(button),
modifier(modifier)
{ }
- EventMouse(EventKey id, MouseButton button, const sinfg::Point& pos, float pressure, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
+ EventMouse(EventKey id, MouseButton button, const synfig::Point& pos, float pressure, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
Smach::event(id),
pos(pos),
button(button),
struct EventBox : public Smach::event
{
- sinfg::Point p1,p2;
+ synfig::Point p1,p2;
MouseButton button;
Gdk::ModifierType modifier;
- EventBox(EventKey id, const sinfg::Point& p1,const sinfg::Point& p2,MouseButton button=BUTTON_NONE, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
+ EventBox(EventKey id, const synfig::Point& p1,const synfig::Point& p2,MouseButton button=BUTTON_NONE, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
Smach::event(id),
p1(p1),
p2(p2),
modifier(modifier)
{ }
- EventBox(const sinfg::Point& p1,const sinfg::Point& p2,MouseButton button=BUTTON_NONE, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
+ EventBox(const synfig::Point& p1,const synfig::Point& p2,MouseButton button=BUTTON_NONE, Gdk::ModifierType modifier=Gdk::ModifierType(0)):
Smach::event(EVENT_WORKAREA_BOX),
p1(p1),
p2(p2),
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file eventkey.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_EVENTKEY_H
-#define __SINFG_STUDIO_EVENTKEY_H
+#ifndef __SYNFIG_STUDIO_EVENTKEY_H
+#define __SYNFIG_STUDIO_EVENTKEY_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#include "groupactionmanager.h"
#include "layergrouptree.h"
-#include <sinfgapp/action_param.h>
+#include <synfigapp/action_param.h>
#include "instance.h"
#include <gtkmm/stock.h>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
static const guint no_prev_popup((guint)-1);
}
void
-GroupActionManager::set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x)
+GroupActionManager::set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x)
{
canvas_interface_=x;
}
// Make sure we are ready
if(!ui_manager_ || !group_tree_ || !canvas_interface_)
{
- sinfg::error("GroupActionManager::refresh(): Not ready!");
+ synfig::error("GroupActionManager::refresh(): Not ready!");
return;
}
// bool multiple_selected(group_tree_->get_selection()->count_selected_rows()>1);
LayerGroupTree::LayerList selected_layers(group_tree_->get_selected_layers());
- std::list<sinfg::String> selected_groups(group_tree_->get_selected_groups());
+ std::list<synfig::String> selected_groups(group_tree_->get_selected_groups());
- sinfg::info("selected_layers.size()=%d",selected_layers.size());
- sinfg::info("selected_groups.size()=%d",selected_groups.size());
+ synfig::info("selected_layers.size()=%d",selected_layers.size());
+ synfig::info("selected_groups.size()=%d",selected_groups.size());
{
bool canvas_set(false);
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",get_canvas_interface()->get_time());
param_list.add("canvas_interface",get_canvas_interface());
}
{
- std::list<sinfg::String>::iterator iter;
+ std::list<synfig::String>::iterator iter;
for(iter=selected_groups.begin();iter!=selected_groups.end();++iter)
{
- param_list.add("group",(sinfg::String)*iter);
+ param_list.add("group",(synfig::String)*iter);
}
}
}
handle<studio::Instance>::cast_static(get_canvas_interface()->get_instance())->
- add_actions_to_group(action_group_, ui_info, param_list, sinfgapp::Action::CATEGORY_GROUP);
+ add_actions_to_group(action_group_, ui_info, param_list, synfigapp::Action::CATEGORY_GROUP);
}
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GROUP_ACTION_MANAGER_H
-#define __SINFG_GROUP_ACTION_MANAGER_H
+#ifndef __SYNFIG_GROUP_ACTION_MANAGER_H
+#define __SYNFIG_GROUP_ACTION_MANAGER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/uimanager.h>
#include <gtkmm/treeview.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
/* === M A C R O S ========================================================= */
{
Glib::RefPtr<Gtk::UIManager> ui_manager_;
LayerGroupTree* group_tree_;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gtk::ActionGroup> action_group_;
Gtk::UIManager::ui_merge_id popup_id_;
void set_group_tree(LayerGroupTree* x);
LayerGroupTree* get_group_tree()const { return group_tree_; }
- void set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x);
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ void set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x);
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
void refresh();
void clear();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file historytreestore.cpp
** \brief Template File
**
#endif
#include "historytreestore.h"
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
#include "iconcontroler.h"
-#include <sinfg/valuenode_timedswap.h>
+#include <synfig/valuenode_timedswap.h>
#include <gtkmm/button.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "instance.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
HistoryTreeStore::~HistoryTreeStore()
{
- sinfg::info("HistoryTreeStore::~HistoryTreeStore(): Deleted");
+ synfig::info("HistoryTreeStore::~HistoryTreeStore(): Deleted");
}
Glib::RefPtr<HistoryTreeStore>
void
HistoryTreeStore::rebuild()
{
- sinfgapp::Action::Stack::const_iterator iter;
+ synfigapp::Action::Stack::const_iterator iter;
clear();
}
void
-HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<sinfgapp::Action::Undoable> action, bool is_active, bool is_undo, bool is_redo)
+HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active, bool is_undo, bool is_redo)
{
assert(action);
row[model.is_undo] = is_undo;
row[model.is_redo] = is_redo;
- sinfgapp::Action::CanvasSpecific *specific_action;
- specific_action=dynamic_cast<sinfgapp::Action::CanvasSpecific*>(action.get());
+ synfigapp::Action::CanvasSpecific *specific_action;
+ specific_action=dynamic_cast<synfigapp::Action::CanvasSpecific*>(action.get());
if(specific_action)
{
row[model.canvas] = specific_action->get_canvas();
row[model.canvas_id] = specific_action->get_canvas()->get_id();
}
- etl::handle<sinfgapp::Action::Group> group;
- group=etl::handle<sinfgapp::Action::Group>::cast_dynamic(action);
+ etl::handle<synfigapp::Action::Group> group;
+ group=etl::handle<synfigapp::Action::Group>::cast_dynamic(action);
if(group)
{
- sinfgapp::Action::ActionList::const_iterator iter;
+ synfigapp::Action::ActionList::const_iterator iter;
for(iter=group->action_list().begin();iter!=group->action_list().end();++iter)
{
Gtk::TreeRow child_row = *(append(row.children()));
}
}
- //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("sinfg-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ //row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
}
}
void
-HistoryTreeStore::on_new_action(etl::handle<sinfgapp::Action::Undoable> action)
+HistoryTreeStore::on_new_action(etl::handle<synfigapp::Action::Undoable> action)
{
// Gtk::TreeRow row = *(append());
Gtk::TreeRow row;
}
void
-HistoryTreeStore::on_action_status_changed(etl::handle<sinfgapp::Action::Undoable> action)
+HistoryTreeStore::on_action_status_changed(etl::handle<synfigapp::Action::Undoable> action)
{
Gtk::TreeModel::Children::iterator iter;
Gtk::TreeModel::Children children_(children());
for(iter=children_.begin(); iter != children_.end(); ++iter)
{
Gtk::TreeModel::Row row = *iter;
- if(action == (etl::handle<sinfgapp::Action::Undoable>)row[model.action])
+ if(action == (etl::handle<synfigapp::Action::Undoable>)row[model.action])
{
row[model.is_active]=action->is_active();
return;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file historytreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_HISTORYTREESTORE_H
-#define __SINFG_STUDIO_HISTORYTREESTORE_H
+#ifndef __SYNFIG_STUDIO_HISTORYTREESTORE_H
+#define __SYNFIG_STUDIO_HISTORYTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include <gdkmm/pixbuf.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
/* === M A C R O S ========================================================= */
{
public:
public:
- Gtk::TreeModelColumn<etl::handle<sinfgapp::Action::Undoable> > action;
+ Gtk::TreeModelColumn<etl::handle<synfigapp::Action::Undoable> > action;
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
Gtk::TreeModelColumn<bool> is_active;
Gtk::TreeModelColumn<bool> is_redo;
Gtk::TreeModelColumn<Glib::ustring> canvas_id;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
Model()
{
void on_redo_stack_cleared();
- void on_new_action(etl::handle<sinfgapp::Action::Undoable> action);
+ void on_new_action(etl::handle<synfigapp::Action::Undoable> action);
- void on_action_status_changed(etl::handle<sinfgapp::Action::Undoable> action);
+ void on_action_status_changed(etl::handle<synfigapp::Action::Undoable> action);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
void refresh() { rebuild(); }
- void insert_action(Gtk::TreeRow row,etl::handle<sinfgapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
+ void insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
/*
-- ** -- P R O T E C T E D M E T H O D S -----------------------------------
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#endif
#include "iconcontroler.h"
-#include <sinfg/valuenode_const.h>
+#include <synfig/valuenode_const.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#endif
using namespace etl;
using namespace std;
using namespace studio;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-static Glib::RefPtr<Gdk::Pixbuf> _tree_pixbuf_table_value_type[(int)sinfg::ValueBase::TYPE_END];
+static Glib::RefPtr<Gdk::Pixbuf> _tree_pixbuf_table_value_type[(int)synfig::ValueBase::TYPE_END];
-IconControler::IconControler(const sinfg::String& basepath)
+IconControler::IconControler(const synfig::String& basepath)
{
Gtk::IconSource icon_source;
icon_source.set_direction_wildcarded();
path_to_icons+=ETL_DIRECTORY_SEPERATOR;
try{
- Gtk::Window::set_default_icon_from_file(path_to_icons+"sinfg_icon."+IMAGE_EXT);
+ Gtk::Window::set_default_icon_from_file(path_to_icons+"synfig_icon."+IMAGE_EXT);
} catch(...)
{
- sinfg::warning("Unable to open "+path_to_icons+"sinfg_icon."+IMAGE_EXT);
+ synfig::warning("Unable to open "+path_to_icons+"synfig_icon."+IMAGE_EXT);
}
/*
#define INIT_STOCK_ICON(name,iconfile,desc) \
- stock_##name=Gtk::StockItem(Gtk::StockID("sinfg-" #name),desc); \
+ stock_##name=Gtk::StockItem(Gtk::StockID("synfig-" #name),desc); \
Gtk::Stock::add(stock_##name); \
icon_source.set_filename(path_to_icons+iconfile); \
icon_##name.add_source(icon_source); \
icon_factory->add(stock_##name.get_stock_id(),icon_##name)
*/
#define INIT_STOCK_ICON(name,iconfile,desc){ \
- Gtk::StockItem stockitem(Gtk::StockID("sinfg-" #name),desc); \
+ Gtk::StockItem stockitem(Gtk::StockID("synfig-" #name),desc); \
Gtk::Stock::add(stockitem); \
Gtk::IconSet icon_set; \
icon_source.set_filename(path_to_icons+iconfile); \
}
#define INIT_STOCK_ICON_CLONE(name,stockid,desc){ \
- Gtk::StockItem stockitem(Gtk::StockID("sinfg-" #name),desc); \
+ Gtk::StockItem stockitem(Gtk::StockID("synfig-" #name),desc); \
Gtk::Stock::add(stockitem); \
Gtk::IconSet icon_set; \
if(Gtk::Stock::lookup(stockitem.get_stock_id(),icon_set)) \
}
#define INIT_STOCK_ITEM(name,desc) \
- stock_##name=Gtk::StockItem(Gtk::StockID("sinfg-" #name),desc); \
+ stock_##name=Gtk::StockItem(Gtk::StockID("synfig-" #name),desc); \
Gtk::Stock::add(stock_##name);
INIT_STOCK_ICON(swap_colors,"swap_colors_icon."IMAGE_EXT,_("Swap Colors"));
icon_factory->add_default();
- Gtk::IconSize::register_new("sinfg-small_icon",12,12);
+ Gtk::IconSize::register_new("synfig-small_icon",12,12);
for(int i(0);i<(int)ValueBase::TYPE_END;i++)
_tree_pixbuf_table_value_type[i]=Gtk::Button().render_icon(value_icon(ValueBase::Type(i)),Gtk::ICON_SIZE_SMALL_TOOLBAR);
DEBUGPOINT();
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
DEBUGPOINT();
- pixbuf=Gtk::Button().render_icon(Gtk::StockID("sinfg-"+name),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ pixbuf=Gtk::Button().render_icon(Gtk::StockID("synfig-"+name),Gtk::ICON_SIZE_SMALL_TOOLBAR);
DEBUGPOINT();
pixbuf->render_to_drawable_alpha(
}
Gtk::StockID
-studio::value_icon(sinfg::ValueBase::Type type)
+studio::value_icon(synfig::ValueBase::Type type)
{
switch(type)
{
case ValueBase::TYPE_REAL:
- return Gtk::StockID("sinfg-real");
+ return Gtk::StockID("synfig-real");
break;
case ValueBase::TYPE_INTEGER:
- return Gtk::StockID("sinfg-integer");
+ return Gtk::StockID("synfig-integer");
break;
case ValueBase::TYPE_BOOL:
- return Gtk::StockID("sinfg-bool");
+ return Gtk::StockID("synfig-bool");
break;
case ValueBase::TYPE_ANGLE:
- return Gtk::StockID("sinfg-angle");
+ return Gtk::StockID("synfig-angle");
break;
case ValueBase::TYPE_VECTOR:
- return Gtk::StockID("sinfg-vector");
+ return Gtk::StockID("synfig-vector");
break;
case ValueBase::TYPE_COLOR:
- return Gtk::StockID("sinfg-color");
+ return Gtk::StockID("synfig-color");
break;
case ValueBase::TYPE_STRING:
- return Gtk::StockID("sinfg-string");
+ return Gtk::StockID("synfig-string");
break;
case ValueBase::TYPE_CANVAS:
- return Gtk::StockID("sinfg-canvas_pointer");
+ return Gtk::StockID("synfig-canvas_pointer");
break;
case ValueBase::TYPE_LIST:
- return Gtk::StockID("sinfg-list");
+ return Gtk::StockID("synfig-list");
break;
case ValueBase::TYPE_SEGMENT:
- return Gtk::StockID("sinfg-segment");
+ return Gtk::StockID("synfig-segment");
break;
case ValueBase::TYPE_GRADIENT:
- return Gtk::StockID("sinfg-gradient");
+ return Gtk::StockID("synfig-gradient");
break;
case ValueBase::TYPE_BLINEPOINT:
- return Gtk::StockID("sinfg-blinepoint");
+ return Gtk::StockID("synfig-blinepoint");
break;
case ValueBase::TYPE_NIL:
default:
- return Gtk::StockID("sinfg-unknown");
+ return Gtk::StockID("synfig-unknown");
break;
}
}
Gtk::StockID
-studio::valuenode_icon(etl::handle<sinfg::ValueNode> value_node)
+studio::valuenode_icon(etl::handle<synfig::ValueNode> value_node)
{
if(handle<ValueNode_Const>::cast_dynamic(value_node))
{
}
else
{
- return Gtk::StockID("sinfg-value_node");
+ return Gtk::StockID("synfig-value_node");
}
}
Glib::RefPtr<Gdk::Pixbuf>
-studio::get_tree_pixbuf(sinfg::ValueBase::Type type)
+studio::get_tree_pixbuf(synfig::ValueBase::Type type)
{
//return Gtk::Button().render_icon(value_icon(type),Gtk::ICON_SIZE_SMALL_TOOLBAR);
return _tree_pixbuf_table_value_type[int(type)];
}
Gtk::StockID
-studio::get_action_stock_id(const sinfgapp::Action::BookEntry& action)
+studio::get_action_stock_id(const synfigapp::Action::BookEntry& action)
{
Gtk::StockID stock_id;
if(action.task=="raise") stock_id=Gtk::Stock::GO_UP;
else if(action.task=="set_on") stock_id=Gtk::Stock::YES;
else if(action.task=="set_off") stock_id=Gtk::Stock::NO;
else if(action.task=="remove") stock_id=Gtk::Stock::DELETE;
- else stock_id=Gtk::StockID("sinfg-"+action.task);
+ else stock_id=Gtk::StockID("synfig-"+action.task);
return stock_id;
}
Gtk::StockID
-studio::layer_icon(const sinfg::String &layer)
+studio::layer_icon(const synfig::String &layer)
{
if(layer=="PasteCanvas" || layer=="pastecanvas")
- return Gtk::StockID("sinfg-layer_pastecanvas");
+ return Gtk::StockID("synfig-layer_pastecanvas");
else if(layer=="rotate")
- return Gtk::StockID("sinfg-rotate");
+ return Gtk::StockID("synfig-rotate");
else if(layer=="zoom")
- return Gtk::StockID("sinfg-zoom");
+ return Gtk::StockID("synfig-zoom");
else if(layer=="region")
- return Gtk::StockID("sinfg-bline");
+ return Gtk::StockID("synfig-bline");
else if(layer=="polygon")
- return Gtk::StockID("sinfg-polygon");
+ return Gtk::StockID("synfig-polygon");
else if(layer=="outline")
- return Gtk::StockID("sinfg-width");
+ return Gtk::StockID("synfig-width");
else if(layer=="circle")
- return Gtk::StockID("sinfg-circle");
+ return Gtk::StockID("synfig-circle");
else if(layer=="rectangle")
- return Gtk::StockID("sinfg-rectangle");
+ return Gtk::StockID("synfig-rectangle");
else if(layer.find("gradient")!=String::npos)
- return Gtk::StockID("sinfg-gradient");
+ return Gtk::StockID("synfig-gradient");
else
- return Gtk::StockID("sinfg-layer");
+ return Gtk::StockID("synfig-layer");
}
Glib::RefPtr<Gdk::Pixbuf>
-studio::get_tree_pixbuf_layer(const sinfg::String &layer)
+studio::get_tree_pixbuf_layer(const synfig::String &layer)
{
return Gtk::Button().render_icon(layer_icon(layer),Gtk::ICON_SIZE_SMALL_TOOLBAR);
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_ICONCONTROLER_H
-#define __SINFG_STUDIO_ICONCONTROLER_H
+#ifndef __SYNFIG_STUDIO_ICONCONTROLER_H
+#define __SYNFIG_STUDIO_ICONCONTROLER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/iconset.h>
#include <gdkmm/cursor.h>
-#include <sinfg/value.h>
+#include <synfig/value.h>
/* === M A C R O S ========================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfg { class ValueNode; class Layer; }
+namespace synfig { class ValueNode; class Layer; }
-namespace sinfgapp { namespace Action { class BookEntry; };};
+namespace synfigapp { namespace Action { class BookEntry; };};
namespace studio {
{
Glib::RefPtr<Gtk::IconFactory> icon_factory;
public:
- IconControler(const sinfg::String& basepath);
+ IconControler(const synfig::String& basepath);
~IconControler();
static Gdk::Cursor get_normal_cursor();
static Gdk::Cursor get_tool_cursor(const Glib::ustring& name,const Glib::RefPtr<Gdk::Window>& window);
};
-Gtk::StockID layer_icon(const sinfg::String &layer);
-Glib::RefPtr<Gdk::Pixbuf> get_tree_pixbuf_layer(const sinfg::String &layer);
+Gtk::StockID layer_icon(const synfig::String &layer);
+Glib::RefPtr<Gdk::Pixbuf> get_tree_pixbuf_layer(const synfig::String &layer);
-Gtk::StockID value_icon(sinfg::ValueBase::Type type);
-Gtk::StockID valuenode_icon(etl::handle<sinfg::ValueNode> value_node);
-Glib::RefPtr<Gdk::Pixbuf> get_tree_pixbuf(sinfg::ValueBase::Type type);
-Gtk::StockID get_action_stock_id(const sinfgapp::Action::BookEntry& action);
+Gtk::StockID value_icon(synfig::ValueBase::Type type);
+Gtk::StockID valuenode_icon(etl::handle<synfig::ValueNode> value_node);
+Glib::RefPtr<Gdk::Pixbuf> get_tree_pixbuf(synfig::ValueBase::Type type);
+Gtk::StockID get_action_stock_id(const synfigapp::Action::BookEntry& action);
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file instance.cpp
** \brief writeme
**
#include <sigc++/retype_return.h>
#include <sigc++/retype.h>
//#include <sigc++/hide.h>
-#include <sinfg/valuenode_composite.h>
+#include <synfig/valuenode_composite.h>
#include "widget_waypointmodel.h"
#include <gtkmm/actiongroup.h>
#include "iconcontroler.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
using namespace SigC;
/* === M E T H O D S ======================================================= */
Instance::Instance(Canvas::Handle canvas):
- sinfgapp::Instance (canvas),
+ synfigapp::Instance (canvas),
// canvas_tree_store_ (Gtk::TreeStore::create(CanvasTreeModel())),
// canvas_tree_store_ (Gtk::TreeStore::create()),
history_tree_store_ (HistoryTreeStore::create(this)),
App::instance_list.push_back(instance);
// Set up the instance with the default UI manager
- instance->sinfgapp::Instance::set_ui_interface(App::get_ui_interface());
+ instance->synfigapp::Instance::set_ui_interface(App::get_ui_interface());
// Signal the new instance
App::signal_instance_created()(instance);
}
bool
-studio::Instance::save_as(const sinfg::String &file_name)const
+studio::Instance::save_as(const synfig::String &file_name)const
{
- if(sinfgapp::Instance::save_as(file_name))
+ if(synfigapp::Instance::save_as(file_name))
{
App::add_recent_file(file_name);
return true;
}
bool
-studio::Instance::save_as(const sinfg::String &file_name)
+studio::Instance::save_as(const synfig::String &file_name)
{
- if(sinfgapp::Instance::save_as(file_name))
+ if(synfigapp::Instance::save_as(file_name))
{
App::add_recent_file(file_name);
return true;
return true;
}
- return sinfgapp::Instance::save();
+ return synfigapp::Instance::save();
}
std::set<Node*>::iterator iter;
for(iter=canvas->parent_set.begin();iter!=canvas->parent_set.end();++iter)
{
- sinfg::Node* node(*iter);
+ synfig::Node* node(*iter);
for(;!node->parent_set.empty();node=*node->parent_set.begin())
{
Layer::Handle parent_layer(dynamic_cast<Layer*>(node));
CanvasTreeModel canvas_tree_model;
assert(canvas);
- row[canvas_tree_model.icon] = Gtk::Button().render_icon(Gtk::StockID("sinfg-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ row[canvas_tree_model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
row[canvas_tree_model.id] = canvas->get_id();
row[canvas_tree_model.name] = canvas->get_name();
if(canvas->is_root())
row[canvas_tree_model.is_value_node] = false;
{
- sinfg::Canvas::Children::iterator iter;
- sinfg::Canvas::Children &children(canvas->children());
+ synfig::Canvas::Children::iterator iter;
+ synfig::Canvas::Children &children(canvas->children());
for(iter=children.begin();iter!=children.end();iter++)
insert_canvas(*(canvas_tree_store()->append(row.children())),*iter);
valuenode_row[canvas_tree_model.is_canvas] = false;
valuenode_row[canvas_tree_model.is_value_node] = false;
- sinfg::ValueNodeList::iterator iter;
- sinfg::ValueNodeList &value_node_list(canvas->value_node_list());
+ synfig::ValueNodeList::iterator iter;
+ synfig::ValueNodeList &value_node_list(canvas->value_node_list());
for(iter=value_node_list.begin();iter!=value_node_list.end();iter++)
insert_value_node(*(canvas_tree_store()->append(valuenode_row.children())),canvas,*iter);
/*
void
-Instance::insert_value_node(Gtk::TreeRow row,Canvas::Handle canvas,etl::handle<sinfg::ValueNode> value_node)
+Instance::insert_value_node(Gtk::TreeRow row,Canvas::Handle canvas,etl::handle<synfig::ValueNode> value_node)
{
CanvasTreeModel canvas_tree_model;
assert(value_node);
{
string message;
- if(sinfgapp::Instance::get_action_count())
+ if(synfigapp::Instance::get_action_count())
{
if(!App::dialog_yes_no(_("CVS Commit"), _("This will save any changes you have made. Are you sure?")))
return;
try
{
String filename(get_file_name());
- if(sinfgapp::Instance::get_action_count())
+ if(synfigapp::Instance::get_action_count())
{
if(!App::dialog_yes_no(_("CVS Update"), _("This will save any changes you have made. Are you sure?")))
return;
if(canvas->count()!=1)
{
one_moment.hide();
- App::dialog_error_blocking(_("Error: Revert Failed"),_("The revert operation has failed. This can be due to it being\nreferenced by another composition that is already open, or\nbecause of an internal error in SINFG Studio. Try closing any\ncompositions that might reference this composition and try\nagain, or restart SINFG studio."));
+ App::dialog_error_blocking(_("Error: Revert Failed"),_("The revert operation has failed. This can be due to it being\nreferenced by another composition that is already open, or\nbecause of an internal error in SYNFIG Studio. Try closing any\ncompositions that might reference this composition and try\nagain, or restart SYNFIG studio."));
one_moment.show();
}
canvas=0;
bool
Instance::safe_revert()
{
- if(sinfgapp::Instance::get_action_count())
+ if(synfigapp::Instance::get_action_count())
if(!App::dialog_yes_no(_("Revert to saved"), _("You will loose any changes you have made since your last save.\nAre you sure?")))
return false;
revert();
bool
Instance::safe_close()
{
- handle<sinfgapp::UIInterface> uim;
+ handle<synfigapp::UIInterface> uim;
uim=find_canvas_view(get_canvas())->get_ui_interface();
if(get_action_count())
{
string str=strprintf(_("Would you like to save your changes to %s?"),basename(get_file_name()).c_str() );
- int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES);
- if(answer==sinfgapp::UIInterface::RESPONSE_YES)
+ int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES);
+ if(answer==synfigapp::UIInterface::RESPONSE_YES)
save();
- if(answer==sinfgapp::UIInterface::RESPONSE_CANCEL)
+ if(answer==synfigapp::UIInterface::RESPONSE_CANCEL)
return false;
}
if(is_modified())
{
string str=strprintf(_("%s has changes not yet on the CVS repository.\nWould you like to commit these changes?"),basename(get_file_name()).c_str());
- int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES);
+ int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES);
- if(answer==sinfgapp::UIInterface::RESPONSE_YES)
+ if(answer==synfigapp::UIInterface::RESPONSE_YES)
dialog_cvs_commit();
- if(answer==sinfgapp::UIInterface::RESPONSE_CANCEL)
+ if(answer==synfigapp::UIInterface::RESPONSE_CANCEL)
return false;
}
void
-Instance::add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, sinfg::String& ui_info, const sinfgapp::Action::ParamList ¶m_list, sinfgapp::Action::Category category)const
+Instance::add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, synfig::String& ui_info, const synfigapp::Action::ParamList ¶m_list, synfigapp::Action::Category category)const
{
- sinfgapp::Action::CanidateList canidate_list;
- sinfgapp::Action::CanidateList::iterator iter;
+ synfigapp::Action::CanidateList canidate_list;
+ synfigapp::Action::CanidateList::iterator iter;
canidate_list=compile_canidate_list(param_list,category);
canidate_list.sort();
if(canidate_list.empty())
- sinfg::warning("Action CanidateList is empty!");
+ synfig::warning("Action CanidateList is empty!");
for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
{
Gtk::StockID stock_id(get_action_stock_id(*iter));
- if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
{
action_group->add(Gtk::Action::create(
"action-"+iter->name,
}
void
-Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list,sinfgapp::Action::Category category)const
+Instance::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list,synfigapp::Action::Category category)const
{
- sinfgapp::Action::CanidateList canidate_list;
- sinfgapp::Action::CanidateList::iterator iter;
+ synfigapp::Action::CanidateList canidate_list;
+ synfigapp::Action::CanidateList::iterator iter;
canidate_list=compile_canidate_list(param_list,category);
canidate_list.sort();
if(canidate_list.empty())
- sinfg::warning("Action CanidateList is empty!");
+ synfig::warning("Action CanidateList is empty!");
for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
{
- if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
{
Gtk::Image* image(manage(new Gtk::Image()));
Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
else
{
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
}
*/
menu->items().push_back(
}
void
-Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list,const sinfgapp::Action::ParamList ¶m_list2,sinfgapp::Action::Category category)const
+Instance::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list,const synfigapp::Action::ParamList ¶m_list2,synfigapp::Action::Category category)const
{
- sinfgapp::Action::CanidateList canidate_list;
- sinfgapp::Action::CanidateList canidate_list2;
+ synfigapp::Action::CanidateList canidate_list;
+ synfigapp::Action::CanidateList canidate_list2;
- sinfgapp::Action::CanidateList::iterator iter;
+ synfigapp::Action::CanidateList::iterator iter;
canidate_list=compile_canidate_list(param_list,category);
canidate_list2=compile_canidate_list(param_list2,category);
canidate_list.sort();
if(canidate_list.empty())
- sinfg::warning("Action CanidateList is empty!");
+ synfig::warning("Action CanidateList is empty!");
if(canidate_list2.empty())
- sinfg::warning("Action CanidateList2 is empty!");
+ synfig::warning("Action CanidateList2 is empty!");
// Seperate out the canidate lists so that there are no conflicts
for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
{
- sinfgapp::Action::CanidateList::iterator iter2(canidate_list2.find(iter->name));
+ synfigapp::Action::CanidateList::iterator iter2(canidate_list2.find(iter->name));
if(iter2!=canidate_list2.end())
canidate_list2.erase(iter2);
}
for(iter=canidate_list2.begin();iter!=canidate_list2.end();++iter)
{
- if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
{
Gtk::Image* image(manage(new Gtk::Image()));
Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
else
{
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
}
*/
menu->items().push_back(
for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
{
- if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
{
Gtk::Image* image(manage(new Gtk::Image()));
Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
else
{
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
- Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+ Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
}
*/
menu->items().push_back(
}
void
-Instance::process_action(String name, sinfgapp::Action::ParamList param_list)
+Instance::process_action(String name, synfigapp::Action::ParamList param_list)
{
- assert(sinfgapp::Action::book().count(name));
+ assert(synfigapp::Action::book().count(name));
- sinfgapp::Action::BookEntry entry(sinfgapp::Action::book().find(name)->second);
+ synfigapp::Action::BookEntry entry(synfigapp::Action::book().find(name)->second);
- sinfgapp::Action::Handle action(entry.factory());
+ synfigapp::Action::Handle action(entry.factory());
if(!action)
{
- sinfg::error("Bad Action");
+ synfig::error("Bad Action");
return;
}
action->set_param_list(param_list);
- sinfgapp::Action::ParamVocab param_vocab(entry.get_param_vocab());
- sinfgapp::Action::ParamVocab::const_iterator iter;
+ synfigapp::Action::ParamVocab param_vocab(entry.get_param_vocab());
+ synfigapp::Action::ParamVocab::const_iterator iter;
for(iter=param_vocab.begin();iter!=param_vocab.end();++iter)
{
{
switch(iter->get_type())
{
- case sinfgapp::Action::Param::TYPE_STRING:
+ case synfigapp::Action::Param::TYPE_STRING:
{
String str;
if(!studio::App::dialog_entry(entry.local_name, iter->get_local_name()+":"+iter->get_desc(),str))
break;
}
default:
- sinfg::error("Unsupported user-supplied action parameter");
+ synfig::error("Unsupported user-supplied action parameter");
return;
break;
}
if(!action->is_ready())
{
- sinfg::error("Action not ready");
+ synfig::error("Action not ready");
return;
}
}
void
-Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp::ValueDesc value_desc, float location)
+Instance::make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas, synfigapp::ValueDesc value_desc, float location)
{
Gtk::Menu& parammenu(*menu);
- etl::handle<sinfgapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
+ etl::handle<synfigapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
if(!canvas_interface)
return;
- sinfgapp::Action::ParamList param_list,param_list2;
+ synfigapp::Action::ParamList param_list,param_list2;
param_list=canvas_interface->generate_param_list(value_desc);
param_list.add("origin",location);
if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
{
param_list2=canvas_interface->generate_param_list(
- sinfgapp::ValueDesc(
+ synfigapp::ValueDesc(
ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
,0
)
sigc::hide_return(
sigc::bind(
sigc::bind(
- sigc::mem_fun(*canvas_interface.get(),&sinfgapp::CanvasInterface::convert),
+ sigc::mem_fun(*canvas_interface.get(),&synfigapp::CanvasInterface::convert),
iter->first
),
value_desc
}
if(param_list2.empty())
- add_actions_to_menu(¶mmenu, param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+ add_actions_to_menu(¶mmenu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
else
- add_actions_to_menu(¶mmenu, param_list2,param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+ add_actions_to_menu(¶mmenu, param_list2,param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
{
- value_desc=sinfgapp::ValueDesc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),0);
+ value_desc=synfigapp::ValueDesc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),0);
}
if(value_desc.is_value_node() && ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()))
}
void
-edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::ValueDesc> value_desc_list)
+edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<synfigapp::ValueDesc> value_desc_list)
{
- etl::handle<sinfgapp::CanvasInterface> canvas_interface(canvas_view->canvas_interface());
+ etl::handle<synfigapp::CanvasInterface> canvas_interface(canvas_view->canvas_interface());
Gtk::Dialog dialog(
"Edit Multiple Waypoints", // Title
if(dialog.run()==0 || widget_waypoint_model.get_waypoint_model().is_trivial())
return;
DEBUGPOINT();
- sinfgapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Set Waypoints"));
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Set Waypoints"));
- std::list<sinfgapp::ValueDesc>::iterator iter;
+ std::list<synfigapp::ValueDesc>::iterator iter;
for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
{
- sinfgapp::ValueDesc value_desc(*iter);
+ synfigapp::ValueDesc value_desc(*iter);
if(!value_desc.is_valid())
continue;
value_node=ValueNode_Animated::create(value,canvas_interface->get_time());
- sinfgapp::Action::Handle action;
+ synfigapp::Action::Handle action;
if(!value_desc.is_value_node())
{
- action=sinfgapp::Action::create("value_desc_connect");
+ action=synfigapp::Action::create("value_desc_connect");
action->set_param("dest",value_desc);
action->set_param("src",ValueNode::Handle(value_node));
}
else
{
- action=sinfgapp::Action::create("value_node_replace");
+ action=synfigapp::Action::create("value_node_replace");
action->set_param("dest",value_desc.get_value_node());
action->set_param("src",ValueNode::Handle(value_node));
}
if(value_node)
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("waypoint_set_smart"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set_smart"));
if(!action)
{
}
void
-Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas,const std::list<sinfgapp::ValueDesc>& value_desc_list)
+Instance::make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas,const std::list<synfigapp::ValueDesc>& value_desc_list)
{
- etl::handle<sinfgapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
+ etl::handle<synfigapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list=canvas_interface->generate_param_list(value_desc_list);
- add_actions_to_menu(menu, param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+ add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
// Add the edit waypoints option if that might be useful
if(canvas->rend_desc().get_time_end()-Time::epsilon()>canvas->rend_desc().get_time_start())
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file instance.h
** \brief writeme
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_INSTANCE_H
-#define __SINFG_STUDIO_INSTANCE_H
+#ifndef __SYNFIG_STUDIO_INSTANCE_H
+#define __SYNFIG_STUDIO_INSTANCE_H
/* === H E A D E R S ======================================================= */
#include <ETL/handle>
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/instance.h>
#include <sigc++/object.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/value_desc.h>
#include "historytreestore.h"
-#include <sinfg/canvas.h>
+#include <synfig/canvas.h>
/* === M A C R O S ========================================================= */
class CanvasView;
-class Instance : public sinfgapp::Instance
+class Instance : public synfigapp::Instance
{
public:
typedef std::list< etl::handle<CanvasView> > CanvasViewList;
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> id;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
Gtk::TreeModelColumn<bool> is_canvas;
- Gtk::TreeModelColumn<sinfg::ValueNode::Handle> value_node;
+ Gtk::TreeModelColumn<synfig::ValueNode::Handle> value_node;
Gtk::TreeModelColumn<bool> is_value_node;
- Gtk::TreeModelColumn<sinfg::ValueBase> value;
+ Gtk::TreeModelColumn<synfig::ValueBase> value;
Gtk::TreeModelColumn<Glib::ustring> type;
Gtk::TreeModelColumn<int> link_id;
Gtk::TreeModelColumn<int> link_count;
Gtk::TreeModelColumn<bool> is_editable;
- Gtk::TreeModelColumn<sinfgapp::ValueDesc> value_desc;
+ Gtk::TreeModelColumn<synfigapp::ValueDesc> value_desc;
CanvasTreeModel()
{
protected:
- Instance(sinfg::Canvas::Handle);
+ Instance(synfig::Canvas::Handle);
public:
//! Returns the number of instances that are currently open in the program
static int get_count() { return instance_count_; }
- //etl::handle<sinfg::Canvas> get_canvas()const { return sinfgapp::Instance::get_canvas(); }
+ //etl::handle<synfig::Canvas> get_canvas()const { return synfigapp::Instance::get_canvas(); }
- etl::handle<CanvasView> find_canvas_view(etl::handle<sinfg::Canvas> canvas);
+ etl::handle<CanvasView> find_canvas_view(etl::handle<synfig::Canvas> canvas);
//! Sets the focus to a specific canvas
- void focus(etl::handle<sinfg::Canvas> canvas);
+ void focus(etl::handle<synfig::Canvas> canvas);
CanvasViewList & canvas_view_list() { return canvas_view_list_; }
const CanvasViewList & canvas_view_list()const { return canvas_view_list_; }
- bool save_as(const sinfg::String &filename)const;
+ bool save_as(const synfig::String &filename)const;
- bool save_as(const sinfg::String &filename);
+ bool save_as(const synfig::String &filename);
//! Opens a "Save As" dialog, and then saves the composition to that file
void dialog_save_as();
bool safe_revert();
bool safe_close();
- void add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list, sinfgapp::Action::Category category=sinfgapp::Action::CATEGORY_ALL)const;
- void add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList ¶m_list1,const sinfgapp::Action::ParamList ¶m_list2, sinfgapp::Action::Category category=sinfgapp::Action::CATEGORY_ALL)const;
+ void add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const;
+ void add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list1,const synfigapp::Action::ParamList ¶m_list2, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const;
- void add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, sinfg::String& ui_info, const sinfgapp::Action::ParamList ¶m_list, sinfgapp::Action::Category category=sinfgapp::Action::CATEGORY_ALL)const;
+ void add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, synfig::String& ui_info, const synfigapp::Action::ParamList ¶m_list, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const;
- void process_action(sinfg::String name, sinfgapp::Action::ParamList param_list);
+ void process_action(synfig::String name, synfigapp::Action::ParamList param_list);
- void make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp::ValueDesc value_desc, float location=0.5f);
+ void make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas, synfigapp::ValueDesc value_desc, float location=0.5f);
- void make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas,const std::list<sinfgapp::ValueDesc>& value_desc_list);
+ void make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas,const std::list<synfigapp::ValueDesc>& value_desc_list);
- static void edit_waypoint(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint);
+ static void edit_waypoint(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint);
private:
- void insert_canvas(Gtk::TreeRow row,sinfg::Canvas::Handle canvas);
+ void insert_canvas(Gtk::TreeRow row,synfig::Canvas::Handle canvas);
public:
- static etl::handle<Instance> create(sinfg::Canvas::Handle canvas);
+ static etl::handle<Instance> create(synfig::Canvas::Handle canvas);
}; // END class Instance
}; // END namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file ipc.cpp
** \brief Template File
**
#include <sys/stat.h>
#endif
-#include <sinfg/main.h>
+#include <synfig/main.h>
#include "app.h"
#ifdef HAVE_UNISTD_H
#include "toolbox.h"
#include <glibmm/dispatcher.h>
-#include <sinfg/mutex.h>
-#include <sinfg/string.h>
+#include <synfig/mutex.h>
+#include <synfig/string.h>
#include <glibmm/thread.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
#ifdef _WIN32
#define WIN32_PIPE_PATH "\\\\.\\pipe\\SynfigStudio.Cmd"
-static sinfg::Mutex cmd_mutex;
-static std::list<sinfg::String> cmd_queue;
+static synfig::Mutex cmd_mutex;
+static std::list<synfig::String> cmd_queue;
static Glib::Dispatcher* cmd_dispatcher;
static void
pipe_listen_thread()
);
if(pipe_handle==INVALID_HANDLE_VALUE)
{
- sinfg::error("IPC(): Call to CreateNamedPipe failed. Ignore next error. GetLastError=%d",GetLastError());
+ synfig::error("IPC(): Call to CreateNamedPipe failed. Ignore next error. GetLastError=%d",GetLastError());
return;
}
if(success && read_bytes==1 && c!='\n')
data+=c;
}while(c!='\n');
- sinfg::Mutex::Lock lock(cmd_mutex);
+ synfig::Mutex::Lock lock(cmd_mutex);
cmd_queue.push_back(data);
cmd_dispatcher->emit();
} while(success && read_bytes);
static void
empty_cmd_queue()
{
- sinfg::Mutex::Lock lock(cmd_mutex);
+ synfig::Mutex::Lock lock(cmd_mutex);
while(!cmd_queue.empty())
{
IPC::process_command(cmd_queue.front());
if(mkfifo(fifo_path().c_str(), S_IRWXU)!=0)
{
- sinfg::error("IPC(): mkfifo failed for "+fifo_path());
+ synfig::error("IPC(): mkfifo failed for "+fifo_path());
}
{
if(fd<0)
{
- sinfg::error("IPC(): Failed to open fifo \"%s\". (errno=%d)",fifo_path().c_str(),errno);
+ synfig::error("IPC(): Failed to open fifo \"%s\". (errno=%d)",fifo_path().c_str(),errno);
}
else
{
// close(fd);
}
-sinfg::String
+synfig::String
IPC::fifo_path()
{
#ifdef _WIN32
bool
IPC::fifo_activity(Glib::IOCondition cond)
{
- sinfg::info(__FILE__":%d: fifo activity",__LINE__);
+ synfig::info(__FILE__":%d: fifo activity",__LINE__);
if(cond&(Glib::IO_ERR|Glib::IO_HUP|Glib::IO_NVAL))
{
if(cond&(Glib::IO_ERR))
- sinfg::error("IPC::fifo_activity(): IO_ERR");
+ synfig::error("IPC::fifo_activity(): IO_ERR");
if(cond&(Glib::IO_HUP))
- sinfg::error("IPC::fifo_activity(): IO_HUP");
+ synfig::error("IPC::fifo_activity(): IO_HUP");
if(cond&(Glib::IO_NVAL))
- sinfg::error("IPC::fifo_activity(): IO_NVAL");
+ synfig::error("IPC::fifo_activity(): IO_NVAL");
return false;
}
- sinfg::info(__FILE__":%d: fifo activity",__LINE__);
+ synfig::info(__FILE__":%d: fifo activity",__LINE__);
String command;
{
}
bool
-IPC::process_command(const sinfg::String& command_line)
+IPC::process_command(const synfig::String& command_line)
{
if(command_line.empty())
return false;
App::quit();
break;
default:
- sinfg::warning("Received unknown command '%c' with arg '%s'",cmd,args.c_str());
+ synfig::warning("Received unknown command '%c' with arg '%s'",cmd,args.c_str());
break;
}
return true;
}
-sinfg::SmartFILE
+synfig::SmartFILE
IPC::make_connection()
{
SmartFILE ret;
);
if(pipe_handle==INVALID_HANDLE_VALUE)
{
- sinfg::warning("IPC::make_connection(): Unable to connect to previous instance. GetLastError=%d",GetLastError());
+ synfig::warning("IPC::make_connection(): Unable to connect to previous instance. GetLastError=%d",GetLastError());
}
int fd=_open_osfhandle(reinterpret_cast<long int>(pipe_handle),_O_APPEND|O_WRONLY);
#else
if(fd>=0)
ret=SmartFILE(fdopen(fd,"w"));
- sinfg::info("uplink fd=%d",fd);
+ synfig::info("uplink fd=%d",fd);
return ret;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file ipc.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_IPC_H
-#define __SINFG_IPC_H
+#ifndef __SYNFIG_IPC_H
+#define __SYNFIG_IPC_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/smartfile.h>
+#include <synfig/smartfile.h>
#include <glibmm/main.h>
-#include <sinfg/string.h>
+#include <synfig/string.h>
/* === M A C R O S ========================================================= */
private:
int fd;
- sinfg::SmartFILE file;
+ synfig::SmartFILE file;
bool fifo_activity(Glib::IOCondition cond);
IPC();
~IPC();
- static sinfg::String fifo_path();
- static sinfg::SmartFILE make_connection();
+ static synfig::String fifo_path();
+ static synfig::SmartFILE make_connection();
- static bool process_command(const sinfg::String& cmd);
+ static bool process_command(const synfig::String& cmd);
}; // END of class IPC
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframeactionmanager.cpp
** \brief Template File
**
#include "keyframeactionmanager.h"
#include "keyframetree.h"
-#include <sinfgapp/action_param.h>
+#include <synfigapp/action_param.h>
#include "instance.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
static const guint no_prev_popup((guint)-1);
}
void
-KeyframeActionManager::set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x)
+KeyframeActionManager::set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x)
{
time_changed_connection.disconnect();
canvas_interface_=x;
void
KeyframeActionManager::on_add_keyframe()
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_add"));
if(!action)
return;
// Make sure we are ready
if(!ui_manager_ || !keyframe_tree_ || !canvas_interface_)
{
- sinfg::error("KeyframeActionManager::refresh(): Not ready!");
+ synfig::error("KeyframeActionManager::refresh(): Not ready!");
return;
}
String ui_info;
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",get_canvas_interface()->get_time());
param_list.add("canvas",get_canvas_interface()->get_canvas());
param_list.add("canvas_interface",get_canvas_interface());
action_group_,
ui_info,
param_list,
- sinfgapp::Action::CATEGORY_KEYFRAME
+ synfigapp::Action::CATEGORY_KEYFRAME
);
}
if(action_group_->get_action("action-keyframe_add"))
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframeactionmanager.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_KEYFRAME_ACTION_MANAGER_H
-#define __SINFG_KEYFRAME_ACTION_MANAGER_H
+#ifndef __SYNFIG_KEYFRAME_ACTION_MANAGER_H
+#define __SYNFIG_KEYFRAME_ACTION_MANAGER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/uimanager.h>
#include <gtkmm/treeview.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
/* === M A C R O S ========================================================= */
Glib::RefPtr<Gtk::UIManager> ui_manager_;
//Glib::RefPtr<Gtk::TreeSelection> tree_selection_;
KeyframeTree* keyframe_tree_;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gtk::ActionGroup> action_group_;
Gtk::UIManager::ui_merge_id popup_id_;
void set_keyframe_tree(KeyframeTree* x);
KeyframeTree* get_keyframe_tree()const { return keyframe_tree_; }
- void set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x);
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ void set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x);
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
void refresh();
void clear();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframetree.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
KeyframeTree::~KeyframeTree()
{
- sinfg::info("KeyframeTree::~KeyframeTree(): deleted");
+ synfig::info("KeyframeTree::~KeyframeTree(): deleted");
}
void
}
void
-KeyframeTree::on_edited_time(const Glib::ustring&path_string,sinfg::Time time)
+KeyframeTree::on_edited_time(const Glib::ustring&path_string,synfig::Time time)
{
Gtk::TreePath path(path_string);
const Gtk::TreeRow row(*(get_model()->get_iter(path)));
- sinfg::Keyframe keyframe(row[model.keyframe]);
+ synfig::Keyframe keyframe(row[model.keyframe]);
if(time!=keyframe.get_time())
{
row[model.time]=time;
}
void
-KeyframeTree::on_edited_time_delta(const Glib::ustring&path_string,sinfg::Time time)
+KeyframeTree::on_edited_time_delta(const Glib::ustring&path_string,synfig::Time time)
{
Gtk::TreePath path(path_string);
const Gtk::TreeRow row = *(get_model()->get_iter(path));
- const sinfg::String description(desc);
- sinfg::Keyframe keyframe(row[model.keyframe]);
+ const synfig::String description(desc);
+ synfig::Keyframe keyframe(row[model.keyframe]);
if(description!=keyframe.get_description())
{
row[model.description]=desc;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframetree.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_KEYFRAMETREE_H
-#define __SINFG_STUDIO_KEYFRAMETREE_H
+#ifndef __SYNFIG_STUDIO_KEYFRAMETREE_H
+#define __SYNFIG_STUDIO_KEYFRAMETREE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "keyframetreestore.h"
-#include <sinfg/keyframe.h>
+#include <synfig/keyframe.h>
/* === M A C R O S ========================================================= */
Gtk::CellRendererText *cell_renderer_description;
- sigc::signal<void,sinfg::Keyframe> signal_edited_;
+ sigc::signal<void,synfig::Keyframe> signal_edited_;
- sigc::signal<void,sinfg::Keyframe,sinfg::Time> signal_edited_time_;
+ sigc::signal<void,synfig::Keyframe,synfig::Time> signal_edited_time_;
- sigc::signal<void,sinfg::Keyframe,sinfg::String> signal_edited_description_;
+ sigc::signal<void,synfig::Keyframe,synfig::String> signal_edited_description_;
sigc::signal<void, int, Gtk::TreeRow, ColumnID> signal_user_click_;
private:
- void on_edited_time(const Glib::ustring&path_string,sinfg::Time time);
+ void on_edited_time(const Glib::ustring&path_string,synfig::Time time);
- void on_edited_time_delta(const Glib::ustring&path_string,sinfg::Time time);
+ void on_edited_time_delta(const Glib::ustring&path_string,synfig::Time time);
void on_edited_description(const Glib::ustring&path_string,const Glib::ustring &description);
bool get_editable()const { return editable_; }
//! Signal called when a keyframe has been edited in any way
- sigc::signal<void,sinfg::Keyframe>& signal_edited() { return signal_edited_; }
+ sigc::signal<void,synfig::Keyframe>& signal_edited() { return signal_edited_; }
//! Signal called when a time has been edited.
- sigc::signal<void,sinfg::Keyframe,sinfg::Time>& signal_edited_time() { return signal_edited_time_; }
+ sigc::signal<void,synfig::Keyframe,synfig::Time>& signal_edited_time() { return signal_edited_time_; }
//! Signal called when a description has been edited.
- sigc::signal<void,sinfg::Keyframe,sinfg::String>& signal_edited_description() { return signal_edited_description_; }
+ sigc::signal<void,synfig::Keyframe,synfig::String>& signal_edited_description() { return signal_edited_description_; }
sigc::signal<void,int, Gtk::TreeRow, ColumnID>& signal_user_click() { return signal_user_click_; }
}; // END of KeyframeTree
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframetreestore.cpp
** \brief Template File
**
#endif
#include "keyframetreestore.h"
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
#include "iconcontroler.h"
-#include <sinfg/valuenode_timedswap.h>
+#include <synfig/valuenode_timedswap.h>
#include <gtkmm/button.h>
#include <gtkmm/treerowreference.h>
-#include <sinfg/canvas.h>
-#include <sinfg/keyframe.h>
+#include <synfig/canvas.h>
+#include <synfig/keyframe.h>
#include <time.h>
#include <cstdlib>
#include <ETL/smart_ptr>
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#include "onemoment.h"
-#include <sinfg/exception.h>
+#include <synfig/exception.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
struct _keyframe_iterator
{
- sinfg::KeyframeList::iterator iter;
+ synfig::KeyframeList::iterator iter;
int ref_count;
int index;
};
/*
-Gtk::TreeModel::iterator keyframe_iter_2_model_iter(sinfg::KeyframeList::iterator iter,int index)
+Gtk::TreeModel::iterator keyframe_iter_2_model_iter(synfig::KeyframeList::iterator iter,int index)
{
Gtk::TreeModel::iterator ret;
}
*/
-sinfg::KeyframeList::iterator model_iter_2_keyframe_iter(Gtk::TreeModel::iterator iter)
+synfig::KeyframeList::iterator model_iter_2_keyframe_iter(Gtk::TreeModel::iterator iter)
{
_keyframe_iterator* data(static_cast<_keyframe_iterator*>(iter->gobj()->user_data));
if(!data)
// ???
}
-KeyframeTreeStore::KeyframeTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+KeyframeTreeStore::KeyframeTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Glib::ObjectBase ("KeyframeTreeStore"),
Glib::Object (Glib::ConstructParams(keyframe_tree_store_class_.init(), (char*) 0)),
canvas_interface_ (canvas_interface_)
KeyframeTreeStore::~KeyframeTreeStore()
{
- sinfg::info("KeyframeTreeStore::~KeyframeTreeStore(): Deleted");
+ synfig::info("KeyframeTreeStore::~KeyframeTreeStore(): Deleted");
}
Glib::RefPtr<KeyframeTreeStore>
-KeyframeTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_)
+KeyframeTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_)
{
KeyframeTreeStore *store(new KeyframeTreeStore(canvas_interface_));
Glib::RefPtr<KeyframeTreeStore> ret(store);
{
if(column==model.time_delta.index())
{
- Glib::Value<sinfg::Time> x;
+ Glib::Value<synfig::Time> x;
g_value_init(x.gobj(),model.time.type());
g_value_copy(value.gobj(),x.gobj());
// New Method
{
Keyframe keyframe((*row)[model.keyframe]);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_set_delta"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_set_delta"));
if(!action)return;
OneMoment one_moment;
// Create the action group
- sinfgapp::Action::PassiveGrouper group(canvas_interface()->get_instance().get(),_("Adjust Time"));
- sinfgapp::PushMode push_mode(canvas_interface(), sinfgapp::MODE_NORMAL);
+ synfigapp::Action::PassiveGrouper group(canvas_interface()->get_instance().get(),_("Adjust Time"));
+ synfigapp::PushMode push_mode(canvas_interface(), synfigapp::MODE_NORMAL);
Gtk::TreeModel::iterator iter(row);
if(change_delta<0)
{
//DEBUGPOINT();
KeyframeList keyframe_list(get_canvas()->keyframe_list());
- sinfg::KeyframeList::iterator iter(keyframe_list.find((*row)[model.keyframe]));
+ synfig::KeyframeList::iterator iter(keyframe_list.find((*row)[model.keyframe]));
//DEBUGPOINT();
for(;iter!=keyframe_list.end();++iter)
{
//DEBUGPOINT();
- sinfg::Keyframe keyframe(*iter);
+ synfig::Keyframe keyframe(*iter);
keyframe.set_time(keyframe.get_time()+change_delta);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_set"));
if(!action)return;
{
//DEBUGPOINT();
KeyframeList keyframe_list(get_canvas()->keyframe_list());
- sinfg::KeyframeList::reverse_iterator end(keyframe_list.find((*row)[model.keyframe]));
- sinfg::KeyframeList::reverse_iterator iter(keyframe_list.rbegin());
+ synfig::KeyframeList::reverse_iterator end(keyframe_list.find((*row)[model.keyframe]));
+ synfig::KeyframeList::reverse_iterator iter(keyframe_list.rbegin());
//end++;
//DEBUGPOINT();
for(;iter!=end;++iter)
{
//DEBUGPOINT();
- sinfg::Keyframe keyframe(*iter);
+ synfig::Keyframe keyframe(*iter);
keyframe.set_time(keyframe.get_time()+change_delta);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_set"));
if(!action)return;
{
OneMoment one_moment;
- Glib::Value<sinfg::Time> x;
+ Glib::Value<synfig::Time> x;
g_value_init(x.gobj(),model.time.type());
g_value_copy(value.gobj(),x.gobj());
- sinfg::Keyframe keyframe(*iter->iter);
+ synfig::Keyframe keyframe(*iter->iter);
- sinfg::info("KeyframeTreeStore::set_value_impl():old_time=%s",keyframe.get_time().get_string().c_str());
+ synfig::info("KeyframeTreeStore::set_value_impl():old_time=%s",keyframe.get_time().get_string().c_str());
keyframe.set_time(x.get());
- sinfg::info("KeyframeTreeStore::set_value_impl():new_time=%s",keyframe.get_time().get_string().c_str());
+ synfig::info("KeyframeTreeStore::set_value_impl():new_time=%s",keyframe.get_time().get_string().c_str());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_set"));
if(!action)
return;
Glib::Value<Glib::ustring> x;
g_value_init(x.gobj(),model.description.type());
g_value_copy(value.gobj(),x.gobj());
- sinfg::Keyframe keyframe(*iter->iter);
+ synfig::Keyframe keyframe(*iter->iter);
keyframe.set_description(x.get());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("keyframe_set"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_set"));
if(!action)
return;
{
case 0: // Time
{
- Glib::Value<sinfg::Time> x;
+ Glib::Value<synfig::Time> x;
g_value_init(x.gobj(),x.value_type());
x.set(iter->iter->get_time());
g_value_init(value.gobj(),x.value_type());
}
case 3: // Time Delta
{
- Glib::Value<sinfg::Time> x;
+ Glib::Value<synfig::Time> x;
g_value_init(x.gobj(),x.value_type());
- sinfg::Keyframe prev_keyframe(*iter->iter);
- sinfg::Keyframe keyframe;
+ synfig::Keyframe prev_keyframe(*iter->iter);
+ synfig::Keyframe keyframe;
{
KeyframeList::iterator tmp(iter->iter);
tmp++;
}
case 2: // Keyframe
{
- Glib::Value<sinfg::Keyframe> x;
+ Glib::Value<synfig::Keyframe> x;
g_value_init(x.gobj(),x.value_type());
x.set(*iter->iter);
g_value_init(value.gobj(),x.value_type());
}
Gtk::TreeModel::Row
-KeyframeTreeStore::find_row(const sinfg::Keyframe &keyframe)
+KeyframeTreeStore::find_row(const synfig::Keyframe &keyframe)
{
Gtk::TreeModel::Row row(*(children().begin()));
dump_iterator(row,"find_row,begin");
_keyframe_iterator *iter(static_cast<_keyframe_iterator*>(gtk_iter->user_data));
- sinfg::KeyframeList &keyframe_list(canvas_interface()->get_canvas()->keyframe_list());
+ synfig::KeyframeList &keyframe_list(canvas_interface()->get_canvas()->keyframe_list());
if(keyframe_list.empty())
throw std::runtime_error(_("There are no keyframes n this canvas"));
unsigned int new_index(get_index_from_model_iter(row));
unsigned int old_index(0);
- sinfg::KeyframeList::iterator iter;
+ synfig::KeyframeList::iterator iter;
for(old_index=0,iter=old_keyframe_list.begin();iter!=old_keyframe_list.end() && (UniqueID)*iter!=(UniqueID)keyframe;++iter,old_index++);
if(iter!=old_keyframe_list.end() && new_index!=old_index)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keyframetreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_KEYFRAMETREESTORE_H
-#define __SINFG_STUDIO_KEYFRAMETREESTORE_H
+#ifndef __SYNFIG_STUDIO_KEYFRAMETREESTORE_H
+#define __SYNFIG_STUDIO_KEYFRAMETREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/liststore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include <gdkmm/pixbuf.h>
-#include <sinfg/keyframe.h>
+#include <synfig/keyframe.h>
#include <map>
/* === M A C R O S ========================================================= */
class Model : public Gtk::TreeModel::ColumnRecord
{
public:
- Gtk::TreeModelColumn<sinfg::Time> time;
+ Gtk::TreeModelColumn<synfig::Time> time;
Gtk::TreeModelColumn<Glib::ustring> description;
- Gtk::TreeModelColumn<sinfg::Keyframe> keyframe;
- Gtk::TreeModelColumn<sinfg::Time> time_delta;
+ Gtk::TreeModelColumn<synfig::Keyframe> keyframe;
+ Gtk::TreeModelColumn<synfig::Time> time_delta;
Model()
{
private:
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
//! Unique stamp for this TreeModel.
int stamp_;
static KeyframeTreeStore_Class keyframe_tree_store_class_;
- //std::map<sinfg::Keyframe,TreeRowReferenceHack> path_table_;
+ //std::map<synfig::Keyframe,TreeRowReferenceHack> path_table_;
- sinfg::KeyframeList old_keyframe_list;
+ synfig::KeyframeList old_keyframe_list;
/*
-- ** -- P R I V A T E M E T H O D S ---------------------------------------
private:
- void add_keyframe(sinfg::Keyframe);
+ void add_keyframe(synfig::Keyframe);
- void remove_keyframe(sinfg::Keyframe);
+ void remove_keyframe(synfig::Keyframe);
- void change_keyframe(sinfg::Keyframe);
+ void change_keyframe(synfig::Keyframe);
static int sorter(const Gtk::TreeModel::iterator &,const Gtk::TreeModel::iterator &);
public:
- KeyframeTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ KeyframeTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
~KeyframeTreeStore();
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
- etl::loose_handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
+ etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
- sinfg::Canvas::Handle get_canvas() { return canvas_interface()->get_canvas(); }
- sinfg::Canvas::Handle get_canvas()const { return canvas_interface()->get_canvas(); }
+ synfig::Canvas::Handle get_canvas() { return canvas_interface()->get_canvas(); }
+ synfig::Canvas::Handle get_canvas()const { return canvas_interface()->get_canvas(); }
- Gtk::TreeModel::Row find_row(const sinfg::Keyframe &keyframe);
+ Gtk::TreeModel::Row find_row(const synfig::Keyframe &keyframe);
/*
-- ** -- S T A T I C M E T H O D S ------------------------------------------
public:
- static Glib::RefPtr<KeyframeTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ static Glib::RefPtr<KeyframeTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
static int time_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keymapsettings.cpp
** \brief Contains Info for Key Map settings
**
using namespace std;
//using namespace etl;
-//using namespace sinfg;
+//using namespace synfig;
using namespace studio;
using namespace Gtk;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file keymapsettings.h
** \brief Defines the structures for managing key map settings
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_KEYMAPSETTINGS_H
-#define __SINFG_KEYMAPSETTINGS_H
+#ifndef __SYNFIG_KEYMAPSETTINGS_H
+#define __SYNFIG_KEYMAPSETTINGS_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/dialog.h>
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#include "layeractionmanager.h"
#include "layertree.h"
-#include <sinfgapp/action_param.h>
+#include <synfigapp/action_param.h>
#include "instance.h"
-#include <sinfgapp/selectionmanager.h>
+#include <synfigapp/selectionmanager.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
static const guint no_prev_popup((guint)-1);
}
void
-LayerActionManager::set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x)
+LayerActionManager::set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x)
{
canvas_interface_=x;
}
// Make sure we are ready
if(!ui_manager_ || !layer_tree_ || !canvas_interface_)
{
- sinfg::error("LayerActionManager::refresh(): Not ready!");
+ synfig::error("LayerActionManager::refresh(): Not ready!");
return;
}
{
bool canvas_set(false);
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",get_canvas_interface()->get_time());
param_list.add("canvas_interface",get_canvas_interface());
{
- sinfgapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
action_copy_->set_sensitive(!layer_list.empty());
action_cut_->set_sensitive(!layer_list.empty());
action_group_->add(action_copy_);
ui_info+="<menuitem action='select-all-child-layers'/>";
}
handle<studio::Instance>::cast_static(get_canvas_interface()->get_instance())->
- add_actions_to_group(action_group_, ui_info, param_list, sinfgapp::Action::CATEGORY_LAYER);
+ add_actions_to_group(action_group_, ui_info, param_list, synfigapp::Action::CATEGORY_LAYER);
}
}
void
LayerActionManager::copy()
{
- sinfgapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
+ synfigapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
clipboard_.clear();
- sinfg::GUID guid;
+ synfig::GUID guid;
while(!layer_list.empty())
{
void
LayerActionManager::paste()
{
- sinfg::GUID guid;
+ synfig::GUID guid;
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Paste"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Paste"));
Canvas::Handle canvas(get_canvas_interface()->get_canvas());
int depth(0);
canvas=layer->get_canvas();
}
- sinfgapp::SelectionManager::LayerList layer_selection;
+ synfigapp::SelectionManager::LayerList layer_selection;
- for(std::list<sinfg::Layer::Handle>::iterator iter=clipboard_.begin();iter!=clipboard_.end();++iter)
+ for(std::list<synfig::Layer::Handle>::iterator iter=clipboard_.begin();iter!=clipboard_.end();++iter)
{
layer=(*iter)->clone(guid);
layer_selection.push_back(layer);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_add"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_add"));
assert(action);
if(!action)
return;
action->set_param("canvas",canvas);
- action->set_param("canvas_interface",etl::loose_handle<sinfgapp::CanvasInterface>(get_canvas_interface()));
+ action->set_param("canvas_interface",etl::loose_handle<synfigapp::CanvasInterface>(get_canvas_interface()));
action->set_param("new",layer);
if(!action->is_ready())
return;
}
- sinfg::info("DEPTH=%d",depth);
+ synfig::info("DEPTH=%d",depth);
// Action to move the layer (if necessary)
if(depth>0)
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_move"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
assert(action);
if(!action)
return;
action->set_param("canvas",canvas);
- action->set_param("canvas_interface",etl::loose_handle<sinfgapp::CanvasInterface>(get_canvas_interface()));
+ action->set_param("canvas_interface",etl::loose_handle<synfigapp::CanvasInterface>(get_canvas_interface()));
action->set_param("layer",layer);
action->set_param("new_index",depth);
float adjust(0.1);
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Decrease Amount"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Decrease Amount"));
if(adjust>0)
group.set_name(_("Increase Amount"));
- sinfgapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
+ synfigapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
while(!layer_list.empty())
{
ValueBase value(layer_list.front()->get_param("amount"));
if(value.same_as(Real()))
{
- get_canvas_interface()->change_value(sinfgapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
+ get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
}
layer_list.pop_front();
}
float adjust(-0.1);
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Decrease Amount"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Decrease Amount"));
if(adjust>0)
group.set_name(_("Increase Amount"));
- sinfgapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
+ synfigapp::SelectionManager::LayerList layer_list(layer_tree_->get_selected_layers());
while(!layer_list.empty())
{
ValueBase value(layer_list.front()->get_param("amount"));
if(value.same_as(Real()))
{
- get_canvas_interface()->change_value(sinfgapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
+ get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
}
layer_list.pop_front();
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_LAYER_ACTION_MANAGER_H
-#define __SINFG_LAYER_ACTION_MANAGER_H
+#ifndef __SYNFIG_LAYER_ACTION_MANAGER_H
+#define __SYNFIG_LAYER_ACTION_MANAGER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/uimanager.h>
#include <gtkmm/treeview.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
/* === M A C R O S ========================================================= */
Glib::RefPtr<Gtk::UIManager> ui_manager_;
//Glib::RefPtr<Gtk::TreeSelection> tree_selection_;
LayerTree* layer_tree_;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gtk::ActionGroup> action_group_;
Gtk::UIManager::ui_merge_id popup_id_;
Glib::RefPtr<Gtk::Action> action_amount_;
- std::list<sinfg::Layer::Handle> clipboard_;
+ std::list<synfig::Layer::Handle> clipboard_;
sigc::connection selection_changed_connection;
void set_layer_tree(LayerTree* x);
LayerTree* get_layer_tree()const { return layer_tree_; }
- void set_canvas_interface(const etl::handle<sinfgapp::CanvasInterface> &x);
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ void set_canvas_interface(const etl::handle<synfigapp::CanvasInterface> &x);
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
- etl::loose_handle<sinfgapp::Instance> get_instance()const { return canvas_interface_->get_instance(); }
+ etl::loose_handle<synfigapp::Instance> get_instance()const { return canvas_interface_->get_instance(); }
void refresh();
void clear();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layergrouptree.cpp
** \brief Template File
**
# include <config.h>
#endif
-#include <sinfg/layer.h>
+#include <synfig/layer.h>
#include "layergrouptree.h"
#include <gtkmm/treemodelsort.h>
#include <ETL/misc>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
LayerGroupTree::~LayerGroupTree()
{
- sinfg::info("LayerGroupTree::~LayerGroupTree(): deleted");
+ synfig::info("LayerGroupTree::~LayerGroupTree(): deleted");
}
void
}
/*
void
-LayerGroupTree::on_edited_time(const Glib::ustring&path_string,sinfg::Time time)
+LayerGroupTree::on_edited_time(const Glib::ustring&path_string,synfig::Time time)
{
Gtk::TreePath path(path_string);
const Gtk::TreeRow row(*(get_model()->get_iter(path)));
- sinfg::Keyframe keyframe(row[model.keyframe]);
+ synfig::Keyframe keyframe(row[model.keyframe]);
if(time!=keyframe.get_time())
{
row[model.time]=time;
}
void
-LayerGroupTree::on_edited_time_delta(const Glib::ustring&path_string,sinfg::Time time)
+LayerGroupTree::on_edited_time_delta(const Glib::ustring&path_string,synfig::Time time)
{
Gtk::TreePath path(path_string);
const Gtk::TreeRow row = *(get_model()->get_iter(path));
- const sinfg::String description(desc);
- sinfg::Keyframe keyframe(row[model.keyframe]);
+ const synfig::String description(desc);
+ synfig::Keyframe keyframe(row[model.keyframe]);
if(description!=keyframe.get_description())
{
row[model.description]=desc;
//return false;
}
-static inline void __group_grabber(const Gtk::TreeModel::iterator& iter, std::list<sinfg::String>* ret)
+static inline void __group_grabber(const Gtk::TreeModel::iterator& iter, std::list<synfig::String>* ret)
{
const LayerGroupTreeStore::Model model;
if((bool)(*iter)[model.is_group])
ret->push_back((Glib::ustring)(*iter)[model.group_name]);
}
-std::list<sinfg::String>
+std::list<synfig::String>
LayerGroupTree::get_selected_groups()const
{
Glib::RefPtr<Gtk::TreeSelection> selection=const_cast<LayerGroupTree&>(*this).get_selection();
if(!selection)
- return std::list<sinfg::String>();
+ return std::list<synfig::String>();
- std::list<sinfg::String> ret;
+ std::list<synfig::String> ret;
selection->selected_foreach_iter(
sigc::bind(
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layergrouptree.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_LAYERGROUPTREE_H
-#define __SINFG_STUDIO_LAYERGROUPTREE_H
+#ifndef __SYNFIG_STUDIO_LAYERGROUPTREE_H
+#define __SYNFIG_STUDIO_LAYERGROUPTREE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "layergrouptreestore.h"
/* === M A C R O S ========================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfg { class Layer; }
+namespace synfig { class Layer; }
namespace studio {
public:
- typedef std::list<sinfg::Layer::Handle> LayerList;
+ typedef std::list<synfig::Layer::Handle> LayerList;
/*
-- ** -- P U B L I C D A T A ------------------------------------------------
bool editable_;
- sigc::signal<void,etl::handle<sinfg::Layer> > signal_popup_layer_menu_;
+ sigc::signal<void,etl::handle<synfig::Layer> > signal_popup_layer_menu_;
// sigc::signal<void,LayerList> signal_select_layers_;
Gtk::TreeView::Column* label_column;
Glib::RefPtr<LayerGroupTreeStore> get_model() { return layer_group_tree_store_; }
- sigc::signal<void,etl::handle<sinfg::Layer> >& signal_popup_layer_menu() { return signal_popup_layer_menu_; }
+ sigc::signal<void,etl::handle<synfig::Layer> >& signal_popup_layer_menu() { return signal_popup_layer_menu_; }
// sigc::signal<void,LayerList>& signal_select_layers() { return signal_select_layers_; }
bool get_editable()const { return editable_; }
- std::list<sinfg::String> get_selected_groups()const;
+ std::list<synfig::String> get_selected_groups()const;
LayerList get_selected_layers()const;
}; // END of LayerGroupTree
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertreestore.cpp
** \brief Template File
**
#include "layergrouptreestore.h"
#include "iconcontroler.h"
#include <gtkmm/button.h>
-#include <sinfg/paramdesc.h>
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfig/paramdesc.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#include "app.h"
#include "instance.h"
-#include <sinfgapp/action_system.h>
+#include <synfigapp/action_system.h>
#include "dockmanager.h"
#include "dockable.h"
#include "iconcontroler.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return *model;
}
-LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+LayerGroupTreeStore::LayerGroupTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Gtk::TreeStore (ModelHack()),
canvas_interface_ (canvas_interface_)
{
- layer_icon=Gtk::Button().render_icon(Gtk::StockID("sinfg-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
- group_icon=Gtk::Button().render_icon(Gtk::StockID("sinfg-group"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ layer_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ group_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-group"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
// Connect Signals to Terminals
canvas_interface()->signal_layer_status_changed().connect(sigc::mem_fun(*this,&studio::LayerGroupTreeStore::on_layer_status_changed));
LayerGroupTreeStore::~LayerGroupTreeStore()
{
//clear();
- sinfg::info("LayerGroupTreeStore::~LayerGroupTreeStore(): Deleted");
+ synfig::info("LayerGroupTreeStore::~LayerGroupTreeStore(): Deleted");
}
bool
Glib::RefPtr<LayerGroupTreeStore>
-LayerGroupTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_)
+LayerGroupTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_)
{
return Glib::RefPtr<LayerGroupTreeStore>(new LayerGroupTreeStore(canvas_interface_));
}
}
else if((bool)(*iter)[model.is_layer])
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.tooltip.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.canvas.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
if((bool)(*iter)[model.is_layer])
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
x.set(layer->active());
}
else if((bool)(*iter)[model.is_group])
if((bool)(*iter)[model.is_layer])
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
//x.set(layer_icon);
x.set(get_tree_pixbuf_layer(layer->get_name()));
if((bool)(*iter)[model.is_layer])
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)
return;
- sinfg::String new_desc(x.get());
+ synfig::String new_desc(x.get());
if(new_desc==layer->get_local_name())
- new_desc=sinfg::String();
+ new_desc=synfig::String();
if(new_desc==layer->get_description())
return;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_set_desc"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_set_desc"));
if(!action)
return;
action->set_param("canvas",canvas_interface()->get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("layer",layer);
- action->set_param("new_description",sinfg::String(x.get()));
+ action->set_param("new_description",synfig::String(x.get()));
canvas_interface()->get_instance()->perform_action(action);
return;
}
else if((bool)(*iter)[model.is_group])
{
- sinfg::String group((Glib::ustring)(*iter)[model.label]);
- sinfg::String new_group(x.get());
+ synfig::String group((Glib::ustring)(*iter)[model.label]);
+ synfig::String new_group(x.get());
if(x.get()==group)
return;
}
new_group+=x.get();
- sinfg::info("Renaming group \"%s\" to \"%s\"...",group.c_str(),new_group.c_str());
+ synfig::info("Renaming group \"%s\" to \"%s\"...",group.c_str(),new_group.c_str());
// Check to see if this group is real or not.
// If it isn't real, then renaming it is a cinch.
}
else
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("group_rename"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("group_rename"));
if(!action)
return;
if((bool)(*iter)[model.is_layer])
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_activate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
if(!action)
return;
}
else if(!iter->children().empty())
{
- sinfgapp::Action::PassiveGrouper group(
+ synfigapp::Action::PassiveGrouper group(
get_canvas_interface()->get_instance().get(),
String(
x.get()?_("Activate "):_("Deactivate ")
LayerGroupTreeStore::drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const
{
if(!const_cast<LayerGroupTreeStore*>(this)->get_iter(path)) return false;
- //sinfg::info("Dragged data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ //synfig::info("Dragged data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
Gtk::TreeModel::Row row(*const_cast<LayerGroupTreeStore*>(this)->get_iter(path));
}
else if((bool)row[model.is_group])
{
- sinfg::String group((Glib::ustring)row[model.group_name]);
+ synfig::String group((Glib::ustring)row[model.group_name]);
if(group.empty())
return false;
Gtk::TreeIter iter(const_cast<LayerGroupTreeStore*>(this)->get_iter(dest));
if(!iter) return false;
- if(sinfg::String(selection_data.get_data_type())=="LAYER")
+ if(synfig::String(selection_data.get_data_type())=="LAYER")
return true;
- if(sinfg::String(selection_data.get_data_type())=="GROUP")
+ if(synfig::String(selection_data.get_data_type())=="GROUP")
{
- sinfg::String dest_group((Glib::ustring)(*iter)[model.group_name]);
- sinfg::String src_group(reinterpret_cast<const gchar*>(selection_data.get_data()));
- //sinfg::String src_group(const_cast<gchar*>(selection_data.get_data()));
+ synfig::String dest_group((Glib::ustring)(*iter)[model.group_name]);
+ synfig::String src_group(reinterpret_cast<const gchar*>(selection_data.get_data()));
+ //synfig::String src_group(const_cast<gchar*>(selection_data.get_data()));
// Avoid putting a group inside of itself
if(dest_group.size()>src_group.size() && src_group==String(dest_group,0,src_group.size()))
}
return false;
- //sinfg::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ //synfig::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection));
//Gtk::TreeModel::Row row(*get_iter(dest));
-/* if(sinfg::String(selection_data.get_data_type())=="LAYER" && (bool)true)
+/* if(synfig::String(selection_data.get_data_type())=="LAYER" && (bool)true)
return true;
*/
return false;
Gtk::TreeModel::Row row(*get_iter(dest));
- //sinfg::info("Dropped data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
- sinfgapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Regroup"));
+ //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ synfigapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Regroup"));
if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
{
- sinfg::String dest_group;
+ synfig::String dest_group;
dest_group=(Glib::ustring)row[model.group_name];
if(dest_group.empty())
return false;
- if(sinfg::String(selection_data.get_data_type())=="LAYER")
+ if(synfig::String(selection_data.get_data_type())=="LAYER")
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("group_add_layers"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("group_add_layers"));
if(!action)
return false;
}
return true;
}
- if(sinfg::String(selection_data.get_data_type())=="GROUP")
+ if(synfig::String(selection_data.get_data_type())=="GROUP")
{
- sinfg::String src_group(reinterpret_cast<const gchar*>(selection_data.get_data()));
- sinfg::String group(src_group);
+ synfig::String src_group(reinterpret_cast<const gchar*>(selection_data.get_data()));
+ synfig::String group(src_group);
// Get rid of any parent group crap
while(group.find(GROUP_NEST_CHAR)!=Glib::ustring::npos)
group=dest_group+GROUP_NEST_CHAR+group;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("group_rename"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("group_rename"));
if(!action)
return false;
}
}
/* // Save the selection data
- sinfgapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
+ synfigapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
{
int dest_layer_depth=dest_layer->get_depth();
- if(sinfg::String(selection_data.get_data_type())=="LAYER")for(i=0;i<selection_data.get_length()/sizeof(void*);i++)
+ if(synfig::String(selection_data.get_data_type())=="LAYER")for(i=0;i<selection_data.get_length()/sizeof(void*);i++)
{
- //sinfg::info("dest_layer_depth=%d",dest_layer_depth);
+ //synfig::info("dest_layer_depth=%d",dest_layer_depth);
Layer::Handle src(reinterpret_cast<Layer**>(const_cast<guint8*>(selection_data.get_data()))[i]);
assert(src);
if(dest_canvas==src->get_canvas() && dest_layer_depth==src->get_depth())
continue;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_move"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",canvas_interface());
action->set_param("layer",src);
}
}
}
- sinfg::info("I suposidly moved %d layers",i);
+ synfig::info("I suposidly moved %d layers",i);
// Reselect the previously selected layers
canvas_interface()->get_selection_manager()->set_selected_layers(selected_layer_list);
throw;
}
rebuilding=false;
- sinfg::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer()));
+ synfig::info("LayerGroupTreeStore::rebuild() took %f seconds",float(timer()));
}
void
void
-LayerGroupTreeStore::set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handle)
+LayerGroupTreeStore::set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle)
{
row[model.is_layer] = true;
row[model.is_group] = false;
}
Gtk::TreeRow
-LayerGroupTreeStore::on_group_added(sinfg::String group)
+LayerGroupTreeStore::on_group_added(synfig::String group)
{
// Check to see if this group perhaps already
// exists
}
bool
-LayerGroupTreeStore::on_group_removed(sinfg::String group)
+LayerGroupTreeStore::on_group_removed(synfig::String group)
{
//DEBUGPOINT();
}
bool
-LayerGroupTreeStore::on_group_changed(sinfg::String group)
+LayerGroupTreeStore::on_group_changed(synfig::String group)
{
//DEBUGPOINT();
return true;
}
void
-LayerGroupTreeStore::on_layer_status_changed(sinfg::Layer::Handle handle,bool x)
+LayerGroupTreeStore::on_layer_status_changed(synfig::Layer::Handle handle,bool x)
{
Gtk::TreeModel::Children::iterator iter;
if(find_layer_row(handle,iter))
(*iter)[model.layer]=handle;
else
{
- sinfg::warning("Couldn't find layer to be activated in layer list. Rebuilding index...");
+ synfig::warning("Couldn't find layer to be activated in layer list. Rebuilding index...");
rebuild();
}
}
void
-LayerGroupTreeStore::on_layer_new_description(sinfg::Layer::Handle handle,sinfg::String desc)
+LayerGroupTreeStore::on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc)
{
Gtk::TreeModel::Children::iterator iter;
if(find_layer_row(handle,iter))
}
bool
-LayerGroupTreeStore::find_layer_row_(const sinfg::Layer::Handle &layer, sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
+LayerGroupTreeStore::find_layer_row_(const synfig::Layer::Handle &layer, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
{
assert(layer);
for(iter=prev=layers.begin(); iter && iter != layers.end(); prev=iter++)
{
Gtk::TreeModel::Row row = *iter;
- if((bool)row[model.is_layer] && layer==(sinfg::Layer::Handle)row[model.layer])
+ if((bool)row[model.is_layer] && layer==(synfig::Layer::Handle)row[model.layer])
return true;
}
}
bool
-LayerGroupTreeStore::find_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter)
+LayerGroupTreeStore::find_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter)
{
Gtk::TreeModel::Children::iterator prev;
return find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev);
}
bool
-LayerGroupTreeStore::find_group_row_(const sinfg::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
+LayerGroupTreeStore::find_group_row_(const synfig::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
{
//if(layer->get_canvas()==canvas)
{
}
bool
-LayerGroupTreeStore::find_prev_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev)
+LayerGroupTreeStore::find_prev_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev)
{
Gtk::TreeModel::Children::iterator iter;
if(!find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev))
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_LAYERGROUPTREESTORE_H
-#define __SINFG_STUDIO_LAYERGROUPTREESTORE_H
+#ifndef __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
+#define __SYNFIG_STUDIO_LAYERGROUPTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/value.h>
-#include <sinfg/valuenode.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfig/value.h>
+#include <synfig/valuenode.h>
#include <gtkmm/treeview.h>
/* === M A C R O S ========================================================= */
*/
public:
- typedef std::list<sinfg::Layer::Handle> LayerList;
+ typedef std::list<synfig::Layer::Handle> LayerList;
class Model : public Gtk::TreeModel::ColumnRecord
{
Gtk::TreeModelColumn<Glib::ustring> group_name;
Gtk::TreeModelColumn<Glib::ustring> parent_group_name;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
Gtk::TreeModelColumn<bool> active;
Gtk::TreeModelColumn<bool> is_layer;
Gtk::TreeModelColumn<bool> is_group;
- Gtk::TreeModelColumn<sinfg::Layer::Handle> layer;
+ Gtk::TreeModelColumn<synfig::Layer::Handle> layer;
Gtk::TreeModelColumn<LayerList> all_layers;
Gtk::TreeModelColumn<LayerList> child_layers;
private:
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gdk::Pixbuf> layer_icon;
Glib::RefPtr<Gdk::Pixbuf> group_icon;
virtual bool row_drop_possible_vfunc (const TreeModel::Path& dest, const Gtk::SelectionData& selection_data)const;
- void on_group_pair_added(sinfg::String group, etl::handle<sinfg::Layer> layer);
- void on_group_pair_removed(sinfg::String group, etl::handle<sinfg::Layer> layer);
+ void on_group_pair_added(synfig::String group, etl::handle<synfig::Layer> layer);
+ void on_group_pair_removed(synfig::String group, etl::handle<synfig::Layer> layer);
void on_activity();
bool on_layer_tree_event(GdkEvent *event);
- void on_layer_new_description(sinfg::Layer::Handle handle,sinfg::String desc);
+ void on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc);
- void on_layer_status_changed(sinfg::Layer::Handle handle,bool);
+ void on_layer_status_changed(synfig::Layer::Handle handle,bool);
- bool find_layer_row_(const sinfg::Layer::Handle &handle, sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
+ bool find_layer_row_(const synfig::Layer::Handle &handle, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
- bool find_group_row_(const sinfg::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
+ bool find_group_row_(const synfig::String &group, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
- bool on_group_removed(sinfg::String group);
- bool on_group_changed(sinfg::String group);
+ bool on_group_removed(synfig::String group);
+ bool on_group_changed(synfig::String group);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
public:
- LayerGroupTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ LayerGroupTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
~LayerGroupTreeStore();
- Gtk::TreeRow on_group_added(sinfg::String group);
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
- etl::loose_handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ Gtk::TreeRow on_group_added(synfig::String group);
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
+ etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
- bool find_layer_row(const sinfg::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
+ bool find_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
- bool find_group_row(const sinfg::String &group, Gtk::TreeModel::Children::iterator &iter);
+ bool find_group_row(const synfig::String &group, Gtk::TreeModel::Children::iterator &iter);
- bool find_prev_layer_row(const sinfg::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
+ bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
void rebuild();
void refresh_row(Gtk::TreeModel::Row &row);
- void set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handle);
+ void set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle);
static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
public:
- static Glib::RefPtr<LayerGroupTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ static Glib::RefPtr<LayerGroupTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
}; // END of class LayerGroupTreeStore
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file childrentreestore.cpp
** \brief Template File
**
#include "layerparamtreestore.h"
#include "iconcontroler.h"
#include <gtkmm/button.h>
-#include <sinfg/paramdesc.h>
+#include <synfig/paramdesc.h>
#include "layertree.h"
-#include <sinfgapp/action_system.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/action_system.h>
+#include <synfigapp/instance.h>
#include "app.h"
#include <ETL/clock>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
const std::string name;
public:
Profiler(const std::string& name):name(name) { reset(); }
- ~Profiler() { float time(operator()()); sinfg::info("%s: took %f msec",name.c_str(),time*1000); }
+ ~Profiler() { float time(operator()()); synfig::info("%s: took %f msec",name.c_str(),time*1000); }
};
/* === G L O B A L S ======================================================= */
return *model;
}
-LayerParamTreeStore::LayerParamTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_,LayerTree* layer_tree):
+LayerParamTreeStore::LayerParamTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_,LayerTree* layer_tree):
Gtk::TreeStore (ModelHack()),
CanvasTreeStore (canvas_interface_),
layer_tree (layer_tree)
changed_connection_list.back().disconnect();
changed_connection_list.pop_back();
}
- sinfg::info("LayerParamTreeStore::~LayerParamTreeStore(): Deleted");
+ synfig::info("LayerParamTreeStore::~LayerParamTreeStore(): Deleted");
}
Glib::RefPtr<LayerParamTreeStore>
-LayerParamTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree)
+LayerParamTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree)
{
return Glib::RefPtr<LayerParamTreeStore>(new LayerParamTreeStore(canvas_interface_,layer_tree));
}
{
if(column<0)
{
- sinfg::error("LayerParamTreeStore::get_value_vfunc(): Bad column!");
+ synfig::error("LayerParamTreeStore::get_value_vfunc(): Bad column!");
return;
}
/* if(column==model.label.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
*/
if(column==model.label.index())
{
- sinfgapp::ValueDesc value_desc((*iter)[model.value_desc]);
+ synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
Glib::ustring label;
if(!(*iter)[model.is_toplevel])
return CanvasTreeStore::get_value_vfunc(iter,column,value);
- sinfg::ParamDesc param_desc((*iter)[model.param_desc]);
+ synfig::ParamDesc param_desc((*iter)[model.param_desc]);
label=param_desc.get_local_name();
if(!(*iter)[model.is_inconsistent])
{
if(column==model.value.index())
{
- Glib::Value<sinfg::ValueBase> x;
+ Glib::Value<synfig::ValueBase> x;
g_value_init(x.gobj(),model.value.type());
g_value_copy(value.gobj(),x.gobj());
if((bool)(*iter)[model.is_toplevel])
{
- sinfgapp::Action::PassiveGrouper group(canvas_interface()->get_instance().get(),_("Set Layer Params"));
+ synfigapp::Action::PassiveGrouper group(canvas_interface()->get_instance().get(),_("Set Layer Params"));
- sinfg::ParamDesc param_desc((*iter)[model.param_desc]);
+ synfig::ParamDesc param_desc((*iter)[model.param_desc]);
LayerList::iterator iter2(layer_list.begin());
for(;iter2!=layer_list.end();++iter2)
{
- if(!canvas_interface()->change_value(sinfgapp::ValueDesc(*iter2,param_desc.get_name()),x.get()))
+ if(!canvas_interface()->change_value(synfigapp::ValueDesc(*iter2,param_desc.get_name()),x.get()))
{
// ERROR!
group.cancel();
/*
if(column==model.active.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
g_value_init(x.gobj(),model.active.type());
g_value_copy(value.gobj(),x.gobj());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_activate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
if(!action)
return;
{
ParamVocab vocab;
- static ParamVocab::iterator find_param_desc(ParamVocab& vocab, const sinfg::String& x)
+ static ParamVocab::iterator find_param_desc(ParamVocab& vocab, const synfig::String& x)
{
ParamVocab::iterator iter;
}
*/
Gtk::TreeRow row(*(append()));
- sinfgapp::ValueDesc value_desc(layer_list.front(),iter->get_name());
+ synfigapp::ValueDesc value_desc(layer_list.front(),iter->get_name());
CanvasTreeStore::set_row(row,value_desc);
if(value_desc.is_value_node())
{
}
void
-LayerParamTreeStore::set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc)
+LayerParamTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc)
{
Gtk::TreeModel::Children children = row.children();
while(!children.empty() && erase(children.begin()));
}
void
-LayerParamTreeStore::on_value_node_child_added(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child)
+LayerParamTreeStore::on_value_node_child_added(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child)
{
queue_rebuild();
}
void
-LayerParamTreeStore::on_value_node_child_removed(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child)
+LayerParamTreeStore::on_value_node_child_removed(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child)
{
queue_rebuild();
}
}
void
-LayerParamTreeStore::on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node)
+LayerParamTreeStore::on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node)
{
queue_rebuild();
}
void
-LayerParamTreeStore::on_layer_param_changed(sinfg::Layer::Handle handle,sinfg::String param_name)
+LayerParamTreeStore::on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name)
{
queue_refresh();
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layerparamtreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_LAYERPARAMTREESTORE_H
-#define __SINFG_STUDIO_LAYERPARAMTREESTORE_H
+#ifndef __SYNFIG_STUDIO_LAYERPARAMTREESTORE_H
+#define __SYNFIG_STUDIO_LAYERPARAMTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include "canvastreestore.h"
-#include <sinfg/value.h>
-#include <sinfg/valuenode.h>
-#include <sinfg/paramdesc.h>
+#include <synfig/value.h>
+#include <synfig/valuenode.h>
+#include <synfig/paramdesc.h>
/* === M A C R O S ========================================================= */
*/
public:
- typedef std::list<sinfg::Layer::Handle> LayerList;
+ typedef std::list<synfig::Layer::Handle> LayerList;
/*
-- ** -- P U B L I C D A T A ------------------------------------------------
{
public:
- Gtk::TreeModelColumn<sinfg::ParamDesc> param_desc;
+ Gtk::TreeModelColumn<synfig::ParamDesc> param_desc;
Gtk::TreeModelColumn<bool> is_inconsistent;
Gtk::TreeModelColumn<bool> is_toplevel;
protected:
virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
- virtual void set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc);
+ virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc);
/*
-- ** -- S I G N A L T E R M I N A L S -------------------------------------
private:
- void on_value_node_child_added(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child);
- void on_value_node_child_removed(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child);
+ void on_value_node_child_added(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
+ void on_value_node_child_removed(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
- void on_value_node_added(sinfg::ValueNode::Handle value_node);
- void on_value_node_deleted(sinfg::ValueNode::Handle value_node);
- virtual void on_value_node_changed(sinfg::ValueNode::Handle value_node);
- void on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node);
- void on_layer_param_changed(sinfg::Layer::Handle handle,sinfg::String param_name);
+ void on_value_node_added(synfig::ValueNode::Handle value_node);
+ void on_value_node_deleted(synfig::ValueNode::Handle value_node);
+ virtual void on_value_node_changed(synfig::ValueNode::Handle value_node);
+ void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
+ void on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
public:
- LayerParamTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_,
+ LayerParamTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_,
LayerTree* layer_tree);
~LayerParamTreeStore();
public:
- static Glib::RefPtr<LayerParamTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree);
+ static Glib::RefPtr<LayerParamTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree);
}; // END of class LayerParamTreeStore
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertree.cpp
** \brief Template File
**
#include "layerparamtreestore.h"
#include "cellrenderer_value.h"
#include "cellrenderer_timetrack.h"
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/paned.h>
#include "app.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Gtk::Image *icon;
- //Gtk::IconSize iconsize(Gtk::IconSize::from_name("sinfg-small_icon"));
+ //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
Gtk::IconSize iconsize(Gtk::ICON_SIZE_SMALL_TOOLBAR);
SMALL_BUTTON(button_raise,"gtk-go-up","Raise");
SMALL_BUTTON(button_lower,"gtk-go-down","Lower");
- SMALL_BUTTON(button_duplicate,"sinfg-duplicate","Duplicate");
+ SMALL_BUTTON(button_duplicate,"synfig-duplicate","Duplicate");
SMALL_BUTTON(button_delete,"gtk-delete","Delete");
hbox->pack_start(*button_raise,Gtk::PACK_SHRINK);
LayerTree::~LayerTree()
{
- sinfg::info("LayerTree::~LayerTree(): Deleted");
+ synfig::info("LayerTree::~LayerTree(): Deleted");
}
Gtk::Widget*
// Set up the value-node icon cell-renderer to be on the far right
Gtk::CellRendererPixbuf* valuenode_icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() );
column->pack_end(*valuenode_icon_cellrenderer,false);
- valuenode_icon_cellrenderer->property_pixbuf()=Gtk::Button().render_icon(Gtk::StockID("sinfg-value_node"),icon_size);
+ valuenode_icon_cellrenderer->property_pixbuf()=Gtk::Button().render_icon(Gtk::StockID("synfig-value_node"),icon_size);
column->add_attribute(valuenode_icon_cellrenderer->property_visible(), param_model.is_shared);
// Finish setting up the column
// Set up the value cell-renderer
cellrenderer_value=LayerParamTreeStore::add_cell_renderer_value(column);
cellrenderer_value->signal_edited().connect(sigc::mem_fun(*this, &studio::LayerTree::on_edited_value));
- cellrenderer_value->property_value()=sinfg::ValueBase();
+ cellrenderer_value->property_value()=synfig::ValueBase();
column->add_attribute(cellrenderer_value->property_param_desc(), param_model.param_desc);
column->add_attribute(cellrenderer_value->property_inconsistant(),param_model.is_inconsistent);
//cellrenderer_value->property_canvas()=canvas_interface->get_canvas(); // Is this line necessary?
}
void
-LayerTree::on_waypoint_changed( sinfg::Waypoint waypoint , sinfg::ValueNode::Handle value_node)
+LayerTree::on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node)
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
param_list.add("value_node",value_node);
}
void
-LayerTree::select_all_children_layers(sinfg::Layer::Handle layer)
+LayerTree::select_all_children_layers(synfig::Layer::Handle layer)
{
Gtk::TreeModel::Children::iterator iter;
if(layer_tree_store_->find_layer_row(layer,iter))
return ret;
}
-sinfg::Layer::Handle
+synfig::Layer::Handle
LayerTree::get_selected_layer()const
{
LayerList layers(get_selected_layers());
void
LayerTree::on_selection_changed()
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
Gtk::TreeIter iter;
if(last_top_selected_layer && !layer_tree_store_->find_layer_row(last_top_selected_layer,iter))
if(quick_layer->get_param("blend_method").is_valid())
{
disable_amount_changed_signal=true;
- signal_edited_value()(sinfgapp::ValueDesc(quick_layer,"blend_method"),blend_method_widget.get_value());
+ signal_edited_value()(synfigapp::ValueDesc(quick_layer,"blend_method"),blend_method_widget.get_value());
disable_amount_changed_signal=false;
}
}
return;
disable_amount_changed_signal=true;
- signal_edited_value()(sinfgapp::ValueDesc(quick_layer,"amount"),sinfg::ValueBase(layer_amount_adjustment_.get_value()));
+ signal_edited_value()(synfigapp::ValueDesc(quick_layer,"amount"),synfig::ValueBase(layer_amount_adjustment_.get_value()));
disable_amount_changed_signal=false;
}
void
-LayerTree::on_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value)
+LayerTree::on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value)
{
Gtk::TreePath path(path_string);
*/
void
-LayerTree::on_waypoint_clicked(const Glib::ustring &path_string, sinfg::Waypoint waypoint,int button)
+LayerTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
{
Gtk::TreePath path(path_string);
if(!row)
return;
- signal_waypoint_clicked()(static_cast<sinfgapp::ValueDesc>(row[param_model.value_desc]),waypoint,button);
+ signal_waypoint_clicked()(static_cast<synfigapp::ValueDesc>(row[param_model.value_desc]),waypoint,button);
}
bool
LayerList layer_list(get_selected_layers());
if(layer_list.size()<=1)
{
- sinfgapp::ValueDesc value_desc(row[param_model.value_desc]);
+ synfigapp::ValueDesc value_desc(row[param_model.value_desc]);
Gtk::Menu* menu(manage(new Gtk::Menu()));
App::get_instance(param_tree_store_->canvas_interface()->get_canvas())->make_param_menu(menu,param_tree_store_->canvas_interface()->get_canvas(),value_desc,0.5f);
menu->popup(event->button.button,gtk_get_current_event_time());
return true;
}
Gtk::Menu* menu(manage(new Gtk::Menu()));
- std::list<sinfgapp::ValueDesc> value_desc_list;
+ std::list<synfigapp::ValueDesc> value_desc_list;
ParamDesc param_desc(row[param_model.param_desc]);
for(;!layer_list.empty();layer_list.pop_back())
- value_desc_list.push_back(sinfgapp::ValueDesc(layer_list.back(),param_desc.get_name()));
+ value_desc_list.push_back(synfigapp::ValueDesc(layer_list.back(),param_desc.get_name()));
App::get_instance(param_tree_store_->canvas_interface()->get_canvas())->make_param_menu(menu,param_tree_store_->canvas_interface()->get_canvas(),value_desc_list);
menu->popup(event->button.button,gtk_get_current_event_time());
return true;
void
LayerTree::on_raise_pressed()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_raise"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_raise"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
}
void
LayerTree::on_lower_pressed()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_lower"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_lower"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
}
void
LayerTree::on_duplicate_pressed()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_duplicate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_duplicate"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
}
void
LayerTree::on_delete_pressed()
{
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list.add("time",layer_tree_store_->canvas_interface()->get_time());
param_list.add("canvas",layer_tree_store_->canvas_interface()->get_canvas());
param_list.add("canvas_interface",layer_tree_store_->canvas_interface());
{
- sinfgapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
- sinfgapp::SelectionManager::LayerList::iterator iter;
+ synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList::iterator iter;
for(iter=layer_list.begin();iter!=layer_list.end();++iter)
param_list.add("layer",Layer::Handle(*iter));
}
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_remove"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_remove"));
action->set_param_list(param_list);
layer_tree_store_->canvas_interface()->get_instance()->perform_action(action);
}
void
LayerTree::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&context, Gtk::SelectionData& selection_data, guint info, guint time)
{
- sinfg::info("Dragged data of type \"%s\"",selection_data.get_data_type());
- sinfg::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
- sinfg::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ synfig::info("Dragged data of type \"%s\"",selection_data.get_data_type());
+ synfig::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
+ synfig::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
DEBUGPOINT();
Gtk::TreeRow row = *(get_selection()->get_selected());
DEBUGPOINT();
- if(sinfg::String(gdk_atom_name(selection_data->target))=="LAYER" && (bool)row[model.is_layer])
+ if(synfig::String(gdk_atom_name(selection_data->target))=="LAYER" && (bool)row[model.is_layer])
{
DEBUGPOINT();
Layer* layer(((Layer::Handle)row[model.layer]).get());
void
LayerTree::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, Gtk::SelectionData& selection_data, guint info, guint time)
{
- sinfg::info("Dropped data of type \"%s\"",selection_data.get_data_type());
- sinfg::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
- sinfg::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
- sinfg::info("Dropped x=%d, y=%d",x,y);
+ synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type());
+ synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
+ synfig::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ synfig::info("Dropped x=%d, y=%d",x,y);
bool success=false;
bool dropped_on_specific_row=false;
if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
{
- if(sinfg::String(selection_data.get_data_type())=="LAYER")do
+ if(synfig::String(selection_data.get_data_type())=="LAYER")do
{
Layer::Handle src(*reinterpret_cast<Layer**>(selection_data.get_data()));
assert(src);
if(!dest_layer || dest_layer==src)
break;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_move"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",layer_tree_store_->canvas_interface());
action->set_param("layer",src);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertree.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_LAYERTREE_H
-#define __SINFG_STUDIO_LAYERTREE_H
+#ifndef __SYNFIG_STUDIO_LAYERTREE_H
+#define __SYNFIG_STUDIO_LAYERTREE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/scale.h>
#include <gtkmm/button.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "layertreestore.h"
#include "layerparamtreestore.h"
-#include <sinfg/valuenode_animated.h>
+#include <synfig/valuenode_animated.h>
#include "widget_value.h"
COLUMNID_END //!< \internal
};
*/
- typedef std::list<sinfg::Layer::Handle> LayerList;
+ typedef std::list<synfig::Layer::Handle> LayerList;
/*
-- ** -- P U B L I C D A T A ------------------------------------------------
LayerTreeStore::Model layer_model;
LayerParamTreeStore::Model param_model;
- sinfg::Layer::Handle last_top_selected_layer;
+ synfig::Layer::Handle last_top_selected_layer;
Gtk::TreePath last_top_selected_path;
/*
Gtk::HScale *layer_amount_hscale;
- sinfg::Layer::Handle quick_layer;
+ synfig::Layer::Handle quick_layer;
Glib::RefPtr<LayerTreeStore> layer_tree_store_;
CellRenderer_ValueBase *cellrenderer_value;
- sigc::signal<void,sinfg::Layer::Handle> signal_layer_toggle_;
+ sigc::signal<void,synfig::Layer::Handle> signal_layer_toggle_;
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase> signal_edited_value_;
+ sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase> signal_edited_value_;
sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_layer_user_click_;
sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_param_user_click_;
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint,int> signal_waypoint_clicked_;
+ sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked_;
bool disable_amount_changed_signal;
private:
- void on_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value);
+ void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
void on_layer_toggle(const Glib::ustring& path_string);
- void on_waypoint_clicked(const Glib::ustring &, sinfg::Waypoint, int button);
+ void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint, int button);
- void on_waypoint_changed( sinfg::Waypoint waypoint , sinfg::ValueNode::Handle value_node);
+ void on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node);
bool on_layer_tree_event(GdkEvent *event);
void set_show_timetrack(bool x=true);
//! Signal called when layer is toggled.
- sigc::signal<void,sinfg::Layer::Handle>& signal_layer_toggle() { return signal_layer_toggle_; }
+ sigc::signal<void,synfig::Layer::Handle>& signal_layer_toggle() { return signal_layer_toggle_; }
//! Signal called with a value has been edited.
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase>& signal_edited_value() { return signal_edited_value_; }
+ sigc::signal<void,synfigapp::ValueDesc,synfig::ValueBase>& signal_edited_value() { return signal_edited_value_; }
sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_layer_user_click() { return signal_layer_user_click_; }
sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_param_user_click() { return signal_param_user_click_; }
- sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint,int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
+ sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
- etl::handle<sinfgapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }
+ etl::handle<synfigapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }
- void select_layer(sinfg::Layer::Handle layer);
+ void select_layer(synfig::Layer::Handle layer);
void select_layers(const LayerList& layer_list);
- void select_all_children_layers(sinfg::Layer::Handle layer);
+ void select_all_children_layers(synfig::Layer::Handle layer);
void select_all_children(Gtk::TreeModel::Children::iterator iter);
LayerList get_selected_layers()const;
- sinfg::Layer::Handle get_selected_layer()const;
+ synfig::Layer::Handle get_selected_layer()const;
void clear_selected_layers();
}; // END of LayerTree
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertreestore.cpp
** \brief Template File
**
#include "layertreestore.h"
#include "iconcontroler.h"
#include <gtkmm/button.h>
-#include <sinfg/paramdesc.h>
-#include <sinfgapp/action.h>
-#include <sinfgapp/instance.h>
+#include <synfig/paramdesc.h>
+#include <synfigapp/action.h>
+#include <synfigapp/instance.h>
#include "app.h"
#include "instance.h"
#include "iconcontroler.h"
-#include <sinfgapp/action_system.h>
+#include <synfigapp/action_system.h>
#include <gtk/gtkversion.h>
#include <ETL/clock>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return *model;
}
-LayerTreeStore::LayerTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+LayerTreeStore::LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Gtk::TreeStore (ModelHack()),
canvas_interface_ (canvas_interface_)
{
- layer_icon=Gtk::Button().render_icon(Gtk::StockID("sinfg-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
+ layer_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
// Connect Signals to Terminals
canvas_interface()->signal_layer_status_changed().connect(sigc::mem_fun(*this,&studio::LayerTreeStore::on_layer_status_changed));
LayerTreeStore::~LayerTreeStore()
{
- sinfg::info("LayerTreeStore::~LayerTreeStore()q: Deleted");
+ synfig::info("LayerTreeStore::~LayerTreeStore()q: Deleted");
}
Glib::RefPtr<LayerTreeStore>
-LayerTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_)
+LayerTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_)
{
return Glib::RefPtr<LayerTreeStore>(new LayerTreeStore(canvas_interface_));
}
{
if(column==model.index.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.z_depth.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.children_lock.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.label.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.tooltip.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.canvas.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.active.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
else
if(column==model.icon.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
Glib::Value<Glib::RefPtr<Gdk::Pixbuf> > x;
g_value_init(x.gobj(),model.label.type());
g_value_copy(value.gobj(),x.gobj());
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)
return;
- sinfg::String new_desc(x.get());
+ synfig::String new_desc(x.get());
if(new_desc==layer->get_local_name())
- new_desc=sinfg::String();
+ new_desc=synfig::String();
if(new_desc==layer->get_description())
return;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_set_desc"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_set_desc"));
if(!action)
return;
action->set_param("canvas",canvas_interface()->get_canvas());
action->set_param("canvas_interface",canvas_interface());
action->set_param("layer",layer);
- action->set_param("new_description",sinfg::String(x.get()));
+ action->set_param("new_description",synfig::String(x.get()));
canvas_interface()->get_instance()->perform_action(action);
return;
else
if(column==model.active.index())
{
- sinfg::Layer::Handle layer((*iter)[model.layer]);
+ synfig::Layer::Handle layer((*iter)[model.layer]);
if(!layer)return;
g_value_init(x.gobj(),model.active.type());
g_value_copy(value.gobj(),x.gobj());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_activate"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate"));
if(!action)
return;
LayerTreeStore::drag_data_get_vfunc (const TreeModel::Path& path, Gtk::SelectionData& selection_data)const
{
if(!const_cast<LayerTreeStore*>(this)->get_iter(path)) return false;
- //sinfg::info("Dragged data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ //synfig::info("Dragged data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Dragged data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("Dragged selection=\"%s\"",gdk_atom_name(selection_data->selection));
Gtk::TreeModel::Row row(*const_cast<LayerTreeStore*>(this)->get_iter(path));
std::vector<Layer*> layers;
// The following is a hack for multiple row DND
{
- sinfgapp::SelectionManager::LayerList bleh(get_canvas_interface()->get_selection_manager()->get_selected_layers());
+ synfigapp::SelectionManager::LayerList bleh(get_canvas_interface()->get_selection_manager()->get_selected_layers());
if(bleh.empty())
{
selection_data.set("LAYER", 8, reinterpret_cast<const guchar*>(&layer), sizeof(layer));
{
//if(!const_cast<LayerTreeStore*>(this)->get_iter(dest)) return false;
- //sinfg::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ //synfig::info("possible_drop -- data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("possible_drop -- data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("possible_drop -- selection=\"%s\"",gdk_atom_name(selection_data->selection));
//Gtk::TreeModel::Row row(*get_iter(dest));
- if(sinfg::String(selection_data.get_data_type())=="LAYER" && (bool)true)
+ if(synfig::String(selection_data.get_data_type())=="LAYER" && (bool)true)
{
//Layer::Handle src(reinterpret_cast<Layer**>(const_cast<guint8*>(selection_data.get_data()))[i]);
//assert(src);
int i(0);
- //sinfg::info("Dropped data of type \"%s\"",selection_data.get_data_type());
- //sinfg::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
- //sinfg::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
- sinfgapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Move Layers"));
+ //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type());
+ //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
+ //synfig::info("Dropped selection=\"%s\"",gdk_atom_name(selection_data->selection));
+ synfigapp::Action::PassiveGrouper passive_grouper(canvas_interface()->get_instance().get(),_("Move Layers"));
// Save the selection data
- sinfgapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
+ synfigapp::SelectionManager::LayerList selected_layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
{
Layer::Handle dest_layer(row[model.layer]);
- if(sinfg::String(selection_data.get_data_type())=="LAYER")for(unsigned int i=0;i<selection_data.get_length()/sizeof(void*);i++)
+ if(synfig::String(selection_data.get_data_type())=="LAYER")for(unsigned int i=0;i<selection_data.get_length()/sizeof(void*);i++)
{
- //sinfg::info("dest_layer_depth=%d",dest_layer_depth);
+ //synfig::info("dest_layer_depth=%d",dest_layer_depth);
Layer::Handle src(reinterpret_cast<Layer**>(const_cast<guint8*>(selection_data.get_data()))[i]);
assert(src);
if(dest_canvas==src->get_canvas() && dest_layer_depth==src->get_depth())
continue;
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_move"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_move"));
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",canvas_interface());
action->set_param("layer",src);
/*else // In this case we need to remove and then add
{
- sinfgapp::Action::Handle action;
- action=sinfgapp::Action::create("layer_remove");
+ synfigapp::Action::Handle action;
+ action=synfigapp::Action::create("layer_remove");
action->set_param("canvas",Canvas::Handle(src->get_canvas()));
if(!action->set_param("canvas_interface",App::get_instance(src->get_canvas())->find_canvas_interface(src->get_canvas())))
action->set_param("canvas_interface",canvas_interface());
return false;
}
- action=sinfgapp::Action::create("layer_add");
+ action=synfigapp::Action::create("layer_add");
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",canvas_interface());
action->set_param("new",src);
if(dest_layer_depth!=0)
{
- action=sinfgapp::Action::create("layer_move");
+ action=synfigapp::Action::create("layer_move");
action->set_param("canvas",dest_canvas);
action->set_param("canvas_interface",canvas_interface());
action->set_param("layer",src);
*/
}
}
- sinfg::info("I suposidly moved %d layers",i);
+ synfig::info("I suposidly moved %d layers",i);
// Reselect the previously selected layers
canvas_interface()->get_selection_manager()->set_selected_layers(selected_layer_list);
{
//etl::clock timer;timer.reset();
- //sinfg::warning("---------rebuilding layer table---------");
+ //synfig::warning("---------rebuilding layer table---------");
// Save the selection data
- sinfgapp::SelectionManager::LayerList layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
+ synfigapp::SelectionManager::LayerList layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
// Clear out the current list
clear();
if(!layer_list.empty())
canvas_interface()->get_selection_manager()->set_selected_layers(layer_list);
- //sinfg::info("LayerTreeStore::rebuild() took %f seconds",float(timer()));
+ //synfig::info("LayerTreeStore::rebuild() took %f seconds",float(timer()));
}
void
Gtk::TreeRow row=*iter;
refresh_row(row);
}
- //sinfg::info("LayerTreeStore::refresh() took %f seconds",float(timer()));
+ //synfig::info("LayerTreeStore::refresh() took %f seconds",float(timer()));
}
void
void
-LayerTreeStore::set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handle)
+LayerTreeStore::set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle)
{
//row[model.id] = handle->get_name();
//row[model.name] = handle->get_local_name();
//row[model.canvas] = handle->get_canvas();
//row[model.icon] = layer_icon;
- sinfg::Layer::ParamList paramlist=handle->get_param_list();
+ synfig::Layer::ParamList paramlist=handle->get_param_list();
- sinfg::Layer::Vocab vocab=handle->get_param_vocab();
- sinfg::Layer::Vocab::iterator iter;
+ synfig::Layer::Vocab vocab=handle->get_param_vocab();
+ synfig::Layer::Vocab::iterator iter;
for(iter=vocab.begin();iter!=vocab.end();++iter)
{
}
void
-LayerTreeStore::on_layer_added(sinfg::Layer::Handle layer)
+LayerTreeStore::on_layer_added(synfig::Layer::Handle layer)
{
assert(layer);
Gtk::TreeRow row;
}
void
-LayerTreeStore::on_layer_removed(sinfg::Layer::Handle handle)
+LayerTreeStore::on_layer_removed(synfig::Layer::Handle handle)
{
Gtk::TreeModel::Children::iterator iter;
if(find_layer_row(handle,iter))
erase(iter);
else
{
- sinfg::error("LayerTreeStore::on_layer_removed():Unable to find layer to be removed, forced to rebuild...");
+ synfig::error("LayerTreeStore::on_layer_removed():Unable to find layer to be removed, forced to rebuild...");
rebuild();
}
}
void
-LayerTreeStore::on_layer_inserted(sinfg::Layer::Handle handle,int depth)
+LayerTreeStore::on_layer_inserted(synfig::Layer::Handle handle,int depth)
{
if(depth==0)
{
Gtk::TreeModel::Children::iterator iter;
if(!find_canvas_row(handle->get_canvas(),iter))
{
- sinfg::error("LayerTreeStore::on_layer_inserted():Unable to find canvas row, forced to rebuild...");
+ synfig::error("LayerTreeStore::on_layer_inserted():Unable to find canvas row, forced to rebuild...");
rebuild();
return;
}
++iter;
if(!iter || iter==children_.end())
{
- sinfg::error("LayerTreeStore::on_layer_inserted():Unable to achieve desired depth, forced to rebuild...");
+ synfig::error("LayerTreeStore::on_layer_inserted():Unable to achieve desired depth, forced to rebuild...");
rebuild();
return;
}
}
void
-LayerTreeStore::on_layer_status_changed(sinfg::Layer::Handle handle,bool x)
+LayerTreeStore::on_layer_status_changed(synfig::Layer::Handle handle,bool x)
{
Gtk::TreeModel::Children::iterator iter;
if(find_layer_row(handle,iter))
(*iter)[model.layer]=handle;
else
{
- sinfg::warning("Couldn't find layer to be activated in layer list. Rebuilding index...");
+ synfig::warning("Couldn't find layer to be activated in layer list. Rebuilding index...");
rebuild();
}
}
void
-LayerTreeStore::on_layer_lowered(sinfg::Layer::Handle layer)
+LayerTreeStore::on_layer_lowered(synfig::Layer::Handle layer)
{
Gtk::TreeModel::Children::iterator iter, iter2;
if(find_layer_row(layer,iter))
{
// Save the selection data
- //sinfgapp::SelectionManager::LayerList layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
+ //synfigapp::SelectionManager::LayerList layer_list=canvas_interface()->get_selection_manager()->get_selected_layers();
iter2=iter;
iter2++;
if(!iter2)
//Gtk::TreeModel::Row row(*iter);
Gtk::TreeModel::Row row2 = *iter2;
- sinfg::Layer::Handle layer2=row2[model.layer];
+ synfig::Layer::Handle layer2=row2[model.layer];
erase(iter2);
row2=*insert(iter);
}
void
-LayerTreeStore::on_layer_raised(sinfg::Layer::Handle layer)
+LayerTreeStore::on_layer_raised(synfig::Layer::Handle layer)
{
Gtk::TreeModel::Children::iterator iter, iter2;
{
//Gtk::TreeModel::Row row = *iter;
Gtk::TreeModel::Row row2 = *iter2;
- sinfg::Layer::Handle layer2=row2[model.layer];
+ synfig::Layer::Handle layer2=row2[model.layer];
erase(iter2);
iter++;
}
void
-LayerTreeStore::on_layer_moved(sinfg::Layer::Handle layer,int depth, sinfg::Canvas::Handle canvas)
+LayerTreeStore::on_layer_moved(synfig::Layer::Handle layer,int depth, synfig::Canvas::Handle canvas)
{
on_layer_removed(layer);
on_layer_inserted(layer,depth);
}
void
-LayerTreeStore::on_layer_param_changed(sinfg::Layer::Handle handle,sinfg::String param_name)
+LayerTreeStore::on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name)
{
if(param_name=="z_depth")
{
}
void
-LayerTreeStore::on_layer_new_description(sinfg::Layer::Handle handle,sinfg::String desc)
+LayerTreeStore::on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc)
{
Gtk::TreeModel::Children::iterator iter;
if(find_layer_row(handle,iter))
}
bool
-LayerTreeStore::find_canvas_row_(sinfg::Canvas::Handle canvas, sinfg::Canvas::Handle parent, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter)
+LayerTreeStore::find_canvas_row_(synfig::Canvas::Handle canvas, synfig::Canvas::Handle parent, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter)
{
if(canvas==parent)
return false;
for(iter=layers.begin(); iter && iter != layers.end(); ++iter)
{
Gtk::TreeModel::Row row = *iter;
- if(canvas==(sinfg::Canvas::Handle)row[model.contained_canvas])
+ if(canvas==(synfig::Canvas::Handle)row[model.contained_canvas])
return true;
}
}
bool
-LayerTreeStore::find_canvas_row(sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children::iterator &iter)
+LayerTreeStore::find_canvas_row(synfig::Canvas::Handle canvas, Gtk::TreeModel::Children::iterator &iter)
{
return find_canvas_row_(canvas,canvas_interface()->get_canvas(),children(),iter);
}
bool
-LayerTreeStore::find_layer_row_(const sinfg::Layer::Handle &layer, sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
+LayerTreeStore::find_layer_row_(const synfig::Layer::Handle &layer, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev)
{
assert(layer);
for(iter=prev=layers.begin(); iter && iter != layers.end(); prev=iter++)
{
Gtk::TreeModel::Row row = *iter;
- if(layer==(sinfg::Layer::Handle)row[model.layer])
+ if(layer==(synfig::Layer::Handle)row[model.layer])
return true;
}
}
bool
-LayerTreeStore::find_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter)
+LayerTreeStore::find_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &iter)
{
Gtk::TreeModel::Children::iterator prev;
return find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev);
}
bool
-LayerTreeStore::find_prev_layer_row(const sinfg::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev)
+LayerTreeStore::find_prev_layer_row(const synfig::Layer::Handle &layer, Gtk::TreeModel::Children::iterator &prev)
{
Gtk::TreeModel::Children::iterator iter;
if(!find_layer_row_(layer,canvas_interface()->get_canvas(),children(),iter,prev))
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file layertreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_LAYERTREESTORE_H
-#define __SINFG_STUDIO_LAYERTREESTORE_H
+#ifndef __SYNFIG_STUDIO_LAYERTREESTORE_H
+#define __SYNFIG_STUDIO_LAYERTREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/value.h>
-#include <sinfg/valuenode.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfig/value.h>
+#include <synfig/valuenode.h>
#include <gtkmm/treeview.h>
/* === M A C R O S ========================================================= */
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> id;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
Gtk::TreeModelColumn<Glib::ustring> tooltip;
Gtk::TreeModelColumn<bool> active;
- Gtk::TreeModelColumn<sinfg::Layer::Handle> layer;
- Gtk::TreeModelColumn<sinfg::Canvas::Handle> contained_canvas;
+ Gtk::TreeModelColumn<synfig::Layer::Handle> layer;
+ Gtk::TreeModelColumn<synfig::Canvas::Handle> contained_canvas;
Gtk::TreeModelColumn<bool> children_lock;
private:
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gdk::Pixbuf> layer_icon;
bool on_layer_tree_event(GdkEvent *event);
- void on_layer_new_description(sinfg::Layer::Handle handle,sinfg::String desc);
+ void on_layer_new_description(synfig::Layer::Handle handle,synfig::String desc);
- void on_layer_added(sinfg::Layer::Handle handle);
+ void on_layer_added(synfig::Layer::Handle handle);
- void on_layer_removed(sinfg::Layer::Handle handle);
+ void on_layer_removed(synfig::Layer::Handle handle);
- void on_layer_inserted(sinfg::Layer::Handle handle,int depth);
+ void on_layer_inserted(synfig::Layer::Handle handle,int depth);
- void on_layer_moved(sinfg::Layer::Handle handle,int depth, sinfg::Canvas::Handle canvas);
+ void on_layer_moved(synfig::Layer::Handle handle,int depth, synfig::Canvas::Handle canvas);
- void on_layer_status_changed(sinfg::Layer::Handle handle,bool);
+ void on_layer_status_changed(synfig::Layer::Handle handle,bool);
- void on_layer_lowered(sinfg::Layer::Handle handle);
+ void on_layer_lowered(synfig::Layer::Handle handle);
- void on_layer_raised(sinfg::Layer::Handle handle);
+ void on_layer_raised(synfig::Layer::Handle handle);
- void on_layer_param_changed(sinfg::Layer::Handle handle,sinfg::String param_name);
+ void on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name);
- //void on_value_node_added(sinfg::ValueNode::Handle value_node);
+ //void on_value_node_added(synfig::ValueNode::Handle value_node);
- //void on_value_node_deleted(sinfg::ValueNode::Handle value_node);
+ //void on_value_node_deleted(synfig::ValueNode::Handle value_node);
- //void on_value_node_changed(sinfg::ValueNode::Handle value_node);
+ //void on_value_node_changed(synfig::ValueNode::Handle value_node);
- //void on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node);
+ //void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
- bool find_layer_row_(const sinfg::Layer::Handle &handle, sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
+ bool find_layer_row_(const synfig::Layer::Handle &handle, synfig::Canvas::Handle canvas, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter, Gtk::TreeModel::Children::iterator &prev);
- bool find_canvas_row_(sinfg::Canvas::Handle canvas, sinfg::Canvas::Handle parent, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter);
+ bool find_canvas_row_(synfig::Canvas::Handle canvas, synfig::Canvas::Handle parent, Gtk::TreeModel::Children layers, Gtk::TreeModel::Children::iterator &iter);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
public:
- LayerTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
~LayerTreeStore();
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
- etl::loose_handle<const sinfgapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
+ etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
- bool find_canvas_row(sinfg::Canvas::Handle canvas, Gtk::TreeModel::Children::iterator &iter);
+ bool find_canvas_row(synfig::Canvas::Handle canvas, Gtk::TreeModel::Children::iterator &iter);
- bool find_layer_row(const sinfg::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
+ bool find_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
- bool find_prev_layer_row(const sinfg::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
+ bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
void rebuild();
void refresh_row(Gtk::TreeModel::Row &row);
- void set_row_layer(Gtk::TreeRow &row,sinfg::Layer::Handle &handle);
+ void set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle);
static int z_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
static int index_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs);
- //void set_row_param(Gtk::TreeRow &row,sinfg::Layer::Handle &handle,const std::string& name, const std::string& local_name, const sinfg::ValueBase &value, etl::handle<sinfg::ValueNode> value_node,sinfg::ParamDesc *param_desc);
+ //void set_row_param(Gtk::TreeRow &row,synfig::Layer::Handle &handle,const std::string& name, const std::string& local_name, const synfig::ValueBase &value, etl::handle<synfig::ValueNode> value_node,synfig::ParamDesc *param_desc);
- //virtual void set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc);
+ //virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc);
static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
/*
public:
- static Glib::RefPtr<LayerTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_);
+ static Glib::RefPtr<LayerTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
}; // END of class LayerTreeStore
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file main.cpp
-** \brief Sinfg Studio Entrypoint
+** \brief Synfig Studio Entrypoint
**
** $Id: main.cpp,v 1.2 2005/01/13 18:37:30 darco Exp $
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
app.run();
}
- catch(sinfg::SoftwareExpired)
+ catch(synfig::SoftwareExpired)
{
cerr<<"FATAL: Software Expired"<<endl;
return 39;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file metadatatreestore.cpp
** \brief Template File
**
#endif
#include "metadatatreestore.h"
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return *model;
}
-MetaDataTreeStore::MetaDataTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_):
+MetaDataTreeStore::MetaDataTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_):
Gtk::TreeStore (ModelHack()),
canvas_interface_ (canvas_interface_)
{
MetaDataTreeStore::~MetaDataTreeStore()
{
- sinfg::info("MetaDataTreeStore::~MetaDataTreeStore(): Deleted");
+ synfig::info("MetaDataTreeStore::~MetaDataTreeStore(): Deleted");
}
Glib::RefPtr<MetaDataTreeStore>
-MetaDataTreeStore::create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_)
+MetaDataTreeStore::create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_)
{
return Glib::RefPtr<MetaDataTreeStore>(new MetaDataTreeStore(canvas_interface_));
}
void
-MetaDataTreeStore::meta_data_changed(sinfg::String key)
+MetaDataTreeStore::meta_data_changed(synfig::String key)
{
rebuild();
}
if(column==model.data.index())
{
- sinfg::String key((Glib::ustring)(*iter)[model.key]);
+ synfig::String key((Glib::ustring)(*iter)[model.key]);
g_value_init(value.gobj(),G_TYPE_STRING);
g_value_set_string(value.gobj(),get_canvas()->get_meta_data(key).c_str());
return;
g_value_init(x.gobj(),model.data.type());
g_value_copy(value.gobj(),x.gobj());
- sinfg::String key((Glib::ustring)(*iter)[model.key]);
- sinfg::String new_data(x.get());
+ synfig::String key((Glib::ustring)(*iter)[model.key]);
+ synfig::String new_data(x.get());
get_canvas_interface()->set_meta_data(key,new_data);
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file metadatatreestore.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_METADATATREESTORE_H
-#define __SINFG_STUDIO_METADATATREESTORE_H
+#ifndef __SYNFIG_STUDIO_METADATATREESTORE_H
+#define __SYNFIG_STUDIO_METADATATREESTORE_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/treestore.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include <gdkmm/pixbuf.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
/* === M A C R O S ========================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfgapp { class CanvasInterface; }
+namespace synfigapp { class CanvasInterface; }
namespace studio {
private:
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
/*
-- ** -- P R I V A T E M E T H O D S ---------------------------------------
private:
- void meta_data_changed(sinfg::String key);
+ void meta_data_changed(synfig::String key);
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
~MetaDataTreeStore();
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface() { return canvas_interface_; }
- etl::loose_handle<const sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
- sinfg::Canvas::Handle get_canvas()const { return canvas_interface_->get_canvas(); }
- sinfg::Canvas::Handle get_canvas() { return canvas_interface_->get_canvas(); }
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface() { return canvas_interface_; }
+ etl::loose_handle<const synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+ synfig::Canvas::Handle get_canvas()const { return canvas_interface_->get_canvas(); }
+ synfig::Canvas::Handle get_canvas() { return canvas_interface_->get_canvas(); }
void rebuild();
*/
protected:
- MetaDataTreeStore(etl::loose_handle<sinfgapp::CanvasInterface>);
+ MetaDataTreeStore(etl::loose_handle<synfigapp::CanvasInterface>);
void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
void set_value_impl(const Gtk::TreeModel::iterator& iter, int column, const Glib::ValueBase& value);
public:
- static Glib::RefPtr<MetaDataTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface>);
+ static Glib::RefPtr<MetaDataTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface>);
}; // END of class MetaDataTreeStore
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file mod_mirror.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file mod_mirror.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_MOD_MIRROR_H
-#define __SINFG_MOD_MIRROR_H
+#ifndef __SYNFIG_MOD_MIRROR_H
+#define __SYNFIG_MOD_MIRROR_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_mirror.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_mirror.h"
#include "../canvasview.h"
#include "../workarea.h"
#include "../app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "../event_mouse.h"
#include "../event_layerclick.h"
#include "../toolbox.h"
#include "../dialog_tooloptions.h"
#include <gtkmm/optionmenu.h>
#include "../duck.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
class DuckDrag_Mirror : public DuckDrag_Base
{
- sinfg::Vector center;
+ synfig::Vector center;
- std::vector<sinfg::Vector> positions;
+ std::vector<synfig::Vector> positions;
public:
Axis axis;
DuckDrag_Mirror();
- void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin);
+ void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin);
bool end_duck_drag(Duckmatic* duckmatic);
- void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector);
+ void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector);
};
{
etl::handle<CanvasView> canvas_view_;
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
etl::handle<DuckDrag_Mirror> duck_dragger_;
~StateMirror_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
void load_settings();
StateMirror_Context::StateMirror_Context(CanvasView* canvas_view):
canvas_view_(canvas_view),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
duck_dragger_(new DuckDrag_Mirror()),
checkbutton_axis_x(_("Horizontal")),
checkbutton_axis_y(_("Vertical"))
#endif
void
-DuckDrag_Mirror::begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& offset)
+DuckDrag_Mirror::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& offset)
{
void
-DuckDrag_Mirror::duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)
+DuckDrag_Mirror::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)
{
center=vector;
int i;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_mirror.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_MIRROR_H
-#define __SINFG_STUDIO_STATE_MIRROR_H
+#ifndef __SYNFIG_STUDIO_STATE_MIRROR_H
+#define __SYNFIG_STUDIO_STATE_MIRROR_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_palette.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_palette.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_PAL_BROWSE_H
-#define __SINFG_STUDIO_DOCK_PAL_BROWSE_H
+#ifndef __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H
+#define __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H
/* === H E A D E R S ======================================================= */
#include "../dockable.h"
-#include <sinfg/palette.h>
+#include <synfig/palette.h>
/* === M A C R O S ========================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfgapp {
+namespace synfigapp {
class CanvasInterface;
};
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_palette.cpp
** \brief Template File
**
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
-#include <sinfg/general.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/value_desc.h>
+#include <synfig/general.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/value_desc.h>
#include "../widget_color.h"
#include <gtkmm/spinbutton.h>
#include <gtkmm/menu.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#include "../app.h"
#include "../dialog_color.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === G L O B A L S ======================================================= */
/*
-class studio::PaletteSettings : public sinfgapp::Settings
+class studio::PaletteSettings : public synfigapp::Settings
{
Dock_PalEdit* dialog_palette;
- sinfg::String name;
+ synfig::String name;
public:
- PaletteSettings(Dock_PalEdit* window,const sinfg::String& name):
+ PaletteSettings(Dock_PalEdit* window,const synfig::String& name):
dialog_palette(window),
name(name)
{
dialog_palette->dialog_settings.remove_domain(name);
}
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const
{
int i(atoi(key.c_str()));
if(i<0 || i>=dialog_palette->size())
return true;
}
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value)
+ virtual bool set_value(const synfig::String& key,const synfig::String& value)
{
int i(atoi(key.c_str()));
if(i<0)
virtual KeyList get_key_list()const
{
- sinfgapp::Settings::KeyList ret(sinfgapp::Settings::get_key_list());
+ synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list());
int i;
for(i=0;i<dialog_palette->size();i++)
}
void
-Dock_PalEdit::set_palette(const sinfg::Palette& x)
+Dock_PalEdit::set_palette(const synfig::Palette& x)
{
palette_=x;
refresh();
void
Dock_PalEdit::on_add_pressed()
{
- add_color(sinfgapp::Main::get_foreground_color());
+ add_color(synfigapp::Main::get_foreground_color());
}
void
}
int
-Dock_PalEdit::add_color(const sinfg::Color& x)
+Dock_PalEdit::add_color(const synfig::Color& x)
{
palette_.push_back(x);
signal_changed()();
}
void
-Dock_PalEdit::set_color(sinfg::Color x, int i)
+Dock_PalEdit::set_color(synfig::Color x, int i)
{
palette_[i].color=x;
signal_changed()();
void
Dock_PalEdit::select_color(int i)
{
- sinfgapp::Main::set_foreground_color(get_color(i));
+ synfigapp::Main::set_foreground_color(get_color(i));
}
void
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_palette.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_DOCK_PAL_EDIT_H
-#define __SINFG_STUDIO_DOCK_PAL_EDIT_H
+#ifndef __SYNFIG_STUDIO_DOCK_PAL_EDIT_H
+#define __SYNFIG_STUDIO_DOCK_PAL_EDIT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/optionmenu.h>
#include <gtkmm/checkbutton.h>
-#include <sinfg/gamma.h>
-#include <sinfg/time.h>
+#include <synfig/gamma.h>
+#include <synfig/time.h>
#include "../widget_coloredit.h"
-#include <sinfgapp/value_desc.h>
-#include <sinfg/time.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/time.h>
#include "../dockable.h"
#include <vector>
#include <gtkmm/actiongroup.h>
-#include <sinfg/palette.h>
+#include <synfig/palette.h>
/* === M A C R O S ========================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfgapp {
+namespace synfigapp {
class CanvasInterface;
};
Glib::RefPtr<Gtk::ActionGroup> action_group;
- sinfg::Palette palette_;
+ synfig::Palette palette_;
Gtk::Table table;
private:
- int add_color(const sinfg::Color& x);
- void set_color(sinfg::Color x, int i);
+ int add_color(const synfig::Color& x);
+ void set_color(synfig::Color x, int i);
void erase_color(int i);
void select_color(int i);
- sinfg::Color get_color(int i)const;
+ synfig::Color get_color(int i)const;
void edit_color(int i);
public:
- void set_palette(const sinfg::Palette& x);
- const sinfg::Palette& get_palette()const { return palette_; }
+ void set_palette(const synfig::Palette& x);
+ const synfig::Palette& get_palette()const { return palette_; }
int size()const;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file mod_palette.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file mod_palette.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_MOD_PALETTE_H
-#define __SINFG_MOD_PALETTE_H
+#ifndef __SYNFIG_MOD_PALETTE_H
+#define __SYNFIG_MOD_PALETTE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-//using namespace sinfg;
+//using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file module.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_MODULE_H
-#define __SINFG_MODULE_H
+#ifndef __SYNFIG_MODULE_H
+#define __SYNFIG_MODULE_H
/* === H E A D E R S ======================================================= */
/*! ========================================================================
-** Sinfg
+** Synfig
** Template File
** $Id: onemoment.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
**
#include <gtkmm/label.h>
#include <gtkmm/fixed.h>
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include "onemoment.h"
#include "app.h"
#ifndef VERSION
#define VERSION "unknown"
-#define PACKAGE "sinfgstudio"
+#define PACKAGE "synfigstudio"
#endif
#ifdef WIN32
/*! ========================================================================
-** Sinfg
+** Synfig
** Template Header File
** $Id: onemoment.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_ONEMOMENT_H
-#define __SINFG_GTKMM_ONEMOMENT_H
+#ifndef __SYNFIG_GTKMM_ONEMOMENT_H
+#define __SYNFIG_GTKMM_ONEMOMENT_H
/* === H E A D E R S ======================================================= */
/* === C L A S S E S & S T R U C T S ======================================= */
-namespace sinfg { class ProgressCallback; };
+namespace synfig { class ProgressCallback; };
namespace studio {
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file preview.cpp
** \brief Preview implementation file
**
#include <gtkmm/stock.h>
#include <gtkmm/separator.h>
-#include <sinfg/target_scanline.h>
-#include <sinfg/surface.h>
+#include <synfig/target_scanline.h>
+#include <synfig/surface.h>
#include <algorithm>
#include "asyncrenderer.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
{
if(Target_Scanline::set_rend_desc(r))
{
- /*sinfg::warning("Succeeded in setting the desc to new one: %d x %d, %.2f fps [%.2f,%.2f]",
+ /*synfig::warning("Succeeded in setting the desc to new one: %d x %d, %.2f fps [%.2f,%.2f]",
desc.get_w(),desc.get_h(),desc.get_frame_rate(),
(float)desc.get_time_start(),(float)desc.get_time_end());*/
//ok... notify our subscribers...
signal_frame_done_(this);
curframe += 1;
- //sinfg::warning("Finished the frame stuff, and changed time to %.3f",t);
+ //synfig::warning("Finished the frame stuff, and changed time to %.3f",t);
}
virtual Color * start_scanline(int scanline)
etl::handle<Preview_Target> target = new Preview_Target;
//connect our information to his...
- //sinfg::warning("Connecting to the end frame function...");
+ //synfig::warning("Connecting to the end frame function...");
target->signal_frame_done().connect(sigc::mem_fun(*this,&Preview::frame_finish));
//set the options
- //sinfg::warning("Setting Canvas");
+ //synfig::warning("Setting Canvas");
target->set_canvas(get_canvas());
target->set_quality(quality);
newh = (int)floor(desc.get_h()*zoom+0.5);
float newfps = fps;
- /*sinfg::warning("Setting the render description: %d x %d, %f fps, [%f,%f]",
+ /*synfig::warning("Setting the render description: %d x %d, %f fps, [%f,%f]",
neww,newh,newfps, overbegin?begintime:(float)desc.get_time_start(),
overend?endtime:(float)desc.get_time_end());*/
if(overbegin)
{
desc.set_time_start(std::max(begintime,(float)desc.get_time_start()));
- //sinfg::warning("Set start time to %.2f...",(float)desc.get_time_start());
+ //synfig::warning("Set start time to %.2f...",(float)desc.get_time_start());
}
if(overend)
{
desc.set_time_end(std::min(endtime,(float)desc.get_time_end()));
- //sinfg::warning("Set end time to %.2f...",(float)desc.get_time_end());
+ //synfig::warning("Set end time to %.2f...",(float)desc.get_time_end());
}
//setting the description
frames.resize(0);
//now tell it to go... with inherited prog. reporting...
- //sinfg::info("Rendering Asynchronously...");
+ //synfig::info("Rendering Asynchronously...");
if(renderer) renderer->stop();
renderer = new AsyncRenderer(target);
renderer->start();
const Surface &surf = targ->get_surface();
const RendDesc& r = targ->get_rend_desc();
- //sinfg::warning("Finished a frame at %f s",time);
+ //synfig::warning("Finished a frame at %f s",time);
//copy EVERYTHING!
PixelFormat pf(PF_RGB);
- const int total_bytes(r.get_w()*r.get_h()*sinfg::channels(pf));
+ const int total_bytes(r.get_w()*r.get_h()*synfig::channels(pf));
- //sinfg::warning("Creating a buffer");
+ //synfig::warning("Creating a buffer");
unsigned char *buffer((unsigned char*)malloc(total_bytes));
if(!buffer)
return;
//convert all the pixles to the pixbuf... buffer... thing...
- //sinfg::warning("Converting...");
+ //synfig::warning("Converting...");
convert_color_format(buffer, surf[0], surf.get_w()*surf.get_h(), pf, App::gamma);
//load time
fe.t = time;
//uses and manages the memory for the buffer...
- //sinfg::warning("Create a pixmap...");
+ //synfig::warning("Create a pixmap...");
fe.buf =
Gdk::Pixbuf::create_from_data(
buffer, // pointer to the data
8, // bits per sample
surf.get_w(), // width
surf.get_h(), // height
- surf.get_w()*sinfg::channels(pf), // stride (pitch)
+ surf.get_w()*synfig::channels(pf), // stride (pitch)
sigc::ptr_fun(free_guint8)
);
//add the flipbook element to the list (assume time is correct)
- //sinfg::info("Prev: Adding %f s to the list", time);
+ //synfig::info("Prev: Adding %f s to the list", time);
frames.push_back(fe);
signal_changed()();
//find the frame and display it...
if(preview)
{
- //sinfg::warning("Updating at %.3f s",time);
+ //synfig::warning("Updating at %.3f s",time);
//use time to find closest frame...
studio::Preview::FlipBook::const_iterator beg = preview->begin(),end = preview->end();
{
//don't bother with binary search it will just be slower...
- //sinfg::info("Search for time %f",time);
+ //synfig::info("Search for time %f",time);
//incrementally go in either direction
//(bias downward towards beg, because that's what we want)
for(;i != end;++i)
{
- //sinfg::info("Look at %f",i->t);
+ //synfig::info("Look at %f",i->t);
if(i->t > time) break;
- //sinfg::info("Go past...");
+ //synfig::info("Go past...");
}
//if(i!=beg)--i;
for(;i != beg;)
{
--i;
- //sinfg::info("Look at %f",i->t);
+ //synfig::info("Look at %f",i->t);
if(i->t <= time) break;
- //sinfg::info("Go past...");
+ //synfig::info("Go past...");
}
/*i = preview->begin(); end = preview->end();
//don't get the closest, round down... (if we can)
if(i == end)
{
- sinfg::error("i == end....");
+ synfig::error("i == end....");
//assert(0);
currentbuf.clear();
currentindex = 0;
if(timedisp != i->t)
{
timedisp = i->t;
- //sinfg::warning("Update at: %f seconds (%f s)",time,timedisp);
+ //synfig::warning("Update at: %f seconds (%f s)",time,timedisp);
preview_draw();
- //sinfg::warning("success!");
+ //synfig::warning("success!");
}
}
}
sx = draw_area.get_width() / (float)px->get_width();
sy = draw_area.get_height() / (float)px->get_height();
- //sinfg::info("widget_preview redraw: now to scale the bitmap: %.3f x %.3f",sx,sy);
+ //synfig::info("widget_preview redraw: now to scale the bitmap: %.3f x %.3f",sx,sy);
//round to smallest scale (fit entire thing in window without distortion)
if(sx > sy) sx = sy;
pxnew = px->scale_simple(nw,nh,Gdk::INTERP_NEAREST);
- //sinfg::info("Now to draw to the window...");
+ //synfig::info("Now to draw to the window...");
//copy to window
Glib::RefPtr<Gdk::Window> wind = draw_area.get_window();
Glib::RefPtr<Gdk::Drawable> surf = Glib::RefPtr<Gdk::Drawable>::cast_static(wind);
draw_area.get_window()->begin_paint_rect(r);
}
- if(!wind) sinfg::warning("The destination window is broken...");
- if(!surf) sinfg::warning("The destination is not drawable...");
+ if(!wind) synfig::warning("The destination window is broken...");
+ if(!surf) synfig::warning("The destination is not drawable...");
if(surf)
{
Glib::ustring timecode(Time((double)timedisp).round(preview->get_global_fps())
.get_string(preview->get_global_fps(),
App::get_time_format()));
- //sinfg::info("Time for preview draw is: %s for time %g", timecode.c_str(), adj_time_scrub.get_value());
+ //synfig::info("Time for preview draw is: %s for time %g", timecode.c_str(), adj_time_scrub.get_value());
gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
layout->set_text(timecode);
draw_area.get_window()->end_paint();
- //sinfg::warning("Refresh the draw area");
+ //synfig::warning("Refresh the draw area");
//make sure the widget refreshes
return false;
bool studio::Widget_Preview::play_update()
{
float diff = timer.pop_time();
- //sinfg::info("Play update: diff = %.2f",diff);
+ //synfig::info("Play update: diff = %.2f",diff);
if(playing)
{
if(newtime != audiotime)
{
- //sinfg::info("Adjusted time from %.3lf to %.3lf", time,newtime);
+ //synfig::info("Adjusted time from %.3lf to %.3lf", time,newtime);
time = audiotime = newtime;
}
}
play_stop();
update();
- //sinfg::info("Play Stopped: time set to %f",adj_time_scrub.get_value());
+ //synfig::info("Play Stopped: time set to %f",adj_time_scrub.get_value());
return false;
}
}
//update the window to the correct image we might want to do this later...
//update();
- //sinfg::warning("Did update pu");
+ //synfig::warning("Did update pu");
}
return true;
}
//if(!playing)
{
update();
- //sinfg::warning("Did update sm");
+ //synfig::warning("Did update sm");
}
}
}
}
- //sinfg::info("Scrubbing to %.3f, setting adj to %.3f",oldt,t);
+ //synfig::info("Scrubbing to %.3f, setting adj to %.3f",oldt,t);
if(adj_time_scrub.get_value() != t)
{
{
preview = prev;
- sinfg::info("Setting preview");
+ synfig::info("Setting preview");
//stop playing the mini animation...
stop();
{
//set the internal values
float rate = preview->get_fps();
- sinfg::info(" FPS = %f",rate);
+ synfig::info(" FPS = %f",rate);
if(rate)
{
float start = preview->get_begintime();
prevchanged = prev->signal_changed().connect(sigc::mem_fun(*this,&Widget_Preview::whenupdated));
prev->signal_destroyed().connect(sigc::mem_fun(*this,&Widget_Preview::disconnect_preview));
update();
- //sinfg::warning("Did update sp");
+ //synfig::warning("Did update sp");
queue_draw();
}
}
{
if(preview && !playing)
{
- //sinfg::info("Playing at %lf",adj_time_scrub.get_value());
+ //synfig::info("Playing at %lf",adj_time_scrub.get_value());
//audiotime = adj_time_scrub.get_value();
playing = true;
//adj_time_scrub.set_value(adj_time_scrub.get_lower());
update(); //we don't want to call play update because that will try to advance the timer
- //sinfg::warning("Did update p");
+ //synfig::warning("Did update p");
//approximate length of time in seconds, right?
double rate = /*std::min(*/adj_time_scrub.get_step_increment()/*,1/30.0)*/;
int timeout = (int)floor(1000*rate);
- //sinfg::info(" rate = %.3lfs = %d ms",rate,timeout);
+ //synfig::info(" rate = %.3lfs = %d ms",rate,timeout);
signal_play_(adj_time_scrub.get_value());
playing = false;
signal_stop()();
if(audio) audio->stop(); //!< stop the audio
- //sinfg::info("Stopping...");
+ //synfig::info("Stopping...");
}
void studio::Widget_Preview::stop()
{
- //sinfg::warning("stopping");
+ //synfig::warning("stopping");
play_stop();
timecon.disconnect();
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file preview.h
** \brief Previews an animation
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_PREVIEW_H
-#define __SINFG_PREVIEW_H
+#ifndef __SYNFIG_PREVIEW_H
+#define __SYNFIG_PREVIEW_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/drawingarea.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/canvasview.h>
-#include <sinfg/time.h>
-#include <sinfg/vector.h>
-#include <sinfg/general.h>
-#include <sinfg/renddesc.h>
-#include <sinfg/canvas.h>
+#include <synfig/time.h>
+#include <synfig/vector.h>
+#include <synfig/general.h>
+#include <synfig/renddesc.h>
+#include <synfig/canvas.h>
#include "widget_sound.h"
studio::CanvasView::LooseHandle canvasview;
- //sinfg::RendDesc description; //for rendering the preview...
+ //synfig::RendDesc description; //for rendering the preview...
float zoom,fps;
float begintime,endtime;
bool overbegin,overend;
int get_quality() const {return quality;}
void set_quality(int i) {quality = i;}
- sinfg::Canvas::Handle get_canvas() const {return canvasview->get_canvas();}
+ synfig::Canvas::Handle get_canvas() const {return canvasview->get_canvas();}
studio::CanvasView::Handle get_canvasview() const {return canvasview;}
void set_canvasview(const studio::CanvasView::LooseHandle &h);
//signal interface
sigc::signal<void, Preview *> & signal_destroyed() { return signal_destroyed_; }
- //sigc::signal<void, const sinfg::RendDesc &> &signal_desc_change() {return signal_desc_change_;}
+ //sigc::signal<void, const synfig::RendDesc &> &signal_desc_change() {return signal_desc_change_;}
//functions for exposing iterators through the preview
FlipBook::iterator begin() {return frames.begin();}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file renddesc.cpp
** \brief Template File
**
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
#include <ETL/misc>
-#include <sinfg/general.h>
+#include <synfig/general.h>
//#include <gtkmm/seperator.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-#ifndef SINFG_MAX_PIXEL_WIDTH
-#define SINFG_MAX_PIXEL_WIDTH (~(1<<31))
+#ifndef SYNFIG_MAX_PIXEL_WIDTH
+#define SYNFIG_MAX_PIXEL_WIDTH (~(1<<31))
#endif
-#ifndef SINFG_MAX_PIXEL_HEIGHT
-#define SINFG_MAX_PIXEL_HEIGHT (~(1<<31))
+#ifndef SYNFIG_MAX_PIXEL_HEIGHT
+#define SYNFIG_MAX_PIXEL_HEIGHT (~(1<<31))
#endif
#if ! defined(_)
Widget_RendDesc::Widget_RendDesc():
Gtk::Table(1,2,false),
- adjustment_width(1,1,SINFG_MAX_PIXEL_WIDTH),
- adjustment_height(1,1,SINFG_MAX_PIXEL_HEIGHT),
+ adjustment_width(1,1,SYNFIG_MAX_PIXEL_WIDTH),
+ adjustment_height(1,1,SYNFIG_MAX_PIXEL_HEIGHT),
adjustment_xres(0,0,10000000),
adjustment_yres(0,0,10000000),
adjustment_phy_width(0,0,10000000),
{
}
-void Widget_RendDesc::set_rend_desc(const sinfg::RendDesc &rend_desc)
+void Widget_RendDesc::set_rend_desc(const synfig::RendDesc &rend_desc)
{
if(update_lock)return;
toggle_im_span->set_active((bool)(rend_desc_.get_flags()&RendDesc::IM_SPAN));
}
-void Widget_RendDesc::apply_rend_desc(const sinfg::RendDesc &rend_desc)
+void Widget_RendDesc::apply_rend_desc(const synfig::RendDesc &rend_desc)
{
set_rend_desc(rend_desc);
}
-const sinfg::RendDesc &
+const synfig::RendDesc &
Widget_RendDesc::get_rend_desc()
{
return rend_desc_;
/*! ========================================================================
-** Sinfg
+** Synfig
** Template Header File
** $Id: renddesc.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_RENDDESC_H
-#define __SINFG_GTKMM_RENDDESC_H
+#ifndef __SYNFIG_GTKMM_RENDDESC_H
+#define __SYNFIG_GTKMM_RENDDESC_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/table.h>
#include <gtkmm/frame.h>
-#include <sinfg/renddesc.h>
+#include <synfig/renddesc.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/checkbutton.h>
class Widget_RendDesc : public Gtk::Table
{
- sinfg::RendDesc rend_desc_;
+ synfig::RendDesc rend_desc_;
sigc::signal<void> signal_changed_;
Gtk::Adjustment adjustment_width;
~Widget_RendDesc();
//! Sets the RendDesc
- void set_rend_desc(const sinfg::RendDesc &rend_desc);
+ void set_rend_desc(const synfig::RendDesc &rend_desc);
//! Applies the given RendDesc to the current RendDesc
- void apply_rend_desc(const sinfg::RendDesc &rend_desc);
+ void apply_rend_desc(const synfig::RendDesc &rend_desc);
//! Retrieves the current RendDesc
- const sinfg::RendDesc &get_rend_desc();
+ const synfig::RendDesc &get_rend_desc();
void disable_time_section();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file render.cpp
** \brief Template File
**
#include "render.h"
#include "app.h"
#include <gtkmm/frame.h>
-#include <sinfg/target_scanline.h>
-#include <sinfg/canvas.h>
+#include <synfig/target_scanline.h>
+#include <synfig/canvas.h>
#include "asyncrenderer.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === M E T H O D S ======================================================= */
-RenderSettings::RenderSettings(Gtk::Window& parent,handle<sinfgapp::CanvasInterface> canvas_interface):
+RenderSettings::RenderSettings(Gtk::Window& parent,handle<synfigapp::CanvasInterface> canvas_interface):
Gtk::Dialog(_("Render Settings"),parent,false,true),
canvas_interface_(canvas_interface),
adjustment_quality(3,0,9),
sigc::bind(sigc::mem_fun(*this,&RenderSettings::set_target),String())
));
- sinfg::Target::Book::iterator iter;
- sinfg::Target::Book book(sinfg::Target::book());
+ synfig::Target::Book::iterator iter;
+ synfig::Target::Book book(synfig::Target::book());
for(iter=book.begin();iter!=book.end();iter++)
{
}
catch(...)
{
- sinfg::warning("Averted crash!");
+ synfig::warning("Averted crash!");
entry_filename.set_text("output.png");
}
}
void
-RenderSettings::set_target(sinfg::String name)
+RenderSettings::set_target(synfig::String name)
{
target_name=name;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file render.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_GTKMM_RENDER_H
-#define __SINFG_STUDIO_GTKMM_RENDER_H
+#ifndef __SYNFIG_STUDIO_GTKMM_RENDER_H
+#define __SYNFIG_STUDIO_GTKMM_RENDER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/tooltips.h>
#include <gtkmm/optionmenu.h>
-#include <sinfg/string.h>
+#include <synfig/string.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfigapp/canvasinterface.h>
#include "renddesc.h"
{
Gtk::Tooltips tooltips;
- etl::handle<sinfgapp::CanvasInterface> canvas_interface_;
+ etl::handle<synfigapp::CanvasInterface> canvas_interface_;
Widget_RendDesc widget_rend_desc;
Gtk::Entry entry_filename;
Gtk::OptionMenu optionmenu_target;
Gtk::Menu *menu_target;
- sinfg::String target_name;
+ synfig::String target_name;
- void set_target(sinfg::String name);
+ void set_target(synfig::String name);
etl::handle<AsyncRenderer> async_renderer;
public:
- RenderSettings(Gtk::Window& parent,etl::handle<sinfgapp::CanvasInterface> canvas_interface);
+ RenderSettings(Gtk::Window& parent,etl::handle<synfigapp::CanvasInterface> canvas_interface);
~RenderSettings();
private:
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
{
}
-const sinfg::Rect&
+const synfig::Rect&
Renderer_BBox::get_bbox()
{
return get_work_area()->get_canvas_view()->get_bbox();
if(!get_work_area())
return;
-// const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+// const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
// std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
-// const sinfg::Vector::value_type
+// const synfig::Vector::value_type
// x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
// y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
// const int
// tile_w(get_work_area()->get_tile_w()),
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- //const sinfg::Vector grid_size(get_grid_size());
+ //const synfig::Vector grid_size(get_grid_size());
- const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-// const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
- const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-// const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+ const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+// const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+ const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+// const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
const float pw(get_pw()),ph(get_ph());
- const sinfg::Point curr_point(get_bbox().get_min());
- const sinfg::Point drag_point(get_bbox().get_max());
+ const synfig::Point curr_point(get_bbox().get_min());
+ const synfig::Point drag_point(get_bbox().get_max());
if(get_bbox().area()<10000000000000000.0)
{
gc->set_function(Gdk::INVERT);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file renderer_bbox.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_BBOX_H
-#define __SINFG_RENDERER_BBOX_H
+#ifndef __SYNFIG_RENDERER_BBOX_H
+#define __SYNFIG_RENDERER_BBOX_H
/* === H E A D E R S ======================================================= */
#include "workarearenderer.h"
#include <vector>
-#include <sinfg/vector.h>
-#include <sinfg/rect.h>
+#include <synfig/vector.h>
+#include <synfig/rect.h>
/* === M A C R O S ========================================================= */
class Renderer_BBox : public studio::WorkAreaRenderer
{
- sinfg::Rect bbox;
+ synfig::Rect bbox;
public:
Renderer_BBox();
~Renderer_BBox();
- const sinfg::Rect& get_bbox();
+ const synfig::Rect& get_bbox();
void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
if(!get_work_area())
return;
-// const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+// const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
- const sinfg::Vector::value_type
+ const synfig::Vector::value_type
x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
const int
tile_w(get_work_area()->get_tile_w()),
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_CANVAS_H
-#define __SINFG_RENDERER_CANVAS_H
+#ifndef __SYNFIG_RENDERER_CANVAS_H
+#define __SYNFIG_RENDERER_CANVAS_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
{
}
-const sinfg::Point&
+const synfig::Point&
Renderer_Dragbox::get_drag_point()const
{
return get_work_area()->get_drag_point();
}
-const sinfg::Point&
+const synfig::Point&
Renderer_Dragbox::get_curr_point()const
{
return get_work_area()->get_cursor_pos();
if(!get_work_area())
return;
- const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+ const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
// std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
- const sinfg::Vector::value_type
+ const synfig::Vector::value_type
x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
const int
tile_w(get_work_area()->get_tile_w()),
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- //const sinfg::Vector grid_size(get_grid_size());
+ //const synfig::Vector grid_size(get_grid_size());
- const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
- const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
- const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
- const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+ const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+ const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+ const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+ const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
const float pw(get_pw()),ph(get_ph());
- const sinfg::Point& curr_point(get_curr_point());
- const sinfg::Point& drag_point(get_drag_point());
+ const synfig::Point& curr_point(get_curr_point());
+ const synfig::Point& drag_point(get_drag_point());
{
gc->set_function(Gdk::COPY);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_DRAGBOX_H
-#define __SINFG_RENDERER_DRAGBOX_H
+#ifndef __SYNFIG_RENDERER_DRAGBOX_H
+#define __SYNFIG_RENDERER_DRAGBOX_H
/* === H E A D E R S ======================================================= */
#include "workarearenderer.h"
#include <vector>
-#include <sinfg/vector.h>
+#include <synfig/vector.h>
/* === M A C R O S ========================================================= */
void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
- const sinfg::Point& get_drag_point()const;
- const sinfg::Point& get_curr_point()const;
+ const synfig::Point& get_drag_point()const;
+ const synfig::Point& get_curr_point()const;
protected:
bool get_enabled_vfunc()const;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#include <ETL/bezier>
#include <ETL/misc>
#include "widget_color.h"
-#include <sinfg/distance.h>
+#include <synfig/distance.h>
#include "app.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
struct ScreenDuck
{
- sinfg::Point pos;
+ synfig::Point pos;
Gdk::Color color;
bool selected;
bool hover;
if(!get_work_area())
return;
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
int drawable_w,drawable_h;
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
- const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+ const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+ const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
const float pw(get_pw()),ph(get_ph());
{
Point window_start(window_startx,window_starty);
vector<Gdk::Point> points;
- std::list<sinfg::Point>::iterator iter2;
+ std::list<synfig::Point>::iterator iter2;
Point holder;
for(iter2=(*iter)->stroke_data->begin();iter2!=(*iter)->stroke_data->end();++iter2)
points.push_back(Gdk::Point(round_to_int(holder[0]),round_to_int(holder[1])));
}
- gc->set_rgb_fg_color(colorconv_sinfg2gdk((*iter)->color));
+ gc->set_rgb_fg_color(colorconv_synfig2gdk((*iter)->color));
gc->set_function(Gdk::COPY);
gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
if(get_work_area()->get_selected_value_node())
{
- sinfgapp::ValueDesc value_desc((*iter)->get_value_desc());
+ synfigapp::ValueDesc value_desc((*iter)->get_value_desc());
if(value_desc.is_valid() && value_desc.is_value_node() && get_work_area()->get_selected_value_node()==value_desc.get_value_node())
{
gc->set_function(Gdk::COPY);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_DUCKS_H
-#define __SINFG_RENDERER_DUCKS_H
+#ifndef __SYNFIG_RENDERER_DUCKS_H
+#define __SYNFIG_RENDERER_DUCKS_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
return get_work_area()->grid_status();
}
-sinfg::Vector
+synfig::Vector
Renderer_Grid::get_grid_size()const
{
return get_work_area()->get_grid_size();
if(!get_work_area())
return;
-// const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+// const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
// std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
-// const sinfg::Vector::value_type
+// const synfig::Vector::value_type
// x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
// y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
// const int
// tile_w(get_work_area()->get_tile_w()),
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- const sinfg::Vector grid_size(get_grid_size());
+ const synfig::Vector grid_size(get_grid_size());
- const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
- const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
- const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
- const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+ const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+ const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+ const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+ const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
const float pw(get_pw()),ph(get_ph());
// Draw out the grid
if(grid_size[0]>pw*3.5 && grid_size[1]>ph*3.5)
{
- sinfg::Vector::value_type x,y;
+ synfig::Vector::value_type x,y;
x=floor(window_startx/grid_size[0])*grid_size[0];
y=floor(window_starty/grid_size[1])*grid_size[1];
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_GRID_H
-#define __SINFG_RENDERER_GRID_H
+#ifndef __SYNFIG_RENDERER_GRID_H
+#define __SYNFIG_RENDERER_GRID_H
/* === H E A D E R S ======================================================= */
public:
~Renderer_Grid();
- sinfg::Vector get_grid_size()const;
+ synfig::Vector get_grid_size()const;
void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
bool
Renderer_Guides::event_vfunc(GdkEvent* event)
{
- sinfg::Point mouse_pos;
+ synfig::Point mouse_pos;
float bezier_click_pos;
const float radius((abs(get_pw())+abs(get_ph()))*4);
int button_pressed(0);
// and the buttons
if(!event->button.axes)
{
- mouse_pos=sinfg::Point(screen_to_comp_coords(sinfg::Point(event->button.x,event->button.y)));
+ mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(event->button.x,event->button.y)));
button_pressed=event->button.button;
pressure=1.0f;
is_mouse=true;
return false;
pressure=event->button.axes[2];
- //sinfg::info("pressure=%f",pressure);
+ //synfig::info("pressure=%f",pressure);
pressure-=0.04f;
pressure/=1.0f-0.04f;
assert(!isnan(pressure));
- mouse_pos=sinfg::Point(screen_to_comp_coords(sinfg::Point(x,y)));
+ mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)));
button_pressed=event->button.button;
pressure=0;
//if(event->any.type==GDK_BUTTON_PRESS && button_pressed)
- // sinfg::info("Button pressed on input device = %d",event->button.button);
+ // synfig::info("Button pressed on input device = %d",event->button.button);
//if(event->button.axes[2]>0.1)
// button_pressed=1;
if(!get_work_area())
return;
- const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+ const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
//std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
- const sinfg::Vector::value_type
+ const synfig::Vector::value_type
x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
const int
tile_w(get_work_area()->get_tile_w()),
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- //const sinfg::Vector grid_size(get_grid_size());
+ //const synfig::Vector grid_size(get_grid_size());
- const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
- const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
- const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
- const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+ const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+ const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+ const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+ const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
const float pw(get_pw()),ph(get_ph());
// Draw out the guides
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_GUIDES_H
-#define __SINFG_RENDERER_GUIDES_H
+#ifndef __SYNFIG_RENDERER_GUIDES_H
+#define __SYNFIG_RENDERER_GUIDES_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
canvas->get_time()!=canvas->rend_desc().get_time_start());
}
-sinfg::Vector
+synfig::Vector
Renderer_Timecode::get_grid_size()const
{
return get_work_area()->get_grid_size();
if(!get_work_area())
return;
- //const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+ //const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_work_area()->get_focus_point());
+ const synfig::Vector focus_point(get_work_area()->get_focus_point());
//std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
// Calculate the window coordinates of the top-left
// corner of the canvas.
-// const sinfg::Vector::value_type
+// const synfig::Vector::value_type
// x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
// y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
- /*const sinfg::Vector::value_type window_startx(window_tl[0]);
- const sinfg::Vector::value_type window_endx(window_br[0]);
- const sinfg::Vector::value_type window_starty(window_tl[1]);
- const sinfg::Vector::value_type window_endy(window_br[1]);
+ /*const synfig::Vector::value_type window_startx(window_tl[0]);
+ const synfig::Vector::value_type window_endx(window_br[0]);
+ const synfig::Vector::value_type window_starty(window_tl[1]);
+ const synfig::Vector::value_type window_endy(window_br[1]);
*/
// const int
// tile_w(get_work_area()->get_tile_w()),
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
- //const sinfg::Vector grid_size(get_grid_size());
+ //const synfig::Vector grid_size(get_grid_size());
-// const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-// const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-// const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-// const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+// const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+// const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+// const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+// const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
// const float pw(get_pw()),ph(get_ph());
Canvas::Handle canvas(get_work_area()->get_canvas());
- sinfg::Time cur_time(canvas->get_time());
+ synfig::Time cur_time(canvas->get_time());
// Print out the timecode
{
timecode+="\n"+canvas->keyframe_list().find(cur_time)->get_description();
gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
}
- catch(sinfg::Exception::NotFound)
+ catch(synfig::Exception::NotFound)
{
return;
gc->set_rgb_fg_color(Gdk::Color("#000000"));
{
layout->set_text(canvas->keyframe_list().find(cur_time)->get_description());
}
- catch(sinfg::Exception::NotFound)
+ catch(synfig::Exception::NotFound)
{
return;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_RENDERER_TIMECODE_H
-#define __SINFG_RENDERER_TIMECODE_H
+#ifndef __SYNFIG_RENDERER_TIMECODE_H
+#define __SYNFIG_RENDERER_TIMECODE_H
/* === H E A D E R S ======================================================= */
public:
~Renderer_Timecode();
- sinfg::Vector get_grid_size()const;
+ synfig::Vector get_grid_size()const;
void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_SMACH_H
-#define __SINFG_SMACH_H
+#ifndef __SYNFIG_SMACH_H
+#define __SYNFIG_SMACH_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file rotoscope_bline.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
+#include <synfig/valuenode_dynamiclist.h>
#include "state_bline.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfg/valuenode_bline.h>
+#include <synfig/valuenode_bline.h>
#include <ETL/hermite>
#include <ETL/calculus>
#include <utility>
#include "toolbox.h"
#include "dialog_tooloptions.h"
#include <gtkmm/spinbutton.h>
-#include <sinfg/transform.h>
-#include <sinfgapp/main.h>
+#include <synfig/transform.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
etl::handle<Duck> next_duck;
- std::list<sinfg::ValueNode_Const::Handle> bline_point_list;
- sinfgapp::Settings& settings;
+ std::list<synfig::ValueNode_Const::Handle> bline_point_list;
+ synfigapp::Settings& settings;
- bool on_vertex_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node);
- bool on_tangent1_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node);
- bool on_tangent2_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node);
+ bool on_vertex_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node);
+ bool on_tangent1_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node);
+ bool on_tangent2_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node);
- void popup_handle_menu(sinfg::ValueNode_Const::Handle value_node);
- void popup_vertex_menu(sinfg::ValueNode_Const::Handle value_node);
- void popup_bezier_menu(float location, sinfg::ValueNode_Const::Handle value_node);
+ void popup_handle_menu(synfig::ValueNode_Const::Handle value_node);
+ void popup_vertex_menu(synfig::ValueNode_Const::Handle value_node);
+ void popup_bezier_menu(float location, synfig::ValueNode_Const::Handle value_node);
- void bline_detach_handle(sinfg::ValueNode_Const::Handle value_node);
- void bline_attach_handle(sinfg::ValueNode_Const::Handle value_node);
- void bline_delete_vertex(sinfg::ValueNode_Const::Handle value_node);
- void bline_insert_vertex(sinfg::ValueNode_Const::Handle value_node,float origin=0.5);
+ void bline_detach_handle(synfig::ValueNode_Const::Handle value_node);
+ void bline_attach_handle(synfig::ValueNode_Const::Handle value_node);
+ void bline_delete_vertex(synfig::ValueNode_Const::Handle value_node);
+ void bline_insert_vertex(synfig::ValueNode_Const::Handle value_node,float origin=0.5);
void loop_bline();
void refresh_ducks(bool x=true);
Real get_feather() const { return adj_feather.get_value(); }
void set_feather(Real x) { return adj_feather.set_value(x); }
- sinfg::String get_id()const { return entry_id.get_text(); }
- void set_id(const sinfg::String& x) { return entry_id.set_text(x); }
+ synfig::String get_id()const { return entry_id.get_text(); }
+ void set_id(const synfig::String& x) { return entry_id.set_text(x); }
Smach::event_result event_stop_handler(const Smach::event& x);
~StateBLine_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
- const sinfg::TransformStack& get_transform_stack()const { return canvas_view_->get_curr_transform_stack(); }
+ const synfig::TransformStack& get_transform_stack()const { return canvas_view_->get_curr_transform_stack(); }
void load_settings();
void save_settings();
void reset();
void increment_id();
- //void on_user_click(sinfg::Point point);
+ //void on_user_click(synfig::Point point);
bool run_();
bool run();
String str_number;
str_number=String(id,id.size()-digits,id.size());
id=String(id,0,id.size()-digits);
- sinfg::info("---------------- \"%s\"",str_number.c_str());
+ synfig::info("---------------- \"%s\"",str_number.c_str());
number=atoi(str_number.c_str());
}
loop_(false),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
duckmatic_push(get_work_area()),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
entry_id(),
checkbutton_layer_region(_("Fill")),
checkbutton_layer_bline(_("Outline")),
Smach::event_result
StateBLine_Context::event_stop_handler(const Smach::event& x)
{
- sinfg::info("STATE RotoBLine: Received Stop Event");
+ synfig::info("STATE RotoBLine: Received Stop Event");
// run();
reset();
// throw Smach::egress_exception();
Smach::event_result
StateBLine_Context::event_refresh_handler(const Smach::event& x)
{
- sinfg::info("STATE RotoBLine: Received Refresh Event");
+ synfig::info("STATE RotoBLine: Received Refresh Event");
refresh_ducks();
return Smach::RESULT_ACCEPT;
}
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New BLine"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New BLine"));
std::vector<BLinePoint> new_list;
- std::list<sinfg::ValueNode_Const::Handle>::iterator iter;
- const sinfg::TransformStack& transform(get_transform_stack());
+ std::list<synfig::ValueNode_Const::Handle>::iterator iter;
+ const synfig::TransformStack& transform(get_transform_stack());
for(iter=bline_point_list.begin();iter!=bline_point_list.end();++iter)
{
if(!canvas)
canvas=get_canvas_view()->get_canvas();
- sinfgapp::SelectionManager::LayerList layer_selection;
+ synfigapp::SelectionManager::LayerList layer_selection;
// If we were asked to create a region layer, go ahead and do so
if(get_layer_region_flag())
{
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("region",canvas,depth));
layer_selection.push_back(layer);
}
if(get_layer_bline_flag())
- layer->set_param("color",sinfgapp::Main::get_background_color());
+ layer->set_param("color",synfigapp::Main::get_background_color());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("bline")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
// If we were asked to create a BLine layer, go ahead and do so
if(get_layer_bline_flag())
{
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("outline",canvas,depth));
layer_selection.push_back(layer);
assert(layer);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("bline")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
/*if(get_layer_region_flag() && !get_auto_export_flag())
{
- get_canvas_interface()->auto_export(sinfgapp::ValueDesc(layer,"bline"));
+ get_canvas_interface()->auto_export(synfigapp::ValueDesc(layer,"bline"));
}*/
}
// If we were asked to create a CurveGradient layer, go ahead and do so
if(get_layer_curve_gradient_flag())
{
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("curve_gradient",canvas,depth));
layer_selection.push_back(layer);
assert(layer);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("bline")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
/*if(get_layer_region_flag() && !get_auto_export_flag())
{
- get_canvas_interface()->auto_export(sinfgapp::ValueDesc(layer,"bline"));
+ get_canvas_interface()->auto_export(synfigapp::ValueDesc(layer,"bline"));
}*/
}
if(curr_duck)
{
- //sinfg::info("Moved Duck");
+ //synfig::info("Moved Duck");
Point p(get_work_area()->snap_point_to_grid(event.pos));
curr_duck->set_trans_point(p);
if(next_duck)
{
if(curr_duck)
{
- //sinfg::info("Released current duck");
+ //synfig::info("Released current duck");
curr_duck->signal_edited()(curr_duck->get_point());
if(next_duck)
{
- //sinfg::info("grabbing next duck");
+ //synfig::info("grabbing next duck");
curr_duck=next_duck;
next_duck=0;
}
Smach::event_result
StateBLine_Context::event_mouse_click_handler(const Smach::event& x)
{
- sinfg::info("STATE BLINE: Received mouse button down Event");
+ synfig::info("STATE BLINE: Received mouse button down Event");
const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
switch(event.button)
{
BLinePoint bline_point;
bline_point.set_vertex(get_work_area()->snap_point_to_grid(event.pos));
- //bline_point.set_width(sinfgapp::Main::get_bline_width());
+ //bline_point.set_width(synfigapp::Main::get_bline_width());
bline_point.set_width(1.0f);
bline_point.set_origin(0.5f);
bline_point.set_split_tangent_flag(false);
if(bline_point_list.size()>1)
{
- std::list<sinfg::ValueNode_Const::Handle>::iterator iter;
+ std::list<synfig::ValueNode_Const::Handle>::iterator iter;
iter=bline_point_list.end();
iter--;iter--;
BLinePoint prev(bline_point_list.back()->get_value().get(BLinePoint()));
bool
-StateBLine_Context::on_vertex_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::on_vertex_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node)
{
BLinePoint bline_point(value_node->get_value().get(BLinePoint()));
bline_point.set_vertex(point);
}
bool
-StateBLine_Context::on_tangent1_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::on_tangent1_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node)
{
BLinePoint bline_point(value_node->get_value().get(BLinePoint()));
bline_point.set_tangent1(point);
}
bool
-StateBLine_Context::on_tangent2_change(const sinfg::Point &point, sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::on_tangent2_change(const synfig::Point &point, synfig::ValueNode_Const::Handle value_node)
{
BLinePoint bline_point(value_node->get_value().get(BLinePoint()));
bline_point.set_tangent2(point);
}
void
-StateBLine_Context::popup_vertex_menu(sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::popup_vertex_menu(synfig::ValueNode_Const::Handle value_node)
{
menu.items().clear();
}
void
-StateBLine_Context::popup_bezier_menu(float location, sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::popup_bezier_menu(float location, synfig::ValueNode_Const::Handle value_node)
{
menu.items().clear();
}
void
-StateBLine_Context::bline_insert_vertex(sinfg::ValueNode_Const::Handle value_node, float origin)
+StateBLine_Context::bline_insert_vertex(synfig::ValueNode_Const::Handle value_node, float origin)
{
list<ValueNode_Const::Handle>::iterator iter;
}
void
-StateBLine_Context::bline_delete_vertex(sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::bline_delete_vertex(synfig::ValueNode_Const::Handle value_node)
{
list<ValueNode_Const::Handle>::iterator iter;
}
void
-StateBLine_Context::popup_handle_menu(sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::popup_handle_menu(synfig::ValueNode_Const::Handle value_node)
{
menu.items().clear();
}
void
-StateBLine_Context::bline_detach_handle(sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::bline_detach_handle(synfig::ValueNode_Const::Handle value_node)
{
BLinePoint bline_point(value_node->get_value().get(BLinePoint()));
bline_point.set_split_tangent_flag(true);
}
void
-StateBLine_Context::bline_attach_handle(sinfg::ValueNode_Const::Handle value_node)
+StateBLine_Context::bline_attach_handle(synfig::ValueNode_Const::Handle value_node)
{
BLinePoint bline_point(value_node->get_value().get(BLinePoint()));
bline_point.set_tangent1((bline_point.get_tangent1()+bline_point.get_tangent2())*0.5);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file rotoscope_bline.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_ROTOSCOPE_BLINE_H
-#define __SINFG_STUDIO_ROTOSCOPE_BLINE_H
+#ifndef __SYNFIG_STUDIO_ROTOSCOPE_BLINE_H
+#define __SYNFIG_STUDIO_ROTOSCOPE_BLINE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_circle.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_circle.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
#include "widget_enum.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
bool prev_workarea_layer_status_;
//Toolbox settings
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
//Toolbox display
Gtk::Table options_table;
public:
- sinfg::String get_id()const { return entry_id.get_text(); }
- void set_id(const sinfg::String& x) { return entry_id.set_text(x); }
+ synfig::String get_id()const { return entry_id.get_text(); }
+ void set_id(const synfig::String& x) { return entry_id.set_text(x); }
int get_falloff()const { return enum_falloff.get_value(); }
void set_falloff(int x) { return enum_falloff.set_value(x); }
//Canvas interaction
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
//Modifying settings etc.
is_working(*canvas_view),
duckmatic_push(get_work_area()),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
entry_id(),
adj_feather(0,0,1,0.01,0.1),
spin_feather(adj_feather,0.1,3),
void
StateCircle_Context::make_circle(const Point& _p1, const Point& _p2)
{
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Circle"));
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Circle"));
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer;
canvas=layer->get_canvas();
}
- const sinfg::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
+ const synfig::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
const Point p1(transform.unperform(_p1));
const Point p2(transform.unperform(_p2));
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_circle.h
** \brief Circle creation state
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_CIRCLE_H
-#define __SINFG_STUDIO_STATE_CIRCLE_H
+#ifndef __SYNFIG_STUDIO_STATE_CIRCLE_H
+#define __SYNFIG_STUDIO_STATE_CIRCLE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file rotoscope_bline.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
+#include <synfig/valuenode_dynamiclist.h>
#include "state_draw.h"
#include "state_stroke.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfg/valuenode_bline.h>
-#include <sinfg/valuenode_composite.h>
+#include <synfig/valuenode_bline.h>
+#include <synfig/valuenode_composite.h>
#include <ETL/hermite>
#include <ETL/calculus>
#include <utility>
#include "event_layerclick.h"
#include "toolbox.h"
-#include <sinfgapp/blineconvert.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/blineconvert.h>
+#include <synfigapp/main.h>
#include <ETL/gaussian>
#include "dialog_tooloptions.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
class studio::StateDraw_Context : public sigc::trackable
{
- typedef etl::smart_ptr<std::list<sinfg::Point> > StrokeData;
- typedef etl::smart_ptr<std::list<sinfg::Real> > WidthData;
+ typedef etl::smart_ptr<std::list<synfig::Point> > StrokeData;
+ typedef etl::smart_ptr<std::list<synfig::Real> > WidthData;
typedef list< pair<StrokeData,WidthData> > StrokeQueue;
//Duckmatic::Push duckmatic_push;
- std::list< etl::smart_ptr<std::list<sinfg::Point> > > stroke_list;
+ std::list< etl::smart_ptr<std::list<synfig::Point> > > stroke_list;
void refresh_ducks();
void fill_last_stroke();
- Smach::event_result new_bline(std::list<sinfg::BLinePoint> bline,bool loop_bline_flag,float radius);
+ Smach::event_result new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline_flag,float radius);
- Smach::event_result new_region(std::list<sinfg::BLinePoint> bline,sinfg::Real radius);
+ Smach::event_result new_region(std::list<synfig::BLinePoint> bline,synfig::Real radius);
- Smach::event_result extend_bline_from_begin(ValueNode_BLine::Handle value_node,std::list<sinfg::BLinePoint> bline);
- Smach::event_result extend_bline_from_end(ValueNode_BLine::Handle value_node,std::list<sinfg::BLinePoint> bline);
- void reverse_bline(std::list<sinfg::BLinePoint> &bline);
+ Smach::event_result extend_bline_from_begin(ValueNode_BLine::Handle value_node,std::list<synfig::BLinePoint> bline);
+ Smach::event_result extend_bline_from_end(ValueNode_BLine::Handle value_node,std::list<synfig::BLinePoint> bline);
+ void reverse_bline(std::list<synfig::BLinePoint> &bline);
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
Gtk::Table options_table;
Gtk::CheckButton checkbutton_pressure_width;
void UpdateErrorBox(); //switches the stuff if need be :)
//Added by Adrian - data drive HOOOOO
- sinfgapp::BLineConverter blineconv;
+ synfigapp::BLineConverter blineconv;
public:
bool get_pressure_width_flag()const { return checkbutton_pressure_width.get_active(); }
~StateDraw_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Time get_time()const { return get_canvas_interface()->get_time(); }
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Time get_time()const { return get_canvas_interface()->get_time(); }
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
- //void on_user_click(sinfg::Point point);
+ //void on_user_click(synfig::Point point);
// bool run();
}; // END of class StateDraw_Context
is_working(*canvas_view),
loop_(false),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
checkbutton_pressure_width(_("Pressure Width")),
checkbutton_auto_loop(_("Auto Loop")),
checkbutton_auto_connect(_("Auto Connect")),
check_localerror(_("LocalError"))
{
- sinfg::info("STATE SKETCH: entering state");
+ synfig::info("STATE SKETCH: entering state");
nested=0;
load_settings();
App::dialog_tool_options->set_name("draw");
App::dialog_tool_options->add_button(
- Gtk::StockID("sinfg-fill"),
+ Gtk::StockID("synfig-fill"),
_("Fill Last Stroke")
)->signal_clicked().connect(
sigc::mem_fun(
struct debugclass
{
- sinfg::String x;
- debugclass(const sinfg::String &x):x(x)
+ synfig::String x;
+ debugclass(const synfig::String &x):x(x)
{
-// sinfg::warning(">>>>>>>>>>>>>>>>>>> "+x);
+// synfig::warning(">>>>>>>>>>>>>>>>>>> "+x);
}
~debugclass()
{
-// sinfg::warning("<<<<<<<<<<<<<<<<<<< "+x);
+// synfig::warning("<<<<<<<<<<<<<<<<<<< "+x);
}
};
assert(event.stroke_data);
- get_work_area()->add_stroke(event.stroke_data,sinfgapp::Main::get_foreground_color());
+ get_work_area()->add_stroke(event.stroke_data,synfigapp::Main::get_foreground_color());
if(nested==0)
{
// debugclass debugger("StateDraw_Context::process_stroke");
DepthCounter depth_counter(nested);
- const float radius(sinfgapp::Main::get_bline_width().units(get_canvas()->rend_desc())+(abs(get_work_area()->get_pw())+abs(get_work_area()->get_ph()))*5);
+ const float radius(synfigapp::Main::get_bline_width().units(get_canvas()->rend_desc())+(abs(get_work_area()->get_pw())+abs(get_work_area()->get_ph()))*5);
// If we aren't using pressure width,
// then set all the width to 1
if(!get_pressure_width_flag())
{
- std::list<sinfg::Real>::iterator iter;
+ std::list<synfig::Real>::iterator iter;
for(iter=width_data->begin();iter!=width_data->end();++iter)
{
*iter=1.0;
}
}
- //get_work_area()->add_stroke(event.stroke_data,sinfgapp::Main::get_foreground_color());
+ //get_work_area()->add_stroke(event.stroke_data,synfigapp::Main::get_foreground_color());
//stroke_list.push_back(event.stroke_data);
//refresh_ducks();
- std::list<sinfg::BLinePoint> bline;
+ std::list<synfig::BLinePoint> bline;
bool loop_bline_flag(false);
//Changed by Adrian - use resident class :)
- //sinfgapp::convert_stroke_to_bline(bline, *event.stroke_data,*event.width_data, sinfgapp::Main::get_bline_width());
- blineconv.width = sinfgapp::Main::get_bline_width().units(get_canvas()->rend_desc());
+ //synfigapp::convert_stroke_to_bline(bline, *event.stroke_data,*event.width_data, synfigapp::Main::get_bline_width());
+ blineconv.width = synfigapp::Main::get_bline_width().units(get_canvas()->rend_desc());
if(get_local_error_flag())
{
//Postprocess to require minimum pressure
if(get_min_pressure_flag())
{
- sinfgapp::BLineConverter::EnforceMinWidth(bline,get_min_pressure());
+ synfigapp::BLineConverter::EnforceMinWidth(bline,get_min_pressure());
}
// If the start and end points are similar, then make then the same point
}
Smach::event_result
-StateDraw_Context::new_bline(std::list<sinfg::BLinePoint> bline,bool loop_bline_flag,float radius)
+StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline_flag,float radius)
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch BLine"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch BLine"));
- //ValueNode_BLine::Handle value_node(ValueNode_BLine::create(sinfg::ValueBase(bline,loop_bline_flag)));
+ //ValueNode_BLine::Handle value_node(ValueNode_BLine::create(synfig::ValueBase(bline,loop_bline_flag)));
ValueNode_BLine::Handle value_node;
{
- std::list<sinfg::BLinePoint> trans_bline;
- std::list<sinfg::BLinePoint>::iterator iter;
- const sinfg::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
+ std::list<synfig::BLinePoint> trans_bline;
+ std::list<synfig::BLinePoint>::iterator iter;
+ const synfig::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
for(iter=bline.begin();iter!=bline.end();++iter)
{
trans_bline.push_back(bline_point);
}
- value_node=ValueNode_BLine::create(sinfg::ValueBase(trans_bline,loop_bline_flag));
+ value_node=ValueNode_BLine::create(synfig::ValueBase(trans_bline,loop_bline_flag));
}
// Find any ducks at the start or end that we might attach to
if(start_duck)do
{
- sinfgapp::ValueDesc value_desc(start_duck->get_value_desc());
+ synfigapp::ValueDesc value_desc(start_duck->get_value_desc());
if(!value_desc)
{
break;
switch(value_desc.get_value_type())
{
- case sinfg::ValueBase::TYPE_BLINEPOINT:
+ case synfig::ValueBase::TYPE_BLINEPOINT:
//get_canvas_interface()->auto_export(value_desc);
//value_node->list.front().value_node=value_desc.get_value_node();
- value_desc=sinfgapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(value_desc.get_value_node()),0);
+ value_desc=synfigapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(value_desc.get_value_node()),0);
//break;
- case sinfg::ValueBase::TYPE_VECTOR:
+ case synfig::ValueBase::TYPE_VECTOR:
get_canvas_interface()->auto_export(value_desc);
LinkableValueNode::Handle::cast_dynamic(value_node->list.front().value_node)->set_link(0,value_desc.get_value_node());
break;
if(finish_duck)do
{
- sinfgapp::ValueDesc value_desc(finish_duck->get_value_desc());
+ synfigapp::ValueDesc value_desc(finish_duck->get_value_desc());
if(!value_desc)
{
break;
switch(value_desc.get_value_type())
{
- case sinfg::ValueBase::TYPE_BLINEPOINT:
+ case synfig::ValueBase::TYPE_BLINEPOINT:
//get_canvas_interface()->auto_export(value_desc);
//value_node->list.back().value_node=value_desc.get_value_node();
- value_desc=sinfgapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(value_desc.get_value_node()),0);
+ value_desc=synfigapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(value_desc.get_value_node()),0);
//break;
- case sinfg::ValueBase::TYPE_VECTOR:
+ case synfig::ValueBase::TYPE_VECTOR:
get_canvas_interface()->auto_export(value_desc);
LinkableValueNode::Handle::cast_dynamic(value_node->list.back().value_node)->set_link(0,value_desc.get_value_node());
break;
canvas=layer->get_canvas();
}
- //int number(sinfg::UniqueID().get_uid());
+ //int number(synfig::UniqueID().get_uid());
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
if(get_region_only_flag())
layer=get_canvas_interface()->add_layer_to("region",canvas,depth);
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("bline")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(value_node)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
}
Smach::event_result
-StateDraw_Context::new_region(std::list<sinfg::BLinePoint> bline, sinfg::Real radius)
+StateDraw_Context::new_region(std::list<synfig::BLinePoint> bline, synfig::Real radius)
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Define Region"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Define Region"));
- std::list<sinfgapp::ValueDesc> vertex_list;
+ std::list<synfigapp::ValueDesc> vertex_list;
// First we need to come up with a rough list of
// BLinePoints that we are going to be using to
// define our region.
{
- std::list<sinfg::BLinePoint>::iterator iter;
+ std::list<synfig::BLinePoint>::iterator iter;
for(iter=bline.begin();iter!=bline.end();++iter)
{
etl::handle<Duck> duck(get_work_area()->find_duck(iter->get_vertex(),0,Duck::TYPE_VERTEX));
if(!duck)
{
- sinfg::info(__FILE__":%d: Nothing to enclose!",__LINE__);
+ synfig::info(__FILE__":%d: Nothing to enclose!",__LINE__);
return Smach::RESULT_OK;
}
assert(duck->get_type()==Duck::TYPE_VERTEX);
- sinfgapp::ValueDesc value_desc(duck->get_value_desc());
+ synfigapp::ValueDesc value_desc(duck->get_value_desc());
if(!value_desc)
{
- sinfg::info(__FILE__":%d: Got a hit, but no ValueDesc on this duck",__LINE__);
+ synfig::info(__FILE__":%d: Got a hit, but no ValueDesc on this duck",__LINE__);
continue;
}
switch(value_desc.get_value_type())
{
- case sinfg::ValueBase::TYPE_BLINEPOINT:
+ case synfig::ValueBase::TYPE_BLINEPOINT:
//if(vertex_list.empty() || value_desc!=vertex_list.back())
vertex_list.push_back(value_desc);
assert(vertex_list.back().is_valid());
if(vertex_list.size()<=2)
{
- sinfg::info(__FILE__":%d: Vertex list too small to make region.",__LINE__);
+ synfig::info(__FILE__":%d: Vertex list too small to make region.",__LINE__);
return Smach::RESULT_OK;
}
// change it back to false.
done=true;
- std::list<sinfgapp::ValueDesc>::iterator prev,iter,next;
+ std::list<synfigapp::ValueDesc>::iterator prev,iter,next;
prev=vertex_list.end();prev--; // Set prev to the last ValueDesc
next=vertex_list.begin();
iter=next++; // Set iter to the first value desc, and next to the second
for(;iter!=vertex_list.end();prev=iter,iter=next++)
{
- sinfgapp::ValueDesc value_prev(*prev);
- sinfgapp::ValueDesc value_desc(*iter);
- sinfgapp::ValueDesc value_next((next==vertex_list.end())?vertex_list.front():*next);
+ synfigapp::ValueDesc value_prev(*prev);
+ synfigapp::ValueDesc value_desc(*iter);
+ synfigapp::ValueDesc value_next((next==vertex_list.end())?vertex_list.front():*next);
assert(value_desc.is_valid());
assert(value_next.is_valid());
assert(value_prev.is_valid());
- //sinfg::info("-------");
- //sinfg::info(__FILE__":%d: value_prev 0x%08X:%d",__LINE__,value_prev.get_parent_value_node().get(),value_prev.get_index());
- //sinfg::info(__FILE__":%d: value_desc 0x%08X:%d",__LINE__,value_desc.get_parent_value_node().get(),value_desc.get_index());
- //sinfg::info(__FILE__":%d: value_next 0x%08X:%d",__LINE__,value_next.get_parent_value_node().get(),value_next.get_index());
+ //synfig::info("-------");
+ //synfig::info(__FILE__":%d: value_prev 0x%08X:%d",__LINE__,value_prev.get_parent_value_node().get(),value_prev.get_index());
+ //synfig::info(__FILE__":%d: value_desc 0x%08X:%d",__LINE__,value_desc.get_parent_value_node().get(),value_desc.get_index());
+ //synfig::info(__FILE__":%d: value_next 0x%08X:%d",__LINE__,value_next.get_parent_value_node().get(),value_next.get_index());
/*
if(value_prev.parent_is_value_node() && value_desc.parent_is_value_node() && value_next.parent_is_value_node())
if(value_desc.get_index()<value_next.get_index()-1)
{
DEBUGPOINT();
- vertex_list.insert(next,sinfgapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1));
+ vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1));
done=false;
break;
}
if(value_next.get_index()<value_desc.get_index()-1)
{
DEBUGPOINT();
- vertex_list.insert(next,sinfgapp::ValueDesc(value_desc.get_parent_value_node(),value_next.get_index()+1));
+ vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_next.get_index()+1));
done=false;
break;
}
BLinePoint vertex(value_desc.get_value(get_time()).get(BLinePoint()));
BLinePoint vertex_next(value_next.get_value(get_time()).get(BLinePoint()));
- //sinfg::info("--------");
- //sinfg::info(__FILE__":%d: vertex: [%f, %f]",__LINE__,vertex.get_vertex()[0],vertex.get_vertex()[1]);
- //sinfg::info(__FILE__":%d: vertex_next: [%f, %f]",__LINE__,vertex_next.get_vertex()[0],vertex_next.get_vertex()[1]);
+ //synfig::info("--------");
+ //synfig::info(__FILE__":%d: vertex: [%f, %f]",__LINE__,vertex.get_vertex()[0],vertex.get_vertex()[1]);
+ //synfig::info(__FILE__":%d: vertex_next: [%f, %f]",__LINE__,vertex_next.get_vertex()[0],vertex_next.get_vertex()[1]);
if((vertex.get_vertex()-vertex_next.get_vertex()).mag_squared()<radius*radius)
{
value_node_next=ValueNode_Composite::Handle::cast_dynamic(value_next.get_value_node().clone());
if(!value_node || !value_node_next)
{
- sinfg::info(__FILE__":%d: Unable to properly connect blines.",__LINE__);
+ synfig::info(__FILE__":%d: Unable to properly connect blines.",__LINE__);
continue;
}
DEBUGPOINT();
get_canvas_interface()->auto_export(value_node);
assert(value_node->is_exported());
- *iter=sinfgapp::ValueDesc(get_canvas(),value_node->get_id());
+ *iter=synfigapp::ValueDesc(get_canvas(),value_node->get_id());
vertex_list.erase(next);
done=false;
break;
if(!positive_trend && value_desc.get_index()>0)
{
DEBUGPOINT();
- vertex_list.insert(next,sinfgapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()-1));
+ vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()-1));
done=false;
break;
}
if(positive_trend && value_desc.get_index()<LinkableValueNode::Handle::cast_static(value_desc.get_value_node())->link_count()-1)
{
DEBUGPOINT();
- vertex_list.insert(next,sinfgapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1));
+ vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1));
done=false;
break;
}
if(vertex_list.size()<=2)
{
- sinfg::info(__FILE__":%d: Vertex list too small to make region.",__LINE__);
+ synfig::info(__FILE__":%d: Vertex list too small to make region.",__LINE__);
return Smach::RESULT_OK;
}
trivial_case_value_node=vertex_list.front().get_parent_value_node();
- std::list<sinfgapp::ValueDesc>::iterator iter;
+ std::list<synfigapp::ValueDesc>::iterator iter;
for(iter=vertex_list.begin();iter!=vertex_list.end();++iter)
{
if(trivial_case_value_node!=iter->get_parent_value_node())
{
value_node_bline=ValueNode_BLine::create();
- std::list<sinfgapp::ValueDesc>::iterator iter;
+ std::list<synfigapp::ValueDesc>::iterator iter;
for(iter=vertex_list.begin();iter!=vertex_list.end();++iter)
{
// Ensure that the vertex is exported.
canvas=layer->get_canvas();
}
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
layer=get_canvas_interface()->add_layer_to("region",canvas,depth);
assert(layer);
- layer->set_param("color",sinfgapp::Main::get_background_color());
+ layer->set_param("color",synfigapp::Main::get_background_color());
if(get_feather())
{
layer->set_param("feather",get_feather());
}
get_canvas_interface()->signal_layer_param_changed()(layer,"color");
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("bline")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
get_work_area()->clear_ducks();
- std::list< etl::smart_ptr<std::list<sinfg::Point> > >::iterator iter;
+ std::list< etl::smart_ptr<std::list<synfig::Point> > >::iterator iter;
for(iter=stroke_list.begin();iter!=stroke_list.end();++iter)
{
Smach::event_result
-StateDraw_Context::extend_bline_from_begin(ValueNode_BLine::Handle value_node,std::list<sinfg::BLinePoint> bline)
+StateDraw_Context::extend_bline_from_begin(ValueNode_BLine::Handle value_node,std::list<synfig::BLinePoint> bline)
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Extend BLine"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Extend BLine"));
- std::list<sinfg::BLinePoint>::reverse_iterator iter;
+ std::list<synfig::BLinePoint>::reverse_iterator iter;
iter=bline.rbegin();
for(;!(iter==bline.rend());++iter)
{
//iter->reverse();
ValueNode_Composite::Handle composite(ValueNode_Composite::create(*iter));
- sinfgapp::Action::Handle action(sinfgapp::Action::create("value_node_dynamic_list_insert"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("value_node_dynamic_list_insert"));
assert(action);
- sinfgapp::ValueDesc value_desc(value_node,0);
+ synfigapp::ValueDesc value_desc(value_node,0);
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("value_desc",value_desc);
if(!action->set_param("item",ValueNode::Handle(composite)))
- sinfg::error("ACTION didn't like \"item\"");
+ synfig::error("ACTION didn't like \"item\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
}
Smach::event_result
-StateDraw_Context::extend_bline_from_end(ValueNode_BLine::Handle value_node,std::list<sinfg::BLinePoint> bline)
+StateDraw_Context::extend_bline_from_end(ValueNode_BLine::Handle value_node,std::list<synfig::BLinePoint> bline)
{
// Create the action group
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Extend BLine"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Extend BLine"));
- std::list<sinfg::BLinePoint>::iterator iter;
+ std::list<synfig::BLinePoint>::iterator iter;
iter=bline.begin();
for(;iter!=bline.end();++iter)
{
ValueNode_Composite::Handle composite(ValueNode_Composite::create(*iter));
- sinfgapp::Action::Handle action(sinfgapp::Action::create("value_node_dynamic_list_insert"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("value_node_dynamic_list_insert"));
assert(action);
- sinfgapp::ValueDesc value_desc(value_node,value_node->link_count());
+ synfigapp::ValueDesc value_desc(value_node,value_node->link_count());
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("value_desc",value_desc);
if(!action->set_param("item",ValueNode::Handle(composite)))
- sinfg::error("ACTION didn't like \"item\"");
+ synfig::error("ACTION didn't like \"item\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
}
void
-StateDraw_Context::reverse_bline(std::list<sinfg::BLinePoint> &bline)
+StateDraw_Context::reverse_bline(std::list<synfig::BLinePoint> &bline)
{
int i;
- std::list<sinfg::BLinePoint>::iterator iter,eiter;
+ std::list<synfig::BLinePoint>::iterator iter,eiter;
iter=bline.begin();
eiter=bline.end();
eiter--;
if(!last_stroke)
return;
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Fill Stroke"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Fill Stroke"));
Layer::Handle layer;
get_canvas_interface()->auto_export(last_stroke);
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
layer=get_canvas_interface()->add_layer("region");
assert(layer);
- layer->set_param("color",sinfgapp::Main::get_background_color());
+ layer->set_param("color",synfigapp::Main::get_background_color());
- sinfgapp::Action::Handle action(sinfgapp::Action::create("layer_param_connect"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
assert(action);
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("layer",layer);
if(!action->set_param("param",String("segment_list")))
- sinfg::error("LayerParamConnect didn't like \"param\"");
+ synfig::error("LayerParamConnect didn't like \"param\"");
if(!action->set_param("value_node",ValueNode::Handle(last_stroke)))
- sinfg::error("LayerParamConnect didn't like \"value_node\"");
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_roto.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_ROTOSCOPE_H
-#define __SINFG_STUDIO_STATE_ROTOSCOPE_H
+#ifndef __SYNFIG_STUDIO_STATE_ROTOSCOPE_H
+#define __SYNFIG_STUDIO_STATE_ROTOSCOPE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_eyedrop.cpp
** \brief Template File
**
#include "state_eyedrop.h"
#include "workarea.h"
-#include <sinfg/context.h>
+#include <synfig/context.h>
#include "app.h"
#include "dialog_color.h"
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "canvasview.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
canvas_view(canvas_view),
is_working(*canvas_view)
{
- sinfg::info("Enterted Eyedrop State");
+ synfig::info("Enterted Eyedrop State");
canvas_view->work_area->set_cursor(Gdk::Cursor(Gdk::CROSSHAIR));
App::toolbox->refresh();
StateEyedrop_Context::~StateEyedrop_Context()
{
- sinfg::info("Left Eyedrop State");
+ synfig::info("Left Eyedrop State");
canvas_view->work_area->reset_cursor();
App::toolbox->refresh();
}
Smach::event_result
StateEyedrop_Context::event_stop_handler(const Smach::event& x)
{
- sinfg::info("STATE EYEDROP: Received Stop Event");
+ synfig::info("STATE EYEDROP: Received Stop Event");
throw Smach::egress_exception();
// canvas_view->get_smach().pop_state();
// return Smach::RESULT_ACCEPT;
Smach::event_result
StateEyedrop_Context::event_refresh_handler(const Smach::event& x)
{
- sinfg::info("STATE EYEDROP: Received Refresh Event");
+ synfig::info("STATE EYEDROP: Received Refresh Event");
canvas_view->work_area->queue_render_preview();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateEyedrop_Context::event_workarea_mouse_button_down_handler(const Smach::event& x)
{
- sinfg::info("STATE EYEDROP: Received mouse button down Event");
+ synfig::info("STATE EYEDROP: Received mouse button down Event");
const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
if(event.button==BUTTON_LEFT)
{
Color color(canvas_view->get_canvas()->get_context().get_color(event.pos));
- sinfgapp::Main::set_foreground_color(color);
+ synfigapp::Main::set_foreground_color(color);
studio::App::dialog_color->set_color(color);
return Smach::RESULT_ACCEPT;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_eyedrop.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STATE_EYEDROP_H
-#define __SINFG_STATE_EYEDROP_H
+#ifndef __SYNFIG_STATE_EYEDROP_H
+#define __SYNFIG_STATE_EYEDROP_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_fill.cpp
** \brief Template File
**
#include "state_fill.h"
#include "workarea.h"
-#include <sinfg/context.h>
+#include <synfig/context.h>
#include "app.h"
#include "dialog_color.h"
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "canvasview.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
etl::handle<CanvasView> get_canvas_view()const{return canvas_view;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view->get_canvas();}
WorkArea * get_work_area()const{return canvas_view->get_work_area();}
canvas_view(canvas_view),
is_working(*canvas_view)
{
- sinfg::info("Enterted Fill State");
+ synfig::info("Enterted Fill State");
canvas_view->work_area->set_cursor(Gdk::CROSSHAIR);
App::toolbox->refresh();
StateFill_Context::~StateFill_Context()
{
- sinfg::info("Left Fill State");
+ synfig::info("Left Fill State");
canvas_view->work_area->reset_cursor();
App::toolbox->refresh();
}
Smach::event_result
StateFill_Context::event_stop_handler(const Smach::event& x)
{
- sinfg::info("STATE FILL: Received Stop Event");
+ synfig::info("STATE FILL: Received Stop Event");
throw Smach::egress_exception();
// canvas_view->get_smach().pop_state();
// return Smach::RESULT_ACCEPT;
Smach::event_result
StateFill_Context::event_refresh_handler(const Smach::event& x)
{
- sinfg::info("STATE FILL: Received Refresh Event");
+ synfig::info("STATE FILL: Received Refresh Event");
canvas_view->work_area->queue_render_preview();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateFill_Context::event_workarea_layer_clicked_handler(const Smach::event& x)
{
- sinfg::info("STATE FILL: Received layer clicked Event");
+ synfig::info("STATE FILL: Received layer clicked Event");
const EventLayerClick& event(*reinterpret_cast<const EventLayerClick*>(&x));
if(!event.layer)
}
- //sinfgapp::Action::Handle action(sinfgapp::Action::create("value_desc_set"));
- sinfgapp::ValueDesc value_desc(event.layer,"color");
+ //synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_set"));
+ synfigapp::ValueDesc value_desc(event.layer,"color");
- if(!get_canvas_interface()->change_value(value_desc,ValueBase(sinfgapp::Main::get_foreground_color())))
+ if(!get_canvas_interface()->change_value(value_desc,ValueBase(synfigapp::Main::get_foreground_color())))
{
get_canvas_view()->get_ui_interface()->warning(_("Unable to set layer color"));
return Smach::RESULT_ERROR;
action->set_param("time",get_canvas_interface()->get_time());
//action->set_param("layer",event.layer);
//if(!action->set_param("param",String("color")))
- // sinfg::error("LayerParamConnect didn't like \"param\"");
- if(!action->set_param("new_value",ValueBase(sinfgapp::Main::get_foreground_color())))
- sinfg::error("LayerParamConnect didn't like \"foreground_color\"");
+ // synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("new_value",ValueBase(synfigapp::Main::get_foreground_color())))
+ synfig::error("LayerParamConnect didn't like \"foreground_color\"");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_fill.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STATE_FILL_H
-#define __SINFG_STATE_FILL_H
+#ifndef __SYNFIG_STATE_FILL_H
+#define __SYNFIG_STATE_FILL_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_gradient.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_gradient.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "duck.h"
#include "widget_enum.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Duckmatic::Push duckmatic_push;
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
Point point_holder;
Widget_Enum enum_blend;
public:
- sinfg::String get_id()const { return entry_id.get_text(); }
- void set_id(const sinfg::String& x) { return entry_id.set_text(x); }
+ synfig::String get_id()const { return entry_id.get_text(); }
+ void set_id(const synfig::String& x) { return entry_id.set_text(x); }
int get_type()const { return enum_type.get_value(); }
void set_type(int x) { return enum_type.set_value(x); }
~StateGradient_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
- //void on_user_click(sinfg::Point point);
+ //void on_user_click(synfig::Point point);
void load_settings();
void save_settings();
void reset();
canvas_view_(canvas_view),
is_working(*canvas_view),
duckmatic_push(get_work_area()),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
entry_id()
{
void
StateGradient_Context::make_gradient(const Point& _p1, const Point& _p2)
{
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Gradient"));
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Gradient"));
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer;
depth=layer->get_depth();
canvas=layer->get_canvas();
}
- const sinfg::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
+ const synfig::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
const Point p1(transform.unperform(_p1));
const Point p2(transform.unperform(_p2));
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_gradient.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_GRADIENT_H
-#define __SINFG_STUDIO_STATE_GRADIENT_H
+#ifndef __SYNFIG_STUDIO_STATE_GRADIENT_H
+#define __SYNFIG_STUDIO_STATE_GRADIENT_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#include "dialog_tooloptions.h"
#include <gtkmm/dialog.h>
#include "widget_waypointmodel.h"
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_composite.h>
-#include <sinfg/valuenode_const.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_composite.h>
+#include <synfig/valuenode_const.h>
#include "canvasview.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
CanvasView* get_canvas_view() { return canvas_view; }
Canvas::Handle get_canvas() { return canvas_view->get_canvas(); }
WorkArea* get_work_area() { return canvas_view->get_work_area(); }
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface() { return canvas_view->canvas_interface(); }
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface() { return canvas_view->canvas_interface(); }
public:
StateNormal_Context(CanvasView *canvas_view);
Smach::event_result event_layer_click(const Smach::event& x);
- void edit_several_waypoints(std::list<sinfgapp::ValueDesc> value_desc_list);
+ void edit_several_waypoints(std::list<synfigapp::ValueDesc> value_desc_list);
void refresh_tool_options();
}; // END of class StateNormal_Context
StateNormal_Context::StateNormal_Context(CanvasView *canvas_view):
canvas_view(canvas_view)
{
- sinfg::info("Enterted Normal State");
+ synfig::info("Enterted Normal State");
}
StateNormal_Context::~StateNormal_Context()
{
- sinfg::info("Left Normal State");
+ synfig::info("Left Normal State");
}
void
Smach::event_result
StateNormal_Context::event_stop_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received Stop Event");
+ synfig::info("STATE NORMAL: Received Stop Event");
canvas_view->stop();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateNormal_Context::event_refresh_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received Refresh Event");
+ synfig::info("STATE NORMAL: Received Refresh Event");
canvas_view->rebuild_tables();
canvas_view->work_area->queue_render_preview();
return Smach::RESULT_ACCEPT;
Smach::event_result
StateNormal_Context::event_refresh_ducks_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received Refresh Ducks");
+ synfig::info("STATE NORMAL: Received Refresh Ducks");
canvas_view->queue_rebuild_ducks();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateNormal_Context::event_undo_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received Undo Event");
+ synfig::info("STATE NORMAL: Received Undo Event");
canvas_view->get_instance()->undo();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateNormal_Context::event_redo_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received Redo Event");
+ synfig::info("STATE NORMAL: Received Redo Event");
canvas_view->get_instance()->redo();
return Smach::RESULT_ACCEPT;
}
Smach::event_result
StateNormal_Context::event_mouse_button_down_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received mouse button down Event");
+ synfig::info("STATE NORMAL: Received mouse button down Event");
const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
if(event.layer)
{
- sinfg::info("STATE NORMAL: Received layer click Event, \"%s\"",event.layer->get_name().c_str());
+ synfig::info("STATE NORMAL: Received layer click Event, \"%s\"",event.layer->get_name().c_str());
}
else
{
- sinfg::info("STATE NORMAL: Received layer click Event with an empty layer.");
+ synfig::info("STATE NORMAL: Received layer click Event with an empty layer.");
}
switch(event.button)
/*
void
-StateNormal_Context::edit_several_waypoints(std::list<sinfgapp::ValueDesc> value_desc_list)
+StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> value_desc_list)
{
Gtk::Dialog dialog(
"Edit Multiple Waypoints", // Title
if(dialog.run()==0)
return;
DEBUGPOINT();
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Set Waypoints"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Set Waypoints"));
- std::list<sinfgapp::ValueDesc>::iterator iter;
+ std::list<synfigapp::ValueDesc>::iterator iter;
for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
{
- sinfgapp::ValueDesc value_desc(*iter);
+ synfigapp::ValueDesc value_desc(*iter);
if(!value_desc.is_valid())
continue;
value_node=ValueNode_Animated::create(value,get_canvas()->get_time());
- sinfgapp::Action::Handle action;
+ synfigapp::Action::Handle action;
if(!value_desc.is_value_node())
{
- action=sinfgapp::Action::create("value_desc_connect");
+ action=synfigapp::Action::create("value_desc_connect");
action->set_param("dest",value_desc);
action->set_param("src",ValueNode::Handle(value_node));
}
else
{
- action=sinfgapp::Action::create("value_node_replace");
+ action=synfigapp::Action::create("value_node_replace");
action->set_param("dest",value_desc.get_value_node());
action->set_param("src",ValueNode::Handle(value_node));
}
if(value_node)
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("waypoint_set_smart"));
+ synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set_smart"));
if(!action)
{
Smach::event_result
StateNormal_Context::event_multiple_ducks_clicked_handler(const Smach::event& x)
{
- sinfg::info("STATE NORMAL: Received multiple duck click event");
+ synfig::info("STATE NORMAL: Received multiple duck click event");
//const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
- std::list<sinfgapp::ValueDesc> value_desc_list;
+ std::list<synfigapp::ValueDesc> value_desc_list;
// Create a list of value_descs associated with selection
const DuckList selected_ducks(get_work_area()->get_selected_ducks());
DuckList::const_iterator iter;
for(iter=selected_ducks.begin();iter!=selected_ducks.end();++iter)
{
- sinfgapp::ValueDesc value_desc((*iter)->get_value_desc());
+ synfigapp::ValueDesc value_desc((*iter)->get_value_desc());
if(!value_desc.is_valid())
continue;
if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
{
value_desc_list.push_back(
- sinfgapp::ValueDesc(
+ synfigapp::ValueDesc(
ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
,0
)
canvas_view->get_instance()->make_param_menu(menu,canvas_view->get_canvas(),value_desc_list);
/*
- sinfgapp::Action::ParamList param_list;
+ synfigapp::Action::ParamList param_list;
param_list=get_canvas_interface()->generate_param_list(value_desc_list);
- canvas_view->add_actions_to_menu(menu, param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+ canvas_view->add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Edit Waypoints"),
sigc::bind(
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_normal.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STATE_NORMAL_H
-#define __SINFG_STATE_NORMAL_H
+#ifndef __SYNFIG_STATE_NORMAL_H
+#define __SYNFIG_STATE_NORMAL_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file rotoscope_polygon.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_polygon.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "dialog_tooloptions.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Duckmatic::Push duckmatic_push;
- std::list<sinfg::Point> polygon_point_list;
- sinfgapp::Settings& settings;
+ std::list<synfig::Point> polygon_point_list;
+ synfigapp::Settings& settings;
- bool on_polygon_duck_change(const sinfg::Point &point, std::list<sinfg::Point>::iterator iter);
+ bool on_polygon_duck_change(const synfig::Point &point, std::list<synfig::Point>::iterator iter);
- void popup_handle_menu(sinfgapp::ValueDesc value_desc);
+ void popup_handle_menu(synfigapp::ValueDesc value_desc);
void refresh_ducks();
Gtk::Button button_make;
public:
- sinfg::String get_id()const { return entry_id.get_text(); }
- void set_id(const sinfg::String& x) { return entry_id.set_text(x); }
+ synfig::String get_id()const { return entry_id.get_text(); }
+ void set_id(const synfig::String& x) { return entry_id.set_text(x); }
Smach::event_result event_stop_handler(const Smach::event& x);
~StatePolygon_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
- //void on_user_click(sinfg::Point point);
+ //void on_user_click(synfig::Point point);
void load_settings();
void save_settings();
void reset();
is_working(*canvas_view),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
duckmatic_push(get_work_area()),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
entry_id(),
button_make(_("Make"))
{
Smach::event_result
StatePolygon_Context::event_stop_handler(const Smach::event& x)
{
- sinfg::info("STATE RotoPolygon: Received Stop Event");
+ synfig::info("STATE RotoPolygon: Received Stop Event");
//throw Smach::egress_exception();
reset();
return Smach::RESULT_ACCEPT;
Smach::event_result
StatePolygon_Context::event_refresh_handler(const Smach::event& x)
{
- sinfg::info("STATE RotoPolygon: Received Refresh Event");
+ synfig::info("STATE RotoPolygon: Received Refresh Event");
refresh_ducks();
return Smach::RESULT_ACCEPT;
}
}
{
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Polygon"));
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Polygon"));
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("polygon",canvas,depth));
layer->set_description(get_id());
}
{
- sinfgapp::Action::Handle action(sinfgapp::Action::create("value_desc_convert"));
- sinfgapp::ValueDesc value_desc(layer,"vector_list");
+ synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_convert"));
+ synfigapp::ValueDesc value_desc(layer,"vector_list");
action->set_param("canvas",get_canvas());
action->set_param("canvas_interface",get_canvas_interface());
action->set_param("value_desc",value_desc);
Smach::event_result
StatePolygon_Context::event_mouse_click_handler(const Smach::event& x)
{
- sinfg::info("STATE ROTOPOLYGON: Received mouse button down Event");
+ synfig::info("STATE ROTOPOLYGON: Received mouse button down Event");
const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
switch(event.button)
{
if(polygon_point_list.empty()) return;
- std::list<sinfg::Point>::iterator iter=polygon_point_list.begin();
+ std::list<synfig::Point>::iterator iter=polygon_point_list.begin();
etl::handle<WorkArea::Duck> duck;
duck=new WorkArea::Duck(*iter);
bool
-StatePolygon_Context::on_polygon_duck_change(const sinfg::Point &point, std::list<sinfg::Point>::iterator iter)
+StatePolygon_Context::on_polygon_duck_change(const synfig::Point &point, std::list<synfig::Point>::iterator iter)
{
*iter=point;
return true;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file rotoscope_polygon.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_ROTOSCOPE_POLYGON_H
-#define __SINFG_STUDIO_ROTOSCOPE_POLYGON_H
+#ifndef __SYNFIG_STUDIO_ROTOSCOPE_POLYGON_H
+#define __SYNFIG_STUDIO_ROTOSCOPE_POLYGON_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_gradient.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_rectangle.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "dialog_tooloptions.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
bool prev_workarea_layer_status_;
//Toolbox settings
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
//Toolbox display
Gtk::Table options_table;
public:
- sinfg::String get_id()const { return entry_id.get_text(); }
- void set_id(const sinfg::String& x) { return entry_id.set_text(x); }
+ synfig::String get_id()const { return entry_id.get_text(); }
+ void set_id(const synfig::String& x) { return entry_id.set_text(x); }
Real get_expand()const { return adj_expand.get_value(); }
void set_expand(Real f) { adj_expand.set_value(f); }
//Canvas interaction
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
//Modifying settings etc.
is_working(*canvas_view),
duckmatic_push(get_work_area()),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
entry_id(),
adj_expand(0,0,1,0.01,0.1),
spin_expand(adj_expand,0.1,3),
void
StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2)
{
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Rectangle"));
- sinfgapp::PushMode push_mode(get_canvas_interface(),sinfgapp::MODE_NORMAL);
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Rectangle"));
+ synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer;
//create the layer
layer=get_canvas_interface()->add_layer_to("rectangle",canvas,depth);
- const sinfg::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
+ const synfig::TransformStack& transform(get_canvas_view()->get_curr_transform_stack());
const Point p1(transform.unperform(_p1));
const Point p2(transform.unperform(_p2));
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_rectangle.h
** \brief Rectangle creation state
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_RECTANGLE_H
-#define __SINFG_STUDIO_STATE_RECTANGLE_H
+#ifndef __SYNFIG_STUDIO_STATE_RECTANGLE_H
+#define __SYNFIG_STUDIO_STATE_RECTANGLE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_rotate.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_rotate.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "dialog_tooloptions.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
-#include <sinfg/angle.h>
-#include <sinfgapp/main.h>
+#include <synfig/angle.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
class DuckDrag_Rotate : public DuckDrag_Base
{
- sinfg::Vector last_rotate;
- sinfg::Vector drag_offset;
- sinfg::Vector center;
- sinfg::Vector snap;
+ synfig::Vector last_rotate;
+ synfig::Vector drag_offset;
+ synfig::Vector center;
+ synfig::Vector snap;
Angle original_angle;
Real original_mag;
- std::vector<sinfg::Vector> positions;
+ std::vector<synfig::Vector> positions;
bool bad_drag;
etl::handle<CanvasView> canvas_view_;
bool use_magnitude;
DuckDrag_Rotate();
- void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin);
+ void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin);
bool end_duck_drag(Duckmatic* duckmatic);
- void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector);
+ void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector);
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
};
{
etl::handle<CanvasView> canvas_view_;
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
etl::handle<DuckDrag_Rotate> duck_dragger_;
~StateRotate_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
void load_settings();
StateRotate_Context::StateRotate_Context(CanvasView* canvas_view):
canvas_view_(canvas_view),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
duck_dragger_(new DuckDrag_Rotate()),
checkbutton_scale(_("Allow Scale"))
{
}
void
-DuckDrag_Rotate::begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& offset)
+DuckDrag_Rotate::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& offset)
{
last_rotate=Vector(1,1);
move_only=false;
- sinfg::Vector vect(offset-center);
+ synfig::Vector vect(offset-center);
original_angle=Angle::tan(vect[1],vect[0]);
original_mag=vect.mag();
}
void
-DuckDrag_Rotate::duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)
+DuckDrag_Rotate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)
{
if(bad_drag)
return;
//std::set<etl::handle<Duck> >::iterator iter;
- sinfg::Vector vect(duckmatic->snap_point_to_grid(vector)-center+snap);
+ synfig::Vector vect(duckmatic->snap_point_to_grid(vector)-center+snap);
const DuckList selected_ducks(duckmatic->get_selected_ducks());
DuckList::const_iterator iter;
if(bad_drag)return false;
if(move_only)
{
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Move Duck"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Move Duck"));
duckmatic->signal_edited_selected_ducks();
return true;
}
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Rotate Ducks"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Rotate Ducks"));
if((last_rotate-Vector(1,1)).mag()>0.0001)
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_rotate.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_ROTATE_H
-#define __SINFG_STUDIO_STATE_ROTATE_H
+#ifndef __SYNFIG_STUDIO_STATE_ROTATE_H
+#define __SYNFIG_STUDIO_STATE_ROTATE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_scale.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_scale.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include "dialog_tooloptions.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
class DuckDrag_Scale : public DuckDrag_Base
{
- sinfg::Vector last_scale;
- sinfg::Vector drag_offset;
- sinfg::Vector center;
- sinfg::Vector snap;
+ synfig::Vector last_scale;
+ synfig::Vector drag_offset;
+ synfig::Vector center;
+ synfig::Vector snap;
- std::vector<sinfg::Vector> positions;
+ std::vector<synfig::Vector> positions;
bool move_only;
public:
bool lock_aspect;
DuckDrag_Scale();
- void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin);
+ void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin);
bool end_duck_drag(Duckmatic* duckmatic);
- void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector);
+ void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector);
};
{
etl::handle<CanvasView> canvas_view_;
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
etl::handle<DuckDrag_Scale> duck_dragger_;
~StateScale_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
void load_settings();
StateScale_Context::StateScale_Context(CanvasView* canvas_view):
canvas_view_(canvas_view),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
duck_dragger_(new DuckDrag_Scale()),
checkbutton_aspect_lock(_("Lock Aspect Ratio"))
{
#endif
void
-DuckDrag_Scale::begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& offset)
+DuckDrag_Scale::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& offset)
{
last_scale=Vector(1,1);
const DuckList selected_ducks(duckmatic->get_selected_ducks());
void
-DuckDrag_Scale::duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)
+DuckDrag_Scale::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)
{
const DuckList selected_ducks(duckmatic->get_selected_ducks());
DuckList::const_iterator iter;
return;
//std::set<etl::handle<Duck> >::iterator iter;
- sinfg::Vector vect(duckmatic->snap_point_to_grid(vector)-center);
+ synfig::Vector vect(duckmatic->snap_point_to_grid(vector)-center);
last_scale=vect;
if(move_only)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_scale.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_SCALE_H
-#define __SINFG_STUDIO_STATE_SCALE_H
+#ifndef __SYNFIG_STUDIO_STATE_SCALE_H
+#define __SYNFIG_STUDIO_STATE_SCALE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_sketch.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
+#include <synfig/valuenode_dynamiclist.h>
#include "state_sketch.h"
#include "state_stroke.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfg/valuenode_bline.h>
+#include <synfig/valuenode_bline.h>
#include <ETL/hermite>
#include <ETL/calculus>
#include <utility>
#include "event_layerclick.h"
#include "toolbox.h"
-#include <sinfgapp/blineconvert.h>
-#include <sinfgapp/main.h>
+#include <synfigapp/blineconvert.h>
+#include <synfigapp/main.h>
#include <ETL/gaussian>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
~StateSketch_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Time get_time()const { return get_canvas_interface()->get_time(); }
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Time get_time()const { return get_canvas_interface()->get_time(); }
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
}; // END of class StateSketch_Context
void
StateSketch_Context::save_sketch()
{
- sinfg::String filename(basename(get_canvas()->get_file_name())+".sketch");
+ synfig::String filename(basename(get_canvas()->get_file_name())+".sketch");
while(App::dialog_save_file(_("Save Sketch"), filename))
{
void
StateSketch_Context::load_sketch()
{
- sinfg::String filename(basename(get_canvas()->get_file_name())+".sketch");
+ synfig::String filename(basename(get_canvas()->get_file_name())+".sketch");
while(App::dialog_open_file(_("Load Sketch"), filename))
{
assert(event.stroke_data);
- get_work_area()->add_persistant_stroke(event.stroke_data,sinfgapp::Main::get_foreground_color());
+ get_work_area()->add_persistant_stroke(event.stroke_data,synfigapp::Main::get_foreground_color());
return Smach::RESULT_ACCEPT;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_sketch.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_SKETCH_H
-#define __SINFG_STUDIO_STATE_SKETCH_H
+#ifndef __SYNFIG_STUDIO_STATE_SKETCH_H
+#define __SYNFIG_STUDIO_STATE_SKETCH_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_smooth_move.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_smoothmove.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
#include "onemoment.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
{
float radius;
- sinfg::Vector last_translate_;
- sinfg::Vector drag_offset_;
- sinfg::Vector snap;
+ synfig::Vector last_translate_;
+ synfig::Vector drag_offset_;
+ synfig::Vector snap;
- std::vector<sinfg::Vector> last_;
- std::vector<sinfg::Vector> positions;
+ std::vector<synfig::Vector> last_;
+ std::vector<synfig::Vector> positions;
public:
DuckDrag_SmoothMove();
- void begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& begin);
+ void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin);
bool end_duck_drag(Duckmatic* duckmatic);
- void duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector);
+ void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector);
void set_radius(float x) { radius=x; }
float get_radius()const { return radius; }
//Duckmatic::Push duckmatic_push;
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
etl::handle<DuckDrag_SmoothMove> duck_dragger_;
~StateSmoothMove_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
void load_settings();
StateSmoothMove_Context::StateSmoothMove_Context(CanvasView* canvas_view):
canvas_view_(canvas_view),
// duckmatic_push(get_work_area()),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
duck_dragger_(new DuckDrag_SmoothMove()),
adj_radius(1,0,100000,0.01,0.1),
spin_radius(adj_radius,0.1,3)
}
void
-DuckDrag_SmoothMove::begin_duck_drag(Duckmatic* duckmatic, const sinfg::Vector& offset)
+DuckDrag_SmoothMove::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& offset)
{
last_translate_=Vector(0,0);
drag_offset_=duckmatic->find_duck(offset)->get_trans_point();
}
void
-DuckDrag_SmoothMove::duck_drag(Duckmatic* duckmatic, const sinfg::Vector& vector)
+DuckDrag_SmoothMove::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector)
{
const DuckList selected_ducks(duckmatic->get_selected_ducks());
DuckList::const_iterator iter;
- sinfg::Vector vect(duckmatic->snap_point_to_grid(vector)-drag_offset_+snap);
+ synfig::Vector vect(duckmatic->snap_point_to_grid(vector)-drag_offset_+snap);
int i;
bool
DuckDrag_SmoothMove::end_duck_drag(Duckmatic* duckmatic)
{
- //sinfg::info("end_duck_drag(): Diff= %f",last_translate_.mag());
+ //synfig::info("end_duck_drag(): Diff= %f",last_translate_.mag());
if(last_translate_.mag()>0.0001)
{
const DuckList selected_ducks(duckmatic->get_selected_ducks());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_smoothmove.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_SMOOTHMOVE_H
-#define __SINFG_STUDIO_STATE_SMOOTHMOVE_H
+#ifndef __SYNFIG_STUDIO_STATE_SMOOTHMOVE_H
+#define __SYNFIG_STUDIO_STATE_SMOOTHMOVE_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_stroke.cpp
** \brief Template File
**
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
-#include <sinfg/valuenode_dynamiclist.h>
+#include <synfig/valuenode_dynamiclist.h>
#include "state_stroke.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfg/valuenode_bline.h>
+#include <synfig/valuenode_bline.h>
#include <ETL/hermite>
#include <ETL/calculus>
#include <utility>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Duckmatic::Push duckmatic_push;
- etl::smart_ptr<std::list<sinfg::Point> > stroke_data;
+ etl::smart_ptr<std::list<synfig::Point> > stroke_data;
- etl::smart_ptr<std::list<sinfg::Real> > width_data;
+ etl::smart_ptr<std::list<synfig::Real> > width_data;
Gdk::ModifierType modifier;
~StateStroke_Context();
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
}; // END of class StateStroke_Context
width_data.spawn();
stroke_data.spawn();
- get_work_area()->add_stroke(stroke_data, sinfgapp::Main::get_foreground_color());
+ get_work_area()->add_stroke(stroke_data, synfigapp::Main::get_foreground_color());
- sinfg::info("Now Scribbling...");
+ synfig::info("Now Scribbling...");
}
StateStroke_Context::~StateStroke_Context()
duckmatic_push.restore();
App::toolbox->refresh();
- sinfg::info("No longer scribbling");
+ synfig::info("No longer scribbling");
// Send the stroke data to whatever previously called this state.
if(stroke_data->size()>=2)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_stroke.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_STROKE_H
-#define __SINFG_STUDIO_STATE_STROKE_H
+#ifndef __SYNFIG_STUDIO_STATE_STROKE_H
+#define __SYNFIG_STUDIO_STATE_STROKE_H
/* === H E A D E R S ======================================================= */
#include "workarea.h"
#include <sigc++/object.h>
#include "duckmatic.h"
-#include <sinfg/blinepoint.h>
+#include <synfig/blinepoint.h>
#include <list>
#include <ETL/smart_ptr>
#include "eventkey.h"
struct EventStroke : public Smach::event
{
- etl::smart_ptr<std::list<sinfg::Point> > stroke_data;
- etl::smart_ptr<std::list<sinfg::Real> > width_data;
+ etl::smart_ptr<std::list<synfig::Point> > stroke_data;
+ etl::smart_ptr<std::list<synfig::Real> > width_data;
Gdk::ModifierType modifier;
- EventStroke(etl::smart_ptr<std::list<sinfg::Point> > stroke_data,
- etl::smart_ptr<std::list<sinfg::Real> > width_data,
+ EventStroke(etl::smart_ptr<std::list<synfig::Point> > stroke_data,
+ etl::smart_ptr<std::list<synfig::Real> > width_data,
Gdk::ModifierType modifier=Gdk::ModifierType(0)
):
Smach::event(EVENT_WORKAREA_STROKE),
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_gradient.cpp
** \brief Template File
**
#include <ETL/bezier>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfgapp/action_system.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfigapp/action_system.h>
#include "state_width.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "toolbox.h"
#include <gtkmm/optionmenu.h>
#include "duck.h"
-//#include <sinfgapp/value_desc.h>
-#include <sinfgapp/main.h>
+//#include <synfigapp/value_desc.h>
+#include <synfigapp/main.h>
#include <ETL/clock>
using namespace std;
using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
+using namespace synfig;
+using namespace synfigapp;
using namespace studio;
/* === M A C R O S ========================================================= */
Duckmatic::Type old_duckmask;
//Toolbox settings
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
//Toolbox display
Gtk::Table options_table;
//Canvas interaction
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
//Modifying settings etc.
prev_workarea_duck_clicking(get_work_area()->allow_duck_clicks),
old_duckmask(get_work_area()->get_type_mask()),
- settings(sinfgapp::Main::get_selected_input_device()->settings()),
+ settings(synfigapp::Main::get_selected_input_device()->settings()),
adj_delta(6,0,1,0.001,0.01),
spin_delta(adj_delta,0.01,3),
//Affect the width changes here...
map<handle<Duck>,Real>::iterator i = changetable.begin();
- sinfgapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch Width"));
+ synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch Width"));
for(; i != changetable.end(); ++i)
{
//for each duck modify IT!!!
if(!action->is_ready() || !get_canvas_view()->get_instance()->perform_action(action))
{
group.cancel();
- sinfg::warning("Changing the width action has failed");
+ synfig::warning("Changing the width action has failed");
return Smach::RESULT_ERROR;
}
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_width.h
** \brief Width creation state
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_STATE_WIDTH_H
-#define __SINFG_STUDIO_STATE_WIDTH_H
+#ifndef __SYNFIG_STUDIO_STATE_WIDTH_H
+#define __SYNFIG_STUDIO_STATE_WIDTH_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_zoom.cpp
** \brief Zoom Toole Implementation File
**
#include <sigc++/object.h>
#include <ETL/handle>
-#include <sinfg/vector.h>
+#include <synfig/vector.h>
#include "state_zoom.h"
#include "app.h"
#include "dialog_tooloptions.h"
#include "toolbox.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
bool prev_workarea_layer_status_;
//Toolbox settings
- sinfgapp::Settings& settings;
+ synfigapp::Settings& settings;
//Toolbox display
Gtk::Table options_table;
//Canvas interaction
const etl::handle<CanvasView>& get_canvas_view()const{return canvas_view_;}
- etl::handle<sinfgapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
- sinfg::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
+ etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
+ synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
//Modifying settings etc.
canvas_view_(canvas_view),
is_working(*canvas_view),
prev_workarea_layer_status_(get_work_area()->allow_layer_clicks),
- settings(sinfgapp::Main::get_selected_input_device()->settings())
+ settings(synfigapp::Main::get_selected_input_device()->settings())
{
// Set up the tool options dialog
//options_table.attach(*manage(new Gtk::Label(_("Zoom Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file state_zoom.h
** \brief Zoom tool Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STATE_ZOOM_H
-#define __SINFG_STATE_ZOOM_H
+#ifndef __SYNFIG_STATE_ZOOM_H
+#define __SYNFIG_STATE_ZOOM_H
/* === H E A D E R S ======================================================= */
#include "smach.h"
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
#include "statemanager.h"
#include <gtkmm/actiongroup.h>
#include <gtkmm/action.h>
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include "app.h"
#include "toolbox.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
Glib::RefPtr<Gtk::Action> action(
Gtk::Action::create(
"state-"+name,
- Gtk::StockID("sinfg-"+name),
+ Gtk::StockID("synfig-"+name),
name,
name
)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STATEMANAGER_H
-#define __SINFG_STATEMANAGER_H
+#ifndef __SYNFIG_STATEMANAGER_H
+#define __SYNFIG_STATEMANAGER_H
/* === H E A D E R S ======================================================= */
/*! ========================================================================
-** Sinfg
+** Synfig
** Template File
** $Id: toolbox.cpp,v 1.3 2005/01/13 20:23:01 darco Exp $
**
#include "widget_defaults.h"
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
using namespace SigC;
#define GRAB_HINT_DATA(y,default) { \
String x; \
- if(sinfgapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
+ if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \
{ \
set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \
} else {\
filemenu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Open Recent"),*recent_files_menu));
- filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-saveall"),
+ filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-saveall"),
sigc::ptr_fun(&studio::App::dialog_not_implemented)));
filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::CLOSE,
sigc::ptr_fun(close_selected_instance)));
helpmenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::HELP,
sigc::ptr_fun(studio::App::dialog_not_implemented)));
helpmenu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
- helpmenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("sinfg-about"),
+ helpmenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-about"),
sigc::ptr_fun(studio::App::dialog_about)));
Gtk::MenuBar *menubar1 = manage(new class Gtk::MenuBar());
ADD_TOOLBOX_BUTTON(button_open,"gtk-open","Open");
ADD_TOOLBOX_BUTTON(button_save,"gtk-save","Save");
ADD_TOOLBOX_BUTTON(button_saveas,"gtk-save-as","SaveAs");
- ADD_TOOLBOX_BUTTON(button_save_all,"sinfg-saveall","Save All");
+ ADD_TOOLBOX_BUTTON(button_save_all,"synfig-saveall","Save All");
TOOLBOX_BUTTON(button_undo,"gtk-undo","Undo");
TOOLBOX_BUTTON(button_redo,"gtk-redo","Redo");
- ADD_TOOLBOX_BUTTON(button_about,"sinfg-about","About Sinfg Studio");
- ADD_TOOLBOX_BUTTON(button_color,"sinfg-color","Color Dialog");
+ ADD_TOOLBOX_BUTTON(button_about,"synfig-about","About Synfig Studio");
+ ADD_TOOLBOX_BUTTON(button_color,"synfig-color","Color Dialog");
- TOOLBOX_BUTTON(button_rotoscope_bline,"sinfg-rotoscope_bline",_("Old Rotoscope BLine"));
- TOOLBOX_BUTTON(button_rotoscope_polygon,"sinfg-rotoscope_polygon",_("Rotoscope Polygon"));
- TOOLBOX_BUTTON(button_eyedrop,"sinfg-eyedrop",_("Eyedrop Tool"));
- TOOLBOX_BUTTON(button_rotoscope,"sinfg-rotoscope_bline",_("Rotoscope 2"));
+ TOOLBOX_BUTTON(button_rotoscope_bline,"synfig-rotoscope_bline",_("Old Rotoscope BLine"));
+ TOOLBOX_BUTTON(button_rotoscope_polygon,"synfig-rotoscope_polygon",_("Rotoscope Polygon"));
+ TOOLBOX_BUTTON(button_eyedrop,"synfig-eyedrop",_("Eyedrop Tool"));
+ TOOLBOX_BUTTON(button_rotoscope,"synfig-rotoscope_bline",_("Rotoscope 2"));
void
Toolbox::set_active_state(const String& statename)
{
- std::map<sinfg::String,Gtk::ToggleButton *>::iterator iter;
+ std::map<synfig::String,Gtk::ToggleButton *>::iterator iter;
changing_state_=true;
- sinfgapp::Main::set_state(statename);
+ synfigapp::Main::set_state(statename);
try
{
}
void
-Toolbox::change_state(const sinfg::String& statename)
+Toolbox::change_state(const synfig::String& statename)
{
etl::handle<studio::CanvasView> canvas_view(studio::App::get_selected_canvas_view());
if(canvas_view)
}
else
{
- sinfg::error("Unknown state \"%s\"",statename.c_str());
+ synfig::error("Unknown state \"%s\"",statename.c_str());
}
}
}
Gtk::ToggleButton* button;
button=manage(new class Gtk::ToggleButton());
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-"+name),Gtk::IconSize(4)));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-"+name),Gtk::IconSize(4)));
button->add(*icon);
tooltips.set_tip(*button,name);
icon->show();
// so that they are only clickable when they should be.
if(instance && App::get_selected_canvas_view())
{
- std::map<sinfg::String,Gtk::ToggleButton *>::iterator iter;
+ std::map<synfig::String,Gtk::ToggleButton *>::iterator iter;
for(iter=state_button_map.begin();iter!=state_button_map.end();++iter)
iter->second->set_sensitive(true);
}
else
{
- std::map<sinfg::String,Gtk::ToggleButton *>::iterator iter;
+ std::map<synfig::String,Gtk::ToggleButton *>::iterator iter;
for(iter=state_button_map.begin();iter!=state_button_map.end();++iter)
iter->second->set_sensitive(false);
if ((selection_data_.get_length() >= 0) && (selection_data_.get_format() == 8))
{
- sinfg::String selection_data((gchar *)(selection_data_.get_data()));
+ synfig::String selection_data((gchar *)(selection_data_.get_data()));
// For some reason, GTK hands us a list of URL's seperated
// by not only Carrage-Returns, but also Line-Feeds.
// Line-Feeds will mess us up. Remove all the line-feeds.
- while(selection_data.find_first_of('\r')!=sinfg::String::npos)
+ while(selection_data.find_first_of('\r')!=synfig::String::npos)
selection_data.erase(selection_data.begin()+selection_data.find_first_of('\r'));
std::stringstream stream(selection_data);
while(stream)
{
- sinfg::String filename,URI;
+ synfig::String filename,URI;
getline(stream,filename);
// If we don't have a filename, move on.
URI=String(filename.begin(),filename.begin()+sizeof("file://")-1);
if(URI!="file://")
{
- sinfg::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str());
+ synfig::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str());
continue;
}
// Strip the "file://" part from the filename
- filename=sinfg::String(filename.begin()+sizeof("file://")-1,filename.end());
+ filename=synfig::String(filename.begin()+sizeof("file://")-1,filename.end());
- sinfg::info("Attempting to open "+filename);
+ synfig::info("Attempting to open "+filename);
if(App::open(filename))
success=true;
else
- sinfg::error("Drop failed: Unable to open "+filename);
+ synfig::error("Drop failed: Unable to open "+filename);
}
}
else
- sinfg::error("Drop failed: bad selection data");
+ synfig::error("Drop failed: bad selection data");
// Finish the drag
context->drag_finish(success, false, time);
/*! ========================================================================
-** Sinfg
+** Synfig
** Template Header File
** $Id: toolbox.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_TOOLBOX_H
-#define __SINFG_GTKMM_TOOLBOX_H
+#ifndef __SYNFIG_GTKMM_TOOLBOX_H
+#define __SYNFIG_GTKMM_TOOLBOX_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/togglebutton.h>
#include <gtkmm/menu.h>
#include <gtkmm/table.h>
-#include <sinfg/string.h>
+#include <synfig/string.h>
#include "smach.h"
#include <map>
#include "dialogsettings.h"
Gtk::Table *tool_table;
- std::map<sinfg::String,Gtk::ToggleButton *> state_button_map;
+ std::map<synfig::String,Gtk::ToggleButton *> state_button_map;
Gtk::Menu *recent_files_menu;
public:
- void change_state(const sinfg::String& statename);
+ void change_state(const synfig::String& statename);
void update_undo_redo();
void refresh() { update_undo_redo(); }
- void set_active_state(const sinfg::String& statename);
+ void set_active_state(const synfig::String& statename);
void add_state(const Smach::state_base *state);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file valuelink.cpp
** \brief ValueBase Link Implementation File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using studio::ValueBaseLink;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file valuelink.h
** \brief ValueBase Link Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_VALUELINK_H
-#define __SINFG_VALUELINK_H
+#ifndef __SYNFIG_VALUELINK_H
+#define __SYNFIG_VALUELINK_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
/* === M A C R O S ========================================================= */
/* NOTE: DO NOT USE THE INDEX BASED INTERFACE... THINGS WILL CHANGE
*/
-class ValueBaseLink : public sinfg::LinkableValueNode
+class ValueBaseLink : public synfig::LinkableValueNode
{
typedef std::vector<ValueNode::Handle> list_type;
list_type list;
protected:
//stuff I don't want
- virtual bool set_link_vfunc(int i,sinfg::ValueNode::Handle x) {return false;}
+ virtual bool set_link_vfunc(int i,synfig::ValueNode::Handle x) {return false;}
virtual LinkableValueNode* create_new()const {return 0;}
//new stuff I need
- list_type::const_iterator findlink(sinfg::ValueNode::Handle x) const;
- list_type::iterator findlink(sinfg::ValueNode::Handle x);
+ list_type::const_iterator findlink(synfig::ValueNode::Handle x) const;
+ list_type::iterator findlink(synfig::ValueNode::Handle x);
public: //linkable interface
//stuff I do want
- virtual sinfg::ValueNode::LooseHandle get_link_vfunc(int i)const;
+ virtual synfig::ValueNode::LooseHandle get_link_vfunc(int i)const;
virtual int link_count()const;
//I have to support the thing because it's too much work otherwise
- virtual sinfg::String link_local_name(int i)const;
- virtual sinfg::String link_name(int i)const;
+ virtual synfig::String link_local_name(int i)const;
+ virtual synfig::String link_name(int i)const;
public:
ValueBaseLink();
virtual ~ValueBaseLink();
//don't want
- virtual int get_link_index_from_name(const sinfg::String &name)const;
+ virtual int get_link_index_from_name(const synfig::String &name)const;
//new add and subtract stuff
- virtual void add(sinfg::ValueNode::Handle v);
- virtual void remove(sinfg::ValueNode::Handle v);
+ virtual void add(synfig::ValueNode::Handle v);
+ virtual void remove(synfig::ValueNode::Handle v);
};
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_canvaschooser.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
}
void
-Widget_CanvasChooser::set_parent_canvas(etl::handle<sinfg::Canvas> x)
+Widget_CanvasChooser::set_parent_canvas(etl::handle<synfig::Canvas> x)
{
assert(x);
parent_canvas=x;
}
void
-Widget_CanvasChooser::set_value_(etl::handle<sinfg::Canvas> data)
+Widget_CanvasChooser::set_value_(etl::handle<synfig::Canvas> data)
{
set_value(data);
activate();
}
void
-Widget_CanvasChooser::set_value(etl::handle<sinfg::Canvas> data)
+Widget_CanvasChooser::set_value(etl::handle<synfig::Canvas> data)
{
assert(parent_canvas);
canvas=data;
canvas_menu=manage(new class Gtk::Menu());
- sinfg::Canvas::Children::iterator iter;
- sinfg::Canvas::Children &children(parent_canvas->children());
+ synfig::Canvas::Children::iterator iter;
+ synfig::Canvas::Children &children(parent_canvas->children());
String label;
if(canvas)
set_history(0);
}
-const etl::handle<sinfg::Canvas> &
+const etl::handle<synfig::Canvas> &
Widget_CanvasChooser::get_value()
{
return canvas;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_canvaschooser.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_CANVASCHOOSER_H
-#define __SINFG_STUDIO_WIDGET_CANVASCHOOSER_H
+#ifndef __SYNFIG_STUDIO_WIDGET_CANVASCHOOSER_H
+#define __SYNFIG_STUDIO_WIDGET_CANVASCHOOSER_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/canvas.h>
+#include <synfig/canvas.h>
#include <gtkmm/optionmenu.h>
class Widget_CanvasChooser : public Gtk::OptionMenu
{
Gtk::Menu *canvas_menu;
- sinfg::Canvas::Handle parent_canvas;
+ synfig::Canvas::Handle parent_canvas;
- sinfg::Canvas::Handle canvas;
- void set_value_(sinfg::Canvas::Handle data);
+ synfig::Canvas::Handle canvas;
+ void set_value_(synfig::Canvas::Handle data);
public:
Widget_CanvasChooser();
~Widget_CanvasChooser();
- void set_parent_canvas(sinfg::Canvas::Handle x);
- void set_value(sinfg::Canvas::Handle data);
- const sinfg::Canvas::Handle &get_value();
+ void set_parent_canvas(synfig::Canvas::Handle x);
+ void set_value(synfig::Canvas::Handle data);
+ const synfig::Canvas::Handle &get_value();
private:
void chooser_menu();
}; // END of class Widget_CanvasChooser
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_color.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === P R O C E D U R E S ================================================= */
Gdk::Color
-studio::colorconv_sinfg2gdk(const sinfg::Color &c_)
+studio::colorconv_synfig2gdk(const synfig::Color &c_)
{
- const sinfg::Color c(c_.clamped());
+ const synfig::Color c(c_.clamped());
Gdk::Color ret;
ret.set_rgb(
256*App::gamma.r_F32_to_U8(c.get_r()),
}
void
-studio::render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::Color &color)
+studio::render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Color &color)
{
const int height(ca.get_height());
const int width(ca.get_width());
const Color bg1(Color::blend(color,Color(0.75, 0.75, 0.75),1.0).clamped());
const Color bg2(Color::blend(color,Color(0.5, 0.5, 0.5),1.0).clamped());
- Gdk::Color gdk_c1(colorconv_sinfg2gdk(bg1));
- Gdk::Color gdk_c2(colorconv_sinfg2gdk(bg2));
+ Gdk::Color gdk_c1(colorconv_synfig2gdk(bg1));
+ Gdk::Color gdk_c2(colorconv_synfig2gdk(bg2));
bool toggle(false);
for(int i=0;i<width;i+=square_size)
else
{
// In this case we have a solid color to use
- Gdk::Color gdk_c1(colorconv_sinfg2gdk(color));
+ Gdk::Color gdk_c1(colorconv_synfig2gdk(color));
gc->set_rgb_fg_color(gdk_c1);
window->draw_rectangle(gc, true, ca.get_x(), ca.get_y(), width-1, height-1);
}
void
-Widget_Color::set_value(const sinfg::Color &data)
+Widget_Color::set_value(const synfig::Color &data)
{
assert(data.is_valid());
color=data;
queue_draw();
}
-const sinfg::Color &
+const synfig::Color &
Widget_Color::get_value()
{
assert(color.is_valid());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_color.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_COLOR_H
-#define __SINFG_STUDIO_WIDGET_COLOR_H
+#ifndef __SYNFIG_STUDIO_WIDGET_COLOR_H
+#define __SYNFIG_STUDIO_WIDGET_COLOR_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/spinbutton.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/drawingarea.h>
-#include <sinfg/color.h>
+#include <synfig/color.h>
/* === M A C R O S ========================================================= */
namespace studio {
-Gdk::Color colorconv_sinfg2gdk(const sinfg::Color &c);
+Gdk::Color colorconv_synfig2gdk(const synfig::Color &c);
-void render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::Color &color);
+void render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Color &color);
class Widget_Color : public Gtk::DrawingArea
{
- sinfg::Color color;
+ synfig::Color color;
sigc::signal<void> signal_activate_;
sigc::signal<void> signal_secondary_;
sigc::signal<void>& signal_clicked() { return signal_activate_; }
sigc::signal<void>& signal_secondary() { return signal_secondary_; }
- void set_value(const sinfg::Color &data);
- const sinfg::Color &get_value();
+ void set_value(const synfig::Color &data);
+ const synfig::Color &get_value();
Widget_Color();
~Widget_Color();
private:
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_coloredit.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
}
void
-Widget_ColorEdit::set_value(const sinfg::Color &data)
+Widget_ColorEdit::set_value(const synfig::Color &data)
{
assert(data.is_valid());
hold_signals=true;
hold_signals=false;
}
-sinfg::Color
+synfig::Color
Widget_ColorEdit::get_value_raw()
{
Color color;
return color;
}
-const sinfg::Color &
+const synfig::Color &
Widget_ColorEdit::get_value()
{
if(use_colorspace_gamma())
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_coloredit.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_COLOREDIT_H
-#define __SINFG_STUDIO_WIDGET_COLOREDIT_H
+#ifndef __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
+#define __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/spinbutton.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/drawingarea.h>
-#include <sinfg/color.h>
+#include <synfig/color.h>
#include "widget_color.h"
/* === M A C R O S ========================================================= */
sigc::signal<void> signal_activated_;
Type type;
- sinfg::Color color_;
+ synfig::Color color_;
public:
Type
get_type()const { return type; }
- const sinfg::Color&
+ const synfig::Color&
get_color()const { return color_; }
set_type(Type x);
void
- set_color(sinfg::Color x);
+ set_color(synfig::Color x);
- static void adjust_color(Type type, sinfg::Color &color, float amount);
+ static void adjust_color(Type type, synfig::Color &color, float amount);
private:
- typedef void (*slider_color_func)(sinfg::Color &,float);
-
- static void slider_color_TYPE_R(sinfg::Color &color, float amount);
- static void slider_color_TYPE_G(sinfg::Color &color, float amount);
- static void slider_color_TYPE_B(sinfg::Color &color, float amount);
- static void slider_color_TYPE_Y(sinfg::Color &color, float amount);
- static void slider_color_TYPE_U(sinfg::Color &color, float amount);
- static void slider_color_TYPE_V(sinfg::Color &color, float amount);
- static void slider_color_TYPE_HUE(sinfg::Color &color, float amount);
- static void slider_color_TYPE_SAT(sinfg::Color &color, float amount);
- static void slider_color_TYPE_A(sinfg::Color &color, float amount);
+ typedef void (*slider_color_func)(synfig::Color &,float);
+
+ static void slider_color_TYPE_R(synfig::Color &color, float amount);
+ static void slider_color_TYPE_G(synfig::Color &color, float amount);
+ static void slider_color_TYPE_B(synfig::Color &color, float amount);
+ static void slider_color_TYPE_Y(synfig::Color &color, float amount);
+ static void slider_color_TYPE_U(synfig::Color &color, float amount);
+ static void slider_color_TYPE_V(synfig::Color &color, float amount);
+ static void slider_color_TYPE_HUE(synfig::Color &color, float amount);
+ static void slider_color_TYPE_SAT(synfig::Color &color, float amount);
+ static void slider_color_TYPE_A(synfig::Color &color, float amount);
bool
Gtk::Adjustment B_adjustment;
Gtk::Adjustment A_adjustment;
- sinfg::Color color;
+ synfig::Color color;
Gtk::Notebook* notebook;
void activated() { signal_activated_(); }
void activate() { signal_activated_(); }
- void set_value(const sinfg::Color &data);
- const sinfg::Color &get_value();
- sinfg::Color get_value_raw();
+ void set_value(const synfig::Color &data);
+ const synfig::Color &get_value();
+ synfig::Color get_value_raw();
void set_has_frame(bool x);
void set_digits(int x);
Widget_ColorEdit();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_compselect.cpp
** \brief Template File
**
#include <gtkmm/menu.h>
#include "widget_compselect.h"
#include <ETL/stringf>
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
#include "instance.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
etl::loose_handle<studio::Instance> loose_instance(instance);
- instance->sinfgapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Widget_CompSelect::refresh));
- instance->sinfgapp::Instance::signal_filename_changed().connect(
+ instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Widget_CompSelect::refresh));
+ instance->synfigapp::Instance::signal_filename_changed().connect(
sigc::bind<etl::loose_handle<studio::Instance> >(
sigc::mem_fun(*this,&Widget_CompSelect::set_selected_instance),
loose_instance
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_compselect.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_COMPSELECT_H
-#define __SINFG_STUDIO_WIDGET_COMPSELECT_H
+#ifndef __SYNFIG_STUDIO_WIDGET_COMPSELECT_H
+#define __SYNFIG_STUDIO_WIDGET_COMPSELECT_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_curves.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/*
void
-studio::render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::Color &color)
+studio::render_color_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Color &color)
{
const int height(ca.get_height());
const int width(ca.get_width());
const Color bg1(Color::blend(color,Color(0.75, 0.75, 0.75),1.0).clamped());
const Color bg2(Color::blend(color,Color(0.5, 0.5, 0.5),1.0).clamped());
- Gdk::Color gdk_c1(colorconv_sinfg2gdk(bg1));
- Gdk::Color gdk_c2(colorconv_sinfg2gdk(bg2));
+ Gdk::Color gdk_c1(colorconv_synfig2gdk(bg1));
+ Gdk::Color gdk_c2(colorconv_synfig2gdk(bg2));
bool toggle(false);
for(int i=0;i<width;i+=square_size)
else
{
// In this case we have a solid color to use
- Gdk::Color gdk_c1(colorconv_sinfg2gdk(color));
+ Gdk::Color gdk_c1(colorconv_synfig2gdk(color));
gc->set_rgb_fg_color(gdk_c1);
window->draw_rectangle(gc, true, ca.get_x(), ca.get_y(), width-1, height-1);
struct studio::Widget_Curves::Channel
{
- sinfg::String name;
+ synfig::String name;
Gdk::Color color;
- std::map<sinfg::Real,sinfg::Real> values;
+ std::map<synfig::Real,synfig::Real> values;
};
struct studio::Widget_Curves::CurveStruct : sigc::trackable
{
- sinfgapp::ValueDesc value_desc;
+ synfigapp::ValueDesc value_desc;
std::vector<Channel> channels;
- CurveStruct(const sinfgapp::ValueDesc& x):
+ CurveStruct(const synfigapp::ValueDesc& x):
value_desc(x)
{
switch(value_desc.get_value_type())
channels.back().color=Gdk::Color("#7f7f00");
break;
default:
- throw sinfg::Exception::BadType("Bad type for curves");
+ throw synfig::Exception::BadType("Bad type for curves");
}
}
iter->values.clear();
}
- sinfg::Real get_value(int chan, sinfg::Real time, sinfg::Real tolerance)
+ synfig::Real get_value(int chan, synfig::Real time, synfig::Real tolerance)
{
- std::map<sinfg::Real,sinfg::Real>::iterator iter;
+ std::map<synfig::Real,synfig::Real>::iterator iter;
// First check to see if we have a value
// that is "close enough" to the time
}
void
-Widget_Curves::set_value_descs(std::list<sinfgapp::ValueDesc> value_descs)
+Widget_Curves::set_value_descs(std::list<synfigapp::ValueDesc> value_descs)
{
curve_list_.clear();
- std::list<sinfgapp::ValueDesc>::iterator iter;
+ std::list<synfigapp::ValueDesc>::iterator iter;
for(iter=value_descs.begin();iter!=value_descs.end();++iter)
{
try {
)
);
}
- }catch(sinfg::Exception::BadType)
+ }catch(synfig::Exception::BadType)
{
continue;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_curves.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_CURVES_H
-#define __SINFG_STUDIO_WIDGET_CURVES_H
+#ifndef __SYNFIG_STUDIO_WIDGET_CURVES_H
+#define __SYNFIG_STUDIO_WIDGET_CURVES_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/adjustment.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/layout.h>
-#include <sinfg/color.h>
-#include <sinfgapp/value_desc.h>
+#include <synfig/color.h>
+#include <synfigapp/value_desc.h>
#include <list>
/* === M A C R O S ========================================================= */
Widget_Curves();
~Widget_Curves();
- void set_value_descs(std::list<sinfgapp::ValueDesc> value_descs);
+ void set_value_descs(std::list<synfigapp::ValueDesc> value_descs);
void clear();
void refresh();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_defaults.cpp
** \brief Template File
**
#include "app.h"
#include <gtkmm/menu.h>
#include <gtkmm/scale.h>
-#include <sinfg/exception.h>
-#include <sinfgapp/main.h>
+#include <synfig/exception.h>
+#include <synfigapp/main.h>
#include "canvasview.h"
#include "widget_distance.h"
#include "widget_enum.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
#define GRADIENT_HEIGHT 16
#define DEFAULT_INCREMENT (0.25)
-#define DEFAULT_WIDTH (sinfg::Distance(3,sinfg::Distance::SYSTEM_POINTS))
+#define DEFAULT_WIDTH (synfig::Distance(3,synfig::Distance::SYSTEM_POINTS))
/* === G L O B A L S ======================================================= */
add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
add_events(Gdk::BUTTON1_MOTION_MASK);
- sinfgapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
- sinfgapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
- sinfgapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
+ synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
+ synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
+ synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
studio::App::signal_instance_selected().connect(sigc::hide(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw)));
}
if(App::get_selected_canvas_view())
{
const RendDesc& rend_desc(App::get_selected_canvas_view()->get_canvas()->rend_desc());
- pixelsize=sinfgapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
+ pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
}
else
{
RendDesc rend_desc;
- pixelsize=sinfgapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
+ pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
}
// Fill in the background color
- render_color_to_window(get_window(),Gdk::Rectangle(0,0,w,h),sinfgapp::Main::get_background_color());
+ render_color_to_window(get_window(),Gdk::Rectangle(0,0,w,h),synfigapp::Main::get_background_color());
/*
- gc->set_rgb_fg_color(colorconv_sinfg2gdk(sinfgapp::Main::get_background_color()));
+ gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_background_color()));
gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
get_window()->draw_rectangle(
gc,
*/
// Draw in the circle
- gc->set_rgb_fg_color(colorconv_sinfg2gdk(sinfgapp::Main::get_foreground_color()));
+ gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_foreground_color()));
gc->set_function(Gdk::COPY);
gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
get_window()->draw_arc(
case GDK_BUTTON_RELEASE:
if(event->button.button==1) // Left click
{
- Distance dist(sinfgapp::Main::get_bline_width());
+ Distance dist(synfigapp::Main::get_bline_width());
if(y<h/2) // increase BLine size
{
{
dist-=DEFAULT_INCREMENT;
}
- sinfgapp::Main::set_bline_width(dist);
+ synfigapp::Main::set_bline_width(dist);
return true;
}
if(event->button.button==3)
{
// right click on bline width
- sinfgapp::Main::set_bline_width(DEFAULT_WIDTH);
+ synfigapp::Main::set_bline_width(DEFAULT_WIDTH);
return true;
}
break;
case GDK_SCROLL:
{
- Distance dist(sinfgapp::Main::get_bline_width());
+ Distance dist(synfigapp::Main::get_bline_width());
if(event->scroll.direction==GDK_SCROLL_UP)
{
{
dist-=DEFAULT_INCREMENT;
}
- sinfgapp::Main::set_bline_width(dist);
+ synfigapp::Main::set_bline_width(dist);
return true;
}
default:
button_swap->show();
button_swap->set_relief(Gtk::RELIEF_NONE);
button_swap->set_border_width(0);
- icon=manage(new Gtk::Image(Gtk::StockID("sinfg-swap_colors"),Gtk::IconSize(1)));
+ icon=manage(new Gtk::Image(Gtk::StockID("synfig-swap_colors"),Gtk::IconSize(1)));
icon->show();
button_swap->add(*icon);
//button_swap->get_child()->set_size_request(16/3,16/3);
// Signals
- sinfgapp::Main::signal_opacity_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::opacity_refresh));
- sinfgapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bline_width_refresh));
- sinfgapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::fg_color_refresh));
- sinfgapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bg_color_refresh));
- sinfgapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::gradient_refresh));
- sinfgapp::Main::signal_blend_method_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::blend_method_refresh));
- sinfgapp::Main::signal_interpolation_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::interpolation_refresh));
+ synfigapp::Main::signal_opacity_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::opacity_refresh));
+ synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bline_width_refresh));
+ synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::fg_color_refresh));
+ synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bg_color_refresh));
+ synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::gradient_refresh));
+ synfigapp::Main::signal_blend_method_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::blend_method_refresh));
+ synfigapp::Main::signal_interpolation_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::interpolation_refresh));
fg_color_refresh();
bg_color_refresh();
add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
add_events(Gdk::BUTTON1_MOTION_MASK);
- sinfgapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
- sinfgapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
- sinfgapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
- sinfgapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
+ synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
+ synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
+ synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
+ synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
if(App::dialog_gradient)
{
- App::dialog_gradient->set_gradient(sinfgapp::Main::get_gradient());
+ App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
App::dialog_gradient->reset();
- App::dialog_gradient->signal_edited().connect(sigc::mem_fun(sinfgapp::Main::set_gradient));
+ App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
}
if(App::dialog_color)
{
- App::dialog_color->set_color(sinfgapp::Main::get_foreground_color());
+ App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
App::dialog_color->reset();
- App::dialog_color->signal_edited().connect(sigc::mem_fun(sinfgapp::Main::set_foreground_color));
+ App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
}
*/
}
void
Widget_Defaults::fg_color_refresh()
{
- widget_fg_color->set_value(sinfgapp::Main::get_foreground_color());
+ widget_fg_color->set_value(synfigapp::Main::get_foreground_color());
}
void
Widget_Defaults::bg_color_refresh()
{
- widget_bg_color->set_value(sinfgapp::Main::get_background_color());
+ widget_bg_color->set_value(synfigapp::Main::get_background_color());
}
void
Widget_Defaults::gradient_refresh()
{
- widget_gradient->set_value(sinfgapp::Main::get_gradient());
+ widget_gradient->set_value(synfigapp::Main::get_gradient());
}
void
Widget_Defaults::bline_width_refresh()
{
- widget_bline_width->set_value(sinfgapp::Main::get_bline_width());
+ widget_bline_width->set_value(synfigapp::Main::get_bline_width());
}
void
Widget_Defaults::blend_method_refresh()
{
- widget_blend_method->set_value(sinfgapp::Main::get_blend_method());
+ widget_blend_method->set_value(synfigapp::Main::get_blend_method());
}
void
Widget_Defaults::interpolation_refresh()
{
- widget_interpolation->set_value(sinfgapp::Main::get_interpolation());
+ widget_interpolation->set_value(synfigapp::Main::get_interpolation());
}
void
Widget_Defaults::opacity_refresh()
{
- widget_opacity->set_value(sinfgapp::Main::get_opacity());
+ widget_opacity->set_value(synfigapp::Main::get_opacity());
}
void
Widget_Defaults::on_opacity_changed()
{
- sinfgapp::Main::set_opacity(widget_opacity->get_value());
+ synfigapp::Main::set_opacity(widget_opacity->get_value());
}
void
Widget_Defaults::on_blend_method_changed()
{
- sinfgapp::Main::set_blend_method(Color::BlendMethod(widget_blend_method->get_value()));
+ synfigapp::Main::set_blend_method(Color::BlendMethod(widget_blend_method->get_value()));
}
void
Widget_Defaults::on_interpolation_changed()
{
- sinfgapp::Main::set_interpolation(Waypoint::Interpolation(widget_interpolation->get_value()));
+ synfigapp::Main::set_interpolation(Waypoint::Interpolation(widget_interpolation->get_value()));
}
void
Widget_Defaults::on_bline_width_changed()
{
- sinfgapp::Main::set_bline_width(widget_bline_width->get_value());
+ synfigapp::Main::set_bline_width(widget_bline_width->get_value());
}
void
Widget_Defaults::on_fg_color_clicked()
{
// Left click on foreground
- App::dialog_color->set_color(sinfgapp::Main::get_foreground_color());
+ App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
App::dialog_color->reset();
- App::dialog_color->signal_edited().connect(sigc::ptr_fun(sinfgapp::Main::set_foreground_color));
+ App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_foreground_color));
App::dialog_color->present();
}
Widget_Defaults::on_bg_color_clicked()
{
// Left click on background
- App::dialog_color->set_color(sinfgapp::Main::get_background_color());
+ App::dialog_color->set_color(synfigapp::Main::get_background_color());
App::dialog_color->reset();
- App::dialog_color->signal_edited().connect(sigc::ptr_fun(sinfgapp::Main::set_background_color));
+ App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_background_color));
App::dialog_color->present();
}
void
Widget_Defaults::on_swap_color_clicked()
{
- sinfgapp::Main::color_swap();
+ synfigapp::Main::color_swap();
}
void
Widget_Defaults::on_reset_color_clicked()
{
- sinfgapp::Main::set_background_color(Color::white());
- sinfgapp::Main::set_foreground_color(Color::black());
+ synfigapp::Main::set_background_color(Color::white());
+ synfigapp::Main::set_foreground_color(Color::black());
}
void
Widget_Defaults::on_gradient_clicked()
{
- App::dialog_gradient->set_gradient(sinfgapp::Main::get_gradient());
+ App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
App::dialog_gradient->reset();
- App::dialog_gradient->signal_edited().connect(sigc::ptr_fun(sinfgapp::Main::set_gradient));
+ App::dialog_gradient->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_gradient));
App::dialog_gradient->present();
}
const int w(get_width());
const int size=std::min(h-GRADIENT_HEIGHT,w);
- render_color_to_window(get_window(),Gdk::Rectangle(size/4,size/4,size/4*3-1,size/4*3-1),sinfgapp::Main::get_background_color());
- render_color_to_window(get_window(),Gdk::Rectangle(0,0,size/4*3-1,size/4*3-1),sinfgapp::Main::get_foreground_color());
- render_gradient_to_window(get_window(),Gdk::Rectangle(0,h-GRADIENT_HEIGHT,w,GRADIENT_HEIGHT-1),sinfgapp::Main::get_gradient());
+ render_color_to_window(get_window(),Gdk::Rectangle(size/4,size/4,size/4*3-1,size/4*3-1),synfigapp::Main::get_background_color());
+ render_color_to_window(get_window(),Gdk::Rectangle(0,0,size/4*3-1,size/4*3-1),synfigapp::Main::get_foreground_color());
+ render_gradient_to_window(get_window(),Gdk::Rectangle(0,h-GRADIENT_HEIGHT,w,GRADIENT_HEIGHT-1),synfigapp::Main::get_gradient());
Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
- layout->set_text(sinfgapp::Main::get_bline_width().get_string(2));
+ layout->set_text(synfigapp::Main::get_bline_width().get_string(2));
layout->set_alignment(Pango::ALIGN_CENTER);
layout->set_width(w/2);
get_window()->draw_layout(gc, w*3/4, (h-GRADIENT_HEIGHT)-16, layout);
if(y>size)
{
// Left click on gradient
- App::dialog_gradient->set_gradient(sinfgapp::Main::get_gradient());
+ App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
App::dialog_gradient->reset();
- App::dialog_gradient->signal_edited().connect(sigc::mem_fun(sinfgapp::Main::set_gradient));
+ App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
App::dialog_gradient->present();
return true;
}
if(x<size*3/4 && y<size*3/4)
{
// Left click on foreground
- App::dialog_color->set_color(sinfgapp::Main::get_foreground_color());
+ App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
App::dialog_color->reset();
- App::dialog_color->signal_edited().connect(sigc::mem_fun(sinfgapp::Main::set_foreground_color));
+ App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
App::dialog_color->present();
return true;
}
if(x>size*3/4 && y>size/4)
{
// Left click on background
- App::dialog_color->set_color(sinfgapp::Main::get_background_color());
+ App::dialog_color->set_color(synfigapp::Main::get_background_color());
App::dialog_color->reset();
- App::dialog_color->signal_edited().connect(sigc::mem_fun(sinfgapp::Main::set_background_color));
+ App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_background_color));
App::dialog_color->present();
return true;
}
}
if(x>size) // Left click on BLine Width
{
- Distance dist(sinfgapp::Main::get_bline_width());
+ Distance dist(synfigapp::Main::get_bline_width());
if(y<size/2) // increase BLine size
{
{
dist-=DEFAULT_INCREMENT;
}
- sinfgapp::Main::set_bline_width(dist);
+ synfigapp::Main::set_bline_width(dist);
}
}
if(event->button.button==3)
if(y>size)
{
// right click on gradient
- sinfgapp::Main::set_gradient_default_colors();
+ synfigapp::Main::set_gradient_default_colors();
return true;
}
else
if(x<size)
{
// right click on colors
- sinfgapp::Main::color_swap();
+ synfigapp::Main::color_swap();
return true;
}
if(x>w/2)
{
// right click on bline width
- sinfgapp::Main::set_bline_width(DEFAULT_WIDTH);
+ synfigapp::Main::set_bline_width(DEFAULT_WIDTH);
}
}
break;
case GDK_SCROLL:
{
- Distance dist(sinfgapp::Main::get_bline_width());
+ Distance dist(synfigapp::Main::get_bline_width());
if(event->scroll.direction==GDK_SCROLL_UP)
{
{
dist-=DEFAULT_INCREMENT;
}
- sinfgapp::Main::set_bline_width(dist);
+ synfigapp::Main::set_bline_width(dist);
}
default:
break;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_defaults.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_DEFAULTS_H
-#define __SINFG_STUDIO_WIDGET_DEFAULTS_H
+#ifndef __SYNFIG_STUDIO_WIDGET_DEFAULTS_H
+#define __SYNFIG_STUDIO_WIDGET_DEFAULTS_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/drawingarea.h>
#include <gtkmm/table.h>
-#include <sinfg/gradient.h>
+#include <synfig/gradient.h>
#include "widget_gradient.h"
#include <gtkmm/tooltips.h>
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_time.cpp
** \brief Template File
**
using namespace std;
//using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
int
Widget_Distance::on_input(double* new_value)
{
- distance_=sinfg::String(get_text());
+ distance_=synfig::String(get_text());
*new_value=distance_.get();
return 1;
}
try{
distance_=get_adjustment()->get_value();
set_text(distance_.get_string(get_digits()));
- } catch (...) { /* sinfg::error("Widget_Distance::on_output(): Caught something..."); */ }
+ } catch (...) { /* synfig::error("Widget_Distance::on_output(): Caught something..."); */ }
return true;
}
void
-Widget_Distance::set_value(const sinfg::Distance &data)
+Widget_Distance::set_value(const synfig::Distance &data)
{
distance_=data;
get_adjustment()->set_value(distance_.get());
}
-sinfg::Distance
+synfig::Distance
Widget_Distance::get_value() const
{
distance_=get_adjustment()->get_value();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_distance.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_DISTANCE_H
-#define __SINFG_STUDIO_WIDGET_DISTANCE_H
+#ifndef __SYNFIG_STUDIO_WIDGET_DISTANCE_H
+#define __SYNFIG_STUDIO_WIDGET_DISTANCE_H
/* === H E A D E R S ======================================================= */
#include <sigc++/slot.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/adjustment.h>
-#include <sinfg/distance.h>
+#include <synfig/distance.h>
/* === M A C R O S ========================================================= */
{
//sigc::signal<void> signal_value_changed_;
- mutable sinfg::Distance distance_;
+ mutable synfig::Distance distance_;
Gtk::Adjustment adjustment;
public:
//sigc::signal<void> &signal_value_changed() { return signal_value_changed_; }
- void set_value(const sinfg::Distance &data);
- sinfg::Distance get_value()const;
+ void set_value(const synfig::Distance &data);
+ synfig::Distance get_value()const;
Widget_Distance();
~Widget_Distance();
}; // END of class Widget_Distance
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_enum.cpp
** \brief Template File
**
#include <gtkmm/menu.h>
#include "widget_enum.h"
#include <ETL/stringf>
-#include <sinfg/valuenode.h>
+#include <synfig/valuenode.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
}
void
-Widget_Enum::set_param_desc(const sinfg::ParamDesc &x)
+Widget_Enum::set_param_desc(const synfig::ParamDesc &x)
{
param_desc=x;
//refresh();
{
enum_menu = manage(new class Gtk::Menu());
- std::list<sinfg::ParamDesc::EnumData> enum_list=param_desc.get_enum_list();
- std::list<sinfg::ParamDesc::EnumData>::iterator iter;
+ std::list<synfig::ParamDesc::EnumData> enum_list=param_desc.get_enum_list();
+ std::list<synfig::ParamDesc::EnumData>::iterator iter;
String name=strprintf("(%d)",value);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_enum.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_ENUM_H
-#define __SINFG_STUDIO_WIDGET_ENUM_H
+#ifndef __SYNFIG_STUDIO_WIDGET_ENUM_H
+#define __SYNFIG_STUDIO_WIDGET_ENUM_H
/* === H E A D E R S ======================================================= */
-#include <sinfg/layer.h>
+#include <synfig/layer.h>
#include <gtkmm/optionmenu.h>
-#include <sinfg/paramdesc.h>
+#include <synfig/paramdesc.h>
/* === M A C R O S ========================================================= */
class Widget_Enum : public Gtk::OptionMenu
{
Gtk::Menu *enum_menu;
- sinfg::ParamDesc param_desc;
+ synfig::ParamDesc param_desc;
int value;
void set_value_(int data);
Widget_Enum();
~Widget_Enum();
- void set_param_desc(const sinfg::ParamDesc &x);
+ void set_param_desc(const synfig::ParamDesc &x);
void refresh();
void set_value(int data);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_filename.cpp
** \brief Template File
**
using namespace std;
//using namespace etl;
-//using namespace sinfg;
+//using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_filename.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_FILENAME_H
-#define __SINFG_STUDIO_WIDGET_FILENAME_H
+#ifndef __SYNFIG_STUDIO_WIDGET_FILENAME_H
+#define __SYNFIG_STUDIO_WIDGET_FILENAME_H
/* === H E A D E R S ======================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_gradient.cpp
** \brief Template File
**
#include "widget_gradient.h"
#include "app.h"
#include <gtkmm/menu.h>
-#include <sinfg/exception.h>
+#include <synfig/exception.h>
#include <ETL/misc>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === P R O C E D U R E S ================================================= */
void
-studio::render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::Gradient &gradient)
+studio::render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Gradient &gradient)
{
int height = ca.get_height();
int width = ca.get_width()-4;
}
void
-Widget_Gradient::set_value(const sinfg::Gradient& x)
+Widget_Gradient::set_value(const synfig::Gradient& x)
{
gradient_=x;
if(gradient_.size())
}
void
-Widget_Gradient::set_selected_cpoint(const sinfg::Gradient::CPoint &x)
+Widget_Gradient::set_selected_cpoint(const synfig::Gradient::CPoint &x)
{
selected_cpoint=x;
signal_cpoint_selected_(selected_cpoint);
}
void
-Widget_Gradient::update_cpoint(const sinfg::Gradient::CPoint &x)
+Widget_Gradient::update_cpoint(const synfig::Gradient::CPoint &x)
{
try
{
gradient_.sort();
queue_draw();
}
- catch(sinfg::Exception::NotFound)
+ catch(synfig::Exception::NotFound)
{
// Yotta...
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_gradient.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_GRADIENT_H
-#define __SINFG_STUDIO_WIDGET_GRADIENT_H
+#ifndef __SYNFIG_STUDIO_WIDGET_GRADIENT_H
+#define __SYNFIG_STUDIO_WIDGET_GRADIENT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/drawingarea.h>
-#include <sinfg/gradient.h>
+#include <synfig/gradient.h>
/* === M A C R O S ========================================================= */
namespace studio {
-void render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::Gradient &gradient);
+void render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Gradient &gradient);
class Widget_Gradient : public Gtk::DrawingArea
{
sigc::signal<void> signal_value_changed_;
sigc::signal<void> signal_clicked_;
- sigc::signal<void,sinfg::Gradient::CPoint> signal_cpoint_selected_;
+ sigc::signal<void,synfig::Gradient::CPoint> signal_cpoint_selected_;
- sinfg::Gradient gradient_;
+ synfig::Gradient gradient_;
bool editable_;
bool changed_;
- sinfg::Gradient::CPoint selected_cpoint;
+ synfig::Gradient::CPoint selected_cpoint;
void popup_menu(float x);
sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
sigc::signal<void>& signal_clicked() { return signal_clicked_; }
- sigc::signal<void,sinfg::Gradient::CPoint>& signal_cpoint_selected() { return signal_cpoint_selected_; }
+ sigc::signal<void,synfig::Gradient::CPoint>& signal_cpoint_selected() { return signal_cpoint_selected_; }
- void set_value(const sinfg::Gradient& x);
+ void set_value(const synfig::Gradient& x);
- const sinfg::Gradient& get_value()const { return gradient_; }
+ const synfig::Gradient& get_value()const { return gradient_; }
void set_editable(bool x=true) { editable_=x; }
- void set_selected_cpoint(const sinfg::Gradient::CPoint &x);
+ void set_selected_cpoint(const synfig::Gradient::CPoint &x);
- const sinfg::Gradient::CPoint& get_selected_cpoint() { return selected_cpoint; }
+ const synfig::Gradient::CPoint& get_selected_cpoint() { return selected_cpoint; }
- void update_cpoint(const sinfg::Gradient::CPoint &x);
+ void update_cpoint(const synfig::Gradient::CPoint &x);
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_sound.cpp
** \brief Widget Sound Implementation File
**
#include <gtkmm/adjustment.h>
-#include <sinfg/general.h>
+#include <synfig/general.h>
#include <ETL/clock>
#include "widget_sound.h"
using namespace std;
using namespace etl;
-//using namespace sinfg;
+//using namespace synfig;
using studio::AudioProfile;
void studio::Widget_Sound::set_position(double t)
{
- //sinfg::info("Setting position to %.2lf s", t);
+ //synfig::info("Setting position to %.2lf s", t);
if(adj_timescale && t != adj_timescale->get_value())
{
float upper = adj_timescale->get_upper();
//redraw all the samples from begin to end, but only if we have samples to draw (or there is no space to draw)
- //sinfg::warning("Ok rendered everything, now must render actual sound wave");
+ //synfig::warning("Ok rendered everything, now must render actual sound wave");
if(!audioprof || !adj_timescale || !w)
{
get_window()->end_paint();
delta = (end - begin)/(float)w; //samples per pixel
- /*sinfg::warning("Rendering a framesize of %f secs from [%d,%d) samples to %d samples, took %f sec",
+ /*synfig::warning("Rendering a framesize of %f secs from [%d,%d) samples to %d samples, took %f sec",
framesize, begin, end, w, check());*/
cur = begin;
}
}
- //sinfg::warning("Drawing audio line");
+ //synfig::warning("Drawing audio line");
c.set_rgb_p(1,0,0);
gc->set_rgb_fg_color(c);
get_window()->draw_line(gc,posi,0,posi,get_height());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_sound.h
** \brief Widget Sound Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_WIDGET_SOUND_H
-#define __SINFG_WIDGET_SOUND_H
+#ifndef __SYNFIG_WIDGET_SOUND_H
+#define __SYNFIG_WIDGET_SOUND_H
/* === H E A D E R S ======================================================= */
#include <ETL/handle>
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_time.cpp
** \brief Template File
**
using namespace std;
//using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
void
-Widget_Time::set_value(const sinfg::Time &data)
+Widget_Time::set_value(const synfig::Time &data)
{
time_=data;
refresh_text();
}
-sinfg::Time
+synfig::Time
Widget_Time::get_value() const
{
return time_;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_time.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_TIME_H
-#define __SINFG_STUDIO_WIDGET_TIME_H
+#ifndef __SYNFIG_STUDIO_WIDGET_TIME_H
+#define __SYNFIG_STUDIO_WIDGET_TIME_H
/* === H E A D E R S ======================================================= */
#include <sigc++/signal.h>
#include <sigc++/slot.h>
#include <gtkmm/entry.h>
-#include <sinfg/time.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
float fps_;
- sinfg::Time time_;
+ synfig::Time time_;
protected:
bool on_focus_out_event(GdkEventFocus* event);
- void set_value(const sinfg::Time &data);
- sinfg::Time get_value()const;
+ void set_value(const synfig::Time &data);
+ synfig::Time get_value()const;
void set_fps(float x);
Widget_Time();
~Widget_Time();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_timeslider.cpp
** \brief Time Slider Widget Implementation File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using studio::Widget_Timeslider;
/* === P R O C E D U R E S ================================================= */
-Gdk::Color get_interp_color(sinfg::Interpolation x)
+Gdk::Color get_interp_color(synfig::Interpolation x)
{
switch(x)
{
studio::render_time_point_to_window(
const Glib::RefPtr<Gdk::Drawable>& window,
const Gdk::Rectangle& area,
- const sinfg::TimePoint &tp,
+ const synfig::TimePoint &tp,
bool selected
)
{
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(window);
if(!gc) return false;
- //sinfg::info("Drawing Timeslider");
+ //synfig::info("Drawing Timeslider");
//clear and update to current values
//invalidated = false;
//update_times();
if(end-start < EPSILON) return true;
- //sinfg::info("Drawing Lines");
+ //synfig::info("Drawing Lines");
//draw all the time stuff
double dtdp = (end - start)/get_width();
scale = *after;
}
- //sinfg::info("Range found: (l %.2lf,u %.2lf - m %.2lf) -> %.2lf",lowerrange,upperrange,midrange,scale);
+ //synfig::info("Range found: (l %.2lf,u %.2lf - m %.2lf) -> %.2lf",lowerrange,upperrange,midrange,scale);
//search around this area to get the right one
//sdindex = (int)floor(t + 0.5); //get how far through the range it is...
sdindex = round_to_int(t); //get how far through the range it is...
- //sinfg::info("Extracted fr %.2lf -> %d", t, sdindex);
+ //synfig::info("Extracted fr %.2lf -> %d", t, sdindex);
}
- //sinfg::info("Initial values: %.4lf t, %.1lf pixels, %d i", time,pixel,sdindex);
+ //synfig::info("Initial values: %.4lf t, %.1lf pixels, %d i", time,pixel,sdindex);
//loop to draw
const int heightbig = 12;
}
}
- //sinfg::info("Scrolling timerange to (%.4f,%.4f)",start,end);
+ //synfig::info("Scrolling timerange to (%.4f,%.4f)",start,end);
adj_timescale->set_lower(start);
adj_timescale->set_upper(end);
end = focuspoint + (end-focuspoint)*zoominfactor;
start = focuspoint + (start-focuspoint)*zoominfactor;
- //sinfg::info("Zooming in timerange to (%.4f,%.4f)",start,end);
+ //synfig::info("Zooming in timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
if(start < adj_bounds->get_lower())
end = focuspoint + (end-focuspoint)*zoomoutfactor;
start = focuspoint + (start-focuspoint)*zoomoutfactor;
- //sinfg::info("Zooming out timerange to (%.4f,%.4f)",start,end);
+ //synfig::info("Zooming out timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
if(start < adj_bounds->get_lower())
t = floor(t*fps + 0.5)/fps;
- /*sinfg::info("Clicking time from %.3lf to %.3lf [(%.2lf,%.2lf) %.2lf / %.2lf ... %.2lf",
+ /*synfig::info("Clicking time from %.3lf to %.3lf [(%.2lf,%.2lf) %.2lf / %.2lf ... %.2lf",
current, vt, start, end, event->x, w, fps);*/
if(t != current)
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_timeslider.h
** \brief Time Slider Widget Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_WIDGET_TIMESLIDER_H
-#define __SINFG_WIDGET_TIMESLIDER_H
+#ifndef __SYNFIG_WIDGET_TIMESLIDER_H
+#define __SYNFIG_WIDGET_TIMESLIDER_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/drawingarea.h>
#include <gtkmm/adjustment.h>
-#include <sinfg/time.h>
+#include <synfig/time.h>
#include "canvasview.h"
/* === M A C R O S ========================================================= */
namespace studio {
-void render_time_point_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::TimePoint &tp,bool selected=false);
+void render_time_point_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::TimePoint &tp,bool selected=false);
/* Design for the timeslider...
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_value.cpp
** \brief Template File
**
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace etl;
using namespace std;
using namespace studio;
}
void
-Widget_ValueBase::set_value(const sinfg::ValueBase &data)
+Widget_ValueBase::set_value(const synfig::ValueBase &data)
{
label->hide();
vector_widget->hide();
case ValueBase::TYPE_CANVAS:
assert(canvas);
canvas_widget->set_parent_canvas(canvas);
- canvas_widget->set_value(value.get(etl::loose_handle<sinfg::Canvas>()));
+ canvas_widget->set_value(value.get(etl::loose_handle<synfig::Canvas>()));
canvas_widget->show();
break;
case ValueBase::TYPE_BOOL:
break;
case ValueBase::TYPE_COLOR:
{
- color_widget->set_value(value.get(sinfg::Color()));
+ color_widget->set_value(value.get(synfig::Color()));
color_widget->show();
/*
Gdk::Color gdkcolor;
- sinfg::Color color=value.get(sinfg::Color());
+ synfig::Color color=value.get(synfig::Color());
gdkcolor.set_rgb_p(color.get_r(),color.get_g(),color.get_b());
color_widget->set_current_color(gdkcolor);
color_widget->set_has_opacity_control(true);
label->show();
break;
}
- }catch(...) { sinfg::error(__FILE__":%d: Caught something that was thrown",__LINE__); }
+ }catch(...) { synfig::error(__FILE__":%d: Caught something that was thrown",__LINE__); }
}
-const sinfg::ValueBase &
+const synfig::ValueBase &
Widget_ValueBase::get_value()
{
switch(value.get_type())
value=color_widget->get_value();
/*
Gdk::Color gdkcolor;
- sinfg::Color color;
+ synfig::Color color;
gdkcolor=color_widget->get_current_color();
color.set_r(gdkcolor.get_red_p());
color.set_g(gdkcolor.get_green_p());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_value.cpp
** \brief Template File
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_VALUE_H
-#define __SINFG_GTKMM_VALUE_H
+#ifndef __SYNFIG_GTKMM_VALUE_H
+#define __SYNFIG_GTKMM_VALUE_H
/* === H E A D E R S ======================================================= */
//#include <gtkmm/colorselection.h>
#include <gtkmm/optionmenu.h>
-//#include <sinfg/sinfg.h>
-#include <sinfg/paramdesc.h>
-#include <sinfg/value.h>
-#include <sinfg/canvas.h>
+//#include <synfig/synfig.h>
+#include <synfig/paramdesc.h>
+#include <synfig/value.h>
+#include <synfig/canvas.h>
/* === M A C R O S ========================================================= */
class Widget_ValueBase : public Gtk::HBox
{
Gtk::Label *label;
- sinfg::ValueBase value;
+ synfig::ValueBase value;
Widget_Vector *vector_widget;
Gtk::SpinButton *real_widget;
// std::string hint;
- sinfg::ParamDesc param_desc;
- etl::handle<sinfg::Canvas> canvas;
+ synfig::ParamDesc param_desc;
+ etl::handle<synfig::Canvas> canvas;
sigc::signal<void> signal_value_changed_;
sigc::signal<void> signal_activate_;
sigc::signal<void>& signal_activate() { return signal_activate_; }
- void set_value(const sinfg::ValueBase &data);
- const sinfg::ValueBase &get_value();
+ void set_value(const synfig::ValueBase &data);
+ const synfig::ValueBase &get_value();
void on_grab_focus();
- void set_param_desc(const sinfg::ParamDesc &x) { param_desc=x; }
- const sinfg::ParamDesc &get_param_desc() { return param_desc; }
+ void set_param_desc(const synfig::ParamDesc &x) { param_desc=x; }
+ const synfig::ParamDesc &get_param_desc() { return param_desc; }
void set_sensitive(bool x);
//void set_hint(std::string x) { hint=x; }
// std::string get_hint() { return hint; }
- void set_canvas(etl::handle<sinfg::Canvas> x) { canvas=x; assert(canvas); }
+ void set_canvas(etl::handle<synfig::Canvas> x) { canvas=x; assert(canvas); }
void inside_cellrenderer();
Widget_ValueBase();
~Widget_ValueBase();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_vector.cpp
** \brief Template File
**
/* === U S I N G =========================================================== */
using namespace std;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
}
void
-Widget_Vector::set_value(const sinfg::Vector &data)
+Widget_Vector::set_value(const synfig::Vector &data)
{
vector=data;
distance_y->set_value(disty);
spinbutton_x->hide();
spinbutton_y->hide();
- }catch(...) { sinfg::error("Widget_Vector::set_value(): Caught something that was thrown"); }}
+ }catch(...) { synfig::error("Widget_Vector::set_value(): Caught something that was thrown"); }}
else
{
spinbutton_x->set_value(vector[0]);
}
}
-const sinfg::Vector &
+const synfig::Vector &
Widget_Vector::get_value()
{
if(!canvas_ && spinbutton_x)
vector[1]=distance_y->get_value().units(canvas_->rend_desc());
spinbutton_x->hide();
spinbutton_y->hide();
- }catch(...) { sinfg::error("Widget_Vector::set_value(): Caught something that was thrown"); }
+ }catch(...) { synfig::error("Widget_Vector::set_value(): Caught something that was thrown"); }
return vector;
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file widget_vector.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_WIDGET_VECTOR_H
-#define __SINFG_STUDIO_WIDGET_VECTOR_H
+#ifndef __SYNFIG_STUDIO_WIDGET_VECTOR_H
+#define __SYNFIG_STUDIO_WIDGET_VECTOR_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/box.h>
#include <gtkmm/adjustment.h>
-#include <sinfg/vector.h>
-#include <sinfg/distance.h>
-#include <sinfg/canvas.h>
+#include <synfig/vector.h>
+#include <synfig/distance.h>
+#include <synfig/canvas.h>
/* === M A C R O S ========================================================= */
Gtk::Adjustment x_adjustment;
Gtk::Adjustment y_adjustment;
- sinfg::Vector vector;
+ synfig::Vector vector;
sigc::signal<void> signal_value_changed_;
sigc::signal<void> signal_activate_;
- sinfg::Canvas::LooseHandle canvas_;
+ synfig::Canvas::LooseHandle canvas_;
public:
void activate() { signal_activate_(); }
- void set_canvas(sinfg::Canvas::LooseHandle);
- sinfg::Canvas::LooseHandle get_canvas()const { return canvas_; }
+ void set_canvas(synfig::Canvas::LooseHandle);
+ synfig::Canvas::LooseHandle get_canvas()const { return canvas_; }
sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
void on_value_changed();
void on_grab_focus();
- void set_value(const sinfg::Vector &data);
- const sinfg::Vector &get_value();
+ void set_value(const synfig::Vector &data);
+ const synfig::Vector &get_value();
void set_has_frame(bool x);
void set_digits(int x);
Widget_Vector();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypoint.cpp
** \brief Template Header
**
#include "widget_waypoint.h"
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace std;
using namespace etl;
using namespace studio;
/* === M E T H O D S ======================================================= */
-Widget_Waypoint::Widget_Waypoint(etl::handle<sinfg::Canvas> canvas):
+Widget_Waypoint::Widget_Waypoint(etl::handle<synfig::Canvas> canvas):
Gtk::Table(4,3,false),
- waypoint(sinfg::ValueBase(),0),
+ waypoint(synfig::ValueBase(),0),
adj_tension(0.0,-20,20,0.1,1),
adj_continuity(0.0,-20,20,0.1,1),
adj_bias(0.0,-20,20,0.1,1),
}
void
-Widget_Waypoint::set_canvas(sinfg::Canvas::Handle x)
+Widget_Waypoint::set_canvas(synfig::Canvas::Handle x)
{
canvas=x;
assert(canvas);
}
void
-Widget_Waypoint::set_waypoint(sinfg::Waypoint &x)
+Widget_Waypoint::set_waypoint(synfig::Waypoint &x)
{
time_widget->set_fps(canvas->rend_desc().get_frame_rate());
adj_temporal_tension.set_value(waypoint.get_temporal_tension());
}
-const sinfg::Waypoint &
+const synfig::Waypoint &
Widget_Waypoint::get_waypoint()const
{
#warning This too!
waypoint.set_value(value_widget->get_value());
//int i;
- waypoint.set_before((sinfg::Waypoint::Interpolation)before->get_history());
- waypoint.set_after((sinfg::Waypoint::Interpolation)after->get_history());
+ waypoint.set_before((synfig::Waypoint::Interpolation)before->get_history());
+ waypoint.set_after((synfig::Waypoint::Interpolation)after->get_history());
waypoint.set_tension(adj_tension.get_value());
waypoint.set_continuity(adj_continuity.get_value());
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypoint.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_WIDGET_WAYPOINT_H
-#define __SINFG_GTKMM_WIDGET_WAYPOINT_H
+#ifndef __SYNFIG_GTKMM_WIDGET_WAYPOINT_H
+#define __SYNFIG_GTKMM_WIDGET_WAYPOINT_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/spinbutton.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/waypoint.h>
-//#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/waypoint.h>
+//#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
Gtk::Label *value_node_label;
Gtk::Label *label;
Widget_Time *time_widget;
- mutable sinfg::Waypoint waypoint;
- sinfg::Canvas::Handle canvas;
+ mutable synfig::Waypoint waypoint;
+ synfig::Canvas::Handle canvas;
//Gtk::Adjustment time_adjustment;
Gtk::Combo *in,*out;
// Gtk::ComboDropDownItem item;
public:
- Widget_Waypoint(etl::handle<sinfg::Canvas> canvas);
- void set_canvas(sinfg::Canvas::Handle x);
- void set_waypoint(sinfg::Waypoint &x);
- const sinfg::Waypoint &get_waypoint()const;
+ Widget_Waypoint(etl::handle<synfig::Canvas> canvas);
+ void set_canvas(synfig::Canvas::Handle x);
+ void set_waypoint(synfig::Waypoint &x);
+ const synfig::Waypoint &get_waypoint()const;
}; // END of class Widget_Waypoint
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypointmodel.cpp
** \brief Template Header
**
#include "widget_waypointmodel.h"
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace std;
using namespace etl;
using namespace studio;
}
void
-Widget_WaypointModel::set_waypoint_model(sinfg::Waypoint::Model &x)
+Widget_WaypointModel::set_waypoint_model(synfig::Waypoint::Model &x)
{
waypoint_model=x;
updating=true;
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_waypointmodel.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_WIDGET_WAYPOINTMODEL_H
-#define __SINFG_GTKMM_WIDGET_WAYPOINTMODEL_H
+#ifndef __SYNFIG_GTKMM_WIDGET_WAYPOINTMODEL_H
+#define __SYNFIG_GTKMM_WIDGET_WAYPOINTMODEL_H
/* === H E A D E R S ======================================================= */
#include <gtkmm/checkbutton.h>
-#include <sinfg/waypoint.h>
-#include <sinfg/string.h>
-#include <sinfg/time.h>
+#include <synfig/waypoint.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
/* === M A C R O S ========================================================= */
class Widget_WaypointModel : public Gtk::Table
{
- sinfg::Waypoint::Model waypoint_model;
+ synfig::Waypoint::Model waypoint_model;
bool updating;
public:
Widget_WaypointModel();
- void set_waypoint_model(sinfg::Waypoint::Model &x);
- const sinfg::Waypoint::Model &get_waypoint_model()const { return waypoint_model; }
+ void set_waypoint_model(synfig::Waypoint::Model &x);
+ const synfig::Waypoint::Model &get_waypoint_model()const { return waypoint_model; }
}; // END of class Widget_WaypointModel
}; // END of namespace studio
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file workarea.cpp
** \brief Template Header
**
#include <sigc++/hide.h>
#include <ETL/misc>
-#include <sinfg/target_scanline.h>
-#include <sinfg/target_tile.h>
-#include <sinfg/surface.h>
-#include <sinfgapp/canvasinterface.h>
+#include <synfig/target_scanline.h>
+#include <synfig/target_tile.h>
+#include <synfig/surface.h>
+#include <synfigapp/canvasinterface.h>
#include "event_mouse.h"
#include "event_layerclick.h"
#include "widget_color.h"
-#include <sinfg/distance.h>
+#include <synfig/distance.h>
#include "workarearenderer.h"
#include "renderer_canvas.h"
#include "asyncrenderer.h"
#include <gtkmm/frame.h>
-#include <sinfg/mutex.h>
+#include <synfig/mutex.h>
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === C L A S S E S ======================================================= */
-class WorkAreaTarget : public sinfg::Target_Tile
+class WorkAreaTarget : public synfig::Target_Tile
{
public:
WorkArea *workarea;
bool onion_first_tile;
int onion_layers;
- std::list<sinfg::Time> onion_skin_queue;
+ std::list<synfig::Time> onion_skin_queue;
- sinfg::Mutex mutex;
+ synfig::Mutex mutex;
void set_onion_skin(bool x)
{
workarea->queue_draw();
}
- virtual bool set_rend_desc(sinfg::RendDesc *newdesc)
+ virtual bool set_rend_desc(synfig::RendDesc *newdesc)
{
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
virtual int next_frame(Time& time)
{
- sinfg::Mutex::Lock lock(mutex);
+ synfig::Mutex::Lock lock(mutex);
if(!onionskin)
- return sinfg::Target_Tile::next_frame(time);
+ return synfig::Target_Tile::next_frame(time);
onion_first_tile=(onion_layers==(signed)onion_skin_queue.size());
virtual int next_tile(int& x, int& y)
{
- sinfg::Mutex::Lock lock(mutex);
+ synfig::Mutex::Lock lock(mutex);
//if(workarea->tile_queue.empty()) return 0;
//int curr_tile(workarea->tile_queue.front());
}
- virtual bool start_frame(sinfg::ProgressCallback *cb)
+ virtual bool start_frame(synfig::ProgressCallback *cb)
{
- sinfg::Mutex::Lock lock(mutex);
+ synfig::Mutex::Lock lock(mutex);
int tw(rend_desc().get_w()/get_tile_w());
if(rend_desc().get_w()%get_tile_w()!=0)tw++;
static void free_buff(const guint8 *x) { free(const_cast<guint8*>(x)); }
- virtual bool add_tile(const sinfg::Surface &surface, int x, int y)
+ virtual bool add_tile(const synfig::Surface &surface, int x, int y)
{
- sinfg::Mutex::Lock lock(mutex);
+ synfig::Mutex::Lock lock(mutex);
assert(surface);
PixelFormat pf(PF_RGB);
- const int total_bytes(get_tile_w()*get_tile_h()*sinfg::channels(pf));
+ const int total_bytes(get_tile_w()*get_tile_h()*synfig::channels(pf));
unsigned char *buffer((unsigned char*)malloc(total_bytes));
8, // bits per sample
surface.get_w(), // width
surface.get_h(), // height
- surface.get_w()*sinfg::channels(pf), // stride (pitch)
+ surface.get_w()*synfig::channels(pf), // stride (pitch)
sigc::ptr_fun(&WorkAreaTarget::free_buff)
);
};
-class WorkAreaTarget_Full : public sinfg::Target_Scanline
+class WorkAreaTarget_Full : public synfig::Target_Scanline
{
public:
WorkArea *workarea;
Surface surface;
- std::list<sinfg::Time> onion_skin_queue;
+ std::list<synfig::Time> onion_skin_queue;
void set_onion_skin(bool x)
{
{
}
- virtual bool set_rend_desc(sinfg::RendDesc *newdesc)
+ virtual bool set_rend_desc(synfig::RendDesc *newdesc)
{
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
workarea->tile_book[0].second=refresh_id;
if(!onionskin)
- return sinfg::Target_Scanline::next_frame(time);
+ return synfig::Target_Scanline::next_frame(time);
onion_first_tile=(onion_layers==(signed)onion_skin_queue.size());
}
- virtual bool start_frame(sinfg::ProgressCallback *cb)
+ virtual bool start_frame(synfig::ProgressCallback *cb)
{
return true;
}
PixelFormat pf(PF_RGB);
- const int total_bytes(surface.get_w()*surface.get_h()*sinfg::channels(pf));
+ const int total_bytes(surface.get_w()*surface.get_h()*synfig::channels(pf));
unsigned char *buffer((unsigned char*)malloc(total_bytes));
8, // bits per sample
surface.get_w(), // width
surface.get_h(), // height
- surface.get_w()*sinfg::channels(pf), // stride (pitch)
+ surface.get_w()*synfig::channels(pf), // stride (pitch)
sigc::ptr_fun(&WorkAreaTarget::free_buff)
);
/* === M E T H O D S ======================================================= */
-WorkArea::WorkArea(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface):
+WorkArea::WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface):
Gtk::Table(4+RULER_FIX, 3, false),
canvas_interface(canvas_interface),
canvas(canvas_interface->get_canvas()),
attach(*drawing_frame, 1, 3+RULER_FIX, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- Gtk::IconSize iconsize=Gtk::IconSize::from_name("sinfg-small_icon");
+ Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
// Create the vertical and horizontal rulers
set_grid_size(Vector(gx,gy));
}
else
- sinfg::error("WorkArea::load_meta_data(): Unable to parse data for \"grid_size\", which was \"%s\"",data.c_str());
+ synfig::error("WorkArea::load_meta_data(): Unable to parse data for \"grid_size\", which was \"%s\"",data.c_str());
data=canvas->get_meta_data("grid_show");
if(data.size() && (data=="1" || data[0]=='t' || data[0]=='T'))
}
void
-WorkArea::set_grid_size(const sinfg::Vector &s)
+WorkArea::set_grid_size(const synfig::Vector &s)
{
Duckmatic::set_grid_size(s);
save_meta_data();
}
void
-WorkArea::set_focus_point(const sinfg::Point &point)
+WorkArea::set_focus_point(const synfig::Point &point)
{
// These next three lines try to ensure that we place the
// focus on a pixel boundry
adjusted[0]=(abs(adjusted[0]-floor(adjusted[0]))<0.5)?floor(adjusted[0])*abs(get_pw()):ceil(adjusted[0])*abs(get_ph());
adjusted[1]=(abs(adjusted[1]-floor(adjusted[1]))<0.5)?floor(adjusted[1])*abs(get_ph()):ceil(adjusted[1])*abs(get_ph());
*/
- const sinfg::Point& adjusted(point);
+ const synfig::Point& adjusted(point);
- sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+ synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
Real x_factor=(rend_desc.get_br()[0]-rend_desc.get_tl()[0]>0)?-1:1;
Real y_factor=(rend_desc.get_br()[1]-rend_desc.get_tl()[1]>0)?-1:1;
get_scrolly_adjustment()->set_value(adjusted[1]*y_factor);
}
-sinfg::Point
+synfig::Point
WorkArea::get_focus_point()const
{
- sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+ synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
Real x_factor=(rend_desc.get_br()[0]-rend_desc.get_tl()[0]>0)?-1:1;
Real y_factor=(rend_desc.get_br()[1]-rend_desc.get_tl()[1]>0)?-1:1;
- return sinfg::Point(get_scrollx_adjustment()->get_value()*x_factor, get_scrolly_adjustment()->get_value()*y_factor);
+ return synfig::Point(get_scrollx_adjustment()->get_value()*x_factor, get_scrolly_adjustment()->get_value()*y_factor);
}
bool
break;
}
- sinfgapp::Action::PassiveGrouper grouper(instance.get(),"Nudge");
+ synfigapp::Action::PassiveGrouper grouper(instance.get(),"Nudge");
// Grid snap does not apply to nudging
bool grid_snap_holder(get_grid_snap());
bool
WorkArea::on_drawing_area_event(GdkEvent *event)
{
- sinfg::Point mouse_pos;
+ synfig::Point mouse_pos;
float bezier_click_pos;
const float radius((abs(pw)+abs(ph))*4);
int button_pressed(0);
// and the buttons
if(!event->button.axes)
{
- mouse_pos=sinfg::Point(screen_to_comp_coords(sinfg::Point(event->button.x,event->button.y)));
+ mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(event->button.x,event->button.y)));
button_pressed=event->button.button;
pressure=1.0f;
is_mouse=true;
return false;
pressure=event->button.axes[2];
- //sinfg::info("pressure=%f",pressure);
+ //synfig::info("pressure=%f",pressure);
pressure-=0.04f;
pressure/=1.0f-0.04f;
assert(!isnan(pressure));
- mouse_pos=sinfg::Point(screen_to_comp_coords(sinfg::Point(x,y)));
+ mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)));
button_pressed=event->button.button;
pressure=0;
//if(event->any.type==GDK_BUTTON_PRESS && button_pressed)
- // sinfg::info("Button pressed on input device = %d",event->button.button);
+ // synfig::info("Button pressed on input device = %d",event->button.button);
//if(event->button.axes[2]>0.1)
// button_pressed=1;
}
if(dragging!=DRAG_WINDOW)
{ // Update those triangle things on the rulers
- const sinfg::Point point(mouse_pos);
+ const synfig::Point point(mouse_pos);
hruler->property_position()=Distance(point[0],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
vruler->property_position()=Distance(point[1],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
}
else
if(dragging==DRAG_DUCK)
{
- sinfgapp::Action::PassiveGrouper grouper(instance.get(),"Move");
+ synfigapp::Action::PassiveGrouper grouper(instance.get(),"Move");
dragging=DRAG_NONE;
//translate_selected_ducks(mouse_pos);
set_axis_lock(false);
if(modifier&GDK_SHIFT_MASK)
{
- //sinfg::info("DUCK_DRAG_RELEASE: SHIFT-MASK ON!");
+ //synfig::info("DUCK_DRAG_RELEASE: SHIFT-MASK ON!");
if(clicked_duck)
{
- //sinfg::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
+ //synfig::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
unselect_duck(clicked_duck);
}
}
else if(modifier&GDK_CONTROL_MASK)
{
- //sinfg::info("DUCK_DRAG_RELEASE: CONTROL-MASK ON!");
+ //synfig::info("DUCK_DRAG_RELEASE: CONTROL-MASK ON!");
if(clicked_duck)
{
- //sinfg::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
+ //synfig::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
unselect_duck(clicked_duck);
}
}
else
{
- //sinfg::info("DUCK_DRAG_RELEASE: NO MASK!");
+ //synfig::info("DUCK_DRAG_RELEASE: NO MASK!");
if(clicked_duck)
{
- //sinfg::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
+ //synfig::info("DUCK_DRAG_RELEASE: CLICKED DUCK!");
clear_selected_ducks();
select_duck(clicked_duck);
}
if(isnan(y) || isnan(x))
return false;
- *curr_guide=sinfg::Point(screen_to_comp_coords(sinfg::Point(x,y)))[1];
+ *curr_guide=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)))[1];
queue_draw();
}
void
WorkArea::refresh_dimension_info()
{
- sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+ synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
canvaswidth=rend_desc.get_br()[0]-rend_desc.get_tl()[0];
canvasheight=rend_desc.get_br()[1]-rend_desc.get_tl()[1];
if(drawing_area->get_width()<=0 || drawing_area->get_height()<=0 || w==0 || h==0)
return;
- const sinfg::Point focus_point(get_focus_point());
- const sinfg::Real x(focus_point[0]/pw+drawing_area->get_width()/2-w/2);
- const sinfg::Real y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
+ const synfig::Point focus_point(get_focus_point());
+ const synfig::Real x(focus_point[0]/pw+drawing_area->get_width()/2-w/2);
+ const synfig::Real y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
window_tl[0]=rend_desc.get_tl()[0]-pw*x;
window_br[0]=rend_desc.get_br()[0]+pw*(drawing_area->get_width()-x-w);
}
-sinfg::Point
-WorkArea::screen_to_comp_coords(sinfg::Point pos)const
+synfig::Point
+WorkArea::screen_to_comp_coords(synfig::Point pos)const
{
- sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
- //sinfg::Vector::value_type canvaswidth=rend_desc.get_br()[0]-rend_desc.get_tl()[0];
- //sinfg::Vector::value_type canvasheight=rend_desc.get_br()[1]-rend_desc.get_tl()[1];
- //sinfg::Vector::value_type pw=canvaswidth/w;
- //sinfg::Vector::value_type ph=canvasheight/h;
+ synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
+ //synfig::Vector::value_type canvaswidth=rend_desc.get_br()[0]-rend_desc.get_tl()[0];
+ //synfig::Vector::value_type canvasheight=rend_desc.get_br()[1]-rend_desc.get_tl()[1];
+ //synfig::Vector::value_type pw=canvaswidth/w;
+ //synfig::Vector::value_type ph=canvasheight/h;
Vector focus_point=get_focus_point();
- sinfg::Vector::value_type x=focus_point[0]/pw+drawing_area->get_width()/2-w/2;
- sinfg::Vector::value_type y=focus_point[1]/ph+drawing_area->get_height()/2-h/2;
+ synfig::Vector::value_type x=focus_point[0]/pw+drawing_area->get_width()/2-w/2;
+ synfig::Vector::value_type y=focus_point[1]/ph+drawing_area->get_height()/2-h/2;
- return rend_desc.get_tl()-sinfg::Point(pw*x,ph*y)+sinfg::Point(pw*pos[0],ph*pos[1]);
+ return rend_desc.get_tl()-synfig::Point(pw*x,ph*y)+synfig::Point(pw*pos[0],ph*pos[1]);
}
-sinfg::Point
-WorkArea::comp_to_screen_coords(sinfg::Point pos)const
+synfig::Point
+WorkArea::comp_to_screen_coords(synfig::Point pos)const
{
- sinfg::warning("WorkArea::comp_to_screen_coords: Not yet implemented");
- return sinfg::Point();
+ synfig::warning("WorkArea::comp_to_screen_coords: Not yet implemented");
+ return synfig::Point();
}
int
if(tile_book.empty())
return -1;
- //const sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+ //const synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_focus_point());
+ const synfig::Vector focus_point(get_focus_point());
// Calculate the window coordinates of the top-left
// corner of the canvas.
- const sinfg::Vector::value_type
+ const synfig::Vector::value_type
x(focus_point[0]/pw+drawing_area->get_width()/2-w/2),
y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
drawing_area->get_window()->clear();
- //const sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+ //const synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
- const sinfg::Vector focus_point(get_focus_point());
+ const synfig::Vector focus_point(get_focus_point());
// Update the old focus point
last_focus_point=focus_point;
// Calculate the window coordinates of the top-left
// corner of the canvas.
- //const sinfg::Vector::value_type
+ //const synfig::Vector::value_type
// x(focus_point[0]/pw+drawing_area->get_width()/2-w/2),
// y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
- //const sinfg::Vector::value_type window_startx(window_tl[0]);
- //const sinfg::Vector::value_type window_endx(window_br[0]);
- //const sinfg::Vector::value_type window_starty(window_tl[1]);
- //const sinfg::Vector::value_type window_endy(window_br[1]);
+ //const synfig::Vector::value_type window_startx(window_tl[0]);
+ //const synfig::Vector::value_type window_endx(window_br[0]);
+ //const synfig::Vector::value_type window_starty(window_tl[1]);
+ //const synfig::Vector::value_type window_endy(window_br[1]);
Glib::RefPtr<Gdk::GC> gc=Gdk::GC::create(drawing_area->get_window());
// If we are in animate mode, draw a red border around the screen
- if(canvas_interface->get_mode()&sinfgapp::MODE_ANIMATE)
+ if(canvas_interface->get_mode()&synfigapp::MODE_ANIMATE)
{
/*gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
}
-class WorkAreaProgress : public sinfg::ProgressCallback
+class WorkAreaProgress : public synfig::ProgressCallback
{
WorkArea *work_area;
ProgressCallback *cb;
//studio::App::Busy busy;
//WorkAreaProgress callback(this,get_canvas_view()->get_ui_interface().get());
- //sinfg::ProgressCallback *cb=&callback;
+ //synfig::ProgressCallback *cb=&callback;
if(!is_visible())return false;
// been set, so there is no need to have to
// recalculate that over again.
// UPDATE: This is kind of needless with
- // the way that time is handled now in SINFG.
+ // the way that time is handled now in SYNFIG.
//target->set_avoid_time_sync(true);
async_renderer=new AsyncRenderer(target);
async_renderer->signal_finished().connect(
rendering=true;
async_renderer->start();
- sinfg::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
+ synfig::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
rendering=true;
cb->task("Rendering...");
void
studio::WorkArea::async_update_finished()
{
- sinfg::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
+ synfig::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
rendering=false;
studio::App::Busy busy;
WorkAreaProgress callback(this,get_canvas_view()->get_ui_interface().get());
- sinfg::ProgressCallback *cb=&callback;
+ synfig::ProgressCallback *cb=&callback;
// We don't want to render if we are already rendering
if(rendering)
void
WorkArea::queue_scroll()
{
-// const sinfg::RendDesc &rend_desc(get_canvas()->rend_desc());
+// const synfig::RendDesc &rend_desc(get_canvas()->rend_desc());
- const sinfg::Point focus_point(get_focus_point());
+ const synfig::Point focus_point(get_focus_point());
- const sinfg::Real
+ const synfig::Real
new_x(focus_point[0]/pw+drawing_area->get_width()/2-w/2),
new_y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
- const sinfg::Real
+ const synfig::Real
old_x(last_focus_point[0]/pw+drawing_area->get_width()/2-w/2),
old_y(last_focus_point[1]/ph+drawing_area->get_height()/2-h/2);
void
studio::WorkArea::queue_render_preview()
{
- //sinfg::info("queue_render_preview(): called for %s", get_canvas_view()->get_time().get_string().c_str());
+ //synfig::info("queue_render_preview(): called for %s", get_canvas_view()->get_time().get_string().c_str());
if(queued==true)
{
return;
- //sinfg::info("queue_render_preview(): already queued, unqueuing");
+ //synfig::info("queue_render_preview(): already queued, unqueuing");
/* if(render_idle_func_id)
g_source_remove(render_idle_func_id);
render_idle_func_id=0;
if(queued==false)
{
- //sinfg::info("queue_render_preview(): (re)queuing...");
+ //synfig::info("queue_render_preview(): (re)queuing...");
//render_idle_func_id=g_idle_add_full(G_PRIORITY_DEFAULT,__render_preview,this,NULL);
render_idle_func_id=g_timeout_add_full(G_PRIORITY_DEFAULT,queue_time,__render_preview,this,NULL);
queued=true;
}
void
-WorkArea::set_selected_value_node(etl::loose_handle<sinfg::ValueNode> x)
+WorkArea::set_selected_value_node(etl::loose_handle<synfig::ValueNode> x)
{
if(x!=selected_value_node_)
{
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file workarea.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_GTKMM_WORKAREA_H
-#define __SINFG_GTKMM_WORKAREA_H
+#ifndef __SYNFIG_GTKMM_WORKAREA_H
+#define __SYNFIG_GTKMM_WORKAREA_H
/* === H E A D E R S ======================================================= */
#include <gdkmm/cursor.h>
#include <gdkmm/device.h>
-#include <sinfg/time.h>
-#include <sinfg/vector.h>
-#include <sinfg/general.h>
-#include <sinfg/renddesc.h>
-#include <sinfg/canvas.h>
+#include <synfig/time.h>
+#include <synfig/vector.h>
+#include <synfig/general.h>
+#include <synfig/renddesc.h>
+#include <synfig/canvas.h>
#include "zoomdial.h"
#include "duckmatic.h"
class WorkAreaTarget;
class WorkAreaTarget_Full;
-namespace sinfgapp { class CanvasInterface; };
+namespace synfigapp { class CanvasInterface; };
-namespace sinfg { class Layer; };
+namespace synfig { class Layer; };
namespace Gtk { class Frame; };
namespace studio
etl::handle<studio::AsyncRenderer> async_renderer;
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface;
- etl::handle<sinfg::Canvas> canvas;
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface;
+ etl::handle<synfig::Canvas> canvas;
etl::loose_handle<studio::Instance> instance;
etl::loose_handle<studio::CanvasView> canvas_view;
// Bleh!
int w; //!< Width of the image (in pixels)
int h; //!< Height of the image (in pixels)
- sinfg::Real canvaswidth; //!< Width of the canvas
- sinfg::Real canvasheight; //!< Height of the canvas
- sinfg::Real pw; //!< The width of a pixel
- sinfg::Real ph; //!< The height of a pixel
+ synfig::Real canvaswidth; //!< Width of the canvas
+ synfig::Real canvasheight; //!< Height of the canvas
+ synfig::Real pw; //!< The width of a pixel
+ synfig::Real ph; //!< The height of a pixel
float zoom; //!< Zoom factor
float prev_zoom; //!< Previous Zoom factor
- sinfg::Point window_tl; //!< The (theoretical) top-left corner of the view window
- sinfg::Point window_br; //!< The (theoretical) bottom-right corner of the view window
+ synfig::Point window_tl; //!< The (theoretical) top-left corner of the view window
+ synfig::Point window_br; //!< The (theoretical) bottom-right corner of the view window
guint32 last_event_time;
//unsigned char *buffer;
//! ???
- sinfg::ProgressCallback *progresscallback;
+ synfig::ProgressCallback *progresscallback;
//! ???
- sinfg::RendDesc desc;
+ synfig::RendDesc desc;
//! This flag is set if the user is dragging the video window
/*! \see drag_point */
etl::handle<Duckmatic::Duck> hover_duck;
//! When dragging the viewport, this is set to the origin of the drag
- sinfg::Point drag_point;
+ synfig::Point drag_point;
- sinfg::Point curr_point;
+ synfig::Point curr_point;
//! ???
- sinfg::Point previous_focus;
+ synfig::Point previous_focus;
//! This flag is set if the grid should be drawn
bool show_grid;
gint render_idle_func_id;
//! The coordinates of the focus the last time a part of the screen was refreshed
- sinfg::Point last_focus_point;
+ synfig::Point last_focus_point;
bool canceled_;
bool onion_skin;
- etl::loose_handle<sinfg::ValueNode> selected_value_node_;
+ etl::loose_handle<synfig::ValueNode> selected_value_node_;
/*
public:
- const etl::loose_handle<sinfg::ValueNode>& get_selected_value_node() { return selected_value_node_; }
- const sinfg::Point& get_drag_point()const { return drag_point; }
+ const etl::loose_handle<synfig::ValueNode>& get_selected_value_node() { return selected_value_node_; }
+ const synfig::Point& get_drag_point()const { return drag_point; }
std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& get_tile_book(){ return tile_book; }
int get_refreshes()const { return refreshes; }
bool get_canceled()const { return canceled_; }
sigc::signal<void,GdkDevice* > signal_input_device_changed_;
//! One signal per button
- sigc::signal<void,sinfg::Point> signal_user_click_[5];
+ sigc::signal<void,synfig::Point> signal_user_click_[5];
sigc::signal<void> signal_popup_menu_;
sigc::signal<void> signal_onion_skin_changed_;
//! Signal for when the user clicks on a layer
- sigc::signal<void, etl::handle<sinfg::Layer> > signal_layer_selected_;
+ sigc::signal<void, etl::handle<synfig::Layer> > signal_layer_selected_;
sigc::signal<void> signal_view_window_changed_;
sigc::signal<void> &signal_popup_menu() { return signal_popup_menu_; }
//! One signal per button (5 buttons)
- sigc::signal<void,sinfg::Point> &signal_user_click(int button=0){ return signal_user_click_[button]; }
+ sigc::signal<void,synfig::Point> &signal_user_click(int button=0){ return signal_user_click_[button]; }
- sigc::signal<void, etl::handle<sinfg::Layer> >& signal_layer_selected() { return signal_layer_selected_; }
+ sigc::signal<void, etl::handle<synfig::Layer> >& signal_layer_selected() { return signal_layer_selected_; }
/*
-- ** -- P U B L I C M E T H O D S -----------------------------------------
bool get_onion_skin()const;
void toggle_onion_skin() { set_onion_skin(!get_onion_skin()); }
- void set_selected_value_node(etl::loose_handle<sinfg::ValueNode> x);
+ void set_selected_value_node(etl::loose_handle<synfig::ValueNode> x);
bool is_dragging() { return dragging!=DRAG_NONE; }
DragMode get_dragging_mode() { return dragging; }
- WorkArea(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface);
+ WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface);
virtual ~WorkArea();
void set_cursor(const Gdk::Cursor& x);
void set_cursor(Gdk::CursorType x);
- const sinfg::Point& get_cursor_pos()const { return curr_point; }
+ const synfig::Point& get_cursor_pos()const { return curr_point; }
Gtk::Adjustment *get_scrollx_adjustment() { return &scrollx_adjustment; }
Gtk::Adjustment *get_scrolly_adjustment() { return &scrolly_adjustment; }
const Gtk::Adjustment *get_scrolly_adjustment()const { return &scrolly_adjustment; }
void set_instance(etl::loose_handle<studio::Instance> x) { instance=x; }
- void set_canvas(etl::handle<sinfg::Canvas> x) { canvas=x; }
+ void set_canvas(etl::handle<synfig::Canvas> x) { canvas=x; }
void set_canvas_view(etl::loose_handle<studio::CanvasView> x) { canvas_view=x; }
- etl::handle<sinfg::Canvas> get_canvas()const { return canvas; }
+ etl::handle<synfig::Canvas> get_canvas()const { return canvas; }
etl::handle<studio::Instance> get_instance()const { return instance; }
etl::loose_handle<studio::CanvasView> get_canvas_view()const { return canvas_view; }
void queue_scroll();
//! Sets the size of the grid
- void set_grid_size(const sinfg::Vector &s);
+ void set_grid_size(const synfig::Vector &s);
//! ??
void popup_menu();
int get_bpp()const { return bpp; }
//! ??
- const sinfg::RendDesc &get_rend_desc()const { return desc; }
+ const synfig::RendDesc &get_rend_desc()const { return desc; }
//! ??
- void set_rend_desc(const sinfg::RendDesc &x) { desc=x; }
+ void set_rend_desc(const synfig::RendDesc &x) { desc=x; }
//! Converts screen coords (ie: pixels) to composition coordinates
- sinfg::Point screen_to_comp_coords(sinfg::Point pos)const;
+ synfig::Point screen_to_comp_coords(synfig::Point pos)const;
//! Converts composition coordinates to screen coords (ie: pixels)
- sinfg::Point comp_to_screen_coords(sinfg::Point pos)const;
+ synfig::Point comp_to_screen_coords(synfig::Point pos)const;
float get_pw()const { return pw; }
float get_ph()const { return ph; }
- const sinfg::Point &get_window_tl()const { return window_tl; }
- const sinfg::Point &get_window_br()const { return window_br; }
+ const synfig::Point &get_window_tl()const { return window_tl; }
+ const synfig::Point &get_window_br()const { return window_br; }
bool async_update_preview();
void async_update_finished();
- void async_render_preview(sinfg::Time time);
+ void async_render_preview(synfig::Time time);
void async_render_preview();
bool sync_update_preview();
- bool sync_render_preview(sinfg::Time time);
+ bool sync_render_preview(synfig::Time time);
bool sync_render_preview();
void sync_render_preview_hook();
void set_zoom(float z);
- void set_progress_callback(sinfg::ProgressCallback *x) { progresscallback=x; }
- sinfg::ProgressCallback *get_progress_callback() { return progresscallback; }
+ void set_progress_callback(synfig::ProgressCallback *x) { progresscallback=x; }
+ synfig::ProgressCallback *get_progress_callback() { return progresscallback; }
- void set_focus_point(const sinfg::Point &x);
+ void set_focus_point(const synfig::Point &x);
- sinfg::Point get_focus_point()const;
+ synfig::Point get_focus_point()const;
void done_rendering();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
WorkAreaRenderer::get_ph()const
{ return get_work_area()->get_ph(); }
-sinfg::Point
-WorkAreaRenderer::screen_to_comp_coords(sinfg::Point pos)const
+synfig::Point
+WorkAreaRenderer::screen_to_comp_coords(synfig::Point pos)const
{
return get_work_area()->screen_to_comp_coords(pos);
}
-sinfg::Point
-WorkAreaRenderer::comp_to_screen_coords(sinfg::Point pos)const
+synfig::Point
+WorkAreaRenderer::comp_to_screen_coords(synfig::Point pos)const
{
return get_work_area()->comp_to_screen_coords(pos);
}
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_WORKAREARENDERER_H
-#define __SINFG_WORKAREARENDERER_H
+#ifndef __SYNFIG_WORKAREARENDERER_H
+#define __SYNFIG_WORKAREARENDERER_H
/* === H E A D E R S ======================================================= */
#include <ETL/handle>
#include <sigc++/signal.h>
#include <sigc++/object.h>
-#include <sinfg/vector.h>
+#include <synfig/vector.h>
#include <gdkmm/drawable.h>
#include <gdkmm/rectangle.h>
float get_ph()const;
//! Converts screen coords (ie: pixels) to composition coordinates
- sinfg::Point screen_to_comp_coords(sinfg::Point pos)const;
+ synfig::Point screen_to_comp_coords(synfig::Point pos)const;
//! Converts composition coordinates to screen coords (ie: pixels)
- sinfg::Point comp_to_screen_coords(sinfg::Point pos)const;
+ synfig::Point comp_to_screen_coords(synfig::Point pos)const;
WorkAreaRenderer();
virtual ~WorkAreaRenderer();
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file zoomdial.cpp
** \brief Template File
**
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file zoomdial.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_STUDIO_ZOOMDIAL_H
-#define __SINFG_STUDIO_ZOOMDIAL_H
+#ifndef __SYNFIG_STUDIO_ZOOMDIAL_H
+#define __SYNFIG_STUDIO_ZOOMDIAL_H
/* === H E A D E R S ======================================================= */
+++ /dev/null
-# $Header: /opt/voria/cvs/studio/src/sinfgapp/Makefile.am,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-
-MAINTAINERCLEANFILES=Makefile.in
-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/libltdl
-
-LAYER_ACTION_HH=actions/layerremove.h actions/layermove.h actions/layerraise.h actions/layerlower.h actions/layeradd.h actions/layeractivate.h actions/layerparamset.h actions/layerparamconnect.h actions/layerparamdisconnect.h actions/layerencapsulate.h actions/layerduplicate.h actions/layersetdesc.h
-LAYER_ACTION_CC=actions/layerremove.cpp actions/layermove.cpp actions/layerraise.cpp actions/layerlower.cpp actions/layeradd.cpp actions/layeractivate.cpp actions/layerparamset.cpp actions/layerparamconnect.cpp actions/layerparamdisconnect.cpp actions/layerencapsulate.cpp actions/layerduplicate.cpp actions/layersetdesc.cpp
-
-VALUEDESC_ACTION_HH=actions/valuedescset.h actions/valuedescexport.h actions/valuedescconvert.h actions/valuedescconnect.h actions/valuedescdisconnect.h actions/valuedesclink.h
-VALUEDESC_ACTION_CC=actions/valuedescset.cpp actions/valuedescexport.cpp actions/valuedescconvert.cpp actions/valuedescconnect.cpp actions/valuedescdisconnect.cpp actions/valuedesclink.cpp
-
-VALUENODE_ACTION_HH=actions/valuenodeconstset.h actions/valuenodeadd.h actions/valuenodereplace.h actions/valuenodelinkconnect.h actions/valuenodelinkdisconnect.h actions/valuenodedynamiclistinsert.h actions/valuenodedynamiclistremove.h actions/valuenoderename.h actions/valuenoderemove.h actions/valuenodedynamiclistinsertsmart.h actions/valuenodedynamiclistremovesmart.h actions/valuenodedynamiclistloop.h actions/valuenodedynamiclistunloop.h actions/valuenodedynamiclistrotateorder.h
-VALUENODE_ACTION_CC=actions/valuenodeconstset.cpp actions/valuenodeadd.cpp actions/valuenodereplace.cpp actions/valuenodelinkconnect.cpp actions/valuenodelinkdisconnect.cpp actions/valuenodedynamiclistinsert.cpp actions/valuenodedynamiclistremove.cpp actions/valuenoderename.cpp actions/valuenoderemove.cpp actions/valuenodedynamiclistinsertsmart.cpp actions/valuenodedynamiclistremovesmart.cpp actions/valuenodedynamiclistloop.cpp actions/valuenodedynamiclistunloop.cpp actions/valuenodedynamiclistrotateorder.cpp
-
-WAYPOINT_ACTION_HH=actions/waypointadd.h actions/waypointset.h actions/waypointsetsmart.h actions/waypointremove.h actions/waypointsimpleadd.h
-WAYPOINT_ACTION_CC=actions/waypointadd.cpp actions/waypointset.cpp actions/waypointsetsmart.cpp actions/waypointremove.cpp actions/waypointsimpleadd.cpp
-
-TIMEPOINT_ACTION_HH=actions/timepointsmove.h actions/timepointscopy.h actions/timepointsdelete.h timegather.h
-TIMEPOINT_ACTION_CC=actions/timepointsmove.cpp actions/timepointscopy.cpp actions/timepointsdelete.cpp timegather.cpp
-
-ACTIVEPOINT_ACTION_HH=actions/activepointadd.h actions/activepointset.h actions/activepointsetsmart.h actions/activepointsetoff.h actions/activepointseton.h actions/activepointremove.h actions/activepointsimpleadd.h
-ACTIVEPOINT_ACTION_CC=actions/activepointadd.cpp actions/activepointset.cpp actions/activepointsetsmart.cpp actions/activepointsetoff.cpp actions/activepointseton.cpp actions/activepointremove.cpp actions/activepointsimpleadd.cpp
-
-KEYFRAME_ACTION_HH=actions/keyframesetdelta.h actions/keyframeadd.h actions/keyframeset.h actions/keyframeremove.h actions/keyframeduplicate.h actions/keyframewaypointset.h
-KEYFRAME_ACTION_CC=actions/keyframesetdelta.cpp actions/keyframeadd.cpp actions/keyframeset.cpp actions/keyframeremove.cpp actions/keyframeduplicate.cpp actions/keyframewaypointset.cpp
-
-CANVAS_ACTION_HH=actions/canvasrenddescset.h actions/canvasadd.h actions/canvasremove.h
-CANVAS_ACTION_CC=actions/canvasrenddescset.cpp actions/canvasadd.cpp actions/canvasremove.cpp
-
-GROUP_ACTION_HH=actions/groupaddlayers.h actions/groupremovelayers.h actions/groupremove.h actions/grouprename.h
-GROUP_ACTION_CC=actions/groupaddlayers.cpp actions/groupremovelayers.cpp actions/groupremove.cpp actions/grouprename.cpp
-
-OTHER_ACTION_HH=actions/colorset.h actions/editmodeset.h actions/blinepointtangentmerge.h actions/blinepointtangentsplit.h actions/gradientset.h
-OTHER_ACTION_CC=actions/colorset.cpp actions/editmodeset.cpp actions/blinepointtangentmerge.cpp actions/blinepointtangentsplit.cpp actions/gradientset.cpp
-
-ACTIONHH=$(GROUP_ACTION_HH) $(LAYER_ACTION_HH) $(VALUEDSEC_ACTION_HH) $(VALUENODE_ACTION_HH) $(WAYPOINT_ACTION_HH) $(KEYFRAME_ACTION_HH) $(OTHER_ACTION_HH) $(CANVAS_ACTION_HH) $(ACTIVEPOINT_ACTION_HH) $(TIMEPOINT_ACTION_HH)
-ACTIONCC=$(GROUP_ACTION_CC) $(LAYER_ACTION_CC) $(VALUEDESC_ACTION_CC) $(VALUENODE_ACTION_CC) $(WAYPOINT_ACTION_CC) $(KEYFRAME_ACTION_CC) $(OTHER_ACTION_CC) $(CANVAS_ACTION_CC) $(ACTIVEPOINT_ACTION_CC) $(TIMEPOINT_ACTION_CC)
-
-SINFGAPPHH=$(ACTIONHH) blineconvert.h cvs.h editmode.h action.h action_param.h action_system.h canvasinterface.h instance.h selectionmanager.h uimanager.h value_desc.h main.h inputdevice.h settings.h
-
-sinfglibdir=@sinfglibdir@
-
-lib_LTLIBRARIES = libsinfgapp.la
-libsinfgapp_la_SOURCES = $(SINFGAPPHH) $(ACTIONCC) blineconvert.cpp cvs.cpp main.cpp action_param.cpp action.cpp action_system.cpp canvasinterface.cpp instance.cpp uimanager.cpp inputdevice.cpp settings.cpp
-libsinfgapp_la_LIBADD = @SINFG_LIBS@
-libsinfgapp_la_CXXFLAGS = @SINFG_CFLAGS@
-libsinfgapp_la_LDFLAGS = -export-dynamic -no-undefined
-
-include_sinfgappdir=$(prefix)/include/sinfgapp-0.0/sinfgapp
-include_sinfgapp_HEADERS = $(SINFGAPPHH)
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action.cpp
-** \brief Template File
-**
-** $Id: action.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "action.h"
-#include "instance.h"
-
-
-#include "actions/layerremove.h"
-#include "actions/layermove.h"
-#include "actions/layerraise.h"
-#include "actions/layerlower.h"
-#include "actions/layeradd.h"
-#include "actions/layeractivate.h"
-#include "actions/layerparamset.h"
-#include "actions/layerparamconnect.h"
-#include "actions/layerparamdisconnect.h"
-#include "actions/layerencapsulate.h"
-#include "actions/layerduplicate.h"
-#include "actions/layersetdesc.h"
-
-#include "actions/valuenodeconstset.h"
-#include "actions/valuenodeadd.h"
-#include "actions/valuenodereplace.h"
-#include "actions/valuenodelinkconnect.h"
-#include "actions/valuenodelinkdisconnect.h"
-#include "actions/valuenodedynamiclistinsert.h"
-#include "actions/valuenodedynamiclistremove.h"
-#include "actions/valuenodedynamiclistinsertsmart.h"
-#include "actions/valuenodedynamiclistremovesmart.h"
-#include "actions/valuenodedynamiclistloop.h"
-#include "actions/valuenodedynamiclistunloop.h"
-#include "actions/valuenodedynamiclistrotateorder.h"
-#include "actions/valuenoderename.h"
-#include "actions/valuenoderemove.h"
-
-#include "actions/valuedescset.h"
-#include "actions/valuedescexport.h"
-#include "actions/valuedescconvert.h"
-#include "actions/valuedescconnect.h"
-#include "actions/valuedescdisconnect.h"
-#include "actions/valuedesclink.h"
-
-#include "actions/waypointadd.h"
-#include "actions/waypointset.h"
-#include "actions/waypointsetsmart.h"
-#include "actions/waypointremove.h"
-
-#include "actions/activepointadd.h"
-#include "actions/activepointset.h"
-#include "actions/activepointsetsmart.h"
-#include "actions/activepointsetoff.h"
-#include "actions/activepointseton.h"
-#include "actions/activepointremove.h"
-
-#include "actions/keyframeadd.h"
-#include "actions/keyframeset.h"
-#include "actions/keyframeremove.h"
-#include "actions/keyframeduplicate.h"
-#include "actions/keyframewaypointset.h"
-#include "actions/keyframesetdelta.h"
-
-#include "actions/timepointsmove.h"
-#include "actions/timepointscopy.h"
-#include "actions/timepointsdelete.h"
-
-#include "actions/canvasrenddescset.h"
-#include "actions/canvasadd.h"
-#include "actions/canvasremove.h"
-
-#include "actions/editmodeset.h"
-
-#include "actions/blinepointtangentmerge.h"
-#include "actions/blinepointtangentsplit.h"
-
-#include "actions/gradientset.h"
-#include "actions/colorset.h"
-
-#include "actions/groupaddlayers.h"
-#include "actions/groupremovelayers.h"
-#include "actions/groupremove.h"
-#include "actions/grouprename.h"
-
-#include "canvasinterface.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === S T A T I C S ======================================================= */
-
-sinfgapp::Action::Book *book_;
-
-/* === M E T H O D S ======================================================= */
-
-#define ADD_ACTION(x) { BookEntry &be(book()[x::name__]); \
- be.name=x::name__; \
- be.local_name=x::local_name__; \
- be.version=x::version__; \
- be.task=x::task__; \
- be.priority=x::priority__; \
- be.category=x::category__; \
- be.factory=x::create; \
- be.get_param_vocab=x::get_param_vocab; \
- be.is_canidate=x::is_canidate; \
- }
-
-
-Action::Main::Main()
-{
- book_=new sinfgapp::Action::Book();
-
- ADD_ACTION(Action::LayerRemove);
- ADD_ACTION(Action::LayerMove);
- ADD_ACTION(Action::LayerRaise);
- ADD_ACTION(Action::LayerLower);
- ADD_ACTION(Action::LayerAdd);
- ADD_ACTION(Action::LayerActivate);
- ADD_ACTION(Action::LayerParamSet);
- ADD_ACTION(Action::LayerParamConnect);
- ADD_ACTION(Action::LayerParamDisconnect);
- ADD_ACTION(Action::LayerEncapsulate);
- ADD_ACTION(Action::LayerDuplicate);
- ADD_ACTION(Action::LayerSetDesc);
-
- ADD_ACTION(Action::ValueNodeConstSet);
- ADD_ACTION(Action::ValueNodeAdd);
- ADD_ACTION(Action::ValueNodeReplace);
- ADD_ACTION(Action::ValueNodeLinkConnect);
- ADD_ACTION(Action::ValueNodeLinkDisconnect);
- ADD_ACTION(Action::ValueNodeDynamicListInsert);
- ADD_ACTION(Action::ValueNodeDynamicListRemove);
- ADD_ACTION(Action::ValueNodeDynamicListInsertSmart);
- ADD_ACTION(Action::ValueNodeDynamicListRemoveSmart);
- ADD_ACTION(Action::ValueNodeDynamicListLoop);
- ADD_ACTION(Action::ValueNodeDynamicListUnLoop);
- ADD_ACTION(Action::ValueNodeDynamicListRotateOrder);
- ADD_ACTION(Action::ValueNodeRename);
- ADD_ACTION(Action::ValueNodeRemove);
-
- ADD_ACTION(Action::ValueDescSet);
- ADD_ACTION(Action::ValueDescExport);
- ADD_ACTION(Action::ValueDescConvert);
- ADD_ACTION(Action::ValueDescConnect);
- ADD_ACTION(Action::ValueDescDisconnect);
- ADD_ACTION(Action::ValueDescLink);
-
- ADD_ACTION(Action::WaypointAdd);
- ADD_ACTION(Action::WaypointSet);
- ADD_ACTION(Action::WaypointSetSmart);
- ADD_ACTION(Action::WaypointRemove);
-
- ADD_ACTION(Action::ActivepointAdd);
- ADD_ACTION(Action::ActivepointSet);
- ADD_ACTION(Action::ActivepointSetSmart);
- ADD_ACTION(Action::ActivepointSetOn);
- ADD_ACTION(Action::ActivepointSetOff);
- ADD_ACTION(Action::ActivepointRemove);
-
- ADD_ACTION(Action::KeyframeAdd);
- ADD_ACTION(Action::KeyframeSet);
- ADD_ACTION(Action::KeyframeRemove);
- ADD_ACTION(Action::KeyframeDuplicate);
- ADD_ACTION(Action::KeyframeWaypointSet);
- ADD_ACTION(Action::KeyframeSetDelta);
-
- ADD_ACTION(Action::CanvasRendDescSet);
- ADD_ACTION(Action::CanvasAdd);
- ADD_ACTION(Action::CanvasRemove);
-
- ADD_ACTION(Action::EditModeSet);
-
- ADD_ACTION(Action::BLinePointTangentMerge);
- ADD_ACTION(Action::BLinePointTangentSplit);
-
- ADD_ACTION(Action::GradientSet);
- ADD_ACTION(Action::ColorSet);
-
- ADD_ACTION(Action::TimepointsMove);
- ADD_ACTION(Action::TimepointsCopy);
- ADD_ACTION(Action::TimepointsDelete);
-
- ADD_ACTION(Action::GroupAddLayers);
- ADD_ACTION(Action::GroupRemoveLayers);
- ADD_ACTION(Action::GroupRemove);
- ADD_ACTION(Action::GroupRename);
-}
-
-Action::Main::~Main()
-{
- delete book_;
-
-}
-
-
-Action::Book& Action::book() { return *book_; }
-
-
-Action::Handle
-Action::create(const String &name)
-{
- if(!book().count(name))
- return 0; //! \todo perhaps we should throw something instead?
- return book()[name].factory();
-}
-
-
-Action::CanidateList
-Action::compile_canidate_list(const ParamList& param_list, Category category)
-{
- Action::CanidateList ret;
-
- Book::const_iterator iter;
-
- //sinfg::info("param_list.size()=%d",param_list.size());
-
- for(iter=book().begin();iter!=book().end();++iter)
- {
- if((iter->second.category&category))
- {
- if(iter->second.is_canidate(param_list))
- ret.push_back(iter->second);
- else
- {
- //sinfg::info("Action \"%s\" is not a canidate",iter->second.name.c_str());
- }
- }
- }
-
- return ret;
-}
-
-Action::CanidateList::iterator
-Action::CanidateList::find(const String& x)
-{
- iterator iter;
- for(iter=begin();iter!=end();++iter)
- if(iter->name==x)
- break;
- return iter;
-}
-
-void
-Action::Base::set_param_list(const ParamList ¶m_list)
-{
- ParamList::const_iterator iter;
-
- for(iter=param_list.begin();iter!=param_list.end();++iter)
- set_param(iter->first,iter->second);
-}
-
-void
-Super::perform()
-{
- set_dirty(false);
-
- prepare();
-
- ActionList::const_iterator iter;
- for(iter=action_list_.begin();iter!=action_list_.end();++iter)
- {
- try
- {
- try
- {
- (*iter)->perform();
- CanvasSpecific* canvas_specific(dynamic_cast<CanvasSpecific*>(iter->get()));
- if(canvas_specific && canvas_specific->is_dirty())
- set_dirty(true);
- }
- catch(...)
- {
- if(iter!=action_list_.begin())
- {
- for(--iter;iter!=action_list_.begin();--iter)
- (*iter)->undo();
- (*iter)->undo();
- }
- throw;
- }
- }
- catch(Error x)
- {
- throw Error(x.get_type(),((*iter)->get_name()+": "+x.get_desc()).c_str());
- }
- }
-}
-
-void
-Super::undo()
-{
- set_dirty(false);
-
- ActionList::const_reverse_iterator iter;
- for(iter=const_cast<const ActionList &>(action_list_).rbegin();iter!=const_cast<const ActionList &>(action_list_).rend();++iter)
- {
- try {
- (*iter)->undo();
- CanvasSpecific* canvas_specific(dynamic_cast<CanvasSpecific*>(iter->get()));
- if(canvas_specific && canvas_specific->is_dirty())
- set_dirty(true);
- }
- catch(...)
- {
- if(iter!=const_cast<const ActionList &>(action_list_).rbegin())
- {
- for(--iter;iter!=const_cast<const ActionList &>(action_list_).rbegin();--iter)
- (*iter)->perform();
- (*iter)->perform();
- }
- throw;
- }
- }
-}
-
-void
-Super::add_action(etl::handle<Undoable> action)
-{
- action_list_.push_back(action);
- CanvasSpecific *specific_action=dynamic_cast<CanvasSpecific *>(action.get());
- if(specific_action && !get_canvas())
- set_canvas(specific_action->get_canvas());
-}
-
-void
-Super::add_action_front(etl::handle<Undoable> action)
-{
- action_list_.push_front(action);
- CanvasSpecific *specific_action=dynamic_cast<CanvasSpecific *>(action.get());
- if(specific_action && !get_canvas())
- set_canvas(specific_action->get_canvas());
-}
-
-
-Group::Group(const std::string &str):
- name_(str),
- ready_(true)
-{
-}
-
-Group::~Group()
-{
-}
-
-
-
-
-Action::ParamVocab
-Action::CanvasSpecific::get_param_vocab()
-{
- ParamVocab ret;
-
- ret.push_back(ParamDesc("canvas",Param::TYPE_CANVAS)
- .set_local_name(_("Canvas"))
- .set_desc(_("Selected Canvas"))
- );
-
- ret.push_back(ParamDesc("canvas_interface",Param::TYPE_CANVASINTERFACE)
- .set_local_name(_("Canvas Interface"))
- .set_desc(_("Canvas Interface"))
- .set_optional(true)
- );
-
-
- return ret;
-}
-
-bool
-CanvasSpecific::set_param(const sinfg::String& name, const Param ¶m)
-{
- if(name=="canvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- if(!param.get_canvas())
- return false;
- set_canvas(param.get_canvas());
-
- return true;
- }
- if(name=="canvas_interface" && param.get_type()==Param::TYPE_CANVASINTERFACE)
- {
- if(!param.get_canvas_interface())
- return false;
- set_canvas_interface(param.get_canvas_interface());
- if(!get_canvas())
- set_canvas(get_canvas_interface()->get_canvas());
-
- return true;
- }
- if(name=="edit_mode" && param.get_type()==Param::TYPE_EDITMODE)
- {
- set_edit_mode(param.get_edit_mode());
-
- return true;
- }
-
- return false;
-}
-
-bool
-CanvasSpecific::is_ready()const
-{
- if(!get_canvas())
- return false;
- return true;
-}
-
-EditMode
-CanvasSpecific::get_edit_mode()const
-{
- if(mode_!=MODE_UNDEFINED)
- return mode_;
-
- if(get_canvas_interface())
- return get_canvas_interface()->get_mode();
-
- return MODE_NORMAL;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action.h
-** \brief Template File
-**
-** $Id: action.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_H
-#define __SINFG_APP_ACTION_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/string.h>
-#include <sinfg/canvas.h>
-#include <ETL/handle>
-#include <ETL/stringf>
-#include <ETL/trivial>
-
-#include <map>
-#include <list>
-
-#include <sinfg/layer.h>
-#include <sinfg/canvas.h>
-#include <sinfg/valuenode.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/value.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/string.h>
-#include <sinfg/keyframe.h>
-
-#include "action_param.h"
-#include "editmode.h"
-
-/* === M A C R O S ========================================================= */
-
-#define ACTION_MODULE_EXT public: \
- static const char name__[], local_name__[], version__[], cvs_id__[], task__[]; \
- static const Category category__; \
- static const int priority__; \
- static Action::Base *create(); \
- virtual sinfg::String get_name()const; \
- virtual sinfg::String get_local_name()const;
-
-
-#define ACTION_SET_NAME(class,x) const char class::name__[]=x
-
-#define ACTION_SET_CATEGORY(class,x) const Category class::category__(x)
-
-#define ACTION_SET_TASK(class,x) const char class::task__[]=x
-
-#define ACTION_SET_PRIORITY(class,x) const int class::priority__=x
-
-#define ACTION_SET_LOCAL_NAME(class,x) const char class::local_name__[]=x
-
-#define ACTION_SET_VERSION(class,x) const char class::version__[]=x
-
-#define ACTION_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
-
-#define ACTION_INIT(class) \
- Action::Base* class::create() { return new class(); } \
- sinfg::String class::get_name()const { return name__; } \
- sinfg::String class::get_local_name()const { return local_name__; } \
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfg {
-class ProgressCallback;
-class Canvas;
-}; // END of namespace sinfg
-
-namespace sinfgapp {
-
-class Instance;
-class Main;
-
-namespace Action {
-
-class System;
-
-
-//! Exception class, thrown when redoing or undoing an action
-class Error
-{
-public:
- enum Type
- {
- TYPE_UNKNOWN,
- TYPE_UNABLE,
- TYPE_BADPARAM,
- TYPE_CRITICAL,
- TYPE_NOTREADY,
- TYPE_BUG,
-
- TYPE_END
- };
-private:
-
- Type type_;
- sinfg::String desc_;
-
-public:
-
- Error(Type type, const char *format, ...):
- type_(type)
- {
- va_list args;
- va_start(args,format);
- desc_=etl::vstrprintf(format,args);
- }
-
- Error(const char *format, ...):
- type_(TYPE_UNKNOWN)
- {
- va_list args;
- va_start(args,format);
- desc_=etl::vstrprintf(format,args);
- }
-
- Error(Type type=TYPE_UNABLE):
- type_(type)
- {
- }
-
- Type get_type()const { return type_; }
- sinfg::String get_desc()const { return desc_; }
-
-}; // END of class Action::Error
-
-class Param;
-class ParamList;
-class ParamDesc;
-class ParamVocab;
-
-// Action Category
-enum Category
-{
- CATEGORY_NONE =0,
- CATEGORY_LAYER =(1<<0),
- CATEGORY_CANVAS =(1<<1),
- CATEGORY_WAYPOINT =(1<<2),
- CATEGORY_ACTIVEPOINT =(1<<3),
- CATEGORY_VALUEDESC =(1<<4),
- CATEGORY_VALUENODE =(1<<5),
- CATEGORY_KEYFRAME =(1<<6),
- CATEGORY_GROUP =(1<<7),
-
- CATEGORY_OTHER =(1<<12),
-
- CATEGORY_DRAG =(1<<24),
-
- CATEGORY_HIDDEN =(1<<31),
- CATEGORY_ALL =(~0)-(1<<31) //!< All categories (EXCEPT HIDDEN)
-}; // END of enum Category
-
-inline Category operator|(Category lhs, Category rhs)
-{ return static_cast<Category>(int(lhs)|int(rhs)); }
-
-
-
-//! Action Base Class
-/*! An action should implement the following functions:
-** static bool is_canidate(const ParamList &x);
-** - Checks the ParamList to see if this action could be performed.
-** static ParamVocab get_param_vocab();
-** - Yields the ParamVocab object which describes what
-** this action needs before it can perform the act.
-** static Action::Base* create();
-** - Factory for creating this action from a ParamList
-**
-*/
-class Base : public etl::shared_object
-{
-protected:
- Base() { }
-
-public:
- virtual ~Base() { };
-
- //! This function will throw an Action::Error() on failure
- virtual void perform()=0;
-
- virtual bool set_param(const sinfg::String& name, const Param &) { return false; }
- virtual bool is_ready()const=0;
-
- virtual sinfg::String get_name()const =0;
- virtual sinfg::String get_local_name()const { return get_name(); }
-
- void set_param_list(const ParamList &);
-
-}; // END of class Action::Base
-
-typedef Action::Base* (*Factory)();
-typedef bool (*CanidateChecker)(const ParamList &x);
-typedef ParamVocab (*GetParamVocab)();
-
-typedef etl::handle<Base> Handle;
-
-//! Undoable Action Base Class
-class Undoable : public Base
-{
- friend class System;
- bool active_;
-
-protected:
- Undoable():active_(true) { }
-
-private:
- void set_active(bool x) { active_=x; }
-
-public:
-
- //! This function will throw an Action::Error() on failure
- virtual void undo()=0;
-
- bool is_active()const { return active_; }
-
-}; // END of class Action::Undoable
-
-//! Action base class for canvas-specific actions
-class CanvasSpecific
-{
-private:
- bool is_dirty_;
- EditMode mode_;
-
- etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_;
- sinfg::Canvas::Handle canvas_;
-
-protected:
- CanvasSpecific(const sinfg::Canvas::Handle &canvas):is_dirty_(true),mode_(MODE_UNDEFINED),canvas_(canvas) { }
- CanvasSpecific():mode_(MODE_UNDEFINED) { }
-
- virtual ~CanvasSpecific() { };
-
-
-public:
-
- void set_canvas(sinfg::Canvas::Handle x) { canvas_=x; }
- void set_canvas_interface(etl::loose_handle<sinfgapp::CanvasInterface> x) { canvas_interface_=x; }
-
- sinfg::Canvas::Handle get_canvas()const { return canvas_; }
- etl::loose_handle<sinfgapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
-
- static ParamVocab get_param_vocab();
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- EditMode get_edit_mode()const;
-
- void set_edit_mode(EditMode x) { mode_=x; }
-
- bool is_dirty()const { return is_dirty_; }
- void set_dirty(bool x=true) { is_dirty_=x; }
-
-}; // END of class Action::Undoable
-
-typedef std::list< etl::handle<Action::Undoable> > ActionList;
-
-/*! \class sinfgapp::Action::Super
-** \brief Super-Action base class for actions composed of several other actions.
-**
-** Actions deriving from this class should only implement prepare(), and
-** NOT implement perform() or undo().
-*/
-class Super : public Undoable, public CanvasSpecific
-{
- ActionList action_list_;
-
-public:
-
- ActionList &action_list() { return action_list_; }
- const ActionList &action_list()const { return action_list_; }
-
- virtual void prepare()=0;
-
- void clear() { action_list().clear(); }
-
- bool first_time()const { return action_list_.empty(); }
-
- void add_action(etl::handle<Undoable> action);
-
- void add_action_front(etl::handle<Undoable> action);
-
- virtual void perform();
- virtual void undo();
-
-}; // END of class Action::Super
-
-
-class Group : public Super
-{
- sinfg::String name_;
-
- ActionList action_list_;
-protected:
- bool ready_;
-public:
- Group(const sinfg::String &str="Group");
- virtual ~Group();
-
- virtual sinfg::String get_name()const { return name_; }
-
- virtual void prepare() { };
-
- virtual bool set_param(const sinfg::String& name, const Param &)const { return false; }
- virtual bool is_ready()const { return ready_; }
-
- void set_name(std::string&x) { name_=x; }
-}; // END of class Action::Group
-
-
-
-
-
-struct BookEntry
-{
- sinfg::String name;
- sinfg::String local_name;
- sinfg::String version;
- sinfg::String task;
- int priority;
- Category category;
- Factory factory;
- CanidateChecker is_canidate;
- GetParamVocab get_param_vocab;
-
- bool operator<(const BookEntry &rhs)const { return priority<rhs.priority; }
-}; // END of struct BookEntry
-
-typedef std::map<sinfg::String,BookEntry> Book;
-
-class CanidateList : public std::list<BookEntry>
-{
-public:
- iterator find(const sinfg::String& x);
- const_iterator find(const sinfg::String& x)const { return const_cast<CanidateList*>(this)->find(x); }
-};
-
-Book& book();
-
-Handle create(const sinfg::String &name);
-
-//! Compiles a list of potential canidate actions with the given \a param_list and \a category
-CanidateList compile_canidate_list(const ParamList& param_list, Category category=CATEGORY_ALL);
-
-/*! \class sinfgapp::Action::Main
-** \brief \writeme
-**
-** \writeme
-*/
-class Main
-{
- friend class sinfgapp::Main;
-
- Main();
-
-public:
- ~Main();
-
-}; // END of class Action::Main
-
-}; // END of namespace Action
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_param.cpp
-** \brief Template File
-**
-** $Id: action_param.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "action_param.h"
-#include "action.h"
-#include "canvasinterface.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === P R O C E D U R E S ================================================= */
-
-bool
-Action::canidate_check(const ParamVocab& param_vocab, const ParamList& param_list)
-{
- ParamVocab::const_iterator iter;
-
- for(iter=param_vocab.begin();iter!=param_vocab.end();++iter)
- {
- int n(param_list.count(iter->get_name()));
-
-// if(n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
-// return false;
-
- if(!n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
- continue;
-
- if(iter->get_user_supplied() || iter->get_optional())
- continue;
-
- if(n==0)
- return false;
- if(n==1 && iter->get_requires_multiple())
- return false;
- if(n>1 && !iter->get_supports_multiple())
- return false;
-
- if(iter->get_type()!=param_list.find(iter->get_name())->second.get_type())
- return false;
- }
- return true;
-}
-
-/* === S T A T I C S ======================================================= */
-
-struct _ParamCounter
-{
- static int counter;
- ~_ParamCounter()
- {
- if(counter)
- sinfg::error("%d action params not yet deleted!",counter);
- }
-} _param_counter;
-
-int _ParamCounter::counter(0);
-
-/* === M E T H O D S ======================================================= */
-
-Param::Param(const Param &rhs):
- type_(rhs.type_)
-{
- _ParamCounter::counter++;
- switch(type_)
- {
- case TYPE_ACTIVEPOINT:
- data.activepoint.construct();
- data.activepoint.get()=rhs.data.activepoint.get();
- break;
- case TYPE_WAYPOINT:
- data.waypoint.construct();
- data.waypoint.get()=rhs.data.waypoint.get();
- break;
- case TYPE_WAYPOINTMODEL:
- data.waypoint_model.construct();
- data.waypoint_model.get()=rhs.data.waypoint_model.get();
- break;
- case TYPE_KEYFRAME:
- data.keyframe.construct();
- data.keyframe.get()=rhs.data.keyframe.get();
- break;
- case TYPE_CANVAS:
- data.canvas.construct();
- data.canvas.get()=rhs.data.canvas.get();
- break;
- case TYPE_CANVASINTERFACE:
- data.canvas_interface.construct();
- data.canvas_interface.get()=rhs.data.canvas_interface.get();
- break;
- case TYPE_LAYER:
- data.layer.construct();
- data.layer.get()=rhs.data.layer.get();
- break;
- case TYPE_VALUENODE:
- data.value_node.construct();
- data.value_node.get()=rhs.data.value_node.get();
- break;
- case TYPE_VALUEDESC:
- data.value_desc.construct();
- data.value_desc.get()=rhs.data.value_desc.get();
- break;
- case TYPE_VALUE:
- data.value.construct();
- data.value.get()=rhs.data.value.get();
- break;
- case TYPE_STRING:
- data.string.construct();
- data.string.get()=rhs.data.string.get();
- break;
- case TYPE_RENDDESC:
- data.rend_desc.construct();
- data.rend_desc.get()=rhs.data.rend_desc.get();
- break;
- case TYPE_TIME:
- data.time.construct();
- data.time.get()=rhs.data.time.get();
- break;
-
- case TYPE_INTEGER:
- data.integer=rhs.data.integer;
- break;
- case TYPE_EDITMODE:
- data.edit_mode=rhs.data.edit_mode;
- break;
- case TYPE_REAL:
- data.real=rhs.data.real;
- break;
- case TYPE_BOOL:
- data.b=rhs.data.b;
- break;
-
- case TYPE_NIL:
- break;
-
- default:
- assert(0);
- break;
- }
-}
-
-Param::Param(const etl::handle<sinfgapp::CanvasInterface>& x):
-
- type_(TYPE_CANVASINTERFACE)
-{
- _ParamCounter::counter++;
- data.canvas_interface.construct();
- data.canvas_interface.get()=x;
-}
-
-/*
-Param::Param(sinfgapp::CanvasInterface* x):
-
- type_(TYPE_CANVASINTERFACE)
-{
- _ParamCounter::counter++;
- data.canvas_interface.construct();
- data.canvas_interface=x;
-}
-*/
-
-Param::Param(const etl::loose_handle<sinfgapp::CanvasInterface>& x):
-
- type_(TYPE_CANVASINTERFACE)
-{
- _ParamCounter::counter++;
- data.canvas_interface.construct();
- data.canvas_interface.get()=x;
-}
-
-Param::Param(const sinfg::Canvas::Handle& x):
- type_(TYPE_CANVAS)
-{
- _ParamCounter::counter++;
- data.canvas.construct();
- data.canvas.get()=x;
-}
-
-Param::Param(const sinfg::Canvas::LooseHandle& x):
- type_(TYPE_CANVAS)
-{
- _ParamCounter::counter++;
- data.canvas.construct();
- data.canvas.get()=x;
-}
-
-Param::Param(const sinfg::Layer::Handle& x):
-
- type_(TYPE_LAYER)
-{
- _ParamCounter::counter++;
- data.layer.construct();
- data.layer.get()=x;
-}
-
-Param::Param(const sinfg::Layer::LooseHandle& x):
-
- type_(TYPE_LAYER)
-{
- _ParamCounter::counter++;
- data.layer.construct();
- data.layer.get()=x;
-}
-
-Param::Param(const sinfg::ValueNode::Handle& x):
-
- type_(TYPE_VALUENODE)
-{
- _ParamCounter::counter++;
- data.value_node.construct();
- data.value_node.get()=x;
-}
-
-Param::Param(const sinfg::ValueNode::LooseHandle& x):
-
- type_(TYPE_VALUENODE)
-{
- _ParamCounter::counter++;
- data.value_node.construct();
- data.value_node.get()=x;
-}
-
-Param::Param(const sinfg::ValueBase& x):
-
- type_(TYPE_VALUE)
-{
- _ParamCounter::counter++;
- data.value.construct();
- data.value.get()=x;
-}
-
-Param::Param(const sinfg::RendDesc& x):
- type_(TYPE_RENDDESC)
-{
- _ParamCounter::counter++;
- data.rend_desc.construct();
- data.rend_desc.get()=x;
-}
-
-Param::Param(const sinfg::Time& x):
- type_(TYPE_TIME)
-{
- _ParamCounter::counter++;
- data.time.construct();
- data.time.get()=x;
-}
-
-Param::Param(const sinfg::Activepoint& x):
-
- type_(TYPE_ACTIVEPOINT)
-{
- _ParamCounter::counter++;
- data.activepoint.construct();
- data.activepoint.get()=x;
-}
-
-Param::Param(const sinfg::Waypoint& x):
- type_(TYPE_WAYPOINT)
-{
- _ParamCounter::counter++;
- data.waypoint.construct();
- data.waypoint.get()=x;
-}
-
-Param::Param(const sinfg::Waypoint::Model& x):
- type_(TYPE_WAYPOINTMODEL)
-{
- _ParamCounter::counter++;
- data.waypoint_model.construct();
- data.waypoint_model.get()=x;
-}
-
-Param::Param(const sinfg::String& x):
- type_(TYPE_STRING)
-{
- _ParamCounter::counter++;
- data.string.construct();
- data.string.get()=x;
-}
-
-Param::Param(const char * x):
- type_(TYPE_STRING)
-{
- _ParamCounter::counter++;
- data.string.construct();
- data.string.get()=x;
-}
-
-Param::Param(const sinfg::Keyframe& x):
-
- type_(TYPE_KEYFRAME)
-{
- _ParamCounter::counter++;
- data.keyframe.construct();
- data.keyframe.get()=x;
-}
-
-Param::Param(const sinfgapp::ValueDesc& x):
-
- type_(TYPE_VALUEDESC)
-{
- _ParamCounter::counter++;
- data.value_desc.construct();
- data.value_desc.get()=x;
-}
-
-Param::Param(const int& x):
- type_(TYPE_INTEGER)
-{
- _ParamCounter::counter++;
- data.integer=x;
-}
-
-Param::Param(const EditMode& x):
- type_(TYPE_EDITMODE)
-{
- _ParamCounter::counter++;
- data.edit_mode=x;
-}
-
-Param::Param(const sinfg::Real& x):
-
- type_(TYPE_REAL)
-{
- _ParamCounter::counter++;
- data.real=x;
-}
-
-Param::Param(const bool& x):
-
- type_(TYPE_BOOL)
-{
- _ParamCounter::counter++;
- data.b=x;
-}
-
-Param::~Param()
-{
- clear();
- _ParamCounter::counter--;
-}
-
-Param&
-Param::operator=(const Param& rhs)
-{
- clear();
- type_=rhs.type_;
-
- switch(type_)
- {
- case TYPE_ACTIVEPOINT:
- data.activepoint.construct();
- data.activepoint.get()=rhs.data.activepoint.get();
- break;
- case TYPE_WAYPOINT:
- data.waypoint.construct();
- data.waypoint.get()=rhs.data.waypoint.get();
- break;
- case TYPE_WAYPOINTMODEL:
- data.waypoint_model.construct();
- data.waypoint_model.get()=rhs.data.waypoint_model.get();
- break;
- case TYPE_KEYFRAME:
- data.keyframe.construct();
- data.keyframe.get()=rhs.data.keyframe.get();
- break;
- case TYPE_CANVAS:
- data.canvas.construct();
- data.canvas.get()=rhs.data.canvas.get();
- break;
- case TYPE_CANVASINTERFACE:
- data.canvas_interface.construct();
- data.canvas_interface.get()=rhs.data.canvas_interface.get();
- break;
- case TYPE_TIME:
- data.time.construct();
- data.time.get()=rhs.data.time.get();
- break;
- case TYPE_LAYER:
- data.layer.construct();
- data.layer.get()=rhs.data.layer.get();
- break;
- case TYPE_VALUENODE:
- data.value_node.construct();
- data.value_node.get()=rhs.data.value_node.get();
- break;
- case TYPE_VALUEDESC:
- data.value_desc.construct();
- data.value_desc.get()=rhs.data.value_desc.get();
- break;
- case TYPE_VALUE:
- data.value.construct();
- data.value.get()=rhs.data.value.get();
- break;
- case TYPE_RENDDESC:
- data.rend_desc.construct();
- data.rend_desc.get()=rhs.data.rend_desc.get();
- break;
- case TYPE_STRING:
- data.string.construct();
- data.string.get()=rhs.data.string.get();
- break;
-
- case TYPE_INTEGER:
- data.integer=rhs.data.integer;
- break;
- case TYPE_EDITMODE:
- data.integer=rhs.data.integer;
- break;
- case TYPE_REAL:
- data.real=rhs.data.real;
- break;
- case TYPE_BOOL:
- data.b=rhs.data.b;
- break;
-
- case TYPE_NIL:
- break;
-
- default:
- assert(0);
- break;
- }
- return *this;
-}
-
-void
-Param::clear()
-{
- switch(type_)
- {
- case TYPE_ACTIVEPOINT:
- data.activepoint.destruct();
- break;
- case TYPE_WAYPOINT:
- data.waypoint.destruct();
- break;
- case TYPE_WAYPOINTMODEL:
- data.waypoint_model.destruct();
- break;
- case TYPE_KEYFRAME:
- data.keyframe.destruct();
- break;
- case TYPE_CANVAS:
- data.canvas.destruct();
- break;
- case TYPE_CANVASINTERFACE:
- data.canvas_interface.destruct();
- break;
- case TYPE_LAYER:
- data.layer.destruct();
- break;
- case TYPE_TIME:
- data.time.destruct();
- break;
- case TYPE_VALUENODE:
- data.value_node.destruct();
- break;
- case TYPE_VALUEDESC:
- data.value_desc.destruct();
- break;
- case TYPE_VALUE:
- data.value.destruct();
- break;
- case TYPE_RENDDESC:
- data.rend_desc.destruct();
- break;
- case TYPE_STRING:
- data.string.destruct();
- break;
-
- case TYPE_NIL:
- case TYPE_EDITMODE:
- case TYPE_INTEGER:
- case TYPE_REAL:
- case TYPE_BOOL:
- break;
-
- default:
- assert(0);
- break;
- }
- type_=TYPE_NIL;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_param.h
-** \brief Template File
-**
-** $Id: action_param.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_PARAM_H
-#define __SINFG_APP_ACTION_PARAM_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/string.h>
-#include <sinfg/canvas.h>
-#include <ETL/handle>
-#include <ETL/stringf>
-#include <ETL/trivial>
-
-#include <map>
-#include <list>
-
-#include <sinfg/layer.h>
-#include <sinfg/canvas.h>
-#include <sinfg/valuenode.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/value.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/string.h>
-#include <sinfg/keyframe.h>
-#include <sinfg/waypoint.h>
-
-#include "editmode.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfg {
-class ProgressCallback;
-class Canvas;
-class RendDesc;
-}; // END of namespace sinfg
-
-namespace sinfgapp {
-
-class CanvasInterface;
-
-namespace Action {
-
-//! Action Parameter
-class Param
-{
-public:
- enum Type
- {
- TYPE_NIL,
- TYPE_INTEGER,
- TYPE_REAL,
- TYPE_BOOL,
- TYPE_ACTIVEPOINT,
- TYPE_WAYPOINT,
- TYPE_WAYPOINTMODEL,
- TYPE_KEYFRAME,
- TYPE_CANVAS,
- TYPE_LAYER,
- TYPE_VALUENODE,
- TYPE_VALUEDESC,
- TYPE_VALUE,
- TYPE_STRING,
- TYPE_TIME,
- TYPE_CANVASINTERFACE,
- TYPE_EDITMODE,
- TYPE_RENDDESC,
-
- TYPE_END
- };
-private:
- Type type_;
-
- union
- {
- etl::trivial<sinfg::Canvas::LooseHandle> canvas;
- etl::trivial<sinfg::Layer::LooseHandle> layer;
- etl::trivial<sinfg::ValueNode::LooseHandle> value_node;
- etl::trivial<sinfg::ValueBase> value;
- etl::trivial<sinfg::Activepoint> activepoint;
- etl::trivial<sinfg::ValueNode_Animated::Waypoint> waypoint;
- etl::trivial<sinfg::ValueNode_Animated::Waypoint::Model> waypoint_model;
- etl::trivial<sinfg::String> string;
- etl::trivial<sinfg::Keyframe> keyframe;
- etl::trivial<sinfg::Time> time;
- etl::trivial<sinfgapp::ValueDesc> value_desc;
- etl::trivial<etl::loose_handle<sinfgapp::CanvasInterface> > canvas_interface;
- etl::trivial<sinfg::RendDesc> rend_desc;
- int integer;
- sinfg::Real real;
- bool b;
- EditMode edit_mode;
-
- } data;
-public:
-
- Param():type_(TYPE_NIL) { }
- Param(const Param &x);
- Param(const etl::handle<sinfgapp::CanvasInterface>& x);
- Param(const etl::loose_handle<sinfgapp::CanvasInterface>& x);
-// Param(sinfgapp::CanvasInterface* x);
- Param(const sinfg::Canvas::Handle& x);
- Param(const sinfg::Canvas::LooseHandle& x);
- Param(const sinfg::Layer::Handle& x);
- Param(const sinfg::Layer::LooseHandle& x);
- Param(const sinfg::ValueNode::Handle& x);
- Param(const sinfg::ValueNode::LooseHandle& x);
- Param(const sinfg::Activepoint& x);
- Param(const sinfg::Waypoint& x);
- Param(const sinfg::Waypoint::Model& x);
- Param(const sinfg::String& x);
- Param(const sinfg::RendDesc& x);
- Param(const char * x);
- Param(const sinfg::Keyframe& x);
- Param(const sinfgapp::ValueDesc& x);
- Param(const int& x);
- Param(const EditMode& x);
- Param(const sinfg::Real& x);
- Param(const sinfg::Time& x);
- Param(const bool& x);
- Param(const sinfg::ValueBase& x);
-
- ~Param();
-
- Param& operator=(const Param& rhs);
-
- void clear();
-
- const sinfg::Canvas::LooseHandle& get_canvas()const { assert(type_==TYPE_CANVAS); return data.canvas.get(); }
- const etl::loose_handle<sinfgapp::CanvasInterface>& get_canvas_interface()const { assert(type_==TYPE_CANVASINTERFACE); return data.canvas_interface.get(); }
- const sinfg::Layer::LooseHandle& get_layer()const { assert(type_==TYPE_LAYER); return data.layer.get(); }
- const sinfg::ValueNode::LooseHandle& get_value_node()const { assert(type_==TYPE_VALUENODE); return data.value_node.get(); }
- const sinfg::ValueBase& get_value()const { assert(type_==TYPE_VALUE); return data.value.get(); }
- const sinfg::Activepoint& get_activepoint()const { assert(type_==TYPE_ACTIVEPOINT); return data.activepoint.get(); }
- const sinfg::Waypoint& get_waypoint()const { assert(type_==TYPE_WAYPOINT); return data.waypoint.get(); }
- const sinfg::Waypoint::Model& get_waypoint_model()const { assert(type_==TYPE_WAYPOINTMODEL); return data.waypoint_model.get(); }
- const sinfg::String& get_string()const { assert(type_==TYPE_STRING); return data.string.get(); }
- const sinfg::Keyframe& get_keyframe()const { assert(type_==TYPE_KEYFRAME); return data.keyframe.get(); }
- const sinfgapp::ValueDesc& get_value_desc()const { assert(type_==TYPE_VALUEDESC); return data.value_desc.get(); }
- const sinfg::Real& get_real()const { assert(type_==TYPE_REAL); return data.real; }
- const sinfg::Time& get_time()const { assert(type_==TYPE_TIME); return data.time.get(); }
- const sinfg::RendDesc& get_rend_desc()const { assert(type_==TYPE_RENDDESC); return data.rend_desc.get(); }
- int get_integer()const { assert(type_==TYPE_INTEGER); return data.integer; }
- EditMode get_edit_mode()const { assert(type_==TYPE_EDITMODE); return data.edit_mode; }
- bool get_bool()const { assert(type_==TYPE_BOOL); return data.b; }
-
-
- const Type& get_type()const { return type_; }
-}; // END of class Param
-
-class ParamList : public std::multimap<sinfg::String,Param>
-{
-public:
- ParamList& add(const sinfg::String& name, const Param &x) { insert(std::pair<sinfg::String,Param>(name,x)); return *this; }
- ParamList& add(const ParamList& x) { insert(x.begin(),x.end()); return *this; }
-}; // END of class ParamList
-
-class ParamDesc
-{
-private:
- sinfg::String name_;
- sinfg::String local_name_;
- sinfg::String desc_;
- sinfg::String mutual_exclusion_;
- Param::Type type_;
- bool user_supplied_;
- bool supports_multiple_;
- bool requires_multiple_;
- bool optional_;
-
-public:
- ParamDesc(const sinfg::String &name, Param::Type type):
- name_(name),
- local_name_(name),
- type_(type),
- user_supplied_(false),
- supports_multiple_(false),
- requires_multiple_(false),
- optional_(false)
- { }
-
- const sinfg::String& get_name()const { return name_; }
- const sinfg::String& get_desc()const { return desc_; }
- const sinfg::String& get_mutual_exclusion()const { return mutual_exclusion_; }
- const sinfg::String& get_local_name()const { return local_name_; }
- const Param::Type& get_type()const { return type_; }
- bool get_user_supplied()const { return user_supplied_; }
- bool get_supports_multiple()const { return supports_multiple_||requires_multiple_; }
- bool get_requires_multiple()const { return requires_multiple_; }
- bool get_optional()const { return optional_; }
-
- ParamDesc& set_local_name(const sinfg::String& x) { local_name_=x; return *this; }
- ParamDesc& set_desc(const sinfg::String& x) { desc_=x; return *this; }
- ParamDesc& set_mutual_exclusion(const sinfg::String& x) { mutual_exclusion_=x; return *this; }
- ParamDesc& set_user_supplied(bool x=true) { user_supplied_=x; return *this; }
- ParamDesc& set_supports_multiple(bool x=true) { supports_multiple_=x; return *this; }
- ParamDesc& set_requires_multiple(bool x=true) { requires_multiple_=x; if(x)supports_multiple_=true; return *this; }
- ParamDesc& set_optional(bool x=true) { optional_=x; return *this; }
-}; // END of class ParamDesc
-
-class ParamVocab : public std::list< ParamDesc > { };
-
-bool canidate_check(const ParamVocab& param_vocab, const ParamList& param_list);
-
-}; // END of namespace Action
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_system.cpp
-** \brief Template File
-**
-** $Id: action_system.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "action_system.h"
-#include "instance.h"
-#include "canvasinterface.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfgapp;
-using namespace sinfg;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-
-
-Action::System::System():
- action_count_(0)
-{
- unset_ui_interface();
- clear_redo_stack_on_new_action_=false;
-}
-
-Action::System::~System()
-{
-}
-
-bool
-Action::System::perform_action(handle<Action::Base> action)
-{
- handle<UIInterface> uim(get_ui_interface());
-
- assert(action);
-
- if(!action->is_ready())
- {
- uim->error(action->get_name()+": "+_("Action is not ready."));
- return false;
- }
-
- most_recent_action_=action;
-
- static bool inuse=false;
-
- if(inuse) return false;
-
- inuse=true;
- try {
-
- assert(action);
-
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- if(canvas_specific && canvas_specific->get_canvas())
- {
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas_specific->get_canvas());
- assert(canvas_interface);
- uim=canvas_interface->get_ui_interface();
- }
-
- handle<Action::Undoable> undoable_action=handle<Action::Undoable>::cast_dynamic(action);
-
- // If we cannot undo this action, make sure
- // that the user knows this.
- if(!undoable_action)
- {
- if(uim->yes_no(
- action->get_name(),
- _("This action cannot be undone! Are you sure you want to continue?"),
- UIInterface::RESPONSE_NO
- ) == UIInterface::RESPONSE_NO
- )
- return false;
- else
- {
- // Because this action cannot be undone,
- // we need to clear the undo stack
- clear_undo_stack();
- }
- }
- else
- assert(undoable_action->is_active());
-
- // Perform the action
- try { action->perform(); }
- catch(Action::Error err)
- {
- uim->task(action->get_name()+' '+_("Failed"));
- inuse=false;
-
- if(err.get_type()!=Action::Error::TYPE_UNABLE)
- {
- if(err.get_desc().empty())
- uim->error(action->get_name()+": "+strprintf("%d",err.get_type()));
- else
- uim->error(action->get_name()+": "+err.get_desc());
- }
-
- // If action failed for whatever reason, just return false and do
- // not add the action onto the list
- return false;
- }
- catch(std::exception err)
- {
- uim->task(action->get_name()+' '+_("Failed"));
- inuse=false;
-
- uim->error(action->get_name()+": "+err.what());
-
- // If action failed for whatever reason, just return false and do
- // not add the action onto the list
- return false;
- }
- catch(...)
- {
- uim->task(action->get_name()+' '+_("Failed"));
- inuse=false;
-
- // If action failed for whatever reason, just return false and do
- // not add the action onto the list
- return false;
- }
-
- // Clear the redo stack
- if(clear_redo_stack_on_new_action_)
- clear_redo_stack();
-
- if(!group_stack_.empty())
- group_stack_.front()->inc_depth();
- else
- inc_action_count();
-
- // Push this action onto the action list if we can undo it
- if(undoable_action)
- {
- // If necessary, signal the change in status of undo
- if(undo_action_stack_.empty()) signal_undo_status_(true);
-
- // Add it to the list
- undo_action_stack_.push_front(undoable_action);
-
- // Signal that a new action has been added
- if(group_stack_.empty())
- signal_new_action()(undoable_action);
- }
-
- inuse=false;
-
- uim->task(action->get_name()+' '+_("Successful"));
-
- // If the action has "dirtied" the preview, signal it.
- if(0)if(canvas_specific && canvas_specific->is_dirty())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- if(!group_stack_.empty())
- group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
- else
- {
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- DEBUGPOINT();
- //canvas_interface->signal_dirty_preview()();
- }
- }
-
- }catch(...) { inuse=false; throw; }
-
- return true;
-}
-
-bool
-sinfgapp::Action::System::undo_(handle<UIInterface> uim)
-{
- handle<Action::Undoable> action(undo_action_stack().front());
- most_recent_action_=action;
-
- try { if(action->is_active()) action->undo(); }
- catch(Action::Error err)
- {
- if(err.get_type()!=Action::Error::TYPE_UNABLE)
- {
- if(err.get_desc().empty())
- uim->error(action->get_name()+_(" (Undo): ")+strprintf("%d",err.get_type()));
- else
- uim->error(action->get_name()+_(" (Undo): ")+err.get_desc());
- }
-
- return false;
- }
- catch(std::runtime_error x)
- {
- uim->error(x.what());
- return false;
- }
- catch(...)
- {
- return false;
- }
-
- dec_action_count();
-
- if(redo_action_stack_.empty()) signal_redo_status()(true);
-
- redo_action_stack_.push_front(undo_action_stack_.front());
- undo_action_stack_.pop_front();
-
- if(undo_action_stack_.empty()) signal_undo_status()(false);
-
- if(!group_stack_.empty())
- group_stack_.front()->dec_depth();
-
- signal_undo_();
-
- return true;
-}
-
-bool
-sinfgapp::Action::System::undo()
-{
- //! \todo This function is not exception safe!
- static bool inuse=false;
-
- // If there is nothing on the action list, there is nothing to undo
- if(undo_action_stack().empty() || inuse)
- return false;
-
- handle<Action::Undoable> action=undo_action_stack().front();
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- handle<UIInterface> uim;
- if(canvas_specific && canvas_specific->get_canvas())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- uim=canvas_interface->get_ui_interface();
- }
- else
- uim=get_ui_interface();
-
- inuse=true;
-
- if(!undo_(uim))
- {
- uim->error(undo_action_stack_.front()->get_name()+": "+_("Failed to undo."));
- inuse=false;
- return false;
- }
-
- inuse=false;
-
- // If the action has "dirtied" the preview, signal it.
- if(0)if(action->is_active() && canvas_specific && canvas_specific->is_dirty())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- if(!group_stack_.empty())
- group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
- else
- {
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- //DEBUGPOINT();
- //canvas_interface->signal_dirty_preview()();
- }
- }
-
- return true;
-}
-
-bool
-Action::System::redo_(handle<UIInterface> uim)
-{
- handle<Action::Undoable> action(redo_action_stack().front());
- most_recent_action_=action;
-
- try { if(action->is_active()) action->perform(); }
- catch(Action::Error err)
- {
- if(err.get_type()!=Action::Error::TYPE_UNABLE)
- {
- if(err.get_desc().empty())
- uim->error(action->get_name()+_(" (Redo): ")+strprintf("%d",err.get_type()));
- else
- uim->error(action->get_name()+_(" (Redo): ")+err.get_desc());
- }
-
- return false;
- }
- catch(std::runtime_error x)
- {
- uim->error(x.what());
- return false;
- }
- catch(...)
- {
- return false;
- }
-
- inc_action_count();
-
- if(undo_action_stack_.empty()) signal_undo_status()(true);
-
- undo_action_stack_.push_front(redo_action_stack_.front());
- redo_action_stack_.pop_front();
-
- if(redo_action_stack_.empty()) signal_redo_status()(false);
-
- if(!group_stack_.empty())
- group_stack_.front()->inc_depth();
-
- signal_redo_();
-
- return true;
-}
-
-bool
-Action::System::redo()
-{
- //! \todo This function is not exception safe!
- static bool inuse=false;
-
- // If there is nothing on the action list, there is nothing to undo
- if(redo_action_stack_.empty() || inuse)
- return false;
-
- inuse=true;
-
- handle<Action::Undoable> action=redo_action_stack().front();
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- handle<UIInterface> uim;
- if(canvas_specific && canvas_specific->get_canvas())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- uim=canvas_interface->get_ui_interface();
- }
- else
- uim=get_ui_interface();
-
- if(!redo_(uim))
- {
- uim->error(redo_action_stack_.front()->get_name()+": "+_("Failed to redo."));
- inuse=false;
- return false;
- }
-
- inuse=false;
-
- // If the action has "dirtied" the preview, signal it.
- if(0)if(action->is_active() && canvas_specific && canvas_specific->is_dirty())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- if(!group_stack_.empty())
- group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
- else
- {
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- //DEBUGPOINT();
- //canvas_interface->signal_dirty_preview()();
- }
- }
-
- return true;
-}
-
-void
-Action::System::inc_action_count()const
-{
- action_count_++;
- if(action_count_==1)
- signal_unsaved_status_changed_(true);
- if(!action_count_)
- signal_unsaved_status_changed_(false);
-}
-
-void
-Action::System::dec_action_count()const
-{
- action_count_--;
- if(action_count_==-1)
- signal_unsaved_status_changed_(true);
- if(!action_count_)
- signal_unsaved_status_changed_(false);
-}
-
-void
-Action::System::reset_action_count()const
-{
- if(!action_count_)
- return;
-
- action_count_=0;
- signal_unsaved_status_changed_(false);
-}
-
-void
-Action::System::clear_undo_stack()
-{
- if(undo_action_stack_.empty()) return;
- undo_action_stack_.clear();
- signal_undo_status_(false);
- signal_undo_stack_cleared_();
-}
-
-void
-Action::System::clear_redo_stack()
-{
- if(redo_action_stack_.empty()) return;
- redo_action_stack_.clear();
- signal_redo_status_(false);
- signal_redo_stack_cleared_();
-}
-
-bool
-Action::System::set_action_status(etl::handle<Action::Undoable> action, bool x)
-{
- Stack::iterator iter;
- int failed=false;
-
- if(action->is_active()==x)
- return true;
-
- handle<Action::Undoable> cur_pos=undo_action_stack_.front();
-
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- handle<UIInterface> uim=new ConfidentUIInterface();
-
- iter=find(undo_action_stack_.begin(),undo_action_stack_.end(),action);
- if(iter!=undo_action_stack_.end())
- {
- while(undo_action_stack_.front()!=action)
- {
- if(!undo_(uim))
- {
- return false;
- }
- }
- if(!undo_(uim))
- {
- return false;
- }
-
- action->set_active(x);
-
- if(redo_(get_ui_interface()))
- {
- signal_action_status_changed_(action);
- }
- else
- {
- action->set_active(!x);
- failed=true;
- }
-
-
- while(undo_action_stack_.front()!=cur_pos)
- {
- if(!redo_(uim))
- {
- redo_action_stack_.front()->set_active(false);
- signal_action_status_changed_(redo_action_stack_.front());
- }
- }
-
- if(!failed && canvas_specific && canvas_specific->is_dirty())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- //DEBUGPOINT();
- //canvas_interface->signal_dirty_preview()();
- }
-
- return true;
- }
-
- iter=find(redo_action_stack_.begin(),redo_action_stack_.end(),action);
- if(iter!=redo_action_stack_.end())
- {
- action->set_active(x);
- signal_action_status_changed_(action);
-
-
-
-
- if(canvas_specific && canvas_specific->is_dirty())
- {
- Canvas::Handle canvas=canvas_specific->get_canvas();
- handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
- assert(canvas_interface);
- DEBUGPOINT();
- //canvas_interface->signal_dirty_preview()();
- }
-
- return true;
- }
-
- return false;
-}
-
-Action::PassiveGrouper::PassiveGrouper(etl::loose_handle<Action::System> instance_,sinfg::String name_):
- instance_(instance_),
- name_(name_),
- redraw_requested_(false),
- depth_(0)
-{
- // Add this group onto the group stack
- instance_->group_stack_.push_front(this);
-}
-
-void
-Action::PassiveGrouper::request_redraw(handle<CanvasInterface> x)
-{
-/* DEBUGPOINT();
- if(instance_->group_stack_.empty())
- {
- if(x!=canvas_interface_)
- {
- DEBUGPOINT();
- x->signal_dirty_preview()();
- }
-
- redraw_requested_=false;
- }
- else
- {
- DEBUGPOINT();
- if(instance_->group_stack_.back()==this)
- {
- DEBUGPOINT();
- redraw_requested_=true;
- }
- else
- {
- DEBUGPOINT();
- instance_->group_stack_.back()->request_redraw(x);
- redraw_requested_=false;
- }
- DEBUGPOINT();
- }
- DEBUGPOINT();
-*/
- if(x)
- {
- redraw_requested_=true;
- canvas_interface_=x;
- }
-}
-
-Action::PassiveGrouper::~PassiveGrouper()
-{
- assert(instance_->group_stack_.front()==this);
-
- // Remove this group from the group stack
- instance_->group_stack_.pop_front();
-
- handle<Action::Group> group;
-
- if(depth_==1)
- {
- handle<Action::Undoable> action(instance_->undo_action_stack_.front());
-
- group=handle<Action::Group>::cast_dynamic(action);
-
- if(group)
- {
- // If the only action inside of us is a group,
- // then we should rename the group to our name.
- group->set_name(name_);
- }
- else
- {
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- if(0)if(canvas_specific && canvas_specific->is_dirty() && canvas_specific->get_canvas_interface())
- {
- if(instance_->group_stack_.empty())
- request_redraw(canvas_specific->get_canvas_interface());
- }
- }
-
- if(instance_->group_stack_.empty())
- {
- instance_->inc_action_count();
- instance_->signal_new_action()(instance_->undo_action_stack_.front());
- }
- else
- instance_->group_stack_.front()->inc_depth();
-
- }
- else
- if(depth_>0)
- {
- group=new Action::Group(name_);
-
- for(int i=0;i<depth_;i++)
- // for(;depth_;depth_--)
- {
- handle<Action::Undoable> action(instance_->undo_action_stack_.front());
- Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
-
- if(0)if(canvas_specific && canvas_specific->is_dirty())
- {
- group->set_dirty(true);
- group->set_canvas(canvas_specific->get_canvas());
- group->set_canvas_interface(canvas_specific->get_canvas_interface());
- }
-
- // Copy the action from the undo stack to the group
- group->add_action_front(action);
-
- // Remove the action from the undo stack
- instance_->undo_action_stack_.pop_front();
- }
-
- // Push the group onto the stack
- instance_->undo_action_stack_.push_front(group);
-
- if(0)if(group->is_dirty())
- request_redraw(group->get_canvas_interface());
- // group->get_canvas_interface()->signal_dirty_preview()();
-
- if(instance_->group_stack_.empty())
- {
- instance_->inc_action_count();
- instance_->signal_new_action()(instance_->undo_action_stack_.front());
- }
- else
- instance_->group_stack_.front()->inc_depth();
- }
-
- if(0)if(redraw_requested_)
- {
- if(instance_->group_stack_.empty())
- {
- assert(canvas_interface_);
- DEBUGPOINT();
- canvas_interface_->signal_dirty_preview()();
- }
- else
- {
- instance_->group_stack_.front()->request_redraw(canvas_interface_);
- redraw_requested_=false;
- }
- }
-}
-
-void
-Action::PassiveGrouper::cancel()
-{
- bool error=false;
-
- // Cancel any groupers that may be on top of us first
- //while(instance_->group_stack_.front()!=this)
- // instance_->group_stack_.front()->cancel();
-
- sinfg::warning("Cancel depth: %d",depth_);
-
- while(depth_)
- if(!instance_->undo())
- {
- error=true;
- break;
- }
-
- if(error)
- instance_->get_ui_interface()->error(_("State restore failure"));
- else
- redraw_requested_=false;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_system.h
-** \brief Template Header
-**
-** $Id: action_system.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFGAPP_ACTIONSYSTEM_H
-#define __SINFGAPP_ACTIONSYSTEM_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "action.h"
-#include <sigc++/signal.h>
-#include <sigc++/object.h>
-#include <ETL/handle>
-#include <sinfg/canvas.h>
-#include "uimanager.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class CanvasInterface;
-
-namespace Action {
-
-
-
-
-
-class System;
-
-//! Passive action grouping class
-class PassiveGrouper
-{
- etl::loose_handle<System> instance_;
- sinfg::String name_;
- bool redraw_requested_;
- int depth_;
- etl::handle<CanvasInterface> canvas_interface_;
-public:
-
- PassiveGrouper(etl::loose_handle<System> instance_,sinfg::String name_);
-
- ~PassiveGrouper();
-
- const sinfg::String &get_name()const { return name_; }
-
- void set_name(const sinfg::String &x) { name_=x; }
-
- etl::loose_handle<System> get_instance() { return instance_; }
-
- void request_redraw(etl::handle<CanvasInterface>);
-
- void cancel();
-
- void inc_depth() { depth_++; }
-
- void dec_depth() { depth_--; }
-
- const int &get_depth()const { return depth_; }
-}; // END of class Action::PassiveGrouper
-
-typedef std::list< etl::handle<Action::Undoable> > Stack;
-
-class System : public etl::shared_object, public sigc::trackable
-{
- friend class PassiveGrouper;
-
- /*
- -- ** -- P U B L I C T Y P E S ---------------------------------------------
- */
-
-public:
-
- /*
- -- ** -- P U B L I C D A T A ------------------------------------------------
- */
-
-public:
-
- /*
- -- ** -- P R I V A T E D A T A ---------------------------------------------
- */
-
-private:
-
- Stack undo_action_stack_;
- Stack redo_action_stack_;
-
- etl::handle<Action::Base> most_recent_action_;
-
- std::list<PassiveGrouper*> group_stack_;
-
- sigc::signal<void,bool> signal_undo_status_;
- sigc::signal<void,bool> signal_redo_status_;
- sigc::signal<void,etl::handle<Action::Undoable> > signal_new_action_;
- sigc::signal<void> signal_undo_stack_cleared_;
- sigc::signal<void> signal_redo_stack_cleared_;
- sigc::signal<void> signal_undo_;
- sigc::signal<void> signal_redo_;
- sigc::signal<void,etl::handle<Action::Undoable> > signal_action_status_changed_;
-
- mutable sigc::signal<void,bool> signal_unsaved_status_changed_;
-
- //! If this is non-zero, then the changes have not yet been saved.
- mutable int action_count_;
-
- etl::handle<UIInterface> ui_interface_;
-
- bool clear_redo_stack_on_new_action_;
-
- /*
- -- ** -- P R I V A T E M E T H O D S ---------------------------------------
- */
-
-private:
-
- bool undo_(etl::handle<UIInterface> uim);
- bool redo_(etl::handle<UIInterface> uim);
-
- /*
- -- ** -- S I G N A L T E R M I N A L S -------------------------------------
- */
-
-private:
-
- /*
- -- ** -- P U B L I C M E T H O D S -----------------------------------------
- */
-
-public:
-
- System();
- ~System();
-
- /*
- template <typename T> bool
- perform_action(T x)
- {
- etl::handle<Action::Base> action((Action::Base*)new T(x));
- return perform_action(action);
- }
- */
-
- const etl::handle<Action::Base>& get_most_recent_action() { return most_recent_action_; }
-
- bool get_clear_redo_stack_on_new_action()const { return clear_redo_stack_on_new_action_; }
-
- void set_clear_redo_stack_on_new_action(bool x) { clear_redo_stack_on_new_action_=x; }
-
- bool perform_action(etl::handle<Action::Base> action);
-
- bool set_action_status(etl::handle<Action::Undoable> action, bool x);
-
- const Stack &undo_action_stack()const { return undo_action_stack_; }
-
- const Stack &redo_action_stack()const { return redo_action_stack_; }
-
- //! Undoes the last action
- bool undo();
-
- //! Redoes the last undone action
- bool redo();
-
- //! Clears the undo stack.
- void clear_undo_stack();
-
- //! Clears the redo stack.
- void clear_redo_stack();
-
- //! Increments the action counter
- /*! \note You should not have to call this under normal circumstances.
- ** \see dec_action_count(), reset_action_count(), get_action_count() */
- void inc_action_count()const;
-
- //! Decrements the action counter
- /*! \note You should not have to call this under normal circumstances.
- ** \see inc_action_count(), reset_action_count(), get_action_count() */
- void dec_action_count()const;
-
- //! Resets the action counter
- /*! \note You should not have to call this under normal circumstances.
- ** \see inc_action_count(), dec_action_count(), get_action_count() */
- void reset_action_count()const;
-
- //! Returns the number of actions performed since last save.
- /*! \see inc_action_count(), dec_action_count(), reset_action_count() */
- int get_action_count()const { return action_count_; }
-
- void set_ui_interface(const etl::handle<UIInterface> &uim) { assert(uim); ui_interface_=uim; }
- void unset_ui_interface() { ui_interface_=new DefaultUIInterface(); }
- const etl::handle<UIInterface> &get_ui_interface() { return ui_interface_; }
-
- /*
- -- ** -- S I G N A L I N T E R F A C E S -----------------------------------
- */
-
-public:
-
- sigc::signal<void,bool>& signal_unsaved_status_changed() { return signal_unsaved_status_changed_; }
-
- sigc::signal<void,bool>& signal_undo_status() { return signal_undo_status_; }
-
- sigc::signal<void,bool>& signal_redo_status() { return signal_redo_status_; }
-
- sigc::signal<void>& signal_undo_stack_cleared() { return signal_undo_stack_cleared_; }
-
- sigc::signal<void>& signal_redo_stack_cleared() { return signal_redo_stack_cleared_; }
-
- sigc::signal<void>& signal_undo() { return signal_undo_; }
-
- sigc::signal<void>& signal_redo() { return signal_redo_; }
-
- //! Called whenever an undoable action is processed and added to the stack.
- sigc::signal<void,etl::handle<Action::Undoable> >& signal_new_action() { return signal_new_action_; }
-
- sigc::signal<void,etl::handle<Action::Undoable> >& signal_action_status_changed() { return signal_action_status_changed_; }
-
-}; // END of class Action::System
-
-
-}; // END of namespace sinfgapp::Action
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file acitvepointadd.cpp
-** \brief Template File
-**
-** $Id: activepointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointAdd);
-ACTION_SET_NAME(Action::ActivepointAdd,"activepoint_add");
-ACTION_SET_LOCAL_NAME(Action::ActivepointAdd,"Add Activepoint");
-ACTION_SET_TASK(Action::ActivepointAdd,"add");
-ACTION_SET_CATEGORY(Action::ActivepointAdd,Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::ActivepointAdd,0);
-ACTION_SET_VERSION(Action::ActivepointAdd,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointAdd,"$Id: activepointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointAdd::ActivepointAdd()
-{
- activepoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("New Activepoint"))
- .set_desc(_("Activepoint to be added"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_desc(_("Time where activepoint is to be added"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointAdd::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- // We need either a activepoint or a time.
- if(x.count("activepoint") || x.count("time"))
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- if(time_set)
- calc_activepoint();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
- {
- activepoint=param.get_activepoint();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
- {
- activepoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointAdd::is_ready()const
-{
- if(!value_node || activepoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a activepoint. In this case, we need to calculate the value
-// of the activepoint
-void
-Action::ActivepointAdd::calc_activepoint()
-{
- const Time time(activepoint.get_time());
- activepoint.set_state(value_node->list[index].status_at_time(time));
- activepoint.set_priority(0);
-
- // In this case, nothing is really changing, so there will be
- // no need to redraw the window
- set_dirty(false);
-}
-
-void
-Action::ActivepointAdd::perform()
-{
- try { value_node->list[index].find(activepoint.get_time()); throw Error(_("A Activepoint already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { if(value_node->list[index].find(activepoint)!=value_node->list[index].timing_info.end()) throw Error(_("This activepoint is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- value_node->list[index].add(activepoint);
- value_node->changed();
-
- /*if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
- */
-}
-
-void
-Action::ActivepointAdd::undo()
-{
- value_node->list[index].erase(activepoint);
- value_node->changed();
- /*
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
- */
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointadd.h
-** \brief Template File
-**
-** $Id: activepointadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTADD_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ActivepointAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Activepoint activepoint;
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
-
- bool time_set;
-
- void calc_activepoint();
-
-public:
-
- ActivepointAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointremove.cpp
-** \brief Template File
-**
-** $Id: activepointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointRemove);
-ACTION_SET_NAME(Action::ActivepointRemove,"activepoint_remove");
-ACTION_SET_LOCAL_NAME(Action::ActivepointRemove,"Remove Activepoint");
-ACTION_SET_TASK(Action::ActivepointRemove,"remove");
-ACTION_SET_CATEGORY(Action::ActivepointRemove,Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::ActivepointRemove,0);
-ACTION_SET_VERSION(Action::ActivepointRemove,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointRemove,"$Id: activepointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointRemove::ActivepointRemove()
-{
- activepoint.set_time(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("Activepoint"))
- .set_desc(_("Activepoint to be changed"))
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointRemove::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
- {
- activepoint=param.get_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointRemove::is_ready()const
-{
- if(!value_node || activepoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ActivepointRemove::perform()
-{
- ValueNode_DynamicList::ListEntry::ActivepointList::iterator iter;
-
- try { iter=value_node->list[index].find(activepoint); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find activepoint"));
- }
-
- value_node->list[index].erase(activepoint);
- value_node->changed();
-
- /*
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
- */
-}
-
-void
-Action::ActivepointRemove::undo()
-{
- try { value_node->list[index].find(activepoint.get_time()); throw Error(_("A Activepoint already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { if(value_node->list[index].find(activepoint)!=value_node->list[index].timing_info.end()) throw Error(_("This activepoint is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- value_node->list[index].add(activepoint);
- value_node->changed();
- /*
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
- */
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointremove.h
-** \brief Template File
-**
-** $Id: activepointremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTREMOVE_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ActivepointRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
- sinfg::Activepoint activepoint;
-
-public:
-
- ActivepointRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointset.cpp
-** \brief Template File
-**
-** $Id: activepointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointSet);
-ACTION_SET_NAME(Action::ActivepointSet,"activepoint_set");
-ACTION_SET_LOCAL_NAME(Action::ActivepointSet,"Set Activepoint");
-ACTION_SET_TASK(Action::ActivepointSet,"set");
-ACTION_SET_CATEGORY(Action::ActivepointSet,Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::ActivepointSet,0);
-ACTION_SET_VERSION(Action::ActivepointSet,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointSet,"$Id: activepointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointSet::ActivepointSet()
-{
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("Activepoint"))
- .set_desc(_("Activepoint to be changed"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointSet::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
- {
- //NOTE: there is no duplication checking at the moment
- activepoints.push_back(param.get_activepoint());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointSet::is_ready()const
-{
- if(!value_node || activepoints.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ActivepointSet::perform()
-{
- typedef ValueNode_DynamicList::ListEntry::ActivepointList AList;
- AList::iterator iter;
-
-#if 1
- vector<AList::iterator> iters;
- vector<Activepoint>::iterator i = activepoints.begin(), end = activepoints.end();
-
- for(; i != end; ++i)
- {
- try { iters.push_back(value_node->list[index].find(*i)); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find activepoint"));
- }
- }
-
- //check to see which valuenodes are going to override because of the time...
- ValueNode_DynamicList::ListEntry::findresult timeiter;
-
- for(i = activepoints.begin(); i != end; ++i)
- {
- timeiter = value_node->list[index].find_time(i->get_time());
-
- bool candelete = timeiter.second;
-
- //we only want to track overwrites (not activepoints that are also being modified)
- if(candelete)
- {
- for(vector<AList::iterator>::iterator ii = iters.begin(); ii != iters.end(); ++ii)
- {
- if(timeiter.first == *ii)
- {
- candelete = false;
- break;
- }
- }
- }
-
- //if we can still delete it after checking, record it, and then remove them all later
- if(candelete)
- {
- Activepoint a = *timeiter.first;
- overwritten_activepoints.push_back(a);
- }
- }
-
- //overwrite all the valuenodes we're supposed to set
- {
- i = activepoints.begin();
- for(vector<AList::iterator>::iterator ii = iters.begin(); ii != iters.end() && i != end; ++ii, ++i)
- {
- old_activepoints.push_back(**ii);
- **ii = *i; //set the point to the corresponding point in the normal waypoint list
- }
- }
-
- //remove all the points we're supposed to be overwritting
- {
- vector<Activepoint>::iterator oi = overwritten_activepoints.begin(),
- oend = overwritten_activepoints.end();
- for(; oi != oend; ++oi)
- {
- value_node->list[index].erase(*oi);
- }
- }
-
-#else
- try { iter=value_node->list[index].find(activepoint); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find activepoint"));
- }
-
- //find the value at the old time before we replace it
- ValueNode_DynamicList::ListEntry::findresult timeiter;
- timeiter = value_node->list[index].find_time(activepoint.get_time());
-
- //we only want to track overwrites (not inplace modifications)
- if(timeiter.second && activepoint.get_uid() == timeiter.first->get_uid())
- {
- timeiter.second = false;
- }
-
- old_activepoint=*iter;
- *iter=activepoint;
-
- if(timeiter.second)
- {
- sinfg::info("Erasing the found activepoint");
- time_overwrite = true;
- overwritten_ap = *timeiter.first;
-
- value_node->list[index].erase(overwritten_ap);
- }
-
-#endif
-
- value_node->list[index].timing_info.sort();
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
-
-void
-Action::ActivepointSet::undo()
-{
- ValueNode_DynamicList::ListEntry::ActivepointList::iterator iter;
-
-#if 1
- vector<Activepoint>::iterator i = old_activepoints.begin(), end = old_activepoints.end();
-
- for(; i != end; ++i)
- {
- try { iter = value_node->list[index].find(*i); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find activepoint"));
- }
-
- //overwrite with old one
- *iter = *i;
- }
-
- //add back in all the points that we removed before...
- {
- vector<Activepoint>::iterator oi = overwritten_activepoints.begin(),
- oend = overwritten_activepoints.end();
- for(; oi != oend; ++oi)
- {
- value_node->list[index].add(*oi);
- }
- }
-
-#else
- try { iter=value_node->list[index].find(activepoint); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find activepoint"));
- }
-
- *iter=old_activepoint;
-
- if(time_overwrite)
- {
- value_node->list[index].add(overwritten_ap);
- }
-#endif
-
- value_node->list[index].timing_info.sort();
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointset.h
-** \brief Template File
-**
-** $Id: activepointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTSET_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ActivepointSet :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
-
- std::vector<sinfg::Activepoint> activepoints;
- std::vector<sinfg::Activepoint> old_activepoints;
-
- std::vector<sinfg::Activepoint> overwritten_activepoints;
-
-public:
-
- ActivepointSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsetoff.cpp
-** \brief Template File
-**
-** $Id: activepointsetoff.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointsetoff.h"
-#include "activepointsetsmart.h"
-#include "valuenodelinkconnect.h"
-#include "valuenodereplace.h"
-
-#include "activepointset.h"
-#include "activepointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointSetOff);
-ACTION_SET_NAME(Action::ActivepointSetOff,"activepoint_set_off");
-ACTION_SET_LOCAL_NAME(Action::ActivepointSetOff,_("Mark Activepoint as \"Off\""));
-ACTION_SET_TASK(Action::ActivepointSetOff,"set_off");
-ACTION_SET_CATEGORY(Action::ActivepointSetOff,Action::CATEGORY_ACTIVEPOINT|Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ActivepointSetOff,-9);
-ACTION_SET_VERSION(Action::ActivepointSetOff,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointSetOff,"$Id: activepointsetoff.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointSetOff::ActivepointSetOff()
-{
- activepoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointSetOff::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("Activepoint"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointSetOff::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- // We are only a canidate if this canvas is animated.
- Canvas::Handle canvas(x.find("canvas")->second.get_canvas());
- if(canvas->rend_desc().get_time_start()==canvas->rend_desc().get_time_end())
- return false;
-
- // We need either a activepoint or a time.
- if(x.count("activepoint") || x.count("time"))
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointSetOff::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- if(time_set)
- calc_activepoint();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
- {
- activepoint=param.get_activepoint();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
- {
- activepoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointSetOff::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing value_node");
-
- if(activepoint.get_time()==(Time::begin()-1))
- sinfg::error("Missing activepoint");
-
- if(!value_node || activepoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a activepoint. In this case, we need to calculate the value
-// of the activepoint
-void
-Action::ActivepointSetOff::calc_activepoint()
-{
- const Time time(activepoint.get_time());
-
- try { activepoint=*value_node->list[index].find(time); }
- catch(...)
- {
- activepoint.set_time(time);
- activepoint.set_state(value_node->list[index].status_at_time(time));
- activepoint.set_priority(0);
- }
-}
-
-void
-Action::ActivepointSetOff::prepare()
-{
- clear();
-
- // Turn the activepoint off
- activepoint.set_state(false);
-
- Action::Handle action(ActivepointSetSmart::create());
-
- action->set_param("edit_mode",get_edit_mode());
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsetoff.h
-** \brief Template File
-**
-** $Id: activepointsetoff.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTSETOFF_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTSETOFF_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-#include <list>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ActivepointSetOff :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
- bool time_set;
- sinfg::Activepoint activepoint;
-
- void calc_activepoint();
-
-public:
-
- ActivepointSetOff();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointseton.cpp
-** \brief Template File
-**
-** $Id: activepointseton.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointseton.h"
-#include "activepointsetsmart.h"
-#include "valuenodelinkconnect.h"
-#include "valuenodereplace.h"
-
-#include "activepointset.h"
-#include "activepointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointSetOn);
-ACTION_SET_NAME(Action::ActivepointSetOn,"activepoint_set_on");
-ACTION_SET_LOCAL_NAME(Action::ActivepointSetOn,_("Mark Activepoint as \"On\""));
-ACTION_SET_TASK(Action::ActivepointSetOn,"set_on");
-ACTION_SET_CATEGORY(Action::ActivepointSetOn,Action::CATEGORY_ACTIVEPOINT|Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ActivepointSetOn,-10);
-ACTION_SET_VERSION(Action::ActivepointSetOn,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointSetOn,"$Id: activepointseton.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointSetOn::ActivepointSetOn()
-{
- activepoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointSetOn::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("Activepoint"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointSetOn::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- // We are only a canidate if this canvas is animated.
- Canvas::Handle canvas(x.find("canvas")->second.get_canvas());
- if(canvas->rend_desc().get_time_start()==canvas->rend_desc().get_time_end())
- return false;
-
- // We need either a activepoint or a time.
- if(x.count("activepoint") || x.count("time"))
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointSetOn::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- if(time_set)
- calc_activepoint();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
- {
- activepoint=param.get_activepoint();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
- {
- activepoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointSetOn::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing value_node");
-
- if(activepoint.get_time()==(Time::begin()-1))
- sinfg::error("Missing activepoint");
-
- if(!value_node || activepoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a activepoint. In this case, we need to calculate the value
-// of the activepoint
-void
-Action::ActivepointSetOn::calc_activepoint()
-{
- const Time time(activepoint.get_time());
-
- try { activepoint=*value_node->list[index].find(time); }
- catch(...)
- {
- activepoint.set_time(time);
- activepoint.set_state(value_node->list[index].status_at_time(time));
- activepoint.set_priority(0);
- }
-}
-
-void
-Action::ActivepointSetOn::prepare()
-{
- clear();
-
- // Turn the activepoint off
- activepoint.set_state(true);
-
- Action::Handle action(ActivepointSetSmart::create());
-
- action->set_param("edit_mode",get_edit_mode());
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointseton.h
-** \brief Template File
-**
-** $Id: activepointseton.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTSETON_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTSETON_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-#include <list>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ActivepointSetOn :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
- sinfg::Activepoint activepoint;
- bool time_set;
-
- void calc_activepoint();
-
-public:
-
- ActivepointSetOn();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsetsmart.cpp
-** \brief Template File
-**
-** $Id: activepointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointsetsmart.h"
-#include "valuenodelinkconnect.h"
-#include "valuenodereplace.h"
-
-#include "activepointset.h"
-#include "activepointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointSetSmart);
-ACTION_SET_NAME(Action::ActivepointSetSmart,"activepoint_set_smart");
-ACTION_SET_LOCAL_NAME(Action::ActivepointSetSmart,_("Set Activepoint (Smart)"));
-ACTION_SET_TASK(Action::ActivepointSetSmart,"set");
-ACTION_SET_CATEGORY(Action::ActivepointSetSmart,Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::ActivepointSetSmart,0);
-ACTION_SET_VERSION(Action::ActivepointSetSmart,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointSetSmart,"$Id: activepointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointSetSmart::ActivepointSetSmart()
-{
- activepoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ActivepointSetSmart::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("New Activepoint"))
- .set_desc(_("Activepoint to be added"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_desc(_("Time where activepoint is to be added"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointSetSmart::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- // We need either a activepoint or a time.
- if(x.count("activepoint") || x.count("time"))
- return true;
- }
- return false;
-}
-
-bool
-Action::ActivepointSetSmart::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- if(time_set)
- calc_activepoint();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
- {
- activepoint=param.get_activepoint();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
- {
- activepoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointSetSmart::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing value_node");
-
- if(activepoint.get_time()==(Time::begin()-1))
- sinfg::error("Missing activepoint");
-
- if(!value_node || activepoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a activepoint. In this case, we need to calculate the value
-// of the activepoint
-void
-Action::ActivepointSetSmart::calc_activepoint()
-{
-/*
- const Time time(activepoint.get_time());
- activepoint.set_state(value_node->list[index].status_at_time(time));
- activepoint.set_priority(0);
-*/
-
- activepoint=value_node->list[index].new_activepoint_at_time(activepoint.get_time());
-
- // In this case, nothing is really changing, so there will be
- // no need to redraw the window
- set_dirty(false);
-}
-
-void
-Action::ActivepointSetSmart::enclose_activepoint(const sinfg::Activepoint& activepoint)
-{
- times.insert(activepoint.get_time());
-
- if(get_edit_mode()&MODE_ANIMATE_PAST) try
- {
- // Try to find prev keyframe
- Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(activepoint.get_time()));
-
- if(times.count(keyframe.get_time()))
- throw int();
- else
- times.insert(keyframe.get_time());
-
- try { value_node->list[index].find(keyframe.get_time()); }
- catch(sinfg::Exception::NotFound)
- {
- Action::Handle action(ActivepointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
-
- if(!value_node->list[index].timing_info.empty())
- {
- action->set_param("time",keyframe.get_time());
- }
- else
- {
- sinfg::Activepoint tmp;
-
- tmp.set_state(true);
- tmp.set_time(keyframe.get_time());
- action->set_param("activepoint",tmp);
- }
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- catch(int) { }
- catch(sinfg::Exception::NotFound) { }
-
- if(get_edit_mode()&MODE_ANIMATE_FUTURE)try
- {
- // Try to find next keyframe
- Keyframe keyframe(*get_canvas()->keyframe_list().find_next(activepoint.get_time()));
-
- if(times.count(keyframe.get_time()))
- throw int();
- else
- times.insert(keyframe.get_time());
-
- try { value_node->list[index].find(keyframe.get_time()); }
- catch(sinfg::Exception::NotFound)
- {
- Action::Handle action(ActivepointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
-
- if(!value_node->list[index].timing_info.empty())
- {
- action->set_param("time",keyframe.get_time());
- }
- else
- {
- sinfg::Activepoint tmp;
-
- tmp.set_state(true);
- tmp.set_time(keyframe.get_time());
- action->set_param("activepoint",tmp);
- }
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- catch(int) { }
- catch(sinfg::Exception::NotFound) { }
-}
-
-void
-Action::ActivepointSetSmart::prepare()
-{
- clear();
- times.clear();
-
- // First, we need to to add any activepoints necessary to
- // maintain the integrity of the keyframes.
- enclose_activepoint(activepoint);
-
- try
- {
- if(value_node->list[index].find(activepoint)==value_node->list[index].timing_info.end())
- throw int();
-
- // Then, lets try to replace the old activepoint, if it exists
- enclose_activepoint(*value_node->list[index].find(activepoint));
-
- Action::Handle action(ActivepointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- return;
- }
- catch(int){}
- catch(Exception::NotFound){}
-
- try
- {
- // Check to see if a activepoint exists at this point in time
- activepoint.mimic(*value_node->list[index].find(activepoint.get_time()));
-
- enclose_activepoint(*value_node->list[index].find(activepoint.get_time()));
-
- Action::Handle action(ActivepointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- return;
- }
- catch(int){}
- catch(Exception::NotFound){}
-
- try
- {
- // At this point we know that the old activepoint doesn't exist,
- // so we need to create it.
- Action::Handle action(ActivepointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- return;
- }
- catch(int){}
- catch(Exception::NotFound){}
-
- throw Error(_("Unable to determine how to procede. This is a bug."));
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsetsmart.h
-** \brief Template File
-**
-** $Id: activepointsetsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_ACTIVEPOINTSETSMART_H
-#define __SINFG_APP_ACTION_ACTIVEPOINTSETSMART_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-#include <list>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ActivepointSetSmart :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
- sinfg::Activepoint activepoint;
- bool time_set;
-
- void calc_activepoint();
- void enclose_activepoint(const sinfg::Activepoint& activepoint);
-
- std::set<sinfg::Time> times;
-
-public:
-
- ActivepointSetSmart();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsimpleadd.cpp
-** \brief Simple add activepoint File
-**
-** $Id: activepointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "activepointsimpleadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ActivepointSimpleAdd);
-ACTION_SET_NAME(Action::ActivepointSimpleAdd,"waypoint_simpleadd");
-ACTION_SET_LOCAL_NAME(Action::ActivepointSimpleAdd,"Simply Add Waypoint");
-ACTION_SET_TASK(Action::ActivepointSimpleAdd,"add");
-ACTION_SET_CATEGORY(Action::ActivepointSimpleAdd,Action::CATEGORY_WAYPOINT);
-ACTION_SET_PRIORITY(Action::ActivepointSimpleAdd,0);
-ACTION_SET_VERSION(Action::ActivepointSimpleAdd,"0.0");
-ACTION_SET_CVS_ID(Action::ActivepointSimpleAdd,"$Id: activepointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ActivepointSimpleAdd::ActivepointSimpleAdd()
-{
- set_dirty(true);
- activepoint.set_time(Time::begin()-1);
-}
-
-Action::ParamVocab
-Action::ActivepointSimpleAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("Destination ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
- .set_local_name(_("Activepoint"))
- .set_desc(_("Activepoint to be added"))
- );
-
- return ret;
-}
-
-bool
-Action::ActivepointSimpleAdd::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ActivepointSimpleAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
- if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
- {
- activepoint = param.get_activepoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ActivepointSimpleAdd::is_ready()const
-{
- if(!value_node && activepoint.get_time() != (Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ActivepointSimpleAdd::perform()
-{
- //remove any pretenders that lie at our destination
- ValueNode_DynamicList::ListEntry::findresult iter = value_node->list[index]
- .find_time(activepoint.get_time());
-
- time_overwrite = false;
- if(iter.second)
- {
- overwritten_ap = *iter.first;
- time_overwrite = true;
- value_node->list[index].erase(overwritten_ap);
- }
-
- //add the value node in since it's safe
- value_node->list[index].add(activepoint);
-
- //sort them...
- value_node->list[index].timing_info.sort();
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
-
-void
-Action::ActivepointSimpleAdd::undo()
-{
- //remove our old version...
- ValueNode_DynamicList::ListEntry::findresult iter = value_node->list[index].find_uid(activepoint);
-
- if(!iter.second)
- {
- throw Error(_("The activepoint to remove no longer exists"));
- }
-
- //remove the offending value
- value_node->list[index].erase(*iter.first); //could also just use waypoint
-
- if(time_overwrite)
- {
- value_node->list[index].add(overwritten_ap);
- }
-
- //sort them...
- value_node->list[index].timing_info.sort();
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file activepointsimpleadd.h
-** \brief A simple add a activepoint function Header
-**
-** $Id: activepointsimpleadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_ACTIVEPOINTSIMPLEADD_H
-#define __SINFG_ACTIVEPOINTSIMPLEADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ActivepointSimpleAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
-
- sinfg::Activepoint activepoint;
-
- bool time_overwrite;
- sinfg::Activepoint overwritten_ap;
-
-public:
-
- ActivepointSimpleAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blinepointtangentmerge.cpp
-** \brief Template File
-**
-** $Id: blinepointtangentmerge.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "blinepointtangentmerge.h"
-#include "valuedescset.h"
-
-#include "activepointset.h"
-#include "activepointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::BLinePointTangentMerge);
-ACTION_SET_NAME(Action::BLinePointTangentMerge,"bline_point_tangent_merge");
-ACTION_SET_LOCAL_NAME(Action::BLinePointTangentMerge,_("Merge Tangents"));
-ACTION_SET_TASK(Action::BLinePointTangentMerge,"merge");
-ACTION_SET_CATEGORY(Action::BLinePointTangentMerge,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::BLinePointTangentMerge,0);
-ACTION_SET_VERSION(Action::BLinePointTangentMerge,"0.0");
-ACTION_SET_CVS_ID(Action::BLinePointTangentMerge,"$Id: blinepointtangentmerge.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::BLinePointTangentMerge::BLinePointTangentMerge()
-{
- time=(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::BLinePointTangentMerge::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode of BLinePoint"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- );
-
- return ret;
-}
-
-bool
-Action::BLinePointTangentMerge::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueNode_Composite::Handle value_node;
- value_node=ValueNode_Composite::Handle::cast_dynamic(x.find("value_node")->second.get_value_node());
- if(!value_node || value_node->get_type()!=ValueBase::TYPE_BLINEPOINT)
- return false;
- sinfg::Time time(x.find("time")->second.get_time());
- if((*value_node->get_link("split"))(time).get(bool())==false)
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::BLinePointTangentMerge::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=value_node.cast_dynamic(param.get_value_node());
-
- return (bool)(value_node);
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::BLinePointTangentMerge::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing or bad value_node");
-
- if(time==(Time::begin()-1))
- sinfg::error("Missing time");
-
- if(!value_node || time==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::BLinePointTangentMerge::prepare()
-{
- clear();
-
- Action::Handle action;
-
- {
- action=Action::create("value_desc_set");
- if(!action)
- throw Error(_("Couldn't find action \"value_desc_set\""));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,3));
- action->set_param("time",time);
- action->set_param("new_value",sinfg::ValueBase(false));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- {
- action=Action::create("value_desc_set");
- if(!action)
- throw Error(_("Couldn't find action \"value_desc_set\""));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,5));
- action->set_param("time",time);
- action->set_param("new_value",(*value_node->get_link("t1"))(time));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blinepointtangentmerge.h
-** \brief Template File
-**
-** $Id: blinepointtangentmerge.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_BLINEPOINTTANGENTMERGE_H
-#define __SINFG_APP_ACTION_BLINEPOINTTANGENTMERGE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/blinepoint.h>
-#include <sinfg/valuenode_composite.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class BLinePointTangentMerge :
- public Super
-{
-private:
-
- sinfg::ValueNode_Composite::Handle value_node;
- sinfg::Time time;
-
-public:
-
- BLinePointTangentMerge();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blinepointtangentsplit.cpp
-** \brief Template File
-**
-** $Id: blinepointtangentsplit.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "blinepointtangentsplit.h"
-#include "valuedescset.h"
-
-#include "activepointset.h"
-#include "activepointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::BLinePointTangentSplit);
-ACTION_SET_NAME(Action::BLinePointTangentSplit,"bline_point_tangent_split");
-ACTION_SET_LOCAL_NAME(Action::BLinePointTangentSplit,_("Split Tangents"));
-ACTION_SET_TASK(Action::BLinePointTangentSplit,"split");
-ACTION_SET_CATEGORY(Action::BLinePointTangentSplit,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::BLinePointTangentSplit,0);
-ACTION_SET_VERSION(Action::BLinePointTangentSplit,"0.0");
-ACTION_SET_CVS_ID(Action::BLinePointTangentSplit,"$Id: blinepointtangentsplit.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::BLinePointTangentSplit::BLinePointTangentSplit()
-{
- time=(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::BLinePointTangentSplit::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode of BLinePoint"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- );
-
- return ret;
-}
-
-bool
-Action::BLinePointTangentSplit::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueNode_Composite::Handle value_node;
- value_node=ValueNode_Composite::Handle::cast_dynamic(x.find("value_node")->second.get_value_node());
- if(!value_node || value_node->get_type()!=ValueBase::TYPE_BLINEPOINT)
- return false;
- sinfg::Time time(x.find("time")->second.get_time());
- if((*value_node->get_link("split"))(time).get(bool())==true)
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::BLinePointTangentSplit::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=value_node.cast_dynamic(param.get_value_node());
-
- return (bool)(value_node);
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::BLinePointTangentSplit::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing or bad value_node");
-
- if(time==(Time::begin()-1))
- sinfg::error("Missing time");
-
- if(!value_node || time==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::BLinePointTangentSplit::prepare()
-{
- clear();
-
- Action::Handle action;
-
- {
- action=Action::create("value_desc_set");
- if(!action)
- throw Error(_("Couldn't find action \"value_desc_set\""));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,3));
- action->set_param("time",time);
- action->set_param("new_value",sinfg::ValueBase(true));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- {
- action=Action::create("value_desc_set");
- if(!action)
- throw Error(_("Couldn't find action \"value_desc_set\""));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,5));
- action->set_param("time",time);
- action->set_param("new_value",(*value_node->get_link("t1"))(time));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blinepointtangentsplit.h
-** \brief Template File
-**
-** $Id: blinepointtangentsplit.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_BLINEPOINTTANGENTSPLIT_H
-#define __SINFG_APP_ACTION_BLINEPOINTTANGENTSPLIT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/blinepoint.h>
-#include <sinfg/valuenode_composite.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class BLinePointTangentSplit :
- public Super
-{
-private:
-
- sinfg::ValueNode_Composite::Handle value_node;
- sinfg::Time time;
-
-public:
-
- BLinePointTangentSplit();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasadd.cpp
-** \brief Template File
-**
-** $Id: canvasadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "canvasadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::CanvasAdd);
-ACTION_SET_NAME(Action::CanvasAdd,"canvas_add");
-ACTION_SET_LOCAL_NAME(Action::CanvasAdd,"Add Child Canvas");
-ACTION_SET_TASK(Action::CanvasAdd,"add");
-ACTION_SET_CATEGORY(Action::CanvasAdd,Action::CATEGORY_CANVAS);
-ACTION_SET_PRIORITY(Action::CanvasAdd,0);
-ACTION_SET_VERSION(Action::CanvasAdd,"0.0");
-ACTION_SET_CVS_ID(Action::CanvasAdd,"$Id: canvasadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::CanvasAdd::CanvasAdd()
-{
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::CanvasAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("src",Param::TYPE_CANVAS)
- .set_local_name(_("New Canvas"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("id",Param::TYPE_STRING)
- .set_local_name(_("ID"))
- .set_desc(_("The name that you want this canvas to be"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::CanvasAdd::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::CanvasAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="src" && param.get_type()==Param::TYPE_CANVAS)
- {
- new_canvas=param.get_canvas();
-
- return true;
- }
- if(name=="id" && param.get_type()==Param::TYPE_STRING)
- {
- id=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::CanvasAdd::is_ready()const
-{
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::CanvasAdd::perform()
-{
- if(!new_canvas)
- {
- new_canvas=get_canvas()->new_child_canvas(id);
- }
- else
- {
- if(new_canvas->is_inline())
- {
- inline_parent=new_canvas->parent();
- }
- get_canvas()->add_child_canvas(new_canvas,id);
- }
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_canvas_added()(new_canvas);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::CanvasAdd::undo()
-{
- get_canvas()->remove_child_canvas(new_canvas);
-
- if(inline_parent)
- new_canvas->set_inline(inline_parent);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_canvas_removed()(new_canvas);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasadd.h
-** \brief Template File
-**
-** $Id: canvasadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_CANVASADD_H
-#define __SINFG_APP_ACTION_CANVASADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/renddesc.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class CanvasAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Canvas::Handle new_canvas;
- sinfg::String id;
-
- sinfg::Canvas::Handle inline_parent;
-
-public:
-
- CanvasAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasremove.cpp
-** \brief Template File
-**
-** $Id: canvasremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "canvasremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::CanvasRemove);
-ACTION_SET_NAME(Action::CanvasRemove,"canvas_remove");
-ACTION_SET_LOCAL_NAME(Action::CanvasRemove,"Remove Canvas");
-ACTION_SET_TASK(Action::CanvasRemove,"remove");
-ACTION_SET_CATEGORY(Action::CanvasRemove,Action::CATEGORY_CANVAS);
-ACTION_SET_PRIORITY(Action::CanvasRemove,0);
-ACTION_SET_VERSION(Action::CanvasRemove,"0.0");
-ACTION_SET_CVS_ID(Action::CanvasRemove,"$Id: canvasremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::CanvasRemove::CanvasRemove()
-{
-}
-
-Action::ParamVocab
-Action::CanvasRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- return ret;
-}
-
-bool
-Action::CanvasRemove::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- Canvas::Handle canvas=x.find("canvas")->second.get_canvas();
- assert(canvas);
- // We cannot remove the root canvas.
- if(canvas->is_root())
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::CanvasRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::CanvasRemove::is_ready()const
-{
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::CanvasRemove::perform()
-{
- // We cannot remove the root canvas.
- if(get_canvas()->is_root())
- throw Error(_("You cannot remove the root canvas!"));
-
- if(get_canvas()->is_inline())
- throw Error(_("You cannot remove an inline canvas!"));
-
- parent_canvas=get_canvas()->parent();
- canvas_id=get_canvas()->get_id();
-
- assert(parent_canvas);
-
- parent_canvas->remove_child_canvas(get_canvas());
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_canvas_removed()(get_canvas());
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::CanvasRemove::undo()
-{
- parent_canvas->add_child_canvas(get_canvas(), canvas_id);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_canvas_added()(get_canvas());
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasremove.h
-** \brief Template File
-**
-** $Id: canvasremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_CANVASREMOVE_H
-#define __SINFG_APP_ACTION_CANVASREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/renddesc.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class CanvasRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
- sinfg::Canvas::Handle parent_canvas;
- sinfg::String canvas_id;
-public:
-
- CanvasRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasrenddescset.cpp
-** \brief Template File
-**
-** $Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "canvasrenddescset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::CanvasRendDescSet);
-ACTION_SET_NAME(Action::CanvasRendDescSet,"canvas_rend_desc_set");
-ACTION_SET_LOCAL_NAME(Action::CanvasRendDescSet,"Set Canvas RendDesc");
-ACTION_SET_TASK(Action::CanvasRendDescSet,"set");
-ACTION_SET_CATEGORY(Action::CanvasRendDescSet,Action::CATEGORY_CANVAS);
-ACTION_SET_PRIORITY(Action::CanvasRendDescSet,0);
-ACTION_SET_VERSION(Action::CanvasRendDescSet,"0.0");
-ACTION_SET_CVS_ID(Action::CanvasRendDescSet,"$Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::CanvasRendDescSet::CanvasRendDescSet()
-{
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::CanvasRendDescSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("rend_desc",Param::TYPE_RENDDESC)
- .set_local_name(_("RendDesc"))
- );
-
- return ret;
-}
-
-bool
-Action::CanvasRendDescSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::CanvasRendDescSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="rend_desc" && param.get_type()==Param::TYPE_RENDDESC)
- {
- new_rend_desc=param.get_rend_desc();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::CanvasRendDescSet::is_ready()const
-{
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::CanvasRendDescSet::perform()
-{
- old_rend_desc=get_canvas()->rend_desc();
-
- get_canvas()->rend_desc()=new_rend_desc;
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_rend_desc_changed()();
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::CanvasRendDescSet::undo()
-{
- get_canvas()->rend_desc()=old_rend_desc;
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_rend_desc_changed()();
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasrenddescset.h
-** \brief Template File
-**
-** $Id: canvasrenddescset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_CANVASRENDDESCSET_H
-#define __SINFG_APP_ACTION_CANVASRENDDESCSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/renddesc.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class CanvasRendDescSet :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::RendDesc new_rend_desc;
- sinfg::RendDesc old_rend_desc;
-
-public:
-
- CanvasRendDescSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file colorset.cpp
-** \brief Template File
-**
-** $Id: colorset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamset.h"
-#include "valuenodeconstset.h"
-#include "valuedescconnect.h"
-#include "waypointsetsmart.h"
-
-#include "colorset.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/main.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ColorSet);
-ACTION_SET_NAME(Action::ColorSet,"color_set");
-ACTION_SET_LOCAL_NAME(Action::ColorSet,"Apply Default Color");
-ACTION_SET_TASK(Action::ColorSet,"set");
-ACTION_SET_CATEGORY(Action::ColorSet,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ColorSet,0);
-ACTION_SET_VERSION(Action::ColorSet,"0.0");
-ACTION_SET_CVS_ID(Action::ColorSet,"$Id: colorset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ColorSet::ColorSet():
- time(0)
-{
-}
-
-Action::ParamVocab
-Action::ColorSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ColorSet::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
- return x.find("value_desc")->second.get_value_desc().get_value_type()==ValueBase::TYPE_COLOR;
-}
-
-bool
-Action::ColorSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- // Grab the value_desc
- value_desc=param.get_value_desc();
-
- // Grab the current color
- color=sinfgapp::Main::get_foreground_color();
-
- return value_desc.get_value_type()==ValueBase::TYPE_COLOR;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ColorSet::is_ready()const
-{
- if(!value_desc || value_desc.get_value_type()!=ValueBase::TYPE_COLOR)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ColorSet::prepare()
-{
- clear();
-
- Action::Handle action;
- action=Action::create("value_desc_set");
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("new_value",ValueBase(color));
- action->set_param("time",time);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file colorset.h
-** \brief Template File
-**
-** $Id: colorset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_COLORSET_H
-#define __SINFG_APP_ACTION_COLORSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ColorSet :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::Color color;
- sinfg::Time time;
-
-public:
-
- ColorSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file editmodeset.cpp
-** \brief Template File
-**
-** $Id: editmodeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "editmodeset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::EditModeSet);
-ACTION_SET_NAME(Action::EditModeSet,"edit_mode_set");
-ACTION_SET_LOCAL_NAME(Action::EditModeSet,"Set Edit Mode");
-ACTION_SET_TASK(Action::EditModeSet,"set");
-ACTION_SET_CATEGORY(Action::EditModeSet,Action::CATEGORY_OTHER);
-ACTION_SET_PRIORITY(Action::EditModeSet,0);
-ACTION_SET_VERSION(Action::EditModeSet,"0.0");
-ACTION_SET_CVS_ID(Action::EditModeSet,"$Id: editmodeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::EditModeSet::EditModeSet()
-{
-}
-
-Action::ParamVocab
-Action::EditModeSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("edit_mode",Param::TYPE_EDITMODE)
- .set_local_name(_("New Edit Mode"))
- );
-
- return ret;
-}
-
-bool
-Action::EditModeSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::EditModeSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
-/*
- if(name=="edit_mode" && param.get_type()==Param::TYPE_EDITMODE)
- {
- set_edit_mode(param.get_edit_mode());
-
- return true;
- }
-*/
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::EditModeSet::is_ready()const
-{
- return Action::CanvasSpecific::is_ready() && get_canvas_interface();
-}
-
-void
-Action::EditModeSet::perform()
-{
- set_dirty(false);
-
- old_edit_mode=get_canvas_interface()->get_mode();
-
- if(old_edit_mode==get_edit_mode())
- return;
-
- get_canvas_interface()->mode_=get_edit_mode();
-
- get_canvas_interface()->signal_mode_changed_(get_edit_mode());
-}
-
-void
-Action::EditModeSet::undo()
-{
- set_dirty(false);
-
- if(old_edit_mode==get_edit_mode())
- return;
-
- get_canvas_interface()->mode_=old_edit_mode;
-
- get_canvas_interface()->signal_mode_changed_(old_edit_mode);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file editmodeset.h
-** \brief Template File
-**
-** $Id: editmodeset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_EDITMODESET_H
-#define __SINFG_APP_ACTION_EDITMODESET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <sinfgapp/editmode.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class EditModeSet :
- public Undoable,
- public CanvasSpecific
-{
- EditMode old_edit_mode;
-public:
-
- EditModeSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file gradientset.cpp
-** \brief Template File
-**
-** $Id: gradientset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamset.h"
-#include "valuenodeconstset.h"
-#include "valuedescconnect.h"
-#include "waypointsetsmart.h"
-
-#include "gradientset.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/main.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::GradientSet);
-ACTION_SET_NAME(Action::GradientSet,"gradient_set");
-ACTION_SET_LOCAL_NAME(Action::GradientSet,"Apply Default Gradient");
-ACTION_SET_TASK(Action::GradientSet,"set");
-ACTION_SET_CATEGORY(Action::GradientSet,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::GradientSet,0);
-ACTION_SET_VERSION(Action::GradientSet,"0.0");
-ACTION_SET_CVS_ID(Action::GradientSet,"$Id: gradientset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::GradientSet::GradientSet():
- time(0)
-{
-}
-
-Action::ParamVocab
-Action::GradientSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::GradientSet::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
- return x.find("value_desc")->second.get_value_desc().get_value_type()==ValueBase::TYPE_GRADIENT;
-}
-
-bool
-Action::GradientSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- // Grab the value_desc
- value_desc=param.get_value_desc();
-
- // Grab the current gradient
- gradient=sinfgapp::Main::get_gradient();
-
- return value_desc.get_value_type()==ValueBase::TYPE_GRADIENT;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::GradientSet::is_ready()const
-{
- if(!value_desc || value_desc.get_value_type()!=ValueBase::TYPE_GRADIENT)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::GradientSet::prepare()
-{
- clear();
-
- Action::Handle action;
- action=Action::create("value_desc_set");
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("new_value",ValueBase(gradient));
- action->set_param("time",time);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file gradientset.h
-** \brief Template File
-**
-** $Id: gradientset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_GRADIENTSET_H
-#define __SINFG_APP_ACTION_GRADIENTSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-#include <sinfg/gradient.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class GradientSet :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::Gradient gradient;
- sinfg::Time time;
-
-public:
-
- GradientSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.cpp
-** \brief Template File
-**
-** $Id: groupaddlayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "groupaddlayers.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::GroupAddLayers);
-ACTION_SET_NAME(Action::GroupAddLayers,"group_add_layers");
-ACTION_SET_LOCAL_NAME(Action::GroupAddLayers,"Add Layers to Group");
-ACTION_SET_TASK(Action::GroupAddLayers,"add");
-ACTION_SET_CATEGORY(Action::GroupAddLayers,Action::CATEGORY_LAYER|Action::CATEGORY_GROUP);
-ACTION_SET_PRIORITY(Action::GroupAddLayers,0);
-ACTION_SET_VERSION(Action::GroupAddLayers,"0.0");
-ACTION_SET_CVS_ID(Action::GroupAddLayers,"$Id: groupaddlayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::GroupAddLayers::GroupAddLayers()
-{
-}
-
-Action::ParamVocab
-Action::GroupAddLayers::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be added to group"))
- .set_supports_multiple()
- );
-
- ret.push_back(ParamDesc("group",Param::TYPE_STRING)
- .set_local_name(_("Group"))
- .set_desc(_("Name of the Group to add the Layers to"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::GroupAddLayers::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::GroupAddLayers::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- std::pair<sinfg::Layer::Handle,String> layer_pair;
- layer_pair.first=param.get_layer();
- layer_list.push_back(layer_pair);
-
- return true;
- }
-
- if(name=="group" && param.get_type()==Param::TYPE_STRING)
- {
- group=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::GroupAddLayers::is_ready()const
-{
- if(layer_list.empty() || group.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::GroupAddLayers::perform()
-{
- std::list<std::pair<sinfg::Layer::Handle,String> >::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- Layer::Handle layer(iter->first);
- iter->second=layer->get_group();
-
- layer->add_to_group(group);
- }
-}
-
-void
-Action::GroupAddLayers::undo()
-{
- std::list<std::pair<sinfg::Layer::Handle,String> >::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- Layer::Handle layer(iter->first);
-
- layer->remove_from_group(group);
-
- layer->add_to_group(iter->second);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_groupaddlayers.h
-** \brief Template File
-**
-** $Id: groupaddlayers.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_GROUPADDLAYERS_H
-#define __SINFG_APP_ACTION_GROUPADDLAYERS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class GroupAddLayers :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- // List contains the layers and their previous groups
- std::list<std::pair<sinfg::Layer::Handle,sinfg::String> > layer_list;
-
- // The name of the new group
- sinfg::String group;
-
-public:
-
- GroupAddLayers();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.cpp
-** \brief Template File
-**
-** $Id: groupremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "groupremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::GroupRemove);
-ACTION_SET_NAME(Action::GroupRemove,"group_remove");
-ACTION_SET_LOCAL_NAME(Action::GroupRemove,"Remove Group");
-ACTION_SET_TASK(Action::GroupRemove,"remove");
-ACTION_SET_CATEGORY(Action::GroupRemove,Action::CATEGORY_GROUP);
-ACTION_SET_PRIORITY(Action::GroupRemove,0);
-ACTION_SET_VERSION(Action::GroupRemove,"0.0");
-ACTION_SET_CVS_ID(Action::GroupRemove,"$Id: groupremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::GroupRemove::GroupRemove()
-{
-}
-
-Action::ParamVocab
-Action::GroupRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("group",Param::TYPE_STRING)
- .set_local_name(_("Group"))
- .set_desc(_("Name of the Group to remove"))
- );
-
- return ret;
-}
-
-bool
-Action::GroupRemove::is_canidate(const ParamList &x)
-{
- bool ret(canidate_check(get_param_vocab(),x));
- if(!ret)
- {
- sinfg::info("Action::GroupRemove::is_canidate(): failed canidate check");
- ParamList::const_iterator iter;
- for(iter=x.begin();iter!=x.end();++iter)
- {
- sinfg::info("PARAM: %s",iter->first.c_str());
- }
- }
- return ret;
-}
-
-bool
-Action::GroupRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="group" && param.get_type()==Param::TYPE_STRING)
- {
- group=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::GroupRemove::is_ready()const
-{
- if(group.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::GroupRemove::perform()
-{
- layer_list=get_canvas()->get_layers_in_group(group);
-
- std::set<sinfg::Layer::Handle>::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- (*iter)->remove_from_group(group);
- }
-}
-
-void
-Action::GroupRemove::undo()
-{
- std::set<sinfg::Layer::Handle>::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- (*iter)->add_to_group(group);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_groupaddlayers.h
-** \brief Template File
-**
-** $Id: groupremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_GROUPREMOVE_H
-#define __SINFG_APP_ACTION_GROUPREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class GroupRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- // List contains the layers
- std::set<sinfg::Layer::Handle> layer_list;
-
- // The name of the group to remove
- sinfg::String group;
-
-public:
-
- GroupRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.cpp
-** \brief Template File
-**
-** $Id: groupremovelayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "groupremovelayers.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::GroupRemoveLayers);
-ACTION_SET_NAME(Action::GroupRemoveLayers,"group_remove_layers");
-ACTION_SET_LOCAL_NAME(Action::GroupRemoveLayers,"Remove Layers from a Group");
-ACTION_SET_TASK(Action::GroupRemoveLayers,"remove");
-ACTION_SET_CATEGORY(Action::GroupRemoveLayers,Action::CATEGORY_LAYER|Action::CATEGORY_GROUP);
-ACTION_SET_PRIORITY(Action::GroupRemoveLayers,0);
-ACTION_SET_VERSION(Action::GroupRemoveLayers,"0.0");
-ACTION_SET_CVS_ID(Action::GroupRemoveLayers,"$Id: groupremovelayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::GroupRemoveLayers::GroupRemoveLayers()
-{
-}
-
-Action::ParamVocab
-Action::GroupRemoveLayers::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be added to group"))
- .set_supports_multiple()
- );
-
- ret.push_back(ParamDesc("group",Param::TYPE_STRING)
- .set_local_name(_("Group"))
- .set_desc(_("Name of the Group to add the Layers to"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::GroupRemoveLayers::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::GroupRemoveLayers::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- std::pair<sinfg::Layer::Handle,String> layer_pair;
- layer_pair.first=param.get_layer();
- layer_list.push_back(layer_pair);
-
- return true;
- }
-
- if(name=="group" && param.get_type()==Param::TYPE_STRING)
- {
- group=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::GroupRemoveLayers::is_ready()const
-{
- if(layer_list.empty() || group.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::GroupRemoveLayers::perform()
-{
- std::list<std::pair<sinfg::Layer::Handle,String> >::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- Layer::Handle layer(iter->first);
- iter->second=layer->get_group();
-
- layer->remove_from_group(group);
- }
-}
-
-void
-Action::GroupRemoveLayers::undo()
-{
- std::list<std::pair<sinfg::Layer::Handle,String> >::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- Layer::Handle layer(iter->first);
-
- layer->add_to_group(iter->second);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_groupremovelayers.h
-** \brief Template File
-**
-** $Id: groupremovelayers.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_GROUPREMOVELAYERS_H
-#define __SINFG_APP_ACTION_GROUPREMOVELAYERS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class GroupRemoveLayers :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- // List contains the layers and their previous groups
- std::list<std::pair<sinfg::Layer::Handle,sinfg::String> > layer_list;
-
- // The name of the new group
- sinfg::String group;
-
-public:
-
- GroupRemoveLayers();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.cpp
-** \brief Template File
-**
-** $Id: grouprename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "grouprename.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::GroupRename);
-ACTION_SET_NAME(Action::GroupRename,"group_rename");
-ACTION_SET_LOCAL_NAME(Action::GroupRename,"Rename Group");
-ACTION_SET_TASK(Action::GroupRename,"rename");
-ACTION_SET_CATEGORY(Action::GroupRename,Action::CATEGORY_GROUP);
-ACTION_SET_PRIORITY(Action::GroupRename,0);
-ACTION_SET_VERSION(Action::GroupRename,"0.0");
-ACTION_SET_CVS_ID(Action::GroupRename,"$Id: grouprename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::GroupRename::GroupRename()
-{
-}
-
-Action::ParamVocab
-Action::GroupRename::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("group",Param::TYPE_STRING)
- .set_local_name(_("Old Group"))
- .set_desc(_("Name of the Group to rename"))
- );
-
- ret.push_back(ParamDesc("new_group",Param::TYPE_STRING)
- .set_local_name(_("New Group"))
- .set_desc(_("New name for group"))
- );
-
- return ret;
-}
-
-bool
-Action::GroupRename::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::GroupRename::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="group" && param.get_type()==Param::TYPE_STRING)
- {
- old_group_name=param.get_string();
-
- return true;
- }
-
- if(name=="new_group" && param.get_type()==Param::TYPE_STRING)
- {
- new_group_name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::GroupRename::is_ready()const
-{
- if(old_group_name.empty()||new_group_name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::GroupRename::perform()
-{
- if(get_canvas()->get_groups().count(new_group_name)!=0)
- {
- throw Error(_("A group with the name \"%s\" already exists!"),new_group_name.c_str());
- }
- get_canvas()->rename_group(old_group_name,new_group_name);
-}
-
-void
-Action::GroupRename::undo()
-{
- get_canvas()->rename_group(new_group_name,old_group_name);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_grouprename.h
-** \brief Template File
-**
-** $Id: grouprename.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_GROUPRENAME_H
-#define __SINFG_APP_ACTION_GROUPRENAME_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class GroupRename :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- // List contains the layers
- std::set<sinfg::Layer::Handle> layer_list;
-
- // The name of the group to remove
- sinfg::String old_group_name;
-
- sinfg::String new_group_name;
-
-public:
-
- GroupRename();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeadd.cpp
-** \brief Template File
-**
-** $Id: keyframeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframeadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeAdd);
-ACTION_SET_NAME(Action::KeyframeAdd,"keyframe_add");
-ACTION_SET_LOCAL_NAME(Action::KeyframeAdd,"Add Keyframe");
-ACTION_SET_TASK(Action::KeyframeAdd,"add");
-ACTION_SET_CATEGORY(Action::KeyframeAdd,Action::CATEGORY_KEYFRAME);
-ACTION_SET_PRIORITY(Action::KeyframeAdd,0);
-ACTION_SET_VERSION(Action::KeyframeAdd,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeAdd,"$Id: keyframeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeAdd::KeyframeAdd()
-{
- keyframe.set_time(Time::begin()-1);
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::KeyframeAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("New Keyframe"))
- .set_desc(_("Keyframe to be added"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeAdd::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
-
- return true;
-}
-
-bool
-Action::KeyframeAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- keyframe=param.get_keyframe();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeAdd::is_ready()const
-{
- if(keyframe.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeAdd::perform()
-{
- try { get_canvas()->keyframe_list().find(keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { get_canvas()->keyframe_list().find(keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- get_canvas()->keyframe_list().add(keyframe);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_added()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::KeyframeAdd::undo()
-{
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_removed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-
- get_canvas()->keyframe_list().erase(keyframe);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeadd.h
-** \brief Template File
-**
-** $Id: keyframeadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMEADD_H
-#define __SINFG_APP_ACTION_KEYFRAMEADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Keyframe keyframe;
-
-public:
-
- KeyframeAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeduplicate.cpp
-** \brief Template File
-**
-** $Id: keyframeduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframeduplicate.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-#include "activepointsetsmart.h"
-#include "waypointsetsmart.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeDuplicate);
-ACTION_SET_NAME(Action::KeyframeDuplicate,"keyframe_duplicate");
-ACTION_SET_LOCAL_NAME(Action::KeyframeDuplicate,"Duplicate Keyframe");
-ACTION_SET_TASK(Action::KeyframeDuplicate,"duplicate");
-ACTION_SET_CATEGORY(Action::KeyframeDuplicate,Action::CATEGORY_KEYFRAME);
-ACTION_SET_PRIORITY(Action::KeyframeDuplicate,0);
-ACTION_SET_VERSION(Action::KeyframeDuplicate,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeDuplicate,"$Id: keyframeduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeDuplicate::KeyframeDuplicate()
-{
- new_keyframe.set_time(Time::begin()-1);
- keyframe.set_time(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::KeyframeDuplicate::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("Keyframe"))
- .set_desc(_("Keyframe to be duplicated"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeDuplicate::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::KeyframeDuplicate::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- keyframe=param.get_keyframe();
- new_keyframe.set_description(keyframe.get_description()+_(" (Duplicate)"));
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- new_keyframe.set_time(param.get_time());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeDuplicate::is_ready()const
-{
- if(keyframe.get_time()==(Time::begin()-1) || new_keyframe.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeDuplicate::prepare()
-{
- clear();
-
- const sinfg::Time old_time=keyframe.get_time();
- const sinfg::Time new_time=new_keyframe.get_time();
-
- try { get_canvas()->keyframe_list().find(keyframe);}
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find the given keyframe"));
- }
-
- try { if(get_canvas()->keyframe_list().find(new_time)!=get_canvas()->keyframe_list().end()) throw Error(_("A Keyframe already exists at this point in time"));}
- catch(...) { }
-
- // If the times are different, then we
- // will need to romp through the valuenodes
- // and add actions to update their values.
- if(new_time!=old_time)
- {
- std::vector<sinfgapp::ValueDesc> value_desc_list;
- get_canvas_interface()->find_important_value_descs(value_desc_list);
- while(!value_desc_list.empty())
- {
- process_value_desc(value_desc_list.back());
- value_desc_list.pop_back();
- }
- }
-}
-
-void
-Action::KeyframeDuplicate::process_value_desc(const sinfgapp::ValueDesc& value_desc)
-{
- const sinfg::Time old_time=keyframe.get_time();
- const sinfg::Time new_time=new_keyframe.get_time();
-
- if(value_desc.is_value_node())
- {
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- // If we are a dynamic list, then we need to update the ActivePoints
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- {
- ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
- int i;
-
- for(i=0;i<value_node->link_count();i++)
- {
- sinfgapp::ValueDesc value_desc(value_node,i);
- Activepoint activepoint(value_node->list[i].new_activepoint_at_time(old_time));
- activepoint.set_time(new_time);
-
- Action::Handle action(ActivepointSetSmart::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
- {
- ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
- Waypoint waypoint(value_node->new_waypoint_at_time(old_time));
- waypoint.set_time(new_time);
-
- Action::Handle action(WaypointSetSmart::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
-}
-
-void
-Action::KeyframeDuplicate::perform()
-{
- try { get_canvas()->keyframe_list().find(new_keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { get_canvas()->keyframe_list().find(new_keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- Action::Super::perform();
-
- get_canvas()->keyframe_list().add(new_keyframe);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_added()(new_keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::KeyframeDuplicate::undo()
-{
- Action::Super::undo();
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_removed()(new_keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-
- get_canvas()->keyframe_list().erase(new_keyframe);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeduplicate.h
-** \brief Template File
-**
-** $Id: keyframeduplicate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMEDUPLICATE_H
-#define __SINFG_APP_ACTION_KEYFRAMEDUPLICATE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeDuplicate :
- public Super
-{
-private:
-
- sinfg::Keyframe keyframe;
- sinfg::Keyframe new_keyframe;
-
- void process_value_desc(const sinfgapp::ValueDesc& value_desc);
-
-public:
-
- KeyframeDuplicate();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeremove.cpp
-** \brief Template File
-**
-** $Id: keyframeremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframeremove.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-#include "activepointremove.h"
-#include "waypointremove.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeRemove);
-ACTION_SET_NAME(Action::KeyframeRemove,"keyframe_remove");
-ACTION_SET_LOCAL_NAME(Action::KeyframeRemove,"Remove Keyframe");
-ACTION_SET_TASK(Action::KeyframeRemove,"remove");
-ACTION_SET_CATEGORY(Action::KeyframeRemove,Action::CATEGORY_KEYFRAME);
-ACTION_SET_PRIORITY(Action::KeyframeRemove,0);
-ACTION_SET_VERSION(Action::KeyframeRemove,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeRemove,"$Id: keyframeremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeRemove::KeyframeRemove()
-{
- keyframe.set_time(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::KeyframeRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("Keyframe"))
- .set_desc(_("Keyframe to be removed"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeRemove::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::KeyframeRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- keyframe=param.get_keyframe();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeRemove::is_ready()const
-{
- if(keyframe.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeRemove::prepare()
-{
- clear();
-
- try { get_canvas()->keyframe_list().find(keyframe);}
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find the given keyframe"));
- }
-
-
- {
- std::vector<sinfgapp::ValueDesc> value_desc_list;
- get_canvas_interface()->find_important_value_descs(value_desc_list);
- while(!value_desc_list.empty())
- {
- process_value_desc(value_desc_list.back());
- value_desc_list.pop_back();
- }
- }
-}
-
-void
-Action::KeyframeRemove::process_value_desc(const sinfgapp::ValueDesc& value_desc)
-{
- const sinfg::Time time(keyframe.get_time());
-
- if(value_desc.is_value_node())
- {
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- // If we are a dynamic list, then we need to update the ActivePoints
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- {
- ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
- int i;
- for(i=0;i<value_node->link_count();i++)
- try
- {
- Activepoint activepoint;
- activepoint=*value_node->list[i].find(time);
-
- sinfgapp::ValueDesc value_desc(value_node,i);
-
- Action::Handle action(ActivepointRemove::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- catch(...)
- {
- }
- }
- else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
- try
- {
- ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
- Waypoint waypoint;
- waypoint=*value_node->find(time);
- assert(waypoint.get_time()==time);
-
- Action::Handle action(WaypointRemove::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- catch(...)
- {
- }
- }
-}
-
-
-void
-Action::KeyframeRemove::perform()
-{
- Action::Super::perform();
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_removed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-
- get_canvas()->keyframe_list().erase(keyframe);
-}
-
-void
-Action::KeyframeRemove::undo()
-{
- try { get_canvas()->keyframe_list().find(keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { get_canvas()->keyframe_list().find(keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- Action::Super::undo();
-
- get_canvas()->keyframe_list().add(keyframe);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_added()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeremove.h
-** \brief Template File
-**
-** $Id: keyframeremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMEREMOVE_H
-#define __SINFG_APP_ACTION_KEYFRAMEREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeRemove :
- public Super
-{
-private:
-
- sinfg::Keyframe keyframe;
-
- void process_value_desc(const sinfgapp::ValueDesc& value_desc);
-
-public:
-
- KeyframeRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeset.cpp
-** \brief Template File
-**
-** $Id: keyframeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframeset.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-#include "activepointsetsmart.h"
-#include "waypointsetsmart.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeSet);
-ACTION_SET_NAME(Action::KeyframeSet,"keyframe_set");
-ACTION_SET_LOCAL_NAME(Action::KeyframeSet,"Set Keyframe");
-ACTION_SET_TASK(Action::KeyframeSet,"set");
-ACTION_SET_CATEGORY(Action::KeyframeSet,Action::CATEGORY_KEYFRAME|Action::CATEGORY_HIDDEN);
-ACTION_SET_PRIORITY(Action::KeyframeSet,0);
-ACTION_SET_VERSION(Action::KeyframeSet,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeSet,"$Id: keyframeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeSet::KeyframeSet()
-{
- keyframe.set_time(Time::begin()-1);
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::KeyframeSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("New Keyframe"))
- .set_desc(_("Keyframe to be added"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::KeyframeSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- sinfg::info("KeyframeSet::set_param():old_time: %s",keyframe.get_time().get_string().c_str());
- keyframe=param.get_keyframe();
- sinfg::info("KeyframeSet::set_param():new_time: %s",keyframe.get_time().get_string().c_str());
- sinfg::info("KeyframeSet::set_param():get_keyframe(): %s",param.get_keyframe().get_time().get_string().c_str());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeSet::is_ready()const
-{
- if(keyframe.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeSet::prepare()
-{
- clear();
- guid_set.clear();
-
-
-
-
-
- //sinfg::info("new_time: %s",new_time.get_string().c_str());
- //sinfg::info("old_time: %s",old_time.get_string().c_str());
-
- try { if(get_canvas()->keyframe_list().find(new_time)!=get_canvas()->keyframe_list().end()) throw Error(_("A Keyframe already exists at this point in time"));}
- catch(...) { }
-
-
- // If the times are different, then we
- // will need to romp through the valuenodes
- // and add actions to update their values.
- if(new_time!=old_time)
- {
- std::vector<sinfgapp::ValueDesc> value_desc_list;
- get_canvas_interface()->find_important_value_descs(value_desc_list);
- while(!value_desc_list.empty())
- {
- process_value_desc(value_desc_list.back());
- value_desc_list.pop_back();
- }
- }
-}
-
-#define old_2_new(x) (((x)-old_begin)/(old_end-old_begin)*(new_end-new_begin)+new_begin)
-
-int
-Action::KeyframeSet::scale_activepoints(const sinfgapp::ValueDesc& value_desc,const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end)
-{
- ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_static(value_desc.get_parent_value_node()));
- ValueNode_DynamicList::ListEntry& list_entry(value_node->list[value_desc.get_index()]);
-
- std::vector<Activepoint*> selected;
- std::vector<Activepoint*>::iterator iter;
-
- if(list_entry.find(old_begin,old_end,selected))
- {
- // check to make sure this operation is OK
- for(iter=selected.begin();iter!=selected.end();++iter)
- {
- try
- {
- Time new_time(old_2_new((*iter)->get_time()));
- if(new_time>=old_begin && new_time<old_end)
- continue;
- list_entry.find(new_time);
- // If we found a activepoint already at that time, then
- // we need to abort
- //throw Exception::BadTime(_("Activepoint Conflict"));
- }
- catch(Exception::NotFound) { }
- }
-
- int ret(0);
- while(!selected.empty())
- {
- if(selected.back()->get_time()!=old_2_new(selected.back()->get_time()))
- {
- Action::Handle action(Action::create("activepoint_set"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
-
- Activepoint activepoint(*selected.back());
- activepoint.set_time(old_2_new(selected.back()->get_time()));
-
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- ret++;
- }
- selected.pop_back();
- }
- return ret;
- }
- return 0;
-}
-
-int
-Action::KeyframeSet::scale_waypoints(const sinfgapp::ValueDesc& value_desc,const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end)
-{
- ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_static(value_desc.get_value_node()));
-
- std::vector<Waypoint*> selected;
- std::vector<Waypoint*>::iterator iter;
-
- if(value_node->find(old_begin,old_end,selected))
- {
- // check to make sure this operation is OK
- for(iter=selected.begin();iter!=selected.end();++iter)
- {
- try
- {
- Time new_time(old_2_new((*iter)->get_time()));
- if(new_time>=old_begin && new_time<old_end)
- continue;
- value_node->find(new_time);
- // If we found a waypoint point already at that time, then
- // we need to abort
- //sinfg::info(_("old_begin: %s, old_end: %s"),old_begin.get_string().c_str(),old_end.get_string().c_str());
- //sinfg::info(_("new_begin: %s, new_end: %s"),new_begin.get_string().c_str(),new_end.get_string().c_str());
- //throw Exception::BadTime(strprintf(_("Waypoint Conflict, old: %s, new: %s"),(*iter)->get_time().get_string().c_str(),new_time.get_string().c_str()));
- }
- catch(Exception::NotFound) { }
- }
-
- int ret(0);
- while(!selected.empty())
- {
- if(selected.back()->get_time()!=old_2_new(selected.back()->get_time()))
- {
- Action::Handle action(Action::create("waypoint_set"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle::cast_static(value_node));
-
- Waypoint waypoint(*selected.back());
- waypoint.set_time(old_2_new(selected.back()->get_time()));
-
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- ret++;
- }
- selected.pop_back();
- }
- return ret;
- }
- return 0;
-}
-
-void
-Action::KeyframeSet::process_value_desc(const sinfgapp::ValueDesc& value_desc)
-{
- if(value_desc.is_value_node())
- {
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- //if(guid_set.count(value_node->get_guid()))
- // return;
- //guid_set.insert(value_node->get_guid());
-
- // If we are a dynamic list, then we need to update the ActivePoints
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- {
- ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
- int i;
- for(i=0;i<value_node->link_count();i++)
- {
- sinfgapp::ValueDesc value_desc(value_node,i);
- if(new_time>keyframe_prev && new_time<keyframe_next)
- {
- // In this circumstance, we need to adjust any
- // activepoints between the previous and next
- // keyframes
- scale_activepoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time);
- scale_activepoints(value_desc,old_time,keyframe_next,new_time,keyframe_next);
- }
- //else
- {
- Action::Handle action(ActivepointSetSmart::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
-
- Activepoint activepoint;
- try
- {
- activepoint=*value_node->list[i].find(old_time);
- activepoint.set_time(new_time);
- }
- catch(...)
- {
- activepoint.set_time(new_time);
- activepoint.set_state(value_node->list[i].status_at_time(old_time));
- activepoint.set_priority(0);
- }
- action->set_param("activepoint",activepoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- }
- else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
- {
- if(new_time>keyframe_prev && new_time<keyframe_next)
- {
- // In this circumstance, we need to adjust any
- // waypoints between the previous and next
- // keyframes
- scale_waypoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time);
- scale_waypoints(value_desc,old_time,keyframe_next,new_time,keyframe_next);
- }
- //else
- {
- ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
-
- Action::Handle action(WaypointSetSmart::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
-
- Waypoint waypoint;
- try
- {
- waypoint=*value_node->find(old_time);
- waypoint.set_time(new_time);
- }
- catch(...)
- {
- waypoint.set_time(new_time);
- waypoint.set_value((*value_node)(old_time));
- }
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- }
-}
-
-
-void
-Action::KeyframeSet::perform()
-{
-
- old_time=get_canvas()->keyframe_list().find(keyframe)->get_time();
- new_time=keyframe.get_time();
-
- try { get_canvas()->keyframe_list().find(keyframe);}
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find the given keyframe"));
- }
-
- // Check for colisions
- if(old_time!=new_time)
- {
- try {
- get_canvas()->keyframe_list().find(new_time);
- throw Error(_("Cannot change keyframe time because another keyframe already exists with that time."));
- }
- catch(Exception::NotFound) { }
- }
- try { keyframe_next=get_canvas()->keyframe_list().find_next(old_time)->get_time(); }
- catch(...) { keyframe_next=Time::end(); }
- try { keyframe_prev=get_canvas()->keyframe_list().find_prev(old_time)->get_time(); }
- catch(...) { keyframe_prev=Time::begin(); }
-
- old_keyframe=*get_canvas()->keyframe_list().find(keyframe);
- *get_canvas()->keyframe_list().find(keyframe)=keyframe;
-
- get_canvas()->keyframe_list().sync();
-
- try{
- Action::Super::perform();
- } catch(...)
- {
- *get_canvas()->keyframe_list().find(old_keyframe)=old_keyframe;
-
- get_canvas()->keyframe_list().sync();
- throw;
- }
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_changed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::KeyframeSet::undo()
-{
- Action::Super::undo();
-
- *get_canvas()->keyframe_list().find(old_keyframe)=old_keyframe;
-
- get_canvas()->keyframe_list().sync();
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_changed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeset.h
-** \brief Template File
-**
-** $Id: keyframeset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMESET_H
-#define __SINFG_APP_ACTION_KEYFRAMESET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-#include <sinfg/time.h>
-#include <sinfg/guid.h>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeSet :
- public Super
-{
-private:
-
- sinfg::Keyframe keyframe;
- sinfg::Keyframe old_keyframe;
- sinfg::Time old_time;
- sinfg::Time new_time;
-
- sinfg::Time keyframe_prev,keyframe_next;
-
- std::set<sinfg::GUID> guid_set;
-
- void process_value_desc(const sinfgapp::ValueDesc& value_desc);
-
- int scale_activepoints(const sinfgapp::ValueDesc& value_desc,const sinfg::Time& old_begin,const sinfg::Time& old_end,const sinfg::Time& new_begin,const sinfg::Time& new_end);
- int scale_waypoints(const sinfgapp::ValueDesc& value_desc,const sinfg::Time& old_begin,const sinfg::Time& old_end,const sinfg::Time& new_begin,const sinfg::Time& new_end);
-
-public:
-
- KeyframeSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeset.cpp
-** \brief Template File
-**
-** $Id: keyframesetdelta.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframesetdelta.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-#include "activepointsetsmart.h"
-#include "waypointsetsmart.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeSetDelta);
-ACTION_SET_NAME(Action::KeyframeSetDelta,"keyframe_set_delta");
-ACTION_SET_LOCAL_NAME(Action::KeyframeSetDelta,"Set Keyframe Delta");
-ACTION_SET_TASK(Action::KeyframeSetDelta,"set");
-ACTION_SET_CATEGORY(Action::KeyframeSetDelta,Action::CATEGORY_KEYFRAME|Action::CATEGORY_HIDDEN);
-ACTION_SET_PRIORITY(Action::KeyframeSetDelta,0);
-ACTION_SET_VERSION(Action::KeyframeSetDelta,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeSetDelta,"$Id: keyframesetdelta.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeSetDelta::KeyframeSetDelta():
- delta(0)
-{
- keyframe.set_time(Time::end());
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::KeyframeSetDelta::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("Keyframe"))
- );
- ret.push_back(ParamDesc("delta",Param::TYPE_KEYFRAME)
- .set_local_name(_("Delta"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeSetDelta::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::KeyframeSetDelta::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- keyframe=param.get_keyframe();
- return true;
- }
- if(name=="delta" && param.get_type()==Param::TYPE_TIME)
- {
- delta=param.get_time();
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeSetDelta::is_ready()const
-{
- if(keyframe.get_time()==Time::end())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeSetDelta::prepare()
-{
- clear();
- value_desc_list.clear();
- get_canvas_interface()->find_important_value_descs(value_desc_list);
-
-
- Time time(get_canvas()->keyframe_list().find(keyframe)->get_time());
-
- std::vector<sinfgapp::ValueDesc>::iterator iter;
- DEBUGPOINT();
- for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
- {
- ValueDesc& value_desc(*iter);
- ValueNode_Animated::Handle value_node(
- ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
- );
-
- if(!value_node)
- continue;
-
- try{
- value_node->find(time);
- // if we got to this point, then we know that
- // a waypoint already exists here and we don't
- // need to add a new one.
- continue;
- }catch(...)
- {
- // Make sure there is something previous
- try{
- value_node->find_prev(time);
- }catch(...)
- {
- continue;
- }
- }
- Action::Handle action(Action::create("waypoint_set_smart"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle::cast_static(value_node));
-
- action->set_param("time",time);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-}
-
-void
-Action::KeyframeSetDelta::perform()
-{
- if(!delta)
- return;
- Action::Super::perform();
-
-// Time location(keyframe.get_time());
- Time location(get_canvas()->keyframe_list().find(keyframe)->get_time());
- Time delta(delta);
-
- get_canvas()->keyframe_list().insert_time(location,delta);
-
- std::vector<sinfgapp::ValueDesc>::iterator iter;
- for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
- {
- ValueDesc& value_desc(*iter);
- if(!value_desc.is_value_node())
- continue;
- ValueNode_Animated::Handle animated(
- ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
- );
- if(animated)
- {
- animated->insert_time(location,delta);
- continue;
- }
- ValueNode_DynamicList::Handle dyn_list(
- ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_value_node())
- );
- if(dyn_list)
- {
- dyn_list->insert_time(location,delta);
- continue;
- }
- }
-
- // Signal that something has changed
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_changed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::KeyframeSetDelta::undo()
-{
- if(!delta)
- return;
-
-// Time location(keyframe.get_time());
- Time location(get_canvas()->keyframe_list().find(keyframe)->get_time());
- Time delta(-delta);
-
- get_canvas()->keyframe_list().insert_time(location,delta);
-
- std::vector<sinfgapp::ValueDesc>::iterator iter;
- for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
- {
- ValueDesc& value_desc(*iter);
- if(!value_desc.is_value_node())
- continue;
- ValueNode_Animated::Handle animated(
- ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
- );
- if(animated)
- {
- animated->insert_time(location,delta);
- continue;
- }
- ValueNode_DynamicList::Handle dyn_list(
- ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_value_node())
- );
- if(dyn_list)
- {
- dyn_list->insert_time(location,delta);
- continue;
- }
- }
-
- Action::Super::undo();
-
- // Signal that something has changed
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_keyframe_changed()(keyframe);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeset.h
-** \brief Template File
-**
-** $Id: keyframesetdelta.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMESETDELTA_H
-#define __SINFG_APP_ACTION_KEYFRAMESETDELTA_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-#include <sinfg/time.h>
-#include <sinfg/guid.h>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeSetDelta :
- public Super
-{
-private:
- sinfg::Keyframe keyframe;
- sinfg::Time delta;
-
- std::vector<sinfgapp::ValueDesc> value_desc_list;
-
- void process_value_desc(const sinfgapp::ValueDesc& value_desc);
-
- int scale_activepoints(const sinfgapp::ValueDesc& value_desc,const sinfg::Time& old_begin,const sinfg::Time& old_end,const sinfg::Time& new_begin,const sinfg::Time& new_end);
- int scale_waypoints(const sinfgapp::ValueDesc& value_desc,const sinfg::Time& old_begin,const sinfg::Time& old_end,const sinfg::Time& new_begin,const sinfg::Time& new_end);
-
-public:
-
- KeyframeSetDelta();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframeset.cpp
-** \brief Template File
-**
-** $Id: keyframewaypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "keyframewaypointset.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-#include "activepointsetsmart.h"
-#include "waypointsetsmart.h"
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::KeyframeWaypointSet);
-ACTION_SET_NAME(Action::KeyframeWaypointSet,"keyframe_waypoint_set");
-ACTION_SET_LOCAL_NAME(Action::KeyframeWaypointSet,"Set Waypoints at Keyframe");
-ACTION_SET_TASK(Action::KeyframeWaypointSet,"set");
-ACTION_SET_CATEGORY(Action::KeyframeWaypointSet,Action::CATEGORY_KEYFRAME);
-ACTION_SET_PRIORITY(Action::KeyframeWaypointSet,0);
-ACTION_SET_VERSION(Action::KeyframeWaypointSet,"0.0");
-ACTION_SET_CVS_ID(Action::KeyframeWaypointSet,"$Id: keyframewaypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::KeyframeWaypointSet::KeyframeWaypointSet()
-{
- keyframe.set_time(Time::begin()-1);
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::KeyframeWaypointSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
- .set_local_name(_("Keyframe"))
- );
-
- ret.push_back(ParamDesc("model",Param::TYPE_WAYPOINTMODEL)
- .set_local_name(_("Waypoint Model"))
- );
-
- return ret;
-}
-
-bool
-Action::KeyframeWaypointSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::KeyframeWaypointSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
- {
- keyframe=param.get_keyframe();
-
- return true;
- }
- if(name=="model" && param.get_type()==Param::TYPE_WAYPOINTMODEL)
- {
- waypoint_model=param.get_waypoint_model();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::KeyframeWaypointSet::is_ready()const
-{
- if(keyframe.get_time()==(Time::begin()-1) || waypoint_model.is_trivial())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::KeyframeWaypointSet::prepare()
-{
- clear();
-
- try { get_canvas()->keyframe_list().find(keyframe);}
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find the given keyframe"));
- }
-
- {
- std::vector<sinfgapp::ValueDesc> value_desc_list;
- get_canvas_interface()->find_important_value_descs(value_desc_list);
- while(!value_desc_list.empty())
- {
- process_value_desc(value_desc_list.back());
- value_desc_list.pop_back();
- }
- }
-}
-
-void
-Action::KeyframeWaypointSet::process_value_desc(const sinfgapp::ValueDesc& value_desc)
-{
- if(value_desc.is_value_node())
- {
- ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()));
-
- if(value_node)
- {
- Action::Handle action(WaypointSetSmart::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
-
- Waypoint waypoint;
- try
- {
- waypoint=*value_node->find(keyframe.get_time());
- }
- catch(...)
- {
- waypoint.set_time(keyframe.get_time());
- waypoint.set_value((*value_node)(keyframe.get_time()));
- }
- waypoint.apply_model(waypoint_model);
-
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file keyframewaypointset.h
-** \brief Template File
-**
-** $Id: keyframewaypointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_KEYFRAMEWAYPOINTSET_H
-#define __SINFG_APP_ACTION_KEYFRAMESET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/keyframe.h>
-#include <sinfg/waypoint.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class KeyframeWaypointSet :
- public Super
-{
-private:
-
- sinfg::Keyframe keyframe;
- sinfg::Waypoint::Model waypoint_model;
-
-
- void process_value_desc(const sinfgapp::ValueDesc& value_desc);
-
-public:
-
- KeyframeWaypointSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layeractivate.cpp
-** \brief Template File
-**
-** $Id: layeractivate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layeractivate.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-#define ACTION_INIT2(class) \
- Action::Base* class::create() { return new class(); } \
- sinfg::String class::get_name()const { return name__; }
-
-ACTION_INIT2(Action::LayerActivate);
-ACTION_SET_NAME(Action::LayerActivate,"layer_activate");
-ACTION_SET_LOCAL_NAME(Action::LayerActivate,_("Activate Layer"));
-ACTION_SET_TASK(Action::LayerActivate,"activate");
-ACTION_SET_CATEGORY(Action::LayerActivate,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerActivate,0);
-ACTION_SET_VERSION(Action::LayerActivate,"0.0");
-ACTION_SET_CVS_ID(Action::LayerActivate,"$Id: layeractivate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerActivate::LayerActivate()
-{
-}
-
-sinfg::String
-Action::LayerActivate::get_local_name()const
-{
- if(!layer)
- return _("Activate Layer");
- String name;
- if(layer->get_description().empty())
- name=layer->get_local_name();
- else
- name=layer->get_description();
-
- return (new_status?_("Activate "):_("Deactivate "))+name;
-}
-
-Action::ParamVocab
-Action::LayerActivate::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- );
-
- ret.push_back(ParamDesc("new_status",Param::TYPE_BOOL)
- .set_local_name(_("New Status"))
- .set_desc(_("The new status of the layer"))
- );
-
- return ret;
-}
-
-bool
-Action::LayerActivate::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerActivate::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="new_status" && param.get_type()==Param::TYPE_BOOL)
- {
- new_status=param.get_bool();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerActivate::is_ready()const
-{
- if(!layer)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerActivate::perform()
-{
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- //if(get_canvas()->get_root()!=subcanvas->get_root())
- // throw Error(_("This layer doesn't belong to this composition"));
-
- old_status=layer->active();
-
- // If we are changing the status to what it already is,
- // the go ahead and return
- if(new_status==old_status)
- {
- set_dirty(false);
- return;
- }
- else
- set_dirty();
-
- if(new_status)
- layer->enable();
- else
- layer->disable();
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_status_changed()(layer,new_status);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::LayerActivate::undo()
-{
- // If we are changing the status to what it already is,
- // the go ahead and return
- if(new_status==old_status)
- {
- set_dirty(false);
- return;
- }
- else
- set_dirty();
-
- // restore the old status
- if(old_status)
- layer->enable();
- else
- layer->disable();
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_status_changed()(layer,old_status);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layeractivate.h
-** \brief Template File
-**
-** $Id: layeractivate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERACTIVATE_H
-#define __SINFG_APP_ACTION_LAYERACTIVATE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerActivate :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- bool old_status;
- bool new_status;
-
-public:
-
- LayerActivate();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layeradd.cpp
-** \brief Template File
-**
-** $Id: layeradd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layeradd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerAdd);
-ACTION_SET_NAME(Action::LayerAdd,"layer_add");
-ACTION_SET_LOCAL_NAME(Action::LayerAdd,"Add Layer");
-ACTION_SET_TASK(Action::LayerAdd,"add");
-ACTION_SET_CATEGORY(Action::LayerAdd,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerAdd,0);
-ACTION_SET_VERSION(Action::LayerAdd,"0.0");
-ACTION_SET_CVS_ID(Action::LayerAdd,"$Id: layeradd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerAdd::LayerAdd()
-{
-}
-
-Action::ParamVocab
-Action::LayerAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("new",Param::TYPE_LAYER)
- .set_local_name(_("New Layer"))
- .set_desc(_("Layer to be added"))
- );
-
- return ret;
-}
-
-bool
-Action::LayerAdd::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="new" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerAdd::is_ready()const
-{
- if(!layer)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerAdd::perform()
-{
- // Set the layer's canvas
- layer->set_canvas(get_canvas());
-
- // Push the layer onto the front of the canvas
- get_canvas()->push_front(layer);
-
- // Mark ourselves as dirty if necessary
- //set_dirty(layer->active());
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_inserted()(layer,0);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::LayerAdd::undo()
-{
- // Find the iterator for the layer
- Canvas::iterator iter=find(get_canvas()->begin(),get_canvas()->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- // Remove the layer from the canvas
- get_canvas()->erase(iter);
-
- // Mark ourselves as dirty if necessary
- //set_dirty(layer->active());
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_removed()(layer);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layeradd.h
-** \brief Template File
-**
-** $Id: layeradd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERADD_H
-#define __SINFG_APP_ACTION_LAYERADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
-
-public:
-
- LayerAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerduplicate.cpp
-** \brief Template File
-**
-** $Id: layerduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerduplicate.h"
-#include "layeradd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerDuplicate);
-ACTION_SET_NAME(Action::LayerDuplicate,"layer_duplicate");
-ACTION_SET_LOCAL_NAME(Action::LayerDuplicate,"Duplicate Layer");
-ACTION_SET_TASK(Action::LayerDuplicate,"duplicate");
-ACTION_SET_CATEGORY(Action::LayerDuplicate,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerDuplicate,0);
-ACTION_SET_VERSION(Action::LayerDuplicate,"0.0");
-ACTION_SET_CVS_ID(Action::LayerDuplicate,"$Id: layerduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerDuplicate::LayerDuplicate()
-{
-}
-
-Action::ParamVocab
-Action::LayerDuplicate::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be duplicated"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::LayerDuplicate::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerDuplicate::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layers.push_back(param.get_layer());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerDuplicate::is_ready()const
-{
- if(layers.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerDuplicate::prepare()
-{
- if(!first_time())
- return;
-
- std::list<sinfg::Layer::Handle>::const_iterator iter;
-
- for(iter=layers.begin();iter!=layers.end();++iter)
- {
- Layer::Handle layer(*iter);
-
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- throw Error(_("This layer doesn't belong to this canvas anymore"));
-
- Layer::Handle new_layer(layer->clone(guid));
-
- {
- Action::Handle action(Action::create("layer_move"));
-
- action->set_param("canvas",subcanvas);
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",new_layer);
- action->set_param("new_index",layers.front()->get_depth());
-
- add_action_front(action);
- }
- {
- Action::Handle action(Action::create("layer_add"));
-
- action->set_param("canvas",subcanvas);
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("new",new_layer);
-
- add_action_front(action);
- }
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerduplicate.h
-** \brief Template File
-**
-** $Id: layerduplicate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERDUPLICATE_H
-#define __SINFG_APP_ACTION_LAYERDUPLICATE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-#include <sinfg/guid.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class LayerDuplicate :
- public Super
-{
-private:
-
- sinfg::GUID guid;
- std::list<sinfg::Layer::Handle> layers;
-
-public:
-
- LayerDuplicate();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerraise.cpp
-** \brief Template File
-**
-** $Id: layerencapsulate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerencapsulate.h"
-#include "layeradd.h"
-#include "layerremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerEncapsulate);
-ACTION_SET_NAME(Action::LayerEncapsulate,"layer_encapsulate");
-ACTION_SET_LOCAL_NAME(Action::LayerEncapsulate,"Encapsulate");
-ACTION_SET_TASK(Action::LayerEncapsulate,"encapsulate");
-ACTION_SET_CATEGORY(Action::LayerEncapsulate,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerEncapsulate,0);
-ACTION_SET_VERSION(Action::LayerEncapsulate,"0.0");
-ACTION_SET_CVS_ID(Action::LayerEncapsulate,"$Id: layerencapsulate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerEncapsulate::LayerEncapsulate()
-{
-}
-
-Action::ParamVocab
-Action::LayerEncapsulate::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be encapsulated"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::LayerEncapsulate::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerEncapsulate::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layers.push_back(param.get_layer());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerEncapsulate::is_ready()const
-{
- if(layers.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-int
-Action::LayerEncapsulate::lowest_depth()const
-{
- std::list<sinfg::Layer::Handle>::const_iterator iter;
- int lowest_depth(0x7fffffff);
-
- for(iter=layers.begin();iter!=layers.end();++iter)
- {
- int depth((*iter)->get_depth());
- if(depth<lowest_depth)
- lowest_depth=depth;
- }
- if(lowest_depth==0x7fffffff)
- return 0;
- return lowest_depth;
-}
-
-void
-Action::LayerEncapsulate::prepare()
-{
-
- if(!first_time())
- return;
-
- if(layers.empty())
- throw Error("No layers to encapsulate");
-
- // First create the new canvas and layer
- if(!child_canvas)
- child_canvas=Canvas::create_inline(get_canvas());
-
- Layer::Handle new_layer(Layer::create("PasteCanvas"));
-
- new_layer->set_param("canvas",child_canvas);
-
- int target_depth(lowest_depth());
-
- // Add the layer
- {
- Action::Handle action(LayerAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("new",new_layer);
-
- add_action(action);
- }
-
- // Move the layer
- {
- Action::Handle action(Action::create("layer_move"));
-
- assert(action);
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",new_layer);
- action->set_param("new_index",target_depth);
-
- add_action(action);
- }
-
- std::list<sinfg::Layer::Handle>::reverse_iterator iter;
-
- for(iter=layers.rbegin();iter!=layers.rend();++iter)
- {
- Layer::Handle layer(*iter);
-
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- if(!subcanvas)
- throw Error(_("This layer doesn't have a parent canvas"));
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- throw Error(_("This layer doesn't belong to this canvas anymore"));
-
- if(get_canvas()!=subcanvas)
- throw Error(_("get_canvas()!=subcanvas"));
-
- // Remove the layer from the old canvas
- {
- Action::Handle action(LayerRemove::create());
-
- action->set_param("canvas",subcanvas);
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",layer);
-
- add_action(action);
- }
- // Add the layer to the new canvas
- {
- Action::Handle action(LayerAdd::create());
-
- action->set_param("canvas",child_canvas);
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("new",layer);
-
- add_action(action);
- }
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerencapsulate.h
-** \brief Template File
-**
-** $Id: layerencapsulate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERENCAPSULATE_H
-#define __SINFG_APP_ACTION_LAYERENCAPSULATE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-#include <sinfg/canvas.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class LayerEncapsulate :
- public Super
-{
-private:
- sinfg::Canvas::Handle child_canvas;
- std::list<sinfg::Layer::Handle> layers;
-
- int lowest_depth()const;
-
-public:
-
- LayerEncapsulate();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerlower.cpp
-** \brief Template File
-**
-** $Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerlower.h"
-#include "layermove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerLower);
-ACTION_SET_NAME(Action::LayerLower,"layer_lower");
-ACTION_SET_LOCAL_NAME(Action::LayerLower,"Lower Layer");
-ACTION_SET_TASK(Action::LayerLower,"lower");
-ACTION_SET_CATEGORY(Action::LayerLower,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerLower,10);
-ACTION_SET_VERSION(Action::LayerLower,"0.0");
-ACTION_SET_CVS_ID(Action::LayerLower,"$Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerLower::LayerLower()
-{
-}
-
-Action::ParamVocab
-Action::LayerLower::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be lowered"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::LayerLower::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
-
- Layer::Handle layer(x.find("layer")->second.get_layer());
- //sinfg::info("layer->get_depth()= %d ; layer->get_canvas()->size()=%d ;",layer->get_depth(),layer->get_canvas()->size());
- if(layer->get_depth()+1>=layer->get_canvas()->size())
- return false;
- return true;
-}
-
-bool
-Action::LayerLower::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layers.push_back(param.get_layer());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerLower::is_ready()const
-{
- if(layers.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerLower::prepare()
-{
- std::list<sinfg::Layer::Handle>::const_iterator iter;
-
- clear();
-
- for(iter=layers.begin();iter!=layers.end();++iter)
- {
- Layer::Handle layer(*iter);
-
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- // throw Error(_("This layer doesn't belong to this canvas anymore"));
-
- int new_index=iter-subcanvas->begin();
-
- new_index++;
-
- // If this lowers the layer past the bottom then don't bother
- if(new_index==subcanvas->size())
- continue;
-
- Action::Handle layer_move(LayerMove::create());
-
- layer_move->set_param("canvas",get_canvas());
- layer_move->set_param("canvas_interface",get_canvas_interface());
- layer_move->set_param("layer",layer);
- layer_move->set_param("new_index",new_index);
-
- add_action_front(layer_move);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerlower.h
-** \brief Template File
-**
-** $Id: layerlower.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERLOWER_H
-#define __SINFG_APP_ACTION_LAYERLOWER_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class LayerLower :
- public Super
-{
-private:
-
- std::list<sinfg::Layer::Handle> layers;
-
-public:
-
- LayerLower();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layermove.cpp
-** \brief Template File
-**
-** $Id: layermove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layermove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerMove);
-ACTION_SET_NAME(Action::LayerMove,"layer_move");
-ACTION_SET_LOCAL_NAME(Action::LayerMove,_("Move Layer"));
-ACTION_SET_TASK(Action::LayerMove,"move");
-ACTION_SET_CATEGORY(Action::LayerMove,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerMove,0);
-ACTION_SET_VERSION(Action::LayerMove,"0.0");
-ACTION_SET_CVS_ID(Action::LayerMove,"$Id: layermove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-static const int nindex=-1;
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerMove::LayerMove():
- new_index(0xdeadbeef)
-{
-}
-
-Action::ParamVocab
-Action::LayerMove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be moved"))
- );
-
- ret.push_back(ParamDesc("new_index",Param::TYPE_INTEGER)
- .set_local_name(_("New Index"))
- .set_desc(_("Where the layer is to be moved to"))
- );
-
- ret.push_back(ParamDesc("dest_canvas",Param::TYPE_CANVAS)
- .set_local_name(_("Destination Canvas"))
- .set_desc(_("The canvas the layer is to be moved to"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::LayerMove::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerMove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
-
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="new_index" && param.get_type()==Param::TYPE_INTEGER)
- {
- new_index=param.get_integer();
-
- return true;
- }
-
- if(name=="dest_canvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- dest_canvas=param.get_canvas();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerMove::is_ready()const
-{
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
- if(!layer || (unsigned)new_index==0xdeadbeef)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerMove::perform()
-{
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
-
- Canvas::Handle subcanvas(layer->get_canvas());
- src_canvas=subcanvas;
- if(!dest_canvas)
- dest_canvas=subcanvas;
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(src_canvas->begin(),src_canvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- if(get_canvas()->get_root()!=dest_canvas->get_root() || get_canvas()->get_root()!=src_canvas->get_root())
- throw Error(_("You cannot directly move layers across compositions"));
-
- old_index=iter-src_canvas->begin();
- int depth;
-
- if(new_index<0)
- depth=dest_canvas->size()+new_index+1;
- else
- depth=new_index;
-
- set_dirty(layer->active());
-
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
-
- // If we were to move it to where it is
- if(old_index==depth && src_canvas==dest_canvas)
- return;
-
- if(depth>dest_canvas->size())
- depth=dest_canvas->size();
- if(depth<0)
- depth=0;
-
- src_canvas->erase(iter);
-
- dest_canvas->insert(dest_canvas->begin()+depth,layer);
- layer->set_canvas(dest_canvas);
-
- layer->changed();
- dest_canvas->changed(); if(dest_canvas!=src_canvas) src_canvas->changed();
-
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
-
- if(get_canvas_interface())
- {
- if(src_canvas==dest_canvas)
- {
- if(new_index==old_index-1) // Raise
- get_canvas_interface()->signal_layer_raised()(layer);
- else if(new_index==old_index+1) // Lower
- get_canvas_interface()->signal_layer_lowered()(layer);
- else // Moved
- {
- get_canvas_interface()->signal_layer_moved()(layer,depth,dest_canvas);
- }
- }
- else
- {
- get_canvas_interface()->signal_layer_moved()(layer,depth,dest_canvas);
- }
- }
- else sinfg::warning("CanvasInterface not set on action");
-
- sinfg::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
-}
-
-void
-Action::LayerMove::undo()
-{
- // Find the iterator for the layer
- Canvas::iterator iter=find(dest_canvas->begin(),dest_canvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer || (get_canvas()!=dest_canvas && !dest_canvas->is_inline()))
- throw Error(_("This layer doesn't exist anymore."));
-
- // If we were to move it to where it is
- if(old_index==new_index && src_canvas==dest_canvas)
- return;
-
- // Mark ourselves as dirty if necessary
- set_dirty(layer->active());
-
- dest_canvas->erase(iter);
-
- src_canvas->insert(src_canvas->begin()+old_index,layer);
- layer->set_canvas(src_canvas);
-
- layer->changed();
- dest_canvas->changed(); if(dest_canvas!=src_canvas) src_canvas->changed();
-
- // Execute any signals
- if(get_canvas_interface())
- {
- if(src_canvas==dest_canvas)
- {
- if(new_index==old_index+1) // Raise
- get_canvas_interface()->signal_layer_raised()(layer);
- else if(new_index==old_index-1) // Lower
- get_canvas_interface()->signal_layer_lowered()(layer);
- else // Moved
- {
- get_canvas_interface()->signal_layer_moved()(layer,old_index,src_canvas);
- }
- }
- else
- {
- get_canvas_interface()->signal_layer_moved()(layer,old_index,src_canvas);
- //get_canvas_interface()->signal_layer_removed()(layer);
- //get_canvas_interface()->signal_layer_inserted()(layer,old_index);
- }
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layermove.h
-** \brief Template File
-**
-** $Id: layermove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERMOVE_H
-#define __SINFG_APP_ACTION_LAYERMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerMove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- int old_index;
- int new_index;
-
- sinfg::Canvas::Handle src_canvas;
- sinfg::Canvas::Handle dest_canvas;
-
-public:
-
- LayerMove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamconnect.cpp
-** \brief Template File
-**
-** $Id: layerparamconnect.cpp,v 1.2 2005/01/16 19:55:57 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerParamConnect);
-ACTION_SET_NAME(Action::LayerParamConnect,"layer_param_connect");
-ACTION_SET_LOCAL_NAME(Action::LayerParamConnect,_("Connect Layer Parameter"));
-ACTION_SET_TASK(Action::LayerParamConnect,"connect");
-ACTION_SET_CATEGORY(Action::LayerParamConnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::LayerParamConnect,0);
-ACTION_SET_VERSION(Action::LayerParamConnect,"0.0");
-ACTION_SET_CVS_ID(Action::LayerParamConnect,"$Id: layerparamconnect.cpp,v 1.2 2005/01/16 19:55:57 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerParamConnect::LayerParamConnect()
-{
-}
-
-Action::ParamVocab
-Action::LayerParamConnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- );
-
- ret.push_back(ParamDesc("param",Param::TYPE_STRING)
- .set_local_name(_("Param"))
- );
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode"))
- );
-
- return ret;
-}
-
-bool
-Action::LayerParamConnect::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerParamConnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=param.get_value_node();
-
- return true;
- }
-
- if(name=="param" && param.get_type()==Param::TYPE_STRING)
- {
- param_name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerParamConnect::is_ready()const
-{
- if(!layer)
- sinfg::warning("Action::LayerParamConnect: Missing \"layer\"");
- if(!value_node)
- sinfg::warning("Action::LayerParamConnect: Missing \"value_node\"");
- if(param_name.empty())
- sinfg::warning("Action::LayerParamConnect: Missing \"param\"");
-
- if(!layer || !value_node || param_name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerParamConnect::perform()
-{
- // See if the parameter is dynamic
- if(layer->dynamic_param_list().count(param_name))
- old_value_node=layer->dynamic_param_list().find(param_name)->second;
- else
- {
- old_value_node=0;
- }
-
- old_value=layer->get_param(param_name);
- if(!old_value.is_valid())
- throw Error(_("Layer did not recognise parameter name"));
-
- if(!layer->set_param(param_name,(*value_node)(0)))
- throw Error(_("Bad connection"));
-
- layer->connect_dynamic_param(param_name,value_node);
-
- layer->changed();
- value_node->changed();
-/* if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- //get_canvas_interface()->signal_value_node_changed()(value_node);
- }
-*/
-}
-
-void
-Action::LayerParamConnect::undo()
-{
- if(old_value_node)
- layer->connect_dynamic_param(param_name,old_value_node);
- else
- {
- layer->disconnect_dynamic_param(param_name);
- layer->set_param(param_name,old_value);
- }
-
- layer->changed();
- if(old_value_node)
- old_value_node->changed();
- /*
- if(layer->active())
- set_dirty(true);
- else
- set_dirty(false);
- */
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- //if(old_value_node)get_canvas_interface()->signal_value_node_changed()(old_value_node);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamconnect.h
-** \brief Template File
-**
-** $Id: layerparamconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERPARAMCONNECT_H
-#define __SINFG_APP_ACTION_LAYERPARAMCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerParamConnect :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- sinfg::String param_name;
- sinfg::ValueNode::Handle value_node;
- sinfg::ValueNode::Handle old_value_node;
- sinfg::ValueBase old_value;
-
-
-public:
-
- LayerParamConnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamdisconnect.cpp
-** \brief Template File
-**
-** $Id: layerparamdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamdisconnect.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerParamDisconnect);
-ACTION_SET_NAME(Action::LayerParamDisconnect,"layer_param_disconnect");
-ACTION_SET_LOCAL_NAME(Action::LayerParamDisconnect,_("Disconnect Layer Parameter"));
-ACTION_SET_TASK(Action::LayerParamDisconnect,"disconnect");
-ACTION_SET_CATEGORY(Action::LayerParamDisconnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::LayerParamDisconnect,0);
-ACTION_SET_VERSION(Action::LayerParamDisconnect,"0.0");
-ACTION_SET_CVS_ID(Action::LayerParamDisconnect,"$Id: layerparamdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerParamDisconnect::LayerParamDisconnect():
- time(0)
-{
-
-}
-
-Action::ParamVocab
-Action::LayerParamDisconnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- );
-
- ret.push_back(ParamDesc("param",Param::TYPE_STRING)
- .set_local_name(_("Param"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_STRING)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::LayerParamDisconnect::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerParamDisconnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="param" && param.get_type()==Param::TYPE_STRING)
- {
- param_name=param.get_string();
-
- return true;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerParamDisconnect::is_ready()const
-{
- if(!layer || param_name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerParamDisconnect::perform()
-{
- if(!layer->dynamic_param_list().count(param_name))
- throw Error(_("Layer Parameter is not connected to anything"));
-
- old_value_node=layer->dynamic_param_list().find(param_name)->second;
- layer->disconnect_dynamic_param(param_name);
-
- if(new_value_node || ValueNode_DynamicList::Handle::cast_dynamic(old_value_node))
- {
- if(!new_value_node)
- new_value_node=old_value_node.clone();
- layer->connect_dynamic_param(param_name,new_value_node);
- }
- else
- layer->set_param(param_name,(*old_value_node)(time));
-
- layer->changed();
- old_value_node->changed();
-
- set_dirty(false);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- }
-}
-
-void
-Action::LayerParamDisconnect::undo()
-{
- layer->connect_dynamic_param(param_name,old_value_node);
-
-/* if(layer->active() && get_canvas()->get_time()!=time)
- set_dirty(true);
- else
- set_dirty(false);
-*/
- layer->changed();
- old_value_node->changed();
-
- set_dirty(false);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamdisconnect.h
-** \brief Template File
-**
-** $Id: layerparamdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERPARAMDISCONNECT_H
-#define __SINFG_APP_ACTION_LAYERPARAMDISCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerParamDisconnect :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- sinfg::String param_name;
- sinfg::ValueNode::Handle old_value_node;
- sinfg::ValueNode::Handle new_value_node;
- sinfg::Time time;
-
-public:
-
- LayerParamDisconnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamset.cpp
-** \brief Template File
-**
-** $Id: layerparamset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerParamSet);
-ACTION_SET_NAME(Action::LayerParamSet,"layer_param_set");
-ACTION_SET_LOCAL_NAME(Action::LayerParamSet,_("Set Layer Parameter"));
-ACTION_SET_TASK(Action::LayerParamSet,"set");
-ACTION_SET_CATEGORY(Action::LayerParamSet,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerParamSet,0);
-ACTION_SET_VERSION(Action::LayerParamSet,"0.0");
-ACTION_SET_CVS_ID(Action::LayerParamSet,"$Id: layerparamset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerParamSet::LayerParamSet()
-{
-}
-
-Action::ParamVocab
-Action::LayerParamSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- );
-
- ret.push_back(ParamDesc("param",Param::TYPE_STRING)
- .set_local_name(_("Param"))
- );
-
- ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
- .set_local_name(_("ValueBase"))
- );
-
- return ret;
-}
-
-bool
-Action::LayerParamSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerParamSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
- {
- new_value=param.get_value();
-
- return true;
- }
-
- if(name=="param" && param.get_type()==Param::TYPE_STRING)
- {
- param_name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerParamSet::is_ready()const
-{
- if(!layer || !new_value.is_valid() || param_name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerParamSet::perform()
-{
- // See if the parameter is dynamic
- if(layer->dynamic_param_list().count(param_name))
- throw Error(_("ValueNode attached to Parameter."));
-
- old_value=layer->get_param(param_name);
-
- if(!layer->set_param(param_name,new_value))
- throw Error(_("Layer did not accept parameter."));
-
- /*if(layer->active())
- set_dirty(true);
- else
- set_dirty(false);
- */
- layer->changed();
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- }
-}
-
-void
-Action::LayerParamSet::undo()
-{
- if(!layer->set_param(param_name,old_value))
- throw Error(_("Layer did not accept parameter."));
-
- /*
- if(layer->active())
- set_dirty(true);
- else
- set_dirty(false);
- */
-
- layer->changed();
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerparamset.h
-** \brief Template File
-**
-** $Id: layerparamset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERPARAMSET_H
-#define __SINFG_APP_ACTION_LAYERPARAMSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerParamSet :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- sinfg::String param_name;
- sinfg::ValueBase new_value;
- sinfg::ValueBase old_value;
-
-
-public:
-
- LayerParamSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerraise.cpp
-** \brief Template File
-**
-** $Id: layerraise.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerraise.h"
-#include "layermove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerRaise);
-ACTION_SET_NAME(Action::LayerRaise,"layer_raise");
-ACTION_SET_LOCAL_NAME(Action::LayerRaise,"Raise Layer");
-ACTION_SET_TASK(Action::LayerRaise,"raise");
-ACTION_SET_CATEGORY(Action::LayerRaise,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerRaise,9);
-ACTION_SET_VERSION(Action::LayerRaise,"0.0");
-ACTION_SET_CVS_ID(Action::LayerRaise,"$Id: layerraise.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerRaise::LayerRaise()
-{
-}
-
-Action::ParamVocab
-Action::LayerRaise::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be raised"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::LayerRaise::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
- if(x.find("layer")->second.get_layer()->get_depth()==0)
- return false;
- return true;
-}
-
-bool
-Action::LayerRaise::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layers.push_back(param.get_layer());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerRaise::is_ready()const
-{
- if(layers.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerRaise::prepare()
-{
- std::list<sinfg::Layer::Handle>::reverse_iterator iter;
-
- clear();
-
- for(iter=layers.rbegin();!(iter==layers.rend());++iter)
- {
- Layer::Handle layer(*iter);
-
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter!=layer)
- throw Error(_("This layer doesn't exist anymore."));
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- // throw Error(_("This layer doesn't belong to this canvas anymore"));
-
- int new_index=iter-subcanvas->begin();
-
- if(new_index==0)
- continue;
-
- new_index--;
-
- Action::Handle layer_move(LayerMove::create());
-
- layer_move->set_param("canvas",get_canvas());
- layer_move->set_param("canvas_interface",get_canvas_interface());
- layer_move->set_param("layer",layer);
- layer_move->set_param("new_index",new_index);
-
- add_action_front(layer_move);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layerraise.h
-** \brief Template File
-**
-** $Id: layerraise.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERRAISE_H
-#define __SINFG_APP_ACTION_LAYERRAISE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class LayerRaise :
- public Super
-{
-private:
-
- std::list<sinfg::Layer::Handle> layers;
-
-public:
-
- LayerRaise();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.cpp
-** \brief Template File
-**
-** $Id: layerremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerRemove);
-ACTION_SET_NAME(Action::LayerRemove,"layer_remove");
-ACTION_SET_LOCAL_NAME(Action::LayerRemove,"Remove Layer");
-ACTION_SET_TASK(Action::LayerRemove,"remove");
-ACTION_SET_CATEGORY(Action::LayerRemove,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerRemove,0);
-ACTION_SET_VERSION(Action::LayerRemove,"0.0");
-ACTION_SET_CVS_ID(Action::LayerRemove,"$Id: layerremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerRemove::LayerRemove()
-{
-}
-
-Action::ParamVocab
-Action::LayerRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be deleted"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::LayerRemove::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- std::pair<sinfg::Layer::Handle,int> layer_pair;
- layer_pair.first=param.get_layer();
- layer_list.push_back(layer_pair);
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerRemove::is_ready()const
-{
- if(layer_list.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerRemove::perform()
-{
- std::list<std::pair<sinfg::Layer::Handle,int> >::iterator iter;
- for(iter=layer_list.begin();iter!=layer_list.end();++iter)
- {
- Layer::Handle layer(iter->first);
-// int& depth(iter->second);
- Canvas::Handle subcanvas(layer->get_canvas());
-
- // Find the iterator for the layer
- Canvas::iterator iter2=find(subcanvas->begin(),subcanvas->end(),layer);
-
- // If we couldn't find the layer in the canvas, then bail
- if(*iter2!=layer)
- {
- /*! \fixme We should really undo all prior removals
- ** before we go throwing shit around */
- throw Error(_("This layer doesn't exist anymore."));
- }
-
- // If the subcanvas isn't the same as the canvas,
- // then it had better be an inline canvas. If not,
- // bail
- if(get_canvas()!=subcanvas && !subcanvas->is_inline())
- {
- /*! \fixme We should really undo all prior removals
- ** before we go throwing shit around */
- throw Error(_("This layer doesn't belong to this canvas anymore"));
- }
-
- set_canvas(subcanvas);
-
- // Calculate the depth that the layer was at (For the undo)
- iter->second=layer->get_depth();
-
- // Mark ourselves as dirty if necessary
- set_dirty(layer->active());
-
- // Remove the layer from the canvas
- subcanvas->erase(iter2);
-
- // Signal that a layer has been removed
- if(get_canvas_interface())
- get_canvas_interface()->signal_layer_removed()(layer);
- }
-}
-
-void
-Action::LayerRemove::undo()
-{
- std::list<std::pair<sinfg::Layer::Handle,int> >::reverse_iterator iter;
- for(iter=layer_list.rbegin();iter!=layer_list.rend();++iter)
- {
- Layer::Handle layer(iter->first);
- int& depth(iter->second);
-
- // Set the layer's canvas
- layer->set_canvas(get_canvas());
-
- // Make sure that the depth is valid
- if(get_canvas()->size()<depth)
- depth=get_canvas()->size();
-
- // Mark ourselves as dirty if necessary
- set_dirty(layer->active());
-
- // Insert the layer into the canvas at the desired depth
- get_canvas()->insert(get_canvas()->begin()+depth,layer);
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- get_canvas_interface()->signal_layer_inserted()(layer,depth);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file action_layerremove.h
-** \brief Template File
-**
-** $Id: layerremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERREMOVE_H
-#define __SINFG_APP_ACTION_LAYERREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- std::list<std::pair<sinfg::Layer::Handle,int> > layer_list;
-
- //sinfg::Layer::Handle layer;
- //int depth;
-
-public:
-
- LayerRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layersetdesc.cpp
-** \brief Template File
-**
-** $Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layersetdesc.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::LayerSetDesc);
-ACTION_SET_NAME(Action::LayerSetDesc,"layer_set_desc");
-ACTION_SET_LOCAL_NAME(Action::LayerSetDesc,_("Set Layer Description"));
-ACTION_SET_TASK(Action::LayerSetDesc,"set_desc");
-ACTION_SET_CATEGORY(Action::LayerSetDesc,Action::CATEGORY_LAYER);
-ACTION_SET_PRIORITY(Action::LayerSetDesc,0);
-ACTION_SET_VERSION(Action::LayerSetDesc,"0.0");
-ACTION_SET_CVS_ID(Action::LayerSetDesc,"$Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-static const int nindex=-1;
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::LayerSetDesc::LayerSetDesc()
-{
-}
-
-Action::ParamVocab
-Action::LayerSetDesc::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
- .set_local_name(_("Layer"))
- .set_desc(_("Layer to be moved"))
- );
-
- ret.push_back(ParamDesc("new_description",Param::TYPE_STRING)
- .set_local_name(_("New Description"))
- .set_local_name(_("Enter a new description for this layer"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::LayerSetDesc::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::LayerSetDesc::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
- {
- layer=param.get_layer();
-
- return true;
- }
-
- if(name=="new_description" && param.get_type()==Param::TYPE_STRING)
- {
- new_description=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::LayerSetDesc::is_ready()const
-{
- if(!layer)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::LayerSetDesc::perform()
-{
- old_description=layer->get_description();
- layer->set_description(new_description);
- set_dirty(false);
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_new_description()(layer,new_description);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::LayerSetDesc::undo()
-{
- layer->set_description(old_description);
- set_dirty(false);
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_layer_new_description()(layer,old_description);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file layersetdesc.h
-** \brief Template File
-**
-** $Id: layersetdesc.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_LAYERSETDSEC_H
-#define __SINFG_APP_ACTION_LAYERSETDSEC_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class LayerSetDesc :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Layer::Handle layer;
- sinfg::String old_description;
- sinfg::String new_description;
-
-public:
-
- LayerSetDesc();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointscopy.cpp
-** \brief Copy the Time Points File
-**
-** $Id: timepointscopy.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "timepointscopy.h"
-#include <sinfg/layer_pastecanvas.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-
-#include "activepointsimpleadd.h"
-#include "waypointsimpleadd.h"
-#include <sinfgapp/timegather.h>
-
-#include <typeinfo>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::TimepointsCopy);
-ACTION_SET_NAME(Action::TimepointsCopy,"timepoint_copy");
-ACTION_SET_LOCAL_NAME(Action::TimepointsCopy,"Copy Time Points");
-ACTION_SET_TASK(Action::TimepointsCopy,"copy");
-ACTION_SET_CATEGORY(Action::TimepointsCopy,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::TimepointsCopy,0);
-ACTION_SET_VERSION(Action::TimepointsCopy,"0.0");
-ACTION_SET_CVS_ID(Action::TimepointsCopy,"$Id: timepointscopy.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::TimepointsCopy::TimepointsCopy()
-{
- timedelta = 0;
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::TimepointsCopy::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
- .set_local_name(_("New Selected Layer"))
- .set_desc(_("A layer to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
- .set_local_name(_("New Selected Canvas"))
- .set_desc(_("A canvas to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
- .set_local_name(_("New Selected ValueBase"))
- .set_desc(_("A valuenode's description to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
- .set_local_name(_("New Selected Time Point"))
- .set_desc(_("A time point to add to our selected list"))
- .set_supports_multiple()
- );
-
- ret.push_back(ParamDesc("deltatime",Param::TYPE_TIME)
- .set_local_name(_("Time adjustment"))
- .set_desc(_("The amount of time to adjust all the selected points"))
- );
-
- return ret;
-}
-
-bool
-Action::TimepointsCopy::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
-
- if( x.find("addlayer") == x.end() &&
- x.find("addcanvas") == x.end() &&
- x.find("addvaluedesc") == x.end())
- return false;
- return true;
-}
-
-bool
-Action::TimepointsCopy::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
- {
- //add a layer to the list
- sel_layers.push_back(param.get_layer());
- //sinfg::info("action got layer");
-
- return true;
- }
-
- if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- //add a layer to the list
- sel_canvases.push_back(param.get_canvas());
- //sinfg::info("action got canvas");
-
- return true;
- }
-
- if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- //add a layer to the list
- sel_values.push_back(param.get_value_desc());
- //sinfg::info("action got valuedesc");
-
- return true;
- }
-
- if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
- {
- //add a layer to the list
- sel_times.insert(param.get_time());
- //sinfg::info("action got time");
-
- return true;
- }
-
- if(name=="deltatime" && param.get_type()==Param::TYPE_TIME)
- {
- timedelta = param.get_time();
- //sinfg::info("action got time to move");
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::TimepointsCopy::is_ready()const
-{
- if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::TimepointsCopy::prepare()
-{
- clear();
-
- //sinfg::info("Preparing TimepointsCopy by %f secs",(float)timemove);
-
- if(sel_times.empty()) return;
-
- //all our lists should be set correctly...
-
- //build our sub-action list
- // and yes we do need to store it temporarily so we don't duplicate
- // an operation on a specific valuenode, etc....
- timepoints_ref match;
-
- Time fps = get_canvas()->rend_desc().get_frame_rate();
-
- //std::vector<sinfg::Layer::Handle>
- //sinfg::info("Layers %d", sel_layers.size());
- {
- std::vector<sinfg::Layer::Handle>::iterator i = sel_layers.begin(),
- end = sel_layers.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a layer");
- recurse_layer(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfg::Canvas::Handle> sel_canvases;
- //sinfg::info("Canvases %d", sel_canvases.size());
- {
- std::vector<sinfg::Canvas::Handle>::iterator i = sel_canvases.begin(),
- end = sel_canvases.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a canvas");
- recurse_canvas(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfgapp::ValueDesc>
- //sinfg::info("ValueBasedescs %d", sel_values.size());
- {
- std::vector<sinfgapp::ValueDesc>::iterator i = sel_values.begin(),
- end = sel_values.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a valuedesc");
- recurse_valuedesc(*i,sel_times,match);
- }
- }
-
- //sinfg::info("built list of waypoints/activepoints to modify");
- //sinfg::info("\t There are %d waypoint sets and %d activepointsets",
- // match.waypointbiglist.size(), match.actpointbiglist.size());
- //process the hell out of em...
- {
- //must build from both lists
- timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
- end = match.waypointbiglist.end();
- for(; i != end; ++i)
- {
- //iterate through each waypoint for this specific valuenode
- std::set<sinfg::Waypoint>::const_iterator j = i->waypoints.begin(),
- end = i->waypoints.end();
- for(; j != end; ++j)
- {
- Action::Handle action(WaypointSimpleAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(i->val));
-
- //sinfg::info("add waypoint mod...");
- //NOTE: We may want to store the old time for undoing the action...
- Waypoint neww;
- Waypoint w = *j;
- w.set_time((w.get_time() + timedelta).round(fps));
- w.mimic(neww); //make sure the new waypoint has a new id
-
- action->set_param("waypoint",w);
-
- //run the action now that we've added everything
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- }
- {
- //must build from both lists
- timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
- end = match.actpointbiglist.end();
- for(; i != end; ++i)
- {
- //iterate through each activepoint for this specific valuenode
- std::set<sinfg::Activepoint>::const_iterator j = i->activepoints.begin(),
- jend = i->activepoints.end();
- for(; j != jend; ++j)
- {
- Action::Handle action(ActivepointSimpleAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",i->val);
-
- //NOTE: We may want to store the old time for undoing the action...
- Activepoint newa;
- Activepoint a = *j;
- a.set_time((a.get_time() + timedelta).round(fps));
- a.mimic(newa); //make sure the new activepoint has a new id
-
- action->set_param("activepoint",a);
-
- assert(action->is_ready());
- if(!action->is_ready())
- {
- throw Error(Error::TYPE_NOTREADY);
- }
-
- add_action_front(action);
- }
- }
- }
-}
-
-void
-Action::TimepointsCopy::perform()
-{
- Action::Super::perform();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointscopy.h
-** \brief Copy the Time Points Header
-**
-** $Id: timepointscopy.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_TIMEPOINTSCOPY_H
-#define __SINFG_APP_ACTION_TIMEPOINTSCOPY_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/time.h>
-#include <sinfg/layer.h>
-#include <sinfg/canvas.h>
-#include <sinfgapp/value_desc.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class TimepointsCopy :
- public Super
-{
-private:
-
- //process all the value descriptions that are selected (or are in subselections)
- std::vector<sinfg::Layer::Handle> sel_layers;
- std::vector<sinfg::Canvas::Handle> sel_canvases;
- std::vector<sinfgapp::ValueDesc> sel_values;
- std::set<sinfg::Time> sel_times;
-
- sinfg::Time timedelta;
-
-public:
-
- TimepointsCopy();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointsdelete.cpp
-** \brief Delete the Time Points File
-**
-** $Id: timepointsdelete.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "timepointsdelete.h"
-#include <sinfg/layer_pastecanvas.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-
-#include "activepointremove.h"
-#include "waypointremove.h"
-#include <sinfgapp/timegather.h>
-
-#include <typeinfo>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::TimepointsDelete);
-ACTION_SET_NAME(Action::TimepointsDelete,"timepoint_delete");
-ACTION_SET_LOCAL_NAME(Action::TimepointsDelete,"Delete Time Points");
-ACTION_SET_TASK(Action::TimepointsDelete,"delete");
-ACTION_SET_CATEGORY(Action::TimepointsDelete,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::TimepointsDelete,0);
-ACTION_SET_VERSION(Action::TimepointsDelete,"0.0");
-ACTION_SET_CVS_ID(Action::TimepointsDelete,"$Id: timepointsdelete.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::TimepointsDelete::TimepointsDelete()
-{
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::TimepointsDelete::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
- .set_local_name(_("New Selected Layer"))
- .set_desc(_("A layer to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
- .set_local_name(_("New Selected Canvas"))
- .set_desc(_("A canvas to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
- .set_local_name(_("New Selected ValueBase"))
- .set_desc(_("A valuenode's description to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
- .set_local_name(_("New Selected Time Point"))
- .set_desc(_("A time point to add to our selected list"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::TimepointsDelete::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
-
- if( x.find("addlayer") == x.end() &&
- x.find("addcanvas") == x.end() &&
- x.find("addvaluedesc") == x.end())
- return false;
- return true;
-}
-
-bool
-Action::TimepointsDelete::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
- {
- //add a layer to the list
- sel_layers.push_back(param.get_layer());
-
- return true;
- }
-
- if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- //add a layer to the list
- sel_canvases.push_back(param.get_canvas());
-
- return true;
- }
-
- if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- //add a layer to the list
- sel_values.push_back(param.get_value_desc());
-
- return true;
- }
-
- if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
- {
- //add a layer to the list
- sel_times.insert(param.get_time());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::TimepointsDelete::is_ready()const
-{
- if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::TimepointsDelete::prepare()
-{
- clear();
-
- if(sel_times.empty()) return;
-
- //all our lists should be set correctly...
-
- //build our sub-action list
- // and yes we do need to store it temporarily so we don't duplicate
- // an operation on a specific valuenode, etc....
- timepoints_ref match;
-
- Time fps = get_canvas()->rend_desc().get_frame_rate();
-
- //std::vector<sinfg::Layer::Handle>
- //sinfg::info("Layers %d", sel_layers.size());
- {
- std::vector<sinfg::Layer::Handle>::iterator i = sel_layers.begin(),
- end = sel_layers.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a layer");
- recurse_layer(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfg::Canvas::Handle> sel_canvases;
- //sinfg::info("Canvases %d", sel_canvases.size());
- {
- std::vector<sinfg::Canvas::Handle>::iterator i = sel_canvases.begin(),
- end = sel_canvases.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a canvas");
- recurse_canvas(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfgapp::ValueDesc>
- //sinfg::info("ValueBasedescs %d", sel_values.size());
- {
- std::vector<sinfgapp::ValueDesc>::iterator i = sel_values.begin(),
- end = sel_values.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a valuedesc");
- recurse_valuedesc(*i,sel_times,match);
- }
- }
-
- //process the hell out of em...
- {
- //must build from both lists
- timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
- end = match.waypointbiglist.end();
- for(; i != end; ++i)
- {
- //iterate through each waypoint for this specific valuenode
- std::set<sinfg::Waypoint>::const_iterator j = i->waypoints.begin(),
- end = i->waypoints.end();
- for(; j != end; ++j)
- {
- Action::Handle action(WaypointRemove::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(i->val));
- action->set_param("waypoint",*j);
-
- //run the action now that we've added everything
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- }
- {
- //must build from both lists
- timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
- end = match.actpointbiglist.end();
- for(; i != end; ++i)
- {
- //iterate through each activepoint for this specific valuenode
- std::set<sinfg::Activepoint>::const_iterator j = i->activepoints.begin(),
- jend = i->activepoints.end();
- for(; j != jend; ++j)
- {
- Action::Handle action(ActivepointRemove::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",i->val);
- action->set_param("activepoint",*j);
-
- //run the action now that everything should be in order
- assert(action->is_ready());
- if(!action->is_ready())
- {
- throw Error(Error::TYPE_NOTREADY);
- }
-
- add_action_front(action);
- }
- }
- }
-}
-
-void
-Action::TimepointsDelete::perform()
-{
- Action::Super::perform();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointsdelete.h
-** \brief Delete the Time Points Header
-**
-** $Id: timepointsdelete.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_TIMEPOINTSDELETE_H
-#define __SINFG_APP_ACTION_TIMEPOINTSDELETE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/time.h>
-#include <sinfg/layer.h>
-#include <sinfg/canvas.h>
-#include <sinfgapp/value_desc.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class TimepointsDelete :
- public Super
-{
-private:
-
- //process all the value descriptions that are selected (or are in subselections)
- std::vector<sinfg::Layer::Handle> sel_layers;
- std::vector<sinfg::Canvas::Handle> sel_canvases;
- std::vector<sinfgapp::ValueDesc> sel_values;
- std::set<sinfg::Time> sel_times;
-
-public:
-
- TimepointsDelete();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointsmove.cpp
-** \brief Move the Time Points File
-**
-** $Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "timepointsmove.h"
-#include <sinfg/layer_pastecanvas.h>
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_animated.h>
-
-#include "activepointset.h"
-#include "waypointset.h"
-#include <sinfgapp/timegather.h>
-
-#include <typeinfo>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::TimepointsMove);
-ACTION_SET_NAME(Action::TimepointsMove,"timepoint_move");
-ACTION_SET_LOCAL_NAME(Action::TimepointsMove,"Move Time Points");
-ACTION_SET_TASK(Action::TimepointsMove,"move");
-ACTION_SET_CATEGORY(Action::TimepointsMove,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
-ACTION_SET_PRIORITY(Action::TimepointsMove,0);
-ACTION_SET_VERSION(Action::TimepointsMove,"0.0");
-ACTION_SET_CVS_ID(Action::TimepointsMove,"$Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::TimepointsMove::TimepointsMove()
-{
- timemove = 0;
- set_dirty(false);
-}
-
-Action::ParamVocab
-Action::TimepointsMove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
- .set_local_name(_("New Selected Layer"))
- .set_desc(_("A layer to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
- .set_local_name(_("New Selected Canvas"))
- .set_desc(_("A canvas to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
- .set_local_name(_("New Selected ValueBase"))
- .set_desc(_("A valuenode's description to add to our selected list"))
- .set_supports_multiple()
- .set_optional()
- );
-
- ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
- .set_local_name(_("New Selected Time Point"))
- .set_desc(_("A time point to add to our selected list"))
- .set_supports_multiple()
- );
-
- ret.push_back(ParamDesc("deltatime",Param::TYPE_TIME)
- .set_local_name(_("Time adjustment"))
- .set_desc(_("The amount of time to adjust all the selected points"))
- );
-
- return ret;
-}
-
-bool
-Action::TimepointsMove::is_canidate(const ParamList &x)
-{
- if(!canidate_check(get_param_vocab(),x))
- return false;
-
- if( x.find("addlayer") == x.end() &&
- x.find("addcanvas") == x.end() &&
- x.find("addvaluedesc") == x.end())
- return false;
- return true;
-}
-
-bool
-Action::TimepointsMove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
- {
- //add a layer to the list
- sel_layers.push_back(param.get_layer());
- //sinfg::info("action got layer");
-
- return true;
- }
-
- if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- //add a layer to the list
- sel_canvases.push_back(param.get_canvas());
- //sinfg::info("action got canvas");
-
- return true;
- }
-
- if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- //add a layer to the list
- sel_values.push_back(param.get_value_desc());
- //sinfg::info("action got valuedesc");
-
- return true;
- }
-
- if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
- {
- //add a layer to the list
- sel_times.insert(param.get_time());
- //sinfg::info("action got time");
-
- return true;
- }
-
- if(name=="deltatime" && param.get_type()==Param::TYPE_TIME)
- {
- timemove = param.get_time();
- //sinfg::info("action got time to move");
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::TimepointsMove::is_ready()const
-{
- if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::TimepointsMove::prepare()
-{
- clear();
-
- //sinfg::info("Preparing TimepointsMove by %f secs",(float)timemove);
-
- if(sel_times.empty()) return;
-
- //all our lists should be set correctly...
-
- /*{
- std::set<sinfg::Time>::iterator i = sel_times.begin(), end = sel_times.end();
-
- for(; i != end; ++i)
- {
- sinfg::info("Time %f", (float)*i);
- }
- }*/
-
- //build our sub-action list
- // and yes we do need to store it temporarily so we don't duplicate
- // an operation on a specific valuenode, etc....
- timepoints_ref match;
-
- Time fps = get_canvas()->rend_desc().get_frame_rate();
-
- //std::vector<sinfg::Layer::Handle>
- //sinfg::info("Layers %d", sel_layers.size());
- {
- std::vector<sinfg::Layer::Handle>::iterator i = sel_layers.begin(),
- end = sel_layers.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a layer");
- recurse_layer(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfg::Canvas::Handle> sel_canvases;
- //sinfg::info("Canvases %d", sel_canvases.size());
- {
- std::vector<sinfg::Canvas::Handle>::iterator i = sel_canvases.begin(),
- end = sel_canvases.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a canvas");
- recurse_canvas(*i,sel_times,match);
- }
- }
-
- //std::vector<sinfgapp::ValueDesc>
- //sinfg::info("ValueBasedescs %d", sel_values.size());
- {
- std::vector<sinfgapp::ValueDesc>::iterator i = sel_values.begin(),
- end = sel_values.end();
-
- for(; i != end; ++i)
- {
- //sinfg::info("Recurse through a valuedesc");
- recurse_valuedesc(*i,sel_times,match);
- }
- }
-
- //sinfg::info("built list of waypoints/activepoints to modify");
- //sinfg::info("\t There are %d waypoint sets and %d activepointsets",
- // match.waypointbiglist.size(), match.actpointbiglist.size());
- //process the hell out of em...
- {
- //must build from both lists
- timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
- end = match.waypointbiglist.end();
- for(; i != end; ++i)
- {
- Action::Handle action(WaypointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(i->val));
-
- //iterate through each waypoint for this specific valuenode
- std::set<sinfg::Waypoint>::const_iterator j = i->waypoints.begin(),
- end = i->waypoints.end();
- for(; j != end; ++j)
- {
- //sinfg::info("add waypoint mod...");
- //NOTE: We may want to store the old time for undoing the action...
- Waypoint w = *j;
- w.set_time((w.get_time() + timemove).round(fps));
- action->set_param("waypoint",w);
- }
-
- //run the action now that we've added everything
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- }
- {
- //must build from both lists
- timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
- end = match.actpointbiglist.end();
- for(; i != end; ++i)
- {
- Action::Handle action(ActivepointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",i->val);
-
- //iterate through each activepoint for this specific valuenode
- std::set<sinfg::Activepoint>::const_iterator j = i->activepoints.begin(),
- jend = i->activepoints.end();
- for(; j != jend; ++j)
- {
- //sinfg::info("add activepoint mod...");
-
- //NOTE: We may want to store the old time for undoing the action...
- Activepoint a = *j;
- a.set_time((a.get_time() + timemove).round(fps));
- action->set_param("activepoint",a);
- }
-
- assert(action->is_ready());
- if(!action->is_ready())
- {
- throw Error(Error::TYPE_NOTREADY);
- }
-
- add_action_front(action);
- }
- }
-}
-
-void
-Action::TimepointsMove::perform()
-{
- Action::Super::perform();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timepointsmove.h
-** \brief Move the Time Points Header
-**
-** $Id: timepointsmove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_TIMEPOINTSMOVE_H
-#define __SINFG_APP_ACTION_TIMEPOINTSMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/time.h>
-#include <sinfg/layer.h>
-#include <sinfg/canvas.h>
-#include <sinfgapp/value_desc.h>
-
-#include <vector>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class TimepointsMove :
- public Super
-{
-private:
-
- //process all the value descriptions that are selected (or are in subselections)
- std::vector<sinfg::Layer::Handle> sel_layers;
- std::vector<sinfg::Canvas::Handle> sel_canvases;
- std::vector<sinfgapp::ValueDesc> sel_values;
- std::set<sinfg::Time> sel_times;
-
- sinfg::Time timemove;
-
-public:
-
- TimepointsMove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
- virtual void perform();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescconnect.cpp
-** \brief Template File
-**
-** $Id: valuedescconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamconnect.h"
-#include "valuenodelinkconnect.h"
-#include "valuenodereplace.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueDescConnect);
-ACTION_SET_NAME(Action::ValueDescConnect,"value_desc_connect");
-ACTION_SET_LOCAL_NAME(Action::ValueDescConnect,"Connect");
-ACTION_SET_TASK(Action::ValueDescConnect,"connect");
-ACTION_SET_CATEGORY(Action::ValueDescConnect,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueDescConnect,0);
-ACTION_SET_VERSION(Action::ValueDescConnect,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescConnect,"$Id: valuedescconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescConnect::ValueDescConnect()
-{
-}
-
-Action::ParamVocab
-Action::ValueDescConnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("dest",Param::TYPE_VALUEDESC)
- .set_local_name(_("Destination ValueDesc"))
- );
-
- ret.push_back(ParamDesc("src",Param::TYPE_VALUENODE)
- .set_local_name(_("Source ValueNode"))
- .set_mutual_exclusion("src_name")
- );
-
- ret.push_back(ParamDesc("src_name",Param::TYPE_STRING)
- .set_local_name(_("Source ValueNode Name"))
- .set_mutual_exclusion("src")
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescConnect::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- if(x.count("src"))
- {
- ValueDesc value_desc=x.find("dest")->second.get_value_desc();
- ValueNode::Handle value_node=x.find("src")->second.get_value_node();
- if(value_desc.get_value_type()==value_node->get_type())
- return true;
- }
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueDescConnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="dest" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- return true;
- }
-
- if(name=="src" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=param.get_value_node();
-
- return true;
- }
-
- if(!value_node_name.empty() && !value_node && name=="canvas" && param.get_type()==Param::TYPE_CANVAS)
- {
- value_node=param.get_canvas()->find_value_node(value_node_name);
- }
-
- if(name=="src_name" && param.get_type()==Param::TYPE_STRING)
- {
- value_node_name=param.get_string();
-
- if(get_canvas())
- {
- value_node=get_canvas()->find_value_node(value_node_name);
- if(!value_node)
- return false;
- }
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueDescConnect::is_ready()const
-{
- if(!value_desc || !value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescConnect::prepare()
-{
- clear();
-
- if(value_desc.parent_is_canvas())
- {
- ValueNode::Handle dest_value_node;
- dest_value_node=value_desc.get_value_node();
-
- Action::Handle action(ValueNodeReplace::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",value_node);
- action->set_param("dest",value_desc.get_value_node());
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_linkable_value_node())
- {
- Action::Handle action(ValueNodeLinkConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("parent_value_node",value_desc.get_parent_value_node());
- action->set_param("value_node", value_node);
- action->set_param("index",value_desc.get_index());
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_layer_param())
- {
- Action::Handle action(LayerParamConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",value_desc.get_layer());
- action->set_param("param",value_desc.get_param_name());
- action->set_param("value_node",value_node);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
-
- throw Error(_("ValueDesc is not recognised or supported."));
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescconnect.h
-** \brief Template File
-**
-** $Id: valuedescconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCCONNECT_H
-#define __SINFG_APP_ACTION_VALUEDESCCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescConnect :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::ValueNode::Handle value_node;
- sinfg::String value_node_name;
-
-public:
-
- ValueDescConnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescconvert.cpp
-** \brief Template File
-**
-** $Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
-#include "valuenodereplace.h"
-#include "layerparamconnect.h"
-#include "valuenodelinkconnect.h"
-*/
-
-#include "valuedescconnect.h"
-
-#include "valuedescconvert.h"
-
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_const.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueDescConvert);
-ACTION_SET_NAME(Action::ValueDescConvert,"value_desc_convert");
-ACTION_SET_LOCAL_NAME(Action::ValueDescConvert,"Convert");
-ACTION_SET_TASK(Action::ValueDescConvert,"convert");
-ACTION_SET_CATEGORY(Action::ValueDescConvert,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ValueDescConvert,0);
-ACTION_SET_VERSION(Action::ValueDescConvert,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescConvert::ValueDescConvert()
-{
-}
-
-Action::ParamVocab
-Action::ValueDescConvert::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("type",Param::TYPE_STRING)
- .set_local_name(_("Type"))
- .set_desc(_("The type of ValueNode that you want to be converted to"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescConvert::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueDescConvert::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- return true;
- }
-
- if(name=="type" && param.get_type()==Param::TYPE_STRING)
- {
- type=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueDescConvert::is_ready()const
-{
- if(!value_desc || type.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescConvert::prepare()
-{
- clear();
-
- ValueBase value;
-
- if(value_desc.is_const())
- value=value_desc.get_value();
- else if(value_desc.is_value_node())
- value=(*value_desc.get_value_node())(0);
- else
- throw Error(_("Unable to decipher ValueDesc (Bug?)"));
-
- ValueNode::Handle src_value_node(LinkableValueNode::create(type,value));
-
- if(!src_value_node)
- throw Error(_("Unable to create new value node"));
-
-
- ValueNode::Handle dest_value_node;
- dest_value_node=value_desc.get_value_node();
-
- Action::Handle action(ValueDescConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",src_value_node);
- action->set_param("dest",value_desc);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
-/*
- return;
-
-
- if(value_desc.parent_is_canvas())
- {
- ValueNode::Handle dest_value_node;
- dest_value_node=value_desc.get_value_node();
-
- Action::Handle action(ValueNodeReplace::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",src_value_node);
- action->set_param("dest",dest_value_node);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_linkable_value_node())
- {
- Action::Handle action(ValueNodeLinkConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("parent_value_node",value_desc.get_parent_value_node());
- action->set_param("value_node", src_value_node);
- action->set_param("index",value_desc.get_index());
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_layer_param())
- {
- Action::Handle action(LayerParamConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",value_desc.get_layer());
- action->set_param("param",value_desc.get_param_name());
- action->set_param("value_node",src_value_node);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
-
-
-
- throw Error(_("ValueDesc is not recognised or supported."));
-*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescconvert.h
-** \brief Template File
-**
-** $Id: valuedescconvert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCCONVERT_H
-#define __SINFG_APP_ACTION_VALUEDESCCONVERT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescConvert :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::String type;
-
-public:
-
- ValueDescConvert();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescdisconnect.cpp
-** \brief Template File
-**
-** $Id: valuedescdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamdisconnect.h"
-#include "valuenodelinkdisconnect.h"
-#include "valuenodereplace.h"
-
-#include "valuedescdisconnect.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_const.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueDescDisconnect);
-ACTION_SET_NAME(Action::ValueDescDisconnect,"value_desc_disconnect");
-ACTION_SET_LOCAL_NAME(Action::ValueDescDisconnect,"Disconnect");
-ACTION_SET_TASK(Action::ValueDescDisconnect,"disconnect");
-ACTION_SET_CATEGORY(Action::ValueDescDisconnect,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ValueDescDisconnect,-100);
-ACTION_SET_VERSION(Action::ValueDescDisconnect,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescDisconnect,"$Id: valuedescdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescDisconnect::ValueDescDisconnect():
- time(0)
-{
-}
-
-Action::ParamVocab
-Action::ValueDescDisconnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescDisconnect::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_canvas() && value_desc.is_value_node() && value_desc.get_value_node()->rcount()>1)
- return true;
- if(value_desc.is_const())
- return false;
- if(value_desc.is_value_node() && ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueDescDisconnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- return true;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueDescDisconnect::is_ready()const
-{
- if(!value_desc)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescDisconnect::prepare()
-{
- clear();
-
- if(value_desc.parent_is_canvas())
- {
- ValueNode::Handle src_value_node;
- src_value_node=ValueNode_Const::create((*value_desc.get_value_node())(time));
-
- Action::Handle action(ValueNodeReplace::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",src_value_node);
- action->set_param("dest",value_desc.get_value_node());
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_linkable_value_node())
- {
- Action::Handle action(ValueNodeLinkDisconnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("parent_value_node",value_desc.get_parent_value_node());
- action->set_param("index",value_desc.get_index());
- action->set_param("time",time);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(value_desc.parent_is_layer_param())
- {
- Action::Handle action(LayerParamDisconnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",value_desc.get_layer());
- action->set_param("param",value_desc.get_param_name());
- action->set_param("time",time);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
-
- throw Error(_("ValueDesc is not recognised or supported."));
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescdisconnect.h
-** \brief Template File
-**
-** $Id: valuedescdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCDISCONNECT_H
-#define __SINFG_APP_ACTION_VALUEDESCDISCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescDisconnect :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::Time time;
-
-public:
-
- ValueDescDisconnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescset.cpp
-** \brief Template File
-**
-** $Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodeadd.h"
-
-#include "canvasadd.h"
-#include "valuedescexport.h"
-#include "layerparamconnect.h"
-
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_const.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueDescExport);
-ACTION_SET_NAME(Action::ValueDescExport,"value_desc_export");
-ACTION_SET_LOCAL_NAME(Action::ValueDescExport,"Export");
-ACTION_SET_TASK(Action::ValueDescExport,"export");
-ACTION_SET_CATEGORY(Action::ValueDescExport,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ValueDescExport,0);
-ACTION_SET_VERSION(Action::ValueDescExport,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescExport,"$Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescExport::ValueDescExport()
-{
-}
-
-Action::ParamVocab
-Action::ValueDescExport::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("name",Param::TYPE_STRING)
- .set_local_name(_("Name"))
- .set_desc(_("The name that you want this value to be exported as"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescExport::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc=x.find("value_desc")->second.get_value_desc();
- if(!value_desc || value_desc.parent_is_canvas() || (value_desc.is_value_node() && value_desc.get_value_node()->is_exported()))
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueDescExport::set_param(const sinfg::String& param_name, const Action::Param ¶m)
-{
- if(param_name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- return true;
- }
-
- if(param_name=="name" && param.get_type()==Param::TYPE_STRING)
- {
- name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(param_name,param);
-}
-
-bool
-Action::ValueDescExport::is_ready()const
-{
- if(!value_desc || name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescExport::prepare()
-{
- clear();
-
- ValueNode::Handle value_node;
-
- if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
- {
- if(!value_desc.is_const())
- throw Error(_("Can only export Canvas when used as constant parameter"));
- Canvas::Handle canvas(value_desc.get_value().get(Canvas::Handle()));
-
- Action::Handle action(CanvasAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",canvas);
- action->set_param("id",name);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-
- return;
- }
-
-
- if(value_desc.is_value_node())
- {
- if(value_desc.get_value_node()->is_exported())
- throw Error(_("ValueBase is already exported"));
-
- value_node=value_desc.get_value_node();
- }
- else
- {
- if(!value_desc.parent_is_layer_param())
- throw Error(_("Unable to export parameter. (Bug?)"));
-
- value_node=ValueNode_Const::create(value_desc.get_value());
-
- Action::Handle action(LayerParamConnect::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("layer",value_desc.get_layer());
- action->set_param("param",value_desc.get_param_name());
- action->set_param("value_node",value_node);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
-
- Action::Handle action(ValueNodeAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("new",value_node);
- action->set_param("name",name);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescexport.h
-** \brief Template File
-**
-** $Id: valuedescexport.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCEXPORT_H
-#define __SINFG_APP_ACTION_VALUEDESCEXPORT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescExport :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::String name;
-
-public:
-
- ValueDescExport();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedesclink.cpp
-** \brief Template File
-**
-** $Id: valuedesclink.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuedesclink.h"
-
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_const.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueDescLink);
-ACTION_SET_NAME(Action::ValueDescLink,"value_desc_link");
-ACTION_SET_LOCAL_NAME(Action::ValueDescLink,"Link");
-ACTION_SET_TASK(Action::ValueDescLink,"connect");
-ACTION_SET_CATEGORY(Action::ValueDescLink,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ValueDescLink,0);
-ACTION_SET_VERSION(Action::ValueDescLink,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescLink,"$Id: valuedesclink.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescLink::ValueDescLink()
-{
- poison=false;
-}
-
-Action::ParamVocab
-Action::ValueDescLink::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc to link"))
- .set_requires_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescLink::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueDescLink::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
- return true;
- }
-
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(value_desc.is_value_node() && value_desc.get_value_node()->is_exported())
- {
- if(link_value_node==value_desc.get_value_node())
- return true;
-
- if(link_value_node && link_value_node->is_exported())
- {
- poison=true;
- return false;
- }
-
- link_value_node=value_desc.get_value_node();
- }
- else if(value_desc.is_value_node())
- {
- if(!link_value_node)
- {
- link_value_node=value_desc.get_value_node();
- }
-
- // Use the one that is referenced more
- else if(link_value_node->rcount()<value_desc.get_value_node()->rcount())
- {
- link_value_node=value_desc.get_value_node();
- }
-
- // If the current link value node is a constant and
- // this one isn't, then give preference to the exotic
- else if(ValueNode_Const::Handle::cast_dynamic(link_value_node) && !ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- link_value_node=value_desc.get_value_node();
- }
-
- // If both are animated, and this one has more waypoints,
- // then use the one with more waypoints
- else if(
- ValueNode_Animated::Handle::cast_dynamic(link_value_node)
- && ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
- && (
- ValueNode_Animated::Handle::cast_dynamic(link_value_node)->waypoint_list().size()
- < ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())->waypoint_list().size()
- )
- )
- {
- link_value_node=value_desc.get_value_node();
- }
-
- /*
- // Use the one that was most recently changed
- else if(link_value_node->get_time_last_changed()<value_desc.get_value_node()->get_time_last_changed())
- {
- link_value_node=value_desc.get_value_node();
- }
- */
- }
-
-
- if(value_desc_list.size() && value_desc.get_value_type()!=value_desc_list.front().get_value_type())
- {
- // Everything must be of the same type
- poison=true;
- return false;
- }
- value_desc_list.push_back(value_desc);
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueDescLink::is_ready()const
-{
- if(poison || value_desc_list.size()<=1)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescLink::prepare()
-{
- if(poison || value_desc_list.empty())
- throw Error(Error::TYPE_NOTREADY);
-
- clear();
-
- if(!link_value_node)
- {
- ValueDesc& value_desc(value_desc_list.front());
-
- link_value_node=ValueNode_Const::create(value_desc.get_value(time));
-
- Action::Handle action(Action::create("value_desc_connect"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",link_value_node);
- action->set_param("dest",value_desc);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
-
- /*
- if(!link_value_node->is_exported())
- {
- Action::Handle action(Action::create("value_node_add"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("new",link_value_node);
- action->set_param("name",strprintf(_("Unnamed%08d"),sinfg::UniqueID().get_uid()));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
- */
-
- std::list<ValueDesc>::iterator iter;
- for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
- {
- ValueDesc& value_desc(*iter);
-
- if(value_desc.is_value_node() && value_desc.get_value_node()==link_value_node)
- continue;
-
- Action::Handle action(Action::create("value_desc_connect"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("src",link_value_node);
- action->set_param("dest",value_desc);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedesclink.h
-** \brief Template File
-**
-** $Id: valuedesclink.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCLINK_H
-#define __SINFG_APP_ACTION_VALUEDESCLINK_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescLink :
- public Super
-{
-private:
-
- std::list<ValueDesc> value_desc_list;
- sinfg::ValueNode::Handle link_value_node;
- bool poison;
- sinfg::Time time;
-public:
-
- ValueDescLink();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescset.cpp
-** \brief Template File
-**
-** $Id: valuedescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "layerparamset.h"
-#include "valuenodeconstset.h"
-#include "valuedescconnect.h"
-#include "waypointsetsmart.h"
-
-#include "valuedescset.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_composite.h>
-#include <sinfg/valuenode_radialcomposite.h>
-#include <sinfg/valuenode_reference.h>
-#include <sinfgapp/main.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-#define ACTION_INIT2(class) \
- Action::Base* class::create() { return new class(); } \
- sinfg::String class::get_name()const { return name__; }
-
-ACTION_INIT2(Action::ValueDescSet);
-ACTION_SET_NAME(Action::ValueDescSet,"value_desc_set");
-ACTION_SET_LOCAL_NAME(Action::ValueDescSet,"Set ValueDesc");
-ACTION_SET_TASK(Action::ValueDescSet,"set");
-ACTION_SET_CATEGORY(Action::ValueDescSet,Action::CATEGORY_VALUEDESC);
-ACTION_SET_PRIORITY(Action::ValueDescSet,0);
-ACTION_SET_VERSION(Action::ValueDescSet,"0.0");
-ACTION_SET_CVS_ID(Action::ValueDescSet,"$Id: valuedescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueDescSet::ValueDescSet():
- time(0)
-{
-}
-
-sinfg::String
-Action::ValueDescSet::get_local_name()const
-{
- String name("ValueDesc");
-
- if(!value_desc)
- {
- }
- else if(value_desc.parent_is_layer_param())
- {
- if(value_desc.get_layer()->get_description().empty())
- name=value_desc.get_layer()->get_local_name();
- else
- name=value_desc.get_layer()->get_description();
- name+="->"+value_desc.get_param_name();
- }
- else if(value_desc.parent_is_value_node())
- {
- sinfg::LinkableValueNode::Handle value_node(sinfg::LinkableValueNode::Handle::cast_reinterpret(value_desc.get_parent_value_node()));
- name=value_node->link_local_name(value_desc.get_index());
-
- sinfg::Node* node;
- for(node=value_node.get();!node->parent_set.empty() && !dynamic_cast<Layer*>(node);node=*node->parent_set.begin());
- Layer::Handle parent_layer(dynamic_cast<Layer*>(node));
- if(parent_layer)
- {
- if(parent_layer->get_description().empty())
- name=parent_layer->get_local_name()+"=>"+name;
- else
- name=parent_layer->get_description()+"=>"+name;
- }
- }
-
- return strprintf(_("Set %s"),name.c_str());
-}
-
-Action::ParamVocab
-Action::ValueDescSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
- .set_local_name(_("ValueBase"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueDescSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueDescSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- value_desc=param.get_value_desc();
-
- return true;
- }
-
- if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
- {
- value=param.get_value();
-
- return true;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueDescSet::is_ready()const
-{
- if(!value_desc || !value.is_valid())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueDescSet::prepare()
-{
- clear();
-
- // If our tangents are merged, and
- // our first tangent is being manipulated,
- // then we also need to adjust the other
- // tangent.
- if( value_desc.parent_is_value_node()
- && value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT
- && value_desc.get_index()==4
- && (*value_desc.get_parent_value_node())(time).get(BLinePoint()).get_split_tangent_flag()==false
- )
- {
- DEBUGPOINT();
- ValueNode_Composite::Handle parent_value_node;
- parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node());
-
- assert(parent_value_node);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",value);
- action->set_param("value_desc",ValueDesc(parent_value_node,5));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
- // If we are a reference value node, then
- // we need to distribute the changes to the
- // referenced value node
- if(value_desc.is_value_node() && ValueNode_Reference::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- ValueDesc reference_value_desc(ValueNode_Reference::Handle::cast_dynamic(value_desc.get_value_node()),0);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",value);
- action->set_param("value_desc",reference_value_desc);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
- return;
- }
-
- // If we are a composite value node, then
- // we need to distribute the changes to the
- // individual parts
- if(value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- ValueBase components[6];
- int n_components(0);
- switch(value.get_type())
- {
- case ValueBase::TYPE_VECTOR:
- components[0]=value.get(Vector())[0];
- components[1]=value.get(Vector())[1];
- n_components=2;
- break;
- case ValueBase::TYPE_COLOR:
- components[0]=value.get(Color()).get_r();
- components[1]=value.get(Color()).get_g();
- components[2]=value.get(Color()).get_b();
- components[3]=value.get(Color()).get_a();
- n_components=4;
- break;
- case ValueBase::TYPE_SEGMENT:
- components[0]=value.get(Segment()).p1;
- components[1]=value.get(Segment()).t1;
- components[2]=value.get(Segment()).p2;
- components[3]=value.get(Segment()).t2;
- n_components=4;
- break;
- case ValueBase::TYPE_BLINEPOINT:
- {
- BLinePoint bline_point(value);
- components[0]=bline_point.get_vertex();
- components[1]=bline_point.get_width();
- components[2]=bline_point.get_origin();
- components[3]=bline_point.get_split_tangent_flag();
- components[4]=bline_point.get_tangent1();
- components[5]=bline_point.get_tangent2();
- n_components=6;
- break;
- }
- default:
- throw Error("Bad type for composite (%s)",ValueBase::type_name(value.get_type()).c_str());
- break;
- }
-
- for(int i=0;i<n_components;i++)
- {
- ValueDesc component_value_desc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),i);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",components[i]);
- action->set_param("value_desc",component_value_desc);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
- return;
- }
-
-
- // If we are a RADIAL composite value node, then
- // we need to distribute the changes to the
- // individual parts
- if(value_desc.is_value_node() && ValueNode_RadialComposite::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- ValueBase components[6];
- int n_components(0);
- switch(value.get_type())
- {
- case ValueBase::TYPE_VECTOR:
- {
- Vector vect(value.get(Vector()));
- components[0]=vect.mag();
- components[1]=Angle(Angle::tan(vect[1],vect[0]));
- n_components=2;
- }
- break;
- case ValueBase::TYPE_COLOR:
- components[0]=value.get(Color()).get_y();
- components[1]=value.get(Color()).get_s();
- components[2]=value.get(Color()).get_hue();
- components[3]=value.get(Color()).get_a();
- n_components=4;
- break;
- default:
- throw Error("Bad type for radial composite (%s)",ValueBase::type_name(value.get_type()).c_str());
- break;
- }
- for(int i=0;i<n_components;i++)
- {
- ValueDesc component_value_desc(ValueNode_RadialComposite::Handle::cast_dynamic(value_desc.get_value_node()),i);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",components[i]);
- action->set_param("value_desc",component_value_desc);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
- return;
- }
-
- // If we are merging the tangents of a BLinePoint,
- // we must also set the second tangent for things
- // to interpolate properly
- if( value_desc.parent_is_value_node()
- && value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT
- && value_desc.get_index()==3
-// && value.get(bool())==false // Actually, we want to do this any time the split flag is tweaked with
- )
- {
- ValueNode_Composite::Handle parent_value_node;
- parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node());
-
- assert(parent_value_node);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",(*parent_value_node->get_link(4))(time));
- action->set_param("value_desc",ValueDesc(parent_value_node,5));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
-/* DEBUGPOINT();
- if( value_desc.parent_is_value_node())
- {
- DEBUGPOINT();
- if(value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT)
- {
- DEBUGPOINT();
- if(value_desc.get_index()==4)
- {
- DEBUGPOINT();
- if((*value_desc.get_parent_value_node())(time).get(BLinePoint()).get_split_tangent_flag()==false)
- {
- DEBUGPOINT();
- }
- }
- }
- }
-*/
-
-
- // If we are in animate editing mode
- if(get_edit_mode()&MODE_ANIMATE)
- {
-
- ValueNode_Animated::Handle& value_node(value_node_animated);
-
- // If this value isn't a ValueNode_Animated, but
- // it is somewhat constant, then go ahead and convert
- // it to a ValueNode_Animated.
- if(!value_desc.is_value_node() || ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- ValueBase value;
- if(value_desc.is_value_node())
- value=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node())->get_value();
- else
- value=value_desc.get_value();
-
- if(!value_node)value_node=ValueNode_Animated::create(value,time);
- //if(!value_node)value_node=ValueNode_Animated::create(value.get_type());
-
- Action::Handle action;
-
- if(!value_desc.is_value_node())
- {
- action=(ValueDescConnect::create());
- action->set_param("dest",value_desc);
- action->set_param("src",ValueNode::Handle(value_node));
- }
- else
- {
- action=Action::create("value_node_replace");
- action->set_param("dest",value_desc.get_value_node());
- action->set_param("src",ValueNode::Handle(value_node));
- }
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- DEBUGPOINT();
- add_action_front(action);
- }
- else
- {
- value_node=value_node.cast_dynamic(value_desc.get_value_node());
- }
-
- DEBUGPOINT();
- if(!value_node)
- throw Error(_("Direct manipulation of this ValueNode type is not yet supported"));
-
- Action::Handle action(WaypointSetSmart::create());
-
- //Waypoint waypoint(value,time);
-
- Waypoint waypoint(value_node->new_waypoint_at_time(time));
- waypoint.set_value(value);
-
- waypoint.set_before(sinfgapp::Main::get_interpolation());
- waypoint.set_after(sinfgapp::Main::get_interpolation());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- DEBUGPOINT();
- add_action(action);
-
- return;
- }
- else
- {
- if(value_desc.is_value_node())
- {
- if(ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- Action::Handle action(ValueNodeConstSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",value_desc.get_value_node());
- action->set_param("new_value",value);
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(action);
- return;
- }
- else
- if(ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()))
- throw Error(_("You must be in Animate-Editing-Mode to directly manipulate this value"));
- else
- throw Error(_("Direct manipulation of this ValueNode type is not yet supported"));
- }
- else
- if(value_desc.parent_is_layer_param() && !value_desc.is_value_node())
- {
- Action::Handle layer_param_set(LayerParamSet::create());
-
- layer_param_set->set_param("canvas",get_canvas());
- layer_param_set->set_param("canvas_interface",get_canvas_interface());
- layer_param_set->set_param("layer",value_desc.get_layer());
- layer_param_set->set_param("param",value_desc.get_param_name());
- layer_param_set->set_param("new_value",value);
-
- if(!layer_param_set->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action_front(layer_param_set);
- return;
- }
-
- throw Error(_("Unsupported ValueDesc type"));
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuedescset.h
-** \brief Template File
-**
-** $Id: valuedescset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUEDESCSET_H
-#define __SINFG_APP_ACTION_VALUEDESCSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_animated.h>
-#include <list>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class ValueDescSet :
- public Super
-{
-private:
-
- ValueDesc value_desc;
- sinfg::ValueBase value;
- sinfg::Time time;
- sinfg::ValueNode_Animated::Handle value_node_animated;
-
-public:
-
- ValueDescSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodeadd.cpp
-** \brief Template File
-**
-** $Id: valuenodeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodeadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeAdd);
-ACTION_SET_NAME(Action::ValueNodeAdd,"value_node_add");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeAdd,"Add ValueNode");
-ACTION_SET_TASK(Action::ValueNodeAdd,"add");
-ACTION_SET_CATEGORY(Action::ValueNodeAdd,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeAdd,0);
-ACTION_SET_VERSION(Action::ValueNodeAdd,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeAdd,"$Id: valuenodeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeAdd::ValueNodeAdd()
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("new",Param::TYPE_VALUENODE)
- .set_local_name(_("New ValueNode"))
- .set_desc(_("ValueNode to be added"))
- );
-
- ret.push_back(ParamDesc("name",Param::TYPE_STRING)
- .set_local_name(_("Name"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeAdd::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueNodeAdd::set_param(const sinfg::String& param_name, const Action::Param ¶m)
-{
- if(param_name=="new" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=param.get_value_node();
-
- return true;
- }
-
- if(param_name=="name" && param.get_type()==Param::TYPE_STRING)
- {
- name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(param_name,param);
-}
-
-bool
-Action::ValueNodeAdd::is_ready()const
-{
- if(!value_node || name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeAdd::perform()
-{
- if(value_node->is_exported())
- {
- throw Error(_("Parameter appears to already be exported"));
- }
-
- try
- {
- get_canvas()->add_value_node(value_node,name);
- }
- catch(Exception::IDAlreadyExists)
- {
- throw Error(_("Another exported ValueBase with this name already exists"));
- }
- catch(...)
- {
- throw Error(_("Exception caught on Add ValueNode."));
- }
-
- set_dirty(false);
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_added()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
-
-void
-Action::ValueNodeAdd::undo()
-{
- try { get_canvas()->remove_value_node(value_node); }
- catch(...)
- {
- throw Error(_("Exception caught on Remove ValueNode."));
- }
-
- set_dirty(false);
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_deleted()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodeadd.h
-** \brief Template File
-**
-** $Id: valuenodeadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEADD_H
-#define __SINFG_APP_ACTION_VALUENODEADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode::Handle value_node;
- sinfg::String name;
-
-public:
-
- ValueNodeAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodeconstset.cpp
-** \brief Template File
-**
-** $Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodeconstset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeConstSet);
-ACTION_SET_NAME(Action::ValueNodeConstSet,"value_node_const_set");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeConstSet,_("Set ValueNode_Const"));
-ACTION_SET_TASK(Action::ValueNodeConstSet,"set");
-ACTION_SET_CATEGORY(Action::ValueNodeConstSet,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeConstSet,0);
-ACTION_SET_VERSION(Action::ValueNodeConstSet,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeConstSet,"$Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeConstSet::ValueNodeConstSet()
-{
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeConstSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode_Const"))
- );
-
- ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
- .set_local_name(_("ValueBase"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeConstSet::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- if(ValueNode_Const::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeConstSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());
-
- return (bool)value_node;
- }
-
- if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
- {
- new_value=param.get_value();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeConstSet::is_ready()const
-{
- if(!value_node || !new_value.is_valid())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeConstSet::perform()
-{
- //set_dirty(true);
-
- old_value=value_node->get_value();
-
- value_node->set_value(new_value);
-
- // Signal that a layer has been inserted
- /*if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }*/
-}
-
-void
-Action::ValueNodeConstSet::undo()
-{
- //set_dirty(true);
-
- value_node->set_value(old_value);
-
- // Signal that a layer has been inserted
- /*if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodeconstset.h
-** \brief Template File
-**
-** $Id: valuenodeconstset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODECONSTSET_H
-#define __SINFG_APP_ACTION_VALUENODECONSTSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode_const.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeConstSet :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_Const::Handle value_node;
- sinfg::ValueBase new_value;
- sinfg::ValueBase old_value;
-
-
-public:
-
- ValueNodeConstSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistinsert.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistinsert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistinsert.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListInsert);
-ACTION_SET_NAME(Action::ValueNodeDynamicListInsert,"value_node_dynamic_list_insert");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListInsert,"Insert Item");
-ACTION_SET_TASK(Action::ValueNodeDynamicListInsert,"insert");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListInsert,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE|Action::CATEGORY_HIDDEN);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListInsert,-20);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListInsert,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListInsert,"$Id: valuenodedynamiclistinsert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListInsert::ValueNodeDynamicListInsert()
-{
- index=0;
- time=0;
- origin=0.5f;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListInsert::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
- ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
- .set_local_name(_("Origin"))
- .set_optional()
- );
- ret.push_back(ParamDesc("item",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode to insert"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListInsert::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListInsert::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- value_node_bline=ValueNode_BLine::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- list_entry=value_node->create_list_entry(index,time,origin);
- if(item)
- list_entry.value_node=item;
-
- assert(list_entry.value_node.rcount()==1);
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
- if(name=="item" && param.get_type()==Param::TYPE_VALUENODE)
- {
- item=param.get_value_node();
- if(item)
- list_entry.value_node=item;
-
- return true;
- }
- if(name=="origin" && param.get_type()==Param::TYPE_REAL)
- {
- origin=param.get_real();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListInsert::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListInsert::perform()
-{
- if(index>value_node->link_count())
- index=value_node->link_count();
-
- value_node->add(list_entry,index);
- assert(list_entry.value_node.rcount()>=2);
-
- // Signal that a layer has been inserted
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
-
-void
-Action::ValueNodeDynamicListInsert::undo()
-{
- assert(list_entry.value_node.rcount()>=2);
- value_node->erase((value_node->list.begin()+index)->value_node);
- assert(list_entry.value_node.rcount()>=1);
-
- // Signal that a layer has been inserted
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistinsert.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistinsert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTINSERT_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTINSERT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListInsert :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- sinfg::ValueNode_BLine::Handle value_node_bline;
- sinfg::ValueNode_DynamicList::ListEntry list_entry;
- sinfg::ValueNode::Handle item;
- sinfg::Time time;
- sinfg::Real origin;
- int index;
-
-
-public:
-
- ValueNodeDynamicListInsert();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistinsertsmart.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistinsertsmart.cpp,v 1.3 2005/01/17 05:20:08 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistinsertsmart.h"
-#include "valuenodedynamiclistinsert.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListInsertSmart);
-ACTION_SET_NAME(Action::ValueNodeDynamicListInsertSmart,"value_node_dynamic_list_insert_smart");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListInsertSmart,"Insert Item (Smart)");
-ACTION_SET_TASK(Action::ValueNodeDynamicListInsertSmart,"insert");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListInsertSmart,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListInsertSmart,-20);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListInsertSmart,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListInsertSmart,"$Id: valuenodedynamiclistinsertsmart.cpp,v 1.3 2005/01/17 05:20:08 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListInsertSmart::ValueNodeDynamicListInsertSmart()
-{
- index=0;
- time=0;
- origin=0.5f;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListInsertSmart::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
- ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
- .set_local_name(_("Origin"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListInsertSmart::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListInsertSmart::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
- if(name=="origin" && param.get_type()==Param::TYPE_REAL)
- {
- origin=param.get_real();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListInsertSmart::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListInsertSmart::prepare()
-{
- //clear();
- // HACK
- if(!first_time())
- return;
-
- // If we are in animate editing mode
- if(get_edit_mode()&MODE_ANIMATE)
- {
- int index(ValueNodeDynamicListInsertSmart::index);
-
- // In this case we need to first determine if there is
- // a currently disabled item in the list that we can
- // turn on. If not, then we need to go ahead and create one.
- sinfg::info("ValueNodeDynamicListInsertSmart: index=%d",index);
- sinfg::info("ValueNodeDynamicListInsertSmart: value_node->list.size()=%d",value_node->list.size());
- if(value_node->list.size()<=index && index>0)
- sinfg::info("ValueNodeDynamicListInsertSmart: value_node->list[index-1].status_at_time(time)=%d",value_node->list[index-1].status_at_time(time));
-
- if(value_node->list.size()>=index && index>0 && !value_node->list[index-1].status_at_time(time))
- {
- // Ok, we do not have to create a new
- // entry in the dynamic list after all.
- // However, we do need to set the
- // position and tangent of this point.
- ValueNode_DynamicList::ListEntry list_entry(value_node->create_list_entry(index,time,origin));
- ValueBase value((*list_entry.value_node)(time));
- index--;
-
- ValueDesc item_value_desc(value_node,index);
-
- Action::Handle action(Action::create("value_desc_set"));
-
- if(!action)
- throw Error(_("Unable to find action value_desc_set (bug)"));
-
- action->set_param("edit_mode",get_edit_mode());
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("new_value",value);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- else
- {
- // Ok, not a big deal, we just need to
- // add a new item
- Action::Handle action(Action::create("value_node_dynamic_list_insert"));
-
- if(!action)
- throw Error(_("Unable to find action (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
- action=Action::create("activepoint_set_off");
-
- if(!action)
- throw Error(_("Unable to find action \"activepoint_set_off\""));
-
- action->set_param("edit_mode",MODE_ANIMATE);
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",Time::begin());
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-
- // Now we set the activepoint up and then we'll be done
- Action::Handle action(Action::create("activepoint_set_on"));
-
- if(!action)
- throw Error(_("Unable to find action \"activepoint_set_on\""));
-
- action->set_param("edit_mode",get_edit_mode());
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- else
- {
- Action::Handle action(Action::create("value_node_dynamic_list_insert"));
-
- if(!action)
- throw Error(_("Unable to find action (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistinsertsmart.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistinsertsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTINSERTSMART_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTINSERTSMART_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListInsertSmart :
- public Super
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- sinfg::Time time;
- sinfg::Real origin;
- int index;
-
-
-public:
-
- ValueNodeDynamicListInsertSmart();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistloop.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistloop.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListLoop);
-ACTION_SET_NAME(Action::ValueNodeDynamicListLoop,"value_node_dynamic_list_loop");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListLoop,"Loop");
-ACTION_SET_TASK(Action::ValueNodeDynamicListLoop,"loop");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListLoop,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListLoop,0);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListLoop,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListLoop,"$Id: valuenodedynamiclistloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListLoop::ValueNodeDynamicListLoop()
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListLoop::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListLoop::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueNode::Handle value_node(x.find("value_node")->second.get_value_node());
- if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- return false;
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==true)
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListLoop::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node());
-
- if(!value_node)
- return false;
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListLoop::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListLoop::perform()
-{
- old_loop_value=value_node->get_loop();
-
- if(old_loop_value==true)
- {
- set_dirty(false);
- return;
- }
- set_dirty(true);
- value_node->set_loop(true);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
-
-void
-Action::ValueNodeDynamicListLoop::undo()
-{
- if(old_loop_value==value_node->get_loop())
- {
- set_dirty(false);
- return;
- }
- set_dirty(true);
- value_node->set_loop(old_loop_value);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistloop.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistloop.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTLOOP_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTLOOP_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListLoop :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- bool old_loop_value;
-
-
-public:
-
- ValueNodeDynamicListLoop();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistremove.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListRemove);
-ACTION_SET_NAME(Action::ValueNodeDynamicListRemove,"value_node_dynamic_list_remove");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRemove,"Remove Item");
-ACTION_SET_TASK(Action::ValueNodeDynamicListRemove,"remove");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRemove,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE|Action::CATEGORY_HIDDEN);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRemove,-19);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListRemove,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRemove,"$Id: valuenodedynamiclistremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListRemove::ValueNodeDynamicListRemove()
-{
- index=0;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListRemove::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListRemove::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListRemove::perform()
-{
- if(index>=value_node->link_count())
- index=value_node->link_count()-1;
-
- list_entry=value_node->list[index];
- value_node->erase((value_node->list.begin()+index)->value_node);
-
- // Signal that a layer has been inserted
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
-
-void
-Action::ValueNodeDynamicListRemove::undo()
-{
- value_node->add(list_entry,index);
-
- // Signal that a layer has been inserted
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistremove.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTREMOVE_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- sinfg::ValueNode_DynamicList::ListEntry list_entry;
- int index;
-
-
-public:
-
- ValueNodeDynamicListRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistremovesmart.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistremovesmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistremovesmart.h"
-#include "valuenodedynamiclistremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListRemoveSmart);
-ACTION_SET_NAME(Action::ValueNodeDynamicListRemoveSmart,"value_node_dynamic_list_remove_smart");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRemoveSmart,"Remove Item (Smart)");
-ACTION_SET_TASK(Action::ValueNodeDynamicListRemoveSmart,"remove");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRemoveSmart,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRemoveSmart,-19);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListRemoveSmart,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRemoveSmart,"$Id: valuenodedynamiclistremovesmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListRemoveSmart::ValueNodeDynamicListRemoveSmart()
-{
- index=0;
- time=0;
- origin=0.5f;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListRemoveSmart::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
- ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
- .set_local_name(_("Origin"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListRemoveSmart::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListRemoveSmart::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
- if(name=="origin" && param.get_type()==Param::TYPE_REAL)
- {
- origin=param.get_real();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListRemoveSmart::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListRemoveSmart::prepare()
-{
- clear();
-
- // If we are in animate editing mode
- if(get_edit_mode()&MODE_ANIMATE)
- {
- Action::Handle action(Action::create("activepoint_set_off"));
-
- if(!action)
- throw Error(_("Unable to find action (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- else
- {
- Action::Handle action(Action::create("value_node_dynamic_list_remove"));
-
- if(!action)
- throw Error(_("Unable to find action (bug)"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("time",time);
- action->set_param("origin",origin);
- action->set_param("value_desc",ValueDesc(value_node,index));
-
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistremovesmart.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistremovesmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTREMOVESMART_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTREMOVESMART_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListRemoveSmart :
- public Super
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- sinfg::Time time;
- sinfg::Real origin;
- int index;
-
-
-public:
-
- ValueNodeDynamicListRemoveSmart();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistinsert.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistrotateorder.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistrotateorder.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListRotateOrder);
-ACTION_SET_NAME(Action::ValueNodeDynamicListRotateOrder,"value_node_dynamic_list_rotate_order");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRotateOrder,"Rotate Order");
-ACTION_SET_TASK(Action::ValueNodeDynamicListRotateOrder,"rotate");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRotateOrder,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRotateOrder,0);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListRotateOrder,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRotateOrder,"$Id: valuenodedynamiclistrotateorder.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListRotateOrder::ValueNodeDynamicListRotateOrder()
-{
- index=0;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListRotateOrder::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
- .set_local_name(_("ValueDesc"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListRotateOrder::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
- if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
- return false;
-
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListRotateOrder::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
- {
- ValueDesc value_desc(param.get_value_desc());
-
- if(!value_desc.parent_is_value_node())
- return false;
-
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
-
- if(!value_node)
- return false;
-
- index=value_desc.get_index();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListRotateOrder::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListRotateOrder::prepare()
-{
- clear();
-
- for(int i(0);i<(value_node->link_count()-index)%value_node->link_count();++i)
- {
- ValueDesc value_desc(value_node,value_node->link_count()-1-i);
- ValueNode::Handle child(value_desc.get_value_node());
-
-
- Action::Handle action(Action::create("value_node_dynamic_list_remove"));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,value_node->link_count()-1));
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
-
- action=Action::create("value_node_dynamic_list_insert");
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",ValueDesc(value_node,0));
- action->set_param("item",child);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
-
-
-
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistrotateorder.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistrotateorder.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTROTATEORDER_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTROTATEORDER_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListRotateOrder :
- public Super
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- int index;
-
-
-public:
-
- ValueNodeDynamicListRotateOrder();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistunloop.cpp
-** \brief Template File
-**
-** $Id: valuenodedynamiclistunloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodedynamiclistunloop.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeDynamicListUnLoop);
-ACTION_SET_NAME(Action::ValueNodeDynamicListUnLoop,"value_node_dynamic_list_unloop");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListUnLoop,"Unloop");
-ACTION_SET_TASK(Action::ValueNodeDynamicListUnLoop,"unloop");
-ACTION_SET_CATEGORY(Action::ValueNodeDynamicListUnLoop,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeDynamicListUnLoop,0);
-ACTION_SET_VERSION(Action::ValueNodeDynamicListUnLoop,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeDynamicListUnLoop,"$Id: valuenodedynamiclistunloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeDynamicListUnLoop::ValueNodeDynamicListUnLoop()
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeDynamicListUnLoop::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeDynamicListUnLoop::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueNode::Handle value_node(x.find("value_node")->second.get_value_node());
- if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- return false;
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==false)
- return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeDynamicListUnLoop::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node());
-
- if(!value_node)
- return false;
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeDynamicListUnLoop::is_ready()const
-{
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeDynamicListUnLoop::perform()
-{
- old_loop_value=value_node->get_loop();
-
- if(old_loop_value==false)
- {
- set_dirty(false);
- return;
- }
-
- set_dirty(true);
- value_node->set_loop(false);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
-
-void
-Action::ValueNodeDynamicListUnLoop::undo()
-{
- if(old_loop_value==value_node->get_loop())
- {
- set_dirty(false);
- return;
- }
-
- set_dirty(true);
- value_node->set_loop(old_loop_value);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodedynamiclistunloop.h
-** \brief Template File
-**
-** $Id: valuenodedynamiclistunloop.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEDYNAMICLISTUNLOOP_H
-#define __SINFG_APP_ACTION_VALUENODEDYNAMICLISTUNLOOP_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/activepoint.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/valuenode_bline.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeDynamicListUnLoop :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_DynamicList::Handle value_node;
- bool old_loop_value;
-
-
-public:
-
- ValueNodeDynamicListUnLoop();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodelinkconnect.cpp
-** \brief Template File
-**
-** $Id: valuenodelinkconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodelinkconnect.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeLinkConnect);
-ACTION_SET_NAME(Action::ValueNodeLinkConnect,"value_node_link_connect");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeLinkConnect,_("Connect ValueNode Link"));
-ACTION_SET_TASK(Action::ValueNodeLinkConnect,"connect");
-ACTION_SET_CATEGORY(Action::ValueNodeLinkConnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeLinkConnect,0);
-ACTION_SET_VERSION(Action::ValueNodeLinkConnect,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeLinkConnect,"$Id: valuenodelinkconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeLinkConnect::ValueNodeLinkConnect():
- index(-1) // Initially set it to negative one so that we know when it has changed
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeLinkConnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Parent ValueNode"))
- );
-
- ret.push_back(ParamDesc("index",Param::TYPE_INTEGER)
- .set_local_name(_("Index"))
- );
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode to be connected"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeLinkConnect::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueNodeLinkConnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- parent_value_node=LinkableValueNode::Handle::cast_dynamic(param.get_value_node());
-
- return static_cast<bool>(parent_value_node);
- }
-
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- new_value_node=param.get_value_node();
-
- return true;
- }
-
- if(name=="index" && param.get_type()==Param::TYPE_INTEGER)
- {
- index=param.get_integer();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeLinkConnect::is_ready()const
-{
- if(!new_value_node || !parent_value_node || index==-1)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeLinkConnect::perform()
-{
- if(parent_value_node->link_count()<=index)
- throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
-
- old_value_node=parent_value_node->get_link(index);
-
- if(!parent_value_node->set_link(index,new_value_node))
- throw Error(_("Parent would not accept link"));
-
- /*set_dirty(true);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(parent_value_node);
- }*/
-}
-
-void
-Action::ValueNodeLinkConnect::undo()
-{
- if(parent_value_node->link_count()<=index)
- throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
-
- if(!parent_value_node->set_link(index,old_value_node))
- throw Error(_("Parent would not accept old link"));
-
- /*set_dirty(true);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(parent_value_node);
- }*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodelinkconnect.h
-** \brief Template File
-**
-** $Id: valuenodelinkconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODELINKCONNECT_H
-#define __SINFG_APP_ACTION_VALUENODELINKCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeLinkConnect :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::LinkableValueNode::Handle parent_value_node;
- sinfg::ValueNode::Handle new_value_node;
- sinfg::ValueNode::Handle old_value_node;
- int index;
-
-
-public:
-
- ValueNodeLinkConnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodelinkdisconnect.cpp
-** \brief Template File
-**
-** $Id: valuenodelinkdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodelinkdisconnect.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/valuenode_const.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeLinkDisconnect);
-ACTION_SET_NAME(Action::ValueNodeLinkDisconnect,"value_node_link_disconnect");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeLinkDisconnect,_("Disconnect ValueNode Link"));
-ACTION_SET_TASK(Action::ValueNodeLinkDisconnect,"disconnect");
-ACTION_SET_CATEGORY(Action::ValueNodeLinkDisconnect,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeLinkDisconnect,0);
-ACTION_SET_VERSION(Action::ValueNodeLinkDisconnect,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeLinkDisconnect,"$Id: valuenodelinkdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeLinkDisconnect::ValueNodeLinkDisconnect():
- index(-1), // Initially set it to negative one so that we know when it has changed
- time(0)
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeLinkDisconnect::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Parent ValueNode"))
- );
-
- ret.push_back(ParamDesc("index",Param::TYPE_INTEGER)
- .set_local_name(_("Index"))
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeLinkDisconnect::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueNodeLinkDisconnect::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- parent_value_node=LinkableValueNode::Handle::cast_dynamic(param.get_value_node());
-
- return static_cast<bool>(parent_value_node);
- }
-
- if(name=="index" && param.get_type()==Param::TYPE_INTEGER)
- {
- index=param.get_integer();
-
- return true;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME)
- {
- time=param.get_time();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeLinkDisconnect::is_ready()const
-{
- if(!parent_value_node || index==-1)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeLinkDisconnect::perform()
-{
- if(parent_value_node->link_count()<=index)
- throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
-
- old_value_node=parent_value_node->get_link(index);
-
- if(!parent_value_node->set_link(index,ValueNode_Const::create((*old_value_node)(time))))
- throw Error(_("Parent would not accept link"));
-
- /*
- if(get_canvas()->get_time()!=time)
- set_dirty(true);
- else
- set_dirty(false);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(parent_value_node);
- }
- */
-}
-
-void
-Action::ValueNodeLinkDisconnect::undo()
-{
- if(parent_value_node->link_count()<=index)
- throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
-
- if(!parent_value_node->set_link(index,old_value_node))
- throw Error(_("Parent would not accept old link"));
-
- /*if(get_canvas()->get_time()!=time)
- set_dirty(true);
- else
- set_dirty(false);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(parent_value_node);
- }*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodelinkdisconnect.h
-** \brief Template File
-**
-** $Id: valuenodelinkdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODELINKDISCONNECT_H
-#define __SINFG_APP_ACTION_VALUENODELINKDISCONNECT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeLinkDisconnect :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::LinkableValueNode::Handle parent_value_node;
- int index;
- sinfg::ValueNode::Handle old_value_node;
- sinfg::Time time;
-
-public:
-
- ValueNodeLinkDisconnect();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenoderemove.cpp
-** \brief Template File
-**
-** $Id: valuenoderemove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenoderemove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeRemove);
-ACTION_SET_NAME(Action::ValueNodeRemove,"value_node_remove");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeRemove,_("Unexport"));
-ACTION_SET_TASK(Action::ValueNodeRemove,"remove");
-ACTION_SET_CATEGORY(Action::ValueNodeRemove,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeRemove,0);
-ACTION_SET_VERSION(Action::ValueNodeRemove,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeRemove,"$Id: valuenoderemove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeRemove::ValueNodeRemove()
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeRemove::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- ValueNode::Handle value_node=x.find("value_node")->second.get_value_node();
- if(!value_node->is_exported())
- return false;
-// if(value_node->rcount()!=1)
-// return false;
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=param.get_value_node();
-
- if(value_node && !value_node->is_exported())
- {
- sinfg::error("Action::ValueNodeRemove::set_param(): ValueBase node not exported!");
- value_node=0;
- }
-
- return (bool)value_node;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeRemove::is_ready()const
-{
- if(!value_node)
- sinfg::error("Action::ValueNodeRemove::is_ready(): ValueNode not set!");
-
- if(!value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeRemove::perform()
-{
-// if(value_node->rcount()!=1)
-// throw Error(_("ValueNode is still being used by something"));
-
- old_name=value_node->get_id();
- parent_canvas=value_node->get_parent_canvas();
- parent_canvas->remove_value_node(value_node);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_deleted()(value_node);
- }
-
- //throw Error(_("Not yet implemented"));
-/*
- assert(value_node->is_exported());
-
- if(get_canvas()->value_node_list().count(new_name))
- throw Error(_("A ValueNode with this ID already exists in this canvas"));
-
- old_name=value_node->get_id();
-
- value_node->set_id(new_name);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
-*/
-}
-
-void
-Action::ValueNodeRemove::undo()
-{
- parent_canvas->add_value_node(value_node,old_name);
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_added()(value_node);
- }
-
- //throw Error(_("Not yet implemented"));
-/*
- assert(value_node->is_exported());
-
- if(get_canvas()->value_node_list().count(old_name))
- throw Error(_("A ValueNode with the old ID already exists in this canvas (BUG)"));
-
- value_node->set_id(old_name);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
-*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenoderemove.h
-** \brief Template File
-**
-** $Id: valuenoderemove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEREMOVE_H
-#define __SINFG_APP_ACTION_VALUENODEREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode_const.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode::Handle value_node;
- sinfg::Canvas::Handle parent_canvas;
- sinfg::String new_name;
- sinfg::String old_name;
-
-
-public:
-
- ValueNodeRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenoderename.cpp
-** \brief Template File
-**
-** $Id: valuenoderename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenoderename.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeRename);
-ACTION_SET_NAME(Action::ValueNodeRename,"value_node_rename");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeRename,_("Rename ValueNode"));
-ACTION_SET_TASK(Action::ValueNodeRename,"rename");
-ACTION_SET_CATEGORY(Action::ValueNodeRename,Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::ValueNodeRename,0);
-ACTION_SET_VERSION(Action::ValueNodeRename,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeRename,"$Id: valuenoderename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeRename::ValueNodeRename()
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeRename::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode_Const"))
- );
-
- ret.push_back(ParamDesc("name",Param::TYPE_STRING)
- .set_local_name(_("Name"))
- .set_desc(_("The new name of the ValueNode"))
- .set_user_supplied()
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeRename::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- if(x.find("value_node")->second.get_value_node()->is_exported())
- return true;
- }
- return false;
-}
-
-bool
-Action::ValueNodeRename::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=param.get_value_node();
-
- if(value_node && !value_node->is_exported())
- {
- sinfg::error("Action::ValueNodeRename::set_param(): ValueBase node not exported!");
- value_node=0;
- }
-
- return (bool)value_node;
- }
-
- if(name=="name" && param.get_type()==Param::TYPE_STRING)
- {
- new_name=param.get_string();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeRename::is_ready()const
-{
- if(!value_node)
- sinfg::error("Action::ValueNodeRename::is_ready(): ValueNode not set!");
-
- if(new_name.empty())
- sinfg::error("Action::ValueNodeRename::is_ready(): ValueNode not set!");
-
- if(!value_node || new_name.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeRename::perform()
-{
- assert(value_node->is_exported());
-
- if(get_canvas()->value_node_list().count(new_name))
- throw Error(_("A ValueNode with this ID already exists in this canvas"));
-
- old_name=value_node->get_id();
-
- value_node->set_id(new_name);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
-}
-
-void
-Action::ValueNodeRename::undo()
-{
- assert(value_node->is_exported());
-
- if(get_canvas()->value_node_list().count(old_name))
- throw Error(_("A ValueNode with the old ID already exists in this canvas (BUG)"));
-
- value_node->set_id(old_name);
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenoderename.h
-** \brief Template File
-**
-** $Id: valuenoderename.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODERENAME_H
-#define __SINFG_APP_ACTION_VALUENODERENAME_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode_const.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeRename :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode::Handle value_node;
- sinfg::String new_name;
- sinfg::String old_name;
-
-
-public:
-
- ValueNodeRename();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodereplace.cpp
-** \brief Template File
-**
-** $Id: valuenodereplace.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "valuenodereplace.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::ValueNodeReplace);
-ACTION_SET_NAME(Action::ValueNodeReplace,"value_node_replace");
-ACTION_SET_LOCAL_NAME(Action::ValueNodeReplace,"Replace ValueNode");
-ACTION_SET_TASK(Action::ValueNodeReplace,"replace");
-ACTION_SET_CATEGORY(Action::ValueNodeReplace,Action::CATEGORY_VALUENODE|Action::CATEGORY_DRAG);
-ACTION_SET_PRIORITY(Action::ValueNodeReplace,0);
-ACTION_SET_VERSION(Action::ValueNodeReplace,"0.0");
-ACTION_SET_CVS_ID(Action::ValueNodeReplace,"$Id: valuenodereplace.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-void swap_guid(const ValueNode::Handle& a,const ValueNode::Handle& b)
-{
- GUID old_a(a->get_guid());
- a->set_guid(GUID());
-
- GUID old_b(b->get_guid());
- b->set_guid(GUID());
-
- a->set_guid(old_b);
- b->set_guid(old_a);
-}
-
-/* === M E T H O D S ======================================================= */
-
-Action::ValueNodeReplace::ValueNodeReplace():
- is_undoable(true)
-{
-}
-
-Action::ParamVocab
-Action::ValueNodeReplace::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("dest",Param::TYPE_VALUENODE)
- .set_local_name(_("Destination ValueNode"))
- .set_desc(_("ValueNode to replaced"))
- );
-
- ret.push_back(ParamDesc("src",Param::TYPE_VALUENODE)
- .set_local_name(_("Source ValueNode"))
- .set_desc(_("ValueNode that will replace the destination"))
- );
-
- return ret;
-}
-
-bool
-Action::ValueNodeReplace::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::ValueNodeReplace::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="dest" && param.get_type()==Param::TYPE_VALUENODE)
- {
- dest_value_node=param.get_value_node();
-
- return true;
- }
-
- if(name=="src" && param.get_type()==Param::TYPE_VALUENODE)
- {
- src_value_node=param.get_value_node();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::ValueNodeReplace::is_ready()const
-{
- if(!dest_value_node || !src_value_node)
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::ValueNodeReplace::perform()
-{
- set_dirty(true);
-
- if(dest_value_node == src_value_node)
- throw Error(_("Attempted to replace valuenode with itself"));
-
- if(dest_value_node->get_type() != src_value_node->get_type())
- throw Error(_("You cannot replace ValueNodes with different types!"));
-
- is_undoable=true;
-
- if(!src_value_node->is_exported())
- {
- src_value_node->set_id(dest_value_node->get_id());
- src_value_node->set_parent_canvas(dest_value_node->get_parent_canvas());
-
- ValueNode::RHandle value_node(src_value_node);
-
- if(!value_node.runique() && value_node.rcount()>1)
- is_undoable=false; // !!!
- }
- else
- is_undoable=false; // !!!
-
- if(!is_undoable)
- sinfg::warning("ValueNodeReplace: Circumstances make undoing this action impossible at the current time. :(");
-
- ValueNode::RHandle value_node(dest_value_node);
-
- if(value_node.runique() || value_node.rcount()<=1)
- throw Error(_("Nothing to replace."));
-
- int replacements;
-
- replacements=value_node->replace(src_value_node);
- assert(replacements);
- if(!replacements)
- throw Error(_("Action Failure. This is a bug. Please report it."));
- swap_guid(dest_value_node,src_value_node);
-
- //src_value_node->parent_set.swap(dest_value_node->parent_set);
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_replaced()(dest_value_node,src_value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
-
-}
-
-void
-Action::ValueNodeReplace::undo()
-{
- if(!is_undoable)
- throw Error(_("This action cannot be undone under these circumstances."));
-
- set_dirty(true);
-
- if(dest_value_node == src_value_node)
- throw Error(_("Attempted to replace valuenode with itself"));
-
- if(dest_value_node->get_type() != src_value_node->get_type())
- throw Error(_("You cannot replace ValueNodes with different types!"));
-
- ValueNode::RHandle value_node(src_value_node);
-
- if(value_node.runique() || value_node.rcount()<=1)
- throw Error(_("Nothing to replace."));
-
- int replacements;
-
- replacements=value_node->replace(dest_value_node);
- assert(replacements);
- if(!replacements)
- throw Error(_("Action Failure. This is a bug. Please report it."));
- swap_guid(dest_value_node,src_value_node);
-
- //src_value_node->parent_set.swap(dest_value_node->parent_set);
-
- sinfg::info(get_name()+_(": (Undo) ")+strprintf("Replaced %d ValueNode instances",replacements));
-
- src_value_node->set_id(String());
- src_value_node->set_parent_canvas(0);
-
- // Signal that a layer has been inserted
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_replaced()(src_value_node,dest_value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");
-
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file valuenodereplace.h
-** \brief Template File
-**
-** $Id: valuenodereplace.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_VALUENODEREPLACE_H
-#define __SINFG_APP_ACTION_VALUENODEREPLACE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/layer.h>
-#include <sinfgapp/action.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class ValueNodeReplace :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode::Handle src_value_node;
- sinfg::ValueNode::Handle dest_value_node;
- bool is_undoable;
-
-public:
-
- ValueNodeReplace();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointadd.cpp
-** \brief Template File
-**
-** $Id: waypointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "waypointadd.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfgapp/main.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::WaypointAdd);
-ACTION_SET_NAME(Action::WaypointAdd,"waypoint_add");
-ACTION_SET_LOCAL_NAME(Action::WaypointAdd,"Add Waypoint");
-ACTION_SET_TASK(Action::WaypointAdd,"add");
-ACTION_SET_CATEGORY(Action::WaypointAdd,Action::CATEGORY_WAYPOINT);
-ACTION_SET_PRIORITY(Action::WaypointAdd,0);
-ACTION_SET_VERSION(Action::WaypointAdd,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointAdd,"$Id: waypointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::WaypointAdd::WaypointAdd()
-{
- waypoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::WaypointAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Destination ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
- .set_local_name(_("New Waypoint"))
- .set_desc(_("Waypoint to be added"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_desc(_("Time where waypoint is to be added"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::WaypointAdd::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
- return false;
-
- // We need either a waypoint or a time.
- if(x.count("waypoint") || x.count("time"))
- return true;
- }
- return false;
-}
-
-bool
-Action::WaypointAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
- if(time_set)
- calc_waypoint();
-
- return static_cast<bool>(value_node);
- }
- if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
- {
- waypoint=param.get_waypoint();
-
- return true;
- }
- if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==Time::begin()-1)
- {
- waypoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_waypoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::WaypointAdd::is_ready()const
-{
- if(!value_node || waypoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a waypoint. In this case, we need to calculate the value
-// of the waypoint
-void
-Action::WaypointAdd::calc_waypoint()
-{
- Time time=waypoint.get_time();
- Waypoint original(waypoint);
- waypoint=value_node->new_waypoint_at_time(time);
- waypoint.mimic(original);
- waypoint.set_before(sinfgapp::Main::get_interpolation());
- waypoint.set_after(sinfgapp::Main::get_interpolation());
-
-/*
- ValueNode_Animated::WaypointList &waypoint_list(value_node->waypoint_list());
- ValueNode_Animated::WaypointList::iterator iter;
-
- if(waypoint_list.empty())
- {
- waypoint.set_value((*value_node)(time));
- return;
- }
-
- ValueNode_Animated::WaypointList::iterator closest=waypoint_list.begin();
-
- for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter)
- {
- const Real dist(abs(iter->get_time()-time));
- if(dist<abs(closest->get_time()-time))
- closest=iter;
- }
- if(!closest->is_static())
- waypoint.set_value_node(closest->get_value_node());
- else
- waypoint.set_value((*value_node)(time));
- */
-}
-
-void
-Action::WaypointAdd::perform()
-{
- try { value_node->find(waypoint.get_time()); throw Error(_("A Waypoint already exists at this point in time (%s)"),waypoint.get_time().get_string().c_str());}
- catch(sinfg::Exception::NotFound) { }
-
- try { if(value_node->find(waypoint)!=value_node->waypoint_list().end()) throw Error(_("This waypoint is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
-
- value_node->add(waypoint);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
-
-void
-Action::WaypointAdd::undo()
-{
- value_node->erase(waypoint);
-
- value_node->changed();
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointadd.h
-** \brief Template File
-**
-** $Id: waypointadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_WAYPOINTADD_H
-#define __SINFG_APP_ACTION_WAYPOINTADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/waypoint.h>
-#include <sinfg/valuenode_animated.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class WaypointAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::Waypoint waypoint;
-
- bool time_overwrite;
- sinfg::Waypoint overwritten_wp;
-
- sinfg::ValueNode_Animated::Handle value_node;
- bool time_set;
-
- void calc_waypoint();
-
-public:
-
- WaypointAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointremove.cpp
-** \brief Template File
-**
-** $Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "waypointremove.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::WaypointRemove);
-ACTION_SET_NAME(Action::WaypointRemove,"waypoint_remove");
-ACTION_SET_LOCAL_NAME(Action::WaypointRemove,"Remove Waypoint");
-ACTION_SET_TASK(Action::WaypointRemove,"remove");
-ACTION_SET_CATEGORY(Action::WaypointRemove,Action::CATEGORY_WAYPOINT);
-ACTION_SET_PRIORITY(Action::WaypointRemove,0);
-ACTION_SET_VERSION(Action::WaypointRemove,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointRemove,"$Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::WaypointRemove::WaypointRemove()
-{
- waypoint.set_time(Time::begin()-1);
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::WaypointRemove::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
- .set_local_name(_("Waypoint"))
- .set_desc(_("Waypoint to be Removed"))
- );
-
- return ret;
-}
-
-bool
-Action::WaypointRemove::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::WaypointRemove::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
-
- return static_cast<bool>(value_node);
- }
- if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
- {
- waypoint=param.get_waypoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::WaypointRemove::is_ready()const
-{
- if(!value_node || waypoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::WaypointRemove::perform()
-{
- WaypointList::iterator iter(value_node->find(waypoint));
-
- if((UniqueID)*iter!=(UniqueID)waypoint)
- throw Error(_("UniqueID mismatch, iter=%d, waypoint=%d"),iter->get_uid(),waypoint.get_uid());
-
- if(iter->get_time()!=waypoint.get_time())
- throw Error(_("Time mismatch iter=%s, waypoint=%s"),iter->get_time().get_string().c_str(),waypoint.get_time().get_string().c_str());
-
- waypoint=*iter;
-
- value_node->erase(waypoint);
-
- // In this case, we need to convert this to a
- // constant value node
- if(value_node->waypoint_list().size()==0)
- {
- if(!value_node_ref)
- {
- value_node_ref=waypoint.get_value_node();
- if(!value_node_ref)
- throw Error(_("Unable to create ValueNode_Reference"));
- }
-
- value_node->replace(value_node_ref);
- value_node->waypoint_list().clear();
-
- if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_replaced()(value_node,value_node_ref);
- }
- }
-
- value_node->changed();
-}
-
-void
-Action::WaypointRemove::undo()
-{
- if(value_node_ref)
- {
- if(value_node->waypoint_list().size()!=0)
- throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (1)"));
-
- value_node_ref->replace(value_node);
-
- waypoint.set_value_node(value_node_ref);
-
- if(get_canvas_interface())
- get_canvas_interface()->signal_value_node_replaced()(value_node_ref,value_node);
-
- if(value_node->waypoint_list().size()!=0)
- throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (2)"));
- }
-
- if(value_node->waypoint_list().size()!=0)
- {
- try { value_node->find(waypoint.get_time()); throw Error(_("A Waypoint already exists at this point in time"));}
- catch(sinfg::Exception::NotFound) { }
-
- try { if(value_node->find(waypoint)!=value_node->waypoint_list().end()) throw Error(_("This waypoint is already in the ValueNode"));}
- catch(sinfg::Exception::NotFound) { }
- }
-
- value_node->add(waypoint);
-
-/*_if(get_canvas_interface())
- {
- get_canvas_interface()->signal_value_node_changed()(value_node);
- }
- else sinfg::warning("CanvasInterface not set on action");*/
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointremove.h
-** \brief Template File
-**
-** $Id: waypointremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_WAYPOINTREMOVE_H
-#define __SINFG_APP_ACTION_WAYPOINTREMOVE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/waypoint.h>
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_reference.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class WaypointRemove :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_Animated::Handle value_node;
- sinfg::ValueNode::Handle value_node_ref;
- sinfg::Waypoint waypoint;
-
-public:
-
- WaypointRemove();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointset.cpp
-** \brief Template File
-**
-** $Id: waypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "waypointset.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::WaypointSet);
-ACTION_SET_NAME(Action::WaypointSet,"waypoint_set");
-ACTION_SET_LOCAL_NAME(Action::WaypointSet,"Set Waypoint");
-ACTION_SET_TASK(Action::WaypointSet,"set");
-ACTION_SET_CATEGORY(Action::WaypointSet,Action::CATEGORY_WAYPOINT);
-ACTION_SET_PRIORITY(Action::WaypointSet,0);
-ACTION_SET_VERSION(Action::WaypointSet,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointSet,"$Id: waypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::WaypointSet::WaypointSet()
-{
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::WaypointSet::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Destination ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
- .set_local_name(_("Waypoint"))
- .set_desc(_("Waypoint to be changed"))
- .set_supports_multiple()
- );
-
- return ret;
-}
-
-bool
-Action::WaypointSet::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::WaypointSet::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
-
- return static_cast<bool>(value_node);
- }
- if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
- {
- //NOTE: at the moment there is no error checking for multiple sets!!!
- waypoints.push_back(param.get_waypoint());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::WaypointSet::is_ready()const
-{
- if(!value_node || waypoints.empty())
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::WaypointSet::perform()
-{
- WaypointList::iterator iter;
-
-#if 1
- vector<WaypointList::iterator> iters;
- vector<Waypoint>::iterator i = waypoints.begin(), end = waypoints.end();
-
- for(; i != end; ++i)
- {
- try { iters.push_back(value_node->find(*i)); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find waypoint"));
- }
- }
-
- //check to see which valuenodes are going to override because of the time...
- ValueNode_Animated::findresult timeiter;
-
- for(i = waypoints.begin(); i != end; ++i)
- {
- timeiter = value_node->find_time(i->get_time());
-
- bool candelete = timeiter.second;
-
- //we only want to track overwrites (not waypoints that are also being modified)
- if(candelete)
- {
- for(vector<WaypointList::iterator>::iterator ii = iters.begin(); ii != iters.end(); ++ii)
- {
- if(timeiter.first == *ii)
- {
- candelete = false;
- break;
- }
- }
- }
-
- //if we can still delete it after checking, record it, and then remove them all later
- if(candelete)
- {
- Waypoint w = *timeiter.first;
- overwritten_waypoints.push_back(w);
- }
- }
-
- //overwrite all the valuenodes we're supposed to set
- {
- i = waypoints.begin();
- for(vector<WaypointList::iterator>::iterator ii = iters.begin(); ii != iters.end() && i != end; ++ii, ++i)
- {
- old_waypoints.push_back(**ii);
- **ii = *i; //set the point to the corresponding point in the normal waypoint list
- }
- }
-
- //remove all the points we're supposed to be overwritting
- {
- vector<Waypoint>::iterator oi = overwritten_waypoints.begin(),
- oend = overwritten_waypoints.end();
- for(; oi != oend; ++oi)
- {
- value_node->erase(*oi);
- }
- }
-
-#else
- try { iter=value_node->find(waypoint); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find waypoint"));
- }
-
- //find the value at the old time before we replace it
- ValueNode_Animated::findresult timeiter;
- timeiter = value_node->find_time(waypoint.get_time());
-
- //we only want to track overwrites (not inplace modifications)
- if(timeiter.second && waypoint.get_uid() == timeiter.first->get_uid())
- {
- timeiter.second = false;
- }
-
- //copy and overwrite
- old_waypoint=*iter;
- *iter=waypoint;
-
- //if we've found a unique one then we need to erase it, but store it first
- if(timeiter.second)
- {
- time_overwrite = true;
- overwritten_wp = *timeiter.first;
-
- value_node->erase(overwritten_wp);
- }
-#endif
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
-
-void
-Action::WaypointSet::undo()
-{
- WaypointList::iterator iter;
-
-#if 1
- vector<Waypoint>::iterator i = old_waypoints.begin(), end = old_waypoints.end();
-
- for(; i != end; ++i)
- {
- try { iter = value_node->find(*i); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find waypoint"));
- }
-
- //overwrite with old one
- *iter = *i;
- }
-
- //add back in all the points that we removed before...
- {
- vector<Waypoint>::iterator oi = overwritten_waypoints.begin(),
- oend = overwritten_waypoints.end();
- for(; oi != oend; ++oi)
- {
- value_node->add(*oi);
- }
- }
-
-#else
- try { iter=value_node->find(old_waypoint); }
- catch(sinfg::Exception::NotFound)
- {
- throw Error(_("Unable to find waypoint"));
- }
-
- *iter=old_waypoint;
-
- if(time_overwrite)
- {
- value_node->add(overwritten_wp);
- }
-#endif
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointset.h
-** \brief Template File
-**
-** $Id: waypointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_WAYPOINTSET_H
-#define __SINFG_APP_ACTION_WAYPOINTSET_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/waypoint.h>
-#include <sinfg/valuenode_animated.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class WaypointSet :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_Animated::Handle value_node;
-
- std::vector<sinfg::Waypoint> waypoints;
- std::vector<sinfg::Waypoint> old_waypoints;
-
- std::vector<sinfg::Waypoint> overwritten_waypoints;
-
-public:
-
- WaypointSet();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointsetsmart.cpp
-** \brief Template File
-**
-** $Id: waypointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "waypointsetsmart.h"
-#include "valuenodelinkconnect.h"
-#include "valuenodereplace.h"
-
-#include "waypointset.h"
-#include "waypointadd.h"
-
-#include "valuedescconnect.h"
-#include <sinfgapp/canvasinterface.h>
-#include <sinfg/exception.h>
-#include <sinfgapp/main.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::WaypointSetSmart);
-ACTION_SET_NAME(Action::WaypointSetSmart,"waypoint_set_smart");
-ACTION_SET_LOCAL_NAME(Action::WaypointSetSmart,"Connect");
-ACTION_SET_TASK(Action::WaypointSetSmart,"set");
-ACTION_SET_CATEGORY(Action::WaypointSetSmart,Action::CATEGORY_WAYPOINT|Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
-ACTION_SET_PRIORITY(Action::WaypointSetSmart,0);
-ACTION_SET_VERSION(Action::WaypointSetSmart,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointSetSmart,"$Id: waypointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-
-/*#ifdef DEBUGPOINT
-#undef DEBUGPOINT
-#endif
-#define DEBUGPOINT()
-*/
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::WaypointSetSmart::WaypointSetSmart()
-{
- waypoint.set_time(Time::begin()-1);
- time_set=false;
- set_dirty(true);
-}
-
-Action::ParamVocab
-Action::WaypointSetSmart::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Destination ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
- .set_local_name(_("New Waypoint"))
- .set_desc(_("Waypoint to be added"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("waypoint_model",Param::TYPE_WAYPOINTMODEL)
- .set_local_name(_("Waypoint Model"))
- .set_optional()
- );
-
- ret.push_back(ParamDesc("time",Param::TYPE_TIME)
- .set_local_name(_("Time"))
- .set_desc(_("Time where waypoint is to be added"))
- .set_optional()
- );
-
- return ret;
-}
-
-bool
-Action::WaypointSetSmart::is_canidate(const ParamList &x)
-{
- if(canidate_check(get_param_vocab(),x))
- {
- if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
- return false;
- // We need either a waypoint or a time.
- if(x.count("waypoint") || x.count("time"))
- return true;
- return false;
- }
- return false;
-}
-
-bool
-Action::WaypointSetSmart::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
- DEBUGPOINT();
- if(time_set)
- calc_waypoint();
-
- return static_cast<bool>(value_node);
- }
- if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
- {
- waypoint=param.get_waypoint();
- DEBUGPOINT();
-
- return true;
- }
-
- if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==(Time::begin()-1))
- {
- waypoint.set_time(param.get_time());
- time_set=true;
-
- if(value_node)
- calc_waypoint();
- DEBUGPOINT();
-
- return true;
- }
-
- if(name=="model" && param.get_type()==Param::TYPE_WAYPOINTMODEL)
- {
- if(value_node)
- calc_waypoint();
-
- waypoint.apply_model(param.get_waypoint_model());
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::WaypointSetSmart::is_ready()const
-{
- if(!value_node)
- sinfg::error("Missing value_node");
-
- if(waypoint.get_time()==(Time::begin()-1))
- sinfg::error("Missing waypoint");
-
- if(!value_node || waypoint.get_time()==(Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-// This function is called if a time is specified, but not
-// a waypoint. In this case, we need to calculate the value
-// of the waypoint
-void
-Action::WaypointSetSmart::calc_waypoint()
-{
- DEBUGPOINT();
- Time time=waypoint.get_time();
- try
- {
- // Trivial case, we are sitting on a waypoint
- waypoint=*value_node->find(waypoint.get_time());
- }
- catch(...)
- {
- waypoint=value_node->new_waypoint_at_time(time);
- waypoint.set_before(sinfgapp::Main::get_interpolation());
- waypoint.set_after(sinfgapp::Main::get_interpolation());
- }
-/*
- Time time=waypoint.get_time();
- ValueNode_Animated::WaypointList &waypoint_list(value_node->waypoint_list());
- ValueNode_Animated::WaypointList::iterator iter;
-
- if(waypoint_list.empty())
- {
- waypoint.set_value((*value_node)(time));
- return;
- }
-
- ValueNode_Animated::WaypointList::iterator closest=waypoint_list.begin();
-
- for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter)
- {
- const Real dist(abs(iter->get_time()-time));
- if(dist<abs(closest->get_time()-time))
- closest=iter;
- }
- if(!closest->is_static())
- waypoint.set_value_node(closest->get_value_node());
- else
- waypoint.set_value((*value_node)(time));
-*/
-}
-
-void
-Action::WaypointSetSmart::enclose_waypoint(const sinfg::Waypoint& waypoint)
-{
- times.insert(waypoint.get_time());
-
- try {
- times.insert(value_node->find(waypoint)->get_time());
-// sinfg::info(__FILE__":%d: value_node->find(waypoint)->get_time()=%s",__LINE__,value_node->find(waypoint)->get_time().get_string().c_str());
-// DEBUGPOINT();
- }catch (...) { }
-
-// DEBUGPOINT();
- // First we need to to add any waypoints necessary to
- // maintain the integrity of the keyframes.
- if(get_edit_mode()&MODE_ANIMATE_PAST) try
- {
- Time curr_time(waypoint.get_time());
-
- //while(value_node->waypoint_list().front().get_time()<=curr_time)
- {
- // Try to find prev keyframe
- Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(curr_time));
- curr_time=keyframe.get_time();
-
-// sinfg::info(__FILE__":%d: prev_keyframe->time=%s",__LINE__,keyframe.get_time().get_string().c_str());
-// sinfg::info(__FILE__":%d: waypoint->time=%s",__LINE__,waypoint.get_time().get_string().c_str());
-
-// DEBUGPOINT();
- if(times.count(keyframe.get_time()))
- {
-// DEBUGPOINT();
- throw int();
- }
- if(waypoint.get_time().is_equal(keyframe.get_time()))
- {
-// DEBUGPOINT();
- throw int();
- }
-
- times.insert(keyframe.get_time());
-// DEBUGPOINT();
- try
- {
- value_node->find(keyframe.get_time());
-// sinfg::info(__FILE__":%d: waypointtime=%s",__LINE__,value_node->find(keyframe.get_time())->get_time().get_string().c_str());
- }
- catch(sinfg::Exception::NotFound)
- {
- Action::Handle action(WaypointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
-
- if(!value_node->waypoint_list().empty())
- {
- action->set_param("time",keyframe.get_time());
- }
- else
- {
- sinfg::Waypoint tmp;
-
- tmp.set_value(waypoint.get_value());
- tmp.set_time(keyframe.get_time());
- action->set_param("waypoint",tmp);
- }
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- }
- }
- catch(Error x) { throw x; }
- catch(sinfg::Exception::NotFound) { DEBUGPOINT(); }
- catch(int) { DEBUGPOINT(); }
- catch(...) { DEBUGPOINT(); }
- //DEBUGPOINT();
-
- //DEBUGPOINT();
- if(get_edit_mode()&MODE_ANIMATE_FUTURE)try
- {
- Time curr_time(waypoint.get_time());
-
- //while(value_node->waypoint_list().back().get_time()>=curr_time)
- {
-
- //DEBUGPOINT();
- // Try to find next keyframe
- //sinfg::info("FUTURE waypoint.get_time()=%s",waypoint.get_time().get_string().c_str());
- Keyframe keyframe(*get_canvas()->keyframe_list().find_next(curr_time));
- //sinfg::info("FUTURE keyframe.get_time()=%s",keyframe.get_time().get_string().c_str());
- curr_time=keyframe.get_time();
-
- //DEBUGPOINT();
- if(times.count(keyframe.get_time())|| waypoint.get_time().is_equal(keyframe.get_time()))
- throw int();
- else
- times.insert(keyframe.get_time());
- //DEBUGPOINT();
-
- try
- {
- value_node->find(keyframe.get_time());
- sinfg::info(__FILE__":%d: time=%s",__LINE__,keyframe.get_time().get_string().c_str());
- sinfg::info(__FILE__":%d: waypointtime=%s",__LINE__,value_node->find(keyframe.get_time())->get_time().get_string().c_str());
-
- }
- catch(sinfg::Exception::NotFound)
- {
- Action::Handle action(WaypointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
-
- if(!value_node->waypoint_list().empty())
- {
- action->set_param("time",keyframe.get_time());
- }
- else
- {
- sinfg::Waypoint tmp;
-
- tmp.set_value(waypoint.get_value());
- tmp.set_time(keyframe.get_time());
- action->set_param("waypoint",tmp);
- }
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
- }
- }
- //DEBUGPOINT();
- }
- catch(Error x) { throw x; }
- catch(sinfg::Exception::NotFound) { DEBUGPOINT(); }
- catch(int) { DEBUGPOINT(); }
- catch(...) { DEBUGPOINT(); }
- //DEBUGPOINT();
-}
-
-void
-Action::WaypointSetSmart::prepare()
-{
- //DEBUGPOINT();
- clear();
- times.clear();
-
- // First we need to to add any waypoints necessary to
- // maintain the integrity of the keyframes.
- enclose_waypoint(waypoint);
-
- try
- {
- //sinfg::info("WaypointSetSmart: Move/Update?");
- // Lets try to replace the old waypoint, if it exists
- WaypointList::iterator iter(value_node->find(waypoint));
-
- if(iter == value_node->waypoint_list().end())
- throw int();
-
- enclose_waypoint(*iter);
-
- Action::Handle action(WaypointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
- return;
- }
- catch(sinfg::Exception::NotFound){ } catch(int){ }
-
- try
- {
- //sinfg::info("WaypointSetSmart: Replace?");
- //DEBUGPOINT();
- // Check to see if a waypoint exists at this point in time
- WaypointList::iterator iter=value_node->find(waypoint.get_time());
-
- waypoint.mimic(*iter);
-
- enclose_waypoint(*iter);
-
- Action::Handle action(WaypointSet::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
- return;
- }
- catch(sinfg::Exception::NotFound){ } catch(int){ }
-
- try
- {
- //sinfg::info("WaypointSetSmart: Add?");
- //DEBUGPOINT();
- // At this point we know that the old waypoint doesn't exist,
- // so we need to create it.
- Action::Handle action(WaypointAdd::create());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_node",ValueNode::Handle(value_node));
- action->set_param("waypoint",waypoint);
-
- assert(action->is_ready());
- if(!action->is_ready())
- throw Error(Error::TYPE_NOTREADY);
-
- add_action(action);
-
- return;
- }
- catch(sinfg::Exception::NotFound){ } catch(int){ }
-
- throw Error(_("Unable to determine how to procede. This is a bug."));
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointsetsmart.h
-** \brief Template File
-**
-** $Id: waypointsetsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_ACTION_WAYPOINTSETSMART_H
-#define __SINFG_APP_ACTION_WAYPOINTSETSMART_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfgapp/value_desc.h>
-#include <sinfg/valuenode_animated.h>
-
-#include <list>
-#include <set>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-namespace Action {
-
-class WaypointSetSmart :
- public Super
-{
-private:
-
- sinfg::ValueNode_Animated::Handle value_node;
- sinfg::Waypoint waypoint;
- //sinfg::WaypointModel waypoint_model;
- bool time_set;
-
- void calc_waypoint();
- void enclose_waypoint(const sinfg::Waypoint& waypoint);
-
- std::set<sinfg::Time> times;
-
-public:
-
- WaypointSetSmart();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void prepare();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointsimpleadd.cpp
-** \brief Simple add waypoint File
-**
-** $Id: waypointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "waypointsimpleadd.h"
-#include <sinfgapp/canvasinterface.h>
-
-#endif
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-using namespace Action;
-
-/* === M A C R O S ========================================================= */
-
-ACTION_INIT(Action::WaypointSimpleAdd);
-ACTION_SET_NAME(Action::WaypointSimpleAdd,"waypoint_simpleadd");
-ACTION_SET_LOCAL_NAME(Action::WaypointSimpleAdd,"Simply Add Waypoint");
-ACTION_SET_TASK(Action::WaypointSimpleAdd,"add");
-ACTION_SET_CATEGORY(Action::WaypointSimpleAdd,Action::CATEGORY_WAYPOINT);
-ACTION_SET_PRIORITY(Action::WaypointSimpleAdd,0);
-ACTION_SET_VERSION(Action::WaypointSimpleAdd,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointSimpleAdd,"$Id: waypointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Action::WaypointSimpleAdd::WaypointSimpleAdd()
-{
- set_dirty(true);
- waypoint.set_time(Time::begin()-1);
-}
-
-Action::ParamVocab
-Action::WaypointSimpleAdd::get_param_vocab()
-{
- ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
-
- ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
- .set_local_name(_("Destination ValueNode (Animated)"))
- );
-
- ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
- .set_local_name(_("Waypoint"))
- .set_desc(_("Waypoint to be added"))
- );
-
- return ret;
-}
-
-bool
-Action::WaypointSimpleAdd::is_canidate(const ParamList &x)
-{
- return canidate_check(get_param_vocab(),x);
-}
-
-bool
-Action::WaypointSimpleAdd::set_param(const sinfg::String& name, const Action::Param ¶m)
-{
- if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
- {
- value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
-
- return static_cast<bool>(value_node);
- }
- if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
- {
- waypoint = param.get_waypoint();
-
- return true;
- }
-
- return Action::CanvasSpecific::set_param(name,param);
-}
-
-bool
-Action::WaypointSimpleAdd::is_ready()const
-{
- if(!value_node && waypoint.get_time() != (Time::begin()-1))
- return false;
- return Action::CanvasSpecific::is_ready();
-}
-
-void
-Action::WaypointSimpleAdd::perform()
-{
- //remove any pretenders that lie at our destination
- ValueNode_Animated::findresult iter = value_node->find_time(waypoint.get_time());
-
- time_overwrite = false;
- if(iter.second)
- {
- overwritten_wp = *iter.first;
- time_overwrite = true;
- }
-
- //add the value node in since it's safe
- value_node->add(waypoint);
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
-
-void
-Action::WaypointSimpleAdd::undo()
-{
- //remove our old version...
- ValueNode_Animated::findresult iter = value_node->find_uid(waypoint);
-
- if(!iter.second)
- {
- throw Error(_("The waypoint to remove no longer exists"));
- }
-
- //remove the offending value
- value_node->erase(*iter.first); //could also just use waypoint
-
- if(time_overwrite)
- {
- value_node->add(overwritten_wp);
- }
-
- // Signal that a valuenode has been changed
- value_node->changed();
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file waypointsimpleadd.h
-** \brief A simple add a waypoint function Header
-**
-** $Id: waypointsimpleadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_WAYPOINTSIMPLEADD_H
-#define __SINFG_WAYPOINTSIMPLEADD_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfgapp/action.h>
-#include <sinfg/waypoint.h>
-#include <sinfg/valuenode_animated.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Instance;
-
-namespace Action {
-
-class WaypointSimpleAdd :
- public Undoable,
- public CanvasSpecific
-{
-private:
-
- sinfg::ValueNode_Animated::Handle value_node;
-
- sinfg::Waypoint waypoint;
-
- bool time_overwrite;
- sinfg::Waypoint overwritten_wp;
-
-public:
-
- WaypointSimpleAdd();
-
- static ParamVocab get_param_vocab();
- static bool is_canidate(const ParamList &x);
-
- virtual bool set_param(const sinfg::String& name, const Param &);
- virtual bool is_ready()const;
-
- virtual void perform();
- virtual void undo();
-
- ACTION_MODULE_EXT
-};
-
-}; // END of namespace action
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blineconvert.cpp
-** \brief Template File
-**
-** $Id: blineconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "blineconvert.h"
-#include <vector>
-#include <ETL/gaussian>
-#include <ETL/hermite>
-#include <ETL/clock>
-#include <float.h>
-#include <algorithm>
-#include <sinfg/general.h>
-#include <cassert>
-
-
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-
-/* === M A C R O S ========================================================= */
-
-#define EPSILON (1e-10)
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-
-//Derivative Functions for numerical approximation
-
-//bias == 0 will get F' at f3, bias < 0 will get F' at f1, and bias > 0 will get F' at f5
-template < class T >
-inline void FivePointdt(T &df, const T &f1, const T &f2, const T &f3, const T &f4, const T &f5, int bias)
-{
- if(bias == 0)
- {
- //middle
- df = (f1 - f2*8 + f4*8 - f5)*(1/12.0f);
- }else if(bias < 0)
- {
- //left
- df = (-f1*25 + f2*48 - f3*36 + f4*16 - f5*3)*(1/12.0f);
- }else
- {
- //right
- df = (f1*3 - f2*16 + f3*36 - f4*48 + f5*25)*(1/12.0f);
- }
-}
-
-template < class T >
-inline void ThreePointdt(T &df, const T &f1, const T &f2, const T &f3, int bias)
-{
- if(bias == 0)
- {
- //middle
- df = (-f1 + f3)*(1/2.0f);
- }else if(bias < 0)
- {
- //left
- df = (-f1*3 + f2*4 - f3)*(1/2.0f);
- }else
- {
- //right
- df = (f1 - f2*4 + f3*3)*(1/2.0f);
- }
-}
-
-template < class T >
-inline void ThreePointddt(T &df, const T &f1, const T &f2, const T &f3, int bias)
-{
- //a 3 point approximation pretends to have constant acceleration, so only one algorithm needed for left, middle, or right
- df = (f1 -f2*2 + f3)*(1/2.0f);
-}
-
-// WARNING -- totaly broken
-template < class T >
-inline void FivePointddt(T &df, const T &f1, const T &f2, const T &f3, int bias)
-{
- if(bias == 0)
- {
- assert(0); // !?
- //middle
- //df = (- f1 + f2*16 - f3*30 + f4*16 - f5)*(1/12.0f);
- }/*else if(bias < 0)
- {
- //left
- df = (f1*7 - f2*26*4 + f3*19*6 - f4*14*4 + f5*11)*(1/12.0f);
- }else
- {
- //right
- df = (f1*3 - f2*16 + f3*36 - f4*48 + f5*25)*(1/12.0f);
- }*/
- //side ones don't work, use 3 point
-}
-
-//implement an arbitrary derivative
-//dumb algorithm
-template < class T >
-void DerivativeApprox(T &df, const T f[], const Real t[], int npoints, int indexval)
-{
- /*
- Lj(x) = PI_i!=j (x - xi) / PI_i!=j (xj - xi)
-
- so Lj'(x) = SUM_k PI_i!=j|k (x - xi) / PI_i!=j (xj - xi)
- */
-
- unsigned int i,j,k,i0,i1;
-
- Real Lpj,mult,div,tj;
- Real tval = t[indexval];
-
- //sum k
- for(j=0;j<npoints;++j)
- {
- Lpj = 0;
- div = 1;
- tj = t[j];
-
- for(k=0;k<npoints;++k)
- {
- if(k != j) //because there is no summand for k == j, since that term is missing from the original equation
- {
- //summation for k
- for(i=0;i<npoints;++i)
- {
- if(i != k)
- {
- mult *= tval - t[i];
- }
- }
-
- Lpj += mult; //add into the summation
-
- //since the ks follow the exact patern we need for the divisor (use that too)
- div *= tj - t[k];
- }
- }
-
- //get the actual coefficient
- Lpj /= div;
-
- //add it in to the equation
- df += f[j]*Lpj;
- }
-}
-
-//END numerical derivatives
-
-template < class T >
-inline int sign(T f, T tol)
-{
- if(f < -tol) return -1;
- if(f > tol) return 1;
- return 0;
-}
-
-void GetFirstDerivatives(const std::vector<sinfg::Point> &f, unsigned int left, unsigned int right, char *out, unsigned int dfstride)
-{
- unsigned int current = left;
-
- if(right - left < 2)
- return;
- else if(right - left < 3)
- {
- sinfg::Vector v = f[left+1] - f[left];
-
- //set both to the one we want
- *(sinfg::Vector*)out = v;
- out += dfstride;
- *(sinfg::Vector*)out = v;
- out += dfstride;
- }
- else if(right - left < 6/*5*/) //should use 3 point
- {
- //left then middle then right
- ThreePointdt(*(sinfg::Vector*)out,f[left+0], f[left+1], f[left+2], -1);
- current += 1;
- out += dfstride;
-
- for(;current < right-1; current++, out += dfstride)
- {
- ThreePointdt(*(sinfg::Vector*)out,f[current-1], f[current], f[current+1], 0);
- }
-
- ThreePointdt(*(sinfg::Vector*)out,f[right-3], f[right-2], f[right-1], 1);
- current++;
- out += dfstride;
-
- }else //can use 5 point
- {
- //left 2 then middle bunch then right two
- //may want to use 3 point for inner edge ones
-
- FivePointdt(*(sinfg::Vector*)out,f[left+0], f[left+1], f[left+2], f[left+3], f[left+4], -2);
- out += dfstride;
- FivePointdt(*(sinfg::Vector*)out,f[left+1], f[left+2], f[left+3], f[left+4], f[left+5], -1);
- out += dfstride;
- current += 2;
-
- for(;current < right-2; current++, out += dfstride)
- {
- FivePointdt(*(sinfg::Vector*)out,f[current-2], f[current-1], f[current], f[current+1], f[current+2], 0);
- }
-
- FivePointdt(*(sinfg::Vector*)out,f[right-5], f[right-4], f[right-3], f[right-2], f[right-1], 1);
- out += dfstride;
- FivePointdt(*(sinfg::Vector*)out,f[right-6], f[right-5], f[right-4], f[right-3], f[right-2], 2);
- out += dfstride;
- current += 2;
- }
-}
-
-void GetSimpleDerivatives(const std::vector<sinfg::Point> &f, int left, int right,
- std::vector<sinfg::Point> &df, int outleft,
- const std::vector<sinfg::Real> &di)
-{
- int i1,i2,i;
- int offset = 2; //df = 1/2 (f[i+o]-f[i-o])
-
- assert((int)df.size() >= right-left+outleft); //must be big enough
-
- for(i = left; i < right; ++i)
- {
- //right now indices (figure out distance later)
- i1 = std::max(left,i-offset);
- i2 = std::max(left,i+offset);
-
- df[outleft++] = (f[i2] - f[i1])*0.5f;
- }
-}
-
-//get the curve error from the double sample list of work points (hopefully that's enough)
-Real CurveError(const sinfg::Point *pts, unsigned int n, std::vector<sinfg::Point> &work, int left, int right)
-{
- if(right-left < 2) return -1;
-
- int i,j;
-
- //get distances to each point
- Real d,dtemp,dsum;
- //sinfg::Vector v,vt;
- //sinfg::Point p1,p2;
- sinfg::Point pi;
- std::vector<sinfg::Point>::const_iterator it;//,end = work.begin()+right;
-
- //unsigned int size = work.size();
-
- //for each line, get distance
- d = 0; //starts at 0
- for(i = 0; i < (int)n; ++i)
- {
- pi = pts[i];
-
- dsum = FLT_MAX;
-
- it = work.begin()+left;
- //p2 = *it++; //put it at left+1
- for(j = left/*+1*/; j < right; ++j,++it)
- {
- /*p1 = p2;
- p2 = *it;
-
- v = p2 - p1;
- vt = pi - p1;
-
- dtemp = v.mag_squared() > 1e-12 ? (vt*v)/v.mag_squared() : 0; //get the projected time value for the current line
-
- //get distance to line segment with the time value clamped 0-1
- if(dtemp >= 1) //use p+v
- {
- vt += v; //makes it pp - (p+v)
- }else if(dtemp > 0) //use vt-proj
- {
- vt -= v*dtemp; // vt - proj_v(vt) //must normalize the projection vector to work
- }
-
- //else use p
- dtemp = vt.mag_squared();*/
-
- dtemp = (pi - *it).mag_squared();
- if(dtemp < dsum)
- dsum = dtemp;
- }
-
- //accumulate the points' min distance from the curve
- d += sqrt(dsum);
- }
-
- return d;
-}
-
-typedef sinfgapp::BLineConverter::cpindex cpindex;
-
-//has the index data and the tangent scale data (relevant as it may be)
-int tesselate_curves(const std::vector<cpindex> &inds, const std::vector<Point> &f, const std::vector<sinfg::Vector> &df, std::vector<Point> &work)
-{
- if(inds.size() < 2)
- return 0;
-
- etl::hermite<Point> curve;
- int ntess = 0;
-
- std::vector<cpindex>::const_iterator j = inds.begin(),j2, end = inds.end();
-
- unsigned int ibase = inds[0].curind;
-
- j2 = j++;
- for(; j != end; j2 = j++)
- {
- //if this curve has invalid error (in j) then retesselate it's work points (requires reparametrization, etc.)
- if(j->error < 0)
- {
- //get the stepsize etc. for the number of points in here
- unsigned int n = j->curind - j2->curind + 1; //thats the number of points in the span
- unsigned int k, kend, i0, i3;
- //so reset the right chunk
-
- Real t, dt = 1/(Real)(n*2-2); //assuming that they own only n points
-
- //start at first intermediate
- t = 0;
-
- i0 = j2->curind; i3 = j->curind;
- k = (i0-ibase)*2; //start on first intermediary point (2x+1)
- kend = (i3-ibase)*2; //last point to set (not intermediary)
-
- //build hermite curve, it's easier
- curve.p1() = f[i0];
- curve.p2() = f[i3];
- curve.t1() = df[i0]*(df[i0].mag_squared() > 1e-4 ? j2->tangentscale/df[i0].mag() : j2->tangentscale);
- curve.t2() = df[i3]*(df[i3].mag_squared() > 1e-4 ? j->tangentscale/df[i3].mag() : j->tangentscale);
- curve.sync();
-
- //MUST include the end point (since we are ignoring left one)
- for(; k < kend; ++k, t += dt)
- {
- work[k] = curve(t);
- }
-
- work[k] = curve(1); //k == kend, t == 1 -> c(t) == p2
- ++ntess;
- }
- }
-
- return ntess;
-}
-
-sinfgapp::BLineConverter::BLineConverter()
-{
- pixelwidth = 1;
- smoothness = 0.70f;
- width = 0;
-};
-
-void
-sinfgapp::BLineConverter::clear()
-{
- f.clear();
- f_w.clear();
- ftemp.clear();
- df.clear();
- cvt.clear();
- brk.clear();
- di.clear();
- d_i.clear();
- work.clear();
- curind.clear();
-}
-
-void
-sinfgapp::BLineConverter::operator () (std::list<sinfg::BLinePoint> &out, const std::list<sinfg::Point> &in,const std::list<sinfg::Real> &in_w)
-{
- //Profiling information
- /*etl::clock::value_type initialprocess=0, curveval=0, breakeval=0, disteval=0;
- etl::clock::value_type preproceval=0, tesseval=0, erroreval=0, spliteval=0;
- unsigned int numpre=0, numtess=0, numerror=0, numsplit=0;
- etl::clock_realtime timer,total;*/
-
- //total.reset();
- if(in.size()<=1)
- return;
-
- clear();
-
- //removing digitization error harder than expected
-
- //intended to fix little pen errors caused by the way people draw (tiny juts in opposite direction)
- //Different solutions
- // Average at both end points (will probably eliminate many points at each end of the samples)
- // Average after the break points are found (weird points would still affect the curve)
- // Just always get rid of breaks at the beginning and end if they are a certain distance apart
- // This is will be current approach so all we do now is try to remove duplicate points
-
- //remove duplicate points - very bad for fitting
-
- //timer.reset();
-
- {
- std::list<sinfg::Point>::const_iterator i = in.begin(), end = in.end();
- std::list<sinfg::Real>::const_iterator iw = in_w.begin();
- sinfg::Point c;
-
- if(in.size() == in_w.size())
- {
- for(;i != end; ++i,++iw)
- {
- //eliminate duplicate points
- if(*i != c)
- {
- f.push_back(c = *i);
- f_w.push_back(*iw);
- }
- }
- }else
- {
- for(;i != end; ++i)
- {
- //eliminate duplicate points
- if(*i != c)
- {
- f.push_back(c = *i);
- }
- }
- }
- }
- //initialprocess = timer();
-
- if(f.size()<=6)
- return;
-
- //get curvature information
- //timer.reset();
-
- {
- int i,i0,i1;
- sinfg::Vector v1,v2;
-
- cvt.resize(f.size());
-
- cvt.front() = 1;
- cvt.back() = 1;
-
- for(i = 1; i < (int)f.size()-1; ++i)
- {
- i0 = std::max(0,i - 2);
- i1 = std::min((int)(f.size()-1),i + 2);
-
- v1 = f[i] - f[i0];
- v2 = f[i1] - f[i];
-
- cvt[i] = (v1*v2)/(v1.mag()*v2.mag());
- }
- }
-
- //curveval = timer();
- //sinfg::info("calculated curvature");
-
- //find corner points and interpolate inside those
- //timer.reset();
- {
- //break at sharp derivative points
- //TODO tolerance should be set based upon digitization resolution (length dependent index selection)
- Real tol = 0; //break tolerance, for the cosine of the change in angle (really high curvature or something)
- Real fixdistsq = 4*width*width; //the distance to ignore breaks at the end points (for fixing stuff)
- unsigned int i = 0;
-
- int maxi = -1, last=0;
- Real minc = 1;
-
- brk.push_back(0);
-
- for(i = 1; i < cvt.size()-1; ++i)
- {
- //insert if too sharp (we need to break the tangents to insert onto the break list)
-
- if(cvt[i] < tol)
- {
- if(cvt[i] < minc)
- {
- minc = cvt[i];
- maxi = i;
- }
- }else if(maxi >= 0)
- {
- if(maxi >= last + 8)
- {
- //sinfg::info("break: %d-%d",maxi+1,cvt.size());
- brk.push_back(maxi);
- last = maxi;
- }
- maxi = -1;
- minc = 1;
- }
- }
-
- brk.push_back(i);
-
- //postprocess for breaks too close to eachother
- Real d = 0;
- Point p = f[brk.front()];
-
- //first set
- for(i = 1; i < brk.size()-1; ++i) //do not want to include end point...
- {
- d = (f[brk[i]] - p).mag_squared();
- if(d > fixdistsq) break; //don't want to group breaks if we ever get over the dist...
- }
- //want to erase all points before...
- if(i != 1)
- brk.erase(brk.begin(),brk.begin()+i-1);
-
- //end set
- p = f[brk.back()];
- for(i = brk.size()-2; i > 0; --i) //start at one in from the end
- {
- d = (f[brk[i]] - p).mag_squared();
- if(d > fixdistsq) break; //don't want to group breaks if we ever get over the dist
- }
- if(i != brk.size()-2)
- brk.erase(brk.begin()+i+2,brk.end()); //erase all points that we found... found none if i has not advanced
- //must not include the one we ended up on
- }
- //breakeval = timer();
- //sinfg::info("found break points: %d",brk.size());
-
- //get the distance calculation of the entire curve (for tangent scaling)
-
- //timer.reset();
- {
- sinfg::Point p1,p2;
-
- p1=p2=f[0];
-
- di.resize(f.size()); d_i.resize(f.size());
- Real d = 0;
- for(unsigned int i = 0; i < f.size();)
- {
- d += (d_i[i] = (p2-p1).mag());
- di[i] = d;
-
- p1=p2;
- p2=f[++i];
- }
- }
- //disteval = timer();
- //sinfg::info("calculated distance");
-
- //now break at every point - calculate new derivatives each time
-
- //TODO
- //must be sure that the break points are 3 or more apart
- //then must also store the breaks which are not smooth, etc.
- //and figure out tangents between there
-
- //for each pair of break points (as long as they are far enough apart) recursively subdivide stuff
- //ignore the detected intermediate points
- {
- unsigned int i0=0,i3=0,is=0;
- int i=0,j=0;
-
- bool done = false;
-
- Real errortol = smoothness*pixelwidth; //???? what the hell should this value be
-
- BLinePoint a;
- sinfg::Vector v;
-
- //intemp = f; //don't want to smooth out the corners
-
- bool breaktan = false, setwidth;
- a.set_split_tangent_flag(false);
- //a.set_width(width);
- a.set_width(1.0f);
-
- setwidth = (f.size() == f_w.size());
-
- for(j = 0; j < (int)brk.size() - 1; ++j)
- {
- //for b[j] to b[j+1] subdivide and stuff
- i0 = brk[j];
- i3 = brk[j+1];
-
- unsigned int size = i3-i0+1; //must include the end points
-
- //new derivatives
- //timer.reset();
- ftemp.assign(f.begin()+i0, f.begin()+i3+1);
- for(i=0;i<20;++i)
- gaussian_blur_3(ftemp.begin(),ftemp.end(),false);
-
- df.resize(size);
- GetFirstDerivatives(ftemp,0,size,(char*)&df[0],sizeof(df[0]));
- //GetSimpleDerivatives(ftemp,0,size,df,0,di);
- //< don't have to worry about indexing stuff as it is all being taken car of right now
- //preproceval += timer();
- //numpre++;
-
- work.resize(size*2-1); //guarantee that all points will be tesselated correctly (one point inbetween every 2 adjacent points)
-
- //if size of work is size*2-1, the step size should be 1/(size*2 - 2)
- //Real step = 1/(Real)(size*2 - 1);
-
- //start off with break points as indices
- curind.clear();
- curind.push_back(cpindex(i0,di[i3]-di[i0],0)); //0 error because no curve on the left
- curind.push_back(cpindex(i3,di[i3]-di[i0],-1)); //error needs to be reevaluated
- done = false; //we want to loop
-
- unsigned int dcount = 0;
-
- //while there are still enough points between us, and the error is too high subdivide (and invalidate neighbors that share tangents)
- while(!done)
- {
- //tesselate all curves with invalid error values
- work[0] = f[i0];
-
- //timer.reset();
- /*numtess += */tesselate_curves(curind,f,df,work);
- //tesseval += timer();
-
- //now get all error values
- //timer.reset();
- for(i = 1; i < (int)curind.size(); ++i)
- {
- if(curind[i].error < 0) //must have been retesselated, so now recalculate error value
- {
- //evaluate error from points (starting at current index)
- int size = curind[i].curind - curind[i-1].curind + 1;
- curind[i].error = CurveError(&f[curind[i-1].curind], size,
- work,(curind[i-1].curind - i0)*2,(curind[i].curind - i0)*2+1);
-
- /*if(curind[i].error > 1.0e5)
- {
- sinfg::info("Holy crap %d-%d error %f",curind[i-1].curind,curind[i].curind,curind[i].error);
- curind[i].error = -1;
- numtess += tesselate_curves(curind,f,df,work);
- curind[i].error = CurveError(&f[curind[i-1].curind], size,
- work,0,work.size());//(curind[i-1].curind - i0)*2,(curind[i].curind - i0)*2+1);
- }*/
- //numerror++;
- }
- }
- //erroreval += timer();
-
- //assume we're done
- done = true;
-
- //check each error to see if it's too big, if so, then subdivide etc.
- int indsize = (int)curind.size();
- Real maxrelerror = 0;
- int maxi = -1;//, numpoints;
-
- //timer.reset();
- //get the maximum error and split there
- for(i = 1; i < indsize; ++i)
- {
- //numpoints = curind[i].curind - curind[i-1].curind + 1;
-
- if(curind[i].error > maxrelerror && curind[i].curind - curind[i-1].curind > 2) //only accept if it's valid
- {
- maxrelerror = curind[i].error;
- maxi = i;
- }
- }
-
- //split if error is too great
- if(maxrelerror > errortol)
- {
- //add one to the left etc
- unsigned int ibase = curind[maxi-1].curind, itop = curind[maxi].curind,
- ibreak = (ibase + itop)/2;
- Real scale, scale2;
-
- assert(ibreak < f.size());
-
- //sinfg::info("Split %d -%d- %d, error: %f", ibase,ibreak,itop,maxrelerror);
-
- if(ibase != itop)
- {
- //invalidate current error of the changed tangents and add an extra segment
- //enforce minimum tangents property
- curind[maxi].error = -1;
- curind[maxi-1].error = -1;
- if(maxi+1 < indsize) curind[maxi+1].error = -1; //if there is a curve segment beyond this it will be effected as well
-
- scale = di[itop] - di[ibreak];
- scale2 = maxi+1 < indsize ? di[curind[maxi+1].curind] - di[itop] : scale; //to the right valid?
- curind[maxi].tangentscale = std::min(scale, scale2);
-
- scale = di[ibreak] - di[ibase];
- scale2 = maxi >= 2 ? di[ibase] - di[curind[maxi-2].curind] : scale; // to the left valid -2 ?
- curind[maxi-1].tangentscale = std::min(scale, scale2);
-
- scale = std::min(di[ibreak] - di[ibase], di[itop] - di[ibreak]);
-
- curind.insert(curind.begin()+maxi,cpindex(ibreak, scale, -1));
- //curind.push_back(cpindex(ibreak, scale, -1));
- //std::sort(curind.begin(), curind.end());
-
- done = false;
- //numsplit++;
- }
- }
- //spliteval += timer();
-
- dcount++;
- }
-
- //insert the last point too (just set tangent for now
- is = curind[0].curind;
-
- //first point inherits current tangent status
- v = df[is - i0];
- if(v.mag_squared() > EPSILON)
- v *= (curind[0].tangentscale/v.mag());
-
- if(!breaktan)
- a.set_tangent(v);
- else a.set_tangent2(v);
-
- a.set_vertex(f[is]);
- if(setwidth)a.set_width(f_w[is]);
-
- out.push_back(a);
- a.set_split_tangent_flag(false); //won't need to break anymore
- breaktan = false;
-
- for(i = 1; i < (int)curind.size()-1; ++i)
- {
- is = curind[i].curind;
-
- //first point inherits current tangent status
- v = df[is-i0];
- if(v.mag_squared() > EPSILON)
- v *= (curind[i].tangentscale/v.mag());
-
- a.set_tangent(v); // always inside, so guaranteed to be smooth
- a.set_vertex(f[is]);
- if(setwidth)a.set_width(f_w[is]);
-
- out.push_back(a);
- }
-
- //set the last point's data
- is = curind.back().curind; //should already be this
-
- v = df[is-i0];
- if(v.mag_squared() > EPSILON)
- v *= (curind.back().tangentscale/v.mag());
-
- a.set_tangent1(v);
- a.set_split_tangent_flag(true);
- breaktan = true;
-
- //will get the vertex and tangent 2 from next round
- }
-
- a.set_vertex(f[i3]);
- a.set_split_tangent_flag(false);
- if(setwidth)
- a.set_width(f_w[i3]);
- out.push_back(a);
-
- /*etl::clock::value_type totaltime = total(),
- misctime = totaltime - initialprocess - curveval - breakeval - disteval
- - preproceval - tesseval - erroreval - spliteval;
-
- sinfg::info(
- "Curve Convert Profile:\n"
- "\tInitial Preprocess: %f\n"
- "\tCurvature Calculation: %f\n"
- "\tBreak Calculation: %f\n"
- "\tDistance Calculation: %f\n"
- " Algorithm: (numtimes,totaltime)\n"
- "\tPreprocess step: (%d,%f)\n"
- "\tTesselation step: (%d,%f)\n"
- "\tError step: (%d,%f)\n"
- "\tSplit step: (%d,%f)\n"
- " Num Input: %d, Num Output: %d\n"
- " Total time: %f, Misc time: %f\n",
- initialprocess, curveval,breakeval,disteval,
- numpre,preproceval,numtess,tesseval,numerror,erroreval,numsplit,spliteval,
- in.size(),out.size(),
- totaltime,misctime);*/
-
- return;
- }
-}
-
-void sinfgapp::BLineConverter::EnforceMinWidth(std::list<sinfg::BLinePoint> &bline, sinfg::Real min_pressure)
-{
- std::list<sinfg::BLinePoint>::iterator i = bline.begin(),
- end = bline.end();
-
- for(i = bline.begin(); i != end; ++i)
- {
- if(i->get_width() < min_pressure)
- {
- i->set_width(min_pressure);
- }
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file blineconvert.h
-** \brief Template Header
-**
-** $Id: blineconvert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_BLINE_CONVERT_H
-#define __SINFG_BLINE_CONVERT_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/general.h>
-#include <sinfg/blinepoint.h>
-#include <list>
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class BLineConverter
-{
-public:
- struct cpindex
- {
- int curind;
- sinfg::Real tangentscale;
- sinfg::Real error; //negative error will indicate invalid;
-
- cpindex(int ci, sinfg::Real s=0, sinfg::Real e=-1)
- :curind(ci), tangentscale(s), error(e)
- {}
-
- cpindex(const cpindex & o)
- :curind(o.curind), tangentscale(o.tangentscale), error(o.error)
- {}
-
- const cpindex & operator = (const cpindex & rhs)
- {
- curind = rhs.curind;
- tangentscale = rhs.tangentscale;
- error = rhs.error;
- return *this;
- }
-
- bool operator < (const cpindex &rhs) const
- {
- return curind < rhs.curind;
- }
-
- //point is obviously in[curind]
- //tangent scale will get reset to the smallest (or something else depending on experimentation)
- };
-
-private:
- //cached data
- std::vector<sinfg::Point> f; //the preprocessed input cache
- std::vector<sinfg::Real> f_w;
-
- //temporary point storage for vector calc
- std::vector<sinfg::Point> ftemp;
-
- std::vector<sinfg::Vector> df; //the derivative cache
- std::vector<sinfg::Real> cvt; //the curvature cache
-
- std::vector<int> brk; //the break point cache
-
- std::vector<sinfg::Real> di, //cumulative distance
- d_i; //distance between adjacent segments
-
- std::vector<sinfg::Point> work; //the working point cache for the entire curve
- std::vector<cpindex> curind;
-
- //function parameters
- void clear();
-
-public:
- sinfg::Real width;
-
- //Converter properties
- sinfg::Real pixelwidth;
- sinfg::Real smoothness; //actual error will be smoothness*pixelwidth (for global set pixelwidth = 1)
-
- BLineConverter();
-
- static void EnforceMinWidth(std::list<sinfg::BLinePoint> &bline, sinfg::Real min_pressure);
- void operator ()(std::list<sinfg::BLinePoint> &out, const std::list<sinfg::Point> &in,const std::list<sinfg::Real> &in_w);
-};
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasinterface.cpp
-** \brief Template File
-**
-** $Id: canvasinterface.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-//#include <iostream>
-
-#include <ETL/clock>
-#include <sinfg/valuenode_scale.h>
-#include <sinfg/valuenode_timedswap.h>
-#include <sinfg/valuenode_composite.h>
-#include <sinfg/valuenode_subtract.h>
-#include <sinfg/valuenode_linear.h>
-#include <sinfg/valuenode_reference.h>
-#include <sinfg/valuenode_twotone.h>
-#include <sinfg/valuenode_stripes.h>
-
-#include <sinfg/waypoint.h>
-#include <sinfg/loadcanvas.h>
-#include <sinfg/importer.h>
-#include <sinfg/guidset.h>
-
-#include "canvasinterface.h"
-#include "instance.h"
-
-#include "actions/layeradd.h"
-#include "actions/valuedescconvert.h"
-#include "actions/valuenodeadd.h"
-#include "actions/editmodeset.h"
-#include "action_system.h"
-
-#include "main.h"
-
-#include <sinfg/gradient.h>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-CanvasInterface::CanvasInterface(loose_handle<Instance> instance,handle<Canvas> canvas):
- instance_(instance),
- canvas_(canvas),
- cur_time_(canvas->rend_desc().get_frame_start()),
- mode_(MODE_NORMAL|MODE_ANIMATE_PAST|MODE_ANIMATE_FUTURE)
-{
- set_selection_manager(get_instance()->get_selection_manager());
- set_ui_interface(get_instance()->get_ui_interface());
-}
-
-CanvasInterface::~CanvasInterface()
-{
- sinfg::info("sinfgapp::CanvasInterface::~CanvasInterface(): Deleted");
-}
-
-void
-CanvasInterface::set_time(sinfg::Time x)
-{
- if(get_canvas()->rend_desc().get_frame_rate())
- {
- float fps(get_canvas()->rend_desc().get_frame_rate());
- Time r(x.round(fps));
- //sinfg::info("CanvasInterface::set_time(): %s rounded to %s\n",x.get_string(fps).c_str(),r.get_string(fps).c_str());
- x=r;
- }
- if(cur_time_.is_equal(x))
- return;
- cur_time_=x;
-
- signal_time_changed()();
- signal_dirty_preview()();
-}
-
-sinfg::Time
-CanvasInterface::get_time()const
-{
- return cur_time_;
-}
-
-void
-CanvasInterface::refresh_current_values()
-{
- get_canvas()->set_time(cur_time_);
- signal_time_changed()();
- signal_dirty_preview()();
-}
-
-etl::handle<CanvasInterface>
-CanvasInterface::create(loose_handle<Instance> instance,handle<Canvas> canvas)
-{
- etl::handle<CanvasInterface> intrfc;
- intrfc=new CanvasInterface(instance,canvas);
- instance->canvas_interface_list().push_front(intrfc);
- return intrfc;
-}
-
-void
-CanvasInterface::set_mode(Mode x)
-{
- Action::Handle action(Action::EditModeSet::create());
-
- assert(action);
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("edit_mode",x);
-
- if(!action->is_ready())
- {
- get_ui_interface()->error(_("Action Not Ready, unable to change mode"));
- assert(0);
- return;
- }
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Unable to change mode"));
-
-// mode_=x;
-// signal_mode_changed_(x);
-}
-
-CanvasInterface::Mode
-CanvasInterface::get_mode()const
-{
- return mode_;
-}
-
-
-
-Layer::Handle
-CanvasInterface::add_layer_to(String name, Canvas::Handle canvas, int depth)
-{
- sinfgapp::Action::PassiveGrouper group(get_instance().get(),_("Add Layer To"));
-
- Layer::Handle layer(Layer::create(name));
-
- assert(layer);
-
- if(!layer)
- return 0;
-
- if(canvas!=get_canvas() && !canvas->is_inline())
- {
- sinfg::error("Bad canvas passed to \"add_layer_to\"");
- return 0;
- }
-
- layer->set_canvas(canvas);
-
- // Apply some defaults
- if(layer->set_param("fg",sinfgapp::Main::get_foreground_color()))
- layer->set_param("bg",sinfgapp::Main::get_background_color());
- else
- layer->set_param("color",sinfgapp::Main::get_foreground_color());
-
- layer->set_param("width",sinfgapp::Main::get_bline_width().units(get_canvas()->rend_desc()));
- layer->set_param("gradient",sinfgapp::Main::get_gradient());
- if(name!="zoom")
- layer->set_param("amount",sinfgapp::Main::get_opacity());
- layer->set_param("blend_method",sinfgapp::Main::get_blend_method());
-
- {
- // Grab the layer's list pf parameters
- Layer::ParamList paramlist=layer->get_param_list();
- Layer::ParamList::iterator iter;
- for(iter=paramlist.begin();iter!=paramlist.end();++iter)
- {
- ValueNode::Handle value_node;
-
- if(iter->second.get_type()==ValueBase::TYPE_LIST)
- value_node=LinkableValueNode::create("dynamic_list",iter->second);
- else if(LinkableValueNode::check_type("composite",iter->second.get_type()) &&
- (iter->second.get_type()!=ValueBase::TYPE_COLOR && iter->second.get_type()!=ValueBase::TYPE_VECTOR)
- )
- value_node=LinkableValueNode::create("composite",iter->second);
-
- if(value_node)
- layer->connect_dynamic_param(iter->first,value_node);
- }
- }
-
- // Action to add the layer
- Action::Handle action(Action::LayerAdd::create());
-
- assert(action);
- if(!action)
- return 0;
-
- action->set_param("canvas",canvas);
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("new",layer);
-
- if(!action->is_ready())
- {
- get_ui_interface()->error(_("Action Not Ready"));
- return 0;
- }
-
- if(!get_instance()->perform_action(action))
- {
- get_ui_interface()->error(_("Action Failed."));
- return 0;
- }
-
- sinfg::info("DEPTH=%d",depth);
- // Action to move the layer (if necessary)
- if(depth>0)
- {
- Action::Handle action(Action::create("layer_move"));
-
- assert(action);
- if(!action)
- return 0;
-
- action->set_param("canvas",canvas);
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("layer",layer);
- action->set_param("new_index",depth);
-
- if(!action->is_ready())
- {
- get_ui_interface()->error(_("Move Action Not Ready"));
- return 0;
- }
-
- if(!get_instance()->perform_action(action))
- {
- get_ui_interface()->error(_("Move Action Failed."));
- return 0;
- }
- }
-
-
- return layer;
-}
-
-
-bool
-CanvasInterface::convert(ValueDesc value_desc, String type)
-{
- Action::Handle action(Action::ValueDescConvert::create());
-
- assert(action);
- if(!action)
- return 0;
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("value_desc",value_desc);
- action->set_param("type",type);
-
- if(!action->is_ready())
- {
- get_ui_interface()->error(_("Action Not Ready"));
- return 0;
- }
-
- if(get_instance()->perform_action(action))
- return true;
-
- get_ui_interface()->error(_("Action Failed."));
- return false;
-}
-
-bool
-CanvasInterface::add_value_node(sinfg::ValueNode::Handle value_node, sinfg::String name)
-{
- if(name.empty())
- {
- get_ui_interface()->error(_("Empty name!"));
- return false;
- }
-
- Action::Handle action(Action::ValueNodeAdd::create());
-
- assert(action);
- if(!action)
- return 0;
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("new",value_node);
- action->set_param("name",name);
-
- if(!action->is_ready())
- {
- get_ui_interface()->error(_("Action Not Ready"));
- return 0;
- }
-
- if(get_instance()->perform_action(action))
- return true;
-
- get_ui_interface()->error(_("Action Failed."));
- return false;
-}
-
-Action::ParamList
-CanvasInterface::generate_param_list(const ValueDesc &value_desc)
-{
- sinfgapp::Action::ParamList param_list;
- param_list.add("time",get_time());
- param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
- param_list.add("canvas",get_canvas());
-
- param_list.add("value_desc",value_desc);
-
- if(value_desc.parent_is_value_node())
- param_list.add("parent_value_node",value_desc.get_parent_value_node());
-
- if(value_desc.is_value_node())
- param_list.add("value_node",value_desc.get_value_node());
-
- if(value_desc.is_const())
- param_list.add("value",value_desc.get_value());
-
- if(value_desc.parent_is_layer_param())
- {
- param_list.add("parent_layer",value_desc.get_layer());
- param_list.add("parent_layer_param",value_desc.get_param_name());
- }
-
- {
- sinfgapp::SelectionManager::ChildrenList children_list;
- children_list=get_selection_manager()->get_selected_children();
- if(!value_desc.parent_is_canvas() && children_list.size()==1)
- {
- param_list.add("dest",value_desc);
- param_list.add("src",children_list.front().get_value_node());
- }
- }
- return param_list;
-}
-
-Action::ParamList
-CanvasInterface::generate_param_list(const std::list<sinfgapp::ValueDesc> &value_desc_list)
-{
- sinfgapp::Action::ParamList param_list;
- param_list.add("time",get_time());
- param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
- param_list.add("canvas",get_canvas());
-
- std::list<sinfgapp::ValueDesc>::const_iterator iter;
- for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
- {
- param_list.add("value_desc",*iter);
- if(iter->is_value_node())
- {
- param_list.add("value_node",iter->get_value_node());
- }
- }
-
-
- return param_list;
-}
-
-void
-CanvasInterface::set_rend_desc(const sinfg::RendDesc &rend_desc)
-{
- Action::Handle action(Action::create("canvas_rend_desc_set"));
-
- assert(action);
- if(!action)
- return;
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("rend_desc",rend_desc);
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Action Failed."));
-}
-
-bool
-CanvasInterface::set_name(const String &x)
-{
- //! \todo This needs to be converted into an action
- get_canvas()->set_name(x);
- signal_id_changed_();
- return true;
-}
-
-bool
-CanvasInterface::set_description(const String &x)
-{
- //! \todo This needs to be converted into an action
- get_canvas()->set_description(x);
- return true;
-}
-
-bool
-CanvasInterface::set_id(const String &x)
-{
- //! \todo This needs to be converted into an action
- get_canvas()->set_id(x);
- signal_id_changed_();
- return true;
-}
-
-
-void
-CanvasInterface::jump_to_next_keyframe()
-{
- sinfg::info("Current time: %s",get_time().get_string().c_str());
- try
- {
- sinfg::Keyframe keyframe(*get_canvas()->keyframe_list().find_next(get_time()));
- sinfg::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
- set_time(keyframe.get_time());
- }
- catch(...) { sinfg::warning("Unable to find next keyframe"); }
-}
-
-void
-CanvasInterface::jump_to_prev_keyframe()
-{
- sinfg::info("Current time: %s",get_time().get_string().c_str());
- try
- {
- sinfg::Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(get_time()));
- sinfg::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
- set_time(keyframe.get_time());
- }
- catch(...) { sinfg::warning("Unable to find prev keyframe"); }
-}
-
-bool
-CanvasInterface::import(const sinfg::String &filename, bool copy)
-{
- Action::PassiveGrouper group(get_instance().get(),_("Import Image"));
-
- sinfg::info("Attempting to import "+filename);
-
-
- if(find(filename.begin(),filename.end(),'.')==filename.end())
- {
- get_ui_interface()->error("Filename must have an extension!");
- return false;
- }
-
- String ext(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));
- std::transform(ext.begin(),ext.end(),ext.begin(),&::tolower);
-
- // If this is a SIF file, then we need to do things slightly differently
- if(ext=="sif" || ext=="sifz")try
- {
-
- Canvas::Handle outside_canvas(sinfg::open_canvas(filename));
- if(!outside_canvas)
- throw String(_("Unable to open this composition"));
-
- Layer::Handle layer(add_layer_to("PasteCanvas",get_canvas()));
- if(!layer)
- throw String(_("Unable to create \"PasteCanvas\" layer"));
- if(!layer->set_param("canvas",ValueBase(outside_canvas)))
- throw int();
-
- //layer->set_description(basename(filename));
- signal_layer_new_description()(layer,filename);
- return true;
- }
- catch(String x)
- {
- get_ui_interface()->error(x+" -- "+filename);
- return false;
- }
- catch(...)
- {
- get_ui_interface()->error(_("Uncaught exception when attempting\nto open this composition -- ")+filename);
- return false;
- }
-
-
-
- if(!Importer::book().count(ext))
- {
- get_ui_interface()->error(_("I don't know how to open images of this type -- ")+ext);
- return false;
- }
-
- try
- {
- Layer::Handle layer(add_layer_to("Import",get_canvas()));
- int w,h;
- if(!layer)
- throw int();
- if(!layer->set_param("filename",ValueBase(filename)))
- throw int();
- w=layer->get_param("_width").get(int());
- h=layer->get_param("_height").get(int());
- if(w&&h)
- {
- Vector size=ValueBase(get_canvas()->rend_desc().get_br()-get_canvas()->rend_desc().get_tl());
- Vector x;
- if(size[0]<size[1])
- {
- x[0]=size[0];
- x[1]=size[0]/w*h;
- if(size[0]<0 ^ size[1]<0)
- x[1]=-x[1];
- }
- else
- {
- x[1]=size[1];
- x[0]=size[1]/h*w;
- if(size[0]<0 ^ size[1]<0)
- x[0]=-x[0];
- }
- if(!layer->set_param("tl",ValueBase(-x/2)))
- throw int();
- if(!layer->set_param("br",ValueBase(x/2)))
- throw int();
- }
- else
- {
- if(!layer->set_param("tl",ValueBase(get_canvas()->rend_desc().get_tl())))
- throw int();
- if(!layer->set_param("br",ValueBase(get_canvas()->rend_desc().get_br())))
- throw int();
- }
-
- layer->set_description(basename(filename));
- signal_layer_new_description()(layer,filename);
-
- return true;
- }
- catch(...)
- {
- get_ui_interface()->error("Unable to import "+filename);
- group.cancel();
- return false;
- }
-}
-
-
-void
-CanvasInterface::waypoint_duplicate(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint)
-{
- Action::Handle action(Action::create("waypoint_set_smart"));
-
- assert(action);
- if(!action)
- return;
-
- waypoint.make_unique();
- waypoint.set_time(get_time());
-
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("waypoint",waypoint);
- action->set_param("time",get_time());
- action->set_param("value_node",value_node);
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Action Failed."));
-}
-
-void
-CanvasInterface::waypoint_remove(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint)
-{
- Action::Handle action(Action::create("waypoint_remove"));
-
- assert(action);
- if(!action)
- return;
-
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("waypoint",waypoint);
- action->set_param("value_node",value_node);
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Action Failed."));
-}
-
-
-void
-CanvasInterface::auto_export(ValueNode::Handle value_node)
-{
-/*
- // Check to see if we are already exported.
- if(value_node->is_exported())
- return;
-
- Action::Handle action(Action::create("value_node_add"));
-
- assert(action);
- if(!action)
- return;
-
- String name(strprintf(_("Unnamed%08d"),sinfg::UniqueID().get_uid()));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("new",value_node);
- action->set_param("name",name);
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Action Failed."));
-*/
-}
-
-void
-CanvasInterface::auto_export(const ValueDesc& value_desc)
-{
- // THIS FUNCTION IS DEPRECATED, AND IS NOW A STUB.
-#if 0
- // Check to see if we are already exported.
- if(value_desc.is_exported())
- return;
-
- Action::Handle action(Action::create("value_desc_export"));
-
- assert(action);
- if(!action)
- return;
-
- String name(strprintf(_("Unnamed%08d"),sinfg::UniqueID().get_uid()));
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("value_desc",value_desc);
- action->set_param("name",name);
-
- if(!get_instance()->perform_action(action))
- get_ui_interface()->error(_("Action Failed."));
-#endif
-}
-
-bool
-CanvasInterface::change_value(sinfgapp::ValueDesc value_desc,sinfg::ValueBase new_value)
-{
- // If this isn't really a change, then don't bother
- if(new_value==value_desc.get_value(get_time()))
- return true;
-
- // If this change needs to take place elsewhere, then so be it.
- if(value_desc.get_canvas() && value_desc.get_canvas()->get_root()!=get_canvas()->get_root())do
- {
- etl::handle<Instance> instance;
- instance=find_instance(value_desc.get_canvas()->get_root());
-
- if(instance)
- return instance->find_canvas_interface(value_desc.get_canvas())->change_value(value_desc,new_value);
- else
- {
- get_ui_interface()->error(_("The value you are trying to edit is in a composition\nwhich doesn't seem to be open. Open that composition and you\nshould be able to edit this value as normal."));
- return false;
- }
- }while(0);
-#ifdef _DEBUG
- else
- { sinfg::warning("Can't get canvas from value desc...?"); }
-#endif
-
- sinfgapp::Action::Handle action(sinfgapp::Action::create("value_desc_set"));
- if(!action)
- {
- return false;
- }
-
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
- action->set_param("time",get_time());
- action->set_param("value_desc",value_desc);
- action->set_param("new_value",new_value);
-
- return get_instance()->perform_action(action);
-}
-
-void
-CanvasInterface::set_meta_data(const sinfg::String& key,const sinfg::String& data)
-{
- get_canvas()->set_meta_data(key,data);
-}
-
-
-// this function goes with find_important_value_descs()
-static int
-_process_value_desc(const sinfgapp::ValueDesc& value_desc,std::vector<sinfgapp::ValueDesc>& out, sinfg::GUIDSet& guid_set)
-{
- int ret(0);
-
- if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
- {
- Canvas::Handle canvas;
- canvas=value_desc.get_value().get(canvas);
- if(!canvas || !canvas->is_inline())
- return ret;
- ret+=CanvasInterface::find_important_value_descs(canvas,out,guid_set);
- }
-
- if(value_desc.is_value_node())
- {
- ValueNode::Handle value_node(value_desc.get_value_node());
-
- if(guid_set.count(value_node->get_guid()))
- return ret;
- guid_set.insert(value_node->get_guid());
-
- if(LinkableValueNode::Handle::cast_dynamic(value_node))
- {
- if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
- {
- out.push_back(value_desc);
- ret++;
- }
- // Process the linkable ValueNode's children
- LinkableValueNode::Handle value_node(LinkableValueNode::Handle::cast_dynamic(value_node));
- int i;
- for(i=0;i<value_node->link_count();i++)
- {
- ValueNode::Handle link(value_node->get_link(i));
- if(!link->is_exported())
- ret+=_process_value_desc(ValueDesc(value_node,i),out,guid_set);
- }
- }
- else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
- {
- out.push_back(value_desc);
- ret++;
- }
- }
-
- return ret;
-}
-
-int
-CanvasInterface::find_important_value_descs(sinfg::Canvas::Handle canvas,std::vector<sinfgapp::ValueDesc>& out,sinfg::GUIDSet& guid_set)
-{
- int ret(0);
- if(!canvas->is_inline())
- {
- ValueNodeList::const_iterator iter;
-
- for(
- iter=canvas->value_node_list().begin();
- iter!=canvas->value_node_list().end();
- ++iter)
- ret+=_process_value_desc(ValueDesc(canvas,(*iter)->get_id()),out,guid_set);
- }
-
- Canvas::const_iterator iter;
-
- for(iter=canvas->begin();iter!=canvas->end();++iter)
- {
- Layer::Handle layer(*iter);
-
- Layer::DynamicParamList::const_iterator iter;
- for(
- iter=layer->dynamic_param_list().begin();
- iter!=layer->dynamic_param_list().end();
- ++iter)
- {
- if(!iter->second->is_exported())
- ret+=_process_value_desc(ValueDesc(layer,iter->first),out,guid_set);
- }
- ValueBase value(layer->get_param("canvas"));
- if(value.is_valid())
- ret+=_process_value_desc(ValueDesc(layer,"canvas"),out,guid_set);
- }
-
- return ret;
-}
-
-int
-CanvasInterface::find_important_value_descs(std::vector<sinfgapp::ValueDesc>& out)
-{
- sinfg::GUIDSet tmp;
- return find_important_value_descs(get_canvas(),out,tmp);
-}
-
-void
-CanvasInterface::seek_frame(int frames)
-{
- if(!frames)
- return;
- float fps(get_canvas()->rend_desc().get_frame_rate());
- Time newtime(get_time()+(float)frames/fps);
- newtime=newtime.round(fps);
-
- if(newtime<=get_canvas()->rend_desc().get_frame_start())
- newtime=get_canvas()->rend_desc().get_frame_start();
- if(newtime>=get_canvas()->rend_desc().get_frame_end())
- newtime=get_canvas()->rend_desc().get_frame_end();
- set_time(newtime);
-}
-
-void
-CanvasInterface::seek_time(sinfg::Time time)
-{
- if(!time)
- return;
-
- float fps(get_canvas()->rend_desc().get_frame_rate());
-
- if(time>=sinfg::Time::end())
- {
- set_time(get_canvas()->rend_desc().get_time_end());
- return;
- }
- if(time<=sinfg::Time::begin())
- {
- set_time(get_canvas()->rend_desc().get_time_end());
- return;
- }
-
- Time newtime(get_time()+time);
- newtime=newtime.round(fps);
-
- if(newtime<=get_canvas()->rend_desc().get_time_start())
- newtime=get_canvas()->rend_desc().get_time_start();
- if(newtime>=get_canvas()->rend_desc().get_time_end())
- newtime=get_canvas()->rend_desc().get_time_end();
- set_time(newtime);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file canvasinterface.h
-** \brief Template Header
-**
-** $Id: canvasinterface.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_CANVASINTERFACE_H
-#define __SINFG_APP_CANVASINTERFACE_H
-
-/* === H E A D E R S ======================================================= */
-
-//#include <sinfg/canvas.h>
-#include <sinfg/value.h>
-#include <sigc++/signal.h>
-#include <sigc++/object.h>
-#include <list>
-#include "selectionmanager.h"
-#include "uimanager.h"
-#include "value_desc.h"
-#include "editmode.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfg { class ValueNode_DynamicList; class Waypoint; class GUIDSet; class Canvas; };
-
-namespace sinfgapp {
-
-namespace Action { class ParamList; class Param; class EditModeSet; };
-
-class Instance;
-class ValueDesc;
-
-class CanvasInterface : public etl::shared_object, public sigc::trackable
-{
- friend class Instance;
- friend class Action::EditModeSet;
-
-public:
-
- typedef EditMode Mode;
-
-private:
- // Constructor is private to force the use of the "create()" constructor.
- CanvasInterface(etl::loose_handle<Instance> instance,etl::handle<sinfg::Canvas> canvas);
-
-private:
- etl::loose_handle<Instance> instance_;
- etl::handle<sinfg::Canvas> canvas_;
- etl::handle<SelectionManager> selection_manager_;
- etl::handle<UIInterface> ui_interface_;
- sinfg::Time cur_time_;
- Mode mode_;
-
- sigc::signal<void,sinfg::Layer::Handle> signal_layer_raised_;
- sigc::signal<void,sinfg::Layer::Handle> signal_layer_lowered_;
- sigc::signal<void,sinfg::Layer::Handle,int> signal_layer_inserted_;
- sigc::signal<void,sinfg::Layer::Handle,int,sinfg::Canvas::Handle> signal_layer_moved_;
- sigc::signal<void,sinfg::Layer::Handle> signal_layer_removed_;
- sigc::signal<void,sinfg::Layer::Handle,bool> signal_layer_status_changed_;
- sigc::signal<void,sinfg::Layer::Handle,sinfg::String> signal_layer_new_description_;
- sigc::signal<void,sinfg::Canvas::Handle> signal_canvas_added_;
- sigc::signal<void,sinfg::Canvas::Handle> signal_canvas_removed_;
-
- sigc::signal<void,sinfg::ValueNode::Handle> signal_value_node_added_;
- sigc::signal<void,sinfg::ValueNode::Handle> signal_value_node_deleted_;
- sigc::signal<void,sinfg::ValueNode::Handle> signal_value_node_changed_;
- sigc::signal<void,sinfg::ValueNode::Handle,sinfg::ValueNode::Handle> signal_value_node_replaced_;
-
- sigc::signal<void,sinfg::Keyframe> signal_keyframe_added_;
- sigc::signal<void,sinfg::Keyframe> signal_keyframe_removed_;
- sigc::signal<void,sinfg::Keyframe> signal_keyframe_changed_;
-
- sigc::signal<void> signal_id_changed_;
-
- sigc::signal<void> signal_time_changed_;
-
- sigc::signal<void> signal_rend_desc_changed_;
-
- sigc::signal<void,Mode> signal_mode_changed_;
-
- //sigc::signal<void> signal_dirty_preview_;
-
- sigc::signal<void,sinfg::Layer::Handle,sinfg::String> signal_layer_param_changed_;
-
-public: // Signal Interface
-
- sigc::signal<void,sinfg::Layer::Handle,int,sinfg::Canvas::Handle>& signal_layer_moved() { return signal_layer_moved_; }
-
- sigc::signal<void,sinfg::Layer::Handle,sinfg::String>& signal_layer_new_description() { return signal_layer_new_description_; }
-
- //! Signal called when layer is raised.
- sigc::signal<void,sinfg::Layer::Handle>& signal_layer_raised() { return signal_layer_raised_; }
-
- //! Signal called when layer is lowered.
- sigc::signal<void,sinfg::Layer::Handle>& signal_layer_lowered() { return signal_layer_lowered_; }
-
- //! Signal called when layer has been inserted at a given position.
- sigc::signal<void,sinfg::Layer::Handle,int>& signal_layer_inserted() { return signal_layer_inserted_; }
-
- //! Signal called when a layer has been removed from the canvas.
- sigc::signal<void,sinfg::Layer::Handle>& signal_layer_removed() { return signal_layer_removed_; }
-
- //! Signal called when the layer's active status has changed.
- sigc::signal<void,sinfg::Layer::Handle,bool>& signal_layer_status_changed() { return signal_layer_status_changed_; }
-
- //! Signal called when a canvas has been added.
- sigc::signal<void,etl::handle<sinfg::Canvas> >& signal_canvas_added() { return signal_canvas_added_; }
-
- //! Signal called when a canvas has been removed.
- sigc::signal<void,etl::handle<sinfg::Canvas> >& signal_canvas_removed() { return signal_canvas_removed_; }
-
- //! Signal called when a layer's parameter has been changed
- sigc::signal<void,sinfg::Layer::Handle,sinfg::String>& signal_layer_param_changed() { return signal_layer_param_changed_; }
-
- //! Signal called when the canvas's preview needs to be updated
- //sigc::signal<void>& signal_dirty_preview() { return signal_dirty_preview_; }
- sigc::signal<void>& signal_dirty_preview() { return get_canvas()->signal_dirty(); }
-
- sigc::signal<void,etl::handle<sinfg::ValueNode>,etl::handle<sinfg::ValueNode> >&
- signal_value_node_child_added() { return get_canvas()->signal_value_node_child_added(); }
- sigc::signal<void,etl::handle<sinfg::ValueNode>,etl::handle<sinfg::ValueNode> >&
- signal_value_node_child_removed() { return get_canvas()->signal_value_node_child_removed(); }
-
- //! Signal called when a ValueNode has changed
- sigc::signal<void,etl::handle<sinfg::ValueNode> >& signal_value_node_added() { return signal_value_node_added_; }
-
- //! Signal called when a ValueNode has been deleted
- sigc::signal<void,etl::handle<sinfg::ValueNode> >& signal_value_node_deleted() { return signal_value_node_deleted_; }
-
- //! Signal called when a ValueNode has been changed
- sigc::signal<void,etl::handle<sinfg::ValueNode> >& signal_value_node_changed() { return get_canvas()->signal_value_node_changed(); }
- //sigc::signal<void,etl::handle<sinfg::ValueNode> >& signal_value_node_changed() { return signal_value_node_changed_; }
-
- //! Signal called when the mode has changed
- sigc::signal<void,Mode> signal_mode_changed() { return signal_mode_changed_; }
-
- //! Signal called when a the ID has been changed
- sigc::signal<void>& signal_id_changed() { return signal_id_changed_; }
-
- //! Signal called whenever the time changes
- sigc::signal<void> signal_time_changed() { return signal_time_changed_; }
-
- //! Signal called whenever a data node has been replaced.
- /*! Second ValueNode replaces first */
- sigc::signal<void,sinfg::ValueNode::Handle,sinfg::ValueNode::Handle>& signal_value_node_replaced()
- { return signal_value_node_replaced_; }
-
- //! Signal called whenever the RendDesc changes
- sigc::signal<void>& signal_rend_desc_changed() { return signal_rend_desc_changed_; }
-
- sigc::signal<void,sinfg::Keyframe>& signal_keyframe_added() { return signal_keyframe_added_; }
-
- sigc::signal<void,sinfg::Keyframe>& signal_keyframe_removed() { return signal_keyframe_removed_; }
-
- sigc::signal<void,sinfg::Keyframe>& signal_keyframe_changed() { return signal_keyframe_changed_; }
-
-public:
-
- void auto_export(const ValueDesc& value_desc);
-
- void auto_export(sinfg::ValueNode::Handle value_node);
-
- void set_meta_data(const sinfg::String& key,const sinfg::String& data);
-
- //! Changes the current SelectionManager object
- void set_selection_manager(const etl::handle<SelectionManager> &sm) { selection_manager_=sm; }
-
- //! Disables the selection manager
- void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
-
- //! Returns a handle to the current SelectionManager
- const etl::handle<SelectionManager> &get_selection_manager()const { return selection_manager_; }
-
- //! Changes the current UIInterface object
- void set_ui_interface(const etl::handle<UIInterface> &uim) { ui_interface_=uim; }
-
- //! Disables the UIInterface
- void unset_ui_interface() { ui_interface_=new DefaultUIInterface(); }
-
- //! Returns a handle to the current UIInterface
- const etl::handle<UIInterface> &get_ui_interface() { return ui_interface_; }
-
- //! Returns the Canvas associated with this interface
- etl::handle<sinfg::Canvas> get_canvas()const { return canvas_; }
-
- //! Returns the Instance associated with this interface
- etl::loose_handle<Instance> get_instance()const { return instance_; }
-
- //! Changes the name of the canvas. Undoable.
- bool set_name(const sinfg::String &x);
-
- //! Changes the description of the canvas. Undoable.
- bool set_description(const sinfg::String &x);
-
- //! Changes the ID of the canvas. Undoable.
- bool set_id(const sinfg::String &x);
-
- //! Convience function to retrieve the name of the canvas
- sinfg::String get_name()const { return get_canvas()->get_name(); }
-
- //! Convience function to retrieve the description of the canvas
- sinfg::String get_description()const { return get_canvas()->get_description(); }
-
- //! Convience function to retrieve the ID of the canvas
- sinfg::String get_id()const { return get_canvas()->get_id(); }
-
- //! Sets the current time
- void set_time(sinfg::Time x);
-
- //! Retrieves the current time
- sinfg::Time get_time()const;
-
- //! Changes the current time to the next keyframe
- void jump_to_next_keyframe();
-
- //! Changes the current time to the next keyframe
- void jump_to_prev_keyframe();
-
- void seek_frame(int frames);
-
- void seek_time(sinfg::Time time);
-
- //! \writeme
- void refresh_current_values();
-
- //! Sets the current editing mode
- /*! \see Mode */
- void set_mode(Mode x);
-
- //! Retrieves the current editing mode
- /*! \see Mode */
- Mode get_mode()const;
-
- //! Creates a new layer, of type \c id at the top of the layer stack
- sinfg::Layer::Handle add_layer(sinfg::String id) { return add_layer_to(id,get_canvas()); }
-
- sinfg::Layer::Handle add_layer_to(sinfg::String id,sinfg::Canvas::Handle canvas, int depth=0);
-
- bool convert(ValueDesc value_desc, sinfg::String type);
- //! Adds the given ValueNode to the canvas.
- bool add_value_node(sinfg::ValueNode::Handle value_node, sinfg::String name);
-
-
- Action::ParamList generate_param_list(const sinfgapp::ValueDesc &);
-
- Action::ParamList generate_param_list(const std::list<sinfgapp::ValueDesc> &);
-
- void set_rend_desc(const sinfg::RendDesc &rend_desc);
-
- bool import(const sinfg::String &filename, bool copy=false);
-
-
- void waypoint_duplicate(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint);
-
- void waypoint_remove(sinfgapp::ValueDesc value_desc,sinfg::Waypoint waypoint);
-
- bool change_value(sinfgapp::ValueDesc value_desc,sinfg::ValueBase new_value);
-
-
- int find_important_value_descs(std::vector<sinfgapp::ValueDesc>& out);
- static int find_important_value_descs(sinfg::Canvas::Handle canvas,std::vector<sinfgapp::ValueDesc>& out,sinfg::GUIDSet& guid_set);
-
- ~CanvasInterface();
-
- static etl::handle<CanvasInterface> create(etl::loose_handle<Instance> instance,etl::handle<sinfg::Canvas> canvas);
-}; // END of class CanvasInterface
-
-/*! \class PushMode
-** \brief Class that changes the mode of a CanvasInterface, and restores it on destruction.
-*/
-class PushMode
-{
- CanvasInterface* canvas_interface_;
- CanvasInterface::Mode old_mode_;
-public:
- PushMode(etl::loose_handle<CanvasInterface> c, CanvasInterface::Mode mode):
- canvas_interface_(c.get()), old_mode_(canvas_interface_->get_mode())
- { canvas_interface_->set_mode(mode); }
-
- ~PushMode() { canvas_interface_->set_mode(old_mode_); }
-}; // END of class PushMode
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file cvs.cpp
-** \brief Template File
-**
-** $Id: cvs.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "cvs.h"
-#include <ETL/stringf>
-#include <fstream>
-#include <iostream>
-#include <sinfg/general.h>
-#include <stdlib.h>
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-//#include <unistd.h>
-
-#include <cassert>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-#define cvs_command sinfg::String("cvs -z4")
-
-#ifndef WIN32
-#define HAVE_STRPTIME
-#endif
-
-#ifdef __APPLE__
-time_t _daylight_() { time_t t(time(0)); return localtime(&t)->tm_gmtoff; }
-#define daylight _daylight_()
-#endif
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-CVSInfo::CVSInfo(const sinfg::String& file_name)
-{
- update_available_=false;
- set_file_name(file_name);
-}
-
-CVSInfo::CVSInfo()
-{
- update_available_=false;
-}
-
-CVSInfo::~CVSInfo()
-{
-}
-
-void
-CVSInfo::set_file_name(const sinfg::String& file_name)
-{
- file_name_=file_name;
-
- std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str());
-
- if(file)
- {
- in_sandbox_=true;
- calc_repository_info();
- }
- else
- in_sandbox_=false;
-}
-
-void
-CVSInfo::calc_repository_info()
-{
-#ifdef _DEBUG
- sinfg::info("in_sandbox() = %d",in_sandbox());
-#endif
-
- if(!in_sandbox_)
- return;
-
- std::ifstream file((dirname(file_name_)+"/CVS/Entries").c_str());
-
- while(file)
- {
- String line;
- getline(file,line);
- if(line.find(basename(file_name_))!=String::npos)
- {
- in_repository_=true;
- String::size_type s,f;
-
- // Grab the version
- s=line.find('/',1);
- assert(s!=String::npos);
- s++;
- f=line.find('/',s+1);
- assert(f!=String::npos);
- cvs_version_=String(line,s,f-s);
-
- // Grab the time
-#ifdef HAVE_STRPTIME
- s=f+1;
- f=line.find('/',s+1);
- assert(f!=String::npos);
- tm time_struct;
- strptime(String(line,s,f-s).c_str(),"%c",&time_struct);
- original_timestamp_=mktime(&time_struct);
-#endif
-
- if(
- system(strprintf(
- "cd '%s' && cvs status '%s' | grep -q -e 'Needs Patch'",
- dirname(file_name_).c_str(),
- basename(file_name_).c_str()
- ).c_str())==0
- )
- {
- sinfg::info("UPDATE_AVAILABLE=TRUE");
- update_available_=true;
- }
- else
- {
- system(strprintf(
- "cd '%s' && cvs status '%s'",
- dirname(file_name_).c_str(),
- basename(file_name_).c_str()
- ).c_str());
- sinfg::info("UPDATE_AVAILABLE=FALSE");
- update_available_=false;
- }
-
-
-#ifdef _DEBUG
- sinfg::info("in_repository() = %d",in_repository());
- sinfg::info("get_cvs_version() = %s",get_cvs_version().c_str());
- sinfg::info("get_original_timestamp() = %s",ctime(&get_original_timestamp()));
- time_t t(get_current_timestamp());
- sinfg::info("get_current_timestamp() = %s",ctime(&t));
- sinfg::info("get_cvs_root() = %s",get_cvs_root().c_str());
- sinfg::info("get_cvs_module() = %s",get_cvs_module().c_str());
-#endif
- return;
- }
- }
-
- in_repository_=false;
- cvs_version_.clear();
- original_timestamp_=0;
-
-#ifdef _DEBUG
- sinfg::info("in_repository() = %d",in_repository());
-#endif
-}
-
-bool
-CVSInfo::in_sandbox()const
-{
- return in_sandbox_;
-}
-
-bool
-CVSInfo::in_repository()const
-{
- if(!in_sandbox_)
- return false;
- return in_repository_;
-}
-
-bool
-CVSInfo::is_modified()const
-{
-#ifdef _DEBUG
- sinfg::info("%d-%d=%d",get_current_timestamp(),get_original_timestamp(),get_current_timestamp()-get_original_timestamp());
-#endif
- if(!in_sandbox() || !in_repository())
- return false;
- return get_current_timestamp()!=get_original_timestamp() && abs(get_current_timestamp()-get_original_timestamp())!=3600;
-}
-
-bool
-CVSInfo::is_updated()const
-{
- return update_available_;
-}
-
-const sinfg::String&
-CVSInfo::get_cvs_version()const
-{
- return cvs_version_;
-}
-
-const time_t&
-CVSInfo::get_original_timestamp()const
-{
- return original_timestamp_;
-}
-
-time_t
-CVSInfo::get_current_timestamp()const
-{
- struct stat st;
- if(stat(file_name_.c_str(),&st)<0)
- {
- sinfg::error("Unable to get file stats");
- return false;
- }
- return st.st_mtime+timezone+(daylight-1)*3600;
-}
-
-sinfg::String
-CVSInfo::get_cvs_root()const
-{
- if(!in_sandbox_)
- return sinfg::String();
-
- std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str());
-
- if(file)
- {
- String ret;
- getline(file,ret);
- return ret;
- }
-
- return sinfg::String();
-}
-
-sinfg::String
-CVSInfo::get_cvs_module()const
-{
- if(!in_sandbox_)
- return sinfg::String();
-
- std::ifstream file((dirname(file_name_)+"/CVS/Repository").c_str());
-
- if(file)
- {
- String ret;
- getline(file,ret);
- return ret;
- }
-
- return sinfg::String();
-}
-
-// This function pre-processes the message so that we
-// don't get any CVS syntax errors.
-inline sinfg::String fix_msg(const sinfg::String& message)
-{
- sinfg::String ret;
- int i;
- for(i=0;i<(int)message.size();i++)
- {
- if(message[i]=='\'')
- ret+="'\"'\"'";
- else
- ret+=message[i];
- }
- return ret;
-}
-
-void
-CVSInfo::cvs_add(const sinfg::String& message)
-{
- if(!in_sandbox_)
- {
- sinfg::error("cvs_add(): Not in a sand box");
- throw int();
- return;
- }
-
- sinfg::String command(strprintf("cd '%s' && %s add -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str()));
-
- int ret(system(command.c_str()));
-
- calc_repository_info();
-
- switch(ret)
- {
- case 0:
- break;
- default:
- sinfg::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
- throw(ret);
- break;
- }
-}
-
-void
-CVSInfo::cvs_update()
-{
- if(!in_sandbox_)
- {
- sinfg::error("cvs_update(): Not in a sand box");
- throw int();
- return;
- }
-
- sinfg::String command(strprintf("cd '%s' && %s update '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),basename(file_name_).c_str()));
-
- int ret(system(command.c_str()));
-
- calc_repository_info();
-
- switch(ret)
- {
- case 0:
- break;
- default:
- sinfg::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
- throw(ret);
- break;
- }
-}
-
-void
-CVSInfo::cvs_commit(const sinfg::String& message)
-{
- if(!in_sandbox_)
- {
- sinfg::error("cvs_commit(): Not in a sand box");
- throw int();
- return;
- }
-
- sinfg::String command(strprintf("cd '%s' && %s commit -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str()));
-
- int ret(system(command.c_str()));
-
- calc_repository_info();
-
- switch(ret)
- {
- case 0:
- break;
- default:
- sinfg::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
- if(is_modified())
- throw(ret);
- break;
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file cvs.h
-** \brief Template Header
-**
-** $Id: cvs.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_CVS_H
-#define __SINFG_CVS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/string.h>
-#include <time.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class CVSInfo
-{
- sinfg::String file_name_;
-
- bool in_sandbox_;
- bool in_repository_;
- bool update_available_;
-
- sinfg::String cvs_version_;
- time_t original_timestamp_;
-
-
-public:
- void calc_repository_info();
-
- CVSInfo(const sinfg::String& file_name);
- CVSInfo();
- ~CVSInfo();
-
- void set_file_name(const sinfg::String& file_name);
-
-// READ OPERATIONS --------------------------------------------------
-
- //! Returns TRUE if \a file_name is in a sandbox
- bool in_sandbox()const;
-
- //! Returns TRUE if \a file_name is in the repository
- bool in_repository()const;
-
- //! Returns TRUE if \a file_name has modifications not yet on the repository
- bool is_modified()const;
-
- //! Returns TRUE if there is a new version of \a file_name on the repository
- bool is_updated()const;
-
- //! Returns the CVS version string
- const sinfg::String& get_cvs_version()const;
-
- //! Returns the unix timestamp of the repository file
- const time_t &get_original_timestamp()const;
-
- //! Returns the unix timestamp of the checked out file
- time_t get_current_timestamp()const;
-
- //! Returns the Root
- sinfg::String get_cvs_root()const;
-
- //! Returns the name of the module
- sinfg::String get_cvs_module()const;
-
-// WRITE OPERATIONS -------------------------------------------------
-
- void cvs_add(const sinfg::String& message=sinfg::String());
-
- void cvs_update();
-
- void cvs_commit(const sinfg::String& message=sinfg::String());
-}; // END of class CVSInfo
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file editmode.h
-** \brief Template Header
-**
-** $Id: editmode.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_EDITMODE_H
-#define __SINFG_EDITMODE_H
-
-/* === H E A D E R S ======================================================= */
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-/*! \enum EditMode
-** \brief \writeme
-*/
-enum EditMode
-{
- MODE_NORMAL =0, //!< Normal editing mode. Place holder.
-
- MODE_ANIMATE =(1<<0), //!< Animated editing mode.
- MODE_ANIMATE_FUTURE =(1<<1), //!< Respect <i>future</i> keyframes
- MODE_ANIMATE_PAST =(1<<2), //!< Respect <i>past</i> keyframes
- MODE_ANIMATE_ALL =(3<<1), //!< Respect <i>all</i> keyframes
-
- MODE_UNDEFINED =(~0) //!< Undefined Mode
-}; // END of enum EditMode
-
-//! Combine Flags
-inline EditMode
-operator|(const EditMode& lhs, const EditMode& rhs)
-{ return static_cast<EditMode>(int(lhs)|int(rhs)); }
-
-//! Exclude Flags
-inline EditMode
-operator-(const EditMode& lhs, const EditMode& rhs)
-{ return static_cast<EditMode>(int(lhs)&~int(rhs)); }
-
-inline EditMode&
-operator|=(EditMode& lhs, const EditMode& rhs)
-{ *reinterpret_cast<int*>(&lhs)|=int(rhs); return lhs; }
-
-//! Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
-/*! This function will return true of all of the flags
-** in the \a rhs are set in the \a lhs */
-inline EditMode
-operator&(const EditMode& lhs, const EditMode& rhs)
-{ return static_cast<EditMode>(int(lhs)&int(rhs)); }
-
-//! Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
-/*! This function will return true of all of the flags
-** in the \a rhs are set in the \a lhs */
-inline bool
-operator<=(const EditMode& lhs, const EditMode& rhs)
-{ return lhs&rhs==int(rhs); }
-
-}; // END if namespace sinfgapp
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file inputdevice.cpp
-** \brief Template File
-**
-** $Id: inputdevice.cpp,v 1.2 2005/01/12 04:08:32 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "inputdevice.h"
-#include "settings.h"
-#include <cstdio>
-#include <ETL/stringf>
-#include "main.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-class DeviceSettings : public Settings
-{
- InputDevice* input_device;
-public:
- DeviceSettings(InputDevice* input_device):
- input_device(input_device) { }
-
-
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const
- {
- if(key=="state")
- {
- value=input_device->get_state();
- return true;
- }
- if(key=="bline_width")
- {
- value=strprintf("%s",input_device->get_bline_width().get_string().c_str());
- return true;
- }
- if(key=="opacity")
- {
- value=strprintf("%f",(float)input_device->get_opacity());
- return true;
- }
- if(key=="blend_method")
- {
- value=strprintf("%i",(int)input_device->get_blend_method());
- return true;
- }
- if(key=="color")
- {
- Color c(input_device->get_foreground_color());
- value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
-
- return true;
- }
-
- return Settings::get_value(key, value);
- }
-
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value)
- {
- DEBUGPOINT();
- if(key=="state")
- {
- input_device->set_state(value);
- return true;
- }
- if(key=="bline_width")
- {
- input_device->set_bline_width(sinfg::Distance(value));
- return true;
- }
- if(key=="opacity")
- {
- input_device->set_opacity(atof(value.c_str()));
- return true;
- }
- if(key=="blend_method")
- {
- input_device->set_blend_method(Color::BlendMethod(atoi(value.c_str())));
- return true;
- }
- if(key=="color")
- {
- float r=0,g=0,b=0,a=1;
- if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
- return false;
- input_device->set_foreground_color(sinfg::Color(r,g,b,a));
- return true;
- }
-
- return Settings::set_value(key, value);
- }
-
- virtual KeyList get_key_list()const
- {
- KeyList ret(Settings::get_key_list());
- ret.push_back("color");
- ret.push_back("state");
- ret.push_back("bline_width");
- ret.push_back("blend_method");
- ret.push_back("opacity");
- return ret;
- }
-};
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-InputDevice::InputDevice(const sinfg::String id_, Type type_):
- id_(id_),
- type_(type_),
- state_((type_==TYPE_PEN)?"sketch":"normal"),
- foreground_color_(Color::black()),
- background_color_(Color::white()),
- bline_width_(Distance(1,Distance::SYSTEM_POINTS)),
- opacity_(1.0f),
- blend_method_(Color::BLEND_COMPOSITE)
-{
- switch(type_)
- {
- case TYPE_MOUSE:
- state_="normal";
- break;
-
- case TYPE_PEN:
- state_="draw";
- break;
-
- case TYPE_ERASER:
- state_="normal";
- break;
-
- case TYPE_CURSOR:
- state_="normal";
- break;
-
- default:
- state_="normal";
- break;
- }
-
- device_settings=new DeviceSettings(this);
- Main::settings().add_domain(device_settings,"input_device."+id_);
-}
-
-InputDevice::~InputDevice()
-{
- Main::settings().remove_domain("input_device."+id_);
- delete device_settings;
-}
-
-Settings&
-InputDevice::settings()
-{
- return *device_settings;
-}
-
-const Settings&
-InputDevice::settings()const
-{
- return *device_settings;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file template.h
-** \brief Template Header
-**
-** $Id: inputdevice.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_INPUTDEVICE_H
-#define __SINFG_INPUTDEVICE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/color.h>
-#include <sinfg/vector.h>
-#include <sinfg/distance.h>
-#include <sinfg/string.h>
-#include <ETL/handle>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-class DeviceSettings;
-
-namespace sinfgapp {
-class Settings;
-
-
-class InputDevice : public etl::shared_object
-{
-public:
- enum Type
- {
- TYPE_MOUSE,
- TYPE_PEN,
- TYPE_ERASER,
- TYPE_CURSOR
- };
-
- typedef etl::handle<InputDevice> Handle;
-
-private:
- sinfg::String id_;
- Type type_;
- sinfg::String state_;
- sinfg::Color foreground_color_;
- sinfg::Color background_color_;
- sinfg::Distance bline_width_;
- sinfg::Real opacity_;
- sinfg::Color::BlendMethod blend_method_;
-
- DeviceSettings* device_settings;
-
-public:
- InputDevice(const sinfg::String id_, Type type_=TYPE_MOUSE);
- ~InputDevice();
-
- const sinfg::String& get_id()const { return id_; }
- const sinfg::String& get_state()const { return state_; }
- const sinfg::Color& get_foreground_color()const { return foreground_color_; }
- const sinfg::Color& get_background_color()const { return background_color_; }
- const sinfg::Distance& get_bline_width()const { return bline_width_; }
- const sinfg::Real& get_opacity()const { return opacity_; }
- const sinfg::Color::BlendMethod& get_blend_method()const { return blend_method_; }
- Type get_type()const { return type_; }
-
- void set_state(const sinfg::String& x) { state_=x; }
- void set_foreground_color(const sinfg::Color& x) { foreground_color_=x; }
- void set_background_color(const sinfg::Color& x) { background_color_=x; }
- void set_bline_width(const sinfg::Distance& x) { bline_width_=x; }
- void set_blend_method(const sinfg::Color::BlendMethod& x) { blend_method_=x; }
- void set_opacity(const sinfg::Real& x) { opacity_=x; }
- void set_type(Type x) { type_=x; }
-
- Settings& settings();
- const Settings& settings()const;
-}; // END of class InputDevice
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file instance.cpp
-** \brief Instance
-**
-** $Id: instance.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "instance.h"
-#include "canvasinterface.h"
-#include <iostream>
-#include <sinfg/loadcanvas.h>
-#include <sinfg/savecanvas.h>
-#include <sinfg/valuenode_composite.h>
-#include <sinfg/valuenode_radialcomposite.h>
-#include <sinfg/valuenode_reference.h>
-#include <map>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-static std::map<loose_handle<Canvas>, loose_handle<Instance> > instance_map_;
-
-/* === P R O C E D U R E S ================================================= */
-
-bool
-sinfgapp::is_editable(sinfg::ValueNode::Handle value_node)
-{
- if(ValueNode_Const::Handle::cast_dynamic(value_node)
- || ValueNode_TimedSwap::Handle::cast_dynamic(value_node)
- || ValueNode_Animated::Handle::cast_dynamic(value_node)
- || ValueNode_Composite::Handle::cast_dynamic(value_node)
- || ValueNode_RadialComposite::Handle::cast_dynamic(value_node)
- || ValueNode_Reference::Handle::cast_dynamic(value_node)
- )
- return true;
- return false;
-}
-
-etl::handle<Instance>
-sinfgapp::find_instance(etl::handle<sinfg::Canvas> canvas)
-{
- if(instance_map_.count(canvas)==0)
- return 0;
- return instance_map_[canvas];
-}
-
-/* === M E T H O D S ======================================================= */
-
-Instance::Instance(Canvas::Handle canvas):
- CVSInfo(canvas->get_file_name()),
- canvas_(canvas)
-{
- assert(canvas->is_root());
-
- unset_selection_manager();
-
- instance_map_[canvas]=this;
-} // END of sinfgapp::Instance::Instance()
-
-handle<Instance>
-Instance::create(Canvas::Handle canvas)
-{
- // Construct a new instance
- handle<Instance> instance(new Instance(canvas));
-
- return instance;
-} // END of sinfgapp::Instance::create()
-
-sinfg::String
-Instance::get_file_name()const
-{
- return get_canvas()->get_file_name();
-}
-
-void
-Instance::set_file_name(const sinfg::String &name)
-{
- get_canvas()->set_file_name(name);
- CVSInfo::set_file_name(name);
-}
-
-Instance::~Instance()
-{
- instance_map_.erase(canvas_);
- sinfg::info("studio::Instance::~Instance(): Deleted");
-} // END of studio::Instance::~Instance()
-
-handle<CanvasInterface>
-Instance::find_canvas_interface(handle<Canvas> canvas)
-{
- if(!canvas)
- return 0;
- while(canvas->is_inline())
- canvas=canvas->parent();
-
- CanvasInterfaceList::iterator iter;
-
- for(iter=canvas_interface_list().begin();iter!=canvas_interface_list().end();iter++)
- if((*iter)->get_canvas()==canvas)
- return *iter;
-
- return CanvasInterface::create(this,canvas);
-}
-
-bool
-Instance::save()const
-{
- bool ret=save_canvas(get_file_name(),canvas_);
- if(ret)
- {
- reset_action_count();
- const_cast<sigc::signal<void>& >(signal_saved_)();
- }
- return ret;
-}
-
-bool
-Instance::save_as(const std::string &file_name)const
-{
- bool ret=save_canvas(file_name,canvas_);
- if(ret)
- {
- reset_action_count();
- const_cast<sigc::signal<void>& >(signal_saved_)();
- }
- return ret;
-}
-
-bool
-Instance::save_as(const std::string &file_name)
-{
- bool ret;
-
- String old_file_name(get_file_name());
-
- set_file_name(file_name);
-
- ret=save_canvas(file_name,canvas_);
-
- if(ret)
- {
- reset_action_count();
- signal_saved_();
- }
- else
- {
- set_file_name(old_file_name);
- }
-
- signal_filename_changed_();
-
- return ret;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file instance.h
-** \brief writeme
-**
-** $Id: instance.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_INSTANCE_H
-#define __SINFG_APP_INSTANCE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "action.h"
-#include <ETL/handle>
-#include <sinfg/canvas.h>
-#include <sinfg/string.h>
-#include <list>
-#include <sigc++/signal.h>
-#include <sigc++/object.h>
-#include "action_system.h"
-#include "selectionmanager.h"
-#include "cvs.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class CanvasInterface;
-
-
-class Instance : public Action::System , public CVSInfo
-{
- friend class PassiveGrouper;
- /*
- -- ** -- P U B L I C T Y P E S ---------------------------------------------
- */
-
-public:
-
- typedef std::list< etl::handle<CanvasInterface> > CanvasInterfaceList;
-
- using etl::shared_object::ref;
- using etl::shared_object::unref;
-
- /*
- -- ** -- P U B L I C D A T A ------------------------------------------------
- */
-
-public:
-
- /*
- -- ** -- P R I V A T E D A T A ---------------------------------------------
- */
-
-private:
- //! Handle for root canvas
- sinfg::Canvas::Handle canvas_;
-
-
- CanvasInterfaceList canvas_interface_list_;
-
- sigc::signal<void> signal_filename_changed_;
- sigc::signal<void> signal_saved_;
- etl::handle<SelectionManager> selection_manager_;
-
-protected:
- Instance(etl::handle<sinfg::Canvas>);
-
- /*
- -- ** -- P U B L I C M E T H O D S -----------------------------------------
- */
-
-public:
-
- ~Instance();
-
- void set_selection_manager(const etl::handle<SelectionManager> &sm) { assert(sm); selection_manager_=sm; }
- void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
- const etl::handle<SelectionManager> &get_selection_manager() { return selection_manager_; }
-
-
-
- etl::handle<CanvasInterface> find_canvas_interface(sinfg::Canvas::Handle canvas);
-
- sinfg::Canvas::Handle get_canvas()const { return canvas_; }
-
- //! Saves the instance to filename_
- bool save()const;
-
- bool save_as(const sinfg::String &filename)const;
-
- bool save_as(const sinfg::String &filename);
-
-public: // Interfaces to internal information
- sigc::signal<void>& signal_filename_changed() { return signal_filename_changed_; }
- sigc::signal<void>& signal_saved() { return signal_saved_; }
-
- CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; }
- const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; }
-
- sinfg::String get_file_name()const;
-
- void set_file_name(const sinfg::String &name);
-
-public:
-
-
-public: // Constructor interfaces
- static etl::handle<Instance> create(etl::handle<sinfg::Canvas> canvas);
-}; // END class Instance
-
-etl::handle<Instance> find_instance(etl::handle<sinfg::Canvas> canvas);
-
-bool is_editable(sinfg::ValueNode::Handle value_node);
-
-}; // END namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file main.cpp
-** \brief Template File
-**
-** $Id: main.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "main.h"
-#include "action.h"
-
-#include <sinfg/color.h>
-#include <sinfg/gradient.h>
-
-#include <ETL/trivial>
-
-#include <list>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === S T A T I C S ======================================================= */
-
-static etl::reference_counter sinfgapp_ref_count_(0);
-static sinfgapp::Action::Main* action_main;
-
-static Color foreground_;
-static Color background_;
-static Gradient gradient_;
-static bool gradient_default_colors_;
-
-static sinfg::Distance bline_width_;
-
-static Color::BlendMethod blend_method_;
-static Real opacity_;
-
-static sinfgapp::InputDevice::Handle selected_input_device_;
-static list<sinfgapp::InputDevice::Handle> input_devices_;
-
-trivial<sigc::signal<void> > signal_foreground_color_changed_;
-trivial<sigc::signal<void> > signal_background_color_changed_;
-trivial<sigc::signal<void> > signal_gradient_changed_;
-trivial<sigc::signal<void> > signal_bline_width_changed_;
-trivial<sigc::signal<void> > signal_blend_method_changed_;
-trivial<sigc::signal<void> > signal_opacity_changed_;
-trivial<sigc::signal<void> > signal_interpolation_changed_;
-
-trivial<Settings> settings_;
-
-static sinfg::Waypoint::Interpolation interpolation_;
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-sinfgapp::Main::Main(const sinfg::String &basepath,ProgressCallback *cb):
- sinfg::Main(basepath,cb),
- ref_count_(sinfgapp_ref_count_)
-{
- if(ref_count_.count())
- return;
-
- sinfgapp_ref_count_.reset();
- ref_count_=sinfgapp_ref_count_;
-
- // Add initialization after this point
- action_main=new sinfgapp::Action::Main();
-
- settings_.construct();
-
- signal_foreground_color_changed_.construct();
- signal_background_color_changed_.construct();
- signal_gradient_changed_.construct();
- signal_opacity_changed_.construct();
- signal_blend_method_changed_.construct();
- signal_interpolation_changed_.construct();
-
- set_foreground_color(Color::black());
- set_background_color(Color::white());
- set_gradient_default_colors();
- set_bline_width(Distance(1,Distance::SYSTEM_POINTS));
- set_opacity(1.0);
- set_blend_method(Color::BLEND_COMPOSITE);
-}
-
-sinfgapp::Main::~Main()
-{
- ref_count_.detach();
- if(!sinfgapp_ref_count_.unique())
- return;
- sinfgapp_ref_count_.detach();
-
- // Add deinitialization after this point
-
- delete action_main;
-
- selected_input_device_=0;
- input_devices_.clear();
-
- settings_.destruct();
- signal_foreground_color_changed_.destruct();
- signal_background_color_changed_.destruct();
- signal_gradient_changed_.destruct();
-
- signal_opacity_changed_.destruct();
- signal_blend_method_changed_.destruct();
- signal_interpolation_changed_.destruct();
-}
-
-Settings&
-sinfgapp::Main::settings()
-{
- return settings_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_foreground_color_changed()
-{
- return signal_foreground_color_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_background_color_changed()
-{
- return signal_background_color_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_gradient_changed()
-{
- return signal_gradient_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_bline_width_changed()
-{
- return signal_bline_width_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_blend_method_changed()
-{
- return signal_blend_method_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_opacity_changed()
-{
- return signal_opacity_changed_;
-}
-
-sigc::signal<void>&
-sinfgapp::Main::signal_interpolation_changed()
-{
- return signal_interpolation_changed_;
-}
-
-const sinfg::Color&
-sinfgapp::Main::get_foreground_color()
-{
- return foreground_;
-}
-
-const sinfg::Color&
-sinfgapp::Main::get_background_color()
-{
- return background_;
-}
-
-const sinfg::Gradient&
-sinfgapp::Main::get_gradient()
-{
- return gradient_;
-}
-
-const sinfg::Real&
-sinfgapp::Main::get_opacity()
-{
- return opacity_;
-}
-
-sinfg::Color::BlendMethod
-sinfgapp::Main::get_blend_method()
-{
- return blend_method_;
-}
-
-void
-sinfgapp::Main::set_foreground_color(sinfg::Color color)
-{
- foreground_=color;
- signal_foreground_color_changed()();
- if(selected_input_device_)
- selected_input_device_->set_foreground_color(foreground_);
- if(gradient_default_colors_)
- {
- gradient_=Gradient(foreground_,background_);
- signal_gradient_changed()();
- }
-}
-
-void
-sinfgapp::Main::set_background_color(sinfg::Color color)
-{
- background_=color;
- signal_background_color_changed()();
-
- if(selected_input_device_)
- selected_input_device_->set_background_color(background_);
-
- if(gradient_default_colors_)
- {
- gradient_=Gradient(foreground_,background_);
- signal_gradient_changed()();
- }
-}
-
-void
-sinfgapp::Main::set_gradient(sinfg::Gradient gradient)
-{
- gradient_=gradient;
- gradient_default_colors_=false;
- signal_gradient_changed()();
-}
-
-void
-sinfgapp::Main::set_gradient_default_colors()
-{
- gradient_default_colors_=true;
- gradient_=Gradient(foreground_,background_);
- signal_gradient_changed()();
-}
-
-void
-sinfgapp::Main::color_swap()
-{
- const Color tmp(foreground_);
- foreground_=background_;
- background_=tmp;
-
- if(selected_input_device_)
- {
- selected_input_device_->set_foreground_color(foreground_);
- selected_input_device_->set_background_color(background_);
- }
-
- signal_foreground_color_changed()();
- signal_background_color_changed()();
-
- if(gradient_default_colors_)
- {
- gradient_=Gradient(foreground_,background_);
- signal_gradient_changed()();
- }
-}
-
-sinfg::Waypoint::Interpolation
-sinfgapp::Main::get_interpolation()
-{
- return interpolation_;
-}
-
-
-void
-sinfgapp::Main::set_interpolation(sinfg::Waypoint::Interpolation x)
-{
- if(interpolation_!=x)
- {
- interpolation_=x;
-
- signal_interpolation_changed();
- }
-}
-
-const sinfg::Distance&
-sinfgapp::Main::get_bline_width()
-{
- return bline_width_;
-}
-
-void
-sinfgapp::Main::set_bline_width(sinfg::Distance x)
-{
- if(x<0)x=0;
- if(x!=bline_width_)
- {
- bline_width_=x;
-
- if(selected_input_device_)
- selected_input_device_->set_bline_width(x);
-
- signal_bline_width_changed()();
- }
-}
-
-void
-sinfgapp::Main::set_opacity(sinfg::Real x)
-{
- opacity_=x;
- if(selected_input_device_)
- selected_input_device_->set_opacity(opacity_);
- signal_opacity_changed()();
-}
-
-void
-sinfgapp::Main::set_blend_method(sinfg::Color::BlendMethod x)
-{
- blend_method_=x;
- if(selected_input_device_)
- selected_input_device_->set_blend_method(x);
- signal_blend_method_changed()();
-}
-
-
-InputDevice::Handle
-sinfgapp::Main::add_input_device(const sinfg::String id, InputDevice::Type type)
-{
- input_devices_.push_back(new InputDevice(id,type));
- return input_devices_.back();
-}
-
-InputDevice::Handle
-sinfgapp::Main::find_input_device(const sinfg::String id)
-{
- list<InputDevice::Handle>::iterator iter;
- for(iter=input_devices_.begin();iter!=input_devices_.end();++iter)
- if((*iter)->get_id()==id)
- return *iter;
- return 0;
-}
-
-InputDevice::Handle
-sinfgapp::Main::select_input_device(const sinfg::String id)
-{
- InputDevice::Handle input_device(find_input_device(id));
- if(!input_device)
- return 0;
- if(!select_input_device(input_device))
- return 0;
- return input_device;
-}
-
-bool
-sinfgapp::Main::select_input_device(InputDevice::Handle input_device)
-{
- assert(input_device);
-
- sinfg::info("Input device changed to \"%s\"",input_device->get_id().c_str());
-
- selected_input_device_=input_device;
-
- set_bline_width(input_device->get_bline_width());
- set_foreground_color(input_device->get_foreground_color());
- set_opacity(input_device->get_opacity());
- set_blend_method(input_device->get_blend_method());
-
- return true;
-}
-
-InputDevice::Handle
-sinfgapp::Main::get_selected_input_device()
-{
- return selected_input_device_;
-}
-
-void
-sinfgapp::Main::set_state(sinfg::String state)
-{
- if(selected_input_device_)
- selected_input_device_->set_state(state);
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file main.h
-** \brief Template Header
-**
-** $Id: main.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFGAPP_MAIN_H
-#define __SINFGAPP_MAIN_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <ETL/ref_count>
-#include <sinfg/string.h>
-#include <sinfg/general.h>
-#include <sinfg/main.h>
-#include <sinfg/distance.h>
-#include <sinfg/real.h>
-#include <sinfg/waypoint.h>
-#include <sigc++/signal.h>
-#include <sigc++/object.h>
-#include "inputdevice.h"
-#include "settings.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfg {
- class Color;
- class Gradient;
-};
-
-namespace sinfgapp {
-
-/*! \class sinfgapp::Main
-** \brief \writeme
-**
-** \writeme
-*/
-class Main : public sinfg::Main
-{
- etl::reference_counter ref_count_;
-public:
- Main(const sinfg::String &basepath,sinfg::ProgressCallback *cb=0);
- ~Main();
-
- const etl::reference_counter& ref_count()const { return ref_count_; }
-
- static const sinfg::Color& get_foreground_color();
- static const sinfg::Color& get_background_color();
- static const sinfg::Gradient& get_gradient();
- static const sinfg::Distance& get_bline_width();
- static sinfg::Waypoint::Interpolation get_interpolation();
-
-
- static void set_interpolation(sinfg::Waypoint::Interpolation x);
- static void set_bline_width(sinfg::Distance x);
- static void set_foreground_color(sinfg::Color color);
- static void set_background_color(sinfg::Color color);
- static void set_gradient(sinfg::Gradient gradient);
- static void set_gradient_default_colors();
- static void color_swap();
-
- static sinfg::Color::BlendMethod get_blend_method();
- static const sinfg::Real& get_opacity();
- static void set_blend_method(sinfg::Color::BlendMethod);
- static void set_opacity(sinfg::Real);
- static sigc::signal<void>& signal_blend_method_changed();
- static sigc::signal<void>& signal_opacity_changed();
- static sigc::signal<void>& signal_interpolation_changed();
-
- // Input Device stuff
- static InputDevice::Handle add_input_device(const sinfg::String id_, InputDevice::Type type_=InputDevice::TYPE_MOUSE);
- static InputDevice::Handle find_input_device(const sinfg::String id_);
- static InputDevice::Handle select_input_device(const sinfg::String id_);
- static bool select_input_device(InputDevice::Handle input_device);
- static InputDevice::Handle get_selected_input_device();
- static void set_state(sinfg::String state);
-
- static Settings& settings();
-
- // Signal interfaces
- static sigc::signal<void>& signal_foreground_color_changed();
- static sigc::signal<void>& signal_background_color_changed();
- static sigc::signal<void>& signal_gradient_changed();
- static sigc::signal<void>& signal_bline_width_changed();
-
-}; // END of class Main
-
-}; // END if namespace sinfgapp
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file template.h
-** \brief Template Header
-**
-** $Id: selectionmanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_SELECTIONMANAGER_H
-#define __SINFG_APP_SELECTIONMANAGER_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <list>
-#include <set>
-#include <ETL/handle>
-#include <sinfg/layer.h>
-#include <sinfg/valuenode.h>
-#include "value_desc.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class SelectionManager : public etl::shared_object
-{
-public:
- typedef std::pair<sinfg::Layer::Handle,sinfg::String> LayerParam;
- typedef std::list<LayerParam> LayerParamList;
-
- typedef std::list<sinfg::Layer::Handle> LayerList;
- typedef std::list<ValueDesc> ChildrenList;
- //typedef std::list<sinfg::ValueNode::Handle> ValueNodeList;
-
- virtual ~SelectionManager() { }
-
- //! Returns the number of layers selected.
- virtual int get_selected_layer_count()const=0;
-
- //! Returns a list of the currently selected layers.
- virtual LayerList get_selected_layers()const=0;
-
- //! Returns the first layer selected or an empty handle if none are selected.
- virtual sinfg::Layer::Handle get_selected_layer()const=0;
-
- //! Sets which layers should be selected
- virtual void set_selected_layers(const LayerList &layer_list)=0;
-
- //! Sets which layer should be selected. Empty handle if none.
- virtual void set_selected_layer(const sinfg::Layer::Handle &layer)=0;
-
- //! Clears the layer selection list
- virtual void clear_selected_layers()=0;
-
-
-
- //! Returns the number of childrens selected.
- virtual int get_selected_children_count()const=0;
-
- //! Returns a list of the currently selected childrens.
- virtual ChildrenList get_selected_children()const=0;
-
- //! Returns the first children selected or an empty handle if none are selected.
- virtual ChildrenList::value_type get_selected_child()const=0;
-
- //! Sets which childrens should be selected
- virtual void set_selected_children(const ChildrenList &children_list)=0;
-
- //! Sets which children should be selected. Empty handle if none.
- virtual void set_selected_child(const ChildrenList::value_type &children)=0;
-
- //! Clears the children selection list
- virtual void clear_selected_children()=0;
-
-
- //! Returns the number of layer parameters selected.
- virtual int get_selected_layer_parameter_count()const=0;
-
- //! Returns a list of the currently selected layer parameters.
- virtual LayerParamList get_selected_layer_parameters()const=0;
-
- //! Returns the first layer parameter selected or an empty handle if none are selected.
- virtual LayerParam get_selected_layer_parameter()const=0;
-
- //! Sets which layer parameters should be selected
- virtual void set_selected_layer_parameters(const LayerParamList &layer_param_list)=0;
-
- //! Sets which layer parameter should be selected. Empty handle if none.
- virtual void set_selected_layer_param(const LayerParam &layer_param)=0;
-
- //! Clears the layer parameter selection list
- virtual void clear_selected_layer_parameters()=0;
-}; // END of class SelectionManager
-
-//! A place holding selection manager that does nothing
-class NullSelectionManager : public SelectionManager
-{
-public:
- int get_selected_layer_count()const { return 0; }
- LayerList get_selected_layers()const { return LayerList(); }
- sinfg::Layer::Handle get_selected_layer()const { return 0; }
- void set_selected_layers(const LayerList &layer_list) { return; }
- void set_selected_layer(const sinfg::Layer::Handle &layer) { return; }
- void clear_selected_layers() { return; }
-
-
- int get_selected_children_count()const { return 0; }
- ChildrenList get_selected_children()const { return ChildrenList(); }
- ChildrenList::value_type get_selected_child()const { return ChildrenList::value_type(); }
- void set_selected_children(const ChildrenList &children_list) { return; }
- void set_selected_child(const ChildrenList::value_type &child) { return; }
- void clear_selected_children() { return; }
-
- int get_selected_layer_parameter_count()const { return 0; }
- LayerParamList get_selected_layer_parameters()const { return LayerParamList(); }
- LayerParam get_selected_layer_parameter()const { return LayerParam(); }
- void set_selected_layer_parameters(const LayerParamList &layer_param_list) { return; }
- void set_selected_layer_param(const LayerParam &layer_param) { return; }
- void clear_selected_layer_parameters() { return; }
-
-}; // END of class NullSelectionManager
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file template.cpp
-** \brief Template File
-**
-** $Id: settings.cpp,v 1.2 2005/01/12 04:08:32 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <fstream>
-#include <iostream>
-#include "settings.h"
-#include <sinfg/general.h>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Settings::Settings()
-{
-}
-
-Settings::~Settings()
-{
-}
-
-sinfg::String
-Settings::get_value(const sinfg::String& key)const
-{
- sinfg::String value;
- if(!get_value(key,value))
- return sinfg::String();
- return value;
-}
-
-void
-Settings::add_domain(Settings* domain, const sinfg::String& name)
-{
- domain_map[name]=domain;
-}
-
-void
-Settings::remove_domain(const sinfg::String& name)
-{
- domain_map.erase(name);
-}
-
-bool
-Settings::get_value(const sinfg::String& key, sinfg::String& value)const
-{
- // Search for the value in any children domains
- DomainMap::const_iterator iter;
- for(iter=domain_map.begin();iter!=domain_map.end();++iter)
- {
- // if we have a domain hit
- if(key.size()>iter->first.size() && String(key.begin(),key.begin()+iter->first.size())==iter->first)
- {
- sinfg::String key_(key.begin()+iter->first.size()+1,key.end());
-
- // If the domain has it, then we have got a hit
- if(iter->second->get_value(key_,value))
- return true;
- }
- }
-
- // Search for the value in our simple map
- if(simple_value_map.count(key))
- {
- value=simple_value_map.find(key)->second;
- return true;
- }
-
- // key not found
- return false;
-}
-
-bool
-Settings::set_value(const sinfg::String& key,const sinfg::String& value)
-{
- // Search for the key in any children domains
- DomainMap::iterator iter;
- for(iter=domain_map.begin();iter!=domain_map.end();++iter)
- {
- // if we have a domain hit
- if(key.size()>iter->first.size() && String(key.begin(),key.begin()+iter->first.size())==iter->first)
- {
- sinfg::String key_(key.begin()+iter->first.size()+1,key.end());
-
- return iter->second->set_value(key_,value);
- }
- }
-
- simple_value_map[key]=value;
- return true;
-}
-
-Settings::KeyList
-Settings::get_key_list()const
-{
- KeyList key_list;
-
- // Get keys from the domains
- {
- DomainMap::const_iterator iter;
- for(iter=domain_map.begin();iter!=domain_map.end();++iter)
- {
- KeyList sub_key_list(iter->second->get_key_list());
- KeyList::iterator key_iter;
- for(key_iter=sub_key_list.begin();key_iter!=sub_key_list.end();++key_iter)
- key_list.push_back(iter->first+'.'+*key_iter);
- }
- }
-
- // Get keys from the simple variables
- {
- ValueBaseMap::const_iterator iter;
- for(iter=simple_value_map.begin();iter!=simple_value_map.end();++iter)
- key_list.push_back(iter->first);
- }
-
- // Sort the keys
- key_list.sort();
-
- return key_list;
-}
-
-bool
-Settings::save_to_file(const sinfg::String& filename)const
-{
- sinfg::String tmp_filename(filename+".TMP");
-
- try
- {
- std::ofstream file(tmp_filename.c_str());
-
- if(!file)return false;
-
- KeyList key_list(get_key_list());
-
- // Save the keys
- {
- KeyList::const_iterator iter;
- for(iter=key_list.begin();iter!=key_list.end();++iter)
- {
- if(!file)return false;
- file<<*iter<<'='<<get_value(*iter)<<endl;
- }
- }
-
- if(!file)
- return false;
- }catch(...) { return false; }
-
-#ifdef _WIN32
- char old_file[80]="sif.XXXXXXXX";
- mktemp(old_file);
- rename(filename.c_str(),old_file);
- if(rename(tmp_filename.c_str(),filename.c_str())!=0)
- {
- rename(old_file,tmp_filename.c_str());
- return false;
- }
- remove(old_file);
-#else
- if(rename(tmp_filename.c_str(),filename.c_str())!=0)
- return false;
-#endif
-
- return true;
-}
-
-bool
-Settings::load_from_file(const sinfg::String& filename)
-{
- std::ifstream file(filename.c_str());
- if(!file)
- return false;
- while(file)
- {
- std::string line;
- getline(file,line);
- if(!line.empty() && ((line[0]>='a' && line[0]<='z')||(line[0]>='A' && line[0]<='Z')))
- {
- std::string::iterator equal(find(line.begin(),line.end(),'='));
- if(equal==line.end())
- continue;
- std::string key(line.begin(),equal);
- std::string value(equal+1,line.end());
-
- //sinfg::info("Settings::load_from_file(): Trying Key \"%s\" with a value of \"%s\".",key.c_str(),value.c_str());
- try{
- if(!set_value(key,value))
- sinfg::warning("Settings::load_from_file(): Key \"%s\" with a value of \"%s\" was rejected.",key.c_str(),value.c_str());
- }
- catch(...)
- {
- sinfg::error("Settings::load_from_file(): Attept to set key \"%s\" with a value of \"%s\" has thrown an exception.",key.c_str(),value.c_str());
- throw;
- }
- }
- }
- return true;
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file template.h
-** \brief Template Header
-**
-** $Id: settings.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_SETTINGS_H
-#define __SINFG_SETTINGS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/string.h>
-#include <map>
-#include <list>
-#include <ETL/stringf>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class Settings
-{
-public:
-
- typedef std::list<sinfg::String> KeyList;
- typedef std::map<sinfg::String,sinfg::String> ValueBaseMap;
- typedef std::map<sinfg::String,Settings*> DomainMap;
-
-private:
- ValueBaseMap simple_value_map;
-
- DomainMap domain_map;
-
-public:
- Settings();
- virtual ~Settings();
-
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const;
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value);
- virtual KeyList get_key_list()const;
-
- sinfg::String get_value(const sinfg::String& key)const;
- void add_domain(Settings* domain, const sinfg::String& name);
- void remove_domain(const sinfg::String& name);
-
- bool load_from_string(const sinfg::String& data);
- bool save_to_string(sinfg::String& data);
-
- bool load_from_file(const sinfg::String& filename);
- bool save_to_file(const sinfg::String& filename)const;
-}; // END of class Settings
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timegather.cpp
-** \brief Time Gather File
-**
-** $Id: timegather.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "timegather.h"
-#include "value_desc.h"
-
-#include <sinfg/layer_pastecanvas.h>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-/* === E N T R Y P O I N T ================================================= */
-
-//! Definitions for build a list of accurate valuenode references
-
-void sinfgapp::timepoints_ref::insert(sinfg::ValueNode_Animated::Handle v, sinfg::Waypoint w)
-{
- ValueBaseTimeInfo vt;
- vt.val = v;
-
- waytracker::iterator i = waypointbiglist.find(vt);
-
- if(i != waypointbiglist.end())
- {
- i->waypoints.insert(w);
- }else
- {
- vt.waypoints.insert(w);
- waypointbiglist.insert(vt);
- }
-}
-
-void sinfgapp::timepoints_ref::insert(sinfgapp::ValueDesc v, sinfg::Activepoint a)
-{
- ActiveTimeInfo vt;
- vt.val = v;
-
- acttracker::iterator i = actpointbiglist.find(vt);
-
- if(i != actpointbiglist.end())
- {
- i->activepoints.insert(a);
- /*{ //if it fails...
- sinfg::info("!!!!For some reason it wasn't able to insert the activepoint in the list (%s,%.4lg)",
- a.state?"true":"false", (double)a.time);
- }*/
- }else
- {
- vt.activepoints.insert(a);
- actpointbiglist.insert(vt);
- //sinfg::info("Insert new activept list for valdesc");
- }
-}
-
-//recursion functions
-void sinfgapp::recurse_canvas(sinfg::Canvas::Handle h, const std::set<Time> &tlist,
- timepoints_ref &vals)
-{
-
- //sinfg::info("Canvas...\n Recurse through layers");
- // iterate through the layers
-
- sinfg::Canvas::iterator i = h->begin(), end = h->end();
-
- for(; i != end; ++i)
- {
- const Node::time_set &tset = (*i)->get_times();
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- recurse_layer(*i,tlist,vals);
- }
- }
-}
-
-void sinfgapp::recurse_layer(sinfg::Layer::Handle h, const std::set<Time> &tlist,
- timepoints_ref &vals)
-{
- // iterate through the layers
- //check for special case of paste canvas
- etl::handle<sinfg::Layer_PasteCanvas> p = etl::handle<sinfg::Layer_PasteCanvas>::cast_dynamic(h);
-
- //sinfg::info("Layer...");
-
- if(p)
- {
- //sinfg::info("We are a paste canvas so go into that");
- //recurse into the canvas
- const sinfg::Node::time_set &tset = p->get_sub_canvas()->get_times();
-
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- //we have to offset the times so it won't wreck havoc if the canvas is imported more than once...
- // and so we get correct results when offsets are present
- std::set<Time> tlistoff;
- std::set<Time>::iterator i = tlist.begin(), end = tlist.end();
- for(; i != end; ++i)
- {
- tlistoff.insert(*i - p->get_time_offset());
- }
-
- recurse_canvas(p->get_sub_canvas(),tlist,vals);
- }
- }
-
- //check all the valuenodes regardless...
- //sinfg::info("Recurse all valuenodes");
- sinfg::Layer::DynamicParamList::const_iterator i = h->dynamic_param_list().begin(),
- end = h->dynamic_param_list().end();
- for(; i != end; ++i)
- {
- const sinfg::Node::time_set &tset = i->second->get_times();
-
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- recurse_valuedesc(ValueDesc(h,i->first),tlist,vals);
- }
- }
-}
-
-template < typename IT, typename CMP >
-static bool sorted(IT i,IT end, const CMP &cmp = CMP())
-{
- if(i == end) return true;
-
- for(IT last = i++; i != end; last = i++)
- {
- if(!cmp(*last,*i))
- return false;
- }
-
- return true;
-}
-
-void sinfgapp::recurse_valuedesc(sinfgapp::ValueDesc h, const std::set<Time> &tlist,
- timepoints_ref &vals)
-{
- //special cases for Animated, DynamicList, and Linkable
-
- //sinfg::info("ValueBasenode... %p, %s", h.get_value_node().get(),typeid(*h.get_value_node()).name());
-
-
- //animated case
- {
- sinfg::ValueNode_Animated::Handle p = sinfg::ValueNode_Animated::Handle::cast_dynamic(h.get_value_node());
-
- if(p)
- {
- //loop through and determine which waypoint we will need to reference
- const sinfg::WaypointList &w = p->waypoint_list();
-
- sinfg::WaypointList::const_iterator i = w.begin(),
- end = w.end();
-
- std::set<Time>::const_iterator j = tlist.begin(),
- jend = tlist.end();
- for(; i != end && j != jend;)
- {
- //sinfg::info("tpair t(%.3f) = %.3f", (float)*j, (float)(i->get_time()));
-
- if(j->is_equal(i->get_time()))
- {
- vals.insert(p,*i);
- ++i,++j;
- }else if(*i < *j)
- {
- ++i;
- }else ++j;
- }
- return;
- }
- }
-
- //parent dynamiclist case - just for active points for that object...
- if(h.parent_is_value_node())
- {
- sinfg::ValueNode_DynamicList::Handle p = sinfg::ValueNode_DynamicList::Handle::cast_dynamic(h.get_parent_value_node());
-
- if(p)
- {
- int index = h.get_index();
-
- //check all the active points in each list...
- const sinfg::ActivepointList &a = p->list[index].timing_info;
-
- //sinfg::info("Our parent = dynamic list, searching in %d activepts",a.size());
-
- std::set<Time>::const_iterator i = tlist.begin(),
- end = tlist.end();
-
- sinfg::ActivepointList::const_iterator j = a.begin(),
- jend = a.end();
-
- for(; j != jend && i != end;)
- {
- double it = *i;
- double jt = j->get_time();
- double diff = (double)(it - jt);
-
- //sinfg::info("\ttpair match(%.4lg) - %.4lg (diff = %lg",it,jt,diff);
-
- //
- if(abs(diff) < (double)Time::epsilon())
- {
- //sinfg::info("\tActivepoint to add being referenced (%x,%s,%.4lg)",
- // (int)j->get_uid(),j->state?"true":"false", (double)j->time);
- vals.insert(ValueDesc(p,index),*j);
- ++i,++j;
- }else if(it < jt)
- {
- ++i;
- //sinfg::info("\tIncrementing time");
- }
- else
- {
- ++j;
- //sinfg::info("\tIncrementing actpt");
- }
- }
- }
- }
-
- //dynamiclist case - we must still make sure that we read from the list entries the time values
- // because just the linked valuenodes will not do that
- {
- sinfg::ValueNode_DynamicList::Handle p = sinfg::ValueNode_DynamicList::Handle::cast_dynamic(h.get_value_node());
-
- if(p)
- {
- //sinfg::info("Process dynamic list valuenode");
- int index = 0;
-
- std::vector<sinfg::ValueNode_DynamicList::ListEntry>::const_iterator
- i = p->list.begin(),
- end = p->list.end();
-
- for(; i != end; ++i, ++index)
- {
- const Node::time_set &tset = i->get_times();
-
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- recurse_valuedesc(ValueDesc(p,index),tlist,vals);
- }
- }
- return;
- }
- }
-
- //the linkable case...
- {
- etl::handle<sinfg::LinkableValueNode> p = etl::handle<sinfg::LinkableValueNode>::cast_dynamic(h.get_value_node());
-
- if(p)
- {
- //sinfg::info("Process Linkable ValueBasenode");
- int i = 0, size = p->link_count();
-
- for(; i < size; ++i)
- {
- ValueNode::Handle v = p->get_link(i);
- const Node::time_set &tset = v->get_times();
-
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- recurse_valuedesc(ValueDesc(p,i),tlist,vals);
- }
- }
- }
- }
-}
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file timegather.h
-** \brief Time Gather Header
-**
-** $Id: timegather.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2004 Adrian Bentley
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_TIMEGATHER_H
-#define __SINFG_TIMEGATHER_H
-
-/* === H E A D E R S ======================================================= */
-#include <sinfg/valuenode_animated.h>
-#include <sinfg/valuenode_dynamiclist.h>
-#include <sinfg/time.h>
-#include "value_desc.h"
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class ValueDesc;
-class sinfg::Time;
-
-struct ValueBaseTimeInfo
-{
- sinfg::ValueNode_Animated::Handle val;
- mutable std::set<sinfg::Waypoint> waypoints;
-
- bool operator<(const ValueBaseTimeInfo &rhs) const
- {
- return val < rhs.val;
- }
-};
-
-struct ActiveTimeInfo
-{
- struct actcmp
- {
- bool operator()(const sinfg::Activepoint &lhs, const sinfg::Activepoint &rhs) const
- {
- return lhs.time < rhs.time;
- }
- };
-
- sinfgapp::ValueDesc val;
-
- typedef std::set<sinfg::Activepoint,actcmp> set;
-
- mutable set activepoints;
-
- bool operator<(const ActiveTimeInfo &rhs) const
- {
- return val.get_parent_value_node() == rhs.val.get_parent_value_node() ?
- val.get_index() < rhs.val.get_index() :
- val.get_parent_value_node() < rhs.val.get_parent_value_node();
- }
-};
-
-struct timepoints_ref
-{
- typedef std::set<ValueBaseTimeInfo> waytracker;
- typedef std::set<ActiveTimeInfo> acttracker;
-
- waytracker waypointbiglist;
- acttracker actpointbiglist;
-
- void insert(sinfg::ValueNode_Animated::Handle v, sinfg::Waypoint w);
- void insert(sinfgapp::ValueDesc v, sinfg::Activepoint a);
-};
-
-//assumes they're sorted... (incremental advance)
-//checks the intersection of the two sets... might be something better in the stl
-template < typename I1, typename I2 >
-bool check_intersect(I1 b1, I1 end1, I2 b2, I2 end2)
-{
- if(b1 == end1 || b2 == end2)
- return false;
-
- for(; b1 != end1 && b2 != end2;)
- {
- if(*b1 < *b2) ++b1;
- else if(*b2 < *b1) ++b2;
- else
- {
- assert(*b1 == *b2);
- return true;
- }
- }
- return false;
-}
-
-//pointer kind of a hack, gets the accurate times from a value desc
-// (deals with dynamic list member correctly... i.e. gathers activepoints)
-const sinfg::Node::time_set *get_times_from_vdesc(const sinfgapp::ValueDesc &v);
-
-//get's the closest time inside the set
-bool get_closest_time(const sinfg::Node::time_set &tset, const sinfg::Time &t,
- const sinfg::Time &range, sinfg::Time &out);
-
-//recursion functions based on time restrictions (can be expanded later)...
-//builds a list of relevant waypoints and activepoints inside the timepoints_ref structure
-void recurse_valuedesc(sinfgapp::ValueDesc valdesc, const std::set<sinfg::Time> &tlist,
- timepoints_ref &vals);
-void recurse_layer(sinfg::Layer::Handle layer, const std::set<sinfg::Time> &tlist,
- timepoints_ref &vals);
-void recurse_canvas(sinfg::Canvas::Handle canvas, const std::set<sinfg::Time> &tlist,
- timepoints_ref &vals);
-
-
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file uimanager.cpp
-** \brief Template File
-**
-** $Id: uimanager.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-# include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "uimanager.h"
-#include <iostream>
-#include <string>
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace sinfg;
-using namespace sinfgapp;
-
-/* === M A C R O S ========================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-UIInterface::Response
-ConsoleUIInterface::yes_no(const std::string &title, const std::string &message,Response dflt)
-{
- cout<<title<<": "<<message<<' ';
- if(dflt==RESPONSE_NO)
- cout<<_("(no/yes)")<<endl;
- else
- cout<<_("(yes/no)")<<endl;
- string resp;
- cin>>resp;
-
- if(dflt==RESPONSE_NO)
- {
- if(resp=="yes")
- return RESPONSE_YES;
- else
- return RESPONSE_NO;
- }
- else
- {
- if(resp=="no")
- return RESPONSE_NO;
- else
- return RESPONSE_YES;
- }
-}
-
-UIInterface::Response
-ConsoleUIInterface::yes_no_cancel(const string &title, const string &message,Response dflt)
-{
- cout<<title<<": "<<message<<' ';
- if(dflt==RESPONSE_NO)
- cout<<_("(no/yes)")<<endl;
- else
- cout<<_("(yes/no)")<<endl;
- string resp;
- cin>>resp;
-
- if(dflt==RESPONSE_NO)
- {
- if(resp=="yes")
- return RESPONSE_YES;
- else
- return RESPONSE_NO;
- }
- else
- {
- if(resp=="no")
- return RESPONSE_NO;
- else
- return RESPONSE_YES;
- }
-}
-
-UIInterface::Response
-ConsoleUIInterface::ok_cancel(const std::string &title, const std::string &message,Response dflt)
-{
- cout<<title<<": "<<message<<' ';
- if(dflt==RESPONSE_CANCEL)
- cout<<_("(cancel/ok)")<<endl;
- else
- cout<<_("(ok/cancel)")<<endl;
- string resp;
- cin>>resp;
-
- if(dflt==RESPONSE_CANCEL)
- {
- if(resp=="ok")
- return RESPONSE_OK;
- else
- return RESPONSE_CANCEL;
- }
- else
- {
- if(resp=="cancel")
- return RESPONSE_CANCEL;
- else
- return RESPONSE_OK;
- }
-}
-
-bool
-ConsoleUIInterface::task(const std::string &task)
-{
- cout<<task<<endl;
- return true;
-}
-
-bool
-ConsoleUIInterface::error(const std::string &task)
-{
- cout<<_("error: ")<<task<<endl;
- return true;
-}
-
-bool
-ConsoleUIInterface::warning(const std::string &task)
-{
- cout<<_("warning: ")<<task<<endl;
- return true;
-}
-
-bool
-ConsoleUIInterface::amount_complete(int current, int total)
-{
- return true;
-}
-
-
-
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file uimanager.h
-** \brief User Interface Manager Class
-**
-** $Id: uimanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_UIMANAGER_H
-#define __SINFG_APP_UIMANAGER_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <ETL/handle>
-#include <sinfg/general.h>
-#include <sinfg/string.h>
-#include <sigc++/object.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class UIInterface : public etl::shared_object, public sinfg::ProgressCallback, public sigc::trackable
-{
-public:
- enum Response
- {
- RESPONSE_CANCEL=-1,
- RESPONSE_NO=0,
- RESPONSE_YES=1,
- RESPONSE_OK=2
- };
- virtual ~UIInterface() { }
- virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
- virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
- virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK)=0;
-};
-
-class DefaultUIInterface : public UIInterface
-{
-public:
- Response yes_no(const std::string &title, const std::string &message,Response dflt)
- { return dflt; }
- Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
- { return dflt; }
- Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
- { return dflt; }
-
- bool task(const std::string &task)
- { return true; }
- bool error(const std::string &task)
- { return true; }
- bool warning(const std::string &task)
- { return true; }
- bool amount_complete(int current, int total)
- { return true; }
-};
-
-class ConfidentUIInterface : public UIInterface
-{
-public:
- Response yes_no(const std::string &title, const std::string &message,Response dflt)
- { return RESPONSE_YES; }
- Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
- { return RESPONSE_YES; }
- Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
- { return RESPONSE_OK; }
-
- bool task(const std::string &task)
- { return true; }
- bool error(const std::string &task)
- { return true; }
- bool warning(const std::string &task)
- { return true; }
- bool amount_complete(int current, int total)
- { return true; }
-};
-
-class ConsoleUIInterface : public UIInterface
-{
-public:
- Response yes_no(const std::string &title, const std::string &message,Response dflt);
- Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt);
- Response ok_cancel(const std::string &title, const std::string &message,Response dflt);
-
- bool task(const std::string &task);
- bool error(const std::string &task);
- bool warning(const std::string &task);
- bool amount_complete(int current, int total);
-};
-
-}; // END of namespace sinfgapp
-
-/* === E N D =============================================================== */
-
-#endif
+++ /dev/null
-/* === S I N F G =========================================================== */
-/*! \file value_desc.h
-** \brief Template Header
-**
-** $Id: value_desc.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
-**
-** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
-**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
-**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
-** \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SINFG_APP_VALUE_DESC_H
-#define __SINFG_APP_VALUE_DESC_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <sinfg/valuenode.h>
-#include <sinfg/string.h>
-#include <sinfg/layer.h>
-#include <sinfg/value.h>
-#include <sinfg/valuenode_const.h>
-#include <sinfg/canvas.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace sinfgapp {
-
-class ValueDesc
-{
- // Info for Layer parent
- sinfg::Layer::Handle layer;
- sinfg::String name;
-
- // Info for ValueNode parent
- sinfg::ValueNode::Handle parent_value_node;
- int index;
-
- // Info for exported ValueNode
- sinfg::Canvas::Handle canvas;
-
-public:
- bool operator==(const ValueDesc &rhs)const
- {
- if((layer||rhs.layer) && layer!=rhs.layer)
- return false;
- if((!name.empty()||!rhs.name.empty()) && name!=rhs.name)
- return false;
- if(layer)
- return true;
- if((canvas||rhs.canvas) && canvas!=rhs.canvas)
- return false;
- if((parent_value_node||rhs.parent_value_node) && parent_value_node!=rhs.parent_value_node)
- return false;
- if((index>-1||rhs.index>-1) && index!=rhs.index)
- return false;
- return true;
- }
- bool operator!=(const ValueDesc &rhs)const
- {
- return !operator==(rhs);
- }
-
-
- ValueDesc(sinfg::Layer::Handle layer,const sinfg::String& param_name):
- layer(layer),
- name(param_name) { }
-
- ValueDesc(sinfg::Layer::LooseHandle layer,const sinfg::String& param_name):
- layer(layer),
- name(param_name) { }
-
- ValueDesc(sinfg::LinkableValueNode::Handle parent_value_node,int index):
- parent_value_node(parent_value_node),
- index(index) { }
-
-// ValueDesc(sinfg::LinkableValueNode::Handle parent_value_node,const sinfg::String& param_name):
-// parent_value_node(parent_value_node),
-// index(parent_value_node->get_link_index_from_name(param_name)) { }
-
- ValueDesc(sinfg::Canvas::Handle canvas,const sinfg::String& name):
- name(name),
- canvas(canvas) { }
-
- ValueDesc(sinfg::ValueNode_Const::Handle parent_value_node):
- parent_value_node(parent_value_node),
- index(-1) { }
-
- ValueDesc() { }
-
- bool is_valid()const { return layer || parent_value_node || canvas; }
- operator bool()const { return is_valid(); }
-
- bool parent_is_layer_param()const { return (bool)layer; }
- bool parent_is_value_node()const { return (bool)parent_value_node; }
- bool parent_is_linkable_value_node()const { return parent_is_value_node() && index>=0; }
- bool parent_is_value_node_const()const { return parent_is_value_node() && index==-1; }
- bool parent_is_canvas()const { return (bool)canvas; }
-
- bool is_value_node()const { return parent_is_value_node() || parent_is_canvas() || (parent_is_layer_param() && (bool)layer->dynamic_param_list().count(name)); }
- bool is_const()const { return (parent_is_layer_param() && !layer->dynamic_param_list().count(name)) || parent_is_value_node_const(); }
-
- sinfg::Layer::Handle get_layer()const { assert(parent_is_layer_param()); return layer; }
- const sinfg::String& get_param_name()const { assert(parent_is_layer_param()); return name; }
-
- sinfg::ValueNode::Handle get_parent_value_node()const { assert(parent_is_value_node()); return parent_value_node; }
- int get_index()const { assert(parent_is_linkable_value_node()); return index; }
-
- const sinfg::String& get_value_node_id()const { assert(parent_is_canvas()); return name; }
-
- sinfg::Canvas::Handle get_canvas()const
- {
- if(canvas)
- return canvas;
- if(layer)
- return layer->get_canvas();
- if(parent_value_node)
- return parent_value_node->get_root_canvas();
- return 0;
- }
-
- sinfg::ValueNode::Handle
- get_value_node()const
- {
- if(parent_is_canvas())
- return canvas->find_value_node(name);
- if(parent_is_layer_param() && layer->dynamic_param_list().count(name))
- return layer->dynamic_param_list().find(name)->second;
- if(parent_is_linkable_value_node())
- return sinfg::LinkableValueNode::Handle::cast_reinterpret(parent_value_node)->get_link(index);
-// return reinterpret_cast<sinfg::LinkableValueNode*>(parent_value_node.get())->get_link(index);
- return 0;
- }
-
- sinfg::ValueBase
- get_value(sinfg::Time time=0)const
- {
- if(parent_is_value_node_const() && parent_value_node)
- return (*parent_value_node)(0);
- if(is_value_node() && get_value_node())
- return (*get_value_node())(time);
- if(parent_is_layer_param() && layer)
- return layer->get_param(name);
- return sinfg::ValueBase();
- }
-
- sinfg::ValueBase::Type
- get_value_type()const
- {
- sinfg::ValueNode::Handle value_node=get_value_node();
- if(value_node)
- return value_node->get_type();
- return get_value().get_type();
- }
-
- bool
- is_exported()const
- {
- return is_value_node() && get_value_node()->is_exported();
- }
-}; // END of class ValueDesc
-
-}; // END of namespace sinfgapp_instance
-
-/* === E N D =============================================================== */
-
-#endif
--- /dev/null
+# $Header: /opt/voria/cvs/studio/src/synfigapp/Makefile.am,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+
+MAINTAINERCLEANFILES=Makefile.in
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/libltdl
+
+LAYER_ACTION_HH=actions/layerremove.h actions/layermove.h actions/layerraise.h actions/layerlower.h actions/layeradd.h actions/layeractivate.h actions/layerparamset.h actions/layerparamconnect.h actions/layerparamdisconnect.h actions/layerencapsulate.h actions/layerduplicate.h actions/layersetdesc.h
+LAYER_ACTION_CC=actions/layerremove.cpp actions/layermove.cpp actions/layerraise.cpp actions/layerlower.cpp actions/layeradd.cpp actions/layeractivate.cpp actions/layerparamset.cpp actions/layerparamconnect.cpp actions/layerparamdisconnect.cpp actions/layerencapsulate.cpp actions/layerduplicate.cpp actions/layersetdesc.cpp
+
+VALUEDESC_ACTION_HH=actions/valuedescset.h actions/valuedescexport.h actions/valuedescconvert.h actions/valuedescconnect.h actions/valuedescdisconnect.h actions/valuedesclink.h
+VALUEDESC_ACTION_CC=actions/valuedescset.cpp actions/valuedescexport.cpp actions/valuedescconvert.cpp actions/valuedescconnect.cpp actions/valuedescdisconnect.cpp actions/valuedesclink.cpp
+
+VALUENODE_ACTION_HH=actions/valuenodeconstset.h actions/valuenodeadd.h actions/valuenodereplace.h actions/valuenodelinkconnect.h actions/valuenodelinkdisconnect.h actions/valuenodedynamiclistinsert.h actions/valuenodedynamiclistremove.h actions/valuenoderename.h actions/valuenoderemove.h actions/valuenodedynamiclistinsertsmart.h actions/valuenodedynamiclistremovesmart.h actions/valuenodedynamiclistloop.h actions/valuenodedynamiclistunloop.h actions/valuenodedynamiclistrotateorder.h
+VALUENODE_ACTION_CC=actions/valuenodeconstset.cpp actions/valuenodeadd.cpp actions/valuenodereplace.cpp actions/valuenodelinkconnect.cpp actions/valuenodelinkdisconnect.cpp actions/valuenodedynamiclistinsert.cpp actions/valuenodedynamiclistremove.cpp actions/valuenoderename.cpp actions/valuenoderemove.cpp actions/valuenodedynamiclistinsertsmart.cpp actions/valuenodedynamiclistremovesmart.cpp actions/valuenodedynamiclistloop.cpp actions/valuenodedynamiclistunloop.cpp actions/valuenodedynamiclistrotateorder.cpp
+
+WAYPOINT_ACTION_HH=actions/waypointadd.h actions/waypointset.h actions/waypointsetsmart.h actions/waypointremove.h actions/waypointsimpleadd.h
+WAYPOINT_ACTION_CC=actions/waypointadd.cpp actions/waypointset.cpp actions/waypointsetsmart.cpp actions/waypointremove.cpp actions/waypointsimpleadd.cpp
+
+TIMEPOINT_ACTION_HH=actions/timepointsmove.h actions/timepointscopy.h actions/timepointsdelete.h timegather.h
+TIMEPOINT_ACTION_CC=actions/timepointsmove.cpp actions/timepointscopy.cpp actions/timepointsdelete.cpp timegather.cpp
+
+ACTIVEPOINT_ACTION_HH=actions/activepointadd.h actions/activepointset.h actions/activepointsetsmart.h actions/activepointsetoff.h actions/activepointseton.h actions/activepointremove.h actions/activepointsimpleadd.h
+ACTIVEPOINT_ACTION_CC=actions/activepointadd.cpp actions/activepointset.cpp actions/activepointsetsmart.cpp actions/activepointsetoff.cpp actions/activepointseton.cpp actions/activepointremove.cpp actions/activepointsimpleadd.cpp
+
+KEYFRAME_ACTION_HH=actions/keyframesetdelta.h actions/keyframeadd.h actions/keyframeset.h actions/keyframeremove.h actions/keyframeduplicate.h actions/keyframewaypointset.h
+KEYFRAME_ACTION_CC=actions/keyframesetdelta.cpp actions/keyframeadd.cpp actions/keyframeset.cpp actions/keyframeremove.cpp actions/keyframeduplicate.cpp actions/keyframewaypointset.cpp
+
+CANVAS_ACTION_HH=actions/canvasrenddescset.h actions/canvasadd.h actions/canvasremove.h
+CANVAS_ACTION_CC=actions/canvasrenddescset.cpp actions/canvasadd.cpp actions/canvasremove.cpp
+
+GROUP_ACTION_HH=actions/groupaddlayers.h actions/groupremovelayers.h actions/groupremove.h actions/grouprename.h
+GROUP_ACTION_CC=actions/groupaddlayers.cpp actions/groupremovelayers.cpp actions/groupremove.cpp actions/grouprename.cpp
+
+OTHER_ACTION_HH=actions/colorset.h actions/editmodeset.h actions/blinepointtangentmerge.h actions/blinepointtangentsplit.h actions/gradientset.h
+OTHER_ACTION_CC=actions/colorset.cpp actions/editmodeset.cpp actions/blinepointtangentmerge.cpp actions/blinepointtangentsplit.cpp actions/gradientset.cpp
+
+ACTIONHH=$(GROUP_ACTION_HH) $(LAYER_ACTION_HH) $(VALUEDSEC_ACTION_HH) $(VALUENODE_ACTION_HH) $(WAYPOINT_ACTION_HH) $(KEYFRAME_ACTION_HH) $(OTHER_ACTION_HH) $(CANVAS_ACTION_HH) $(ACTIVEPOINT_ACTION_HH) $(TIMEPOINT_ACTION_HH)
+ACTIONCC=$(GROUP_ACTION_CC) $(LAYER_ACTION_CC) $(VALUEDESC_ACTION_CC) $(VALUENODE_ACTION_CC) $(WAYPOINT_ACTION_CC) $(KEYFRAME_ACTION_CC) $(OTHER_ACTION_CC) $(CANVAS_ACTION_CC) $(ACTIVEPOINT_ACTION_CC) $(TIMEPOINT_ACTION_CC)
+
+SYNFIGAPPHH=$(ACTIONHH) blineconvert.h cvs.h editmode.h action.h action_param.h action_system.h canvasinterface.h instance.h selectionmanager.h uimanager.h value_desc.h main.h inputdevice.h settings.h
+
+synfiglibdir=@synfiglibdir@
+
+lib_LTLIBRARIES = libsynfigapp.la
+libsynfigapp_la_SOURCES = $(SYNFIGAPPHH) $(ACTIONCC) blineconvert.cpp cvs.cpp main.cpp action_param.cpp action.cpp action_system.cpp canvasinterface.cpp instance.cpp uimanager.cpp inputdevice.cpp settings.cpp
+libsynfigapp_la_LIBADD = @SYNFIG_LIBS@
+libsynfigapp_la_CXXFLAGS = @SYNFIG_CFLAGS@
+libsynfigapp_la_LDFLAGS = -export-dynamic -no-undefined
+
+include_synfigappdir=$(prefix)/include/synfigapp-0.0/synfigapp
+include_synfigapp_HEADERS = $(SYNFIGAPPHH)
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action.cpp
+** \brief Template File
+**
+** $Id: action.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "action.h"
+#include "instance.h"
+
+
+#include "actions/layerremove.h"
+#include "actions/layermove.h"
+#include "actions/layerraise.h"
+#include "actions/layerlower.h"
+#include "actions/layeradd.h"
+#include "actions/layeractivate.h"
+#include "actions/layerparamset.h"
+#include "actions/layerparamconnect.h"
+#include "actions/layerparamdisconnect.h"
+#include "actions/layerencapsulate.h"
+#include "actions/layerduplicate.h"
+#include "actions/layersetdesc.h"
+
+#include "actions/valuenodeconstset.h"
+#include "actions/valuenodeadd.h"
+#include "actions/valuenodereplace.h"
+#include "actions/valuenodelinkconnect.h"
+#include "actions/valuenodelinkdisconnect.h"
+#include "actions/valuenodedynamiclistinsert.h"
+#include "actions/valuenodedynamiclistremove.h"
+#include "actions/valuenodedynamiclistinsertsmart.h"
+#include "actions/valuenodedynamiclistremovesmart.h"
+#include "actions/valuenodedynamiclistloop.h"
+#include "actions/valuenodedynamiclistunloop.h"
+#include "actions/valuenodedynamiclistrotateorder.h"
+#include "actions/valuenoderename.h"
+#include "actions/valuenoderemove.h"
+
+#include "actions/valuedescset.h"
+#include "actions/valuedescexport.h"
+#include "actions/valuedescconvert.h"
+#include "actions/valuedescconnect.h"
+#include "actions/valuedescdisconnect.h"
+#include "actions/valuedesclink.h"
+
+#include "actions/waypointadd.h"
+#include "actions/waypointset.h"
+#include "actions/waypointsetsmart.h"
+#include "actions/waypointremove.h"
+
+#include "actions/activepointadd.h"
+#include "actions/activepointset.h"
+#include "actions/activepointsetsmart.h"
+#include "actions/activepointsetoff.h"
+#include "actions/activepointseton.h"
+#include "actions/activepointremove.h"
+
+#include "actions/keyframeadd.h"
+#include "actions/keyframeset.h"
+#include "actions/keyframeremove.h"
+#include "actions/keyframeduplicate.h"
+#include "actions/keyframewaypointset.h"
+#include "actions/keyframesetdelta.h"
+
+#include "actions/timepointsmove.h"
+#include "actions/timepointscopy.h"
+#include "actions/timepointsdelete.h"
+
+#include "actions/canvasrenddescset.h"
+#include "actions/canvasadd.h"
+#include "actions/canvasremove.h"
+
+#include "actions/editmodeset.h"
+
+#include "actions/blinepointtangentmerge.h"
+#include "actions/blinepointtangentsplit.h"
+
+#include "actions/gradientset.h"
+#include "actions/colorset.h"
+
+#include "actions/groupaddlayers.h"
+#include "actions/groupremovelayers.h"
+#include "actions/groupremove.h"
+#include "actions/grouprename.h"
+
+#include "canvasinterface.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === S T A T I C S ======================================================= */
+
+synfigapp::Action::Book *book_;
+
+/* === M E T H O D S ======================================================= */
+
+#define ADD_ACTION(x) { BookEntry &be(book()[x::name__]); \
+ be.name=x::name__; \
+ be.local_name=x::local_name__; \
+ be.version=x::version__; \
+ be.task=x::task__; \
+ be.priority=x::priority__; \
+ be.category=x::category__; \
+ be.factory=x::create; \
+ be.get_param_vocab=x::get_param_vocab; \
+ be.is_canidate=x::is_canidate; \
+ }
+
+
+Action::Main::Main()
+{
+ book_=new synfigapp::Action::Book();
+
+ ADD_ACTION(Action::LayerRemove);
+ ADD_ACTION(Action::LayerMove);
+ ADD_ACTION(Action::LayerRaise);
+ ADD_ACTION(Action::LayerLower);
+ ADD_ACTION(Action::LayerAdd);
+ ADD_ACTION(Action::LayerActivate);
+ ADD_ACTION(Action::LayerParamSet);
+ ADD_ACTION(Action::LayerParamConnect);
+ ADD_ACTION(Action::LayerParamDisconnect);
+ ADD_ACTION(Action::LayerEncapsulate);
+ ADD_ACTION(Action::LayerDuplicate);
+ ADD_ACTION(Action::LayerSetDesc);
+
+ ADD_ACTION(Action::ValueNodeConstSet);
+ ADD_ACTION(Action::ValueNodeAdd);
+ ADD_ACTION(Action::ValueNodeReplace);
+ ADD_ACTION(Action::ValueNodeLinkConnect);
+ ADD_ACTION(Action::ValueNodeLinkDisconnect);
+ ADD_ACTION(Action::ValueNodeDynamicListInsert);
+ ADD_ACTION(Action::ValueNodeDynamicListRemove);
+ ADD_ACTION(Action::ValueNodeDynamicListInsertSmart);
+ ADD_ACTION(Action::ValueNodeDynamicListRemoveSmart);
+ ADD_ACTION(Action::ValueNodeDynamicListLoop);
+ ADD_ACTION(Action::ValueNodeDynamicListUnLoop);
+ ADD_ACTION(Action::ValueNodeDynamicListRotateOrder);
+ ADD_ACTION(Action::ValueNodeRename);
+ ADD_ACTION(Action::ValueNodeRemove);
+
+ ADD_ACTION(Action::ValueDescSet);
+ ADD_ACTION(Action::ValueDescExport);
+ ADD_ACTION(Action::ValueDescConvert);
+ ADD_ACTION(Action::ValueDescConnect);
+ ADD_ACTION(Action::ValueDescDisconnect);
+ ADD_ACTION(Action::ValueDescLink);
+
+ ADD_ACTION(Action::WaypointAdd);
+ ADD_ACTION(Action::WaypointSet);
+ ADD_ACTION(Action::WaypointSetSmart);
+ ADD_ACTION(Action::WaypointRemove);
+
+ ADD_ACTION(Action::ActivepointAdd);
+ ADD_ACTION(Action::ActivepointSet);
+ ADD_ACTION(Action::ActivepointSetSmart);
+ ADD_ACTION(Action::ActivepointSetOn);
+ ADD_ACTION(Action::ActivepointSetOff);
+ ADD_ACTION(Action::ActivepointRemove);
+
+ ADD_ACTION(Action::KeyframeAdd);
+ ADD_ACTION(Action::KeyframeSet);
+ ADD_ACTION(Action::KeyframeRemove);
+ ADD_ACTION(Action::KeyframeDuplicate);
+ ADD_ACTION(Action::KeyframeWaypointSet);
+ ADD_ACTION(Action::KeyframeSetDelta);
+
+ ADD_ACTION(Action::CanvasRendDescSet);
+ ADD_ACTION(Action::CanvasAdd);
+ ADD_ACTION(Action::CanvasRemove);
+
+ ADD_ACTION(Action::EditModeSet);
+
+ ADD_ACTION(Action::BLinePointTangentMerge);
+ ADD_ACTION(Action::BLinePointTangentSplit);
+
+ ADD_ACTION(Action::GradientSet);
+ ADD_ACTION(Action::ColorSet);
+
+ ADD_ACTION(Action::TimepointsMove);
+ ADD_ACTION(Action::TimepointsCopy);
+ ADD_ACTION(Action::TimepointsDelete);
+
+ ADD_ACTION(Action::GroupAddLayers);
+ ADD_ACTION(Action::GroupRemoveLayers);
+ ADD_ACTION(Action::GroupRemove);
+ ADD_ACTION(Action::GroupRename);
+}
+
+Action::Main::~Main()
+{
+ delete book_;
+
+}
+
+
+Action::Book& Action::book() { return *book_; }
+
+
+Action::Handle
+Action::create(const String &name)
+{
+ if(!book().count(name))
+ return 0; //! \todo perhaps we should throw something instead?
+ return book()[name].factory();
+}
+
+
+Action::CanidateList
+Action::compile_canidate_list(const ParamList& param_list, Category category)
+{
+ Action::CanidateList ret;
+
+ Book::const_iterator iter;
+
+ //synfig::info("param_list.size()=%d",param_list.size());
+
+ for(iter=book().begin();iter!=book().end();++iter)
+ {
+ if((iter->second.category&category))
+ {
+ if(iter->second.is_canidate(param_list))
+ ret.push_back(iter->second);
+ else
+ {
+ //synfig::info("Action \"%s\" is not a canidate",iter->second.name.c_str());
+ }
+ }
+ }
+
+ return ret;
+}
+
+Action::CanidateList::iterator
+Action::CanidateList::find(const String& x)
+{
+ iterator iter;
+ for(iter=begin();iter!=end();++iter)
+ if(iter->name==x)
+ break;
+ return iter;
+}
+
+void
+Action::Base::set_param_list(const ParamList ¶m_list)
+{
+ ParamList::const_iterator iter;
+
+ for(iter=param_list.begin();iter!=param_list.end();++iter)
+ set_param(iter->first,iter->second);
+}
+
+void
+Super::perform()
+{
+ set_dirty(false);
+
+ prepare();
+
+ ActionList::const_iterator iter;
+ for(iter=action_list_.begin();iter!=action_list_.end();++iter)
+ {
+ try
+ {
+ try
+ {
+ (*iter)->perform();
+ CanvasSpecific* canvas_specific(dynamic_cast<CanvasSpecific*>(iter->get()));
+ if(canvas_specific && canvas_specific->is_dirty())
+ set_dirty(true);
+ }
+ catch(...)
+ {
+ if(iter!=action_list_.begin())
+ {
+ for(--iter;iter!=action_list_.begin();--iter)
+ (*iter)->undo();
+ (*iter)->undo();
+ }
+ throw;
+ }
+ }
+ catch(Error x)
+ {
+ throw Error(x.get_type(),((*iter)->get_name()+": "+x.get_desc()).c_str());
+ }
+ }
+}
+
+void
+Super::undo()
+{
+ set_dirty(false);
+
+ ActionList::const_reverse_iterator iter;
+ for(iter=const_cast<const ActionList &>(action_list_).rbegin();iter!=const_cast<const ActionList &>(action_list_).rend();++iter)
+ {
+ try {
+ (*iter)->undo();
+ CanvasSpecific* canvas_specific(dynamic_cast<CanvasSpecific*>(iter->get()));
+ if(canvas_specific && canvas_specific->is_dirty())
+ set_dirty(true);
+ }
+ catch(...)
+ {
+ if(iter!=const_cast<const ActionList &>(action_list_).rbegin())
+ {
+ for(--iter;iter!=const_cast<const ActionList &>(action_list_).rbegin();--iter)
+ (*iter)->perform();
+ (*iter)->perform();
+ }
+ throw;
+ }
+ }
+}
+
+void
+Super::add_action(etl::handle<Undoable> action)
+{
+ action_list_.push_back(action);
+ CanvasSpecific *specific_action=dynamic_cast<CanvasSpecific *>(action.get());
+ if(specific_action && !get_canvas())
+ set_canvas(specific_action->get_canvas());
+}
+
+void
+Super::add_action_front(etl::handle<Undoable> action)
+{
+ action_list_.push_front(action);
+ CanvasSpecific *specific_action=dynamic_cast<CanvasSpecific *>(action.get());
+ if(specific_action && !get_canvas())
+ set_canvas(specific_action->get_canvas());
+}
+
+
+Group::Group(const std::string &str):
+ name_(str),
+ ready_(true)
+{
+}
+
+Group::~Group()
+{
+}
+
+
+
+
+Action::ParamVocab
+Action::CanvasSpecific::get_param_vocab()
+{
+ ParamVocab ret;
+
+ ret.push_back(ParamDesc("canvas",Param::TYPE_CANVAS)
+ .set_local_name(_("Canvas"))
+ .set_desc(_("Selected Canvas"))
+ );
+
+ ret.push_back(ParamDesc("canvas_interface",Param::TYPE_CANVASINTERFACE)
+ .set_local_name(_("Canvas Interface"))
+ .set_desc(_("Canvas Interface"))
+ .set_optional(true)
+ );
+
+
+ return ret;
+}
+
+bool
+CanvasSpecific::set_param(const synfig::String& name, const Param ¶m)
+{
+ if(name=="canvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ if(!param.get_canvas())
+ return false;
+ set_canvas(param.get_canvas());
+
+ return true;
+ }
+ if(name=="canvas_interface" && param.get_type()==Param::TYPE_CANVASINTERFACE)
+ {
+ if(!param.get_canvas_interface())
+ return false;
+ set_canvas_interface(param.get_canvas_interface());
+ if(!get_canvas())
+ set_canvas(get_canvas_interface()->get_canvas());
+
+ return true;
+ }
+ if(name=="edit_mode" && param.get_type()==Param::TYPE_EDITMODE)
+ {
+ set_edit_mode(param.get_edit_mode());
+
+ return true;
+ }
+
+ return false;
+}
+
+bool
+CanvasSpecific::is_ready()const
+{
+ if(!get_canvas())
+ return false;
+ return true;
+}
+
+EditMode
+CanvasSpecific::get_edit_mode()const
+{
+ if(mode_!=MODE_UNDEFINED)
+ return mode_;
+
+ if(get_canvas_interface())
+ return get_canvas_interface()->get_mode();
+
+ return MODE_NORMAL;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action.h
+** \brief Template File
+**
+** $Id: action.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_H
+#define __SYNFIG_APP_ACTION_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/string.h>
+#include <synfig/canvas.h>
+#include <ETL/handle>
+#include <ETL/stringf>
+#include <ETL/trivial>
+
+#include <map>
+#include <list>
+
+#include <synfig/layer.h>
+#include <synfig/canvas.h>
+#include <synfig/valuenode.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/value.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/string.h>
+#include <synfig/keyframe.h>
+
+#include "action_param.h"
+#include "editmode.h"
+
+/* === M A C R O S ========================================================= */
+
+#define ACTION_MODULE_EXT public: \
+ static const char name__[], local_name__[], version__[], cvs_id__[], task__[]; \
+ static const Category category__; \
+ static const int priority__; \
+ static Action::Base *create(); \
+ virtual synfig::String get_name()const; \
+ virtual synfig::String get_local_name()const;
+
+
+#define ACTION_SET_NAME(class,x) const char class::name__[]=x
+
+#define ACTION_SET_CATEGORY(class,x) const Category class::category__(x)
+
+#define ACTION_SET_TASK(class,x) const char class::task__[]=x
+
+#define ACTION_SET_PRIORITY(class,x) const int class::priority__=x
+
+#define ACTION_SET_LOCAL_NAME(class,x) const char class::local_name__[]=x
+
+#define ACTION_SET_VERSION(class,x) const char class::version__[]=x
+
+#define ACTION_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
+
+#define ACTION_INIT(class) \
+ Action::Base* class::create() { return new class(); } \
+ synfig::String class::get_name()const { return name__; } \
+ synfig::String class::get_local_name()const { return local_name__; } \
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfig {
+class ProgressCallback;
+class Canvas;
+}; // END of namespace synfig
+
+namespace synfigapp {
+
+class Instance;
+class Main;
+
+namespace Action {
+
+class System;
+
+
+//! Exception class, thrown when redoing or undoing an action
+class Error
+{
+public:
+ enum Type
+ {
+ TYPE_UNKNOWN,
+ TYPE_UNABLE,
+ TYPE_BADPARAM,
+ TYPE_CRITICAL,
+ TYPE_NOTREADY,
+ TYPE_BUG,
+
+ TYPE_END
+ };
+private:
+
+ Type type_;
+ synfig::String desc_;
+
+public:
+
+ Error(Type type, const char *format, ...):
+ type_(type)
+ {
+ va_list args;
+ va_start(args,format);
+ desc_=etl::vstrprintf(format,args);
+ }
+
+ Error(const char *format, ...):
+ type_(TYPE_UNKNOWN)
+ {
+ va_list args;
+ va_start(args,format);
+ desc_=etl::vstrprintf(format,args);
+ }
+
+ Error(Type type=TYPE_UNABLE):
+ type_(type)
+ {
+ }
+
+ Type get_type()const { return type_; }
+ synfig::String get_desc()const { return desc_; }
+
+}; // END of class Action::Error
+
+class Param;
+class ParamList;
+class ParamDesc;
+class ParamVocab;
+
+// Action Category
+enum Category
+{
+ CATEGORY_NONE =0,
+ CATEGORY_LAYER =(1<<0),
+ CATEGORY_CANVAS =(1<<1),
+ CATEGORY_WAYPOINT =(1<<2),
+ CATEGORY_ACTIVEPOINT =(1<<3),
+ CATEGORY_VALUEDESC =(1<<4),
+ CATEGORY_VALUENODE =(1<<5),
+ CATEGORY_KEYFRAME =(1<<6),
+ CATEGORY_GROUP =(1<<7),
+
+ CATEGORY_OTHER =(1<<12),
+
+ CATEGORY_DRAG =(1<<24),
+
+ CATEGORY_HIDDEN =(1<<31),
+ CATEGORY_ALL =(~0)-(1<<31) //!< All categories (EXCEPT HIDDEN)
+}; // END of enum Category
+
+inline Category operator|(Category lhs, Category rhs)
+{ return static_cast<Category>(int(lhs)|int(rhs)); }
+
+
+
+//! Action Base Class
+/*! An action should implement the following functions:
+** static bool is_canidate(const ParamList &x);
+** - Checks the ParamList to see if this action could be performed.
+** static ParamVocab get_param_vocab();
+** - Yields the ParamVocab object which describes what
+** this action needs before it can perform the act.
+** static Action::Base* create();
+** - Factory for creating this action from a ParamList
+**
+*/
+class Base : public etl::shared_object
+{
+protected:
+ Base() { }
+
+public:
+ virtual ~Base() { };
+
+ //! This function will throw an Action::Error() on failure
+ virtual void perform()=0;
+
+ virtual bool set_param(const synfig::String& name, const Param &) { return false; }
+ virtual bool is_ready()const=0;
+
+ virtual synfig::String get_name()const =0;
+ virtual synfig::String get_local_name()const { return get_name(); }
+
+ void set_param_list(const ParamList &);
+
+}; // END of class Action::Base
+
+typedef Action::Base* (*Factory)();
+typedef bool (*CanidateChecker)(const ParamList &x);
+typedef ParamVocab (*GetParamVocab)();
+
+typedef etl::handle<Base> Handle;
+
+//! Undoable Action Base Class
+class Undoable : public Base
+{
+ friend class System;
+ bool active_;
+
+protected:
+ Undoable():active_(true) { }
+
+private:
+ void set_active(bool x) { active_=x; }
+
+public:
+
+ //! This function will throw an Action::Error() on failure
+ virtual void undo()=0;
+
+ bool is_active()const { return active_; }
+
+}; // END of class Action::Undoable
+
+//! Action base class for canvas-specific actions
+class CanvasSpecific
+{
+private:
+ bool is_dirty_;
+ EditMode mode_;
+
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
+ synfig::Canvas::Handle canvas_;
+
+protected:
+ CanvasSpecific(const synfig::Canvas::Handle &canvas):is_dirty_(true),mode_(MODE_UNDEFINED),canvas_(canvas) { }
+ CanvasSpecific():mode_(MODE_UNDEFINED) { }
+
+ virtual ~CanvasSpecific() { };
+
+
+public:
+
+ void set_canvas(synfig::Canvas::Handle x) { canvas_=x; }
+ void set_canvas_interface(etl::loose_handle<synfigapp::CanvasInterface> x) { canvas_interface_=x; }
+
+ synfig::Canvas::Handle get_canvas()const { return canvas_; }
+ etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
+
+ static ParamVocab get_param_vocab();
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ EditMode get_edit_mode()const;
+
+ void set_edit_mode(EditMode x) { mode_=x; }
+
+ bool is_dirty()const { return is_dirty_; }
+ void set_dirty(bool x=true) { is_dirty_=x; }
+
+}; // END of class Action::Undoable
+
+typedef std::list< etl::handle<Action::Undoable> > ActionList;
+
+/*! \class synfigapp::Action::Super
+** \brief Super-Action base class for actions composed of several other actions.
+**
+** Actions deriving from this class should only implement prepare(), and
+** NOT implement perform() or undo().
+*/
+class Super : public Undoable, public CanvasSpecific
+{
+ ActionList action_list_;
+
+public:
+
+ ActionList &action_list() { return action_list_; }
+ const ActionList &action_list()const { return action_list_; }
+
+ virtual void prepare()=0;
+
+ void clear() { action_list().clear(); }
+
+ bool first_time()const { return action_list_.empty(); }
+
+ void add_action(etl::handle<Undoable> action);
+
+ void add_action_front(etl::handle<Undoable> action);
+
+ virtual void perform();
+ virtual void undo();
+
+}; // END of class Action::Super
+
+
+class Group : public Super
+{
+ synfig::String name_;
+
+ ActionList action_list_;
+protected:
+ bool ready_;
+public:
+ Group(const synfig::String &str="Group");
+ virtual ~Group();
+
+ virtual synfig::String get_name()const { return name_; }
+
+ virtual void prepare() { };
+
+ virtual bool set_param(const synfig::String& name, const Param &)const { return false; }
+ virtual bool is_ready()const { return ready_; }
+
+ void set_name(std::string&x) { name_=x; }
+}; // END of class Action::Group
+
+
+
+
+
+struct BookEntry
+{
+ synfig::String name;
+ synfig::String local_name;
+ synfig::String version;
+ synfig::String task;
+ int priority;
+ Category category;
+ Factory factory;
+ CanidateChecker is_canidate;
+ GetParamVocab get_param_vocab;
+
+ bool operator<(const BookEntry &rhs)const { return priority<rhs.priority; }
+}; // END of struct BookEntry
+
+typedef std::map<synfig::String,BookEntry> Book;
+
+class CanidateList : public std::list<BookEntry>
+{
+public:
+ iterator find(const synfig::String& x);
+ const_iterator find(const synfig::String& x)const { return const_cast<CanidateList*>(this)->find(x); }
+};
+
+Book& book();
+
+Handle create(const synfig::String &name);
+
+//! Compiles a list of potential canidate actions with the given \a param_list and \a category
+CanidateList compile_canidate_list(const ParamList& param_list, Category category=CATEGORY_ALL);
+
+/*! \class synfigapp::Action::Main
+** \brief \writeme
+**
+** \writeme
+*/
+class Main
+{
+ friend class synfigapp::Main;
+
+ Main();
+
+public:
+ ~Main();
+
+}; // END of class Action::Main
+
+}; // END of namespace Action
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_param.cpp
+** \brief Template File
+**
+** $Id: action_param.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "action_param.h"
+#include "action.h"
+#include "canvasinterface.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === P R O C E D U R E S ================================================= */
+
+bool
+Action::canidate_check(const ParamVocab& param_vocab, const ParamList& param_list)
+{
+ ParamVocab::const_iterator iter;
+
+ for(iter=param_vocab.begin();iter!=param_vocab.end();++iter)
+ {
+ int n(param_list.count(iter->get_name()));
+
+// if(n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
+// return false;
+
+ if(!n && !iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
+ continue;
+
+ if(iter->get_user_supplied() || iter->get_optional())
+ continue;
+
+ if(n==0)
+ return false;
+ if(n==1 && iter->get_requires_multiple())
+ return false;
+ if(n>1 && !iter->get_supports_multiple())
+ return false;
+
+ if(iter->get_type()!=param_list.find(iter->get_name())->second.get_type())
+ return false;
+ }
+ return true;
+}
+
+/* === S T A T I C S ======================================================= */
+
+struct _ParamCounter
+{
+ static int counter;
+ ~_ParamCounter()
+ {
+ if(counter)
+ synfig::error("%d action params not yet deleted!",counter);
+ }
+} _param_counter;
+
+int _ParamCounter::counter(0);
+
+/* === M E T H O D S ======================================================= */
+
+Param::Param(const Param &rhs):
+ type_(rhs.type_)
+{
+ _ParamCounter::counter++;
+ switch(type_)
+ {
+ case TYPE_ACTIVEPOINT:
+ data.activepoint.construct();
+ data.activepoint.get()=rhs.data.activepoint.get();
+ break;
+ case TYPE_WAYPOINT:
+ data.waypoint.construct();
+ data.waypoint.get()=rhs.data.waypoint.get();
+ break;
+ case TYPE_WAYPOINTMODEL:
+ data.waypoint_model.construct();
+ data.waypoint_model.get()=rhs.data.waypoint_model.get();
+ break;
+ case TYPE_KEYFRAME:
+ data.keyframe.construct();
+ data.keyframe.get()=rhs.data.keyframe.get();
+ break;
+ case TYPE_CANVAS:
+ data.canvas.construct();
+ data.canvas.get()=rhs.data.canvas.get();
+ break;
+ case TYPE_CANVASINTERFACE:
+ data.canvas_interface.construct();
+ data.canvas_interface.get()=rhs.data.canvas_interface.get();
+ break;
+ case TYPE_LAYER:
+ data.layer.construct();
+ data.layer.get()=rhs.data.layer.get();
+ break;
+ case TYPE_VALUENODE:
+ data.value_node.construct();
+ data.value_node.get()=rhs.data.value_node.get();
+ break;
+ case TYPE_VALUEDESC:
+ data.value_desc.construct();
+ data.value_desc.get()=rhs.data.value_desc.get();
+ break;
+ case TYPE_VALUE:
+ data.value.construct();
+ data.value.get()=rhs.data.value.get();
+ break;
+ case TYPE_STRING:
+ data.string.construct();
+ data.string.get()=rhs.data.string.get();
+ break;
+ case TYPE_RENDDESC:
+ data.rend_desc.construct();
+ data.rend_desc.get()=rhs.data.rend_desc.get();
+ break;
+ case TYPE_TIME:
+ data.time.construct();
+ data.time.get()=rhs.data.time.get();
+ break;
+
+ case TYPE_INTEGER:
+ data.integer=rhs.data.integer;
+ break;
+ case TYPE_EDITMODE:
+ data.edit_mode=rhs.data.edit_mode;
+ break;
+ case TYPE_REAL:
+ data.real=rhs.data.real;
+ break;
+ case TYPE_BOOL:
+ data.b=rhs.data.b;
+ break;
+
+ case TYPE_NIL:
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+}
+
+Param::Param(const etl::handle<synfigapp::CanvasInterface>& x):
+
+ type_(TYPE_CANVASINTERFACE)
+{
+ _ParamCounter::counter++;
+ data.canvas_interface.construct();
+ data.canvas_interface.get()=x;
+}
+
+/*
+Param::Param(synfigapp::CanvasInterface* x):
+
+ type_(TYPE_CANVASINTERFACE)
+{
+ _ParamCounter::counter++;
+ data.canvas_interface.construct();
+ data.canvas_interface=x;
+}
+*/
+
+Param::Param(const etl::loose_handle<synfigapp::CanvasInterface>& x):
+
+ type_(TYPE_CANVASINTERFACE)
+{
+ _ParamCounter::counter++;
+ data.canvas_interface.construct();
+ data.canvas_interface.get()=x;
+}
+
+Param::Param(const synfig::Canvas::Handle& x):
+ type_(TYPE_CANVAS)
+{
+ _ParamCounter::counter++;
+ data.canvas.construct();
+ data.canvas.get()=x;
+}
+
+Param::Param(const synfig::Canvas::LooseHandle& x):
+ type_(TYPE_CANVAS)
+{
+ _ParamCounter::counter++;
+ data.canvas.construct();
+ data.canvas.get()=x;
+}
+
+Param::Param(const synfig::Layer::Handle& x):
+
+ type_(TYPE_LAYER)
+{
+ _ParamCounter::counter++;
+ data.layer.construct();
+ data.layer.get()=x;
+}
+
+Param::Param(const synfig::Layer::LooseHandle& x):
+
+ type_(TYPE_LAYER)
+{
+ _ParamCounter::counter++;
+ data.layer.construct();
+ data.layer.get()=x;
+}
+
+Param::Param(const synfig::ValueNode::Handle& x):
+
+ type_(TYPE_VALUENODE)
+{
+ _ParamCounter::counter++;
+ data.value_node.construct();
+ data.value_node.get()=x;
+}
+
+Param::Param(const synfig::ValueNode::LooseHandle& x):
+
+ type_(TYPE_VALUENODE)
+{
+ _ParamCounter::counter++;
+ data.value_node.construct();
+ data.value_node.get()=x;
+}
+
+Param::Param(const synfig::ValueBase& x):
+
+ type_(TYPE_VALUE)
+{
+ _ParamCounter::counter++;
+ data.value.construct();
+ data.value.get()=x;
+}
+
+Param::Param(const synfig::RendDesc& x):
+ type_(TYPE_RENDDESC)
+{
+ _ParamCounter::counter++;
+ data.rend_desc.construct();
+ data.rend_desc.get()=x;
+}
+
+Param::Param(const synfig::Time& x):
+ type_(TYPE_TIME)
+{
+ _ParamCounter::counter++;
+ data.time.construct();
+ data.time.get()=x;
+}
+
+Param::Param(const synfig::Activepoint& x):
+
+ type_(TYPE_ACTIVEPOINT)
+{
+ _ParamCounter::counter++;
+ data.activepoint.construct();
+ data.activepoint.get()=x;
+}
+
+Param::Param(const synfig::Waypoint& x):
+ type_(TYPE_WAYPOINT)
+{
+ _ParamCounter::counter++;
+ data.waypoint.construct();
+ data.waypoint.get()=x;
+}
+
+Param::Param(const synfig::Waypoint::Model& x):
+ type_(TYPE_WAYPOINTMODEL)
+{
+ _ParamCounter::counter++;
+ data.waypoint_model.construct();
+ data.waypoint_model.get()=x;
+}
+
+Param::Param(const synfig::String& x):
+ type_(TYPE_STRING)
+{
+ _ParamCounter::counter++;
+ data.string.construct();
+ data.string.get()=x;
+}
+
+Param::Param(const char * x):
+ type_(TYPE_STRING)
+{
+ _ParamCounter::counter++;
+ data.string.construct();
+ data.string.get()=x;
+}
+
+Param::Param(const synfig::Keyframe& x):
+
+ type_(TYPE_KEYFRAME)
+{
+ _ParamCounter::counter++;
+ data.keyframe.construct();
+ data.keyframe.get()=x;
+}
+
+Param::Param(const synfigapp::ValueDesc& x):
+
+ type_(TYPE_VALUEDESC)
+{
+ _ParamCounter::counter++;
+ data.value_desc.construct();
+ data.value_desc.get()=x;
+}
+
+Param::Param(const int& x):
+ type_(TYPE_INTEGER)
+{
+ _ParamCounter::counter++;
+ data.integer=x;
+}
+
+Param::Param(const EditMode& x):
+ type_(TYPE_EDITMODE)
+{
+ _ParamCounter::counter++;
+ data.edit_mode=x;
+}
+
+Param::Param(const synfig::Real& x):
+
+ type_(TYPE_REAL)
+{
+ _ParamCounter::counter++;
+ data.real=x;
+}
+
+Param::Param(const bool& x):
+
+ type_(TYPE_BOOL)
+{
+ _ParamCounter::counter++;
+ data.b=x;
+}
+
+Param::~Param()
+{
+ clear();
+ _ParamCounter::counter--;
+}
+
+Param&
+Param::operator=(const Param& rhs)
+{
+ clear();
+ type_=rhs.type_;
+
+ switch(type_)
+ {
+ case TYPE_ACTIVEPOINT:
+ data.activepoint.construct();
+ data.activepoint.get()=rhs.data.activepoint.get();
+ break;
+ case TYPE_WAYPOINT:
+ data.waypoint.construct();
+ data.waypoint.get()=rhs.data.waypoint.get();
+ break;
+ case TYPE_WAYPOINTMODEL:
+ data.waypoint_model.construct();
+ data.waypoint_model.get()=rhs.data.waypoint_model.get();
+ break;
+ case TYPE_KEYFRAME:
+ data.keyframe.construct();
+ data.keyframe.get()=rhs.data.keyframe.get();
+ break;
+ case TYPE_CANVAS:
+ data.canvas.construct();
+ data.canvas.get()=rhs.data.canvas.get();
+ break;
+ case TYPE_CANVASINTERFACE:
+ data.canvas_interface.construct();
+ data.canvas_interface.get()=rhs.data.canvas_interface.get();
+ break;
+ case TYPE_TIME:
+ data.time.construct();
+ data.time.get()=rhs.data.time.get();
+ break;
+ case TYPE_LAYER:
+ data.layer.construct();
+ data.layer.get()=rhs.data.layer.get();
+ break;
+ case TYPE_VALUENODE:
+ data.value_node.construct();
+ data.value_node.get()=rhs.data.value_node.get();
+ break;
+ case TYPE_VALUEDESC:
+ data.value_desc.construct();
+ data.value_desc.get()=rhs.data.value_desc.get();
+ break;
+ case TYPE_VALUE:
+ data.value.construct();
+ data.value.get()=rhs.data.value.get();
+ break;
+ case TYPE_RENDDESC:
+ data.rend_desc.construct();
+ data.rend_desc.get()=rhs.data.rend_desc.get();
+ break;
+ case TYPE_STRING:
+ data.string.construct();
+ data.string.get()=rhs.data.string.get();
+ break;
+
+ case TYPE_INTEGER:
+ data.integer=rhs.data.integer;
+ break;
+ case TYPE_EDITMODE:
+ data.integer=rhs.data.integer;
+ break;
+ case TYPE_REAL:
+ data.real=rhs.data.real;
+ break;
+ case TYPE_BOOL:
+ data.b=rhs.data.b;
+ break;
+
+ case TYPE_NIL:
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+ return *this;
+}
+
+void
+Param::clear()
+{
+ switch(type_)
+ {
+ case TYPE_ACTIVEPOINT:
+ data.activepoint.destruct();
+ break;
+ case TYPE_WAYPOINT:
+ data.waypoint.destruct();
+ break;
+ case TYPE_WAYPOINTMODEL:
+ data.waypoint_model.destruct();
+ break;
+ case TYPE_KEYFRAME:
+ data.keyframe.destruct();
+ break;
+ case TYPE_CANVAS:
+ data.canvas.destruct();
+ break;
+ case TYPE_CANVASINTERFACE:
+ data.canvas_interface.destruct();
+ break;
+ case TYPE_LAYER:
+ data.layer.destruct();
+ break;
+ case TYPE_TIME:
+ data.time.destruct();
+ break;
+ case TYPE_VALUENODE:
+ data.value_node.destruct();
+ break;
+ case TYPE_VALUEDESC:
+ data.value_desc.destruct();
+ break;
+ case TYPE_VALUE:
+ data.value.destruct();
+ break;
+ case TYPE_RENDDESC:
+ data.rend_desc.destruct();
+ break;
+ case TYPE_STRING:
+ data.string.destruct();
+ break;
+
+ case TYPE_NIL:
+ case TYPE_EDITMODE:
+ case TYPE_INTEGER:
+ case TYPE_REAL:
+ case TYPE_BOOL:
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+ type_=TYPE_NIL;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_param.h
+** \brief Template File
+**
+** $Id: action_param.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_PARAM_H
+#define __SYNFIG_APP_ACTION_PARAM_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/string.h>
+#include <synfig/canvas.h>
+#include <ETL/handle>
+#include <ETL/stringf>
+#include <ETL/trivial>
+
+#include <map>
+#include <list>
+
+#include <synfig/layer.h>
+#include <synfig/canvas.h>
+#include <synfig/valuenode.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/value.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/string.h>
+#include <synfig/keyframe.h>
+#include <synfig/waypoint.h>
+
+#include "editmode.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfig {
+class ProgressCallback;
+class Canvas;
+class RendDesc;
+}; // END of namespace synfig
+
+namespace synfigapp {
+
+class CanvasInterface;
+
+namespace Action {
+
+//! Action Parameter
+class Param
+{
+public:
+ enum Type
+ {
+ TYPE_NIL,
+ TYPE_INTEGER,
+ TYPE_REAL,
+ TYPE_BOOL,
+ TYPE_ACTIVEPOINT,
+ TYPE_WAYPOINT,
+ TYPE_WAYPOINTMODEL,
+ TYPE_KEYFRAME,
+ TYPE_CANVAS,
+ TYPE_LAYER,
+ TYPE_VALUENODE,
+ TYPE_VALUEDESC,
+ TYPE_VALUE,
+ TYPE_STRING,
+ TYPE_TIME,
+ TYPE_CANVASINTERFACE,
+ TYPE_EDITMODE,
+ TYPE_RENDDESC,
+
+ TYPE_END
+ };
+private:
+ Type type_;
+
+ union
+ {
+ etl::trivial<synfig::Canvas::LooseHandle> canvas;
+ etl::trivial<synfig::Layer::LooseHandle> layer;
+ etl::trivial<synfig::ValueNode::LooseHandle> value_node;
+ etl::trivial<synfig::ValueBase> value;
+ etl::trivial<synfig::Activepoint> activepoint;
+ etl::trivial<synfig::ValueNode_Animated::Waypoint> waypoint;
+ etl::trivial<synfig::ValueNode_Animated::Waypoint::Model> waypoint_model;
+ etl::trivial<synfig::String> string;
+ etl::trivial<synfig::Keyframe> keyframe;
+ etl::trivial<synfig::Time> time;
+ etl::trivial<synfigapp::ValueDesc> value_desc;
+ etl::trivial<etl::loose_handle<synfigapp::CanvasInterface> > canvas_interface;
+ etl::trivial<synfig::RendDesc> rend_desc;
+ int integer;
+ synfig::Real real;
+ bool b;
+ EditMode edit_mode;
+
+ } data;
+public:
+
+ Param():type_(TYPE_NIL) { }
+ Param(const Param &x);
+ Param(const etl::handle<synfigapp::CanvasInterface>& x);
+ Param(const etl::loose_handle<synfigapp::CanvasInterface>& x);
+// Param(synfigapp::CanvasInterface* x);
+ Param(const synfig::Canvas::Handle& x);
+ Param(const synfig::Canvas::LooseHandle& x);
+ Param(const synfig::Layer::Handle& x);
+ Param(const synfig::Layer::LooseHandle& x);
+ Param(const synfig::ValueNode::Handle& x);
+ Param(const synfig::ValueNode::LooseHandle& x);
+ Param(const synfig::Activepoint& x);
+ Param(const synfig::Waypoint& x);
+ Param(const synfig::Waypoint::Model& x);
+ Param(const synfig::String& x);
+ Param(const synfig::RendDesc& x);
+ Param(const char * x);
+ Param(const synfig::Keyframe& x);
+ Param(const synfigapp::ValueDesc& x);
+ Param(const int& x);
+ Param(const EditMode& x);
+ Param(const synfig::Real& x);
+ Param(const synfig::Time& x);
+ Param(const bool& x);
+ Param(const synfig::ValueBase& x);
+
+ ~Param();
+
+ Param& operator=(const Param& rhs);
+
+ void clear();
+
+ const synfig::Canvas::LooseHandle& get_canvas()const { assert(type_==TYPE_CANVAS); return data.canvas.get(); }
+ const etl::loose_handle<synfigapp::CanvasInterface>& get_canvas_interface()const { assert(type_==TYPE_CANVASINTERFACE); return data.canvas_interface.get(); }
+ const synfig::Layer::LooseHandle& get_layer()const { assert(type_==TYPE_LAYER); return data.layer.get(); }
+ const synfig::ValueNode::LooseHandle& get_value_node()const { assert(type_==TYPE_VALUENODE); return data.value_node.get(); }
+ const synfig::ValueBase& get_value()const { assert(type_==TYPE_VALUE); return data.value.get(); }
+ const synfig::Activepoint& get_activepoint()const { assert(type_==TYPE_ACTIVEPOINT); return data.activepoint.get(); }
+ const synfig::Waypoint& get_waypoint()const { assert(type_==TYPE_WAYPOINT); return data.waypoint.get(); }
+ const synfig::Waypoint::Model& get_waypoint_model()const { assert(type_==TYPE_WAYPOINTMODEL); return data.waypoint_model.get(); }
+ const synfig::String& get_string()const { assert(type_==TYPE_STRING); return data.string.get(); }
+ const synfig::Keyframe& get_keyframe()const { assert(type_==TYPE_KEYFRAME); return data.keyframe.get(); }
+ const synfigapp::ValueDesc& get_value_desc()const { assert(type_==TYPE_VALUEDESC); return data.value_desc.get(); }
+ const synfig::Real& get_real()const { assert(type_==TYPE_REAL); return data.real; }
+ const synfig::Time& get_time()const { assert(type_==TYPE_TIME); return data.time.get(); }
+ const synfig::RendDesc& get_rend_desc()const { assert(type_==TYPE_RENDDESC); return data.rend_desc.get(); }
+ int get_integer()const { assert(type_==TYPE_INTEGER); return data.integer; }
+ EditMode get_edit_mode()const { assert(type_==TYPE_EDITMODE); return data.edit_mode; }
+ bool get_bool()const { assert(type_==TYPE_BOOL); return data.b; }
+
+
+ const Type& get_type()const { return type_; }
+}; // END of class Param
+
+class ParamList : public std::multimap<synfig::String,Param>
+{
+public:
+ ParamList& add(const synfig::String& name, const Param &x) { insert(std::pair<synfig::String,Param>(name,x)); return *this; }
+ ParamList& add(const ParamList& x) { insert(x.begin(),x.end()); return *this; }
+}; // END of class ParamList
+
+class ParamDesc
+{
+private:
+ synfig::String name_;
+ synfig::String local_name_;
+ synfig::String desc_;
+ synfig::String mutual_exclusion_;
+ Param::Type type_;
+ bool user_supplied_;
+ bool supports_multiple_;
+ bool requires_multiple_;
+ bool optional_;
+
+public:
+ ParamDesc(const synfig::String &name, Param::Type type):
+ name_(name),
+ local_name_(name),
+ type_(type),
+ user_supplied_(false),
+ supports_multiple_(false),
+ requires_multiple_(false),
+ optional_(false)
+ { }
+
+ const synfig::String& get_name()const { return name_; }
+ const synfig::String& get_desc()const { return desc_; }
+ const synfig::String& get_mutual_exclusion()const { return mutual_exclusion_; }
+ const synfig::String& get_local_name()const { return local_name_; }
+ const Param::Type& get_type()const { return type_; }
+ bool get_user_supplied()const { return user_supplied_; }
+ bool get_supports_multiple()const { return supports_multiple_||requires_multiple_; }
+ bool get_requires_multiple()const { return requires_multiple_; }
+ bool get_optional()const { return optional_; }
+
+ ParamDesc& set_local_name(const synfig::String& x) { local_name_=x; return *this; }
+ ParamDesc& set_desc(const synfig::String& x) { desc_=x; return *this; }
+ ParamDesc& set_mutual_exclusion(const synfig::String& x) { mutual_exclusion_=x; return *this; }
+ ParamDesc& set_user_supplied(bool x=true) { user_supplied_=x; return *this; }
+ ParamDesc& set_supports_multiple(bool x=true) { supports_multiple_=x; return *this; }
+ ParamDesc& set_requires_multiple(bool x=true) { requires_multiple_=x; if(x)supports_multiple_=true; return *this; }
+ ParamDesc& set_optional(bool x=true) { optional_=x; return *this; }
+}; // END of class ParamDesc
+
+class ParamVocab : public std::list< ParamDesc > { };
+
+bool canidate_check(const ParamVocab& param_vocab, const ParamList& param_list);
+
+}; // END of namespace Action
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_system.cpp
+** \brief Template File
+**
+** $Id: action_system.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "action_system.h"
+#include "instance.h"
+#include "canvasinterface.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfigapp;
+using namespace synfig;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+
+
+Action::System::System():
+ action_count_(0)
+{
+ unset_ui_interface();
+ clear_redo_stack_on_new_action_=false;
+}
+
+Action::System::~System()
+{
+}
+
+bool
+Action::System::perform_action(handle<Action::Base> action)
+{
+ handle<UIInterface> uim(get_ui_interface());
+
+ assert(action);
+
+ if(!action->is_ready())
+ {
+ uim->error(action->get_name()+": "+_("Action is not ready."));
+ return false;
+ }
+
+ most_recent_action_=action;
+
+ static bool inuse=false;
+
+ if(inuse) return false;
+
+ inuse=true;
+ try {
+
+ assert(action);
+
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ if(canvas_specific && canvas_specific->get_canvas())
+ {
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas_specific->get_canvas());
+ assert(canvas_interface);
+ uim=canvas_interface->get_ui_interface();
+ }
+
+ handle<Action::Undoable> undoable_action=handle<Action::Undoable>::cast_dynamic(action);
+
+ // If we cannot undo this action, make sure
+ // that the user knows this.
+ if(!undoable_action)
+ {
+ if(uim->yes_no(
+ action->get_name(),
+ _("This action cannot be undone! Are you sure you want to continue?"),
+ UIInterface::RESPONSE_NO
+ ) == UIInterface::RESPONSE_NO
+ )
+ return false;
+ else
+ {
+ // Because this action cannot be undone,
+ // we need to clear the undo stack
+ clear_undo_stack();
+ }
+ }
+ else
+ assert(undoable_action->is_active());
+
+ // Perform the action
+ try { action->perform(); }
+ catch(Action::Error err)
+ {
+ uim->task(action->get_name()+' '+_("Failed"));
+ inuse=false;
+
+ if(err.get_type()!=Action::Error::TYPE_UNABLE)
+ {
+ if(err.get_desc().empty())
+ uim->error(action->get_name()+": "+strprintf("%d",err.get_type()));
+ else
+ uim->error(action->get_name()+": "+err.get_desc());
+ }
+
+ // If action failed for whatever reason, just return false and do
+ // not add the action onto the list
+ return false;
+ }
+ catch(std::exception err)
+ {
+ uim->task(action->get_name()+' '+_("Failed"));
+ inuse=false;
+
+ uim->error(action->get_name()+": "+err.what());
+
+ // If action failed for whatever reason, just return false and do
+ // not add the action onto the list
+ return false;
+ }
+ catch(...)
+ {
+ uim->task(action->get_name()+' '+_("Failed"));
+ inuse=false;
+
+ // If action failed for whatever reason, just return false and do
+ // not add the action onto the list
+ return false;
+ }
+
+ // Clear the redo stack
+ if(clear_redo_stack_on_new_action_)
+ clear_redo_stack();
+
+ if(!group_stack_.empty())
+ group_stack_.front()->inc_depth();
+ else
+ inc_action_count();
+
+ // Push this action onto the action list if we can undo it
+ if(undoable_action)
+ {
+ // If necessary, signal the change in status of undo
+ if(undo_action_stack_.empty()) signal_undo_status_(true);
+
+ // Add it to the list
+ undo_action_stack_.push_front(undoable_action);
+
+ // Signal that a new action has been added
+ if(group_stack_.empty())
+ signal_new_action()(undoable_action);
+ }
+
+ inuse=false;
+
+ uim->task(action->get_name()+' '+_("Successful"));
+
+ // If the action has "dirtied" the preview, signal it.
+ if(0)if(canvas_specific && canvas_specific->is_dirty())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ if(!group_stack_.empty())
+ group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
+ else
+ {
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ DEBUGPOINT();
+ //canvas_interface->signal_dirty_preview()();
+ }
+ }
+
+ }catch(...) { inuse=false; throw; }
+
+ return true;
+}
+
+bool
+synfigapp::Action::System::undo_(handle<UIInterface> uim)
+{
+ handle<Action::Undoable> action(undo_action_stack().front());
+ most_recent_action_=action;
+
+ try { if(action->is_active()) action->undo(); }
+ catch(Action::Error err)
+ {
+ if(err.get_type()!=Action::Error::TYPE_UNABLE)
+ {
+ if(err.get_desc().empty())
+ uim->error(action->get_name()+_(" (Undo): ")+strprintf("%d",err.get_type()));
+ else
+ uim->error(action->get_name()+_(" (Undo): ")+err.get_desc());
+ }
+
+ return false;
+ }
+ catch(std::runtime_error x)
+ {
+ uim->error(x.what());
+ return false;
+ }
+ catch(...)
+ {
+ return false;
+ }
+
+ dec_action_count();
+
+ if(redo_action_stack_.empty()) signal_redo_status()(true);
+
+ redo_action_stack_.push_front(undo_action_stack_.front());
+ undo_action_stack_.pop_front();
+
+ if(undo_action_stack_.empty()) signal_undo_status()(false);
+
+ if(!group_stack_.empty())
+ group_stack_.front()->dec_depth();
+
+ signal_undo_();
+
+ return true;
+}
+
+bool
+synfigapp::Action::System::undo()
+{
+ //! \todo This function is not exception safe!
+ static bool inuse=false;
+
+ // If there is nothing on the action list, there is nothing to undo
+ if(undo_action_stack().empty() || inuse)
+ return false;
+
+ handle<Action::Undoable> action=undo_action_stack().front();
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ handle<UIInterface> uim;
+ if(canvas_specific && canvas_specific->get_canvas())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ uim=canvas_interface->get_ui_interface();
+ }
+ else
+ uim=get_ui_interface();
+
+ inuse=true;
+
+ if(!undo_(uim))
+ {
+ uim->error(undo_action_stack_.front()->get_name()+": "+_("Failed to undo."));
+ inuse=false;
+ return false;
+ }
+
+ inuse=false;
+
+ // If the action has "dirtied" the preview, signal it.
+ if(0)if(action->is_active() && canvas_specific && canvas_specific->is_dirty())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ if(!group_stack_.empty())
+ group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
+ else
+ {
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ //DEBUGPOINT();
+ //canvas_interface->signal_dirty_preview()();
+ }
+ }
+
+ return true;
+}
+
+bool
+Action::System::redo_(handle<UIInterface> uim)
+{
+ handle<Action::Undoable> action(redo_action_stack().front());
+ most_recent_action_=action;
+
+ try { if(action->is_active()) action->perform(); }
+ catch(Action::Error err)
+ {
+ if(err.get_type()!=Action::Error::TYPE_UNABLE)
+ {
+ if(err.get_desc().empty())
+ uim->error(action->get_name()+_(" (Redo): ")+strprintf("%d",err.get_type()));
+ else
+ uim->error(action->get_name()+_(" (Redo): ")+err.get_desc());
+ }
+
+ return false;
+ }
+ catch(std::runtime_error x)
+ {
+ uim->error(x.what());
+ return false;
+ }
+ catch(...)
+ {
+ return false;
+ }
+
+ inc_action_count();
+
+ if(undo_action_stack_.empty()) signal_undo_status()(true);
+
+ undo_action_stack_.push_front(redo_action_stack_.front());
+ redo_action_stack_.pop_front();
+
+ if(redo_action_stack_.empty()) signal_redo_status()(false);
+
+ if(!group_stack_.empty())
+ group_stack_.front()->inc_depth();
+
+ signal_redo_();
+
+ return true;
+}
+
+bool
+Action::System::redo()
+{
+ //! \todo This function is not exception safe!
+ static bool inuse=false;
+
+ // If there is nothing on the action list, there is nothing to undo
+ if(redo_action_stack_.empty() || inuse)
+ return false;
+
+ inuse=true;
+
+ handle<Action::Undoable> action=redo_action_stack().front();
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ handle<UIInterface> uim;
+ if(canvas_specific && canvas_specific->get_canvas())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ uim=canvas_interface->get_ui_interface();
+ }
+ else
+ uim=get_ui_interface();
+
+ if(!redo_(uim))
+ {
+ uim->error(redo_action_stack_.front()->get_name()+": "+_("Failed to redo."));
+ inuse=false;
+ return false;
+ }
+
+ inuse=false;
+
+ // If the action has "dirtied" the preview, signal it.
+ if(0)if(action->is_active() && canvas_specific && canvas_specific->is_dirty())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ if(!group_stack_.empty())
+ group_stack_.front()->request_redraw(canvas_specific->get_canvas_interface());
+ else
+ {
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ //DEBUGPOINT();
+ //canvas_interface->signal_dirty_preview()();
+ }
+ }
+
+ return true;
+}
+
+void
+Action::System::inc_action_count()const
+{
+ action_count_++;
+ if(action_count_==1)
+ signal_unsaved_status_changed_(true);
+ if(!action_count_)
+ signal_unsaved_status_changed_(false);
+}
+
+void
+Action::System::dec_action_count()const
+{
+ action_count_--;
+ if(action_count_==-1)
+ signal_unsaved_status_changed_(true);
+ if(!action_count_)
+ signal_unsaved_status_changed_(false);
+}
+
+void
+Action::System::reset_action_count()const
+{
+ if(!action_count_)
+ return;
+
+ action_count_=0;
+ signal_unsaved_status_changed_(false);
+}
+
+void
+Action::System::clear_undo_stack()
+{
+ if(undo_action_stack_.empty()) return;
+ undo_action_stack_.clear();
+ signal_undo_status_(false);
+ signal_undo_stack_cleared_();
+}
+
+void
+Action::System::clear_redo_stack()
+{
+ if(redo_action_stack_.empty()) return;
+ redo_action_stack_.clear();
+ signal_redo_status_(false);
+ signal_redo_stack_cleared_();
+}
+
+bool
+Action::System::set_action_status(etl::handle<Action::Undoable> action, bool x)
+{
+ Stack::iterator iter;
+ int failed=false;
+
+ if(action->is_active()==x)
+ return true;
+
+ handle<Action::Undoable> cur_pos=undo_action_stack_.front();
+
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ handle<UIInterface> uim=new ConfidentUIInterface();
+
+ iter=find(undo_action_stack_.begin(),undo_action_stack_.end(),action);
+ if(iter!=undo_action_stack_.end())
+ {
+ while(undo_action_stack_.front()!=action)
+ {
+ if(!undo_(uim))
+ {
+ return false;
+ }
+ }
+ if(!undo_(uim))
+ {
+ return false;
+ }
+
+ action->set_active(x);
+
+ if(redo_(get_ui_interface()))
+ {
+ signal_action_status_changed_(action);
+ }
+ else
+ {
+ action->set_active(!x);
+ failed=true;
+ }
+
+
+ while(undo_action_stack_.front()!=cur_pos)
+ {
+ if(!redo_(uim))
+ {
+ redo_action_stack_.front()->set_active(false);
+ signal_action_status_changed_(redo_action_stack_.front());
+ }
+ }
+
+ if(!failed && canvas_specific && canvas_specific->is_dirty())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ //DEBUGPOINT();
+ //canvas_interface->signal_dirty_preview()();
+ }
+
+ return true;
+ }
+
+ iter=find(redo_action_stack_.begin(),redo_action_stack_.end(),action);
+ if(iter!=redo_action_stack_.end())
+ {
+ action->set_active(x);
+ signal_action_status_changed_(action);
+
+
+
+
+ if(canvas_specific && canvas_specific->is_dirty())
+ {
+ Canvas::Handle canvas=canvas_specific->get_canvas();
+ handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas);
+ assert(canvas_interface);
+ DEBUGPOINT();
+ //canvas_interface->signal_dirty_preview()();
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+Action::PassiveGrouper::PassiveGrouper(etl::loose_handle<Action::System> instance_,synfig::String name_):
+ instance_(instance_),
+ name_(name_),
+ redraw_requested_(false),
+ depth_(0)
+{
+ // Add this group onto the group stack
+ instance_->group_stack_.push_front(this);
+}
+
+void
+Action::PassiveGrouper::request_redraw(handle<CanvasInterface> x)
+{
+/* DEBUGPOINT();
+ if(instance_->group_stack_.empty())
+ {
+ if(x!=canvas_interface_)
+ {
+ DEBUGPOINT();
+ x->signal_dirty_preview()();
+ }
+
+ redraw_requested_=false;
+ }
+ else
+ {
+ DEBUGPOINT();
+ if(instance_->group_stack_.back()==this)
+ {
+ DEBUGPOINT();
+ redraw_requested_=true;
+ }
+ else
+ {
+ DEBUGPOINT();
+ instance_->group_stack_.back()->request_redraw(x);
+ redraw_requested_=false;
+ }
+ DEBUGPOINT();
+ }
+ DEBUGPOINT();
+*/
+ if(x)
+ {
+ redraw_requested_=true;
+ canvas_interface_=x;
+ }
+}
+
+Action::PassiveGrouper::~PassiveGrouper()
+{
+ assert(instance_->group_stack_.front()==this);
+
+ // Remove this group from the group stack
+ instance_->group_stack_.pop_front();
+
+ handle<Action::Group> group;
+
+ if(depth_==1)
+ {
+ handle<Action::Undoable> action(instance_->undo_action_stack_.front());
+
+ group=handle<Action::Group>::cast_dynamic(action);
+
+ if(group)
+ {
+ // If the only action inside of us is a group,
+ // then we should rename the group to our name.
+ group->set_name(name_);
+ }
+ else
+ {
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ if(0)if(canvas_specific && canvas_specific->is_dirty() && canvas_specific->get_canvas_interface())
+ {
+ if(instance_->group_stack_.empty())
+ request_redraw(canvas_specific->get_canvas_interface());
+ }
+ }
+
+ if(instance_->group_stack_.empty())
+ {
+ instance_->inc_action_count();
+ instance_->signal_new_action()(instance_->undo_action_stack_.front());
+ }
+ else
+ instance_->group_stack_.front()->inc_depth();
+
+ }
+ else
+ if(depth_>0)
+ {
+ group=new Action::Group(name_);
+
+ for(int i=0;i<depth_;i++)
+ // for(;depth_;depth_--)
+ {
+ handle<Action::Undoable> action(instance_->undo_action_stack_.front());
+ Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
+
+ if(0)if(canvas_specific && canvas_specific->is_dirty())
+ {
+ group->set_dirty(true);
+ group->set_canvas(canvas_specific->get_canvas());
+ group->set_canvas_interface(canvas_specific->get_canvas_interface());
+ }
+
+ // Copy the action from the undo stack to the group
+ group->add_action_front(action);
+
+ // Remove the action from the undo stack
+ instance_->undo_action_stack_.pop_front();
+ }
+
+ // Push the group onto the stack
+ instance_->undo_action_stack_.push_front(group);
+
+ if(0)if(group->is_dirty())
+ request_redraw(group->get_canvas_interface());
+ // group->get_canvas_interface()->signal_dirty_preview()();
+
+ if(instance_->group_stack_.empty())
+ {
+ instance_->inc_action_count();
+ instance_->signal_new_action()(instance_->undo_action_stack_.front());
+ }
+ else
+ instance_->group_stack_.front()->inc_depth();
+ }
+
+ if(0)if(redraw_requested_)
+ {
+ if(instance_->group_stack_.empty())
+ {
+ assert(canvas_interface_);
+ DEBUGPOINT();
+ canvas_interface_->signal_dirty_preview()();
+ }
+ else
+ {
+ instance_->group_stack_.front()->request_redraw(canvas_interface_);
+ redraw_requested_=false;
+ }
+ }
+}
+
+void
+Action::PassiveGrouper::cancel()
+{
+ bool error=false;
+
+ // Cancel any groupers that may be on top of us first
+ //while(instance_->group_stack_.front()!=this)
+ // instance_->group_stack_.front()->cancel();
+
+ synfig::warning("Cancel depth: %d",depth_);
+
+ while(depth_)
+ if(!instance_->undo())
+ {
+ error=true;
+ break;
+ }
+
+ if(error)
+ instance_->get_ui_interface()->error(_("State restore failure"));
+ else
+ redraw_requested_=false;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_system.h
+** \brief Template Header
+**
+** $Id: action_system.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIGAPP_ACTIONSYSTEM_H
+#define __SYNFIGAPP_ACTIONSYSTEM_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "action.h"
+#include <sigc++/signal.h>
+#include <sigc++/object.h>
+#include <ETL/handle>
+#include <synfig/canvas.h>
+#include "uimanager.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class CanvasInterface;
+
+namespace Action {
+
+
+
+
+
+class System;
+
+//! Passive action grouping class
+class PassiveGrouper
+{
+ etl::loose_handle<System> instance_;
+ synfig::String name_;
+ bool redraw_requested_;
+ int depth_;
+ etl::handle<CanvasInterface> canvas_interface_;
+public:
+
+ PassiveGrouper(etl::loose_handle<System> instance_,synfig::String name_);
+
+ ~PassiveGrouper();
+
+ const synfig::String &get_name()const { return name_; }
+
+ void set_name(const synfig::String &x) { name_=x; }
+
+ etl::loose_handle<System> get_instance() { return instance_; }
+
+ void request_redraw(etl::handle<CanvasInterface>);
+
+ void cancel();
+
+ void inc_depth() { depth_++; }
+
+ void dec_depth() { depth_--; }
+
+ const int &get_depth()const { return depth_; }
+}; // END of class Action::PassiveGrouper
+
+typedef std::list< etl::handle<Action::Undoable> > Stack;
+
+class System : public etl::shared_object, public sigc::trackable
+{
+ friend class PassiveGrouper;
+
+ /*
+ -- ** -- P U B L I C T Y P E S ---------------------------------------------
+ */
+
+public:
+
+ /*
+ -- ** -- P U B L I C D A T A ------------------------------------------------
+ */
+
+public:
+
+ /*
+ -- ** -- P R I V A T E D A T A ---------------------------------------------
+ */
+
+private:
+
+ Stack undo_action_stack_;
+ Stack redo_action_stack_;
+
+ etl::handle<Action::Base> most_recent_action_;
+
+ std::list<PassiveGrouper*> group_stack_;
+
+ sigc::signal<void,bool> signal_undo_status_;
+ sigc::signal<void,bool> signal_redo_status_;
+ sigc::signal<void,etl::handle<Action::Undoable> > signal_new_action_;
+ sigc::signal<void> signal_undo_stack_cleared_;
+ sigc::signal<void> signal_redo_stack_cleared_;
+ sigc::signal<void> signal_undo_;
+ sigc::signal<void> signal_redo_;
+ sigc::signal<void,etl::handle<Action::Undoable> > signal_action_status_changed_;
+
+ mutable sigc::signal<void,bool> signal_unsaved_status_changed_;
+
+ //! If this is non-zero, then the changes have not yet been saved.
+ mutable int action_count_;
+
+ etl::handle<UIInterface> ui_interface_;
+
+ bool clear_redo_stack_on_new_action_;
+
+ /*
+ -- ** -- P R I V A T E M E T H O D S ---------------------------------------
+ */
+
+private:
+
+ bool undo_(etl::handle<UIInterface> uim);
+ bool redo_(etl::handle<UIInterface> uim);
+
+ /*
+ -- ** -- S I G N A L T E R M I N A L S -------------------------------------
+ */
+
+private:
+
+ /*
+ -- ** -- P U B L I C M E T H O D S -----------------------------------------
+ */
+
+public:
+
+ System();
+ ~System();
+
+ /*
+ template <typename T> bool
+ perform_action(T x)
+ {
+ etl::handle<Action::Base> action((Action::Base*)new T(x));
+ return perform_action(action);
+ }
+ */
+
+ const etl::handle<Action::Base>& get_most_recent_action() { return most_recent_action_; }
+
+ bool get_clear_redo_stack_on_new_action()const { return clear_redo_stack_on_new_action_; }
+
+ void set_clear_redo_stack_on_new_action(bool x) { clear_redo_stack_on_new_action_=x; }
+
+ bool perform_action(etl::handle<Action::Base> action);
+
+ bool set_action_status(etl::handle<Action::Undoable> action, bool x);
+
+ const Stack &undo_action_stack()const { return undo_action_stack_; }
+
+ const Stack &redo_action_stack()const { return redo_action_stack_; }
+
+ //! Undoes the last action
+ bool undo();
+
+ //! Redoes the last undone action
+ bool redo();
+
+ //! Clears the undo stack.
+ void clear_undo_stack();
+
+ //! Clears the redo stack.
+ void clear_redo_stack();
+
+ //! Increments the action counter
+ /*! \note You should not have to call this under normal circumstances.
+ ** \see dec_action_count(), reset_action_count(), get_action_count() */
+ void inc_action_count()const;
+
+ //! Decrements the action counter
+ /*! \note You should not have to call this under normal circumstances.
+ ** \see inc_action_count(), reset_action_count(), get_action_count() */
+ void dec_action_count()const;
+
+ //! Resets the action counter
+ /*! \note You should not have to call this under normal circumstances.
+ ** \see inc_action_count(), dec_action_count(), get_action_count() */
+ void reset_action_count()const;
+
+ //! Returns the number of actions performed since last save.
+ /*! \see inc_action_count(), dec_action_count(), reset_action_count() */
+ int get_action_count()const { return action_count_; }
+
+ void set_ui_interface(const etl::handle<UIInterface> &uim) { assert(uim); ui_interface_=uim; }
+ void unset_ui_interface() { ui_interface_=new DefaultUIInterface(); }
+ const etl::handle<UIInterface> &get_ui_interface() { return ui_interface_; }
+
+ /*
+ -- ** -- S I G N A L I N T E R F A C E S -----------------------------------
+ */
+
+public:
+
+ sigc::signal<void,bool>& signal_unsaved_status_changed() { return signal_unsaved_status_changed_; }
+
+ sigc::signal<void,bool>& signal_undo_status() { return signal_undo_status_; }
+
+ sigc::signal<void,bool>& signal_redo_status() { return signal_redo_status_; }
+
+ sigc::signal<void>& signal_undo_stack_cleared() { return signal_undo_stack_cleared_; }
+
+ sigc::signal<void>& signal_redo_stack_cleared() { return signal_redo_stack_cleared_; }
+
+ sigc::signal<void>& signal_undo() { return signal_undo_; }
+
+ sigc::signal<void>& signal_redo() { return signal_redo_; }
+
+ //! Called whenever an undoable action is processed and added to the stack.
+ sigc::signal<void,etl::handle<Action::Undoable> >& signal_new_action() { return signal_new_action_; }
+
+ sigc::signal<void,etl::handle<Action::Undoable> >& signal_action_status_changed() { return signal_action_status_changed_; }
+
+}; // END of class Action::System
+
+
+}; // END of namespace synfigapp::Action
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file acitvepointadd.cpp
+** \brief Template File
+**
+** $Id: activepointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointAdd);
+ACTION_SET_NAME(Action::ActivepointAdd,"activepoint_add");
+ACTION_SET_LOCAL_NAME(Action::ActivepointAdd,"Add Activepoint");
+ACTION_SET_TASK(Action::ActivepointAdd,"add");
+ACTION_SET_CATEGORY(Action::ActivepointAdd,Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::ActivepointAdd,0);
+ACTION_SET_VERSION(Action::ActivepointAdd,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointAdd,"$Id: activepointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointAdd::ActivepointAdd()
+{
+ activepoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("New Activepoint"))
+ .set_desc(_("Activepoint to be added"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_desc(_("Time where activepoint is to be added"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointAdd::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ // We need either a activepoint or a time.
+ if(x.count("activepoint") || x.count("time"))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ if(time_set)
+ calc_activepoint();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
+ {
+ activepoint=param.get_activepoint();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
+ {
+ activepoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointAdd::is_ready()const
+{
+ if(!value_node || activepoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a activepoint. In this case, we need to calculate the value
+// of the activepoint
+void
+Action::ActivepointAdd::calc_activepoint()
+{
+ const Time time(activepoint.get_time());
+ activepoint.set_state(value_node->list[index].status_at_time(time));
+ activepoint.set_priority(0);
+
+ // In this case, nothing is really changing, so there will be
+ // no need to redraw the window
+ set_dirty(false);
+}
+
+void
+Action::ActivepointAdd::perform()
+{
+ try { value_node->list[index].find(activepoint.get_time()); throw Error(_("A Activepoint already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { if(value_node->list[index].find(activepoint)!=value_node->list[index].timing_info.end()) throw Error(_("This activepoint is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ value_node->list[index].add(activepoint);
+ value_node->changed();
+
+ /*if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+ */
+}
+
+void
+Action::ActivepointAdd::undo()
+{
+ value_node->list[index].erase(activepoint);
+ value_node->changed();
+ /*
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+ */
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointadd.h
+** \brief Template File
+**
+** $Id: activepointadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTADD_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ActivepointAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Activepoint activepoint;
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+
+ bool time_set;
+
+ void calc_activepoint();
+
+public:
+
+ ActivepointAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointremove.cpp
+** \brief Template File
+**
+** $Id: activepointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointRemove);
+ACTION_SET_NAME(Action::ActivepointRemove,"activepoint_remove");
+ACTION_SET_LOCAL_NAME(Action::ActivepointRemove,"Remove Activepoint");
+ACTION_SET_TASK(Action::ActivepointRemove,"remove");
+ACTION_SET_CATEGORY(Action::ActivepointRemove,Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::ActivepointRemove,0);
+ACTION_SET_VERSION(Action::ActivepointRemove,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointRemove,"$Id: activepointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointRemove::ActivepointRemove()
+{
+ activepoint.set_time(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("Activepoint"))
+ .set_desc(_("Activepoint to be changed"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointRemove::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
+ {
+ activepoint=param.get_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointRemove::is_ready()const
+{
+ if(!value_node || activepoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ActivepointRemove::perform()
+{
+ ValueNode_DynamicList::ListEntry::ActivepointList::iterator iter;
+
+ try { iter=value_node->list[index].find(activepoint); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find activepoint"));
+ }
+
+ value_node->list[index].erase(activepoint);
+ value_node->changed();
+
+ /*
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+ */
+}
+
+void
+Action::ActivepointRemove::undo()
+{
+ try { value_node->list[index].find(activepoint.get_time()); throw Error(_("A Activepoint already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { if(value_node->list[index].find(activepoint)!=value_node->list[index].timing_info.end()) throw Error(_("This activepoint is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ value_node->list[index].add(activepoint);
+ value_node->changed();
+ /*
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+ */
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointremove.h
+** \brief Template File
+**
+** $Id: activepointremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTREMOVE_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ActivepointRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+ synfig::Activepoint activepoint;
+
+public:
+
+ ActivepointRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointset.cpp
+** \brief Template File
+**
+** $Id: activepointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointSet);
+ACTION_SET_NAME(Action::ActivepointSet,"activepoint_set");
+ACTION_SET_LOCAL_NAME(Action::ActivepointSet,"Set Activepoint");
+ACTION_SET_TASK(Action::ActivepointSet,"set");
+ACTION_SET_CATEGORY(Action::ActivepointSet,Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::ActivepointSet,0);
+ACTION_SET_VERSION(Action::ActivepointSet,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointSet,"$Id: activepointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointSet::ActivepointSet()
+{
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("Activepoint"))
+ .set_desc(_("Activepoint to be changed"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointSet::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
+ {
+ //NOTE: there is no duplication checking at the moment
+ activepoints.push_back(param.get_activepoint());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointSet::is_ready()const
+{
+ if(!value_node || activepoints.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ActivepointSet::perform()
+{
+ typedef ValueNode_DynamicList::ListEntry::ActivepointList AList;
+ AList::iterator iter;
+
+#if 1
+ vector<AList::iterator> iters;
+ vector<Activepoint>::iterator i = activepoints.begin(), end = activepoints.end();
+
+ for(; i != end; ++i)
+ {
+ try { iters.push_back(value_node->list[index].find(*i)); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find activepoint"));
+ }
+ }
+
+ //check to see which valuenodes are going to override because of the time...
+ ValueNode_DynamicList::ListEntry::findresult timeiter;
+
+ for(i = activepoints.begin(); i != end; ++i)
+ {
+ timeiter = value_node->list[index].find_time(i->get_time());
+
+ bool candelete = timeiter.second;
+
+ //we only want to track overwrites (not activepoints that are also being modified)
+ if(candelete)
+ {
+ for(vector<AList::iterator>::iterator ii = iters.begin(); ii != iters.end(); ++ii)
+ {
+ if(timeiter.first == *ii)
+ {
+ candelete = false;
+ break;
+ }
+ }
+ }
+
+ //if we can still delete it after checking, record it, and then remove them all later
+ if(candelete)
+ {
+ Activepoint a = *timeiter.first;
+ overwritten_activepoints.push_back(a);
+ }
+ }
+
+ //overwrite all the valuenodes we're supposed to set
+ {
+ i = activepoints.begin();
+ for(vector<AList::iterator>::iterator ii = iters.begin(); ii != iters.end() && i != end; ++ii, ++i)
+ {
+ old_activepoints.push_back(**ii);
+ **ii = *i; //set the point to the corresponding point in the normal waypoint list
+ }
+ }
+
+ //remove all the points we're supposed to be overwritting
+ {
+ vector<Activepoint>::iterator oi = overwritten_activepoints.begin(),
+ oend = overwritten_activepoints.end();
+ for(; oi != oend; ++oi)
+ {
+ value_node->list[index].erase(*oi);
+ }
+ }
+
+#else
+ try { iter=value_node->list[index].find(activepoint); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find activepoint"));
+ }
+
+ //find the value at the old time before we replace it
+ ValueNode_DynamicList::ListEntry::findresult timeiter;
+ timeiter = value_node->list[index].find_time(activepoint.get_time());
+
+ //we only want to track overwrites (not inplace modifications)
+ if(timeiter.second && activepoint.get_uid() == timeiter.first->get_uid())
+ {
+ timeiter.second = false;
+ }
+
+ old_activepoint=*iter;
+ *iter=activepoint;
+
+ if(timeiter.second)
+ {
+ synfig::info("Erasing the found activepoint");
+ time_overwrite = true;
+ overwritten_ap = *timeiter.first;
+
+ value_node->list[index].erase(overwritten_ap);
+ }
+
+#endif
+
+ value_node->list[index].timing_info.sort();
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
+
+void
+Action::ActivepointSet::undo()
+{
+ ValueNode_DynamicList::ListEntry::ActivepointList::iterator iter;
+
+#if 1
+ vector<Activepoint>::iterator i = old_activepoints.begin(), end = old_activepoints.end();
+
+ for(; i != end; ++i)
+ {
+ try { iter = value_node->list[index].find(*i); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find activepoint"));
+ }
+
+ //overwrite with old one
+ *iter = *i;
+ }
+
+ //add back in all the points that we removed before...
+ {
+ vector<Activepoint>::iterator oi = overwritten_activepoints.begin(),
+ oend = overwritten_activepoints.end();
+ for(; oi != oend; ++oi)
+ {
+ value_node->list[index].add(*oi);
+ }
+ }
+
+#else
+ try { iter=value_node->list[index].find(activepoint); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find activepoint"));
+ }
+
+ *iter=old_activepoint;
+
+ if(time_overwrite)
+ {
+ value_node->list[index].add(overwritten_ap);
+ }
+#endif
+
+ value_node->list[index].timing_info.sort();
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointset.h
+** \brief Template File
+**
+** $Id: activepointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTSET_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ActivepointSet :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+
+ std::vector<synfig::Activepoint> activepoints;
+ std::vector<synfig::Activepoint> old_activepoints;
+
+ std::vector<synfig::Activepoint> overwritten_activepoints;
+
+public:
+
+ ActivepointSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsetoff.cpp
+** \brief Template File
+**
+** $Id: activepointsetoff.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointsetoff.h"
+#include "activepointsetsmart.h"
+#include "valuenodelinkconnect.h"
+#include "valuenodereplace.h"
+
+#include "activepointset.h"
+#include "activepointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointSetOff);
+ACTION_SET_NAME(Action::ActivepointSetOff,"activepoint_set_off");
+ACTION_SET_LOCAL_NAME(Action::ActivepointSetOff,_("Mark Activepoint as \"Off\""));
+ACTION_SET_TASK(Action::ActivepointSetOff,"set_off");
+ACTION_SET_CATEGORY(Action::ActivepointSetOff,Action::CATEGORY_ACTIVEPOINT|Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ActivepointSetOff,-9);
+ACTION_SET_VERSION(Action::ActivepointSetOff,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointSetOff,"$Id: activepointsetoff.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointSetOff::ActivepointSetOff()
+{
+ activepoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointSetOff::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("Activepoint"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointSetOff::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ // We are only a canidate if this canvas is animated.
+ Canvas::Handle canvas(x.find("canvas")->second.get_canvas());
+ if(canvas->rend_desc().get_time_start()==canvas->rend_desc().get_time_end())
+ return false;
+
+ // We need either a activepoint or a time.
+ if(x.count("activepoint") || x.count("time"))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointSetOff::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ if(time_set)
+ calc_activepoint();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
+ {
+ activepoint=param.get_activepoint();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
+ {
+ activepoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointSetOff::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing value_node");
+
+ if(activepoint.get_time()==(Time::begin()-1))
+ synfig::error("Missing activepoint");
+
+ if(!value_node || activepoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a activepoint. In this case, we need to calculate the value
+// of the activepoint
+void
+Action::ActivepointSetOff::calc_activepoint()
+{
+ const Time time(activepoint.get_time());
+
+ try { activepoint=*value_node->list[index].find(time); }
+ catch(...)
+ {
+ activepoint.set_time(time);
+ activepoint.set_state(value_node->list[index].status_at_time(time));
+ activepoint.set_priority(0);
+ }
+}
+
+void
+Action::ActivepointSetOff::prepare()
+{
+ clear();
+
+ // Turn the activepoint off
+ activepoint.set_state(false);
+
+ Action::Handle action(ActivepointSetSmart::create());
+
+ action->set_param("edit_mode",get_edit_mode());
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsetoff.h
+** \brief Template File
+**
+** $Id: activepointsetoff.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTSETOFF_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTSETOFF_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+#include <list>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ActivepointSetOff :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+ bool time_set;
+ synfig::Activepoint activepoint;
+
+ void calc_activepoint();
+
+public:
+
+ ActivepointSetOff();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointseton.cpp
+** \brief Template File
+**
+** $Id: activepointseton.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointseton.h"
+#include "activepointsetsmart.h"
+#include "valuenodelinkconnect.h"
+#include "valuenodereplace.h"
+
+#include "activepointset.h"
+#include "activepointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointSetOn);
+ACTION_SET_NAME(Action::ActivepointSetOn,"activepoint_set_on");
+ACTION_SET_LOCAL_NAME(Action::ActivepointSetOn,_("Mark Activepoint as \"On\""));
+ACTION_SET_TASK(Action::ActivepointSetOn,"set_on");
+ACTION_SET_CATEGORY(Action::ActivepointSetOn,Action::CATEGORY_ACTIVEPOINT|Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ActivepointSetOn,-10);
+ACTION_SET_VERSION(Action::ActivepointSetOn,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointSetOn,"$Id: activepointseton.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointSetOn::ActivepointSetOn()
+{
+ activepoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointSetOn::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("Activepoint"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointSetOn::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ // We are only a canidate if this canvas is animated.
+ Canvas::Handle canvas(x.find("canvas")->second.get_canvas());
+ if(canvas->rend_desc().get_time_start()==canvas->rend_desc().get_time_end())
+ return false;
+
+ // We need either a activepoint or a time.
+ if(x.count("activepoint") || x.count("time"))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointSetOn::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ if(time_set)
+ calc_activepoint();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
+ {
+ activepoint=param.get_activepoint();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
+ {
+ activepoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointSetOn::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing value_node");
+
+ if(activepoint.get_time()==(Time::begin()-1))
+ synfig::error("Missing activepoint");
+
+ if(!value_node || activepoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a activepoint. In this case, we need to calculate the value
+// of the activepoint
+void
+Action::ActivepointSetOn::calc_activepoint()
+{
+ const Time time(activepoint.get_time());
+
+ try { activepoint=*value_node->list[index].find(time); }
+ catch(...)
+ {
+ activepoint.set_time(time);
+ activepoint.set_state(value_node->list[index].status_at_time(time));
+ activepoint.set_priority(0);
+ }
+}
+
+void
+Action::ActivepointSetOn::prepare()
+{
+ clear();
+
+ // Turn the activepoint off
+ activepoint.set_state(true);
+
+ Action::Handle action(ActivepointSetSmart::create());
+
+ action->set_param("edit_mode",get_edit_mode());
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointseton.h
+** \brief Template File
+**
+** $Id: activepointseton.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTSETON_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTSETON_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+#include <list>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ActivepointSetOn :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+ synfig::Activepoint activepoint;
+ bool time_set;
+
+ void calc_activepoint();
+
+public:
+
+ ActivepointSetOn();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsetsmart.cpp
+** \brief Template File
+**
+** $Id: activepointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointsetsmart.h"
+#include "valuenodelinkconnect.h"
+#include "valuenodereplace.h"
+
+#include "activepointset.h"
+#include "activepointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointSetSmart);
+ACTION_SET_NAME(Action::ActivepointSetSmart,"activepoint_set_smart");
+ACTION_SET_LOCAL_NAME(Action::ActivepointSetSmart,_("Set Activepoint (Smart)"));
+ACTION_SET_TASK(Action::ActivepointSetSmart,"set");
+ACTION_SET_CATEGORY(Action::ActivepointSetSmart,Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::ActivepointSetSmart,0);
+ACTION_SET_VERSION(Action::ActivepointSetSmart,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointSetSmart,"$Id: activepointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointSetSmart::ActivepointSetSmart()
+{
+ activepoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ActivepointSetSmart::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("New Activepoint"))
+ .set_desc(_("Activepoint to be added"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_desc(_("Time where activepoint is to be added"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointSetSmart::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ // We need either a activepoint or a time.
+ if(x.count("activepoint") || x.count("time"))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ActivepointSetSmart::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ if(time_set)
+ calc_activepoint();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
+ {
+ activepoint=param.get_activepoint();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && activepoint.get_time()==Time::begin()-1)
+ {
+ activepoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointSetSmart::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing value_node");
+
+ if(activepoint.get_time()==(Time::begin()-1))
+ synfig::error("Missing activepoint");
+
+ if(!value_node || activepoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a activepoint. In this case, we need to calculate the value
+// of the activepoint
+void
+Action::ActivepointSetSmart::calc_activepoint()
+{
+/*
+ const Time time(activepoint.get_time());
+ activepoint.set_state(value_node->list[index].status_at_time(time));
+ activepoint.set_priority(0);
+*/
+
+ activepoint=value_node->list[index].new_activepoint_at_time(activepoint.get_time());
+
+ // In this case, nothing is really changing, so there will be
+ // no need to redraw the window
+ set_dirty(false);
+}
+
+void
+Action::ActivepointSetSmart::enclose_activepoint(const synfig::Activepoint& activepoint)
+{
+ times.insert(activepoint.get_time());
+
+ if(get_edit_mode()&MODE_ANIMATE_PAST) try
+ {
+ // Try to find prev keyframe
+ Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(activepoint.get_time()));
+
+ if(times.count(keyframe.get_time()))
+ throw int();
+ else
+ times.insert(keyframe.get_time());
+
+ try { value_node->list[index].find(keyframe.get_time()); }
+ catch(synfig::Exception::NotFound)
+ {
+ Action::Handle action(ActivepointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+
+ if(!value_node->list[index].timing_info.empty())
+ {
+ action->set_param("time",keyframe.get_time());
+ }
+ else
+ {
+ synfig::Activepoint tmp;
+
+ tmp.set_state(true);
+ tmp.set_time(keyframe.get_time());
+ action->set_param("activepoint",tmp);
+ }
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ catch(int) { }
+ catch(synfig::Exception::NotFound) { }
+
+ if(get_edit_mode()&MODE_ANIMATE_FUTURE)try
+ {
+ // Try to find next keyframe
+ Keyframe keyframe(*get_canvas()->keyframe_list().find_next(activepoint.get_time()));
+
+ if(times.count(keyframe.get_time()))
+ throw int();
+ else
+ times.insert(keyframe.get_time());
+
+ try { value_node->list[index].find(keyframe.get_time()); }
+ catch(synfig::Exception::NotFound)
+ {
+ Action::Handle action(ActivepointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+
+ if(!value_node->list[index].timing_info.empty())
+ {
+ action->set_param("time",keyframe.get_time());
+ }
+ else
+ {
+ synfig::Activepoint tmp;
+
+ tmp.set_state(true);
+ tmp.set_time(keyframe.get_time());
+ action->set_param("activepoint",tmp);
+ }
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ catch(int) { }
+ catch(synfig::Exception::NotFound) { }
+}
+
+void
+Action::ActivepointSetSmart::prepare()
+{
+ clear();
+ times.clear();
+
+ // First, we need to to add any activepoints necessary to
+ // maintain the integrity of the keyframes.
+ enclose_activepoint(activepoint);
+
+ try
+ {
+ if(value_node->list[index].find(activepoint)==value_node->list[index].timing_info.end())
+ throw int();
+
+ // Then, lets try to replace the old activepoint, if it exists
+ enclose_activepoint(*value_node->list[index].find(activepoint));
+
+ Action::Handle action(ActivepointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ return;
+ }
+ catch(int){}
+ catch(Exception::NotFound){}
+
+ try
+ {
+ // Check to see if a activepoint exists at this point in time
+ activepoint.mimic(*value_node->list[index].find(activepoint.get_time()));
+
+ enclose_activepoint(*value_node->list[index].find(activepoint.get_time()));
+
+ Action::Handle action(ActivepointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ return;
+ }
+ catch(int){}
+ catch(Exception::NotFound){}
+
+ try
+ {
+ // At this point we know that the old activepoint doesn't exist,
+ // so we need to create it.
+ Action::Handle action(ActivepointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ return;
+ }
+ catch(int){}
+ catch(Exception::NotFound){}
+
+ throw Error(_("Unable to determine how to procede. This is a bug."));
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsetsmart.h
+** \brief Template File
+**
+** $Id: activepointsetsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_ACTIVEPOINTSETSMART_H
+#define __SYNFIG_APP_ACTION_ACTIVEPOINTSETSMART_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+#include <list>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ActivepointSetSmart :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+ synfig::Activepoint activepoint;
+ bool time_set;
+
+ void calc_activepoint();
+ void enclose_activepoint(const synfig::Activepoint& activepoint);
+
+ std::set<synfig::Time> times;
+
+public:
+
+ ActivepointSetSmart();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsimpleadd.cpp
+** \brief Simple add activepoint File
+**
+** $Id: activepointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "activepointsimpleadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ActivepointSimpleAdd);
+ACTION_SET_NAME(Action::ActivepointSimpleAdd,"waypoint_simpleadd");
+ACTION_SET_LOCAL_NAME(Action::ActivepointSimpleAdd,"Simply Add Waypoint");
+ACTION_SET_TASK(Action::ActivepointSimpleAdd,"add");
+ACTION_SET_CATEGORY(Action::ActivepointSimpleAdd,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::ActivepointSimpleAdd,0);
+ACTION_SET_VERSION(Action::ActivepointSimpleAdd,"0.0");
+ACTION_SET_CVS_ID(Action::ActivepointSimpleAdd,"$Id: activepointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ActivepointSimpleAdd::ActivepointSimpleAdd()
+{
+ set_dirty(true);
+ activepoint.set_time(Time::begin()-1);
+}
+
+Action::ParamVocab
+Action::ActivepointSimpleAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("Destination ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("activepoint",Param::TYPE_ACTIVEPOINT)
+ .set_local_name(_("Activepoint"))
+ .set_desc(_("Activepoint to be added"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ActivepointSimpleAdd::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ActivepointSimpleAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+ if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
+ {
+ activepoint = param.get_activepoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ActivepointSimpleAdd::is_ready()const
+{
+ if(!value_node && activepoint.get_time() != (Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ActivepointSimpleAdd::perform()
+{
+ //remove any pretenders that lie at our destination
+ ValueNode_DynamicList::ListEntry::findresult iter = value_node->list[index]
+ .find_time(activepoint.get_time());
+
+ time_overwrite = false;
+ if(iter.second)
+ {
+ overwritten_ap = *iter.first;
+ time_overwrite = true;
+ value_node->list[index].erase(overwritten_ap);
+ }
+
+ //add the value node in since it's safe
+ value_node->list[index].add(activepoint);
+
+ //sort them...
+ value_node->list[index].timing_info.sort();
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
+
+void
+Action::ActivepointSimpleAdd::undo()
+{
+ //remove our old version...
+ ValueNode_DynamicList::ListEntry::findresult iter = value_node->list[index].find_uid(activepoint);
+
+ if(!iter.second)
+ {
+ throw Error(_("The activepoint to remove no longer exists"));
+ }
+
+ //remove the offending value
+ value_node->list[index].erase(*iter.first); //could also just use waypoint
+
+ if(time_overwrite)
+ {
+ value_node->list[index].add(overwritten_ap);
+ }
+
+ //sort them...
+ value_node->list[index].timing_info.sort();
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file activepointsimpleadd.h
+** \brief A simple add a activepoint function Header
+**
+** $Id: activepointsimpleadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_ACTIVEPOINTSIMPLEADD_H
+#define __SYNFIG_ACTIVEPOINTSIMPLEADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ActivepointSimpleAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+
+ synfig::Activepoint activepoint;
+
+ bool time_overwrite;
+ synfig::Activepoint overwritten_ap;
+
+public:
+
+ ActivepointSimpleAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blinepointtangentmerge.cpp
+** \brief Template File
+**
+** $Id: blinepointtangentmerge.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "blinepointtangentmerge.h"
+#include "valuedescset.h"
+
+#include "activepointset.h"
+#include "activepointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::BLinePointTangentMerge);
+ACTION_SET_NAME(Action::BLinePointTangentMerge,"bline_point_tangent_merge");
+ACTION_SET_LOCAL_NAME(Action::BLinePointTangentMerge,_("Merge Tangents"));
+ACTION_SET_TASK(Action::BLinePointTangentMerge,"merge");
+ACTION_SET_CATEGORY(Action::BLinePointTangentMerge,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::BLinePointTangentMerge,0);
+ACTION_SET_VERSION(Action::BLinePointTangentMerge,"0.0");
+ACTION_SET_CVS_ID(Action::BLinePointTangentMerge,"$Id: blinepointtangentmerge.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::BLinePointTangentMerge::BLinePointTangentMerge()
+{
+ time=(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::BLinePointTangentMerge::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode of BLinePoint"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ );
+
+ return ret;
+}
+
+bool
+Action::BLinePointTangentMerge::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueNode_Composite::Handle value_node;
+ value_node=ValueNode_Composite::Handle::cast_dynamic(x.find("value_node")->second.get_value_node());
+ if(!value_node || value_node->get_type()!=ValueBase::TYPE_BLINEPOINT)
+ return false;
+ synfig::Time time(x.find("time")->second.get_time());
+ if((*value_node->get_link("split"))(time).get(bool())==false)
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::BLinePointTangentMerge::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=value_node.cast_dynamic(param.get_value_node());
+
+ return (bool)(value_node);
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::BLinePointTangentMerge::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing or bad value_node");
+
+ if(time==(Time::begin()-1))
+ synfig::error("Missing time");
+
+ if(!value_node || time==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::BLinePointTangentMerge::prepare()
+{
+ clear();
+
+ Action::Handle action;
+
+ {
+ action=Action::create("value_desc_set");
+ if(!action)
+ throw Error(_("Couldn't find action \"value_desc_set\""));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,3));
+ action->set_param("time",time);
+ action->set_param("new_value",synfig::ValueBase(false));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ {
+ action=Action::create("value_desc_set");
+ if(!action)
+ throw Error(_("Couldn't find action \"value_desc_set\""));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,5));
+ action->set_param("time",time);
+ action->set_param("new_value",(*value_node->get_link("t1"))(time));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blinepointtangentmerge.h
+** \brief Template File
+**
+** $Id: blinepointtangentmerge.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_BLINEPOINTTANGENTMERGE_H
+#define __SYNFIG_APP_ACTION_BLINEPOINTTANGENTMERGE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/blinepoint.h>
+#include <synfig/valuenode_composite.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class BLinePointTangentMerge :
+ public Super
+{
+private:
+
+ synfig::ValueNode_Composite::Handle value_node;
+ synfig::Time time;
+
+public:
+
+ BLinePointTangentMerge();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blinepointtangentsplit.cpp
+** \brief Template File
+**
+** $Id: blinepointtangentsplit.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "blinepointtangentsplit.h"
+#include "valuedescset.h"
+
+#include "activepointset.h"
+#include "activepointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::BLinePointTangentSplit);
+ACTION_SET_NAME(Action::BLinePointTangentSplit,"bline_point_tangent_split");
+ACTION_SET_LOCAL_NAME(Action::BLinePointTangentSplit,_("Split Tangents"));
+ACTION_SET_TASK(Action::BLinePointTangentSplit,"split");
+ACTION_SET_CATEGORY(Action::BLinePointTangentSplit,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::BLinePointTangentSplit,0);
+ACTION_SET_VERSION(Action::BLinePointTangentSplit,"0.0");
+ACTION_SET_CVS_ID(Action::BLinePointTangentSplit,"$Id: blinepointtangentsplit.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::BLinePointTangentSplit::BLinePointTangentSplit()
+{
+ time=(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::BLinePointTangentSplit::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode of BLinePoint"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ );
+
+ return ret;
+}
+
+bool
+Action::BLinePointTangentSplit::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueNode_Composite::Handle value_node;
+ value_node=ValueNode_Composite::Handle::cast_dynamic(x.find("value_node")->second.get_value_node());
+ if(!value_node || value_node->get_type()!=ValueBase::TYPE_BLINEPOINT)
+ return false;
+ synfig::Time time(x.find("time")->second.get_time());
+ if((*value_node->get_link("split"))(time).get(bool())==true)
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::BLinePointTangentSplit::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=value_node.cast_dynamic(param.get_value_node());
+
+ return (bool)(value_node);
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::BLinePointTangentSplit::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing or bad value_node");
+
+ if(time==(Time::begin()-1))
+ synfig::error("Missing time");
+
+ if(!value_node || time==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::BLinePointTangentSplit::prepare()
+{
+ clear();
+
+ Action::Handle action;
+
+ {
+ action=Action::create("value_desc_set");
+ if(!action)
+ throw Error(_("Couldn't find action \"value_desc_set\""));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,3));
+ action->set_param("time",time);
+ action->set_param("new_value",synfig::ValueBase(true));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ {
+ action=Action::create("value_desc_set");
+ if(!action)
+ throw Error(_("Couldn't find action \"value_desc_set\""));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,5));
+ action->set_param("time",time);
+ action->set_param("new_value",(*value_node->get_link("t1"))(time));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blinepointtangentsplit.h
+** \brief Template File
+**
+** $Id: blinepointtangentsplit.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_BLINEPOINTTANGENTSPLIT_H
+#define __SYNFIG_APP_ACTION_BLINEPOINTTANGENTSPLIT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/blinepoint.h>
+#include <synfig/valuenode_composite.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class BLinePointTangentSplit :
+ public Super
+{
+private:
+
+ synfig::ValueNode_Composite::Handle value_node;
+ synfig::Time time;
+
+public:
+
+ BLinePointTangentSplit();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasadd.cpp
+** \brief Template File
+**
+** $Id: canvasadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "canvasadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::CanvasAdd);
+ACTION_SET_NAME(Action::CanvasAdd,"canvas_add");
+ACTION_SET_LOCAL_NAME(Action::CanvasAdd,"Add Child Canvas");
+ACTION_SET_TASK(Action::CanvasAdd,"add");
+ACTION_SET_CATEGORY(Action::CanvasAdd,Action::CATEGORY_CANVAS);
+ACTION_SET_PRIORITY(Action::CanvasAdd,0);
+ACTION_SET_VERSION(Action::CanvasAdd,"0.0");
+ACTION_SET_CVS_ID(Action::CanvasAdd,"$Id: canvasadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::CanvasAdd::CanvasAdd()
+{
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::CanvasAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("src",Param::TYPE_CANVAS)
+ .set_local_name(_("New Canvas"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("id",Param::TYPE_STRING)
+ .set_local_name(_("ID"))
+ .set_desc(_("The name that you want this canvas to be"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::CanvasAdd::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::CanvasAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="src" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ new_canvas=param.get_canvas();
+
+ return true;
+ }
+ if(name=="id" && param.get_type()==Param::TYPE_STRING)
+ {
+ id=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::CanvasAdd::is_ready()const
+{
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::CanvasAdd::perform()
+{
+ if(!new_canvas)
+ {
+ new_canvas=get_canvas()->new_child_canvas(id);
+ }
+ else
+ {
+ if(new_canvas->is_inline())
+ {
+ inline_parent=new_canvas->parent();
+ }
+ get_canvas()->add_child_canvas(new_canvas,id);
+ }
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_canvas_added()(new_canvas);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::CanvasAdd::undo()
+{
+ get_canvas()->remove_child_canvas(new_canvas);
+
+ if(inline_parent)
+ new_canvas->set_inline(inline_parent);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_canvas_removed()(new_canvas);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasadd.h
+** \brief Template File
+**
+** $Id: canvasadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_CANVASADD_H
+#define __SYNFIG_APP_ACTION_CANVASADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/renddesc.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class CanvasAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Canvas::Handle new_canvas;
+ synfig::String id;
+
+ synfig::Canvas::Handle inline_parent;
+
+public:
+
+ CanvasAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasremove.cpp
+** \brief Template File
+**
+** $Id: canvasremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "canvasremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::CanvasRemove);
+ACTION_SET_NAME(Action::CanvasRemove,"canvas_remove");
+ACTION_SET_LOCAL_NAME(Action::CanvasRemove,"Remove Canvas");
+ACTION_SET_TASK(Action::CanvasRemove,"remove");
+ACTION_SET_CATEGORY(Action::CanvasRemove,Action::CATEGORY_CANVAS);
+ACTION_SET_PRIORITY(Action::CanvasRemove,0);
+ACTION_SET_VERSION(Action::CanvasRemove,"0.0");
+ACTION_SET_CVS_ID(Action::CanvasRemove,"$Id: canvasremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::CanvasRemove::CanvasRemove()
+{
+}
+
+Action::ParamVocab
+Action::CanvasRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ return ret;
+}
+
+bool
+Action::CanvasRemove::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ Canvas::Handle canvas=x.find("canvas")->second.get_canvas();
+ assert(canvas);
+ // We cannot remove the root canvas.
+ if(canvas->is_root())
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::CanvasRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::CanvasRemove::is_ready()const
+{
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::CanvasRemove::perform()
+{
+ // We cannot remove the root canvas.
+ if(get_canvas()->is_root())
+ throw Error(_("You cannot remove the root canvas!"));
+
+ if(get_canvas()->is_inline())
+ throw Error(_("You cannot remove an inline canvas!"));
+
+ parent_canvas=get_canvas()->parent();
+ canvas_id=get_canvas()->get_id();
+
+ assert(parent_canvas);
+
+ parent_canvas->remove_child_canvas(get_canvas());
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_canvas_removed()(get_canvas());
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::CanvasRemove::undo()
+{
+ parent_canvas->add_child_canvas(get_canvas(), canvas_id);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_canvas_added()(get_canvas());
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasremove.h
+** \brief Template File
+**
+** $Id: canvasremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_CANVASREMOVE_H
+#define __SYNFIG_APP_ACTION_CANVASREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/renddesc.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class CanvasRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+ synfig::Canvas::Handle parent_canvas;
+ synfig::String canvas_id;
+public:
+
+ CanvasRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasrenddescset.cpp
+** \brief Template File
+**
+** $Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "canvasrenddescset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::CanvasRendDescSet);
+ACTION_SET_NAME(Action::CanvasRendDescSet,"canvas_rend_desc_set");
+ACTION_SET_LOCAL_NAME(Action::CanvasRendDescSet,"Set Canvas RendDesc");
+ACTION_SET_TASK(Action::CanvasRendDescSet,"set");
+ACTION_SET_CATEGORY(Action::CanvasRendDescSet,Action::CATEGORY_CANVAS);
+ACTION_SET_PRIORITY(Action::CanvasRendDescSet,0);
+ACTION_SET_VERSION(Action::CanvasRendDescSet,"0.0");
+ACTION_SET_CVS_ID(Action::CanvasRendDescSet,"$Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::CanvasRendDescSet::CanvasRendDescSet()
+{
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::CanvasRendDescSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("rend_desc",Param::TYPE_RENDDESC)
+ .set_local_name(_("RendDesc"))
+ );
+
+ return ret;
+}
+
+bool
+Action::CanvasRendDescSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::CanvasRendDescSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="rend_desc" && param.get_type()==Param::TYPE_RENDDESC)
+ {
+ new_rend_desc=param.get_rend_desc();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::CanvasRendDescSet::is_ready()const
+{
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::CanvasRendDescSet::perform()
+{
+ old_rend_desc=get_canvas()->rend_desc();
+
+ get_canvas()->rend_desc()=new_rend_desc;
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_rend_desc_changed()();
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::CanvasRendDescSet::undo()
+{
+ get_canvas()->rend_desc()=old_rend_desc;
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_rend_desc_changed()();
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasrenddescset.h
+** \brief Template File
+**
+** $Id: canvasrenddescset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_CANVASRENDDESCSET_H
+#define __SYNFIG_APP_ACTION_CANVASRENDDESCSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/renddesc.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class CanvasRendDescSet :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::RendDesc new_rend_desc;
+ synfig::RendDesc old_rend_desc;
+
+public:
+
+ CanvasRendDescSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file colorset.cpp
+** \brief Template File
+**
+** $Id: colorset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamset.h"
+#include "valuenodeconstset.h"
+#include "valuedescconnect.h"
+#include "waypointsetsmart.h"
+
+#include "colorset.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/main.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ColorSet);
+ACTION_SET_NAME(Action::ColorSet,"color_set");
+ACTION_SET_LOCAL_NAME(Action::ColorSet,"Apply Default Color");
+ACTION_SET_TASK(Action::ColorSet,"set");
+ACTION_SET_CATEGORY(Action::ColorSet,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ColorSet,0);
+ACTION_SET_VERSION(Action::ColorSet,"0.0");
+ACTION_SET_CVS_ID(Action::ColorSet,"$Id: colorset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ColorSet::ColorSet():
+ time(0)
+{
+}
+
+Action::ParamVocab
+Action::ColorSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ColorSet::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+ return x.find("value_desc")->second.get_value_desc().get_value_type()==ValueBase::TYPE_COLOR;
+}
+
+bool
+Action::ColorSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ // Grab the value_desc
+ value_desc=param.get_value_desc();
+
+ // Grab the current color
+ color=synfigapp::Main::get_foreground_color();
+
+ return value_desc.get_value_type()==ValueBase::TYPE_COLOR;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ColorSet::is_ready()const
+{
+ if(!value_desc || value_desc.get_value_type()!=ValueBase::TYPE_COLOR)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ColorSet::prepare()
+{
+ clear();
+
+ Action::Handle action;
+ action=Action::create("value_desc_set");
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("new_value",ValueBase(color));
+ action->set_param("time",time);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file colorset.h
+** \brief Template File
+**
+** $Id: colorset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_COLORSET_H
+#define __SYNFIG_APP_ACTION_COLORSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ColorSet :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::Color color;
+ synfig::Time time;
+
+public:
+
+ ColorSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file editmodeset.cpp
+** \brief Template File
+**
+** $Id: editmodeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "editmodeset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::EditModeSet);
+ACTION_SET_NAME(Action::EditModeSet,"edit_mode_set");
+ACTION_SET_LOCAL_NAME(Action::EditModeSet,"Set Edit Mode");
+ACTION_SET_TASK(Action::EditModeSet,"set");
+ACTION_SET_CATEGORY(Action::EditModeSet,Action::CATEGORY_OTHER);
+ACTION_SET_PRIORITY(Action::EditModeSet,0);
+ACTION_SET_VERSION(Action::EditModeSet,"0.0");
+ACTION_SET_CVS_ID(Action::EditModeSet,"$Id: editmodeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::EditModeSet::EditModeSet()
+{
+}
+
+Action::ParamVocab
+Action::EditModeSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("edit_mode",Param::TYPE_EDITMODE)
+ .set_local_name(_("New Edit Mode"))
+ );
+
+ return ret;
+}
+
+bool
+Action::EditModeSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::EditModeSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+/*
+ if(name=="edit_mode" && param.get_type()==Param::TYPE_EDITMODE)
+ {
+ set_edit_mode(param.get_edit_mode());
+
+ return true;
+ }
+*/
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::EditModeSet::is_ready()const
+{
+ return Action::CanvasSpecific::is_ready() && get_canvas_interface();
+}
+
+void
+Action::EditModeSet::perform()
+{
+ set_dirty(false);
+
+ old_edit_mode=get_canvas_interface()->get_mode();
+
+ if(old_edit_mode==get_edit_mode())
+ return;
+
+ get_canvas_interface()->mode_=get_edit_mode();
+
+ get_canvas_interface()->signal_mode_changed_(get_edit_mode());
+}
+
+void
+Action::EditModeSet::undo()
+{
+ set_dirty(false);
+
+ if(old_edit_mode==get_edit_mode())
+ return;
+
+ get_canvas_interface()->mode_=old_edit_mode;
+
+ get_canvas_interface()->signal_mode_changed_(old_edit_mode);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file editmodeset.h
+** \brief Template File
+**
+** $Id: editmodeset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_EDITMODESET_H
+#define __SYNFIG_APP_ACTION_EDITMODESET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <synfigapp/editmode.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class EditModeSet :
+ public Undoable,
+ public CanvasSpecific
+{
+ EditMode old_edit_mode;
+public:
+
+ EditModeSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file gradientset.cpp
+** \brief Template File
+**
+** $Id: gradientset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamset.h"
+#include "valuenodeconstset.h"
+#include "valuedescconnect.h"
+#include "waypointsetsmart.h"
+
+#include "gradientset.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/main.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::GradientSet);
+ACTION_SET_NAME(Action::GradientSet,"gradient_set");
+ACTION_SET_LOCAL_NAME(Action::GradientSet,"Apply Default Gradient");
+ACTION_SET_TASK(Action::GradientSet,"set");
+ACTION_SET_CATEGORY(Action::GradientSet,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::GradientSet,0);
+ACTION_SET_VERSION(Action::GradientSet,"0.0");
+ACTION_SET_CVS_ID(Action::GradientSet,"$Id: gradientset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::GradientSet::GradientSet():
+ time(0)
+{
+}
+
+Action::ParamVocab
+Action::GradientSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::GradientSet::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+ return x.find("value_desc")->second.get_value_desc().get_value_type()==ValueBase::TYPE_GRADIENT;
+}
+
+bool
+Action::GradientSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ // Grab the value_desc
+ value_desc=param.get_value_desc();
+
+ // Grab the current gradient
+ gradient=synfigapp::Main::get_gradient();
+
+ return value_desc.get_value_type()==ValueBase::TYPE_GRADIENT;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::GradientSet::is_ready()const
+{
+ if(!value_desc || value_desc.get_value_type()!=ValueBase::TYPE_GRADIENT)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::GradientSet::prepare()
+{
+ clear();
+
+ Action::Handle action;
+ action=Action::create("value_desc_set");
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("new_value",ValueBase(gradient));
+ action->set_param("time",time);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file gradientset.h
+** \brief Template File
+**
+** $Id: gradientset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_GRADIENTSET_H
+#define __SYNFIG_APP_ACTION_GRADIENTSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+#include <synfig/gradient.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class GradientSet :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::Gradient gradient;
+ synfig::Time time;
+
+public:
+
+ GradientSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.cpp
+** \brief Template File
+**
+** $Id: groupaddlayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "groupaddlayers.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::GroupAddLayers);
+ACTION_SET_NAME(Action::GroupAddLayers,"group_add_layers");
+ACTION_SET_LOCAL_NAME(Action::GroupAddLayers,"Add Layers to Group");
+ACTION_SET_TASK(Action::GroupAddLayers,"add");
+ACTION_SET_CATEGORY(Action::GroupAddLayers,Action::CATEGORY_LAYER|Action::CATEGORY_GROUP);
+ACTION_SET_PRIORITY(Action::GroupAddLayers,0);
+ACTION_SET_VERSION(Action::GroupAddLayers,"0.0");
+ACTION_SET_CVS_ID(Action::GroupAddLayers,"$Id: groupaddlayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::GroupAddLayers::GroupAddLayers()
+{
+}
+
+Action::ParamVocab
+Action::GroupAddLayers::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be added to group"))
+ .set_supports_multiple()
+ );
+
+ ret.push_back(ParamDesc("group",Param::TYPE_STRING)
+ .set_local_name(_("Group"))
+ .set_desc(_("Name of the Group to add the Layers to"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::GroupAddLayers::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::GroupAddLayers::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ std::pair<synfig::Layer::Handle,String> layer_pair;
+ layer_pair.first=param.get_layer();
+ layer_list.push_back(layer_pair);
+
+ return true;
+ }
+
+ if(name=="group" && param.get_type()==Param::TYPE_STRING)
+ {
+ group=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::GroupAddLayers::is_ready()const
+{
+ if(layer_list.empty() || group.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::GroupAddLayers::perform()
+{
+ std::list<std::pair<synfig::Layer::Handle,String> >::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ Layer::Handle layer(iter->first);
+ iter->second=layer->get_group();
+
+ layer->add_to_group(group);
+ }
+}
+
+void
+Action::GroupAddLayers::undo()
+{
+ std::list<std::pair<synfig::Layer::Handle,String> >::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ Layer::Handle layer(iter->first);
+
+ layer->remove_from_group(group);
+
+ layer->add_to_group(iter->second);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_groupaddlayers.h
+** \brief Template File
+**
+** $Id: groupaddlayers.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_GROUPADDLAYERS_H
+#define __SYNFIG_APP_ACTION_GROUPADDLAYERS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class GroupAddLayers :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ // List contains the layers and their previous groups
+ std::list<std::pair<synfig::Layer::Handle,synfig::String> > layer_list;
+
+ // The name of the new group
+ synfig::String group;
+
+public:
+
+ GroupAddLayers();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.cpp
+** \brief Template File
+**
+** $Id: groupremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "groupremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::GroupRemove);
+ACTION_SET_NAME(Action::GroupRemove,"group_remove");
+ACTION_SET_LOCAL_NAME(Action::GroupRemove,"Remove Group");
+ACTION_SET_TASK(Action::GroupRemove,"remove");
+ACTION_SET_CATEGORY(Action::GroupRemove,Action::CATEGORY_GROUP);
+ACTION_SET_PRIORITY(Action::GroupRemove,0);
+ACTION_SET_VERSION(Action::GroupRemove,"0.0");
+ACTION_SET_CVS_ID(Action::GroupRemove,"$Id: groupremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::GroupRemove::GroupRemove()
+{
+}
+
+Action::ParamVocab
+Action::GroupRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("group",Param::TYPE_STRING)
+ .set_local_name(_("Group"))
+ .set_desc(_("Name of the Group to remove"))
+ );
+
+ return ret;
+}
+
+bool
+Action::GroupRemove::is_canidate(const ParamList &x)
+{
+ bool ret(canidate_check(get_param_vocab(),x));
+ if(!ret)
+ {
+ synfig::info("Action::GroupRemove::is_canidate(): failed canidate check");
+ ParamList::const_iterator iter;
+ for(iter=x.begin();iter!=x.end();++iter)
+ {
+ synfig::info("PARAM: %s",iter->first.c_str());
+ }
+ }
+ return ret;
+}
+
+bool
+Action::GroupRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="group" && param.get_type()==Param::TYPE_STRING)
+ {
+ group=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::GroupRemove::is_ready()const
+{
+ if(group.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::GroupRemove::perform()
+{
+ layer_list=get_canvas()->get_layers_in_group(group);
+
+ std::set<synfig::Layer::Handle>::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ (*iter)->remove_from_group(group);
+ }
+}
+
+void
+Action::GroupRemove::undo()
+{
+ std::set<synfig::Layer::Handle>::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ (*iter)->add_to_group(group);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_groupaddlayers.h
+** \brief Template File
+**
+** $Id: groupremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_GROUPREMOVE_H
+#define __SYNFIG_APP_ACTION_GROUPREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class GroupRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ // List contains the layers
+ std::set<synfig::Layer::Handle> layer_list;
+
+ // The name of the group to remove
+ synfig::String group;
+
+public:
+
+ GroupRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.cpp
+** \brief Template File
+**
+** $Id: groupremovelayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "groupremovelayers.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::GroupRemoveLayers);
+ACTION_SET_NAME(Action::GroupRemoveLayers,"group_remove_layers");
+ACTION_SET_LOCAL_NAME(Action::GroupRemoveLayers,"Remove Layers from a Group");
+ACTION_SET_TASK(Action::GroupRemoveLayers,"remove");
+ACTION_SET_CATEGORY(Action::GroupRemoveLayers,Action::CATEGORY_LAYER|Action::CATEGORY_GROUP);
+ACTION_SET_PRIORITY(Action::GroupRemoveLayers,0);
+ACTION_SET_VERSION(Action::GroupRemoveLayers,"0.0");
+ACTION_SET_CVS_ID(Action::GroupRemoveLayers,"$Id: groupremovelayers.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::GroupRemoveLayers::GroupRemoveLayers()
+{
+}
+
+Action::ParamVocab
+Action::GroupRemoveLayers::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be added to group"))
+ .set_supports_multiple()
+ );
+
+ ret.push_back(ParamDesc("group",Param::TYPE_STRING)
+ .set_local_name(_("Group"))
+ .set_desc(_("Name of the Group to add the Layers to"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::GroupRemoveLayers::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::GroupRemoveLayers::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ std::pair<synfig::Layer::Handle,String> layer_pair;
+ layer_pair.first=param.get_layer();
+ layer_list.push_back(layer_pair);
+
+ return true;
+ }
+
+ if(name=="group" && param.get_type()==Param::TYPE_STRING)
+ {
+ group=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::GroupRemoveLayers::is_ready()const
+{
+ if(layer_list.empty() || group.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::GroupRemoveLayers::perform()
+{
+ std::list<std::pair<synfig::Layer::Handle,String> >::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ Layer::Handle layer(iter->first);
+ iter->second=layer->get_group();
+
+ layer->remove_from_group(group);
+ }
+}
+
+void
+Action::GroupRemoveLayers::undo()
+{
+ std::list<std::pair<synfig::Layer::Handle,String> >::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ Layer::Handle layer(iter->first);
+
+ layer->add_to_group(iter->second);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_groupremovelayers.h
+** \brief Template File
+**
+** $Id: groupremovelayers.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_GROUPREMOVELAYERS_H
+#define __SYNFIG_APP_ACTION_GROUPREMOVELAYERS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class GroupRemoveLayers :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ // List contains the layers and their previous groups
+ std::list<std::pair<synfig::Layer::Handle,synfig::String> > layer_list;
+
+ // The name of the new group
+ synfig::String group;
+
+public:
+
+ GroupRemoveLayers();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.cpp
+** \brief Template File
+**
+** $Id: grouprename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "grouprename.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::GroupRename);
+ACTION_SET_NAME(Action::GroupRename,"group_rename");
+ACTION_SET_LOCAL_NAME(Action::GroupRename,"Rename Group");
+ACTION_SET_TASK(Action::GroupRename,"rename");
+ACTION_SET_CATEGORY(Action::GroupRename,Action::CATEGORY_GROUP);
+ACTION_SET_PRIORITY(Action::GroupRename,0);
+ACTION_SET_VERSION(Action::GroupRename,"0.0");
+ACTION_SET_CVS_ID(Action::GroupRename,"$Id: grouprename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::GroupRename::GroupRename()
+{
+}
+
+Action::ParamVocab
+Action::GroupRename::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("group",Param::TYPE_STRING)
+ .set_local_name(_("Old Group"))
+ .set_desc(_("Name of the Group to rename"))
+ );
+
+ ret.push_back(ParamDesc("new_group",Param::TYPE_STRING)
+ .set_local_name(_("New Group"))
+ .set_desc(_("New name for group"))
+ );
+
+ return ret;
+}
+
+bool
+Action::GroupRename::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::GroupRename::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="group" && param.get_type()==Param::TYPE_STRING)
+ {
+ old_group_name=param.get_string();
+
+ return true;
+ }
+
+ if(name=="new_group" && param.get_type()==Param::TYPE_STRING)
+ {
+ new_group_name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::GroupRename::is_ready()const
+{
+ if(old_group_name.empty()||new_group_name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::GroupRename::perform()
+{
+ if(get_canvas()->get_groups().count(new_group_name)!=0)
+ {
+ throw Error(_("A group with the name \"%s\" already exists!"),new_group_name.c_str());
+ }
+ get_canvas()->rename_group(old_group_name,new_group_name);
+}
+
+void
+Action::GroupRename::undo()
+{
+ get_canvas()->rename_group(new_group_name,old_group_name);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_grouprename.h
+** \brief Template File
+**
+** $Id: grouprename.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_GROUPRENAME_H
+#define __SYNFIG_APP_ACTION_GROUPRENAME_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class GroupRename :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ // List contains the layers
+ std::set<synfig::Layer::Handle> layer_list;
+
+ // The name of the group to remove
+ synfig::String old_group_name;
+
+ synfig::String new_group_name;
+
+public:
+
+ GroupRename();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeadd.cpp
+** \brief Template File
+**
+** $Id: keyframeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframeadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeAdd);
+ACTION_SET_NAME(Action::KeyframeAdd,"keyframe_add");
+ACTION_SET_LOCAL_NAME(Action::KeyframeAdd,"Add Keyframe");
+ACTION_SET_TASK(Action::KeyframeAdd,"add");
+ACTION_SET_CATEGORY(Action::KeyframeAdd,Action::CATEGORY_KEYFRAME);
+ACTION_SET_PRIORITY(Action::KeyframeAdd,0);
+ACTION_SET_VERSION(Action::KeyframeAdd,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeAdd,"$Id: keyframeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeAdd::KeyframeAdd()
+{
+ keyframe.set_time(Time::begin()-1);
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::KeyframeAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("New Keyframe"))
+ .set_desc(_("Keyframe to be added"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeAdd::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+
+ return true;
+}
+
+bool
+Action::KeyframeAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ keyframe=param.get_keyframe();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeAdd::is_ready()const
+{
+ if(keyframe.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeAdd::perform()
+{
+ try { get_canvas()->keyframe_list().find(keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { get_canvas()->keyframe_list().find(keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ get_canvas()->keyframe_list().add(keyframe);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_added()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::KeyframeAdd::undo()
+{
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_removed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+ get_canvas()->keyframe_list().erase(keyframe);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeadd.h
+** \brief Template File
+**
+** $Id: keyframeadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMEADD_H
+#define __SYNFIG_APP_ACTION_KEYFRAMEADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Keyframe keyframe;
+
+public:
+
+ KeyframeAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeduplicate.cpp
+** \brief Template File
+**
+** $Id: keyframeduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframeduplicate.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+#include "activepointsetsmart.h"
+#include "waypointsetsmart.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeDuplicate);
+ACTION_SET_NAME(Action::KeyframeDuplicate,"keyframe_duplicate");
+ACTION_SET_LOCAL_NAME(Action::KeyframeDuplicate,"Duplicate Keyframe");
+ACTION_SET_TASK(Action::KeyframeDuplicate,"duplicate");
+ACTION_SET_CATEGORY(Action::KeyframeDuplicate,Action::CATEGORY_KEYFRAME);
+ACTION_SET_PRIORITY(Action::KeyframeDuplicate,0);
+ACTION_SET_VERSION(Action::KeyframeDuplicate,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeDuplicate,"$Id: keyframeduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeDuplicate::KeyframeDuplicate()
+{
+ new_keyframe.set_time(Time::begin()-1);
+ keyframe.set_time(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::KeyframeDuplicate::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("Keyframe"))
+ .set_desc(_("Keyframe to be duplicated"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeDuplicate::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::KeyframeDuplicate::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ keyframe=param.get_keyframe();
+ new_keyframe.set_description(keyframe.get_description()+_(" (Duplicate)"));
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ new_keyframe.set_time(param.get_time());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeDuplicate::is_ready()const
+{
+ if(keyframe.get_time()==(Time::begin()-1) || new_keyframe.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeDuplicate::prepare()
+{
+ clear();
+
+ const synfig::Time old_time=keyframe.get_time();
+ const synfig::Time new_time=new_keyframe.get_time();
+
+ try { get_canvas()->keyframe_list().find(keyframe);}
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find the given keyframe"));
+ }
+
+ try { if(get_canvas()->keyframe_list().find(new_time)!=get_canvas()->keyframe_list().end()) throw Error(_("A Keyframe already exists at this point in time"));}
+ catch(...) { }
+
+ // If the times are different, then we
+ // will need to romp through the valuenodes
+ // and add actions to update their values.
+ if(new_time!=old_time)
+ {
+ std::vector<synfigapp::ValueDesc> value_desc_list;
+ get_canvas_interface()->find_important_value_descs(value_desc_list);
+ while(!value_desc_list.empty())
+ {
+ process_value_desc(value_desc_list.back());
+ value_desc_list.pop_back();
+ }
+ }
+}
+
+void
+Action::KeyframeDuplicate::process_value_desc(const synfigapp::ValueDesc& value_desc)
+{
+ const synfig::Time old_time=keyframe.get_time();
+ const synfig::Time new_time=new_keyframe.get_time();
+
+ if(value_desc.is_value_node())
+ {
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ // If we are a dynamic list, then we need to update the ActivePoints
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ {
+ ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+ int i;
+
+ for(i=0;i<value_node->link_count();i++)
+ {
+ synfigapp::ValueDesc value_desc(value_node,i);
+ Activepoint activepoint(value_node->list[i].new_activepoint_at_time(old_time));
+ activepoint.set_time(new_time);
+
+ Action::Handle action(ActivepointSetSmart::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
+ {
+ ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
+ Waypoint waypoint(value_node->new_waypoint_at_time(old_time));
+ waypoint.set_time(new_time);
+
+ Action::Handle action(WaypointSetSmart::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+}
+
+void
+Action::KeyframeDuplicate::perform()
+{
+ try { get_canvas()->keyframe_list().find(new_keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { get_canvas()->keyframe_list().find(new_keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ Action::Super::perform();
+
+ get_canvas()->keyframe_list().add(new_keyframe);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_added()(new_keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::KeyframeDuplicate::undo()
+{
+ Action::Super::undo();
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_removed()(new_keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+ get_canvas()->keyframe_list().erase(new_keyframe);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeduplicate.h
+** \brief Template File
+**
+** $Id: keyframeduplicate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMEDUPLICATE_H
+#define __SYNFIG_APP_ACTION_KEYFRAMEDUPLICATE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeDuplicate :
+ public Super
+{
+private:
+
+ synfig::Keyframe keyframe;
+ synfig::Keyframe new_keyframe;
+
+ void process_value_desc(const synfigapp::ValueDesc& value_desc);
+
+public:
+
+ KeyframeDuplicate();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeremove.cpp
+** \brief Template File
+**
+** $Id: keyframeremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframeremove.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+#include "activepointremove.h"
+#include "waypointremove.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeRemove);
+ACTION_SET_NAME(Action::KeyframeRemove,"keyframe_remove");
+ACTION_SET_LOCAL_NAME(Action::KeyframeRemove,"Remove Keyframe");
+ACTION_SET_TASK(Action::KeyframeRemove,"remove");
+ACTION_SET_CATEGORY(Action::KeyframeRemove,Action::CATEGORY_KEYFRAME);
+ACTION_SET_PRIORITY(Action::KeyframeRemove,0);
+ACTION_SET_VERSION(Action::KeyframeRemove,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeRemove,"$Id: keyframeremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeRemove::KeyframeRemove()
+{
+ keyframe.set_time(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::KeyframeRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("Keyframe"))
+ .set_desc(_("Keyframe to be removed"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeRemove::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::KeyframeRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ keyframe=param.get_keyframe();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeRemove::is_ready()const
+{
+ if(keyframe.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeRemove::prepare()
+{
+ clear();
+
+ try { get_canvas()->keyframe_list().find(keyframe);}
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find the given keyframe"));
+ }
+
+
+ {
+ std::vector<synfigapp::ValueDesc> value_desc_list;
+ get_canvas_interface()->find_important_value_descs(value_desc_list);
+ while(!value_desc_list.empty())
+ {
+ process_value_desc(value_desc_list.back());
+ value_desc_list.pop_back();
+ }
+ }
+}
+
+void
+Action::KeyframeRemove::process_value_desc(const synfigapp::ValueDesc& value_desc)
+{
+ const synfig::Time time(keyframe.get_time());
+
+ if(value_desc.is_value_node())
+ {
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ // If we are a dynamic list, then we need to update the ActivePoints
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ {
+ ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+ int i;
+ for(i=0;i<value_node->link_count();i++)
+ try
+ {
+ Activepoint activepoint;
+ activepoint=*value_node->list[i].find(time);
+
+ synfigapp::ValueDesc value_desc(value_node,i);
+
+ Action::Handle action(ActivepointRemove::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ catch(...)
+ {
+ }
+ }
+ else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
+ try
+ {
+ ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
+ Waypoint waypoint;
+ waypoint=*value_node->find(time);
+ assert(waypoint.get_time()==time);
+
+ Action::Handle action(WaypointRemove::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ catch(...)
+ {
+ }
+ }
+}
+
+
+void
+Action::KeyframeRemove::perform()
+{
+ Action::Super::perform();
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_removed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+ get_canvas()->keyframe_list().erase(keyframe);
+}
+
+void
+Action::KeyframeRemove::undo()
+{
+ try { get_canvas()->keyframe_list().find(keyframe.get_time()); throw Error(_("A Keyframe already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { get_canvas()->keyframe_list().find(keyframe); throw Error(_("This keyframe is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ Action::Super::undo();
+
+ get_canvas()->keyframe_list().add(keyframe);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_added()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeremove.h
+** \brief Template File
+**
+** $Id: keyframeremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMEREMOVE_H
+#define __SYNFIG_APP_ACTION_KEYFRAMEREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeRemove :
+ public Super
+{
+private:
+
+ synfig::Keyframe keyframe;
+
+ void process_value_desc(const synfigapp::ValueDesc& value_desc);
+
+public:
+
+ KeyframeRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeset.cpp
+** \brief Template File
+**
+** $Id: keyframeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframeset.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+#include "activepointsetsmart.h"
+#include "waypointsetsmart.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeSet);
+ACTION_SET_NAME(Action::KeyframeSet,"keyframe_set");
+ACTION_SET_LOCAL_NAME(Action::KeyframeSet,"Set Keyframe");
+ACTION_SET_TASK(Action::KeyframeSet,"set");
+ACTION_SET_CATEGORY(Action::KeyframeSet,Action::CATEGORY_KEYFRAME|Action::CATEGORY_HIDDEN);
+ACTION_SET_PRIORITY(Action::KeyframeSet,0);
+ACTION_SET_VERSION(Action::KeyframeSet,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeSet,"$Id: keyframeset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeSet::KeyframeSet()
+{
+ keyframe.set_time(Time::begin()-1);
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::KeyframeSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("New Keyframe"))
+ .set_desc(_("Keyframe to be added"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::KeyframeSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ synfig::info("KeyframeSet::set_param():old_time: %s",keyframe.get_time().get_string().c_str());
+ keyframe=param.get_keyframe();
+ synfig::info("KeyframeSet::set_param():new_time: %s",keyframe.get_time().get_string().c_str());
+ synfig::info("KeyframeSet::set_param():get_keyframe(): %s",param.get_keyframe().get_time().get_string().c_str());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeSet::is_ready()const
+{
+ if(keyframe.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeSet::prepare()
+{
+ clear();
+ guid_set.clear();
+
+
+
+
+
+ //synfig::info("new_time: %s",new_time.get_string().c_str());
+ //synfig::info("old_time: %s",old_time.get_string().c_str());
+
+ try { if(get_canvas()->keyframe_list().find(new_time)!=get_canvas()->keyframe_list().end()) throw Error(_("A Keyframe already exists at this point in time"));}
+ catch(...) { }
+
+
+ // If the times are different, then we
+ // will need to romp through the valuenodes
+ // and add actions to update their values.
+ if(new_time!=old_time)
+ {
+ std::vector<synfigapp::ValueDesc> value_desc_list;
+ get_canvas_interface()->find_important_value_descs(value_desc_list);
+ while(!value_desc_list.empty())
+ {
+ process_value_desc(value_desc_list.back());
+ value_desc_list.pop_back();
+ }
+ }
+}
+
+#define old_2_new(x) (((x)-old_begin)/(old_end-old_begin)*(new_end-new_begin)+new_begin)
+
+int
+Action::KeyframeSet::scale_activepoints(const synfigapp::ValueDesc& value_desc,const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end)
+{
+ ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_static(value_desc.get_parent_value_node()));
+ ValueNode_DynamicList::ListEntry& list_entry(value_node->list[value_desc.get_index()]);
+
+ std::vector<Activepoint*> selected;
+ std::vector<Activepoint*>::iterator iter;
+
+ if(list_entry.find(old_begin,old_end,selected))
+ {
+ // check to make sure this operation is OK
+ for(iter=selected.begin();iter!=selected.end();++iter)
+ {
+ try
+ {
+ Time new_time(old_2_new((*iter)->get_time()));
+ if(new_time>=old_begin && new_time<old_end)
+ continue;
+ list_entry.find(new_time);
+ // If we found a activepoint already at that time, then
+ // we need to abort
+ //throw Exception::BadTime(_("Activepoint Conflict"));
+ }
+ catch(Exception::NotFound) { }
+ }
+
+ int ret(0);
+ while(!selected.empty())
+ {
+ if(selected.back()->get_time()!=old_2_new(selected.back()->get_time()))
+ {
+ Action::Handle action(Action::create("activepoint_set"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+
+ Activepoint activepoint(*selected.back());
+ activepoint.set_time(old_2_new(selected.back()->get_time()));
+
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ ret++;
+ }
+ selected.pop_back();
+ }
+ return ret;
+ }
+ return 0;
+}
+
+int
+Action::KeyframeSet::scale_waypoints(const synfigapp::ValueDesc& value_desc,const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end)
+{
+ ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_static(value_desc.get_value_node()));
+
+ std::vector<Waypoint*> selected;
+ std::vector<Waypoint*>::iterator iter;
+
+ if(value_node->find(old_begin,old_end,selected))
+ {
+ // check to make sure this operation is OK
+ for(iter=selected.begin();iter!=selected.end();++iter)
+ {
+ try
+ {
+ Time new_time(old_2_new((*iter)->get_time()));
+ if(new_time>=old_begin && new_time<old_end)
+ continue;
+ value_node->find(new_time);
+ // If we found a waypoint point already at that time, then
+ // we need to abort
+ //synfig::info(_("old_begin: %s, old_end: %s"),old_begin.get_string().c_str(),old_end.get_string().c_str());
+ //synfig::info(_("new_begin: %s, new_end: %s"),new_begin.get_string().c_str(),new_end.get_string().c_str());
+ //throw Exception::BadTime(strprintf(_("Waypoint Conflict, old: %s, new: %s"),(*iter)->get_time().get_string().c_str(),new_time.get_string().c_str()));
+ }
+ catch(Exception::NotFound) { }
+ }
+
+ int ret(0);
+ while(!selected.empty())
+ {
+ if(selected.back()->get_time()!=old_2_new(selected.back()->get_time()))
+ {
+ Action::Handle action(Action::create("waypoint_set"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle::cast_static(value_node));
+
+ Waypoint waypoint(*selected.back());
+ waypoint.set_time(old_2_new(selected.back()->get_time()));
+
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ ret++;
+ }
+ selected.pop_back();
+ }
+ return ret;
+ }
+ return 0;
+}
+
+void
+Action::KeyframeSet::process_value_desc(const synfigapp::ValueDesc& value_desc)
+{
+ if(value_desc.is_value_node())
+ {
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ //if(guid_set.count(value_node->get_guid()))
+ // return;
+ //guid_set.insert(value_node->get_guid());
+
+ // If we are a dynamic list, then we need to update the ActivePoints
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ {
+ ValueNode_DynamicList::Handle value_node(ValueNode_DynamicList::Handle::cast_dynamic(value_node));
+ int i;
+ for(i=0;i<value_node->link_count();i++)
+ {
+ synfigapp::ValueDesc value_desc(value_node,i);
+ if(new_time>keyframe_prev && new_time<keyframe_next)
+ {
+ // In this circumstance, we need to adjust any
+ // activepoints between the previous and next
+ // keyframes
+ scale_activepoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time);
+ scale_activepoints(value_desc,old_time,keyframe_next,new_time,keyframe_next);
+ }
+ //else
+ {
+ Action::Handle action(ActivepointSetSmart::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
+
+ Activepoint activepoint;
+ try
+ {
+ activepoint=*value_node->list[i].find(old_time);
+ activepoint.set_time(new_time);
+ }
+ catch(...)
+ {
+ activepoint.set_time(new_time);
+ activepoint.set_state(value_node->list[i].status_at_time(old_time));
+ activepoint.set_priority(0);
+ }
+ action->set_param("activepoint",activepoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ }
+ else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
+ {
+ if(new_time>keyframe_prev && new_time<keyframe_next)
+ {
+ // In this circumstance, we need to adjust any
+ // waypoints between the previous and next
+ // keyframes
+ scale_waypoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time);
+ scale_waypoints(value_desc,old_time,keyframe_next,new_time,keyframe_next);
+ }
+ //else
+ {
+ ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_node));
+
+ Action::Handle action(WaypointSetSmart::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+
+ Waypoint waypoint;
+ try
+ {
+ waypoint=*value_node->find(old_time);
+ waypoint.set_time(new_time);
+ }
+ catch(...)
+ {
+ waypoint.set_time(new_time);
+ waypoint.set_value((*value_node)(old_time));
+ }
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ }
+}
+
+
+void
+Action::KeyframeSet::perform()
+{
+
+ old_time=get_canvas()->keyframe_list().find(keyframe)->get_time();
+ new_time=keyframe.get_time();
+
+ try { get_canvas()->keyframe_list().find(keyframe);}
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find the given keyframe"));
+ }
+
+ // Check for colisions
+ if(old_time!=new_time)
+ {
+ try {
+ get_canvas()->keyframe_list().find(new_time);
+ throw Error(_("Cannot change keyframe time because another keyframe already exists with that time."));
+ }
+ catch(Exception::NotFound) { }
+ }
+ try { keyframe_next=get_canvas()->keyframe_list().find_next(old_time)->get_time(); }
+ catch(...) { keyframe_next=Time::end(); }
+ try { keyframe_prev=get_canvas()->keyframe_list().find_prev(old_time)->get_time(); }
+ catch(...) { keyframe_prev=Time::begin(); }
+
+ old_keyframe=*get_canvas()->keyframe_list().find(keyframe);
+ *get_canvas()->keyframe_list().find(keyframe)=keyframe;
+
+ get_canvas()->keyframe_list().sync();
+
+ try{
+ Action::Super::perform();
+ } catch(...)
+ {
+ *get_canvas()->keyframe_list().find(old_keyframe)=old_keyframe;
+
+ get_canvas()->keyframe_list().sync();
+ throw;
+ }
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_changed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::KeyframeSet::undo()
+{
+ Action::Super::undo();
+
+ *get_canvas()->keyframe_list().find(old_keyframe)=old_keyframe;
+
+ get_canvas()->keyframe_list().sync();
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_changed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeset.h
+** \brief Template File
+**
+** $Id: keyframeset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMESET_H
+#define __SYNFIG_APP_ACTION_KEYFRAMESET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+#include <synfig/time.h>
+#include <synfig/guid.h>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeSet :
+ public Super
+{
+private:
+
+ synfig::Keyframe keyframe;
+ synfig::Keyframe old_keyframe;
+ synfig::Time old_time;
+ synfig::Time new_time;
+
+ synfig::Time keyframe_prev,keyframe_next;
+
+ std::set<synfig::GUID> guid_set;
+
+ void process_value_desc(const synfigapp::ValueDesc& value_desc);
+
+ int scale_activepoints(const synfigapp::ValueDesc& value_desc,const synfig::Time& old_begin,const synfig::Time& old_end,const synfig::Time& new_begin,const synfig::Time& new_end);
+ int scale_waypoints(const synfigapp::ValueDesc& value_desc,const synfig::Time& old_begin,const synfig::Time& old_end,const synfig::Time& new_begin,const synfig::Time& new_end);
+
+public:
+
+ KeyframeSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeset.cpp
+** \brief Template File
+**
+** $Id: keyframesetdelta.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframesetdelta.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+#include "activepointsetsmart.h"
+#include "waypointsetsmart.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeSetDelta);
+ACTION_SET_NAME(Action::KeyframeSetDelta,"keyframe_set_delta");
+ACTION_SET_LOCAL_NAME(Action::KeyframeSetDelta,"Set Keyframe Delta");
+ACTION_SET_TASK(Action::KeyframeSetDelta,"set");
+ACTION_SET_CATEGORY(Action::KeyframeSetDelta,Action::CATEGORY_KEYFRAME|Action::CATEGORY_HIDDEN);
+ACTION_SET_PRIORITY(Action::KeyframeSetDelta,0);
+ACTION_SET_VERSION(Action::KeyframeSetDelta,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeSetDelta,"$Id: keyframesetdelta.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeSetDelta::KeyframeSetDelta():
+ delta(0)
+{
+ keyframe.set_time(Time::end());
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::KeyframeSetDelta::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("Keyframe"))
+ );
+ ret.push_back(ParamDesc("delta",Param::TYPE_KEYFRAME)
+ .set_local_name(_("Delta"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeSetDelta::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::KeyframeSetDelta::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ keyframe=param.get_keyframe();
+ return true;
+ }
+ if(name=="delta" && param.get_type()==Param::TYPE_TIME)
+ {
+ delta=param.get_time();
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeSetDelta::is_ready()const
+{
+ if(keyframe.get_time()==Time::end())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeSetDelta::prepare()
+{
+ clear();
+ value_desc_list.clear();
+ get_canvas_interface()->find_important_value_descs(value_desc_list);
+
+
+ Time time(get_canvas()->keyframe_list().find(keyframe)->get_time());
+
+ std::vector<synfigapp::ValueDesc>::iterator iter;
+ DEBUGPOINT();
+ for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+ {
+ ValueDesc& value_desc(*iter);
+ ValueNode_Animated::Handle value_node(
+ ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
+ );
+
+ if(!value_node)
+ continue;
+
+ try{
+ value_node->find(time);
+ // if we got to this point, then we know that
+ // a waypoint already exists here and we don't
+ // need to add a new one.
+ continue;
+ }catch(...)
+ {
+ // Make sure there is something previous
+ try{
+ value_node->find_prev(time);
+ }catch(...)
+ {
+ continue;
+ }
+ }
+ Action::Handle action(Action::create("waypoint_set_smart"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle::cast_static(value_node));
+
+ action->set_param("time",time);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+}
+
+void
+Action::KeyframeSetDelta::perform()
+{
+ if(!delta)
+ return;
+ Action::Super::perform();
+
+// Time location(keyframe.get_time());
+ Time location(get_canvas()->keyframe_list().find(keyframe)->get_time());
+ Time delta(delta);
+
+ get_canvas()->keyframe_list().insert_time(location,delta);
+
+ std::vector<synfigapp::ValueDesc>::iterator iter;
+ for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+ {
+ ValueDesc& value_desc(*iter);
+ if(!value_desc.is_value_node())
+ continue;
+ ValueNode_Animated::Handle animated(
+ ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
+ );
+ if(animated)
+ {
+ animated->insert_time(location,delta);
+ continue;
+ }
+ ValueNode_DynamicList::Handle dyn_list(
+ ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_value_node())
+ );
+ if(dyn_list)
+ {
+ dyn_list->insert_time(location,delta);
+ continue;
+ }
+ }
+
+ // Signal that something has changed
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_changed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::KeyframeSetDelta::undo()
+{
+ if(!delta)
+ return;
+
+// Time location(keyframe.get_time());
+ Time location(get_canvas()->keyframe_list().find(keyframe)->get_time());
+ Time delta(-delta);
+
+ get_canvas()->keyframe_list().insert_time(location,delta);
+
+ std::vector<synfigapp::ValueDesc>::iterator iter;
+ for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+ {
+ ValueDesc& value_desc(*iter);
+ if(!value_desc.is_value_node())
+ continue;
+ ValueNode_Animated::Handle animated(
+ ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
+ );
+ if(animated)
+ {
+ animated->insert_time(location,delta);
+ continue;
+ }
+ ValueNode_DynamicList::Handle dyn_list(
+ ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_value_node())
+ );
+ if(dyn_list)
+ {
+ dyn_list->insert_time(location,delta);
+ continue;
+ }
+ }
+
+ Action::Super::undo();
+
+ // Signal that something has changed
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_keyframe_changed()(keyframe);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeset.h
+** \brief Template File
+**
+** $Id: keyframesetdelta.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMESETDELTA_H
+#define __SYNFIG_APP_ACTION_KEYFRAMESETDELTA_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+#include <synfig/time.h>
+#include <synfig/guid.h>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeSetDelta :
+ public Super
+{
+private:
+ synfig::Keyframe keyframe;
+ synfig::Time delta;
+
+ std::vector<synfigapp::ValueDesc> value_desc_list;
+
+ void process_value_desc(const synfigapp::ValueDesc& value_desc);
+
+ int scale_activepoints(const synfigapp::ValueDesc& value_desc,const synfig::Time& old_begin,const synfig::Time& old_end,const synfig::Time& new_begin,const synfig::Time& new_end);
+ int scale_waypoints(const synfigapp::ValueDesc& value_desc,const synfig::Time& old_begin,const synfig::Time& old_end,const synfig::Time& new_begin,const synfig::Time& new_end);
+
+public:
+
+ KeyframeSetDelta();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframeset.cpp
+** \brief Template File
+**
+** $Id: keyframewaypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "keyframewaypointset.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+#include "activepointsetsmart.h"
+#include "waypointsetsmart.h"
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::KeyframeWaypointSet);
+ACTION_SET_NAME(Action::KeyframeWaypointSet,"keyframe_waypoint_set");
+ACTION_SET_LOCAL_NAME(Action::KeyframeWaypointSet,"Set Waypoints at Keyframe");
+ACTION_SET_TASK(Action::KeyframeWaypointSet,"set");
+ACTION_SET_CATEGORY(Action::KeyframeWaypointSet,Action::CATEGORY_KEYFRAME);
+ACTION_SET_PRIORITY(Action::KeyframeWaypointSet,0);
+ACTION_SET_VERSION(Action::KeyframeWaypointSet,"0.0");
+ACTION_SET_CVS_ID(Action::KeyframeWaypointSet,"$Id: keyframewaypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::KeyframeWaypointSet::KeyframeWaypointSet()
+{
+ keyframe.set_time(Time::begin()-1);
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::KeyframeWaypointSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("keyframe",Param::TYPE_KEYFRAME)
+ .set_local_name(_("Keyframe"))
+ );
+
+ ret.push_back(ParamDesc("model",Param::TYPE_WAYPOINTMODEL)
+ .set_local_name(_("Waypoint Model"))
+ );
+
+ return ret;
+}
+
+bool
+Action::KeyframeWaypointSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::KeyframeWaypointSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
+ {
+ keyframe=param.get_keyframe();
+
+ return true;
+ }
+ if(name=="model" && param.get_type()==Param::TYPE_WAYPOINTMODEL)
+ {
+ waypoint_model=param.get_waypoint_model();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::KeyframeWaypointSet::is_ready()const
+{
+ if(keyframe.get_time()==(Time::begin()-1) || waypoint_model.is_trivial())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::KeyframeWaypointSet::prepare()
+{
+ clear();
+
+ try { get_canvas()->keyframe_list().find(keyframe);}
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find the given keyframe"));
+ }
+
+ {
+ std::vector<synfigapp::ValueDesc> value_desc_list;
+ get_canvas_interface()->find_important_value_descs(value_desc_list);
+ while(!value_desc_list.empty())
+ {
+ process_value_desc(value_desc_list.back());
+ value_desc_list.pop_back();
+ }
+ }
+}
+
+void
+Action::KeyframeWaypointSet::process_value_desc(const synfigapp::ValueDesc& value_desc)
+{
+ if(value_desc.is_value_node())
+ {
+ ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()));
+
+ if(value_node)
+ {
+ Action::Handle action(WaypointSetSmart::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+
+ Waypoint waypoint;
+ try
+ {
+ waypoint=*value_node->find(keyframe.get_time());
+ }
+ catch(...)
+ {
+ waypoint.set_time(keyframe.get_time());
+ waypoint.set_value((*value_node)(keyframe.get_time()));
+ }
+ waypoint.apply_model(waypoint_model);
+
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file keyframewaypointset.h
+** \brief Template File
+**
+** $Id: keyframewaypointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_KEYFRAMEWAYPOINTSET_H
+#define __SYNFIG_APP_ACTION_KEYFRAMESET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/keyframe.h>
+#include <synfig/waypoint.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class KeyframeWaypointSet :
+ public Super
+{
+private:
+
+ synfig::Keyframe keyframe;
+ synfig::Waypoint::Model waypoint_model;
+
+
+ void process_value_desc(const synfigapp::ValueDesc& value_desc);
+
+public:
+
+ KeyframeWaypointSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layeractivate.cpp
+** \brief Template File
+**
+** $Id: layeractivate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layeractivate.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+#define ACTION_INIT2(class) \
+ Action::Base* class::create() { return new class(); } \
+ synfig::String class::get_name()const { return name__; }
+
+ACTION_INIT2(Action::LayerActivate);
+ACTION_SET_NAME(Action::LayerActivate,"layer_activate");
+ACTION_SET_LOCAL_NAME(Action::LayerActivate,_("Activate Layer"));
+ACTION_SET_TASK(Action::LayerActivate,"activate");
+ACTION_SET_CATEGORY(Action::LayerActivate,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerActivate,0);
+ACTION_SET_VERSION(Action::LayerActivate,"0.0");
+ACTION_SET_CVS_ID(Action::LayerActivate,"$Id: layeractivate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerActivate::LayerActivate()
+{
+}
+
+synfig::String
+Action::LayerActivate::get_local_name()const
+{
+ if(!layer)
+ return _("Activate Layer");
+ String name;
+ if(layer->get_description().empty())
+ name=layer->get_local_name();
+ else
+ name=layer->get_description();
+
+ return (new_status?_("Activate "):_("Deactivate "))+name;
+}
+
+Action::ParamVocab
+Action::LayerActivate::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ );
+
+ ret.push_back(ParamDesc("new_status",Param::TYPE_BOOL)
+ .set_local_name(_("New Status"))
+ .set_desc(_("The new status of the layer"))
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerActivate::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerActivate::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="new_status" && param.get_type()==Param::TYPE_BOOL)
+ {
+ new_status=param.get_bool();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerActivate::is_ready()const
+{
+ if(!layer)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerActivate::perform()
+{
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ //if(get_canvas()->get_root()!=subcanvas->get_root())
+ // throw Error(_("This layer doesn't belong to this composition"));
+
+ old_status=layer->active();
+
+ // If we are changing the status to what it already is,
+ // the go ahead and return
+ if(new_status==old_status)
+ {
+ set_dirty(false);
+ return;
+ }
+ else
+ set_dirty();
+
+ if(new_status)
+ layer->enable();
+ else
+ layer->disable();
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_status_changed()(layer,new_status);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::LayerActivate::undo()
+{
+ // If we are changing the status to what it already is,
+ // the go ahead and return
+ if(new_status==old_status)
+ {
+ set_dirty(false);
+ return;
+ }
+ else
+ set_dirty();
+
+ // restore the old status
+ if(old_status)
+ layer->enable();
+ else
+ layer->disable();
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_status_changed()(layer,old_status);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layeractivate.h
+** \brief Template File
+**
+** $Id: layeractivate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERACTIVATE_H
+#define __SYNFIG_APP_ACTION_LAYERACTIVATE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerActivate :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ bool old_status;
+ bool new_status;
+
+public:
+
+ LayerActivate();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layeradd.cpp
+** \brief Template File
+**
+** $Id: layeradd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layeradd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerAdd);
+ACTION_SET_NAME(Action::LayerAdd,"layer_add");
+ACTION_SET_LOCAL_NAME(Action::LayerAdd,"Add Layer");
+ACTION_SET_TASK(Action::LayerAdd,"add");
+ACTION_SET_CATEGORY(Action::LayerAdd,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerAdd,0);
+ACTION_SET_VERSION(Action::LayerAdd,"0.0");
+ACTION_SET_CVS_ID(Action::LayerAdd,"$Id: layeradd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerAdd::LayerAdd()
+{
+}
+
+Action::ParamVocab
+Action::LayerAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("new",Param::TYPE_LAYER)
+ .set_local_name(_("New Layer"))
+ .set_desc(_("Layer to be added"))
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerAdd::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="new" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerAdd::is_ready()const
+{
+ if(!layer)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerAdd::perform()
+{
+ // Set the layer's canvas
+ layer->set_canvas(get_canvas());
+
+ // Push the layer onto the front of the canvas
+ get_canvas()->push_front(layer);
+
+ // Mark ourselves as dirty if necessary
+ //set_dirty(layer->active());
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_inserted()(layer,0);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::LayerAdd::undo()
+{
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(get_canvas()->begin(),get_canvas()->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // Remove the layer from the canvas
+ get_canvas()->erase(iter);
+
+ // Mark ourselves as dirty if necessary
+ //set_dirty(layer->active());
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_removed()(layer);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layeradd.h
+** \brief Template File
+**
+** $Id: layeradd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERADD_H
+#define __SYNFIG_APP_ACTION_LAYERADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+
+public:
+
+ LayerAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerduplicate.cpp
+** \brief Template File
+**
+** $Id: layerduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerduplicate.h"
+#include "layeradd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerDuplicate);
+ACTION_SET_NAME(Action::LayerDuplicate,"layer_duplicate");
+ACTION_SET_LOCAL_NAME(Action::LayerDuplicate,"Duplicate Layer");
+ACTION_SET_TASK(Action::LayerDuplicate,"duplicate");
+ACTION_SET_CATEGORY(Action::LayerDuplicate,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerDuplicate,0);
+ACTION_SET_VERSION(Action::LayerDuplicate,"0.0");
+ACTION_SET_CVS_ID(Action::LayerDuplicate,"$Id: layerduplicate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerDuplicate::LayerDuplicate()
+{
+}
+
+Action::ParamVocab
+Action::LayerDuplicate::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be duplicated"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerDuplicate::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerDuplicate::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layers.push_back(param.get_layer());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerDuplicate::is_ready()const
+{
+ if(layers.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerDuplicate::prepare()
+{
+ if(!first_time())
+ return;
+
+ std::list<synfig::Layer::Handle>::const_iterator iter;
+
+ for(iter=layers.begin();iter!=layers.end();++iter)
+ {
+ Layer::Handle layer(*iter);
+
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ throw Error(_("This layer doesn't belong to this canvas anymore"));
+
+ Layer::Handle new_layer(layer->clone(guid));
+
+ {
+ Action::Handle action(Action::create("layer_move"));
+
+ action->set_param("canvas",subcanvas);
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",new_layer);
+ action->set_param("new_index",layers.front()->get_depth());
+
+ add_action_front(action);
+ }
+ {
+ Action::Handle action(Action::create("layer_add"));
+
+ action->set_param("canvas",subcanvas);
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("new",new_layer);
+
+ add_action_front(action);
+ }
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerduplicate.h
+** \brief Template File
+**
+** $Id: layerduplicate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERDUPLICATE_H
+#define __SYNFIG_APP_ACTION_LAYERDUPLICATE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+#include <synfig/guid.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class LayerDuplicate :
+ public Super
+{
+private:
+
+ synfig::GUID guid;
+ std::list<synfig::Layer::Handle> layers;
+
+public:
+
+ LayerDuplicate();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerraise.cpp
+** \brief Template File
+**
+** $Id: layerencapsulate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerencapsulate.h"
+#include "layeradd.h"
+#include "layerremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerEncapsulate);
+ACTION_SET_NAME(Action::LayerEncapsulate,"layer_encapsulate");
+ACTION_SET_LOCAL_NAME(Action::LayerEncapsulate,"Encapsulate");
+ACTION_SET_TASK(Action::LayerEncapsulate,"encapsulate");
+ACTION_SET_CATEGORY(Action::LayerEncapsulate,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerEncapsulate,0);
+ACTION_SET_VERSION(Action::LayerEncapsulate,"0.0");
+ACTION_SET_CVS_ID(Action::LayerEncapsulate,"$Id: layerencapsulate.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerEncapsulate::LayerEncapsulate()
+{
+}
+
+Action::ParamVocab
+Action::LayerEncapsulate::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be encapsulated"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerEncapsulate::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerEncapsulate::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layers.push_back(param.get_layer());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerEncapsulate::is_ready()const
+{
+ if(layers.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+int
+Action::LayerEncapsulate::lowest_depth()const
+{
+ std::list<synfig::Layer::Handle>::const_iterator iter;
+ int lowest_depth(0x7fffffff);
+
+ for(iter=layers.begin();iter!=layers.end();++iter)
+ {
+ int depth((*iter)->get_depth());
+ if(depth<lowest_depth)
+ lowest_depth=depth;
+ }
+ if(lowest_depth==0x7fffffff)
+ return 0;
+ return lowest_depth;
+}
+
+void
+Action::LayerEncapsulate::prepare()
+{
+
+ if(!first_time())
+ return;
+
+ if(layers.empty())
+ throw Error("No layers to encapsulate");
+
+ // First create the new canvas and layer
+ if(!child_canvas)
+ child_canvas=Canvas::create_inline(get_canvas());
+
+ Layer::Handle new_layer(Layer::create("PasteCanvas"));
+
+ new_layer->set_param("canvas",child_canvas);
+
+ int target_depth(lowest_depth());
+
+ // Add the layer
+ {
+ Action::Handle action(LayerAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("new",new_layer);
+
+ add_action(action);
+ }
+
+ // Move the layer
+ {
+ Action::Handle action(Action::create("layer_move"));
+
+ assert(action);
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",new_layer);
+ action->set_param("new_index",target_depth);
+
+ add_action(action);
+ }
+
+ std::list<synfig::Layer::Handle>::reverse_iterator iter;
+
+ for(iter=layers.rbegin();iter!=layers.rend();++iter)
+ {
+ Layer::Handle layer(*iter);
+
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ if(!subcanvas)
+ throw Error(_("This layer doesn't have a parent canvas"));
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ throw Error(_("This layer doesn't belong to this canvas anymore"));
+
+ if(get_canvas()!=subcanvas)
+ throw Error(_("get_canvas()!=subcanvas"));
+
+ // Remove the layer from the old canvas
+ {
+ Action::Handle action(LayerRemove::create());
+
+ action->set_param("canvas",subcanvas);
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",layer);
+
+ add_action(action);
+ }
+ // Add the layer to the new canvas
+ {
+ Action::Handle action(LayerAdd::create());
+
+ action->set_param("canvas",child_canvas);
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("new",layer);
+
+ add_action(action);
+ }
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerencapsulate.h
+** \brief Template File
+**
+** $Id: layerencapsulate.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERENCAPSULATE_H
+#define __SYNFIG_APP_ACTION_LAYERENCAPSULATE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+#include <synfig/canvas.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class LayerEncapsulate :
+ public Super
+{
+private:
+ synfig::Canvas::Handle child_canvas;
+ std::list<synfig::Layer::Handle> layers;
+
+ int lowest_depth()const;
+
+public:
+
+ LayerEncapsulate();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerlower.cpp
+** \brief Template File
+**
+** $Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerlower.h"
+#include "layermove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerLower);
+ACTION_SET_NAME(Action::LayerLower,"layer_lower");
+ACTION_SET_LOCAL_NAME(Action::LayerLower,"Lower Layer");
+ACTION_SET_TASK(Action::LayerLower,"lower");
+ACTION_SET_CATEGORY(Action::LayerLower,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerLower,10);
+ACTION_SET_VERSION(Action::LayerLower,"0.0");
+ACTION_SET_CVS_ID(Action::LayerLower,"$Id: layerlower.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerLower::LayerLower()
+{
+}
+
+Action::ParamVocab
+Action::LayerLower::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be lowered"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerLower::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+
+ Layer::Handle layer(x.find("layer")->second.get_layer());
+ //synfig::info("layer->get_depth()= %d ; layer->get_canvas()->size()=%d ;",layer->get_depth(),layer->get_canvas()->size());
+ if(layer->get_depth()+1>=layer->get_canvas()->size())
+ return false;
+ return true;
+}
+
+bool
+Action::LayerLower::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layers.push_back(param.get_layer());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerLower::is_ready()const
+{
+ if(layers.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerLower::prepare()
+{
+ std::list<synfig::Layer::Handle>::const_iterator iter;
+
+ clear();
+
+ for(iter=layers.begin();iter!=layers.end();++iter)
+ {
+ Layer::Handle layer(*iter);
+
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ // throw Error(_("This layer doesn't belong to this canvas anymore"));
+
+ int new_index=iter-subcanvas->begin();
+
+ new_index++;
+
+ // If this lowers the layer past the bottom then don't bother
+ if(new_index==subcanvas->size())
+ continue;
+
+ Action::Handle layer_move(LayerMove::create());
+
+ layer_move->set_param("canvas",get_canvas());
+ layer_move->set_param("canvas_interface",get_canvas_interface());
+ layer_move->set_param("layer",layer);
+ layer_move->set_param("new_index",new_index);
+
+ add_action_front(layer_move);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerlower.h
+** \brief Template File
+**
+** $Id: layerlower.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERLOWER_H
+#define __SYNFIG_APP_ACTION_LAYERLOWER_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class LayerLower :
+ public Super
+{
+private:
+
+ std::list<synfig::Layer::Handle> layers;
+
+public:
+
+ LayerLower();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layermove.cpp
+** \brief Template File
+**
+** $Id: layermove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layermove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerMove);
+ACTION_SET_NAME(Action::LayerMove,"layer_move");
+ACTION_SET_LOCAL_NAME(Action::LayerMove,_("Move Layer"));
+ACTION_SET_TASK(Action::LayerMove,"move");
+ACTION_SET_CATEGORY(Action::LayerMove,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerMove,0);
+ACTION_SET_VERSION(Action::LayerMove,"0.0");
+ACTION_SET_CVS_ID(Action::LayerMove,"$Id: layermove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+static const int nindex=-1;
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerMove::LayerMove():
+ new_index(0xdeadbeef)
+{
+}
+
+Action::ParamVocab
+Action::LayerMove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be moved"))
+ );
+
+ ret.push_back(ParamDesc("new_index",Param::TYPE_INTEGER)
+ .set_local_name(_("New Index"))
+ .set_desc(_("Where the layer is to be moved to"))
+ );
+
+ ret.push_back(ParamDesc("dest_canvas",Param::TYPE_CANVAS)
+ .set_local_name(_("Destination Canvas"))
+ .set_desc(_("The canvas the layer is to be moved to"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerMove::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerMove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="new_index" && param.get_type()==Param::TYPE_INTEGER)
+ {
+ new_index=param.get_integer();
+
+ return true;
+ }
+
+ if(name=="dest_canvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ dest_canvas=param.get_canvas();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerMove::is_ready()const
+{
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+ if(!layer || (unsigned)new_index==0xdeadbeef)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerMove::perform()
+{
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+
+ Canvas::Handle subcanvas(layer->get_canvas());
+ src_canvas=subcanvas;
+ if(!dest_canvas)
+ dest_canvas=subcanvas;
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(src_canvas->begin(),src_canvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ if(get_canvas()->get_root()!=dest_canvas->get_root() || get_canvas()->get_root()!=src_canvas->get_root())
+ throw Error(_("You cannot directly move layers across compositions"));
+
+ old_index=iter-src_canvas->begin();
+ int depth;
+
+ if(new_index<0)
+ depth=dest_canvas->size()+new_index+1;
+ else
+ depth=new_index;
+
+ set_dirty(layer->active());
+
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+
+ // If we were to move it to where it is
+ if(old_index==depth && src_canvas==dest_canvas)
+ return;
+
+ if(depth>dest_canvas->size())
+ depth=dest_canvas->size();
+ if(depth<0)
+ depth=0;
+
+ src_canvas->erase(iter);
+
+ dest_canvas->insert(dest_canvas->begin()+depth,layer);
+ layer->set_canvas(dest_canvas);
+
+ layer->changed();
+ dest_canvas->changed(); if(dest_canvas!=src_canvas) src_canvas->changed();
+
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+
+ if(get_canvas_interface())
+ {
+ if(src_canvas==dest_canvas)
+ {
+ if(new_index==old_index-1) // Raise
+ get_canvas_interface()->signal_layer_raised()(layer);
+ else if(new_index==old_index+1) // Lower
+ get_canvas_interface()->signal_layer_lowered()(layer);
+ else // Moved
+ {
+ get_canvas_interface()->signal_layer_moved()(layer,depth,dest_canvas);
+ }
+ }
+ else
+ {
+ get_canvas_interface()->signal_layer_moved()(layer,depth,dest_canvas);
+ }
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+ synfig::info(__FILE__":%d: layer->count()=%d",__LINE__,layer.count());
+}
+
+void
+Action::LayerMove::undo()
+{
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(dest_canvas->begin(),dest_canvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer || (get_canvas()!=dest_canvas && !dest_canvas->is_inline()))
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // If we were to move it to where it is
+ if(old_index==new_index && src_canvas==dest_canvas)
+ return;
+
+ // Mark ourselves as dirty if necessary
+ set_dirty(layer->active());
+
+ dest_canvas->erase(iter);
+
+ src_canvas->insert(src_canvas->begin()+old_index,layer);
+ layer->set_canvas(src_canvas);
+
+ layer->changed();
+ dest_canvas->changed(); if(dest_canvas!=src_canvas) src_canvas->changed();
+
+ // Execute any signals
+ if(get_canvas_interface())
+ {
+ if(src_canvas==dest_canvas)
+ {
+ if(new_index==old_index+1) // Raise
+ get_canvas_interface()->signal_layer_raised()(layer);
+ else if(new_index==old_index-1) // Lower
+ get_canvas_interface()->signal_layer_lowered()(layer);
+ else // Moved
+ {
+ get_canvas_interface()->signal_layer_moved()(layer,old_index,src_canvas);
+ }
+ }
+ else
+ {
+ get_canvas_interface()->signal_layer_moved()(layer,old_index,src_canvas);
+ //get_canvas_interface()->signal_layer_removed()(layer);
+ //get_canvas_interface()->signal_layer_inserted()(layer,old_index);
+ }
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layermove.h
+** \brief Template File
+**
+** $Id: layermove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERMOVE_H
+#define __SYNFIG_APP_ACTION_LAYERMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerMove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ int old_index;
+ int new_index;
+
+ synfig::Canvas::Handle src_canvas;
+ synfig::Canvas::Handle dest_canvas;
+
+public:
+
+ LayerMove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamconnect.cpp
+** \brief Template File
+**
+** $Id: layerparamconnect.cpp,v 1.2 2005/01/16 19:55:57 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerParamConnect);
+ACTION_SET_NAME(Action::LayerParamConnect,"layer_param_connect");
+ACTION_SET_LOCAL_NAME(Action::LayerParamConnect,_("Connect Layer Parameter"));
+ACTION_SET_TASK(Action::LayerParamConnect,"connect");
+ACTION_SET_CATEGORY(Action::LayerParamConnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::LayerParamConnect,0);
+ACTION_SET_VERSION(Action::LayerParamConnect,"0.0");
+ACTION_SET_CVS_ID(Action::LayerParamConnect,"$Id: layerparamconnect.cpp,v 1.2 2005/01/16 19:55:57 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerParamConnect::LayerParamConnect()
+{
+}
+
+Action::ParamVocab
+Action::LayerParamConnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ );
+
+ ret.push_back(ParamDesc("param",Param::TYPE_STRING)
+ .set_local_name(_("Param"))
+ );
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode"))
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerParamConnect::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerParamConnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(name=="param" && param.get_type()==Param::TYPE_STRING)
+ {
+ param_name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerParamConnect::is_ready()const
+{
+ if(!layer)
+ synfig::warning("Action::LayerParamConnect: Missing \"layer\"");
+ if(!value_node)
+ synfig::warning("Action::LayerParamConnect: Missing \"value_node\"");
+ if(param_name.empty())
+ synfig::warning("Action::LayerParamConnect: Missing \"param\"");
+
+ if(!layer || !value_node || param_name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerParamConnect::perform()
+{
+ // See if the parameter is dynamic
+ if(layer->dynamic_param_list().count(param_name))
+ old_value_node=layer->dynamic_param_list().find(param_name)->second;
+ else
+ {
+ old_value_node=0;
+ }
+
+ old_value=layer->get_param(param_name);
+ if(!old_value.is_valid())
+ throw Error(_("Layer did not recognise parameter name"));
+
+ if(!layer->set_param(param_name,(*value_node)(0)))
+ throw Error(_("Bad connection"));
+
+ layer->connect_dynamic_param(param_name,value_node);
+
+ layer->changed();
+ value_node->changed();
+/* if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ //get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+*/
+}
+
+void
+Action::LayerParamConnect::undo()
+{
+ if(old_value_node)
+ layer->connect_dynamic_param(param_name,old_value_node);
+ else
+ {
+ layer->disconnect_dynamic_param(param_name);
+ layer->set_param(param_name,old_value);
+ }
+
+ layer->changed();
+ if(old_value_node)
+ old_value_node->changed();
+ /*
+ if(layer->active())
+ set_dirty(true);
+ else
+ set_dirty(false);
+ */
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ //if(old_value_node)get_canvas_interface()->signal_value_node_changed()(old_value_node);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamconnect.h
+** \brief Template File
+**
+** $Id: layerparamconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERPARAMCONNECT_H
+#define __SYNFIG_APP_ACTION_LAYERPARAMCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerParamConnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ synfig::String param_name;
+ synfig::ValueNode::Handle value_node;
+ synfig::ValueNode::Handle old_value_node;
+ synfig::ValueBase old_value;
+
+
+public:
+
+ LayerParamConnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamdisconnect.cpp
+** \brief Template File
+**
+** $Id: layerparamdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamdisconnect.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerParamDisconnect);
+ACTION_SET_NAME(Action::LayerParamDisconnect,"layer_param_disconnect");
+ACTION_SET_LOCAL_NAME(Action::LayerParamDisconnect,_("Disconnect Layer Parameter"));
+ACTION_SET_TASK(Action::LayerParamDisconnect,"disconnect");
+ACTION_SET_CATEGORY(Action::LayerParamDisconnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::LayerParamDisconnect,0);
+ACTION_SET_VERSION(Action::LayerParamDisconnect,"0.0");
+ACTION_SET_CVS_ID(Action::LayerParamDisconnect,"$Id: layerparamdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerParamDisconnect::LayerParamDisconnect():
+ time(0)
+{
+
+}
+
+Action::ParamVocab
+Action::LayerParamDisconnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ );
+
+ ret.push_back(ParamDesc("param",Param::TYPE_STRING)
+ .set_local_name(_("Param"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_STRING)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerParamDisconnect::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerParamDisconnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="param" && param.get_type()==Param::TYPE_STRING)
+ {
+ param_name=param.get_string();
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerParamDisconnect::is_ready()const
+{
+ if(!layer || param_name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerParamDisconnect::perform()
+{
+ if(!layer->dynamic_param_list().count(param_name))
+ throw Error(_("Layer Parameter is not connected to anything"));
+
+ old_value_node=layer->dynamic_param_list().find(param_name)->second;
+ layer->disconnect_dynamic_param(param_name);
+
+ if(new_value_node || ValueNode_DynamicList::Handle::cast_dynamic(old_value_node))
+ {
+ if(!new_value_node)
+ new_value_node=old_value_node.clone();
+ layer->connect_dynamic_param(param_name,new_value_node);
+ }
+ else
+ layer->set_param(param_name,(*old_value_node)(time));
+
+ layer->changed();
+ old_value_node->changed();
+
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ }
+}
+
+void
+Action::LayerParamDisconnect::undo()
+{
+ layer->connect_dynamic_param(param_name,old_value_node);
+
+/* if(layer->active() && get_canvas()->get_time()!=time)
+ set_dirty(true);
+ else
+ set_dirty(false);
+*/
+ layer->changed();
+ old_value_node->changed();
+
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamdisconnect.h
+** \brief Template File
+**
+** $Id: layerparamdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERPARAMDISCONNECT_H
+#define __SYNFIG_APP_ACTION_LAYERPARAMDISCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerParamDisconnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ synfig::String param_name;
+ synfig::ValueNode::Handle old_value_node;
+ synfig::ValueNode::Handle new_value_node;
+ synfig::Time time;
+
+public:
+
+ LayerParamDisconnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamset.cpp
+** \brief Template File
+**
+** $Id: layerparamset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerParamSet);
+ACTION_SET_NAME(Action::LayerParamSet,"layer_param_set");
+ACTION_SET_LOCAL_NAME(Action::LayerParamSet,_("Set Layer Parameter"));
+ACTION_SET_TASK(Action::LayerParamSet,"set");
+ACTION_SET_CATEGORY(Action::LayerParamSet,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerParamSet,0);
+ACTION_SET_VERSION(Action::LayerParamSet,"0.0");
+ACTION_SET_CVS_ID(Action::LayerParamSet,"$Id: layerparamset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerParamSet::LayerParamSet()
+{
+}
+
+Action::ParamVocab
+Action::LayerParamSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ );
+
+ ret.push_back(ParamDesc("param",Param::TYPE_STRING)
+ .set_local_name(_("Param"))
+ );
+
+ ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
+ .set_local_name(_("ValueBase"))
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerParamSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerParamSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
+ {
+ new_value=param.get_value();
+
+ return true;
+ }
+
+ if(name=="param" && param.get_type()==Param::TYPE_STRING)
+ {
+ param_name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerParamSet::is_ready()const
+{
+ if(!layer || !new_value.is_valid() || param_name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerParamSet::perform()
+{
+ // See if the parameter is dynamic
+ if(layer->dynamic_param_list().count(param_name))
+ throw Error(_("ValueNode attached to Parameter."));
+
+ old_value=layer->get_param(param_name);
+
+ if(!layer->set_param(param_name,new_value))
+ throw Error(_("Layer did not accept parameter."));
+
+ /*if(layer->active())
+ set_dirty(true);
+ else
+ set_dirty(false);
+ */
+ layer->changed();
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ }
+}
+
+void
+Action::LayerParamSet::undo()
+{
+ if(!layer->set_param(param_name,old_value))
+ throw Error(_("Layer did not accept parameter."));
+
+ /*
+ if(layer->active())
+ set_dirty(true);
+ else
+ set_dirty(false);
+ */
+
+ layer->changed();
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerparamset.h
+** \brief Template File
+**
+** $Id: layerparamset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERPARAMSET_H
+#define __SYNFIG_APP_ACTION_LAYERPARAMSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerParamSet :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ synfig::String param_name;
+ synfig::ValueBase new_value;
+ synfig::ValueBase old_value;
+
+
+public:
+
+ LayerParamSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerraise.cpp
+** \brief Template File
+**
+** $Id: layerraise.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerraise.h"
+#include "layermove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerRaise);
+ACTION_SET_NAME(Action::LayerRaise,"layer_raise");
+ACTION_SET_LOCAL_NAME(Action::LayerRaise,"Raise Layer");
+ACTION_SET_TASK(Action::LayerRaise,"raise");
+ACTION_SET_CATEGORY(Action::LayerRaise,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerRaise,9);
+ACTION_SET_VERSION(Action::LayerRaise,"0.0");
+ACTION_SET_CVS_ID(Action::LayerRaise,"$Id: layerraise.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerRaise::LayerRaise()
+{
+}
+
+Action::ParamVocab
+Action::LayerRaise::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be raised"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerRaise::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+ if(x.find("layer")->second.get_layer()->get_depth()==0)
+ return false;
+ return true;
+}
+
+bool
+Action::LayerRaise::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layers.push_back(param.get_layer());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerRaise::is_ready()const
+{
+ if(layers.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerRaise::prepare()
+{
+ std::list<synfig::Layer::Handle>::reverse_iterator iter;
+
+ clear();
+
+ for(iter=layers.rbegin();!(iter==layers.rend());++iter)
+ {
+ Layer::Handle layer(*iter);
+
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter!=layer)
+ throw Error(_("This layer doesn't exist anymore."));
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ //if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ // throw Error(_("This layer doesn't belong to this canvas anymore"));
+
+ int new_index=iter-subcanvas->begin();
+
+ if(new_index==0)
+ continue;
+
+ new_index--;
+
+ Action::Handle layer_move(LayerMove::create());
+
+ layer_move->set_param("canvas",get_canvas());
+ layer_move->set_param("canvas_interface",get_canvas_interface());
+ layer_move->set_param("layer",layer);
+ layer_move->set_param("new_index",new_index);
+
+ add_action_front(layer_move);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layerraise.h
+** \brief Template File
+**
+** $Id: layerraise.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERRAISE_H
+#define __SYNFIG_APP_ACTION_LAYERRAISE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class LayerRaise :
+ public Super
+{
+private:
+
+ std::list<synfig::Layer::Handle> layers;
+
+public:
+
+ LayerRaise();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.cpp
+** \brief Template File
+**
+** $Id: layerremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerRemove);
+ACTION_SET_NAME(Action::LayerRemove,"layer_remove");
+ACTION_SET_LOCAL_NAME(Action::LayerRemove,"Remove Layer");
+ACTION_SET_TASK(Action::LayerRemove,"remove");
+ACTION_SET_CATEGORY(Action::LayerRemove,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerRemove,0);
+ACTION_SET_VERSION(Action::LayerRemove,"0.0");
+ACTION_SET_CVS_ID(Action::LayerRemove,"$Id: layerremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerRemove::LayerRemove()
+{
+}
+
+Action::ParamVocab
+Action::LayerRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be deleted"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerRemove::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ std::pair<synfig::Layer::Handle,int> layer_pair;
+ layer_pair.first=param.get_layer();
+ layer_list.push_back(layer_pair);
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerRemove::is_ready()const
+{
+ if(layer_list.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerRemove::perform()
+{
+ std::list<std::pair<synfig::Layer::Handle,int> >::iterator iter;
+ for(iter=layer_list.begin();iter!=layer_list.end();++iter)
+ {
+ Layer::Handle layer(iter->first);
+// int& depth(iter->second);
+ Canvas::Handle subcanvas(layer->get_canvas());
+
+ // Find the iterator for the layer
+ Canvas::iterator iter2=find(subcanvas->begin(),subcanvas->end(),layer);
+
+ // If we couldn't find the layer in the canvas, then bail
+ if(*iter2!=layer)
+ {
+ /*! \fixme We should really undo all prior removals
+ ** before we go throwing shit around */
+ throw Error(_("This layer doesn't exist anymore."));
+ }
+
+ // If the subcanvas isn't the same as the canvas,
+ // then it had better be an inline canvas. If not,
+ // bail
+ if(get_canvas()!=subcanvas && !subcanvas->is_inline())
+ {
+ /*! \fixme We should really undo all prior removals
+ ** before we go throwing shit around */
+ throw Error(_("This layer doesn't belong to this canvas anymore"));
+ }
+
+ set_canvas(subcanvas);
+
+ // Calculate the depth that the layer was at (For the undo)
+ iter->second=layer->get_depth();
+
+ // Mark ourselves as dirty if necessary
+ set_dirty(layer->active());
+
+ // Remove the layer from the canvas
+ subcanvas->erase(iter2);
+
+ // Signal that a layer has been removed
+ if(get_canvas_interface())
+ get_canvas_interface()->signal_layer_removed()(layer);
+ }
+}
+
+void
+Action::LayerRemove::undo()
+{
+ std::list<std::pair<synfig::Layer::Handle,int> >::reverse_iterator iter;
+ for(iter=layer_list.rbegin();iter!=layer_list.rend();++iter)
+ {
+ Layer::Handle layer(iter->first);
+ int& depth(iter->second);
+
+ // Set the layer's canvas
+ layer->set_canvas(get_canvas());
+
+ // Make sure that the depth is valid
+ if(get_canvas()->size()<depth)
+ depth=get_canvas()->size();
+
+ // Mark ourselves as dirty if necessary
+ set_dirty(layer->active());
+
+ // Insert the layer into the canvas at the desired depth
+ get_canvas()->insert(get_canvas()->begin()+depth,layer);
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ get_canvas_interface()->signal_layer_inserted()(layer,depth);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file action_layerremove.h
+** \brief Template File
+**
+** $Id: layerremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERREMOVE_H
+#define __SYNFIG_APP_ACTION_LAYERREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ std::list<std::pair<synfig::Layer::Handle,int> > layer_list;
+
+ //synfig::Layer::Handle layer;
+ //int depth;
+
+public:
+
+ LayerRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layersetdesc.cpp
+** \brief Template File
+**
+** $Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layersetdesc.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerSetDesc);
+ACTION_SET_NAME(Action::LayerSetDesc,"layer_set_desc");
+ACTION_SET_LOCAL_NAME(Action::LayerSetDesc,_("Set Layer Description"));
+ACTION_SET_TASK(Action::LayerSetDesc,"set_desc");
+ACTION_SET_CATEGORY(Action::LayerSetDesc,Action::CATEGORY_LAYER);
+ACTION_SET_PRIORITY(Action::LayerSetDesc,0);
+ACTION_SET_VERSION(Action::LayerSetDesc,"0.0");
+ACTION_SET_CVS_ID(Action::LayerSetDesc,"$Id: layersetdesc.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+static const int nindex=-1;
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerSetDesc::LayerSetDesc()
+{
+}
+
+Action::ParamVocab
+Action::LayerSetDesc::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("layer",Param::TYPE_LAYER)
+ .set_local_name(_("Layer"))
+ .set_desc(_("Layer to be moved"))
+ );
+
+ ret.push_back(ParamDesc("new_description",Param::TYPE_STRING)
+ .set_local_name(_("New Description"))
+ .set_local_name(_("Enter a new description for this layer"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::LayerSetDesc::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::LayerSetDesc::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ layer=param.get_layer();
+
+ return true;
+ }
+
+ if(name=="new_description" && param.get_type()==Param::TYPE_STRING)
+ {
+ new_description=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerSetDesc::is_ready()const
+{
+ if(!layer)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerSetDesc::perform()
+{
+ old_description=layer->get_description();
+ layer->set_description(new_description);
+ set_dirty(false);
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_new_description()(layer,new_description);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::LayerSetDesc::undo()
+{
+ layer->set_description(old_description);
+ set_dirty(false);
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_layer_new_description()(layer,old_description);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file layersetdesc.h
+** \brief Template File
+**
+** $Id: layersetdesc.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERSETDSEC_H
+#define __SYNFIG_APP_ACTION_LAYERSETDSEC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerSetDesc :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Layer::Handle layer;
+ synfig::String old_description;
+ synfig::String new_description;
+
+public:
+
+ LayerSetDesc();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointscopy.cpp
+** \brief Copy the Time Points File
+**
+** $Id: timepointscopy.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "timepointscopy.h"
+#include <synfig/layer_pastecanvas.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+
+#include "activepointsimpleadd.h"
+#include "waypointsimpleadd.h"
+#include <synfigapp/timegather.h>
+
+#include <typeinfo>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::TimepointsCopy);
+ACTION_SET_NAME(Action::TimepointsCopy,"timepoint_copy");
+ACTION_SET_LOCAL_NAME(Action::TimepointsCopy,"Copy Time Points");
+ACTION_SET_TASK(Action::TimepointsCopy,"copy");
+ACTION_SET_CATEGORY(Action::TimepointsCopy,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::TimepointsCopy,0);
+ACTION_SET_VERSION(Action::TimepointsCopy,"0.0");
+ACTION_SET_CVS_ID(Action::TimepointsCopy,"$Id: timepointscopy.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::TimepointsCopy::TimepointsCopy()
+{
+ timedelta = 0;
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::TimepointsCopy::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
+ .set_local_name(_("New Selected Layer"))
+ .set_desc(_("A layer to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
+ .set_local_name(_("New Selected Canvas"))
+ .set_desc(_("A canvas to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("New Selected ValueBase"))
+ .set_desc(_("A valuenode's description to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
+ .set_local_name(_("New Selected Time Point"))
+ .set_desc(_("A time point to add to our selected list"))
+ .set_supports_multiple()
+ );
+
+ ret.push_back(ParamDesc("deltatime",Param::TYPE_TIME)
+ .set_local_name(_("Time adjustment"))
+ .set_desc(_("The amount of time to adjust all the selected points"))
+ );
+
+ return ret;
+}
+
+bool
+Action::TimepointsCopy::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+
+ if( x.find("addlayer") == x.end() &&
+ x.find("addcanvas") == x.end() &&
+ x.find("addvaluedesc") == x.end())
+ return false;
+ return true;
+}
+
+bool
+Action::TimepointsCopy::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ //add a layer to the list
+ sel_layers.push_back(param.get_layer());
+ //synfig::info("action got layer");
+
+ return true;
+ }
+
+ if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ //add a layer to the list
+ sel_canvases.push_back(param.get_canvas());
+ //synfig::info("action got canvas");
+
+ return true;
+ }
+
+ if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ //add a layer to the list
+ sel_values.push_back(param.get_value_desc());
+ //synfig::info("action got valuedesc");
+
+ return true;
+ }
+
+ if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
+ {
+ //add a layer to the list
+ sel_times.insert(param.get_time());
+ //synfig::info("action got time");
+
+ return true;
+ }
+
+ if(name=="deltatime" && param.get_type()==Param::TYPE_TIME)
+ {
+ timedelta = param.get_time();
+ //synfig::info("action got time to move");
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::TimepointsCopy::is_ready()const
+{
+ if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::TimepointsCopy::prepare()
+{
+ clear();
+
+ //synfig::info("Preparing TimepointsCopy by %f secs",(float)timemove);
+
+ if(sel_times.empty()) return;
+
+ //all our lists should be set correctly...
+
+ //build our sub-action list
+ // and yes we do need to store it temporarily so we don't duplicate
+ // an operation on a specific valuenode, etc....
+ timepoints_ref match;
+
+ Time fps = get_canvas()->rend_desc().get_frame_rate();
+
+ //std::vector<synfig::Layer::Handle>
+ //synfig::info("Layers %d", sel_layers.size());
+ {
+ std::vector<synfig::Layer::Handle>::iterator i = sel_layers.begin(),
+ end = sel_layers.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a layer");
+ recurse_layer(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfig::Canvas::Handle> sel_canvases;
+ //synfig::info("Canvases %d", sel_canvases.size());
+ {
+ std::vector<synfig::Canvas::Handle>::iterator i = sel_canvases.begin(),
+ end = sel_canvases.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a canvas");
+ recurse_canvas(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfigapp::ValueDesc>
+ //synfig::info("ValueBasedescs %d", sel_values.size());
+ {
+ std::vector<synfigapp::ValueDesc>::iterator i = sel_values.begin(),
+ end = sel_values.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a valuedesc");
+ recurse_valuedesc(*i,sel_times,match);
+ }
+ }
+
+ //synfig::info("built list of waypoints/activepoints to modify");
+ //synfig::info("\t There are %d waypoint sets and %d activepointsets",
+ // match.waypointbiglist.size(), match.actpointbiglist.size());
+ //process the hell out of em...
+ {
+ //must build from both lists
+ timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
+ end = match.waypointbiglist.end();
+ for(; i != end; ++i)
+ {
+ //iterate through each waypoint for this specific valuenode
+ std::set<synfig::Waypoint>::const_iterator j = i->waypoints.begin(),
+ end = i->waypoints.end();
+ for(; j != end; ++j)
+ {
+ Action::Handle action(WaypointSimpleAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(i->val));
+
+ //synfig::info("add waypoint mod...");
+ //NOTE: We may want to store the old time for undoing the action...
+ Waypoint neww;
+ Waypoint w = *j;
+ w.set_time((w.get_time() + timedelta).round(fps));
+ w.mimic(neww); //make sure the new waypoint has a new id
+
+ action->set_param("waypoint",w);
+
+ //run the action now that we've added everything
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ }
+ {
+ //must build from both lists
+ timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
+ end = match.actpointbiglist.end();
+ for(; i != end; ++i)
+ {
+ //iterate through each activepoint for this specific valuenode
+ std::set<synfig::Activepoint>::const_iterator j = i->activepoints.begin(),
+ jend = i->activepoints.end();
+ for(; j != jend; ++j)
+ {
+ Action::Handle action(ActivepointSimpleAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",i->val);
+
+ //NOTE: We may want to store the old time for undoing the action...
+ Activepoint newa;
+ Activepoint a = *j;
+ a.set_time((a.get_time() + timedelta).round(fps));
+ a.mimic(newa); //make sure the new activepoint has a new id
+
+ action->set_param("activepoint",a);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ {
+ throw Error(Error::TYPE_NOTREADY);
+ }
+
+ add_action_front(action);
+ }
+ }
+ }
+}
+
+void
+Action::TimepointsCopy::perform()
+{
+ Action::Super::perform();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointscopy.h
+** \brief Copy the Time Points Header
+**
+** $Id: timepointscopy.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_TIMEPOINTSCOPY_H
+#define __SYNFIG_APP_ACTION_TIMEPOINTSCOPY_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/time.h>
+#include <synfig/layer.h>
+#include <synfig/canvas.h>
+#include <synfigapp/value_desc.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class TimepointsCopy :
+ public Super
+{
+private:
+
+ //process all the value descriptions that are selected (or are in subselections)
+ std::vector<synfig::Layer::Handle> sel_layers;
+ std::vector<synfig::Canvas::Handle> sel_canvases;
+ std::vector<synfigapp::ValueDesc> sel_values;
+ std::set<synfig::Time> sel_times;
+
+ synfig::Time timedelta;
+
+public:
+
+ TimepointsCopy();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointsdelete.cpp
+** \brief Delete the Time Points File
+**
+** $Id: timepointsdelete.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "timepointsdelete.h"
+#include <synfig/layer_pastecanvas.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+
+#include "activepointremove.h"
+#include "waypointremove.h"
+#include <synfigapp/timegather.h>
+
+#include <typeinfo>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::TimepointsDelete);
+ACTION_SET_NAME(Action::TimepointsDelete,"timepoint_delete");
+ACTION_SET_LOCAL_NAME(Action::TimepointsDelete,"Delete Time Points");
+ACTION_SET_TASK(Action::TimepointsDelete,"delete");
+ACTION_SET_CATEGORY(Action::TimepointsDelete,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::TimepointsDelete,0);
+ACTION_SET_VERSION(Action::TimepointsDelete,"0.0");
+ACTION_SET_CVS_ID(Action::TimepointsDelete,"$Id: timepointsdelete.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::TimepointsDelete::TimepointsDelete()
+{
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::TimepointsDelete::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
+ .set_local_name(_("New Selected Layer"))
+ .set_desc(_("A layer to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
+ .set_local_name(_("New Selected Canvas"))
+ .set_desc(_("A canvas to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("New Selected ValueBase"))
+ .set_desc(_("A valuenode's description to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
+ .set_local_name(_("New Selected Time Point"))
+ .set_desc(_("A time point to add to our selected list"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::TimepointsDelete::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+
+ if( x.find("addlayer") == x.end() &&
+ x.find("addcanvas") == x.end() &&
+ x.find("addvaluedesc") == x.end())
+ return false;
+ return true;
+}
+
+bool
+Action::TimepointsDelete::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ //add a layer to the list
+ sel_layers.push_back(param.get_layer());
+
+ return true;
+ }
+
+ if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ //add a layer to the list
+ sel_canvases.push_back(param.get_canvas());
+
+ return true;
+ }
+
+ if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ //add a layer to the list
+ sel_values.push_back(param.get_value_desc());
+
+ return true;
+ }
+
+ if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
+ {
+ //add a layer to the list
+ sel_times.insert(param.get_time());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::TimepointsDelete::is_ready()const
+{
+ if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::TimepointsDelete::prepare()
+{
+ clear();
+
+ if(sel_times.empty()) return;
+
+ //all our lists should be set correctly...
+
+ //build our sub-action list
+ // and yes we do need to store it temporarily so we don't duplicate
+ // an operation on a specific valuenode, etc....
+ timepoints_ref match;
+
+ Time fps = get_canvas()->rend_desc().get_frame_rate();
+
+ //std::vector<synfig::Layer::Handle>
+ //synfig::info("Layers %d", sel_layers.size());
+ {
+ std::vector<synfig::Layer::Handle>::iterator i = sel_layers.begin(),
+ end = sel_layers.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a layer");
+ recurse_layer(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfig::Canvas::Handle> sel_canvases;
+ //synfig::info("Canvases %d", sel_canvases.size());
+ {
+ std::vector<synfig::Canvas::Handle>::iterator i = sel_canvases.begin(),
+ end = sel_canvases.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a canvas");
+ recurse_canvas(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfigapp::ValueDesc>
+ //synfig::info("ValueBasedescs %d", sel_values.size());
+ {
+ std::vector<synfigapp::ValueDesc>::iterator i = sel_values.begin(),
+ end = sel_values.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a valuedesc");
+ recurse_valuedesc(*i,sel_times,match);
+ }
+ }
+
+ //process the hell out of em...
+ {
+ //must build from both lists
+ timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
+ end = match.waypointbiglist.end();
+ for(; i != end; ++i)
+ {
+ //iterate through each waypoint for this specific valuenode
+ std::set<synfig::Waypoint>::const_iterator j = i->waypoints.begin(),
+ end = i->waypoints.end();
+ for(; j != end; ++j)
+ {
+ Action::Handle action(WaypointRemove::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(i->val));
+ action->set_param("waypoint",*j);
+
+ //run the action now that we've added everything
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ }
+ {
+ //must build from both lists
+ timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
+ end = match.actpointbiglist.end();
+ for(; i != end; ++i)
+ {
+ //iterate through each activepoint for this specific valuenode
+ std::set<synfig::Activepoint>::const_iterator j = i->activepoints.begin(),
+ jend = i->activepoints.end();
+ for(; j != jend; ++j)
+ {
+ Action::Handle action(ActivepointRemove::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",i->val);
+ action->set_param("activepoint",*j);
+
+ //run the action now that everything should be in order
+ assert(action->is_ready());
+ if(!action->is_ready())
+ {
+ throw Error(Error::TYPE_NOTREADY);
+ }
+
+ add_action_front(action);
+ }
+ }
+ }
+}
+
+void
+Action::TimepointsDelete::perform()
+{
+ Action::Super::perform();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointsdelete.h
+** \brief Delete the Time Points Header
+**
+** $Id: timepointsdelete.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_TIMEPOINTSDELETE_H
+#define __SYNFIG_APP_ACTION_TIMEPOINTSDELETE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/time.h>
+#include <synfig/layer.h>
+#include <synfig/canvas.h>
+#include <synfigapp/value_desc.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class TimepointsDelete :
+ public Super
+{
+private:
+
+ //process all the value descriptions that are selected (or are in subselections)
+ std::vector<synfig::Layer::Handle> sel_layers;
+ std::vector<synfig::Canvas::Handle> sel_canvases;
+ std::vector<synfigapp::ValueDesc> sel_values;
+ std::set<synfig::Time> sel_times;
+
+public:
+
+ TimepointsDelete();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointsmove.cpp
+** \brief Move the Time Points File
+**
+** $Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "timepointsmove.h"
+#include <synfig/layer_pastecanvas.h>
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_animated.h>
+
+#include "activepointset.h"
+#include "waypointset.h"
+#include <synfigapp/timegather.h>
+
+#include <typeinfo>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::TimepointsMove);
+ACTION_SET_NAME(Action::TimepointsMove,"timepoint_move");
+ACTION_SET_LOCAL_NAME(Action::TimepointsMove,"Move Time Points");
+ACTION_SET_TASK(Action::TimepointsMove,"move");
+ACTION_SET_CATEGORY(Action::TimepointsMove,Action::CATEGORY_WAYPOINT|Action::CATEGORY_ACTIVEPOINT);
+ACTION_SET_PRIORITY(Action::TimepointsMove,0);
+ACTION_SET_VERSION(Action::TimepointsMove,"0.0");
+ACTION_SET_CVS_ID(Action::TimepointsMove,"$Id: timepointsmove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::TimepointsMove::TimepointsMove()
+{
+ timemove = 0;
+ set_dirty(false);
+}
+
+Action::ParamVocab
+Action::TimepointsMove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("addlayer",Param::TYPE_VALUE)
+ .set_local_name(_("New Selected Layer"))
+ .set_desc(_("A layer to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addcanvas",Param::TYPE_CANVAS)
+ .set_local_name(_("New Selected Canvas"))
+ .set_desc(_("A canvas to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addvaluedesc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("New Selected ValueBase"))
+ .set_desc(_("A valuenode's description to add to our selected list"))
+ .set_supports_multiple()
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("addtime",Param::TYPE_TIME)
+ .set_local_name(_("New Selected Time Point"))
+ .set_desc(_("A time point to add to our selected list"))
+ .set_supports_multiple()
+ );
+
+ ret.push_back(ParamDesc("deltatime",Param::TYPE_TIME)
+ .set_local_name(_("Time adjustment"))
+ .set_desc(_("The amount of time to adjust all the selected points"))
+ );
+
+ return ret;
+}
+
+bool
+Action::TimepointsMove::is_canidate(const ParamList &x)
+{
+ if(!canidate_check(get_param_vocab(),x))
+ return false;
+
+ if( x.find("addlayer") == x.end() &&
+ x.find("addcanvas") == x.end() &&
+ x.find("addvaluedesc") == x.end())
+ return false;
+ return true;
+}
+
+bool
+Action::TimepointsMove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
+ {
+ //add a layer to the list
+ sel_layers.push_back(param.get_layer());
+ //synfig::info("action got layer");
+
+ return true;
+ }
+
+ if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ //add a layer to the list
+ sel_canvases.push_back(param.get_canvas());
+ //synfig::info("action got canvas");
+
+ return true;
+ }
+
+ if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ //add a layer to the list
+ sel_values.push_back(param.get_value_desc());
+ //synfig::info("action got valuedesc");
+
+ return true;
+ }
+
+ if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
+ {
+ //add a layer to the list
+ sel_times.insert(param.get_time());
+ //synfig::info("action got time");
+
+ return true;
+ }
+
+ if(name=="deltatime" && param.get_type()==Param::TYPE_TIME)
+ {
+ timemove = param.get_time();
+ //synfig::info("action got time to move");
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::TimepointsMove::is_ready()const
+{
+ if((sel_layers.empty() && sel_canvases.empty() && sel_values.empty()) || sel_times.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::TimepointsMove::prepare()
+{
+ clear();
+
+ //synfig::info("Preparing TimepointsMove by %f secs",(float)timemove);
+
+ if(sel_times.empty()) return;
+
+ //all our lists should be set correctly...
+
+ /*{
+ std::set<synfig::Time>::iterator i = sel_times.begin(), end = sel_times.end();
+
+ for(; i != end; ++i)
+ {
+ synfig::info("Time %f", (float)*i);
+ }
+ }*/
+
+ //build our sub-action list
+ // and yes we do need to store it temporarily so we don't duplicate
+ // an operation on a specific valuenode, etc....
+ timepoints_ref match;
+
+ Time fps = get_canvas()->rend_desc().get_frame_rate();
+
+ //std::vector<synfig::Layer::Handle>
+ //synfig::info("Layers %d", sel_layers.size());
+ {
+ std::vector<synfig::Layer::Handle>::iterator i = sel_layers.begin(),
+ end = sel_layers.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a layer");
+ recurse_layer(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfig::Canvas::Handle> sel_canvases;
+ //synfig::info("Canvases %d", sel_canvases.size());
+ {
+ std::vector<synfig::Canvas::Handle>::iterator i = sel_canvases.begin(),
+ end = sel_canvases.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a canvas");
+ recurse_canvas(*i,sel_times,match);
+ }
+ }
+
+ //std::vector<synfigapp::ValueDesc>
+ //synfig::info("ValueBasedescs %d", sel_values.size());
+ {
+ std::vector<synfigapp::ValueDesc>::iterator i = sel_values.begin(),
+ end = sel_values.end();
+
+ for(; i != end; ++i)
+ {
+ //synfig::info("Recurse through a valuedesc");
+ recurse_valuedesc(*i,sel_times,match);
+ }
+ }
+
+ //synfig::info("built list of waypoints/activepoints to modify");
+ //synfig::info("\t There are %d waypoint sets and %d activepointsets",
+ // match.waypointbiglist.size(), match.actpointbiglist.size());
+ //process the hell out of em...
+ {
+ //must build from both lists
+ timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(),
+ end = match.waypointbiglist.end();
+ for(; i != end; ++i)
+ {
+ Action::Handle action(WaypointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(i->val));
+
+ //iterate through each waypoint for this specific valuenode
+ std::set<synfig::Waypoint>::const_iterator j = i->waypoints.begin(),
+ end = i->waypoints.end();
+ for(; j != end; ++j)
+ {
+ //synfig::info("add waypoint mod...");
+ //NOTE: We may want to store the old time for undoing the action...
+ Waypoint w = *j;
+ w.set_time((w.get_time() + timemove).round(fps));
+ action->set_param("waypoint",w);
+ }
+
+ //run the action now that we've added everything
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ }
+ {
+ //must build from both lists
+ timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(),
+ end = match.actpointbiglist.end();
+ for(; i != end; ++i)
+ {
+ Action::Handle action(ActivepointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",i->val);
+
+ //iterate through each activepoint for this specific valuenode
+ std::set<synfig::Activepoint>::const_iterator j = i->activepoints.begin(),
+ jend = i->activepoints.end();
+ for(; j != jend; ++j)
+ {
+ //synfig::info("add activepoint mod...");
+
+ //NOTE: We may want to store the old time for undoing the action...
+ Activepoint a = *j;
+ a.set_time((a.get_time() + timemove).round(fps));
+ action->set_param("activepoint",a);
+ }
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ {
+ throw Error(Error::TYPE_NOTREADY);
+ }
+
+ add_action_front(action);
+ }
+ }
+}
+
+void
+Action::TimepointsMove::perform()
+{
+ Action::Super::perform();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timepointsmove.h
+** \brief Move the Time Points Header
+**
+** $Id: timepointsmove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_TIMEPOINTSMOVE_H
+#define __SYNFIG_APP_ACTION_TIMEPOINTSMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/time.h>
+#include <synfig/layer.h>
+#include <synfig/canvas.h>
+#include <synfigapp/value_desc.h>
+
+#include <vector>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class TimepointsMove :
+ public Super
+{
+private:
+
+ //process all the value descriptions that are selected (or are in subselections)
+ std::vector<synfig::Layer::Handle> sel_layers;
+ std::vector<synfig::Canvas::Handle> sel_canvases;
+ std::vector<synfigapp::ValueDesc> sel_values;
+ std::set<synfig::Time> sel_times;
+
+ synfig::Time timemove;
+
+public:
+
+ TimepointsMove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+ virtual void perform();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescconnect.cpp
+** \brief Template File
+**
+** $Id: valuedescconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamconnect.h"
+#include "valuenodelinkconnect.h"
+#include "valuenodereplace.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueDescConnect);
+ACTION_SET_NAME(Action::ValueDescConnect,"value_desc_connect");
+ACTION_SET_LOCAL_NAME(Action::ValueDescConnect,"Connect");
+ACTION_SET_TASK(Action::ValueDescConnect,"connect");
+ACTION_SET_CATEGORY(Action::ValueDescConnect,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueDescConnect,0);
+ACTION_SET_VERSION(Action::ValueDescConnect,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescConnect,"$Id: valuedescconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescConnect::ValueDescConnect()
+{
+}
+
+Action::ParamVocab
+Action::ValueDescConnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("dest",Param::TYPE_VALUEDESC)
+ .set_local_name(_("Destination ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("src",Param::TYPE_VALUENODE)
+ .set_local_name(_("Source ValueNode"))
+ .set_mutual_exclusion("src_name")
+ );
+
+ ret.push_back(ParamDesc("src_name",Param::TYPE_STRING)
+ .set_local_name(_("Source ValueNode Name"))
+ .set_mutual_exclusion("src")
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescConnect::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ if(x.count("src"))
+ {
+ ValueDesc value_desc=x.find("dest")->second.get_value_desc();
+ ValueNode::Handle value_node=x.find("src")->second.get_value_node();
+ if(value_desc.get_value_type()==value_node->get_type())
+ return true;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueDescConnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="dest" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ return true;
+ }
+
+ if(name=="src" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(!value_node_name.empty() && !value_node && name=="canvas" && param.get_type()==Param::TYPE_CANVAS)
+ {
+ value_node=param.get_canvas()->find_value_node(value_node_name);
+ }
+
+ if(name=="src_name" && param.get_type()==Param::TYPE_STRING)
+ {
+ value_node_name=param.get_string();
+
+ if(get_canvas())
+ {
+ value_node=get_canvas()->find_value_node(value_node_name);
+ if(!value_node)
+ return false;
+ }
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueDescConnect::is_ready()const
+{
+ if(!value_desc || !value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescConnect::prepare()
+{
+ clear();
+
+ if(value_desc.parent_is_canvas())
+ {
+ ValueNode::Handle dest_value_node;
+ dest_value_node=value_desc.get_value_node();
+
+ Action::Handle action(ValueNodeReplace::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",value_node);
+ action->set_param("dest",value_desc.get_value_node());
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_linkable_value_node())
+ {
+ Action::Handle action(ValueNodeLinkConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("parent_value_node",value_desc.get_parent_value_node());
+ action->set_param("value_node", value_node);
+ action->set_param("index",value_desc.get_index());
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_layer_param())
+ {
+ Action::Handle action(LayerParamConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",value_desc.get_layer());
+ action->set_param("param",value_desc.get_param_name());
+ action->set_param("value_node",value_node);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+
+ throw Error(_("ValueDesc is not recognised or supported."));
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescconnect.h
+** \brief Template File
+**
+** $Id: valuedescconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCCONNECT_H
+#define __SYNFIG_APP_ACTION_VALUEDESCCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescConnect :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::ValueNode::Handle value_node;
+ synfig::String value_node_name;
+
+public:
+
+ ValueDescConnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescconvert.cpp
+** \brief Template File
+**
+** $Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/*
+#include "valuenodereplace.h"
+#include "layerparamconnect.h"
+#include "valuenodelinkconnect.h"
+*/
+
+#include "valuedescconnect.h"
+
+#include "valuedescconvert.h"
+
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueDescConvert);
+ACTION_SET_NAME(Action::ValueDescConvert,"value_desc_convert");
+ACTION_SET_LOCAL_NAME(Action::ValueDescConvert,"Convert");
+ACTION_SET_TASK(Action::ValueDescConvert,"convert");
+ACTION_SET_CATEGORY(Action::ValueDescConvert,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescConvert,0);
+ACTION_SET_VERSION(Action::ValueDescConvert,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id: valuedescconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescConvert::ValueDescConvert()
+{
+}
+
+Action::ParamVocab
+Action::ValueDescConvert::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("type",Param::TYPE_STRING)
+ .set_local_name(_("Type"))
+ .set_desc(_("The type of ValueNode that you want to be converted to"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescConvert::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueDescConvert::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ return true;
+ }
+
+ if(name=="type" && param.get_type()==Param::TYPE_STRING)
+ {
+ type=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueDescConvert::is_ready()const
+{
+ if(!value_desc || type.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescConvert::prepare()
+{
+ clear();
+
+ ValueBase value;
+
+ if(value_desc.is_const())
+ value=value_desc.get_value();
+ else if(value_desc.is_value_node())
+ value=(*value_desc.get_value_node())(0);
+ else
+ throw Error(_("Unable to decipher ValueDesc (Bug?)"));
+
+ ValueNode::Handle src_value_node(LinkableValueNode::create(type,value));
+
+ if(!src_value_node)
+ throw Error(_("Unable to create new value node"));
+
+
+ ValueNode::Handle dest_value_node;
+ dest_value_node=value_desc.get_value_node();
+
+ Action::Handle action(ValueDescConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",src_value_node);
+ action->set_param("dest",value_desc);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+/*
+ return;
+
+
+ if(value_desc.parent_is_canvas())
+ {
+ ValueNode::Handle dest_value_node;
+ dest_value_node=value_desc.get_value_node();
+
+ Action::Handle action(ValueNodeReplace::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",src_value_node);
+ action->set_param("dest",dest_value_node);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_linkable_value_node())
+ {
+ Action::Handle action(ValueNodeLinkConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("parent_value_node",value_desc.get_parent_value_node());
+ action->set_param("value_node", src_value_node);
+ action->set_param("index",value_desc.get_index());
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_layer_param())
+ {
+ Action::Handle action(LayerParamConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",value_desc.get_layer());
+ action->set_param("param",value_desc.get_param_name());
+ action->set_param("value_node",src_value_node);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+
+
+
+ throw Error(_("ValueDesc is not recognised or supported."));
+*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescconvert.h
+** \brief Template File
+**
+** $Id: valuedescconvert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCCONVERT_H
+#define __SYNFIG_APP_ACTION_VALUEDESCCONVERT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescConvert :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::String type;
+
+public:
+
+ ValueDescConvert();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescdisconnect.cpp
+** \brief Template File
+**
+** $Id: valuedescdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamdisconnect.h"
+#include "valuenodelinkdisconnect.h"
+#include "valuenodereplace.h"
+
+#include "valuedescdisconnect.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueDescDisconnect);
+ACTION_SET_NAME(Action::ValueDescDisconnect,"value_desc_disconnect");
+ACTION_SET_LOCAL_NAME(Action::ValueDescDisconnect,"Disconnect");
+ACTION_SET_TASK(Action::ValueDescDisconnect,"disconnect");
+ACTION_SET_CATEGORY(Action::ValueDescDisconnect,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescDisconnect,-100);
+ACTION_SET_VERSION(Action::ValueDescDisconnect,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescDisconnect,"$Id: valuedescdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescDisconnect::ValueDescDisconnect():
+ time(0)
+{
+}
+
+Action::ParamVocab
+Action::ValueDescDisconnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescDisconnect::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_canvas() && value_desc.is_value_node() && value_desc.get_value_node()->rcount()>1)
+ return true;
+ if(value_desc.is_const())
+ return false;
+ if(value_desc.is_value_node() && ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueDescDisconnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueDescDisconnect::is_ready()const
+{
+ if(!value_desc)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescDisconnect::prepare()
+{
+ clear();
+
+ if(value_desc.parent_is_canvas())
+ {
+ ValueNode::Handle src_value_node;
+ src_value_node=ValueNode_Const::create((*value_desc.get_value_node())(time));
+
+ Action::Handle action(ValueNodeReplace::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",src_value_node);
+ action->set_param("dest",value_desc.get_value_node());
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_linkable_value_node())
+ {
+ Action::Handle action(ValueNodeLinkDisconnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("parent_value_node",value_desc.get_parent_value_node());
+ action->set_param("index",value_desc.get_index());
+ action->set_param("time",time);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(value_desc.parent_is_layer_param())
+ {
+ Action::Handle action(LayerParamDisconnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",value_desc.get_layer());
+ action->set_param("param",value_desc.get_param_name());
+ action->set_param("time",time);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+
+ throw Error(_("ValueDesc is not recognised or supported."));
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescdisconnect.h
+** \brief Template File
+**
+** $Id: valuedescdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCDISCONNECT_H
+#define __SYNFIG_APP_ACTION_VALUEDESCDISCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescDisconnect :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::Time time;
+
+public:
+
+ ValueDescDisconnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescset.cpp
+** \brief Template File
+**
+** $Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodeadd.h"
+
+#include "canvasadd.h"
+#include "valuedescexport.h"
+#include "layerparamconnect.h"
+
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueDescExport);
+ACTION_SET_NAME(Action::ValueDescExport,"value_desc_export");
+ACTION_SET_LOCAL_NAME(Action::ValueDescExport,"Export");
+ACTION_SET_TASK(Action::ValueDescExport,"export");
+ACTION_SET_CATEGORY(Action::ValueDescExport,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescExport,0);
+ACTION_SET_VERSION(Action::ValueDescExport,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescExport,"$Id: valuedescexport.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescExport::ValueDescExport()
+{
+}
+
+Action::ParamVocab
+Action::ValueDescExport::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("name",Param::TYPE_STRING)
+ .set_local_name(_("Name"))
+ .set_desc(_("The name that you want this value to be exported as"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescExport::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc=x.find("value_desc")->second.get_value_desc();
+ if(!value_desc || value_desc.parent_is_canvas() || (value_desc.is_value_node() && value_desc.get_value_node()->is_exported()))
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueDescExport::set_param(const synfig::String& param_name, const Action::Param ¶m)
+{
+ if(param_name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ return true;
+ }
+
+ if(param_name=="name" && param.get_type()==Param::TYPE_STRING)
+ {
+ name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(param_name,param);
+}
+
+bool
+Action::ValueDescExport::is_ready()const
+{
+ if(!value_desc || name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescExport::prepare()
+{
+ clear();
+
+ ValueNode::Handle value_node;
+
+ if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
+ {
+ if(!value_desc.is_const())
+ throw Error(_("Can only export Canvas when used as constant parameter"));
+ Canvas::Handle canvas(value_desc.get_value().get(Canvas::Handle()));
+
+ Action::Handle action(CanvasAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",canvas);
+ action->set_param("id",name);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+
+ return;
+ }
+
+
+ if(value_desc.is_value_node())
+ {
+ if(value_desc.get_value_node()->is_exported())
+ throw Error(_("ValueBase is already exported"));
+
+ value_node=value_desc.get_value_node();
+ }
+ else
+ {
+ if(!value_desc.parent_is_layer_param())
+ throw Error(_("Unable to export parameter. (Bug?)"));
+
+ value_node=ValueNode_Const::create(value_desc.get_value());
+
+ Action::Handle action(LayerParamConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",value_desc.get_layer());
+ action->set_param("param",value_desc.get_param_name());
+ action->set_param("value_node",value_node);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+
+ Action::Handle action(ValueNodeAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("new",value_node);
+ action->set_param("name",name);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescexport.h
+** \brief Template File
+**
+** $Id: valuedescexport.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCEXPORT_H
+#define __SYNFIG_APP_ACTION_VALUEDESCEXPORT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescExport :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::String name;
+
+public:
+
+ ValueDescExport();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedesclink.cpp
+** \brief Template File
+**
+** $Id: valuedesclink.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuedesclink.h"
+
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueDescLink);
+ACTION_SET_NAME(Action::ValueDescLink,"value_desc_link");
+ACTION_SET_LOCAL_NAME(Action::ValueDescLink,"Link");
+ACTION_SET_TASK(Action::ValueDescLink,"connect");
+ACTION_SET_CATEGORY(Action::ValueDescLink,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescLink,0);
+ACTION_SET_VERSION(Action::ValueDescLink,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescLink,"$Id: valuedesclink.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescLink::ValueDescLink()
+{
+ poison=false;
+}
+
+Action::ParamVocab
+Action::ValueDescLink::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc to link"))
+ .set_requires_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescLink::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+ return true;
+ }
+
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(value_desc.is_value_node() && value_desc.get_value_node()->is_exported())
+ {
+ if(link_value_node==value_desc.get_value_node())
+ return true;
+
+ if(link_value_node && link_value_node->is_exported())
+ {
+ poison=true;
+ return false;
+ }
+
+ link_value_node=value_desc.get_value_node();
+ }
+ else if(value_desc.is_value_node())
+ {
+ if(!link_value_node)
+ {
+ link_value_node=value_desc.get_value_node();
+ }
+
+ // Use the one that is referenced more
+ else if(link_value_node->rcount()<value_desc.get_value_node()->rcount())
+ {
+ link_value_node=value_desc.get_value_node();
+ }
+
+ // If the current link value node is a constant and
+ // this one isn't, then give preference to the exotic
+ else if(ValueNode_Const::Handle::cast_dynamic(link_value_node) && !ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ link_value_node=value_desc.get_value_node();
+ }
+
+ // If both are animated, and this one has more waypoints,
+ // then use the one with more waypoints
+ else if(
+ ValueNode_Animated::Handle::cast_dynamic(link_value_node)
+ && ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())
+ && (
+ ValueNode_Animated::Handle::cast_dynamic(link_value_node)->waypoint_list().size()
+ < ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node())->waypoint_list().size()
+ )
+ )
+ {
+ link_value_node=value_desc.get_value_node();
+ }
+
+ /*
+ // Use the one that was most recently changed
+ else if(link_value_node->get_time_last_changed()<value_desc.get_value_node()->get_time_last_changed())
+ {
+ link_value_node=value_desc.get_value_node();
+ }
+ */
+ }
+
+
+ if(value_desc_list.size() && value_desc.get_value_type()!=value_desc_list.front().get_value_type())
+ {
+ // Everything must be of the same type
+ poison=true;
+ return false;
+ }
+ value_desc_list.push_back(value_desc);
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueDescLink::is_ready()const
+{
+ if(poison || value_desc_list.size()<=1)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescLink::prepare()
+{
+ if(poison || value_desc_list.empty())
+ throw Error(Error::TYPE_NOTREADY);
+
+ clear();
+
+ if(!link_value_node)
+ {
+ ValueDesc& value_desc(value_desc_list.front());
+
+ link_value_node=ValueNode_Const::create(value_desc.get_value(time));
+
+ Action::Handle action(Action::create("value_desc_connect"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",link_value_node);
+ action->set_param("dest",value_desc);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+
+ /*
+ if(!link_value_node->is_exported())
+ {
+ Action::Handle action(Action::create("value_node_add"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("new",link_value_node);
+ action->set_param("name",strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+ */
+
+ std::list<ValueDesc>::iterator iter;
+ for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+ {
+ ValueDesc& value_desc(*iter);
+
+ if(value_desc.is_value_node() && value_desc.get_value_node()==link_value_node)
+ continue;
+
+ Action::Handle action(Action::create("value_desc_connect"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("src",link_value_node);
+ action->set_param("dest",value_desc);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedesclink.h
+** \brief Template File
+**
+** $Id: valuedesclink.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCLINK_H
+#define __SYNFIG_APP_ACTION_VALUEDESCLINK_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescLink :
+ public Super
+{
+private:
+
+ std::list<ValueDesc> value_desc_list;
+ synfig::ValueNode::Handle link_value_node;
+ bool poison;
+ synfig::Time time;
+public:
+
+ ValueDescLink();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescset.cpp
+** \brief Template File
+**
+** $Id: valuedescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "layerparamset.h"
+#include "valuenodeconstset.h"
+#include "valuedescconnect.h"
+#include "waypointsetsmart.h"
+
+#include "valuedescset.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_composite.h>
+#include <synfig/valuenode_radialcomposite.h>
+#include <synfig/valuenode_reference.h>
+#include <synfigapp/main.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+#define ACTION_INIT2(class) \
+ Action::Base* class::create() { return new class(); } \
+ synfig::String class::get_name()const { return name__; }
+
+ACTION_INIT2(Action::ValueDescSet);
+ACTION_SET_NAME(Action::ValueDescSet,"value_desc_set");
+ACTION_SET_LOCAL_NAME(Action::ValueDescSet,"Set ValueDesc");
+ACTION_SET_TASK(Action::ValueDescSet,"set");
+ACTION_SET_CATEGORY(Action::ValueDescSet,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescSet,0);
+ACTION_SET_VERSION(Action::ValueDescSet,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescSet,"$Id: valuedescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueDescSet::ValueDescSet():
+ time(0)
+{
+}
+
+synfig::String
+Action::ValueDescSet::get_local_name()const
+{
+ String name("ValueDesc");
+
+ if(!value_desc)
+ {
+ }
+ else if(value_desc.parent_is_layer_param())
+ {
+ if(value_desc.get_layer()->get_description().empty())
+ name=value_desc.get_layer()->get_local_name();
+ else
+ name=value_desc.get_layer()->get_description();
+ name+="->"+value_desc.get_param_name();
+ }
+ else if(value_desc.parent_is_value_node())
+ {
+ synfig::LinkableValueNode::Handle value_node(synfig::LinkableValueNode::Handle::cast_reinterpret(value_desc.get_parent_value_node()));
+ name=value_node->link_local_name(value_desc.get_index());
+
+ synfig::Node* node;
+ for(node=value_node.get();!node->parent_set.empty() && !dynamic_cast<Layer*>(node);node=*node->parent_set.begin());
+ Layer::Handle parent_layer(dynamic_cast<Layer*>(node));
+ if(parent_layer)
+ {
+ if(parent_layer->get_description().empty())
+ name=parent_layer->get_local_name()+"=>"+name;
+ else
+ name=parent_layer->get_description()+"=>"+name;
+ }
+ }
+
+ return strprintf(_("Set %s"),name.c_str());
+}
+
+Action::ParamVocab
+Action::ValueDescSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
+ .set_local_name(_("ValueBase"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueDescSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueDescSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ value_desc=param.get_value_desc();
+
+ return true;
+ }
+
+ if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
+ {
+ value=param.get_value();
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueDescSet::is_ready()const
+{
+ if(!value_desc || !value.is_valid())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueDescSet::prepare()
+{
+ clear();
+
+ // If our tangents are merged, and
+ // our first tangent is being manipulated,
+ // then we also need to adjust the other
+ // tangent.
+ if( value_desc.parent_is_value_node()
+ && value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT
+ && value_desc.get_index()==4
+ && (*value_desc.get_parent_value_node())(time).get(BLinePoint()).get_split_tangent_flag()==false
+ )
+ {
+ DEBUGPOINT();
+ ValueNode_Composite::Handle parent_value_node;
+ parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node());
+
+ assert(parent_value_node);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",value);
+ action->set_param("value_desc",ValueDesc(parent_value_node,5));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+ // If we are a reference value node, then
+ // we need to distribute the changes to the
+ // referenced value node
+ if(value_desc.is_value_node() && ValueNode_Reference::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueDesc reference_value_desc(ValueNode_Reference::Handle::cast_dynamic(value_desc.get_value_node()),0);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",value);
+ action->set_param("value_desc",reference_value_desc);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+ return;
+ }
+
+ // If we are a composite value node, then
+ // we need to distribute the changes to the
+ // individual parts
+ if(value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueBase components[6];
+ int n_components(0);
+ switch(value.get_type())
+ {
+ case ValueBase::TYPE_VECTOR:
+ components[0]=value.get(Vector())[0];
+ components[1]=value.get(Vector())[1];
+ n_components=2;
+ break;
+ case ValueBase::TYPE_COLOR:
+ components[0]=value.get(Color()).get_r();
+ components[1]=value.get(Color()).get_g();
+ components[2]=value.get(Color()).get_b();
+ components[3]=value.get(Color()).get_a();
+ n_components=4;
+ break;
+ case ValueBase::TYPE_SEGMENT:
+ components[0]=value.get(Segment()).p1;
+ components[1]=value.get(Segment()).t1;
+ components[2]=value.get(Segment()).p2;
+ components[3]=value.get(Segment()).t2;
+ n_components=4;
+ break;
+ case ValueBase::TYPE_BLINEPOINT:
+ {
+ BLinePoint bline_point(value);
+ components[0]=bline_point.get_vertex();
+ components[1]=bline_point.get_width();
+ components[2]=bline_point.get_origin();
+ components[3]=bline_point.get_split_tangent_flag();
+ components[4]=bline_point.get_tangent1();
+ components[5]=bline_point.get_tangent2();
+ n_components=6;
+ break;
+ }
+ default:
+ throw Error("Bad type for composite (%s)",ValueBase::type_name(value.get_type()).c_str());
+ break;
+ }
+
+ for(int i=0;i<n_components;i++)
+ {
+ ValueDesc component_value_desc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),i);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",components[i]);
+ action->set_param("value_desc",component_value_desc);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+ return;
+ }
+
+
+ // If we are a RADIAL composite value node, then
+ // we need to distribute the changes to the
+ // individual parts
+ if(value_desc.is_value_node() && ValueNode_RadialComposite::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueBase components[6];
+ int n_components(0);
+ switch(value.get_type())
+ {
+ case ValueBase::TYPE_VECTOR:
+ {
+ Vector vect(value.get(Vector()));
+ components[0]=vect.mag();
+ components[1]=Angle(Angle::tan(vect[1],vect[0]));
+ n_components=2;
+ }
+ break;
+ case ValueBase::TYPE_COLOR:
+ components[0]=value.get(Color()).get_y();
+ components[1]=value.get(Color()).get_s();
+ components[2]=value.get(Color()).get_hue();
+ components[3]=value.get(Color()).get_a();
+ n_components=4;
+ break;
+ default:
+ throw Error("Bad type for radial composite (%s)",ValueBase::type_name(value.get_type()).c_str());
+ break;
+ }
+ for(int i=0;i<n_components;i++)
+ {
+ ValueDesc component_value_desc(ValueNode_RadialComposite::Handle::cast_dynamic(value_desc.get_value_node()),i);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",components[i]);
+ action->set_param("value_desc",component_value_desc);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+ return;
+ }
+
+ // If we are merging the tangents of a BLinePoint,
+ // we must also set the second tangent for things
+ // to interpolate properly
+ if( value_desc.parent_is_value_node()
+ && value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT
+ && value_desc.get_index()==3
+// && value.get(bool())==false // Actually, we want to do this any time the split flag is tweaked with
+ )
+ {
+ ValueNode_Composite::Handle parent_value_node;
+ parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node());
+
+ assert(parent_value_node);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",(*parent_value_node->get_link(4))(time));
+ action->set_param("value_desc",ValueDesc(parent_value_node,5));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+/* DEBUGPOINT();
+ if( value_desc.parent_is_value_node())
+ {
+ DEBUGPOINT();
+ if(value_desc.get_parent_value_node()->get_type()==ValueBase::TYPE_BLINEPOINT)
+ {
+ DEBUGPOINT();
+ if(value_desc.get_index()==4)
+ {
+ DEBUGPOINT();
+ if((*value_desc.get_parent_value_node())(time).get(BLinePoint()).get_split_tangent_flag()==false)
+ {
+ DEBUGPOINT();
+ }
+ }
+ }
+ }
+*/
+
+
+ // If we are in animate editing mode
+ if(get_edit_mode()&MODE_ANIMATE)
+ {
+
+ ValueNode_Animated::Handle& value_node(value_node_animated);
+
+ // If this value isn't a ValueNode_Animated, but
+ // it is somewhat constant, then go ahead and convert
+ // it to a ValueNode_Animated.
+ if(!value_desc.is_value_node() || ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueBase value;
+ if(value_desc.is_value_node())
+ value=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node())->get_value();
+ else
+ value=value_desc.get_value();
+
+ if(!value_node)value_node=ValueNode_Animated::create(value,time);
+ //if(!value_node)value_node=ValueNode_Animated::create(value.get_type());
+
+ Action::Handle action;
+
+ if(!value_desc.is_value_node())
+ {
+ action=(ValueDescConnect::create());
+ action->set_param("dest",value_desc);
+ action->set_param("src",ValueNode::Handle(value_node));
+ }
+ else
+ {
+ action=Action::create("value_node_replace");
+ action->set_param("dest",value_desc.get_value_node());
+ action->set_param("src",ValueNode::Handle(value_node));
+ }
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ DEBUGPOINT();
+ add_action_front(action);
+ }
+ else
+ {
+ value_node=value_node.cast_dynamic(value_desc.get_value_node());
+ }
+
+ DEBUGPOINT();
+ if(!value_node)
+ throw Error(_("Direct manipulation of this ValueNode type is not yet supported"));
+
+ Action::Handle action(WaypointSetSmart::create());
+
+ //Waypoint waypoint(value,time);
+
+ Waypoint waypoint(value_node->new_waypoint_at_time(time));
+ waypoint.set_value(value);
+
+ waypoint.set_before(synfigapp::Main::get_interpolation());
+ waypoint.set_after(synfigapp::Main::get_interpolation());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ DEBUGPOINT();
+ add_action(action);
+
+ return;
+ }
+ else
+ {
+ if(value_desc.is_value_node())
+ {
+ if(ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ Action::Handle action(ValueNodeConstSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",value_desc.get_value_node());
+ action->set_param("new_value",value);
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
+ if(ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()))
+ throw Error(_("You must be in Animate-Editing-Mode to directly manipulate this value"));
+ else
+ throw Error(_("Direct manipulation of this ValueNode type is not yet supported"));
+ }
+ else
+ if(value_desc.parent_is_layer_param() && !value_desc.is_value_node())
+ {
+ Action::Handle layer_param_set(LayerParamSet::create());
+
+ layer_param_set->set_param("canvas",get_canvas());
+ layer_param_set->set_param("canvas_interface",get_canvas_interface());
+ layer_param_set->set_param("layer",value_desc.get_layer());
+ layer_param_set->set_param("param",value_desc.get_param_name());
+ layer_param_set->set_param("new_value",value);
+
+ if(!layer_param_set->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(layer_param_set);
+ return;
+ }
+
+ throw Error(_("Unsupported ValueDesc type"));
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuedescset.h
+** \brief Template File
+**
+** $Id: valuedescset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUEDESCSET_H
+#define __SYNFIG_APP_ACTION_VALUEDESCSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_animated.h>
+#include <list>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class ValueDescSet :
+ public Super
+{
+private:
+
+ ValueDesc value_desc;
+ synfig::ValueBase value;
+ synfig::Time time;
+ synfig::ValueNode_Animated::Handle value_node_animated;
+
+public:
+
+ ValueDescSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodeadd.cpp
+** \brief Template File
+**
+** $Id: valuenodeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodeadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeAdd);
+ACTION_SET_NAME(Action::ValueNodeAdd,"value_node_add");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeAdd,"Add ValueNode");
+ACTION_SET_TASK(Action::ValueNodeAdd,"add");
+ACTION_SET_CATEGORY(Action::ValueNodeAdd,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeAdd,0);
+ACTION_SET_VERSION(Action::ValueNodeAdd,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeAdd,"$Id: valuenodeadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeAdd::ValueNodeAdd()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("new",Param::TYPE_VALUENODE)
+ .set_local_name(_("New ValueNode"))
+ .set_desc(_("ValueNode to be added"))
+ );
+
+ ret.push_back(ParamDesc("name",Param::TYPE_STRING)
+ .set_local_name(_("Name"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeAdd::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueNodeAdd::set_param(const synfig::String& param_name, const Action::Param ¶m)
+{
+ if(param_name=="new" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(param_name=="name" && param.get_type()==Param::TYPE_STRING)
+ {
+ name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(param_name,param);
+}
+
+bool
+Action::ValueNodeAdd::is_ready()const
+{
+ if(!value_node || name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeAdd::perform()
+{
+ if(value_node->is_exported())
+ {
+ throw Error(_("Parameter appears to already be exported"));
+ }
+
+ try
+ {
+ get_canvas()->add_value_node(value_node,name);
+ }
+ catch(Exception::IDAlreadyExists)
+ {
+ throw Error(_("Another exported ValueBase with this name already exists"));
+ }
+ catch(...)
+ {
+ throw Error(_("Exception caught on Add ValueNode."));
+ }
+
+ set_dirty(false);
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_added()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
+
+void
+Action::ValueNodeAdd::undo()
+{
+ try { get_canvas()->remove_value_node(value_node); }
+ catch(...)
+ {
+ throw Error(_("Exception caught on Remove ValueNode."));
+ }
+
+ set_dirty(false);
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_deleted()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodeadd.h
+** \brief Template File
+**
+** $Id: valuenodeadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEADD_H
+#define __SYNFIG_APP_ACTION_VALUENODEADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode::Handle value_node;
+ synfig::String name;
+
+public:
+
+ ValueNodeAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodeconstset.cpp
+** \brief Template File
+**
+** $Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodeconstset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeConstSet);
+ACTION_SET_NAME(Action::ValueNodeConstSet,"value_node_const_set");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeConstSet,_("Set ValueNode_Const"));
+ACTION_SET_TASK(Action::ValueNodeConstSet,"set");
+ACTION_SET_CATEGORY(Action::ValueNodeConstSet,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeConstSet,0);
+ACTION_SET_VERSION(Action::ValueNodeConstSet,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeConstSet,"$Id: valuenodeconstset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeConstSet::ValueNodeConstSet()
+{
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeConstSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode_Const"))
+ );
+
+ ret.push_back(ParamDesc("new_value",Param::TYPE_VALUE)
+ .set_local_name(_("ValueBase"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeConstSet::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ if(ValueNode_Const::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeConstSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());
+
+ return (bool)value_node;
+ }
+
+ if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
+ {
+ new_value=param.get_value();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeConstSet::is_ready()const
+{
+ if(!value_node || !new_value.is_valid())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeConstSet::perform()
+{
+ //set_dirty(true);
+
+ old_value=value_node->get_value();
+
+ value_node->set_value(new_value);
+
+ // Signal that a layer has been inserted
+ /*if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }*/
+}
+
+void
+Action::ValueNodeConstSet::undo()
+{
+ //set_dirty(true);
+
+ value_node->set_value(old_value);
+
+ // Signal that a layer has been inserted
+ /*if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodeconstset.h
+** \brief Template File
+**
+** $Id: valuenodeconstset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODECONSTSET_H
+#define __SYNFIG_APP_ACTION_VALUENODECONSTSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode_const.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeConstSet :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Const::Handle value_node;
+ synfig::ValueBase new_value;
+ synfig::ValueBase old_value;
+
+
+public:
+
+ ValueNodeConstSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistinsert.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistinsert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistinsert.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListInsert);
+ACTION_SET_NAME(Action::ValueNodeDynamicListInsert,"value_node_dynamic_list_insert");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListInsert,"Insert Item");
+ACTION_SET_TASK(Action::ValueNodeDynamicListInsert,"insert");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListInsert,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE|Action::CATEGORY_HIDDEN);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListInsert,-20);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListInsert,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListInsert,"$Id: valuenodedynamiclistinsert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListInsert::ValueNodeDynamicListInsert()
+{
+ index=0;
+ time=0;
+ origin=0.5f;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListInsert::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+ ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
+ .set_local_name(_("Origin"))
+ .set_optional()
+ );
+ ret.push_back(ParamDesc("item",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode to insert"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListInsert::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListInsert::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ value_node_bline=ValueNode_BLine::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ list_entry=value_node->create_list_entry(index,time,origin);
+ if(item)
+ list_entry.value_node=item;
+
+ assert(list_entry.value_node.rcount()==1);
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+ if(name=="item" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ item=param.get_value_node();
+ if(item)
+ list_entry.value_node=item;
+
+ return true;
+ }
+ if(name=="origin" && param.get_type()==Param::TYPE_REAL)
+ {
+ origin=param.get_real();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListInsert::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListInsert::perform()
+{
+ if(index>value_node->link_count())
+ index=value_node->link_count();
+
+ value_node->add(list_entry,index);
+ assert(list_entry.value_node.rcount()>=2);
+
+ // Signal that a layer has been inserted
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
+
+void
+Action::ValueNodeDynamicListInsert::undo()
+{
+ assert(list_entry.value_node.rcount()>=2);
+ value_node->erase((value_node->list.begin()+index)->value_node);
+ assert(list_entry.value_node.rcount()>=1);
+
+ // Signal that a layer has been inserted
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistinsert.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistinsert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTINSERT_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTINSERT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListInsert :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ synfig::ValueNode_BLine::Handle value_node_bline;
+ synfig::ValueNode_DynamicList::ListEntry list_entry;
+ synfig::ValueNode::Handle item;
+ synfig::Time time;
+ synfig::Real origin;
+ int index;
+
+
+public:
+
+ ValueNodeDynamicListInsert();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistinsertsmart.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistinsertsmart.cpp,v 1.3 2005/01/17 05:20:08 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistinsertsmart.h"
+#include "valuenodedynamiclistinsert.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListInsertSmart);
+ACTION_SET_NAME(Action::ValueNodeDynamicListInsertSmart,"value_node_dynamic_list_insert_smart");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListInsertSmart,"Insert Item (Smart)");
+ACTION_SET_TASK(Action::ValueNodeDynamicListInsertSmart,"insert");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListInsertSmart,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListInsertSmart,-20);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListInsertSmart,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListInsertSmart,"$Id: valuenodedynamiclistinsertsmart.cpp,v 1.3 2005/01/17 05:20:08 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListInsertSmart::ValueNodeDynamicListInsertSmart()
+{
+ index=0;
+ time=0;
+ origin=0.5f;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListInsertSmart::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+ ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
+ .set_local_name(_("Origin"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListInsertSmart::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListInsertSmart::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+ if(name=="origin" && param.get_type()==Param::TYPE_REAL)
+ {
+ origin=param.get_real();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListInsertSmart::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListInsertSmart::prepare()
+{
+ //clear();
+ // HACK
+ if(!first_time())
+ return;
+
+ // If we are in animate editing mode
+ if(get_edit_mode()&MODE_ANIMATE)
+ {
+ int index(ValueNodeDynamicListInsertSmart::index);
+
+ // In this case we need to first determine if there is
+ // a currently disabled item in the list that we can
+ // turn on. If not, then we need to go ahead and create one.
+ synfig::info("ValueNodeDynamicListInsertSmart: index=%d",index);
+ synfig::info("ValueNodeDynamicListInsertSmart: value_node->list.size()=%d",value_node->list.size());
+ if(value_node->list.size()<=index && index>0)
+ synfig::info("ValueNodeDynamicListInsertSmart: value_node->list[index-1].status_at_time(time)=%d",value_node->list[index-1].status_at_time(time));
+
+ if(value_node->list.size()>=index && index>0 && !value_node->list[index-1].status_at_time(time))
+ {
+ // Ok, we do not have to create a new
+ // entry in the dynamic list after all.
+ // However, we do need to set the
+ // position and tangent of this point.
+ ValueNode_DynamicList::ListEntry list_entry(value_node->create_list_entry(index,time,origin));
+ ValueBase value((*list_entry.value_node)(time));
+ index--;
+
+ ValueDesc item_value_desc(value_node,index);
+
+ Action::Handle action(Action::create("value_desc_set"));
+
+ if(!action)
+ throw Error(_("Unable to find action value_desc_set (bug)"));
+
+ action->set_param("edit_mode",get_edit_mode());
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("new_value",value);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ else
+ {
+ // Ok, not a big deal, we just need to
+ // add a new item
+ Action::Handle action(Action::create("value_node_dynamic_list_insert"));
+
+ if(!action)
+ throw Error(_("Unable to find action (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+ action=Action::create("activepoint_set_off");
+
+ if(!action)
+ throw Error(_("Unable to find action \"activepoint_set_off\""));
+
+ action->set_param("edit_mode",MODE_ANIMATE);
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",Time::begin());
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+
+ // Now we set the activepoint up and then we'll be done
+ Action::Handle action(Action::create("activepoint_set_on"));
+
+ if(!action)
+ throw Error(_("Unable to find action \"activepoint_set_on\""));
+
+ action->set_param("edit_mode",get_edit_mode());
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ else
+ {
+ Action::Handle action(Action::create("value_node_dynamic_list_insert"));
+
+ if(!action)
+ throw Error(_("Unable to find action (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistinsertsmart.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistinsertsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTINSERTSMART_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTINSERTSMART_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListInsertSmart :
+ public Super
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ synfig::Time time;
+ synfig::Real origin;
+ int index;
+
+
+public:
+
+ ValueNodeDynamicListInsertSmart();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistloop.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistloop.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListLoop);
+ACTION_SET_NAME(Action::ValueNodeDynamicListLoop,"value_node_dynamic_list_loop");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListLoop,"Loop");
+ACTION_SET_TASK(Action::ValueNodeDynamicListLoop,"loop");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListLoop,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListLoop,0);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListLoop,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListLoop,"$Id: valuenodedynamiclistloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListLoop::ValueNodeDynamicListLoop()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListLoop::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListLoop::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueNode::Handle value_node(x.find("value_node")->second.get_value_node());
+ if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ return false;
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==true)
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListLoop::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node());
+
+ if(!value_node)
+ return false;
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListLoop::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListLoop::perform()
+{
+ old_loop_value=value_node->get_loop();
+
+ if(old_loop_value==true)
+ {
+ set_dirty(false);
+ return;
+ }
+ set_dirty(true);
+ value_node->set_loop(true);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
+
+void
+Action::ValueNodeDynamicListLoop::undo()
+{
+ if(old_loop_value==value_node->get_loop())
+ {
+ set_dirty(false);
+ return;
+ }
+ set_dirty(true);
+ value_node->set_loop(old_loop_value);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistloop.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistloop.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTLOOP_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTLOOP_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListLoop :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ bool old_loop_value;
+
+
+public:
+
+ ValueNodeDynamicListLoop();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistremove.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListRemove);
+ACTION_SET_NAME(Action::ValueNodeDynamicListRemove,"value_node_dynamic_list_remove");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRemove,"Remove Item");
+ACTION_SET_TASK(Action::ValueNodeDynamicListRemove,"remove");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRemove,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE|Action::CATEGORY_HIDDEN);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRemove,-19);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListRemove,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRemove,"$Id: valuenodedynamiclistremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListRemove::ValueNodeDynamicListRemove()
+{
+ index=0;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListRemove::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListRemove::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListRemove::perform()
+{
+ if(index>=value_node->link_count())
+ index=value_node->link_count()-1;
+
+ list_entry=value_node->list[index];
+ value_node->erase((value_node->list.begin()+index)->value_node);
+
+ // Signal that a layer has been inserted
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
+
+void
+Action::ValueNodeDynamicListRemove::undo()
+{
+ value_node->add(list_entry,index);
+
+ // Signal that a layer has been inserted
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistremove.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTREMOVE_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ synfig::ValueNode_DynamicList::ListEntry list_entry;
+ int index;
+
+
+public:
+
+ ValueNodeDynamicListRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistremovesmart.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistremovesmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistremovesmart.h"
+#include "valuenodedynamiclistremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListRemoveSmart);
+ACTION_SET_NAME(Action::ValueNodeDynamicListRemoveSmart,"value_node_dynamic_list_remove_smart");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRemoveSmart,"Remove Item (Smart)");
+ACTION_SET_TASK(Action::ValueNodeDynamicListRemoveSmart,"remove");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRemoveSmart,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRemoveSmart,-19);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListRemoveSmart,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRemoveSmart,"$Id: valuenodedynamiclistremovesmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListRemoveSmart::ValueNodeDynamicListRemoveSmart()
+{
+ index=0;
+ time=0;
+ origin=0.5f;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListRemoveSmart::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+ ret.push_back(ParamDesc("origin",Param::TYPE_REAL)
+ .set_local_name(_("Origin"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListRemoveSmart::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListRemoveSmart::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+ if(name=="origin" && param.get_type()==Param::TYPE_REAL)
+ {
+ origin=param.get_real();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListRemoveSmart::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListRemoveSmart::prepare()
+{
+ clear();
+
+ // If we are in animate editing mode
+ if(get_edit_mode()&MODE_ANIMATE)
+ {
+ Action::Handle action(Action::create("activepoint_set_off"));
+
+ if(!action)
+ throw Error(_("Unable to find action (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ else
+ {
+ Action::Handle action(Action::create("value_node_dynamic_list_remove"));
+
+ if(!action)
+ throw Error(_("Unable to find action (bug)"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("time",time);
+ action->set_param("origin",origin);
+ action->set_param("value_desc",ValueDesc(value_node,index));
+
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistremovesmart.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistremovesmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTREMOVESMART_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTREMOVESMART_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListRemoveSmart :
+ public Super
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ synfig::Time time;
+ synfig::Real origin;
+ int index;
+
+
+public:
+
+ ValueNodeDynamicListRemoveSmart();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistinsert.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistrotateorder.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistrotateorder.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListRotateOrder);
+ACTION_SET_NAME(Action::ValueNodeDynamicListRotateOrder,"value_node_dynamic_list_rotate_order");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListRotateOrder,"Rotate Order");
+ACTION_SET_TASK(Action::ValueNodeDynamicListRotateOrder,"rotate");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListRotateOrder,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListRotateOrder,0);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListRotateOrder,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListRotateOrder,"$Id: valuenodedynamiclistrotateorder.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListRotateOrder::ValueNodeDynamicListRotateOrder()
+{
+ index=0;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListRotateOrder::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+ .set_local_name(_("ValueDesc"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListRotateOrder::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+ if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListRotateOrder::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+ {
+ ValueDesc value_desc(param.get_value_desc());
+
+ if(!value_desc.parent_is_value_node())
+ return false;
+
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
+
+ if(!value_node)
+ return false;
+
+ index=value_desc.get_index();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListRotateOrder::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListRotateOrder::prepare()
+{
+ clear();
+
+ for(int i(0);i<(value_node->link_count()-index)%value_node->link_count();++i)
+ {
+ ValueDesc value_desc(value_node,value_node->link_count()-1-i);
+ ValueNode::Handle child(value_desc.get_value_node());
+
+
+ Action::Handle action(Action::create("value_node_dynamic_list_remove"));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,value_node->link_count()-1));
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+
+ action=Action::create("value_node_dynamic_list_insert");
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",ValueDesc(value_node,0));
+ action->set_param("item",child);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+
+
+
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistrotateorder.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistrotateorder.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTROTATEORDER_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTROTATEORDER_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListRotateOrder :
+ public Super
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ int index;
+
+
+public:
+
+ ValueNodeDynamicListRotateOrder();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistunloop.cpp
+** \brief Template File
+**
+** $Id: valuenodedynamiclistunloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodedynamiclistunloop.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeDynamicListUnLoop);
+ACTION_SET_NAME(Action::ValueNodeDynamicListUnLoop,"value_node_dynamic_list_unloop");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeDynamicListUnLoop,"Unloop");
+ACTION_SET_TASK(Action::ValueNodeDynamicListUnLoop,"unloop");
+ACTION_SET_CATEGORY(Action::ValueNodeDynamicListUnLoop,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeDynamicListUnLoop,0);
+ACTION_SET_VERSION(Action::ValueNodeDynamicListUnLoop,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeDynamicListUnLoop,"$Id: valuenodedynamiclistunloop.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeDynamicListUnLoop::ValueNodeDynamicListUnLoop()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeDynamicListUnLoop::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeDynamicListUnLoop::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueNode::Handle value_node(x.find("value_node")->second.get_value_node());
+ if(!ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ return false;
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)->get_loop()==false)
+ return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeDynamicListUnLoop::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_DynamicList::Handle::cast_dynamic(param.get_value_node());
+
+ if(!value_node)
+ return false;
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeDynamicListUnLoop::is_ready()const
+{
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeDynamicListUnLoop::perform()
+{
+ old_loop_value=value_node->get_loop();
+
+ if(old_loop_value==false)
+ {
+ set_dirty(false);
+ return;
+ }
+
+ set_dirty(true);
+ value_node->set_loop(false);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
+
+void
+Action::ValueNodeDynamicListUnLoop::undo()
+{
+ if(old_loop_value==value_node->get_loop())
+ {
+ set_dirty(false);
+ return;
+ }
+
+ set_dirty(true);
+ value_node->set_loop(old_loop_value);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodedynamiclistunloop.h
+** \brief Template File
+**
+** $Id: valuenodedynamiclistunloop.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTUNLOOP_H
+#define __SYNFIG_APP_ACTION_VALUENODEDYNAMICLISTUNLOOP_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/activepoint.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/valuenode_bline.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeDynamicListUnLoop :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_DynamicList::Handle value_node;
+ bool old_loop_value;
+
+
+public:
+
+ ValueNodeDynamicListUnLoop();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodelinkconnect.cpp
+** \brief Template File
+**
+** $Id: valuenodelinkconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodelinkconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeLinkConnect);
+ACTION_SET_NAME(Action::ValueNodeLinkConnect,"value_node_link_connect");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeLinkConnect,_("Connect ValueNode Link"));
+ACTION_SET_TASK(Action::ValueNodeLinkConnect,"connect");
+ACTION_SET_CATEGORY(Action::ValueNodeLinkConnect,Action::CATEGORY_LAYER|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeLinkConnect,0);
+ACTION_SET_VERSION(Action::ValueNodeLinkConnect,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeLinkConnect,"$Id: valuenodelinkconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeLinkConnect::ValueNodeLinkConnect():
+ index(-1) // Initially set it to negative one so that we know when it has changed
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeLinkConnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Parent ValueNode"))
+ );
+
+ ret.push_back(ParamDesc("index",Param::TYPE_INTEGER)
+ .set_local_name(_("Index"))
+ );
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode to be connected"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeLinkConnect::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueNodeLinkConnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ parent_value_node=LinkableValueNode::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(parent_value_node);
+ }
+
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ new_value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(name=="index" && param.get_type()==Param::TYPE_INTEGER)
+ {
+ index=param.get_integer();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeLinkConnect::is_ready()const
+{
+ if(!new_value_node || !parent_value_node || index==-1)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeLinkConnect::perform()
+{
+ if(parent_value_node->link_count()<=index)
+ throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
+
+ old_value_node=parent_value_node->get_link(index);
+
+ if(!parent_value_node->set_link(index,new_value_node))
+ throw Error(_("Parent would not accept link"));
+
+ /*set_dirty(true);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
+
+void
+Action::ValueNodeLinkConnect::undo()
+{
+ if(parent_value_node->link_count()<=index)
+ throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
+
+ if(!parent_value_node->set_link(index,old_value_node))
+ throw Error(_("Parent would not accept old link"));
+
+ /*set_dirty(true);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodelinkconnect.h
+** \brief Template File
+**
+** $Id: valuenodelinkconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODELINKCONNECT_H
+#define __SYNFIG_APP_ACTION_VALUENODELINKCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeLinkConnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::LinkableValueNode::Handle parent_value_node;
+ synfig::ValueNode::Handle new_value_node;
+ synfig::ValueNode::Handle old_value_node;
+ int index;
+
+
+public:
+
+ ValueNodeLinkConnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodelinkdisconnect.cpp
+** \brief Template File
+**
+** $Id: valuenodelinkdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodelinkdisconnect.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeLinkDisconnect);
+ACTION_SET_NAME(Action::ValueNodeLinkDisconnect,"value_node_link_disconnect");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeLinkDisconnect,_("Disconnect ValueNode Link"));
+ACTION_SET_TASK(Action::ValueNodeLinkDisconnect,"disconnect");
+ACTION_SET_CATEGORY(Action::ValueNodeLinkDisconnect,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeLinkDisconnect,0);
+ACTION_SET_VERSION(Action::ValueNodeLinkDisconnect,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeLinkDisconnect,"$Id: valuenodelinkdisconnect.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeLinkDisconnect::ValueNodeLinkDisconnect():
+ index(-1), // Initially set it to negative one so that we know when it has changed
+ time(0)
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeLinkDisconnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Parent ValueNode"))
+ );
+
+ ret.push_back(ParamDesc("index",Param::TYPE_INTEGER)
+ .set_local_name(_("Index"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeLinkDisconnect::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueNodeLinkDisconnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ parent_value_node=LinkableValueNode::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(parent_value_node);
+ }
+
+ if(name=="index" && param.get_type()==Param::TYPE_INTEGER)
+ {
+ index=param.get_integer();
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeLinkDisconnect::is_ready()const
+{
+ if(!parent_value_node || index==-1)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeLinkDisconnect::perform()
+{
+ if(parent_value_node->link_count()<=index)
+ throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
+
+ old_value_node=parent_value_node->get_link(index);
+
+ if(!parent_value_node->set_link(index,ValueNode_Const::create((*old_value_node)(time))))
+ throw Error(_("Parent would not accept link"));
+
+ /*
+ if(get_canvas()->get_time()!=time)
+ set_dirty(true);
+ else
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }
+ */
+}
+
+void
+Action::ValueNodeLinkDisconnect::undo()
+{
+ if(parent_value_node->link_count()<=index)
+ throw Error(_("Bad index, too big. LinkCount=%d, Index=%d"),parent_value_node->link_count(),index);
+
+ if(!parent_value_node->set_link(index,old_value_node))
+ throw Error(_("Parent would not accept old link"));
+
+ /*if(get_canvas()->get_time()!=time)
+ set_dirty(true);
+ else
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodelinkdisconnect.h
+** \brief Template File
+**
+** $Id: valuenodelinkdisconnect.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODELINKDISCONNECT_H
+#define __SYNFIG_APP_ACTION_VALUENODELINKDISCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeLinkDisconnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::LinkableValueNode::Handle parent_value_node;
+ int index;
+ synfig::ValueNode::Handle old_value_node;
+ synfig::Time time;
+
+public:
+
+ ValueNodeLinkDisconnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenoderemove.cpp
+** \brief Template File
+**
+** $Id: valuenoderemove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenoderemove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeRemove);
+ACTION_SET_NAME(Action::ValueNodeRemove,"value_node_remove");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeRemove,_("Unexport"));
+ACTION_SET_TASK(Action::ValueNodeRemove,"remove");
+ACTION_SET_CATEGORY(Action::ValueNodeRemove,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeRemove,0);
+ACTION_SET_VERSION(Action::ValueNodeRemove,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeRemove,"$Id: valuenoderemove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeRemove::ValueNodeRemove()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeRemove::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ ValueNode::Handle value_node=x.find("value_node")->second.get_value_node();
+ if(!value_node->is_exported())
+ return false;
+// if(value_node->rcount()!=1)
+// return false;
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=param.get_value_node();
+
+ if(value_node && !value_node->is_exported())
+ {
+ synfig::error("Action::ValueNodeRemove::set_param(): ValueBase node not exported!");
+ value_node=0;
+ }
+
+ return (bool)value_node;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeRemove::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Action::ValueNodeRemove::is_ready(): ValueNode not set!");
+
+ if(!value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeRemove::perform()
+{
+// if(value_node->rcount()!=1)
+// throw Error(_("ValueNode is still being used by something"));
+
+ old_name=value_node->get_id();
+ parent_canvas=value_node->get_parent_canvas();
+ parent_canvas->remove_value_node(value_node);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_deleted()(value_node);
+ }
+
+ //throw Error(_("Not yet implemented"));
+/*
+ assert(value_node->is_exported());
+
+ if(get_canvas()->value_node_list().count(new_name))
+ throw Error(_("A ValueNode with this ID already exists in this canvas"));
+
+ old_name=value_node->get_id();
+
+ value_node->set_id(new_name);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+*/
+}
+
+void
+Action::ValueNodeRemove::undo()
+{
+ parent_canvas->add_value_node(value_node,old_name);
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_added()(value_node);
+ }
+
+ //throw Error(_("Not yet implemented"));
+/*
+ assert(value_node->is_exported());
+
+ if(get_canvas()->value_node_list().count(old_name))
+ throw Error(_("A ValueNode with the old ID already exists in this canvas (BUG)"));
+
+ value_node->set_id(old_name);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenoderemove.h
+** \brief Template File
+**
+** $Id: valuenoderemove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEREMOVE_H
+#define __SYNFIG_APP_ACTION_VALUENODEREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode_const.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode::Handle value_node;
+ synfig::Canvas::Handle parent_canvas;
+ synfig::String new_name;
+ synfig::String old_name;
+
+
+public:
+
+ ValueNodeRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenoderename.cpp
+** \brief Template File
+**
+** $Id: valuenoderename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenoderename.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeRename);
+ACTION_SET_NAME(Action::ValueNodeRename,"value_node_rename");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeRename,_("Rename ValueNode"));
+ACTION_SET_TASK(Action::ValueNodeRename,"rename");
+ACTION_SET_CATEGORY(Action::ValueNodeRename,Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeRename,0);
+ACTION_SET_VERSION(Action::ValueNodeRename,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeRename,"$Id: valuenoderename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeRename::ValueNodeRename()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeRename::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode_Const"))
+ );
+
+ ret.push_back(ParamDesc("name",Param::TYPE_STRING)
+ .set_local_name(_("Name"))
+ .set_desc(_("The new name of the ValueNode"))
+ .set_user_supplied()
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeRename::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ if(x.find("value_node")->second.get_value_node()->is_exported())
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::ValueNodeRename::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=param.get_value_node();
+
+ if(value_node && !value_node->is_exported())
+ {
+ synfig::error("Action::ValueNodeRename::set_param(): ValueBase node not exported!");
+ value_node=0;
+ }
+
+ return (bool)value_node;
+ }
+
+ if(name=="name" && param.get_type()==Param::TYPE_STRING)
+ {
+ new_name=param.get_string();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeRename::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Action::ValueNodeRename::is_ready(): ValueNode not set!");
+
+ if(new_name.empty())
+ synfig::error("Action::ValueNodeRename::is_ready(): ValueNode not set!");
+
+ if(!value_node || new_name.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeRename::perform()
+{
+ assert(value_node->is_exported());
+
+ if(get_canvas()->value_node_list().count(new_name))
+ throw Error(_("A ValueNode with this ID already exists in this canvas"));
+
+ old_name=value_node->get_id();
+
+ value_node->set_id(new_name);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+}
+
+void
+Action::ValueNodeRename::undo()
+{
+ assert(value_node->is_exported());
+
+ if(get_canvas()->value_node_list().count(old_name))
+ throw Error(_("A ValueNode with the old ID already exists in this canvas (BUG)"));
+
+ value_node->set_id(old_name);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenoderename.h
+** \brief Template File
+**
+** $Id: valuenoderename.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODERENAME_H
+#define __SYNFIG_APP_ACTION_VALUENODERENAME_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode_const.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeRename :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode::Handle value_node;
+ synfig::String new_name;
+ synfig::String old_name;
+
+
+public:
+
+ ValueNodeRename();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodereplace.cpp
+** \brief Template File
+**
+** $Id: valuenodereplace.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "valuenodereplace.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeReplace);
+ACTION_SET_NAME(Action::ValueNodeReplace,"value_node_replace");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeReplace,"Replace ValueNode");
+ACTION_SET_TASK(Action::ValueNodeReplace,"replace");
+ACTION_SET_CATEGORY(Action::ValueNodeReplace,Action::CATEGORY_VALUENODE|Action::CATEGORY_DRAG);
+ACTION_SET_PRIORITY(Action::ValueNodeReplace,0);
+ACTION_SET_VERSION(Action::ValueNodeReplace,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeReplace,"$Id: valuenodereplace.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+void swap_guid(const ValueNode::Handle& a,const ValueNode::Handle& b)
+{
+ GUID old_a(a->get_guid());
+ a->set_guid(GUID());
+
+ GUID old_b(b->get_guid());
+ b->set_guid(GUID());
+
+ a->set_guid(old_b);
+ b->set_guid(old_a);
+}
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeReplace::ValueNodeReplace():
+ is_undoable(true)
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeReplace::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("dest",Param::TYPE_VALUENODE)
+ .set_local_name(_("Destination ValueNode"))
+ .set_desc(_("ValueNode to replaced"))
+ );
+
+ ret.push_back(ParamDesc("src",Param::TYPE_VALUENODE)
+ .set_local_name(_("Source ValueNode"))
+ .set_desc(_("ValueNode that will replace the destination"))
+ );
+
+ return ret;
+}
+
+bool
+Action::ValueNodeReplace::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::ValueNodeReplace::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="dest" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ dest_value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(name=="src" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ src_value_node=param.get_value_node();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeReplace::is_ready()const
+{
+ if(!dest_value_node || !src_value_node)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeReplace::perform()
+{
+ set_dirty(true);
+
+ if(dest_value_node == src_value_node)
+ throw Error(_("Attempted to replace valuenode with itself"));
+
+ if(dest_value_node->get_type() != src_value_node->get_type())
+ throw Error(_("You cannot replace ValueNodes with different types!"));
+
+ is_undoable=true;
+
+ if(!src_value_node->is_exported())
+ {
+ src_value_node->set_id(dest_value_node->get_id());
+ src_value_node->set_parent_canvas(dest_value_node->get_parent_canvas());
+
+ ValueNode::RHandle value_node(src_value_node);
+
+ if(!value_node.runique() && value_node.rcount()>1)
+ is_undoable=false; // !!!
+ }
+ else
+ is_undoable=false; // !!!
+
+ if(!is_undoable)
+ synfig::warning("ValueNodeReplace: Circumstances make undoing this action impossible at the current time. :(");
+
+ ValueNode::RHandle value_node(dest_value_node);
+
+ if(value_node.runique() || value_node.rcount()<=1)
+ throw Error(_("Nothing to replace."));
+
+ int replacements;
+
+ replacements=value_node->replace(src_value_node);
+ assert(replacements);
+ if(!replacements)
+ throw Error(_("Action Failure. This is a bug. Please report it."));
+ swap_guid(dest_value_node,src_value_node);
+
+ //src_value_node->parent_set.swap(dest_value_node->parent_set);
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_replaced()(dest_value_node,src_value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+}
+
+void
+Action::ValueNodeReplace::undo()
+{
+ if(!is_undoable)
+ throw Error(_("This action cannot be undone under these circumstances."));
+
+ set_dirty(true);
+
+ if(dest_value_node == src_value_node)
+ throw Error(_("Attempted to replace valuenode with itself"));
+
+ if(dest_value_node->get_type() != src_value_node->get_type())
+ throw Error(_("You cannot replace ValueNodes with different types!"));
+
+ ValueNode::RHandle value_node(src_value_node);
+
+ if(value_node.runique() || value_node.rcount()<=1)
+ throw Error(_("Nothing to replace."));
+
+ int replacements;
+
+ replacements=value_node->replace(dest_value_node);
+ assert(replacements);
+ if(!replacements)
+ throw Error(_("Action Failure. This is a bug. Please report it."));
+ swap_guid(dest_value_node,src_value_node);
+
+ //src_value_node->parent_set.swap(dest_value_node->parent_set);
+
+ synfig::info(get_name()+_(": (Undo) ")+strprintf("Replaced %d ValueNode instances",replacements));
+
+ src_value_node->set_id(String());
+ src_value_node->set_parent_canvas(0);
+
+ // Signal that a layer has been inserted
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_replaced()(src_value_node,dest_value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");
+
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodereplace.h
+** \brief Template File
+**
+** $Id: valuenodereplace.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODEREPLACE_H
+#define __SYNFIG_APP_ACTION_VALUENODEREPLACE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeReplace :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode::Handle src_value_node;
+ synfig::ValueNode::Handle dest_value_node;
+ bool is_undoable;
+
+public:
+
+ ValueNodeReplace();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointadd.cpp
+** \brief Template File
+**
+** $Id: waypointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointadd.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfigapp/main.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointAdd);
+ACTION_SET_NAME(Action::WaypointAdd,"waypoint_add");
+ACTION_SET_LOCAL_NAME(Action::WaypointAdd,"Add Waypoint");
+ACTION_SET_TASK(Action::WaypointAdd,"add");
+ACTION_SET_CATEGORY(Action::WaypointAdd,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointAdd,0);
+ACTION_SET_VERSION(Action::WaypointAdd,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointAdd,"$Id: waypointadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointAdd::WaypointAdd()
+{
+ waypoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::WaypointAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Destination ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
+ .set_local_name(_("New Waypoint"))
+ .set_desc(_("Waypoint to be added"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_desc(_("Time where waypoint is to be added"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointAdd::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
+ return false;
+
+ // We need either a waypoint or a time.
+ if(x.count("waypoint") || x.count("time"))
+ return true;
+ }
+ return false;
+}
+
+bool
+Action::WaypointAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+ if(time_set)
+ calc_waypoint();
+
+ return static_cast<bool>(value_node);
+ }
+ if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
+ {
+ waypoint=param.get_waypoint();
+
+ return true;
+ }
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==Time::begin()-1)
+ {
+ waypoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_waypoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointAdd::is_ready()const
+{
+ if(!value_node || waypoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a waypoint. In this case, we need to calculate the value
+// of the waypoint
+void
+Action::WaypointAdd::calc_waypoint()
+{
+ Time time=waypoint.get_time();
+ Waypoint original(waypoint);
+ waypoint=value_node->new_waypoint_at_time(time);
+ waypoint.mimic(original);
+ waypoint.set_before(synfigapp::Main::get_interpolation());
+ waypoint.set_after(synfigapp::Main::get_interpolation());
+
+/*
+ ValueNode_Animated::WaypointList &waypoint_list(value_node->waypoint_list());
+ ValueNode_Animated::WaypointList::iterator iter;
+
+ if(waypoint_list.empty())
+ {
+ waypoint.set_value((*value_node)(time));
+ return;
+ }
+
+ ValueNode_Animated::WaypointList::iterator closest=waypoint_list.begin();
+
+ for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter)
+ {
+ const Real dist(abs(iter->get_time()-time));
+ if(dist<abs(closest->get_time()-time))
+ closest=iter;
+ }
+ if(!closest->is_static())
+ waypoint.set_value_node(closest->get_value_node());
+ else
+ waypoint.set_value((*value_node)(time));
+ */
+}
+
+void
+Action::WaypointAdd::perform()
+{
+ try { value_node->find(waypoint.get_time()); throw Error(_("A Waypoint already exists at this point in time (%s)"),waypoint.get_time().get_string().c_str());}
+ catch(synfig::Exception::NotFound) { }
+
+ try { if(value_node->find(waypoint)!=value_node->waypoint_list().end()) throw Error(_("This waypoint is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+
+ value_node->add(waypoint);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
+
+void
+Action::WaypointAdd::undo()
+{
+ value_node->erase(waypoint);
+
+ value_node->changed();
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointadd.h
+** \brief Template File
+**
+** $Id: waypointadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTADD_H
+#define __SYNFIG_APP_ACTION_WAYPOINTADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/waypoint.h>
+#include <synfig/valuenode_animated.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::Waypoint waypoint;
+
+ bool time_overwrite;
+ synfig::Waypoint overwritten_wp;
+
+ synfig::ValueNode_Animated::Handle value_node;
+ bool time_set;
+
+ void calc_waypoint();
+
+public:
+
+ WaypointAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointremove.cpp
+** \brief Template File
+**
+** $Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointremove.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointRemove);
+ACTION_SET_NAME(Action::WaypointRemove,"waypoint_remove");
+ACTION_SET_LOCAL_NAME(Action::WaypointRemove,"Remove Waypoint");
+ACTION_SET_TASK(Action::WaypointRemove,"remove");
+ACTION_SET_CATEGORY(Action::WaypointRemove,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointRemove,0);
+ACTION_SET_VERSION(Action::WaypointRemove,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointRemove,"$Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointRemove::WaypointRemove()
+{
+ waypoint.set_time(Time::begin()-1);
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::WaypointRemove::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
+ .set_local_name(_("Waypoint"))
+ .set_desc(_("Waypoint to be Removed"))
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointRemove::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::WaypointRemove::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(value_node);
+ }
+ if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
+ {
+ waypoint=param.get_waypoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointRemove::is_ready()const
+{
+ if(!value_node || waypoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::WaypointRemove::perform()
+{
+ WaypointList::iterator iter(value_node->find(waypoint));
+
+ if((UniqueID)*iter!=(UniqueID)waypoint)
+ throw Error(_("UniqueID mismatch, iter=%d, waypoint=%d"),iter->get_uid(),waypoint.get_uid());
+
+ if(iter->get_time()!=waypoint.get_time())
+ throw Error(_("Time mismatch iter=%s, waypoint=%s"),iter->get_time().get_string().c_str(),waypoint.get_time().get_string().c_str());
+
+ waypoint=*iter;
+
+ value_node->erase(waypoint);
+
+ // In this case, we need to convert this to a
+ // constant value node
+ if(value_node->waypoint_list().size()==0)
+ {
+ if(!value_node_ref)
+ {
+ value_node_ref=waypoint.get_value_node();
+ if(!value_node_ref)
+ throw Error(_("Unable to create ValueNode_Reference"));
+ }
+
+ value_node->replace(value_node_ref);
+ value_node->waypoint_list().clear();
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_replaced()(value_node,value_node_ref);
+ }
+ }
+
+ value_node->changed();
+}
+
+void
+Action::WaypointRemove::undo()
+{
+ if(value_node_ref)
+ {
+ if(value_node->waypoint_list().size()!=0)
+ throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (1)"));
+
+ value_node_ref->replace(value_node);
+
+ waypoint.set_value_node(value_node_ref);
+
+ if(get_canvas_interface())
+ get_canvas_interface()->signal_value_node_replaced()(value_node_ref,value_node);
+
+ if(value_node->waypoint_list().size()!=0)
+ throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (2)"));
+ }
+
+ if(value_node->waypoint_list().size()!=0)
+ {
+ try { value_node->find(waypoint.get_time()); throw Error(_("A Waypoint already exists at this point in time"));}
+ catch(synfig::Exception::NotFound) { }
+
+ try { if(value_node->find(waypoint)!=value_node->waypoint_list().end()) throw Error(_("This waypoint is already in the ValueNode"));}
+ catch(synfig::Exception::NotFound) { }
+ }
+
+ value_node->add(waypoint);
+
+/*_if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(value_node);
+ }
+ else synfig::warning("CanvasInterface not set on action");*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointremove.h
+** \brief Template File
+**
+** $Id: waypointremove.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTREMOVE_H
+#define __SYNFIG_APP_ACTION_WAYPOINTREMOVE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/waypoint.h>
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_reference.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointRemove :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Animated::Handle value_node;
+ synfig::ValueNode::Handle value_node_ref;
+ synfig::Waypoint waypoint;
+
+public:
+
+ WaypointRemove();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointset.cpp
+** \brief Template File
+**
+** $Id: waypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointset.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointSet);
+ACTION_SET_NAME(Action::WaypointSet,"waypoint_set");
+ACTION_SET_LOCAL_NAME(Action::WaypointSet,"Set Waypoint");
+ACTION_SET_TASK(Action::WaypointSet,"set");
+ACTION_SET_CATEGORY(Action::WaypointSet,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointSet,0);
+ACTION_SET_VERSION(Action::WaypointSet,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointSet,"$Id: waypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointSet::WaypointSet()
+{
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::WaypointSet::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Destination ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
+ .set_local_name(_("Waypoint"))
+ .set_desc(_("Waypoint to be changed"))
+ .set_supports_multiple()
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointSet::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::WaypointSet::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(value_node);
+ }
+ if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
+ {
+ //NOTE: at the moment there is no error checking for multiple sets!!!
+ waypoints.push_back(param.get_waypoint());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointSet::is_ready()const
+{
+ if(!value_node || waypoints.empty())
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::WaypointSet::perform()
+{
+ WaypointList::iterator iter;
+
+#if 1
+ vector<WaypointList::iterator> iters;
+ vector<Waypoint>::iterator i = waypoints.begin(), end = waypoints.end();
+
+ for(; i != end; ++i)
+ {
+ try { iters.push_back(value_node->find(*i)); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find waypoint"));
+ }
+ }
+
+ //check to see which valuenodes are going to override because of the time...
+ ValueNode_Animated::findresult timeiter;
+
+ for(i = waypoints.begin(); i != end; ++i)
+ {
+ timeiter = value_node->find_time(i->get_time());
+
+ bool candelete = timeiter.second;
+
+ //we only want to track overwrites (not waypoints that are also being modified)
+ if(candelete)
+ {
+ for(vector<WaypointList::iterator>::iterator ii = iters.begin(); ii != iters.end(); ++ii)
+ {
+ if(timeiter.first == *ii)
+ {
+ candelete = false;
+ break;
+ }
+ }
+ }
+
+ //if we can still delete it after checking, record it, and then remove them all later
+ if(candelete)
+ {
+ Waypoint w = *timeiter.first;
+ overwritten_waypoints.push_back(w);
+ }
+ }
+
+ //overwrite all the valuenodes we're supposed to set
+ {
+ i = waypoints.begin();
+ for(vector<WaypointList::iterator>::iterator ii = iters.begin(); ii != iters.end() && i != end; ++ii, ++i)
+ {
+ old_waypoints.push_back(**ii);
+ **ii = *i; //set the point to the corresponding point in the normal waypoint list
+ }
+ }
+
+ //remove all the points we're supposed to be overwritting
+ {
+ vector<Waypoint>::iterator oi = overwritten_waypoints.begin(),
+ oend = overwritten_waypoints.end();
+ for(; oi != oend; ++oi)
+ {
+ value_node->erase(*oi);
+ }
+ }
+
+#else
+ try { iter=value_node->find(waypoint); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find waypoint"));
+ }
+
+ //find the value at the old time before we replace it
+ ValueNode_Animated::findresult timeiter;
+ timeiter = value_node->find_time(waypoint.get_time());
+
+ //we only want to track overwrites (not inplace modifications)
+ if(timeiter.second && waypoint.get_uid() == timeiter.first->get_uid())
+ {
+ timeiter.second = false;
+ }
+
+ //copy and overwrite
+ old_waypoint=*iter;
+ *iter=waypoint;
+
+ //if we've found a unique one then we need to erase it, but store it first
+ if(timeiter.second)
+ {
+ time_overwrite = true;
+ overwritten_wp = *timeiter.first;
+
+ value_node->erase(overwritten_wp);
+ }
+#endif
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
+
+void
+Action::WaypointSet::undo()
+{
+ WaypointList::iterator iter;
+
+#if 1
+ vector<Waypoint>::iterator i = old_waypoints.begin(), end = old_waypoints.end();
+
+ for(; i != end; ++i)
+ {
+ try { iter = value_node->find(*i); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find waypoint"));
+ }
+
+ //overwrite with old one
+ *iter = *i;
+ }
+
+ //add back in all the points that we removed before...
+ {
+ vector<Waypoint>::iterator oi = overwritten_waypoints.begin(),
+ oend = overwritten_waypoints.end();
+ for(; oi != oend; ++oi)
+ {
+ value_node->add(*oi);
+ }
+ }
+
+#else
+ try { iter=value_node->find(old_waypoint); }
+ catch(synfig::Exception::NotFound)
+ {
+ throw Error(_("Unable to find waypoint"));
+ }
+
+ *iter=old_waypoint;
+
+ if(time_overwrite)
+ {
+ value_node->add(overwritten_wp);
+ }
+#endif
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointset.h
+** \brief Template File
+**
+** $Id: waypointset.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTSET_H
+#define __SYNFIG_APP_ACTION_WAYPOINTSET_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/waypoint.h>
+#include <synfig/valuenode_animated.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointSet :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Animated::Handle value_node;
+
+ std::vector<synfig::Waypoint> waypoints;
+ std::vector<synfig::Waypoint> old_waypoints;
+
+ std::vector<synfig::Waypoint> overwritten_waypoints;
+
+public:
+
+ WaypointSet();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointsetsmart.cpp
+** \brief Template File
+**
+** $Id: waypointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointsetsmart.h"
+#include "valuenodelinkconnect.h"
+#include "valuenodereplace.h"
+
+#include "waypointset.h"
+#include "waypointadd.h"
+
+#include "valuedescconnect.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/exception.h>
+#include <synfigapp/main.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointSetSmart);
+ACTION_SET_NAME(Action::WaypointSetSmart,"waypoint_set_smart");
+ACTION_SET_LOCAL_NAME(Action::WaypointSetSmart,"Connect");
+ACTION_SET_TASK(Action::WaypointSetSmart,"set");
+ACTION_SET_CATEGORY(Action::WaypointSetSmart,Action::CATEGORY_WAYPOINT|Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::WaypointSetSmart,0);
+ACTION_SET_VERSION(Action::WaypointSetSmart,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointSetSmart,"$Id: waypointsetsmart.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+
+/*#ifdef DEBUGPOINT
+#undef DEBUGPOINT
+#endif
+#define DEBUGPOINT()
+*/
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointSetSmart::WaypointSetSmart()
+{
+ waypoint.set_time(Time::begin()-1);
+ time_set=false;
+ set_dirty(true);
+}
+
+Action::ParamVocab
+Action::WaypointSetSmart::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Destination ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
+ .set_local_name(_("New Waypoint"))
+ .set_desc(_("Waypoint to be added"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("waypoint_model",Param::TYPE_WAYPOINTMODEL)
+ .set_local_name(_("Waypoint Model"))
+ .set_optional()
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_desc(_("Time where waypoint is to be added"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointSetSmart::is_canidate(const ParamList &x)
+{
+ if(canidate_check(get_param_vocab(),x))
+ {
+ if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
+ return false;
+ // We need either a waypoint or a time.
+ if(x.count("waypoint") || x.count("time"))
+ return true;
+ return false;
+ }
+ return false;
+}
+
+bool
+Action::WaypointSetSmart::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+ DEBUGPOINT();
+ if(time_set)
+ calc_waypoint();
+
+ return static_cast<bool>(value_node);
+ }
+ if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
+ {
+ waypoint=param.get_waypoint();
+ DEBUGPOINT();
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==(Time::begin()-1))
+ {
+ waypoint.set_time(param.get_time());
+ time_set=true;
+
+ if(value_node)
+ calc_waypoint();
+ DEBUGPOINT();
+
+ return true;
+ }
+
+ if(name=="model" && param.get_type()==Param::TYPE_WAYPOINTMODEL)
+ {
+ if(value_node)
+ calc_waypoint();
+
+ waypoint.apply_model(param.get_waypoint_model());
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointSetSmart::is_ready()const
+{
+ if(!value_node)
+ synfig::error("Missing value_node");
+
+ if(waypoint.get_time()==(Time::begin()-1))
+ synfig::error("Missing waypoint");
+
+ if(!value_node || waypoint.get_time()==(Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+// This function is called if a time is specified, but not
+// a waypoint. In this case, we need to calculate the value
+// of the waypoint
+void
+Action::WaypointSetSmart::calc_waypoint()
+{
+ DEBUGPOINT();
+ Time time=waypoint.get_time();
+ try
+ {
+ // Trivial case, we are sitting on a waypoint
+ waypoint=*value_node->find(waypoint.get_time());
+ }
+ catch(...)
+ {
+ waypoint=value_node->new_waypoint_at_time(time);
+ waypoint.set_before(synfigapp::Main::get_interpolation());
+ waypoint.set_after(synfigapp::Main::get_interpolation());
+ }
+/*
+ Time time=waypoint.get_time();
+ ValueNode_Animated::WaypointList &waypoint_list(value_node->waypoint_list());
+ ValueNode_Animated::WaypointList::iterator iter;
+
+ if(waypoint_list.empty())
+ {
+ waypoint.set_value((*value_node)(time));
+ return;
+ }
+
+ ValueNode_Animated::WaypointList::iterator closest=waypoint_list.begin();
+
+ for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter)
+ {
+ const Real dist(abs(iter->get_time()-time));
+ if(dist<abs(closest->get_time()-time))
+ closest=iter;
+ }
+ if(!closest->is_static())
+ waypoint.set_value_node(closest->get_value_node());
+ else
+ waypoint.set_value((*value_node)(time));
+*/
+}
+
+void
+Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& waypoint)
+{
+ times.insert(waypoint.get_time());
+
+ try {
+ times.insert(value_node->find(waypoint)->get_time());
+// synfig::info(__FILE__":%d: value_node->find(waypoint)->get_time()=%s",__LINE__,value_node->find(waypoint)->get_time().get_string().c_str());
+// DEBUGPOINT();
+ }catch (...) { }
+
+// DEBUGPOINT();
+ // First we need to to add any waypoints necessary to
+ // maintain the integrity of the keyframes.
+ if(get_edit_mode()&MODE_ANIMATE_PAST) try
+ {
+ Time curr_time(waypoint.get_time());
+
+ //while(value_node->waypoint_list().front().get_time()<=curr_time)
+ {
+ // Try to find prev keyframe
+ Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(curr_time));
+ curr_time=keyframe.get_time();
+
+// synfig::info(__FILE__":%d: prev_keyframe->time=%s",__LINE__,keyframe.get_time().get_string().c_str());
+// synfig::info(__FILE__":%d: waypoint->time=%s",__LINE__,waypoint.get_time().get_string().c_str());
+
+// DEBUGPOINT();
+ if(times.count(keyframe.get_time()))
+ {
+// DEBUGPOINT();
+ throw int();
+ }
+ if(waypoint.get_time().is_equal(keyframe.get_time()))
+ {
+// DEBUGPOINT();
+ throw int();
+ }
+
+ times.insert(keyframe.get_time());
+// DEBUGPOINT();
+ try
+ {
+ value_node->find(keyframe.get_time());
+// synfig::info(__FILE__":%d: waypointtime=%s",__LINE__,value_node->find(keyframe.get_time())->get_time().get_string().c_str());
+ }
+ catch(synfig::Exception::NotFound)
+ {
+ Action::Handle action(WaypointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+
+ if(!value_node->waypoint_list().empty())
+ {
+ action->set_param("time",keyframe.get_time());
+ }
+ else
+ {
+ synfig::Waypoint tmp;
+
+ tmp.set_value(waypoint.get_value());
+ tmp.set_time(keyframe.get_time());
+ action->set_param("waypoint",tmp);
+ }
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ }
+ }
+ catch(Error x) { throw x; }
+ catch(synfig::Exception::NotFound) { DEBUGPOINT(); }
+ catch(int) { DEBUGPOINT(); }
+ catch(...) { DEBUGPOINT(); }
+ //DEBUGPOINT();
+
+ //DEBUGPOINT();
+ if(get_edit_mode()&MODE_ANIMATE_FUTURE)try
+ {
+ Time curr_time(waypoint.get_time());
+
+ //while(value_node->waypoint_list().back().get_time()>=curr_time)
+ {
+
+ //DEBUGPOINT();
+ // Try to find next keyframe
+ //synfig::info("FUTURE waypoint.get_time()=%s",waypoint.get_time().get_string().c_str());
+ Keyframe keyframe(*get_canvas()->keyframe_list().find_next(curr_time));
+ //synfig::info("FUTURE keyframe.get_time()=%s",keyframe.get_time().get_string().c_str());
+ curr_time=keyframe.get_time();
+
+ //DEBUGPOINT();
+ if(times.count(keyframe.get_time())|| waypoint.get_time().is_equal(keyframe.get_time()))
+ throw int();
+ else
+ times.insert(keyframe.get_time());
+ //DEBUGPOINT();
+
+ try
+ {
+ value_node->find(keyframe.get_time());
+ synfig::info(__FILE__":%d: time=%s",__LINE__,keyframe.get_time().get_string().c_str());
+ synfig::info(__FILE__":%d: waypointtime=%s",__LINE__,value_node->find(keyframe.get_time())->get_time().get_string().c_str());
+
+ }
+ catch(synfig::Exception::NotFound)
+ {
+ Action::Handle action(WaypointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+
+ if(!value_node->waypoint_list().empty())
+ {
+ action->set_param("time",keyframe.get_time());
+ }
+ else
+ {
+ synfig::Waypoint tmp;
+
+ tmp.set_value(waypoint.get_value());
+ tmp.set_time(keyframe.get_time());
+ action->set_param("waypoint",tmp);
+ }
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+ }
+ }
+ //DEBUGPOINT();
+ }
+ catch(Error x) { throw x; }
+ catch(synfig::Exception::NotFound) { DEBUGPOINT(); }
+ catch(int) { DEBUGPOINT(); }
+ catch(...) { DEBUGPOINT(); }
+ //DEBUGPOINT();
+}
+
+void
+Action::WaypointSetSmart::prepare()
+{
+ //DEBUGPOINT();
+ clear();
+ times.clear();
+
+ // First we need to to add any waypoints necessary to
+ // maintain the integrity of the keyframes.
+ enclose_waypoint(waypoint);
+
+ try
+ {
+ //synfig::info("WaypointSetSmart: Move/Update?");
+ // Lets try to replace the old waypoint, if it exists
+ WaypointList::iterator iter(value_node->find(waypoint));
+
+ if(iter == value_node->waypoint_list().end())
+ throw int();
+
+ enclose_waypoint(*iter);
+
+ Action::Handle action(WaypointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+ return;
+ }
+ catch(synfig::Exception::NotFound){ } catch(int){ }
+
+ try
+ {
+ //synfig::info("WaypointSetSmart: Replace?");
+ //DEBUGPOINT();
+ // Check to see if a waypoint exists at this point in time
+ WaypointList::iterator iter=value_node->find(waypoint.get_time());
+
+ waypoint.mimic(*iter);
+
+ enclose_waypoint(*iter);
+
+ Action::Handle action(WaypointSet::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+ return;
+ }
+ catch(synfig::Exception::NotFound){ } catch(int){ }
+
+ try
+ {
+ //synfig::info("WaypointSetSmart: Add?");
+ //DEBUGPOINT();
+ // At this point we know that the old waypoint doesn't exist,
+ // so we need to create it.
+ Action::Handle action(WaypointAdd::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_node",ValueNode::Handle(value_node));
+ action->set_param("waypoint",waypoint);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action(action);
+
+ return;
+ }
+ catch(synfig::Exception::NotFound){ } catch(int){ }
+
+ throw Error(_("Unable to determine how to procede. This is a bug."));
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointsetsmart.h
+** \brief Template File
+**
+** $Id: waypointsetsmart.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTSETSMART_H
+#define __SYNFIG_APP_ACTION_WAYPOINTSETSMART_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfigapp/value_desc.h>
+#include <synfig/valuenode_animated.h>
+
+#include <list>
+#include <set>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+namespace Action {
+
+class WaypointSetSmart :
+ public Super
+{
+private:
+
+ synfig::ValueNode_Animated::Handle value_node;
+ synfig::Waypoint waypoint;
+ //synfig::WaypointModel waypoint_model;
+ bool time_set;
+
+ void calc_waypoint();
+ void enclose_waypoint(const synfig::Waypoint& waypoint);
+
+ std::set<synfig::Time> times;
+
+public:
+
+ WaypointSetSmart();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void prepare();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointsimpleadd.cpp
+** \brief Simple add waypoint File
+**
+** $Id: waypointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointsimpleadd.h"
+#include <synfigapp/canvasinterface.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointSimpleAdd);
+ACTION_SET_NAME(Action::WaypointSimpleAdd,"waypoint_simpleadd");
+ACTION_SET_LOCAL_NAME(Action::WaypointSimpleAdd,"Simply Add Waypoint");
+ACTION_SET_TASK(Action::WaypointSimpleAdd,"add");
+ACTION_SET_CATEGORY(Action::WaypointSimpleAdd,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointSimpleAdd,0);
+ACTION_SET_VERSION(Action::WaypointSimpleAdd,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointSimpleAdd,"$Id: waypointsimpleadd.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointSimpleAdd::WaypointSimpleAdd()
+{
+ set_dirty(true);
+ waypoint.set_time(Time::begin()-1);
+}
+
+Action::ParamVocab
+Action::WaypointSimpleAdd::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Destination ValueNode (Animated)"))
+ );
+
+ ret.push_back(ParamDesc("waypoint",Param::TYPE_WAYPOINT)
+ .set_local_name(_("Waypoint"))
+ .set_desc(_("Waypoint to be added"))
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointSimpleAdd::is_canidate(const ParamList &x)
+{
+ return canidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::WaypointSimpleAdd::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(value_node);
+ }
+ if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
+ {
+ waypoint = param.get_waypoint();
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointSimpleAdd::is_ready()const
+{
+ if(!value_node && waypoint.get_time() != (Time::begin()-1))
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::WaypointSimpleAdd::perform()
+{
+ //remove any pretenders that lie at our destination
+ ValueNode_Animated::findresult iter = value_node->find_time(waypoint.get_time());
+
+ time_overwrite = false;
+ if(iter.second)
+ {
+ overwritten_wp = *iter.first;
+ time_overwrite = true;
+ }
+
+ //add the value node in since it's safe
+ value_node->add(waypoint);
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
+
+void
+Action::WaypointSimpleAdd::undo()
+{
+ //remove our old version...
+ ValueNode_Animated::findresult iter = value_node->find_uid(waypoint);
+
+ if(!iter.second)
+ {
+ throw Error(_("The waypoint to remove no longer exists"));
+ }
+
+ //remove the offending value
+ value_node->erase(*iter.first); //could also just use waypoint
+
+ if(time_overwrite)
+ {
+ value_node->add(overwritten_wp);
+ }
+
+ // Signal that a valuenode has been changed
+ value_node->changed();
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointsimpleadd.h
+** \brief A simple add a waypoint function Header
+**
+** $Id: waypointsimpleadd.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_WAYPOINTSIMPLEADD_H
+#define __SYNFIG_WAYPOINTSIMPLEADD_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/waypoint.h>
+#include <synfig/valuenode_animated.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointSimpleAdd :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Animated::Handle value_node;
+
+ synfig::Waypoint waypoint;
+
+ bool time_overwrite;
+ synfig::Waypoint overwritten_wp;
+
+public:
+
+ WaypointSimpleAdd();
+
+ static ParamVocab get_param_vocab();
+ static bool is_canidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blineconvert.cpp
+** \brief Template File
+**
+** $Id: blineconvert.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "blineconvert.h"
+#include <vector>
+#include <ETL/gaussian>
+#include <ETL/hermite>
+#include <ETL/clock>
+#include <float.h>
+#include <algorithm>
+#include <synfig/general.h>
+#include <cassert>
+
+
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+
+/* === M A C R O S ========================================================= */
+
+#define EPSILON (1e-10)
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+
+//Derivative Functions for numerical approximation
+
+//bias == 0 will get F' at f3, bias < 0 will get F' at f1, and bias > 0 will get F' at f5
+template < class T >
+inline void FivePointdt(T &df, const T &f1, const T &f2, const T &f3, const T &f4, const T &f5, int bias)
+{
+ if(bias == 0)
+ {
+ //middle
+ df = (f1 - f2*8 + f4*8 - f5)*(1/12.0f);
+ }else if(bias < 0)
+ {
+ //left
+ df = (-f1*25 + f2*48 - f3*36 + f4*16 - f5*3)*(1/12.0f);
+ }else
+ {
+ //right
+ df = (f1*3 - f2*16 + f3*36 - f4*48 + f5*25)*(1/12.0f);
+ }
+}
+
+template < class T >
+inline void ThreePointdt(T &df, const T &f1, const T &f2, const T &f3, int bias)
+{
+ if(bias == 0)
+ {
+ //middle
+ df = (-f1 + f3)*(1/2.0f);
+ }else if(bias < 0)
+ {
+ //left
+ df = (-f1*3 + f2*4 - f3)*(1/2.0f);
+ }else
+ {
+ //right
+ df = (f1 - f2*4 + f3*3)*(1/2.0f);
+ }
+}
+
+template < class T >
+inline void ThreePointddt(T &df, const T &f1, const T &f2, const T &f3, int bias)
+{
+ //a 3 point approximation pretends to have constant acceleration, so only one algorithm needed for left, middle, or right
+ df = (f1 -f2*2 + f3)*(1/2.0f);
+}
+
+// WARNING -- totaly broken
+template < class T >
+inline void FivePointddt(T &df, const T &f1, const T &f2, const T &f3, int bias)
+{
+ if(bias == 0)
+ {
+ assert(0); // !?
+ //middle
+ //df = (- f1 + f2*16 - f3*30 + f4*16 - f5)*(1/12.0f);
+ }/*else if(bias < 0)
+ {
+ //left
+ df = (f1*7 - f2*26*4 + f3*19*6 - f4*14*4 + f5*11)*(1/12.0f);
+ }else
+ {
+ //right
+ df = (f1*3 - f2*16 + f3*36 - f4*48 + f5*25)*(1/12.0f);
+ }*/
+ //side ones don't work, use 3 point
+}
+
+//implement an arbitrary derivative
+//dumb algorithm
+template < class T >
+void DerivativeApprox(T &df, const T f[], const Real t[], int npoints, int indexval)
+{
+ /*
+ Lj(x) = PI_i!=j (x - xi) / PI_i!=j (xj - xi)
+
+ so Lj'(x) = SUM_k PI_i!=j|k (x - xi) / PI_i!=j (xj - xi)
+ */
+
+ unsigned int i,j,k,i0,i1;
+
+ Real Lpj,mult,div,tj;
+ Real tval = t[indexval];
+
+ //sum k
+ for(j=0;j<npoints;++j)
+ {
+ Lpj = 0;
+ div = 1;
+ tj = t[j];
+
+ for(k=0;k<npoints;++k)
+ {
+ if(k != j) //because there is no summand for k == j, since that term is missing from the original equation
+ {
+ //summation for k
+ for(i=0;i<npoints;++i)
+ {
+ if(i != k)
+ {
+ mult *= tval - t[i];
+ }
+ }
+
+ Lpj += mult; //add into the summation
+
+ //since the ks follow the exact patern we need for the divisor (use that too)
+ div *= tj - t[k];
+ }
+ }
+
+ //get the actual coefficient
+ Lpj /= div;
+
+ //add it in to the equation
+ df += f[j]*Lpj;
+ }
+}
+
+//END numerical derivatives
+
+template < class T >
+inline int sign(T f, T tol)
+{
+ if(f < -tol) return -1;
+ if(f > tol) return 1;
+ return 0;
+}
+
+void GetFirstDerivatives(const std::vector<synfig::Point> &f, unsigned int left, unsigned int right, char *out, unsigned int dfstride)
+{
+ unsigned int current = left;
+
+ if(right - left < 2)
+ return;
+ else if(right - left < 3)
+ {
+ synfig::Vector v = f[left+1] - f[left];
+
+ //set both to the one we want
+ *(synfig::Vector*)out = v;
+ out += dfstride;
+ *(synfig::Vector*)out = v;
+ out += dfstride;
+ }
+ else if(right - left < 6/*5*/) //should use 3 point
+ {
+ //left then middle then right
+ ThreePointdt(*(synfig::Vector*)out,f[left+0], f[left+1], f[left+2], -1);
+ current += 1;
+ out += dfstride;
+
+ for(;current < right-1; current++, out += dfstride)
+ {
+ ThreePointdt(*(synfig::Vector*)out,f[current-1], f[current], f[current+1], 0);
+ }
+
+ ThreePointdt(*(synfig::Vector*)out,f[right-3], f[right-2], f[right-1], 1);
+ current++;
+ out += dfstride;
+
+ }else //can use 5 point
+ {
+ //left 2 then middle bunch then right two
+ //may want to use 3 point for inner edge ones
+
+ FivePointdt(*(synfig::Vector*)out,f[left+0], f[left+1], f[left+2], f[left+3], f[left+4], -2);
+ out += dfstride;
+ FivePointdt(*(synfig::Vector*)out,f[left+1], f[left+2], f[left+3], f[left+4], f[left+5], -1);
+ out += dfstride;
+ current += 2;
+
+ for(;current < right-2; current++, out += dfstride)
+ {
+ FivePointdt(*(synfig::Vector*)out,f[current-2], f[current-1], f[current], f[current+1], f[current+2], 0);
+ }
+
+ FivePointdt(*(synfig::Vector*)out,f[right-5], f[right-4], f[right-3], f[right-2], f[right-1], 1);
+ out += dfstride;
+ FivePointdt(*(synfig::Vector*)out,f[right-6], f[right-5], f[right-4], f[right-3], f[right-2], 2);
+ out += dfstride;
+ current += 2;
+ }
+}
+
+void GetSimpleDerivatives(const std::vector<synfig::Point> &f, int left, int right,
+ std::vector<synfig::Point> &df, int outleft,
+ const std::vector<synfig::Real> &di)
+{
+ int i1,i2,i;
+ int offset = 2; //df = 1/2 (f[i+o]-f[i-o])
+
+ assert((int)df.size() >= right-left+outleft); //must be big enough
+
+ for(i = left; i < right; ++i)
+ {
+ //right now indices (figure out distance later)
+ i1 = std::max(left,i-offset);
+ i2 = std::max(left,i+offset);
+
+ df[outleft++] = (f[i2] - f[i1])*0.5f;
+ }
+}
+
+//get the curve error from the double sample list of work points (hopefully that's enough)
+Real CurveError(const synfig::Point *pts, unsigned int n, std::vector<synfig::Point> &work, int left, int right)
+{
+ if(right-left < 2) return -1;
+
+ int i,j;
+
+ //get distances to each point
+ Real d,dtemp,dsum;
+ //synfig::Vector v,vt;
+ //synfig::Point p1,p2;
+ synfig::Point pi;
+ std::vector<synfig::Point>::const_iterator it;//,end = work.begin()+right;
+
+ //unsigned int size = work.size();
+
+ //for each line, get distance
+ d = 0; //starts at 0
+ for(i = 0; i < (int)n; ++i)
+ {
+ pi = pts[i];
+
+ dsum = FLT_MAX;
+
+ it = work.begin()+left;
+ //p2 = *it++; //put it at left+1
+ for(j = left/*+1*/; j < right; ++j,++it)
+ {
+ /*p1 = p2;
+ p2 = *it;
+
+ v = p2 - p1;
+ vt = pi - p1;
+
+ dtemp = v.mag_squared() > 1e-12 ? (vt*v)/v.mag_squared() : 0; //get the projected time value for the current line
+
+ //get distance to line segment with the time value clamped 0-1
+ if(dtemp >= 1) //use p+v
+ {
+ vt += v; //makes it pp - (p+v)
+ }else if(dtemp > 0) //use vt-proj
+ {
+ vt -= v*dtemp; // vt - proj_v(vt) //must normalize the projection vector to work
+ }
+
+ //else use p
+ dtemp = vt.mag_squared();*/
+
+ dtemp = (pi - *it).mag_squared();
+ if(dtemp < dsum)
+ dsum = dtemp;
+ }
+
+ //accumulate the points' min distance from the curve
+ d += sqrt(dsum);
+ }
+
+ return d;
+}
+
+typedef synfigapp::BLineConverter::cpindex cpindex;
+
+//has the index data and the tangent scale data (relevant as it may be)
+int tesselate_curves(const std::vector<cpindex> &inds, const std::vector<Point> &f, const std::vector<synfig::Vector> &df, std::vector<Point> &work)
+{
+ if(inds.size() < 2)
+ return 0;
+
+ etl::hermite<Point> curve;
+ int ntess = 0;
+
+ std::vector<cpindex>::const_iterator j = inds.begin(),j2, end = inds.end();
+
+ unsigned int ibase = inds[0].curind;
+
+ j2 = j++;
+ for(; j != end; j2 = j++)
+ {
+ //if this curve has invalid error (in j) then retesselate it's work points (requires reparametrization, etc.)
+ if(j->error < 0)
+ {
+ //get the stepsize etc. for the number of points in here
+ unsigned int n = j->curind - j2->curind + 1; //thats the number of points in the span
+ unsigned int k, kend, i0, i3;
+ //so reset the right chunk
+
+ Real t, dt = 1/(Real)(n*2-2); //assuming that they own only n points
+
+ //start at first intermediate
+ t = 0;
+
+ i0 = j2->curind; i3 = j->curind;
+ k = (i0-ibase)*2; //start on first intermediary point (2x+1)
+ kend = (i3-ibase)*2; //last point to set (not intermediary)
+
+ //build hermite curve, it's easier
+ curve.p1() = f[i0];
+ curve.p2() = f[i3];
+ curve.t1() = df[i0]*(df[i0].mag_squared() > 1e-4 ? j2->tangentscale/df[i0].mag() : j2->tangentscale);
+ curve.t2() = df[i3]*(df[i3].mag_squared() > 1e-4 ? j->tangentscale/df[i3].mag() : j->tangentscale);
+ curve.sync();
+
+ //MUST include the end point (since we are ignoring left one)
+ for(; k < kend; ++k, t += dt)
+ {
+ work[k] = curve(t);
+ }
+
+ work[k] = curve(1); //k == kend, t == 1 -> c(t) == p2
+ ++ntess;
+ }
+ }
+
+ return ntess;
+}
+
+synfigapp::BLineConverter::BLineConverter()
+{
+ pixelwidth = 1;
+ smoothness = 0.70f;
+ width = 0;
+};
+
+void
+synfigapp::BLineConverter::clear()
+{
+ f.clear();
+ f_w.clear();
+ ftemp.clear();
+ df.clear();
+ cvt.clear();
+ brk.clear();
+ di.clear();
+ d_i.clear();
+ work.clear();
+ curind.clear();
+}
+
+void
+synfigapp::BLineConverter::operator () (std::list<synfig::BLinePoint> &out, const std::list<synfig::Point> &in,const std::list<synfig::Real> &in_w)
+{
+ //Profiling information
+ /*etl::clock::value_type initialprocess=0, curveval=0, breakeval=0, disteval=0;
+ etl::clock::value_type preproceval=0, tesseval=0, erroreval=0, spliteval=0;
+ unsigned int numpre=0, numtess=0, numerror=0, numsplit=0;
+ etl::clock_realtime timer,total;*/
+
+ //total.reset();
+ if(in.size()<=1)
+ return;
+
+ clear();
+
+ //removing digitization error harder than expected
+
+ //intended to fix little pen errors caused by the way people draw (tiny juts in opposite direction)
+ //Different solutions
+ // Average at both end points (will probably eliminate many points at each end of the samples)
+ // Average after the break points are found (weird points would still affect the curve)
+ // Just always get rid of breaks at the beginning and end if they are a certain distance apart
+ // This is will be current approach so all we do now is try to remove duplicate points
+
+ //remove duplicate points - very bad for fitting
+
+ //timer.reset();
+
+ {
+ std::list<synfig::Point>::const_iterator i = in.begin(), end = in.end();
+ std::list<synfig::Real>::const_iterator iw = in_w.begin();
+ synfig::Point c;
+
+ if(in.size() == in_w.size())
+ {
+ for(;i != end; ++i,++iw)
+ {
+ //eliminate duplicate points
+ if(*i != c)
+ {
+ f.push_back(c = *i);
+ f_w.push_back(*iw);
+ }
+ }
+ }else
+ {
+ for(;i != end; ++i)
+ {
+ //eliminate duplicate points
+ if(*i != c)
+ {
+ f.push_back(c = *i);
+ }
+ }
+ }
+ }
+ //initialprocess = timer();
+
+ if(f.size()<=6)
+ return;
+
+ //get curvature information
+ //timer.reset();
+
+ {
+ int i,i0,i1;
+ synfig::Vector v1,v2;
+
+ cvt.resize(f.size());
+
+ cvt.front() = 1;
+ cvt.back() = 1;
+
+ for(i = 1; i < (int)f.size()-1; ++i)
+ {
+ i0 = std::max(0,i - 2);
+ i1 = std::min((int)(f.size()-1),i + 2);
+
+ v1 = f[i] - f[i0];
+ v2 = f[i1] - f[i];
+
+ cvt[i] = (v1*v2)/(v1.mag()*v2.mag());
+ }
+ }
+
+ //curveval = timer();
+ //synfig::info("calculated curvature");
+
+ //find corner points and interpolate inside those
+ //timer.reset();
+ {
+ //break at sharp derivative points
+ //TODO tolerance should be set based upon digitization resolution (length dependent index selection)
+ Real tol = 0; //break tolerance, for the cosine of the change in angle (really high curvature or something)
+ Real fixdistsq = 4*width*width; //the distance to ignore breaks at the end points (for fixing stuff)
+ unsigned int i = 0;
+
+ int maxi = -1, last=0;
+ Real minc = 1;
+
+ brk.push_back(0);
+
+ for(i = 1; i < cvt.size()-1; ++i)
+ {
+ //insert if too sharp (we need to break the tangents to insert onto the break list)
+
+ if(cvt[i] < tol)
+ {
+ if(cvt[i] < minc)
+ {
+ minc = cvt[i];
+ maxi = i;
+ }
+ }else if(maxi >= 0)
+ {
+ if(maxi >= last + 8)
+ {
+ //synfig::info("break: %d-%d",maxi+1,cvt.size());
+ brk.push_back(maxi);
+ last = maxi;
+ }
+ maxi = -1;
+ minc = 1;
+ }
+ }
+
+ brk.push_back(i);
+
+ //postprocess for breaks too close to eachother
+ Real d = 0;
+ Point p = f[brk.front()];
+
+ //first set
+ for(i = 1; i < brk.size()-1; ++i) //do not want to include end point...
+ {
+ d = (f[brk[i]] - p).mag_squared();
+ if(d > fixdistsq) break; //don't want to group breaks if we ever get over the dist...
+ }
+ //want to erase all points before...
+ if(i != 1)
+ brk.erase(brk.begin(),brk.begin()+i-1);
+
+ //end set
+ p = f[brk.back()];
+ for(i = brk.size()-2; i > 0; --i) //start at one in from the end
+ {
+ d = (f[brk[i]] - p).mag_squared();
+ if(d > fixdistsq) break; //don't want to group breaks if we ever get over the dist
+ }
+ if(i != brk.size()-2)
+ brk.erase(brk.begin()+i+2,brk.end()); //erase all points that we found... found none if i has not advanced
+ //must not include the one we ended up on
+ }
+ //breakeval = timer();
+ //synfig::info("found break points: %d",brk.size());
+
+ //get the distance calculation of the entire curve (for tangent scaling)
+
+ //timer.reset();
+ {
+ synfig::Point p1,p2;
+
+ p1=p2=f[0];
+
+ di.resize(f.size()); d_i.resize(f.size());
+ Real d = 0;
+ for(unsigned int i = 0; i < f.size();)
+ {
+ d += (d_i[i] = (p2-p1).mag());
+ di[i] = d;
+
+ p1=p2;
+ p2=f[++i];
+ }
+ }
+ //disteval = timer();
+ //synfig::info("calculated distance");
+
+ //now break at every point - calculate new derivatives each time
+
+ //TODO
+ //must be sure that the break points are 3 or more apart
+ //then must also store the breaks which are not smooth, etc.
+ //and figure out tangents between there
+
+ //for each pair of break points (as long as they are far enough apart) recursively subdivide stuff
+ //ignore the detected intermediate points
+ {
+ unsigned int i0=0,i3=0,is=0;
+ int i=0,j=0;
+
+ bool done = false;
+
+ Real errortol = smoothness*pixelwidth; //???? what the hell should this value be
+
+ BLinePoint a;
+ synfig::Vector v;
+
+ //intemp = f; //don't want to smooth out the corners
+
+ bool breaktan = false, setwidth;
+ a.set_split_tangent_flag(false);
+ //a.set_width(width);
+ a.set_width(1.0f);
+
+ setwidth = (f.size() == f_w.size());
+
+ for(j = 0; j < (int)brk.size() - 1; ++j)
+ {
+ //for b[j] to b[j+1] subdivide and stuff
+ i0 = brk[j];
+ i3 = brk[j+1];
+
+ unsigned int size = i3-i0+1; //must include the end points
+
+ //new derivatives
+ //timer.reset();
+ ftemp.assign(f.begin()+i0, f.begin()+i3+1);
+ for(i=0;i<20;++i)
+ gaussian_blur_3(ftemp.begin(),ftemp.end(),false);
+
+ df.resize(size);
+ GetFirstDerivatives(ftemp,0,size,(char*)&df[0],sizeof(df[0]));
+ //GetSimpleDerivatives(ftemp,0,size,df,0,di);
+ //< don't have to worry about indexing stuff as it is all being taken car of right now
+ //preproceval += timer();
+ //numpre++;
+
+ work.resize(size*2-1); //guarantee that all points will be tesselated correctly (one point inbetween every 2 adjacent points)
+
+ //if size of work is size*2-1, the step size should be 1/(size*2 - 2)
+ //Real step = 1/(Real)(size*2 - 1);
+
+ //start off with break points as indices
+ curind.clear();
+ curind.push_back(cpindex(i0,di[i3]-di[i0],0)); //0 error because no curve on the left
+ curind.push_back(cpindex(i3,di[i3]-di[i0],-1)); //error needs to be reevaluated
+ done = false; //we want to loop
+
+ unsigned int dcount = 0;
+
+ //while there are still enough points between us, and the error is too high subdivide (and invalidate neighbors that share tangents)
+ while(!done)
+ {
+ //tesselate all curves with invalid error values
+ work[0] = f[i0];
+
+ //timer.reset();
+ /*numtess += */tesselate_curves(curind,f,df,work);
+ //tesseval += timer();
+
+ //now get all error values
+ //timer.reset();
+ for(i = 1; i < (int)curind.size(); ++i)
+ {
+ if(curind[i].error < 0) //must have been retesselated, so now recalculate error value
+ {
+ //evaluate error from points (starting at current index)
+ int size = curind[i].curind - curind[i-1].curind + 1;
+ curind[i].error = CurveError(&f[curind[i-1].curind], size,
+ work,(curind[i-1].curind - i0)*2,(curind[i].curind - i0)*2+1);
+
+ /*if(curind[i].error > 1.0e5)
+ {
+ synfig::info("Holy crap %d-%d error %f",curind[i-1].curind,curind[i].curind,curind[i].error);
+ curind[i].error = -1;
+ numtess += tesselate_curves(curind,f,df,work);
+ curind[i].error = CurveError(&f[curind[i-1].curind], size,
+ work,0,work.size());//(curind[i-1].curind - i0)*2,(curind[i].curind - i0)*2+1);
+ }*/
+ //numerror++;
+ }
+ }
+ //erroreval += timer();
+
+ //assume we're done
+ done = true;
+
+ //check each error to see if it's too big, if so, then subdivide etc.
+ int indsize = (int)curind.size();
+ Real maxrelerror = 0;
+ int maxi = -1;//, numpoints;
+
+ //timer.reset();
+ //get the maximum error and split there
+ for(i = 1; i < indsize; ++i)
+ {
+ //numpoints = curind[i].curind - curind[i-1].curind + 1;
+
+ if(curind[i].error > maxrelerror && curind[i].curind - curind[i-1].curind > 2) //only accept if it's valid
+ {
+ maxrelerror = curind[i].error;
+ maxi = i;
+ }
+ }
+
+ //split if error is too great
+ if(maxrelerror > errortol)
+ {
+ //add one to the left etc
+ unsigned int ibase = curind[maxi-1].curind, itop = curind[maxi].curind,
+ ibreak = (ibase + itop)/2;
+ Real scale, scale2;
+
+ assert(ibreak < f.size());
+
+ //synfig::info("Split %d -%d- %d, error: %f", ibase,ibreak,itop,maxrelerror);
+
+ if(ibase != itop)
+ {
+ //invalidate current error of the changed tangents and add an extra segment
+ //enforce minimum tangents property
+ curind[maxi].error = -1;
+ curind[maxi-1].error = -1;
+ if(maxi+1 < indsize) curind[maxi+1].error = -1; //if there is a curve segment beyond this it will be effected as well
+
+ scale = di[itop] - di[ibreak];
+ scale2 = maxi+1 < indsize ? di[curind[maxi+1].curind] - di[itop] : scale; //to the right valid?
+ curind[maxi].tangentscale = std::min(scale, scale2);
+
+ scale = di[ibreak] - di[ibase];
+ scale2 = maxi >= 2 ? di[ibase] - di[curind[maxi-2].curind] : scale; // to the left valid -2 ?
+ curind[maxi-1].tangentscale = std::min(scale, scale2);
+
+ scale = std::min(di[ibreak] - di[ibase], di[itop] - di[ibreak]);
+
+ curind.insert(curind.begin()+maxi,cpindex(ibreak, scale, -1));
+ //curind.push_back(cpindex(ibreak, scale, -1));
+ //std::sort(curind.begin(), curind.end());
+
+ done = false;
+ //numsplit++;
+ }
+ }
+ //spliteval += timer();
+
+ dcount++;
+ }
+
+ //insert the last point too (just set tangent for now
+ is = curind[0].curind;
+
+ //first point inherits current tangent status
+ v = df[is - i0];
+ if(v.mag_squared() > EPSILON)
+ v *= (curind[0].tangentscale/v.mag());
+
+ if(!breaktan)
+ a.set_tangent(v);
+ else a.set_tangent2(v);
+
+ a.set_vertex(f[is]);
+ if(setwidth)a.set_width(f_w[is]);
+
+ out.push_back(a);
+ a.set_split_tangent_flag(false); //won't need to break anymore
+ breaktan = false;
+
+ for(i = 1; i < (int)curind.size()-1; ++i)
+ {
+ is = curind[i].curind;
+
+ //first point inherits current tangent status
+ v = df[is-i0];
+ if(v.mag_squared() > EPSILON)
+ v *= (curind[i].tangentscale/v.mag());
+
+ a.set_tangent(v); // always inside, so guaranteed to be smooth
+ a.set_vertex(f[is]);
+ if(setwidth)a.set_width(f_w[is]);
+
+ out.push_back(a);
+ }
+
+ //set the last point's data
+ is = curind.back().curind; //should already be this
+
+ v = df[is-i0];
+ if(v.mag_squared() > EPSILON)
+ v *= (curind.back().tangentscale/v.mag());
+
+ a.set_tangent1(v);
+ a.set_split_tangent_flag(true);
+ breaktan = true;
+
+ //will get the vertex and tangent 2 from next round
+ }
+
+ a.set_vertex(f[i3]);
+ a.set_split_tangent_flag(false);
+ if(setwidth)
+ a.set_width(f_w[i3]);
+ out.push_back(a);
+
+ /*etl::clock::value_type totaltime = total(),
+ misctime = totaltime - initialprocess - curveval - breakeval - disteval
+ - preproceval - tesseval - erroreval - spliteval;
+
+ synfig::info(
+ "Curve Convert Profile:\n"
+ "\tInitial Preprocess: %f\n"
+ "\tCurvature Calculation: %f\n"
+ "\tBreak Calculation: %f\n"
+ "\tDistance Calculation: %f\n"
+ " Algorithm: (numtimes,totaltime)\n"
+ "\tPreprocess step: (%d,%f)\n"
+ "\tTesselation step: (%d,%f)\n"
+ "\tError step: (%d,%f)\n"
+ "\tSplit step: (%d,%f)\n"
+ " Num Input: %d, Num Output: %d\n"
+ " Total time: %f, Misc time: %f\n",
+ initialprocess, curveval,breakeval,disteval,
+ numpre,preproceval,numtess,tesseval,numerror,erroreval,numsplit,spliteval,
+ in.size(),out.size(),
+ totaltime,misctime);*/
+
+ return;
+ }
+}
+
+void synfigapp::BLineConverter::EnforceMinWidth(std::list<synfig::BLinePoint> &bline, synfig::Real min_pressure)
+{
+ std::list<synfig::BLinePoint>::iterator i = bline.begin(),
+ end = bline.end();
+
+ for(i = bline.begin(); i != end; ++i)
+ {
+ if(i->get_width() < min_pressure)
+ {
+ i->set_width(min_pressure);
+ }
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file blineconvert.h
+** \brief Template Header
+**
+** $Id: blineconvert.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_BLINE_CONVERT_H
+#define __SYNFIG_BLINE_CONVERT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/general.h>
+#include <synfig/blinepoint.h>
+#include <list>
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class BLineConverter
+{
+public:
+ struct cpindex
+ {
+ int curind;
+ synfig::Real tangentscale;
+ synfig::Real error; //negative error will indicate invalid;
+
+ cpindex(int ci, synfig::Real s=0, synfig::Real e=-1)
+ :curind(ci), tangentscale(s), error(e)
+ {}
+
+ cpindex(const cpindex & o)
+ :curind(o.curind), tangentscale(o.tangentscale), error(o.error)
+ {}
+
+ const cpindex & operator = (const cpindex & rhs)
+ {
+ curind = rhs.curind;
+ tangentscale = rhs.tangentscale;
+ error = rhs.error;
+ return *this;
+ }
+
+ bool operator < (const cpindex &rhs) const
+ {
+ return curind < rhs.curind;
+ }
+
+ //point is obviously in[curind]
+ //tangent scale will get reset to the smallest (or something else depending on experimentation)
+ };
+
+private:
+ //cached data
+ std::vector<synfig::Point> f; //the preprocessed input cache
+ std::vector<synfig::Real> f_w;
+
+ //temporary point storage for vector calc
+ std::vector<synfig::Point> ftemp;
+
+ std::vector<synfig::Vector> df; //the derivative cache
+ std::vector<synfig::Real> cvt; //the curvature cache
+
+ std::vector<int> brk; //the break point cache
+
+ std::vector<synfig::Real> di, //cumulative distance
+ d_i; //distance between adjacent segments
+
+ std::vector<synfig::Point> work; //the working point cache for the entire curve
+ std::vector<cpindex> curind;
+
+ //function parameters
+ void clear();
+
+public:
+ synfig::Real width;
+
+ //Converter properties
+ synfig::Real pixelwidth;
+ synfig::Real smoothness; //actual error will be smoothness*pixelwidth (for global set pixelwidth = 1)
+
+ BLineConverter();
+
+ static void EnforceMinWidth(std::list<synfig::BLinePoint> &bline, synfig::Real min_pressure);
+ void operator ()(std::list<synfig::BLinePoint> &out, const std::list<synfig::Point> &in,const std::list<synfig::Real> &in_w);
+};
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasinterface.cpp
+** \brief Template File
+**
+** $Id: canvasinterface.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+//#include <iostream>
+
+#include <ETL/clock>
+#include <synfig/valuenode_scale.h>
+#include <synfig/valuenode_timedswap.h>
+#include <synfig/valuenode_composite.h>
+#include <synfig/valuenode_subtract.h>
+#include <synfig/valuenode_linear.h>
+#include <synfig/valuenode_reference.h>
+#include <synfig/valuenode_twotone.h>
+#include <synfig/valuenode_stripes.h>
+
+#include <synfig/waypoint.h>
+#include <synfig/loadcanvas.h>
+#include <synfig/importer.h>
+#include <synfig/guidset.h>
+
+#include "canvasinterface.h"
+#include "instance.h"
+
+#include "actions/layeradd.h"
+#include "actions/valuedescconvert.h"
+#include "actions/valuenodeadd.h"
+#include "actions/editmodeset.h"
+#include "action_system.h"
+
+#include "main.h"
+
+#include <synfig/gradient.h>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+CanvasInterface::CanvasInterface(loose_handle<Instance> instance,handle<Canvas> canvas):
+ instance_(instance),
+ canvas_(canvas),
+ cur_time_(canvas->rend_desc().get_frame_start()),
+ mode_(MODE_NORMAL|MODE_ANIMATE_PAST|MODE_ANIMATE_FUTURE)
+{
+ set_selection_manager(get_instance()->get_selection_manager());
+ set_ui_interface(get_instance()->get_ui_interface());
+}
+
+CanvasInterface::~CanvasInterface()
+{
+ synfig::info("synfigapp::CanvasInterface::~CanvasInterface(): Deleted");
+}
+
+void
+CanvasInterface::set_time(synfig::Time x)
+{
+ if(get_canvas()->rend_desc().get_frame_rate())
+ {
+ float fps(get_canvas()->rend_desc().get_frame_rate());
+ Time r(x.round(fps));
+ //synfig::info("CanvasInterface::set_time(): %s rounded to %s\n",x.get_string(fps).c_str(),r.get_string(fps).c_str());
+ x=r;
+ }
+ if(cur_time_.is_equal(x))
+ return;
+ cur_time_=x;
+
+ signal_time_changed()();
+ signal_dirty_preview()();
+}
+
+synfig::Time
+CanvasInterface::get_time()const
+{
+ return cur_time_;
+}
+
+void
+CanvasInterface::refresh_current_values()
+{
+ get_canvas()->set_time(cur_time_);
+ signal_time_changed()();
+ signal_dirty_preview()();
+}
+
+etl::handle<CanvasInterface>
+CanvasInterface::create(loose_handle<Instance> instance,handle<Canvas> canvas)
+{
+ etl::handle<CanvasInterface> intrfc;
+ intrfc=new CanvasInterface(instance,canvas);
+ instance->canvas_interface_list().push_front(intrfc);
+ return intrfc;
+}
+
+void
+CanvasInterface::set_mode(Mode x)
+{
+ Action::Handle action(Action::EditModeSet::create());
+
+ assert(action);
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("edit_mode",x);
+
+ if(!action->is_ready())
+ {
+ get_ui_interface()->error(_("Action Not Ready, unable to change mode"));
+ assert(0);
+ return;
+ }
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Unable to change mode"));
+
+// mode_=x;
+// signal_mode_changed_(x);
+}
+
+CanvasInterface::Mode
+CanvasInterface::get_mode()const
+{
+ return mode_;
+}
+
+
+
+Layer::Handle
+CanvasInterface::add_layer_to(String name, Canvas::Handle canvas, int depth)
+{
+ synfigapp::Action::PassiveGrouper group(get_instance().get(),_("Add Layer To"));
+
+ Layer::Handle layer(Layer::create(name));
+
+ assert(layer);
+
+ if(!layer)
+ return 0;
+
+ if(canvas!=get_canvas() && !canvas->is_inline())
+ {
+ synfig::error("Bad canvas passed to \"add_layer_to\"");
+ return 0;
+ }
+
+ layer->set_canvas(canvas);
+
+ // Apply some defaults
+ if(layer->set_param("fg",synfigapp::Main::get_foreground_color()))
+ layer->set_param("bg",synfigapp::Main::get_background_color());
+ else
+ layer->set_param("color",synfigapp::Main::get_foreground_color());
+
+ layer->set_param("width",synfigapp::Main::get_bline_width().units(get_canvas()->rend_desc()));
+ layer->set_param("gradient",synfigapp::Main::get_gradient());
+ if(name!="zoom")
+ layer->set_param("amount",synfigapp::Main::get_opacity());
+ layer->set_param("blend_method",synfigapp::Main::get_blend_method());
+
+ {
+ // Grab the layer's list pf parameters
+ Layer::ParamList paramlist=layer->get_param_list();
+ Layer::ParamList::iterator iter;
+ for(iter=paramlist.begin();iter!=paramlist.end();++iter)
+ {
+ ValueNode::Handle value_node;
+
+ if(iter->second.get_type()==ValueBase::TYPE_LIST)
+ value_node=LinkableValueNode::create("dynamic_list",iter->second);
+ else if(LinkableValueNode::check_type("composite",iter->second.get_type()) &&
+ (iter->second.get_type()!=ValueBase::TYPE_COLOR && iter->second.get_type()!=ValueBase::TYPE_VECTOR)
+ )
+ value_node=LinkableValueNode::create("composite",iter->second);
+
+ if(value_node)
+ layer->connect_dynamic_param(iter->first,value_node);
+ }
+ }
+
+ // Action to add the layer
+ Action::Handle action(Action::LayerAdd::create());
+
+ assert(action);
+ if(!action)
+ return 0;
+
+ action->set_param("canvas",canvas);
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("new",layer);
+
+ if(!action->is_ready())
+ {
+ get_ui_interface()->error(_("Action Not Ready"));
+ return 0;
+ }
+
+ if(!get_instance()->perform_action(action))
+ {
+ get_ui_interface()->error(_("Action Failed."));
+ return 0;
+ }
+
+ synfig::info("DEPTH=%d",depth);
+ // Action to move the layer (if necessary)
+ if(depth>0)
+ {
+ Action::Handle action(Action::create("layer_move"));
+
+ assert(action);
+ if(!action)
+ return 0;
+
+ action->set_param("canvas",canvas);
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("layer",layer);
+ action->set_param("new_index",depth);
+
+ if(!action->is_ready())
+ {
+ get_ui_interface()->error(_("Move Action Not Ready"));
+ return 0;
+ }
+
+ if(!get_instance()->perform_action(action))
+ {
+ get_ui_interface()->error(_("Move Action Failed."));
+ return 0;
+ }
+ }
+
+
+ return layer;
+}
+
+
+bool
+CanvasInterface::convert(ValueDesc value_desc, String type)
+{
+ Action::Handle action(Action::ValueDescConvert::create());
+
+ assert(action);
+ if(!action)
+ return 0;
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("value_desc",value_desc);
+ action->set_param("type",type);
+
+ if(!action->is_ready())
+ {
+ get_ui_interface()->error(_("Action Not Ready"));
+ return 0;
+ }
+
+ if(get_instance()->perform_action(action))
+ return true;
+
+ get_ui_interface()->error(_("Action Failed."));
+ return false;
+}
+
+bool
+CanvasInterface::add_value_node(synfig::ValueNode::Handle value_node, synfig::String name)
+{
+ if(name.empty())
+ {
+ get_ui_interface()->error(_("Empty name!"));
+ return false;
+ }
+
+ Action::Handle action(Action::ValueNodeAdd::create());
+
+ assert(action);
+ if(!action)
+ return 0;
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("new",value_node);
+ action->set_param("name",name);
+
+ if(!action->is_ready())
+ {
+ get_ui_interface()->error(_("Action Not Ready"));
+ return 0;
+ }
+
+ if(get_instance()->perform_action(action))
+ return true;
+
+ get_ui_interface()->error(_("Action Failed."));
+ return false;
+}
+
+Action::ParamList
+CanvasInterface::generate_param_list(const ValueDesc &value_desc)
+{
+ synfigapp::Action::ParamList param_list;
+ param_list.add("time",get_time());
+ param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
+ param_list.add("canvas",get_canvas());
+
+ param_list.add("value_desc",value_desc);
+
+ if(value_desc.parent_is_value_node())
+ param_list.add("parent_value_node",value_desc.get_parent_value_node());
+
+ if(value_desc.is_value_node())
+ param_list.add("value_node",value_desc.get_value_node());
+
+ if(value_desc.is_const())
+ param_list.add("value",value_desc.get_value());
+
+ if(value_desc.parent_is_layer_param())
+ {
+ param_list.add("parent_layer",value_desc.get_layer());
+ param_list.add("parent_layer_param",value_desc.get_param_name());
+ }
+
+ {
+ synfigapp::SelectionManager::ChildrenList children_list;
+ children_list=get_selection_manager()->get_selected_children();
+ if(!value_desc.parent_is_canvas() && children_list.size()==1)
+ {
+ param_list.add("dest",value_desc);
+ param_list.add("src",children_list.front().get_value_node());
+ }
+ }
+ return param_list;
+}
+
+Action::ParamList
+CanvasInterface::generate_param_list(const std::list<synfigapp::ValueDesc> &value_desc_list)
+{
+ synfigapp::Action::ParamList param_list;
+ param_list.add("time",get_time());
+ param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
+ param_list.add("canvas",get_canvas());
+
+ std::list<synfigapp::ValueDesc>::const_iterator iter;
+ for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+ {
+ param_list.add("value_desc",*iter);
+ if(iter->is_value_node())
+ {
+ param_list.add("value_node",iter->get_value_node());
+ }
+ }
+
+
+ return param_list;
+}
+
+void
+CanvasInterface::set_rend_desc(const synfig::RendDesc &rend_desc)
+{
+ Action::Handle action(Action::create("canvas_rend_desc_set"));
+
+ assert(action);
+ if(!action)
+ return;
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("rend_desc",rend_desc);
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Action Failed."));
+}
+
+bool
+CanvasInterface::set_name(const String &x)
+{
+ //! \todo This needs to be converted into an action
+ get_canvas()->set_name(x);
+ signal_id_changed_();
+ return true;
+}
+
+bool
+CanvasInterface::set_description(const String &x)
+{
+ //! \todo This needs to be converted into an action
+ get_canvas()->set_description(x);
+ return true;
+}
+
+bool
+CanvasInterface::set_id(const String &x)
+{
+ //! \todo This needs to be converted into an action
+ get_canvas()->set_id(x);
+ signal_id_changed_();
+ return true;
+}
+
+
+void
+CanvasInterface::jump_to_next_keyframe()
+{
+ synfig::info("Current time: %s",get_time().get_string().c_str());
+ try
+ {
+ synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_next(get_time()));
+ synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
+ set_time(keyframe.get_time());
+ }
+ catch(...) { synfig::warning("Unable to find next keyframe"); }
+}
+
+void
+CanvasInterface::jump_to_prev_keyframe()
+{
+ synfig::info("Current time: %s",get_time().get_string().c_str());
+ try
+ {
+ synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(get_time()));
+ synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
+ set_time(keyframe.get_time());
+ }
+ catch(...) { synfig::warning("Unable to find prev keyframe"); }
+}
+
+bool
+CanvasInterface::import(const synfig::String &filename, bool copy)
+{
+ Action::PassiveGrouper group(get_instance().get(),_("Import Image"));
+
+ synfig::info("Attempting to import "+filename);
+
+
+ if(find(filename.begin(),filename.end(),'.')==filename.end())
+ {
+ get_ui_interface()->error("Filename must have an extension!");
+ return false;
+ }
+
+ String ext(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));
+ std::transform(ext.begin(),ext.end(),ext.begin(),&::tolower);
+
+ // If this is a SIF file, then we need to do things slightly differently
+ if(ext=="sif" || ext=="sifz")try
+ {
+
+ Canvas::Handle outside_canvas(synfig::open_canvas(filename));
+ if(!outside_canvas)
+ throw String(_("Unable to open this composition"));
+
+ Layer::Handle layer(add_layer_to("PasteCanvas",get_canvas()));
+ if(!layer)
+ throw String(_("Unable to create \"PasteCanvas\" layer"));
+ if(!layer->set_param("canvas",ValueBase(outside_canvas)))
+ throw int();
+
+ //layer->set_description(basename(filename));
+ signal_layer_new_description()(layer,filename);
+ return true;
+ }
+ catch(String x)
+ {
+ get_ui_interface()->error(x+" -- "+filename);
+ return false;
+ }
+ catch(...)
+ {
+ get_ui_interface()->error(_("Uncaught exception when attempting\nto open this composition -- ")+filename);
+ return false;
+ }
+
+
+
+ if(!Importer::book().count(ext))
+ {
+ get_ui_interface()->error(_("I don't know how to open images of this type -- ")+ext);
+ return false;
+ }
+
+ try
+ {
+ Layer::Handle layer(add_layer_to("Import",get_canvas()));
+ int w,h;
+ if(!layer)
+ throw int();
+ if(!layer->set_param("filename",ValueBase(filename)))
+ throw int();
+ w=layer->get_param("_width").get(int());
+ h=layer->get_param("_height").get(int());
+ if(w&&h)
+ {
+ Vector size=ValueBase(get_canvas()->rend_desc().get_br()-get_canvas()->rend_desc().get_tl());
+ Vector x;
+ if(size[0]<size[1])
+ {
+ x[0]=size[0];
+ x[1]=size[0]/w*h;
+ if(size[0]<0 ^ size[1]<0)
+ x[1]=-x[1];
+ }
+ else
+ {
+ x[1]=size[1];
+ x[0]=size[1]/h*w;
+ if(size[0]<0 ^ size[1]<0)
+ x[0]=-x[0];
+ }
+ if(!layer->set_param("tl",ValueBase(-x/2)))
+ throw int();
+ if(!layer->set_param("br",ValueBase(x/2)))
+ throw int();
+ }
+ else
+ {
+ if(!layer->set_param("tl",ValueBase(get_canvas()->rend_desc().get_tl())))
+ throw int();
+ if(!layer->set_param("br",ValueBase(get_canvas()->rend_desc().get_br())))
+ throw int();
+ }
+
+ layer->set_description(basename(filename));
+ signal_layer_new_description()(layer,filename);
+
+ return true;
+ }
+ catch(...)
+ {
+ get_ui_interface()->error("Unable to import "+filename);
+ group.cancel();
+ return false;
+ }
+}
+
+
+void
+CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
+{
+ Action::Handle action(Action::create("waypoint_set_smart"));
+
+ assert(action);
+ if(!action)
+ return;
+
+ waypoint.make_unique();
+ waypoint.set_time(get_time());
+
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("waypoint",waypoint);
+ action->set_param("time",get_time());
+ action->set_param("value_node",value_node);
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Action Failed."));
+}
+
+void
+CanvasInterface::waypoint_remove(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
+{
+ Action::Handle action(Action::create("waypoint_remove"));
+
+ assert(action);
+ if(!action)
+ return;
+
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("waypoint",waypoint);
+ action->set_param("value_node",value_node);
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Action Failed."));
+}
+
+
+void
+CanvasInterface::auto_export(ValueNode::Handle value_node)
+{
+/*
+ // Check to see if we are already exported.
+ if(value_node->is_exported())
+ return;
+
+ Action::Handle action(Action::create("value_node_add"));
+
+ assert(action);
+ if(!action)
+ return;
+
+ String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("new",value_node);
+ action->set_param("name",name);
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Action Failed."));
+*/
+}
+
+void
+CanvasInterface::auto_export(const ValueDesc& value_desc)
+{
+ // THIS FUNCTION IS DEPRECATED, AND IS NOW A STUB.
+#if 0
+ // Check to see if we are already exported.
+ if(value_desc.is_exported())
+ return;
+
+ Action::Handle action(Action::create("value_desc_export"));
+
+ assert(action);
+ if(!action)
+ return;
+
+ String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("value_desc",value_desc);
+ action->set_param("name",name);
+
+ if(!get_instance()->perform_action(action))
+ get_ui_interface()->error(_("Action Failed."));
+#endif
+}
+
+bool
+CanvasInterface::change_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value)
+{
+ // If this isn't really a change, then don't bother
+ if(new_value==value_desc.get_value(get_time()))
+ return true;
+
+ // If this change needs to take place elsewhere, then so be it.
+ if(value_desc.get_canvas() && value_desc.get_canvas()->get_root()!=get_canvas()->get_root())do
+ {
+ etl::handle<Instance> instance;
+ instance=find_instance(value_desc.get_canvas()->get_root());
+
+ if(instance)
+ return instance->find_canvas_interface(value_desc.get_canvas())->change_value(value_desc,new_value);
+ else
+ {
+ get_ui_interface()->error(_("The value you are trying to edit is in a composition\nwhich doesn't seem to be open. Open that composition and you\nshould be able to edit this value as normal."));
+ return false;
+ }
+ }while(0);
+#ifdef _DEBUG
+ else
+ { synfig::warning("Can't get canvas from value desc...?"); }
+#endif
+
+ synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_set"));
+ if(!action)
+ {
+ return false;
+ }
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
+ action->set_param("time",get_time());
+ action->set_param("value_desc",value_desc);
+ action->set_param("new_value",new_value);
+
+ return get_instance()->perform_action(action);
+}
+
+void
+CanvasInterface::set_meta_data(const synfig::String& key,const synfig::String& data)
+{
+ get_canvas()->set_meta_data(key,data);
+}
+
+
+// this function goes with find_important_value_descs()
+static int
+_process_value_desc(const synfigapp::ValueDesc& value_desc,std::vector<synfigapp::ValueDesc>& out, synfig::GUIDSet& guid_set)
+{
+ int ret(0);
+
+ if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
+ {
+ Canvas::Handle canvas;
+ canvas=value_desc.get_value().get(canvas);
+ if(!canvas || !canvas->is_inline())
+ return ret;
+ ret+=CanvasInterface::find_important_value_descs(canvas,out,guid_set);
+ }
+
+ if(value_desc.is_value_node())
+ {
+ ValueNode::Handle value_node(value_desc.get_value_node());
+
+ if(guid_set.count(value_node->get_guid()))
+ return ret;
+ guid_set.insert(value_node->get_guid());
+
+ if(LinkableValueNode::Handle::cast_dynamic(value_node))
+ {
+ if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
+ {
+ out.push_back(value_desc);
+ ret++;
+ }
+ // Process the linkable ValueNode's children
+ LinkableValueNode::Handle value_node(LinkableValueNode::Handle::cast_dynamic(value_node));
+ int i;
+ for(i=0;i<value_node->link_count();i++)
+ {
+ ValueNode::Handle link(value_node->get_link(i));
+ if(!link->is_exported())
+ ret+=_process_value_desc(ValueDesc(value_node,i),out,guid_set);
+ }
+ }
+ else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
+ {
+ out.push_back(value_desc);
+ ret++;
+ }
+ }
+
+ return ret;
+}
+
+int
+CanvasInterface::find_important_value_descs(synfig::Canvas::Handle canvas,std::vector<synfigapp::ValueDesc>& out,synfig::GUIDSet& guid_set)
+{
+ int ret(0);
+ if(!canvas->is_inline())
+ {
+ ValueNodeList::const_iterator iter;
+
+ for(
+ iter=canvas->value_node_list().begin();
+ iter!=canvas->value_node_list().end();
+ ++iter)
+ ret+=_process_value_desc(ValueDesc(canvas,(*iter)->get_id()),out,guid_set);
+ }
+
+ Canvas::const_iterator iter;
+
+ for(iter=canvas->begin();iter!=canvas->end();++iter)
+ {
+ Layer::Handle layer(*iter);
+
+ Layer::DynamicParamList::const_iterator iter;
+ for(
+ iter=layer->dynamic_param_list().begin();
+ iter!=layer->dynamic_param_list().end();
+ ++iter)
+ {
+ if(!iter->second->is_exported())
+ ret+=_process_value_desc(ValueDesc(layer,iter->first),out,guid_set);
+ }
+ ValueBase value(layer->get_param("canvas"));
+ if(value.is_valid())
+ ret+=_process_value_desc(ValueDesc(layer,"canvas"),out,guid_set);
+ }
+
+ return ret;
+}
+
+int
+CanvasInterface::find_important_value_descs(std::vector<synfigapp::ValueDesc>& out)
+{
+ synfig::GUIDSet tmp;
+ return find_important_value_descs(get_canvas(),out,tmp);
+}
+
+void
+CanvasInterface::seek_frame(int frames)
+{
+ if(!frames)
+ return;
+ float fps(get_canvas()->rend_desc().get_frame_rate());
+ Time newtime(get_time()+(float)frames/fps);
+ newtime=newtime.round(fps);
+
+ if(newtime<=get_canvas()->rend_desc().get_frame_start())
+ newtime=get_canvas()->rend_desc().get_frame_start();
+ if(newtime>=get_canvas()->rend_desc().get_frame_end())
+ newtime=get_canvas()->rend_desc().get_frame_end();
+ set_time(newtime);
+}
+
+void
+CanvasInterface::seek_time(synfig::Time time)
+{
+ if(!time)
+ return;
+
+ float fps(get_canvas()->rend_desc().get_frame_rate());
+
+ if(time>=synfig::Time::end())
+ {
+ set_time(get_canvas()->rend_desc().get_time_end());
+ return;
+ }
+ if(time<=synfig::Time::begin())
+ {
+ set_time(get_canvas()->rend_desc().get_time_end());
+ return;
+ }
+
+ Time newtime(get_time()+time);
+ newtime=newtime.round(fps);
+
+ if(newtime<=get_canvas()->rend_desc().get_time_start())
+ newtime=get_canvas()->rend_desc().get_time_start();
+ if(newtime>=get_canvas()->rend_desc().get_time_end())
+ newtime=get_canvas()->rend_desc().get_time_end();
+ set_time(newtime);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file canvasinterface.h
+** \brief Template Header
+**
+** $Id: canvasinterface.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_CANVASINTERFACE_H
+#define __SYNFIG_APP_CANVASINTERFACE_H
+
+/* === H E A D E R S ======================================================= */
+
+//#include <synfig/canvas.h>
+#include <synfig/value.h>
+#include <sigc++/signal.h>
+#include <sigc++/object.h>
+#include <list>
+#include "selectionmanager.h"
+#include "uimanager.h"
+#include "value_desc.h"
+#include "editmode.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfig { class ValueNode_DynamicList; class Waypoint; class GUIDSet; class Canvas; };
+
+namespace synfigapp {
+
+namespace Action { class ParamList; class Param; class EditModeSet; };
+
+class Instance;
+class ValueDesc;
+
+class CanvasInterface : public etl::shared_object, public sigc::trackable
+{
+ friend class Instance;
+ friend class Action::EditModeSet;
+
+public:
+
+ typedef EditMode Mode;
+
+private:
+ // Constructor is private to force the use of the "create()" constructor.
+ CanvasInterface(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas);
+
+private:
+ etl::loose_handle<Instance> instance_;
+ etl::handle<synfig::Canvas> canvas_;
+ etl::handle<SelectionManager> selection_manager_;
+ etl::handle<UIInterface> ui_interface_;
+ synfig::Time cur_time_;
+ Mode mode_;
+
+ sigc::signal<void,synfig::Layer::Handle> signal_layer_raised_;
+ sigc::signal<void,synfig::Layer::Handle> signal_layer_lowered_;
+ sigc::signal<void,synfig::Layer::Handle,int> signal_layer_inserted_;
+ sigc::signal<void,synfig::Layer::Handle,int,synfig::Canvas::Handle> signal_layer_moved_;
+ sigc::signal<void,synfig::Layer::Handle> signal_layer_removed_;
+ sigc::signal<void,synfig::Layer::Handle,bool> signal_layer_status_changed_;
+ sigc::signal<void,synfig::Layer::Handle,synfig::String> signal_layer_new_description_;
+ sigc::signal<void,synfig::Canvas::Handle> signal_canvas_added_;
+ sigc::signal<void,synfig::Canvas::Handle> signal_canvas_removed_;
+
+ sigc::signal<void,synfig::ValueNode::Handle> signal_value_node_added_;
+ sigc::signal<void,synfig::ValueNode::Handle> signal_value_node_deleted_;
+ sigc::signal<void,synfig::ValueNode::Handle> signal_value_node_changed_;
+ sigc::signal<void,synfig::ValueNode::Handle,synfig::ValueNode::Handle> signal_value_node_replaced_;
+
+ sigc::signal<void,synfig::Keyframe> signal_keyframe_added_;
+ sigc::signal<void,synfig::Keyframe> signal_keyframe_removed_;
+ sigc::signal<void,synfig::Keyframe> signal_keyframe_changed_;
+
+ sigc::signal<void> signal_id_changed_;
+
+ sigc::signal<void> signal_time_changed_;
+
+ sigc::signal<void> signal_rend_desc_changed_;
+
+ sigc::signal<void,Mode> signal_mode_changed_;
+
+ //sigc::signal<void> signal_dirty_preview_;
+
+ sigc::signal<void,synfig::Layer::Handle,synfig::String> signal_layer_param_changed_;
+
+public: // Signal Interface
+
+ sigc::signal<void,synfig::Layer::Handle,int,synfig::Canvas::Handle>& signal_layer_moved() { return signal_layer_moved_; }
+
+ sigc::signal<void,synfig::Layer::Handle,synfig::String>& signal_layer_new_description() { return signal_layer_new_description_; }
+
+ //! Signal called when layer is raised.
+ sigc::signal<void,synfig::Layer::Handle>& signal_layer_raised() { return signal_layer_raised_; }
+
+ //! Signal called when layer is lowered.
+ sigc::signal<void,synfig::Layer::Handle>& signal_layer_lowered() { return signal_layer_lowered_; }
+
+ //! Signal called when layer has been inserted at a given position.
+ sigc::signal<void,synfig::Layer::Handle,int>& signal_layer_inserted() { return signal_layer_inserted_; }
+
+ //! Signal called when a layer has been removed from the canvas.
+ sigc::signal<void,synfig::Layer::Handle>& signal_layer_removed() { return signal_layer_removed_; }
+
+ //! Signal called when the layer's active status has changed.
+ sigc::signal<void,synfig::Layer::Handle,bool>& signal_layer_status_changed() { return signal_layer_status_changed_; }
+
+ //! Signal called when a canvas has been added.
+ sigc::signal<void,etl::handle<synfig::Canvas> >& signal_canvas_added() { return signal_canvas_added_; }
+
+ //! Signal called when a canvas has been removed.
+ sigc::signal<void,etl::handle<synfig::Canvas> >& signal_canvas_removed() { return signal_canvas_removed_; }
+
+ //! Signal called when a layer's parameter has been changed
+ sigc::signal<void,synfig::Layer::Handle,synfig::String>& signal_layer_param_changed() { return signal_layer_param_changed_; }
+
+ //! Signal called when the canvas's preview needs to be updated
+ //sigc::signal<void>& signal_dirty_preview() { return signal_dirty_preview_; }
+ sigc::signal<void>& signal_dirty_preview() { return get_canvas()->signal_dirty(); }
+
+ sigc::signal<void,etl::handle<synfig::ValueNode>,etl::handle<synfig::ValueNode> >&
+ signal_value_node_child_added() { return get_canvas()->signal_value_node_child_added(); }
+ sigc::signal<void,etl::handle<synfig::ValueNode>,etl::handle<synfig::ValueNode> >&
+ signal_value_node_child_removed() { return get_canvas()->signal_value_node_child_removed(); }
+
+ //! Signal called when a ValueNode has changed
+ sigc::signal<void,etl::handle<synfig::ValueNode> >& signal_value_node_added() { return signal_value_node_added_; }
+
+ //! Signal called when a ValueNode has been deleted
+ sigc::signal<void,etl::handle<synfig::ValueNode> >& signal_value_node_deleted() { return signal_value_node_deleted_; }
+
+ //! Signal called when a ValueNode has been changed
+ sigc::signal<void,etl::handle<synfig::ValueNode> >& signal_value_node_changed() { return get_canvas()->signal_value_node_changed(); }
+ //sigc::signal<void,etl::handle<synfig::ValueNode> >& signal_value_node_changed() { return signal_value_node_changed_; }
+
+ //! Signal called when the mode has changed
+ sigc::signal<void,Mode> signal_mode_changed() { return signal_mode_changed_; }
+
+ //! Signal called when a the ID has been changed
+ sigc::signal<void>& signal_id_changed() { return signal_id_changed_; }
+
+ //! Signal called whenever the time changes
+ sigc::signal<void> signal_time_changed() { return signal_time_changed_; }
+
+ //! Signal called whenever a data node has been replaced.
+ /*! Second ValueNode replaces first */
+ sigc::signal<void,synfig::ValueNode::Handle,synfig::ValueNode::Handle>& signal_value_node_replaced()
+ { return signal_value_node_replaced_; }
+
+ //! Signal called whenever the RendDesc changes
+ sigc::signal<void>& signal_rend_desc_changed() { return signal_rend_desc_changed_; }
+
+ sigc::signal<void,synfig::Keyframe>& signal_keyframe_added() { return signal_keyframe_added_; }
+
+ sigc::signal<void,synfig::Keyframe>& signal_keyframe_removed() { return signal_keyframe_removed_; }
+
+ sigc::signal<void,synfig::Keyframe>& signal_keyframe_changed() { return signal_keyframe_changed_; }
+
+public:
+
+ void auto_export(const ValueDesc& value_desc);
+
+ void auto_export(synfig::ValueNode::Handle value_node);
+
+ void set_meta_data(const synfig::String& key,const synfig::String& data);
+
+ //! Changes the current SelectionManager object
+ void set_selection_manager(const etl::handle<SelectionManager> &sm) { selection_manager_=sm; }
+
+ //! Disables the selection manager
+ void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
+
+ //! Returns a handle to the current SelectionManager
+ const etl::handle<SelectionManager> &get_selection_manager()const { return selection_manager_; }
+
+ //! Changes the current UIInterface object
+ void set_ui_interface(const etl::handle<UIInterface> &uim) { ui_interface_=uim; }
+
+ //! Disables the UIInterface
+ void unset_ui_interface() { ui_interface_=new DefaultUIInterface(); }
+
+ //! Returns a handle to the current UIInterface
+ const etl::handle<UIInterface> &get_ui_interface() { return ui_interface_; }
+
+ //! Returns the Canvas associated with this interface
+ etl::handle<synfig::Canvas> get_canvas()const { return canvas_; }
+
+ //! Returns the Instance associated with this interface
+ etl::loose_handle<Instance> get_instance()const { return instance_; }
+
+ //! Changes the name of the canvas. Undoable.
+ bool set_name(const synfig::String &x);
+
+ //! Changes the description of the canvas. Undoable.
+ bool set_description(const synfig::String &x);
+
+ //! Changes the ID of the canvas. Undoable.
+ bool set_id(const synfig::String &x);
+
+ //! Convience function to retrieve the name of the canvas
+ synfig::String get_name()const { return get_canvas()->get_name(); }
+
+ //! Convience function to retrieve the description of the canvas
+ synfig::String get_description()const { return get_canvas()->get_description(); }
+
+ //! Convience function to retrieve the ID of the canvas
+ synfig::String get_id()const { return get_canvas()->get_id(); }
+
+ //! Sets the current time
+ void set_time(synfig::Time x);
+
+ //! Retrieves the current time
+ synfig::Time get_time()const;
+
+ //! Changes the current time to the next keyframe
+ void jump_to_next_keyframe();
+
+ //! Changes the current time to the next keyframe
+ void jump_to_prev_keyframe();
+
+ void seek_frame(int frames);
+
+ void seek_time(synfig::Time time);
+
+ //! \writeme
+ void refresh_current_values();
+
+ //! Sets the current editing mode
+ /*! \see Mode */
+ void set_mode(Mode x);
+
+ //! Retrieves the current editing mode
+ /*! \see Mode */
+ Mode get_mode()const;
+
+ //! Creates a new layer, of type \c id at the top of the layer stack
+ synfig::Layer::Handle add_layer(synfig::String id) { return add_layer_to(id,get_canvas()); }
+
+ synfig::Layer::Handle add_layer_to(synfig::String id,synfig::Canvas::Handle canvas, int depth=0);
+
+ bool convert(ValueDesc value_desc, synfig::String type);
+ //! Adds the given ValueNode to the canvas.
+ bool add_value_node(synfig::ValueNode::Handle value_node, synfig::String name);
+
+
+ Action::ParamList generate_param_list(const synfigapp::ValueDesc &);
+
+ Action::ParamList generate_param_list(const std::list<synfigapp::ValueDesc> &);
+
+ void set_rend_desc(const synfig::RendDesc &rend_desc);
+
+ bool import(const synfig::String &filename, bool copy=false);
+
+
+ void waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint);
+
+ void waypoint_remove(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint);
+
+ bool change_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value);
+
+
+ int find_important_value_descs(std::vector<synfigapp::ValueDesc>& out);
+ static int find_important_value_descs(synfig::Canvas::Handle canvas,std::vector<synfigapp::ValueDesc>& out,synfig::GUIDSet& guid_set);
+
+ ~CanvasInterface();
+
+ static etl::handle<CanvasInterface> create(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas);
+}; // END of class CanvasInterface
+
+/*! \class PushMode
+** \brief Class that changes the mode of a CanvasInterface, and restores it on destruction.
+*/
+class PushMode
+{
+ CanvasInterface* canvas_interface_;
+ CanvasInterface::Mode old_mode_;
+public:
+ PushMode(etl::loose_handle<CanvasInterface> c, CanvasInterface::Mode mode):
+ canvas_interface_(c.get()), old_mode_(canvas_interface_->get_mode())
+ { canvas_interface_->set_mode(mode); }
+
+ ~PushMode() { canvas_interface_->set_mode(old_mode_); }
+}; // END of class PushMode
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file cvs.cpp
+** \brief Template File
+**
+** $Id: cvs.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "cvs.h"
+#include <ETL/stringf>
+#include <fstream>
+#include <iostream>
+#include <synfig/general.h>
+#include <stdlib.h>
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+//#include <unistd.h>
+
+#include <cassert>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+#define cvs_command synfig::String("cvs -z4")
+
+#ifndef WIN32
+#define HAVE_STRPTIME
+#endif
+
+#ifdef __APPLE__
+time_t _daylight_() { time_t t(time(0)); return localtime(&t)->tm_gmtoff; }
+#define daylight _daylight_()
+#endif
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+CVSInfo::CVSInfo(const synfig::String& file_name)
+{
+ update_available_=false;
+ set_file_name(file_name);
+}
+
+CVSInfo::CVSInfo()
+{
+ update_available_=false;
+}
+
+CVSInfo::~CVSInfo()
+{
+}
+
+void
+CVSInfo::set_file_name(const synfig::String& file_name)
+{
+ file_name_=file_name;
+
+ std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str());
+
+ if(file)
+ {
+ in_sandbox_=true;
+ calc_repository_info();
+ }
+ else
+ in_sandbox_=false;
+}
+
+void
+CVSInfo::calc_repository_info()
+{
+#ifdef _DEBUG
+ synfig::info("in_sandbox() = %d",in_sandbox());
+#endif
+
+ if(!in_sandbox_)
+ return;
+
+ std::ifstream file((dirname(file_name_)+"/CVS/Entries").c_str());
+
+ while(file)
+ {
+ String line;
+ getline(file,line);
+ if(line.find(basename(file_name_))!=String::npos)
+ {
+ in_repository_=true;
+ String::size_type s,f;
+
+ // Grab the version
+ s=line.find('/',1);
+ assert(s!=String::npos);
+ s++;
+ f=line.find('/',s+1);
+ assert(f!=String::npos);
+ cvs_version_=String(line,s,f-s);
+
+ // Grab the time
+#ifdef HAVE_STRPTIME
+ s=f+1;
+ f=line.find('/',s+1);
+ assert(f!=String::npos);
+ tm time_struct;
+ strptime(String(line,s,f-s).c_str(),"%c",&time_struct);
+ original_timestamp_=mktime(&time_struct);
+#endif
+
+ if(
+ system(strprintf(
+ "cd '%s' && cvs status '%s' | grep -q -e 'Needs Patch'",
+ dirname(file_name_).c_str(),
+ basename(file_name_).c_str()
+ ).c_str())==0
+ )
+ {
+ synfig::info("UPDATE_AVAILABLE=TRUE");
+ update_available_=true;
+ }
+ else
+ {
+ system(strprintf(
+ "cd '%s' && cvs status '%s'",
+ dirname(file_name_).c_str(),
+ basename(file_name_).c_str()
+ ).c_str());
+ synfig::info("UPDATE_AVAILABLE=FALSE");
+ update_available_=false;
+ }
+
+
+#ifdef _DEBUG
+ synfig::info("in_repository() = %d",in_repository());
+ synfig::info("get_cvs_version() = %s",get_cvs_version().c_str());
+ synfig::info("get_original_timestamp() = %s",ctime(&get_original_timestamp()));
+ time_t t(get_current_timestamp());
+ synfig::info("get_current_timestamp() = %s",ctime(&t));
+ synfig::info("get_cvs_root() = %s",get_cvs_root().c_str());
+ synfig::info("get_cvs_module() = %s",get_cvs_module().c_str());
+#endif
+ return;
+ }
+ }
+
+ in_repository_=false;
+ cvs_version_.clear();
+ original_timestamp_=0;
+
+#ifdef _DEBUG
+ synfig::info("in_repository() = %d",in_repository());
+#endif
+}
+
+bool
+CVSInfo::in_sandbox()const
+{
+ return in_sandbox_;
+}
+
+bool
+CVSInfo::in_repository()const
+{
+ if(!in_sandbox_)
+ return false;
+ return in_repository_;
+}
+
+bool
+CVSInfo::is_modified()const
+{
+#ifdef _DEBUG
+ synfig::info("%d-%d=%d",get_current_timestamp(),get_original_timestamp(),get_current_timestamp()-get_original_timestamp());
+#endif
+ if(!in_sandbox() || !in_repository())
+ return false;
+ return get_current_timestamp()!=get_original_timestamp() && abs(get_current_timestamp()-get_original_timestamp())!=3600;
+}
+
+bool
+CVSInfo::is_updated()const
+{
+ return update_available_;
+}
+
+const synfig::String&
+CVSInfo::get_cvs_version()const
+{
+ return cvs_version_;
+}
+
+const time_t&
+CVSInfo::get_original_timestamp()const
+{
+ return original_timestamp_;
+}
+
+time_t
+CVSInfo::get_current_timestamp()const
+{
+ struct stat st;
+ if(stat(file_name_.c_str(),&st)<0)
+ {
+ synfig::error("Unable to get file stats");
+ return false;
+ }
+ return st.st_mtime+timezone+(daylight-1)*3600;
+}
+
+synfig::String
+CVSInfo::get_cvs_root()const
+{
+ if(!in_sandbox_)
+ return synfig::String();
+
+ std::ifstream file((dirname(file_name_)+"/CVS/Root").c_str());
+
+ if(file)
+ {
+ String ret;
+ getline(file,ret);
+ return ret;
+ }
+
+ return synfig::String();
+}
+
+synfig::String
+CVSInfo::get_cvs_module()const
+{
+ if(!in_sandbox_)
+ return synfig::String();
+
+ std::ifstream file((dirname(file_name_)+"/CVS/Repository").c_str());
+
+ if(file)
+ {
+ String ret;
+ getline(file,ret);
+ return ret;
+ }
+
+ return synfig::String();
+}
+
+// This function pre-processes the message so that we
+// don't get any CVS syntax errors.
+inline synfig::String fix_msg(const synfig::String& message)
+{
+ synfig::String ret;
+ int i;
+ for(i=0;i<(int)message.size();i++)
+ {
+ if(message[i]=='\'')
+ ret+="'\"'\"'";
+ else
+ ret+=message[i];
+ }
+ return ret;
+}
+
+void
+CVSInfo::cvs_add(const synfig::String& message)
+{
+ if(!in_sandbox_)
+ {
+ synfig::error("cvs_add(): Not in a sand box");
+ throw int();
+ return;
+ }
+
+ synfig::String command(strprintf("cd '%s' && %s add -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str()));
+
+ int ret(system(command.c_str()));
+
+ calc_repository_info();
+
+ switch(ret)
+ {
+ case 0:
+ break;
+ default:
+ synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
+ throw(ret);
+ break;
+ }
+}
+
+void
+CVSInfo::cvs_update()
+{
+ if(!in_sandbox_)
+ {
+ synfig::error("cvs_update(): Not in a sand box");
+ throw int();
+ return;
+ }
+
+ synfig::String command(strprintf("cd '%s' && %s update '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),basename(file_name_).c_str()));
+
+ int ret(system(command.c_str()));
+
+ calc_repository_info();
+
+ switch(ret)
+ {
+ case 0:
+ break;
+ default:
+ synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
+ throw(ret);
+ break;
+ }
+}
+
+void
+CVSInfo::cvs_commit(const synfig::String& message)
+{
+ if(!in_sandbox_)
+ {
+ synfig::error("cvs_commit(): Not in a sand box");
+ throw int();
+ return;
+ }
+
+ synfig::String command(strprintf("cd '%s' && %s commit -m '%s' '%s'",dirname(file_name_).c_str(),cvs_command.c_str(),fix_msg(message).c_str(),basename(file_name_).c_str()));
+
+ int ret(system(command.c_str()));
+
+ calc_repository_info();
+
+ switch(ret)
+ {
+ case 0:
+ break;
+ default:
+ synfig::error("Unknown errorcode %d (\"%s\")",ret,command.c_str());
+ if(is_modified())
+ throw(ret);
+ break;
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file cvs.h
+** \brief Template Header
+**
+** $Id: cvs.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_CVS_H
+#define __SYNFIG_CVS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/string.h>
+#include <time.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class CVSInfo
+{
+ synfig::String file_name_;
+
+ bool in_sandbox_;
+ bool in_repository_;
+ bool update_available_;
+
+ synfig::String cvs_version_;
+ time_t original_timestamp_;
+
+
+public:
+ void calc_repository_info();
+
+ CVSInfo(const synfig::String& file_name);
+ CVSInfo();
+ ~CVSInfo();
+
+ void set_file_name(const synfig::String& file_name);
+
+// READ OPERATIONS --------------------------------------------------
+
+ //! Returns TRUE if \a file_name is in a sandbox
+ bool in_sandbox()const;
+
+ //! Returns TRUE if \a file_name is in the repository
+ bool in_repository()const;
+
+ //! Returns TRUE if \a file_name has modifications not yet on the repository
+ bool is_modified()const;
+
+ //! Returns TRUE if there is a new version of \a file_name on the repository
+ bool is_updated()const;
+
+ //! Returns the CVS version string
+ const synfig::String& get_cvs_version()const;
+
+ //! Returns the unix timestamp of the repository file
+ const time_t &get_original_timestamp()const;
+
+ //! Returns the unix timestamp of the checked out file
+ time_t get_current_timestamp()const;
+
+ //! Returns the Root
+ synfig::String get_cvs_root()const;
+
+ //! Returns the name of the module
+ synfig::String get_cvs_module()const;
+
+// WRITE OPERATIONS -------------------------------------------------
+
+ void cvs_add(const synfig::String& message=synfig::String());
+
+ void cvs_update();
+
+ void cvs_commit(const synfig::String& message=synfig::String());
+}; // END of class CVSInfo
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file editmode.h
+** \brief Template Header
+**
+** $Id: editmode.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_EDITMODE_H
+#define __SYNFIG_EDITMODE_H
+
+/* === H E A D E R S ======================================================= */
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+/*! \enum EditMode
+** \brief \writeme
+*/
+enum EditMode
+{
+ MODE_NORMAL =0, //!< Normal editing mode. Place holder.
+
+ MODE_ANIMATE =(1<<0), //!< Animated editing mode.
+ MODE_ANIMATE_FUTURE =(1<<1), //!< Respect <i>future</i> keyframes
+ MODE_ANIMATE_PAST =(1<<2), //!< Respect <i>past</i> keyframes
+ MODE_ANIMATE_ALL =(3<<1), //!< Respect <i>all</i> keyframes
+
+ MODE_UNDEFINED =(~0) //!< Undefined Mode
+}; // END of enum EditMode
+
+//! Combine Flags
+inline EditMode
+operator|(const EditMode& lhs, const EditMode& rhs)
+{ return static_cast<EditMode>(int(lhs)|int(rhs)); }
+
+//! Exclude Flags
+inline EditMode
+operator-(const EditMode& lhs, const EditMode& rhs)
+{ return static_cast<EditMode>(int(lhs)&~int(rhs)); }
+
+inline EditMode&
+operator|=(EditMode& lhs, const EditMode& rhs)
+{ *reinterpret_cast<int*>(&lhs)|=int(rhs); return lhs; }
+
+//! Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
+/*! This function will return true of all of the flags
+** in the \a rhs are set in the \a lhs */
+inline EditMode
+operator&(const EditMode& lhs, const EditMode& rhs)
+{ return static_cast<EditMode>(int(lhs)&int(rhs)); }
+
+//! Flag Comparison. THIS IS NOT LESS-THAN-OR-EQUAL-TO.
+/*! This function will return true of all of the flags
+** in the \a rhs are set in the \a lhs */
+inline bool
+operator<=(const EditMode& lhs, const EditMode& rhs)
+{ return lhs&rhs==int(rhs); }
+
+}; // END if namespace synfigapp
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file inputdevice.cpp
+** \brief Template File
+**
+** $Id: inputdevice.cpp,v 1.2 2005/01/12 04:08:32 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "inputdevice.h"
+#include "settings.h"
+#include <cstdio>
+#include <ETL/stringf>
+#include "main.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+class DeviceSettings : public Settings
+{
+ InputDevice* input_device;
+public:
+ DeviceSettings(InputDevice* input_device):
+ input_device(input_device) { }
+
+
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const
+ {
+ if(key=="state")
+ {
+ value=input_device->get_state();
+ return true;
+ }
+ if(key=="bline_width")
+ {
+ value=strprintf("%s",input_device->get_bline_width().get_string().c_str());
+ return true;
+ }
+ if(key=="opacity")
+ {
+ value=strprintf("%f",(float)input_device->get_opacity());
+ return true;
+ }
+ if(key=="blend_method")
+ {
+ value=strprintf("%i",(int)input_device->get_blend_method());
+ return true;
+ }
+ if(key=="color")
+ {
+ Color c(input_device->get_foreground_color());
+ value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
+
+ return true;
+ }
+
+ return Settings::get_value(key, value);
+ }
+
+ virtual bool set_value(const synfig::String& key,const synfig::String& value)
+ {
+ DEBUGPOINT();
+ if(key=="state")
+ {
+ input_device->set_state(value);
+ return true;
+ }
+ if(key=="bline_width")
+ {
+ input_device->set_bline_width(synfig::Distance(value));
+ return true;
+ }
+ if(key=="opacity")
+ {
+ input_device->set_opacity(atof(value.c_str()));
+ return true;
+ }
+ if(key=="blend_method")
+ {
+ input_device->set_blend_method(Color::BlendMethod(atoi(value.c_str())));
+ return true;
+ }
+ if(key=="color")
+ {
+ float r=0,g=0,b=0,a=1;
+ if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
+ return false;
+ input_device->set_foreground_color(synfig::Color(r,g,b,a));
+ return true;
+ }
+
+ return Settings::set_value(key, value);
+ }
+
+ virtual KeyList get_key_list()const
+ {
+ KeyList ret(Settings::get_key_list());
+ ret.push_back("color");
+ ret.push_back("state");
+ ret.push_back("bline_width");
+ ret.push_back("blend_method");
+ ret.push_back("opacity");
+ return ret;
+ }
+};
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+InputDevice::InputDevice(const synfig::String id_, Type type_):
+ id_(id_),
+ type_(type_),
+ state_((type_==TYPE_PEN)?"sketch":"normal"),
+ foreground_color_(Color::black()),
+ background_color_(Color::white()),
+ bline_width_(Distance(1,Distance::SYSTEM_POINTS)),
+ opacity_(1.0f),
+ blend_method_(Color::BLEND_COMPOSITE)
+{
+ switch(type_)
+ {
+ case TYPE_MOUSE:
+ state_="normal";
+ break;
+
+ case TYPE_PEN:
+ state_="draw";
+ break;
+
+ case TYPE_ERASER:
+ state_="normal";
+ break;
+
+ case TYPE_CURSOR:
+ state_="normal";
+ break;
+
+ default:
+ state_="normal";
+ break;
+ }
+
+ device_settings=new DeviceSettings(this);
+ Main::settings().add_domain(device_settings,"input_device."+id_);
+}
+
+InputDevice::~InputDevice()
+{
+ Main::settings().remove_domain("input_device."+id_);
+ delete device_settings;
+}
+
+Settings&
+InputDevice::settings()
+{
+ return *device_settings;
+}
+
+const Settings&
+InputDevice::settings()const
+{
+ return *device_settings;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file template.h
+** \brief Template Header
+**
+** $Id: inputdevice.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_INPUTDEVICE_H
+#define __SYNFIG_INPUTDEVICE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/color.h>
+#include <synfig/vector.h>
+#include <synfig/distance.h>
+#include <synfig/string.h>
+#include <ETL/handle>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+class DeviceSettings;
+
+namespace synfigapp {
+class Settings;
+
+
+class InputDevice : public etl::shared_object
+{
+public:
+ enum Type
+ {
+ TYPE_MOUSE,
+ TYPE_PEN,
+ TYPE_ERASER,
+ TYPE_CURSOR
+ };
+
+ typedef etl::handle<InputDevice> Handle;
+
+private:
+ synfig::String id_;
+ Type type_;
+ synfig::String state_;
+ synfig::Color foreground_color_;
+ synfig::Color background_color_;
+ synfig::Distance bline_width_;
+ synfig::Real opacity_;
+ synfig::Color::BlendMethod blend_method_;
+
+ DeviceSettings* device_settings;
+
+public:
+ InputDevice(const synfig::String id_, Type type_=TYPE_MOUSE);
+ ~InputDevice();
+
+ const synfig::String& get_id()const { return id_; }
+ const synfig::String& get_state()const { return state_; }
+ const synfig::Color& get_foreground_color()const { return foreground_color_; }
+ const synfig::Color& get_background_color()const { return background_color_; }
+ const synfig::Distance& get_bline_width()const { return bline_width_; }
+ const synfig::Real& get_opacity()const { return opacity_; }
+ const synfig::Color::BlendMethod& get_blend_method()const { return blend_method_; }
+ Type get_type()const { return type_; }
+
+ void set_state(const synfig::String& x) { state_=x; }
+ void set_foreground_color(const synfig::Color& x) { foreground_color_=x; }
+ void set_background_color(const synfig::Color& x) { background_color_=x; }
+ void set_bline_width(const synfig::Distance& x) { bline_width_=x; }
+ void set_blend_method(const synfig::Color::BlendMethod& x) { blend_method_=x; }
+ void set_opacity(const synfig::Real& x) { opacity_=x; }
+ void set_type(Type x) { type_=x; }
+
+ Settings& settings();
+ const Settings& settings()const;
+}; // END of class InputDevice
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file instance.cpp
+** \brief Instance
+**
+** $Id: instance.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "instance.h"
+#include "canvasinterface.h"
+#include <iostream>
+#include <synfig/loadcanvas.h>
+#include <synfig/savecanvas.h>
+#include <synfig/valuenode_composite.h>
+#include <synfig/valuenode_radialcomposite.h>
+#include <synfig/valuenode_reference.h>
+#include <map>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+static std::map<loose_handle<Canvas>, loose_handle<Instance> > instance_map_;
+
+/* === P R O C E D U R E S ================================================= */
+
+bool
+synfigapp::is_editable(synfig::ValueNode::Handle value_node)
+{
+ if(ValueNode_Const::Handle::cast_dynamic(value_node)
+ || ValueNode_TimedSwap::Handle::cast_dynamic(value_node)
+ || ValueNode_Animated::Handle::cast_dynamic(value_node)
+ || ValueNode_Composite::Handle::cast_dynamic(value_node)
+ || ValueNode_RadialComposite::Handle::cast_dynamic(value_node)
+ || ValueNode_Reference::Handle::cast_dynamic(value_node)
+ )
+ return true;
+ return false;
+}
+
+etl::handle<Instance>
+synfigapp::find_instance(etl::handle<synfig::Canvas> canvas)
+{
+ if(instance_map_.count(canvas)==0)
+ return 0;
+ return instance_map_[canvas];
+}
+
+/* === M E T H O D S ======================================================= */
+
+Instance::Instance(Canvas::Handle canvas):
+ CVSInfo(canvas->get_file_name()),
+ canvas_(canvas)
+{
+ assert(canvas->is_root());
+
+ unset_selection_manager();
+
+ instance_map_[canvas]=this;
+} // END of synfigapp::Instance::Instance()
+
+handle<Instance>
+Instance::create(Canvas::Handle canvas)
+{
+ // Construct a new instance
+ handle<Instance> instance(new Instance(canvas));
+
+ return instance;
+} // END of synfigapp::Instance::create()
+
+synfig::String
+Instance::get_file_name()const
+{
+ return get_canvas()->get_file_name();
+}
+
+void
+Instance::set_file_name(const synfig::String &name)
+{
+ get_canvas()->set_file_name(name);
+ CVSInfo::set_file_name(name);
+}
+
+Instance::~Instance()
+{
+ instance_map_.erase(canvas_);
+ synfig::info("studio::Instance::~Instance(): Deleted");
+} // END of studio::Instance::~Instance()
+
+handle<CanvasInterface>
+Instance::find_canvas_interface(handle<Canvas> canvas)
+{
+ if(!canvas)
+ return 0;
+ while(canvas->is_inline())
+ canvas=canvas->parent();
+
+ CanvasInterfaceList::iterator iter;
+
+ for(iter=canvas_interface_list().begin();iter!=canvas_interface_list().end();iter++)
+ if((*iter)->get_canvas()==canvas)
+ return *iter;
+
+ return CanvasInterface::create(this,canvas);
+}
+
+bool
+Instance::save()const
+{
+ bool ret=save_canvas(get_file_name(),canvas_);
+ if(ret)
+ {
+ reset_action_count();
+ const_cast<sigc::signal<void>& >(signal_saved_)();
+ }
+ return ret;
+}
+
+bool
+Instance::save_as(const std::string &file_name)const
+{
+ bool ret=save_canvas(file_name,canvas_);
+ if(ret)
+ {
+ reset_action_count();
+ const_cast<sigc::signal<void>& >(signal_saved_)();
+ }
+ return ret;
+}
+
+bool
+Instance::save_as(const std::string &file_name)
+{
+ bool ret;
+
+ String old_file_name(get_file_name());
+
+ set_file_name(file_name);
+
+ ret=save_canvas(file_name,canvas_);
+
+ if(ret)
+ {
+ reset_action_count();
+ signal_saved_();
+ }
+ else
+ {
+ set_file_name(old_file_name);
+ }
+
+ signal_filename_changed_();
+
+ return ret;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file instance.h
+** \brief writeme
+**
+** $Id: instance.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_INSTANCE_H
+#define __SYNFIG_APP_INSTANCE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "action.h"
+#include <ETL/handle>
+#include <synfig/canvas.h>
+#include <synfig/string.h>
+#include <list>
+#include <sigc++/signal.h>
+#include <sigc++/object.h>
+#include "action_system.h"
+#include "selectionmanager.h"
+#include "cvs.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class CanvasInterface;
+
+
+class Instance : public Action::System , public CVSInfo
+{
+ friend class PassiveGrouper;
+ /*
+ -- ** -- P U B L I C T Y P E S ---------------------------------------------
+ */
+
+public:
+
+ typedef std::list< etl::handle<CanvasInterface> > CanvasInterfaceList;
+
+ using etl::shared_object::ref;
+ using etl::shared_object::unref;
+
+ /*
+ -- ** -- P U B L I C D A T A ------------------------------------------------
+ */
+
+public:
+
+ /*
+ -- ** -- P R I V A T E D A T A ---------------------------------------------
+ */
+
+private:
+ //! Handle for root canvas
+ synfig::Canvas::Handle canvas_;
+
+
+ CanvasInterfaceList canvas_interface_list_;
+
+ sigc::signal<void> signal_filename_changed_;
+ sigc::signal<void> signal_saved_;
+ etl::handle<SelectionManager> selection_manager_;
+
+protected:
+ Instance(etl::handle<synfig::Canvas>);
+
+ /*
+ -- ** -- P U B L I C M E T H O D S -----------------------------------------
+ */
+
+public:
+
+ ~Instance();
+
+ void set_selection_manager(const etl::handle<SelectionManager> &sm) { assert(sm); selection_manager_=sm; }
+ void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
+ const etl::handle<SelectionManager> &get_selection_manager() { return selection_manager_; }
+
+
+
+ etl::handle<CanvasInterface> find_canvas_interface(synfig::Canvas::Handle canvas);
+
+ synfig::Canvas::Handle get_canvas()const { return canvas_; }
+
+ //! Saves the instance to filename_
+ bool save()const;
+
+ bool save_as(const synfig::String &filename)const;
+
+ bool save_as(const synfig::String &filename);
+
+public: // Interfaces to internal information
+ sigc::signal<void>& signal_filename_changed() { return signal_filename_changed_; }
+ sigc::signal<void>& signal_saved() { return signal_saved_; }
+
+ CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; }
+ const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; }
+
+ synfig::String get_file_name()const;
+
+ void set_file_name(const synfig::String &name);
+
+public:
+
+
+public: // Constructor interfaces
+ static etl::handle<Instance> create(etl::handle<synfig::Canvas> canvas);
+}; // END class Instance
+
+etl::handle<Instance> find_instance(etl::handle<synfig::Canvas> canvas);
+
+bool is_editable(synfig::ValueNode::Handle value_node);
+
+}; // END namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file main.cpp
+** \brief Template File
+**
+** $Id: main.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "main.h"
+#include "action.h"
+
+#include <synfig/color.h>
+#include <synfig/gradient.h>
+
+#include <ETL/trivial>
+
+#include <list>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === S T A T I C S ======================================================= */
+
+static etl::reference_counter synfigapp_ref_count_(0);
+static synfigapp::Action::Main* action_main;
+
+static Color foreground_;
+static Color background_;
+static Gradient gradient_;
+static bool gradient_default_colors_;
+
+static synfig::Distance bline_width_;
+
+static Color::BlendMethod blend_method_;
+static Real opacity_;
+
+static synfigapp::InputDevice::Handle selected_input_device_;
+static list<synfigapp::InputDevice::Handle> input_devices_;
+
+trivial<sigc::signal<void> > signal_foreground_color_changed_;
+trivial<sigc::signal<void> > signal_background_color_changed_;
+trivial<sigc::signal<void> > signal_gradient_changed_;
+trivial<sigc::signal<void> > signal_bline_width_changed_;
+trivial<sigc::signal<void> > signal_blend_method_changed_;
+trivial<sigc::signal<void> > signal_opacity_changed_;
+trivial<sigc::signal<void> > signal_interpolation_changed_;
+
+trivial<Settings> settings_;
+
+static synfig::Waypoint::Interpolation interpolation_;
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+synfigapp::Main::Main(const synfig::String &basepath,ProgressCallback *cb):
+ synfig::Main(basepath,cb),
+ ref_count_(synfigapp_ref_count_)
+{
+ if(ref_count_.count())
+ return;
+
+ synfigapp_ref_count_.reset();
+ ref_count_=synfigapp_ref_count_;
+
+ // Add initialization after this point
+ action_main=new synfigapp::Action::Main();
+
+ settings_.construct();
+
+ signal_foreground_color_changed_.construct();
+ signal_background_color_changed_.construct();
+ signal_gradient_changed_.construct();
+ signal_opacity_changed_.construct();
+ signal_blend_method_changed_.construct();
+ signal_interpolation_changed_.construct();
+
+ set_foreground_color(Color::black());
+ set_background_color(Color::white());
+ set_gradient_default_colors();
+ set_bline_width(Distance(1,Distance::SYSTEM_POINTS));
+ set_opacity(1.0);
+ set_blend_method(Color::BLEND_COMPOSITE);
+}
+
+synfigapp::Main::~Main()
+{
+ ref_count_.detach();
+ if(!synfigapp_ref_count_.unique())
+ return;
+ synfigapp_ref_count_.detach();
+
+ // Add deinitialization after this point
+
+ delete action_main;
+
+ selected_input_device_=0;
+ input_devices_.clear();
+
+ settings_.destruct();
+ signal_foreground_color_changed_.destruct();
+ signal_background_color_changed_.destruct();
+ signal_gradient_changed_.destruct();
+
+ signal_opacity_changed_.destruct();
+ signal_blend_method_changed_.destruct();
+ signal_interpolation_changed_.destruct();
+}
+
+Settings&
+synfigapp::Main::settings()
+{
+ return settings_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_foreground_color_changed()
+{
+ return signal_foreground_color_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_background_color_changed()
+{
+ return signal_background_color_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_gradient_changed()
+{
+ return signal_gradient_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_bline_width_changed()
+{
+ return signal_bline_width_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_blend_method_changed()
+{
+ return signal_blend_method_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_opacity_changed()
+{
+ return signal_opacity_changed_;
+}
+
+sigc::signal<void>&
+synfigapp::Main::signal_interpolation_changed()
+{
+ return signal_interpolation_changed_;
+}
+
+const synfig::Color&
+synfigapp::Main::get_foreground_color()
+{
+ return foreground_;
+}
+
+const synfig::Color&
+synfigapp::Main::get_background_color()
+{
+ return background_;
+}
+
+const synfig::Gradient&
+synfigapp::Main::get_gradient()
+{
+ return gradient_;
+}
+
+const synfig::Real&
+synfigapp::Main::get_opacity()
+{
+ return opacity_;
+}
+
+synfig::Color::BlendMethod
+synfigapp::Main::get_blend_method()
+{
+ return blend_method_;
+}
+
+void
+synfigapp::Main::set_foreground_color(synfig::Color color)
+{
+ foreground_=color;
+ signal_foreground_color_changed()();
+ if(selected_input_device_)
+ selected_input_device_->set_foreground_color(foreground_);
+ if(gradient_default_colors_)
+ {
+ gradient_=Gradient(foreground_,background_);
+ signal_gradient_changed()();
+ }
+}
+
+void
+synfigapp::Main::set_background_color(synfig::Color color)
+{
+ background_=color;
+ signal_background_color_changed()();
+
+ if(selected_input_device_)
+ selected_input_device_->set_background_color(background_);
+
+ if(gradient_default_colors_)
+ {
+ gradient_=Gradient(foreground_,background_);
+ signal_gradient_changed()();
+ }
+}
+
+void
+synfigapp::Main::set_gradient(synfig::Gradient gradient)
+{
+ gradient_=gradient;
+ gradient_default_colors_=false;
+ signal_gradient_changed()();
+}
+
+void
+synfigapp::Main::set_gradient_default_colors()
+{
+ gradient_default_colors_=true;
+ gradient_=Gradient(foreground_,background_);
+ signal_gradient_changed()();
+}
+
+void
+synfigapp::Main::color_swap()
+{
+ const Color tmp(foreground_);
+ foreground_=background_;
+ background_=tmp;
+
+ if(selected_input_device_)
+ {
+ selected_input_device_->set_foreground_color(foreground_);
+ selected_input_device_->set_background_color(background_);
+ }
+
+ signal_foreground_color_changed()();
+ signal_background_color_changed()();
+
+ if(gradient_default_colors_)
+ {
+ gradient_=Gradient(foreground_,background_);
+ signal_gradient_changed()();
+ }
+}
+
+synfig::Waypoint::Interpolation
+synfigapp::Main::get_interpolation()
+{
+ return interpolation_;
+}
+
+
+void
+synfigapp::Main::set_interpolation(synfig::Waypoint::Interpolation x)
+{
+ if(interpolation_!=x)
+ {
+ interpolation_=x;
+
+ signal_interpolation_changed();
+ }
+}
+
+const synfig::Distance&
+synfigapp::Main::get_bline_width()
+{
+ return bline_width_;
+}
+
+void
+synfigapp::Main::set_bline_width(synfig::Distance x)
+{
+ if(x<0)x=0;
+ if(x!=bline_width_)
+ {
+ bline_width_=x;
+
+ if(selected_input_device_)
+ selected_input_device_->set_bline_width(x);
+
+ signal_bline_width_changed()();
+ }
+}
+
+void
+synfigapp::Main::set_opacity(synfig::Real x)
+{
+ opacity_=x;
+ if(selected_input_device_)
+ selected_input_device_->set_opacity(opacity_);
+ signal_opacity_changed()();
+}
+
+void
+synfigapp::Main::set_blend_method(synfig::Color::BlendMethod x)
+{
+ blend_method_=x;
+ if(selected_input_device_)
+ selected_input_device_->set_blend_method(x);
+ signal_blend_method_changed()();
+}
+
+
+InputDevice::Handle
+synfigapp::Main::add_input_device(const synfig::String id, InputDevice::Type type)
+{
+ input_devices_.push_back(new InputDevice(id,type));
+ return input_devices_.back();
+}
+
+InputDevice::Handle
+synfigapp::Main::find_input_device(const synfig::String id)
+{
+ list<InputDevice::Handle>::iterator iter;
+ for(iter=input_devices_.begin();iter!=input_devices_.end();++iter)
+ if((*iter)->get_id()==id)
+ return *iter;
+ return 0;
+}
+
+InputDevice::Handle
+synfigapp::Main::select_input_device(const synfig::String id)
+{
+ InputDevice::Handle input_device(find_input_device(id));
+ if(!input_device)
+ return 0;
+ if(!select_input_device(input_device))
+ return 0;
+ return input_device;
+}
+
+bool
+synfigapp::Main::select_input_device(InputDevice::Handle input_device)
+{
+ assert(input_device);
+
+ synfig::info("Input device changed to \"%s\"",input_device->get_id().c_str());
+
+ selected_input_device_=input_device;
+
+ set_bline_width(input_device->get_bline_width());
+ set_foreground_color(input_device->get_foreground_color());
+ set_opacity(input_device->get_opacity());
+ set_blend_method(input_device->get_blend_method());
+
+ return true;
+}
+
+InputDevice::Handle
+synfigapp::Main::get_selected_input_device()
+{
+ return selected_input_device_;
+}
+
+void
+synfigapp::Main::set_state(synfig::String state)
+{
+ if(selected_input_device_)
+ selected_input_device_->set_state(state);
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file main.h
+** \brief Template Header
+**
+** $Id: main.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIGAPP_MAIN_H
+#define __SYNFIGAPP_MAIN_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <ETL/ref_count>
+#include <synfig/string.h>
+#include <synfig/general.h>
+#include <synfig/main.h>
+#include <synfig/distance.h>
+#include <synfig/real.h>
+#include <synfig/waypoint.h>
+#include <sigc++/signal.h>
+#include <sigc++/object.h>
+#include "inputdevice.h"
+#include "settings.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfig {
+ class Color;
+ class Gradient;
+};
+
+namespace synfigapp {
+
+/*! \class synfigapp::Main
+** \brief \writeme
+**
+** \writeme
+*/
+class Main : public synfig::Main
+{
+ etl::reference_counter ref_count_;
+public:
+ Main(const synfig::String &basepath,synfig::ProgressCallback *cb=0);
+ ~Main();
+
+ const etl::reference_counter& ref_count()const { return ref_count_; }
+
+ static const synfig::Color& get_foreground_color();
+ static const synfig::Color& get_background_color();
+ static const synfig::Gradient& get_gradient();
+ static const synfig::Distance& get_bline_width();
+ static synfig::Waypoint::Interpolation get_interpolation();
+
+
+ static void set_interpolation(synfig::Waypoint::Interpolation x);
+ static void set_bline_width(synfig::Distance x);
+ static void set_foreground_color(synfig::Color color);
+ static void set_background_color(synfig::Color color);
+ static void set_gradient(synfig::Gradient gradient);
+ static void set_gradient_default_colors();
+ static void color_swap();
+
+ static synfig::Color::BlendMethod get_blend_method();
+ static const synfig::Real& get_opacity();
+ static void set_blend_method(synfig::Color::BlendMethod);
+ static void set_opacity(synfig::Real);
+ static sigc::signal<void>& signal_blend_method_changed();
+ static sigc::signal<void>& signal_opacity_changed();
+ static sigc::signal<void>& signal_interpolation_changed();
+
+ // Input Device stuff
+ static InputDevice::Handle add_input_device(const synfig::String id_, InputDevice::Type type_=InputDevice::TYPE_MOUSE);
+ static InputDevice::Handle find_input_device(const synfig::String id_);
+ static InputDevice::Handle select_input_device(const synfig::String id_);
+ static bool select_input_device(InputDevice::Handle input_device);
+ static InputDevice::Handle get_selected_input_device();
+ static void set_state(synfig::String state);
+
+ static Settings& settings();
+
+ // Signal interfaces
+ static sigc::signal<void>& signal_foreground_color_changed();
+ static sigc::signal<void>& signal_background_color_changed();
+ static sigc::signal<void>& signal_gradient_changed();
+ static sigc::signal<void>& signal_bline_width_changed();
+
+}; // END of class Main
+
+}; // END if namespace synfigapp
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file template.h
+** \brief Template Header
+**
+** $Id: selectionmanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_SELECTIONMANAGER_H
+#define __SYNFIG_APP_SELECTIONMANAGER_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <list>
+#include <set>
+#include <ETL/handle>
+#include <synfig/layer.h>
+#include <synfig/valuenode.h>
+#include "value_desc.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class SelectionManager : public etl::shared_object
+{
+public:
+ typedef std::pair<synfig::Layer::Handle,synfig::String> LayerParam;
+ typedef std::list<LayerParam> LayerParamList;
+
+ typedef std::list<synfig::Layer::Handle> LayerList;
+ typedef std::list<ValueDesc> ChildrenList;
+ //typedef std::list<synfig::ValueNode::Handle> ValueNodeList;
+
+ virtual ~SelectionManager() { }
+
+ //! Returns the number of layers selected.
+ virtual int get_selected_layer_count()const=0;
+
+ //! Returns a list of the currently selected layers.
+ virtual LayerList get_selected_layers()const=0;
+
+ //! Returns the first layer selected or an empty handle if none are selected.
+ virtual synfig::Layer::Handle get_selected_layer()const=0;
+
+ //! Sets which layers should be selected
+ virtual void set_selected_layers(const LayerList &layer_list)=0;
+
+ //! Sets which layer should be selected. Empty handle if none.
+ virtual void set_selected_layer(const synfig::Layer::Handle &layer)=0;
+
+ //! Clears the layer selection list
+ virtual void clear_selected_layers()=0;
+
+
+
+ //! Returns the number of childrens selected.
+ virtual int get_selected_children_count()const=0;
+
+ //! Returns a list of the currently selected childrens.
+ virtual ChildrenList get_selected_children()const=0;
+
+ //! Returns the first children selected or an empty handle if none are selected.
+ virtual ChildrenList::value_type get_selected_child()const=0;
+
+ //! Sets which childrens should be selected
+ virtual void set_selected_children(const ChildrenList &children_list)=0;
+
+ //! Sets which children should be selected. Empty handle if none.
+ virtual void set_selected_child(const ChildrenList::value_type &children)=0;
+
+ //! Clears the children selection list
+ virtual void clear_selected_children()=0;
+
+
+ //! Returns the number of layer parameters selected.
+ virtual int get_selected_layer_parameter_count()const=0;
+
+ //! Returns a list of the currently selected layer parameters.
+ virtual LayerParamList get_selected_layer_parameters()const=0;
+
+ //! Returns the first layer parameter selected or an empty handle if none are selected.
+ virtual LayerParam get_selected_layer_parameter()const=0;
+
+ //! Sets which layer parameters should be selected
+ virtual void set_selected_layer_parameters(const LayerParamList &layer_param_list)=0;
+
+ //! Sets which layer parameter should be selected. Empty handle if none.
+ virtual void set_selected_layer_param(const LayerParam &layer_param)=0;
+
+ //! Clears the layer parameter selection list
+ virtual void clear_selected_layer_parameters()=0;
+}; // END of class SelectionManager
+
+//! A place holding selection manager that does nothing
+class NullSelectionManager : public SelectionManager
+{
+public:
+ int get_selected_layer_count()const { return 0; }
+ LayerList get_selected_layers()const { return LayerList(); }
+ synfig::Layer::Handle get_selected_layer()const { return 0; }
+ void set_selected_layers(const LayerList &layer_list) { return; }
+ void set_selected_layer(const synfig::Layer::Handle &layer) { return; }
+ void clear_selected_layers() { return; }
+
+
+ int get_selected_children_count()const { return 0; }
+ ChildrenList get_selected_children()const { return ChildrenList(); }
+ ChildrenList::value_type get_selected_child()const { return ChildrenList::value_type(); }
+ void set_selected_children(const ChildrenList &children_list) { return; }
+ void set_selected_child(const ChildrenList::value_type &child) { return; }
+ void clear_selected_children() { return; }
+
+ int get_selected_layer_parameter_count()const { return 0; }
+ LayerParamList get_selected_layer_parameters()const { return LayerParamList(); }
+ LayerParam get_selected_layer_parameter()const { return LayerParam(); }
+ void set_selected_layer_parameters(const LayerParamList &layer_param_list) { return; }
+ void set_selected_layer_param(const LayerParam &layer_param) { return; }
+ void clear_selected_layer_parameters() { return; }
+
+}; // END of class NullSelectionManager
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file template.cpp
+** \brief Template File
+**
+** $Id: settings.cpp,v 1.2 2005/01/12 04:08:32 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <fstream>
+#include <iostream>
+#include "settings.h"
+#include <synfig/general.h>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Settings::Settings()
+{
+}
+
+Settings::~Settings()
+{
+}
+
+synfig::String
+Settings::get_value(const synfig::String& key)const
+{
+ synfig::String value;
+ if(!get_value(key,value))
+ return synfig::String();
+ return value;
+}
+
+void
+Settings::add_domain(Settings* domain, const synfig::String& name)
+{
+ domain_map[name]=domain;
+}
+
+void
+Settings::remove_domain(const synfig::String& name)
+{
+ domain_map.erase(name);
+}
+
+bool
+Settings::get_value(const synfig::String& key, synfig::String& value)const
+{
+ // Search for the value in any children domains
+ DomainMap::const_iterator iter;
+ for(iter=domain_map.begin();iter!=domain_map.end();++iter)
+ {
+ // if we have a domain hit
+ if(key.size()>iter->first.size() && String(key.begin(),key.begin()+iter->first.size())==iter->first)
+ {
+ synfig::String key_(key.begin()+iter->first.size()+1,key.end());
+
+ // If the domain has it, then we have got a hit
+ if(iter->second->get_value(key_,value))
+ return true;
+ }
+ }
+
+ // Search for the value in our simple map
+ if(simple_value_map.count(key))
+ {
+ value=simple_value_map.find(key)->second;
+ return true;
+ }
+
+ // key not found
+ return false;
+}
+
+bool
+Settings::set_value(const synfig::String& key,const synfig::String& value)
+{
+ // Search for the key in any children domains
+ DomainMap::iterator iter;
+ for(iter=domain_map.begin();iter!=domain_map.end();++iter)
+ {
+ // if we have a domain hit
+ if(key.size()>iter->first.size() && String(key.begin(),key.begin()+iter->first.size())==iter->first)
+ {
+ synfig::String key_(key.begin()+iter->first.size()+1,key.end());
+
+ return iter->second->set_value(key_,value);
+ }
+ }
+
+ simple_value_map[key]=value;
+ return true;
+}
+
+Settings::KeyList
+Settings::get_key_list()const
+{
+ KeyList key_list;
+
+ // Get keys from the domains
+ {
+ DomainMap::const_iterator iter;
+ for(iter=domain_map.begin();iter!=domain_map.end();++iter)
+ {
+ KeyList sub_key_list(iter->second->get_key_list());
+ KeyList::iterator key_iter;
+ for(key_iter=sub_key_list.begin();key_iter!=sub_key_list.end();++key_iter)
+ key_list.push_back(iter->first+'.'+*key_iter);
+ }
+ }
+
+ // Get keys from the simple variables
+ {
+ ValueBaseMap::const_iterator iter;
+ for(iter=simple_value_map.begin();iter!=simple_value_map.end();++iter)
+ key_list.push_back(iter->first);
+ }
+
+ // Sort the keys
+ key_list.sort();
+
+ return key_list;
+}
+
+bool
+Settings::save_to_file(const synfig::String& filename)const
+{
+ synfig::String tmp_filename(filename+".TMP");
+
+ try
+ {
+ std::ofstream file(tmp_filename.c_str());
+
+ if(!file)return false;
+
+ KeyList key_list(get_key_list());
+
+ // Save the keys
+ {
+ KeyList::const_iterator iter;
+ for(iter=key_list.begin();iter!=key_list.end();++iter)
+ {
+ if(!file)return false;
+ file<<*iter<<'='<<get_value(*iter)<<endl;
+ }
+ }
+
+ if(!file)
+ return false;
+ }catch(...) { return false; }
+
+#ifdef _WIN32
+ char old_file[80]="sif.XXXXXXXX";
+ mktemp(old_file);
+ rename(filename.c_str(),old_file);
+ if(rename(tmp_filename.c_str(),filename.c_str())!=0)
+ {
+ rename(old_file,tmp_filename.c_str());
+ return false;
+ }
+ remove(old_file);
+#else
+ if(rename(tmp_filename.c_str(),filename.c_str())!=0)
+ return false;
+#endif
+
+ return true;
+}
+
+bool
+Settings::load_from_file(const synfig::String& filename)
+{
+ std::ifstream file(filename.c_str());
+ if(!file)
+ return false;
+ while(file)
+ {
+ std::string line;
+ getline(file,line);
+ if(!line.empty() && ((line[0]>='a' && line[0]<='z')||(line[0]>='A' && line[0]<='Z')))
+ {
+ std::string::iterator equal(find(line.begin(),line.end(),'='));
+ if(equal==line.end())
+ continue;
+ std::string key(line.begin(),equal);
+ std::string value(equal+1,line.end());
+
+ //synfig::info("Settings::load_from_file(): Trying Key \"%s\" with a value of \"%s\".",key.c_str(),value.c_str());
+ try{
+ if(!set_value(key,value))
+ synfig::warning("Settings::load_from_file(): Key \"%s\" with a value of \"%s\" was rejected.",key.c_str(),value.c_str());
+ }
+ catch(...)
+ {
+ synfig::error("Settings::load_from_file(): Attept to set key \"%s\" with a value of \"%s\" has thrown an exception.",key.c_str(),value.c_str());
+ throw;
+ }
+ }
+ }
+ return true;
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file template.h
+** \brief Template Header
+**
+** $Id: settings.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_SETTINGS_H
+#define __SYNFIG_SETTINGS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/string.h>
+#include <map>
+#include <list>
+#include <ETL/stringf>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Settings
+{
+public:
+
+ typedef std::list<synfig::String> KeyList;
+ typedef std::map<synfig::String,synfig::String> ValueBaseMap;
+ typedef std::map<synfig::String,Settings*> DomainMap;
+
+private:
+ ValueBaseMap simple_value_map;
+
+ DomainMap domain_map;
+
+public:
+ Settings();
+ virtual ~Settings();
+
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const;
+ virtual bool set_value(const synfig::String& key,const synfig::String& value);
+ virtual KeyList get_key_list()const;
+
+ synfig::String get_value(const synfig::String& key)const;
+ void add_domain(Settings* domain, const synfig::String& name);
+ void remove_domain(const synfig::String& name);
+
+ bool load_from_string(const synfig::String& data);
+ bool save_to_string(synfig::String& data);
+
+ bool load_from_file(const synfig::String& filename);
+ bool save_to_file(const synfig::String& filename)const;
+}; // END of class Settings
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timegather.cpp
+** \brief Time Gather File
+**
+** $Id: timegather.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "timegather.h"
+#include "value_desc.h"
+
+#include <synfig/layer_pastecanvas.h>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+/* === E N T R Y P O I N T ================================================= */
+
+//! Definitions for build a list of accurate valuenode references
+
+void synfigapp::timepoints_ref::insert(synfig::ValueNode_Animated::Handle v, synfig::Waypoint w)
+{
+ ValueBaseTimeInfo vt;
+ vt.val = v;
+
+ waytracker::iterator i = waypointbiglist.find(vt);
+
+ if(i != waypointbiglist.end())
+ {
+ i->waypoints.insert(w);
+ }else
+ {
+ vt.waypoints.insert(w);
+ waypointbiglist.insert(vt);
+ }
+}
+
+void synfigapp::timepoints_ref::insert(synfigapp::ValueDesc v, synfig::Activepoint a)
+{
+ ActiveTimeInfo vt;
+ vt.val = v;
+
+ acttracker::iterator i = actpointbiglist.find(vt);
+
+ if(i != actpointbiglist.end())
+ {
+ i->activepoints.insert(a);
+ /*{ //if it fails...
+ synfig::info("!!!!For some reason it wasn't able to insert the activepoint in the list (%s,%.4lg)",
+ a.state?"true":"false", (double)a.time);
+ }*/
+ }else
+ {
+ vt.activepoints.insert(a);
+ actpointbiglist.insert(vt);
+ //synfig::info("Insert new activept list for valdesc");
+ }
+}
+
+//recursion functions
+void synfigapp::recurse_canvas(synfig::Canvas::Handle h, const std::set<Time> &tlist,
+ timepoints_ref &vals)
+{
+
+ //synfig::info("Canvas...\n Recurse through layers");
+ // iterate through the layers
+
+ synfig::Canvas::iterator i = h->begin(), end = h->end();
+
+ for(; i != end; ++i)
+ {
+ const Node::time_set &tset = (*i)->get_times();
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ {
+ recurse_layer(*i,tlist,vals);
+ }
+ }
+}
+
+void synfigapp::recurse_layer(synfig::Layer::Handle h, const std::set<Time> &tlist,
+ timepoints_ref &vals)
+{
+ // iterate through the layers
+ //check for special case of paste canvas
+ etl::handle<synfig::Layer_PasteCanvas> p = etl::handle<synfig::Layer_PasteCanvas>::cast_dynamic(h);
+
+ //synfig::info("Layer...");
+
+ if(p)
+ {
+ //synfig::info("We are a paste canvas so go into that");
+ //recurse into the canvas
+ const synfig::Node::time_set &tset = p->get_sub_canvas()->get_times();
+
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ {
+ //we have to offset the times so it won't wreck havoc if the canvas is imported more than once...
+ // and so we get correct results when offsets are present
+ std::set<Time> tlistoff;
+ std::set<Time>::iterator i = tlist.begin(), end = tlist.end();
+ for(; i != end; ++i)
+ {
+ tlistoff.insert(*i - p->get_time_offset());
+ }
+
+ recurse_canvas(p->get_sub_canvas(),tlist,vals);
+ }
+ }
+
+ //check all the valuenodes regardless...
+ //synfig::info("Recurse all valuenodes");
+ synfig::Layer::DynamicParamList::const_iterator i = h->dynamic_param_list().begin(),
+ end = h->dynamic_param_list().end();
+ for(; i != end; ++i)
+ {
+ const synfig::Node::time_set &tset = i->second->get_times();
+
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ {
+ recurse_valuedesc(ValueDesc(h,i->first),tlist,vals);
+ }
+ }
+}
+
+template < typename IT, typename CMP >
+static bool sorted(IT i,IT end, const CMP &cmp = CMP())
+{
+ if(i == end) return true;
+
+ for(IT last = i++; i != end; last = i++)
+ {
+ if(!cmp(*last,*i))
+ return false;
+ }
+
+ return true;
+}
+
+void synfigapp::recurse_valuedesc(synfigapp::ValueDesc h, const std::set<Time> &tlist,
+ timepoints_ref &vals)
+{
+ //special cases for Animated, DynamicList, and Linkable
+
+ //synfig::info("ValueBasenode... %p, %s", h.get_value_node().get(),typeid(*h.get_value_node()).name());
+
+
+ //animated case
+ {
+ synfig::ValueNode_Animated::Handle p = synfig::ValueNode_Animated::Handle::cast_dynamic(h.get_value_node());
+
+ if(p)
+ {
+ //loop through and determine which waypoint we will need to reference
+ const synfig::WaypointList &w = p->waypoint_list();
+
+ synfig::WaypointList::const_iterator i = w.begin(),
+ end = w.end();
+
+ std::set<Time>::const_iterator j = tlist.begin(),
+ jend = tlist.end();
+ for(; i != end && j != jend;)
+ {
+ //synfig::info("tpair t(%.3f) = %.3f", (float)*j, (float)(i->get_time()));
+
+ if(j->is_equal(i->get_time()))
+ {
+ vals.insert(p,*i);
+ ++i,++j;
+ }else if(*i < *j)
+ {
+ ++i;
+ }else ++j;
+ }
+ return;
+ }
+ }
+
+ //parent dynamiclist case - just for active points for that object...
+ if(h.parent_is_value_node())
+ {
+ synfig::ValueNode_DynamicList::Handle p = synfig::ValueNode_DynamicList::Handle::cast_dynamic(h.get_parent_value_node());
+
+ if(p)
+ {
+ int index = h.get_index();
+
+ //check all the active points in each list...
+ const synfig::ActivepointList &a = p->list[index].timing_info;
+
+ //synfig::info("Our parent = dynamic list, searching in %d activepts",a.size());
+
+ std::set<Time>::const_iterator i = tlist.begin(),
+ end = tlist.end();
+
+ synfig::ActivepointList::const_iterator j = a.begin(),
+ jend = a.end();
+
+ for(; j != jend && i != end;)
+ {
+ double it = *i;
+ double jt = j->get_time();
+ double diff = (double)(it - jt);
+
+ //synfig::info("\ttpair match(%.4lg) - %.4lg (diff = %lg",it,jt,diff);
+
+ //
+ if(abs(diff) < (double)Time::epsilon())
+ {
+ //synfig::info("\tActivepoint to add being referenced (%x,%s,%.4lg)",
+ // (int)j->get_uid(),j->state?"true":"false", (double)j->time);
+ vals.insert(ValueDesc(p,index),*j);
+ ++i,++j;
+ }else if(it < jt)
+ {
+ ++i;
+ //synfig::info("\tIncrementing time");
+ }
+ else
+ {
+ ++j;
+ //synfig::info("\tIncrementing actpt");
+ }
+ }
+ }
+ }
+
+ //dynamiclist case - we must still make sure that we read from the list entries the time values
+ // because just the linked valuenodes will not do that
+ {
+ synfig::ValueNode_DynamicList::Handle p = synfig::ValueNode_DynamicList::Handle::cast_dynamic(h.get_value_node());
+
+ if(p)
+ {
+ //synfig::info("Process dynamic list valuenode");
+ int index = 0;
+
+ std::vector<synfig::ValueNode_DynamicList::ListEntry>::const_iterator
+ i = p->list.begin(),
+ end = p->list.end();
+
+ for(; i != end; ++i, ++index)
+ {
+ const Node::time_set &tset = i->get_times();
+
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ {
+ recurse_valuedesc(ValueDesc(p,index),tlist,vals);
+ }
+ }
+ return;
+ }
+ }
+
+ //the linkable case...
+ {
+ etl::handle<synfig::LinkableValueNode> p = etl::handle<synfig::LinkableValueNode>::cast_dynamic(h.get_value_node());
+
+ if(p)
+ {
+ //synfig::info("Process Linkable ValueBasenode");
+ int i = 0, size = p->link_count();
+
+ for(; i < size; ++i)
+ {
+ ValueNode::Handle v = p->get_link(i);
+ const Node::time_set &tset = v->get_times();
+
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ {
+ recurse_valuedesc(ValueDesc(p,i),tlist,vals);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file timegather.h
+** \brief Time Gather Header
+**
+** $Id: timegather.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2004 Adrian Bentley
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_TIMEGATHER_H
+#define __SYNFIG_TIMEGATHER_H
+
+/* === H E A D E R S ======================================================= */
+#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_dynamiclist.h>
+#include <synfig/time.h>
+#include "value_desc.h"
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class ValueDesc;
+class synfig::Time;
+
+struct ValueBaseTimeInfo
+{
+ synfig::ValueNode_Animated::Handle val;
+ mutable std::set<synfig::Waypoint> waypoints;
+
+ bool operator<(const ValueBaseTimeInfo &rhs) const
+ {
+ return val < rhs.val;
+ }
+};
+
+struct ActiveTimeInfo
+{
+ struct actcmp
+ {
+ bool operator()(const synfig::Activepoint &lhs, const synfig::Activepoint &rhs) const
+ {
+ return lhs.time < rhs.time;
+ }
+ };
+
+ synfigapp::ValueDesc val;
+
+ typedef std::set<synfig::Activepoint,actcmp> set;
+
+ mutable set activepoints;
+
+ bool operator<(const ActiveTimeInfo &rhs) const
+ {
+ return val.get_parent_value_node() == rhs.val.get_parent_value_node() ?
+ val.get_index() < rhs.val.get_index() :
+ val.get_parent_value_node() < rhs.val.get_parent_value_node();
+ }
+};
+
+struct timepoints_ref
+{
+ typedef std::set<ValueBaseTimeInfo> waytracker;
+ typedef std::set<ActiveTimeInfo> acttracker;
+
+ waytracker waypointbiglist;
+ acttracker actpointbiglist;
+
+ void insert(synfig::ValueNode_Animated::Handle v, synfig::Waypoint w);
+ void insert(synfigapp::ValueDesc v, synfig::Activepoint a);
+};
+
+//assumes they're sorted... (incremental advance)
+//checks the intersection of the two sets... might be something better in the stl
+template < typename I1, typename I2 >
+bool check_intersect(I1 b1, I1 end1, I2 b2, I2 end2)
+{
+ if(b1 == end1 || b2 == end2)
+ return false;
+
+ for(; b1 != end1 && b2 != end2;)
+ {
+ if(*b1 < *b2) ++b1;
+ else if(*b2 < *b1) ++b2;
+ else
+ {
+ assert(*b1 == *b2);
+ return true;
+ }
+ }
+ return false;
+}
+
+//pointer kind of a hack, gets the accurate times from a value desc
+// (deals with dynamic list member correctly... i.e. gathers activepoints)
+const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v);
+
+//get's the closest time inside the set
+bool get_closest_time(const synfig::Node::time_set &tset, const synfig::Time &t,
+ const synfig::Time &range, synfig::Time &out);
+
+//recursion functions based on time restrictions (can be expanded later)...
+//builds a list of relevant waypoints and activepoints inside the timepoints_ref structure
+void recurse_valuedesc(synfigapp::ValueDesc valdesc, const std::set<synfig::Time> &tlist,
+ timepoints_ref &vals);
+void recurse_layer(synfig::Layer::Handle layer, const std::set<synfig::Time> &tlist,
+ timepoints_ref &vals);
+void recurse_canvas(synfig::Canvas::Handle canvas, const std::set<synfig::Time> &tlist,
+ timepoints_ref &vals);
+
+
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file uimanager.cpp
+** \brief Template File
+**
+** $Id: uimanager.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "uimanager.h"
+#include <iostream>
+#include <string>
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+
+/* === M A C R O S ========================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+UIInterface::Response
+ConsoleUIInterface::yes_no(const std::string &title, const std::string &message,Response dflt)
+{
+ cout<<title<<": "<<message<<' ';
+ if(dflt==RESPONSE_NO)
+ cout<<_("(no/yes)")<<endl;
+ else
+ cout<<_("(yes/no)")<<endl;
+ string resp;
+ cin>>resp;
+
+ if(dflt==RESPONSE_NO)
+ {
+ if(resp=="yes")
+ return RESPONSE_YES;
+ else
+ return RESPONSE_NO;
+ }
+ else
+ {
+ if(resp=="no")
+ return RESPONSE_NO;
+ else
+ return RESPONSE_YES;
+ }
+}
+
+UIInterface::Response
+ConsoleUIInterface::yes_no_cancel(const string &title, const string &message,Response dflt)
+{
+ cout<<title<<": "<<message<<' ';
+ if(dflt==RESPONSE_NO)
+ cout<<_("(no/yes)")<<endl;
+ else
+ cout<<_("(yes/no)")<<endl;
+ string resp;
+ cin>>resp;
+
+ if(dflt==RESPONSE_NO)
+ {
+ if(resp=="yes")
+ return RESPONSE_YES;
+ else
+ return RESPONSE_NO;
+ }
+ else
+ {
+ if(resp=="no")
+ return RESPONSE_NO;
+ else
+ return RESPONSE_YES;
+ }
+}
+
+UIInterface::Response
+ConsoleUIInterface::ok_cancel(const std::string &title, const std::string &message,Response dflt)
+{
+ cout<<title<<": "<<message<<' ';
+ if(dflt==RESPONSE_CANCEL)
+ cout<<_("(cancel/ok)")<<endl;
+ else
+ cout<<_("(ok/cancel)")<<endl;
+ string resp;
+ cin>>resp;
+
+ if(dflt==RESPONSE_CANCEL)
+ {
+ if(resp=="ok")
+ return RESPONSE_OK;
+ else
+ return RESPONSE_CANCEL;
+ }
+ else
+ {
+ if(resp=="cancel")
+ return RESPONSE_CANCEL;
+ else
+ return RESPONSE_OK;
+ }
+}
+
+bool
+ConsoleUIInterface::task(const std::string &task)
+{
+ cout<<task<<endl;
+ return true;
+}
+
+bool
+ConsoleUIInterface::error(const std::string &task)
+{
+ cout<<_("error: ")<<task<<endl;
+ return true;
+}
+
+bool
+ConsoleUIInterface::warning(const std::string &task)
+{
+ cout<<_("warning: ")<<task<<endl;
+ return true;
+}
+
+bool
+ConsoleUIInterface::amount_complete(int current, int total)
+{
+ return true;
+}
+
+
+
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file uimanager.h
+** \brief User Interface Manager Class
+**
+** $Id: uimanager.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_UIMANAGER_H
+#define __SYNFIG_APP_UIMANAGER_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <ETL/handle>
+#include <synfig/general.h>
+#include <synfig/string.h>
+#include <sigc++/object.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class UIInterface : public etl::shared_object, public synfig::ProgressCallback, public sigc::trackable
+{
+public:
+ enum Response
+ {
+ RESPONSE_CANCEL=-1,
+ RESPONSE_NO=0,
+ RESPONSE_YES=1,
+ RESPONSE_OK=2
+ };
+ virtual ~UIInterface() { }
+ virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
+ virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES)=0;
+ virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK)=0;
+};
+
+class DefaultUIInterface : public UIInterface
+{
+public:
+ Response yes_no(const std::string &title, const std::string &message,Response dflt)
+ { return dflt; }
+ Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
+ { return dflt; }
+ Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
+ { return dflt; }
+
+ bool task(const std::string &task)
+ { return true; }
+ bool error(const std::string &task)
+ { return true; }
+ bool warning(const std::string &task)
+ { return true; }
+ bool amount_complete(int current, int total)
+ { return true; }
+};
+
+class ConfidentUIInterface : public UIInterface
+{
+public:
+ Response yes_no(const std::string &title, const std::string &message,Response dflt)
+ { return RESPONSE_YES; }
+ Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt)
+ { return RESPONSE_YES; }
+ Response ok_cancel(const std::string &title, const std::string &message,Response dflt)
+ { return RESPONSE_OK; }
+
+ bool task(const std::string &task)
+ { return true; }
+ bool error(const std::string &task)
+ { return true; }
+ bool warning(const std::string &task)
+ { return true; }
+ bool amount_complete(int current, int total)
+ { return true; }
+};
+
+class ConsoleUIInterface : public UIInterface
+{
+public:
+ Response yes_no(const std::string &title, const std::string &message,Response dflt);
+ Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt);
+ Response ok_cancel(const std::string &title, const std::string &message,Response dflt);
+
+ bool task(const std::string &task);
+ bool error(const std::string &task);
+ bool warning(const std::string &task);
+ bool amount_complete(int current, int total);
+};
+
+}; // END of namespace synfigapp
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file value_desc.h
+** \brief Template Header
+**
+** $Id: value_desc.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**
+** \legal
+** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**
+** This software and associated documentation
+** are CONFIDENTIAL and PROPRIETARY property of
+** the above-mentioned copyright holder.
+**
+** You may not copy, print, publish, or in any
+** other way distribute this software without
+** a prior written agreement with
+** the copyright holder.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_VALUE_DESC_H
+#define __SYNFIG_APP_VALUE_DESC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode.h>
+#include <synfig/string.h>
+#include <synfig/layer.h>
+#include <synfig/value.h>
+#include <synfig/valuenode_const.h>
+#include <synfig/canvas.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class ValueDesc
+{
+ // Info for Layer parent
+ synfig::Layer::Handle layer;
+ synfig::String name;
+
+ // Info for ValueNode parent
+ synfig::ValueNode::Handle parent_value_node;
+ int index;
+
+ // Info for exported ValueNode
+ synfig::Canvas::Handle canvas;
+
+public:
+ bool operator==(const ValueDesc &rhs)const
+ {
+ if((layer||rhs.layer) && layer!=rhs.layer)
+ return false;
+ if((!name.empty()||!rhs.name.empty()) && name!=rhs.name)
+ return false;
+ if(layer)
+ return true;
+ if((canvas||rhs.canvas) && canvas!=rhs.canvas)
+ return false;
+ if((parent_value_node||rhs.parent_value_node) && parent_value_node!=rhs.parent_value_node)
+ return false;
+ if((index>-1||rhs.index>-1) && index!=rhs.index)
+ return false;
+ return true;
+ }
+ bool operator!=(const ValueDesc &rhs)const
+ {
+ return !operator==(rhs);
+ }
+
+
+ ValueDesc(synfig::Layer::Handle layer,const synfig::String& param_name):
+ layer(layer),
+ name(param_name) { }
+
+ ValueDesc(synfig::Layer::LooseHandle layer,const synfig::String& param_name):
+ layer(layer),
+ name(param_name) { }
+
+ ValueDesc(synfig::LinkableValueNode::Handle parent_value_node,int index):
+ parent_value_node(parent_value_node),
+ index(index) { }
+
+// ValueDesc(synfig::LinkableValueNode::Handle parent_value_node,const synfig::String& param_name):
+// parent_value_node(parent_value_node),
+// index(parent_value_node->get_link_index_from_name(param_name)) { }
+
+ ValueDesc(synfig::Canvas::Handle canvas,const synfig::String& name):
+ name(name),
+ canvas(canvas) { }
+
+ ValueDesc(synfig::ValueNode_Const::Handle parent_value_node):
+ parent_value_node(parent_value_node),
+ index(-1) { }
+
+ ValueDesc() { }
+
+ bool is_valid()const { return layer || parent_value_node || canvas; }
+ operator bool()const { return is_valid(); }
+
+ bool parent_is_layer_param()const { return (bool)layer; }
+ bool parent_is_value_node()const { return (bool)parent_value_node; }
+ bool parent_is_linkable_value_node()const { return parent_is_value_node() && index>=0; }
+ bool parent_is_value_node_const()const { return parent_is_value_node() && index==-1; }
+ bool parent_is_canvas()const { return (bool)canvas; }
+
+ bool is_value_node()const { return parent_is_value_node() || parent_is_canvas() || (parent_is_layer_param() && (bool)layer->dynamic_param_list().count(name)); }
+ bool is_const()const { return (parent_is_layer_param() && !layer->dynamic_param_list().count(name)) || parent_is_value_node_const(); }
+
+ synfig::Layer::Handle get_layer()const { assert(parent_is_layer_param()); return layer; }
+ const synfig::String& get_param_name()const { assert(parent_is_layer_param()); return name; }
+
+ synfig::ValueNode::Handle get_parent_value_node()const { assert(parent_is_value_node()); return parent_value_node; }
+ int get_index()const { assert(parent_is_linkable_value_node()); return index; }
+
+ const synfig::String& get_value_node_id()const { assert(parent_is_canvas()); return name; }
+
+ synfig::Canvas::Handle get_canvas()const
+ {
+ if(canvas)
+ return canvas;
+ if(layer)
+ return layer->get_canvas();
+ if(parent_value_node)
+ return parent_value_node->get_root_canvas();
+ return 0;
+ }
+
+ synfig::ValueNode::Handle
+ get_value_node()const
+ {
+ if(parent_is_canvas())
+ return canvas->find_value_node(name);
+ if(parent_is_layer_param() && layer->dynamic_param_list().count(name))
+ return layer->dynamic_param_list().find(name)->second;
+ if(parent_is_linkable_value_node())
+ return synfig::LinkableValueNode::Handle::cast_reinterpret(parent_value_node)->get_link(index);
+// return reinterpret_cast<synfig::LinkableValueNode*>(parent_value_node.get())->get_link(index);
+ return 0;
+ }
+
+ synfig::ValueBase
+ get_value(synfig::Time time=0)const
+ {
+ if(parent_is_value_node_const() && parent_value_node)
+ return (*parent_value_node)(0);
+ if(is_value_node() && get_value_node())
+ return (*get_value_node())(time);
+ if(parent_is_layer_param() && layer)
+ return layer->get_param(name);
+ return synfig::ValueBase();
+ }
+
+ synfig::ValueBase::Type
+ get_value_type()const
+ {
+ synfig::ValueNode::Handle value_node=get_value_node();
+ if(value_node)
+ return value_node->get_type();
+ return get_value().get_type();
+ }
+
+ bool
+ is_exported()const
+ {
+ return is_value_node() && get_value_node()->is_exported();
+ }
+}; // END of class ValueDesc
+
+}; // END of namespace synfigapp_instance
+
+/* === E N D =============================================================== */
+
+#endif
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.cpp
** \brief Template File
**
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
/* === M A C R O S ========================================================= */
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file template.h
** \brief Template Header
**
/* === S T A R T =========================================================== */
-#ifndef __SINFG_TEMPLATE_H
-#define __SINFG_TEMPLATE_H
+#ifndef __SYNFIG_TEMPLATE_H
+#define __SYNFIG_TEMPLATE_H
/* === H E A D E R S ======================================================= */
--- /dev/null
+[Desktop Entry]
+Name=@PACKAGE_NAME@
+Comment=A Powerful 2D Animation and Composition Package
+Exec=@prefix@/bin/synfigstudio
+Terminal=1
+Type=Application
+Icon=@prefix@/share/pixmaps/synfig_icon.@imageext@
+Categories=Application;Graphics;
+StartupNotify=true
+Encoding=UTF-8
+MimeType=image/sif
--- /dev/null
+
+image/sif:
+ open=@prefix@/bin/synfigstudio %f
+ view=@prefix@/bin/synfigstudio %f
+ icon-filename=@prefix@/share/pixmaps/sif_icon.@imageext@
+ description=SYNFIG Composition
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=synfigstudio
+ short_list_application_ids_for_intermediate_user_level=synfigstudio
+ short_list_application_ids_for_advanced_user_level=synfigstudio
+# category=Images
+
+
+image/sifz:
+ open=@prefix@/bin/synfigstudio %f
+ view=@prefix@/bin/synfigstudio %f
+ icon-filename=@prefix@/share/pixmaps/sif_icon.@imageext@
+ description=Compressed SYNFIG Composition
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=synfigstudio
+ short_list_application_ids_for_intermediate_user_level=synfigstudio
+ short_list_application_ids_for_advanced_user_level=synfigstudio
+# category=Images
--- /dev/null
+# mime types for synfig studio
+
+image/sif
+ ext: sif SIF
+
+image/sifz
+ ext: sifZ SIFZ sif.gz SIF.GZ SIF.gz
File "images\*.ico"
SetOutPath "$INSTDIR\bin"
- File "src\sinfgapp\.libs\libsinfgapp-0.dll"
- File "src\gtkmm\.libs\sinfgstudio.exe"
+ File "src\synfigapp\.libs\libsynfigapp-0.dll"
+ File "src\gtkmm\.libs\synfigstudio.exe"
FileOpen $0 $PROFILE\.gtkrc-2.0 a
FileSeek $0 0 END
WriteRegStr HKCR ".sif.gz" "PerceivedType" "image"
WriteRegStr HKCR "Synfig.Composition" "" "Synfig Composition File"
- WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\bin\sinfgstudio.exe;1"
+ WriteRegStr HKCR "Synfig.Composition\DefaultIcon" "" "$INSTDIR\bin\synfigstudio.exe;1"
WriteRegStr HKCR "Synfig.Composition\shell" "" "open"
- WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\sinfgstudio.exe "%1"'
+ WriteRegStr HKCR "Synfig.Composition\shell\open\command" "" '$INSTDIR\bin\synfigstudio.exe "%1"'
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
CreateDirectory "$SMPROGRAMS\Voria"
CreateShortCut "$SMPROGRAMS\Voria\Uninstall Synfig Studio.lnk" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" "" "$INSTDIR\uninstall-@PACKAGE_TARNAME@.exe" 0
- CreateShortCut "$SMPROGRAMS\Voria\Synfig Studio.lnk" "$INSTDIR\bin\sinfgstudio.exe" "" "$INSTDIR\bin\sinfgstudio.exe" 0
+ CreateShortCut "$SMPROGRAMS\Voria\Synfig Studio.lnk" "$INSTDIR\bin\synfigstudio.exe" "" "$INSTDIR\bin\synfigstudio.exe" 0
SectionEnd
; Remove files and uninstaller
Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
- Delete $INSTDIR\bin\sinfgstudio.exe
- Delete $INSTDIR\bin\libsinfgapp-0.dll
+ Delete $INSTDIR\bin\synfigstudio.exe
+ Delete $INSTDIR\bin\libsynfigapp-0.dll
RMDir $INSTDIR\bin
; Remove shortcuts, if any