aboutsummaryrefslogtreecommitdiff
path: root/0.8.0/src/gtkpaludis/vtemm
diff options
context:
space:
mode:
Diffstat (limited to '0.8.0/src/gtkpaludis/vtemm')
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/Makefile.am73
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/converts/Makefile.am6
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/converts/convert.m430
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/converts/convert_base.m469
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/defs/Makefile.am51
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/defs/enum.pl230
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/defs/generate_defs_vte.cc36
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/reaper.ccg65
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/reaper.hg50
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/terminal_widget.ccg159
-rw-r--r--0.8.0/src/gtkpaludis/vtemm/terminal_widget.hg181
11 files changed, 950 insertions, 0 deletions
diff --git a/0.8.0/src/gtkpaludis/vtemm/Makefile.am b/0.8.0/src/gtkpaludis/vtemm/Makefile.am
new file mode 100644
index 000000000..f51639808
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/Makefile.am
@@ -0,0 +1,73 @@
+EXTRA_DIST = \
+ terminal_widget.hg terminal_widget.ccg \
+ reaper.hg reaper.ccg
+
+AM_CXXFLAGS = -I$(top_srcdir) \
+ @PALUDIS_CXXFLAGS@ \
+ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@ \
+ @PALUDIS_CXXFLAGS_NO_WREDUNDANT_DECLS@ \
+ @PALUDIS_CXXFLAGS_NO_WSHADOW@
+
+DEFS = \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DGLIBMM_EXCEPTIONS_ENABLED=1
+
+vte_generated_sources = \
+ terminal_widget.cc terminal_widget.hh private/terminal_widget_p.hh \
+ reaper.cc reaper.hh private/reaper_p.hh
+
+SUBDIRS = defs converts .
+
+if ENABLE_GTK
+
+BUILT_SOURCES = terminal_widget.hh reaper.hh $(vte_generated_sources)
+
+# automake is rather weird on this one...
+automake-deps-hack.tmp :
+ $(MAKE) -C defs
+ touch $@
+
+terminal_widget.hh terminal_widget.cc : terminal_widget.hg terminal_widget.ccg automake-deps-hack.tmp
+ mkdir -p private
+ @GMMPROC@ --unwrapped -I converts --defs defs terminal_widget . .
+ sed -e 's@/\* vim: set @/* vim: set ro @' < ./terminal_widget.h > ./terminal_widget.hh
+ rm terminal_widget.h
+ mv ./terminal_widget.cc ./terminal_widget.cc.tmp
+ sed \
+ -e 's@#include <vtemm/terminal_widget.h>@#include "terminal_widget.hh"@' \
+ -e 's@#include <vtemm/private/terminal_widget_p.h>@#include "private/terminal_widget_p.hh"@' \
+ -e 's@/\* vim: set @/* vim: set ro @' \
+ < ./terminal_widget.cc.tmp > ./terminal_widget.cc
+ rm ./terminal_widget.cc.tmp
+ mv ./private/terminal_widget_p.h ./private/terminal_widget_p.hh
+
+reaper.hh reaper.cc : reaper.hg reaper.ccg automake-deps-hack.tmp
+ mkdir -p private
+ @GMMPROC@ --unwrapped -I converts --defs defs reaper . .
+ sed -e 's@/\* vim: set @/* vim: set ro @' < ./reaper.h > ./reaper.hh
+ rm reaper.h
+ mv ./reaper.cc ./reaper.cc.tmp
+ sed \
+ -e 's@#include <vtemm/reaper.h>@#include "reaper.hh"@' \
+ -e 's@#include <vtemm/private/reaper_p.h>@#include "private/reaper_p.hh"@' \
+ -e 's@/\* vim: set @/* vim: set ro @' \
+ < ./reaper.cc.tmp > ./reaper.cc
+ rm ./reaper.cc.tmp
+ mv ./private/reaper_p.h ./private/reaper_p.hh
+
+noinst_LIBRARIES = libvtemm.a
+
+nodist_libvtemm_a_SOURCES = \
+ $(vte_generated_sources)
+
+INCLUDES = $(GTKDEPS_CFLAGS)
+
+clean-local :
+ rm -fr private || true
+
+endif
+
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda $(vte_generated_sources) automake-deps-hack.tmp
+MAINTAINERCLEANFILES = Makefile.in
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/converts/Makefile.am b/0.8.0/src/gtkpaludis/vtemm/converts/Makefile.am
new file mode 100644
index 000000000..d9fa379ff
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/converts/Makefile.am
@@ -0,0 +1,6 @@
+noinst_DATA = convert.m4 convert_base.m4
+CLEANFILES = *~
+MAINTAINERCLEANFILES = Makefile.in
+EXTRA_DIST = $(noinst_DATA)
+
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/converts/convert.m4 b/0.8.0/src/gtkpaludis/vtemm/converts/convert.m4
new file mode 100644
index 000000000..319807ef4
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/converts/convert.m4
@@ -0,0 +1,30 @@
+dnl $Id: convert.m4,v 1.1.1.1 2003/01/21 13:41:24 murrayc Exp $
+
+# Other libraries, such as libgnomeuimm, can provide their own convert.m4 files,
+# Maybe choosing to include the same files as this one.
+
+include(convert_gtkmm.m4)
+
+_CONV_ENUM(Vte,TerminalEraseBinding)
+_CONV_ENUM(Vte,TerminalAntiAlias)
+
+_EQUAL(glong, long)
+_EQUAL(guint, unsigned)
+
+_CONVERSION(int&, int*, &($3))
+_CONVERSION(long&, glong*, &($3))
+_CONVERSION(return-char*, char*, ($3))
+
+# Gtk conversions
+_CONVERSION(const Gtk::MenuShell&, GtkMenuShell*, (const_cast<Gtk::MenuShell&>($3)).gobj())
+
+# Gdk conversions
+_CONVERSION(const Gdk::Color&, const GdkColor*, ($3).gobj())
+_CONVERSION(Gdk::Color&, GdkColor*, ($3).gobj())
+_CONVERSION(Gdk::Cursor&, GdkCursor*, ($3).gobj())
+
+# Pango conversions
+_CONVERSION(const Pango::FontDescription&, const PangoFontDescription*, ($3).gobj())
+_CONVERSION(const PangoFontDescription*, const Pango::FontDescription, Glib::wrap(const_cast<PangoFontDescription*>(($3)), true))
+
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/converts/convert_base.m4 b/0.8.0/src/gtkpaludis/vtemm/converts/convert_base.m4
new file mode 100644
index 000000000..feaf583ca
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/converts/convert_base.m4
@@ -0,0 +1,69 @@
+dnl $Id: convert_base.m4,v 1.1.1.1 2003/01/21 13:41:24 murrayc Exp $
+
+#
+# Define a hashing for names
+#
+define(`__HASH',`__`'m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ<>[]&*, ',`abcdefghijklmnopqrstuvwxyzVBNMRSC_')`'')
+define(`__EQUIV',`m4_ifdef(EV`'__HASH(`$1'),EV`'__HASH(`$1'),`$1')')
+
+define(`__HASH2',`dnl
+pushdef(`__E1',__EQUIV(`$1'))pushdef(`__E2',__EQUIV(`$2'))dnl
+m4_ifelse(__E1,__E2,`__EQ',__HASH(__E1)`'__HASH(__E2))`'dnl
+popdef(`__E1')popdef(`__E2')`'')
+
+define(`CF__EQ',`$3')
+
+#
+# _CONVERT(ctype, cpptype, name, wrap_line)
+# Print the conversion from ctype to cpptype
+define(`_CONVERT',`dnl
+pushdef(`__COV',`CF`'__HASH2(`$1',`$2')')dnl
+m4_ifdef(__COV,`m4_indir(__COV,`$1',`$2',`$3')',`
+m4_errprint(`No conversion from $1 to $2 defined (line: $4, parameter name: $3)
+')
+m4_m4exit(1)
+')`'dnl
+')
+
+
+#
+# Functions for populating the tables.
+#
+define(`_CONVERSION',`
+m4_ifelse(`$3',,,`define(CF`'__HASH2(`$1',`$2'),`$3')')
+')
+
+define(`_EQUAL',`define(EV`'__HASH(`$1'),`$2')')
+
+/*******************************************************************/
+
+
+define(`__ARG3__',`$`'3')
+define(`_CONV_ENUM',`dnl
+_CONVERSION(`$1$2', `$2', (($2)(__ARG3__)))
+_CONVERSION(`$1$2', `$1::$2', (($1::$2)(__ARG3__)))
+_CONVERSION(`$2', `$1$2', (($1$2)(__ARG3__)))
+_CONVERSION(`$1::$2', `$1$2', (($1$2)(__ARG3__)))
+')dnl
+
+# e.g. Glib::RefPtr<Gdk::Something> to GdkSomething*
+define(`__CONVERT_REFPTR_TO_P',`Glib::unwrap($`'3)')
+
+# e.g. Glib::RefPtr<const Gdk::Something> to GdkSomething*
+#define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>($`'3->gobj())')
+define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>(Glib::unwrap($`'3))')
+
+# The Sun Forte compiler doesn't seem to be able to handle these, so we are using the altlernative, __CONVERT_CONST_REFPTR_TO_P_SUN.
+# The Sun compiler gives this error, for instance:
+#  "widget.cc", line 4463: Error: Overloading ambiguity between "Glib::unwrap<Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)" and
+# "Glib::unwrap<const Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)".
+#
+define(`__CONVERT_CONST_REFPTR_TO_P_SUN',`const_cast<$`'2>(Glib::unwrap<$1>($`'3))')
+
+
+include(convert_gtk.m4)
+include(convert_pango.m4)
+include(convert_gdk.m4)
+include(convert_atk.m4)
+include(convert_glib.m4)
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/defs/Makefile.am b/0.8.0/src/gtkpaludis/vtemm/defs/Makefile.am
new file mode 100644
index 000000000..7fa3843ed
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/defs/Makefile.am
@@ -0,0 +1,51 @@
+vte_defs_included = \
+ vte_methods.defs \
+ vte_vfuncs.defs \
+ vte_enums.defs \
+ vte_signals.defs
+
+vte_defs = \
+ $(vte_defs_included) \
+ vte.defs
+
+if ENABLE_GTK
+
+noinst_DATA = $(vte_defs)
+noinst_PROGRAMS = force_automake_to_include_cxxcompile
+
+endif
+
+INCLUDES = $(GTKDEPS_CFLAGS)
+
+force_automake_to_include_cxxcompile_SOURCES = force_automake_to_include_cxxcompile.cc
+
+force_automake_to_include_cxxcompile.cc :
+ echo 'int main(int, char *[]) { }' > $@
+
+generate_defs_vte : generate_defs_vte.cc
+ $(CXXCOMPILE) $(GTKDEPS_LIBS) -lglibmm_generate_extra_defs-2.4 -o $@ $<
+
+CLEANFILES = *~ force_automake_to_include_cxxcompile.cc generate_defs_vte
+MAINTAINERCLEANFILES = Makefile.in $(vte_defs)
+
+vte_methods.defs :
+ if ! python `pkg-config --variable=datadir pygtk-2.0`/pygtk/2.0/codegen/h2def.py \
+ `pkg-config --variable=includedir vte`/vte/*.h \
+ > $@ ; then rm $@ ; false ; fi
+
+vte_enums.defs :
+ if ! perl $(srcdir)/enum.pl `pkg-config --variable=includedir vte`/vte/*.h > $@ ; \
+ then rm $@ ; false ; fi
+
+vte_signals.defs : generate_defs_vte
+ ./generate_defs_vte | sed -e 's~const-gchar\*~gchar*~' > $@
+
+vte.defs :
+ echo > $@
+ for a in $(vte_defs_included) ; do echo "(include $${a})" >> $@ ; done
+
+vte_vfuncs.defs :
+ touch $@
+
+EXTRA_DIST = enum.pl generate_defs_vte.cc
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/defs/enum.pl b/0.8.0/src/gtkpaludis/vtemm/defs/enum.pl
new file mode 100644
index 000000000..df41545dc
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/defs/enum.pl
@@ -0,0 +1,230 @@
+#! /usr/bin/perl
+
+# The lisp definitions for flags does not include order.
+# thus we must extract it ourselves.
+# Usage: ./enum.pl /gnome/head/cvs/gconf/gconf/*.h > gconf_enums.defs
+
+
+my %token;
+$module="none";
+
+while ($ARGV[0] =~ /^--(\S+)/)
+{
+ shift @ARGV;
+ $module=shift @ARGV if ($1 eq "module");
+ if ($1 eq "help")
+ {
+ print "enum.pl [--module modname] header_files ....\n";
+ exit 0;
+ }
+}
+
+foreach $file (@ARGV)
+{
+ &parse($file);
+}
+
+exit;
+
+
+
+# parse enums from C
+sub parse
+{
+ my ($file)=@_;
+
+ $from=0;
+ open(FILE,$file);
+
+ $enum=0;
+ $deprecated=0;
+ $comment=0;
+
+ while(<FILE>)
+ {
+ if($comment)
+ {
+ # end of multiline comment
+ $comment = 0 if(/\*\//);
+ next;
+ }
+
+ $deprecated = 1 if(s/^#ifndef [A-Z_]+_DISABLE_DEPRECATED//);
+
+ ++$deprecated if($deprecated > 0 && /^#\s*if/);
+ --$deprecated if($deprecated > 0 && /^#\s*endif/);
+
+ next if($deprecated > 0);
+
+ # filter single-line comments
+ s/\/\*.*\*\///g;
+
+ # begin of multiline comment
+ if(/\/\*/)
+ {
+ $comment = 1;
+ next;
+ }
+
+ s/','/\%\%COMMA\%\%/;
+ s/'}'/\%\%RBRACE\%\%/;
+ if (/^typedef enum/ )
+ {
+ print ";; From $file\n\n" if (!$from);
+ $from=1;
+ $enum=1;
+ next;
+ }
+
+ if ($enum && /\}/)
+ {
+ $enum=0;
+ &process($line,$_);
+ $line="";
+ }
+ $line.=$_ if ($enum);
+ }
+}
+
+
+# convert enums to lisp
+sub process
+{
+ my ($line,$def)=@_;
+
+ $def=~s/\s*\}\s*//g;
+ $def=~s/\s*;\s*$//;
+ my $c_name=$def;
+
+ $line=~s/\s+/ /g;
+ $line=~s/\/\*.*\*\///g;
+ $line=~s/\s*{\s*//;
+
+ my $entity = "enum";
+ $c_name =~ /^([A-Z][a-z]*)/;
+ $module = $1;
+ $def =~ s/$module//;
+
+ @c_name=();
+ @name=();
+ @number=();
+
+ $val=0;
+ foreach $i (split(/,/,$line))
+ {
+ $i=~s/^\s+//;
+ $i=~s/\s+$//;
+ if ($i =~ /^\S+$/)
+ {
+ push(@c_name,$i);
+ push(@number,sprintf("%d",$val));
+ $token{$i}=$val;
+ }
+ elsif ($i =~ /^(\S+)\s*=\s*(0x[0-9a-fA-F]+)$/ ||
+ $i =~ /^(\S+)\s*=\s*(-?[0-9]+)$/ ||
+ $i =~ /^(\S+)\s*=\s*(1\s*<<\s*[0-9]+)$/
+ )
+ {
+ my ($tmp1, $tmp2) = ($1, $2);
+ push(@c_name, $tmp1);
+ eval("\$val = $tmp2;");
+ $entity = "flags" if($tmp2 =~ /^1\s*<</ || $tmp2 =~ /^0x/);
+ push(@number, $tmp2);
+ $token{$tmp1} = $tmp2;
+ }
+ elsif ($i =~ /^(\S+)\s*=\s*([ _x0-9a-fA-Z|()~]+)$/)
+ {
+ my ($tmp1, $tmp2) = ($1, $2);
+ push(@c_name, $tmp1);
+ $tmp2 =~ s/([A-Z_]+)/($token{$1})/;
+ eval("\$val = $tmp2;");
+ $val = "#error" if(!$val);
+ $val = sprintf("0x%X", $val) if($entity eq "flags");
+ push(@number, $val);
+ $token{$tmp1} = $val;
+ }
+ elsif ($i =~ /^(\S+)\s*=\s*'(.)'$/)
+ {
+ push(@c_name,$1);
+ push(@number,"\'$2\'");
+ $val=ord($2);
+ $token{$1}=$val;
+ }
+ elsif ($i =~ /^(\S+)\s*=\s*(\%\%[A-Z]+\%\%)$/)
+ {
+ $tmp=$1;
+ $_=$2;
+ s/\%\%COMMA\%\%/,/;
+ s/\%\%RBRACE\%\%/]/;
+ push(@c_name,$tmp);
+ push(@number,"\'$_\'");
+ $val=ord($_);
+ $token{$tmp}=$val;
+ }
+ else
+ {
+ #print STDERR "$i\n";
+ }
+ $val++;
+ }
+
+ # remove the prefix to form names
+ &form_names(\@name,\@c_name);
+
+ my $format = "%d";
+ $format = "0x%X" if($entity eq "flags");
+
+ # evaluate any unevaluated values
+ my $j;
+ for ($j=0;$j<$#number+1;$j++)
+ {
+ if ($number[$j]=~/\$/)
+ {
+ $number[$j]=sprintf($format, eval($number[$j]));
+ }
+ }
+
+ #print ";; Enum $def\n\n";
+ print "(define-$entity-extended $def\n";
+ print " (in-module \"$module\")\n";
+ print " (c-name \"$c_name\")\n";
+
+ print " (values\n";
+ for ($j=0;$j<$#c_name+1;$j++)
+ {
+ print " \'(\"$name[$j]\" \"$c_name[$j]\"";
+ print " \"$number[$j]\"" if ($number[$j] ne "");
+ print ")\n";
+ }
+ print " )\n";
+ print ")\n\n";
+}
+
+
+sub form_names
+{
+ my ($name,$c_name)=@_;
+
+ my $len=length($$c_name[0]) - 1;
+ my $j;
+ for ($j=0;$j<$#c_name;$j++)
+ {
+ while (substr($$c_name[$j],$len-1,1) ne "_" ||
+ substr($$c_name[$j],0,$len) ne substr($$c_name[$j+1],0,$len))
+ {
+ $len--;
+ }
+ #print substr($$c_name[$j],0,$len),"\n";
+ }
+
+ my $prefix=substr($$c_name[0],0,$len);
+
+ for ($j=0;$j<$#c_name+1;$j++)
+ {
+ $_=$$c_name[$j];
+ s/^$prefix//;
+ tr/A-Z_/a-z-/;
+ push(@$name,$_);
+ }
+
+}
diff --git a/0.8.0/src/gtkpaludis/vtemm/defs/generate_defs_vte.cc b/0.8.0/src/gtkpaludis/vtemm/defs/generate_defs_vte.cc
new file mode 100644
index 000000000..20c9b5c68
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/defs/generate_defs_vte.cc
@@ -0,0 +1,36 @@
+/* $Id: generate_defs_gtk.cc,v 1.22 2006/05/16 18:03:21 murrayc Exp $ */
+
+/* generate_defs_gtk.cc
+ *
+ * Copyright (C) 2001 The Free Software Foundation
+ *
+ * This library 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 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "glibmm_generate_extra_defs/generate_extra_defs.h"
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <vte/vte.h>
+#include <vte/reaper.h>
+
+int main (int argc, char *argv[])
+{
+ gtk_init(&argc, &argv);
+
+std::cout << get_defs(VTE_TYPE_TERMINAL)
+ << get_defs(VTE_TYPE_REAPER);
+
+ return 0;
+}
diff --git a/0.8.0/src/gtkpaludis/vtemm/reaper.ccg b/0.8.0/src/gtkpaludis/vtemm/reaper.ccg
new file mode 100644
index 000000000..e2f1164aa
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/reaper.ccg
@@ -0,0 +1,65 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Piotr Rak <piotr.rak@gmail.com>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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 <vte/reaper.h>
+#include <paludis/util/exception.hh>
+
+namespace
+{
+
+ void Reaper_proxy_signal_child_exited(GObject*, int pid, int status, gpointer data)
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ if (Vte::Reaper::get_instance() == data) //ignore signals connected using c api
+ Vte::Reaper::get_instance()->signal_child_exited().emit(pid, status);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+} /* anonymous namspace */
+
+namespace Vte
+{
+
+ Reaper::Reaper() :
+ Glib::Object(reinterpret_cast<GObject*>(::vte_reaper_get()))
+ {
+ //TODO: looks like vte-0.13.3 has child-exited renamed abi/api breakage??
+ //propably shoud be also unregistred if Reaper will stop be singleton
+ g_signal_connect(G_OBJECT(gobj()), "child-exited", G_CALLBACK(Reaper_proxy_signal_child_exited) , this);
+ }
+
+ int Reaper::add_child(GPid pid)
+ {
+ return vte_reaper_add_child(pid);
+ }
+
+ sigc::signal<void, int, int>& Reaper::signal_child_exited()
+ {
+ return _signal_child_exited;
+ }
+}
+
diff --git a/0.8.0/src/gtkpaludis/vtemm/reaper.hg b/0.8.0/src/gtkpaludis/vtemm/reaper.hg
new file mode 100644
index 000000000..3447636dc
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/reaper.hg
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Piotr Rak <piotr.rak@gmail.com>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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 <sys/types.h>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <glibmm/object.h>
+#include <sigc++/sigc++.h>
+
+_DEFS(vtemm,vte)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Vte
+{
+ class Reaper :
+ public Glib::Object,
+ public paludis::InstantiationPolicy<Reaper, paludis::instantiation_method::SingletonAsNeededTag>
+
+ {
+ friend class paludis::InstantiationPolicy<Reaper, paludis::instantiation_method::SingletonAsNeededTag>;
+
+ sigc::signal<void, int, int> _signal_child_exited;
+
+ _CLASS_GOBJECT(Reaper,VteReaper,VTE_REAPER,Glib::Object,GObject)
+
+ Reaper();
+
+ public:
+
+ int add_child(GPid pid);
+ sigc::signal<void, int, int>& signal_child_exited();
+
+ };
+}
diff --git a/0.8.0/src/gtkpaludis/vtemm/terminal_widget.ccg b/0.8.0/src/gtkpaludis/vtemm/terminal_widget.ccg
new file mode 100644
index 000000000..74ff4a981
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/terminal_widget.ccg
@@ -0,0 +1,159 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Piotr Rak <piotr.rak@gmail.com>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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 <vte/vte.h>
+
+namespace
+{
+
+gboolean proxy_slot_selected_callback(VteTerminal * /* term */ , glong column, glong row, gpointer data)
+{
+ typedef Vte::Terminal::SlotIsSelected SlotType;
+ SlotType& slot(*static_cast<SlotType*>(data));
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ return slot(column, row);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return 0;
+}
+
+} /* anonymous namespace */
+
+
+namespace Vte
+{
+
+CharAttributes::CharAttributes(VteCharAttributes* obj) :
+ _gobject(new VteCharAttributes(*obj))
+{
+}
+
+CharAttributes::~CharAttributes()
+{
+ delete _gobject;
+}
+
+CharAttributes::CharAttributes(const CharAttributes& rhs) :
+ _gobject(new VteCharAttributes(*rhs._gobject))
+{
+}
+
+CharAttributes& CharAttributes::operator= (const CharAttributes& rhs)
+{
+ if (this != &rhs)
+ {
+ delete _gobject;
+ _gobject = new VteCharAttributes(*rhs._gobject);
+ }
+ return *this;
+}
+
+int CharAttributes::row() const
+{
+ return _gobject->row;
+}
+
+int CharAttributes::column() const
+{
+ return _gobject->column;
+}
+
+Gdk::Color CharAttributes::foreground() const
+{
+ return Gdk::Color(&_gobject->fore, true);
+}
+
+Gdk::Color CharAttributes::background() const
+{
+ return Gdk::Color(&_gobject->back, true);
+}
+
+bool CharAttributes::underline() const
+{
+ return _gobject->underline;
+}
+
+bool CharAttributes::strikethrough() const
+{
+ return _gobject->strikethrough;
+}
+
+char* Terminal::get_text(const Terminal::SlotIsSelected& slot, std::vector<CharAttributes>& attributes)
+{
+ GArray* garray(g_array_new(false, true, sizeof(VteCharAttributes)));
+ Terminal::SlotIsSelected slot_copy(slot);
+
+ char * result(vte_terminal_get_text(gobj(), &proxy_slot_selected_callback, &slot_copy, garray));
+
+ for (size_t i=0; i< garray->len; ++i)
+ {
+ attributes.push_back(new VteCharAttributes(g_array_index(garray, VteCharAttributes, i))); //TODO suboptimal deep copy
+ }
+
+ g_array_free(garray, false);
+
+ return result;
+}
+
+char* Terminal::get_text_include_trailing_spaces(const Terminal::SlotIsSelected& slot, std::vector<CharAttributes>& attributes)
+{
+ GArray* garray(g_array_new(false, true, sizeof(VteCharAttributes)));
+ Terminal::SlotIsSelected slot_copy(slot);
+
+ char * result(vte_terminal_get_text_include_trailing_spaces(gobj(),
+ &proxy_slot_selected_callback, &slot_copy, garray));
+
+ for (size_t i=0; i< garray->len; ++i)
+ {
+ attributes.push_back(new VteCharAttributes(g_array_index(garray, VteCharAttributes, i))); //TODO suboptimal deep copy
+ }
+
+ g_array_free(garray, true);
+
+ return result;
+}
+
+char* Terminal::get_text_range(long start_row, long start_col, long end_row, long end_col, const SlotIsSelected& slot, std::vector<CharAttributes>& attributes)
+{
+ GArray* garray(g_array_new(false, true, sizeof(VteCharAttributes)));
+ Terminal::SlotIsSelected slot_copy(slot);
+
+ char * result(vte_terminal_get_text_range(gobj(),start_row, start_col, end_row, end_col,
+ &proxy_slot_selected_callback, &slot_copy, garray));
+
+ for (size_t i=0; i< garray->len; ++i)
+ {
+ attributes.push_back(new VteCharAttributes(g_array_index(garray, VteCharAttributes, i))); //TODO suboptimal deep copy
+ }
+
+ g_array_free(garray, true);
+
+ return result;
+}
+
+} /* namespace Vte */
diff --git a/0.8.0/src/gtkpaludis/vtemm/terminal_widget.hg b/0.8.0/src/gtkpaludis/vtemm/terminal_widget.hg
new file mode 100644
index 000000000..956a29396
--- /dev/null
+++ b/0.8.0/src/gtkpaludis/vtemm/terminal_widget.hg
@@ -0,0 +1,181 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Piotr Rak <piotr.rak@gmail.com>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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 <gtkmm/widget.h>
+#include <gtkmm/menushell.h>
+#include <gtkmm/adjustment.h>
+#include <gdkmm/cursor.h>
+#include <pangomm/fontdescription.h>
+
+#include <vector>
+
+_DEFS(vtemm,vte)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+/* we don't want whole vte.h in this file */
+typedef struct _VteCharAttributes VteCharAttributes;
+
+namespace Vte
+{
+
+
+class CharAttributes
+{
+private:
+ VteCharAttributes * _gobject;
+
+public:
+ CharAttributes(VteCharAttributes *obj);
+ CharAttributes(const CharAttributes&);
+
+ ~CharAttributes();
+
+ CharAttributes& operator= (const CharAttributes&);
+
+ int row() const;
+ int column() const;
+ Gdk::Color foreground() const;
+ Gdk::Color background() const;
+ bool underline() const;
+ bool strikethrough() const;
+};
+
+_WRAP_ENUM(TerminalEraseBinding, VteTerminalEraseBinding)
+_WRAP_ENUM(TerminalAntiAlias, VteTerminalAntiAlias)
+
+class Terminal :
+ public Gtk::Widget
+{
+
+_CLASS_GTKOBJECT(Terminal,VteTerminal,VTE_TERMINAL,Gtk::Widget,GtkWidget)
+public:
+
+typedef sigc::slot<bool, long, long> SlotIsSelected;
+
+_CTOR_DEFAULT
+
+_WRAP_METHOD(void im_append_menuitems(const Gtk::MenuShell& menushell), vte_terminal_im_append_menuitems)
+_WRAP_METHOD(pid_t fork_command(const char* command, char** argv, char** envv, const char* directory, bool lastlog, bool utmp, bool wtmp), vte_terminal_fork_command)
+_WRAP_METHOD(pid_t forkpty(char** env, const char* directory, bool lastlog, bool utmp, bool wtmp), vte_terminal_forkpty)
+_WRAP_METHOD(void set_pty(int pty_master), vte_terminal_set_pty)
+_WRAP_METHOD(void feed(const char* data, glong length), vte_terminal_feed)
+_WRAP_METHOD(void feed_child(const char* text, glong length), vte_terminal_feed_child)
+_WRAP_METHOD(void feed_child_binary(const char* data, glong length), vte_terminal_feed_child_binary)
+_WRAP_METHOD(void copy_clipboard(), vte_terminal_copy_clipboard)
+_WRAP_METHOD(void paste_clipboard(), vte_terminal_paste_clipboard)
+_WRAP_METHOD(void copy_primary(), vte_terminal_copy_primary)
+_WRAP_METHOD(void paste_primary(), vte_terminal_paste_primary)
+_WRAP_METHOD(void set_size(glong columns, glong rows), vte_terminal_set_size)
+_WRAP_METHOD(void set_audible_bell(bool is_audible), vte_terminal_set_audible_bell)
+_WRAP_METHOD(bool get_audible_bell(), vte_terminal_get_audible_bell)
+_WRAP_METHOD(void set_visible_bell(bool is_visible), vte_terminal_set_visible_bell)
+_WRAP_METHOD(bool get_visible_bell(), vte_terminal_get_visible_bell)
+_WRAP_METHOD(void set_allow_bold(bool allow_bold), vte_terminal_set_allow_bold)
+_WRAP_METHOD(bool get_allow_bold(), vte_terminal_get_allow_bold)
+_WRAP_METHOD(void set_scroll_on_output(bool scroll), vte_terminal_set_scroll_on_output)
+_WRAP_METHOD(void set_scroll_on_keystroke(bool scroll), vte_terminal_set_scroll_on_keystroke)
+_WRAP_METHOD(void set_color_bold(const Gdk::Color& bold), vte_terminal_set_color_bold )
+_WRAP_METHOD(void set_color_foreground(const Gdk::Color& foreground), vte_terminal_set_color_foreground)
+_WRAP_METHOD(void set_color_background(const Gdk::Color& background), vte_terminal_set_color_background)
+_WRAP_METHOD(void set_color_dim(const Gdk::Color& dim), vte_terminal_set_color_dim)
+_WRAP_METHOD(void set_color_cursor(const Gdk::Color& cursor), vte_terminal_set_color_cursor)
+_WRAP_METHOD(void set_color_highlight(const Gdk::Color& highlight), vte_terminal_set_color_highlight)
+_WRAP_METHOD(void set_colors(const Gdk::Color& foreground, const Gdk::Color& background, const Gdk::Color& palete_size, glong palette_size), vte_terminal_set_colors)
+_WRAP_METHOD(void set_default_colors(), vte_terminal_set_default_colors)
+_WRAP_METHOD(void set_background_image(Glib::RefPtr<Gdk::Pixbuf> pixbuf), vte_terminal_set_background_image)
+_WRAP_METHOD(void set_background_image_file(const char* path), vte_terminal_set_background_image_file)
+_WRAP_METHOD(void set_background_saturation(double saturation), vte_terminal_set_background_saturation)
+_WRAP_METHOD(void set_background_transparent(bool transparent), vte_terminal_set_background_transparent)
+_WRAP_METHOD(void set_background_tint_color(const Gdk::Color& color), vte_terminal_set_background_tint_color)
+_WRAP_METHOD(void set_scroll_background(bool scroll), vte_terminal_set_scroll_background)
+_WRAP_METHOD(void set_cursor_blinks(bool blink), vte_terminal_set_cursor_blinks)
+_WRAP_METHOD(void set_scrollback_lines(long lines), vte_terminal_set_scrollback_lines)
+_WRAP_METHOD(void set_font(const Pango::FontDescription& font_desc), vte_terminal_set_font)
+_WRAP_METHOD(void set_font_from_string(const char* name), vte_terminal_set_font_from_string)
+_WRAP_METHOD(void set_font_from_string_full(const char* name, TerminalAntiAlias antialas), vte_terminal_set_font_from_string_full)
+_WRAP_METHOD(void set_font_full(const Pango::FontDescription& font_desc, TerminalAntiAlias antialas), vte_terminal_set_font_full)
+_WRAP_METHOD(const Pango::FontDescription get_font(), vte_terminal_get_font)
+_WRAP_METHOD(bool get_using_xft(), vte_terminal_get_using_xft)
+_WRAP_METHOD(bool get_has_selection(), vte_terminal_get_has_selection)
+_WRAP_METHOD(void set_word_chars(const char* spec), vte_terminal_set_word_chars)
+_WRAP_METHOD(bool is_word_char(gunichar), vte_terminal_is_word_char)
+_WRAP_METHOD(void set_backspace_binding(TerminalEraseBinding binding), vte_terminal_set_backspace_binding)
+_WRAP_METHOD(void set_delete_binding(TerminalEraseBinding binding), vte_terminal_set_delete_binding)
+_WRAP_METHOD(void set_mouse_autohide(bool setting), vte_terminal_set_mouse_autohide)
+_WRAP_METHOD(bool get_mouse_autohide(), vte_terminal_get_mouse_autohide)
+_WRAP_METHOD(void reset(bool full, bool clear_history), vte_terminal_reset)
+//_WRAP_METHOD(char* get_text(bool (*is_selected) (glong column,glong row,gpointer data), gpointer data, GArray *attributes), vte_terminal_get_text) //Manualy wrapped below
+//_WRAP_METHOD(char* get_text_range(glong start_row, glong start_col, glong end_row, glong end_col, gboolean (*is_selected) (glong column,glong row,gpointer data), gpointer data, GArray *attributes), vte_terminal_get_text_range) //Manualy wrapped bellow
+_WRAP_METHOD(void get_cursor_position(long& column, long& row), vte_terminal_get_cursor_position)
+_WRAP_METHOD(void match_clear_all(), vte_terminal_match_clear_all)
+_WRAP_METHOD(int match_add(const char* match), vte_terminal_match_add)
+_WRAP_METHOD(void match_remove(int tag), vte_terminal_match_remove)
+_WRAP_METHOD(char* match_check(glong column, glong row, int& tag), vte_terminal_match_check)
+_WRAP_METHOD(void match_set_cursor(int tag, Gdk::Cursor& ), vte_terminal_match_set_cursor)
+_WRAP_METHOD(void match_set_cursor_type(int tag, Gdk::CursorType), vte_terminal_match_set_cursor_type)
+_WRAP_METHOD(void set_emulation(const char* emulation), vte_terminal_set_emulation)
+_WRAP_METHOD(const char* get_emulation(), vte_terminal_get_emulation)
+_WRAP_METHOD(const char* get_default_emulation(), vte_terminal_get_default_emulation)
+_WRAP_METHOD(void set_encoding(const char* codeset), vte_terminal_set_encoding)
+_WRAP_METHOD(const char* get_encoding(), vte_terminal_get_encoding)
+_WRAP_METHOD(const char* get_status_line(), vte_terminal_get_status_line)
+_WRAP_METHOD(void get_padding(int& xpad, int& ypad), vte_terminal_get_padding)
+_WRAP_METHOD(Gtk::Adjustment* get_adjustment(), vte_terminal_get_adjustment)
+_WRAP_METHOD(glong get_char_ascent(), vte_terminal_get_char_ascent)
+_WRAP_METHOD(glong get_char_descent(), vte_terminal_get_char_descent)
+_WRAP_METHOD(glong get_char_height(), vte_terminal_get_char_height)
+_WRAP_METHOD(glong get_char_width(), vte_terminal_get_char_width)
+_WRAP_METHOD(glong get_column_count(), vte_terminal_get_column_count)
+_WRAP_METHOD(const char* get_icon_title(), vte_terminal_get_icon_title)
+_WRAP_METHOD(glong get_row_count(), vte_terminal_get_row_count)
+_WRAP_METHOD(const char* get_window_title(), vte_terminal_get_window_title)
+
+_WRAP_SIGNAL(void char_size_changed(unsigned w, unsigned h), "char-size-changed")
+_WRAP_SIGNAL(void child_exited(), "child-exited")
+_WRAP_SIGNAL(void commit(gchar* text, unsigned length), "commit")
+_WRAP_SIGNAL(void contents_changed(), "contents-changed")
+_WRAP_SIGNAL(void cursor_moved(), "cursor-moved")
+_WRAP_SIGNAL(void decrease_font_size(), "decrease-font-size")
+_WRAP_SIGNAL(void deiconify_window(), "deiconify-window")
+_WRAP_SIGNAL(void emulation_changed(), "emulation-changed")
+_WRAP_SIGNAL(void encoding_changed(), "encoding-changed")
+_WRAP_SIGNAL(void eof(), "eof")
+_WRAP_SIGNAL(void icon_title_changed(), "icon-title-changed")
+_WRAP_SIGNAL(void iconify_window(), "iconify-window")
+_WRAP_SIGNAL(void increase_font_size(), "increase-font-size")
+_WRAP_SIGNAL(void lower_window(), "lower-window")
+_WRAP_SIGNAL(void maximize_window(), "maximize-window")
+_WRAP_SIGNAL(void move_window(unsigned x, unsigned y), "move-window")
+_WRAP_SIGNAL(void raise_window(), "raise-window")
+_WRAP_SIGNAL(void refresh_window(), "refresh-window")
+_WRAP_SIGNAL(void resize_window(unsigned w, unsigned h), "resize-window")
+_WRAP_SIGNAL(void restore_window(), "restore-window")
+_WRAP_SIGNAL(void selection_changed(), "selection-changed")
+_WRAP_SIGNAL(void status_line_changed(), "status-line-changed")
+_WRAP_SIGNAL(void text_deleted(), "text-deleted")
+_WRAP_SIGNAL(void text_inserted(), "text-inserted")
+_WRAP_SIGNAL(void text_modified(), "text-modified")
+_WRAP_SIGNAL(void text_scrolled(int arg), "text-scrolled")
+_WRAP_SIGNAL(void window_title_changed(), "window-title-changed")
+ char* get_text(const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
+ char* get_text_include_trailing_spaces(const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
+ char* get_text_range(long start_row, long start_col, long end_row, long end_col, const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
+};
+
+} /* namespace Vte */