//界面预览工具
import win.cur;
import win.ui;
import win.ui.menu;
/*DSG{{*/
var winform = win.form( bottom=542;parent=...;right=856;text="web.layout(HTMLayout) 界面范例浏览器 http://www.aau.cn/doc/htmlayout/samples" )
winform.add( 
tab={ dr=1;dl=1;bottom=530;right=843;left=236;dt=1;top=9;z=2;db=1;edge=1;cls="tab" };
treeview={ dl=1;bgcolor=15793151;vscroll=1;infoTip=1;right=231;asel=false;dt=1;db=1;cls="treeview";bottom=527;top=10;z=1;hscroll=1;edge=1;left=23 }
)
/*}}*/

var frmPreview = winform.tab.add( text="效果预览"; bottom=140;right=325 ) 
var frmSourceCode = winform.tab.add( text="查看源码";right=599;bottom=390 ) 
frmSourceCode.add( 
btnCreateProject={ dr=1;disabled=1;bottom=387;right=562;left=384;top=353;z=2;db=1;text="在IDE中创建HTMLayout工程";cls="button" };
btnHelp={ dr=1;bottom=387;text="查看HTMLayout语法文档";left=190;top=353;z=3;db=1;right=368;cls="button" };
richedit={ dr=1;dl=1;bottom=346;right=591;left=7;dt=1;top=6;z=1;db=1;multiline=1;edge=1;cls="richedit";hscroll=1;vscroll=1 }
)
frmSourceCode.btnCreateProject.oncommand = function(id,event){
	 createDemoProject();
}
frmSourceCode.btnHelp.oncommand = function(id,event){
	import web.util;
	web.util.ieBrowser("http://www.aau.cn/doc/htmlayout/HTMLLayoutDocMx3.htm")
}
 
import inet.url;
getCurrentHtmlFileUrl = function(){ 
	if(!winform.treeview.lastClickItem)
		return;
		
	var path = winform.treeview.getItemText(winform.treeview.lastClickItem )
	if( #path ){
		frmSourceCode.btnCreateProject.disabled = false;
		var htmlayoutDir = "http://www.aau.cn/doc/htmlayout/samples/" 
		return inet.url.joinpath(htmlayoutDir,path)	
	}
}
 

import ide;
import fsys;
import fsys.dlg;
var templateLayout = /********************
import win.ui;
/*DSG{{*/
var winform = win.form( bottom=399;parent=...;text="AAuto Form";right=599 ) 
/*}}*/

import web.layout;
var wbLayout = web.layout(winform); 

wbLayout.onDocumentComplete = function (layoutEle, params, pparams) {  
	
}  
wbLayout.go("${URL}") 

winform.show() 
win.loopMessage();

	   		********************/
	   		
createDemoProject = function(){ 
	var targerDir = fsys.dlg.opendir(,,"请选择工程保存目录");
	if(!targerDir)return;
	var path = fsys.joinpath(..io._exedir,"extensions\wizard\project\win")
	fsys.copy(path,targerDir);
	var path = fsys.joinpath(targerDir,"win\main.aau")
	string.save(fsys.joinpath(targerDir,"win\main.aau"),( string.replace(templateLayout,"@${URL}",getCurrentHtmlFileUrl() ) ) ) 
	ide.openDocument(fsys.joinpath(targerDir,"win\default.aproj"))
}

frmSourceCode.richedit.wndproc = function(hwnd,message,wParam,lParam){
	if( message == 0x204/*_WM_RBUTTONDOWN*/  ){ 
	   owner.popMenu( { 
	   	{ "在IDE中创建HTMLayout工程"; createDemoProject }
	   } );
	}
}

import web.layout;
var wbLayout = web.layout(frmPreview); 

import inet.whttp;
var http = inet.whttp();
loadHtmlFile = function(){
	var path = getCurrentHtmlFileUrl() 
	if(!#path)return;
	win.cur.beginWaitCur();
	frmSourceCode.richedit.text = "正在加载......"
	wbLayout.write( "<body>正在加载.......</body>" )   
	winform.setTimeout( 
		function(){
			wbLayout.go(path)
			frmSourceCode.richedit.text = http.get(path); 
			win.cur.endCur()	
		}
	)	 
}

winform.treeview.onnotify = function(id,code,ptr){
 
	if( code == 0xFFFFFFFE/*_NM_CLICK*/ ){  
		var hItem = winform.treeview.hitTest()  
		if( hItem ){ 
			 winform.treeview.lastClickItem = hItem
			 var path = winform.treeview.getItemText(hItem);
			 if( (#path) ? string.endWith(path,".htm",true) ){ 
			 	loadHtmlFile()
			 }
		}
	}
	elseif(code = 0xFFFFFFFB/*_NM_RCLICK*/){ 
		var hItem,tvht = winform.treeview.hitTest();
		winform.treeview.setSelected(hItem)
		var menu = win.ui.popmenu(winform)
		menu.add("打开",loadHtmlFile )
		menu.add("在IDE中创建HTMLayout工程",createDemoProject )
		menu.popup(x,y,true);
	} 
} 
 	
var tab = { 
{ text="cssmap.htm" };
{ text="HTML32.htm" };
{ text="index.htm" }; 
{ 
children={ 
{ text="@font-face\test.htm" }
};text="@font-face" };
{ 
children={ 
{ text="abs\abs.htm" };
{ text="abs\abspos.htm" };
{ text="abs\abs_fix.htm" };
{ text="abs\fix_center.htm" };
{ text="abs\menus.htm" };
{ text="abs\rel_abs.htm" }
};text="abs" };
{ 
children={ 
{ text="animated-png\apng.htm" };
{ text="animated-png\disposal.htm" };
{ text="animated-png\loading.htm" }
};text="animated-png" };
{ 
children={ 
{ text="animations\blend.htm" };
{ text="animations\h-sliding-bar-csss!.htm" };
{ text="animations\h-sliding-bar.htm" };
{ text="animations\popup-animations.htm" };
{ text="animations\sliding-bar-csss!.htm" };
{ text="animations\sliding-bar.htm" };
{ text="animations\sliding-list.htm" }
};text="animations" };
{ 
children={ 
{ text="back\alpha-back.htm" };
{ text="back\backdemo.htm" };
{ text="back\keep-ratio.htm" }
};text="back" };
{ 
children={ 
{ text="behaviors\accesskeys.htm" };
{ text="behaviors\actions.htm" };
{ text="behaviors\chart.htm" };
{ text="behaviors\colorpopup.htm" };
{ text="behaviors\commands.htm" };
{ text="behaviors\dropdown-with-select.htm" };
{ text="behaviors\dropdown.htm" };
{ text="behaviors\editable-select.htm" };
{ text="behaviors\form-test.htm" };
{ text="behaviors\graphin-live-clock.htm" };
{ text="behaviors\htmlarea.htm" };
{ text="behaviors\hyperlinks.htm" };
{ text="behaviors\light-box-dialog.htm" };
{ text="behaviors\live-clock.htm" };
{ text="behaviors\more_tabs.htm" };
{ text="behaviors\path-behavior.htm" };
{ text="behaviors\scroller.htm" };
{ text="behaviors\select-buddy.htm" };
{ text="behaviors\shell-icon.htm" };
{ text="behaviors\sizer-popup.htm" };
{ text="behaviors\sizer.htm" };
{ text="behaviors\splitters-and-trees.htm" };
{ text="behaviors\splitters.htm" };
{ text="behaviors\treeview.htm" };
children={ 
{ 
children={  };text="behaviors\colorpopup" };
{ 
children={  };text="behaviors\more_tabs" }
}
};text="behaviors" };
{ 
children={ 
{ text="border-radius\border-radius.htm" };
{ text="border-radius\rounded-tabs-at-bottom.htm" };
{ text="border-radius\rounded-tabs.htm" }
};text="border-radius" };
{ 
children={ 
{ text="communication\file-upload.htm" };
{ text="communication\form-submission.htm" }
};text="communication" };
{ 
children={ 
{ text="css-plus\aspect-ratio.htm" };
{ text="css-plus\back-fore.htm" };
{ text="css-plus\big-scrollbar-styling.htm" };
{ text="css-plus\color-transform-gamma.htm" };
{ text="css-plus\color-transform.htm" };
{ text="css-plus\constants.htm" };
{ text="css-plus\content-transform.htm" };
{ text="css-plus\hsl-colors.htm" };
{ text="css-plus\opacity.htm" };
{ text="css-plus\outline-glow-on-black.htm" };
{ text="css-plus\outline-glow.htm" };
{ text="css-plus\outline-styles.htm" };
{ text="css-plus\scroll-manner-styling-flow-grid.htm" };
{ text="css-plus\scroll-manner-styling-table.htm" };
{ text="css-plus\scroll-manner-styling.htm" };
{ text="css-plus\scrollbar-styling.htm" };
{ text="css-plus\small-scrollbar-styling.htm" };
{ text="css-plus\table-of-content.htm" };
{ text="css-plus\theme-images.htm" };
{ text="css-plus\tree-view-lines.htm" }
};text="css-plus" };
{ 
children={ 
{ text="csss!\1.htm" };
{ text="csss!\animate-bounce.htm" };
{ text="csss!\animate-cubic.htm" };
{ text="csss!\animate-ease-list.htm" };
{ text="csss!\animation-expand-horz.htm" };
{ text="csss!\animation-expand.htm" };
{ text="csss!\animation-fade.htm" };
{ text="csss!\animation-simple.htm" };
{ text="csss!\animation-slide.htm" };
{ text="csss!\autofocus.htm" };
{ text="csss!\behavior-method-calls.htm" };
{ text="csss!\bound-slider.htm" };
{ text="csss!\calc-basic.htm" };
{ text="csss!\calc-dom.htm" };
{ text="csss!\calc-ext.htm" };
{ text="csss!\chart-custom-methods.htm" };
{ text="csss!\collapsible-by-checkbox.htm" };
{ text="csss!\collapsible-by-icon.htm" };
{ text="csss!\collapsible-when-action.htm" };
{ text="csss!\collapsible-with-behavior.htm" };
{ text="csss!\custom-global-functions.htm" };
{ text="csss!\custom-tooltip-positioning.htm" };
{ text="csss!\dip-units.htm" };
{ text="csss!\dropdown-list.htm" };
{ text="csss!\frame-loading.htm" };
{ text="csss!\grid-sortable.htm" };
{ text="csss!\grid-with-collapsibles.htm" };
{ text="csss!\highlight-links.htm" };
{ text="csss!\keyboard-handling.htm" };
{ text="csss!\label-for-activation.htm" };
{ text="csss!\localization.htm" };
{ text="csss!\loops.htm" };
{ text="csss!\progress.htm" };
{ text="csss!\pure-css-tabs-states.htm" };
{ text="csss!\pure-css-tabs.htm" };
{ text="csss!\scroll-to-view.htm" };
{ text="csss!\show-popup.htm" };
{ text="csss!\size-changed.htm" };
{ text="csss!\slider-and-better-buddy.htm" };
{ text="csss!\styles-link-activation.htm" };
{ text="csss!\table-checkboxes.htm" };
{ text="csss!\text-width.htm" };
{ text="csss!\textarea-method-calls.htm" };
{ text="csss!\total.htm" };
{ text="csss!\use-of-consts.htm" };
{ text="csss!\use-of-other-dom-elements.htm" };
children={ 
{ 
children={  };text="csss!\styles" }
}
};text="csss!" };
{ 
children={ 
{ text="drag-n-drop\drop-target-types.htm" };
{ text="drag-n-drop\gripper.htm" };
{ text="drag-n-drop\menu-dd.htm" };
{ text="drag-n-drop\shopping-cart.htm" };
{ text="drag-n-drop\tabs-reordering.htm" };
{ text="drag-n-drop\tree-view-context.htm" };
{ text="drag-n-drop\tree-view-rtl.htm" };
{ text="drag-n-drop\tree-view.htm" }
};text="drag-n-drop" };
{ 
children={ 
{ text="editor\index.htm" }
};text="editor" };
{ 
children={ 
{ text="effects\marquee.htm" };
{ text="effects\reflection.htm" }
};text="effects" };
{ 
children={ 
{ text="fieldset\layout.htm" }
};text="fieldset" };
{ 
children={ 
{ text="fisheye\magnifier-4.htm" };
{ text="fisheye\magnifier-left-bottom.htm" };
{ text="fisheye\magnifier.htm" };
{ text="fisheye\magnifieranza.htm" }
};text="fisheye" };
{ 
children={ 
{ text="fixed-table\collapsible-sections-classic.htm" };
{ text="fixed-table\collapsible-sections.htm" };
{ text="fixed-table\simple-sections.htm" };
{ text="fixed-table\simple.htm" };
{ text="fixed-table\table-fixed-10000-rows-sections.htm" };
{ text="fixed-table\table-fixed-10000-rows.htm" }
};text="fixed-table" };
{ 
children={ 
{ text="flows\columns.htm" };
{ text="flows\demo-at-w3c.htm" };
{ text="flows\dynamic-flow-tmpl.htm" };
{ text="flows\grid-layout-2.htm" };
{ text="flows\grid-layout-3.htm" };
{ text="flows\grid-layout-4.htm" };
{ text="flows\grid.htm" };
{ text="flows\h-flow.htm" };
{ text="flows\template-layout-using-indexes.htm" };
{ text="flows\template-layout.htm" };
{ text="flows\text-fragment.htm" };
{ text="flows\v-flow.htm" };
children={ 
{ 
children={ 
{ text="flows\content\flow-and-floats.htm" };
{ text="flows\content\flow-horizontal-flow.htm" };
{ text="flows\content\flow-horizontal.htm" };
{ text="flows\content\flow-template.htm" };
{ text="flows\content\flow-vertical-flow.htm" };
{ text="flows\content\flow-vertical.htm" };
{ text="flows\content\lorem-ipsum.htm" }
};text="flows\content" }
}
};text="flows" };
{ 
children={ 
{ text="for-at\buttons.htm" };
{ text="for-at\ext-scrollbars.htm" }
};text="for-at" };
{ 
children={ 
{ text="forms\basiccontrols.htm" };
{ text="forms\buttons.htm" };
{ text="forms\custom-ctl-styles.htm" };
{ text="forms\custom-dropdown-selects.htm" };
{ text="forms\datetime.htm" };
{ text="forms\dropdown-select-tree.htm" };
{ text="forms\dropdown-selects.htm" };
{ text="forms\editable-dropdown-selects.htm" };
{ text="forms\edits.htm" };
{ text="forms\form.htm" };
{ text="forms\input-text-and-button.htm" };
{ text="forms\listview.htm" };
{ text="forms\multiselect.htm" };
{ text="forms\path-select.htm" };
{ text="forms\plaintext.htm" };
{ text="forms\popup-selector.htm" };
{ text="forms\progress.htm" };
{ text="forms\scrollbars.htm" };
{ text="forms\selects.htm" };
{ text="forms\slider.htm" };
{ text="forms\table-select.htm" };
{ text="forms\tabs-in-tabs.htm" };
{ text="forms\tabs.htm" };
{ text="forms\textarea.htm" };
{ text="forms\tree-view.htm" };
{ text="forms\tristate-checkbox.htm" }
};text="forms" };
{ 
children={ 
{ text="frames\behaviors.htm" };
{ text="frames\border-spacing.htm" };
{ text="frames\frame-splitter-styling.htm" };
{ text="frames\frame1.htm" };
{ text="frames\frame2.htm" };
{ text="frames\frame3.htm" };
{ text="frames\frame4.htm" };
{ text="frames\frames-rtl.htm" };
{ text="frames\frames.htm" };
{ text="frames\frameset-splitter.htm" };
{ text="frames\large-content-in-frames.htm" };
{ text="frames\standalone-frame.htm" }
};text="frames" };
{ 
children={ 
{ text="generic\backgrounds.htm" };
{ text="generic\custom-control-border.htm" };
{ text="generic\hidden.htm" };
{ text="generic\iframe.htm" };
{ text="generic\overflows.htm" };
{ text="generic\selectors.htm" };
{ text="generic\sidebars.htm" };
{ text="generic\tabindex_navigation.htm" };
children={ 
{ 
children={  };text="generic\backgrounds" };
{ 
children={  };text="generic\sidebars" }
}
};text="generic" };
{ 
children={ 
{ text="goodies\animated-cursor.htm" };
{ text="goodies\animatedgifs.htm" };
{ text="goodies\cursor.htm" };
{ text="goodies\custom-tags.htm" };
{ text="goodies\data-url.htm" };
{ text="goodies\file-icon.htm" };
{ text="goodies\gifs.htm" };
{ text="goodies\icon.htm" };
{ text="goodies\picture.htm" };
children={ 
{ 
children={  };text="goodies\pictures" };
{ 
children={  };text="goodies\smiley" }
}
};text="goodies" };
{ 
children={ 
{ text="grid\scrollable-table.htm" };
{ text="grid\sortable-grid.htm" };
{ text="grid\table-tbody-thead.htm" };
{ text="grid\virtual-table.htm" }
};text="grid" };
{ 
children={ 
{ text="horizontal-vertical-align\horizontal-align-flow.htm" };
{ text="horizontal-vertical-align\horizontal-align.htm" };
{ text="horizontal-vertical-align\vertical-align.htm" }
};text="horizontal-vertical-align" };
{ 
children={ 
{ text="includes\chunk1.htm" };
{ text="includes\chunk2.htm" };
{ text="includes\root.htm" }
};text="includes" };
{ 
children={ 
{ text="menu\c-menu.htm" };
{ text="menu\context-menu.htm" };
{ text="menu\for-track-popup-test.htm" };
{ text="menu\menu-bar.htm" };
{ text="menu\non-rectangular-menu.htm" };
{ text="menu\popup-menu.htm" }
};text="menu" };
{ 
children={ 
{ text="MSVS-start-page\start-page.htm" };
children={ 
{ 
children={ 
{ text="MSVS-start-page\content\getting-started.htm" };
{ text="MSVS-start-page\content\headlines.htm" };
{ text="MSVS-start-page\content\list-of-projects.htm" };
{ text="MSVS-start-page\content\msdn-recent-news.htm" }
};text="MSVS-start-page\content" }
}
};text="MSVS-start-page" };
{ 
children={ 
{ text="optimizations\dyn-updates.htm" }
};text="optimizations" };
{ 
children={ 
{ text="printing\!readme!.htm" };
{ text="printing\page-break-after.htm" };
{ text="printing\page-break-before.htm" };
{ text="printing\page-break-inside.htm" }
};text="printing" };
{ 
children={ 
{ text="richtext\help-shortcuts.htm" };
{ text="richtext\plaintext-modes.htm" };
{ text="richtext\plaintext.htm" };
{ text="richtext\richtext-list.htm" };
{ text="richtext\richtext.htm" }
};text="richtext" };
{ 
children={ 
{ text="sort-of-frames\help.htm" }
};text="sort-of-frames" };
{ 
children={ 
{ text="stress\animation.htm" };
{ text="stress\complex_tables.htm" };
{ text="stress\grid-1000-outline-glow.htm" };
{ text="stress\grid-1000-rounded-corners.htm" };
{ text="stress\grid-1000.htm" };
{ text="stress\grid-fixed-1000.htm" };
{ text="stress\grid-fixed-10000.htm" };
{ text="stress\select-10000.htm" };
{ text="stress\table-10000.htm" };
{ text="stress\table-fixed-10000.htm" };
children={ 
{ 
children={ 
{ text="stress\tabs\form.htm" };
{ text="stress\tabs\grid-1000.htm" };
{ text="stress\tabs\tabs.htm" };
{ text="stress\tabs\tree-view.htm" };
children={ 
{ 
children={  };text="stress\tabs\more_tabs" }
}
};text="stress\tabs" }
}
};text="stress" };
{ 
children={ 
{ text="svg\gradient-svg.htm" };
{ text="svg\simple-svg.htm" };
children={ 
{ 
children={  };text="svg\svg" }
}
};text="svg" };
{ 
children={ 
{ text="tooltips\month.htm" };
{ text="tooltips\titles.htm" }
};text="tooltips" };
{ 
children={ 
{ text="transitions\!transition-doc.htm" };
{ text="transitions\accordion.htm" };
{ text="transitions\border-animation.htm" };
{ text="transitions\easing-functions.htm" };
{ text="transitions\flex-units-transition.htm" };
{ text="transitions\folding.htm" };
{ text="transitions\margin-animation.htm" };
{ text="transitions\opacity.htm" };
{ text="transitions\reverse-modes.htm" };
{ text="transitions\to-intrinsic-height.htm" }
};text="transitions" } 
}
hitem = winform.treeview.insertItem( tab ) 
 

winform.show() 
win.loopMessage();
