require 'sketchup.rb'
Sketchup::require 'CompoSpray/CompoSpray'
Sketchup::require 'CompoSpray/CompoTools'
Sketchup::require 'CompoSpray/CompoNormalTools'
Sketchup::require 'CompoSpray/CompoUtils'

module DBUR
	if defined?(Encoding)
		Plugins=File.dirname(__FILE__).force_encoding("UTF-8")
	else
		Plugins = File.dirname(__FILE__)
	end
	CompoSprayDir = File.join(Plugins, "CompoSpray")
end

compSpray_env()

if (!file_loaded?("compoSprayToolbar.rb"))
	# Standard menu
	drawMenu = UI.menu("Draw")
	csMenu=drawMenu.add_submenu($cs_H["Components Spray"])
	csMenu.add_item($cs_H["Components Spray"] + " [" + $cs_H["Top-Down"] + "]") { compoSpray_main("topdown") }
	csMenu.add_item($cs_H["Components Spray"] + " [" + $cs_H["Perpendicular"] + "]") { compoSpray_main("perpendicular") }
	# Toolbar
	cs_tb = UI::Toolbar.new($cs_H["Components Spray"])
	cmd1 = UI::Command.new($cs_H["Components Spray"] + " [" + $cs_H["Top-Down"] + "]") { compoSpray_main("topdown") }
	cmd1.small_icon = "CompoSpray/IMAGES/cs_Small.png"
	cmd1.large_icon = "CompoSpray/IMAGES/cs_Large.png"
	cmd1.tooltip = $cs_H["Components Spray"] + " [" + $cs_H["Top-Down"] + "]"
	cs_tb.add_item(cmd1)
	
	cmd2 = UI::Command.new($cs_H["Components Spray"] + " [" + $cs_H["Perpendicular"] + "]") { compoSpray_main("perpendicular") }
	cmd2.small_icon = "CompoSpray/IMAGES/csn_Small.png"
	cmd2.large_icon = "CompoSpray/IMAGES/csn_Large.png"
	cmd2.tooltip = $cs_H["Components Spray"] + " [" + $cs_H["Perpendicular"] + "]"
	cs_tb.add_item(cmd2)
	
	cmd3 = UI::Command.new(($cs_H["Settings"])) { compoSpray_settings() }
	cmd3.small_icon = "CompoSpray/IMAGES/csSettings_Small.png"
	cmd3.large_icon = "CompoSpray/IMAGES/csSettings_Large.png"
	cmd3.tooltip = $cs_H["Settings"]
	cs_tb.add_item(cmd3)
end
file_loaded?("compoSprayToolbar.rb")
