origami 1.2.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/README.md +112 -0
- data/bin/config/pdfcop.conf.yml +232 -233
- data/bin/gui/about.rb +27 -37
- data/bin/gui/config.rb +108 -117
- data/bin/gui/file.rb +416 -365
- data/bin/gui/gtkhex.rb +1138 -1153
- data/bin/gui/hexview.rb +55 -57
- data/bin/gui/imgview.rb +48 -51
- data/bin/gui/menu.rb +388 -386
- data/bin/gui/properties.rb +114 -130
- data/bin/gui/signing.rb +571 -617
- data/bin/gui/textview.rb +77 -95
- data/bin/gui/treeview.rb +382 -387
- data/bin/gui/walker.rb +227 -232
- data/bin/gui/xrefs.rb +56 -60
- data/bin/pdf2pdfa +53 -57
- data/bin/pdf2ruby +212 -228
- data/bin/pdfcop +338 -348
- data/bin/pdfdecompress +58 -65
- data/bin/pdfdecrypt +56 -60
- data/bin/pdfencrypt +75 -80
- data/bin/pdfexplode +185 -182
- data/bin/pdfextract +201 -218
- data/bin/pdfmetadata +83 -82
- data/bin/pdfsh +4 -5
- data/bin/pdfwalker +1 -2
- data/bin/shell/.irbrc +45 -82
- data/bin/shell/console.rb +105 -130
- data/bin/shell/hexdump.rb +40 -64
- data/examples/README.md +34 -0
- data/examples/attachments/attachment.rb +38 -0
- data/examples/attachments/nested_document.rb +51 -0
- data/examples/encryption/encryption.rb +28 -0
- data/{samples/actions/triggerevents/trigger.rb → examples/events/events.rb} +13 -16
- data/examples/flash/flash.rb +37 -0
- data/{samples → examples}/flash/helloworld.swf +0 -0
- data/examples/forms/javascript.rb +54 -0
- data/examples/forms/xfa.rb +115 -0
- data/examples/javascript/hello_world.rb +22 -0
- data/examples/javascript/js_emulation.rb +54 -0
- data/examples/loop/goto.rb +32 -0
- data/examples/loop/named.rb +33 -0
- data/examples/signature/signature.rb +65 -0
- data/examples/uri/javascript.rb +56 -0
- data/examples/uri/open-uri.rb +21 -0
- data/examples/uri/submitform.rb +47 -0
- data/lib/origami.rb +29 -42
- data/lib/origami/3d.rb +350 -225
- data/lib/origami/acroform.rb +262 -288
- data/lib/origami/actions.rb +268 -288
- data/lib/origami/annotations.rb +697 -722
- data/lib/origami/array.rb +258 -184
- data/lib/origami/boolean.rb +74 -84
- data/lib/origami/catalog.rb +397 -434
- data/lib/origami/collections.rb +144 -0
- data/lib/origami/destinations.rb +233 -194
- data/lib/origami/dictionary.rb +253 -232
- data/lib/origami/encryption.rb +1274 -1243
- data/lib/origami/export.rb +232 -268
- data/lib/origami/extensions/fdf.rb +307 -220
- data/lib/origami/extensions/ppklite.rb +368 -435
- data/lib/origami/filespec.rb +197 -0
- data/lib/origami/filters.rb +301 -295
- data/lib/origami/filters/ascii.rb +177 -180
- data/lib/origami/filters/ccitt.rb +528 -535
- data/lib/origami/filters/crypt.rb +26 -35
- data/lib/origami/filters/dct.rb +46 -52
- data/lib/origami/filters/flate.rb +95 -94
- data/lib/origami/filters/jbig2.rb +49 -55
- data/lib/origami/filters/jpx.rb +38 -44
- data/lib/origami/filters/lzw.rb +189 -183
- data/lib/origami/filters/predictors.rb +221 -235
- data/lib/origami/filters/runlength.rb +103 -104
- data/lib/origami/font.rb +173 -186
- data/lib/origami/functions.rb +67 -81
- data/lib/origami/graphics.rb +25 -21
- data/lib/origami/graphics/colors.rb +178 -187
- data/lib/origami/graphics/instruction.rb +79 -85
- data/lib/origami/graphics/path.rb +142 -148
- data/lib/origami/graphics/patterns.rb +160 -167
- data/lib/origami/graphics/render.rb +43 -50
- data/lib/origami/graphics/state.rb +138 -153
- data/lib/origami/graphics/text.rb +188 -205
- data/lib/origami/graphics/xobject.rb +819 -815
- data/lib/origami/header.rb +63 -78
- data/lib/origami/javascript.rb +596 -597
- data/lib/origami/linearization.rb +285 -290
- data/lib/origami/metadata.rb +139 -148
- data/lib/origami/name.rb +112 -148
- data/lib/origami/null.rb +53 -62
- data/lib/origami/numeric.rb +162 -175
- data/lib/origami/obfuscation.rb +186 -174
- data/lib/origami/object.rb +593 -573
- data/lib/origami/outline.rb +42 -47
- data/lib/origami/outputintents.rb +73 -82
- data/lib/origami/page.rb +703 -592
- data/lib/origami/parser.rb +238 -290
- data/lib/origami/parsers/fdf.rb +41 -33
- data/lib/origami/parsers/pdf.rb +75 -95
- data/lib/origami/parsers/pdf/lazy.rb +137 -0
- data/lib/origami/parsers/pdf/linear.rb +64 -66
- data/lib/origami/parsers/ppklite.rb +34 -70
- data/lib/origami/pdf.rb +1030 -1005
- data/lib/origami/reference.rb +102 -102
- data/lib/origami/signature.rb +591 -609
- data/lib/origami/stream.rb +668 -551
- data/lib/origami/string.rb +397 -373
- data/lib/origami/template/patterns.rb +56 -0
- data/lib/origami/template/widgets.rb +151 -0
- data/lib/origami/trailer.rb +144 -158
- data/lib/origami/tree.rb +62 -0
- data/lib/origami/version.rb +23 -0
- data/lib/origami/webcapture.rb +88 -79
- data/lib/origami/xfa.rb +2863 -2882
- data/lib/origami/xreftable.rb +472 -384
- data/test/dataset/calc.pdf +85 -0
- data/test/dataset/crypto.pdf +82 -0
- data/test/dataset/empty.pdf +49 -0
- data/test/test_actions.rb +27 -0
- data/test/test_annotations.rb +90 -0
- data/test/test_pages.rb +31 -0
- data/test/test_pdf.rb +16 -0
- data/test/test_pdf_attachment.rb +34 -0
- data/test/test_pdf_create.rb +24 -0
- data/test/test_pdf_encrypt.rb +95 -0
- data/test/test_pdf_parse.rb +96 -0
- data/test/test_pdf_sign.rb +58 -0
- data/test/test_streams.rb +182 -0
- data/test/test_xrefs.rb +67 -0
- metadata +88 -58
- data/README +0 -67
- data/bin/pdf2graph +0 -121
- data/bin/pdfcocoon +0 -104
- data/lib/origami/file.rb +0 -233
- data/samples/README.txt +0 -45
- data/samples/actions/launch/calc.rb +0 -87
- data/samples/actions/launch/winparams.rb +0 -22
- data/samples/actions/loop/loopgoto.rb +0 -24
- data/samples/actions/loop/loopnamed.rb +0 -21
- data/samples/actions/named/named.rb +0 -31
- data/samples/actions/samba/smbrelay.rb +0 -26
- data/samples/actions/webbug/submitform.js +0 -26
- data/samples/actions/webbug/webbug-browser.rb +0 -68
- data/samples/actions/webbug/webbug-js.rb +0 -67
- data/samples/actions/webbug/webbug-reader.rb +0 -90
- data/samples/attachments/attach.rb +0 -40
- data/samples/attachments/attached.txt +0 -1
- data/samples/crypto/crypto.rb +0 -28
- data/samples/digsig/signed.rb +0 -46
- data/samples/exploits/cve-2008-2992-utilprintf.rb +0 -87
- data/samples/exploits/cve-2009-0927-geticon.rb +0 -65
- data/samples/exploits/exploit_customdictopen.rb +0 -55
- data/samples/exploits/getannots.rb +0 -69
- data/samples/flash/flash.rb +0 -31
- data/samples/javascript/attached.txt +0 -1
- data/samples/javascript/js.rb +0 -52
- data/templates/patterns.rb +0 -66
- data/templates/widgets.rb +0 -173
- data/templates/xdp.rb +0 -92
- data/test/ts_pdf.rb +0 -50
data/bin/gui/textview.rb
CHANGED
|
@@ -1,106 +1,88 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
GNU General Public License for more details.
|
|
20
|
-
|
|
21
|
-
You should have received a copy of the GNU General Public License
|
|
22
|
-
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
|
3
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
|
4
|
+
Copyright (C) 2016 Guillaume Delugré.
|
|
5
|
+
|
|
6
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
PDF Walker is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
|
23
18
|
|
|
24
19
|
=end
|
|
25
20
|
|
|
26
21
|
module PDFWalker
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@pdfbuffer.apply_tag(pdftag, @pdfbuffer.start_iter, @pdfbuffer.end_iter)
|
|
91
|
-
|
|
92
|
-
rescue Exception => e
|
|
93
|
-
@parent.error("An error occured while loading this object.\n#{e} (#{e.class})")
|
|
23
|
+
class Walker < Window
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def create_objectview
|
|
28
|
+
@objectview = ObjectView.new(self)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class ObjectView < Notebook
|
|
32
|
+
attr_reader :parent
|
|
33
|
+
attr_reader :pdfpanel, :valuepanel
|
|
34
|
+
|
|
35
|
+
def initialize(parent)
|
|
36
|
+
@parent = parent
|
|
37
|
+
super()
|
|
38
|
+
|
|
39
|
+
@pdfbuffer = TextBuffer.new
|
|
40
|
+
@pdfview = TextView.new(@pdfbuffer).set_editable(false).set_cursor_visible(false).set_left_margin(5)
|
|
41
|
+
|
|
42
|
+
@pdfpanel = ScrolledWindow.new.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
|
|
43
|
+
@pdfpanel.add_with_viewport @pdfview
|
|
44
|
+
append_page(@pdfpanel, Label.new("PDF Code"))
|
|
45
|
+
|
|
46
|
+
@pdfbuffer.create_tag("Default",
|
|
47
|
+
weight: Pango::WEIGHT_BOLD,
|
|
48
|
+
family: "monospace",
|
|
49
|
+
scale: Pango::AttrScale::LARGE
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def load(object)
|
|
54
|
+
begin
|
|
55
|
+
self.clear
|
|
56
|
+
|
|
57
|
+
case object
|
|
58
|
+
when Origami::PDF::Header, Origami::FDF::Header, Origami::PPKLite::Header
|
|
59
|
+
text = object.to_s
|
|
60
|
+
@pdfbuffer.set_text(text)
|
|
61
|
+
@pdfbuffer.apply_tag("Default", @pdfbuffer.start_iter, @pdfbuffer.end_iter)
|
|
62
|
+
|
|
63
|
+
when Origami::Object
|
|
64
|
+
if object.is_a?(Origami::Stream)
|
|
65
|
+
text = [ "#{object.no} #{object.generation} obj", object.dictionary ].join($/)
|
|
66
|
+
else
|
|
67
|
+
text = object.to_s
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
text.encode!("UTF-8", replace: '.')
|
|
71
|
+
.gsub!("\x00", '.')
|
|
72
|
+
|
|
73
|
+
@pdfbuffer.set_text(text)
|
|
74
|
+
@pdfbuffer.apply_tag("Default", @pdfbuffer.start_iter, @pdfbuffer.end_iter)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
rescue
|
|
78
|
+
@parent.error("An error occured while loading this object.\n#{$!} (#{$!.class})")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def clear
|
|
83
|
+
@pdfbuffer.set_text("")
|
|
84
|
+
end
|
|
94
85
|
end
|
|
95
|
-
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def clear
|
|
99
|
-
@pdfbuffer.set_text("")
|
|
100
|
-
end
|
|
101
|
-
|
|
102
86
|
end
|
|
103
|
-
|
|
104
|
-
end
|
|
105
87
|
|
|
106
88
|
end
|
data/bin/gui/treeview.rb
CHANGED
|
@@ -1,415 +1,410 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
GNU General Public License for more details.
|
|
20
|
-
|
|
21
|
-
You should have received a copy of the GNU General Public License
|
|
22
|
-
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
|
3
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
|
4
|
+
Copyright (C) 2016 Guillaume Delugré.
|
|
5
|
+
|
|
6
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
PDF Walker is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
|
23
18
|
|
|
24
19
|
=end
|
|
25
20
|
|
|
26
21
|
module PDFWalker
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
class Walker < Window
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def create_treeview
|
|
28
|
+
@treeview = PDFTree.new(self).set_headers_visible(false)
|
|
29
|
+
|
|
30
|
+
colcontent = Gtk::TreeViewColumn.new("Names",
|
|
31
|
+
Gtk::CellRendererText.new.set_foreground_set(true).set_background_set(true),
|
|
32
|
+
text: PDFTree::TEXTCOL,
|
|
33
|
+
weight: PDFTree::WEIGHTCOL,
|
|
34
|
+
style: PDFTree::STYLECOL,
|
|
35
|
+
foreground: PDFTree::FGCOL,
|
|
36
|
+
background: PDFTree::BGCOL
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
@treeview.append_column(colcontent)
|
|
40
|
+
end
|
|
47
41
|
end
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
42
|
+
|
|
43
|
+
class PDFTree < TreeView
|
|
44
|
+
include Popable
|
|
45
|
+
|
|
46
|
+
OBJCOL = 0
|
|
47
|
+
TEXTCOL = 1
|
|
48
|
+
WEIGHTCOL = 2
|
|
49
|
+
STYLECOL = 3
|
|
50
|
+
FGCOL = 4
|
|
51
|
+
BGCOL = 5
|
|
52
|
+
LOADCOL = 6
|
|
53
|
+
|
|
54
|
+
@@appearance = Hash.new(Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_NORMAL)
|
|
55
|
+
|
|
56
|
+
attr_reader :parent
|
|
57
|
+
|
|
58
|
+
def initialize(parent)
|
|
59
|
+
@parent = parent
|
|
60
|
+
|
|
61
|
+
reset_appearance
|
|
62
|
+
|
|
63
|
+
@treestore = TreeStore.new(Object::Object, String, Pango::FontDescription::Weight, Pango::FontDescription::Style, String, String, Fixnum)
|
|
64
|
+
super(@treestore)
|
|
65
|
+
|
|
66
|
+
signal_connect('cursor-changed') {
|
|
67
|
+
iter = selection.selected
|
|
68
|
+
if iter
|
|
69
|
+
obj = @treestore.get_value(iter, OBJCOL)
|
|
70
|
+
|
|
71
|
+
parent.hexview.load(obj)
|
|
72
|
+
parent.objectview.load(obj)
|
|
73
|
+
end
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
signal_connect('row-activated') { |tree, path, column|
|
|
77
|
+
if selection.selected
|
|
78
|
+
obj = @treestore.get_value(selection.selected, OBJCOL)
|
|
79
|
+
|
|
80
|
+
if row_expanded?(path)
|
|
81
|
+
collapse_row(path)
|
|
82
|
+
else
|
|
83
|
+
expand_row(path, false)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
goto(obj) if obj.is_a?(Origami::Reference)
|
|
87
|
+
end
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
signal_connect('row-expanded') { |tree, iter, path|
|
|
91
|
+
obj = @treestore.get_value(iter, OBJCOL)
|
|
92
|
+
|
|
93
|
+
if obj.is_a?(Origami::Stream) and iter.n_children == 1
|
|
94
|
+
|
|
95
|
+
# Processing with an XRef or Object Stream
|
|
96
|
+
if obj.is_a?(Origami::ObjectStream)
|
|
97
|
+
obj.each { |embeddedobj|
|
|
98
|
+
load_object(iter, embeddedobj)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
elsif obj.is_a?(Origami::XRefStream)
|
|
102
|
+
obj.each { |xref|
|
|
103
|
+
load_xrefstm(iter, xref)
|
|
104
|
+
}
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
for i in 0...iter.n_children
|
|
109
|
+
subiter = iter.nth_child(i)
|
|
110
|
+
subobj = @treestore.get_value(subiter, OBJCOL)
|
|
111
|
+
|
|
112
|
+
load_sub_objects(subiter, subobj)
|
|
113
|
+
end
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
add_events(Gdk::Event::BUTTON_PRESS_MASK)
|
|
117
|
+
signal_connect('button_press_event') { |widget, event|
|
|
118
|
+
if event.button == 3 && parent.opened
|
|
119
|
+
path = get_path(event.x,event.y).first
|
|
120
|
+
set_cursor(path, nil, false)
|
|
121
|
+
|
|
122
|
+
obj = @treestore.get_value(@treestore.get_iter(path), OBJCOL)
|
|
123
|
+
popup_menu(obj, event, path)
|
|
124
|
+
end
|
|
125
|
+
}
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def clear
|
|
129
|
+
@treestore.clear
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def goto(obj, follow_references: true)
|
|
133
|
+
if obj.is_a?(TreePath)
|
|
134
|
+
set_cursor(obj, nil, false)
|
|
135
|
+
else
|
|
136
|
+
if obj.is_a?(Origami::Name) and obj.parent.is_a?(Origami::Dictionary) and obj.parent.has_key?(obj)
|
|
137
|
+
obj = obj.parent[obj]
|
|
138
|
+
elsif obj.is_a?(Origami::Reference) and follow_references
|
|
139
|
+
obj =
|
|
140
|
+
begin
|
|
141
|
+
obj.solve
|
|
142
|
+
rescue Origami::InvalidReferenceError
|
|
143
|
+
@parent.error("Object not found : #{obj}")
|
|
144
|
+
return
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
_, path = object_to_tree_pos(obj)
|
|
149
|
+
if path.nil?
|
|
150
|
+
@parent.error("Object not found : #{obj.type}")
|
|
151
|
+
return
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
expand_to_path(path) unless row_expanded?(path)
|
|
155
|
+
@parent.explorer_history << cursor.first if cursor.first
|
|
156
|
+
set_cursor(path, nil, false)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def highlight(obj, color)
|
|
161
|
+
if obj.is_a?(Origami::Name) and obj.parent.is_a?(Origami::Dictionary) and obj.parent.has_key?(obj)
|
|
162
|
+
obj = obj.parent[obj]
|
|
92
163
|
end
|
|
93
|
-
end
|
|
94
164
|
|
|
95
|
-
|
|
96
|
-
|
|
165
|
+
iter, path = object_to_tree_pos(obj)
|
|
166
|
+
if iter.nil? or path.nil?
|
|
167
|
+
@parent.error("Object not found : #{obj.type}")
|
|
168
|
+
return
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
@treestore.set_value(iter, BGCOL, color)
|
|
172
|
+
expand_to_path(path) unless row_expanded?(path)
|
|
97
173
|
end
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
174
|
+
|
|
175
|
+
def load(pdf)
|
|
176
|
+
return unless pdf
|
|
177
|
+
|
|
178
|
+
self.clear
|
|
179
|
+
|
|
180
|
+
begin
|
|
181
|
+
#
|
|
182
|
+
# Create root entry
|
|
183
|
+
#
|
|
184
|
+
root = @treestore.append(nil)
|
|
185
|
+
@treestore.set_value(root, OBJCOL, pdf)
|
|
186
|
+
|
|
187
|
+
set_node(root, :Filename, @parent.filename)
|
|
188
|
+
|
|
189
|
+
#
|
|
190
|
+
# Create header entry
|
|
191
|
+
#
|
|
192
|
+
header = @treestore.append(root)
|
|
193
|
+
@treestore.set_value(header, OBJCOL, pdf.header)
|
|
194
|
+
|
|
195
|
+
set_node(header, :Header,
|
|
196
|
+
"Header (version #{pdf.header.major_version}.#{pdf.header.minor_version})")
|
|
197
|
+
|
|
198
|
+
no = 1
|
|
199
|
+
pdf.revisions.each { |revision|
|
|
200
|
+
load_revision(root, no, revision)
|
|
201
|
+
no = no + 1
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
set_model(@treestore)
|
|
205
|
+
|
|
206
|
+
ensure
|
|
207
|
+
expand(@treestore.iter_first, 3)
|
|
208
|
+
set_cursor(@treestore.iter_first.path, nil, false)
|
|
209
|
+
end
|
|
111
210
|
end
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
211
|
+
|
|
212
|
+
private
|
|
213
|
+
|
|
214
|
+
def object_to_tree_pos(obj)
|
|
215
|
+
|
|
216
|
+
# Locate the indirect object.
|
|
217
|
+
root_obj = obj
|
|
218
|
+
object_path = [ root_obj ]
|
|
219
|
+
while root_obj.parent
|
|
220
|
+
root_obj = root_obj.parent
|
|
221
|
+
object_path.push(root_obj)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
@treestore.each do |model, path, iter|
|
|
225
|
+
current_obj = @treestore.get_value(iter, OBJCOL)
|
|
226
|
+
|
|
227
|
+
# Load the intermediate nodes if necessary.
|
|
228
|
+
if object_path.any?{|object| object.equal?(current_obj)}
|
|
229
|
+
load_sub_objects(iter, current_obj)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Unfold the object stream if it's in the object path.
|
|
233
|
+
if obj.is_a?(Origami::Object) and current_obj.is_a?(Origami::ObjectStream) and
|
|
234
|
+
root_obj.equal?(current_obj) and iter.n_children == 1
|
|
235
|
+
|
|
236
|
+
current_obj.each { |embeddedobj|
|
|
237
|
+
load_object(iter, embeddedobj)
|
|
238
|
+
}
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
return [ iter, path ] if obj.equal?(current_obj)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
nil
|
|
122
245
|
end
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if obj.is_a?(TreePath)
|
|
134
|
-
set_cursor(obj, nil, false)
|
|
135
|
-
else
|
|
136
|
-
if obj.is_a?(Name) and obj.parent.is_a?(Dictionary) and obj.parent.has_key?(obj)
|
|
137
|
-
obj = obj.parent[obj]
|
|
138
|
-
elsif obj.is_a?(Reference)
|
|
139
|
-
obj =
|
|
140
|
-
begin
|
|
141
|
-
obj.solve
|
|
142
|
-
rescue InvalidReferenceError
|
|
143
|
-
@parent.error("Object not found : #{obj}")
|
|
144
|
-
return
|
|
246
|
+
|
|
247
|
+
def expand(row, depth)
|
|
248
|
+
if row and depth != 0
|
|
249
|
+
loop do
|
|
250
|
+
expand_row(row.path, false)
|
|
251
|
+
expand(row.first_child, depth - 1)
|
|
252
|
+
|
|
253
|
+
break if not row.next!
|
|
254
|
+
end
|
|
145
255
|
end
|
|
146
256
|
end
|
|
147
257
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
load_object(iter, embeddedobj)
|
|
154
|
-
}
|
|
155
|
-
next
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
if obj.equal?(current_obj)
|
|
159
|
-
expand_to_path(path) unless row_expanded?(path)
|
|
160
|
-
|
|
161
|
-
if cursor.first then @parent.explorer_history << cursor.first end
|
|
162
|
-
set_cursor(path, nil, false)
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
end
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@parent.error("Object not found : #{obj}")
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
end
|
|
258
|
+
def load_revision(root, no, revision)
|
|
259
|
+
revroot = @treestore.append(root)
|
|
260
|
+
@treestore.set_value(revroot, OBJCOL, revision)
|
|
261
|
+
|
|
262
|
+
set_node(revroot, :Revision, "Revision #{no}")
|
|
172
263
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
@treestore.each { |model, path, iter|
|
|
179
|
-
current_obj = @treestore.get_value(iter, OBJCOL)
|
|
180
|
-
|
|
181
|
-
if obj.equal?(current_obj)
|
|
182
|
-
@treestore.set_value(iter, BGCOL, color)
|
|
183
|
-
expand_to_path(path) unless row_expanded?(path)
|
|
184
|
-
return
|
|
264
|
+
load_body(revroot, revision.body.values)
|
|
265
|
+
load_xrefs(revroot, revision.xreftable)
|
|
266
|
+
load_trailer(revroot, revision.trailer)
|
|
185
267
|
end
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
#
|
|
206
|
-
# Create header entry
|
|
207
|
-
#
|
|
208
|
-
header = @treestore.append(root)
|
|
209
|
-
@treestore.set_value(header, OBJCOL, pdf.header)
|
|
210
|
-
|
|
211
|
-
set_node(header, :Header, "Header (version #{pdf.header.majorversion}.#{pdf.header.minorversion})")
|
|
212
|
-
|
|
213
|
-
no = 1
|
|
214
|
-
pdf.revisions.each { |revision|
|
|
215
|
-
|
|
216
|
-
load_revision(root, no, revision)
|
|
217
|
-
no = no + 1
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
set_model(@treestore)
|
|
222
|
-
|
|
223
|
-
ensure
|
|
224
|
-
expand(@treestore.iter_first, 3)
|
|
225
|
-
set_cursor(@treestore.iter_first.path, nil, false)
|
|
268
|
+
|
|
269
|
+
def load_body(rev, body)
|
|
270
|
+
bodyroot = @treestore.append(rev)
|
|
271
|
+
@treestore.set_value(bodyroot, OBJCOL, body)
|
|
272
|
+
|
|
273
|
+
set_node(bodyroot, :Body, "Body")
|
|
274
|
+
|
|
275
|
+
body.sort_by{|obj| obj.file_offset.to_i }.each { |object|
|
|
276
|
+
begin
|
|
277
|
+
load_object(bodyroot, object)
|
|
278
|
+
rescue
|
|
279
|
+
msg = "#{$!.class}: #{$!.message}\n#{$!.backtrace.join($/)}"
|
|
280
|
+
STDERR.puts(msg)
|
|
281
|
+
|
|
282
|
+
#@parent.error(msg)
|
|
283
|
+
next
|
|
284
|
+
end
|
|
285
|
+
}
|
|
226
286
|
end
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
287
|
+
|
|
288
|
+
def load_object(container, object, depth = 1, name = nil)
|
|
289
|
+
iter = @treestore.append(container)
|
|
290
|
+
@treestore.set_value(iter, OBJCOL, object)
|
|
291
|
+
|
|
292
|
+
type = object.native_type.to_s.split('::').last.to_sym
|
|
293
|
+
|
|
294
|
+
if name.nil?
|
|
295
|
+
name =
|
|
296
|
+
case object
|
|
297
|
+
when Origami::String
|
|
298
|
+
'"' + object.to_utf8.gsub("\x00", ".") + '"'
|
|
299
|
+
when Origami::Number, Origami::Name
|
|
300
|
+
object.value.to_s
|
|
301
|
+
else
|
|
302
|
+
object.type.to_s
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
set_node(iter, type, name)
|
|
307
|
+
return unless depth > 0
|
|
308
|
+
|
|
309
|
+
load_sub_objects(iter, object, depth)
|
|
242
310
|
end
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def load_body(rev, body)
|
|
264
|
-
|
|
265
|
-
bodyroot = @treestore.append(rev)
|
|
266
|
-
@treestore.set_value(bodyroot, OBJCOL, body)
|
|
267
|
-
|
|
268
|
-
set_node(bodyroot, :Body, "Body")
|
|
269
|
-
|
|
270
|
-
body.sort_by{|obj| obj.file_offset}.each { |object|
|
|
271
|
-
begin
|
|
272
|
-
load_object(bodyroot, object)
|
|
273
|
-
rescue Exception => e
|
|
274
|
-
msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
275
|
-
|
|
276
|
-
#@parent.error(msg)
|
|
277
|
-
next
|
|
311
|
+
|
|
312
|
+
def load_sub_objects(container, object, depth = 1)
|
|
313
|
+
return unless depth > 0 and @treestore.get_value(container, LOADCOL) != 1
|
|
314
|
+
|
|
315
|
+
case object
|
|
316
|
+
when Origami::Array
|
|
317
|
+
object.each do |subobject|
|
|
318
|
+
load_object(container, subobject, depth - 1)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
when Origami::Dictionary
|
|
322
|
+
object.each_key do |subkey|
|
|
323
|
+
load_object(container, object[subkey.value], depth - 1, subkey.value.to_s)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
when Origami::Stream
|
|
327
|
+
load_object(container, object.dictionary, depth - 1, "Stream Dictionary")
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
@treestore.set_value(container, LOADCOL, 1)
|
|
278
331
|
end
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
@treestore.set_value(obj, OBJCOL, object)
|
|
287
|
-
|
|
288
|
-
type = object.native_type.to_s.split('::').last.to_sym
|
|
289
|
-
|
|
290
|
-
if name.nil?
|
|
291
|
-
name =
|
|
292
|
-
case object
|
|
293
|
-
when Origami::String
|
|
294
|
-
'"' + object.to_utf8 + '"'
|
|
295
|
-
when Origami::Number, Name
|
|
296
|
-
object.value.to_s
|
|
332
|
+
|
|
333
|
+
def load_xrefstm(stm, embxref)
|
|
334
|
+
xref = @treestore.append(stm)
|
|
335
|
+
@treestore.set_value(xref, OBJCOL, embxref)
|
|
336
|
+
|
|
337
|
+
if embxref.is_a?(Origami::XRef)
|
|
338
|
+
set_node(xref, :XRef, embxref.to_s.chomp)
|
|
297
339
|
else
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
set_node(obj, type, name)
|
|
303
|
-
|
|
304
|
-
if object.is_a? Origami::Array
|
|
305
|
-
object.each { |subobject|
|
|
306
|
-
load_object(obj, subobject)
|
|
307
|
-
}
|
|
308
|
-
elsif object.is_a? Origami::Dictionary
|
|
309
|
-
object.each_key { |subkey|
|
|
310
|
-
load_object(obj, object[subkey.value], subkey.value.to_s)
|
|
311
|
-
}
|
|
312
|
-
elsif object.is_a? Origami::Stream
|
|
313
|
-
load_object(obj, object.dictionary, "Stream Dictionary")
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
end
|
|
340
|
+
set_node(xref, :XRef, "xref to ObjectStream #{embxref.objstmno}, object index #{embxref.index}")
|
|
341
|
+
end
|
|
342
|
+
end
|
|
317
343
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
xref = @treestore.append(stm)
|
|
321
|
-
@treestore.set_value(xref, OBJCOL, embxref)
|
|
344
|
+
def load_xrefs(rev, table)
|
|
345
|
+
return unless table
|
|
322
346
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
else
|
|
326
|
-
set_node(xref, :XRef, "xref to ObjectStream #{embxref.objstmno}, object index #{embxref.index}")
|
|
327
|
-
end
|
|
347
|
+
section = @treestore.append(rev)
|
|
348
|
+
@treestore.set_value(section, OBJCOL, table)
|
|
328
349
|
|
|
350
|
+
set_node(section, :XRefSection, "XRef section")
|
|
351
|
+
|
|
352
|
+
table.each_subsection { |subtable|
|
|
353
|
+
subsection = @treestore.append(section)
|
|
354
|
+
@treestore.set_value(subsection, OBJCOL, subtable)
|
|
355
|
+
|
|
356
|
+
set_node(subsection, :XRefSubSection, "#{subtable.range.begin} #{subtable.range.end - subtable.range.begin + 1}")
|
|
357
|
+
|
|
358
|
+
subtable.each { |entry|
|
|
359
|
+
xref = @treestore.append(subsection)
|
|
360
|
+
@treestore.set_value(xref, OBJCOL, entry)
|
|
361
|
+
|
|
362
|
+
set_node(xref, :XRef, entry.to_s.chomp)
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def load_trailer(rev, trailer)
|
|
368
|
+
trailer_root = @treestore.append(rev)
|
|
369
|
+
@treestore.set_value(trailer_root, OBJCOL, trailer)
|
|
370
|
+
|
|
371
|
+
set_node(trailer_root, :Trailer, "Trailer")
|
|
372
|
+
load_object(trailer_root, trailer.dictionary) unless trailer.dictionary.nil?
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def reset_appearance
|
|
376
|
+
@@appearance[:Filename] = {Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
377
|
+
@@appearance[:Header] = {Color: "darkgreen", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
378
|
+
@@appearance[:Revision] = {Color: "blue", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
379
|
+
@@appearance[:Body] = {Color: "purple", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
380
|
+
@@appearance[:XRefSection] = {Color: "purple", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
381
|
+
@@appearance[:XRefSubSection] = {Color: "brown", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
382
|
+
@@appearance[:XRef] = {Color: "gray20", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
383
|
+
@@appearance[:Trailer] = {Color: "purple", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
384
|
+
@@appearance[:StartXref] = {Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
385
|
+
@@appearance[:String] = {Color: "red", Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_ITALIC}
|
|
386
|
+
@@appearance[:Name] = {Color: "gray", Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_ITALIC}
|
|
387
|
+
@@appearance[:Number] = {Color: "orange", Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_NORMAL}
|
|
388
|
+
@@appearance[:Dictionary] = {Color: "brown", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
389
|
+
@@appearance[:Stream] = {Color: "darkcyan", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
390
|
+
@@appearance[:StreamData] = {Color: "darkcyan", Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_OBLIQUE}
|
|
391
|
+
@@appearance[:Array] = {Color: "darkgreen", Weight: Pango::WEIGHT_BOLD, Style: Pango::STYLE_NORMAL}
|
|
392
|
+
@@appearance[:Reference] = {Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_OBLIQUE}
|
|
393
|
+
@@appearance[:Boolean] = {Color: "deeppink", Weight: Pango::WEIGHT_NORMAL, Style: Pango::STYLE_NORMAL}
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
def get_object_appearance(type)
|
|
397
|
+
@@appearance[type]
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
def set_node(node, type, text)
|
|
401
|
+
@treestore.set_value(node, TEXTCOL, text)
|
|
402
|
+
|
|
403
|
+
app = get_object_appearance(type)
|
|
404
|
+
@treestore.set_value(node, WEIGHTCOL, app[:Weight])
|
|
405
|
+
@treestore.set_value(node, STYLECOL, app[:Style])
|
|
406
|
+
@treestore.set_value(node, FGCOL, app[:Color])
|
|
407
|
+
end
|
|
329
408
|
end
|
|
330
|
-
|
|
331
|
-
def load_xrefs(rev, table)
|
|
332
|
-
|
|
333
|
-
if table
|
|
334
|
-
|
|
335
|
-
section = @treestore.append(rev)
|
|
336
|
-
@treestore.set_value(section, OBJCOL, table)
|
|
337
|
-
|
|
338
|
-
set_node(section, :XRefSection, "XRef section")
|
|
339
|
-
|
|
340
|
-
table.each { |subtable|
|
|
341
|
-
|
|
342
|
-
subsection = @treestore.append(section)
|
|
343
|
-
@treestore.set_value(subsection, OBJCOL, subtable)
|
|
344
|
-
|
|
345
|
-
set_node(subsection, :XRefSubSection, "#{subtable.range.begin} #{subtable.range.end - subtable.range.begin + 1}")
|
|
346
|
-
|
|
347
|
-
subtable.each { |entry|
|
|
348
|
-
|
|
349
|
-
xref = @treestore.append(subsection)
|
|
350
|
-
@treestore.set_value(xref, OBJCOL, entry)
|
|
351
|
-
|
|
352
|
-
set_node(xref, :XRef, entry.to_s.chomp)
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
end
|
|
361
|
-
|
|
362
|
-
def load_trailer(rev, trailer)
|
|
363
|
-
|
|
364
|
-
trailerroot = @treestore.append(rev)
|
|
365
|
-
@treestore.set_value(trailerroot, OBJCOL, trailer)
|
|
366
|
-
|
|
367
|
-
set_node(trailerroot, :Trailer, "Trailer")
|
|
368
|
-
|
|
369
|
-
unless trailer.dictionary.nil?
|
|
370
|
-
load_object(trailerroot, trailer.dictionary)
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
end
|
|
374
|
-
|
|
375
|
-
def reset_appearance
|
|
376
|
-
|
|
377
|
-
@@appearance[:Filename] = {:Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
378
|
-
@@appearance[:Header] = {:Color => "darkgreen", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
379
|
-
@@appearance[:Revision] = {:Color => "blue", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
380
|
-
@@appearance[:Body] = {:Color => "purple", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
381
|
-
@@appearance[:XRefSection] = {:Color => "purple", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
382
|
-
@@appearance[:XRefSubSection] = {:Color => "brown", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
383
|
-
@@appearance[:XRef] = {:Color => "gray20", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
384
|
-
@@appearance[:Trailer] = {:Color => "purple", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
385
|
-
@@appearance[:StartXref] = {:Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
386
|
-
@@appearance[:String] = {:Color => "red", :Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_ITALIC}
|
|
387
|
-
@@appearance[:Name] = {:Color => "gray", :Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_ITALIC}
|
|
388
|
-
@@appearance[:Number] = {:Color => "orange", :Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_NORMAL}
|
|
389
|
-
@@appearance[:Dictionary] = {:Color => "brown", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
390
|
-
@@appearance[:Stream] = {:Color => "darkcyan", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
391
|
-
@@appearance[:StreamData] = {:Color => "darkcyan", :Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_OBLIQUE}
|
|
392
|
-
@@appearance[:Array] = {:Color => "darkgreen", :Weight => Pango::WEIGHT_BOLD, :Style => Pango::STYLE_NORMAL}
|
|
393
|
-
@@appearance[:Reference] = {:Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_OBLIQUE}
|
|
394
|
-
@@appearance[:Boolean] = {:Color => "deeppink", :Weight => Pango::WEIGHT_NORMAL, :Style => Pango::STYLE_NORMAL}
|
|
395
|
-
|
|
396
|
-
end
|
|
397
|
-
|
|
398
|
-
def get_object_appearance(type)
|
|
399
|
-
@@appearance[type]
|
|
400
|
-
end
|
|
401
|
-
|
|
402
|
-
def set_node(node, type, text)
|
|
403
|
-
|
|
404
|
-
@treestore.set_value(node, TEXTCOL, text)
|
|
405
|
-
|
|
406
|
-
app = get_object_appearance(type)
|
|
407
|
-
@treestore.set_value(node, WEIGHTCOL, app[:Weight])
|
|
408
|
-
@treestore.set_value(node, STYLECOL, app[:Style])
|
|
409
|
-
@treestore.set_value(node, FGCOL, app[:Color])
|
|
410
|
-
|
|
411
|
-
end
|
|
412
|
-
|
|
413
|
-
end
|
|
414
409
|
|
|
415
410
|
end
|