/* */ /* Copyright (c) 2003, organization : Scol Technologies Association, owner : Sylvain Huet */ /* For conditions of distribution and use, see copyright notice in dms/l/license.txt */ /* or on 'www.scol-technologies.org' */ /* Template Editor - DMS - Sep. '98 - by Marc BARILLEY */ /* Jun. '00 - by Marc BARILLEY */ /* Jul. '00 - by Julien ZORKO */ /* Nov. '03 - by BLG */ /* search for BLG in the code for latest modifications */ /* proto startEditor = fun [ Chn channel ObjWin parent I x main window left bound I y main window upper bound I w edit window width I h edit window height I winflag main window flags I flag flags for toolbar, statusbar, ... S _file dmi file to open S _class class file S _help help file S _icone default icone file fun [[[S r1] r1]] I load call back fun [S S] [[S r1] r1] callback [ [[[I S fun [ObjMenuItem Editor] I] r1] [[I S fun [ObjMenuItem Editor] I] r1]] [[[I S fun [ObjMenuItem Editor] I] r1] [[I S fun [ObjMenuItem Editor] I] r1]] [[S [ObjMenu r1]] r1] ] additional menus */ /* graphic resources */ var EDITOR_NORMAL = 0b1101;; var EDITOR_TOOLBAR = 0b0001;; /* obsolete */ var EDITOR_STATUSBAR = 0b0010;; var EDITOR_INFOWIN = 0b0100;; /* obsolete */ var EDITOR_MENUBAR = 0b1000;; /* obsolete */ /* Global public variable */ var DMSclassPath = "";; /* Class path */ var statusBarHeight = 20;; var EDITOR_BGCOLOR = 0xC8D0D4;; /* only required for compatibility */ var toolBarHeight = 29;; var infoWinHeight = 55;; /* end */ typeof TEMPLATEdefinitionsBuffer = [[S [[S r1] r1]] r1];; struct Editor = [ EditorCore : EditorCore, EditorPanel : ObjContainer, EditorDefaultFont : ObjFont, EditorEditableTextColor : [I I I I], EditorDmcMajorV : I, EditorDmcMinorV : I, EditorXMainWin : I, EditorYMainWin : I, EditorWMainWin : I, EditorHMainWin : I, EditorXEditWin : I, EditorYEditWin : I, EditorWEditWin : I, EditorHEditWin : I, EditorOffsetTop : I, EditorOffsetBottom : I, EditorOffsetLeft : I, EditorOffsetRight : I, EditorMainWin : ObjWin, EditorEditWin : ObjWin, EditorEditCont : ObjContainer, EditorStatusBar : ObjText, EditorName : ObjText, EditorStatusBarSCS2 : CompText, /* changed type (old ObjText) */ EditorNameSCS2 : CompText, /* changed type (old ObjText) */ EditorIcone : AlphaBitmap, EditorCbLoad : fun [[[S r1] r1]] I, EditorCbSave : fun [S S] [[S r1] r1], /* only required for compatibility */ EditorChannel : Chn, EditorFlag : I, EditorClass : S, EditorClassName : S, EditorModName : S, EditorFileName : S, EditorHelpfile : S, EditorDefaultIconeFile : S, EditorIconeFileName : S, EditorDmiMajorV : I, EditorDmiMinorV : I, EditorToolBar : ObjWin, EditorInfoWin : ObjWin, EditorFile : ObjText, EditorIconeButton : ObjButton, EditorIconeBitmap : ObjBitmap, EditorEdgeL : ObjBitmap, EditorEdgeR : ObjBitmap, EditorEdge : ObjBitmap, EditorOpenButtonIcone : ObjBitmap, EditorStaticToolTip : ScsToolTip, EditorCustomMenuItems : [ObjMenuItem r1] /*---*/ ] mkEditor;; /* libs */ fun getPathFile (longfile, file)= if (longfile==nil) || (strlen longfile)==0 || (nth_char longfile ((strlen longfile)-1)) == '/ then [longfile file] else getPathFile substr longfile 0 (strlen longfile)-1 strcat substr longfile ((strlen longfile)-1) 1 file;; /*************************************************************************************** * * Save * ***************************************************************************************/ fun TEDI_Save (ed) = set TEMPLATEdefinitionsBuffer = nil; let "class"::ed.EditorCore.EDICOclassFile::nil -> classLine in let "version"::ed.EditorCore.EDICOclassVersion -> versionLine in let classLine::versionLine::(exec ed.EditorCbSave with ["" ""]) -> dmiDef in set TEMPLATEdefinitionsBuffer = _SetDefBlock TEMPLATEdefinitionsBuffer MOD_BLOCK_DMI dmiDef; set ed.EditorCore.EDICOname = _GETcompText ed.EditorNameSCS2; set ed.EditorCore.EDICOdefinitions = TEMPLATEdefinitionsBuffer; EDITOR_Save; _PAINTcontainer ed.EditorPanel ;; /**************************************************************************************** * * Help * ****************************************************************************************/ fun _helphtml (fic,ext)= let _getress "DefaultLanguage" -> defLang in let if (strlen defLang)<=0 then "English" else defLang -> defLang in let strcatn fic::defLang::"."::ext::nil -> Hhelp in let if (_checkpack Hhelp)!=nil then Hhelp else if strcmp defLang "English" then strcatn fic::"English."::ext::nil else "Dms/Scs/help/code404.html" -> Hhelp in if http_svr==nil then _openbrowserhttpP _checkpack Hhelp else ( /* _openbrowserhttp strcatn "http://"::_hostIP::":"::(itoa http_port)::"/"::http_clid::"/"::Hhelp::nil; */ _openbrowserhttp strcatn "http://127.0.0.1:"::(itoa http_port)::"/"::http_clid::"/"::Hhelp::nil; nil ) ;; fun _resizeT (a, t, x, y)= _SIZEtext t x-2 y-2 1 1;; fun _help (a, ed)= /* aide html si extension htm ou html */ let file_extension ed.EditorCore.EDICOhelp -> ext in if (!strcmpi ext "htm")||(!strcmpi ext "html") then ( _helphtml substr ed.EditorCore.EDICOhelp 0 (strlen ed.EditorCore.EDICOhelp)-(strlen ext) ext; nil ) else ( let _CRwindow _channel ed.EditorMainWin 150 150 500 300 WN_MENU|WN_MINBOX|WN_SIZEBOX if ed.EditorCore.EDICOclassFile==nil then nil else ed.EditorCore.EDICOclassFile -> win in _CBwinSize win @_resizeT _CRtext _channel win 1 1 498 298 ET_VSCROLL _getpack _checkpack ed.EditorCore.EDICOhelp );; /**************************************************************************************** * Write a message in the status bar * proto: fun[Editor S]I ****************************************************************************************/ fun setEditorStatus (ed, message) = _SETcompText ed.EditorStatusBarSCS2 message nil nil 1; 1 ;; fun _rflBROWSEicone (ob, ed, pack)= if pack==nil then nil else let _LDbitmap _channel pack -> bmp in if bmp==nil then nil else let _GETbitmapSize bmp -> [bmpw bmph] in let _GETalphaBitmaps ed.EditorIcone -> [iconeBmp _] in let _GETbitmapSize iconeBmp -> [icoW icoH] in let _GETwindowSizePosition ed.EditorMainWin -> [wwin _ _ _] in ( set ed.EditorCore.EDICObitmap = _PtoScol pack; _SCPbitmap iconeBmp 3 4 27 28 bmp 0 0 bmpw-1 bmph-1 0; _DSbitmap bmp; _PAINTcontainer ed.EditorPanel; );; fun _rflCLICKicone (icone, ed, posx, posy,btn, mask) = let getPathFile ed.EditorCore.EDICObitmap "" -> [dir _] in _DLGrflopen _DLGOpenFile _channel ed.EditorMainWin dir "" "bitmaps (*.bmp)\0*.bmp\0all (*.*)\0*.*\0\0" @_rflBROWSEicone ed ;; /**************************************************************************************** * * Command Panel * ****************************************************************************************/ fun _rflCLICKcommandPanel (action, x, y, w, h, ed) = if !strcmp action "OK" then (TEDI_Save ed;EDITOR_Close;0) else if !strcmp action "CANCEL" then (EDITOR_Close;0) else if !strcmp action "APPLY" then (TEDI_Save ed;0) else if !strcmp action "HELP" then (_help nil ed;0) else nil ;; /**************************************************************************************** * * editor GUI creation * ****************************************************************************************/ fun _CreateCommandPanel (chnl, ed) = let ed.EditorPanel -> cont in /* buttons creation */ let ed.EditorDefaultFont -> font in let _GETcontainerPositionSize cont -> [_ _ w h] in let /*_locSCS "button-HELP" nil*/"?" -> helpTxt in let _locSCS "button-OK" nil -> okTxt in let _locSCS "button-CANCEL" nil -> cancelTxt in let _locSCS "button-APPLY" nil -> applyTxt in let maxGETstringSize font helpTxt::okTxt::cancelTxt::applyTxt::nil -> zone in let [20 20 3 3] -> edgeWidths in let [10 10 10 10] -> [l r t b] in let zone -> [bW bH] in let [0 bH] -> zone in let [bW+l+r bH+t+b] -> [bW bH] in let [font 0 helpTxt "HELP"]::nil -> htxt in let [font 0 applyTxt "APPLY"]::[font 0 cancelTxt "CANCEL"]::[font 0 okTxt "OK"]::nil -> txt in let mkfun6 @_rflCLICKcommandPanel ed -> reflex in let GRAPHICDRESSING_CRbuttonBar chnl cont nil w-ed.EditorOffsetRight h-(ed.EditorOffsetBottom-7) edgeWidths [0 22] reflex txt BUTTONBAR_HORIZONTAL|BUTTONBAR_INVX OBJ_ENABLE|OBJ_VISIBLE|ROL_DISABLE|ROL_MASK|OBJ_LW_FLEX|OBJ_RW_FLEX|OBJ_LH_FLEX OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_KEYUP|OBJ_CONTAINER_MOVE -> menuBar in let GRAPHICDRESSING_CRbuttonBar chnl cont nil w-ed.EditorOffsetRight ed.EditorOffsetTop-42 edgeWidths [22 22] reflex htxt BUTTONBAR_HORIZONTAL|BUTTONBAR_INVX OBJ_ENABLE|OBJ_VISIBLE|ROL_DISABLE|ROL_MASK|OBJ_LW_FLEX|OBJ_RH_FLEX OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_KEYUP|OBJ_CONTAINER_MOVE -> helpBut in /* icone creation */ let [32 34] -> [barW barH] in let _LDalphaBitmap chnl _checkpack GRAPHICDRESSING_GetIcone "WINDOWS_ICONE" -> borders in let _CRbitmap chnl 32 32 -> icoBmp in let _CPalphaBitmap icoBmp 0 0 borders 56 16 88 48 -> _ in let _LDbitmap chnl _checkpack ed.EditorCore.EDICObitmap -> preBmp in let if preBmp==nil then _LDbitmap chnl _checkpack ed.EditorDefaultIconeFile else preBmp -> bmp in let _GETbitmapSize bmp -> [icoW icoH] in let if bmp!=nil then (_SCPbitmap icoBmp 3 4 27 28 bmp 0 0 icoW-1 icoH-1 GRAPHICDRESSING_GetCurrentTransparencyColor) else nil -> _ in let /*_GETalphaBitmapSize abmp*/ [32 32] -> [bw bh] in let _locSCS "label-MODULENAME" nil -> nameTxt in let _GETstringSize font nameTxt -> [lw lh] in let if lh>bh then lh+10+barH else bh+10+barH -> height in let _CRalphaBitmap chnl icoBmp nil GRAPHICDRESSING_GetCurrentBackgroundColor GRAPHICDRESSING_GetCurrentTransparencyColor -> abmp in let _CRcompBitmap chnl cont nil [ed.EditorOffsetLeft+1 ed.EditorOffsetTop-(bh+10)] OBJ_ENABLE|OBJ_VISIBLE OBJ_CONTAINER_KEYDOWN|OBJ_CONTAINER_KEYUP|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE abmp 0 0 32 32 -> icone in /* module name label and edit creation */ let _CRcompText chnl cont nil [ed.EditorOffsetLeft+bw+10 ed.EditorOffsetTop-(lh+14)] OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL OBJ_CONTAINER_KEYDOWN|OBJ_CONTAINER_KEYUP|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE lw bh nameTxt font [GD_DEFAULT_TEXT_COLOR 0 0 0] nil nil nil -> labelName in let _GETstringSize font (strcat "|Hfp" ed.EditorCore.EDICOname) -> [tw th] in let GRAPHICDRESSING_CRcompText chnl cont nil [ed.EditorOffsetLeft+bw+10+lw+5 ed.EditorOffsetTop-(th+16)] OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_EDITLINE|OBJ_MW_FLEX OBJ_CONTAINER_KEYDOWN|OBJ_CONTAINER_KEYUP|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE w-(ed.EditorOffsetLeft+bw+10+lw+5+32+ed.EditorOffsetRight) 20 ed.EditorCore.EDICOname font ed.EditorEditableTextColor [GD_DEFAULT_TEXT_HIGHLIGHT_COLOR 50] -> editName in ( set ed.EditorNameSCS2 = editName; set ed.EditorIcone = abmp; _CBcompBitmapDblClick icone @_rflCLICKicone ed; TOOLTIP_StaticLink cont (_CONVERTcompBitmapToObjNode icone) ed.EditorStaticToolTip (_locSCS "tooltip-ICONE" nil); /* status bar */ if ed.EditorFlag&EDITOR_STATUSBAR then set ed.EditorStatusBarSCS2 = _CRcompText ed.EditorCore.EDICOchannel cont nil [ed.EditorOffsetLeft h-(statusBarHeight+8)] OBJ_ENABLE|OBJ_VISIBLE|CT_LABEL|CT_LEFT|OBJ_LH_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_DBLCLICK|OBJ_CONTAINER_CLICK|OBJ_CONTAINER_MOVE|OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_KEYDOWN w-(ed.EditorOffsetLeft+ed.EditorOffsetRight) statusBarHeight ".." ed.EditorDefaultFont [GD_DEFAULT_TEXT_COLOR 0 0 0] [0 0] nil nil else nil; _PAINTcontainer cont ) ;; /**************************************************************************************** * * callbacks for the interface * ****************************************************************************************/ fun rflDestroyMainWin (win, ed)= EDITOR_Close ;; /* resize the main editor window */ fun rflSizeMainWin (win, ed, w, h) = if h < (ed.EditorOffsetTop) then nil else let _GETcontainerExPositionSize ed.EditorPanel -> [_ ppy ppw pph] in let _GETwindowExSizePosition win -> [ww hh _ _] in /* Required because of the w and h are not the client */ ( /* size and not the external one. */ set ed.EditorWMainWin = ww; set ed.EditorHMainWin = hh; /* editwin */ set ed.EditorXEditWin = ed.EditorOffsetLeft; set ed.EditorYEditWin = ed.EditorOffsetTop; set ed.EditorWEditWin = w-(ed.EditorOffsetLeft + ed.EditorOffsetRight); set ed.EditorHEditWin = h-(ed.EditorOffsetTop + ed.EditorOffsetBottom); _SIZEcontainer ed.EditorPanel 0 0 w h; if ed.EditorEditWin != nil then ( _SIZEwindowEx ed.EditorEditWin ed.EditorWEditWin ed.EditorHEditWin ed.EditorXEditWin ed.EditorYEditWin; if (ed.EditorWEditWin<10 || ed.EditorHEditWin<10) then _SHOWwindow ed.EditorEditWin WINDOW_HIDDEN else _SHOWwindow ed.EditorEditWin WINDOW_UNHIDDEN; 0 ) else ( _SIZEEXcontainer ed.EditorEditCont ed.EditorXEditWin ed.EditorYEditWin ed.EditorWEditWin ed.EditorHEditWin; 0 ) ) ;; /* move the main editor window */ fun rflMoveMainWin (wn, ed, x, y)= set ed.EditorXMainWin=x; set ed.EditorYMainWin=y;; /************************************ * Keyboard reflexes ************************************/ fun rflKeyDown (wn, ed, key, vcode) = /* _showconsole; _fooS strcatn "key:"::(itoa key)::"vcode:"::(itoa vcode)::nil;*/ if KEYBOARD_IsKey key KEYCODE_ENTER then ( TEDI_Save ed; if KEYBOARD_IsCTRLKeyDown then ( EDITOR_Close; 0) /* CTRL+ENTER */ else 0 ) else if KEYBOARD_IsKey key KEYCODE_ESCAPE then ( EDITOR_Close; 0 ) else if KEYBOARD_IsKey key KEYCODE_F1 then ( _help nil ed; 0 ) else if ( ((key>KEYCODE_F1) && (key<=KEYCODE_F12)) || KEYBOARD_IsCTRLKeyDown || KEYBOARD_IsALTKeyDown ) then ( EDITOR_KeyDown key vcode; 0 ) else nil ;; /*********************************** * functions for CBs definitions ***********************************/ fun _CBeditorLoad (ed, f) = set ed.EditorCbLoad = f;; fun _CBeditorSave (ed, f) = set ed.EditorCbSave = f;; /**************************************************************************************** * return 0 when the editor class version and the module version are equal * <0 when the module version is newer and >0 when older ****************************************************************************************/ fun _GetModuleVersionState (ed) = let switchstr (switchstr ed.EditorCore.EDICOdefinitions MOD_BLOCK_DMI) "version" -> [ver1 [ver2 _]] in let ed.EditorCore.EDICOclassVersion -> [cver1 [cver2 _]] in let [(atoi cver1) (atoi cver2)] -> [cv1 cv2] in let if ver1==nil then cv1 else (atoi ver1) -> mv1 in let if ver2==nil then if ver1==nil then cv2 else 0 else (atoi ver2) -> mv2 in if mv1==cv1 then if mv2==cv2 then 0 else if mv2>cv2 then -1 else 1 else if mv1>cv1 then -1 else 1 ;; /**************************************************************************************** * Called at the end of the iniEditor function in order to load the parameters ****************************************************************************************/ fun openDMI (ed) = let _GetModuleVersionState ed -> verState in if verState < 0 then ( _DLGMessageBox _channel ed.EditorMainWin (_locSCS "dlg-ERROR" nil) (_locSCS "dlg-ERRORT" nil) 0; /* EDITOR_Close;*/ 0 ) else ( if verState > 0 then ( _DLGMessageBox _channel ed.EditorMainWin (_locSCS "dlg-REMARK" nil) (_locSCS "dlg-REMARKT" nil) 0;0 ) else 0 ); if ed.EditorCore.EDICOdefinitions != nil then exec ed.EditorCbLoad with [ (_GetDefBlock ed.EditorCore.EDICOdefinitions MOD_BLOCK_DMI) ] else nil; if ed.EditorEditWin != nil then (_PAINTwindow ed.EditorEditWin;0) else if ed.EditorEditCont != nil then (_PAINTcontainer _SHOWcontainer ed.EditorEditCont CONTAINER_UNHIDDEN;0) else nil ;; /**************************************************************************************** * Called when a definition or name or bitmap has been modified ****************************************************************************************/ fun _ModuleDataModified (edCore, ed) = _SETcompText ed.EditorNameSCS2 edCore.EDICOname ed.EditorDefaultFont ed.EditorEditableTextColor CT_END; exec ed.EditorCbLoad with [ (_GetDefBlock ed.EditorCore.EDICOdefinitions MOD_BLOCK_DMI) ]; _PAINTcontainer ed.EditorPanel; if ed.EditorEditWin != nil then (_PAINTwindow _SHOWwindow ed.EditorEditWin WINDOW_UNHIDDEN;0) else if ed.EditorEditCont != nil then (_PAINTcontainer _SHOWcontainer ed.EditorEditCont CONTAINER_UNHIDDEN;0) else nil; 0 ;; fun EDITOR_MaxResToolTip (compCheck) = if ((_GETcompCheckState compCheck) == CHK_CHECKED) then (_locSCS "winbut-RES" nil) else (_locSCS "winbut-MAX" nil) ;; fun searchlastpoint(s)= let strlen s->l in let l-1-> i in (while i>=0 && (nth_char s i)!='. do set i=i-1; i);; fun newext(f,ext)= let searchlastpoint f -> i in strcat (if i==-1 then f else substr f 0 i) (strcat "." ext) ;; /*###################################################################################### # # # PUBLIC FUNCTIONS # # # ######################################################################################*/ /*************************************************************************************** * set a block of definition of a module * if the new block value is nil then suppress the block definition * Return value: 1 (success) ***************************************************************************************/ fun setDef (ed, name, content) = set ed.EditorCore.EDICOdefinitions = _SetDefBlock ed.EditorCore.EDICOdefinitions name content; set TEMPLATEdefinitionsBuffer = _SetDefBlock TEMPLATEdefinitionsBuffer name content; 0 ;; /**************************************************************************************** Get a definition block of a definition list Return value: [[S r1] r1] (success) or nil (failure) *****************************************************************************************/ fun getDef (ed, name) = _GetDefBlock ed.EditorCore.EDICOdefinitions name ;; /**************************************************************************************** Return the editor window to customize proto fun[Editor] ObjWin *****************************************************************************************/ fun getEditWin (ed) = ed.EditorEditWin ;; /**************************************************************************************** Return the editor container to customize proto fun[Editor] ObjContainer ( create the container and destroy is the editor window at the first call.) *****************************************************************************************/ fun getEditCont (ed) = if ed.EditorEditCont != nil then ed.EditorEditCont else ( _DSwindow ed.EditorEditWin; set ed.EditorEditWin = nil; set ed.EditorEditCont = _CRcontainerFromObjCont ed.EditorCore.EDICOchannel ed.EditorPanel ed.EditorXEditWin ed.EditorYEditWin ed.EditorWEditWin ed.EditorHEditWin CO_CHILDINSIDE|CO_NOBORDER|CO_HIDE GRAPHICDRESSING_GetCurrentBackgroundColor nil ) ;; /**************************************************************************************** * Localisation ****************************************************************************************/ fun _locEditor (ref,param)= _locSCS ref param;; /**************************************************************************************** * function to write in the status bar ****************************************************************************************/ fun status (ed, string)= setEditorStatus ed string;; fun RESIZEeditWin (ed,w,h) = let _GETwindowSizePosition ed.EditorEditWin -> [ew eh _ _] in let _GETwindowExSizePosition ed.EditorMainWin -> [mw mh mx my] in _SIZEwindowEx ed.EditorMainWin mw+w-ew mh+h-eh mx my;; /**************************************************************************************** * * Function for initializing the editor window (proto at the begining of this file) * ****************************************************************************************/ fun globalStartEditor (chn, parent, x, y, w, h, winflag, flag, fil, _class, _help, _icone, load, save, menus, test)= let mkEditor [ nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil ] -> ed in ( set ed.EditorFlag = flag; set ed.EditorOffsetTop = 80; set ed.EditorOffsetBottom = 40; if ed.EditorFlag&EDITOR_STATUSBAR then set ed.EditorOffsetBottom = ed.EditorOffsetBottom + statusBarHeight else nil; set ed.EditorOffsetLeft = 10; set ed.EditorOffsetRight = 10; set ed.EditorCore = EDITOR_CreateCore nil; set ed.EditorCbLoad = load; set ed.EditorCbSave = save; if ed.EditorCore.EDICOhelp == nil then set ed.EditorCore.EDICOhelp = _help else nil; if ed.EditorCore.EDICOclassFile == nil then set ed.EditorCore.EDICOclassFile = _class else nil; set ed.EditorDefaultIconeFile = _icone; set ed.EditorDefaultFont = _CRfont chn 14 0 0 "Arial"; _SETdefaultFont _CRfont _channel 14 0 0 "Arial"; set ed.EditorEditableTextColor = [0 0 0 0]; let _LDalphaBitmap chn _checkpack GRAPHICDRESSING_GetIcone "TOOLTIP_BG_ICONE" -> motif in set ed.EditorStaticToolTip = TOOLTIP_Create _CRfont chn 12 0 0 "Arial" [0 0 0 0] GRAPHICDRESSING_GetCurrentBackgroundColor motif [2 2 18 18] "TOOLTIP_IS_USER_HELP_ENABLED"; set ed.EditorXMainWin = x; set ed.EditorYMainWin = y; set ed.EditorWMainWin = w + ed.EditorOffsetLeft + ed.EditorOffsetRight + 3; set ed.EditorHMainWin = h + ed.EditorOffsetTop + ed.EditorOffsetBottom + 3; EDITOR_CBmodified @_ModuleDataModified ed; /* dmc version */ let ed.EditorCore.EDICOclassVersion -> [dmcM [dmcm _]] in ( set ed.EditorDmcMajorV = atoi dmcM; set ed.EditorDmcMinorV = atoi dmcm ); /* Localisation kit initialization */ let getPathFile ed.EditorCore.EDICOclassFile "" ->[path file] in let strcat path "editorLang/" -> thePath in let searchlastpoint file -> i in let substr file 0 i -> theFile in ( iniLocEditor "dms/l/templateedit1" thePath theFile; /* class path initialisation */ set DMSclassPath = path ); /* will the editor be launched or can not ? */ if (test!=nil) && !(exec test with []) then ( EDITOR_Close; nil ) else ( /* main window */ let strcatn " "::(_locSCS "wintitle-EDITOR" ed.EditorCore.EDICOclassName::nil)::nil -> title in let [ed.EditorWMainWin ed.EditorHMainWin] -> [w h] in let if parent==nil then /*EDITOR_WinMother*/nil else parent -> mother in let _CRwindow ed.EditorCore.EDICOchannel mother nil nil w h WN_NOBORDER|WN_NOCAPTION|WN_HIDDEN title -> win in /* buttons min & max */ let if winflag&WN_MINBOX then GDWIN_MIN_BUTTON else 0 -> buttonFlag in let if ((winflag&WN_SIZEBOX) && (winflag&WN_MAXBOX)) then GDWIN_MAX_BUTTON|buttonFlag else buttonFlag -> buttonFlag in /* editor max size */ let if WN_SIZEBOX then _GETscreenSize else [w h] -> [maxw maxh] in let _CRfont chn 14 0 FF_WEIGHT "Arial" -> weightFont in let GRAPHICDRESSING_CRcontainerWithObjWin chn win [x y w h] [w h maxw maxh] GRAPHICDRESSING_GetCurrentBackgroundColor "" weightFont [GD_WINDOWS_TITLE_COLOR1 0 1 0x50] GDWIN_BORDERS|GDWIN_TITLE_BAR|GDWIN_CLOSE_BUTTON|buttonFlag [nil nil @EDITOR_Close] -> [cont compTitle compMin compMax compClose _] in ( set ed.EditorMainWin = win; set ed.EditorPanel = cont; TOOLTIP_StaticLink cont _CONVERTcompRollOverToObjNode compMin ed.EditorStaticToolTip (_locSCS "winbut-MIN" nil); TOOLTIP_DynamicLink cont (_CONVERTcompCheckToObjNode compMax) ed.EditorStaticToolTip (mkfun1 @EDITOR_MaxResToolTip compMax); TOOLTIP_StaticLink cont _CONVERTcompRollOverToObjNode compClose ed.EditorStaticToolTip (_locSCS "winbut-CLOSE" nil); _SETcompText compTitle title nil nil nil ); /* get core editor structure */ set ed.EditorCore = EDITOR_CreateCore ed.EditorMainWin; /* command panel creation */ _CreateCommandPanel ed.EditorCore.EDICOchannel ed; /******** for compatibility ***********/ set ed.EditorName = _CRtext ed.EditorCore.EDICOchannel ed.EditorMainWin 0 0 0 0 ET_HIDDEN ed.EditorCore.EDICOname; set ed.EditorFile = _CRtext ed.EditorCore.EDICOchannel ed.EditorMainWin 0 0 0 0 ET_HIDDEN fil; set ed.EditorStatusBar = _CRtext ed.EditorCore.EDICOchannel ed.EditorMainWin 0 0 0 0 ET_HIDDEN ""; /**************************************/ _CBwinDestroy ed.EditorMainWin @rflDestroyMainWin ed; _CBwinSize ed.EditorMainWin @rflSizeMainWin ed; _CBwinMove ed.EditorMainWin @rflMoveMainWin ed; /* edit window */ set ed.EditorXEditWin = ed.EditorOffsetLeft; set ed.EditorYEditWin = ed.EditorOffsetTop; set ed.EditorWEditWin = w; set ed.EditorHEditWin = h; set ed.EditorEditWin = _CRwindow ed.EditorCore.EDICOchannel ed.EditorMainWin ed.EditorXEditWin ed.EditorYEditWin ed.EditorWEditWin ed.EditorHEditWin /*WN_NOBORDER|*/WN_CHILD ""; if (ed.EditorWEditWin<10 || ed.EditorHEditWin<10) then _SHOWwindow ed.EditorEditWin WINDOW_HIDDEN else _SHOWwindow ed.EditorEditWin WINDOW_UNHIDDEN; _PAINTcontainer ed.EditorPanel; // BLG - 2003/11/03 // The 2 following lines were added to force the proper display of the editor's borders using the // latest SCS skin. _SIZEwindowEx ed.EditorMainWin 1+ed.EditorWMainWin 1+ed.EditorHMainWin nil nil; _SIZEwindowEx ed.EditorMainWin ed.EditorWMainWin ed.EditorHMainWin nil nil; // BLG - End of modification _SHOWwindow ed.EditorMainWin WINDOW_UNHIDDEN; _TOPwindow ed.EditorMainWin; /* Definition of the key call back */ _CBwinKeydown ed.EditorMainWin @rflKeyDown ed; _CBwinKeydown ed.EditorEditWin @rflKeyDown ed; _CBcontainerKeyDown ed.EditorPanel @rflKeyDown ed; /* return the editor structure */ ed ) ) ;; fun startEditor (chn, parent, x, y, w, h, winflag, flag, fil, _class, _help, _icone, load, save, menus) = globalStartEditor chn parent x y w h winflag flag fil _class _help _icone load save menus nil ;; fun _StartEditor (chn, parent, x, y, w, h, winflag, flag, load, save, test)= globalStartEditor chn parent x y w h winflag flag nil nil nil nil load save nil test ;;