Browse Source

Start playing with scrolling widgets in Pimp.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2872 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 years ago
parent
commit
5dc12d0c28
16 changed files with 254 additions and 110 deletions
  1. +12
    -3
      ThePimp/AssemblyInfo.cs
  2. +12
    -3
      ThePimp/Main.cs
  3. +19
    -6
      ThePimp/MainWindow.cs
  4. +1
    -2
      ThePimp/Makefile.am
  5. +11
    -3
      ThePimp/OpenFile.cs
  6. +105
    -8
      ThePimp/PictureView.cs
  7. +4
    -2
      ThePimp/ThePimp.mdp
  8. +21
    -0
      ThePimp/ToolBox.cs
  9. +18
    -36
      ThePimp/gtk-gui/MainWindow.cs
  10. +3
    -9
      ThePimp/gtk-gui/ThePimp.ToolBox.cs
  11. +9
    -29
      ThePimp/gtk-gui/gui.stetic
  12. +4
    -0
      ThePimp/gtk-gui/objects.xml
  13. +1
    -0
      pipi-sharp/.gitignore
  14. +12
    -3
      pipi-sharp/AssemblyInfo.cs
  15. +11
    -3
      pipi-sharp/Picture.cs
  16. +11
    -3
      pipi-sharp/Pipi.cs

+ 12
- 3
ThePimp/AssemblyInfo.cs View File

@@ -1,8 +1,17 @@
// AssemblyInfo.cs created with MonoDevelop
// User: sam at 10:31 AM 9/2/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// The Pimp The Pathetic Image Manipulation Program
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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.Reflection;
using System.Runtime.CompilerServices;



+ 12
- 3
ThePimp/Main.cs View File

@@ -1,8 +1,17 @@
// Main.cs created with MonoDevelop
// User: sam at 10:31 AM 9/2/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// The Pimp The Pathetic Image Manipulation Program
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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 Gtk;



+ 19
- 6
ThePimp/MainWindow.cs View File

@@ -1,21 +1,33 @@
// MainWindow.cs created with MonoDevelop
// User: sam at 10:31 AM 9/2/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// The Pimp The Pathetic Image Manipulation Program
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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 Gtk;
using Pipi;
using ThePimp;

public partial class MainWindow: Gtk.Window
{
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
Title += " v" + Libpipi.getVersion();

notebook1.Add(new PictureView(new Pipi.Picture("random:1024x1024")));
//scrolledwindow1.Add(new PictureView(new Pipi.Picture("random:1024x1024")));
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
@@ -30,7 +42,8 @@ public partial class MainWindow: Gtk.Window
if(p != null)
{
Title += " image " + p.Width + "x" + p.Height;
scrolledwindow1.Add(new PictureView(p));
notebook1.RemovePage(0);
notebook1.AppendPage(new PictureView(p), null);
}
}



+ 1
- 2
ThePimp/Makefile.am View File

@@ -3,11 +3,10 @@
pimp_sources = \
$(srcdir)/AssemblyInfo.cs \
$(srcdir)/Main.cs \
$(srcdir)/PictureView.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



+ 11
- 3
ThePimp/OpenFile.cs View File

@@ -1,7 +1,15 @@
// OpenFile.cs created with MonoDevelop
// User: sam at 23:05 03/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// The Pimp The Pathetic Image Manipulation Program
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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;


+ 105
- 8
ThePimp/PictureView.cs View File

@@ -1,7 +1,15 @@
// PictureView.cs created with MonoDevelop
// User: sam at 22:59 04/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// The Pimp The Pathetic Image Manipulation Program
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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;
@@ -10,16 +18,105 @@ using Pipi;

namespace ThePimp
{
public partial class PictureView : Gtk.Bin
public class PictureArea : Gtk.DrawingArea
{
protected override void OnSetScrollAdjustments (Adjustment hAdjustement, Adjustment vAdjustement)
private Pipi.Picture _p;
private Pango.Layout _l;
private Adjustment _hadj = null, _vadj = null;

void HAdjust(object sender, EventArgs args)
{
QueueDraw();
}

void VAdjust(object sender, EventArgs args)
{
QueueDraw();
}

protected override bool OnExposeEvent(Gdk.EventExpose e)
{
bool ret = base.OnExposeEvent(e);
//Console.WriteLine("expose {0}x{1}+{2}+{3}", e.Area.Width, e.Area.Height, e.Area.X, e.Area.Y);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 40 - (int)_hadj.Value, 40 - (int)_vadj.Value, _l);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 560 - (int)_hadj.Value, 40 - (int)_vadj.Value, _l);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 40 - (int)_hadj.Value, 560 - (int)_vadj.Value, _l);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 560 - (int)_hadj.Value, 560 - (int)_vadj.Value, _l);
return ret;
}

protected override void OnRealized()
{
_l = new Pango.Layout(PangoContext);
_l.Wrap = Pango.WrapMode.Word;
_l.FontDescription = Pango.FontDescription.FromString("Tahoma 64");
_l.SetMarkup("WHAT THE\nFUCK IS\nTHIS SHIT\nLOL ♥ ♥");
base.OnRealized();
}

protected override void OnSetScrollAdjustments(Adjustment hadj,
Adjustment vadj)
{
Console.WriteLine("LOL WHAT");
_hadj = hadj;
_vadj = vadj;
if(hadj != null)
hadj.ValueChanged += HAdjust;
if(vadj != null)
vadj.ValueChanged += VAdjust;
}

protected override void OnSizeAllocated(Gdk.Rectangle alloc)
{
base.OnSizeAllocated(alloc);

if(_hadj != null)
{
_hadj.SetBounds(0, _p.Width, 1, alloc.Width, alloc.Width);
if(_hadj.Value + alloc.Width > _p.Width)
{
_hadj.Value = _p.Width - alloc.Width;
_hadj.ChangeValue();
}
}

if(_vadj != null)
{
_vadj.SetBounds(0, _p.Height, 1, alloc.Height, alloc.Height);
if(_vadj.Value + alloc.Height > _p.Height)
{
_vadj.Value = _p.Height - alloc.Height;
_vadj.ChangeValue();
}
}
}

protected override void OnDestroyed()
{
if(_hadj != null)
{
_hadj.ValueChanged -= HAdjust;
_hadj = null;
}

if(_vadj != null)
{
_vadj.ValueChanged -= VAdjust;
_vadj = null;
}
}

public PictureArea(Picture p)
{
_p = p;
}
}

public class PictureView : Gtk.ScrolledWindow
{
public PictureView(Picture p)
{
this.Build();
Add(new PictureArea(p));
ShowAll();
}
}
}

+ 4
- 2
ThePimp/ThePimp.mdp View File

@@ -28,10 +28,11 @@
<File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
<File name="app.desktop" subtype="Code" buildaction="FileCopy" DeployService.TargetDirectoryId="Linux.DesktopApplications" />
<File name="OpenFile.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/Pimp.OpenFile.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/objects.xml" subtype="Code" buildaction="EmbedAsResource" />
<File name="PictureView.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/ThePimp.PictureView.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/ThePimp.OpenFile.cs" subtype="Code" buildaction="Compile" />
<File name="ToolBox.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/ThePimp.ToolBox.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
@@ -47,6 +48,7 @@
<GtkDesignInfo gtkVersion="2.12.1">
<ExportedWidgets>
<Widget>ThePimp.PictureView</Widget>
<Widget>ThePimp.ToolBox</Widget>
</ExportedWidgets>
</GtkDesignInfo>
</Project>

+ 21
- 0
ThePimp/ToolBox.cs View File

@@ -0,0 +1,21 @@
// ToolBox.cs created with MonoDevelop
// User: sam at 12:31 05/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;

namespace ThePimp
{
public partial class ToolBox : Gtk.Bin
{
public ToolBox()
{
this.Build();
}
}
}

+ 18
- 36
ThePimp/gtk-gui/MainWindow.cs View File

@@ -78,10 +78,6 @@ public partial class MainWindow {
private Gtk.Notebook notebook1;
private Gtk.ScrolledWindow scrolledwindow1;
private Gtk.Label label1;
private Gtk.VPaned vpaned1;
private Gtk.VBox vbox2;
@@ -232,23 +228,9 @@ public partial class MainWindow {
this.notebook1.Name = "notebook1";
this.notebook1.CurrentPage = 0;
this.notebook1.BorderWidth = ((uint)(5));
// Container child notebook1.Gtk.Notebook+NotebookChild
this.scrolledwindow1 = new Gtk.ScrolledWindow();
this.scrolledwindow1.WidthRequest = 640;
this.scrolledwindow1.HeightRequest = 480;
this.scrolledwindow1.CanFocus = true;
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1));
this.notebook1.Add(this.scrolledwindow1);
// Notebook tab
this.label1 = new Gtk.Label();
this.label1.Name = "label1";
this.label1.LabelProp = Mono.Unix.Catalog.GetString("Test tab");
this.notebook1.SetTabLabel(this.scrolledwindow1, this.label1);
this.label1.ShowAll();
this.hpaned1.Add(this.notebook1);
Gtk.Paned.PanedChild w6 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1]));
w6.Resize = false;
Gtk.Paned.PanedChild w5 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1]));
w5.Resize = false;
// Container child hpaned1.Gtk.Paned+PanedChild
this.vpaned1 = new Gtk.VPaned();
this.vpaned1.CanFocus = true;
@@ -264,13 +246,13 @@ public partial class MainWindow {
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;
Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.label2]));
w6.Position = 0;
w6.Expand = false;
w6.Fill = false;
this.vpaned1.Add(this.vbox2);
Gtk.Paned.PanedChild w8 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2]));
w8.Resize = false;
Gtk.Paned.PanedChild w7 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2]));
w7.Resize = false;
// Container child vpaned1.Gtk.Paned+PanedChild
this.vbox3 = new Gtk.VBox();
this.vbox3.Name = "vbox3";
@@ -281,24 +263,24 @@ public partial class MainWindow {
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;
Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox3[this.label3]));
w8.Position = 0;
w8.Expand = false;
w8.Fill = false;
this.vpaned1.Add(this.vbox3);
this.hpaned1.Add(this.vpaned1);
this.vbox1.Add(this.hpaned1);
Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1]));
w12.Position = 2;
Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1]));
w11.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 w13 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
w13.Position = 3;
w13.Expand = false;
w13.Fill = false;
Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
w12.Position = 3;
w12.Expand = false;
w12.Fill = false;
this.Add(this.vbox1);
if ((this.Child != null)) {
this.Child.ShowAll();


ThePimp/gtk-gui/ThePimp.PictureView.cs → ThePimp/gtk-gui/ThePimp.ToolBox.cs View File

@@ -11,19 +11,13 @@
namespace ThePimp {
public partial class PictureView {
private Gtk.DrawingArea drawingarea1;
public partial class ToolBox {
protected virtual void Build() {
Stetic.Gui.Initialize(this);
// Widget ThePimp.PictureView
// Widget ThePimp.ToolBox
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);
this.Name = "ThePimp.ToolBox";
if ((this.Child != null)) {
this.Child.ShowAll();
}

+ 9
- 29
ThePimp/gtk-gui/gui.stetic View File

@@ -267,31 +267,7 @@
<property name="CurrentPage">0</property>
<property name="BorderWidth">5</property>
<child>
<widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
<property name="MemberName" />
<property name="WidthRequest">640</property>
<property name="HeightRequest">480</property>
<property name="CanFocus">True</property>
<property name="ShadowType">In</property>
<child>
<widget class="Gtk.Viewport" id="GtkViewport">
<property name="MemberName" />
<property name="ShadowType">None</property>
<child>
<placeholder />
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="Gtk.Label" id="label1">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">Test tab</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
<placeholder />
</child>
</widget>
<packing>
@@ -453,12 +429,16 @@
</widget>
</child>
</widget>
<widget class="Gtk.Bin" id="ThePimp.ToolBox" design-size="300 300">
<property name="MemberName" />
<child>
<placeholder />
</child>
</widget>
<widget class="Gtk.Bin" id="ThePimp.PictureView" design-size="300 300">
<property name="MemberName" />
<child>
<widget class="Gtk.DrawingArea" id="drawingarea1">
<property name="MemberName" />
</widget>
<placeholder />
</child>
</widget>
</stetic-interface>
</stetic-interface>

+ 4
- 0
ThePimp/gtk-gui/objects.xml View File

@@ -3,4 +3,8 @@
<itemgroups />
<signals />
</object>
<object type="ThePimp.ToolBox" palette-category="ThePimp" allow-children="false" base-type="Gtk.Bin">
<itemgroups />
<signals />
</object>
</objects>

+ 1
- 0
pipi-sharp/.gitignore View File

@@ -1,4 +1,5 @@
*.pidb
*.mdb
*.exe
*.dll
pipi-sharp.pc

+ 12
- 3
pipi-sharp/AssemblyInfo.cs View File

@@ -1,8 +1,17 @@
// AssemblyInfo.cs created with MonoDevelop
// User: sam at 13:14 04/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// libpipi Pathetic image processing interface library
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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.Reflection;
using System.Runtime.CompilerServices;



+ 11
- 3
pipi-sharp/Picture.cs View File

@@ -1,7 +1,15 @@
// MyClass.cs created with MonoDevelop
// User: sam at 13:14 04/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// libpipi Pathetic image processing interface library
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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;


+ 11
- 3
pipi-sharp/Pipi.cs View File

@@ -1,7 +1,15 @@
// MyClass.cs created with MonoDevelop
// User: sam at 13:14 04/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
// libpipi Pathetic image processing interface library
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
// All Rights Reserved
//
// $Id$
//
// This library 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;


Loading…
Cancel
Save