/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : PopUpConfigSCSParams.pkg */ /* Version : 26 juillet 2000 */ /* Popup SCS Preferences window specific functions by Loïc ARGELIES */ /* */ /***************************************************************************************/ /* control variables */ var SCSPREF_LISTNBITEMSVISIBLE = 4 ;; /* How many list items displayed */ var SCSPREF_TYPE_STRING = "S" ;; var SCSPREF_TYPE_INTEGER = "I" ;; var SCSPREF_TYPE_COLOR = "C" ;; var SCSPREF_TYPE_BOOLEAN = "B" ;; var SCSPREF_TYPE_COMBO = "K" ;; /* Definition of SITE INFO STRUCTURE */ struct Struct_SCSPrefInfo = [ m_Channel : Chn , /* channel */ ctrl_Container : ObjContainer , /* container */ ctrl_Label1 : CompText , /* Displaying : "CATEGORY" */ ctrl_Label2 : CompText , /* Displaying : "PREFERENCE" */ ctrl_Label3 : CompText , /* Displaying : "SET NEW VALUE" */ ctrl_Label4 : CompText , /* Displaying : "DESCRIPTION" */ ctrl_LabelPrefDesc : CompText , /* Complete description of pref or category */ ctrl_EditBox1 : CompText , /* for pref value editing */ ctrl_CategoryCombo : CompCombo , /* Main list showing pref categories */ ctrl_PreferenceList : CompList , /* list showing prefs in a given category */ ctrl_CustomButton : CompRollOver , /* Custom button (for instance, used to launch color selector window */ ctrl_CheckButton : CompCheck , /* Check Button used when setting Boolean values */ ctrl_CustomCombo : CompCombo , /* Combo bar to display ini variable combo type */ m_listCategoryNames : [S r1] , /* Stores the variables names of categories */ m_listPrefNames : [S r1] , /* Stores the variables names of preferences */ m_IsColorSelectorWindowOpened : I /* Set to 1 when opened */ ] mkSCSPrefInfo ;; fun SCSPREF_GetINIVarType(sKey) = /* Retrieves the env variable type from the ini scs file */ /* returns type string by default */ { let PARAMS_GetS SCSparameters (strcat sKey "_TYPE") -> type in if (strcmpi type SCSPREF_TYPE_INTEGER) == 0 then SCSPREF_TYPE_INTEGER else if (strcmpi type SCSPREF_TYPE_BOOLEAN) == 0 then SCSPREF_TYPE_BOOLEAN else if (strcmpi type SCSPREF_TYPE_COLOR) == 0 then SCSPREF_TYPE_COLOR else if (strcmpi type SCSPREF_TYPE_COMBO) == 0 then SCSPREF_TYPE_COMBO else SCSPREF_TYPE_STRING ; } ;; fun SCSPREF_SetNewValueEditBoxText(SCSPrefInfo, txt) = /* Set to refresh the edit box value */ { if SCSPrefInfo.ctrl_EditBox1 == nil then nil else { _SETcompText SCSPrefInfo.ctrl_EditBox1 txt scsgui.SCSGUIsmallFont nil CT_BEGIN ; _PAINTcontainer SCSPrefInfo.ctrl_Container ; 0 } ; } ;; fun SCSPREF_AddToCategoryNamesList(SCSPrefInfo, sname) = /* Adds an entry to the category list control */ { set SCSPrefInfo.m_listCategoryNames = listcat SCSPrefInfo.m_listCategoryNames sname ; } ;; fun SCSPREF_AddToPrefNamesList(SCSPrefInfo, sname) = /* Adds an entry to the pref list control */ { set SCSPrefInfo.m_listPrefNames = listcat SCSPrefInfo.m_listPrefNames sname ; } ;; fun SCSPREF_GetVariableNameFromIndex(list,index) = /* Takes a list control index and return the related variable name in SCS INI file */ { nth_list list index ; } ;; fun SCSPREF_AddItemToList(ctrl_list, txt) = /* adds an entry to a list control */ { if ctrl_list != nil then { let (_GETcompListCount ctrl_list) -> nbelem in let (if SCSPREF_LISTNBITEMSVISIBLE pos in { _ADDcompList ctrl_list nbelem [txt nil] ; _SETcompListFirst ctrl_list pos ; } ; _PAINTobjNode _CONVERTcompListToObjNode ctrl_list ; 0 ; } else 0 ; } ;; fun SCSPREF_AddItemToCombo(combo, txt) = /* Adds an entry to a combo control */ { if combo != nil then { let (_GETcompComboCount combo) -> nbelem in { /*_SETalphaBitmapTransparency bmp scsgui.SCSGUItransparencyColor ;*/ _ADDcompCombo combo nbelem [txt /*bmp*/nil] ; } ; _PAINTobjNode _CONVERTcompComboToObjNode combo ; 0 ; } else 0 ; } ;; fun SCSPREF_OnSetNewValue(ctrl_text, SCSPrefInfo, typevalidation, ctrlValue) = /* called for validation as soon as a change occured in the new value edit box */ { let _GETcompListClicked SCSPrefInfo.ctrl_PreferenceList -> [index [txt _]] in let (SCSPREF_GetVariableNameFromIndex SCSPrefInfo.m_listPrefNames index) -> varname in let SCSPREF_GetINIVarType varname -> type in let 0 -> bMustUpdate in { /* type checking : Integer */ if type == SCSPREF_TYPE_INTEGER then { let PARAMS_GetI SCSparameters varname -> oldvalue in if oldvalue != (atoi ctrlValue) then { set bMustUpdate = 1 ; PARAMS_SetI SCSparameters varname atoi ctrlValue ; } else nil ; } else /* type checking : Color */ if type == SCSPREF_TYPE_COLOR then { let PARAMS_GetI SCSparameters varname -> oldvalue in if oldvalue != (colorHTMLtoSCOL ctrlValue) then { set bMustUpdate = 1 ; PARAMS_SetI SCSparameters varname colorHTMLtoSCOL ctrlValue ; } else nil ; } else /* type checking : String */ if type == SCSPREF_TYPE_STRING then { let PARAMS_GetS SCSparameters varname -> oldvalue in if (strcmpi oldvalue ctrlValue) != 0 then { set bMustUpdate = 1 ; PARAMS_SetS SCSparameters varname ctrlValue } else nil ; } else /* type checking : Boolean */ if type == SCSPREF_TYPE_BOOLEAN then { let PARAMS_GetI SCSparameters varname -> oldvalue in if oldvalue != (atoi ctrlValue) then { set bMustUpdate = 1 ; PARAMS_SetI SCSparameters varname atoi ctrlValue ; } else nil ; } else /* type checking : Combo */ if type == SCSPREF_TYPE_COMBO then { let PARAMS_GetS SCSparameters varname -> oldvalue in if (strcmpi oldvalue ctrlValue) != 0 then { set bMustUpdate = 1 ; PARAMS_SetS SCSparameters varname ctrlValue ; } else nil ; } else 0 ; if bMustUpdate then { /* time consuming process */ SCSGUI_OpenLoadingDialogBox (_locSCS "popupscspref-REFRESHINGSITE" nil); SCSPREF_FlushCurrentSite; SCSGUI_CloseLoadingDialogBox; UTILSGUI_UnClick SCSPrefInfo.ctrl_Container nil nil nil nil nil ; } else nil ; } } ;; fun SCSPREF_OnColorSelected(colorcode,param) = /* Callback of color selection */ { let param -> [SCSPrefInfo origColorCode] in { if (colorcode == 0 || colorcode == nil) then { SCSPREF_SetNewValueEditBoxText SCSPrefInfo colorSCOLtoHTML origColorCode ; SCSPREF_OnSetNewValue SCSPrefInfo.ctrl_EditBox1 SCSPrefInfo CT_VALIDCLICK colorSCOLtoHTML origColorCode ; 0 } else { SCSPREF_SetNewValueEditBoxText SCSPrefInfo colorSCOLtoHTML colorcode ; SCSPREF_OnSetNewValue SCSPrefInfo.ctrl_EditBox1 SCSPrefInfo CT_VALIDCLICK colorSCOLtoHTML colorcode ; 0 } ; set SCSPrefInfo.m_IsColorSelectorWindowOpened = 0 ; } ; 0 } ;; fun SCSPREF_OnBooleanCheckButtonStateChanged(check, SCSPrefInfo, state) = /* Callback of check button control */ { let _GETcompListClicked SCSPrefInfo.ctrl_PreferenceList -> [index [txt _]] in let (SCSPREF_GetVariableNameFromIndex SCSPrefInfo.m_listPrefNames index) -> varname in let SCSPREF_GetINIVarType varname -> type in { PARAMS_SetI SCSparameters varname state ; SCSPREF_FlushCurrentSite; /* _PAINTcontainer SCSPrefInfo.ctrl_Container ;*/ } } ;; fun SCSPREF_OnColorButtonClicked(button, param, posx, posy, buttontype, mask) = /* Use this function as a button callback to open a color code selector window */ /* param must be of this form : [SCSPrefInfo title origColorCode] */ /* title is the window title origColorCode is the color code initially selected */ { let param -> [SCSPrefInfo title _] in let colorHTMLtoSCOL (_GETcompText SCSPrefInfo.ctrl_EditBox1) -> origColorCode in if buttontype == LBUTTON && !SCSPrefInfo.m_IsColorSelectorWindowOpened then { _CRcolorMapFromCont SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container 100 100 title mknode @SCSPREF_OnColorSelected [SCSPrefInfo origColorCode] origColorCode ; set SCSPrefInfo.m_IsColorSelectorWindowOpened = 1 ; 0 } else 0 ; } ;; fun SCSPREF_OnCustomComboClicked(combo, param, index) = /* callback category combo control */ { let param -> [sKey SCSPrefInfo] in let _GETcompComboClicked combo -> [_ [sValue _]] in { PARAMS_SetS SCSparameters sKey sValue ; SCSPREF_FlushCurrentSite; } ; } ;; fun SCSPREF_DisablePrefModification(SCSPrefInfo) = /* Called to hide modification controls */ { /* Disables CompText "Set New Value" */ if SCSPrefInfo.ctrl_Label3 != nil then { GRAPHICDRESSING_DScompText SCSPrefInfo.ctrl_Label3 ; set SCSPrefInfo.ctrl_Label3 = nil ; 0 } else 0 ; /* Disables related edit box */ if SCSPrefInfo.ctrl_EditBox1 != nil then { GRAPHICDRESSING_DScompText SCSPrefInfo.ctrl_EditBox1 ; set SCSPrefInfo.ctrl_EditBox1 = nil ; 0 } else 0 ; /* Disables custom button */ if SCSPrefInfo.ctrl_CustomButton != nil then { GRAPHICDRESSING_DScompRollOver SCSPrefInfo.ctrl_CustomButton ; set SCSPrefInfo.ctrl_CustomButton = nil ; 0 } else 0; /* Disables check button */ if SCSPrefInfo.ctrl_CheckButton != nil then { GRAPHICDRESSING_DScompCheck SCSPrefInfo.ctrl_CheckButton ; set SCSPrefInfo.ctrl_CheckButton = nil ; 0 } else 0; /* Disables combo */ if SCSPrefInfo.ctrl_CustomCombo != nil then { GRAPHICDRESSING_DScompCombo SCSPrefInfo.ctrl_CustomCombo ; set SCSPrefInfo.ctrl_CustomCombo = nil ; 0 } else 0; _PAINTcontainer SCSPrefInfo.ctrl_Container ; } ;; fun SCSPREF_FillCustomCombo(combo, TxtList) = /* Given a list of strings, fill a combo control */ { if TxtList == nil then nil else let TxtList -> [txt L2] in { SCSPREF_AddItemToCombo combo txt ; SCSPREF_FillCustomCombo combo L2 ; 0 }; } ;; fun SCSPREF_EnablePrefModification(SCSPrefInfo,type,sparam) = /* called to create modification controls related to variable type and value */ { let sparam -> [txt param] in let _GETcontainerPositionSize SCSPrefInfo.ctrl_Container -> [_ _ wcont hcont] in let hcont-80 -> ypos in if (strcmpi type SCSPREF_TYPE_INTEGER) == 0 then { /* Must build an interface allowing INTEGER modification */ set SCSPrefInfo.ctrl_Label3 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label3 (_locSCS "popupscspref-SETNEWVALUE_INTEGER" nil) [10 ypos+5] [wcont-30-60 30] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX|OBJ_MW_FLEX ; set SCSPrefInfo.ctrl_EditBox1 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_TEXT SCSPrefInfo.ctrl_EditBox1 param [wcont-30-70 ypos] [60 20] @SCSPREF_OnSetNewValue SCSPrefInfo OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_EDITLINE|OBJ_LH_FLEX|OBJ_LW_FLEX ; _SETcompTextAuthorizedChar SCSPrefInfo.ctrl_EditBox1 "0123456789" ; 0 } else if (strcmpi type SCSPREF_TYPE_COLOR) == 0 then { /* Must build an interface allowing COLOR modification */ set SCSPrefInfo.ctrl_Label3 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label3 (_locSCS "popupscspref-SETNEWVALUE_COLOR" nil) [10 ypos+5] [wcont-30-80 16] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX|OBJ_MW_FLEX ; set SCSPrefInfo.ctrl_EditBox1 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_EditBox1 colorSCOLtoHTML atoi param [wcont-30-80 ypos] [60 20] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX|OBJ_LW_FLEX ; set SCSPrefInfo.ctrl_CustomButton = GRAPHICDRESSING_CRcompRollOver SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container nil [wcont-30-80+5+60+5 ypos] OBJ_VISIBLE|OBJ_ENABLE|OBJ_LH_FLEX|OBJ_LW_FLEX OBJ_CONTAINER_MOVE|OBJ_KEYBOARD ; _CBcompRollOverClick SCSPrefInfo.ctrl_CustomButton @SCSPREF_OnColorButtonClicked [SCSPrefInfo _locSCS "popupscspref-COLORMAP" nil colorSCOLtoHTML atoi param] ; 0 } else if (strcmpi type SCSPREF_TYPE_STRING) == 0 then { /* Must build an interface allowing STRING modification */ set SCSPrefInfo.ctrl_Label3 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label3 (_locSCS "popupscspref-SETNEWVALUE_STRING" nil) [10 ypos+5] [wcont/2 20] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX; set SCSPrefInfo.ctrl_EditBox1 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_TEXT SCSPrefInfo.ctrl_EditBox1 param [wcont/2-5 ypos] [wcont/2-30 20] @SCSPREF_OnSetNewValue SCSPrefInfo OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_EDITLINE|OBJ_LH_FLEX|OBJ_MW_FLEX ; 0 } else if (strcmpi type SCSPREF_TYPE_COMBO) == 0 then { /* Must build an interface allowing COMBO option choice */ set SCSPrefInfo.ctrl_Label3 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label3 (_locSCS "popupscspref-SETNEWVALUE_STRING" nil) [10 ypos+5] [80 20] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX; set SCSPrefInfo.ctrl_CustomCombo = GRAPHICDRESSING_CRcompCombo SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container nil [90 ypos] OBJ_ENABLE|OBJ_VISIBLE|OBJ_LH_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_UNCLICK|OBJ_KEYBOARD|OBJ_CONTAINER_MOVE wcont-20-105 100 scsgui.SCSGUIfont [GD_COMBO_TEXT_COLOR nil 0 0] [GD_COMBO_HIGHLIGHT_COLOR 50] 10 ; SCSPREF_FillCustomCombo SCSPrefInfo.ctrl_CustomCombo PARAMS_GetLS SCSparameters strcat txt "_OPTIONS" ; _SSETcompComboClicked SCSPrefInfo.ctrl_CustomCombo param ; _CBcompComboClick SCSPrefInfo.ctrl_CustomCombo @SCSPREF_OnCustomComboClicked [txt SCSPrefInfo] ; 0 } else if (strcmpi type SCSPREF_TYPE_BOOLEAN) == 0 then { /* Must build an interface allowing BOOLEAN modification */ { set SCSPrefInfo.ctrl_Label3 = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label3 txt [10 ypos+5] [wcont-80 30] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_LH_FLEX|OBJ_MW_FLEX ; set SCSPrefInfo.ctrl_EditBox1 = nil ; set SCSPrefInfo.ctrl_CheckButton = GRAPHICDRESSING_CRcompCheck SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container nil [wcont-75 ypos] OBJ_VISIBLE|OBJ_ENABLE|OBJ_LH_FLEX|OBJ_LW_FLEX OBJ_CONTAINER_MOVE|OBJ_KEYBOARD ; _SETcompCheckState SCSPrefInfo.ctrl_CheckButton (if atoi param then CHK_CHECKED else CHK_UNCHECKED) ; _CBcompCheckStateChanged SCSPrefInfo.ctrl_CheckButton @SCSPREF_OnBooleanCheckButtonStateChanged SCSPrefInfo ; } ; 0 } else 0 ; } ;; fun SCSPREF_OnCategoryComboDblClick(combo, SCSPrefInfo, index) = /* Callback combo double click */ { 0 } ;; fun SCSPREF_SetDetailedDescriptionMessage(SCSPrefInfo, txt) = /* Updates description text control */ { if SCSPrefInfo.ctrl_LabelPrefDesc == nil then nil else { _SETcompText SCSPrefInfo.ctrl_LabelPrefDesc txt scsgui.SCSGUIsmallFont nil CT_BEGIN ; _PAINTcontainer SCSPrefInfo.ctrl_Container ; 0 } ; } ;; fun SCSPREF_GetUserFriendlySCSParameterTitle(sKey) = /* Given a variable name in SCS INI file, gives its user friendly text label */ { _locSCS (strcat "LOC_USERTITLE_" sKey) nil ; } ;; fun SCSPREF_FillList(SCSPrefInfo, TxtList) = /* Given a list of strings, fill a list control */ { if TxtList == nil then nil else let TxtList -> [ txt L2] in { SCSPREF_AddToPrefNamesList SCSPrefInfo txt::nil ; SCSPREF_AddItemToList SCSPrefInfo.ctrl_PreferenceList (SCSPREF_GetUserFriendlySCSParameterTitle txt) ; SCSPREF_FillList SCSPrefInfo L2 ; 0 }; } ;; fun SCSPREF_FillCombo(SCSPrefInfo, TxtList) = /* Given a list of strings, fill a combo control */ { if TxtList == nil then nil else let TxtList -> [txt L2] in { SCSPREF_AddToCategoryNamesList SCSPrefInfo txt::nil ; SCSPREF_AddItemToCombo SCSPrefInfo.ctrl_CategoryCombo SCSPREF_GetUserFriendlySCSParameterTitle txt ; SCSPREF_FillCombo SCSPrefInfo L2 ; 0 }; } ;; fun SCSPREF_FillListFromINIFile(SCSPrefInfo, sKey) = /* Parse the SCS INI File */ /* Gets the pref list */ { _RSTcompList SCSPrefInfo.ctrl_PreferenceList ; set SCSPrefInfo.m_listPrefNames = nil ; let PARAMS_GetLS SCSparameters sKey -> L in SCSPREF_FillList SCSPrefInfo L ; } ;; fun SCSPREF_FillComboFromINIFile(SCSPrefInfo, sKey) = /* Parse the INI file */ /* Gets the categories list */ { _RSTcompCombo SCSPrefInfo.ctrl_CategoryCombo ; set SCSPrefInfo.m_listCategoryNames = nil ; let PARAMS_GetLS SCSparameters sKey -> L in SCSPREF_FillCombo SCSPrefInfo L ; } ;; fun SCSPREF_UpdateDescriptionMessage(txt, SCSPrefInfo) = /* Update description text control using locale info */ { SCSPREF_SetDetailedDescriptionMessage SCSPrefInfo (_locSCS (strcat "LOC_COMMENT_" txt) nil) ; } ;; fun SCSPREF_OnCategoryComboClick(combo, SCSPrefInfo, index) = /* callback category combo control */ { let SCSPREF_GetVariableNameFromIndex SCSPrefInfo.m_listCategoryNames index -> txt in { SCSPREF_DisablePrefModification SCSPrefInfo ; SCSPREF_UpdateDescriptionMessage txt SCSPrefInfo ; SCSPREF_FillListFromINIFile SCSPrefInfo txt ; } ; } ;; fun SCSPREF_OnPreferenceCompListClick(ctrl_complist, SCSPrefInfo, index) = /* Callback of pref list control */ { let SCSPREF_GetVariableNameFromIndex SCSPrefInfo.m_listPrefNames index -> txt in let PARAMS_GetS SCSparameters txt -> value in { SCSPREF_DisablePrefModification SCSPrefInfo ; let SCSPREF_GetINIVarType txt -> type in if type == SCSPREF_TYPE_BOOLEAN then SCSPREF_EnablePrefModification SCSPrefInfo type [(SCSPREF_GetUserFriendlySCSParameterTitle txt) value] else if type == SCSPREF_TYPE_COMBO then SCSPREF_EnablePrefModification SCSPrefInfo type [txt value] else SCSPREF_EnablePrefModification SCSPrefInfo type [nil value] ; SCSPREF_UpdateDescriptionMessage txt SCSPrefInfo ; } ; } ;; fun SCSPREF_OnPreferenceCompListDblClick(ctrl_complist, SCSPrefInfo, index) = { 0; } ;; fun SCSPREF_RefreshSCSPrefWindow(SCSPrefInfo) = /* Creates or redraws scs prefs configuration popup child window*/ { /* window controls creation */ let _GETcontainerPositionSize SCSPrefInfo.ctrl_Container -> [_ _ wcont hcont] in let hcont-50 -> ypos in let GD_COMPLIST_HIGHLIGHT_TRANSPARENCY -> colortransp in let GD_COMPLIST_TEXT_COLOR -> txtcolor in let GD_COMPLIST_HIGHLIGHT_COLOR -> highlightcolor in { /* Builds Preference list frame */ set SCSPrefInfo.ctrl_Label2 = UTILSGUI_SetOrCreateText SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label2 (_locSCS "popupscspref-PREFFRAMETITLE" nil) [10 80] [wcont-30 16] nil nil ; if SCSPrefInfo.ctrl_PreferenceList == nil then { set SCSPrefInfo.ctrl_PreferenceList = GRAPHICDRESSING_CRcompList SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container nil [10 95] OBJ_ENABLE|OBJ_VISIBLE|LST_LEFT|LST_HIGHLIGHT_CLICKED|OBJ_MH_FLEX|OBJ_MW_FLEX OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD wcont-20 120 SCSPREF_LISTNBITEMSVISIBLE LST_VERTICAL scsgui.SCSGUIfont 10 [txtcolor 0 0 0] [highlightcolor colortransp] ; _CBcompListClick SCSPrefInfo.ctrl_PreferenceList @SCSPREF_OnPreferenceCompListClick SCSPrefInfo ; _CBcompListDblClick SCSPrefInfo.ctrl_PreferenceList @SCSPREF_OnPreferenceCompListDblClick SCSPrefInfo; 0; } else 1 ; /* builds description comptext */ set SCSPrefInfo.ctrl_LabelPrefDesc = UTILSGUI_SetOrCreateTextEx SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_LabelPrefDesc (_locSCS "popupscspref-DESCWELCOMEMESSAGE" nil) [10 ypos] [wcont-20 50] nil nil OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|OBJ_MW_FLEX|OBJ_LH_FLEX ; /* Builds Category Combo frame */ /* Must be the last one to be built */ set SCSPrefInfo.ctrl_Label1 = UTILSGUI_SetOrCreateText SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container GUI_LABEL SCSPrefInfo.ctrl_Label1 (_locSCS "popupscspref-CATFRAMETITLE" nil) [10 35] [wcont-30 20] nil nil ; if SCSPrefInfo.ctrl_CategoryCombo == nil then ( set SCSPrefInfo.ctrl_CategoryCombo = GRAPHICDRESSING_CRcompCombo SCSPrefInfo.m_Channel SCSPrefInfo.ctrl_Container nil [10 50] OBJ_ENABLE|OBJ_VISIBLE|OBJ_MW_FLEX OBJ_CONTAINER_UNCLICK|OBJ_CONTAINER_MOVE|OBJ_KEYBOARD wcont-20 104 scsgui.SCSGUIfont [GD_COMBO_TEXT_COLOR nil 0 0] [GD_COMBO_HIGHLIGHT_COLOR 50] 20 ; _CBcompComboClick SCSPrefInfo.ctrl_CategoryCombo @SCSPREF_OnCategoryComboClick SCSPrefInfo ; /* Gets the categories list */ SCSPREF_FillComboFromINIFile SCSPrefInfo "CATEGORIES" ; _SETcompComboClicked SCSPrefInfo.ctrl_CategoryCombo 0 ; SCSPREF_OnCategoryComboClick SCSPrefInfo.ctrl_CategoryCombo SCSPrefInfo 0 ; 0 ) else 0; _PAINTcontainer SCSPrefInfo.ctrl_Container ; } ; } ;; fun SCSPREF_HideAllControls (cont) = { 0; };; fun SCSPREF_OnContainerKeyDown(cont, SCSPrefInfo, scancode, asciicode) = { if (KEYBOARD_IsKey scancode KEYCODE_DELETE) && KEYBOARD_IsCTRLKeyDown then { /* DELETE Key pressed */ /* _showconsole ; _fooS "DELETE detected in popup window SCS Preferences !" ; */ 0 } else (KEYBOARD_ProcessKeyDownCode scancode asciicode ; 0) /* Needed to process other key codes */ } ;; /* fonctions generiques aux fenetres pop-up */ fun SCSPREF_OnPreDestroy (cont) = { let _GETcontainerPositionSize cont -> [popx popy popw poph] in { PARAMS_SetI SCSparameters "POPUP_SCSPREF_POSITION_X" popx ; PARAMS_SetI SCSparameters "POPUP_SCSPREF_POSITION_Y" popy ; PARAMS_SetI SCSparameters "POPUP_SCSPREF_WIDTH" popw ; PARAMS_SetI SCSparameters "POPUP_SCSPREF_HEIGHT" poph ; } ; 1 ; } ;; fun POPUPWIN_SetSCSPrefCallbacks (cont, param, SCSPrefInfo ) = { /* Example of Keyboard interception */ _CBcontainerKeyDown cont @SCSPREF_OnContainerKeyDown SCSPrefInfo ; POPUPWIN_CBpopupPreDestroy @SCSPREF_OnPreDestroy cont ; } ;; fun POPUPWIN_CreateSCSPref (Channel, win, code) = /* Main function called to create popup window */ { let PARAMS_GetI SCSparameters "POPUP_SCSPREF_POSITION_X" -> popx in let PARAMS_GetI SCSparameters "POPUP_SCSPREF_POSITION_Y" -> popy in let PARAMS_GetI SCSparameters "POPUP_SCSPREF_MIN_WIDTH" -> popminw in let PARAMS_GetI SCSparameters "POPUP_SCSPREF_MIN_HEIGHT" -> popminh in let PARAMS_GetI SCSparameters "POPUP_SCSPREF_WIDTH" -> popw in let PARAMS_GetI SCSparameters "POPUP_SCSPREF_HEIGHT" -> poph in let POPUPWIN_CreatePopupWindow Channel win if (popx != nil) then popx else 100 if (popy != nil) then popy else 50 if (popminw != nil) then popminw else 200 if (popminh != nil) then popminh else 350 (_locSCS "popupscspref-TITLE" nil) code nil nil -> cont in let mkSCSPrefInfo [Channel cont nil nil nil nil nil nil nil nil nil nil nil nil nil 0] -> SCSPrefInfo in { /* Sets callbacks */ POPUPWIN_SetSCSPrefCallbacks cont code SCSPrefInfo ; /* Displays the window */ SCSPREF_RefreshSCSPrefWindow SCSPrefInfo ; /* reset previously saved width & height parameters */ if popw != nil then _SIZEEXcontainer cont popx popy popw poph else nil; [cont (_locSCS "popupscspref-TITLE" nil)] ; } ; } ;;