You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
2.0 KiB

  1. //
  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.
  13. //
  14. using System;
  15. using Gtk;
  16. using Pipi;
  17. using ThePimp;
  18. namespace ThePimp
  19. {
  20. public partial class MainWindow: Gtk.Window
  21. {
  22. public MainWindow (): base (Gtk.WindowType.Toplevel)
  23. {
  24. Build ();
  25. Title += " v" + Libpipi.getVersion();
  26. }
  27. protected void OnDeleteEvent (object sender, DeleteEventArgs a)
  28. {
  29. Application.Quit ();
  30. a.RetVal = true;
  31. }
  32. protected virtual void OnOpenActionActivated (object sender, System.EventArgs e)
  33. {
  34. OpenFile open = new OpenFile();
  35. Pipi.Picture p = open.Load();
  36. open.Destroy();
  37. if(p != null)
  38. {
  39. while(notebook1.NPages > 0)
  40. notebook1.RemovePage(0);
  41. int n = notebook1.AppendPage(new PictureView(p),
  42. new Label(p.FileName));
  43. notebook1.Page = n;
  44. }
  45. }
  46. protected virtual void OnQuitActionActivated (object sender, System.EventArgs e)
  47. {
  48. Application.Quit ();
  49. }
  50. protected virtual void OnSaveAsActionActivated (object sender, System.EventArgs e)
  51. {
  52. SaveFile save = new SaveFile();
  53. PictureView view = notebook1.CurrentPageWidget as PictureView;
  54. save.Save(view.Picture);
  55. save.Destroy();
  56. }
  57. protected virtual void OnAboutActionActivated (object sender, System.EventArgs e)
  58. {
  59. new About();
  60. }
  61. }
  62. }