# ------------------------------------------------------------------------------
#
# **AMS Window Settings**
#
# Homepage
#   http://sketchucation.com/forums/viewtopic.php?f=323&t=42926
#
# Allows you to switch SU full screen and toggle various element of the window.
#
# Usage
#   Use the dialog, toolbar, or menu commands to modify window settings.
#
# Access
#   (Menu) Window → Settings → [Option]
#
# Requirements
#   - Microsoft Windows XP, Vista, 7, or 8
#   - SketchUp 6 or later
#   - AMS Library 2
#
# Version
#   4.2.0
#
# Release Date
#   January 08, 2015
#
# Author
#   Anton Synytsia
#
# ------------------------------------------------------------------------------

require 'sketchup.rb'
require 'extensions.rb'

load_me = true

# Verify operation system.
if RUBY_PLATFORM !~ /mswin|mingw/i
  load_me = false
  msg = "'AMS Window Settings' extension can operate on MSFT Windows based platforms only! "
  msg << "Your operating system doesn't smell like Windows to me."
  UI.messagebox(msg)
  dir = File.dirname(__FILE__)
  File.rename(__FILE__, File.join(dir, 'ams_WindowSettings.rb!'))
end

# Load and verify AMS Library.
begin
  require 'ams_Lib/main.rb'
  raise 'Outdated library!' if AMS::Lib::VERSION.to_f < 2.1
rescue StandardError, LoadError
  msg = "'AMS Window Settings' extension requires AMS Library, version 2.1.0 + ! "
  msg << "This extension will not work without the library installed. "
  msg << "Would you like to get to the library's download page?"
  load_me = false
  if UI.messagebox(msg, MB_YESNO) == IDYES
    UI.openURL('http://sketchucation.com/forums/viewtopic.php?f=323&t=55067#p499835')
  end
end if load_me

module AMS; end
module AMS::WindowSettings

  NAME         = 'AMS Window Settings'.freeze
  VERSION      = '4.2.0'.freeze
  RELEASE_DATE = 'January 08, 2015'.freeze

  # Create the extension
  @extension = SketchupExtension.new NAME, 'ams_WindowSettings/main.rb'

  desc = 'Allows you to switch SU full screen and toggle various element of the window.'

  # Attach some nice info.
  @extension.description = desc
  @extension.version     = VERSION
  @extension.copyright   = 'Copyright © 2014-2015, Anton Synytsia'
  @extension.creator     = 'Anton Synytsia'

  # Register and load the extension on start-up.
  Sketchup.register_extension(@extension, true)

  class << self
    attr_reader :extension
  end

end if load_me
