Changeset 2872 for libpipi


Ignore:
Timestamp:
Oct 5, 2008, 10:30:14 PM (12 years ago)
Author:
Sam Hocevar
Message:

Start playing with scrolling widgets in Pimp.

Location:
libpipi/trunk
Files:
1 added
14 edited
1 moved

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/ThePimp/AssemblyInfo.cs

    r2869 r2872  
    1 // AssemblyInfo.cs created with MonoDevelop
    2 // User: sam at 10:31 AM 9/2/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  The Pimp      The Pathetic Image Manipulation Program
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
    55//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
     13//
     14
    615using System.Reflection;
    716using System.Runtime.CompilerServices;
  • libpipi/trunk/ThePimp/Main.cs

    r2869 r2872  
    1 // Main.cs created with MonoDevelop
    2 // User: sam at 10:31 AM 9/2/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  The Pimp      The Pathetic Image Manipulation Program
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
    55//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
     13//
     14
    615using System;
    716using Gtk;
  • libpipi/trunk/ThePimp/MainWindow.cs

    r2869 r2872  
    1 // MainWindow.cs created with MonoDevelop
    2 // User: sam at 10:31 AM 9/2/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  The Pimp      The Pathetic Image Manipulation Program
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
    55//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
     13//
     14
    615using System;
    716using Gtk;
     
    1019
    1120public partial class MainWindow: Gtk.Window
    12 {   
     21{
    1322    public MainWindow (): base (Gtk.WindowType.Toplevel)
    1423    {
    1524        Build ();
    1625        Title += " v" + Libpipi.getVersion();
     26
     27        notebook1.Add(new PictureView(new Pipi.Picture("random:1024x1024")));
     28        //scrolledwindow1.Add(new PictureView(new Pipi.Picture("random:1024x1024")));
    1729    }
    18    
     30
    1931    protected void OnDeleteEvent (object sender, DeleteEventArgs a)
    2032    {
     
    3143        {
    3244            Title += " image " + p.Width + "x" + p.Height;
    33             scrolledwindow1.Add(new PictureView(p));
     45            notebook1.RemovePage(0);
     46            notebook1.AppendPage(new PictureView(p), null);
    3447        }
    3548    }
  • libpipi/trunk/ThePimp/Makefile.am

    r2869 r2872  
    44        $(srcdir)/AssemblyInfo.cs \
    55        $(srcdir)/Main.cs \
     6        $(srcdir)/PictureView.cs \
    67        $(srcdir)/gtk-gui/generated.cs \
    78        $(srcdir)/OpenFile.cs \
    89        $(srcdir)/gtk-gui/ThePimp.OpenFile.cs \
    9         $(srcdir)/PictureView.cs \
    10         $(srcdir)/gtk-gui/ThePimp.PictureView.cs \
    1110        $(srcdir)/MainWindow.cs \
    1211        $(srcdir)/gtk-gui/MainWindow.cs
  • libpipi/trunk/ThePimp/OpenFile.cs

    r2869 r2872  
    1 // OpenFile.cs created with MonoDevelop
    2 // User: sam at 23:05 03/10/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  The Pimp      The Pathetic Image Manipulation Program
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
     5//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
    513//
    614
  • libpipi/trunk/ThePimp/PictureView.cs

    r2869 r2872  
    1 // PictureView.cs created with MonoDevelop
    2 // User: sam at 22:59 04/10/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  The Pimp      The Pathetic Image Manipulation Program
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
     5//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
    513//
    614
     
    1119namespace ThePimp
    1220{
    13     public partial class PictureView : Gtk.Bin
     21    public class PictureArea : Gtk.DrawingArea
    1422    {
    15         protected override void OnSetScrollAdjustments (Adjustment hAdjustement, Adjustment vAdjustement)
     23        private Pipi.Picture _p;
     24        private Pango.Layout _l;
     25        private Adjustment _hadj = null, _vadj = null;
     26
     27        void HAdjust(object sender, EventArgs args)
    1628        {
    17             Console.WriteLine("LOL WHAT");
     29            QueueDraw();
    1830        }
    19        
     31
     32        void VAdjust(object sender, EventArgs args)
     33        {
     34            QueueDraw();
     35        }
     36
     37        protected override bool OnExposeEvent(Gdk.EventExpose e)
     38        {
     39            bool ret = base.OnExposeEvent(e);
     40            //Console.WriteLine("expose {0}x{1}+{2}+{3}", e.Area.Width, e.Area.Height, e.Area.X, e.Area.Y);
     41            GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 40 - (int)_hadj.Value, 40 - (int)_vadj.Value, _l);
     42            GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 560 - (int)_hadj.Value, 40 - (int)_vadj.Value, _l);
     43            GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 40 - (int)_hadj.Value, 560 - (int)_vadj.Value, _l);
     44            GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), 560 - (int)_hadj.Value, 560 - (int)_vadj.Value, _l);
     45            return ret;
     46        }
     47
     48        protected override void OnRealized()
     49        {
     50            _l = new Pango.Layout(PangoContext);
     51            _l.Wrap = Pango.WrapMode.Word;
     52            _l.FontDescription = Pango.FontDescription.FromString("Tahoma 64");
     53            _l.SetMarkup("WHAT THE\nFUCK IS\nTHIS SHIT\nLOL ♥ ♥");
     54            base.OnRealized();
     55        }
     56
     57        protected override void OnSetScrollAdjustments(Adjustment hadj,
     58                                                       Adjustment vadj)
     59        {
     60            _hadj = hadj;
     61            _vadj = vadj;
     62            if(hadj != null)
     63                hadj.ValueChanged += HAdjust;
     64            if(vadj != null)
     65                vadj.ValueChanged += VAdjust;
     66        }
     67
     68        protected override void OnSizeAllocated(Gdk.Rectangle alloc)
     69        {
     70            base.OnSizeAllocated(alloc);
     71
     72            if(_hadj != null)
     73            {
     74                _hadj.SetBounds(0, _p.Width, 1, alloc.Width, alloc.Width);
     75                if(_hadj.Value + alloc.Width > _p.Width)
     76                {
     77                    _hadj.Value = _p.Width - alloc.Width;
     78                    _hadj.ChangeValue();
     79                }
     80            }
     81
     82            if(_vadj != null)
     83            {
     84                _vadj.SetBounds(0, _p.Height, 1, alloc.Height, alloc.Height);
     85                if(_vadj.Value + alloc.Height > _p.Height)
     86                {
     87                    _vadj.Value = _p.Height - alloc.Height;
     88                    _vadj.ChangeValue();
     89                }
     90            }
     91        }
     92
     93        protected override void OnDestroyed()
     94        {
     95            if(_hadj != null)
     96            {
     97                _hadj.ValueChanged -= HAdjust;
     98                _hadj = null;
     99            }
     100
     101            if(_vadj != null)
     102            {
     103                _vadj.ValueChanged -= VAdjust;
     104                _vadj = null;
     105            }
     106        }
     107
     108        public PictureArea(Picture p)
     109        {
     110            _p = p;
     111        }
     112    }
     113
     114    public class PictureView : Gtk.ScrolledWindow
     115    {
    20116        public PictureView(Picture p)
    21117        {
    22             this.Build();
     118            Add(new PictureArea(p));
     119            ShowAll();
    23120        }
    24121    }
  • libpipi/trunk/ThePimp/ThePimp.mdp

    r2869 r2872  
    2929    <File name="app.desktop" subtype="Code" buildaction="FileCopy" DeployService.TargetDirectoryId="Linux.DesktopApplications" />
    3030    <File name="OpenFile.cs" subtype="Code" buildaction="Compile" />
    31     <File name="gtk-gui/Pimp.OpenFile.cs" subtype="Code" buildaction="Compile" />
    3231    <File name="gtk-gui/objects.xml" subtype="Code" buildaction="EmbedAsResource" />
    3332    <File name="PictureView.cs" subtype="Code" buildaction="Compile" />
    34     <File name="gtk-gui/ThePimp.PictureView.cs" subtype="Code" buildaction="Compile" />
     33    <File name="gtk-gui/ThePimp.OpenFile.cs" subtype="Code" buildaction="Compile" />
     34    <File name="ToolBox.cs" subtype="Code" buildaction="Compile" />
     35    <File name="gtk-gui/ThePimp.ToolBox.cs" subtype="Code" buildaction="Compile" />
    3536  </Contents>
    3637  <References>
     
    4849    <ExportedWidgets>
    4950      <Widget>ThePimp.PictureView</Widget>
     51      <Widget>ThePimp.ToolBox</Widget>
    5052    </ExportedWidgets>
    5153  </GtkDesignInfo>
  • libpipi/trunk/ThePimp/gtk-gui/MainWindow.cs

    r2869 r2872  
    7878   
    7979    private Gtk.Notebook notebook1;
    80    
    81     private Gtk.ScrolledWindow scrolledwindow1;
    82    
    83     private Gtk.Label label1;
    8480   
    8581    private Gtk.VPaned vpaned1;
     
    233229        this.notebook1.CurrentPage = 0;
    234230        this.notebook1.BorderWidth = ((uint)(5));
    235         // Container child notebook1.Gtk.Notebook+NotebookChild
    236         this.scrolledwindow1 = new Gtk.ScrolledWindow();
    237         this.scrolledwindow1.WidthRequest = 640;
    238         this.scrolledwindow1.HeightRequest = 480;
    239         this.scrolledwindow1.CanFocus = true;
    240         this.scrolledwindow1.Name = "scrolledwindow1";
    241         this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1));
    242         this.notebook1.Add(this.scrolledwindow1);
    243         // Notebook tab
    244         this.label1 = new Gtk.Label();
    245         this.label1.Name = "label1";
    246         this.label1.LabelProp = Mono.Unix.Catalog.GetString("Test tab");
    247         this.notebook1.SetTabLabel(this.scrolledwindow1, this.label1);
    248         this.label1.ShowAll();
    249231        this.hpaned1.Add(this.notebook1);
    250         Gtk.Paned.PanedChild w6 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1]));
    251         w6.Resize = false;
     232        Gtk.Paned.PanedChild w5 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.notebook1]));
     233        w5.Resize = false;
    252234        // Container child hpaned1.Gtk.Paned+PanedChild
    253235        this.vpaned1 = new Gtk.VPaned();
     
    265247        this.label2.LabelProp = Mono.Unix.Catalog.GetString("Tools");
    266248        this.vbox2.Add(this.label2);
    267         Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox2[this.label2]));
    268         w7.Position = 0;
    269         w7.Expand = false;
    270         w7.Fill = false;
     249        Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.label2]));
     250        w6.Position = 0;
     251        w6.Expand = false;
     252        w6.Fill = false;
    271253        this.vpaned1.Add(this.vbox2);
    272         Gtk.Paned.PanedChild w8 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2]));
    273         w8.Resize = false;
     254        Gtk.Paned.PanedChild w7 = ((Gtk.Paned.PanedChild)(this.vpaned1[this.vbox2]));
     255        w7.Resize = false;
    274256        // Container child vpaned1.Gtk.Paned+PanedChild
    275257        this.vbox3 = new Gtk.VBox();
     
    282264        this.label3.LabelProp = Mono.Unix.Catalog.GetString("Layers & Channels");
    283265        this.vbox3.Add(this.label3);
    284         Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox3[this.label3]));
    285         w9.Position = 0;
    286         w9.Expand = false;
    287         w9.Fill = false;
     266        Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox3[this.label3]));
     267        w8.Position = 0;
     268        w8.Expand = false;
     269        w8.Fill = false;
    288270        this.vpaned1.Add(this.vbox3);
    289271        this.hpaned1.Add(this.vpaned1);
    290272        this.vbox1.Add(this.hpaned1);
    291         Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1]));
    292         w12.Position = 2;
     273        Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox1[this.hpaned1]));
     274        w11.Position = 2;
    293275        // Container child vbox1.Gtk.Box+BoxChild
    294276        this.statusbar1 = new Gtk.Statusbar();
     
    296278        this.statusbar1.Spacing = 6;
    297279        this.vbox1.Add(this.statusbar1);
    298         Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
    299         w13.Position = 3;
    300         w13.Expand = false;
    301         w13.Fill = false;
     280        Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
     281        w12.Position = 3;
     282        w12.Expand = false;
     283        w12.Fill = false;
    302284        this.Add(this.vbox1);
    303285        if ((this.Child != null)) {
  • libpipi/trunk/ThePimp/gtk-gui/ThePimp.ToolBox.cs

    r2870 r2872  
    1212   
    1313   
    14     public partial class PictureView {
    15        
    16         private Gtk.DrawingArea drawingarea1;
     14    public partial class ToolBox {
    1715       
    1816        protected virtual void Build() {
    1917            Stetic.Gui.Initialize(this);
    20             // Widget ThePimp.PictureView
     18            // Widget ThePimp.ToolBox
    2119            Stetic.BinContainer.Attach(this);
    22             this.Name = "ThePimp.PictureView";
    23             // Container child ThePimp.PictureView.Gtk.Container+ContainerChild
    24             this.drawingarea1 = new Gtk.DrawingArea();
    25             this.drawingarea1.Name = "drawingarea1";
    26             this.Add(this.drawingarea1);
     20            this.Name = "ThePimp.ToolBox";
    2721            if ((this.Child != null)) {
    2822                this.Child.ShowAll();
  • libpipi/trunk/ThePimp/gtk-gui/gui.stetic

    r2869 r2872  
    268268                <property name="BorderWidth">5</property>
    269269                <child>
    270                   <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
    271                     <property name="MemberName" />
    272                     <property name="WidthRequest">640</property>
    273                     <property name="HeightRequest">480</property>
    274                     <property name="CanFocus">True</property>
    275                     <property name="ShadowType">In</property>
    276                     <child>
    277                       <widget class="Gtk.Viewport" id="GtkViewport">
    278                         <property name="MemberName" />
    279                         <property name="ShadowType">None</property>
    280                         <child>
    281                           <placeholder />
    282                         </child>
    283                       </widget>
    284                     </child>
    285                   </widget>
    286                 </child>
    287                 <child>
    288                   <widget class="Gtk.Label" id="label1">
    289                     <property name="MemberName" />
    290                     <property name="LabelProp" translatable="yes">Test tab</property>
    291                   </widget>
    292                   <packing>
    293                     <property name="type">tab</property>
    294                   </packing>
     270                  <placeholder />
    295271                </child>
    296272              </widget>
     
    454430    </child>
    455431  </widget>
     432  <widget class="Gtk.Bin" id="ThePimp.ToolBox" design-size="300 300">
     433    <property name="MemberName" />
     434    <child>
     435      <placeholder />
     436    </child>
     437  </widget>
    456438  <widget class="Gtk.Bin" id="ThePimp.PictureView" design-size="300 300">
    457439    <property name="MemberName" />
    458440    <child>
    459       <widget class="Gtk.DrawingArea" id="drawingarea1">
    460         <property name="MemberName" />
    461       </widget>
     441      <placeholder />
    462442    </child>
    463443  </widget>
  • libpipi/trunk/ThePimp/gtk-gui/objects.xml

    r2869 r2872  
    44    <signals />
    55  </object>
     6  <object type="ThePimp.ToolBox" palette-category="ThePimp" allow-children="false" base-type="Gtk.Bin">
     7    <itemgroups />
     8    <signals />
     9  </object>
    610</objects>
  • libpipi/trunk/pipi-sharp/.gitignore

    r2869 r2872  
    11*.pidb
     2*.mdb
    23*.exe
    34*.dll
  • libpipi/trunk/pipi-sharp/AssemblyInfo.cs

    r2869 r2872  
    1 // AssemblyInfo.cs created with MonoDevelop
    2 // User: sam at 13:14 04/10/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  libpipi       Pathetic image processing interface library
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
    55//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
     13//
     14
    615using System.Reflection;
    716using System.Runtime.CompilerServices;
  • libpipi/trunk/pipi-sharp/Picture.cs

    r2869 r2872  
    1 // MyClass.cs created with MonoDevelop
    2 // User: sam at 13:14 04/10/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  libpipi       Pathetic image processing interface library
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
     5//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
    513//
    614
  • libpipi/trunk/pipi-sharp/Pipi.cs

    r2869 r2872  
    1 // MyClass.cs created with MonoDevelop
    2 // User: sam at 13:14 04/10/2008
    31//
    4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
     2//  libpipi       Pathetic image processing interface library
     3//  Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
     4//                All Rights Reserved
     5//
     6//  $Id$
     7//
     8//  This library is free software. It comes without any warranty, to
     9//  the extent permitted by applicable law. You can redistribute it
     10//  and/or modify it under the terms of the Do What The Fuck You Want
     11//  To Public License, Version 2, as published by Sam Hocevar. See
     12//  http://sam.zoy.org/wtfpl/COPYING for more details.
    513//
    614
Note: See TracChangeset for help on using the changeset viewer.