# Copyright(C) 2007-2012 Terry Ross, Draw Metal LLC
# Portions Copyright 2005, @Last Software, Inc.

# DISCLAIMER OF WARRANTIES
# BECAUSE THIS SOFTWARE IS PROVIDED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE.
# THE SOFTWARE IS PROVIDED "AS IS" WITH ALL FAULTS AND WITHOUT WARRANTY OF ANY KIND,    
# EITHER EXPRESSED, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF SATISFACTORY QUALITY,
# OF FITNESS FOR A PARTICULAR PURPOSE OR USE, OF ACCURACY, OF QUIET ENJOYMENT,
# AND OF NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
# THERE IS NO WARRANTY AS TO THE SOFTWARE'S PERFORMANCE, AGAINST INTERFERENCE WITH
# YOUR ENJOYMENT OF THE SOFTWARE, THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE
# WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION OF THE SOFTWARE WILL BE
# UNINTERRUPTED OR ERROR-FREE, OR THAT DEFECTS IN THE SOFTWARE WILL BE CORRECTED.
# YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT USE OF THE SOFTWARE IS AT YOUR SOLE RISK
# AND THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND EFFORT
# IS WITH YOU.  SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST
# OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
# NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY THE SOFTWARE PROVIDER
# SHALL CREATE A WARRANTY.


module DMTaperMakerMenu
	ext_dir = File.dirname(__FILE__)
	
	dm_ext = File.join(ext_dir, 'dm_taper_maker_ext')
	Sketchup::require(dm_ext)

	DMTaperMaker::Makers.init(ext_dir)
	
	dm_menu_rb = __FILE__

	if( not file_loaded?( dm_menu_rb ) )###
	  plugins_menu = UI.menu("Plugins").add_submenu( $dm_lang.to( "Taper Maker" ) )
	  plugins_menu.add_item( $dm_lang.to( "Draw a Taper" ) ) { DMTaperMaker::Makers.maker( $dm_taper ) }
	  plugins_menu.add_item( $dm_lang.to( "Display Taper Data" ) ) { DMTaperMaker::Makers.display_data( $dm_taper ) }
	  plugins_menu.add_item( $dm_lang.to( "Select Tapers by Attribute" ) ) { DMTaperMaker::Makers.select_by_attribute_value( $dm_taper ) }
	  plugins_menu.add_item( $dm_lang.to( "Assign Stock to Selected Tapers" ) ) { DMTaperMaker::Makers.assign_stock }
	  plugins_menu.add_item( $dm_lang.to( "Accumulate Required Stock" ) ) { DMTaperMaker::Makers.accumulate_required_stock }
	  plugins_menu.add_item( $dm_lang.to( "About Taper Maker" ) ) { DMTaperMaker::Makers.about_maker( $dm_taper ) }

	 # TOOLBAR
	 # courtesy of Max Coppoletta of Quarr-IT
	 # www.quarr-it.com
 
	  toolbar = UI::Toolbar.new $dm_lang.to( "Taper Maker" )
  
	  cmd = UI::Command.new( $dm_lang.to( "Draw a Taper" ) ) { DMTaperMaker::Makers.maker( $dm_taper ) }
			  cmd.small_icon = "dm_taper_icons/tap_16.png"
			  cmd.large_icon = "dm_taper_icons/tap_24.png"
			  cmd.tooltip = $dm_lang.to( "Draw a Taper" )
			  toolbar = toolbar.add_item cmd
		  
	  toolbar.restore

	end

	file_loaded( dm_menu_rb )###
end
