/usr/share/origami/gui/textview.rb is in origami-pdf 2.0.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 | =begin
This file is part of PDF Walker, a graphical PDF file browser
Copyright (C) 2016 Guillaume Delugré.
PDF Walker is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PDF Walker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
=end
module PDFWalker
class Walker < Window
private
def create_objectview
@objectview = ObjectView.new(self)
end
class ObjectView < Notebook
attr_reader :parent
attr_reader :pdfpanel, :valuepanel
def initialize(parent)
@parent = parent
super()
@pdfbuffer = TextBuffer.new
@pdfview = TextView.new(@pdfbuffer).set_editable(false).set_cursor_visible(false).set_left_margin(5)
@pdfpanel = ScrolledWindow.new.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
@pdfpanel.add_with_viewport @pdfview
append_page(@pdfpanel, Label.new("PDF Code"))
@pdfbuffer.create_tag("Default",
weight: Pango::WEIGHT_BOLD,
family: "monospace",
scale: Pango::AttrScale::LARGE
)
end
def load(object)
begin
self.clear
case object
when Origami::PDF::Header, Origami::FDF::Header, Origami::PPKLite::Header
text = object.to_s
@pdfbuffer.set_text(text)
@pdfbuffer.apply_tag("Default", @pdfbuffer.start_iter, @pdfbuffer.end_iter)
when Origami::Object
if object.is_a?(Origami::Stream)
text = [ "#{object.no} #{object.generation} obj", object.dictionary ].join($/)
else
text = object.to_s
end
text.encode!("UTF-8", replace: '.')
.gsub!("\x00", '.')
@pdfbuffer.set_text(text)
@pdfbuffer.apply_tag("Default", @pdfbuffer.start_iter, @pdfbuffer.end_iter)
end
rescue
@parent.error("An error occured while loading this object.\n#{$!} (#{$!.class})")
end
end
def clear
@pdfbuffer.set_text("")
end
end
end
end
|