diff --git a/.gitignore b/.gitignore index e4b144a..7ff2ab3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ stamp-h1 *.la *.lo *.o +*.userprefs +*.usertasks diff --git a/Makefile.am b/Makefile.am index e8782d0..eed1dab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # $Id$ -SUBDIRS = pipi src genethumb examples test +SUBDIRS = pipi src genethumb examples test pipi-sharp ThePimp EXTRA_DIST = bootstrap build-win32 common.h NOTES AUTOMAKE_OPTIONS = dist-bzip2 diff --git a/ThePimp.mds b/ThePimp.mds new file mode 100644 index 0000000..616eaf4 --- /dev/null +++ b/ThePimp.mds @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ThePimp/.gitignore b/ThePimp/.gitignore new file mode 100644 index 0000000..c8ef348 --- /dev/null +++ b/ThePimp/.gitignore @@ -0,0 +1,5 @@ +*.pidb +*.mdb +*.exe +*.dll +pipi-sharp.dll.* diff --git a/pimp/Pimp/AssemblyInfo.cs b/ThePimp/AssemblyInfo.cs similarity index 100% rename from pimp/Pimp/AssemblyInfo.cs rename to ThePimp/AssemblyInfo.cs diff --git a/pimp/Pimp/Main.cs b/ThePimp/Main.cs similarity index 91% rename from pimp/Pimp/Main.cs rename to ThePimp/Main.cs index b6e11a4..801358c 100644 --- a/pimp/Pimp/Main.cs +++ b/ThePimp/Main.cs @@ -6,9 +6,9 @@ using System; using Gtk; -namespace Pimp +namespace ThePimp { - class Pimp + class ThePimp { public static void Main (string[] args) { diff --git a/pimp/Pimp/MainWindow.cs b/ThePimp/MainWindow.cs similarity index 74% rename from pimp/Pimp/MainWindow.cs rename to ThePimp/MainWindow.cs index 3f323f3..3b6417a 100644 --- a/pimp/Pimp/MainWindow.cs +++ b/ThePimp/MainWindow.cs @@ -6,6 +6,7 @@ using System; using Gtk; using Pipi; +using ThePimp; public partial class MainWindow: Gtk.Window { @@ -23,11 +24,14 @@ public partial class MainWindow: Gtk.Window protected virtual void OnOpenActionActivated (object sender, System.EventArgs e) { - Pimp.OpenFile open = new Pimp.OpenFile(); - ResponseType rsp = (ResponseType)open.Run(); + ThePimp.OpenFile open = new ThePimp.OpenFile(); + Pipi.Picture p = open.Load(); open.Destroy(); - if(rsp == ResponseType.Ok) - return; + if(p != null) + { + Title += " image " + p.Width + "x" + p.Height; + scrolledwindow1.Add(new PictureView(p)); + } } protected virtual void OnQuitActionActivated (object sender, System.EventArgs e) diff --git a/ThePimp/Makefile.am b/ThePimp/Makefile.am new file mode 100644 index 0000000..a4d20e3 --- /dev/null +++ b/ThePimp/Makefile.am @@ -0,0 +1,29 @@ +# $Id: $ + +pimp_sources = \ + $(srcdir)/AssemblyInfo.cs \ + $(srcdir)/Main.cs \ + $(srcdir)/gtk-gui/generated.cs \ + $(srcdir)/OpenFile.cs \ + $(srcdir)/gtk-gui/ThePimp.OpenFile.cs \ + $(srcdir)/PictureView.cs \ + $(srcdir)/gtk-gui/ThePimp.PictureView.cs \ + $(srcdir)/MainWindow.cs \ + $(srcdir)/gtk-gui/MainWindow.cs + +if USE_CSHARP +bin_SCRIPTS = Pimp.exe +endif + +EXTRA_DIST = $(pimp_sources) + +Pimp.exe: $(pimp_sources) + cp ../pipi-sharp/pipi-sharp.dll . + cp ../pipi-sharp/pipi-sharp.dll.config . + gmcs $(pimp_sources) -out:$@ -lib:./ \ + -pkg:gtk-sharp-2.0 -r:Mono.Posix -r:pipi-sharp.dll + +clean-local: + rm -f pipi-sharp.dll pipi-sharp.dll.config + rm -f *.exe *.dll *.mdb + diff --git a/ThePimp/OpenFile.cs b/ThePimp/OpenFile.cs new file mode 100644 index 0000000..cdfb622 --- /dev/null +++ b/ThePimp/OpenFile.cs @@ -0,0 +1,29 @@ +// OpenFile.cs created with MonoDevelop +// User: sam at 23:05 03/10/2008 +// +// To change standard headers go to Edit->Preferences->Coding->Standard Headers +// + +using System; +using Gtk; + +namespace ThePimp +{ + public partial class OpenFile : Gtk.Dialog + { + public OpenFile() + { + this.Build(); + } + + public Pipi.Picture Load() + { + ResponseType rsp = (ResponseType)Run(); + Hide(); + if(rsp != ResponseType.Ok) + return null; + Pipi.Picture p = new Pipi.Picture(filechooserwidget1.Filename); + return p; + } + } +} diff --git a/ThePimp/PictureView.cs b/ThePimp/PictureView.cs new file mode 100644 index 0000000..0a9d882 --- /dev/null +++ b/ThePimp/PictureView.cs @@ -0,0 +1,25 @@ +// PictureView.cs created with MonoDevelop +// User: sam at 22:59 04/10/2008 +// +// To change standard headers go to Edit->Preferences->Coding->Standard Headers +// + +using System; +using Gtk; +using Pipi; + +namespace ThePimp +{ + public partial class PictureView : Gtk.Bin + { + protected override void OnSetScrollAdjustments (Adjustment hAdjustement, Adjustment vAdjustement) + { + Console.WriteLine("LOL WHAT"); + } + + public PictureView(Picture p) + { + this.Build(); + } + } +} diff --git a/pimp/Pimp/Pimp.mdp b/ThePimp/ThePimp.mdp similarity index 73% rename from pimp/Pimp/Pimp.mdp rename to ThePimp/ThePimp.mdp index 058e534..1e1333a 100644 --- a/pimp/Pimp/Pimp.mdp +++ b/ThePimp/ThePimp.mdp @@ -1,16 +1,19 @@ - + - + - + - + + + + @@ -26,6 +29,9 @@ + + + @@ -35,8 +41,12 @@ - + - + + + ThePimp.PictureView + + \ No newline at end of file diff --git a/pimp/Pimp/app.desktop b/ThePimp/app.desktop similarity index 100% rename from pimp/Pimp/app.desktop rename to ThePimp/app.desktop diff --git a/pimp/Pimp/gtk-gui/MainWindow.cs b/ThePimp/gtk-gui/MainWindow.cs similarity index 91% rename from pimp/Pimp/gtk-gui/MainWindow.cs rename to ThePimp/gtk-gui/MainWindow.cs index ff05806..02aac03 100644 --- a/pimp/Pimp/gtk-gui/MainWindow.cs +++ b/ThePimp/gtk-gui/MainWindow.cs @@ -80,16 +80,18 @@ public partial class MainWindow { private Gtk.ScrolledWindow scrolledwindow1; - private Gtk.DrawingArea drawingarea1; - private Gtk.Label label1; private Gtk.VPaned vpaned1; private Gtk.VBox vbox2; + private Gtk.Label label2; + private Gtk.VBox vbox3; + private Gtk.Label label3; + private Gtk.Statusbar statusbar1; protected virtual void Build() { @@ -237,14 +239,6 @@ public partial class MainWindow { this.scrolledwindow1.CanFocus = true; this.scrolledwindow1.Name = "scrolledwindow1"; this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1)); - // Container child scrolledwindow1.Gtk.Container+ContainerChild - Gtk.Viewport w5 = new Gtk.Viewport(); - w5.ShadowType = ((Gtk.ShadowType)(0)); - // Container child GtkViewport.Gtk.Container+ContainerChild - this.drawingarea1 = new Gtk.DrawingArea(); - this.drawingarea1.Name = "drawingarea1"; - w5.Add(this.drawingarea1); - this.scrolledwindow1.Add(w5); this.notebook1.Add(this.scrolledwindow1); // Notebook tab this.label1 = new Gtk.Label(); @@ -253,8 +247,8 @@ public partial class MainWindow { this.notebook1.SetTabLabel(this.scrolledwindow1, this.label1); this.label1.ShowAll(); this.hpaned1.Add(this.notebook1); - Gtk.Paned.PanedChild w9 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1])); - w9.Resize = false; + Gtk.Paned.PanedChild w6 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1])); + w6.Resize = false; // Container child hpaned1.Gtk.Paned+PanedChild this.vpaned1 = new Gtk.VPaned(); this.vpaned1.CanFocus = true; @@ -264,27 +258,47 @@ public partial class MainWindow { this.vbox2 = new Gtk.VBox(); this.vbox2.Name = "vbox2"; this.vbox2.BorderWidth = ((uint)(5)); + // Container child vbox2.Gtk.Box+BoxChild + this.label2 = new Gtk.Label(); + this.label2.WidthRequest = 100; + this.label2.Name = "label2"; + this.label2.LabelProp = Mono.Unix.Catalog.GetString("Tools"); + this.vbox2.Add(this.label2); + Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox2[this.label2])); + w7.Position = 0; + w7.Expand = false; + w7.Fill = false; this.vpaned1.Add(this.vbox2); - Gtk.Paned.PanedChild w10 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2])); - w10.Resize = false; + Gtk.Paned.PanedChild w8 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2])); + w8.Resize = false; // Container child vpaned1.Gtk.Paned+PanedChild this.vbox3 = new Gtk.VBox(); this.vbox3.Name = "vbox3"; this.vbox3.BorderWidth = ((uint)(5)); + // Container child vbox3.Gtk.Box+BoxChild + this.label3 = new Gtk.Label(); + this.label3.WidthRequest = 100; + this.label3.Name = "label3"; + this.label3.LabelProp = Mono.Unix.Catalog.GetString("Layers & Channels"); + this.vbox3.Add(this.label3); + Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox3[this.label3])); + w9.Position = 0; + w9.Expand = false; + w9.Fill = false; this.vpaned1.Add(this.vbox3); this.hpaned1.Add(this.vpaned1); this.vbox1.Add(this.hpaned1); - Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1])); - w13.Position = 2; + Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1])); + w12.Position = 2; // Container child vbox1.Gtk.Box+BoxChild this.statusbar1 = new Gtk.Statusbar(); this.statusbar1.Name = "statusbar1"; this.statusbar1.Spacing = 6; this.vbox1.Add(this.statusbar1); - Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1])); - w14.Position = 3; - w14.Expand = false; - w14.Fill = false; + Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1])); + w13.Position = 3; + w13.Expand = false; + w13.Fill = false; this.Add(this.vbox1); if ((this.Child != null)) { this.Child.ShowAll(); diff --git a/pimp/Pimp/gtk-gui/Pimp.OpenFile.cs b/ThePimp/gtk-gui/ThePimp.OpenFile.cs similarity index 93% rename from pimp/Pimp/gtk-gui/Pimp.OpenFile.cs rename to ThePimp/gtk-gui/ThePimp.OpenFile.cs index a808445..0e4d985 100644 --- a/pimp/Pimp/gtk-gui/Pimp.OpenFile.cs +++ b/ThePimp/gtk-gui/ThePimp.OpenFile.cs @@ -8,7 +8,7 @@ // // ------------------------------------------------------------------------------ -namespace Pimp { +namespace ThePimp { public partial class OpenFile { @@ -21,15 +21,15 @@ namespace Pimp { protected virtual void Build() { Stetic.Gui.Initialize(this); - // Widget Pimp.OpenFile - this.Name = "Pimp.OpenFile"; + // Widget ThePimp.OpenFile + this.Name = "ThePimp.OpenFile"; this.Title = Mono.Unix.Catalog.GetString("Open File"); this.Icon = Stetic.IconLoader.LoadIcon(this, "gtk-open", Gtk.IconSize.Menu, 16); this.TypeHint = ((Gdk.WindowTypeHint)(1)); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.Modal = true; this.HasSeparator = false; - // Internal child Pimp.OpenFile.VBox + // Internal child ThePimp.OpenFile.VBox Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); @@ -39,7 +39,7 @@ namespace Pimp { w1.Add(this.filechooserwidget1); Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(w1[this.filechooserwidget1])); w2.Position = 0; - // Internal child Pimp.OpenFile.ActionArea + // Internal child ThePimp.OpenFile.ActionArea Gtk.HButtonBox w3 = this.ActionArea; w3.Name = "dialog1_ActionArea"; w3.Spacing = 6; diff --git a/ThePimp/gtk-gui/ThePimp.PictureView.cs b/ThePimp/gtk-gui/ThePimp.PictureView.cs new file mode 100644 index 0000000..f3429e7 --- /dev/null +++ b/ThePimp/gtk-gui/ThePimp.PictureView.cs @@ -0,0 +1,33 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +namespace ThePimp { + + + public partial class PictureView { + + private Gtk.DrawingArea drawingarea1; + + protected virtual void Build() { + Stetic.Gui.Initialize(this); + // Widget ThePimp.PictureView + Stetic.BinContainer.Attach(this); + this.Name = "ThePimp.PictureView"; + // Container child ThePimp.PictureView.Gtk.Container+ContainerChild + this.drawingarea1 = new Gtk.DrawingArea(); + this.drawingarea1.Name = "drawingarea1"; + this.Add(this.drawingarea1); + if ((this.Child != null)) { + this.Child.ShowAll(); + } + this.Show(); + } + } +} diff --git a/pimp/Pimp/gtk-gui/generated.cs b/ThePimp/gtk-gui/generated.cs similarity index 61% rename from pimp/Pimp/gtk-gui/generated.cs rename to ThePimp/gtk-gui/generated.cs index dd18ad7..1e348d4 100644 --- a/pimp/Pimp/gtk-gui/generated.cs +++ b/ThePimp/gtk-gui/generated.cs @@ -55,6 +55,53 @@ namespace Stetic { } } + internal class BinContainer { + + private Gtk.Widget child; + + private Gtk.UIManager uimanager; + + public static BinContainer Attach(Gtk.Bin bin) { + BinContainer bc = new BinContainer(); + bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested); + bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated); + bin.Added += new Gtk.AddedHandler(bc.OnAdded); + return bc; + } + + private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) { + if ((this.child != null)) { + args.Requisition = this.child.SizeRequest(); + } + } + + private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) { + if ((this.child != null)) { + this.child.Allocation = args.Allocation; + } + } + + private void OnAdded(object sender, Gtk.AddedArgs args) { + this.child = args.Widget; + } + + public void SetUiManager(Gtk.UIManager uim) { + this.uimanager = uim; + this.child.Realized += new System.EventHandler(this.OnRealized); + } + + private void OnRealized(object sender, System.EventArgs args) { + if ((this.uimanager != null)) { + Gtk.Widget w; + w = this.child.Toplevel; + if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) { + ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup); + this.uimanager = null; + } + } + } + } + internal class ActionGroups { public static Gtk.ActionGroup GetActionGroup(System.Type type) { diff --git a/pimp/Pimp/gtk-gui/gui.stetic b/ThePimp/gtk-gui/gui.stetic similarity index 91% rename from pimp/Pimp/gtk-gui/gui.stetic rename to ThePimp/gtk-gui/gui.stetic index e85c9b1..1fc972b 100644 --- a/pimp/Pimp/gtk-gui/gui.stetic +++ b/ThePimp/gtk-gui/gui.stetic @@ -4,6 +4,9 @@ .. 2.12.1 + + + @@ -275,9 +278,7 @@ None - - - + @@ -307,7 +308,17 @@ 5 - + + + 100 + Tools + + + 0 + True + False + False + @@ -325,7 +336,17 @@ 5 - + + + 100 + Layers & Channels + + + 0 + True + False + False + @@ -364,7 +385,7 @@ - + Open File stock:gtk-open Menu @@ -432,4 +453,12 @@ - \ No newline at end of file + + + + + + + + + diff --git a/ThePimp/gtk-gui/objects.xml b/ThePimp/gtk-gui/objects.xml new file mode 100644 index 0000000..1e2733a --- /dev/null +++ b/ThePimp/gtk-gui/objects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/configure.ac b/configure.ac index a91feed..5d48572 100644 --- a/configure.ac +++ b/configure.ac @@ -120,6 +120,13 @@ if test "${ac_cv_my_have_il}" = "no" -a "${ac_cv_my_have_ole}" = "no" -a "${ac_c AC_MSG_ERROR([[cannot find DevIL, OLE, SDL_Image, Imlib2 or OpenCV, please install one of them]]) fi +# Build The Pimp? +AC_PATH_PROG(GMCS, gmcs, no) +PKG_CHECK_MODULES([GLADE_SHARP_20], [glade-sharp-2.0], [:]) +PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:]) +PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:]) +AM_CONDITIONAL(USE_CSHARP, test "${gmcs}" != "no") + AC_CONFIG_FILES([ Makefile pipi/Makefile @@ -127,12 +134,14 @@ AC_CONFIG_FILES([ genethumb/Makefile examples/Makefile test/Makefile + pipi-sharp/Makefile + ThePimp/Makefile ]) AC_CONFIG_FILES([ pipi/pipi.pc + pipi-sharp/pipi-sharp.pc + pipi-sharp/pipi-sharp.dll.config ]) AC_OUTPUT -(cd pimp && ./configure) - diff --git a/pimp/.gitignore b/pimp/.gitignore deleted file mode 100644 index 28b37c4..0000000 --- a/pimp/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.userprefs -*.usertasks -*.pidb -*.exe -*.dll -*.pc -pimp -bin diff --git a/pimp/Makefile b/pimp/Makefile deleted file mode 100644 index 227e349..0000000 --- a/pimp/Makefile +++ /dev/null @@ -1,71 +0,0 @@ - -EXTRA_DIST = rules.make configure Makefile.include - -all: all-recursive - -top_srcdir=. -include $(top_srcdir)/config.make -include $(top_srcdir)/rules.make - -#include $(top_srcdir)/custom-hooks.make - -#Warning: This is an automatically generated file, do not edit! -ifeq ($(CONFIG),DEBUG) - SUBDIRS = Pipi Pimp -endif -ifeq ($(CONFIG),RELEASE) - SUBDIRS = Pipi Pimp -endif - - -CONFIG_MAKE=$(top_srcdir)/config.make - -%-recursive: $(CONFIG_MAKE) - @set . $$MAKEFLAGS; final_exit=:; \ - case $$2 in --unix) shift ;; esac; \ - case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \ - make pre-$*-hook prefix=$(prefix) ; \ - for dir in $(SUBDIRS); do \ - case $$dir in \ - .) make $*-local || { final_exit="exit 1"; $$dk; };;\ - *) (cd $$dir && make $*) || { final_exit="exit 1"; $$dk; };;\ - esac \ - done; \ - make post-$*-hook prefix=$(prefix) ; \ - $$final_exit - -$(CONFIG_MAKE): - echo "You must run configure first" - exit 1 - -clean distclean: clean-recursive -install: install-recursive -uninstall: uninstall-recursive - -dist: $(CONFIG_MAKE) - rm -rf $(PACKAGE)-$(VERSION) - mkdir $(PACKAGE)-$(VERSION) - make pre-dist-hook distdir=$$distdir - for dir in $(SUBDIRS); do \ - pkgdir=`pwd`/$(PACKAGE)-$(VERSION); \ - mkdir $$pkgdir/$$dir || true; \ - case $$dir in \ - .) make dist-local distdir=$$pkgdir || exit 1;; \ - *) (cd $$dir; make dist-local distdir=$$pkgdir/$$dir) || exit 1;; \ - esac \ - done - (make dist-local distdir=$(PACKAGE)-$(VERSION)) - make - make post-dist-hook distsir=$$distdir - tar czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) - rm -rf $(PACKAGE)-$(VERSION) - @echo "==========================================" - @echo "$(PACKAGE)-$(VERSION) has been packaged > $(PACKAGE)-$(VERSION).tar.gz" - @echo "==========================================" - -distcheck: dist - (mkdir test; cd test; \ - tar xzvf ../$(PACKAGE)-$(VERSION).tar.gz; cd $(PACKAGE)-$(VERSION); \ - ./configure --prefix=$$(cd `pwd`/..; pwd); \ - make && make install && make dist); - rm -rf test diff --git a/pimp/Makefile.include b/pimp/Makefile.include deleted file mode 100644 index e0eb56d..0000000 --- a/pimp/Makefile.include +++ /dev/null @@ -1,86 +0,0 @@ -VALID_CULTURES = ar bg ca zh-CHS cs da de el en es fi fr he hu is it ja ko nl no pl pt ro ru hr sk sq sv th tr id uk be sl et lv lt fa vi hy eu mk af fo hi sw gu ta te kn mr gl kok ar-SA bg-BG ca-ES zh-TW cs-CZ da-DK de-DE el-GR en-US fi-FI fr-FR he-IL hu-HU is-IS it-IT ja-JP ko-KR nl-NL nb-NO pl-PL pt-BR ro-RO ru-RU hr-HR sk-SK sq-AL sv-SE th-TH tr-TR id-ID uk-UA be-BY sl-SI et-EE lv-LV lt-LT fa-IR vi-VN hy-AM eu-ES mk-MK af-ZA fo-FO hi-IN sw-KE gu-IN ta-IN te-IN kn-IN mr-IN gl-ES kok-IN ar-IQ zh-CN de-CH en-GB es-MX fr-BE it-CH nl-BE nn-NO pt-PT sv-FI ar-EG zh-HK de-AT en-AU es-ES fr-CA ar-LY zh-SG de-LU en-CA es-GT fr-CH ar-DZ zh-MO en-NZ es-CR fr-LU ar-MA en-IE es-PA ar-TN en-ZA es-DO ar-OM es-VE ar-YE es-CO ar-SY es-PE ar-JO es-AR ar-LB en-ZW es-EC ar-KW en-PH es-CL ar-AE es-UY ar-BH es-PY ar-QA es-BO es-SV es-HN es-NI es-PR zh-CHT - -build_sources = $(FILES) $(GENERATED_FILES) -build_sources_embed = $(build_sources:%='$(srcdir)/%') - -comma__=, -get_resource_name = $(firstword $(subst $(comma__), ,$1)) -get_culture = $(lastword $(subst ., ,$(basename $1))) -is_cultured_resource = $(and $(word 3,$(subst ., ,$1)), $(filter $(VALID_CULTURES),$(lastword $(subst ., ,$(basename $1))))) - -build_resx_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, $(call get_resource_name,$(res))),$(res),)) -build_non_culture_resx_list = $(foreach res, $(build_resx_list),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res))) -build_non_culture_others_list = $(foreach res, $(filter-out $(build_resx_list),$(RESOURCES)),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res))) -build_others_list = $(build_non_culture_others_list) -build_xamlg_list = $(filter %.xaml.g.cs, $(FILES)) - -# resgen all .resx resources -build_resx_files = $(foreach res, $(build_resx_list), $(call get_resource_name,$(res))) -build_resx_resources = $(build_resx_files:.resx=.resources) - -# embed resources for the main assembly -build_resx_resources_hack = $(subst .resx,.resources, $(build_non_culture_resx_list)) -build_resx_resources_embed = $(build_resx_resources_hack:%='-resource:%') -build_others_files = $(foreach res, $(build_others_list),$(call get_resource_name,$(res))) -build_others_resources = $(build_others_files) -build_others_resources_embed = $(build_others_list:%='-resource:$(srcdir)/%') - -build_resources = $(build_resx_resources) $(build_others_resources) -build_resources_embed = $(build_resx_resources_embed) $(build_others_resources_embed) - -build_references_ref = $(foreach ref, $(REFERENCES), $(if $(filter -pkg:%, $(ref)), $(ref), $(if $(filter -r:%, $(ref)), $(ref), -r:$(ref)))) -build_references_ref += $(foreach ref, $(DLL_REFERENCES), -r:$(ref)) -build_references_ref += $(foreach ref, $(PROJECT_REFERENCES), -r:$(ref)) - -EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(build_culture_res_files) -CLEANFILES += $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources) $(build_satellite_assembly_list) -DISTCLEANFILES = $(GENERATED_FILES) $(pc_files) $(BUILD_DIR)/* - -pkglib_SCRIPTS = $(ASSEMBLY) -bin_SCRIPTS = $(BINARIES) - -linuxdesktopapplicationsdir = @datadir@/applications -linuxdesktopapplications_DATA = $(LINUX_DESKTOPAPPLICATIONS) -programfilesdir = @libdir@/@PACKAGE@ -programfiles_DATA = $(PROGRAMFILES) -linuxpkgconfigdir = @libdir@/pkgconfig -linuxpkgconfig_DATA = $(LINUX_PKGCONFIG) - - -# macros - -# $(call emit-deploy-target,deploy-variable-name) -define emit-deploy-target -$($1): $($1_SOURCE) - mkdir -p $$(dir $($1)) - cp '$$<' '$$@' -endef - -# $(call emit-deploy-wrapper,wrapper-variable-name,wrapper-sourcefile,x) -# assumes that for a wrapper foo.pc its source template is foo.pc.in -# if $3 is non-empty then wrapper is marked exec -define emit-deploy-wrapper -$($1): $2 $(top_srcdir)/config.make - mkdir -p '$$(@D)' - cp '$$<' '$$@' - $(if $3,chmod +x '$$@') - -$2: $2.in $(top_srcdir)/config.make - sed -e "s,@prefix@,$(prefix)," -e "s,@PACKAGE@,$(PACKAGE)," -e "s,@expanded_libdir@,$(libdir)," -e "s,@expanded_bindir@,$(bindir)," -e "s,@expanded_datadir@,$(datadir)," < $2.in > $2 -endef - -# generating satellite assemblies - -culture_resources = $(foreach res, $(RESOURCES), $(if $(call is_cultured_resource,$(call get_resource_name, $(res))),$(res))) -cultures = $(sort $(foreach res, $(culture_resources), $(call get_culture,$(call get_resource_name,$(res))))) -culture_resource_dependencies = $(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): $(subst .resx,.resources,$2) -culture_resource_commandlines = cmd_line_satellite_$1 += '/embed:$(subst .resx,.resources,$2)' -build_satellite_assembly_list = $(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME)) -build_culture_res_files = $(foreach res, $(culture_resources),$(call get_resource_name,$(res))) - -$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_dependencies,$(call get_culture,$(call get_resource_name,$(res))),$(call get_resource_name,$(res)))))) -$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_commandlines,$(call get_culture,$(call get_resource_name,$(res))),$(res))))) - -$(build_satellite_assembly_list): $(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME): - mkdir -p '$(@D)' - $(AL) -out:'$@' -culture:$* -t:lib $(cmd_line_satellite_$*) \ No newline at end of file diff --git a/pimp/Pimp.make b/pimp/Pimp.make deleted file mode 100644 index 60600ed..0000000 --- a/pimp/Pimp.make +++ /dev/null @@ -1,91 +0,0 @@ - - -# Warning: This is an automatically generated file, do not edit! - -if ENABLE_DEBUG -ASSEMBLY_COMPILER_COMMAND = gmcs -ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG" - -ASSEMBLY = bin/Debug/pimp.exe -ASSEMBLY_MDB = $(ASSEMBLY).mdb -COMPILE_TARGET = exe -PROJECT_REFERENCES = -BUILD_DIR = bin/Debug - -PIMP_DESKTOP_SOURCE=app.desktop - -endif - -if ENABLE_RELEASE -ASSEMBLY_COMPILER_COMMAND = gmcs -ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -ASSEMBLY = bin/Release/pimp.exe -ASSEMBLY_MDB = -COMPILE_TARGET = exe -PROJECT_REFERENCES = -BUILD_DIR = bin/Release - -PIMP_DESKTOP_SOURCE=app.desktop - -endif - -AL=al2 -SATELLITE_ASSEMBLY_NAME=.resources.dll - -LINUX_DESKTOPAPPLICATIONS = \ - $(PIMP_DESKTOP) - -BINARIES = \ - $(PIMP) - - - -all: $(ASSEMBLY) $(LINUX_DESKTOPAPPLICATIONS) $(BINARIES) - -FILES = \ - gtk-gui/generated.cs \ - MainWindow.cs \ - gtk-gui/MainWindow.cs \ - Main.cs \ - AssemblyInfo.cs \ - OpenFile.cs \ - gtk-gui/Pimp.OpenFile.cs - -DATA_FILES = \ - app.desktop - -RESOURCES = \ - gtk-gui/gui.stetic - -EXTRAS = \ - pimp.in - -REFERENCES = \ - $(GTK_SHARP_20_LIBS) \ - $(GLIB_SHARP_20_LIBS) \ - $(GLADE_SHARP_20_LIBS) \ - System \ - Mono.Posix - -DLL_REFERENCES = - -CLEANFILES = $(LINUX_DESKTOPAPPLICATIONS) $(BINARIES) - -include $(top_srcdir)/Makefile.include - -PIMP = $(BUILD_DIR)/pimp -PIMP_DESKTOP = $(BUILD_DIR)/pimp.desktop - -$(eval $(call emit-deploy-wrapper,PIMP,pimp,x)) -$(eval $(call emit-deploy-target,PIMP_DESKTOP)) - - -$(build_xamlg_list): %.xaml.g.cs: %.xaml - xamlg '$<' - -$(build_resx_resources) : %.resources: %.resx - resgen2 '$<' '$@' - -$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list) - mkdir -p $(dir $(ASSEMBLY)) - $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref) diff --git a/pimp/Pimp.mds b/pimp/Pimp.mds deleted file mode 100644 index 9ecc0e0..0000000 --- a/pimp/Pimp.mds +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/pimp/Pimp/OpenFile.cs b/pimp/Pimp/OpenFile.cs deleted file mode 100644 index 0368066..0000000 --- a/pimp/Pimp/OpenFile.cs +++ /dev/null @@ -1,18 +0,0 @@ -// OpenFile.cs created with MonoDevelop -// User: sam at 23:05 03/10/2008 -// -// To change standard headers go to Edit->Preferences->Coding->Standard Headers -// - -using System; - -namespace Pimp -{ - public partial class OpenFile : Gtk.Dialog - { - public OpenFile() - { - this.Build(); - } - } -} diff --git a/pimp/Pimp/pimp.in b/pimp/Pimp/pimp.in deleted file mode 100644 index 1e0cf2e..0000000 --- a/pimp/Pimp/pimp.in +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec mono "@expanded_libdir@/@PACKAGE@/Pimp.exe" "$@" diff --git a/pimp/Pipi/pipi-sharp.dll.config b/pimp/Pipi/pipi-sharp.dll.config deleted file mode 100644 index c4ad2a0..0000000 --- a/pimp/Pipi/pipi-sharp.dll.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/pimp/config.log b/pimp/config.log deleted file mode 100644 index ba0328c..0000000 --- a/pimp/config.log +++ /dev/null @@ -1,4 +0,0 @@ -Looking for required packages -Checking for package 'glade-sharp-2.0'.. found. -Checking for package 'glib-sharp-2.0'.. found. -Checking for package 'gtk-sharp-2.0'.. found. diff --git a/pimp/config.make b/pimp/config.make deleted file mode 100644 index b328722..0000000 --- a/pimp/config.make +++ /dev/null @@ -1,9 +0,0 @@ -prefix=/usr/local -libdir=/usr/local/lib -bindir=/usr/local/bin -datadir=/usr/local/share -RUNTIME=mono -ASSEMBLY_VERSION=0.1.0.0 -VERSION=0.1 -PACKAGE=pimp -CONFIG=DEBUG diff --git a/pimp/configure b/pimp/configure deleted file mode 100755 index 829ba11..0000000 --- a/pimp/configure +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -VERSION=0.1 -PACKAGE=pimp -prefix=/usr/local -config=RELEASE -configurations=" RELEASE DEBUG" -common_packages=" glade-sharp-2.0;2.12.1 glib-sharp-2.0;2.12.1 gtk-sharp-2.0;2.12.1" - - -usage () -{ - echo "Usage : configure [OPTION]... [--config=CONFIG]" - echo - echo "Options:" - echo " --prefix=PREFIX install architecture-independent files in PREFIX" - echo " [/usr/local]" - echo " --bindir=DIR user executables [PREFIX/bin]" - echo " --datadir=DIR read-only architecture-independent data [PREFIX/share]" - echo " --libdir=DIR object code libraries [PREFIX/lib]" - echo - echo "Configurations available :" - for c in $configurations; do - if [ "$c" = "$config" ]; then - echo " $c (Default)" - else - echo " $c" - fi - done -} - -validate_config () -{ - test -z "$1" && return 0 - for c in $configurations; do - if [ "$c" = "$1" ]; then - return 1 - fi - done - return 0 -} - -check_package () -{ - name=`echo $1 | cut -d\; -f1` - version=`echo $1 | cut -d\; -f2` - - echo -n "Checking for package '$name'.." | tee -a config.log - pkg-config --atleast-version=$version $name - if [ $? -ne 0 ]; then - echo " ERROR: Package named '$name' >= $version not found." | tee -a config.log - echo "Try adjusting your PKG_CONFIG_PATH environment variable." | tee -a config.log - return 1 - fi - echo " found." | tee -a config.log -} - -check_required_packages () -{ - echo "Looking for required packages" | tee config.log - var=required_packages_$config - for pkg in $common_packages ${!var}; do - check_package $pkg - retval=$? - [ $retval -ne 0 ] && return $retval - done - return 0 -} - -while test x$1 != x; do - case $1 in - --prefix=*) - prefix=`echo $1 | sed 's/--prefix=//'` - ;; - --prefix) - shift - prefix=$1 - ;; - --libdir=*) - libdir=`echo $1 | sed 's/--libdir=//'` - ;; - --libdir) - shift - libdir=$1 - ;; - --bindir=*) - bindir=`echo $1 | sed 's/--bindir=//'` - ;; - --bindir) - shift - bindir=$1 - ;; - --datadir=*) - datadir=`echo $1 | sed 's/--datadir=//'` - ;; - --datadir) - shift - datadir=$1 - ;; - --config=*) - conf=`echo $1 | sed 's/--config=//'` - validate_config "$conf" - if [ $? -eq 1 ]; then - config=$conf - else - echo "Invalid config name - $conf" - usage - exit 1 - fi - ;; - --help) - usage - exit - ;; - *) - echo Unknown argument $1 >&2 - usage - exit 1 - ;; - esac - shift -done - -check_required_packages -[ $? -eq 1 ] && exit 1 - -if [ -z "$libdir" ]; then - libdir=$prefix/lib -fi -if [ -z "$bindir" ]; then - bindir=$prefix/bin -fi -if [ -z "$datadir" ]; then - datadir=$prefix/share -fi - -echo "prefix=$prefix" > config.make -echo "libdir=$libdir" >> config.make -echo "bindir=$bindir" >> config.make -echo "datadir=$datadir" >> config.make -echo "RUNTIME=mono" >> config.make -echo "ASSEMBLY_VERSION=$VERSION.0.0" >> config.make -echo "VERSION=$VERSION" >> config.make -echo "PACKAGE=$PACKAGE" >> config.make -echo "CONFIG=$config" >> config.make - -echo -echo "$PACKAGE has been configured with " -echo " prefix = $prefix" -if [ "$libdir" != "$prefix/lib" ]; then - echo " libdir = $libdir" -fi -if [ "$bindir" != "$prefix/bin" ]; then - echo " bindir = $bindir" -fi -if [ "$datadir" != "$prefix/share" ]; then - echo " datadir = $datadir" -fi -echo " config = $config" -echo diff --git a/pimp/rules.make b/pimp/rules.make deleted file mode 100644 index 5f906b2..0000000 --- a/pimp/rules.make +++ /dev/null @@ -1,40 +0,0 @@ -clean-local: - make pre-clean-local-hook - make $(CONFIG)_BeforeClean - -rm -f $(CLEANFILES) - make $(CONFIG)_AfterClean - make post-clean-local-hook - -install-local: -uninstall-local: - -dist-local: - make pre-dist-local-hook distdir=$$distdir - list='$(EXTRA_DIST)'; \ - for f in Makefile $$list; do \ - d=`dirname "$$f"`; \ - test -d "$(distdir)/$$d" || \ - mkdir -p "$(distdir)/$$d"; \ - cp -p "$$f" "$(distdir)/$$d" || exit 1; \ - done - make post-dist-local-hook distdir=$$distdir - -dist-local-recursive: - for dir in $(SUBDIRS); do \ - mkdir -p $(distdir)/$$dir || true; \ - case $$dir in \ - .) make dist-local distdir=$(distdir) || exit 1;; \ - *) (cd $$dir; make dist-local distdir=$(distdir)/$$dir) || exit 1; \ - esac \ - done - -#hooks: Available hooks - all, clean, install, uninstall and dist -# and their *-local variants -pre-%-hook: ; @: -post-%-hook: ; @: - -#targets for custom commands -%_BeforeBuild: ; @: -%_AfterBuild: ; @: -%_BeforeClean: ; @: -%_AfterClean: ; @: diff --git a/pipi-sharp/.gitignore b/pipi-sharp/.gitignore new file mode 100644 index 0000000..9580c15 --- /dev/null +++ b/pipi-sharp/.gitignore @@ -0,0 +1,4 @@ +*.pidb +*.exe +*.dll +pipi-sharp.pc diff --git a/pimp/Pipi/AssemblyInfo.cs b/pipi-sharp/AssemblyInfo.cs similarity index 100% rename from pimp/Pipi/AssemblyInfo.cs rename to pipi-sharp/AssemblyInfo.cs diff --git a/pipi-sharp/Makefile.am b/pipi-sharp/Makefile.am new file mode 100644 index 0000000..744b69a --- /dev/null +++ b/pipi-sharp/Makefile.am @@ -0,0 +1,30 @@ +# $Id: $ + +pipidir = $(libdir)/pipi-sharp + +pipi_sources = \ + $(srcdir)/AssemblyInfo.cs \ + $(srcdir)/Pipi.cs \ + $(srcdir)/Picture.cs + +test_sources = \ + $(srcdir)/test.cs + +if USE_CSHARP +pipi_DATA = pipi-sharp.dll pipi-sharp.dll.config +noinst_DATA = test.exe +endif + +EXTRA_DIST = $(pipi_sources) $(test_sources) \ + pipi-sharp.pc.in pipi-sharp.dll.config.in + +pipi-sharp.dll: $(pipi_sources) + gmcs -unsafe $(pipi_sources) -out:$@ -target:library + +test.exe: $(test_sources) pipi-sharp.dll + gmcs $(test_sources) -out:$@ -lib:./ \ + -r:./pipi-sharp.dll + +clean-local: + rm -f *.exe *.dll *.mdb + diff --git a/pipi-sharp/Picture.cs b/pipi-sharp/Picture.cs new file mode 100644 index 0000000..28b8289 --- /dev/null +++ b/pipi-sharp/Picture.cs @@ -0,0 +1,57 @@ +// MyClass.cs created with MonoDevelop +// User: sam at 13:14 04/10/2008 +// +// To change standard headers go to Edit->Preferences->Coding->Standard Headers +// + +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace Pipi +{ + public class Picture + { + private IntPtr _picture; + + [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), + SuppressUnmanagedCodeSecurity] + private static extern IntPtr pipi_load(string s); + public Picture(string s) + { + _picture = pipi_load(s); + } + + [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), + SuppressUnmanagedCodeSecurity] + private static extern int pipi_free(IntPtr img); + ~Picture() + { + pipi_free(_picture); + } + + [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), + SuppressUnmanagedCodeSecurity] + private static extern IntPtr pipi_save(IntPtr p, string s); + public void Save(string s) + { + _picture = pipi_save(_picture, s); + } + + [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), + SuppressUnmanagedCodeSecurity] + private static extern int pipi_get_image_width(IntPtr img); + public int Width + { + get { return pipi_get_image_width(_picture); } + } + + [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), + SuppressUnmanagedCodeSecurity] + private static extern int pipi_get_image_height(IntPtr img); + public int Height + { + get { return pipi_get_image_height(_picture); } + } + } +} diff --git a/pimp/Pipi/Pipi.cs b/pipi-sharp/Pipi.cs similarity index 100% rename from pimp/Pipi/Pipi.cs rename to pipi-sharp/Pipi.cs diff --git a/pipi-sharp/pipi-sharp.dll.config b/pipi-sharp/pipi-sharp.dll.config new file mode 100644 index 0000000..77c2739 --- /dev/null +++ b/pipi-sharp/pipi-sharp.dll.config @@ -0,0 +1,3 @@ + + + diff --git a/pipi-sharp/pipi-sharp.dll.config.in b/pipi-sharp/pipi-sharp.dll.config.in new file mode 100644 index 0000000..9e302f8 --- /dev/null +++ b/pipi-sharp/pipi-sharp.dll.config.in @@ -0,0 +1,3 @@ + + + diff --git a/pimp/Pipi/Pipi.mdp b/pipi-sharp/pipi-sharp.mdp similarity index 82% rename from pimp/Pipi/Pipi.mdp rename to pipi-sharp/pipi-sharp.mdp index 5c9d723..1b6f366 100644 --- a/pimp/Pipi/Pipi.mdp +++ b/pipi-sharp/pipi-sharp.mdp @@ -1,13 +1,13 @@ - + - + - + @@ -15,6 +15,7 @@ + diff --git a/pimp/Pipi/pipi.pc.in b/pipi-sharp/pipi-sharp.pc.in similarity index 100% rename from pimp/Pipi/pipi.pc.in rename to pipi-sharp/pipi-sharp.pc.in diff --git a/pipi-sharp/test.cs b/pipi-sharp/test.cs new file mode 100644 index 0000000..34444c1 --- /dev/null +++ b/pipi-sharp/test.cs @@ -0,0 +1,31 @@ +/* + * Test .NET bindings test program + * Copyright (c) 2008 Sam Hocevar + * All Rights Reserved + * + * $Id$ + * + * This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. + */ + + +using System; + +using Pipi; + +class Test +{ + public static void Main() + { + Console.WriteLine("libpipi {0} .NET test", Libpipi.getVersion()); + Console.WriteLine("(c) 2008 Sam Hocevar "); + + Pipi.Picture p = new Pipi.Picture("random:640x480"); + Console.WriteLine("Test picture size: {0}x{1}", p.Width, p.Height); + } +} +