Sha256: 0c784fe25e92aa6815a74c327c96c15e3107e3fc5beae05784e6086a9913dfd1

Contents?: true

Size: 1.48 KB

Versions: 28

Compression:

Stored size: 1.48 KB

Contents

require "rabbit/rabbit"

require "rabbit/renderer/base"

module Rabbit
  module Renderer
    module Print
      module Base
        include Renderer::Base

        attr_writer :filename
        attr_accessor :show_page
        
        def initialize(canvas)
          super
          @filename = nil
        end

        def page_width
          @page_width - page_margin_left - page_margin_right
        end
        
        def page_height
          @page_height - page_margin_top - page_margin_bottom
        end
        
        def width
          page_width
        end

        def height
          page_height
        end

        def paper_width=(value)
          super
          init_paper
        end
        
        def paper_height=(value)
          super
          init_paper
        end
        
        def pre_print(slide_size)
          @show_page = true
        end

        def printable?
          true
        end

        def filename
          @filename ||= default_filename
        end

        def draw_slide(slide, simulation)
          internal_draw_slide(slide, simulation) do
            if simulation
              yield
            else
              save_context do
                internal_clip_slide
                internal_draw_background
                yield
              end
            end
          end
        end

        private
        def default_filename
          "#{GLib.filename_from_utf8(@canvas.title.gsub(/\n/, ''))}.pdf"
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rabbit-2.1.3 lib/rabbit/renderer/print/base.rb
rabbit-2.1.2 lib/rabbit/renderer/print/base.rb
rabbit-2.1.1 lib/rabbit/renderer/print/base.rb
rabbit-2.1.0 lib/rabbit/renderer/print/base.rb
rabbit-2.0.9 lib/rabbit/renderer/print/base.rb
rabbit-2.0.8 lib/rabbit/renderer/print/base.rb
rabbit-2.0.7 lib/rabbit/renderer/print/base.rb
rabbit-2.0.6 lib/rabbit/renderer/print/base.rb
rabbit-2.0.5 lib/rabbit/renderer/print/base.rb
rabbit-2.0.4 lib/rabbit/renderer/print/base.rb
rabbit-2.0.3 lib/rabbit/renderer/print/base.rb
rabbit-2.0.2 lib/rabbit/renderer/print/base.rb
rabbit-2.0.1 lib/rabbit/renderer/print/base.rb
rabbit-2.0.0 lib/rabbit/renderer/print/base.rb
rabbit-1.0.9 lib/rabbit/renderer/print/base.rb
rabbit-1.0.8 lib/rabbit/renderer/print/base.rb
rabbit-1.0.7 lib/rabbit/renderer/print/base.rb
rabbit-1.0.6 lib/rabbit/renderer/print/base.rb
rabbit-1.0.5 lib/rabbit/renderer/print/base.rb
rabbit-1.0.4 lib/rabbit/renderer/print/base.rb