// Improvements made by: // Nils G. Svedmyr (support@rdctools.com) @ March, 7 2008, September 2013, September 2014. // // The code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // This is free software; you can redistribute it and/or modify it under the terms of the // GNU Lesser General Public License. // License: LGPLv3 - GNU LESSER GENERAL PUBLIC LICENSE Version 3 - http://www.gnu.org/licenses/lgpl.txt // // ToDo: Add a table for the "Maintain Classes" grid and change logic to a cDbCJGrid. // Use Windows.pkg Use DFClient.pkg Use Dfline.pkg Use cWsDbCJGrid.pkg Use cCJGridColumnRowIndicator.pkg Use DFEntry.pkg Use Dfenchk.pkg Use Dftabdlg.pkg Use File_dlg.pkg Use WinShell.pkg Use Dfspnfrm.pkg Use cRegistry.pkg Use cReadDirComboform.pkg Use cDbReadOnlyForm.pkg Use vWin32fh.pkg Use cIniFile.pkg Use cProjectIniFile.pkg Use cButton.pkg Use CodeSpy.pkg Use cGridExtraOptions.pkg Use cDbFormOrDbSuggestionForm.pkg Use Symdef.pkg // Status panel: Use CodeSpyStatus.vw Use ChangeAllSourceFilesPath.dg Use cCodeHdrDataDictionary.dd Use cCodeDtlDataDictionary.dd Use cCodeClassDataDictionary.dd Use dbSuggestionForm.pkg Register_Function CallOpenDialog Returns String[] #IFNDEF ghoCodeDtl_DD Global_Variable Integer ghoCodeDtl_DD #ENDIF Activate_View Activate_oCodeSpy_vw for oCodeSpy_vw Object oCodeSpy_vw is a dbView Set Location to 0 0 Set Size to 283 449 Set Icon to "CodeSpy2.ico" Set Border_Style to Border_Thick Set Minimize_Icon to False Set Maximize_Icon to True Set pbAutoActivate to True Set pbAcceptDropFiles to True Set Auto_Clear_DEO_State to False Set Verify_Save_Msg to (RefFunc(No_Confirmation)) Property String psSaveFile "CodeSpy.ini" Property String[] pArrayOfDroppedFiles Object oCodeHdr_DD is a cCodeHdrDataDictionary Set Allow_Foreign_New_Save_State to True End_Object Object oCodeClass_DD is a cCodeClassDataDictionary Set DDO_Server to oCodeHdr_DD Set Constrain_File to CodeHdr.File_Number End_Object Object oCodeDtl_DD is a cCodeDtlDataDictionary Move Self to ghoCodeDtl_DD Set DDO_Server to oCodeHdr_DD Set Constrain_File to CodeHdr.File_Number End_Object Set Main_DD to oCodeHdr_DD Set Server to oCodeHdr_DD Object oMultiFileCodeSpy is a cMultiFileCodeSpy End_Object Object oTabDialog Is a dbTabDialog Set Size to 267 433 Set Location to 6 9 Set Border_Style to Border_Thick Set peAnchors to anAll Set Rotate_Mode to RM_Ring On_Key Key_Alt+Key_F1 Send Request_Next_Tab Object oCreateHTML_tp is a dbTabPage Set Label To "Create HTML" // The dbSuggestionForm is new to DataFlex 18. If an earlier // version of the Studio is used; use a dbForm object instead. // We use a special subclass to make the Studio render the object correctly, // and not having the Studio's Output panel nag about "Designer cannot model..." // Object oCodeHdr_SWSFileName is a DbSuggestionForm // cDbFormOrDbSuggestionForm Entry_Item CodeHdr.SWSFileName Set Location to 10 58 Set Size to 13 303 Set Label to "SWS Filename" Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set psToolTip to "The .sws file for the workspace" Set peAnchors to anTopLeftRight Set pbFullText to True Set piStartAtChar to 1 // Note: These two properties must be in the sub-class code. // So there are drawbacks with this solution... // Set piStartAtChar to 1 // Set pbFullText to True //#IF (Required_FMAC_Version >= 18) // // Augment method to add further info to the Suggestion List. // // Note that the Forward is _after_ the augmentation. // Procedure ShowSuggestion tSuggestion SuggestionData String sSearch // Send ReadByRowId to (Server(Self)) CodeHdr.File_Number (DeserializeRowID(SuggestionData.sRowId)) // Move CodeHdr.Path to SuggestionData.aValues[1] // Forward Send ShowSuggestion SuggestionData sSearch // End_Procedure //#ENDIF // // Check if the folder is missing; in case we set the textcolor to red // Procedure OnChange // String sValue sPath // Boolean bExists // Handle hoDD // // Move (oCodeHdr_DD(Self)) to hoDD // Get Field_Current_Value of hoDD Field CodeHdr.SWSFileName to sValue // If (sValue = "") Begin // Get Value to sValue // End // // Get Field_Current_Value of hoDD Field CodeHdr.Path to sPath // If (sPath = "") Begin // Get Value of oCodeHdr_Path to sPath // End // Get vFolderFormat sPath to sPath // // Set TextColor to clWindowText // If (sValue <> "") Begin // Get vFilePathExists (sPath + sValue) to bExists // If (bExists = False) Begin // Set TextColor to clRed // End // End // End_Procedure End_Object Object oBrowse_btn is a Button Set Size to 13 50 Set Location to 10 367 Set Label to "Browse..." Set peAnchors to anTopRight Procedure OnClick String sValue sFileName sPath sTargetDir sHelpPath sWSFile sChar Integer iCh iPos Handle hoIni Get vSelect_File "Visual DataFlex .sws Files (*.sws)|*.sws" "Select a Visual DataFlex .sws file" "" to sValue If (sValue = "") Begin Procedure_Return End Get ParseFolderName sValue to sPath Get vFolderFormat sPath to sPath Get ParseFileName sValue to sFileName Set Changed_Value of oCodeHdr_Path 0 to sPath Set Changed_Value of oCodeHdr_SWSFileName 0 to sFileName // First open the .sws file, then the .ws file and get the Help path from it Get Create (RefClass(cIniFile)) to hoIni Set psFileName of hoIni to sValue Get ReadString of hoIni CS_WorkspacePaths CS_WSFileName "" to sWSFile If (sWSFile <> "") Begin Get MakeProperPathFromShortPath sWSFile sPath to sWSFile Set psFileName of hoIni to sWSFile Get ReadString of hoIni CS_Workspace CS_HelpPath "" to sHelpPath Get MakeProperPathFromShortPath sHelpPath sPath to sHelpPath Set Changed_Value of oTarget 0 to sHelpPath End Else Begin Send Stop_Box "No Workspace file reference found in .sws file" End Send Destroy of hoIni End_Procedure End_Object Object oCodeHdr_Path is a dbForm //cDbReadOnlyForm Entry_Item CodeHdr.Path Set Location to 25 58 Set Size to 13 303 Set Label to "SWS File Path" Set peAnchors to anTopLeftRight Set Focus_Mode to Focusable Set Color to clWindow Set Enabled_State to False Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right End_Object Object oEditPath_btn is a cButton Set Size to 13 50 Set Location to 25 367 Set Label to "Enable" Set psToolTip to "Makes the path window accessable for edit." Set peAnchors to anTopRight Set pbAutoEnable to True Procedure OnClick Boolean bEnabled Get Enabled_State of oCodeHdr_Path to bEnabled Set Enabled_State of oCodeHdr_Path to (not(bEnabled)) Set Label to (If(bEnabled, "Enable", "Disable")) End_Procedure End_Object Object oTarget is a dbForm Entry_Item CodeHdr.TargetFolder Set Label to "Target Folder" Set Size to 13 359 Set Location to 40 58 Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set peAnchors to anTopLeftRight Set psToolTip to "Folder where the .html files will be generated." // Check if the folder is missing; in case we set the textcolor to red Procedure OnChange String sValue Boolean bExists Get Value to sValue Set TextColor to clWindowText If (sValue <> "") Begin Get vFilePathExists sValue to bExists If (bExists = False) Begin Set TextColor to clRed End End End_Procedure End_Object Object oCodeHdr_CreatedDateTime is a cDbReadOnlyForm Entry_Item CodeHdr.CreatedDateTime Set Location to 55 58 Set Size to 13 126 Set Label to "Created" End_Object Object oCodeHdr_CreatedBy is a cDbReadOnlyForm Entry_Item CodeHdr.CreatedBy Set Location to 55 199 Set Size to 13 218 Set Label to "By" Set peAnchors to anTopLeftRight End_Object Object oCodeHdr_ChangedDateTime is a cDbReadOnlyForm Entry_Item CodeHdr.ChangedDateTime Set Location to 70 58 Set Size to 13 126 Set Label to "Last Edited" End_Object Object oCodeHdr_ChangedBy is a cDbReadOnlyForm Entry_Item CodeHdr.ChangedBy Set Location to 70 199 Set Size to 13 218 Set Label to "By" Set peAnchors to anTopLeftRight End_Object Object oSource_grd is a cWsDbCJGrid Set Server to oCodeDtl_DD Set Size to 85 360 Set Location to 94 58 Set peAnchors to anAll Set pbHeaderPrompts to True Set pbShowFooter to True Set Verify_Delete_Msg to (RefFunc(No_Confirmation)) Set Verify_Data_Loss_Msg to (RefFunc(No_Confirmation)) Set Verify_Save_msg to (RefFunc(No_Confirmation)) Set pbStaticData to True Set pbShowRowFocus to True Set pbGrayIfDisable to False Set pbHotTracking to True Set psNoFieldsAvailableText to "No source files selected" Set psNoItemsText to "No source files selected" Set pbSelectionEnable to True Set pbEditOnTyping to False Set piFocusCellBackColor to clBtnShadow Set piAlternateRowBackgroundColor to 15263976 // Set pbUseAlternateRowBackgroundColor to True Object oCJGridColumnRowIndicator is a cCJGridColumnRowIndicator Set piWidth to 26 End_Object Object oCodeDtl_FullSourceFileName is a cDbCJGridColumn Entry_Item CodeDtl.FullSourceFileName Set piWidth to 608 Set psCaption to "Source File Name - Click header to add one or more source files. You can also drag & drop files onto the grid." Set Prompt_Button_Mode to PB_PromptOn Set psImage to "ActionPrompt.ico" Procedure Prompt String[] sRetvalsArray String sValue Integer i iRows iID iRetval Handle hoDD Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.ID to iID If (iID = 0) ; Procedure_Return Move (oCodeDtl_DD(Self)) to hoDD // Get the selection from the open dialog and add them to the grid: Get CallOpenDialog of oOpenDialog to sRetvalsArray Move (SizeOfArray(sRetvalsArray)) to iRows If (iRows = 0) ; Procedure_Return // Create new records from the returned sRetvalsArray values Decrement iRows Lock For i from 0 to iRows Send Clear of hoDD Move sRetvalsArray[i] to sValue // Due to a bug in DataFlex, multiple selected // filenames needs to be converted to OEM, so we do it here. If (iRows > 0) Begin Move (ToOEM(sValue)) to sValue End Set Field_Changed_Value of hoDD Field CodeDtl.FullSourceFileName to sValue Get Validate_Save of hoDD to iRetval If (iRetval = 0) Begin Send Request_Save of hoDD End Loop Unlock // Refresh grid from the database table's records Send RefreshDataFromExternal of (Parent(Self)) 0 Send MovetoFirstRow of (Parent(Self)) End_Procedure // Check if the file is missing; in case we set the textcolor to red Procedure OnSetDisplayMetrics Handle hoMetrics Integer iRow String ByRef sValue String sPath sComment sFileName Boolean bExists If (sValue <> "") Begin // We need to translate the filename back to ANSI for the vFilePathExists // function to work: Move (ToANSI(sValue)) to sFileName Get vFilePathExists sFileName to bExists If (bExists = False) Begin Set ComForeColor of hoMetrics to clRed End End End_Procedure // Add "Add source file(s)" & "Edit source file" to grid right-click menu. Procedure DoAddItemsToContextMenu Handle hoMenu hoMenu1 hoContextMenu Get phoContextMenu to hoContextMenu If (hoContextMenu <> 0) Begin Move hoContextMenu to hoMenu Get Create of hoMenu (RefClass(cSourcePromptMenuItem)) to hoMenu1 Set pbControlBeginGroup of hoMenu1 to True Get Create of hoMenu (RefClass(cOpenSourceFileMenuItem)) to hoMenu1 End End_Procedure Send DoAddItemsToContextMenu End_Object Procedure OnHeaderClick Integer iCol Send Prompt of oCodeDtl_FullSourceFileName End_Procedure Function SourceItems Returns String[] Integer i iItems iRetval iSourceColumn Handle hoDataSource tDataSourceRow[] TheData Boolean bChecked String sFileName String[] sSourceFilesArray Get piColumnId of oCodeDtl_FullSourceFileName to iSourceColumn Get phoDataSource to hoDataSource Get DataSource of hoDataSource to TheData Move (SizeOfArray(TheData)) to iItems Decrement iItems For i from 0 to iItems Move TheData[i].sValue[iSourceColumn] to sSourceFilesArray[i] Loop Function_Return sSourceFilesArray End_Function // When loading data, update the footer 'No of Items' text Procedure Refresh Integer eMode Forward Send Refresh eMode Send DoSetCurrentRow End_Procedure // Send by grid subclass Refresh message. Procedure DoSetCurrentRow Handle hoDataSource Integer iRows Forward Send DoSetCurrentRow Get phoDataSource to hoDataSource Get RowCount of hoDataSource to iRows Set psFooterText of oCodeDtl_FullSourceFileName to (" Number of Files:" * String(iRows)) End_Procedure Procedure ProcessDroppedFiles String[] ArrayOfDroppedFiles Integer iItems iCount iID String sFileName sSWSFileName Handle hoDD Boolean bErr Get Server to hoDD Get File_Field_Current_Value of hoDD File_Field CodeHdr.ID to iID Get File_Field_Current_Value of hoDD File_Field CodeHdr.SWSFileName to sSWSFileName If (sSWSFileName = "") Begin Send Stop_Box "You need to select a .sws file first." Procedure_Return End // If the parent record isn't created yet, try saving/creating now. If (iID = 0) Begin Send Request_Save of (Parent(Self)) If (Err) Begin Send Stop_Box "Couldn't save the new header record. Try saving the header manually, then try dropping files on the grid." Procedure_Return End End Move (SizeOfArray(ArrayOfDroppedFiles)) to iItems Decrement iItems For iCount from 0 to iItems Move ArrayOfDroppedFiles[iCount] to sFileName Send Clear of hoDD Set Field_Changed_Value of hoDD Field CodeDtl.FullSourceFileName to sFileName Get Request_Validate of hoDD to bErr If (bErr = False) Begin Move False to Err Send Request_Save of hoDD Move Err to bErr End // If error encountered, end processing of dropped files. If (bErr = True) Begin Move iItems to iCount End End If (bErr = False) Begin Send RefreshDataFromSelectedRow End Else Begin // Refind main record to avoid "Changes exists..." when exiting program. Send Request_Assign of oCodeHdr_DD Send Info_Box "An error was encountered and the file drag & drop process was cancelled." End End_Procedure Function OnPostEntering Returns Boolean Boolean bRetVal bHasRecord Handle hoSrvr Boolean bErr Forward Get OnPostEntering to bRetVal Delegate Get Server to hoSrvr Get Request_Validate of hoSrvr to bErr If (bErr = False) Begin Delegate Send Request_Save If (Err = True) Begin Send Stop_Box "The filename and path needs to be unique and there already exist a record with these values. Please adjust and try again." Move Err to bErr End End Function_Return (bErr) End_Function Procedure OnEntering Handle hoSrvr Boolean bChanged Get Server to hoSrvr Get Should_Save of hoSrvr to bChanged If (bChanged = True) Begin Set pbNeedPostEntering to True End End_Procedure On_Key kDelete_Character Send Request_Delete End_Object Object oScanDependencies is a dbCheckbox Entry_Item CodeHdr.ScanDependencies Set Auto_Size_State to False Set Label to "Scan dependencies (Use *.pkg)" Set Size to 10 117 Set Location to 182 58 Set peAnchors to anBottomLeft End_Object Object oOpenNewBrowserTab is a CheckBox Set Size to 10 127 Set Auto_Size_State to False Set Checked_State to True Set Location to 196 58 Set Label to 'Open New Browser tab for classes' Set peAnchors to anBottomLeft End_Object Object oPublicOnly is a dbCheckbox Entry_Item CodeHdr.PublicInterfaceOnly Set Auto_Size_State to False Set Label to "Public interface only" Set Size to 11 86 Set Location to 182 186 Set peAnchors to anBottomLeft End_Object Object oEditSourceFilePath_btn is a cButton Set Size to 12 137 Set Location to 182 281 Set Label to "Change path for multiple source files" Set psToolTip to "Change path for multiple source files" Set peAnchors to anBottomRight Set pbAutoEnable to True Procedure OnClick String sFromPath Integer iCodeHdrID Get Field_Current_Value of oCodeDtl_DD Field CodeDtl.CodeHdrID to iCodeHdrID Get Field_Current_Value of oCodeDtl_DD Field CodeDtl.FullSourceFileName to sFromPath Get ParseFolderName sFromPath to sFromPath Send ActivateChangeSourceFilesPath of (Client_Id(phoMainPanel(ghoApplication))) sFromPath iCodeHdrID Send RefreshDataFromDD of oSource_grd 0 Send MovetoFirstRow of oSource_grd End_Procedure End_Object Object oLine is a LineControl Set Size to 2 415 Set Location to 213 4 Set peAnchors to anBottomLeftRight End_Object Object oStyleSheet_cf is a dbComboForm Entry_Item CodeHdr.StyleSheet Set Size to 12 111 Set Location to 227 58 Set Label to "Style Sheet" Set peAnchors to anBottomLeft Set Status_Help to "Style sheet (CSS-file) to use when formatting the .html files." Set Entry_State to False Set Label_Justification_Mode to JMode_Right Set Label_Col_Offset to 2 End_Object Object oGenerate_bn is a cButton Set Label to "&Generate HTML Documentation" Set Size to 28 76 Set Location to 219 179 Set peAnchors to anBottomRight Set Status_Help to "Start generating .html files to the Target folder." Set MultiLineState to True Set pbAutoEnable to True Procedure OnClick Forward Send OnClick String sSource sSourceDir sFile sDir sCSSFile Integer iC hoSpy hoSrc hoID iItems iRetval String[] sSourceArray Boolean bScanDependencies bPublicOnly Boolean bOpenNewWindow Handle hoDD Object oFilesList is an Array Move Self to hoID End_Object Send Cursor_Wait of Cursor_Control // Change to cursor wait Send Request_Save_No_Clear Move (oCodeHdr_DD(Self)) to hoDD Get Field_Current_Value of hoDD Field CodeHdr.TargetFolder to sDir Get Field_Current_Value of hoDD Field CodeHdr.StyleSheet to sCSSFile Get Field_Current_Value of hoDD Field CodeHdr.ScanDependencies to bScanDependencies Get Field_Current_Value of hoDD Field CodeHdr.PublicInterfaceOnly to bPublicOnly Get Checked_State of oOpenNewBrowserTab to bOpenNewWindow If (not(Directory_Exist(sDir))) Begin Get YesNo_Box ("Target folder doesn't exist!\n\n" + CS_QUOTE + sDir + CS_QUOTE + "\n\nDo you want to create it?") to iRetval If (iRetval <> MBR_Yes) Begin Procedure_Return End Send Make_Directory sDir End Send DoCopyCSSAndHtmlFiles sDir sCSSFile Move (oMultiFileCodeSpy(Self)) to hoSpy Set psDirectory of hoSpy to sDir Set pbScanDependencies of hoSpy to bScanDependencies Set pbPublicOnly of hoSpy to bPublicOnly Set pbOpenNewWindow of hoSpy to bOpenNewWindow Send DoInit to hoSpy Move (oSource_grd(Self)) to hoSrc Get SourceItems of hoSrc to sSourceArray Move (SizeOfArray(sSourceArray)) to iItems Decrement iItems For iC from 0 to iItems Move sSourceArray[iC] to sSource If (Trim(sSource) <> "") Begin If (sSource contains "*") Begin Move (Trim(sSource)) to sSource // No blanks at end or begin. Get ParseFolderName sSource to sSourceDir Get vFolderFormat sSourceDir to sSourceDir Move ('dir:' + sSource) to sDir Direct_Input channel 9 sDir // Start input Repeat Readln channel 9 sFile // [not SeqEof] If (Trim(sFile)) Ne "" If not "[" In sFile ; // Set value of hoID (Item_Count(hoID)) to (sSourceDir+sFile) If (SeqEof = False and Trim(sFile) <> "") Begin If (not(sFile) contains "[") Begin Set Value of hoID (Item_Count(hoID)) to (sSourceDir + sFile) End End Until (SeqEof) Close_Input End Else ; Set Value of hoID (Item_Count(hoID)) to sSource // or a single file. End End For iC from 0 to (Item_Count(hoID)) Get Value of hoID iC to sFile Send ShowInfo to (oCodeSpyStatus(Self)) sFile If (sFile <> "") Begin Send RunParseFile to hoSpy sFile End End Send WriteHTML to hoSpy Send Destroy_Object to hoID Send FillGrid of oClasses Send Deactivate of oCodeSpyStatus Send Cursor_Ready of Cursor_Control Send Info_Box "Ready!" End_Procedure End_Object Object ReadHtml_bn is a cButton Set Size to 14 76 Set Location to 227 261 Set Label to "View Gene&rated Doc" Set peAnchors to anBottomRight Set Status_Help to "View generated .htm files in your browser." Set pbAutoEnable to True Procedure OnClick String sPath Send Cursor_Wait of Cursor_Control Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.TargetFolder to sPath Get vFolderFormat sPath to sPath Send StartFile (sPath + "ClassReference.htm") Send Cursor_Ready of Cursor_Control End_Procedure End_Object Object OpenTargetDirInExplorer_btn is a cButton Set Size to 14 76 Set Location to 227 343 Set Label to "Open Target Folder" Set peAnchors to anBottomRight Set Status_Help to "Open target directory in Windows Explorer." Set pbAutoEnable to True Procedure OnClick String sPath Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.TargetFolder to sPath Send vShellExecute "open" "Explorer.exe" sPath "" End_Procedure End_Object Object oOpenDialog is a OpenDialog Set Filter_String to "Packages (*.pkg)|*.pkg|Include Files (*.inc)|*.inc|Source (*.src)|*.src|All Source (*.src; *.pkc; *.inc)|*.src;*.pkg;*.inc|All Files *.*|*.*" Set MultiSelect_State to True Function CallOpenDialog Returns String[] Integer bOpen String sFileTitle sPath String[] sFilesArray Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.Path to sPath Get vFolderFormat sPath to sPath Move (sPath + "AppSrc") to sPath Set Initial_Folder to sPath Set Dialog_Caption to "Please select source file(s) to scan" Get Show_Dialog to bOpen If (bOpen = True) Begin Get Selected_Files to sFilesArray End Function_Return sFilesArray End_Function End_Object // *** General messages used by the view *** Procedure DoCopyCSSAndHtmlFiles String sDir String sCSSFile String sLocalPath Boolean bExist Integer iRetval Get psHelpPath of (phoWorkspace(ghoApplication)) to sLocalPath Get vFolderFormat sLocalPath to sLocalPath Get vFolderFormat sDir to sDir CopyFile (sLocalPath + sCSSFile) to (sDir + "Classes.css") CopyFile (sLocalPath + sCSSFile) to (sDir + "ClassReference.css") Get vFilePathExists (sDir + "CodeSpyInfo.htm") to bExist // Do the copy unconditionally, in case the CodeSpy version files has been changed. Get vCopyFile (sLocalPath + "Code*.htm") sDir to iRetval End_Procedure Procedure DoSetFileNames String sFileName Integer iItem String sTargetDir sChar sLocalHelpPath Boolean bRemoved Move (PathRemoveFileSpec(AddressOf(sFileName))) to bRemoved Move (CString(sFileName)) to sTargetDir Get psHelpPath of (phoWorkspace(ghoApplication)) to sLocalHelpPath Send DoCopyCSSAndHtmlFiles sTargetDir "" End_Procedure On_Key Key_Ctrl+Key_O Send KeyAction of oBrowse_btn On_Key Key_Ctrl+Key_G Send KeyAction of oGenerate_bn On_Key Key_Ctrl+Key_R Send KeyAction of ReadHtml_bn On_Key Key_Ctrl+Key_S Send Request_Save End_Object Object oMaintain_tp is a dbTabPage Set Label To "Maintain Classes" // Object oClasses_grd is a cDbCJGrid // Set Server to oCodeClass_DD // Set Size to 80 407 // Set Location to 12 17 // Set peAnchors to anAll // Set pbRestoreLayout to True // Set psLayoutSection to "oCodeSpy_vw_oClasses_grd" // Set pbShowFooter to True // Set Verify_Delete_Msg to (RefFunc(No_Confirmation)) // Set Verify_Data_Loss_Msg to (RefFunc(No_Confirmation)) // Set Verify_Save_msg to (RefFunc(No_Confirmation)) // Set piAlternateRowBackgroundColor to 15263976 // Set piFocusCellBackColor to 14667984 // Set pbStaticData to True // // Object oCJGridColumnRowIndicator is a cCJGridColumnRowIndicator // Set piWidth to 21 // End_Object // // Object oCodeClass_ClassName is a cDbCJGridColumn // Entry_Item CodeClass.ClassName // Set piWidth to 232 // Set psCaption to "Class Name" // End_Object // // Object oCodeClass_ClassSourceFile is a cDbCJGridColumn // Entry_Item CodeClass.ClassSourceFile // Set piWidth to 302 // Set psCaption to "Source File" // End_Object // // Object oCodeClass_ClassGroup is a cDbCJGridColumn // Entry_Item CodeClass.ClassGroup // Set piWidth to 157 // Set psCaption to "Group" // End_Object // // // When loading data, update the footer 'No of Items' text // Procedure Refresh Integer eMode // Forward Send Refresh eMode // Send DoSetCurrentRow // End_Procedure // // // Send by grid subclass Refresh message. // Procedure DoSetCurrentRow // Handle hoDataSource // Integer iRows // // Get phoDataSource to hoDataSource // Get RowCount of hoDataSource to iRows // Set psFooterText of oCodeDtl_FullSourceFileName to (" Number of Files:" * String(iRows)) // End_Procedure // // End_Object Object oClasses is a Grid Set Size to 173 360 Set Location to 10 58 Set Line_Width to 3 0 Set Form_Width 0 to 119 Set Header_Label 0 to "Class Name" Set Form_Width 1 to 168 Set Header_Label 1 to "Source File" Set Form_Width 2 to 67 Set Header_Label 2 to "Group" Set peAnchors to anAll Set peResizeColumn to rcSelectedColumn Set piResizeColumn to 1 Object oFileClassList Is a cFileClassList End_Object // Saves the contents of the grid to the classlist. Procedure SaveGrid Integer hoID iOld iC String sDir sClassName sSrc Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.TargetFolder to sDir Move (oFileClassList(Self)) to hoID Set psDirectory of hoID to sDir Send DoInit to hoID // ToDo: Change after change to new class For iC from 0 to (Item_Count(Self)-1) Send RegisterClass to hoID (Value(Self, iC)) (Value(Self, iC+1)) (Value(Self, iC+2)) Move (iC+2) to iC // 3 Items per line End Send WriteClasses to hoID End_Procedure // Adds a class and its sourcefile to the grid. Procedure AddClass String sName String sSrc String sGrp Send Add_Item msg_None sName Send Add_Item msg_None sSrc Send Add_Item msg_None sGrp End_Procedure // Reads the classlist of the codespy into the grid. Procedure FillGrid Integer hoID iOld iC String sDir sClassName sSrc Set Dynamic_Update_State to False Send Delete_Data Get Field_Current_Value of oCodeHdr_DD Field CodeHdr.TargetFolder to sDir If (sDir = "") Begin Procedure_Return End Move (oFileClassList(Self)) to hoID Set psDirectory of hoID to sDir Send ReadClasses to hoID Send EnumClasses to hoID Msg_AddClass Self For iC From 0 To 9 Send AddClass "" "" "" End Set Dynamic_Update_State to True End_Procedure // Deletes a row. Procedure Request_Delete Integer iBase iOld Get Current_item to iBase Move (iBase - Mod(iBase, 3)) to iBase Send Delete_Item iBase Send Delete_Item iBase Send Delete_Item iBase End_Procedure On_Key kSave_Record Send SaveGrid On_Key kDelete_Record Send Request_Delete End_Object Object oLine Is a LineControl Set Size to 2 415 Set Location to 198 4 Set peAnchors to anBottomLeftRight End_Object Object oSave_bn is a Button Set Label to "&Save" Set Location to 212 369 Set peAnchors to anBottomRight Set Status_Help to "Save settings to .ini file." On_Key kCancel Send Close_Panel Procedure OnClick Send SaveGrid To (oClasses(Self)) End_Procedure End_Object Object oReload_bn is a Button Set Label to "&Reload" Set Location to 212 314 Set peAnchors to anBottomRight On_Key kCancel Send Close_Panel Set Status_Help to "Reload settings from .ini file" Procedure OnClick Send FillGrid to oClasses End_Procedure End_Object On_Key Key_Ctrl+Key_S Send KeyAction of oSave_bn On_Key Key_Ctrl+Key_R Send KeyAction of oReload_bn End_Object Procedure Request_Switch_To_Tab Integer tab# Integer iPointerMode Forward Send Request_Switch_To_Tab tab# iPointerMode If (tab# > 0) Begin Send FillGrid to oClasses End End_Procedure End_Object // Takes a short format path like ".\AppSrc" and a normal path variable and // returns the two values concatanated without any "." or ".." in the path. Function MakeProperPathFromShortPath String sShortPath String sPath Returns String String sChar sRetval Repeat Move (Left(sShortPath, 1)) to sChar If (sChar = ".") Begin If (Left(sShortPath, 2) = "..") Begin Move (Replace("..", sShortPath, "")) to sShortPath End Else If (Left(sShortPath, 1) = ".") Begin Move (Replace(".", sShortPath, "")) to sShortPath End End Until (sChar <> ".") // Remove end "\" if any from path & returned value If (Right(sPath, 1) = "\") Begin Move (Left(sPath, (Length(sPath) -1))) to sPath End Move (sPath + sShortPath) to sRetval If (Right(sRetval, 1) = "\") Begin Move (Left(sRetval, (Length(sRetval) -1))) to sRetval End Function_Return sRetval End_Function // Check to see if we should "auto-find" a record when the view is activated. // It should be done if the program was started from the VDF Studio's Tools menu Procedure Activating String sArgument sFileName sPath Integer iRetval Handle ho Forward Get msg_activating to iRetval Set Sysmenu_Icon to False Set Maximize_Icon to True Set Minimize_Icon to False Set Border_Style to Border_Thick Set View_Mode to Viewmode_Zoom Move (Client_Id(phoMainPanel(ghoApplication))) to ho // Note: The following line is essential for the resizing logic // to work when starting the program. Set Border_Style of ho to Border_ClientEdge // Check if program was started with command line parameters, in // case we auto-load that record. Get psApplicationManifestName of ghoApplication to sArgument Get vFilePathExists sArgument to iRetval If (sArgument <> "" and iRetval = True) Begin Get ParseFileName sArgument to sFileName Get ParseFolderName sArgument to sPath Clear CodeHdr Move sFileName to CodeHdr.SWSFileName Move sPath to CodeHdr.Path Find eq CodeHdr.SWSFileName If (Found = True) Begin Send Request_Assign of oCodeHdr_DD End Else Begin Send Clear of oCodeHdr_DD End End End_Procedure Procedure OnFileDropped String sFilename Boolean bLast Integer iFiles String[] ArrayOfDroppedFiles EmptyArray Get pArrayOfDroppedFiles to ArrayOfDroppedFiles // Add the filename to the list of dropped files.... Move (SizeOfArray(ArrayOfDroppedFiles)) to iFiles Move sFilename to ArrayOfDroppedFiles[iFiles] // If this was the last file, process them and clear the list If (bLast) Begin Send ProcessDroppedFiles of oSource_grd ArrayOfDroppedFiles // Clear the property so it is ready for next drop Move EmptyArray to ArrayOfDroppedFiles End Set pArrayOfDroppedFiles to ArrayOfDroppedFiles End_Procedure // Just kill this method. Else a runtime error will be generated // if the escape key is pressed. Procedure Request_Cancel End_Procedure End_Object