=begin
Copyright 2008 Rick Wilson 

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Name :          Windowizer 4.0 Style Manager
Description :   manage Windowizer 4 Styles
Author :        Rick Wilson
Usage :         ##########
Date :          2008-06-24
History:
	1.000 (2008/06/24)	- first version

=end

require 'sketchup.rb'
#require 'windowizer4.rb'



class Windowizer4

	def styles
		@@styles.keys
	end



	def styledata(stylename)
		@@styles[stylename]
	end



	def add_style(stylename,values)
		return false if stylename == ""
	#	vpanes,hpanes,framewidth,frameheight,framethickness,frameinset,framematerial,mullwidth,mullheight,mullthickness,glassinset,glassthickness,glassmaterial=values
		if @@styles[stylename]
			if UI.messagebox("Overwrite existing style #{stylename}?", 52)==7
				return false
			end
		end
		
		@@styles[stylename]=values
		@dict[stylename]=values
		return true
	end



	def change_style(stylename,values)
	#	vpanes,hpanes,framewidth,frameheight,framethickness,frameinset,framematerial,mullwidth,mullheight,mullthickness,glassinset,glassthickness,glassmaterial=values
		if @@styles[stylename]
			@@styles[stylename]=values
			@dict[stylename]=values
			return true
		else
			return false
		end
	end



	def rename_style(stylename,newstylename)
	#	if @@styles[newstylename] # I DON'T THINK THIS IS CORRECT
		if @@styles[stylename]
			@@styles[newstylename]=@@styles.delete(stylename)
		 	@dict[newstylename]=@dict.delete(stylename)
			return true
		else
			return false
		end
	end



	def delete_style(stylename)
		@@styles.delete(stylename)
		@dict.delete_key(stylename)
	end



#	def update_attributes
#	#	@dict.each_key{|style| @dict.delete_key(style)}	#CLEAR STORED TO AVOID CONFLICTS
#		@@styles.each_pair do |style,data|
#			Sketchup.active_model.set_attribute("Windowizer4styles",style,data)
#		end
#	end



	def Windowizer4.styles
		@@styles.keys
	end



	def Windowizer4.import_styles
		puts "IMPORT STYLE"
	end



	def Windowizer4.export_styles
		puts "EXPORT STYLE"
		styles.each{|style| puts style}
	end



end
