Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

86 wiersze
2.6 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. vpaned1.Add1(new ToolBox());
  27. }
  28. protected void OnDeleteEvent (object sender, DeleteEventArgs a)
  29. {
  30. Application.Quit ();
  31. a.RetVal = true;
  32. }
  33. protected virtual void OnOpenActionActivated (object sender, System.EventArgs e)
  34. {
  35. OpenFile open = new OpenFile();
  36. Pipi.Picture p = open.Load();
  37. open.Destroy();
  38. if(p != null)
  39. {
  40. while(notebook1.NPages > 0)
  41. notebook1.RemovePage(0);
  42. int n = notebook1.AppendPage(new PictureView(p),
  43. new Label(p.FileName));
  44. notebook1.Page = n;
  45. }
  46. }
  47. protected virtual void OnNewActionActivated (object sender, System.EventArgs e)
  48. {
  49. NewFile dialog = new NewFile();
  50. Pipi.Picture p = dialog.New();
  51. dialog.Destroy();
  52. if(p != null)
  53. {
  54. while(notebook1.NPages > 0)
  55. notebook1.RemovePage(0);
  56. int n = notebook1.AppendPage(new PictureView(p),
  57. new Label(p.FileName));
  58. notebook1.Page = n;
  59. }
  60. }
  61. protected virtual void OnQuitActionActivated (object sender, System.EventArgs e)
  62. {
  63. Application.Quit ();
  64. }
  65. protected virtual void OnSaveAsActionActivated (object sender, System.EventArgs e)
  66. {
  67. SaveFile save = new SaveFile();
  68. PictureView view = notebook1.CurrentPageWidget as PictureView;
  69. save.Save(view.Picture);
  70. save.Destroy();
  71. }
  72. protected virtual void OnAboutActionActivated (object sender, System.EventArgs e)
  73. {
  74. new AboutWindow();
  75. }
  76. }
  77. }