Commit 27fceb24 authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

abstract platform dependencies in help menu;

parent acb86aa0
...@@ -2,4 +2,4 @@ definition module idehelp ...@@ -2,4 +2,4 @@ definition module idehelp
import StdPSt, StdId import StdPSt, StdId
initHelpMenu :: Id !*(PSt .l) -> *PSt .l initHelpMenu :: !Id !*(PSt .l) -> *PSt .l
...@@ -4,42 +4,10 @@ import StdFunc, StdMisc ...@@ -4,42 +4,10 @@ import StdFunc, StdMisc
import StdMenu, StdPStClass, StdSystem import StdMenu, StdPStClass, StdSystem
import ExtNotice import ExtNotice
import ioutil, UtilIO, IdePlatform import ioutil, UtilIO, IdePlatform
import first_run
import Directory, StdTuple
//-- export //-- export
IDE_VERSION initHelpMenu :: !Id !*(PSt .b) -> *PSt .b
:== "v2.0 build 2001-12-18 "
// want link(?) date/time to be automatically entered...
+++. PLATFORM
+++. CLEAN_VERSION
+++. EXE_VERSION
PLATFORM
= case toInt '\n' of
13 -> "Mac "
10 -> "Win "
_ -> "??? "
CLEAN_VERSION
# clean = "(1.3) "
// 2.0 only...
/*
// /*
*/
# clean = "(2.0) "
// */
= clean
EXE_VERSION
= toString (fst3 GetVNP)
//--
initHelpMenu :: Id !*(PSt .b) -> *PSt .b
initHelpMenu wId ps initHelpMenu wId ps
# (mId,ps) = openId ps # (mId,ps) = openId ps
# (_,ps) = openMenu Void (helpMenu wId mId) ps # (_,ps) = openMenu Void (helpMenu wId mId) ps
...@@ -48,14 +16,6 @@ initHelpMenu wId ps ...@@ -48,14 +16,6 @@ initHelpMenu wId ps
//-- local //-- 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"
helpMenu wId mId helpMenu wId mId
= Menu "&Help" = Menu "&Help"
( MenuItem "&About..." [MenuFunction (noLS (about wId))] ( MenuItem "&About..." [MenuFunction (noLS (about wId))]
...@@ -64,49 +24,11 @@ helpMenu wId mId ...@@ -64,49 +24,11 @@ helpMenu wId mId
[ [
] ]
helpItems wId mId ps
# path = applicationpath "help"
# ((ok,path`),ps) = pd_StringToPath path ps
| not ok = ps
# ((err,dir),ps) = getDirectoryContents path` ps
| err <> NoDirError = ps
# items = map getinfo dir
= to_menu_items (path+++."\\") items mId ps
where
getinfo {fileName,fileInfo=fi=:{pi_fileInfo=dummyname=:{isDirectory}}}
= (isDirectory,fileName)
to_menu_items path [] mId ps = ps
to_menu_items path [(is_dir,filename):rest] mId ps
| not is_dir
# item = MenuItem filename [MenuFunction (noLS (help path filename wId))]
# (err,ps) = openSubMenuElements mId 32000 Void item ps
= to_menu_items path rest mId ps
| filename == "." || filename == ".."
= to_menu_items path rest mId ps
# ((ok,path`),ps) = pd_StringToPath (path+++.filename) ps
| not ok
= to_menu_items path rest mId ps
# ((err,dir),ps) = getDirectoryContents path` ps
| err <> NoDirError
= to_menu_items path rest mId ps
# items = map getinfo dir // only need common fileinfo...
# (mId`,ps) = openId ps
# item = SubMenu filename NilLS [MenuId mId`]
# (err,ps) = openSubMenuElements mId 32000 Void item ps
# ps = to_menu_items (path+++.filename+++."\\") items mId` ps
= to_menu_items path rest mId ps
help path file wId ps
# path = path +++. file
# (ret,ps) = ShellDefault path ps
= ps
about wId ps about wId ps
# (wId,ps) = openId ps # (wId,ps) = openId ps
# (bmap,ps) = GetBitmapResource AboutBitmap ps # (bmap,ps) = getAboutBitmap ps
| isNothing bmap | isNothing bmap
= openNotice (Notice [bitmapname+++" bitmap unavailable."] (NoticeButton "OK" id) []) ps = openNotice (Notice ["AboutIDE bitmap unavailable."] (NoticeButton "OK" id) []) ps
# bmap = fromJust bmap # bmap = fromJust bmap
# (cId,ps) = openId ps # (cId,ps) = openId ps
# (_,ps) = openModalDialog dloc (ddef bmap cId wId) ps # (_,ps) = openModalDialog dloc (ddef bmap cId wId) ps
...@@ -131,3 +53,30 @@ where ...@@ -131,3 +53,30 @@ where
# p = setPenFont font`` p # p = setPenFont font`` p
# p = drawAt {x=newFrame.corner1.x+10,y=newFrame.corner2.y-20} IDE_VERSION p # p = drawAt {x=newFrame.corner1.x+10,y=newFrame.corner2.y-20} IDE_VERSION p
= p = p
IDE_VERSION
:== BUILD_VERSION
// want link(?) date/time to be automatically entered...
+++. PLATFORM
+++. CLEAN_VERSION
+++. EXE_VERSION
BUILD_VERSION :== "v2.0 build 2003-03-17 "
PLATFORM
= case toInt '\n' of
13 -> "Mac "
10 -> "Win "
_ -> "??? "
CLEAN_VERSION
# clean = "(1.3) "
// 2.0 only...
/*
// /*
*/
# clean = "(2.0) "
// */
= clean
definition module IdePlatform definition module IdePlatform
import StdPSt, StdString import StdPSt, StdString, StdFile
import StdIOCommon import StdIOCommon
from IdeState import :: General from IdeState import :: General
...@@ -22,6 +22,8 @@ ImpmodIcon :== 32516 ...@@ -22,6 +22,8 @@ ImpmodIcon :== 32516
toolIconFun :: !Int !(Maybe String) !(IdFun .st) ![(ToolbarItem .st)] !.env -> (![(ToolbarItem .st)],!.env) toolIconFun :: !Int !(Maybe String) !(IdFun .st) ![(ToolbarItem .st)] !.env -> (![(ToolbarItem .st)],!.env)
getAboutBitmap :: !*env -> (!Maybe Bitmap, !*env) | FileEnv env
AboutBitmap :== 32512 AboutBitmap :== 32512
findBM :== 32513 findBM :== 32513
newfBM :== 32514 newfBM :== 32514
...@@ -31,3 +33,6 @@ saveBM :== 32517 ...@@ -31,3 +33,6 @@ saveBM :== 32517
srchBM :== 32518 srchBM :== 32518
updtBM :== 32519 updtBM :== 32519
urunBM :== 32520 urunBM :== 32520
helpItems :: !Id !Id !*(PSt .a) -> *PSt .a
EXE_VERSION :: String
...@@ -273,3 +273,53 @@ srchBM :== 32518 ...@@ -273,3 +273,53 @@ srchBM :== 32518
updtBM :== 32519 updtBM :== 32519
urunBM :== 32520 urunBM :== 32520
import first_run
import Directory, StdTuple, StdMenu, StdSystem
getAboutBitmap :: !*env -> (!Maybe Bitmap, !*env) | FileEnv env
getAboutBitmap env
= GetBitmapResource AboutBitmap env
helpItems :: !Id !Id !*(PSt .a) -> *PSt .a
helpItems wId mId ps
# path = applicationpath "Help"
# ((ok,path`),ps) = pd_StringToPath path ps
| not ok = ps
# ((err,dir),ps) = getDirectoryContents path` ps
| err <> NoDirError = ps
# items = map getinfo dir
= to_menu_items (path+++."\\") items mId ps
where
getinfo {fileName,fileInfo=fi=:{pi_fileInfo=dummyname=:{isDirectory}}}
= (isDirectory,fileName)
to_menu_items path [] mId ps = ps
to_menu_items path [(is_dir,filename):rest] mId ps
| not is_dir
# item = MenuItem filename [MenuFunction (noLS (help path filename wId))]
# (err,ps) = openSubMenuElements mId 32000 Void item ps
= to_menu_items path rest mId ps
| filename == "." || filename == ".."
= to_menu_items path rest mId ps
# ((ok,path`),ps) = pd_StringToPath (path+++.filename) ps
| not ok
= to_menu_items path rest mId ps
# ((err,dir),ps) = getDirectoryContents path` ps
| err <> NoDirError
= to_menu_items path rest mId ps
# items = map getinfo dir // only need common fileinfo...
# (mId`,ps) = openId ps
# item = SubMenu filename NilLS [MenuId mId`]
# (err,ps) = openSubMenuElements mId 32000 Void item ps
# ps = to_menu_items (path+++.filename+++."\\") items mId` ps
= to_menu_items path rest mId ps
help path file wId ps
# path = path +++. file
# (ret,ps) = ShellDefault path ps
= ps
EXE_VERSION :: String
EXE_VERSION
= toString (fst3 GetVNP)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment