////////////////////////////////////////////////////////////
//
//ファイル名:   drawtemp.js
//機能		:	一時図形作図
//依存		:	-
//バージョン:　 2.0.0.1
//更新日時	:　 2006.08.01
//更新者	:	kawame
//
////////////////////////////////////////////////////////////


function initDrawTempValues()
{	
	win = window.opener?window.opener:this;
	
	win.mode_input = 'input_point';
	
	setDrawISizeOption();
	setDrawFColorOption();
	setDrawFSizeOption();
	setDrawLColorOption();
	setDrawLWidthOption();
	setDrawBGColorOption();
	changeInputIsize(win.INPUT_ISIZE,-1,5000);
}
//一時図形アイコンサイズコントロール作成
function setDrawISizeOption()
{
	var node = document.getElementById("draw_isize_container");
	if(node)
	{
		var array = win.tempIsizeArray;
		var mode = win.tempIsize_Mode;
		var path = win.style_path;
		
		var obj = "";
		for (var i = 0;i<array.length;i++)
		{
				var s = array[i].value * (win.DISPLAY_PPC) /10;
				var opt = "<nobr><input onclick='changeInputIsize(value,-1,5000);' type='radio' name='draw_select' value=";
				opt += array[i].value;

				if(array[i].def == 1)
				{
					opt += " CHECKED";
					win.INPUT_ISIZE=array[i].value;
				}
				opt += " id='icon"+i+"'";
				opt += ">" ;

				opt += "<label for='icon"+i+"'>";

				if(mode == 0)
				{
					var name = "icon"+i;
					opt += "<img width='"+s+"' height='"+s+"' src='"+path+"/images/utility/blank.gif' class='icon_size' onclick='radioClick(";
					opt += '"'+name+'"';
					opt += ");'>";
				}
				else if(mode == 1)
				{
					opt += array[i].desc;
				}
				
				opt += "</label></nobr>";
				obj += opt ;
		}
		
		obj += "";
		
		node.innerHTML = obj;
	}
}




//一時図形線色リスト作成
function setDrawLColorOption()
{
	var node = document.getElementById("draw_lcolor_container");
	if(node)
	{
		var array = win.tempColorArray;
		
		var obj = "";
		for (var i = 0;i<array.length;i++)
		{
			var opt = "<label style='WIDTH:10px;HEIGHT:10px;BACKGROUND-COLOR:" ;
			
			opt += array[i].value +"'>";
			
			opt += "<input onclick='changeInputColor(value);' type='radio' name='lcolor' value=";
			opt += array[i].value;
			
			if(array[i].def == 1)
			{
				opt += " CHECKED"
				win.INPUT_COLOR = array[i].value;
			}
			
			opt += ">" ;
			
			opt += "</label>";			
			obj += opt ;
		}
		node.innerHTML = obj;
	}
}
//一時図形線幅コントロール作成
function setDrawLWidthOption()
{
	var node = document.getElementById("draw_lwidth_container");
	if(node)
	{
		var array = win.tempLwidthArray;
		
		var obj = "<select class='draw_select' onchange='changeInputWidth(value)' name='draw_select'>";
				
		for (var i = 0;i<array.length;i++)
		{
			var opt = "<option";
			
			opt += " value='" +array[i].value +"'";
			
			if(array[i].def == 1)
			{
				opt += " selected";
				win.INPUT_WIDTH = array[i].value;
			}
			opt += ">" ;
			opt += array[i].value + "px";
			opt += "</option>";
						
			obj += opt ;
		}
		
		obj +="</select>";
		
		node.innerHTML = obj;
	}
}
//一時図形塗色リスト作成
function setDrawBGColorOption()
{
	var bnode = document.getElementById("draw_bgbrush_container");
	var tnode = document.getElementById("draw_transparent_container");
	var cnode = document.getElementById("draw_bgcolor_container");
	
	var obj = "";
	//ブラシリスト

	
	if(bnode)
	{
		var barray = win.tempBrushArray;
		
		if(win.tempBrush_Mode == 0)
		{
			for (var i = 0;i<barray.length;i++)
			{		
				var opt = "<nobr>" ;	
				opt += '<input onclick="changeBrush(value)" type="radio" name="bg_mode"' ;
				opt += ' value="' + barray[i].value + '"';
				opt += ' id ="' + barray[i].id +'"';
				if(barray[i].def == 1)
				{
					opt += ' CHECKED';
					win.INPUT_BRUSH = barray[i].value;
				}
				opt += '>' ;
				
				opt += '<label for=';		
				
				opt += '"' + barray[i].id + '" style="color:gray;font-size:15px;">';	
				
				opt += barray[i].desc;
				
				opt += '</label>';
						
				opt += "</nobr>" ;	
				obj += opt ;
			}
		}
		else if(win.tempBrush_Mode == 1)
		{	
			obj = '<select class="draw_select" name="draw_select" onchange ="changeBrush(value)">';
			
			for (var i = 0;i<barray.length;i++)
			{
				var opt = '<option' ;
				opt += ' value="' + barray[i].value + '"';
				
				if(barray[i].def == 1)
				{
					opt += ' selected';
					win.INPUT_BRUSH = barray[i].value;
				}
				opt += '>' ;
				
				opt += barray[i].desc;
				
				opt += '</option>';
				
				obj += opt ;
			}
			obj +='</selected>';
		}
				
		bnode.innerHTML = obj;
		bnode.style.align = "center";
	}
	obj = "";
	
	if(tnode)
	{
		//透過チェックボックス
		obj ='<nobr><input type="checkbox" id="bg_transparent" onclick="changeTransparent(checked)" checked><label for="bg_transparent" style="color:gray;font-size:15px;">透過させる</label></nobr>';
		tnode.innerHTML = obj;
		tnode.style.align = "right";
	}	
	obj = "";
	
	//背景色リスト

	if(cnode)
	{
		var array = ((win.tempBgcolorArray) ? win.tempBgcolorArray : win.tempColorArray);
		for (var i = 0;i<array.length;i++)
		{
			var opt = "<label style='WIDTH:10px;HEIGHT:10px;BACKGROUND-COLOR:" ;
			
			opt += array[i].value +"'>";
			
			opt += "<input onclick='changeInputBGColor(value);' type='radio' name='bgcolor' value=";
			opt += array[i].value;
			
			if(array[i].def == 1)
			{
				opt += " CHECKED"
				win.INPUT_BG_COLOR = array[i].value;
			}
			
			opt += ">" ;
			
			opt += "</label>";			
			obj += opt ;
		}
		cnode.innerHTML = obj;
	}
				
}

//一時図形文字色リスト作成
function setDrawFColorOption()
{
	var node = document.getElementById("draw_fcolor_container");
	if(node)
	{
		var array = ((win.tempFcolorArray) ? win.tempFcolorArray : win.tempColorArray);
		
		var obj = "";
		for (var i = 0;i<array.length;i++)
		{
			var opt = "<label style='WIDTH:10px;HEIGHT:10px;BACKGROUND-COLOR:" ;
			
			opt += array[i].value +"'>";
			
			opt += "<input onclick='changeInputFColor(value);' type='radio' name='fcolor' value=";
			opt += array[i].value;
			
			if(array[i].def == 1)
			{
				opt += " CHECKED"
				win.INPUT_FCOLOR = array[i].value;
			}
			
			opt += ">" ;
			
			opt += "</label>";			
			obj += opt ;
		}
		node.innerHTML = obj;
	}
}

//一時図形文字サイズコントロール作成
function setDrawFSizeOption()
{
	var node = document.getElementById("draw_fsize_container");
	if(node)
	{
		var array = win.tempFsizeArray;
		
		var obj = "<select class='draw_select' onchange='changeInputFsize(value,-1)' name='draw_select'>";
				
		for (var i = 0;i<array.length;i++)
		{
			var opt = "<option";
			
			opt += " value='" +array[i].value +"'";
			
			if(array[i].def == 1)
			{
				opt += " selected";
				win.INPUT_FSIZE = array[i].value;
				win.INPUT_SIZE = -1;
			}
			opt += ">" ;
			opt += array[i].value + "pt";
			opt += "</option>";
						
			obj += opt ;
		}
		
		obj +="</select>";
		
		node.innerHTML = obj;
	}
}


function changeDrawStyleDisp(mode)
{
	switch (mode)
	{
		case win.INPUT_POINT:
		
			document.getElementById("drawtemp_icon_container").style.display="block";
			document.getElementById("drawtemp_text_container").style.display="none";
			document.getElementById("drawtemp_line_container").style.display="none";
			document.getElementById("drawtemp_area_container").style.display="none";
			document.getElementById("drawtemp_circle_container").style.display="none";
			
			break;	
		
		case win.INPUT_TEXT:
		
			document.getElementById("drawtemp_icon_container").style.display="none";
			document.getElementById("drawtemp_text_container").style.display="block";
			document.getElementById("drawtemp_line_container").style.display="none";
			document.getElementById("drawtemp_area_container").style.display="none";
			document.getElementById("drawtemp_circle_container").style.display="none";
			
			break;
			
		case win.INPUT_POLYLINE:
		
			document.getElementById("drawtemp_icon_container").style.display="none";
			document.getElementById("drawtemp_text_container").style.display="none";
			document.getElementById("drawtemp_line_container").style.display="block";
			document.getElementById("drawtemp_area_container").style.display="none";
			document.getElementById("drawtemp_circle_container").style.display="none";
			
			break;
			
		case win.INPUT_POLYGON:
		
			document.getElementById("drawtemp_icon_container").style.display="none";
			document.getElementById("drawtemp_text_container").style.display="none";
			document.getElementById("drawtemp_line_container").style.display="block";
			document.getElementById("drawtemp_area_container").style.display="block";
			
			break;
			
		case win.INPUT_RECT:
		
			document.getElementById("drawtemp_icon_container").style.display="none";
			document.getElementById("drawtemp_text_container").style.display="none";
			document.getElementById("drawtemp_line_container").style.display="block";
			document.getElementById("drawtemp_area_container").style.display="block";
			
			break;
			
		case win.INPUT_CIRCLE:
		
			document.getElementById("drawtemp_icon_container").style.display="none";
			document.getElementById("drawtemp_text_container").style.display="none";
			document.getElementById("drawtemp_line_container").style.display="block";
			document.getElementById("drawtemp_area_container").style.display="block";
			
			break;	
			
		case win.NONE:
		
			break;
			
		default:
		
			break;
		}
		
		fitWindowSize();
}


