~ubuntu-branches/ubuntu/oneiric/pdfmod/oneiric

« back to all changes in this revision

Viewing changes to src/PdfMod/Pdf/Actions/RemoveAction.cs

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2011-03-05 13:24:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110305132402-6om11ow0dqjlyomo
Tags: 0.9.1-1
* [72666d8] New upstream bugfix release:
  + Enhancements:
    - Make removing many pages much faster (bgo#630012)
  + Bugs Fixed:
    - Fix being able to load files with : in their path (bgo#631456)
    - Fix build on Mono 2.8
    - Don't crash if unable to save (bgo#633125)
    - Fix poppler-sharp.dll.config for NetBSD (bgo#638852)
    - Fix scrolling the view while dragging
    - Don't crash if Outlines point to null (bgo#642379)
    - Fix issue with saving landscape pages (bgo#597215)
    - Fix crash on page click due to ExportImagesAction (bgo#631889)
    - Fix crash if Catalog.Outlines is PdfNull (bgo#633123)
* [de4ca36] Drop autoreconf things (no longer needed)
* [cff5d0a] Bump hyena build-dep to 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
using System;
 
3
using System.Linq;
3
4
using System.Collections.Generic;
4
5
 
5
6
using Mono.Unix;
13
14
{
14
15
    public class RemoveAction : BasePageAction
15
16
    {
16
 
        int [] old_indices;
 
17
        //int [] old_indices;
 
18
        Page [] pages;
17
19
 
18
20
        public RemoveAction (Document document, IEnumerable<Page> pages) : base (document, pages)
19
21
        {
 
22
            this.pages = pages.ToArray ();
20
23
        }
21
24
 
22
25
        public override void Undo ()
37
40
 
38
41
        public override void Redo ()
39
42
        {
40
 
            if (old_indices != null) {
41
 
                throw new InvalidOperationException (Catalog.GetString ("Error trying to remove pages from document"));
42
 
            }
43
 
 
44
 
            old_indices = new int[Pages.Count];
45
 
            for (int i = 0; i < Pages.Count; i++) {
46
 
                old_indices[i] = Document.IndexOf (Pages[i]);
47
 
                Console.WriteLine ("Old index of {0} was {1}", Pages[i], old_indices[i]);
48
 
                Document.Remove (Pages[i]);
49
 
            }
 
43
            Document.Remove (pages);
50
44
        }
51
45
    }
52
46
}