require 'sketchup.rb'

module Max_Coppoletta
		module JHS_standard

MAC = ( Object::RUBY_PLATFORM =~ /(darwin)/i ? true : false ) unless defined?(MAC)
WIN = ( not MAC ) unless defined?(WIN)
OSX = MAC unless defined?(OSX)
PC = WIN unless defined?(PC)		
if PC
	$jhs_winnerone_check = 1  ; 	$jhs_maccherone_check = 0
elsif OSX
	$jhs_winnerone_check = 0  ;   $jhs_maccherone_check = 1
end	

		
@SketchyVersion=Sketchup.version_number.to_i
$jhs_sketchy_version_check = 15 if @SketchyVersion > 15000000
$jhs_sketchy_version_check = 14 if @SketchyVersion > 14000000 && @SketchyVersion < 15000000
$jhs_sketchy_version_check = 13 if @SketchyVersion > 13000000 && @SketchyVersion < 14000000
$jhs_sketchy_version_check = 8 if @SketchyVersion > 8000000 && @SketchyVersion < 9000000
#puts "Sketchup Version is = " + $jhs_sketchy_version_check.to_s


end#mod


@@dir = File.dirname(__FILE__)

$jhs_imex_imx=[]
$jhs_seq_imagexport_rename=('000'..'999').to_a
$jhs_icon_state_standard=Array.new(59,"")


def self.load_options
toolbar=[]
@checks_file = @@dir+'/op_checks.ini'
File.readlines(@checks_file).map { |line| toolbar <<  line.strip }
toolbar.each_with_index do |i,indx|
  $jhs_icon_state_standard[indx] = i
if $jhs_maccherone_check == 1 
  $jhs_icon_state_standard[indx] = 'off' if indx == 5 || indx == 6 || indx == 23 || indx == 27 || indx == 57
end
end#do
end#get_options

#@filetype_3di = "LOAD 3D FILE  (skp,  dwg,  dxf,  3ds,  dae,  dem,  ddf,  kmz,  ifc)|*.skp;*.dxf;*.dwg;*.3ds;*.dae;*.dem;*.ddf;*.ifc;*.ifcZIP;*.kmz||"


=begin                                            SCRIPTS
=end

def self.purge_all_debris
result = UI.messagebox('Purge All Unused', MB_YESNO)
if result == IDYES
	m=Sketchup.active_model
	m.start_operation "Purge ALL"
	d = m.definitions
	l = m.layers
	mt = m.materials
	s = m.styles
	d.purge_unused
	l.purge_unused
	s.purge_unused
	mt.purge_unused
	m.commit_operation
else
	return nil	
end
end#def purge



def self.hide_all_edges(choice)
	m = Sketchup.active_model
	s = m.selection
	if s.empty?
		if UI.messagebox("This will process the whole model!  Continue? ", MB_YESNO, "Hide/Unhide")==7
			return nil
		else
			t = Time.now
			m.start_operation("DiggerHider")
			s = m.active_entities
			self.hide_digger(s,choice)
			m.commit_operation
			tn=Time.now-t
			puts "Finished in " + tn.to_s + " secs"	
		end	
	else
			t = Time.now
			m.start_operation("DiggerHider")
			self.hide_digger(s,choice)
			m.commit_operation
			tn=Time.now-t
			puts "Finished in " + tn.to_s + " secs"	
	end	
end#def

def self.hide_digger(ss,choice)#
	x=[]
	ss.each do |obj|
		self.hide_digger(obj.entities,choice) if obj.is_a?(Sketchup::Group)
		self.hide_digger(obj.definition.entities,choice) if obj.is_a?(Sketchup::ComponentInstance)
		x << obj if obj.is_a?(Sketchup::Edge)
	end
		x.each{|z| z.hidden = true} if choice == 'hide'
		x.each{|z| z.hidden = false} if choice == 'unhide'
end#def




def self.material_selector()
pot=[];@m=Sketchup.active_model;@e=@m.entities;@s=@m.selection
@v=@m.active_view;@eye=@v.camera.eye
#find face side
@m.start_operation("Get material")
@n=@s[0].normal
@vec=@s[0].bounds.center.vector_to(@eye)
@ang=@n.angle_between(@vec)
@mat = @s[0].material if @ang < 90.degrees
@mat = @s[0].back_material if @ang > 90.degrees
#; puts @mat.name
@e.each do |obj| 
if obj.is_a?(Sketchup::Face) 
pot<< obj if obj.material==@mat || obj.back_material==@mat
end;
end#do
@s.add pot
@m.commit_operation
end#def





module MEMO
$jhs_selection_vault_pot=[]

def self.selection_vault
			m=Sketchup.active_model
			s=m.selection
			e=m.entities
      m.start_operation("selection vault")
			if s.empty? && $jhs_selection_vault_pot!=nil
					$jhs_selection_vault_pot.delete_if {|e| e.deleted? }
					s.add $jhs_selection_vault_pot
			else
					$jhs_selection_vault_pot=[]
					s.each{|ss| $jhs_selection_vault_pot << ss}	
					$jhs_selection_vault_pot.flatten!
					$jhs_selection_vault_pot.uniq!
					$jhs_selection_vault_pot.compact!
			end
      m.commit_operation
end#def
end#MEMO


def self.selection_invert()
	m=Sketchup.active_model
	s=m.selection 
	e=m.active_entities 
	m.start_operation("Invert Selection")
	e.each{|obj| s.toggle(obj) }
	m.commit_operation
end


def self.get_edges
    s=Sketchup.active_model.selection
    sa=s.to_a
    s.clear
    sa.each{ |e|s.add(e)if e.is_a? Sketchup::Edge }
end#def
  
def self.get_faces
    s=Sketchup.active_model.selection
    sa=s.to_a
    s.clear
    sa.each{ |e|s.add(e)if e.is_a? Sketchup::Face }
end#def


def self.select_same_instance
acg=[]
m=Sketchup.active_model
s=m.selection
m.start_operation("Get instances")
s.each { |obj|   
	if obj.is_a? Sketchup::ComponentInstance 
		acg << (obj.definition.instances)
	end
	if obj.is_a? Sketchup::Group
		acg << (obj.entities.parent.instances)
	end  }
s.clear
s.add acg
acg=[]
m.commit_operation
end



module CG_convert

def self.cg_converter
m=Sketchup.active_model;s=m.selection;e=m.entities
m.start_operation("CG Converter")
if s.empty?
    UI.messagebox('There is no Group or Component selected.')
else
    if s[0].is_a? Sketchup::ComponentInstance 
        self.cg_unique
    elsif s[0].is_a? Sketchup::Group 
        self.gg_options
    else
        UI.messagebox('There is no Group or Component selected.') 
    end
end
m.commit_operation
end#def


def self.gg_options
prompts = ['Group Convertion to: ']
defaults = [ 'Component Instances']
lists = ['Component Instances|All Unique Components']
go = UI.inputbox(prompts, defaults, lists, 'Groups to Components')
return nil unless go
if go[0].include? "Instances"
    self.gc_instance
elsif go[0].include? "Unique"
    self.gc_unique
end#if
end#

def self.gc_unique#UNIQUE
m = Sketchup.active_model
e=m.active_entities 
s=m.selection
m.start_operation('GtoCu')
pot = s.to_a
c = []
pot.each do |obj|
next unless obj.is_a?(Sketchup::Group)
g = obj.to_component
c << g  
end
s.add(c)
#ng = s[0].parent.entities.add_group(s.to_a)
#s.add ng
m.commit_operation
end

def self.gc_instance#INSTANCES
m=Sketchup.active_model;s=m.selection;e=m.entities;d=m.definitions
unless s.empty?
m.start_operation('GtoC')
gp=s[0].entities.parent
gi=gp.instances.to_a
gc=s[0].to_component
s.clear
pot=[]
@gx=gc.definition
gi.each{|obj|
if obj.deleted?
puts ""
else
@tr=obj.transformation
@ly=obj.layer
@mt=obj.material

c = obj.parent.entities.add_instance(@gx,@tr)
pot << c
end#if 
}
gi.each{|obj|   obj.erase! unless obj.deleted? }
pot.each{|z| 
z.layer=@ly
z.material=@mt  }
sel=@gx.instances.to_a
s.add sel
#ng = s[0].parent.entities.add_group(s.to_a)
#s.add ng
m.commit_operation
end#uless
end


def self.cg_unique
m=Sketchup.active_model
s=m.selection
m.start_operation('CtoG')
sel=[]
cl=s.to_a
cl.each { |obj|
g = nil
g = m.entities.add_group obj
g.name=obj.definition.name
sel << g
obj.explode }
s.add sel
m.commit_operation
end

end #module CG_convert



module JHS_export
@@dir = File.dirname(__FILE__)
@name=""


def self.export_imagex

@cancel = 0
@m=Sketchup.active_model
@v=@m.active_view
@path=@m.path
    if File.exist?(@path)
    @name=@m.title
    else
    @name='Image '
    end
@screen_w = @v.vpwidth
@screen_h = @v.vpheight
@ratio = @screen_w/@screen_h.to_f
@ratio=@ratio.round

self.user_op('false')

@h=@w/@ratio
@h=@h.round.to_i
@filepath_name = UI.savepanel("Save Image File", "~/Desktop/", @name)
return if @filepath_name == nil
@filepath_name=@filepath_name.gsub("\\","/")
@export_path = File.dirname(@filepath_name)

if File.exist?(@filepath_name+"#{@type}")
      ask = UI.messagebox("File already exists. Auto_Rename? (Yes)   (Choose 'No' for Overwrite)", MB_YESNOCANCEL)  
          case ask
                when 6  #Yes
                      $jhs_seq_imagexport_rename.shift
                      @image_to_export = @filepath_name + "_" + $jhs_seq_imagexport_rename[0]+@type.to_s
                      self.go_export_image  if @export_all == 'One'
                      self.go_export_image_all  if @export_all == 'All'
                when 7  #No
                      @image_to_export = @filepath_name+@type.to_s
                      self.go_export_image  if @export_all == 'One'
                      self.go_export_image_all  if @export_all == 'All'
                when 2  #cancel
                      puts "Cancelled."
          end#case
else
                      @image_to_export = @filepath_name+@type.to_s
                      self.go_export_image  if @export_all == 'One'
                      self.go_export_image_all  if @export_all == 'All'
end#ifexist
end#def


def self.go_export_image
    keys = {  :filename => @image_to_export,
    :width => @w,
    :height => @h,
    :antialias => 'Yes',
    :compression => 1.0,
    :transparent => 'Yes'  }
    @v.write_image(keys) if @type != '.jpg'
    @v.write_image(@image_to_export, @w, @h, true, 1.0) if @type == '.jpg'
end#



def self.go_export_image_all
    pages=@m.pages
    current_page = pages.selected_page
    pages.each{|tt| tt.transition_time=0.0 }
          pages.each do |pg|  
          pages.selected_page = @m.pages["#{pg.name}"]
          @scene=@filepath_name+"_"+pg.name+@type
          keys = {  :filename => @scene,  :width => @w, :height => @h,  :antialias => 'Yes',  :compression => 1.0,  :transparent => 'Yes'  }
          @v.write_image(keys) if @type != '.jpg'
          @v.write_image(@scene, @w, @h, true, 1.0) if @type == '.jpg' 
          end#do
    pages.selected_page = @m.pages[current_page.name]
end#

def self.user_op(set)
@setzz = 1 if set == 'true'
@setzz = 0 if set == 'false'
@image_defs = 	@@dir+"/op_image_export.ini"

if not File.exist? (@image_defs)
      $jhs_imex_imx << ['2400','.png','Yes','Yes','1.0','Yes','One']
      File.open(@image_defs, 'w') {|line| line.write $jhs_imex_imx.join("\n")}		
      @setzz = 1

else

if $jhs_imex_imx.length == 0 || @setzz == 1
      $jhs_imex_imx.clear
      File.readlines(@image_defs).map { |line| $jhs_imex_imx <<  line.strip }
      @w = $jhs_imex_imx[0].to_i
      @type = $jhs_imex_imx[1]
      @alpha = $jhs_imex_imx[2]
      @alias = $jhs_imex_imx[3]
      @compress = $jhs_imex_imx[4]
      @dialog = $jhs_imex_imx[5]
      @export_all = $jhs_imex_imx[6]
else
      @w = $jhs_imex_imx[0].to_i
      @type = $jhs_imex_imx[1]
      @alpha = $jhs_imex_imx[2]
      @alias = $jhs_imex_imx[3]
      @compress = $jhs_imex_imx[4]
      @dialog = $jhs_imex_imx[5]
      @export_all = $jhs_imex_imx[6]
end
end

unless @dialog == 'No' && @setzz != 1
    if @setzz == 1
              prompts = [ 'Resolution (Width)   ', 'Image Type', 'Alpha (png, tif)   ', 'AntiAlias', 'Compression', 'Display Dialog']
              defaults = [ "#{@w}", "#{@type}", "#{@alpha}", "#{@alias}", "#{@compress}", "#{@dialog}" ]
              lists = ['1000|2000|2400|3000|3600|4000|5000|6000|7000|8000|9000|9999|', '.jpg|.png|.tif', 'Yes|No', 'Yes|No', '0.1|0.2|0.3|0.4|0.5|0.6|0.7|0.8|0.9|1.0', 'Yes|No']
              user = UI.inputbox(prompts, defaults, lists, 'Export Image Options')
              return nil unless user
              user1, user2, user3, user4, user5, user6 = user
              @dialog = user6
              $jhs_imex_imx[5] = user6
        elsif @setzz == 0
              prompts = [ 'Resolution (Width)   ', 'Image Type', 'Alpha (png, tif)   ', 'AntiAlias', 'Compression', 'Export Scenes   ']
              defaults = [ "#{@w}", "#{@type}", "#{@alpha}", "#{@alias}", "#{@compress}", "One"]
              lists = ['1000|2000|2400|3000|3600|4000|5000|6000|7000|8000|9000|9999', '.jpg|.png|.tif', 'Yes|No', 'Yes|No', '0.1|0.2|0.3|0.4|0.5|0.6|0.7|0.8|0.9|1.0', 'All|One']
              user = UI.inputbox(prompts, defaults, lists, 'Export Image Options')
              return nil unless user
              user1, user2, user3, user4, user5, user6 = user
              @export_all = user6
              $jhs_imex_imx[6] = user6 if @setzz == 0 #scenes
    end

    @w=user1.to_i
    @type = user2
    @alpha = 'true' if user3 == 'Yes' && user2 == '.png'
    @alpha = 'true' if user3 == 'Yes' && user2 == '.tif'
    @alpha = 'false' if user2 == '.jpg' 
    @alpha = 'false' if user3 == 'No'
    @alias = 'true' if user4 == 'Yes'
    @alias = 'false' if user4 == 'No'
    @compress = user5
    $jhs_imex_imx[0] = @w
    $jhs_imex_imx[1] = user2
    $jhs_imex_imx[2] = user3
    $jhs_imex_imx[3] = user4
    $jhs_imex_imx[4] = user5

        if @setzz == 1
          File.open(@image_defs, 'w') {|line| line.write  $jhs_imex_imx.join("\n")}		
          @setzz = 0
        end
end#uless
end#def op

end#module export image



def self.zoom_back
m=Sketchup.active_model ; s=m.selection  ; v = m.active_view
    if s.empty?
      v.zoom_extents
    else
      e = s[0]
      c = v.camera
      eye = c.eye
      t = c.target
      up = c.up
      t = e.bounds.center
      c.set(eye, t, up)
      v.zoom(m.selection)
    end 
end#def




@c = 0
def self.working_kopies
m=Sketchup.active_model;s=m.selection;e=m.entities;d=m.definitions;v=m.active_view;l=m.layers
m.start_operation("Get material")
if @c==0
@wkops=[]
@wkops_file = @@dir+'/op_wk_ops.ini'
File.readlines(@wkops_file).map { |line| @wkops <<  line.strip }
@c = @c+1
@jump = @wkops[1]
end
return if s.empty?
nl = l.add  '_WORKING_COPIES'
nl.visible = false
g = e.add_group(s)
g.name = g.entities.parent.name = 'WK_ORIGINAL_0' + (@c).to_s
gtr = g.transformation
unless @wkops[0] == 'No'
jump=inputbox(["Move by"],[@wkops[1]],"Move WorkCopy Below")
return nil unless jump
@jump=jump[0]
end
gcopy=g.parent.entities.add_instance(g.entities.parent, gtr)
gcopy.name = gcopy.entities.parent.name = 'WK_CLONE_0' + (@c).to_s
vector = Geom::Vector3d.new(0, 0, @jump.to_i)
tr = Geom::Transformation.translation(vector)
gcopy.transform! tr
gcopy.layer = nl
m.commit_operation
end#def


def self.working_kopies_ops
@wkops=[]
@wkops_file = @@dir+'/op_wk_ops.ini'
File.readlines(@wkops_file).map { |line| @wkops <<  line.strip }
wkops=inputbox(["Display Dialog Box?    ","Set Default Distance"],["#{@wkops[0]}","#{@wkops[1]}"],['Yes|No',""],"Working Copies Options")
return nil unless wkops
File.open(@wkops_file, 'w') do |item|
wkops.to_a.each { |line| item.puts line }
end
end#def





module JHS_zoom
class Zoomer

def initialize()
@@rate1=1.001
@@rate2=0.999
@@zoom='off'
@@dir = File.dirname(__FILE__)
sequence_cursor = File.join(@@dir + "/_ICONS/tb/zoomer.png")
@cursor = UI.create_cursor(sequence_cursor, 15, 13)		if sequence_cursor
Sketchup::set_status_text("ARROWS:     UP = Zoom In   DOWN = Zoom Out    RIGHT = Slower In    LEFT =  Slower Out  ")
end	

def onSetCursor
	set_cursor()
end#def
def set_cursor
	UI.set_cursor(@cursor)
end#def

def onMouseMove(flags, x, y, view)
Sketchup::set_status_text("CLICK+MOUSE MOVE =>   [LEFT = Zoom In]  [RIGHT = Zoom Out]         ARROWS =>   [UP = Zoom In]  [DOWN = Zoom Out]  [RIGHT = Slower In]  [LEFT =  Slower Out]" )
unless  @@zoom== 'off'
Sketchup.active_model.active_view.zoom @@rate1  if @@zoomdir == 'front'
Sketchup.active_model.active_view.zoom @@rate2  if @@zoomdir == 'back'
end#uless
end#onmousemove

def onLButtonDown(flags, x, y, view)
if @@zoom  == 'off'
@@zoom = 'on'
@@zoomdir = 'front'
elsif @@zoom == 'on'
@@zoom = 'off'
end
#puts @@zoom + @@zoomdir
end#onLbuttondown

def onRButtonDown(flags, x, y, view)
if @@zoom  == 'off'
@@zoom = 'on'
@@zoomdir = 'back'
elsif @@zoom == 'on'
@@zoom = 'off'
end
#puts @@zoom + @@zoomdir
end#onLbuttondown

def onKeyDown(key, repeat, flags, view)
case key
when VK_UP
@@zoomdir = 'front' ; @@zoom = 'on' ; Sketchup.active_model.active_view.zoom @@rate1
when VK_DOWN
@@zoomdir = 'back' ; @@zoom = 'on' ; Sketchup.active_model.active_view.zoom @@rate2
when VK_RIGHT
@@rate1 = 1.001
@@rate2 = 0.999
when VK_LEFT
@@rate1 = 1.0002
@@rate2 = 0.9998
end
end # onkey		

def draw(view)
#view.draw_text [10,10], "Zoom is:  "+ @@zoom.to_s
view.draw_text [10,10], "Zoom Dir is:  "+ @@zoomdir.to_s.capitalize
view.draw_text [10,30], "Speed is:  "+ @@rate1.to_s if @@zoomdir == 'front'
view.draw_text [10,30], "Speed is:  "+ @@rate2.to_s if @@zoomdir == 'back'
view.draw_text [10,80], 'Keyboard:'
view.draw_text [10,100], 'Arrow Up = Zoom In'
view.draw_text [10,120], 'Arrow Down = Zoom Out'
view.draw_text [10,140], 'Arrow Right = Faster Step'
view.draw_text [10,160], 'Arrow Left = Slower Step'
view.draw_text [10,190], 'Mouse:'
view.draw_text [10,210], 'Left Click = Start/Stop Forward'
view.draw_text [10,230], 'Right Click = Start/Stop Backward'
view.draw_text [10,250], 'Move Mouse = Continuous Zooming'
end

def deactivate(view)
view.invalidate
Sketchup::status_text=""
Sketchup::set_status_text("", SB_VCB_LABEL)
Sketchup::set_status_text("", SB_VCB_VALUE)
end	

end # class
end   # module




def self.material_finder
@m=Sketchup.active_model;@s=@m.selection;@e=@m.entities;@v=@m.active_view;@eye=@v.camera.eye
@m.start_operation('op')
@pot=[]
@n=@s[0].normal
@vec=@s[0].bounds.center.vector_to(@eye)
@ang=@n.angle_between(@vec)
@mat = @s[0].material if @ang < 90.degrees
@mat = @s[0].back_material if @ang > 90.degrees
#get faces
array_context = @e.grep(Sketchup::Face)
from_comps = @e.grep(Sketchup::ComponentInstance)
array_comps = from_comps.map { |c| c.definition.entities.grep(Sketchup::Face) }.uniq
from_groups = @e.grep(Sketchup::Group)
array_groups = from_groups.map { |g| g.entities.grep(Sketchup::Face) }.uniq
@faces=array_context.push(*array_comps).push(*array_groups)
@faces.flatten!;@faces.compact!
#once gathered, check material
@faces.each{|obj| @pot << obj if obj.material==@mat || obj.back_material==@mat  }
#get edges
array_context = @e.grep(Sketchup::Edge)
from_comps = @e.grep(Sketchup::ComponentInstance)
array_comps = from_comps.map { |c| c.definition.entities.grep(Sketchup::Edge) }.uniq
from_groups = @e.grep(Sketchup::Group)
array_groups = from_groups.map { |g| g.entities.grep(Sketchup::Edge) }.uniq
@edge=array_context.push(*array_comps).push(*array_groups)
@edge.flatten!;@edge.compact!
@hide=@edge.to_a + (@faces.to_a - @pot.to_a)
@others=@e.to_a-@pot.to_a
@others.each{|obj| obj.hidden=true unless obj.is_a?( Sketchup::Group ) ||  obj.is_a?( Sketchup::ComponentInstance )  }
@hide.each{|obj| obj.hidden=true}
Sketchup.send_action('viewShowHidden:')   if Sketchup.active_model.rendering_options["DrawHidden"] == true
@s.clear
@m.commit_operation
end#def






=begin                                            CADFATHER STYLES
=end

#  DEFINING STYLE FILES

def self.sty1 		#  DEFAULT

	Sketchup.active_model.active_view.camera.aspect_ratio = 0.0
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/01-DEFAULTx.style'), true)  
	Sketchup.active_model.shadow_info["DisplayShadows"] = false    
end

def self.sty2		# CAD LINES
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/02-CADLINESx.style'), true) 
	
end

 def self.sty3		#   FACECHECK
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/03-FACECHECKx.style'), true)    
	Sketchup.active_model.shadow_info["DisplayShadows"] = false
end

def self.sty4		#    SHADOWS
	Sketchup.active_model.rendering_options["EdgeDisplayMode"] == 0
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/04-SHADOWSx.style'), true)    
	Sketchup.active_model.shadow_info["DisplayShadows"] = true
	Sketchup.active_model.rendering_options["EdgeDisplayMode"] = 0
end

def self.sty5		#   TRACER
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/05-TRACERx.style'), true)    
	Sketchup.active_model.shadow_info["DisplayShadows"] = false
end

def self.sty6		#    JITTERS
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/06-JITTERSx.style'), true)    
end

def self.sty7		#   SKETCHY EDGES
	styles = Sketchup.active_model.styles
	status = styles.add_style(File.join(File.dirname(__FILE__), 'STYLES/07-SKETCHx.style'), true)    
end



	
=begin          
                                  TOOLBAR MANAGER
								  
=end








@label0 ="New File"
@label1 ="Open File"
@label2 ="Save (Fast 2015)"
@label3 ="Save As... (Fast 2015)"
@label4 ="Save as 8"
@label5 ="Import 3D File (PC)"  #
@label6 ="Export 3D File (PC)"  #
@label7 ="Image Import"
@label8 ="Image Export"
@label9 ="Cut"
@label10 ="Copy"
@label11 ="Paste"
@label12 ="Paste in Place"
@label13 ="Delete"
@label14 ="Scene Add"
@label15 ="Scene Delete"
@label16 ="Undo"
@label17 ="Redo"
@label18 ="View:  Iso"
@label19 ="View:  Top/Bottom"
@label20 ="View:  Front/Back"
@label21 ="View:  Left/Right"
@label22 ="X-Ray"
@label23 ="Back Edges (PC)" #
@label24 ="WireFrame / Hidden"
@label25 ="Shaded / Textured"
@label26 ="Toggle Edges"
@label27 ="Toggle Profiles (PC)"  #
@label28 ="Edges by Axis"
@label29 ="Style: Cad Lines"
@label30 ="Style: Default"
@label31 ="Style: Jitter"
@label32 ="Style: Sketchy"
@label33 ="Style: Face Check"
@label34 ="Style: Tracer"
@label35 ="Style: Shadows Only"
@label36 ="Toggle Guides"
@label37 ="Component Axis"
@label38 ="Select All"
@label39 ="Invert Selection"
@label40 ="Selection Vault"
@label41 ="Zoom ExtentsSelection"
@label42 ="Filter Edges"
@label43 ="Filter Faces"
@label44 ="Select by Material"
@label45 ="Isolate Material"
@label46 ="Select Instances"
@label47 ="CG Convert"
@label48 ="Create Working Copy"
@label49 ="Hide Edges"
@label50 ="Unhide Edges"
@label51 ="Hide Rest of the Model"
@label52 ="2 Point Perspective"
@label53 ="Field of View"
@label54 ="Undo View Change"
@label55 ="Redo View Change"
@label56 ="Step Zoomer"
@label57 ="Toggle Shadows"
@label58 ="Purge Model"
@label59 ="Set up Shortcuts (PC)"  #
#@label60 ="Ruby Console"


#####


@status0 =  'Create a new file.'
@status1 =  'Open SketchUp File.'
@status2 =  'Use Fast Save (2015).    (Shaded mode - no shadows =>  up to 60% faster).'
@status3 =  'Use Save as... (Fast mode 2015).'
@status4 =  'Save current file as version 8 (Fast Save).'
@status5 =  'Import 3D File.'
@status6 =  'Export 3D File.'
@status7 =  'Import Image File.'
@status8 =  'Export Images.    Choose options and quantity.   (Settings available in menu).'
@status9 =  'Cut selected entities.'
@status10 =  'Copy selected entities.'
@status11 =  'Paste selected entities.'
@status12 =  'Paste entities in their original position.'
@status13 =  'Delete selected entities.'
@status14 =  'Add Scene.'
@status15 =  'Delete current Scene.'
@status16 =  'Undo last operation.'
@status17 =  'Redo last operation.'
@status18 =  'View: Iso.'
@status19 =  'Flip between Top and Bottom Camera views.'
@status20 =  'Flip between Front and Back Camera views.'
@status21 =  'Flip between Left and Right Camera views.'
@status22 =   'X-Ray.'
@status23 =  'Back Edges.'
@status24 =  'Flip between Wireframe and Hidden Line rendering.'
@status25 =  'Flip between Shaded and Textured rendering.'
@status26 =  'Show or hide Model Edges.'
@status27 =  'Show or hide Profile Lines.'
@status28 =  'Colours all Edges by their Axis.'
@status29 =  'Renders model for exporting to CAD.'
@status30 =  'Default modeling style.'
@status31 =  'Renders model with jittered lines.'
@status32 =  'Renders model with sketchy lines.'
@status33 =  "Check for 'Front' or 'Back' faces."
@status34 =  'Tracing over images with thick edges by axis and transparency.'
@status35 =  'Renders model with shadows only.'
@status36 =  'Show or hide all Guides.'
@status37 =  'Show or hide all Group/Component axis.'
@status38 =  'Select all entities in the model.'
@status39 =  'Invert Selection.'
@status40 =  'Click to save current selection state.  Click again to restore the selection.'
@status41 =  'Zoom to to extents or selection.'
@status42 =  'Keep only Edges selected.'
@status43 =  'Keep only Faces selected.'
@status44 =  'Select all faces with the same material.'
@status45 =  'Select one material on face.  Only objects with same material will remain visible  (Also in G & C).'
@status46 =  'Select same CG instances as current entities.'
@status47 =  'Convert Groups to Components and viceversa.'
@status48 =  "Creates a Safe Group Copy a distance below, hidden in Layer '_WORKING_COPIES'"
@status49 =  'Hide Edges.'
@status50 =  'Unhide Edges.'
@status51 =  'Hide rest of model when in Groups or Components.'
@status52 =  'Fake a 2 Point Perspective for rendering.'
@status53 =  'Change the Field of view (FOV).'
@status54 =  'Go to the previous Camera View.'
@status55 =  'Go to the next Camera View.'
@status56 =  'Zoom by tiny increments.  Use Mouse or Arrow keys.'
@status57 =  'Toggle Shadows On or Off.'
@status58 =  'Purge model of ALL unused Entities.'
@status59 =  'Opens the Shortcut Preferences Panel.'
#@status60 = ' Toggles the Ruby console.'










def self.web_dialog
@checked = []
$jhs_icon_state_standard.each_with_index { |z,i|  
@checked[i]='checked'  if z == 'On' 
@checked[i]='Off'  if z == 'Off'  }


web_dialog_file = @@dir + "/jhs_standard.html"
web_dialog_code ="<!doctype html>
<html>
<script type='text/javascript'>
function callRuby(actionName) { query = 'skp:user_options@' + actionName;  window.location.href = query; }
function checkState() {var state = document.forms[0];  var flag = '';  var i;
for (i = 0; i < state.length; i++) { if (state[i].checked) {flag = flag + state[i].value + ','; } }
query = 'skp:get_state@'+ flag ; window.location.href = query;}
</script>
<head><meta charset='utf-8'><title>JHS Standard 2015</title><style type='text/css'>

.stage {background-color: #B9B9B9;width: 980px;height: 706px;position: absolute;}
.header {background-color: #313131;width: 980px;height: 96px;position: absolute;}
.col1 {width: 245px;height: 610px;position: absolute;top: 96px;color: #F7F7F7;}
.col2 {width: 245px;height: 610px;position: absolute;top: 96px;left: 245px;color: #F7F7F7;}
.col3 {width: 245px;height: 610px;position: absolute;top: 96px;left: 490px;color: #F7F7F7;}
.col4 {width: 245px;height: 610px;position: absolute;top: 96px;left: 735px;color: #F7F7F7;}
.logo {	background-color: #333333;	width: 90px;	height: 90px;	left: 8px;	position: absolute; }
.title {	width: 500px;	height: 66px;	position: absolute;	left: 130px;	top: 0px;	color: #FFCE00;	font-size: xx-large;	font-weight: bold;	padding-top: 30px;	padding-left: 0px; }
.buttons {position: absolute;left: 630px;width: 350px;height: 96px;}
body,td,th {	font-family: Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif ; color: #1C1C1C;	font-size: small; 	font-weight: bold; }
body {	background-color: #313131; }

</style></head><body>
<div class='stage'><div class='header'><div class='logo'><img src='_ICONS/tb/jhs.png' width='90' height='90' alt=''/></div><div class='title'>JHS Standard 2015</div><div class='buttons'>
<table width='100%' border='0' cellspacing='0' cellpadding='0'><tbody>

<tr><!--    CANCEL BUTTON    -->
<td align='center'><input name='imageField1' type='image' id='Cancel' value='Cancel' onClick="+"\""+"callRuby('Cancel')"+"\""+" src='_ICONS/tb/b_cancel.png' width='130' height='32'></td>
<!--    APPLY  BUTTON    -->
<td height='96' align='center' valign='middle'><input name='imageField2' type='image'  id='Apply' value='Apply' onClick="+"\""+"checkState() ; callRuby('Apply')"+"\""+" src='_ICONS/tb/b_apply.png' width='130' height='32'></td>

</tr></tbody><form><!--    FORM START    -->
</table></div></div><div class='col1'><table height='610' border='0' cellpadding='0' cellspacing='0'><tbody><tr>
<td><canvas id='canvas' width='12' height='12'></canvas></td>
<td><canvas id='canvas2' width='34' height='12'></canvas></td>
<td><canvas id='canvas3' width='6' height='12'></canvas></td>
<td><canvas id='canvas4' width='192' height='12'></canvas></td></tr><tr>

<!--    COLUMN 1    -->
<td>&nbsp;</td><td><img src='_ICONS/tb/i00.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='0' id='id0' value='0' onclick="+"\""+"callRuby('0')"+"\"" "#{@checked[0]}"+">
<label for='id0'>"+"#{@label0}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i01.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='1' id='id1' value='1' onclick="+"\""+"callRuby('1')"+"\"" "#{@checked[1]}"+">
<label for='id1'>"+"#{@label1}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i02.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='2' id='id2' value='2' onclick="+"\""+"callRuby('2')"+"\"" "#{@checked[2]}"+">
<label for='id2'>"+"#{@label2}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i03.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='3' id='id3' value='3' onclick="+"\""+"callRuby('3')"+"\"" "#{@checked[3]}"+">
<label for='id3'>"+"#{@label3}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i04.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='4' id='id4' value='4' onclick="+"\""+"callRuby('4')"+"\"" "#{@checked[4]}"+">
<label for='id4'>"+"#{@label4}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i05.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='5' id='id5' value='5' onclick="+"\""+"callRuby('5')"+"\"" "#{@checked[5]}"+">
<label for='id5'>"+"#{@label5}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i06.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='6' id='id6' value='6' onclick="+"\""+"callRuby('6')"+"\"" "#{@checked[6]}"+">
<label for='id6'>"+"#{@label6}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i07.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='7' id='id7' value='7' onclick="+"\""+"callRuby('7')"+"\"" "#{@checked[7]}"+">
<label for='id7'>"+"#{@label7}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i08.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='8' id='id8' value='8' onclick="+"\""+"callRuby('8')"+"\"" "#{@checked[8]}"+">
<label for='id8'>"+"#{@label8}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i09.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='9' id='id9' value='9' onclick="+"\""+"callRuby('9')"+"\"" "#{@checked[9]}"+">
<label for='id9'>"+"#{@label9}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i10.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='10' id='id10' value='10' onclick="+"\""+"callRuby('10')"+"\"" "#{@checked[10]}"+">
<label for='id10'>"+"#{@label10}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i11.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='11' id='id11' value='11' onclick="+"\""+"callRuby('11')"+"\"" "#{@checked[11]}"+">
<label for='id11'>"+"#{@label11}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i12.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='12' id='id12' value='12' onclick="+"\""+"callRuby('12')"+"\"" "#{@checked[12]}"+">
<label for='id12'>"+"#{@label12}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i13.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='13' id='id13' value='13' onclick="+"\""+"callRuby('13')"+"\"" "#{@checked[13]}"+">
<label for='id13'>"+"#{@label13}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i14.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='14' id='id14' value='14' onclick="+"\""+"callRuby('14')"+"\"" "#{@checked[14]}"+">
<label for='id14'>"+"#{@label14}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></div>
<div class='col2'><table height='610' border='0' cellpadding='0' cellspacing='0'><tbody><tr>
<td><canvas id='canvas13' width='12' height='12'></canvas></td>
<td><canvas id='canvas14' width='34' height='12'></canvas></td>
<td><canvas id='canvas15' width='6' height='12'></canvas></td>
<td><canvas id='canvas16' width='192' height='12'></canvas></td></tr><tr>
<!--    COLUMN 2    -->
<td>&nbsp;</td><td><img src='_ICONS/tb/i15.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='15' id='id15' value='15' onclick="+"\""+"callRuby('15')"+"\"" "#{@checked[15]}"+">
<label for='id15'>"+"#{@label15}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i16.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='16' id='id16' value='16' onclick="+"\""+"callRuby('16')"+"\"" "#{@checked[16]}"+">
<label for='id16'>"+"#{@label16}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i17.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='17' id='id17' value='17' onclick="+"\""+"callRuby('17')"+"\"" "#{@checked[17]}"+">
<label for='id17'>"+"#{@label17}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i18.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='18' id='id18' value='18' onclick="+"\""+"callRuby('18')"+"\"" "#{@checked[18]}"+">
<label for='id18'>"+"#{@label18}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i19.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='19' id='id19' value='19' onclick="+"\""+"callRuby('19')"+"\"" "#{@checked[19]}"+">
<label for='id19'>"+"#{@label19}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i20.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='20' id='id20' value='20' onclick="+"\""+"callRuby('20')"+"\"" "#{@checked[20]}"+">
<label for='id20'>"+"#{@label20}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i21.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='21' id='id21' value='21' onclick="+"\""+"callRuby('21')"+"\"" "#{@checked[21]}"+">
<label for='id21'>"+"#{@label21}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i22.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='22' id='id22' value='22' onclick="+"\""+"callRuby('22')"+"\"" "#{@checked[22]}"+">
<label for='id22'>"+"#{@label22}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i23.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='23' id='id23' value='23' onclick="+"\""+"callRuby('23')"+"\"" "#{@checked[23]}"+">
<label for='id23'>"+"#{@label23}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i24.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='24' id='id24' value='24' onclick="+"\""+"callRuby('24')"+"\"" "#{@checked[24]}"+">
<label for='id24'>"+"#{@label24}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i25.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='25' id='id25' value='25' onclick="+"\""+"callRuby('25')"+"\"" "#{@checked[25]}"+">
<label for='id25'>"+"#{@label25}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i26.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='26' id='id26' value='26' onclick="+"\""+"callRuby('26')"+"\"" "#{@checked[26]}"+">
<label for='id26'>"+"#{@label26}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i27.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='27' id='id27' value='27' onclick="+"\""+"callRuby('27')"+"\"" "#{@checked[27]}"+">
<label for='id27'>"+"#{@label27}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i28.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='28' id='id28' value='28' onclick="+"\""+"callRuby('28')"+"\"" "#{@checked[28]}"+">
<label for='id28'>"+"#{@label28}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i29.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='29' id='id29' value='29' onclick="+"\""+"callRuby('29')"+"\"" "#{@checked[29]}"+">
<label for='id29'>"+"#{@label29}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></div>
<div class='col3'><table height='610' border='0' cellpadding='0' cellspacing='0'><tbody><tr>
<td><canvas id='canvas13' width='12' height='12'></canvas></td>
<td><canvas id='canvas14' width='34' height='12'></canvas></td>
<td><canvas id='canvas15' width='6' height='12'></canvas></td>
<td><canvas id='canvas16' width='192' height='12'></canvas></td></tr><tr>
<!--    COLUMN 3    -->
<td>&nbsp;</td><td><img src='_ICONS/tb/i30.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='30' id='id30' value='30' onclick="+"\""+"callRuby('30')"+"\"" "#{@checked[30]}"+">
<label for='id30'>"+"#{@label30}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i31.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='31' id='id31' value='31' onclick="+"\""+"callRuby('31')"+"\"" "#{@checked[31]}"+">
<label for='id31'>"+"#{@label31}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i32.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='32' id='id32' value='32' onclick="+"\""+"callRuby('32')"+"\"" "#{@checked[32]}"+">
<label for='id32'>"+"#{@label32}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i33.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='33' id='id33' value='33' onclick="+"\""+"callRuby('33')"+"\"" "#{@checked[33]}"+">
<label for='id33'>"+"#{@label33}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i34.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='34' id='id34' value='34' onclick="+"\""+"callRuby('34')"+"\"" "#{@checked[34]}"+">
<label for='id34'>"+"#{@label34}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i35.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='35' id='id35' value='35' onclick="+"\""+"callRuby('35')"+"\"" "#{@checked[35]}"+">
<label for='id35'>"+"#{@label35}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i36.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='36' id='id36' value='36' onclick="+"\""+"callRuby('36')"+"\"" "#{@checked[36]}"+">
<label for='id36'>"+"#{@label36}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i37.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='37' id='id37' value='37' onclick="+"\""+"callRuby('37')"+"\"" "#{@checked[37]}"+">
<label for='id37'>"+"#{@label37}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i38.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='38' id='id38' value='38' onclick="+"\""+"callRuby('38')"+"\"" "#{@checked[38]}"+">
<label for='id38'>"+"#{@label38}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i39.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='39' id='id39' value='39' onclick="+"\""+"callRuby('39')"+"\"" "#{@checked[39]}"+">
<label for='id39'>"+"#{@label39}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i40.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='40' id='id40' value='40' onclick="+"\""+"callRuby('40')"+"\"" "#{@checked[40]}"+">
<label for='id40'>"+"#{@label40}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i41.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='41' id='id41' value='41' onclick="+"\""+"callRuby('41')"+"\"" "#{@checked[41]}"+">
<label for='id41'>"+"#{@label41}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i42.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='42' id='id42' value='42' onclick="+"\""+"callRuby('42')"+"\"" "#{@checked[42]}"+">
<label for='id42'>"+"#{@label42}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i43.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='43' id='id43' value='43' onclick="+"\""+"callRuby('43')"+"\"" "#{@checked[43]}"+">
<label for='id43'>"+"#{@label43}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i44.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='44' id='id44' value='44' onclick="+"\""+"callRuby('44')"+"\"" "#{@checked[44]}"+">
<label for='id44'>"+"#{@label44}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></div>
<div class='col4'><table height='610' border='0' cellpadding='0' cellspacing='0'><tbody><tr>
<td><canvas id='canvas13' width='12' height='12'></canvas></td>
<td><canvas id='canvas14' width='34' height='12'></canvas></td>
<td><canvas id='canvas15' width='6' height='12'></canvas></td>
<td><canvas id='canvas16' width='192' height='12'></canvas></td></tr><tr>
<!--    COLUMN 4    -->
<td>&nbsp;</td><td><img src='_ICONS/tb/i45.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='45' id='id45' value='45' onclick="+"\""+"callRuby('45')"+"\"" "#{@checked[45]}"+">
<label for='id45'>"+"#{@label45}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i46.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='46' id='id46' value='46' onclick="+"\""+"callRuby('46')"+"\"" "#{@checked[46]}"+">
<label for='id46'>"+"#{@label46}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i47.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='47' id='id47' value='47' onclick="+"\""+"callRuby('47')"+"\"" "#{@checked[47]}"+">
<label for='id47'>"+"#{@label47}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i48.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='48' id='id48' value='48' onclick="+"\""+"callRuby('48')"+"\"" "#{@checked[48]}"+">
<label for='id48'>"+"#{@label48}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i49.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='49' id='id49' value='49' onclick="+"\""+"callRuby('49')"+"\"" "#{@checked[49]}"+">
<label for='id49'>"+"#{@label49}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i50.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='50' id='id50' value='50' onclick="+"\""+"callRuby('50')"+"\"" "#{@checked[50]}"+">
<label for='id50'>"+"#{@label50}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i51.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='51' id='id51' value='51' onclick="+"\""+"callRuby('51')"+"\"" "#{@checked[51]}"+">
<label for='id51'>"+"#{@label51}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i52.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='52' id='id52' value='52' onclick="+"\""+"callRuby('52')"+"\"" "#{@checked[52]}"+">
<label for='id52'>"+"#{@label52}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i53.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='53' id='id53' value='53' onclick="+"\""+"callRuby('53')"+"\"" "#{@checked[53]}"+">
<label for='id53'>"+"#{@label53}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i54.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='54' id='id54' value='54' onclick="+"\""+"callRuby('54')"+"\"" "#{@checked[54]}"+">
<label for='id54'>"+"#{@label54}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i55.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='55' id='id55' value='55' onclick="+"\""+"callRuby('55')"+"\"" "#{@checked[55]}"+">
<label for='id55'>"+"#{@label55}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i56.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='56' id='id56' value='56' onclick="+"\""+"callRuby('56')"+"\"" "#{@checked[56]}"+">
<label for='id56'>"+"#{@label56}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i57.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='57' id='id57' value='57' onclick="+"\""+"callRuby('57')"+"\"" "#{@checked[57]}"+">
<label for='id57'>"+"#{@label57}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i58.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='58' id='id58' value='58' onclick="+"\""+"callRuby('58')"+"\"" "#{@checked[58]}"+">
<label for='id58'>"+"#{@label58}"+"</label></td>
</tr><tr>
<td>&nbsp;</td><td><img src='_ICONS/tb/i59.png' width='24' height='24' alt=''/></td>
<td>&nbsp;</td><td><input type='checkbox' name='59' id='id59' value='59' onclick="+"\""+"callRuby('59')"+"\"" "#{@checked[59]}"+">
<label for='id59'>"+"#{@label59}"+"</label></td>
</tr><tr>



<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
</tr></tbody></table>
</form><!--    FORM END    -->
</div></div></body></html>"

File.write(web_dialog_file, web_dialog_code)
@screen_w = Sketchup.active_model.active_view.vpwidth/2
@screen_h = Sketchup.active_model.active_view.vpheight/4
#@webdialog = UI::WebDialog.new("Web Dialog", false, "", 1004, 746, @screen_w-500, @screen_h, false)
@webdialog = UI::WebDialog.new("Web Dialog", false, "", 1004, 746, 50, 50, false)
@webdialog.set_file(File.join(web_dialog_file))	if web_dialog_file
RUBY_PLATFORM =~ /(darwin)/ ? @webdialog.show_modal() : @webdialog.show

@checkboxes=[] 
@webdialog.add_action_callback("user_options") do |wd, results|
  case results
      when 'Apply'
            @checkboxes.clear
             self.go_apply
             self.go_apply
            @webdialog.close
      when  'Cancel'
            @webdialog.close
  end#case
end#do
end#DEF


def self.go_apply
@new_states=Array.new(59,'Off')
@webdialog.execute_script("checkState()")
@webdialog.add_action_callback("get_state") do |wd,ck| @checkboxes=ck.split(",")
@checkboxes.each{|x|  @new_states[x.to_i]='On'  }
#@new_states.each_with_index{|t,i|  puts "Box " + "#{i}" + " = " + t.to_s }
end#do
File.open(@checks_file, 'w') do |item|
@new_states.each { |line| item.puts line }
end
end#def




=begin                                            MENUS
=end




# TOOLBAR MENU START
unless file_loaded?('jhs_menus_home')
#unless file_loaded?(__FILE__)

@@jhs_menus = UI.menu("Help").add_submenu("- CADFATHER PACK")
@@jhs_menus.add_item('STANDARD ICONS...') { self.web_dialog }	 # TOOLBAR ICONS
mn = @@jhs_menus.add_submenu("STANDARD...")
cf_settings = mn.add_submenu("SETTINGS...")				
cf_settings.add_item("Image Export Settings")	{ JHS_export::user_op('true')  }		
mn.add_separator		
mn.add_separator		
cf_common = mn.add_submenu("COMMON...")				
mn.add_separator		
cf_view = mn.add_submenu("VIEWS...")				
mn.add_separator		
cf_tools = mn.add_submenu("TOOLS...")				

tb = UI::Toolbar.new('JHS Standard')

@m=Sketchup.active_model
#---------------------------------------------------------------
# 0 =>  NEW
@cmd0 = UI::Command.new(@label0) { Sketchup.send_action "newDocument:"  }	
@cmd0.small_icon = '_icons/00_24.png'  ; @cmd0.large_icon = '_icons/00_32.png'
@cmd0.tooltip = @label0  ; @cmd0.status_bar_text=@status0
# 1 =>  OPEN
@cmd1 = UI::Command.new(@label1) { Sketchup.send_action "openDocument:" } 
@cmd1.small_icon = '_icons/01_24.png'  ; @cmd1.large_icon = '_icons/01_32.png'
@cmd1.tooltip = @label1  ; @cmd1.status_bar_text=@status1
# 2 =>  SAVE FAST 2015
@cmd2 = UI::Command.new(@label2) { Sketchup.send_action "renderShaded:" ;	@m.shadow_info["DisplayShadows"] = false ; 	Sketchup.send_action "saveDocument:"	}  
@cmd2.small_icon = '_icons/02_24.png'  ;  @cmd2.large_icon = '_icons/02_32.png'
@cmd2.tooltip = @label2  ; @cmd2.status_bar_text=@status2
# 3 =>  SAVE AS FAST (2015)
@cmd3 = UI::Command.new(@label3) { Sketchup.send_action "renderShaded:" ; @m.shadow_info["DisplayShadows"] = false ; Sketchup.send_action "saveDocument:"	}
@cmd3.small_icon = '_icons/03_24.png'  ; @cmd3.large_icon = '_icons/03_32.png'
@cmd3.tooltip = @label3  ; @cmd3.status_bar_text=@status3
# 4 =>  SAVE AS 8
@cmd4 = UI::Command.new(@label4) { Sketchup.send_action "renderShaded:" ; @m.shadow_info["DisplayShadows"] = false
model = @m ; path=model.path ; if not path or path=="" ; Sketchup.send_action "saveDocument:" ; else
status = model.save("", Sketchup::Model::VERSION_8)  ; 	end		}  
@cmd4.small_icon = '_icons/04_24.png'  ; @cmd4.large_icon = '_icons/04_32.png'
@cmd4.tooltip = @label4  ; @cmd4.status_bar_text=@status4
# 5 =>  IMPORT 3D
@cmd5 = UI::Command.new(@label5) { Sketchup.send_action 21933 } #not mac
@cmd5.small_icon = '_icons/05_24.png'  ; @cmd5.large_icon = '_icons/05_32.png'
@cmd5.tooltip = @label5  ; @cmd5.status_bar_text=@status5
# 6 =>  EXPORT 3D
@cmd6 = UI::Command.new(@label6) { Sketchup.send_action 21149 } # not mac
@cmd6.small_icon = '_icons/06_24.png'  ; @cmd6.large_icon = '_icons/06_32.png'
@cmd6.tooltip = @label6  ; @cmd6.status_bar_text=@status6
# 7 =>  IMPORT IMAGE
@cmd7 = UI::Command.new(@label7) {   if $jhs_maccherone_check == 1 ; @get_image = UI.openpanel('Import Image', '', '*.jpg;*.png;*.psd;*.tif;*.tga;*.bmp' ) ; @m.import @get_image
elsif $jhs_winnerone_check == 1 ; Sketchup.send_action 21200  ;   end   } 
@cmd7.small_icon = '_icons/07_24.png'  ; @cmd7.large_icon = '_icons/07_32.png'
@cmd7.tooltip = @label7  ; @cmd7.status_bar_text=@status7
# 8 =>  EXPORT IMAGE
@cmd8 = UI::Command.new(@label8) { JHS_export::export_imagex   }   #Sketchup.send_action 21237 ;  
@cmd8.small_icon = '_icons/08_24.png'  ; @cmd8.large_icon = '_icons/08_32.png'
@cmd8.tooltip = @label8  ; @cmd8.status_bar_text=@status8
# 9 =>  CUT
@cmd9 = UI::Command.new(@label9){ Sketchup.send_action "cut:" } 
@cmd9.small_icon = '_icons/09_24.png'  ; @cmd9.large_icon = '_icons/09_32.png'
@cmd9.tooltip = @label9  ; @cmd9.status_bar_text=@status9
# 10 =>  COPY
@cmd10 = UI::Command.new(@label10) { Sketchup.send_action "copy:" } 
@cmd10.small_icon = '_icons/10_24.png' ; @cmd10.large_icon = '_icons/10_32.png'
@cmd10.tooltip = @label10  ; @cmd10.status_bar_text=@status10
# 11 =>  PASTE
@cmd11 = UI::Command.new(@label11)  { Sketchup.send_action "paste:" }  
@cmd11.small_icon = '_icons/11_24.png' ; @cmd11.large_icon = '_icons/11_32.png'
@cmd11.tooltip = @label11  ; @cmd11.status_bar_text=@status11
# 12 =>  PASTE IN PLACE
@cmd12 = UI::Command.new(@label12) { Sketchup.send_action('pasteInPlace:')		if $jhs_maccherone_check == 1
Sketchup.send_action(21939) 	if $jhs_winnerone_check == 1	} 
@cmd12.small_icon = '_icons/12_24.png' ; @cmd12.large_icon = '_icons/12_32.png'
@cmd12.tooltip = @label12  ; @cmd12.status_bar_text=@status12
# 13 =>  DELETE
@cmd13 = UI::Command.new(@label13) { Sketchup.send_action "editDelete:" }  
@cmd13.small_icon = '_icons/13_24.png' ; @cmd13.large_icon = '_icons/13_32.png'
@cmd13.tooltip = @label13  ; @cmd13.status_bar_text=@status13
# 14 =>  SCENE ADD
@cmd14 = UI::Command.new(@label14)  { Sketchup.send_action "pageAdd:" }  
@cmd14.small_icon = '_icons/14_24.png' ; @cmd14.large_icon = '_icons/14_32.png'
@cmd14.tooltip = @label14  ; @cmd14.status_bar_text=@status14
# 15 =>  SCENE DELETE
@cmd15 = UI::Command.new(@label15) { Sketchup.send_action "pageDelete:" } 
@cmd15.small_icon = '_icons/15_24.png' ; @cmd15.large_icon = '_icons/15_32.png'
@cmd15.tooltip = @label15  ; @cmd15.status_bar_text=@status15
# 16 =>  UNDO
@cmd16 = UI::Command.new(@label16)  { Sketchup.send_action "editUndo:" } 
@cmd16.small_icon = '_icons/16_24.png' ; @cmd16.large_icon = '_icons/16_32.png'
@cmd16.tooltip = @label16  ; @cmd16.status_bar_text=@status16
# 17 =>  REDO
@cmd17 = UI::Command.new(@label17)  { Sketchup.send_action "editRedo:" }  
@cmd17.small_icon = '_icons/17_24.png' ; @cmd17.large_icon = '_icons/17_32.png'
@cmd17.tooltip = @label17  ; @cmd17.status_bar_text=@status17
# 18 =>  ISO
@cmd18 = UI::Command.new(@label18)   { Sketchup.send_action 'viewIso:' } 
@cmd18.small_icon = '_icons/18_24.png' ; @cmd18.large_icon = '_icons/18_32.png'
@cmd18.tooltip = @label18  ; @cmd18.status_bar_text=@status18
# 19 =>  TOP/BOTTOM
@cmd19 = UI::Command.new(@label19)   { if Sketchup.active_model.active_view.camera.zaxis == [0,0,-1] ; Sketchup.send_action('viewBottom:') 
else  ; Sketchup.send_action('viewTop:') ;  end 	} 
@cmd19.small_icon = '_icons/19_24.png' ; @cmd19.large_icon = '_icons/19_32.png'
@cmd19.tooltip = @label19  ; @cmd19.status_bar_text=@status19
# 20 =>  FRONT/BACK
@cmd20 = UI::Command.new(@label20)   { if @m.active_view.camera.zaxis == [0,1,0]
Sketchup.send_action('viewBack:') ; else ; Sketchup.send_action('viewFront:')  ;  end 	} 
@cmd20.small_icon = '_icons/20_24.png' ; @cmd20.large_icon = '_icons/20_32.png'
@cmd20.tooltip = @label20  ; @cmd20.status_bar_text=@status20
# 21 =>  LEFT/RIGHT
@cmd21 = UI::Command.new(@label21)  { if @m.active_view.camera.zaxis == [-1,0,0]
Sketchup.send_action('viewLeft:')  ;	else ; Sketchup.send_action('viewRight:')  ; end 	} 
@cmd21.small_icon = '_icons/21_24.png' ; @cmd21.large_icon = '_icons/21_32.png'
@cmd21.tooltip = @label21  ; @cmd21.status_bar_text=@status21
# 22 =>  XRAY
@cmd22 = UI::Command.new(@label22){ @m.rendering_options["ModelTransparency"] = ! @m.rendering_options["ModelTransparency"]
@m.shadow_info["DisplayShadows"] = false } 
@cmd22.small_icon = '_icons/22_24.png' ; @cmd22.large_icon = '_icons/22_32.png'
@cmd22.tooltip = @label22  ; @cmd22.status_bar_text=@status22
@cmd22.set_validation_proc { if @m.rendering_options["ModelTransparency"] == true  ; MF_CHECKED  ; else  ; MF_UNCHECKED  ; end	}
# 23 =>   BACK EDGES
@cmd23 = UI::Command.new(@label23)   { Sketchup.send_action 10619 } #not mac
@cmd23.small_icon = '_icons/23_24.png' ; @cmd23.large_icon = '_icons/23_32.png'
@cmd23.tooltip = @label23  ; @cmd23.status_bar_text=@status23
# 24 =>    TOGGLE WIREFRAME / HIDDEN
@cmd24 = UI::Command.new(@label24) { 	if @m.rendering_options["RenderMode"] == 0  ; @m.rendering_options["RenderMode"] = 1
else  ;  @m.rendering_options["RenderMode"] == 1  ; @m.rendering_options["RenderMode"] = 0  ;  end  	}
@cmd24.small_icon = '_icons/24_24.png' ; @cmd24.large_icon = '_icons/24_32.png'
@cmd24.tooltip = @label24  ; @cmd24.status_bar_text=@status24
@cmd24.set_validation_proc { if @m.rendering_options["RenderMode"] == 1  ; MF_CHECKED ; else ; MF_UNCHECKED ; end }
# 25 =>    TOGGLE SHADED / TEXTURED
@cmd25 = UI::Command.new(@label25){ if @m.rendering_options["RenderMode"] == 2 and @m.rendering_options["Texture"] == false
@m.rendering_options["RenderMode"] = 2  ; @m.rendering_options["Texture"] = true
else  ; @m.rendering_options["RenderMode"] == 2 and @m.rendering_options["Texture"] == true
@m.rendering_options["RenderMode"] = 2  ; @m.rendering_options["Texture"] = false  ; end		}
@cmd25.small_icon = '_icons/25_24.png' ; @cmd25.large_icon = '_icons/25_32.png'
@cmd25.tooltip = @label25  ; @cmd25.status_bar_text=@status25
@cmd25.set_validation_proc {  if @m.rendering_options["RenderMode"] == 2 and @m.rendering_options["Texture"] == true ; MF_CHECKED ; else ; MF_UNCHECKED ; end }
# 26 =>    TOGGLE EDGES
@cmd26 = UI::Command.new(@label26)  { if Sketchup.active_model.rendering_options["EdgeDisplayMode"] == 0
Sketchup.active_model.rendering_options["EdgeDisplayMode"] = 1 ; else ; Sketchup.active_model.rendering_options["EdgeDisplayMode"] = 0 ; end	}
@cmd26.small_icon = '_icons/26_24.png' ; @cmd26.large_icon = '_icons/26_32.png'
@cmd26.tooltip = @label26  ; @cmd26.status_bar_text=@status26
@cmd26.set_validation_proc { if Sketchup.active_model.rendering_options["EdgeDisplayMode"] == 0  ; MF_CHECKED  ; else  ; MF_UNCHECKED  ; end }
# 27 =>    TOGGLE PROFILE LINES
@cmd27 = UI::Command.new(@label27)  { 	Sketchup.send_action 10603 }  #not mac
@cmd27.small_icon = '_icons/27_24.png' ; @cmd27.large_icon = '_icons/27_32.png'
@cmd27.tooltip = @label27  ; @cmd27.status_bar_text=@status27
@cmd27.set_validation_proc { if @m.rendering_options["DrawSilhouettes"] == true  ; MF_CHECKED ; else ; MF_UNCHECKED ; end  }
# 28 =>    EDGE BY AXIS
@cmd28 = UI::Command.new(@label28) {	@m.shadow_info["DisplayShadows"] = false
ro = @m.rendering_options ; ecm = ro["EdgeColorMode"] ; if ecm != 2 ; ecm = 2
Sketchup.set_status_text "Egde Color Mode: by Axis" ; else ; ecm = 1
Sketchup.set_status_text "Egde Color Mode: Default" ; end ; ro["EdgeColorMode"] = ecm	 }
@cmd28.small_icon = '_icons/28_24.png' ; @cmd28.large_icon = '_icons/28_32.png'
@cmd28.tooltip = @label28  ; @cmd28.status_bar_text=@status28
@cmd28.set_validation_proc { if @m.rendering_options["EdgeColorMode"] == 2 ; MF_CHECKED ; else ; MF_UNCHECKED ; end }
# 29 =>    STYLER CADLINE
@cmd29 = UI::Command.new(@label29) { sty2 }
@cmd29.small_icon = '_icons/29_24.png' ; @cmd29.large_icon = '_icons/29_32.png'
@cmd29.tooltip = @label29  ; @cmd29.status_bar_text=@status29
@cmd29.set_validation_proc{  if @m.styles.selected_style.name == '02-CADLINESx'  ; MF_CHECKED ; else ; MF_UNCHECKED ; end  }
# 30 =>    STYLER DEFAULT
@cmd30 = UI::Command.new(@label30) { sty1 }
@cmd30.small_icon = '_icons/30_24.png' ; @cmd30.large_icon = '_icons/30_32.png'
@cmd30.tooltip = @label30  ; @cmd30.status_bar_text=@status30
@cmd30.set_validation_proc{  if @m.styles.selected_style.name == '01-DEFAULTx' ; MF_CHECKED ; else ; MF_UNCHECKED ; end }
# 31 =>    STYLER JITTER
@cmd31 = UI::Command.new(@label31) {sty6}
@cmd31.small_icon = '_icons/31_24.png' ; @cmd31.large_icon = '_icons/31_32.png'
@cmd31.tooltip = @label31  ; @cmd31.status_bar_text=@status31
@cmd31.set_validation_proc{  if @m.styles.selected_style.name == '06-JITTERSx' ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 32 =>    STYLER SKETCHY
@cmd32 = UI::Command.new(@label32) {sty7}
@cmd32.small_icon = '_icons/32_24.png' ; @cmd32.large_icon = '_icons/32_32.png'
@cmd32.tooltip = @label32  ; @cmd32.status_bar_text=@status32
@cmd32.set_validation_proc{  if @m.styles.selected_style.name == '07-SKETCHx'  ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 33 =>     STYLER FACE CHECK
@cmd33 = UI::Command.new(@label33){ if @m.styles.selected_style.name == '03-FACECHECKx'  ; sty1 ; else ; sty3 ; end	}
@cmd33.small_icon = '_icons/33_24.png' ; @cmd33.large_icon = '_icons/33_32.png'
@cmd33.tooltip = @label33  ; @cmd33.status_bar_text=@status33
@cmd33.set_validation_proc{  if @m.styles.selected_style.name == '03-FACECHECKx' ; MF_CHECKED ; else ; MF_UNCHECKED ; end		}
# 34 =>    STYLER TRACER
@cmd34 = UI::Command.new(@label34)   {sty5}
@cmd34.small_icon = '_icons/34_24.png' ; @cmd34.large_icon = '_icons/34_32.png'
@cmd34.tooltip = @label34  ; @cmd34.status_bar_text=@status34
@cmd34.set_validation_proc{  if @m.styles.selected_style.name == '05-TRACERx'  ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 35 =>    STYLER SHADOWS
@cmd35 = UI::Command.new(@label35) {sty4}
@cmd35.small_icon = '_icons/35_24.png' ; @cmd35.large_icon = '_icons/35_32.png'
@cmd35.tooltip = @label35  ; @cmd35.status_bar_text=@status35
@cmd35.set_validation_proc{  if @m.styles.selected_style.name == '04-SHADOWSx' ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 36 =>    TOGGLE GUIDES
@cmd36 = UI::Command.new(@label36) {	@m.rendering_options["HideConstructionGeometry"] = !
@m.rendering_options["HideConstructionGeometry"] 	}
@cmd36.small_icon = '_icons/36_24.png' ; @cmd36.large_icon = '_icons/36_32.png'
@cmd36.tooltip = @label36  ; @cmd36.status_bar_text=@status36
@cmd36.set_validation_proc { if @m.rendering_options["HideConstructionGeometry"] == false  ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 37 =>    TOGGLE COMP AXIS
@cmd37 = UI::Command.new(@label37)   {  if @m.rendering_options["DisplayInstanceAxes"] ; @m.rendering_options["DisplayInstanceAxes"]=false
else ; @m.rendering_options["DisplayInstanceAxes"]=true ; 	end 	}
@cmd37.small_icon = '_icons/37_24.png' ; @cmd37.large_icon = '_icons/37_32.png'
@cmd37.tooltip = @label37  ; @cmd37.status_bar_text=@status37
@cmd37.set_validation_proc { if @m.rendering_options["DisplayInstanceAxes"] == true  ; MF_CHECKED ; else ; MF_UNCHECKED ; end 	}
# 38 =>    SELECT ALL
@cmd38 = UI::Command.new(@label38) { Sketchup.send_action('selectAll:')			if $jhs_maccherone_check == 1 ; Sketchup.send_action 21101	if $jhs_winnerone_check == 1	}
@cmd38.small_icon = '_icons/38_24.png' ; @cmd38.large_icon = '_icons/38_32.png'
@cmd38.tooltip = @label38  ; @cmd38.status_bar_text=@status38
# 39 =>    INVERT SELECTION
@cmd39 = UI::Command.new(@label39) {self.selection_invert()}
@cmd39.small_icon = '_icons/39_24.png' ; @cmd39.large_icon = '_icons/39_32.png'
@cmd39.tooltip = @label39  ; @cmd39.status_bar_text=@status39
# 40 =>    SELECTION VAULT
@cmd40 = UI::Command.new(@label40) { MEMO::selection_vault }
@cmd40.small_icon = '_icons/40_24.png' ; @cmd40.large_icon = '_icons/40_32.png'
@cmd40.tooltip = @label40  ; @cmd40.status_bar_text=@status40
# 41 =>    ZOOM ALL OR SELECTED
@cmd41 = UI::Command.new(@label41) { self.zoom_back }
@cmd41.small_icon = '_icons/41_24.png' ; @cmd41.large_icon = '_icons/41_32.png'
@cmd41.tooltip = @label41  ; @cmd41.status_bar_text=@status41
# 42 =>    FILTER EDGES
@cmd42 = UI::Command.new(@label42) {self.get_edges}
@cmd42.small_icon = '_icons/42_24.png' ; @cmd42.large_icon = '_icons/42_32.png'
@cmd42.tooltip = @label42  ; @cmd42.status_bar_text=@status42
# 43 =>    FILTER FACES
@cmd43 = UI::Command.new(@label43) {self.get_faces}
@cmd43.small_icon = '_icons/43_24.png' ; @cmd43.large_icon = '_icons/43_32.png'
@cmd43.tooltip = @label43  ; @cmd43.status_bar_text=@status43
# 44 =>    SELECT BY MATERIAL  
@cmd44 = UI::Command.new(@label44)  { self.material_selector() if $jhs_maccherone_check == 1 ; Sketchup.send_action 21454 if $jhs_winnerone_check == 1}
@cmd44.small_icon = '_icons/44_24.png' ; @cmd44.large_icon = '_icons/44_32.png'
@cmd44.tooltip = @label44  ; @cmd44.status_bar_text=@status44
# 45 =>    MATERIAL FINDER
@cmd45 = UI::Command.new(@label45)  {  self.material_finder }
@cmd45.small_icon = '_icons/45_24.png' ; @cmd45.large_icon = '_icons/45_32.png'
@cmd45.tooltip = @label45  ; @cmd45.status_bar_text=@status45
# 46 =>    SELECT INSTANCES
@cmd46 = UI::Command.new(@label46) { self.select_same_instance }
@cmd46.small_icon = '_icons/46_24.png' ; @cmd46.large_icon = '_icons/46_32.png'
@cmd46.tooltip = @label46  ; @cmd46.status_bar_text=@status46
# 47 =>    GROUPS/COMPS CONVERT
@cmd47 = UI::Command.new(@label47) { CG_convert::cg_converter }
@cmd47.small_icon = '_icons/47_24.png' ; @cmd47.large_icon = '_icons/47_32.png'
@cmd47.tooltip = @label47  ; @cmd47.status_bar_text=@status47
# 48 =>    WORKING COPIES
@cmd48 = UI::Command.new(@label48) {  self.working_kopies }
@cmd48.small_icon = '_icons/48_24.png' ; @cmd48.large_icon = '_icons/48_32.png'
@cmd48.tooltip = @label48  ; @cmd48.status_bar_text=@status48
# 49 =>    HIDE EDGES
@cmd49 = UI::Command.new(@label49) { hide_all_edges('hide') }	
@cmd49.small_icon = '_icons/49_24.png' ; @cmd49.large_icon = '_icons/49_32.png'
@cmd49.tooltip = @label49  ; @cmd49.status_bar_text=@status49
# 50 =>    UNHIDE EDGES
@cmd50 = UI::Command.new(@label50) { hide_all_edges('unhide') }	
@cmd50.small_icon = '_icons/50_24.png' ; @cmd50.large_icon = '_icons/50_32.png'
@cmd50.tooltip = @label50  ; @cmd50.status_bar_text=@status50
# 51 =>    HIDE REST OF THE MODEL
@cmd51 = UI::Command.new(@label51)  { @m.rendering_options["InactiveHidden"] = !@m.rendering_options["InactiveHidden"]	 }  
@cmd51.small_icon = '_icons/51_24.png' ; @cmd51.large_icon = '_icons/51_32.png'
@cmd51.tooltip = @label51  ; @cmd51.status_bar_text=@status51
@cmd51.set_validation_proc  {  if @m.rendering_options["InactiveHidden"] == true ; MF_CHECKED ; else ; MF_UNCHECKED ; end  }	
# 52 =>    2PT PERSPECTIVE FIX
@cmd52 = UI::Command.new(@label52) { Sketchup.send_action(10627) if $jhs_winnerone_check == 1 ; Sketchup.send_action "viewPerspective:" if $jhs_winnerone_check == 1
Sketchup.send_action('viewTwoPointPerspective:')  if $jhs_maccherone_check == 1 ; Sketchup.send_action "viewPerspective:" if $jhs_maccherone_check == 1 		}
@cmd52.small_icon = '_icons/52_24.png' ; @cmd52.large_icon = '_icons/52_32.png'
@cmd52.tooltip = @label52  ; @cmd52.status_bar_text=@status52
# 53 =>    FIELD OF VIEW
@cmd53 = UI::Command.new(@label53)    { Sketchup.send_action "selectFieldOfViewTool:" }
@cmd53.small_icon = '_icons/53_24.png' ; @cmd53.large_icon = '_icons/53_32.png'
@cmd53.tooltip = @label53  ; @cmd53.status_bar_text=@status53
# 54 =>    UNDO VIEW
@cmd54 = UI::Command.new(@label54) { Sketchup.send_action('viewUndo:') }  
@cmd54.small_icon = '_icons/54_24.png' ; @cmd54.large_icon = '_icons/54_32.png'
@cmd54.tooltip = @label54  ; @cmd54.status_bar_text=@status54
# 55 =>    REDO VIEW
@cmd55 = UI::Command.new(@label55) { Sketchup.send_action 10629  if $jhs_winnerone_check == 1 ; Sketchup.send_action('viewRedo:') if $jhs_maccherone_check == 1}  
@cmd55.small_icon = '_icons/55_24.png' ; @cmd55.large_icon = '_icons/55_32.png'
@cmd55.tooltip = @label55  ; @cmd55.status_bar_text=@status55
# 56 =>    STEP ZOOMER
@cmd56 = UI::Command.new(@label56) { @m.select_tool(JHS_zoom::Zoomer.new) }
@cmd56.small_icon = '_icons/56_24.png' ; @cmd56.large_icon = '_icons/56_32.png'
@cmd56.tooltip = @label56  ; @cmd56.status_bar_text=@status56
# 57 =>    TOGGLE SHADOWS
@cmd57 = UI::Command.new(@label57) {  @m.shadow_info["DisplayShadows"] = !  @m.shadow_info["DisplayShadows"] }
@cmd57.small_icon = '_icons/57_24.png' ; @cmd57.large_icon = '_icons/57_32.png'
@cmd57.tooltip = @label57  ; @cmd57.status_bar_text=@status57
@cmd57.set_validation_proc { if @m.shadow_info["DisplayShadows"] == true ; MF_CHECKED ; else ; MF_UNCHECKED ; end  }
# 58 =>    PURGE MODEL
@cmd58 = UI::Command.new(@label58) { purge_all_debris }
@cmd58.small_icon = '_icons/58_24.png' ; @cmd58.large_icon = '_icons/58_32.png'
@cmd58.tooltip = @label58  ; @cmd58.status_bar_text=@status58
# 59 =>    SHORTCUTS
@cmd59 = UI::Command.new(@label59) { UI.show_preferences "Accelerator:" }#not mac
@cmd59.small_icon = '_icons/59_24.png' ; @cmd59.large_icon = '_icons/59_32.png'
@cmd59.tooltip = @label59  ; @cmd59.status_bar_text=@status59
# 60 =>    RUBY CONSOLE
# @cmd60 = UI::Command.new(@label60)   { if SKETCHUP_CONSOLE.visible? ; SKETCHUP_CONSOLE.hide  ; else ; SKETCHUP_CONSOLE.show ; end }
# @cmd60.small_icon = '_icons/60_24.png' ; @cmd60.large_icon = '_icons/60_32.png'
# @cmd60.tooltip = @label60  ; @cmd60.status_bar_text=@status60
# @cmd60.set_validation_proc{  if SKETCHUP_CONSOLE.visible?  ; MF_CHECKED ; else ; MF_UNCHECKED ; end		}


# call load options from file (populate toolbar)
self.load_options


$jhs_icon_state_standard.each_with_index do |icon,idx|
tb.add_item(eval("@cmd"+idx.to_s)) if icon.strip == 'On' 
cf_common.add_item(eval("@cmd"+idx.to_s)) if icon.strip == 'On' && idx < 18
cf_view.add_item(eval("@cmd"+idx.to_s)) if icon.strip == 'On' && idx.between?(18, 37)
cf_tools.add_item(eval("@cmd"+idx.to_s)) if icon.strip == 'On' && idx > 37
end#do


#--------------------------------------------------------   ADDITIONAL MENU ITEMS

# CAMERA PROPERTIES
cf_settings.add_separator

@cmd100 = UI::Command.new('Working Copies Options')   { self.working_kopies_ops }			
cf_settings.add_item(@cmd100)

@cmd101 = UI::Command.new('Camera Properties')   { Sketchup.send_action(10624) }			
cf_settings.add_item(@cmd101)		if $jhs_winnerone_check == 1



end   #    Unless file_loaded?
file_loaded('jhs_menuk')
file_loaded('jhs_menus_home')


end # Max_Coppoletta
