Sha256: 976db1874878c480a6673ecbdff39f00763af2c2933f90ad45aeb47eabc6ce9b

Contents?: true

Size: 1.42 KB

Versions: 36

Compression:

Stored size: 1.42 KB

Contents

module Redcar
  class Application
    class OpenNewWindowCommand < Command

      def initialize(title=nil)
        @title = title
      end

      def execute
        window = Redcar.app.new_window
        window.title = @title if @title
      end
    end

    class FocusWindowCommand < Command
      def initialize(window=nil)
        @window = window
      end

      def execute
        win.focus
        @window = nil
      end

      def win
        @window || super
      end
    end

    class CloseWindowCommand < Command
      def initialize(window=nil)
        @window = window
      end

      def execute
        Redcar.app.call_on_plugins(:close_window_guard, win) do |guard|
          return unless guard
        end
        win.close
        quit_if_no_windows if [:linux, :windows].include?(Redcar.platform)
        @window = nil
      end

      private

      def quit_if_no_windows
        if Redcar.app.windows.length == 0
          if Application.storage['stay_resident_after_last_window_closed'] && !(ARGV.include?("--multiple-instance"))
            puts 'continuing to run to wait for incoming drb connections later'
          else
            QuitCommand.new.run
          end
        end
      end

      def win
        @window || super
      end
    end

    class ToggleFullscreen < Command
      def execute
        Redcar.app.focussed_window.fullscreen = !Redcar.app.focussed_window.fullscreen
      end
    end

  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
redcar-0.13 plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.5dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.4dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.3dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.2dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.1dev plugins/application/lib/application/commands/window_commands.rb
redcar-0.12.1 plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.13.0dev plugins/application/lib/application/commands/window_commands.rb
redcar-0.12 plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.27dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.26dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.25dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.24dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.23dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.22dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.21dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.20dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.19dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.18dev plugins/application/lib/application/commands/window_commands.rb
redcar-dev-0.12.17dev plugins/application/lib/application/commands/window_commands.rb