/*

default pickle module 
(Photodex Internal 'C' Kernel Language Environment)

Copyright (c)1995 Photodex Corporation.  All rights reserved.
Photodex is a trademark of Photodex Corporation.

THIS INFORMATION IS PROPRIETARY AND CONFIDENTIAL.  USE OF THIS INFORMATION
IS STRICTLY PROHIBITED WITHOUT WRITTEN PERMISSION FROM AN EXECUTIVE OFFICER
OF PHOTODEX CORPORATION.

*/

"Copyright (c)1995 Photodex Corporation.  All rights reserved."		// legal copyright notice (emitted in data segment)






export "V()" PickleStartup()		/* startup routine */
{
	Deb("PICKLE STARTUP - STARTING");

	VarSetGlobal("kbFileDouble","(script code for double click)");		/* set global variable for double click event */
	VarSetGlobal("h","[cpicPath]help/");		/* set global variable for help directory */

	// do housekeeping of anything that can change with preferences
	StatDockCheck(ifs);		/* check docking of process status panel */
	RecStatDockCheck(ifs);	/* check docking of file list status panel */

	Deb("PICKLE STARTUP - COMPLETE");
}




export "V()" mHelpOver()		/* help overview */
{
	Help("[h]help");		/* main help */
}


export "V()" mHelpAbout()		/* help about */
{
	Deb("CPIC version %s",cpicVer);
	Deb("Pickle version %s",pickleVer);
}


export "V()" ExitScript()		/* exit script */
{
	Deb("ExitScript calling Exit...");		/* tell user */
	Exit(ifs);		/* exit application */
}



export "V()" tViewScript()		/* view script */
{
	RecPresent(ifs,RecGetCaret(ifs));		/* present record */
}



export "V()" tEditScript()		/* edit script */
{
	RecEdit(ifs,RecGetCaret(ifs));		/* edit record */
}



export "V()" tCreateScript()		/* create script */
{
	Deb("toolbar create new");
}



export "V()" tBogusScript()		/* bogus script */
{
	Deb("toolbar bogus");
}



export "V()" tPathExpAll()		/* expand all paths */
{
	val=0;		// preload temporary variable

	pos=0;		/* start at first entry */
	while(1) {
		val=PathGetListCount(ifs);
		if(pos < val) {		/* until done */
			PathExpandListEntry(ifs,pos);		/* expand entry */
		} else {
			break;
		}
		pos++;
	}
	Deb("Done expanding");
}



export "V()" tPathColAll()		/* collapse all paths */
{
	val=0;		// preload temporary variable

	pos=PathGetListCount(ifs);		/* start at last entry */
	while(--pos >= 0) {
		PathCollapseListEntry(ifs,pos);		/* collapse entry */
	}
}



export "V()" tPathExpAllSel()		/* expand selected paths recursively */
{
	val=0;		// preload temporary variable

	pos=0;		/* start at first entry */
	while(1) {
		pos=PathNextSelItem(ifs,pos);		/* find next selected item */
		if(pos < 0) {
			break;
		}
		val=PathGetListCount(ifs);
		if(pos < val) {		/* until done */
			indent=PathGetListIndent(ifs,pos);		/* get indentation level */
			PathExpandListEntry(ifs,pos);		/* expand entry */
			pos++;
			while(val > indent) {		/* until end of parent's children */
				PathExpandListEntry(ifs,pos);		/* expand entry */
				pos++;
				val=PathGetListIndent(ifs,pos);
			}
		} else {
			break;
		}
	}
}




export "V()" tPathExpSel()		/* expand selected paths once */
{
	val=0;		// preload temporary variable

	pos=0;		/* start at first entry */
	while(1) {
		pos=PathNextSelItem(ifs,pos);		/* find next selected item */
		if(pos < 0) {
			break;
		}
		val=PathGetListCount(ifs);
		if(pos < val) {		/* until done */
			PathExpandListEntry(ifs,pos);		/* expand entry */
		} else {
			break;
		}
		pos++;
	}
}










