aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2014-07-21 13:58:29 +0100
committerAlessio Treglia <alessio@debian.org>2014-07-21 13:58:29 +0100
commite25104d1480e03993980d944d21d788a95ecd09d (patch)
tree96b84cc4baac713ad7ab3e887395f9febb91a462 /src
parent6ef14034edff72de856c29dd2e4f2b180444d890 (diff)
Imported Upstream version 0.18upstream/0.18
Diffstat (limited to 'src')
-rw-r--r--src/.cvsignore1
-rw-r--r--src/CVS/Entries41
-rw-r--r--src/CVS/Root2
-rw-r--r--src/Makefile.am49
-rw-r--r--src/Makefile.in130
-rw-r--r--src/callbacks.c307
-rw-r--r--src/callbacks.h29
-rw-r--r--src/camorama-filter-chain.c89
-rw-r--r--src/camorama-filter-chain.h63
-rw-r--r--src/camorama-filter-laplace.c129
-rw-r--r--src/camorama-filter-mirror.c69
-rw-r--r--src/camorama-globals.h40
-rw-r--r--src/camorama-stock-items.c51
-rw-r--r--src/camorama-stock-items.h14
-rw-r--r--src/camorama-window.c475
-rw-r--r--src/camorama-window.h36
-rw-r--r--src/eggtrayicon.c480
-rw-r--r--src/eggtrayicon.h77
-rw-r--r--src/fileio.c15
-rw-r--r--src/fileio.h2
-rw-r--r--src/filter.c437
-rw-r--r--src/filter.h91
-rw-r--r--src/filters.h4
-rw-r--r--src/glib-helpers.h37
-rw-r--r--src/interface.h4
-rw-r--r--src/main.c409
-rw-r--r--src/v4l.c34
-rw-r--r--src/v4l.h24
28 files changed, 1688 insertions, 1451 deletions
diff --git a/src/.cvsignore b/src/.cvsignore
index 01407ae..a815255 100644
--- a/src/.cvsignore
+++ b/src/.cvsignore
@@ -3,3 +3,4 @@ Makefile.in
camorama
*.o
.deps
+camorama-stock-images.h
diff --git a/src/CVS/Entries b/src/CVS/Entries
index 32a325b..1ea0096 100644
--- a/src/CVS/Entries
+++ b/src/CVS/Entries
@@ -1,18 +1,27 @@
-/.cvsignore/1.2/Fri Jan 17 01:49:00 2003//
-/filter.h/1.2/Thu Feb 6 03:05:54 2003//
+/.cvsignore/1.3/Tue Feb 14 13:57:51 2006//
+/Makefile.am/1.8/Sun Jul 30 11:59:59 2006//
+/callbacks.c/1.26/Sun Jul 30 12:32:25 2006//
+/callbacks.h/1.12/Mon Jan 9 16:26:15 2006//
+/camorama-filter-chain.c/1.2/Thu Mar 16 16:38:35 2006//
+/camorama-filter-chain.h/1.2/Thu Mar 16 16:38:35 2006//
+/camorama-filter-laplace.c/1.1/Thu Mar 16 16:38:35 2006//
+/camorama-filter-mirror.c/1.1/Thu Mar 16 16:38:35 2006//
+/camorama-globals.h/1.1/Mon Jan 9 16:26:15 2006//
+/camorama-stock-items.c/1.1/Sun Jan 8 22:23:27 2006//
+/camorama-stock-items.h/1.1/Sun Jan 8 22:23:27 2006//
+/camorama-window.c/1.4/Sun Jul 30 12:32:25 2006//
+/camorama-window.h/1.1/Mon Jan 9 16:26:15 2006//
+/fileio.c/1.15/Mon Nov 7 21:06:26 2005//
+/fileio.h/1.4/Mon Nov 7 21:06:26 2005//
+/filter.c/1.14/Thu Mar 16 16:38:35 2006//
+/filter.h/1.6/Thu Mar 16 16:38:35 2006//
+/filters.h/1.1/Sun Jan 8 22:23:27 2006//
/font_6x11.h/1.2/Thu Feb 6 03:05:54 2003//
-/interface.h/1.2/Thu Feb 6 03:05:54 2003//
-/Makefile.am/1.4/Fri Jul 25 22:55:50 2003//
-/callbacks.h/1.7/Wed Jul 30 01:42:26 2003//
-/eggtrayicon.c/1.1/Fri Jul 25 22:43:40 2003//
-/eggtrayicon.h/1.1/Fri Jul 25 22:43:27 2003//
-/fileio.h/1.3/Wed Jul 30 01:42:25 2003//
-/support.h/1.3/Wed Jul 30 01:42:27 2003//
-/callbacks.c/1.18/Fri Aug 15 15:32:30 2003//
-/filter.c/1.8/Fri Aug 15 15:03:43 2003//
-/main.c/1.18/Fri Aug 15 15:32:03 2003//
-/v4l.c/1.12/Fri Aug 15 14:25:16 2003//
-/v4l.h/1.7/Fri Aug 15 14:17:41 2003//
-/fileio.c/1.13/Wed Aug 20 18:20:55 2003//
-/support.c/1.4/Wed Aug 20 18:21:12 2003//
+/glib-helpers.h/1.1/Thu Mar 16 16:38:35 2006//
+/interface.h/1.4/Mon Nov 7 17:53:37 2005//
+/main.c/1.27/Sun Jul 30 11:59:59 2006//
+/support.c/1.4/Wed Jul 30 18:11:37 2003//
+/support.h/1.3/Wed Jul 30 18:11:37 2003//
+/v4l.c/1.14/Mon Nov 7 18:21:23 2005//
+/v4l.h/1.13/Sun Jul 30 12:32:25 2006//
D
diff --git a/src/CVS/Root b/src/CVS/Root
index f253780..a85e4ed 100644
--- a/src/CVS/Root
+++ b/src/CVS/Root
@@ -1 +1 @@
-:pserver:ly@cvs.gnome.org:/cvs/gnome
+:pserver:anonymous@anoncvs.gnome.org:/cvs/gnome
diff --git a/src/Makefile.am b/src/Makefile.am
index df75c50..05ec122 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,46 @@
-INCLUDES = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
- @PACKAGE_CFLAGS@
+NULL=
+AM_CPPFLAGS=\
+ $(PACKAGE_CFLAGS) \
+ -g \
+ $(NULL)
bin_PROGRAMS = camorama
-camorama_SOURCES = main.c v4l.c filter.c callbacks.c support.c fileio.c eggtrayicon.c v4l.h callbacks.h support.h interface.h fileio.h font_6x11.h filter.h eggtrayicon.h
-camorama_LDADD = @PACKAGE_LIBS@
+BUILT_SOURCES = camorama-stock-images.h
+camorama_SOURCES = \
+ callbacks.c \
+ camorama-filter-chain.c \
+ camorama-filter-chain.h \
+ camorama-filter-laplace.c \
+ camorama-filter-mirror.c \
+ camorama-globals.h \
+ camorama-stock-items.c \
+ camorama-stock-items.h \
+ camorama-window.c \
+ camorama-window.h \
+ filter.c \
+ glib-helpers.h \
+ main.c \
+ support.c \
+ v4l.c \
+ fileio.c \
+ v4l.h \
+ callbacks.h \
+ support.h \
+ interface.h \
+ fileio.h \
+ font_6x11.h \
+ filter.h \
+ $(BUILT_SOURCES)\
+ $(NULL)
+camorama_LDADD = $(PACKAGE_LIBS)
+
+DISTCLEANFILES=$(BUILT_SOURCES)
+
+camorama-stock-images.h:
+ gdk-pixbuf-csource --raw --build-list \
+ camorama_webcam_16 ../pixmaps/camorama-webcam-16.png \
+ camorama_webcam_24 ../pixmaps/camorama-webcam-24.png \
+ > $@ || (rm -f $@)
+
diff --git a/src/Makefile.in b/src/Makefile.in
index f9b6b91..8286c5d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.7.6 from Makefile.am.
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
@@ -36,6 +36,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -77,19 +78,27 @@ INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@
INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@
INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_ICONV = @INTLTOOL_ICONV@
+INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@
INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@
INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_MSGFMT = @INTLTOOL_MSGFMT@
+INTLTOOL_MSGMERGE = @INTLTOOL_MSGMERGE@
INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@
INTLTOOL_PERL = @INTLTOOL_PERL@
INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@
INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@
INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@
INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@
+INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@
INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@
INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@
INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@
INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@
+INTLTOOL_XGETTEXT = @INTLTOOL_XGETTEXT@
+INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@
INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
@@ -118,9 +127,11 @@ SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
XGETTEXT = @XGETTEXT@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
@@ -145,17 +156,46 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-INCLUDES = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
- @PACKAGE_CFLAGS@
+NULL =
+AM_CPPFLAGS = \
+ $(PACKAGE_CFLAGS) \
+ -g \
+ $(NULL)
bin_PROGRAMS = camorama
-camorama_SOURCES = main.c v4l.c filter.c callbacks.c support.c fileio.c eggtrayicon.c v4l.h callbacks.h support.h interface.h fileio.h font_6x11.h filter.h eggtrayicon.h
-camorama_LDADD = @PACKAGE_LIBS@
+BUILT_SOURCES = camorama-stock-images.h
+camorama_SOURCES = \
+ callbacks.c \
+ camorama-filter-chain.c \
+ camorama-filter-chain.h \
+ camorama-filter-laplace.c \
+ camorama-filter-mirror.c \
+ camorama-globals.h \
+ camorama-stock-items.c \
+ camorama-stock-items.h \
+ camorama-window.c \
+ camorama-window.h \
+ filter.c \
+ glib-helpers.h \
+ main.c \
+ support.c \
+ v4l.c \
+ fileio.c \
+ v4l.h \
+ callbacks.h \
+ support.h \
+ interface.h \
+ fileio.h \
+ font_6x11.h \
+ filter.h \
+ $(BUILT_SOURCES)\
+ $(NULL)
+
+camorama_LDADD = $(PACKAGE_LIBS)
+
+DISTCLEANFILES = $(BUILT_SOURCES)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -164,9 +204,14 @@ CONFIG_CLEAN_FILES =
bin_PROGRAMS = camorama$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
-am_camorama_OBJECTS = main.$(OBJEXT) v4l.$(OBJEXT) filter.$(OBJEXT) \
- callbacks.$(OBJEXT) support.$(OBJEXT) fileio.$(OBJEXT) \
- eggtrayicon.$(OBJEXT)
+am__objects_1 =
+am_camorama_OBJECTS = callbacks.$(OBJEXT) \
+ camorama-filter-chain.$(OBJEXT) \
+ camorama-filter-laplace.$(OBJEXT) \
+ camorama-filter-mirror.$(OBJEXT) camorama-stock-items.$(OBJEXT) \
+ camorama-window.$(OBJEXT) filter.$(OBJEXT) main.$(OBJEXT) \
+ support.$(OBJEXT) v4l.$(OBJEXT) fileio.$(OBJEXT) \
+ $(am__objects_1) $(am__objects_1)
camorama_OBJECTS = $(am_camorama_OBJECTS)
camorama_DEPENDENCIES =
camorama_LDFLAGS =
@@ -175,18 +220,24 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/callbacks.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/eggtrayicon.Po ./$(DEPDIR)/fileio.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/filter.Po ./$(DEPDIR)/main.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/v4l.Po
+@AMDEP_TRUE@ ./$(DEPDIR)/camorama-filter-chain.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/camorama-filter-laplace.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/camorama-filter-mirror.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/camorama-stock-items.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/camorama-window.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/fileio.Po ./$(DEPDIR)/filter.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/support.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/v4l.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(camorama_SOURCES)
-DIST_COMMON = Makefile.am Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(camorama_SOURCES)
-all: all-am
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
@@ -230,16 +281,17 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eggtrayicon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-chain.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-laplace.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-mirror.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-stock-items.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-window.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v4l.Po@am__quote@
-distclean-depend:
- -rm -rf ./$(DEPDIR)
-
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@@ -349,12 +401,14 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -365,7 +419,7 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@@ -373,19 +427,22 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-
-distclean-am: clean-am distclean-compile distclean-depend \
- distclean-generic distclean-tags
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
dvi: dvi-am
@@ -406,7 +463,8 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
@@ -425,15 +483,21 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
- distclean-depend distclean-generic distclean-tags distdir dvi \
- dvi-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-exec install-exec-am \
- install-info install-info-am install-man install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+ distclean-generic distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-binPROGRAMS install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-info-am
+
+camorama-stock-images.h:
+ gdk-pixbuf-csource --raw --build-list \
+ camorama_webcam_16 ../pixmaps/camorama-webcam-16.png \
+ camorama_webcam_24 ../pixmaps/camorama-webcam-24.png \
+ > $@ || (rm -f $@)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/src/callbacks.c b/src/callbacks.c
index 8e5ce02..bdfabf8 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -11,7 +11,8 @@
#include <pthread.h>
extern GtkWidget *main_window, *prefswindow;
-extern state func_state;
+//extern state func_state;
+//extern gint effect_mask;
extern int frames;
extern int frames2;
extern int seconds;
@@ -349,7 +350,7 @@ void prefs_func (GtkWidget * okbutton, cam * cam)
}
-void on_quit1_activate (GtkMenuItem * menuitem, gpointer user_data)
+void on_quit_activate (GtkMenuItem * menuitem, gpointer user_data)
{
gtk_main_quit ();
}
@@ -359,36 +360,20 @@ void on_preferences1_activate (GtkMenuItem * menuitem, gpointer user_data)
gtk_widget_show (prefswindow);
}
-void on_show_adjustments1_activate (GtkMenuItem * menuitem, cam * cam)
-{
-
- if (GTK_WIDGET_VISIBLE (glade_xml_get_widget (cam->xml, "table6"))) {
- gtk_widget_hide (glade_xml_get_widget (cam->xml, "table6"));
- gtk_window_resize (GTK_WINDOW
- (glade_xml_get_widget
- (cam->xml, "window2")), 320, 240);
- cam->show_adjustments = FALSE;
-
- } else {
- gtk_widget_show (glade_xml_get_widget (cam->xml, "table6"));
- cam->show_adjustments = TRUE;
- }
- gconf_client_set_bool (cam->gc, KEY22, cam->show_adjustments, NULL);
-}
-
void on_change_size_activate (GtkWidget * widget, cam * cam)
{
- gchar *name, *title;
+ gchar const *name;
+ gchar *title;
- (G_CONST_RETURN) name = gtk_widget_get_name (widget);
-
- if (strcmp (name, "small1") == 0) {
+ name = gtk_widget_get_name (widget);
+ printf("name = %s\n",name);
+ if (strcmp (name, "small") == 0) {
cam->x = cam->vid_cap.minwidth;
cam->y = cam->vid_cap.minheight;
if (cam->debug) {
printf ("\nsmall\n");
}
- } else if (strcmp (name, "medium1") == 0) {
+ } else if (strcmp (name, "medium") == 0) {
cam->x = cam->vid_cap.maxwidth / 2;
cam->y = cam->vid_cap.maxheight / 2;
if (cam->debug) {
@@ -408,19 +393,19 @@ void on_change_size_activate (GtkWidget * widget, cam * cam)
/*
* if(cam->read == FALSE) {
- * * cam->pic = mmap(0, cam->vid_buf.size, PROT_READ | PROT_WRITE, MAP_SHARED, cam->dev, 0);
- * *
- * * if((unsigned char *) -1 == (unsigned char *) cam->pic) {
- * * if(cam->debug == TRUE) {
- * * fprintf(stderr, "Unable to capture image (mmap).\n");
- * * }
- * * error_dialog(_("Unable to capture image."));
- * * exit(-1);
- * * }
- * * }else{
- * * cam->pic_buf = malloc(cam->x * cam->y * cam->depth);
- * * read(cam->dev,cam->pic,(cam->x * cam->y * 3));
- * * }
+ * cam->pic = mmap(0, cam->vid_buf.size, PROT_READ | PROT_WRITE, MAP_SHARED, cam->dev, 0);
+ *
+ * if((unsigned char *) -1 == (unsigned char *) cam->pic) {
+ * if(cam->debug == TRUE) {
+ * fprintf(stderr, "Unable to capture image (mmap).\n");
+ * }
+ * error_dialog(_("Unable to capture image."));
+ * exit(-1);
+ * }
+ * }else{
+ * cam->pic_buf = malloc(cam->x * cam->y * cam->depth);
+ * read(cam->dev,cam->pic,(cam->x * cam->y * 3));
+ * }
*/
cam->vid_win.x = 0;
@@ -458,75 +443,99 @@ void on_change_size_activate (GtkWidget * widget, cam * cam)
get_win_info (cam);
frame = 0;
gtk_window_resize (GTK_WINDOW
- (glade_xml_get_widget (cam->xml, "window2")), 320,
+ (glade_xml_get_widget (cam->xml, "main_window")), 320,
240);
title = g_strdup_printf ("Camorama - %s - %dx%d", cam->vid_cap.name,
cam->x, cam->y);
gtk_window_set_title (GTK_WINDOW
- (glade_xml_get_widget (cam->xml, "window2")),
+ (glade_xml_get_widget (cam->xml, "main_window")),
title);
g_free (title);
-
}
-void on_show_effects_activate (GtkMenuItem * menuitem, cam * cam)
+void on_show_adjustments_activate (GtkMenuItem * menuitem, cam * cam)
{
- if (GTK_WIDGET_VISIBLE (glade_xml_get_widget (cam->xml, "vbox37"))) {
- gtk_widget_hide (glade_xml_get_widget (cam->xml, "vbox37"));
+ if (GTK_WIDGET_VISIBLE (glade_xml_get_widget (cam->xml, "adjustments_table"))) {
+ gtk_widget_hide (glade_xml_get_widget (cam->xml, "adjustments_table"));
gtk_window_resize (GTK_WINDOW
(glade_xml_get_widget
- (cam->xml, "window2")), 320, 240);
+ (cam->xml, "main_window")), 320, 240);
cam->show_adjustments = FALSE;
} else {
- gtk_widget_show (glade_xml_get_widget (cam->xml, "vbox37"));
+ gtk_widget_show (glade_xml_get_widget (cam->xml, "adjustments_table"));
cam->show_adjustments = TRUE;
}
gconf_client_set_bool (cam->gc, KEY22, cam->show_adjustments, NULL);
}
-void on_about1_activate (GtkMenuItem * menuitem, gpointer user_data)
-{
- GtkWidget *about1 = NULL;
- const gchar *authors[] = { "Greg Jones <greg@fixedgear.org>",
- "Jens Knutson <tempest@magusbooks.com>", NULL
+void
+on_show_effects_activate(GtkMenuItem* menuitem, cam* cam) {
+ GtkWidget* effects = glade_xml_get_widget(cam->xml, "scrolledwindow_effects");
+ cam->show_effects = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
+
+ if(!cam->show_effects) {
+ gtk_widget_hide(effects);
+ gtk_window_resize(GTK_WINDOW(glade_xml_get_widget(cam->xml, "main_window")), 320, 240);
+ } else {
+ gtk_widget_show(effects);
+ }
+
+ gconf_client_set_bool(cam->gc, KEY23, cam->show_effects, NULL);
+}
+
+void on_about_activate (GtkMenuItem * menuitem, cam * cam)
+{
+ static GtkWidget *about = NULL;
+ const gchar *authors[] = {
+ "Greg Jones <greg@fixedgear.org>",
+ "Jens Knutson <tempest@magusbooks.com>",
+ NULL
};
const gchar *documenters[] = { NULL };
GdkPixbuf *logo =
- (GdkPixbuf *) create_pixbuf (DATADIR "/pixmaps/camorama.png");
+ (GdkPixbuf *) create_pixbuf (PACKAGE_DATA_DIR "/pixmaps/camorama.png");
char *translators = _("translator_credits");
if (!strcmp (translators, "translator_credits"))
translators = NULL;
-
- if (about1 != NULL) {
- printf ("before the old return\n");
- gdk_window_raise (about1->window);
- gdk_window_show (about1->window);
+ if (about != NULL) {
+ gtk_window_present (GTK_WINDOW (about));
return;
- printf ("after the old return\n");
}
- about1 = gnome_about_new ("Camorama", VERSION,
- "Copyright \xc2\xa9 2002 Greg Jones",
- _
- ("View, alter and save images from a webcam"),
- authors, documenters, translators, logo);
+ about = gnome_about_new (_("Camorama"), PACKAGE_VERSION,
+ "Copyright \xc2\xa9 2002 Greg Jones",
+ _("View, alter and save images from a webcam"),
+ (const char **) authors,
+ (const char **) documenters, translators, logo);
+ gtk_window_set_transient_for (GTK_WINDOW (about),
+ GTK_WINDOW (glade_xml_get_widget
+ (cam->xml, "main_window")));
- g_signal_connect (G_OBJECT (about1), "destroy",
- G_CALLBACK (gtk_widget_destroyed), &about1);
- g_object_add_weak_pointer (G_OBJECT (about1), (void **) &(about1));
+ g_object_add_weak_pointer (G_OBJECT (about), (void **) &(about));
- gtk_widget_show (about1);
+ gtk_widget_show (about);
+}
+
+static void
+apply_filters(cam* cam) {
+ camorama_filter_chain_apply(cam->filter_chain, cam->pic_buf, cam->x, cam->y, cam->depth);
+#warning "FIXME: enable the threshold channel filter"
+// if((effect_mask & CAMORAMA_FILTER_THRESHOLD_CHANNEL) != 0)
+// threshold_channel (cam->pic_buf, cam->x, cam->y, cam->dither);
+#warning "FIXME: enable the threshold filter"
+// if((effect_mask & CAMORAMA_FILTER_THRESHOLD) != 0)
+// threshold (cam->pic_buf, cam->x, cam->y, cam->dither);
}
/*
* get image from cam - does all the work ;)
*/
-gint read_timeout_func (cam * cam)
-{
+gint
+read_timeout_func(cam* cam) {
int i, count = 0;
GdkGC *gc;
@@ -534,9 +543,9 @@ gint read_timeout_func (cam * cam)
frames2++;
/*
* update_rec.x = 0;
- * * update_rec.y = 0;
- * * update_rec.width = cam->x;
- * * update_rec.height = cam->y;
+ * update_rec.y = 0;
+ * update_rec.width = cam->x;
+ * update_rec.height = cam->y;
*/
count++;
/*
@@ -549,46 +558,7 @@ gint read_timeout_func (cam * cam)
cam->pic_buf = cam->tmp;
}
- if (func_state.fc == TRUE) {
- fix_colour (cam->pic_buf, cam->x, cam->y);
- }
-
- if (func_state.threshold_channel == TRUE) {
- threshold_channel (cam->pic_buf, cam->x, cam->y, cam->dither);
- }
-
- if (func_state.threshold == TRUE) {
- threshold (cam->pic_buf, cam->x, cam->y, cam->dither);
- }
-
- if (func_state.laplace == TRUE) {
-
- laplace (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
-
- if (func_state.sobel == TRUE) {
- sobel (cam->pic_buf, cam->x, cam->y);
- }
-
- if (func_state.wacky == TRUE) {
- wacky (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
-
- if (func_state.negative == TRUE) {
- negative (cam->pic_buf, cam->x, cam->y, cam->depth);
- }
-
- if (func_state.mirror == TRUE) {
- mirror (cam->pic_buf, cam->x, cam->y, cam->depth);
- }
-
- if (func_state.colour == TRUE) {
- bw (cam->pic_buf, cam->x, cam->y);
- }
-
- if (func_state.smooth == TRUE) {
- smooth (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
+ apply_filters(cam);
gc = gdk_gc_new (cam->pixmap);
gdk_draw_rgb_image (cam->pixmap,
@@ -636,46 +606,9 @@ gint timeout_func (cam * cam)
yuv420p_to_rgb (cam->pic_buf, cam->tmp, cam->x, cam->y, cam->depth);
cam->pic_buf = cam->tmp;
}
- if (func_state.fc == TRUE) {
- fix_colour (cam->pic_buf, cam->x, cam->y);
- }
-
- if (func_state.threshold_channel == TRUE) {
- threshold_channel (cam->pic_buf, cam->x, cam->y, cam->dither);
- }
-
- if (func_state.threshold == TRUE) {
- threshold (cam->pic_buf, cam->x, cam->y, cam->dither);
- }
-
- if (func_state.laplace == TRUE) {
-
- laplace (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
-
- if (func_state.sobel == TRUE) {
- sobel (cam->pic_buf, cam->x, cam->y);
- }
-
- if (func_state.wacky == TRUE) {
- wacky (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
-
- if (func_state.negative == TRUE) {
- negative (cam->pic_buf, cam->x, cam->y, cam->depth);
- }
- if (func_state.mirror == TRUE) {
- mirror (cam->pic_buf, cam->x, cam->y, cam->depth);
- }
-
- if (func_state.colour == TRUE) {
- bw (cam->pic_buf, cam->x, cam->y);
- }
+ apply_filters(cam);
- if (func_state.smooth == TRUE) {
- smooth (cam->pic_buf, cam->depth, cam->x, cam->y);
- }
gc = gdk_gc_new (cam->pixmap);
@@ -784,17 +717,16 @@ void capture_func (GtkWidget * widget, cam * cam)
gint timeout_capture_func (cam * cam)
{
- /* GdkRectangle rect;
- rect->x = 0; rect->y = 0;
- rect->width = cam->x; rect->height = cam->y;*/
+ /* GdkRectangle rect;
+ * rect->x = 0; rect->y = 0;
+ * rect->width = cam->x; rect->height = cam->y; */
/* need to return true, or the timeout will be destroyed - don't forget! :) */
if (cam->hidden == TRUE) {
/* call timeout_func to get a new picture. stupid, but it works.
* also need to add this to capture_func
* maybe add a "window_state_event" handler to do the same when window is iconified */
-
-
+
pt2Function (cam);
pt2Function (cam);
pt2Function (cam);
@@ -813,8 +745,8 @@ gint timeout_capture_func (cam * cam)
}
gboolean
-on_drawingarea1_expose_event (GtkWidget * widget, GdkEventExpose * event,
- cam * cam)
+on_drawingarea_expose_event (GtkWidget * widget, GdkEventExpose * event,
+ cam * cam)
{
cam->window = widget->window;
gdk_draw_drawable (widget->window,
@@ -827,61 +759,6 @@ on_drawingarea1_expose_event (GtkWidget * widget, GdkEventExpose * event,
return FALSE;
}
-void fix_colour_func (GtkToggleButton * tb, char *data)
-{
- func_state.fc = gtk_toggle_button_get_active (tb);
-}
-
-void edge_func1 (GtkToggleButton * tb, gpointer data)
-{
- func_state.wacky = gtk_toggle_button_get_active (tb);
-}
-
-void sobel_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.sobel = gtk_toggle_button_get_active (tb);
-}
-
-void threshold_func1 (GtkToggleButton * tb, gpointer data)
-{
- func_state.threshold = gtk_toggle_button_get_active (tb);
-}
-
-void threshold_ch_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.threshold_channel = gtk_toggle_button_get_active (tb);
-}
-
-void edge_func3 (GtkToggleButton * tb, gpointer data)
-{
- func_state.laplace = gtk_toggle_button_get_active (tb);
-}
-
-void negative_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.negative = gtk_toggle_button_get_active (tb);
-}
-
-void mirror_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.mirror = gtk_toggle_button_get_active (tb);
-}
-
-void smooth_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.smooth = gtk_toggle_button_get_active (tb);
-}
-
-void colour_func (GtkToggleButton * tb, gpointer data)
-{
- func_state.colour = gtk_toggle_button_get_active (tb);
-}
-
-void on_scale1_drag_data_received (GtkHScale * sc1, cam * cam)
-{
- cam->dither = (int) gtk_range_get_value ((GtkRange *) sc1);
-}
-
void contrast_change (GtkHScale * sc1, cam * cam)
{
@@ -943,7 +820,7 @@ void update_tooltip (cam * cam)
if (cam->acap == TRUE) {
tooltip_text =
g_strdup_printf
- ("Local Capture: %d\nRemote Capture: %d\nCapture Interval: %d",
+ (_("Local Capture: %d\nRemote Capture: %d\nCapture Interval: %d"),
cam->cap, cam->rcap, cam->timeout_interval / 60000);
if (cam->debug == TRUE) {
printf ("tip - acap on\n");
@@ -952,10 +829,8 @@ void update_tooltip (cam * cam)
if (cam->debug == TRUE) {
printf ("tip - acap off\n");
}
- tooltip_text = g_strdup_printf ("Automatic Capture Disabled");
+ tooltip_text = g_strdup_printf (_("Automatic Capture Disabled"));
}
- gtk_tooltips_set_tip ((GtkTooltips *) cam->tooltips,
- (GtkWidget *) cam->tray_icon, tooltip_text,
- "private");
+ gtk_status_icon_set_tooltip(cam->tray_icon, tooltip_text);
g_free (tooltip_text);
}
diff --git a/src/callbacks.h b/src/callbacks.h
index 04ede00..a4294f9 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -1,22 +1,14 @@
+#ifndef CAMORAMA_CALLBACKS_H
+#define CAMORAMA_CALLBACKS_H
+
#include <gtk/gtk.h>
#include "fileio.h"
#include <gconf/gconf-client.h>
-typedef struct image_state {
- gboolean wacky;
- gboolean threshold;
- gboolean threshold_channel;
- gboolean sobel;
- gboolean laplace;
- gboolean negative;
- gboolean mirror;
- gboolean colour;
- gboolean smooth;
- gboolean fc;
-} state;
+G_BEGIN_DECLS
void on_change_size_activate (GtkWidget * widget, cam * cam);
-void on_quit1_activate (GtkMenuItem * menuitem, gpointer user_data);
+void on_quit_activate (GtkMenuItem * menuitem, gpointer user_data);
void gconf_notify_func (GConfClient * client, guint cnxn_id,
GConfEntry * entry, char *);
void gconf_notify_func_bool (GConfClient * client, guint cnxn_id,
@@ -44,8 +36,8 @@ void rpng_func (GtkWidget *, cam *);
gint (*pt2Function) (cam *);
void rppm_func (GtkWidget *, cam *);
void on_preferences1_activate (GtkMenuItem * menuitem, gpointer user_data);
-void on_about1_activate (GtkMenuItem * menuitem, gpointer user_data);
-void on_show_adjustments1_activate (GtkMenuItem * menuitem, cam *);
+void on_about_activate (GtkMenuItem * menuitem, cam *cam);
+void on_show_adjustments_activate (GtkMenuItem * menuitem, cam *);
void on_show_effects_activate (GtkMenuItem * menuitem, cam *);
void prefs_func (GtkWidget *, cam *);
gint io_func (cam *, gint, GdkInputCondition);
@@ -73,5 +65,10 @@ void brightness_change (GtkHScale *, cam *);
void colour_change (GtkHScale *, cam *);
void hue_change (GtkHScale *, cam *);
void wb_change (GtkHScale *, cam *);
-gboolean on_drawingarea1_expose_event (GtkWidget *, GdkEventExpose *, cam *);
+gboolean on_drawingarea_expose_event (GtkWidget *, GdkEventExpose *, cam *);
void update_tooltip (cam * cam);
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_CALLBACKS_H */
+
diff --git a/src/camorama-filter-chain.c b/src/camorama-filter-chain.c
new file mode 100644
index 0000000..78f9092
--- /dev/null
+++ b/src/camorama-filter-chain.c
@@ -0,0 +1,89 @@
+/* This file is part of camorama
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "camorama-filter-chain.h"
+
+#include "filter.h"
+
+struct CamoramaImage {
+ guchar* buf;
+ gint width;
+ gint height;
+ gint depth;
+};
+
+CamoramaFilterChain*
+camorama_filter_chain_new(void) {
+ return g_object_new(CAMORAMA_TYPE_FILTER_CHAIN, NULL);
+}
+
+void
+camorama_filter_chain_append(CamoramaFilterChain* self, GType filter_type) {
+ GtkTreeIter iter;
+ GtkListStore* store;
+ CamoramaFilter* filter;
+ g_return_if_fail(g_type_is_a(filter_type, CAMORAMA_TYPE_FILTER));
+
+ store = GTK_LIST_STORE(self);
+ gtk_list_store_append(store, &iter);
+ filter = g_object_new(filter_type, NULL);
+ gtk_list_store_set(store, &iter,
+ CAMORAMA_FILTER_CHAIN_COL_FILTER, filter,
+ CAMORAMA_FILTER_CHAIN_COL_NAME, camorama_filter_get_name(filter),
+ -1);
+ g_object_unref(filter);
+}
+
+static gboolean
+camorama_filter_chain_apply_filter(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer user_data) {
+ struct CamoramaImage* img = user_data;
+ CamoramaFilter* filter = NULL;
+ gtk_tree_model_get(model, iter,
+ CAMORAMA_FILTER_CHAIN_COL_FILTER, &filter,
+ -1);
+ camorama_filter_apply(filter, img->buf, img->width, img->height, img->depth);
+
+ return FALSE;
+}
+
+void
+camorama_filter_chain_apply(CamoramaFilterChain* self, guchar* image, gint width, gint height, gint depth) {
+ struct CamoramaImage img = {image, width, height, depth};
+
+ gtk_tree_model_foreach(GTK_TREE_MODEL(self), camorama_filter_chain_apply_filter, &img);
+}
+
+/* GType stuff */
+G_DEFINE_TYPE(CamoramaFilterChain, camorama_filter_chain, GTK_TYPE_LIST_STORE);
+
+static void
+camorama_filter_chain_init(CamoramaFilterChain* self) {
+ GType column_types[CAMORAMA_FILTER_CHAIN_N_COLUMNS];
+ column_types[CAMORAMA_FILTER_CHAIN_COL_NAME] = G_TYPE_STRING;
+ column_types[CAMORAMA_FILTER_CHAIN_COL_FILTER] = G_TYPE_OBJECT;
+ gtk_list_store_set_column_types(GTK_LIST_STORE(self), CAMORAMA_FILTER_CHAIN_N_COLUMNS, column_types);
+}
+
+static void
+camorama_filter_chain_class_init(CamoramaFilterChainClass* self) {}
+
diff --git a/src/camorama-filter-chain.h b/src/camorama-filter-chain.h
new file mode 100644
index 0000000..1ccd0e2
--- /dev/null
+++ b/src/camorama-filter-chain.h
@@ -0,0 +1,63 @@
+/* This file is part of camorama
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef CAMORAMA_FILTER_CHAIN_H
+#define CAMORAMA_FILTER_CHAIN_H
+
+#include <gtk/gtkliststore.h>
+
+G_BEGIN_DECLS
+
+typedef struct _CamoramaFilterChain CamoramaFilterChain;
+typedef struct _CamoramaFilterChainClass CamoramaFilterChainClass;
+
+#define CAMORAMA_TYPE_FILTER_CHAIN (camorama_filter_chain_get_type())
+
+GType camorama_filter_chain_get_type(void);
+
+CamoramaFilterChain* camorama_filter_chain_new (void);
+void camorama_filter_chain_append(CamoramaFilterChain* self,
+ GType filter_type);
+void camorama_filter_chain_apply (CamoramaFilterChain* self,
+ guchar* image,
+ gint width,
+ gint height,
+ gint depth);
+
+struct _CamoramaFilterChain {
+ GtkListStore base_instance;
+};
+
+struct _CamoramaFilterChainClass {
+ GtkListStoreClass base_class;
+};
+
+enum {
+ CAMORAMA_FILTER_CHAIN_COL_NAME,
+ CAMORAMA_FILTER_CHAIN_COL_FILTER,
+ CAMORAMA_FILTER_CHAIN_N_COLUMNS
+};
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_FILTER_CHAIN_H */
diff --git a/src/camorama-filter-laplace.c b/src/camorama-filter-laplace.c
new file mode 100644
index 0000000..25db6bd
--- /dev/null
+++ b/src/camorama-filter-laplace.c
@@ -0,0 +1,129 @@
+/* This file is part of camorama
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "filter.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib/gi18n.h>
+
+/* GType stuff for CamoramaFilterLaplace */
+typedef struct _CamoramaFilter CamoramaFilterLaplace;
+typedef struct _CamoramaFilterClass CamoramaFilterLaplaceClass;
+
+G_DEFINE_TYPE(CamoramaFilterLaplace, camorama_filter_laplace, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_laplace_init(CamoramaFilterLaplace* self) {}
+
+static void
+camorama_filter_laplace_filter(CamoramaFilter* filter, guchar *image, int width, int height, int depth) {
+ int x, y;
+ unsigned char *image2;
+
+ image2 = (unsigned char *) malloc (sizeof (unsigned char) * width * height * depth);
+ memcpy (image2, image, width * height * depth);
+
+ y = 0;
+ // FIXME: the fist pixel
+ for(x = 1; x < width - 1; x++) {
+ int offsets[6] = {
+ y * width * depth + x * depth - depth,
+ y * width * depth + x * depth,
+ y * width * depth + x * depth + depth,
+ (y + 1) * width * depth + x * depth - depth,
+ (y + 1) * width * depth + x * depth,
+ (y + 1) * width * depth + x * depth + depth,
+ };
+ int chan, max = 0;
+ for(chan = 0; chan < depth; chan++) {
+ int new_val = image[offsets[1] + chan] * 6 -
+ image2[offsets[0] + chan] -
+ image2[offsets[2] + chan] -
+ image2[offsets[3] + chan] -
+ image2[offsets[4] + chan] -
+ image2[offsets[5] + chan];
+ if(new_val < 0) {
+ new_val = 0;
+ }
+ max = MAX(max, new_val);
+ }
+ for(chan = 0; chan < depth; chan++) {
+ image[offsets[1] + chan] = max;
+ }
+ }
+ // FIXME: the last pixel
+
+ // inner pixels with 8 neighbours
+ for(y = 1; y < height - 1; y++) {
+ // FIXME: the first column
+ for(x = 1; x < width - 1; x++) {
+ int offsets[9] = {
+ (y - 1) * width * depth + x * depth - depth,
+ (y - 1) * width * depth + x * depth,
+ (y - 1) * width * depth + x * depth + depth,
+ y * width * depth + x * depth - depth,
+ y * width * depth + x * depth,
+ y * width * depth + x * depth + depth,
+ (y + 1) * width * depth + x * depth - depth,
+ (y + 1) * width * depth + x * depth,
+ (y + 1) * width * depth + x * depth + depth,
+ };
+ int chan, max = 0;
+ for(chan = 0; chan < depth; chan++) {
+ int new_val = image[offsets[4] + chan] * 8 -
+ image2[offsets[0] + chan] -
+ image2[offsets[1] + chan] -
+ image2[offsets[2] + chan] -
+ image2[offsets[3] + chan] -
+ image2[offsets[5] + chan] -
+ image2[offsets[6] + chan] -
+ image2[offsets[7] + chan] -
+ image2[offsets[8] + chan];
+
+ if(new_val < 0) {
+ new_val = 0;
+ }
+ max = MAX(max, new_val);
+ }
+ for(chan = 0; chan < depth; chan++) {
+ image[offsets[4] + chan] = max;
+ }
+ }
+ // FIXME: the last column
+ }
+
+ // FIXME: the last line
+
+ free (image2);
+}
+
+static void
+camorama_filter_laplace_class_init(CamoramaFilterLaplaceClass* self_class) {
+ self_class->filter = camorama_filter_laplace_filter;
+ self_class->name = _("Laplace (4 Neighbours)");
+}
diff --git a/src/camorama-filter-mirror.c b/src/camorama-filter-mirror.c
new file mode 100644
index 0000000..6d42178
--- /dev/null
+++ b/src/camorama-filter-mirror.c
@@ -0,0 +1,69 @@
+/* This file is part of camorama
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "filter.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+
+/* GType stuff for CamoramaFilterMirror */
+typedef struct _CamoramaFilter CamoramaFilterMirror;
+typedef struct _CamoramaFilterClass CamoramaFilterMirrorClass;
+
+G_DEFINE_TYPE(CamoramaFilterMirror, camorama_filter_mirror, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_mirror_init(CamoramaFilterMirror* self) {}
+
+static void
+camorama_filter_mirror_filter(CamoramaFilter* filter, guchar *image, gint width, gint height, gint depth) {
+ gint x, y, z, row_length, image_length, new_row, next_row, half_row, index1, index2;
+ guchar temp;
+
+ row_length = width * depth;
+ image_length = row_length * height;
+ half_row = ((width+1)/2)*depth;
+ for(new_row = 0; new_row < image_length; new_row = next_row) { // 0, 320*depth, 640*depth, 960*depth, ...
+ next_row = new_row + row_length;
+ for (x = 0; x < half_row; x+=depth) { // 0, 3, 6, ..., 160*depth
+ index1 = new_row + x; // 0, 3, 6, ..., 160*depth
+ index2 = next_row - x - depth;// 320, 319, 318, ..., 161*depth
+ for (z = 0; z < depth; z++) { // 0, ..., depth
+ temp = image[index1 + z];
+ image[index1 + z] = image[index2 + z];
+ image[index2 + z] = temp;
+ }
+ }
+ }
+}
+
+static void
+camorama_filter_mirror_class_init(CamoramaFilterMirrorClass* self_class) {
+ self_class->filter = camorama_filter_mirror_filter;
+ self_class->name = _("Mirror");
+}
+
+
diff --git a/src/camorama-globals.h b/src/camorama-globals.h
new file mode 100644
index 0000000..d956905
--- /dev/null
+++ b/src/camorama-globals.h
@@ -0,0 +1,40 @@
+/* This file is part of ...
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2003 Greg Jones
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef CAMORAMA_GLOBALS_H
+#define CAMORAMA_GLOBALS_H
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+GtkWidget *main_window, *prefswindow;
+int frames, frames2, seconds;
+GtkWidget *dentry, *entry2, *string_entry, *format_selection;
+GtkWidget *host_entry, *directory_entry, *filename_entry, *login_entry,
+ *pw_entry;
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_GLOBALS_H */
diff --git a/src/camorama-stock-items.c b/src/camorama-stock-items.c
new file mode 100644
index 0000000..01bf3a5
--- /dev/null
+++ b/src/camorama-stock-items.c
@@ -0,0 +1,51 @@
+#include "camorama-stock-items.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkstock.h>
+
+#include "camorama-stock-images.h"
+
+static GtkStockItem camorama_items[] = {
+ {CAMORAMA_STOCK_WEBCAM, N_("Webcam"), 0, 0, "camorama"}
+};
+
+static void
+add_default_image(const gchar* stock_id, gint size, const guchar* inline_data) {
+ GdkPixbuf* buf = gdk_pixbuf_new_from_inline(-1, inline_data, FALSE, NULL);
+ g_return_if_fail(buf);
+
+ gtk_icon_theme_add_builtin_icon(stock_id, size, buf);
+ g_object_unref(buf);
+}
+
+void
+camorama_stock_init(void) {
+ GtkIconFactory* factory = gtk_icon_factory_new();
+ GtkIconSet * set = gtk_icon_set_new ();
+ GtkIconSource * source = gtk_icon_source_new();
+
+ gtk_stock_add_static(camorama_items, G_N_ELEMENTS(camorama_items));
+
+ gtk_icon_source_set_size_wildcarded(source, TRUE);
+ gtk_icon_source_set_direction_wildcarded(source, TRUE);
+ gtk_icon_source_set_state_wildcarded(source, TRUE);
+
+ gtk_icon_source_set_icon_name(source, CAMORAMA_STOCK_WEBCAM);
+ gtk_icon_set_add_source(set, source);
+
+ gtk_icon_factory_add(factory, CAMORAMA_STOCK_WEBCAM, set);
+
+ add_default_image(CAMORAMA_STOCK_WEBCAM, 16, camorama_webcam_16);
+ add_default_image(CAMORAMA_STOCK_WEBCAM, 24, camorama_webcam_24);
+
+ gtk_icon_factory_add_default(factory);
+
+ gtk_icon_set_unref(set);
+ gtk_icon_source_free(source);
+}
+
diff --git a/src/camorama-stock-items.h b/src/camorama-stock-items.h
new file mode 100644
index 0000000..17b2527
--- /dev/null
+++ b/src/camorama-stock-items.h
@@ -0,0 +1,14 @@
+#ifndef CAMORAMA_STOCK_ITEMS_H
+#define CAMORAMA_STOCK_ITEMS_H
+
+#include <glib/gmacros.h>
+
+G_BEGIN_DECLS
+
+void camorama_stock_init(void);
+
+#define CAMORAMA_STOCK_WEBCAM "camorama-webcam"
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_STOCK_ITEMS_H */
diff --git a/src/camorama-window.c b/src/camorama-window.c
new file mode 100644
index 0000000..df9c125
--- /dev/null
+++ b/src/camorama-window.c
@@ -0,0 +1,475 @@
+/* This file is part of camorama
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2003 Greg Jones
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "camorama-window.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <libgnomeui/gnome-file-entry.h>
+#include "callbacks.h"
+#include "camorama-filter-chain.h"
+#include "camorama-globals.h"
+#include "camorama-stock-items.h"
+#include "filter.h"
+#include "glib-helpers.h"
+
+static GQuark menu_item_filter_type = 0;
+
+static void
+add_filter_clicked(GtkMenuItem* menuitem, CamoramaFilterChain* chain) {
+ GType filter_type = GPOINTER_TO_INT(g_object_get_qdata(G_OBJECT(menuitem), menu_item_filter_type));
+ camorama_filter_chain_append(chain, filter_type);
+}
+
+struct weak_target {
+ GtkTreeModel* model;
+ GList * list;
+};
+
+static void
+reference_path(GtkTreePath* path, struct weak_target* target) {
+ target->list = g_list_prepend(target->list, gtk_tree_row_reference_new(target->model, path));
+}
+
+static void
+delete_filter(GtkTreeRowReference* ref, GtkTreeModel* model) {
+ GtkTreeIter iter;
+ GtkTreePath* path = gtk_tree_row_reference_get_path(ref);
+ gtk_tree_model_get_iter(model, &iter, path);
+ gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
+}
+
+static void
+delete_filter_clicked(GtkTreeSelection* sel, GtkMenuItem* menuitem) {
+ GtkTreeModel* model;
+ GList* paths = gtk_tree_selection_get_selected_rows(sel, &model);
+ struct weak_target target = {model, NULL};
+ g_list_foreach(paths, G_FUNC(reference_path), &target);
+ g_list_foreach(target.list, G_FUNC(delete_filter), model);
+ g_list_foreach(target.list, G_FUNC(gtk_tree_row_reference_free), NULL);
+ g_list_free(target.list);
+ g_list_foreach(paths, G_FUNC(gtk_tree_path_free), NULL);
+ g_list_free(paths);
+}
+
+static void
+menu_position_func(GtkMenu* menu, gint* x, gint* y, gboolean *push_in, gpointer user_data) {
+ if(user_data) {
+ GdkEventButton* ev = (GdkEventButton*)user_data;
+ *x = ev->x;
+ *y = ev->y;
+ } else {
+ // find the selected row and open the popup there
+ }
+}
+
+static void
+show_popup(cam* cam, GtkTreeView* treeview, GdkEventButton* ev) {
+ GtkMenu* menu = GTK_MENU(gtk_menu_new());
+ GtkWidget* item;
+ GtkWidget* add_filters = gtk_menu_new();
+ GType* filters;
+ guint n_filters, i;
+ GtkTreeModel* model = gtk_tree_view_get_model(treeview);
+ GtkTreeSelection* sel = gtk_tree_view_get_selection(treeview);
+
+ gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
+
+ item = gtk_menu_item_new_with_mnemonic("_Delete");
+ g_signal_connect_swapped(item, "activate",
+ G_CALLBACK(delete_filter_clicked), sel);
+ gtk_container_add(GTK_CONTAINER(menu), item);
+ gtk_container_add(GTK_CONTAINER(menu), gtk_separator_menu_item_new());
+
+ if(!gtk_tree_selection_count_selected_rows(sel)) {
+ gtk_widget_set_sensitive(item, FALSE);
+ }
+
+ item = gtk_menu_item_new_with_mnemonic(_("_Add Filter"));
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), add_filters);
+ gtk_container_add(GTK_CONTAINER(menu), item);
+
+ filters = g_type_children(CAMORAMA_TYPE_FILTER, &n_filters);
+ for(i = 0; i < n_filters; i++) {
+ CamoramaFilterClass* filter_class = g_type_class_ref(filters[i]);
+ gchar const* filter_name = filter_class->name;
+
+ if(!filter_name) {
+ filter_name = g_type_name(filters[i]);
+ }
+
+ item = gtk_menu_item_new_with_label(filter_name);
+ g_object_set_qdata(G_OBJECT(item), menu_item_filter_type, GINT_TO_POINTER(filters[i]));
+ g_signal_connect(item, "activate",
+ G_CALLBACK(add_filter_clicked), model);
+ gtk_container_add(GTK_CONTAINER(add_filters), item);
+ g_type_class_unref(filter_class);
+ }
+ g_free(filters);
+
+ gtk_widget_show_all(GTK_WIDGET(menu));
+ gtk_menu_popup(menu,
+ NULL, NULL,
+ menu_position_func, ev,
+ ev ? ev->button : 0,
+ ev ? ev->time : gtk_get_current_event_time());
+}
+
+static void
+treeview_popup_menu_cb(cam* cam, GtkTreeView* treeview) {
+ show_popup(cam, treeview, NULL);
+}
+
+static gboolean
+treeview_clicked_cb(cam* cam, GdkEventButton* ev, GtkTreeView* treeview) {
+ gboolean retval = GTK_WIDGET_GET_CLASS(treeview)->button_press_event(GTK_WIDGET(treeview), ev);
+
+ if(ev->button == 3) {
+ show_popup(cam, treeview, NULL);
+ retval = TRUE;
+ }
+
+ return retval;
+}
+
+static void
+tray_clicked_callback (GtkStatusIcon* status, guint button, guint activate_time, cam * cam){
+ // FIXME: change to switch
+ if (button == 1) {
+ if (GTK_WIDGET_VISIBLE
+ (glade_xml_get_widget (cam->xml, "main_window"))) {
+ cam->hidden = TRUE;
+ gtk_idle_remove (cam->idle_id);
+ gtk_widget_hide (glade_xml_get_widget
+ (cam->xml, "main_window"));
+ } else {
+ cam->idle_id =
+ gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
+ gtk_widget_show (glade_xml_get_widget
+ (cam->xml, "main_window"));
+ cam->hidden = FALSE;
+ }
+ } else if (button == 3) {
+
+ //gw = MyApp->GetMainWindow ();
+
+ //gnomemeeting_component_view (NULL, (gpointer) gw->ldap_window);
+
+ }
+}
+
+void
+load_interface(cam* cam) {
+ gchar *title;
+ GdkPixbuf *logo = NULL;
+ GtkTreeView* treeview = GTK_TREE_VIEW(glade_xml_get_widget(cam->xml, "treeview_effects"));
+ GtkCellRenderer* cell;
+
+ menu_item_filter_type = g_quark_from_static_string("camorama-menu-item-filter-type");
+
+ /* set up the tree view */
+ cell = gtk_cell_renderer_text_new();
+ g_object_set(cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(cell), 1);
+ gtk_tree_view_insert_column_with_attributes(treeview, -1,
+ _("Effects"), cell,
+ "text", CAMORAMA_FILTER_CHAIN_COL_NAME,
+ NULL);
+ cam->filter_chain = camorama_filter_chain_new();
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(cam->filter_chain));
+ g_object_unref(cam->filter_chain);
+ g_signal_connect_swapped(treeview, "button-press-event",
+ G_CALLBACK(treeview_clicked_cb), cam);
+ g_signal_connect_swapped(treeview, "popup-menu",
+ G_CALLBACK(treeview_popup_menu_cb), cam);
+
+ logo = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gtk_widget_get_screen(glade_xml_get_widget(cam->xml, "main_window"))), CAMORAMA_STOCK_WEBCAM, 24, 0, NULL);
+ gtk_window_set_default_icon(logo);
+ logo = (GdkPixbuf *) create_pixbuf (PACKAGE_DATA_DIR "/pixmaps/camorama.png");
+ if (logo == NULL) {
+ printf ("\n\nLOGO NO GO\n\n");
+ }
+
+ if (cam->show_adjustments == FALSE) {
+ gtk_widget_hide (glade_xml_get_widget
+ (cam->xml, "adjustments_table"));
+
+ gtk_window_resize (GTK_WINDOW
+ (glade_xml_get_widget
+ (cam->xml, "main_window")), 320, 240);
+ }
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(cam->xml, "showadjustment_item")), cam->show_adjustments);
+ if (cam->show_effects == FALSE) {
+ gtk_widget_hide (glade_xml_get_widget (cam->xml, "scrolledwindow_effects"));
+ gtk_window_resize (GTK_WINDOW
+ (glade_xml_get_widget
+ (cam->xml, "main_window")), 320, 240);
+ }
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(cam->xml, "show_effects")), cam->show_effects);
+
+ cam->tray_icon = gtk_status_icon_new_from_stock (CAMORAMA_STOCK_WEBCAM);
+ update_tooltip (cam);
+ /* add the status to the plug */
+ g_object_set_data (G_OBJECT (cam->tray_icon), "available",
+ GINT_TO_POINTER (1));
+ g_object_set_data (G_OBJECT (cam->tray_icon), "embedded",
+ GINT_TO_POINTER (0));
+
+ g_signal_connect (cam->tray_icon, "popup-menu",
+ G_CALLBACK (tray_clicked_callback), cam);
+
+ /* connect the signals in the interface
+ * glade_xml_signal_autoconnect(xml);
+ * this won't work, can't pass data to callbacks. have to do it individually :(*/
+
+ title = g_strdup_printf ("Camorama - %s - %dx%d", cam->vid_cap.name,
+ cam->x, cam->y);
+ gtk_window_set_title (GTK_WINDOW
+ (glade_xml_get_widget (cam->xml, "main_window")),
+ title);
+ g_free (title);
+
+ gtk_window_set_icon (GTK_WINDOW
+ (glade_xml_get_widget (cam->xml, "main_window")),
+ logo);
+ gtk_window_set_icon (GTK_WINDOW
+ (glade_xml_get_widget (cam->xml, "prefswindow")),
+ logo);
+
+ glade_xml_signal_connect_data (cam->xml, "on_show_effects_activate",
+ G_CALLBACK (on_show_effects_activate),
+ cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "togglebutton1"),
+ cam->show_adjustments);
+ glade_xml_signal_connect_data (cam->xml,
+ "on_show_adjustments_activate",
+ G_CALLBACK
+ (on_show_adjustments_activate), cam);
+
+ glade_xml_signal_connect_data (cam->xml, "on_large_activate",
+ G_CALLBACK (on_change_size_activate), cam);
+ glade_xml_signal_connect_data (cam->xml, "on_medium_activate",
+ G_CALLBACK (on_change_size_activate), cam);
+ glade_xml_signal_connect_data (cam->xml, "on_small_activate",
+ G_CALLBACK (on_change_size_activate), cam);
+
+ //glade_xml_signal_connect_data(cam->xml, "capture_func", G_CALLBACK(on_change_size_activate), cam);
+ glade_xml_signal_connect_data (cam->xml, "capture_func",
+ G_CALLBACK (capture_func), cam);
+ glade_xml_signal_connect_data (cam->xml, "gtk_main_quit",
+ G_CALLBACK (delete_event), NULL);
+
+ /* sliders */
+ glade_xml_signal_connect_data (cam->xml, "contrast_change",
+ G_CALLBACK (contrast_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider2"),
+ (int) (cam->contrast / 256));
+ glade_xml_signal_connect_data (cam->xml, "brightness_change",
+ G_CALLBACK (brightness_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider3"),
+ (int) (cam->brightness / 256));
+ glade_xml_signal_connect_data (cam->xml, "colour_change",
+ G_CALLBACK (colour_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider4"),
+ (int) (cam->colour / 256));
+ glade_xml_signal_connect_data (cam->xml, "hue_change",
+ G_CALLBACK (hue_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider5"),
+ (int) (cam->hue / 256));
+ glade_xml_signal_connect_data (cam->xml, "wb_change",
+ G_CALLBACK (wb_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider6"),
+ (int) (cam->wb / 256));
+
+ /* buttons */
+ glade_xml_signal_connect_data (cam->xml,
+ "on_drawingarea_expose_event",
+ G_CALLBACK
+ (on_drawingarea_expose_event),
+ (gpointer) cam);
+ glade_xml_signal_connect_data (cam->xml, "on_status_show",
+ G_CALLBACK (on_status_show),
+ (gpointer) cam);
+ glade_xml_signal_connect_data (cam->xml, "on_quit_activate",
+ G_CALLBACK (on_quit_activate),
+ (gpointer) cam);
+ glade_xml_signal_connect_data (cam->xml, "on_preferences1_activate",
+ G_CALLBACK (on_preferences1_activate),
+ (gpointer) cam);
+ glade_xml_signal_connect_data (cam->xml, "on_about_activate",
+ G_CALLBACK (on_about_activate),
+ (gpointer) cam);
+
+ /* prefs */
+ glade_xml_signal_connect_data (cam->xml, "prefs_func",
+ G_CALLBACK (prefs_func), cam);
+
+ /* general */
+ glade_xml_signal_connect_data (cam->xml, "cap_func",
+ G_CALLBACK (cap_func), cam);
+
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "captured_cb"),
+ cam->cap);
+
+ glade_xml_signal_connect_data (cam->xml, "rcap_func",
+ G_CALLBACK (rcap_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "rcapture"),
+ cam->rcap);
+
+ glade_xml_signal_connect_data (cam->xml, "acap_func",
+ G_CALLBACK (acap_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "acapture"),
+ cam->acap);
+
+ glade_xml_signal_connect_data (cam->xml, "interval_change",
+ G_CALLBACK (interval_change), cam);
+
+ gtk_spin_button_set_value ((GtkSpinButton *)
+ glade_xml_get_widget (cam->xml,
+ "interval_entry"),
+ (cam->timeout_interval / 60000));
+
+ /* local */
+ dentry = glade_xml_get_widget (cam->xml, "dentry");
+ entry2 = glade_xml_get_widget (cam->xml, "entry2");
+ gtk_entry_set_text (GTK_ENTRY
+ (gnome_file_entry_gtk_entry
+ (GNOME_FILE_ENTRY (dentry))), cam->pixdir);
+
+ gtk_entry_set_text (GTK_ENTRY (entry2), cam->capturefile);
+
+ glade_xml_signal_connect_data (cam->xml, "append_func",
+ G_CALLBACK (append_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "appendbutton"),
+ cam->timefn);
+
+ glade_xml_signal_connect_data (cam->xml, "jpg_func",
+ G_CALLBACK (jpg_func), cam);
+ if (cam->savetype == JPEG) {
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "jpgb"), TRUE);
+ }
+ glade_xml_signal_connect_data (cam->xml, "png_func",
+ G_CALLBACK (png_func), cam);
+ if (cam->savetype == PNG) {
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "pngb"), TRUE);
+ }
+
+ glade_xml_signal_connect_data (cam->xml, "ts_func",
+ G_CALLBACK (ts_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "tsbutton"),
+ cam->timestamp);
+
+ /* remote */
+ login_entry = glade_xml_get_widget (cam->xml, "login_entry");
+ host_entry = glade_xml_get_widget (cam->xml, "host_entry");
+ pw_entry = glade_xml_get_widget (cam->xml, "pw_entry");
+ directory_entry = glade_xml_get_widget (cam->xml, "directory_entry");
+ filename_entry = glade_xml_get_widget (cam->xml, "filename_entry");
+ gtk_entry_set_text (GTK_ENTRY (host_entry), cam->rhost);
+ gtk_entry_set_text (GTK_ENTRY (login_entry), cam->rlogin);
+ gtk_entry_set_text (GTK_ENTRY (pw_entry), cam->rpw);
+ gtk_entry_set_text (GTK_ENTRY (directory_entry), cam->rpixdir);
+ gtk_entry_set_text (GTK_ENTRY (filename_entry), cam->rcapturefile);
+
+ glade_xml_signal_connect_data (cam->xml, "rappend_func",
+ G_CALLBACK (rappend_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "timecb"),
+ cam->rtimefn);
+
+ glade_xml_signal_connect_data (cam->xml, "rjpg_func",
+ G_CALLBACK (rjpg_func), cam);
+ if (cam->rsavetype == JPEG) {
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "fjpgb"), TRUE);
+ }
+ glade_xml_signal_connect_data (cam->xml, "rpng_func",
+ G_CALLBACK (rpng_func), cam);
+ if (cam->rsavetype == PNG) {
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "fpngb"), TRUE);
+ }
+
+ glade_xml_signal_connect_data (cam->xml, "rts_func",
+ G_CALLBACK (rts_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml,
+ "tsbutton2"),
+ cam->rtimestamp);
+
+ /* timestamp */
+ glade_xml_signal_connect_data (cam->xml, "customstring_func",
+ G_CALLBACK (customstring_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml, "cscb"),
+ cam->usestring);
+
+ string_entry = glade_xml_get_widget (cam->xml, "string_entry");
+ gtk_entry_set_text (GTK_ENTRY (string_entry), cam->ts_string);
+
+ glade_xml_signal_connect_data (cam->xml, "drawdate_func",
+ G_CALLBACK (drawdate_func), cam);
+ gtk_toggle_button_set_active ((GtkToggleButton *)
+ glade_xml_get_widget (cam->xml, "tscb"),
+ cam->usedate);
+
+ cam->status = glade_xml_get_widget (cam->xml, "status");
+ set_sensitive (cam);
+ gtk_widget_set_sensitive (glade_xml_get_widget
+ (cam->xml, "string_entry"), cam->usestring);
+
+ gtk_widget_set_size_request (glade_xml_get_widget (cam->xml, "da"),
+ cam->x, cam->y);
+
+ prefswindow = glade_xml_get_widget (cam->xml, "prefswindow");
+}
+
+
diff --git a/src/camorama-window.h b/src/camorama-window.h
new file mode 100644
index 0000000..5a25e87
--- /dev/null
+++ b/src/camorama-window.h
@@ -0,0 +1,36 @@
+/* This file is part of ...
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2003 Greg Jones
+ * Copyright (C) 2006 Sven Herzberg <herzi@gnome-de.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef CAMORAMA_WINDOW_H
+#define CAMORAMA_WINDOW_H
+
+#include "v4l.h"
+
+G_BEGIN_DECLS
+
+void load_interface(cam* cam);
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_WINDOW_H */
diff --git a/src/eggtrayicon.c b/src/eggtrayicon.c
deleted file mode 100644
index 6c30930..0000000
--- a/src/eggtrayicon.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.c
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <libintl.h>
-
-#include "eggtrayicon.h"
-
-#include <gdk/gdkx.h>
-#include <X11/Xatom.h>
-
-#ifndef EGG_COMPILATION
-#ifndef _
-#define _(x) dgettext (GETTEXT_PACKAGE, x)
-#define N_(x) x
-#endif
-#else
-#define _(x) x
-#define N_(x) x
-#endif
-
-#define SYSTEM_TRAY_REQUEST_DOCK 0
-#define SYSTEM_TRAY_BEGIN_MESSAGE 1
-#define SYSTEM_TRAY_CANCEL_MESSAGE 2
-
-#define SYSTEM_TRAY_ORIENTATION_HORZ 0
-#define SYSTEM_TRAY_ORIENTATION_VERT 1
-
-enum {
- PROP_0,
- PROP_ORIENTATION
-};
-
-static GtkPlugClass *parent_class = NULL;
-
-static void egg_tray_icon_init (EggTrayIcon *icon);
-static void egg_tray_icon_class_init (EggTrayIconClass *klass);
-
-static void egg_tray_icon_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void egg_tray_icon_realize (GtkWidget *widget);
-static void egg_tray_icon_unrealize (GtkWidget *widget);
-
-static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
-
-GType
-egg_tray_icon_get_type (void)
-{
- static GType our_type = 0;
-
- if (our_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (EggTrayIconClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_tray_icon_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggTrayIcon),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tray_icon_init
- };
-
- our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
- }
-
- return our_type;
-}
-
-static void
-egg_tray_icon_init (EggTrayIcon *icon)
-{
- icon->stamp = 1;
- icon->orientation = GTK_ORIENTATION_HORIZONTAL;
-
- gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
-}
-
-static void
-egg_tray_icon_class_init (EggTrayIconClass *klass)
-{
- GObjectClass *gobject_class = (GObjectClass *)klass;
- GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->get_property = egg_tray_icon_get_property;
-
- widget_class->realize = egg_tray_icon_realize;
- widget_class->unrealize = egg_tray_icon_unrealize;
-
- g_object_class_install_property (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation",
- _("Orientation"),
- _("The orientation of the tray."),
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READABLE));
-}
-
-static void
-egg_tray_icon_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggTrayIcon *icon = EGG_TRAY_ICON (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, icon->orientation);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
-{
- Display *xdisplay;
- Atom type;
- int format;
- union {
- gulong *prop;
- guchar *prop_ch;
- } prop = { NULL };
- gulong nitems;
- gulong bytes_after;
- int error, result;
-
- g_assert (icon->manager_window != None);
-
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-
- gdk_error_trap_push ();
- type = None;
- result = XGetWindowProperty (xdisplay,
- icon->manager_window,
- icon->orientation_atom,
- 0, G_MAXLONG, FALSE,
- XA_CARDINAL,
- &type, &format, &nitems,
- &bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
-
- if (error || result != Success)
- return;
-
- if (type == XA_CARDINAL)
- {
- GtkOrientation orientation;
-
- orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
- GTK_ORIENTATION_HORIZONTAL :
- GTK_ORIENTATION_VERTICAL;
-
- if (icon->orientation != orientation)
- {
- icon->orientation = orientation;
-
- g_object_notify (G_OBJECT (icon), "orientation");
- }
- }
-
- if (prop.prop)
- XFree (prop.prop);
-}
-
-static GdkFilterReturn
-egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
-{
- EggTrayIcon *icon = user_data;
- XEvent *xev = (XEvent *)xevent;
-
- if (xev->xany.type == ClientMessage &&
- xev->xclient.message_type == icon->manager_atom &&
- xev->xclient.data.l[1] == icon->selection_atom)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- else if (xev->xany.window == icon->manager_window)
- {
- if (xev->xany.type == PropertyNotify &&
- xev->xproperty.atom == icon->orientation_atom)
- {
- egg_tray_icon_get_orientation_property (icon);
- }
- if (xev->xany.type == DestroyNotify)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-egg_tray_icon_unrealize (GtkWidget *widget)
-{
- EggTrayIcon *icon = EGG_TRAY_ICON (widget);
- GdkWindow *root_window;
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
- gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
- icon->manager_window);
-
- gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
- }
-
- root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
-
- gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon);
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-egg_tray_icon_send_manager_message (EggTrayIcon *icon,
- long message,
- Window window,
- long data1,
- long data2,
- long data3)
-{
- XClientMessageEvent ev;
- Display *display;
-
- ev.type = ClientMessage;
- ev.window = window;
- ev.message_type = icon->system_tray_opcode_atom;
- ev.format = 32;
- ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
- ev.data.l[1] = message;
- ev.data.l[2] = data1;
- ev.data.l[3] = data2;
- ev.data.l[4] = data3;
-
- display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-
- gdk_error_trap_push ();
- XSendEvent (display,
- icon->manager_window, False, NoEventMask, (XEvent *)&ev);
- XSync (display, False);
- gdk_error_trap_pop ();
-}
-
-static void
-egg_tray_icon_send_dock_request (EggTrayIcon *icon)
-{
- egg_tray_icon_send_manager_message (icon,
- SYSTEM_TRAY_REQUEST_DOCK,
- icon->manager_window,
- gtk_plug_get_id (GTK_PLUG (icon)),
- 0, 0);
-}
-
-static void
-egg_tray_icon_update_manager_window (EggTrayIcon *icon)
-{
- Display *xdisplay;
-
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
- gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
- icon->manager_window);
-
- gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
- }
-
- XGrabServer (xdisplay);
-
- icon->manager_window = XGetSelectionOwner (xdisplay,
- icon->selection_atom);
-
- if (icon->manager_window != None)
- XSelectInput (xdisplay,
- icon->manager_window, StructureNotifyMask|PropertyChangeMask);
-
- XUngrabServer (xdisplay);
- XFlush (xdisplay);
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
- gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
- icon->manager_window);
-
- gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-
- /* Send a request that we'd like to dock */
- egg_tray_icon_send_dock_request (icon);
-
- egg_tray_icon_get_orientation_property (icon);
- }
-}
-
-static void
-egg_tray_icon_realize (GtkWidget *widget)
-{
- EggTrayIcon *icon = EGG_TRAY_ICON (widget);
- GdkScreen *screen;
- GdkDisplay *display;
- Display *xdisplay;
- char buffer[256];
- GdkWindow *root_window;
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
- screen = gtk_widget_get_screen (widget);
- display = gdk_screen_get_display (screen);
- xdisplay = gdk_x11_display_get_xdisplay (display);
-
- /* Now see if there's a manager window around */
- g_snprintf (buffer, sizeof (buffer),
- "_NET_SYSTEM_TRAY_S%d",
- gdk_screen_get_number (screen));
-
- icon->selection_atom = XInternAtom (xdisplay, buffer, False);
-
- icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False);
-
- icon->system_tray_opcode_atom = XInternAtom (xdisplay,
- "_NET_SYSTEM_TRAY_OPCODE",
- False);
-
- icon->orientation_atom = XInternAtom (xdisplay,
- "_NET_SYSTEM_TRAY_ORIENTATION",
- False);
-
- egg_tray_icon_update_manager_window (icon);
-
- root_window = gdk_screen_get_root_window (screen);
-
- /* Add a root window filter so that we get changes on MANAGER */
- gdk_window_add_filter (root_window,
- egg_tray_icon_manager_filter, icon);
-}
-
-EggTrayIcon *
-egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
-{
- GdkDisplay *display;
- GdkScreen *screen;
-
- display = gdk_x11_lookup_xdisplay (DisplayOfScreen (xscreen));
- screen = gdk_display_get_screen (display, XScreenNumberOfScreen (xscreen));
-
- return egg_tray_icon_new_for_screen (screen, name);
-}
-
-EggTrayIcon *
-egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL);
-}
-
-EggTrayIcon*
-egg_tray_icon_new (const gchar *name)
-{
- return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL);
-}
-
-guint
-egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const gchar *message,
- gint len)
-{
- guint stamp;
-
- g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
- g_return_val_if_fail (timeout >= 0, 0);
- g_return_val_if_fail (message != NULL, 0);
-
- if (icon->manager_window == None)
- return 0;
-
- if (len < 0)
- len = strlen (message);
-
- stamp = icon->stamp++;
-
- /* Get ready to send the message */
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- timeout, len, stamp);
-
- /* Now to send the actual message */
- gdk_error_trap_push ();
- while (len > 0)
- {
- XClientMessageEvent ev;
- Display *xdisplay;
-
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-
- ev.type = ClientMessage;
- ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
- ev.format = 8;
- ev.message_type = XInternAtom (xdisplay,
- "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
- if (len > 20)
- {
- memcpy (&ev.data, message, 20);
- len -= 20;
- message += 20;
- }
- else
- {
- memcpy (&ev.data, message, len);
- len = 0;
- }
-
- XSendEvent (xdisplay,
- icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
- XSync (xdisplay, False);
- }
- gdk_error_trap_pop ();
-
- return stamp;
-}
-
-void
-egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id)
-{
- g_return_if_fail (EGG_IS_TRAY_ICON (icon));
- g_return_if_fail (id > 0);
-
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- id, 0, 0);
-}
-
-GtkOrientation
-egg_tray_icon_get_orientation (EggTrayIcon *icon)
-{
- g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL);
-
- return icon->orientation;
-}
diff --git a/src/eggtrayicon.h b/src/eggtrayicon.h
deleted file mode 100644
index 007f4c1..0000000
--- a/src/eggtrayicon.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TRAY_ICON_H__
-#define __EGG_TRAY_ICON_H__
-
-#include <gtk/gtkplug.h>
-#include <gdk/gdkx.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ())
-#define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon))
-#define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-#define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON))
-#define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON))
-#define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-
-typedef struct _EggTrayIcon EggTrayIcon;
-typedef struct _EggTrayIconClass EggTrayIconClass;
-
-struct _EggTrayIcon
-{
- GtkPlug parent_instance;
-
- guint stamp;
-
- Atom selection_atom;
- Atom manager_atom;
- Atom system_tray_opcode_atom;
- Atom orientation_atom;
- Window manager_window;
-
- GtkOrientation orientation;
-};
-
-struct _EggTrayIconClass
-{
- GtkPlugClass parent_class;
-};
-
-GType egg_tray_icon_get_type (void);
-
-EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen,
- const gchar *name);
-
-EggTrayIcon *egg_tray_icon_new (const gchar *name);
-
-guint egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const char *message,
- gint len);
-void egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id);
-
-GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon);
-
-G_END_DECLS
-
-#endif /* __EGG_TRAY_ICON_H__ */
diff --git a/src/fileio.c b/src/fileio.c
index 7e8a6b1..43ee0b2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -15,12 +15,13 @@ static int print_error (GnomeVFSResult result, const char *uri_string);
/* add timestamp/text to image - "borrowed" from gspy */
int
-add_rgb_text (char *image, int width, int height, char *cstring, char *format,
+add_rgb_text (guchar *image, int width, int height, char *cstring, char *format,
gboolean str, gboolean date)
{
time_t t;
struct tm *tm;
- unsigned char line[128], *ptr;
+ gchar line[128];
+ guchar *ptr;
int i, x, y, f, len;
int total;
gchar *image_label;
@@ -207,7 +208,7 @@ void remote_save (cam * cam)
/* start here? */
/*result = gnome_vfs_open_uri((GnomeVFSHandle **) & write_handle, uri_1, GNOME_VFS_OPEN_WRITE);
* if(result != GNOME_VFS_OK) {
- * error_message = g_strdup_printf(_("An error occured opening %s."), output_uri_string);
+ * error_message = g_strdup_printf(_("An error occurred opening %s."), output_uri_string);
* error_dialog(error_message);
* g_free(error_message);
* g_thread_exit(NULL);
@@ -216,7 +217,7 @@ void remote_save (cam * cam)
/* write the data */
/*result = gnome_vfs_write((GnomeVFSHandle *) write_handle, tmp, bytes, &bytes_written);
* if(result != GNOME_VFS_OK) {
- * error_message = g_strdup_printf(_("An error occured writing to %s."), output_uri_string);
+ * error_message = g_strdup_printf(_("An error occurred writing to %s."), output_uri_string);
* error_dialog(error_message);
* g_free(error_message);
* } */
@@ -308,7 +309,7 @@ void save_thread (cam * cam)
uri_1, GNOME_VFS_OPEN_WRITE);
if (result != GNOME_VFS_OK) {
error_message =
- g_strdup_printf (_("An error occured opening %s."),
+ g_strdup_printf (_("An error occurred opening %s."),
output_uri_string);
error_dialog (error_message);
g_free (error_message);
@@ -320,7 +321,7 @@ void save_thread (cam * cam)
&bytes_written);
if (result != GNOME_VFS_OK) {
error_message =
- g_strdup_printf (_("An error occured writing to %s."),
+ g_strdup_printf (_("An error occurred writing to %s."),
output_uri_string);
error_dialog (error_message);
g_free (error_message);
@@ -336,7 +337,7 @@ static int print_error (GnomeVFSResult result, const char *uri_string)
const char *error_string;
/* get the string corresponding to this GnomeVFSResult value */
error_string = gnome_vfs_result_to_string (result);
- printf ("Error %s occured opening location %s\n", error_string,
+ printf ("Error %s occurred opening location %s\n", error_string,
uri_string);
return 1;
}
diff --git a/src/fileio.h b/src/fileio.h
index 96ae35c..c74e2ca 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -1,7 +1,7 @@
#include "v4l.h"
#include <libgnomevfs/gnome-vfs.h>
-int add_rgb_text (char *, int, int, char *, char *, gboolean, gboolean);
+int add_rgb_text (guchar *, int, int, char *, char *, gboolean, gboolean);
void remote_save (cam *);
void save_thread (cam *);
int local_save (cam *);
diff --git a/src/filter.c b/src/filter.c
index 778a7ce..7322243 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -1,3 +1,34 @@
+#include "filter.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+
+gchar const*
+camorama_filter_get_name(CamoramaFilter* self) {
+ gchar const* name = CAMORAMA_FILTER_GET_CLASS(self)->name;
+ g_return_val_if_fail(name, G_OBJECT_TYPE_NAME(self));
+ return _(name);
+}
+
+void
+camorama_filter_apply(CamoramaFilter* self, guchar* image, gint width, gint height, gint depth) {
+ g_return_if_fail(CAMORAMA_FILTER_GET_CLASS(self)->filter);
+
+ CAMORAMA_FILTER_GET_CLASS(self)->filter(self, image, width, height, depth);
+}
+
+/* GType stuff ifor CamoramaFilter */
+G_DEFINE_ABSTRACT_TYPE(CamoramaFilter, camorama_filter, G_TYPE_OBJECT);
+
+static void
+camorama_filter_init(CamoramaFilter* self) {}
+
+static void
+camorama_filter_class_init(CamoramaFilterClass* self_class) {}
+
#include "v4l.h"
static inline void move_420_block (int yTL, int yTR, int yBL, int yBR, int u,
@@ -11,9 +42,7 @@ static inline void move_420_block (int yTL, int yTR, int yBL, int yBR, int u,
#define LIMIT(x) ((x)>0xffffff?0xff: ((x)<=0xffff?0:((x)>>16)))
void
-yuv420p_to_rgb (unsigned char *image, unsigned char *temp, int x, int y,
- int z)
-{
+yuv420p_to_rgb (unsigned char *image, unsigned char *temp, int x, int y, int z) {
const int numpix = x * y;
const int bytes = z; /* (z*8) >> 3; */
int i, j, y00, y01, y10, y11, u, v;
@@ -21,7 +50,8 @@ yuv420p_to_rgb (unsigned char *image, unsigned char *temp, int x, int y,
unsigned char *pU = pY + numpix;
unsigned char *pV = pU + numpix / 4;
unsigned char *image2 = temp;
-
+ if(FALSE) // FIXME: make TRUE to add debugging in here
+ g_print("%s\n", "yuv420p->rgb");
for (j = 0; j <= y - 2; j += 2) {
for (i = 0; i <= x - 2; i += 2) {
y00 = *pY;
@@ -31,15 +61,16 @@ yuv420p_to_rgb (unsigned char *image, unsigned char *temp, int x, int y,
u = (*pU++) - 128;
v = (*pV++) - 128;
- move_420_block (y00, y01, y10, y11, u, v, x, image2, z * 8);
+ move_420_block (y00, y01, y10, y11, u, v, x, image2, z * 8);
- pY += 2;
- image2 += 2 * bytes;
+ pY += 2;
+ image2 += 2 * bytes;
+ }
+ pY += x;
+ image2 += x * bytes;
}
- pY += x;
- image2 += x * bytes;
- }
}
+
static inline void
move_420_block (int yTL, int yTR, int yBL, int yBR, int u, int v,
int rowPixels, unsigned char *rgb, int bits)
@@ -111,33 +142,80 @@ move_420_block (int yTL, int yTR, int yBL, int yBR, int u, int v,
}
}
-void fix_colour (char *image, int x, int y)
-{
- int i;
- char tmp;
- i = x * y;
- while (--i) {
- tmp = image[0];
- image[0] = image[2];
- image[2] = tmp;
- image += 3;
- }
+/* GType stuff for CamoramaFilterColor */
+typedef struct _CamoramaFilter CamoramaFilterColor;
+typedef struct _CamoramaFilterClass CamoramaFilterColorClass;
+
+G_DEFINE_TYPE(CamoramaFilterColor, camorama_filter_color, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_color_init(CamoramaFilterColor* self) {}
+
+static void
+camorama_filter_color_filter(CamoramaFilterColor* filter, guchar *image, int x, int y, int depth) {
+ int i;
+ char tmp;
+ i = x * y;
+ while (--i) {
+ tmp = image[0];
+ image[0] = image[2];
+ image[2] = tmp;
+ image += 3;
+ }
}
-void negative (unsigned char *image, int x, int y, int z)
-{
- int i;
- for (i = 0; i < x * y * z; i++) {
- image[i] = 255 - image[i];
+static void
+camorama_filter_color_class_init(CamoramaFilterColorClass* self_class) {
+ self_class->filter = camorama_filter_color_filter;
+ self_class->name = _("Color Correction");
+}
- }
+/* GType stuff for CamoramaFilterInvert */
+typedef struct _CamoramaFilter CamoramaFilterInvert;
+typedef struct _CamoramaFilterClass CamoramaFilterInvertClass;
+
+G_DEFINE_TYPE(CamoramaFilterInvert, camorama_filter_invert, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_invert_init(CamoramaFilterInvert* self) {}
+
+static void
+camorama_filter_invert_filter(CamoramaFilter* filter, guchar *image, int x, int y, int depth) {
+#warning "FIXME: add a checking cast here"
+ CamoramaFilterInvert* self = (CamoramaFilterInvert*)filter;
+ int i;
+ for (i = 0; i < x * y * depth; i++) {
+ image[i] = 255 - image[i];
+ }
}
-void threshold (unsigned char *image, int x, int y, int threshold_value)
-{
+static void
+camorama_filter_invert_class_init(CamoramaFilterClass* self_class) {
+ self_class->filter = camorama_filter_invert_filter;
+ self_class->name = _("Invert");
+}
+
+/* GType stuff for CamoramaFilterThreshold */
+typedef struct _CamoramaFilterThreshold {
+ CamoramaFilter base_instance;
+ gint threshold;
+} CamoramaFilterThreshold;
+typedef struct _CamoramaFilterClass CamoramaFilterThresholdClass;
+
+G_DEFINE_TYPE(CamoramaFilterThreshold, camorama_filter_threshold, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_threshold_init(CamoramaFilterThreshold* self) {
+ self->threshold = 127;
+}
+
+static void
+camorama_filter_threshold_filter(CamoramaFilter* filter, guchar *image, int x, int y, int depth) {
+#warning "FIXME: cast"
+ CamoramaFilterThreshold* self = (CamoramaFilterThreshold*)filter;
int i;
for (i = 0; i < x * y; i++) {
- if ((image[0] + image[1] + image[2]) > (threshold_value * 3)) {
+ if ((image[0] + image[1] + image[2]) > (self->threshold * 3)) {
image[0] = 255;
image[1] = 255;
image[2] = 255;
@@ -150,22 +228,40 @@ void threshold (unsigned char *image, int x, int y, int threshold_value)
}
}
-void
-threshold_channel (unsigned char *image, int x, int y, int threshold_value)
-{
+static void
+camorama_filter_threshold_class_init(CamoramaFilterThresholdClass* self_class) {
+ self_class->filter = camorama_filter_threshold_filter;
+ self_class->name = _("Threshold (Overall)");
+}
+
+/* GType stuff for CamoramaFilterThresholdChannel */
+typedef struct _CamoramaFilterThreshold CamoramaFilterThresholdChannel;
+typedef struct _CamoramaFilterClass CamoramaFilterThresholdChannelClass;
+
+G_DEFINE_TYPE(CamoramaFilterThresholdChannel, camorama_filter_threshold_channel, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_threshold_channel_init(CamoramaFilterThresholdChannel* self) {
+ self->threshold = 127;
+}
+
+static void
+camorama_filter_threshold_channel_filter(CamoramaFilter* filter, unsigned char *image, int x, int y, int depth) {
+#warning "FIXME: cast"
+ CamoramaFilterThresholdChannel* self = (CamoramaFilterThresholdChannel*)filter;
int i;
for (i = 0; i < x * y; i++) {
- if (image[0] > threshold_value) {
+ if (image[0] > self->threshold) {
image[0] = 255;
} else {
image[0] = 0;
}
- if (image[1] > threshold_value) {
+ if (image[1] > self->threshold) {
image[1] = 255;
} else {
image[1] = 0;
}
- if (image[2] > threshold_value) {
+ if (image[2] > self->threshold) {
image[2] = 255;
} else {
image[2] = 0;
@@ -174,98 +270,104 @@ threshold_channel (unsigned char *image, int x, int y, int threshold_value)
}
}
-void mirror (unsigned char *image, int x, int y, int z)
-{
- int i, j, k;
- unsigned char *image2;
-
- image2 = (char *) malloc (sizeof (unsigned char) * x * y * z);
- memcpy (image2, image, x * y * z);
-
- for (i = 0; i < y; i++) {
- for (j = 0; j < x; j++) {
- for (k = 0; k < z; k++) {
- /*ow, my brain! */
- image[(i * x * z) + (j * z) + k] =
- image2[(i * x * z) - (j * z) + k];
- }
+static void
+camorama_filter_threshold_channel_class_init(CamoramaFilterThresholdChannelClass* self_class) {
+ self_class->filter = camorama_filter_threshold_channel_filter;
+ self_class->name = _("Threshold (Per Channel)");
+}
- }
+/* GType stuff for CamoramaFilterWacky */
+typedef struct _CamoramaFilter CamoramaFilterWacky;
+typedef struct _CamoramaFilterClass CamoramaFilterWackyClass;
- }
+G_DEFINE_TYPE(CamoramaFilterWacky, camorama_filter_wacky, CAMORAMA_TYPE_FILTER);
- free (image2);
+static void
+camorama_filter_wacky_init(CamoramaFilterWacky* self) {}
-}
-
-void wacky (unsigned char *image, int z, int x, int y)
-{
+static void
+camorama_filter_wacky_filter(CamoramaFilter* filter, unsigned char *image, int x, int y, int depth) {
int i;
int neighbours;
int total;
unsigned char *image2, *image3;
- image2 = (unsigned char *) malloc (sizeof (unsigned char) * x * y * z);
- memcpy (image2, image, x * y * z);
+ image2 = (unsigned char *) malloc (sizeof (unsigned char) * x * y * depth);
+ memcpy (image2, image, x * y * depth);
image3 = image2;
for (i = 0; i < x * y; i++) {
total = 0;
neighbours = 0;
- if (i < x * z) {
+ if (i < x * depth) {
/*we are in the top row */
} else {
- image2 -= (x + 1) * z;
+ image2 -= (x + 1) * depth;
total = total + ((1 / 6) * image2[0]);
- image2 += z;
+ image2 += depth;
total = total + ((4 / 6) * image2[0]);
- image2 += z;
+ image2 += depth;
total = total + ((1 / 6) * image2[0]);
- neighbours = neighbours + z;
- image2 += (x - 1) * z;
+ neighbours = neighbours + depth;
+ image2 += (x - 1) * depth;
}
- if (i > x * (y - 1) * z) {
+ if (i > x * (y - 1) * depth) {
/*we are in the bottom row */
} else {
- image2 += (x + 1) * z;
+ image2 += (x + 1) * depth;
total = total + ((1 / 6) * image2[0]);
- image2 -= z;
+ image2 -= depth;
total = total + ((4 / 6) * image2[0]);
- image2 -= z;
+ image2 -= depth;
total = total + ((1 / 6) * image2[0]);
- image2 -= (x - 1) * z;
- neighbours = neighbours + z;
+ image2 -= (x - 1) * depth;
+ neighbours = neighbours + depth;
}
- image2 += z;
+ image2 += depth;
total = total + ((4 / 6) * image2[0]);
- image2 -= z;
+ image2 -= depth;
neighbours++;
- image2 -= z;
+ image2 -= depth;
total = total + ((4 / 6) * image2[0]);
- image2 += z;
+ image2 += depth;
neighbours++;
image[0] = image[0] * (-20 / 6);
image[0] = image[0] + total;
image[1] = image[0];
image[2] = image[0];
- image += z;
+ image += depth;
}
free (image2);
}
-void smooth (unsigned char *image, int z, int x, int y)
-{
+static void
+camorama_filter_wacky_class_init(CamoramaFilterWackyClass* self_class) {
+ self_class->filter = camorama_filter_wacky_filter;
+ self_class->name = _("Wacky");
+}
+
+/* GType stuff for CamoramaFilterSmotth */
+typedef struct _CamoramaFilter CamoramaFilterSmooth;
+typedef struct _CamoramaFilterClass CamoramaFilterSmoothClass;
+
+G_DEFINE_TYPE(CamoramaFilterSmooth, camorama_filter_smooth, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_smooth_init(CamoramaFilterSmooth* self) {}
+
+static void
+camorama_filter_smooth_filter(CamoramaFilter* filter, guchar *image, int x, int y, int depth) {
int i;
int neighbours;
int total0, total1, total2;
unsigned char *image2, *image3;
int tr = 0, br = 0;
- image2 = (unsigned char *) malloc (sizeof (unsigned char) * x * y * z);
- memcpy (image2, image, x * y * z);
+ image2 = (unsigned char *) malloc (sizeof (unsigned char) * x * y * depth);
+ memcpy (image2, image, x * y * depth);
image3 = image2;
for (i = 0; i < x * y; i++) {
@@ -278,7 +380,7 @@ void smooth (unsigned char *image, int z, int x, int y)
/*we are in the top row */
tr++;
} else {
- image2 -= (x + 1) * z;
+ image2 -= (x + 1) * depth;
total0 = total0 + image2[0];
total1 = total1 + image2[1];
total2 = total2 + image2[2];
@@ -290,17 +392,17 @@ void smooth (unsigned char *image, int z, int x, int y)
total0 = total0 + image2[6];
total1 = total1 + image2[7];
total2 = total2 + image2[8];
- neighbours = neighbours + z;
+ neighbours = neighbours + depth;
if (tr > 1) {
tr = 0;
}
- image2 += (x + 1) * z;
+ image2 += (x + 1) * depth;
}
if (i > x * (y - 1)) {
br++;
/*we are in the bottom row */
} else {
- image2 += (x - 1) * z;
+ image2 += (x - 1) * depth;
total0 = total0 + image2[0];
total1 = total1 + image2[1];
total2 = total2 + image2[2];
@@ -313,9 +415,9 @@ void smooth (unsigned char *image, int z, int x, int y)
total1 = total1 + image2[7];
total2 = total2 + image2[8];
- image2 -= (x - 1) * z;
+ image2 -= (x - 1) * depth;
- neighbours = neighbours + z;
+ neighbours = neighbours + depth;
}
image2 += 3;
@@ -340,94 +442,25 @@ void smooth (unsigned char *image, int z, int x, int y)
image2 += 3;
}
free (image3);
-
}
-void laplace (unsigned char *image, int z, int x, int y)
-{
- int i;
- int neighbours;
- int total0, total1, total2;
- unsigned char *image2, *image3;
-
- image2 = (unsigned char *) malloc (sizeof (unsigned char) * x * y * z);
- memcpy (image2, image, x * y * z);
- image3 = image2;
-
- for (i = 1; i < x * (y - 1); i++) {
- total0 = 0;
- total1 = 0;
- total2 = 0;
- neighbours = 0;
-
- image2 -= (x + 1) * 3;
- total0 = total0 + image2[0];
- total1 = total1 + image2[1];
- total2 = total2 + image2[2];
-
- total0 = total0 + image2[3];
- total1 = total1 + image2[4];
- total2 = total2 + image2[5];
-
- total0 = total0 + image2[6];
- total1 = total1 + image2[7];
- total2 = total2 + image2[8];
-
- image2 += (x + 1) * 3;
-
- image2 += (x - 1) * 3;
- total0 = total0 + image2[0];
- total1 = total1 + image2[1];
- total2 = total2 + image2[2];
-
- total0 = total0 + image2[3];
- total1 = total1 + image2[4];
- total2 = total2 + image2[5];
-
- total0 = total0 + image2[6];
- total1 = total1 + image2[7];
- total2 = total2 + image2[8];
-
- image2 -= (x - 1) * 3;
-
- image2 += 3;
- total0 = total0 + image2[0];
- total1 = total1 + image2[1];
- total2 = total2 + image2[2];
- image2 -= 3;
-
- image2 -= 3;
- total0 = total0 + image2[0];
- total1 = total1 + image2[1];
- total2 = total2 + image2[2];
- image2 += 3;
-
- if (image[0] * 8 < total0) {
- image[0] = 0;
- } else {
- image[0] = (image[0] * 8) - total0;
- }
- if (image[1] * 8 < total1) {
- image[1] = 0;
- } else {
- image[1] = (image[1] * 8) - total1;
- }
- if (image[2] * 8 < total2) {
- image[2] = 0;
- } else {
- image[2] = (image[2] * 8) - total2;
- }
+static void
+camorama_filter_smooth_class_init(CamoramaFilterSmoothClass* self_class) {
+ self_class->filter = camorama_filter_smooth_filter;
+ self_class->name = _("Smooth");
+}
- image += 3;
- image2 += 3;
- }
+/* GType for CamoramaFilterMono */
+typedef struct _CamoramaFilter CamoramaFilterMono;
+typedef struct _CamoramaFilterClass CamoramaFilterMonoClass;
- free (image3);
+G_DEFINE_TYPE(CamoramaFilterMono, camorama_filter_mono, CAMORAMA_TYPE_FILTER);
-}
+static void
+camorama_filter_mono_init(CamoramaFilterMono* self) {}
-void bw (unsigned char *image, int x, int y)
-{
+static void
+camorama_filter_mono_filter(CamoramaFilter* filter, unsigned char *image, int x, int y, int depth) {
int i;
int total, avg;
@@ -441,8 +474,24 @@ void bw (unsigned char *image, int x, int y)
image += 3;
}
}
-void bw2 (unsigned char *image, int x, int y)
-{
+
+static void
+camorama_filter_mono_class_init(CamoramaFilterMonoClass* self_class) {
+ self_class->filter = camorama_filter_mono_filter;
+ self_class->name = _("Monochrome");
+}
+
+/* GType for CamoramaFilterMonoWeight */
+typedef struct _CamoramaFilter CamoramaFilterMonoWeight;
+typedef struct _CamoramaFilterClass CamoramaFilterMonoWeightClass;
+
+G_DEFINE_TYPE(CamoramaFilterMonoWeight, camorama_filter_mono_weight, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_mono_weight_init(CamoramaFilterMonoWeight* self) {}
+
+static void
+camorama_filter_mono_weight_filter(CamoramaFilter* filter, unsigned char *image, int x, int y, int depth) {
int i;
int avg;
for (i = 0; i < x * y; i++) {
@@ -456,15 +505,30 @@ void bw2 (unsigned char *image, int x, int y)
}
}
+static void
+camorama_filter_mono_weight_class_init(CamoramaFilterMonoWeightClass* self_class) {
+ self_class->filter = camorama_filter_mono_weight_filter;
+ self_class->name = _("Monochrome (Weight)");
+}
+
+/* GType stuff for CamoramaFilterSobel */
+typedef struct _CamoramaFilter CamoramaFilterSobel;
+typedef struct _CamoramaFilterClass CamoramaFilterSobelClass;
+
+G_DEFINE_TYPE(CamoramaFilterSobel, camorama_filter_sobel, CAMORAMA_TYPE_FILTER);
+
+static void
+camorama_filter_sobel_init(CamoramaFilterSobel* self) {}
+
/* fix this at some point, very slow */
-void sobel (unsigned char *image, int x, int y)
-{
+static void
+camorama_filter_sobel_filter(CamoramaFilter* filter, unsigned char *image, int x, int y, int depth) {
int i, j, grad[3];
int deltaX[3], deltaY[3];
int width = x * 3;
- unsigned char *image2;
+ guchar *image2;
- image2 = (char *) malloc (sizeof (unsigned char) * (x * y * 3));
+ image2 = (guchar *) malloc (sizeof (guchar) * (x * y * 3));
for (i = width; i < (y - 1) * width; i++) {
for (j = 0; j <= 2; j++) {
@@ -491,3 +555,26 @@ void sobel (unsigned char *image, int x, int y)
memcpy (image, image2, (x * y * 3));
free (image2);
}
+
+static void
+camorama_filter_sobel_class_init(CamoramaFilterSobelClass* self_class) {
+ self_class->filter = camorama_filter_sobel_filter;
+ self_class->name = _("Sobel");
+}
+
+/* general filter initialization */
+void
+camorama_filters_init(void) {
+ camorama_filter_color_get_type();
+ camorama_filter_invert_get_type();
+ camorama_filter_threshold_get_type();
+ camorama_filter_threshold_channel_get_type();
+ camorama_filter_mirror_get_type();
+ camorama_filter_wacky_get_type();
+ camorama_filter_smooth_get_type();
+ camorama_filter_laplace_get_type();
+ camorama_filter_mono_get_type();
+ camorama_filter_mono_weight_get_type();
+ camorama_filter_sobel_get_type();
+}
+
diff --git a/src/filter.h b/src/filter.h
index 0735d67..edb4990 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -1,13 +1,78 @@
-void yuv420p_to_rgb(unsigned char *image, unsigned char *temp, int x, int y, int z);
-void fix_colour(char *image, int x, int y);
-void negative(unsigned char *image, int x, int y, int z);
-void threshold(unsigned char *image, int x, int y, int threshold_value);
-void threshold_channel(unsigned char *image, int x, int y, int threshold_value);
-void mirror(unsigned char *image, int x, int y, int z);
-void wacky(unsigned char *image, int z, int x, int y);
-void smooth(unsigned char *image, int z, int x, int y);
-
-void bw(unsigned char *image, int x, int y);
-void bw2(unsigned char *image, int x, int y);
-void laplace(unsigned char *image, int z, int x, int y);
-void sobel(unsigned char *image, int x, int y);
+/* this file is part of camorama, a gnome webcam viewer
+ *
+ * AUTHORS
+ * Greg Jones <greg@fixedgear.org>
+ * Bastien Nocera <hadess@hadess.net>
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2003 Greg Jones
+ * Copyright (C) 2003 Bastien Nocera
+ * Copyright (C) 2005,2006 Sven Herzberg
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef CAMORAMA_FILTER_H
+#define CAMORAMA_FILTER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _CamoramaFilter CamoramaFilter;
+typedef struct _CamoramaFilterClass CamoramaFilterClass;
+
+#define CAMORAMA_TYPE_FILTER (camorama_filter_get_type())
+#define CAMORAMA_FILTER(i) (G_TYPE_CHECK_INSTANCE_CAST((i), CAMORAMA_TYPE_FILTER, CamoramaFilter))
+#define CAMORAMA_FILTER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), CAMORAMA_TYPE_FILTER, CamoramaFilterClass))
+#define CAMORAMA_IS_FILTER(i) (G_TYPE_CHECK_INSTANCE_TYPE((i), CAMORAMA_TYPE_FILTER))
+#define CAMORAMA_IS_FILTER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE((c), CAMORAMA_TYPE_FILTER))
+#define CAMORAMA_FILTER_GET_CLASS(i) (G_TYPE_INSTANCE_GET_CLASS((i), CAMORAMA_TYPE_FILTER, CamoramaFilterClass))
+
+GType camorama_filter_get_type (void);
+GType camorama_filter_mirror_get_type (void);
+GType camorama_filter_laplace_get_type(void);
+
+void camorama_filters_init (void);
+gchar const* camorama_filter_get_name(CamoramaFilter* self);
+void camorama_filter_apply (CamoramaFilter* self,
+ guchar* image,
+ gint width,
+ gint height,
+ gint depth);
+
+struct _CamoramaFilter {
+ GObject base_instance;
+};
+
+struct _CamoramaFilterClass {
+ GObjectClass base_class;
+
+ gchar const* name;
+
+ void (*filter) (CamoramaFilter* self,
+ guchar * image,
+ gint width,
+ gint height,
+ gint depth);
+};
+
+void yuv420p_to_rgb (guchar *image, guchar *temp, gint x, gint y, gint z);
+
+G_END_DECLS
+
+#endif /* !CAMORAMA_FILTER_H */
+
diff --git a/src/filters.h b/src/filters.h
new file mode 100644
index 0000000..0b40842
--- /dev/null
+++ b/src/filters.h
@@ -0,0 +1,4 @@
+#ifndef FILTERS_H
+#define FILTERS_H
+
+#endif
diff --git a/src/glib-helpers.h b/src/glib-helpers.h
new file mode 100644
index 0000000..02531e0
--- /dev/null
+++ b/src/glib-helpers.h
@@ -0,0 +1,37 @@
+/* this file is part of criawips, a gnome presentation application
+ *
+ * AUTHORS
+ * Sven Herzberg <herzi@gnome-de.org>
+ *
+ * Copyright (C) 2005 Sven Herzberg
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef GLIB_HELPERS_H
+#define GLIB_HELPERS_H
+
+#include <glib/gmacros.h>
+
+G_BEGIN_DECLS
+
+#define G_FUNC(func) ((GFunc)(func))
+#define G_SOURCE_FUNC(func) ((GSourceFunc)(func))
+
+G_END_DECLS
+
+#endif /* GLIB_HELPERS_H */
+
diff --git a/src/interface.h b/src/interface.h
index 10b37b9..bd1dbfe 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -1,4 +1,5 @@
#define PATH "/apps/camorama/preferences"
+#define KEY_DEVICE PATH "/device"
#define KEY1 "/apps/camorama/preferences/save_dir"
#define KEY2 "/apps/camorama/preferences/save_file"
#define KEY3 "/apps/camorama/preferences/file_type"
@@ -21,5 +22,4 @@
#define KEY20 "/apps/camorama/preferences/auto_capture"
#define KEY21 "/apps/camorama/preferences/auto_capture_interval"
#define KEY22 "/apps/camorama/preferences/show_adjustments"
-
-
+#define KEY23 "/apps/camorama/preferences/show_effects"
diff --git a/src/main.c b/src/main.c
index d03d939..a4618c8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -10,12 +10,7 @@
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h>
#include <locale.h>
-GtkWidget *main_window, *prefswindow;
-state func_state;
-int frames, frames2, seconds;
-GtkWidget *dentry, *entry2, *string_entry, *format_selection;
-GtkWidget *host_entry, *directory_entry, *filename_entry, *login_entry,
- *pw_entry;
+#include "camorama-stock-items.h"
static gboolean ver = FALSE, max = FALSE, min = FALSE, half =
FALSE, use_read = FALSE;
@@ -40,363 +35,8 @@ static gboolean ver = FALSE, max = FALSE, min = FALSE, half =
return true;
}*/
-static gint
-tray_clicked_callback (GtkWidget * widget, GdkEventButton * event, cam * cam)
-{
- GdkEventButton *event_button = NULL;
-
- if (event->type == GDK_BUTTON_PRESS) {
-
- event_button = (GdkEventButton *) event;
-
- //change to switch
- if (event_button->button == 1) {
- if (GTK_WIDGET_VISIBLE
- (glade_xml_get_widget (cam->xml, "window2"))) {
- cam->hidden = TRUE;
- gtk_idle_remove(cam->idle_id);
- gtk_widget_hide (glade_xml_get_widget (cam->xml, "window2"));
-
- } else {
- cam->idle_id = gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
- gtk_widget_show (glade_xml_get_widget (cam->xml, "window2"));
- cam->hidden = FALSE;
-
- }
- return TRUE;
- } else if (event_button->button == 3) {
-
- //gw = MyApp->GetMainWindow ();
-
- //gnomemeeting_component_view (NULL, (gpointer) gw->ldap_window);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void load_interface (cam * cam)
-{
- gchar *title;
- GdkPixbuf *logo = NULL, *scaled = NULL;
- GtkWidget *eventbox = NULL, *image = NULL;
- gint width, height;
-
- (GtkTooltips *)cam->tooltips = gtk_tooltips_new ();
- logo = (GdkPixbuf *) create_pixbuf (DATADIR "/pixmaps/camorama.png");
- if (logo == NULL) {
- printf ("\n\nLOGO NO GO\n\n");
- }
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
- scaled =
- gdk_pixbuf_scale_simple (logo, width, height, GDK_INTERP_BILINEAR);
-
- image = gtk_image_new_from_pixbuf (scaled);
-
- //image = gtk_image_new_from_stock (GNOME_STOCK_TRASH, GTK_ICON_SIZE_MENU);
-
- if (cam->show_adjustments == FALSE) {
- gtk_widget_hide (glade_xml_get_widget (cam->xml, "table6"));
- gtk_widget_hide (glade_xml_get_widget (cam->xml, "vbox37"));
- gtk_window_resize (GTK_WINDOW
- (glade_xml_get_widget
- (cam->xml, "window2")), 320, 240);
-
- }
-
- eventbox = gtk_event_box_new ();
-
- gtk_widget_show (image);
-
- gtk_widget_show (eventbox);
-
- cam->tray_icon = egg_tray_icon_new ("Our cool tray icon");
- update_tooltip (cam);
- /* add the status to the plug */
- g_object_set_data (G_OBJECT (cam->tray_icon), "image", image);
- g_object_set_data (G_OBJECT (cam->tray_icon), "available",
- GINT_TO_POINTER (1));
- g_object_set_data (G_OBJECT (cam->tray_icon), "embedded",
- GINT_TO_POINTER (0));
- gtk_container_add (GTK_CONTAINER (eventbox), image);
- gtk_container_add ((GtkContainer *)cam->tray_icon, eventbox);
-
- g_signal_connect (G_OBJECT (eventbox), "button_press_event",
- G_CALLBACK (tray_clicked_callback), cam);
-
- //button = gtk_button_new_with_label ("This is a cool\ntray icon");
- /*g_signal_connect (button, "clicked",
- * G_CALLBACK (capture_func), cam);
- * gtk_container_add (GTK_CONTAINER (cam->tray_icon), button); */
- gtk_widget_show_all (GTK_WIDGET (cam->tray_icon));
-
- /* connect the signals in the interface
- * glade_xml_signal_autoconnect(xml);
- * this won't work, can't pass data to callbacks. have to do it individually :(*/
-
- title = g_strdup_printf ("Camorama - %s - %dx%d", cam->vid_cap.name,
- cam->x, cam->y);
- gtk_window_set_title (GTK_WINDOW
- (glade_xml_get_widget (cam->xml, "window2")),
- title);
- g_free (title);
-
- gtk_window_set_icon (GTK_WINDOW
- (glade_xml_get_widget (cam->xml, "window2")), logo);
- gtk_window_set_icon (GTK_WINDOW
- (glade_xml_get_widget (cam->xml, "prefswindow")),
- logo);
-
- glade_xml_signal_connect_data (cam->xml, "on_show_effects_activate",
- G_CALLBACK (on_show_effects_activate),
- cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "togglebutton1"),
- cam->show_adjustments);
- glade_xml_signal_connect_data (cam->xml,
- "on_show_adjustments1_activate",
- G_CALLBACK
- (on_show_adjustments1_activate), cam);
-
- glade_xml_signal_connect_data (cam->xml, "on_large1_activate",
- G_CALLBACK (on_change_size_activate), cam);
- glade_xml_signal_connect_data (cam->xml, "on_medium1_activate",
- G_CALLBACK (on_change_size_activate), cam);
- glade_xml_signal_connect_data (cam->xml, "on_small1_activate",
- G_CALLBACK (on_change_size_activate), cam);
-
- //glade_xml_signal_connect_data(cam->xml, "capture_func", G_CALLBACK(on_change_size_activate), cam);
- glade_xml_signal_connect_data (cam->xml, "capture_func",
- G_CALLBACK (capture_func), cam);
- glade_xml_signal_connect_data (cam->xml, "gtk_main_quit",
- G_CALLBACK (delete_event), NULL);
-
- /* sliders */
- glade_xml_signal_connect_data (cam->xml,
- "on_scale1_drag_data_received",
- G_CALLBACK
- (on_scale1_drag_data_received), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider1"), 128);
- glade_xml_signal_connect_data (cam->xml, "contrast_change",
- G_CALLBACK (contrast_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider2"),
- (int) (cam->contrast / 256));
- glade_xml_signal_connect_data (cam->xml, "brightness_change",
- G_CALLBACK (brightness_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider3"),
- (int) (cam->brightness / 256));
- glade_xml_signal_connect_data (cam->xml, "colour_change",
- G_CALLBACK (colour_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider4"),
- (int) (cam->colour / 256));
- glade_xml_signal_connect_data (cam->xml, "hue_change",
- G_CALLBACK (hue_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider5"),
- (int) (cam->hue / 256));
- glade_xml_signal_connect_data (cam->xml, "wb_change",
- G_CALLBACK (wb_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider6"),
- (int) (cam->wb / 256));
-
- /* buttons */
- glade_xml_signal_connect_data (cam->xml, "fix_colour_func",
- G_CALLBACK (fix_colour_func),
- (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "threshold_func1",
- G_CALLBACK (threshold_func1),
- (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "threshold_ch_func",
- G_CALLBACK (threshold_ch_func),
- (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "edge_func1",
- G_CALLBACK (edge_func1), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "sobel_func",
- G_CALLBACK (sobel_func), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "edge_func3",
- G_CALLBACK (edge_func3), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "negative_func",
- G_CALLBACK (negative_func),
- (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "mirror_func",
- G_CALLBACK (mirror_func), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "colour_func",
- G_CALLBACK (colour_func), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "smooth_func",
- G_CALLBACK (smooth_func), (gpointer) NULL);
- glade_xml_signal_connect_data (cam->xml, "edge_func1",
- G_CALLBACK (edge_func1), (gpointer) NULL);
-
- glade_xml_signal_connect_data (cam->xml,
- "on_drawingarea1_expose_event",
- G_CALLBACK
- (on_drawingarea1_expose_event),
- (gpointer) cam);
- glade_xml_signal_connect_data (cam->xml, "on_status_show",
- G_CALLBACK (on_status_show),
- (gpointer) cam);
- glade_xml_signal_connect_data (cam->xml, "on_quit1_activate",
- G_CALLBACK (on_quit1_activate),
- (gpointer) cam);
- glade_xml_signal_connect_data (cam->xml, "on_preferences1_activate",
- G_CALLBACK (on_preferences1_activate),
- (gpointer) cam);
- glade_xml_signal_connect_data (cam->xml, "on_about1_activate",
- G_CALLBACK (on_about1_activate),
- (gpointer) cam);
-
- /* prefs */
- glade_xml_signal_connect_data (cam->xml, "prefs_func",
- G_CALLBACK (prefs_func), cam);
-
- /* general */
- glade_xml_signal_connect_data (cam->xml, "cap_func",
- G_CALLBACK (cap_func), cam);
-
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "captured_cb"),
- cam->cap);
-
- glade_xml_signal_connect_data (cam->xml, "rcap_func",
- G_CALLBACK (rcap_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "rcapture"),
- cam->rcap);
-
- glade_xml_signal_connect_data (cam->xml, "acap_func",
- G_CALLBACK (acap_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "acapture"),
- cam->acap);
-
- glade_xml_signal_connect_data (cam->xml, "interval_change",
- G_CALLBACK (interval_change), cam);
-
- gtk_spin_button_set_value ((GtkSpinButton *)
- glade_xml_get_widget (cam->xml,
- "interval_entry"),
- (cam->timeout_interval / 60000));
-
- /* local */
- dentry = glade_xml_get_widget (cam->xml, "dentry");
- entry2 = glade_xml_get_widget (cam->xml, "entry2");
- gtk_entry_set_text (GTK_ENTRY
- (gnome_file_entry_gtk_entry
- (GNOME_FILE_ENTRY (dentry))), cam->pixdir);
-
- gtk_entry_set_text (GTK_ENTRY (entry2), cam->capturefile);
-
- glade_xml_signal_connect_data (cam->xml, "append_func",
- G_CALLBACK (append_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "appendbutton"),
- cam->timefn);
-
- glade_xml_signal_connect_data (cam->xml, "jpg_func",
- G_CALLBACK (jpg_func), cam);
- if (cam->savetype == JPEG) {
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "jpgb"), TRUE);
- }
- glade_xml_signal_connect_data (cam->xml, "png_func",
- G_CALLBACK (png_func), cam);
- if (cam->savetype == PNG) {
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "pngb"), TRUE);
- }
-
- glade_xml_signal_connect_data (cam->xml, "ts_func",
- G_CALLBACK (ts_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "tsbutton"),
- cam->timestamp);
-
- /* remote */
- login_entry = glade_xml_get_widget (cam->xml, "login_entry");
- host_entry = glade_xml_get_widget (cam->xml, "host_entry");
- pw_entry = glade_xml_get_widget (cam->xml, "pw_entry");
- directory_entry = glade_xml_get_widget (cam->xml, "directory_entry");
- filename_entry = glade_xml_get_widget (cam->xml, "filename_entry");
- gtk_entry_set_text (GTK_ENTRY (host_entry), cam->rhost);
- gtk_entry_set_text (GTK_ENTRY (login_entry), cam->rlogin);
- gtk_entry_set_text (GTK_ENTRY (pw_entry), cam->rpw);
- gtk_entry_set_text (GTK_ENTRY (directory_entry), cam->rpixdir);
- gtk_entry_set_text (GTK_ENTRY (filename_entry), cam->rcapturefile);
-
- glade_xml_signal_connect_data (cam->xml, "rappend_func",
- G_CALLBACK (rappend_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "timecb"),
- cam->rtimefn);
-
- glade_xml_signal_connect_data (cam->xml, "rjpg_func",
- G_CALLBACK (rjpg_func), cam);
- if (cam->rsavetype == JPEG) {
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "fjpgb"), TRUE);
- }
- glade_xml_signal_connect_data (cam->xml, "rpng_func",
- G_CALLBACK (rpng_func), cam);
- if (cam->rsavetype == PNG) {
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "fpngb"), TRUE);
- }
-
- glade_xml_signal_connect_data (cam->xml, "rts_func",
- G_CALLBACK (rts_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml,
- "tsbutton2"),
- cam->rtimestamp);
-
- /* timestamp */
- glade_xml_signal_connect_data (cam->xml, "customstring_func",
- G_CALLBACK (customstring_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml, "cscb"),
- cam->usestring);
-
- string_entry = glade_xml_get_widget (cam->xml, "string_entry");
- gtk_entry_set_text (GTK_ENTRY (string_entry), cam->ts_string);
-
- glade_xml_signal_connect_data (cam->xml, "drawdate_func",
- G_CALLBACK (drawdate_func), cam);
- gtk_toggle_button_set_active ((GtkToggleButton *)
- glade_xml_get_widget (cam->xml, "tscb"),
- cam->usedate);
-
- cam->status = glade_xml_get_widget (cam->xml, "status");
- set_sensitive (cam);
- gtk_widget_set_sensitive (glade_xml_get_widget
- (cam->xml, "string_entry"), cam->usestring);
-
- gtk_widget_set_size_request (glade_xml_get_widget (cam->xml, "da"),
- cam->x, cam->y);
-
- prefswindow = glade_xml_get_widget (cam->xml, "prefswindow");
-}
-
-int main (int argc, char *argv[])
-{
+int
+main(int argc, char *argv[]) {
cam cam_object, *cam;
Display *display;
Screen *screen_num;
@@ -414,7 +54,7 @@ int main (int argc, char *argv[])
{"device", 'd', POPT_ARG_STRING, &poopoo, 0,
N_("v4l device to use"), NULL},
{"debug", 'D', POPT_ARG_NONE, &buggery, 0,
- N_("enable debuging code"), NULL},
+ N_("enable debugging code"), NULL},
{"width", 'x', POPT_ARG_INT, &x, 0, N_("capture width"),
NULL},
{"height", 'y', POPT_ARG_INT, &y, 0, N_("capture height"),
@@ -445,18 +85,17 @@ int main (int argc, char *argv[])
setlocale (LC_ALL, "");
/* gnome_program_init - initialize everything (gconf, threads, etc) */
- gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PARAM_APP_DATADIR, DATADIR,
+ gnome_program_init (PACKAGE_NAME, PACKAGE_VERSION, LIBGNOMEUI_MODULE, argc, argv,
+ GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
GNOME_PARAM_POPT_TABLE, popt_options,
GNOME_PARAM_HUMAN_READABLE_NAME, _("camorama"), NULL);
+ /* gtk is initialized now */
+ camorama_stock_init();
+ camorama_filters_init();
+
cam->debug = buggery;
- if (poopoo == NULL) {
- cam->video_dev = g_strdup ("/dev/video0");
- } else {
- cam->video_dev = g_strdup (poopoo);
- }
cam->x = x;
cam->y = y;
glade_gnome_init ();
@@ -495,6 +134,17 @@ int main (int argc, char *argv[])
(void *) gconf_notify_func_bool,
&cam->timestamp, NULL, NULL);
+ if (!poopoo) {
+ gchar const* gconf_device = gconf_client_get_string(cam->gc, KEY_DEVICE, NULL);
+ if(gconf_device) {
+ cam->video_dev = g_strdup(gconf_device);
+ } else {
+ cam->video_dev = g_strdup ("/dev/video0");
+ }
+ } else {
+ cam->video_dev = g_strdup (poopoo);
+ }
+
cam->pixdir = g_strdup (gconf_client_get_string (cam->gc, KEY1, NULL));
cam->capturefile =
g_strdup (gconf_client_get_string (cam->gc, KEY2, NULL));
@@ -521,6 +171,8 @@ int main (int argc, char *argv[])
cam->acap = gconf_client_get_bool (cam->gc, KEY20, NULL);
cam->timeout_interval = gconf_client_get_int (cam->gc, KEY21, NULL);
cam->show_adjustments = gconf_client_get_bool (cam->gc, KEY22, NULL);
+ cam->show_effects = gconf_client_get_bool (cam->gc, KEY23, NULL);
+
/* get desktop depth */
display = (Display *) gdk_x11_get_default_xdisplay ();
@@ -528,17 +180,6 @@ int main (int argc, char *argv[])
gdk_pixbuf_xlib_init (display, 0);
cam->desk_depth = xlib_rgb_get_depth ();
- func_state.wacky = 0;
- func_state.threshold = 0;
- func_state.laplace = 0;
- func_state.negative = 0;
- func_state.colour = 0;
- func_state.mirror = 0;
- func_state.smooth = 0;
- func_state.fc = 1;
-
- cam->dither = 128;
-
cam->dev = open (cam->video_dev, O_RDWR);
camera_cap (cam);
@@ -557,7 +198,7 @@ int main (int argc, char *argv[])
/* get picture attributes */
get_pic_info (cam);
-
+// set_pic_info(cam);
/* set_pic_info(cam); */
cam->contrast = cam->vid_pic.contrast;
cam->brightness = cam->vid_pic.brightness;
@@ -616,8 +257,6 @@ int main (int argc, char *argv[])
cam->idle_id = gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
gtk_timeout_add (2000, (GSourceFunc) fps, cam->status);
- gdk_threads_enter ();
gtk_main ();
- gdk_threads_leave ();
return 0;
}
diff --git a/src/v4l.c b/src/v4l.c
index f337e02..7732346 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -151,23 +151,29 @@ void camera_cap(cam * cam)
printf("min height = %d\n", cam->vid_cap.minheight);
}
}
-void set_pic_info(cam * cam)
-{
- char *msg;
- if(ioctl(cam->dev, VIDIOCSPICT, &cam->vid_pic) == -1) {
- if(cam->debug == TRUE) {
- fprintf(stderr, "VIDIOCSPICT -- could not set picture info, exiting....\n");
- }
- msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
- error_dialog(msg);
- g_free(msg);
- exit(0);
- }
+void
+set_pic_info(cam* cam) {
+ char *msg;
+ if(cam->debug) {
+ g_message("SET PIC");
+ }
+ //cam->vid_pic.palette = VIDEO_PALETTE_RGB24;
+ //cam->vid_pic.depth = 24;
+ //cam->vid_pic.palette = VIDEO_PALETTE_YUV420P;
+ if(ioctl(cam->dev, VIDIOCSPICT, &cam->vid_pic) == -1) {
+ if(cam->debug) {
+ g_message("VIDIOCSPICT -- could not set picture info, exiting....");
+ }
+ msg = g_strdup_printf(_("Could not connect to video device (%s).\nPlease check connection."), cam->video_dev);
+ error_dialog(msg);
+ g_free(msg);
+ exit(0);
+ }
}
-void get_pic_info(cam * cam)
-{
+void get_pic_info(cam * cam){
+//set_pic_info(cam);
char *msg;
if(ioctl(cam->dev, VIDIOCGPICT, &cam->vid_pic) == -1) {
diff --git a/src/v4l.h b/src/v4l.h
index 5b8ff10..5cd9f13 100644
--- a/src/v4l.h
+++ b/src/v4l.h
@@ -1,3 +1,6 @@
+#ifndef CAMORAMA_V4L_H
+#define CAMORAMA_V4L_H
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -15,7 +18,8 @@
#include <png.h>
#include <glade/glade.h>
#include <gconf/gconf-client.h>
-#include "eggtrayicon.h"
+
+#include "camorama-filter-chain.h"
#define PICMAX 0
#define PICMIN 1
@@ -31,7 +35,6 @@ typedef struct camera {
int depth;
int desk_depth;
int size;
- int dither;
int contrast, brightness, colour, hue, wb;
int frame_number;
struct video_capability vid_cap;
@@ -49,18 +52,20 @@ typedef struct camera {
gchar *ts_string;
gchar *date_format;
gboolean debug, read, hidden;
- gboolean cap, rcap, acap, show_adjustments;
+ gboolean cap, rcap, acap, show_adjustments, show_effects;
gboolean timestamp, rtimestamp, usedate, usestring;
gboolean rtimefn, timefn;
- GdkPixmap *pixmap;
- GdkWindow *window;
- GtkWidget *da, *tooltips, *tray_tooltip, *status;
- unsigned char *pic_buf, *tmp;
+ GdkPixmap *pixmap;
+ GdkWindow *window;
+ GtkWidget *da, *tray_tooltip, *status;
+ unsigned char *pic_buf, *tmp;
guint timeout_id, idle_id;
guint32 timeout_interval;
GConfClient *gc;
GladeXML *xml;
- EggTrayIcon *tray_icon;
+ GtkStatusIcon *tray_icon;
+
+ CamoramaFilterChain* filter_chain;
} cam;
void camera_cap (cam *);
@@ -69,3 +74,6 @@ void get_pic_info (cam *);
void set_pic_info (cam *);
void get_win_info (cam *);
void set_buffer (cam *);
+
+#endif /* !CAMORAMA_V4L_H */
+

Privacy Policy