Use Windows.pkg Use Dfspnfrm.pkg Use cRegistry.pkg Use vWin32fh.pkg Use cButtonDPI.pkg #IFNDEF cx_RegKeyAlreadyExist Enum_List Define cx_RegKeyAlreadyExist Define cx_RegKeyCreated Define cx_RegkeyFailed Define cx_RegKeyVDFKeyDoesNotExist Define CX_InstalledOkVdfUnder16 End_Enum_List #ENDIF // Note: The "Visual" part will automatically be removed if // the current DataFlex version is above 17. Define CS_StudioPath for "Software\Data Access Worldwide\Visual DataFlex Tools\" Define CS_StudioTools for "\Studio\Tools" Define CS_RegWorkspace for "" Define CS_RegApplication for "" Define CS_RegProject for "" Define CS_RegFileName for "" Define CS_CommandLine for "CommandLine" Define CS_Name for "Name" Define CS_Separator for "Separator" Define CS_Command for "Command" Define CS_CleanMarkersFlag for "/c" Define CS_CleanMarkers for "(Cleanup Source Code)" Define CS_CodeIndentFlag for "/i" Define CS_CodeIndent for "(Code Indent)" #IFNDEF CS_Settings Define CS_Settings for "Settings" #ENDIF #IFNDEF CS_StarZenSourceExplorer Define CS_StarZenSourceExplorer for "StarZenSourceExplorer" #ENDIF #IFNDEF CS_FileCompareProgram Define CS_FileCompareProgram for "FileCompareProgram" #ENDIF Object oProgramSetup_dg is a ModalPanel Set Size to 270 330 Set Label to "DataFlex Source Code Tools Setup" Set piMinSize to 79 211 Set Location to 5 4 Set Locate_Mode to Center_On_Parent Object oStudioIntegration_grp is a Group Set Size to 55 299 Set Location to 8 15 Set Label to "Cleanup Source - DataFlex Studio Integration" Object oStudioMajorVersion_sf is a SpinForm Set Size to 12 27 Set Location to 18 168 Set Maximum_Position to 30 Set Minimum_Position to 14 Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set Label to "Add to Studio's Tools Menu: Major Version" Set Status_Help to "DataFlex main version - e.g. '18'" Set Value to FMAC_VERSION Set peAnchors to anNone End_Object Object oStudioMinorVersion_sf is a SpinForm Set Size to 12 27 Set Location to 18 254 Set Label_Col_Offset to 2 Set Label to "Minor Version" Set Status_Help to "DataFlex minor version - e.g. '0'" Set Maximum_Position to 9 Set Minimum_Position to 0 Set Value to FMAC_REVISION Set Label_Justification_Mode to JMode_Right Set peAnchors to anNone End_Object Object oOK_btn is a cButtonDPI Set Location to 35 209 Set Size to 12 72 Set Label to "Add to Studio..." Set Status_Help to "Add to DataFlex Studios 'Tools' menu. The Studio version can be selected with the two spinforms. The COMManifestStudio program gets added to the Studios Tools menu. When selected from the Studio it will pass the current project name on the command line so that the current program's manifest file is automatically loaded by the COMManifestStudio program." Set psImage to "ActionAdd.ico" Set piImageMarginLeft to 8 Set peAnchors to anTopRight Procedure OnClick Integer iRetval iMajorVersion iMinorVersion String sText sStudioVersion Set pbCodeIndent of ghoApplication to False Get Value of oStudioMajorVersion_sf to iMajorVersion Get Value of oStudioMinorVersion_sf to iMinorVersion Move (String(iMajorVersion) + "." + String(iMinorVersion)) to sStudioVersion Get AddProgramToStudioToolsMenu sStudioVersion to iRetval Case Begin Case (iRetval = cx_RegKeyAlreadyExist) Move ("The program already exists in the" * sStudioVersion * "DataFlex Studios Tools menu.") to sText Break Case (iRetval = cx_RegKeyCreated) Move ("Success. The tool was added to the" * sStudioVersion * "DataFlex Studios Tools menu.") to sText Break Case (iRetval = cx_RegkeyFailed) Move "Failed. Could not create the registry key for adding the program to the DataFlex Studio's Tools menu." to sText Break Case (iRetval = cx_RegKeyVDFKeyDoesNotExist) Move ("Could not find the Studio registry key. Is DataFlex Studio version" * sStudioVersion * "really installed on this machine?") to sText Break Case (iRetval = CX_InstalledOkVdfUnder16) Move ("The program was added to the" * sStudioVersion * "Studios Tools menu successfully, but because you installed for an earlier version of the Studio than 16.0 you need to compile the program under that same VDF version, else the Studio can't start the program properly. (Sorry, just a 'feature' of earlier versions of the Studio)") to sText Break Case End Send Info_Box sText End_Procedure End_Object End_Object Object oCodeIndentStudioIntegration_grp is a Group Set Size to 55 299 Set Location to 70 15 Set Label to "Code Indent - DataFlex Studio Integration" Object oStudioMajorVersion_sf is a SpinForm Set Size to 12 27 Set Location to 18 168 Set Maximum_Position to 30 Set Minimum_Position to 14 Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set Label to "Add to Studio's Tools Menu: Major Version" Set Status_Help to "DataFlex main version - e.g. '18'" Set Value to FMAC_VERSION Set peAnchors to anNone End_Object Object oStudioMinorVersion_sf is a SpinForm Set Size to 12 27 Set Location to 18 254 Set Label_Col_Offset to 2 Set Label to "Minor Version" Set Status_Help to "DataFlex minor version - e.g. '0'" Set Maximum_Position to 9 Set Minimum_Position to 0 Set Value to FMAC_REVISION Set Label_Justification_Mode to JMode_Right Set peAnchors to anNone End_Object Object oOK_btn is a cButtonDPI Set Location to 35 209 Set Size to 12 72 Set Label to "Add to Studio..." Set Status_Help to "Add to DataFlex Studios 'Tools' menu. The Studio version can be selected with the two spinforms. The COMManifestStudio program gets added to the Studios Tools menu. When selected from the Studio it will pass the current project name on the command line so that the current program's manifest file is automatically loaded by the COMManifestStudio program." Set psImage to "ActionAdd.ico" Set piImageMarginLeft to 8 Set peAnchors to anTopRight Procedure OnClick Integer iRetval iMajorVersion iMinorVersion String sText sStudioVersion Set pbCodeIndent of ghoApplication to True Get Value of oStudioMajorVersion_sf to iMajorVersion Get Value of oStudioMinorVersion_sf to iMinorVersion Move (String(iMajorVersion) + "." + String(iMinorVersion)) to sStudioVersion Get AddProgramToStudioToolsMenu sStudioVersion to iRetval Case Begin Case (iRetval = cx_RegKeyAlreadyExist) Move ("The program already exists in the" * sStudioVersion * "DataFlex Studios Tools menu.") to sText Break Case (iRetval = cx_RegKeyCreated) Move ("Success. The tool was added to the" * sStudioVersion * "DataFlex Studios Tools menu.") to sText Break Case (iRetval = cx_RegkeyFailed) Move "Failed. Could not create the registry key for adding the program to the DataFlex Studio's Tools menu." to sText Break Case (iRetval = cx_RegKeyVDFKeyDoesNotExist) Move ("Could not find the Studio registry key. Is DataFlex Studio version" * sStudioVersion * "really installed on this machine?") to sText Break Case (iRetval = CX_InstalledOkVdfUnder16) Move ("The program was added to the" * sStudioVersion * "Studios Tools menu successfully, but because you installed for an earlier version of the Studio than 16.0 you need to compile the program under that same VDF version, else the Studio can't start the program properly. (Sorry, just a 'feature' of earlier versions of the Studio)") to sText Break Case End Send Info_Box sText End_Procedure End_Object End_Object Function AddProgramToStudioToolsMenu String sStudioVersion Returns Integer Boolean bOk bExists bOpen bCodeIndent String sKey sValue sProgramPath sProgram sProduct sProductComment sStudioPath sParam sTag sCommandLine Handle hoReg hoArray Integer i iItems iCreated iRetval Move False to bOk Get pbCodeIndent of ghoApplication to bCodeIndent If (bCodeIndent = True) Begin Move (CS_RegFileName * CS_RegWorkspace) to sTag Move CS_CodeIndentFlag to sParam Move CS_CodeIndent to sProductComment End Else Begin Move (CS_RegFileName * CS_RegWorkspace) to sTag Move CS_CleanMarkersFlag to sParam Move CS_CleanMarkers to sProductComment End Move (CS_StudioPath + (Trim(sStudioVersion))) to sStudioPath If (sStudioVersion > "17.1") Begin Move (Replace("Visual ", sStudioPath, "")) to sStudioPath End Get psProgramPath of (phoWorkspace(ghoApplication)) to sProgramPath Get PathAtIndex of (phoWorkspace(ghoApplication)) sProgramPath 1 to sProgramPath Get vFolderFormat sProgramPath to sProgramPath Get psProduct of (phoWorkspace(ghoApplication)) to sProduct Move (sProduct * sProductComment) to sProduct Get Module_Name to sProgram Get Create (RefClass(cRegistry)) to hoReg Set phRootKey of hoReg to HKEY_CURRENT_USER // First check if the DataFlex version is installed Get KeyExists of hoReg sStudioPath to bExists If (bExists = False) Begin Send Destroy of hoReg Function_Return cx_RegKeyVDFKeyDoesNotExist End // Then check if any tools have been installed in the Tools Menu. // If no tools created yet, create the Tools registry key. Move (sStudioPath + CS_StudioTools) to sStudioPath Get KeyExists of hoReg sStudioPath to bExists If (bExists = False) Begin Set pfAccessRights of hoReg to KEY_ALL_ACCESS Get CreateKey of hoReg sStudioPath to iCreated If (iCreated <> 0) Begin Move cx_RegkeyFailed to iRetval End Else Begin Move True to bExists End End If (bExists = True) Begin Get OpenKey of hoReg sStudioPath to bOk If (bOk = True) Begin Get Create (RefClass(Array)) to hoArray Get GetSubkeys of hoReg hoArray to iItems Decrement iItems Move False to bExists Set pfAccessRights of hoReg to KEY_READ // Check if the key already exists: For i from 0 to iItems Get Value of hoArray i to sKey Move (sStudioPath + "\" + sKey) to sKey Get OpenKey of hoReg sKey to bOpen If (bOpen = True) Begin Get ReadString of hoReg CS_Name to sValue Get ReadString of hoReg CS_CommandLine to sCommandLine If (Uppercase(sValue) = Uppercase(sProduct) and Uppercase(sCommandLine) = Uppercase(sTag * String(sParam))) Begin Move True to bExists End End Loop Send Destroy of hoArray If (bExists = False) Begin Set pfAccessRights of hoReg to KEY_ALL_ACCESS // We need to create the next key number: // The studio expect tools menu items to be numbered 1,2,3...n Increment iItems Increment iItems Get CreateKey of hoReg (sStudioPath + "\" + String(iItems)) to iCreated If (iCreated = 0) Begin Send WriteString of hoReg CS_Name sProduct // From DataFlex 16 and up the params for the Studio's Tools menu changed slightly: If (sStudioVersion >= "16.0") Begin Send WriteString of hoReg CS_Command (sProgramPath + sProgram) Send WriteString of hoReg CS_CommandLine (sTag * String(sParam)) End Else Begin Send WriteString of hoReg CS_CommandLine ('"' + sProgramPath + sProgram + ".exe" + '"' * (sTag * String(sParam))) Move CX_InstalledOkVdfUnder16 to iRetval End Send WriteDword of hoReg CS_Separator 1 Move cx_RegKeyCreated to iRetval End Else Begin Move cx_RegkeyFailed to iRetval End End Else Begin Move cx_RegKeyAlreadyExist to iRetval End Send CloseKey of hoReg End End Send Destroy of hoReg Function_Return iRetval End_Function Procedure Page Integer iPageObject Forward Send Page iPageObject Set Icon to "SQLConnections.ico" End_Procedure Object oCompareEditor_grp is a Group Set Size to 63 299 Set Location to 129 15 Set Label to "Compare Tool Settings" Object oExplanationText is a TextBox Set Auto_Size_State to False Set Size to 20 269 Set Location to 10 16 Set Label to "Select your preferred file comparison tool to use, such as Beyond Compare, WinMerge, Araxis merge etc.." Set Justification_Mode to JMode_Left End_Object Object oCompareprogram_fm is a Form Set Size to 13 267 Set Location to 41 16 Set Prompt_Button_Mode to pb_PromptOn Set Label_Col_Offset to 0 Set Label_Row_Offset to 1 Set Label_Justification_Mode to JMode_Top Set Label to "Enter the full 'Compare Program' path and filename, without parameters" Procedure Prompt Integer bOpen String sFileName Get Show_Dialog of oOpenDialog to bOpen If bOpen Begin Get File_Name of oOpenDialog to sFileName Set Value to sFileName End End_Procedure End_Object End_Object Object oDFSourceExplorer_grp is a Group Set Size to 46 299 Set Location to 198 15 Set Label to "DataFlex Source Explorer" Object oSourceExplorerProgram_fm is a Form Set Size to 13 267 Set Location to 21 16 Set Prompt_Button_Mode to pb_PromptOn Set Label_Row_Offset to 1 Set Label_Col_Offset to 0 Set Label_Justification_Mode to JMode_Top Set Label to "Enter the full path and file name to Starzen's 'DataFlex Source Explorer' program" Procedure Prompt Integer bOpen String sFileName Get Show_Dialog of oOpenDialog to bOpen If bOpen Begin Get File_Name of oOpenDialog to sFileName Set Value to sFileName End End_Procedure End_Object End_Object Object oCancel_Btn is a cButtonDPI Set Label to "&Close" Set Location to 250 264 Set peAnchors to anBottomRight Procedure OnClick Send Close_Panel End_Procedure End_Object Object oOpenDialog is a OpenDialog Set Dialog_Caption to "Select your file compare application of choice" Set Filter_String to "Programs|*.exe|Any file|*.*" End_Object Procedure Popup String sFile sProgram Get FileCompareApp of ghoApplication to sFile Set Value of oCompareprogram_fm to sFile Get ReadString of ghoApplication CS_Settings CS_StarZenSourceExplorer "" to sProgram Set Value of oSourceExplorerProgram_fm to sProgram Forward Send Popup End_Procedure Object oSave_Btn is a cButtonDPI Set Size to 14 50 Set Label to "Save" Set Location to 250 208 Set peAnchors to anBottomRight Set psImage to "ActionSave.ico" Procedure OnClick String sFile Get Value of oCompareprogram_fm to sFile Set FileCompareApp of ghoApplication to sFile Get Value of oSourceExplorerProgram_fm to sFile Send WriteString of ghoApplication CS_Settings CS_StarZenSourceExplorer sFile Send Info_Box "Changes saved." Send Close_Panel End_Procedure End_Object On_Key Key_Alt+Key_O Send KeyAction of oOK_Btn On_Key Key_Alt+Key_C Send KeyAction of oCancel_Btn On_Key kCancel Send KeyAction of oCancel_Btn End_Object