# mx_constructtools.rb (C) 2014 by Henry Schorradt, email@henryschorradt.de, http://www.henryschorradt.de

Sketchup::require 'sketchup.rb'
Sketchup::require 'extensions.rb'
$mxct_plugin_loader = nil

class MX_constructtools_loader

	def initialize
		@mxct_toolbar = nil
		@my_menu = nil
	end
	def setButtonMenu
		@mxct_toolbar = UI::Toolbar.new("Construction Tools")
        parent_menu = UI.menu("Draw")
		@my_menu = parent_menu.add_submenu("Construction Tools")

        cmd = UI::Command.new("Set Curve-Centerpoint") { MX_constructtools::WCO_ADDCICLEPOINT.start }
        cmd.small_icon = File.join("mx_constructtools","addciclepoint_icon.png")
        cmd.large_icon = File.join("mx_constructtools","addciclepoint_icon.png")
        cmd.tooltip = "Set an Construction Curve-Centerpoint"
        cmd.status_bar_text = "Set Curve-Centerpoint"
        cmd.menu_text = "Set Curve-Centerpoint"
        @my_menu.add_item("Set Curve-Centerpoint") { MX_constructtools::WCO_ADDCICLEPOINT.start }
        @mxct_toolbar.add_item cmd

       cmd = UI::Command.new("Set Edge-Points") { MX_constructtools::WCO_ADDENDPOINTS.start }
        cmd.small_icon = File.join("mx_constructtools","addendpoints_icon.png")
        cmd.large_icon = File.join("mx_constructtools","addendpoints_icon.png")
        cmd.tooltip = "Set the Edge-Points"
        cmd.status_bar_text = "Set Edge-Points"
        cmd.menu_text = "Set Edge-Points"
        @my_menu.add_item("Add Edge-Points") { MX_constructtools::WCO_ADDENDPOINTS.start  }
        @mxct_toolbar.add_item cmd

        cmd = UI::Command.new("Add Construction-Points") {  Sketchup.active_model.select_tool(MX_constructtools::WCO_ADDCPOINT.new) }
        cmd.small_icon =  File.join("mx_constructtools","icon_addcpoint.png")
        cmd.large_icon =  File.join("mx_constructtools","icon_addcpoint.png")
        cmd.tooltip = "Add Construction-Point on Elements"
        cmd.status_bar_text = "Add Construction-Points"
        cmd.menu_text = "Add Construction-Points"
        @my_menu.add_item("Add Construction-Points") { Sketchup.active_model.select_tool(MX_constructtools::WCO_ADDCPOINT.new) }
        @mxct_toolbar.add_item cmd



        cmd = UI::Command.new("Draw Construction-Line") { Sketchup.active_model.select_tool MX_constructtools::WCO_CLINETOOL.new }
        cmd.small_icon =  File.join("mx_constructtools","clinetool_icon.png")
        cmd.large_icon =  File.join("mx_constructtools","clinetool_icon.png")
        cmd.tooltip = "Draw Construction Line"
        cmd.status_bar_text = "Draw Construction Line"
        cmd.menu_text = "Draw Construction Line"
        @my_menu.add_item("Draw Construction Line") { Sketchup.active_model.select_tool MX_constructtools::WCO_CLINETOOL.new }
        @mxct_toolbar.add_item cmd
	end

end # class

#-----------------------------------------------------------------------------
if( not file_loaded?(__FILE__) ) then
	$mxct_plugin_loader = MX_constructtools_loader.new
	mx_constructtool = SketchupExtension.new "Construction Tools", File.join("mx_constructtools","mx_constructtools.rb")
	mx_constructtool.name = "Construction Tools"
	mx_constructtool.version = "1.0.0"
	mx_constructtool.description = "Contact: email@henryschorradt.de (german)"
	mx_constructtool.copyright = "Henry Schorradt, 2014"
	mx_constructtool.creator = "Henry Schorradt, http://www.henryschorradt.de"
	Sketchup.register_extension mx_constructtool, true
end
file_loaded(__FILE__)