Use Windows.pkg Use cScrollingContainer.pkg Use cSplitterContainer.pkg Use cCJCommandBarSystem.pkg Use Cursor.pkg Use dfLine.pkg Use cRDCCJSelectionGrid.pkg Use cRDCButtonDPI.pkg Use cRDCComboForm.pkg Use cRefactorTextbox.pkg Use cRDCHeaderGroup.pkg Use cRDCForm.pkg Use cRDCSpinForm.pkg Use cRefactorDbView.pkg Use cRDCCommandLinkButton.pkg Use cRefactorCheckbox.pkg Use cRDCSlideButton.pkg Use cCommandLinkButton.pkg Use cRDCCheckbox.pkg Activate_View Activate_oRefactorView For oRefactorView Object oRefactorView is a cRefactorDbView Set Size to 270 521 Set Label to "Refactoring Selections" Set Icon to "DFRefactor.ico" Set pbAcceptDropFiles to True Set phoRefactorView of ghoApplication to Self Object oSplitterContainer is a cSplitterContainer Set pbSplitVertical to False Set piSplitterLocation to 167 Set pbAcceptDropFiles to True Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure Object oSplitterContainerChild1 is a cSplitterContainerChild Set pbAcceptDropFiles to True Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure Object oLineControlTop is a LineControl Set Size to 2 518 Set Location to 1 0 Set peAnchors to anTopLeftRight Set Line_Thickness to 4 Set Line_Style to lnBump End_Object Object oActions_Grp is a cRDCHeaderGroup Set Size to 161 516 Set Location to 3 0 Set psLabel to "Function Selection" Set psNote to "Select refactoring functions to freshen up your source code" Set psToolTip to "Select refactoring functions" Set peAnchors to anAll Set Border_Style to Border_None Set psImage to "DFRefactor.ico" Set pbUseLargeFontHeight to True // ToDo: There's a bug somewhere in the cRDCSlideButton class that changes // the header image. This is a quick fix... Procedure Set psImage String sImage Forward Set psImage to "DFRefactor.ico" End_Procedure Object oInvisible_Container is a Container3d Set Size to 131 516 Set Location to 28 0 Set Border_Style to Border_None // Set Size to 131 519 // Set Border_Style to Border_Normal Set peAnchors to anAll Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure Object oActionsScrollingContainer is a cScrollingContainer Set pbAcceptDropFiles to True // For some reason we need to augment this event to allow // files to be dropped; else nothing will // happen. Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure Object oActionsScrollingClientArea is a cScrollingClientArea Set pbAcceptDropFiles to True Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure #IF (!@ >= 190) Set pbTabWorkspaceView to False #ENDIF Object oStandardFunctions_grp is a cRDCHeaderGroup Set Size to 118 271 Set Location to 0 0 Set Label to "Standard Functions" Set psImage to "FunctionLibrary.ico" Set psToolTip to "Standard refactoring functions." Set Border_Style to Border_None Set peAnchors to anNone // ToDo: There's a bug somewhere in the cRDCSlideButton class that changes // the header image. This is a quick fix... Procedure Set psImage String sImage Forward Set psImage to "FunctionLibrary.ico" End_Procedure Object oRemoveMarkers_cb is a cRefactorCheckBox Set Size to 11 60 Set Location to 20 12 Set Label to "Studio markers" Set psToolTip to "Remove old //AB-xxxx IDE markers" Set Checked_State to True End_Object Object oReplaceMoveStatement_cb is a cRefactorCheckBox Set Size to 11 83 Set Location to 20 122 Set Label to "Calc/MoveInt" Set psToolTip to "Replaces obsolete commands 'Calc', 'MoveInt', 'MoveReal', 'MoveNum' and 'MoveStr' with the 'Move' command" Set Checked_State to True End_Object Object oProjectObjectStructure_cb is a cRefactorCheckBox Set Size to 11 87 Set Location to 32 12 Set Label to "Project object structure" Set psToolTip to "Removes the 'Project Object Structure' comments at the top of source files. It also removes 'Register_Object' for those same objects." Set Checked_State to True End_Object Object oRemoveUnusedLocals_cb is a cRefactorCheckBox Set Size to 11 88 Set Location to 32 122 Set Label to "Unused local variables" Set psToolTip to "Remove variables declared in functions and procedures that are never used." Set Checked_State to True End_Object Object oRTrimLines_cb is a cRefactorCheckBox Set Size to 11 61 Set Location to 44 12 Set Label to "Trailing spaces" Set psToolTip to "Removes spaces at the end of lines" Set Checked_State to True End_Object Object oRemoveFonts_cb is a cRefactorCheckBox Set Size to 11 57 Set Location to 44 122 Set Label to "MS Sans Serif" Set psToolTip to "Removes hard coded: MS Sans Serif fonts if present. With more recent versions of DataFlex fonts are handled much better than before and these font settings usually makes the app look strange." Set Checked_State to True End_Object Object oRemoveEndComments_cb is a cRefactorCheckBox Set Size to 11 60 Set Location to 63 12 Set Label to "End comments" Set psToolTip to "Remove comments after End_Class/End_Object/End_Function/End_Procedure as they easily becomes out of sync, meaning that e.g. the object/procedure/function name is changed but not the bottom end comment." Set Checked_State to True End_Object Object oUClassToRefClass_cb is a cRefactorCheckBox Set Size to 11 94 Set Location to 63 122 Set Label to "Get U_" Set psToolTip to "Replaces 'Get Create U_ClassName' with 'Get Create (RefClass(ClassName))'." Set Checked_State to True End_Object Object oRemoveLocals_cb is a cRefactorCheckBox Set Size to 11 99 Set Location to 75 12 Set Label to "'Local' keyword" Set psToolTip to "Removes the keyword: Local from variable declaration lines in functions and procedures as they no longer apply." Set Checked_State to True End_Object Object oRemoveBlankLines_cb is a cRefactorCheckBox Set Size to 11 44 Set Location to 75 122 Set Label to "Blank lines" Set Checked_State to True Set psToolTip to "Select the maximum number of consecutive blank lines that is allowed in a source file. If more empty lines are encountered, they will be removed." Procedure OnChange Boolean bChecked Forward Send OnChange Get Checked_State to bChecked Set Enabled_State of oMaxBlankLines_sf to bChecked End_Procedure End_Object Object oMaxBlankLines_sf is a cRDCSpinForm Set Size to 12 27 Set Location to 72 239 Set Label to "Max blank lines" Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set psToolTip to "Select the maximum number of consecutive blank lines that is allowed in a source file. If more empty lines are encountered, they will be removed." Set Maximum_Position to 6 Set Minimum_Position to 1 Procedure OnChange Integer iMaxBlankLineSize iMinValue iMaxValue Get Minimum_Position to iMinValue Get Maximum_Position to iMaxValue Get Value to iMaxBlankLineSize If (iMaxBlankLineSize >= iMinValue and iMaxBlankLineSize <= iMaxValue) Begin Set piMaxBlankLineSize of ghoApplication to iMaxBlankLineSize End End_Procedure Procedure Activating Integer iMaxBlankLineSize Get piMaxBlankLineSize of ghoApplication to iMaxBlankLineSize Set Value to iMaxBlankLineSize End_Procedure End_Object Object oPropertyPublic_cb is a cRefactorCheckBox Set Size to 11 99 Set Location to 87 12 Set Label to "'Public' keyword" Set psToolTip to "Removes the keyword: Public from property declarations as it is no longer serves any purpose." Set Checked_State to True End_Object Object oPropertyPrivate_cb is a cRefactorCheckBox Set Size to 11 72 Set Location to 99 12 Set Label to "'Private' keyword*" Set psToolTip to "Removes the keyword: Private from property declarations. Note that in some rare cases you might need to tweak your code if it is removed. Therefor this option is unchecked by default." Set Checked_State to False End_Object Object oIfElseSemicolumn_cb is a cRefactorCheckBox Set Size to 11 87 Set Location to 87 122 Set Label to "If/Else constructs" Set psToolTip to "Restructures single if/else code lines to multiple lines, which makes debugging much easier. See also the 'Use' group below for options." Set Checked_State to True Procedure OnChange Boolean bChecked Forward Send OnChange Get Checked_State to bChecked Set Enabled_State of oSplitBy_rgp to bChecked // Set Enabled_State of oTabSize_sf to bChecked End_Procedure End_Object Object oSplitBy_rgp is a RadioGroup Set Location to 98 138 Set Size to 20 99 Set Label to "Change To:" Object oRadio1 is a Radio Set Label to "' ;'" Set Size to 10 20 Set Location to 8 5 Set psToolTip to "Break the if/else line with a space followed by a semi column" End_Object Object oRadio2 is a Radio Set Label to "';'" Set Size to 10 19 Set Location to 8 27 Set psToolTip to "Break the if/else line with a semi column" End_Object Object oRadio3 is a Radio Set Label to "Begin/End" Set Size to 10 46 Set Location to 8 49 Set psToolTip to "Break the if/else line by adding a begin / end block" End_Object Procedure Notify_Select_State Integer iToItem Integer iFromItem Set piSplitByPreference of ghoApplication to iToItem End_Procedure Procedure Activating Integer iSplitByPreference Get piSplitByPreference of ghoApplication to iSplitByPreference Set Current_Radio to iSplitByPreference End_Procedure End_Object End_Object // Object oGetAddress_cb is a cRefactorCheckBox // Set Size to 9 75 // Set Location to 27 438 // Set Label to "GetAddress" // Set psToolTip to "Change 'GetAddress of sVal to aAddress -> Move (AddressOf(sVal)) to aAddress'" // Set Checked_State to False // Set Visible_State to False // End_Object // // Object oInToContains_cb is a cRefactorCheckBox // Set Size to 9 75 // Set Location to 39 438 // Set Label to "IN -> Contains" // Set psToolTip to "Change 'IN' to 'Contains'" // Set Checked_State to False // Set Visible_State to False // End_Object // // Object oCompareOperators_cb is a cRefactorCheckBox // Set Size to 9 75 // Set Location to 50 438 // Set Label to "If sTmp Ne '' Begin" // Set psToolTip to "Change 'If sTmp Ne '' Begin -> If (sTmp <> '') Begin'" // Set Checked_State to False // Set Visible_State to False // End_Object Object oEditorFunctions_grp is a cRDCHeaderGroup Set Size to 72 223 Set Location to 0 276 Set Label to "Editor Functions" Set psImage to "Editor.ico" Set psToolTip to "These refactoring functions are all using the build in Scintilla editor to do their work. For various reasons this also makes these functions much slower than the other refactoring functions." Set Border_Style to Border_None Set psNote to "Uses Scintilla Editor Functionality" // ToDo: There's a bug somewhere in the cRDCSlideButton class that changes // the header image. This is a quick fix... Procedure Set psImage String sImage Forward Set psImage to "Editor.ico" End_Procedure Object oReindentCode_cb is a cRefactorCheckBox Set Size to 11 80 Set Location to 31 14 Set Label to "Reindent*" Set psToolTip to "Reindents the source file. You can change the Tab Size from the 'Editor Settings (Alt+D)' dialog. NOTE: This is a Scintilla editor library function and will slow down the refactoring considerably." Set Checked_State to False End_Object Object oProperCasing_cb is a cRefactorCheckBox Set Size to 11 73 Set Location to 44 14 Set Label to "Upper/Lowercase*" Set psToolTip to "Changes all casing for the a source file. Note: You can change keyword spellings from the 'Editor Settings (Alt+D)' dialog. NOTE: This is a Scintilla editor library function and will slow down the refactoring considerably." Set Checked_State to False End_Object Object oDropSelf_cb is a cRefactorCheckBox Set Size to 11 52 Set Location to 57 14 Set Label to "Drop (Self)*" Set psToolTip to "Drop Self for the currently loaded file.In a view/dialog calling a method of an object no longer needs the (Self) keyword, so it can be removed. NOTE: You will get a question to replace or not for each and every occasion of the 'Self' word." Set Checked_State to False End_Object End_Object Object oLineControlHorizontal is a LineControl Set Size to 2 234 Set Location to 72 281 Set peAnchors to anTopLeftRight End_Object Object oReportFunctionsOnly_grp is a cRDCHeaderGroup Set Size to 45 223 Set Location to 77 277 Set Label to "Report Functions" Set psImage to "Report.ico" Set psNote to "Makes no source code changes" Set psToolTip to "These refactoring functions only reports anomalies in the selected source code without making any changes to it." Set Border_Style to Border_None // ToDo: There's a bug somewhere in the cRDCSlideButton class that changes // the header image. This is a quick fix... Procedure Set psImage String sImage Forward Set psImage to "Report.ico" End_Procedure Object oReportUnusedSource_cb is a cRefactorCheckBox Set Size to 11 76 Set Location to 26 14 Set Label to "Unused source files" Set psToolTip to ("Report source files that are never Used." + (Character(13)) + "Creates a list of all unused source files." + (Character(13)) + "It will NOT make any changes to the source code.") Set Checked_State to True Set pbReportFunction to True End_Object End_Object Object oLineControlVertical is a LineControl Set Size to 116 2 Set Location to 1 275 Set Horizontal_State to False Set peAnchors to anTopBottomLeft End_Object Object oNote_tb is a cRefactorTextbox Set Size to 8 354 Set Location to 121 2 Set Label to "*) Take special note and read the tooltips carefully before selecting a checkbox marked with an asterisk (*)" Set Justification_Mode to JMode_Left Set FontItalics to True Set FontPointHeight to 8 Set peAnchors to anBottomLeft End_Object End_Object End_Object End_Object Object oToggle_btn is a cRDCButtonDPI Set Size to 13 79 Set Location to 6 274 Set Label to "To&ggle Functions" Set psImage to "SelectInvert.ico" Set psToolTip to "Toggle all checkboxes on/off. (Ctrl+G)" Procedure OnClick Send ToggleAll End_Procedure End_Object Object oNoOfSelectedFunctions_fm is a cRDCForm Set Size to 12 13 Set Location to 6 360 Set Label_Col_Offset to -18 Set Label_Justification_Mode to JMode_Left Set Label to "Functions Selected" Set psToolTip to "Number of functions selected." Set Enabled_State to False Set pbAutoEnable to False Set Form_Datatype to 0 Procedure DoUpdate Integer iSelectedFunctions Get SelectedFunctions to iSelectedFunctions Set Value to iSelectedFunctions End_Procedure End_Object Object oTabSize_sf is a cRDCSpinForm Set Size to 12 27 Set Location to 6 484 Set Label to "Tab Size" Set Label_Col_Offset to 2 Set Label_Justification_Mode to JMode_Right Set psToolTip to "Select the indent size you want to use when indenting code and when breaking a line on rewriting a single line to multiple lines. It is the same value that can be set on the Editor Settings dialog tab size." Set peAnchors to anTopRight Procedure OnStartup Integer iTabSize Get piTabSize of ghoEditorProperties to iTabSize Set Value to iTabSize End_Procedure Send OnStartup Procedure OnChange Integer iTabSize Get Value to iTabSize Set piTabSize of (phoEditor(ghoApplication)) to iTabSize End_Procedure End_Object End_Object End_Object Object oSplitterContainerChild2 is a cSplitterContainerChild Set pbAcceptDropFiles to True Object oSplitterContainer1 is a cSplitterContainer Set piSplitterLocation to 272 Set peFixedPanel to fpFixLastPanel Object oSplitterContainerChild3 is a cSplitterContainerChild Procedure OnFileDropped String sFilename Boolean bLast Delegate Send OnFileDropped sFilename bLast End_Procedure Object oSourceFolders_grp is a cRDCHeaderGroup Set Size to 100 268 Set Label to "Source Code Folders" Set psImage to "Folder.ico" Set psNote to "Right click grid for options" Set psToolTip to "You can add a folder with drag and drop from Windows Explorer, or by using the right-click mouse menu." Set peAnchors to anAll Set Border_Style to Border_None Object oFolders_grd is a cRDCCJSelectionGrid Set Size to 70 249 Set Location to 27 13 Set psNoItemsText to "No Workspace selected yet..." Set pbShowAddFolderMenuItem to True Set pbShowRemoveFolderMenuItem to True Object oCJGridColumnRowIndicator is a cCJGridColumnRowIndicator Set piWidth to 20 End_Object Object oFoldername_Col is a cCJGridColumn // NOTE: This must be set here! Set phoData_Col to Self Set piWidth to 495 Set psCaption to "Folder Name" Set psToolTip to "The process will run on all files that match the 'File extensions to parse' comboform for the selected folders and all subfolders" Set pbEditable to False Set psFooterText to "No of Folders Selected:" End_Object // This column is created automatically by the cRDCCJGrid class. // Object oCheckbox_Col is a cCJGridColumn // End_Object Procedure LoadData String sHomePath sFolderName sDefaultFolders String[] asNoFolderList asStartFolder asFolderArray asDefaultFolders Handle hoDataSource tDataSourceRow[] TheData TheDataEmpty Integer iSize iRow iCount iFolderCol iCheckBoxCol iDefaultFolders iFolder Boolean bChecked If (not(IsComObjectCreated(Self))) Begin Procedure_Return End Get psWorkspaceHomePath of ghoApplication to sHomePath If (sHomePath = "") Begin Procedure_Return End Send Cursor_Wait of Cursor_Control Get vFolderFormat sHomePath to sHomePath Move sHomePath to asStartFolder[0] Get AllSourceFolders of ghoApplication asStartFolder to asFolderArray Move (SizeOfArray(asFolderArray)) to iSize If (iSize = 0) Begin Send Cursor_Ready of Cursor_Control Procedure_Return End Decrement iSize Move 0 to iCount Get phoDataSource to hoDataSource Get DataSource of hoDataSource to TheData Move TheDataEmpty to TheData Get piColumnId of (phoData_Col(Self)) to iFolderCol Get piColumnId of (phoCheckbox_Col(Self)) to iCheckBoxCol Get NoFolderListAsArray of ghoApplication False to asNoFolderList Move CS_DefaultSourceFolders to sDefaultFolders Move (Lowercase(sDefaultFolders)) to sDefaultFolders Move (StrSplitToArray(sDefaultFolders, "|")) to asDefaultFolders Move (SizeOfArray(asDefaultFolders)) to iDefaultFolders Decrement iDefaultFolders Move 0 to iRow For iCount from 0 to iSize Move asFolderArray[iCount] to sFolderName Move sFolderName to TheData[iRow].sValue[iFolderCol] Get IsFolderInDefaultsFolderList of ghoApplication sFolderName to bChecked Move bChecked to TheData[iRow].sValue[iCheckBoxCol] Increment iRow Loop If (iRow <> 0) Begin Send ReInitializeData TheData False Send MoveToFirstRow End Else Begin Send InitializeData TheDataEmpty End Get CheckedItems to iCount Set psFooterText of oFoldername_Col to ("Selected Items:" * String(iCount) * "of" * String(iSize + 1)) Send Cursor_Ready of Cursor_Control End_Procedure Procedure UpdateEnabledState Boolean bWorkspaceMode Get pbWorkspaceMode of ghoApplication to bWorkspaceMode Set Enabled_State to bWorkspaceMode End_Procedure On_Key kClear Send ActivateProcess End_Object End_Object End_Object Object oSplitterContainerChild4 is a cSplitterContainerChild Object oFileExtenstions_grp is a cRDCHeaderGroup Set Size to 42 262 Set Label to "File Extensions Filter" Set psImage to "FileExtensions.ico" Set psNote to "Specify file extensions to parse" Set psToolTip to "Each extension must start with a wildcard character and a dot (*.) and file extensions must be separated with a semicolon (;)" Set Border_Style to Border_None Object oFileNameFilters_cf is a cRDCComboForm Set Size to 12 240 Set Location to 27 12 Set psToolTip to "When the 'Workspace' toolbar button is selected and the 'Start Process!' button is pushed, all the file extensions listed here will be processed for the currently selected Workspace (but not any libraries it may contain/use)." Set Status_Help to (psToolTip(Self)) Set Label_Col_Offset to 0 Set Label_Justification_Mode to JMode_Top Set peAnchors to anBottomLeftRight Set Label_Row_Offset to 1 Set Combo_Sort_State to False Set pbAutoEnable to True Set peAnchors to anTopLeftRight Property Integer piMaxUserFilters 8 Procedure Combo_Fill_List String sVDFExtensions sVDFVersion Integer iMajorVersion iMinorVersion iCount iSize String[] asUserExtensions Forward Send Combo_Fill_List Move FMAC_VERSION to iMajorVersion Move FMAC_REVISION to iMinorVersion Move (String(iMajorVersion) + "." + String(iMinorVersion)) to sVDFVersion Get StudioFileExtensions of ghoApplication sVDFVersion to sVDFExtensions Send Combo_Add_Item CS_StdExtensions Send Combo_Add_Item CS_VDFAndTemplExt Send Combo_Add_Item CS_PkgIncExt Send Combo_Add_Item CS_SrcPkgExt If (sVDFExtensions <> String(cx_RegKeyVDFKeyDoesNotExist)) Begin Send Combo_Add_Item sVDFExtensions End Get UserSavedExtensions to asUserExtensions Move (SizeOfArray(asUserExtensions)) to iSize Decrement iSize For iCount from 0 to iSize Send Combo_Add_Item asUserExtensions[iCount] Loop Set Value to CS_StdExtensions End_Procedure Function UserSavedExtensions Returns String[] String[] asUserExtensions String sExt Integer iCount iSize Get piMaxUserFilters to iSize For iCount from 0 to iSize Get ReadString of ghoApplication CS_Settings (CS_VdfExtensionsKey + String(iCount)) "" to sExt If (sExt <> "") Begin Move sExt to asUserExtensions[SizeOfArray(asUserExtensions)] End Loop Function_Return asUserExtensions End_Function // Note: Can't save new extensions entered by user with the // OnChange event, as it would save character per character. Procedure OnExitObject String sVDFExtensions sVDFVersion sNewExt Integer iMajorVersion iMinorVersion iCount iSize iMaxUserFilters iItem String[] asUserExtensions Boolean bExists Move FMAC_VERSION to iMajorVersion Move FMAC_REVISION to iMinorVersion Move (String(iMajorVersion) + "." + String(iMinorVersion)) to sVDFVersion Get StudioFileExtensions of ghoApplication sVDFVersion to sVDFExtensions Get piMaxUserFilters to iSize Get Value to sNewExt If (sNewExt <> CS_StdExtensions and ; sNewExt <> CS_VDFAndTemplExt and ; sNewExt <> CS_PkgIncExt and ; sNewExt <> CS_SrcPkgExt and ; sNewExt <> sVDFExtensions) Begin Get IsExtensionInRegistry sNewExt to bExists If (bExists = False) Begin Get UserSavedExtensions to asUserExtensions // Push the new item on top of the list Send WriteString of ghoApplication CS_Settings (CS_VdfExtensionsKey + String("0")) sNewExt Get piMaxUserFilters to iMaxUserFilters Move (SizeOfArray(asUserExtensions)) to iSize Move (iMaxUserFilters min iSize) to iSize Decrement iSize Move 0 to iItem For iCount from 0 to iSize Send WriteString of ghoApplication CS_Settings (CS_VdfExtensionsKey + String(iCount + 1)) asUserExtensions[iItem] Increment iItem Loop Get piMaxUserFilters to iSize Move iSize to iCount // Get out of loop End End End_Procedure Function IsExtensionInRegistry String sExt Returns Boolean Boolean bExists String[] asUserExtensions Integer iCount iSize Move False to bExists Get UserSavedExtensions to asUserExtensions Move (SizeOfArray(asUserExtensions)) to iSize Decrement iSize For iCount from 0 to iSize If (Lowercase(asUserExtensions[iCount]) = Lowercase(sExt)) Begin Move True to bExists Move iSize to iCount // We're done. End Loop Function_Return bExists End_Function Function IsEnabled Returns Boolean Boolean bWorkspaceMode Get pbWorkspaceMode of ghoApplication to bWorkspaceMode Function_Return bWorkspaceMode End_Function End_Object End_Object Object oLineControlHorizontal is a LineControl Set Size to 2 235 Set Location to 41 5 Set peAnchors to anBottomLeftRight End_Object Object oRunNow_grp is a cRDCHeaderGroup Set Size to 52 262 Set Location to 45 -1 Set psLabel to "Process Selections" Set psNote to "Process selected refactoring functions" Set psToolTip to "Process selected refactoring functions for the source code matching the selected folders and file extensions." Set psImage to "Process.ico" Set peAnchors to anBottomLeftRight Set Border_Style to Border_None Set pbUseLargeFontHeight to True Object oNoOfSelectedFunctions2_fm is a cRDCForm Set Size to 12 13 Set Location to 29 103 Set Label_Col_Offset to -18 Set Label_Justification_Mode to JMode_Left Set Label to "Functions Selected" Set psToolTip to "Number of functions selected." Set Enabled_State to False Set pbAutoEnable to False Set Form_Datatype to 0 Set peAnchors to anBottomRight Procedure DoUpdate Integer iSelectedFunctions Get SelectedFunctions to iSelectedFunctions Set Value to iSelectedFunctions End_Procedure End_Object Object oExecute_btn is a cRDCButton Set Location to 28 190 Set Label to "&Run Now!" Set psToolTip to "Start processing the selected refactoring functions. If 'Workspace' mode has been selected from the toolbar all source files that matches the 'File Extensions Filter' will be processed. Else the operations will take place on a single file only. (Alt+R or Ctrl+R)" Set MultiLineState to True Set psImage to "Start.ico" Set pbAutoEnable to True Set peAnchors to anBottomRight Set Default_State to True Set piImageMarginLeft to 7 Procedure End_Construct_Object Forward Send End_Construct_Object Set FontPointHeight to 10 Set FontWeight to fw_Bold End_Procedure Procedure OnClick Send Process End_Procedure Function IsEnabled Returns Boolean Boolean bEnabled bWorkspaceMode String sFileName sSWSFile Integer iSelectedFunctions iFolders Get pbWorkspaceMode of ghoApplication to bWorkspaceMode Get psSWSFile of ghoApplication to sSWSFile Get psCurrentSourceFileName of ghoApplication to sFileName If (bWorkspaceMode = True) Begin Move (sSWSFile <> "") to bEnabled End Else Begin Move (sFileName <> "") to bEnabled End If (bEnabled = True) Begin Get SelectedFunctions to iSelectedFunctions Move (iSelectedFunctions <> 0) to bEnabled End If (bEnabled = True) Begin Get CheckedItems of oFolders_grd to iFolders Move (iFolders <> 0) to bEnabled End Function_Return bEnabled End_Function End_Object End_Object End_Object End_Object End_Object End_Object // Reads the settings from the checkboxes and applies those by writing them out // to a struct property. // There's no "smart" way of getting the values from the refactor actions array // to the struct, so we need to this manually, by reading each checkbox. Procedure ReadSelections tRefactorActions RefactorActions Get Checked_State of oRemoveMarkers_cb to RefactorActions.bRemoveMarkers Get Checked_State of oProjectObjectStructure_cb to RefactorActions.bProjectObjectStructure Get Checked_State of oRTrimLines_cb to RefactorActions.bRTrimLines Get Checked_State of oRemoveLocals_cb to RefactorActions.bRemoveLocals Get Checked_State of oRemoveFonts_cb to RefactorActions.bRemoveFonts Get Checked_State of oIfElseSemiColumn_cb to RefactorActions.bInlineIfElse Get Checked_State of oPropertyPublic_cb to RefactorActions.bPropertyPublic Get Checked_State of oPropertyPrivate_cb to RefactorActions.bPropertyPrivate Get Checked_State of oRemoveEndComments_cb to RefactorActions.bRemoveEndComments Get Checked_State of oUClassToRefClass_cb to RefactorActions.bUClassToRefClass Get Checked_State of oReindentCode_cb to RefactorActions.bReindent Get Checked_State of oProperCasing_cb to RefactorActions.bProperCasing Get Checked_State of oDropSelf_cb to RefactorActions.bDropSelf Get Checked_State of oReplaceMoveStatement_cb to RefactorActions.bReplaceMoveStatement Get Checked_State of oRemoveBlankLines_cb to RefactorActions.bRemoveBlankLines Get Checked_State of oRemoveUnusedLocals_cb to RefactorActions.bRemoveUnusedLocals // Get Checked_State of oGetAddress_cb to RefactorActions.bGetAddress // Get Checked_State of oInToContains_cb to RefactorActions.bInToContains // Get Checked_State of oCompareOperators_cb to RefactorActions.bCompareOperators // Report functions Get Checked_State of oReportUnusedSource_cb to RefactorActions.bUnusedSource Get Current_Radio of oSplitBy_rgp to RefactorActions.eSplitBy Get Value of oTabSize_sf to RefactorActions.iTabSize Get Value of oMaxBlankLines_sf to RefactorActions.iMaxBlankLines Get Value of oFileNameFilters_cf to RefactorActions.sFileFilter Get SelectedItems of oFolders_grd to RefactorActions.asFolderNames Set pRefactorActions to RefactorActions End_Procedure // At least one action should have been selected. // Also checks that spinform values are correct. Function IsValidActions Returns Boolean Boolean bOK Integer iTabSize iRefactorFunctions iReportFunctions iMaxLines iMinLines tRefactorActions RefactorActions Get IsRefactorFunctions False to iRefactorFunctions Get IsRefactorFunctions True to iReportFunctions Move (iRefactorFunctions > 0 or iReportFunctions > 0) to bOK If (bOK = False) Begin Send Info_Box "You should at least check ONE action for the process to run." Function_Return False End Get Minimum_Position of oMaxBlankLines_sf to iMinLines Get Maximum_Position of oMaxBlankLines_sf to iMaxLines Send ReadSelections Get pRefactorActions to RefactorActions If (RefactorActions.iTabSize < 1 or RefactorActions.iTabSize > 8) Begin Send Info_Box "The tab size value needs to be between 1 and 8." Move False to bOK End Else If (RefactorActions.bRemoveBlankLines = True and RefactorActions.iMaxBlankLines < iMinLines or RefactorActions.iMaxBlankLines > iMaxLines) Begin Send Info_Box ("The value for maximum number of consequitive blank lines needs to be between" * String(iMinLines) * "and" * String(iMaxLines) + ".") Move False to bOK End Function_Return bOK End_Function // Does error checking then switches to the oEditorView and calls its main_process. Procedure Process String sFileName sPath sFileFilter Boolean bFolderExists bFileExists bOK bWorkspaceMode tRefactorActions RefactorActions tRefactorCheckbox[] aRefactorCheckboxes Integer iFolders Get pbWorkspaceMode of ghoApplication to bWorkspaceMode If (bWorkspaceMode = True) Begin Get CheckedItems of oFolders_grd to iFolders If (iFolders = 0) Begin Send Info_Box "You need to select at least one folder." Procedure_Return End End Get IsValidActions to bOk If (bOk = False) Begin Procedure_Return End Get pRefactorActions to RefactorActions If (bWorkspaceMode = True) Begin Get psHomePath of ghoApplication to sPath Get vFolderExists sPath to bFolderExists If (bFolderExists = False) Begin Send Stop_Box "Workspace directory does not exist" "Process Halted" Procedure_Return End If (SizeOfArray(RefactorActions.asFolderNames) = 0) Begin Send Stop_Box "You need to select at least one folder. Please adjust and try again." Procedure_Return End Move RefactorActions.sFileFilter to sFileFilter If (not(sFileFilter contains "." and (not(sFileFilter contains "*") or not(sFileFilter contains "?")))) Begin Send Stop_Box "You need to select at least one file name extenstion. Please adjust and try again" Procedure_Return End End Else If (bWorkspaceMode = False) Begin Get psCurrentSourceFileName of ghoApplication to sFileName Get FileExists of ghoFileSystem sFileName DIRMODE_FILES_ONLY to bFileExists If (bFileExists = False) Begin Send Stop_Box "File does not exists" "Process Halted" Procedure_Return End End Get paRefactorCheckboxes to aRefactorCheckboxes // *** Call the Main Process *** Send MAIN_PROCESS of (phoEditorView(ghoApplication)) RefactorActions aRefactorCheckboxes End_Procedure Function pbShouldSave Returns Boolean Function_Return (Changed_State(Self)) End_Function Procedure Request_Clear Set Changed_State to False End_Procedure Procedure Request_Clear_All Set Changed_State to False Send Request_Clear_All of oFolders_grd End_Procedure Procedure Close_Panel End_Procedure Procedure OnSetFocus Integer iTabSize Set piActiveView of ghoApplication to CI_CleanupSource Self Get piTabSize of ghoEditorProperties to iTabSize Set Value of oTabSize_sf to iTabSize End_Procedure Procedure WorkspaceLoaded Send LoadData of oFolders_grd End_Procedure // Allow a source file, .sws file or a folder to be dropped on the view: Procedure OnFileDropped String sFileFolderName Boolean bLast String sFileExt Boolean bFile bFolder bSWSFile Forward Send OnFileDropped sFileFolderName bLast // Try to find out if a file or a folder name // was dropped on the view: If (bLast = True) Begin Get ParseFileExtension sFileFolderName to sFileExt Move (Lowercase(sFileExt)) to sFileExt Move (sFileExt = "") to bFolder Move (sFileExt = "sws") to bSWSFile Move (bSWSFile = False and bFolder = False) to bFile If (bFile = True) Begin Send UpdateSourceFileNameDisplay of ghoApplication sFileFolderName Set pbWorkspaceMode of ghoApplication to False End Else If (bSWSFile = True) Begin Send UpdateWorkspaceSelectorDisplay of ghoApplication sFileFolderName Set pbWorkspaceMode of ghoApplication to True End Else If (bFolder = True) Begin Send AddItem of oFolders_grd sFileFolderName End End Else Begin Send Info_Box "Only one file, folder or .sws project can be dropped on the view at a time. The last will be used." End End_Procedure Object oView_IdleHandler is a cIdleHandler Set pbEnabled to True Procedure OnIdle String sSWSFile Get psSWSFile of ghoApplication to sSWSFile Set Enabled_State to (sSWSFile <> "") Send UpdateEnabledState of oFolders_grd End_Procedure End_Object Procedure ToggleActionButton Send KeyAction of oToggle_btn End_Procedure On_Key Key_Alt+Key_G Send ToggleActionButton On_Key Key_Ctrl+Key_G Send ToggleActionButton End_Object