idehelp.icl 2.6 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2 3 4 5 6
implementation module idehelp

//import StdHtmlHelp
import StdFunc, StdMisc
import StdMenu, StdPStClass, StdSystem
import ExtNotice
Diederik van Arkel's avatar
Diederik van Arkel committed
7 8 9 10
import ioutil, UtilIO

//import dodebug
trace_n` m f :== f
Diederik van Arkel's avatar
Diederik van Arkel committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

//-- export

IDE_VERSION
	:== "v2.0 build 2001-08-28 "
	// want link(?) date/time to be automatically entered...
	+++. PLATFORM
	+++. CLEAN_VERSION

PLATFORM
	= case toInt '\n' of
		13	-> "Mac "
		10	-> "Win "
		_	-> "??? "
		
CLEAN_VERSION
	# clean	= "(1.3)"

// 2.0 only...
/*
// /*
*/
	# clean = "(2.0)"
// */

	= clean

//--

initHelpMenu :: Id !*(PSt .b) -> *PSt .b
initHelpMenu wId ps
Diederik van Arkel's avatar
Diederik van Arkel committed
42 43
	# (items,ps) = accFiles helpItems ps
	# (_,ps) = openMenu undef (helpMenu items wId) ps
Diederik van Arkel's avatar
Diederik van Arkel committed
44 45 46 47 48 49 50 51 52 53 54 55
	= ps

//-- local

bitmapname		= case toInt '\n' of
					13 -> applicationpath ":bitmaps:aboutIDE.pict"
					10 -> applicationpath "bitmaps//aboutIDE.bmp"
					_ -> abort "idehelp: unknown platform"

idehelpname		= applicationpath "idehelp"
idehelptopic	= "general.htm"

Diederik van Arkel's avatar
Diederik van Arkel committed
56 57
//helpMenu :: Id -> Menu (:+: .MenuItem .MenuItem) .a *(PSt .b )
helpMenu items wId
Diederik van Arkel's avatar
Diederik van Arkel committed
58 59
	= Menu "&Help"
		(	MenuItem "&About..." [MenuFunction (noLS (about wId))]
Diederik van Arkel's avatar
Diederik van Arkel committed
60 61
//		:+:	MenuItem "&Help..." [MenuFunction (noLS (help "help//man.pdf" wId))]
		:+:	SubMenu "&Help" (ListLS [MenuItem file [MenuFunction (noLS (help file wId))] \\ file <- items]) []
Diederik van Arkel's avatar
Diederik van Arkel committed
62 63 64 65
		)
		[
		]

Diederik van Arkel's avatar
Diederik van Arkel committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
import Directory, StdTuple

helpItems files
	# path					= applicationpath "help"
	# ((ok,path`),files)	= pd_StringToPath path files
	| not ok = ([],files)
	# ((err,dir),files)		= getDirectoryContents path` files
	| err <> NoDirError = ([],files)
	# items					= map getinfo dir		// only need common fileinfo...
	# items					= filter (\(b,n) -> not b) items
	# items					= map snd items
	= (items,files)
where
	getinfo {fileName,fileInfo=fi=:{pi_fileInfo=dummyname=:{isDirectory}}}
		= (isDirectory,fileName)

help file wId ps
	# path		= applicationpath ("help//"+++.file)
	# (ret,ps)	= ShellDefault path ps
	= trace_n` ("ShellExecute",ret,file) ps
Diederik van Arkel's avatar
Diederik van Arkel committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107

about wId ps
	# (wId,ps)	= openId ps
	# (bmap,ps)	= accFiles (openBitmap bitmapname) ps
	| isNothing bmap
		= openNotice (Notice [bitmapname+++" bitmap unavailable."] (NoticeButton "OK" id) []) ps
	# bmap		= fromJust bmap
	# (cId,ps)	= openId ps
	# (_,ps)	= openModalDialog dloc (ddef bmap cId wId) ps
	= ps
where
	dloc = 0
	ddef bmap cId wId
		# bitmapSize = 	getBitmapSize bmap
		# bitmapLook = \_ {newFrame} -> drawAt {x=newFrame.corner1.x+10,y=newFrame.corner2.y-20} IDE_VERSION o draw bmap
		= Dialog "About the Clean IDE"
						( CustomControl bitmapSize bitmapLook [ControlId cId])
						[ WindowClose (noLS (closeWindow wId))
						, WindowId wId
						, WindowHMargin 0 0
						, WindowVMargin 0 0
						]