//***************************************************************************************** // Copyright (c) 2000 Michael Kurz // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : cEditorEdit.Pkg // $ProjectName : CODEMAX EDITOR // $Author : Michael Kurz // $Created : 01-25-2001 @ 19:00 // // Contents: // Properties for Editor, stored in an INI file, based on cIniHandler. // // $Rev History // //***************************************************************************************** //TH-RevisionStart // 05.02.2003 13:38 Redesigned all Autosuggestion-Lists BP APBP // to new codelist control. Cleaned up // obsolete code // 07.02.2003 08:14 Implementen Character Translation BP APBP // for Keyboard Input // 18.04.2003 08:37 MarkScopeBlock: Marks the lines BP APBP // between ScopeStart/ScopeEnd blocks // with a thin line // 18.04.2003 08:39 RemoveRemarkFromLine, BP APBP // IsKeywordInLine are // helper functions for the // MarkScopeBlock feature // 27.06.2003 21:10 Get a free channel for insert headers WvA // 11.07.2004 Adds support for "Send Of WvA // 21.06.2005 10.00 Fixed Function isReasonForFieldList RRS // The ability to Popup FieldList wherever in line, rather then only last item //TH-RevisionEnd Use mFileTime.pkg // TimeStamp of a file Use ASDB_Ext.pkg // Access functions and constants for the ASDB db. Use cLineParser.Pkg // For Parsing VDF src code lines. Use cCPPDataConverter.Pkg // Used to convert a C Struct to a VDF TYPE-END_TYP Statement. Use cDllImportToVDF.pkg // Used to convert a C Dll call into a VDF format. Use cStructHandlerCreater.Pkg // Used to create easy handling code for VDF TYPEs Use cIndexListEx.Pkg // Abilities to read Indexes of a given file. Use Colr_Dlg.pkg // For selecting colors Use Seq_chnl.pkg // Sequential file access Use Strings.pkg Use cHtmlHelp.pkg Use FindFile.pkg Use vWin32fh.pkg Use cSourceFilesList.pkg Use cRefactorMethodExtract.pkg Use Tools\MethodExtract.dg Use Tools\TextEncoding.dg Global_Variable Boolean gbDisableParser Move False To gbDisableParser Define MK_LW_NO For 0 Define MK_LR_OBJECTS For 1 Define MK_LR_PROCEDURES For 2 Define MK_LR_CREATOR For 3 Define MK_LR_VARS For 4 Define MK_LR_KEYS For 5 Define MK_LR_FUNCTIONS For 6 Define MK_LR_SETPROCEDURES For 7 Define MK_LR_DATABASEFIELDS For 8 Define MK_LR_CLASSES For 9 Define MK_LR_INDEXES For 10 Define MK_LR_IDETAGS For 11 Define MK_LR_DATAFILES for 12 Define MK_LR_COMMANDS for 13 Define MK_LR_TYPES for 14 Define MK_LR_ATTRIBUTES For 15 Define MK_LR_SOURCEFILES For 16 Define MK_LR_METHODS For 17 Register_Function phoElements Returns Integer Register_procedure Define_EditorHotKeys // in cEditorEditView Class cPopupGridMixin Is a Mixin Procedure Define_cPopupGridMixin Property Integer piFoundColor (RGB(255,255,128)) Property Integer piNotFoundColor (RGB(230,230,230)) Set ItemIsFitting To True Set Highlight_Row_State To True Set Select_Mode To no_select Set Gridline_Mode To Grid_Visible_none Set Header_Visible_State To False End_Procedure Procedure Set ItemIsFitting Integer iFlag Integer iColor If iFlag Move (piFoundColor(Self)) To iColor Else Move (piNotFoundColor(Self)) To iColor Set Highlight_Row_Color To iColor Set Current_Item_Color To iColor Set Dynamic_Update_State To True End_Procedure Function ItemIsFitting Returns Integer Integer iColor Get Current_Item_Color To iColor Function_Return (iColor Eq piFoundColor(Self)) End_Function Procedure FitSizeToParent Set GuiSize To (Hi(Client_Size(Parent(Self)))) (Low(Client_Size(Parent(Self)))) Set Form_guiWidth Item 0 To (Low(Client_Size(Parent(Self)))-15) End_Procedure End_Class // Makes all characters of a string lowercase and the 1st Uppercase. Function UppercaseFirstLetter Global String sStr Returns String String sRet sChr Integer iPos iLen Move (Append(Uppercase(Left(sStr,1)),Lowercase(Right(sStr,Length(sStr)-1)))) To sRet For iPos From 1 To (Length(sRet)) If (Mid(sRet,1,iPos)="_") Begin Increment iPos Move (Uppercase(Mid(sRet,1,iPos))) To sChr Move (Overstrike(sChr,sRet,iPos)) To sRet End Loop Function_Return sRet End_Function //@RRS Normalizes Sentence Function UppercaseFirstLetterWords Global String sText Returns String Integer ix iPos String sRet sComments sWord Move (Pos(("/"+"/"),sText)) To iPos If (iPos) Begin Move (Right(sText,Length(sText)-iPos+1)) To sComments Move (Left(sText,iPos-1)) To sText End Move sText To sRet For ix From 1 To (HowManyWords(sText," ")) Move (ExtractWord(sText," ",ix)) To sWord Move (Replace(sWord,sRet,(UppercaseFirstLetter(sWord)))) To sRet Loop Move (sRet+sComments) To sRet Function_Return sRet End_Function // Reduces a reference for an Object. Function ReduceReference Global String sRef String sCurRef Returns String Integer hoID1 hoID2 iC iFrom iStart String sRet Object oLP1 Is a cLineParser Move Self To hoID1 Set psSepCharacter To "." End_Object Object oLP2 Is a cLineParser Move Self To hoID2 Set psSepCharacter To "." End_Object Send ParseLine To hoID1 (FlipStrLR(sRef)) Send ParseLine To hoID2 (FlipStrLR(sCurRef)) For iC From 0 To (Item_Count(hoID1)-1) If Not iStart If (Value(hoID1,iC)) Ne (Value(hoID2,iC)) Begin Move iC To iFrom Move 1 To iStart End If iStart Begin If sRet Ne "" Append sRet "." Append sRet (Value(hoID1,iC)) End Loop Send Request_Destroy_Object To hoID1 Send Request_Destroy_Object To hoID2 Move (FlipStrLR(sRet)) To sRet Function_Return sRet End_Function // Replaces a Part of a string in a string within a given Start and EndToken. Function RemovePartFromString Global String sVal String sStartPart String sEndPart Returns String Integer iPosStart iPosEnd String sPart Move (Pos(sStartPart,sVal)) To iPosStart Move (Right(sVal,Length(sVal)-iPosStart)) To sPart Move (Pos(sEndPart,sPart)) To iPosEnd If iPosStart Gt 0 If iPosEnd Gt iPosStart Begin Move (Remove(sVal,iPosStart,iPosEnd)) To sVal End Function_Return sVal End_Function // Replaces a Method out of an reference. Function ReplaceMethod Global Integer iType String sVal Returns String String sRet sSub Integer iEnde If iType Eq MK_Function Move "@F" To sSub Else If iType Eq MK_Procedure Move "@P" To sSub Else If iType Eq MK_SetProcedure Move "@S" To sSub Else Function_Return sVal Repeat Move (RemovePartFromString(sVal,sSub,".")) To sRet If sRet Eq sVal Move 1 To iEnde Else Move (Replace("..",sRet,".")) To sRet Move sRet To sVal Until (iEnde) Function_Return sVal End_Function // Replaces all Methods out of a Reference. Function ReplaceAllMethods Global String sVal Returns String If (Pos("@",sVal)<>0) Begin Move (ReplaceMethod(MK_Function ,sVal)) To sVal Move (ReplaceMethod(MK_Procedure ,sVal)) To sVal Move (ReplaceMethod(MK_SetProcedure ,sVal)) To sVal End Function_Return sVal End_Function // Converts a Ref like Object1.Object2 to (Object1(Object2(Self))) // If VdfVersion>7.2 then don't insert self for objects that are within // the current object scope. Function ReferenceToObject Global String sVal Returns String Number nVdfVersion Boolean bChanged Get fnCurrentVdfVersion of ghoWorkSpaceHandlerEx To nVdfVersion If (nVdfVersion<=72) Begin If sVal Eq "" Move "Self" To sVal Else Begin If (Right(Trim(sVal),1)) Eq "." Append sVal "Self" Else Append sVal "(Self)" While (sVal Contains ".") Move (Replace(".",sVal,"(")) To sVal Append sVal ")" End Move (Append("(",sVal)) To sVal Append sVal ")" End End Else Begin Move False To bChanged If sVal Eq "" Move "Self" To sVal Else Begin If (Right(Trim(sVal),1)) Eq "." Begin Append sVal "Self" Move True To bChanged End //Else Append sVal "(Self)" While (sVal Contains ".") Move (Replace(".",sVal,"(")) To sVal Append sVal ")" Move True To bChanged Loop If (bChanged) Begin Move (Append("(",sVal)) To sVal Append sVal ")" End End End Function_Return sVal End_Function Function ObjectToReference Global String sObjects Returns String Integer iPos Integer iLength String sRef String sChar String sTab Move "" To sRef Move (Character(9)) To sTab Move (Length(sObjects)) To iLength // first step is to rewrite to reference instead For iPos From 1 To iLength Move (Mid(sObjects,1,iPos)) To sChar If (sChar="(") Move "." To sChar If (sChar<>")" and sChar<>" " and sChar<>sTab) Begin Move (sRef+sChar) To sRef End Loop While (Pos("..",sRef)<>0) Move (Replace("..",sRef,".")) To sRef Loop If (Pos(".",sRef)=1) Move (Replace(".",sRef,"")) To sRef If (Right(Lowercase(sRef),5)=".self") Move (Left(sRef,Length(sRef)-5)) To sRef Function_Return sRef End_Function // This Grid allows a search on the items. // with more then the 1st character. Class cSearchAndControlGrid Is a Grid Import_Class_Protocol cPopupGridMixin Procedure Construct_Object Forward Send Construct_Object Property String psOffsetChar "" Property Integer piOffsetX 0 Property String psRef "" Property Integer piSearchState True Property String psSearchValue "" Property String psHeaderLabel0 "" Property Integer piMaxTextLen 0 // Added to support the FindGe Message with unsorted data (i.e. the index-list) // 2.5.2002 Bernhard Property Integer piIsSorted True Send Define_cPopupGridMixin Set autosize_height_state To False Set horz_scroll_bar_visible_state To False On_Key kEnter Send Mouse_Click On_Key KEY_TAB Send Mouse_Click On_Key KCANCEL Send CloseList End_Procedure // To allow selection with mouse dblClick Procedure mouse_click Integer iPara0 Integer iPara1 //If (Invoking_Object_ID(self)) Send Request_SimulateKey to (Invoking_Object_ID(self)) 0 VK_TAB "" //If (Invoking_Object_ID(self)) Send Activate to (Invoking_Object_ID(self)) End_Procedure Procedure CloseList //If (Invoking_Object_ID(self)) Send Request_SimulateKey to (Invoking_Object_ID(self)) 0 VK_RIGHT "" //If (Invoking_Object_ID(self)) Send Activate to (Invoking_Object_ID(self)) End_Procedure // Create a String with Blanks with an length of min. iL pixels. Function CreateStringWithLength Integer iL Returns String Integer iLS String sStr Repeat Move (Append(sStr," ")) To sStr Get Text_Extent sStr To iLS Move (Low(iLS)) To iLS Until (iLS>iL) Set piOffsetX To iLS Function_Return sStr End_Function // Sets an offset string. Procedure Set TextOffsetX Integer iX String sStr Move (CreateStringWithLength(Self,iX)) To sStr Set psOffSetChar To sStr End_Procedure // Delivers the current value in a format which can be inserted. Function CurrentValue Returns String Function_Return "" End_Function // Finds an entry. Procedure FindGE String sStr Returns Integer Integer iC iCur iL iStart String sVal If (Item_Count(Self)) Eq 0 Procedure_Return Get Current_Item To iCur Move (Trim(sStr)) To sStr Move (Uppercase(sStr)) To sStr Move (CString(sStr)) To sStr Get value Item iCur To sVal Move (LTrim(sVal)) To sVal Move (Uppercase(Value(Self,iC))) To sVal Move (Left(sVal,il)) To sVal If (Left(sStr,1)) Eq "(" Move (Replace("(",sStr,"")) To sStr Move (Replaces("(",sStr,".")) To sStr Move (Replaces(")",sStr,"")) To sStr Move (Length(sStr)) To iL For iC From iStart To (Item_Count(Self)-1) Move (LTrim(Uppercase(Value(Self,iC)))) To sVal If (Left(sVal,iL)) Eq sStr Begin Set ItemIsFitting To True Set Current_Item To iC Procedure_Return 1 // Delivers true if item is fittin! End // Don't cancel if the data is unsorted // 2.5.2002 Bernhard If ( (piIsSorted(Self)) And ( (Left(sVal,iL)) Gt sStr) ) Move (Item_Count(Self)) To iC Loop Set ItemIsFitting To False End_Procedure // Append the offset char. Procedure Add_Item Integer iMsg String sVal Integer iL Move (Append(psOffsetChar(Self),sVal)) To sVal Forward Send Add_Item iMsg sVal Get Text_Extent sVal To iL Move (Low(iL)) To iL If (iL > piMaxTextLen(Self)) Set piMaxTextLen To iL End_Procedure // Storing keys in the Header_Label Procedure AddKey Integer iKey String sValue sTmp Get psSearchValue To sValue Append sValue (Character(iKey)) Set psSearchValue To sValue Get psHeaderLabel0 To sTmp Append sTmp " - " sValue Send FindGE sValue Set Header_Label Item 0 To sTmp End_Procedure // Deleting keys from the Header_Label. Procedure RemoveKey String sValue sTmp Get psSearchValue To sValue Move (Left(sValue,Length(sValue)-1)) To sValue Set psSearchValue To sValue Get psHeaderLabel0 To sTmp Append sTmp " - " sValue Send FindGE sValue Set Header_Label Item 0 To sTmp End_Procedure Procedure ResetKey Set Header_Label Item 0 To (psHeaderLabel0(Self)) Set psSearchValue To "" End_Procedure // To reset the search text during close and reactivate. Procedure page_object Integer iMode Send ResetKey Forward Send page_object iMode End_Procedure Function isDisplayAbleKey Integer iKey Returns Integer If iKey Eq (Ascii("_")) Function_Return 1 If iKey Ge (Ascii("A")) If iKey Le (Ascii("Z")) Function_Return 1 If iKey Ge (Ascii("a")) If iKey Le (Ascii("z")) Function_Return 1 If iKey Ge (Ascii("0")) If iKey Le (Ascii("9")) Function_Return 1 End_Function Procedure Key Integer iKey Integer iTKey iFwd Move 1 To iFwd If (Focus(Desktop)) Eq Self Begin Move 0 To iFwd If (iKey Iand 1024) Move (iKey-1024) To iTKey Else Move iKey To iTKey If (isDisplayAbleKey(Self,iTKey)) Send AddKey iKey Else If iKey Eq KEY_BACK_SPACE Send RemoveKey Else Move 1 To iFwd End If iFwd Begin Send ResetKey If iKey Eq (Key_Ctrl+Key_Home) Set Current_Item To 0 Else If iKey Eq (Key_Ctrl+Key_End ) Set Current_Item To (Item_Count(Self)-1) Else Forward Send Key iKey End Set ItemIsFitting To True End_Procedure // Sends a message to the parent without causing an error if not known. Procedure TryToSendMessage2Parent Integer iMsg Integer iP1 Integer iP2 Integer iDel Get Delegation_Mode Of (Parent(Self)) To iDel Set Delegation_Mode Of (Parent(Self)) To No_Delegate_Or_Error Send iMsg To (Parent(Self)) iP1 iP2 Set Delegation_Mode Of (Parent(Self)) To iDel End_Procedure Procedure End_Construct_Object Set psHeaderLabel0 To (Header_Label(Self,0)) Forward Send End_Construct_Object End_Procedure End_Class // Grid with objects. Class cObjectList Is a cSearchAndControlGrid Procedure Construct_Object Forward Send Construct_Object Property tParseObject[] pOwnedParseObjects Property Integer piAddExtElementsState False End_Procedure // Delivers the current value in a format which can be inserted. Function CurrentValue Returns String String sVal Integer isVar Integer iItem tParseObject[] OwnedParseObjects If Not (ItemIsFitting(Self)) Function_Return "" Get pOwnedParseObjects To OwnedParseObjects If (SizeOfArray(OwnedParseObjects)>0) Begin Get Current_Item To iItem If (OwnedParseObjects[iItem].pElement = MK_VARIABLE) Move 1 To isVar End Get Value To sVal If isVar Function_Return (Trim(sVal)) Move (LTrim(sVal)) To sVal Move (ReduceReference(sVal,psRef(Self))) To sVal Move (ReferenceToObject(sVal)) To sVal Function_Return sVal End_Function // Fills the list from an Object 2D Array. Procedure FillList Integer hoParser Integer iLine String sRef Integer hoIDVarsE Integer iC iItem iTextMaxX iTextX iDel iCur Integer iObjCount Integer iVarType String sObj sCls sVarName tParseObject[] ParseObjects tParseObject[] OwnedParseObjects tParseParam[] ParseParams tParseVar[] ParseVars Get pOwnedParseObjects To OwnedParseObjects If (SizeOfArray(OwnedParseObjects)>0) Begin Move (ResizeArray(OwnedParseObjects,0)) To OwnedParseObjects Set pOwnedParseObjects To OwnedParseObjects End Get pParseObjects of hoParser To ParseObjects If (piAddExtElementsState(Self)) Begin Move "Desktop" To ParseObjects[SizeOfArray(ParseObjects)].sObject // Add "Desktop" //____Add_Variables_to_Object_List...______________ Get GetVariablenListFromLine Of hoParser iLine To ParseVars // Variables For iC From 0 To (SizeOfArray(ParseVars)-1) Move ParseVars[iItem].sName To sVarName Move ParseVars[iItem].iType To iVarType If ((iVarType Eq MK_INTEGER) Or (iVarType Eq MK_HANDLE)) If (Left(Uppercase(sVarName),2)) Eq "HO" Begin Move sVarName To ParseObjects[SizeOfArray(ParseObjects)].sObject End Loop //____Add_Parameters_to_Object_List...______________ Get GetParameterListFromLine Of hoParser iLine To ParseParams // Parameters For iC From 0 To (SizeOfArray(ParseParams)-1) Move ParseParams[iC].sName To sVarName Move ParseParams[iC].iType To iVarType If ((iVarType Eq MK_INTEGER) Or (iVarType Eq MK_HANDLE)) If (Left(Uppercase(sVarName),2)) Eq "HO" Begin Move sVarName To ParseObjects[SizeOfArray(ParseObjects)].sObject End Loop End Set pOwnedParseObjects To ParseObjects Set psRef To sRef Set piMaxTextLen To 0 Move (SizeOfArray(ParseObjects)) To iObjCount If (iObjCount>0) Begin If (piOffsetX(Self)) Eq 0 Set TextOffsetX To 16 If (iObjCount=0) Procedure_Return 1 Move (SortArray(ParseObjects)) To ParseObjects Send Delete_Data For iC from 0 To (iObjCount-1) Move ParseObjects[iC].sObject To sObj Move ParseObjects[iC].sClass To sCls Get Text_Extent (sObj+psOffsetChar(Self)) To iTextX Move (Low(iTextX)) To iTextX If iTextX Gt iTextMaxX Move iTextX To iTextMaxX Get ReplaceAllMethods sObj To sObj // Remove Procedures and Functions Send add_item msg_none sObj Set entry_state Item (Item_Count(Self)-1) To False Set Form_Bitmap Item iC To (ClassBitmaps(desktop,sCls,MK_CLASS)) If (Trim(sObj)) Eq sRef Move iC To iCur Loop End Set Current_Item To iCur End_Procedure End_Class Define MK_PROC_NONE For 0 Define MK_PROC_PROCEDURE For 1 Define MK_PROC_FUNCTION For 2 Define MK_PROC_BEGIN For 3 Define MK_PROC_WHILE For 4 Define MK_PROC_REPEAT For 5 // Shall Insert multiline revision marks. Class cPrintStack Is a cLineParser Procedure construct_object Forward Send Construct_Object Set psSepCharacter To "\n" End_Procedure Procedure PushItem String sWert Set value Item (item_count(Self)) To sWert End_Procedure Function PullItem Returns String String sRet Get value Item 0 To sRet Send Delete_Item 0 Function_Return sRet End_Function // Delivers a sub string from the left side at a specific // length, but tries to cut only at blanks. Function LeftWithWholeWord String sStr Integer iL Returns String Integer iLAlt String sHilf If (Length(Trim(sStr))) Le iL Function_Return (Trim(sStr)) Move iL To iLAlt Move (Left(sStr,iL)) To sHilf While (((Right(sHilf,1)) Ne " ") And (iL Gt 10)) Move (iL-1) To iL Move (Left(sStr,iL)) To sHilf End If iL Le 10 Move (Left(sStr,iLAlt)) To sHilf Function_Return sHilf End_Function // Should break the lines on the length of the given mask. Procedure AutoLineBreak Integer iL Integer iC hoTmp iC2 String sVal sSub Object oTmpArray Is an Array Move Self To hoTmp End_Object For iC From 0 To (Item_Count(Self)-1) Get value Item iC To sVal While (Length(sVal) Gt iL) Move (LeftWithWholeWord(Self,sVal,iL)) To sSub Move (Replace(sSub,sVal,"")) To sVal Set value Of hoTmp Item iC2 To sSub Increment iC2 End Set value Of hoTmp Item iC2 To sVal Increment iC2 Loop Send Delete_Data For iC From 0 To (Item_Count(hoTmp)-1) Set value Item iC To (Value(hoTmp,iC)) Loop Send Request_Destroy_Object To hoTmp End_Procedure // Fills all lines from the given line. Procedure FillFromLine String sLine Integer iLE String sPart Integer iL iDidIt Send ParseLine sLine // Parses the Line If NUM_Arguments Gt 1 Move iLe To iL If iL Gt 0 Begin Send AutoLineBreak iL End End_Procedure Procedure RunUntilReady Integer iZielID Integer iSektion Integer iCount If Not iZielID Procedure_Return While (Item_Count(Self) Gt 0) Get Item_Count To iCount //Send OUTPUT_Sektion To iZielID iSektion //If (Item_Count(Self)) Ge iCount Procedure_Return End End_Procedure End_Class // To Handle the Revision masks and create the necc. inserting strings. Class cRevisionMaskHandler Is an Array Procedure Construct_Object Forward Send Construct_Object Property String psMaskLine "" Object oMaskElements Is a cLineParser Set psSepCharacter To " " End_Object Object oDataElements Is a cLineParser Set psSepCharacter To " " End_Object Object oPrintStack Is a cPrintStack End_Object End_Procedure // Loads a Revsion mask from a file. Function LoadRevisionMaskFromFile String sFile Returns Integer String sLine sMask sData Direct_Input sFile If (seqeof) Function_Return False Repeat Readln sLine If (Uppercase(Trim(sLine))) Eq ("/"+"/TH-REVISIONSTART") Begin Readln sMask Readln sData Send FillMask sMask sData Close_Input Function_Return 1 End Until (seqeof) Close_Input Function_Return 0 End_Function // Tries 1st to load the mask from the userlocal .TPL and the from the global. Procedure LoadRevisionMask If (LoadRevisionMaskFromFile(Self,("Header"+gsUserName+".tpl"))) Procedure_Return 1 If (LoadRevisionMaskFromFile(Self,("Header.tpl"))) Procedure_Return 1 End_Procedure // Fills the Revisionmask. Procedure FillMask String sMask String sData Set psMaskLine To sMask Send ParseLine To oMaskElements sMask Send ParseLine To oDataElements sData End_Procedure // Creates the Data from the Function EvalData String sData String sMask String sTxt Returns String Integer iDescLen String sDY sDM sDD sTH sTM sTS sTHUSER Date dToday If sData Eq "@DESCRIPTION@" Begin Move (Length(sMask)) To iDescLen Send FillFromLine To oPrintStack sTxt iDescLen Get value Of oPrintStack Item 0 To sTxt Function_Return sTxt End If sData Eq "@USERNAME@" Function_Return gsUserName If sData Eq "@COMPUTERNAME@" Function_Return gsComputerName // Date parts. Sysdate dToday sTH sTM sTS Move (DateGetDay(dToday)) to sDD Move (DateGetMonth(dToday)) to sDM Move (DateGetYear(dToday)) to sDY Move (Right("00"+sDD,2)) to sDD Move (Right("00"+sDM,2)) to sDM Move (Replaces("@DD@" ,sData,sDD)) To sData // Day Move (Replaces("@DM@" ,sData,sDM)) To sData // Month Move (Replaces("@DY@" ,sData,sDY)) To sData // Year // Time parts. Move (Right("0"+sTH,2)) To sTH Move (Right("0"+sTM,2)) To sTM Move (Right("0"+sTS,2)) To sTS Move (Replaces("@TH@" ,sData,sTH)) To sData // Hour Move (Replaces("@TM@" ,sData,sTM)) To sData // Minute Move (Replaces("@TS@" ,sData,sTH)) To sData // Second //@ Custom Data If sData Eq "@ISSUE@" Get psIssue of oAddRevisionEntryPanel to sData //@ RRS If sData Eq "@THUSER@" Get psUserName of oAddRevisionEntryPanel to sData //@ RRS Function_Return sData End_Function // Formats a string to a specific length with an alignment Function FormatString String sStr Integer iL Integer iMode Returns String If iMode Begin // Right aligned Move (Right( (Repeat(" ",iL)+(RTrim(sStr))),iL)) To sStr End Else Begin // Leftaligned Move (Left( ((LTrim(sStr)+Repeat(" ",iL))),iL)) To sStr End Function_Return sStr End_Function // Should create the Line to Insert. Function CreateMaskedValue String sTxt Returns String String sMask sData sMaskLine s2ndLine sMaskDesc Integer iC iRight iDescLen Get psMaskLine To sMaskLine Move sMaskLine to s2ndLine For iC From 0 To (Item_Count(oMaskElements(Self))-1) Get value Of oMaskElements Item iC To sMask If sMask Eq ("/"+"/") Increment iC Get value of oMaskElements item iC to sMask If (Pos('_', sMask)) Begin Get value of oDataElements item iC to sData // its the name of the value If sData Eq "@DESCRIPTION@" Begin Move (Repeat("X",Length(sMask))) to sMaskDesc Move (Replace(sMask,s2ndLine,Repeat("X",Length(sMask)))) to s2ndLine End Else Move (Replace(sMask,s2ndLine,Repeat(" ",Length(sMask)))) to s2ndLine Move (EvalData(Self,sData,sMask,sTxt)) to sData // Not its the real value If "." In sMask Move 1 to iRight // Align it right Else Move 0 to iRight // Align it left Move (FormatString(Self,sData,Length(sMask),iRight)) to sData // Not the DataString is formated! Move (Replace(sMask,sMaskLine,sData)) to sMaskLine // Now the Data is inserted into the Line! End // Mask, not a text (eg. "by __________") Loop For iC From 1 To (Item_Count(oPrintStack(Self))-1) Get value Of oPrintStack Item iC To sData If "." In sMaskDesc Move 1 To iRight // Align it right Else Move 0 To iRight // Align it left Move (FormatString(Self,sData,Length(sMaskDesc),iRight)) To sData // Not the DataString is formated! Append sMaskLine "\n" (Replace(sMaskDesc,s2ndLine,sData)) Loop Function_Return sMaskLine End_Function //@ RRS Returns MaskElement Data Length // Works out the form lengths for oAddRevisionEntryPanel, namely, the Issue and username within the "InsertRevision" Function DataMaskedValueLen String sRevData Returns Integer String sMask sData sMaskLine s2ndLine sMaskDesc Integer iC iRight iDescLen iMax Get psMaskLine to sMaskLine Move sMaskLine to s2ndLine Move (Item_Count(oMaskElements(Self))-1) to iMax For iC from 0 to iMax Get value of oMaskElements item iC to sMask If sMask Eq ("/"+"/") Increment iC Get value of oMaskElements item iC to sMask If (Pos('_', sMask)) Begin Get value of oDataElements item iC to sData // its the name of the value If sData Eq sRevData Begin Move (Length(sMask)) to iDescLen Move iMax to iC End End // Mask, not a text (eg. "by __________") Loop Function_Return iDescLen End_Function End_Class // Delivers the WindowText of a Function EditWindowText For Desktop Integer iEditID Returns String Integer iTextLen iRetval Handle hWnd String sFullText Get Window_Handle Of iEditID To hWnd If (hWnd <> 0) Begin Move (SendMessage (hWnd, WM_GETTEXTLENGTH, 0, 0)) To iTextLen If (iTextLen <> 0) Begin Increment iTextLen Move (ZeroString(iTextLen)) To sFullText Move (SendMessage (hWnd, WM_GETTEXT, iTextLen, AddressOf(sFullText))) To iRetval End End Function_Return sFullText End_Function // EditWindowText Use Tools\AddRevisionEntry.dg Class cEditExtentionsMixin Is a Mixin Procedure Define_cEditExtentionsMixin Integer hoID Property Integer phoParser hoID Property Integer piInListCol 0 Property Integer piInListLine 0 Property Integer piOnce 0 Property Integer piBeginLineMarked 0 Property Integer piEndLineMarked 0 Object oLineParser Is a cLineParser // USed to Parse some lines. End_Object Object oItems Is a Set End_Object Object oItemHandles Is an Array End_Object Object oItemsTouched Is an Array End_Object Object oUsedFiles Is a Set End_Object // Used to show the fields of a DataFile, by reading the *.FD file. Object oFDFileReader Is a cFDFileReader Set piSortMode To ascending // Sort for searching during type. //Set piNormalizeEntries To True // Normalize entry instead of all Uppercase. End_Object // Used to show all available Indexes for a special file Object oIndexReader Is a cIndexListEx Set pbFillIndexString To True // Use the Interface needed for the Hammer. End_Object End_Procedure // Used to access the general LineParser Object oLineParser Function ParseLineTmp String sSepCharacter Integer iSkipEmptyParts String sLine Returns Integer Integer hoID Move (oLineParser(Self)) To hoID Send Init To hoID sSepCharacter iSkipEmptyParts Send ParseLine To hoID sLine Function_Return hoID End_Function // Toggle comments. // The logic checks if there is a comment for the first 2 characters at the first // line, if there is.. it will try to remove the comments // if there is not, then it will insert comments -in the first two positions- for // all selected lines. Procedure ToggleComment Boolean bAddComments Integer iStart iEnd iLine iRet iEndCol iStartCol iCurrLine String sVal sChk Append sChk "//" Get CM_GetSel False To iRet Get piSelEndCol To iEndCol Get piSelStartCol To iStartCol Get piSelStartLine To iStart Get piSelEndLine To iEnd Move iEnd To iCurrLine // Is selection at end line column 1? Don't include that line... If (iStart<>iEnd) Begin If (iEndCol=0) Decrement iEnd End // // Check the first line to see if we are going to add or remove comments Move False To bAddComments Get value Item iStart To sVal If (Left(sVal,2) <> sChk) Begin Move True to bAddComments End // Run all lines and toggle the comment mark. Send EditorMessage SCI_BEGINUNDOACTION For iLine From iStart To iEnd Get value Item iLine To sVal If (bAddComments) Begin Move (Append(sChk,sVal)) To sVal End Else Begin If (Left(sVal,2) = sChk) Move (Replace(sChk,sVal,"")) To sVal End Set value Item iLine To sVal Loop Send EditorMessage SCI_ENDUNDOACTION // Keep the selection Move (CM_SetSel(Self,iStart,iStartCol,iCurrLine,iEndCol,False)) To iRet End_Procedure // // Remove end-of-line whitespace in the entire edit buffer. // This will temporarily set the normalizecase to off as otherwise // your entire text would end up normalized and not just the lines changed. // (Actually the "temp disable normalize case" might not have any effect as it // looks like all text is changed anyways if that's on) // // The reason for this code is not so much the feature as well as this is the // default behavior of the Studio editor nowadays and it is a good time saver // in source control if text edited by either one have little differences // (eg. editing with the studio tends to trigger loads of whitespace differences) // Procedure BufferTextRTrim Integer iLine iRet Integer iCount Integer iCaseEnabled String sLine sRTLine Move (CM_IsNormalizeCaseEnabled(Self)) To iCaseEnabled If (iCaseEnabled) Begin Get CM_EnableNormalizeCase False To iRet End Get Item_Count To iCount If (iCount>0) Begin Decrement iCount For iLine From 0 To iCount Get value Item iLine To sLine Move (CString(sLine)) To sLine Move (RTrim(sLine)) To sRTLine If (sRTLine<>"" and length(sRTLine)<>Length(sLine)) Begin // only change if not indented white text line only // and if has whitespace at the end of the line. Set Value Item iLine To sRTLine End Loop End If (iCaseEnabled) Begin // Reset the normalize case feature to the orginal value. Get CM_EnableNormalizeCase iCaseEnabled To iCaseEnabled End End_Procedure // BufferTextRTrim // Converts a On_item "" Block to send Add_Item // Or if a block of send Add_Item converts it to on_item statements. Procedure Toggle_OnItem_AddItem Integer iStart iEnd iLine iRet iCol iCurrLine iPos hoParser iIndent iLen String sVal sCmt sChk sTmp sMsg Append sChk "/" "/" Get CM_GetSel False To iRet Get piSelEndCol To iCol Get piSelStartLine To iStart Get piSelEndLine To iEnd Move iEnd To iCurrLine // Is the selection Is done From bottom To top, exchange the Values. If (iStart Gt iEnd) Begin Move iStart To iLine Move iEnd To iStart Move iLine To iEnd End Object oTmpParser Is a cLineParser Set psSepCharacter To " " Set piSkipEmptyParts To True Move Self To hoParser End_Object // Run all lines and toggle the comment mark. For iLine From iStart To iEnd Get value Item iLine To sVal Move (Length(sVal)-Length(LTrim(sVal))) To iIndent Move (Pos(sChk,sVal)) To iPos Move "" To sCmt If iPos Gt 0 Begin Move (Right(sVal,Length(sVal)-iPos)) To sCmt Move (Left(sVal,iPos-1)) To sVal End Send ParseLine To hoParser sVal If (Uppercase(Value(hoParser,0))) Eq "SEND" If (Uppercase(Value(hoParser,1))) Eq "ADD_ITEM" Begin Move "" To sTmp Append sTmp (Repeat(" ",iIndent)) Append sTmp "On_Item " Get value Of hoParser Item 2 To sMsg Append sTmp (Value(hoParser,3)) " Send " (Right(sMsg,Length(sMsg)-4)) " " sCmt Set Value Item iLine To sTmp End If (Uppercase(Value(hoParser,0))) Eq "ON_ITEM" Begin // 0 1 2 3 4 5 // On_Item "Name" Send Message To Object Move "" To sTmp Append sTmp (Repeat(" ",iIndent)) Append sTmp "Send Add_Item " Append sTmp "Msg_" (Value(hoParser,3)) " " (Value(hoParser,1)) " " sCmt Set Value Item iLine To sTmp If (Uppercase(Value(hoParser,4))) Eq "TO" Begin Move (Length(sTmp)) To iLen Move "" To sTmp Append sTmp (Character(13)) (Character(10)) (Repeat(" ",iIndent)) "Set aux_value item (Item_Count(Self)-1) to " Append sTmp (Value(hoParser,5)) Move (CM_InsertText(Self,sTmp,iLine,iLen)) To iRet Increment iEnd Increment iLine End End Loop // Reset the position, line and col. Move (CM_SetSel(Self,iCurrLine,iCol,iCurrLine,iCol,False)) To iRet Send request_destroy_object To hoParser End_Procedure // 18.04.2003 08:39 RemoveRemarkFromLine, BP APBP // IsKeywordInLine are // helper functions for the // MarkScopeBlock feature Function RemoveRemarkFromLine String sLine Returns String Move (Replaces(Character(9),sLine,"")) To sLine If (Pos(("/"+"/"),sLine)) Ne 0 Move (Left(sLine,((Pos(("/"+"/"),sLine)) -1))) To sLine Function_Return ( " " + (uppercase(Trim(sLine))) + " ") End_Function // helper function for MarkScopeBlock, when a keyword is found in a string declaration // it will skew the scope block marking, so remove all strings Function RemoveStringsFromLine String sLine Returns String Integer iLength Integer iPos Boolean bSep1 Boolean bSep2 String sChar String sSep1 String sSep2 String sReturn Move "'" To sSep1 Move '"' To sSep2 Move "" To sReturn Move false To bSep1 Move false To bSep2 Move (length(sLine)) To iLength For iPos From 1 To iLength Move (Mid(sLine,1,iPos)) To sChar If (bSep1=false and bSep2=false) Begin If (sChar=sSep1) Move True to bSep1 Else If (sChar=sSep2) Move True To bSep2 If (bSep1=false and bSep2=false) Move (sReturn+sChar) To sReturn End Else Begin If (bSep1) Begin If (sChar=sSep1) Move false To bSep1 End Else If (bSep2) Begin If (sChar=sSep2) Move false To bSep2 End End Loop Function_Return sReturn End_Function // RemoveStringsFromLine Function IsKeywordInLine String sKeywords String sLine String sLanguage Returns String String sKeyword Get RemoveRemarkFromLine sLine To sLine Get RemoveStringsFromLine sLine To sLine While sKeywords Ne "" Move (Left(sKeywords,(Pos("|",sKeywords)))) To sKeyword Move (Replace(sKeyword,sKeywords,"")) To sKeywords Move (uppercase(Trim(Replace("|",sKeyword,"")))) To sKeyword If ( (sLanguage Eq "VDF") And (sKeyword Eq "FOR") ) Begin // Handle VDF For in a special way If (Left(sLine,5)) Eq " FOR " Function_Return sKeyword End Else If ( (sKeyword<>"") And ((Pos((" " + sKeyword + " "),sLine))<>0) ) Function_Return sKeyword Loop Function_Return "" End_Function // 18.04.2003 08:37 MarkScopeBlock: Marks the lines BP APBP // between ScopeStart/ScopeEnd blocks // with a thin line Procedure MarkScopeBlock Integer iRet iEndLine iCurLine iFound iLine iStartLine iDepth iLanguage String sLine sLanguage sScopeStartKeywords sScopeEndKeywords Get psLanguage Of ghoEditorProperties To sLanguage If (Trim(sLanguage)) Eq "" Procedure_Return Get FindLanguage Of ghoEditorProperties sLanguage To iLanguage If (iLanguage < 0) Procedure_Return Send cursor_wait To cursor_control Move (psLanguages.szScopeKeywords1(ghoEditorProperties,iLanguage)) To sScopeStartKeywords Move (psLanguages.szScopeKeywords2(ghoEditorProperties,iLanguage)) To sScopeEndKeywords Move ("|" + (Trim(Replaces("\n",sScopeStartKeywords,"|"))) + "|") To sScopeStartKeywords Move ("|" + (Trim(Replaces("\n",sScopeEndKeywords,"|"))) + "|") To sScopeEndKeywords If (piBeginLineMarked(Self)) Ne 0 Begin Get CM_GetDivider (piBeginLineMarked(Self)) To iRet If (Not(iRet)) Begin For iLine From 0 To (SC_LineCount(Self)) Get CM_SetDivider iLine FALSE To iRet Loop Set piEndLineMarked To 0 End Else Get CM_SetDivider (piBeginLineMarked(Self)) FALSE To iRet Set piBeginLineMarked To 0 End If (piEndLineMarked(Self)) Ne 0 Begin Get CM_GetDivider (piEndLineMarked(Self)) To iRet If (Not(iRet)) Begin For iLine From 0 To (SC_LineCount(Self)) Get CM_SetDivider iLine FALSE To iRet Loop End Else Get CM_SetDivider (piEndLineMarked(Self)) FALSE To iRet Set piEndLineMarked To 0 End Get CM_GetSel True To iRet Get piSelEndLine To iCurLine Move iCurLine To iLine Move -1 To iEndLine Move 0 To iFound Move 0 To iDepth While (iFound Eq 0) Get value Item iLine To sLine If (IsKeywordInLine(Self,sScopeStartKeywords,sLine,sLanguage)) Ne "" Begin If iLine Ne iCurLine Increment iDepth End Else If (IsKeywordInLine(Self,sScopeEndKeywords,sLine,sLanguage)) Ne "" Begin If iDepth Le 0 Begin Move 1 To iFound Move iLine To iEndLine End Else Decrement iDepth End Increment iLine If iLine Gt (SC_LineCount(Self)) Move 1 To iFound End If iEndLine Ne -1 Begin Move iCurLine To iLine Move -1 To iStartLine Move 0 To iFound Move 0 To iDepth While (iFound Eq 0) Get value Item iLine To sLine If (IsKeywordInLine(Self,sScopeEndKeywords,sLine,sLanguage)) Ne "" Begin If iLine Ne iCurLine Increment iDepth End Else If (IsKeywordInLine(Self,sScopeStartKeywords,sLine,sLanguage)) Ne "" Begin If iDepth Le 0 Begin Move 1 To iFound Move iLine To iStartLine End Else Decrement iDepth End Decrement iLine If iLine Lt 0 Move 1 To iFound End If iStartLine Ne -1 Begin Get CM_SetDivider (iStartLine -1) TRUE To iRet Get CM_SetDivider iEndLine TRUE To iRet Set piBeginLineMarked To (iStartLine -1) Set piEndLineMarked To iEndLine End End Send cursor_ready To cursor_control End_Procedure // Converts a Selected C Struct to a VDF Type. Procedure ConvertVDFTypeToHandler Integer hoID iStart iEnd iLine iRet String sLine sRet Get CM_GetSel False To iRet Get piSelStartLine To iStart Get piSelEndLine To iEnd // Is the selection Is done From bottom To top, exchange the Values. If (iStart Gt iEnd) Begin Move iStart To iLine Move iEnd To iStart Move iLine To iEnd End Object oStructHandlerCreater Is a cStructHandlerCreater Move Self To hoID End_Object // Fill... For iLine From iStart To iEnd Get value Item iLine To sLine Send AddItem To hoID sLine Loop Get CreateCode Of hoID To sRet Move (CM_InsertText(Self,sRet,iEnd+1,0)) To iRet End_Procedure // Converts a C DLLImport declaration into a VDF format. Procedure ConvertCDllCallToVDF String sLine sLineNew Integer iLine iRet Get Current_Item To iLine Get value Item iLine To sLine // Should delive the current line. Move (gfsConvertCDllCallToVDF(sLine)) To sLineNew Move ("/"+"/"+sLine) To sLine Set value To sLine Append sLineNew (Character(13)) (Character(10)) Move (CM_InsertText(Self,sLineNew,iLine,0)) To iRet End_Procedure // Converts a Selected C Struct to a VDF Type. Procedure ConvertCStructToVDF Integer hoID iStart iEnd iLine iRet String sLine Get CM_GetSel False To iRet Get piSelStartLine To iStart Get piSelEndLine To iEnd // Is the selection Is done From bottom To top, exchange the Values. If (iStart Gt iEnd) Begin Move iStart To iLine Move iEnd To iStart Move iLine To iEnd End Object oCPPDataConverter Is a cCPPDataConverter Move Self To hoID End_Object // Fill the cCPPDataConverter For iLine From iStart To iEnd Get value Item iLine To sLine Send AddItem To hoID sLine Loop // Convert the contents. Send Convert To hoID // And insert it again into the Edit. For iLine From 0 To (Item_Count(hoID)-1) Get value Of hoID Item iLine To sLine Set Value Item (iLine+iStart) To sLine Loop End_Procedure // Fills in the Info of the Element in the given Line. // With iType you can force an ElementType // eg.: (MK_OBJECT+MK_CLASS) only Object or class are filled, if the current is // a Procedure it tries to find the parent element until the forced type is sathiesfied. Function GetElementFromLine Integer iType Integer iLine Returns Integer Integer iRet Get LineToItemEx Of (phoParser(Self)) iType iLine To iRet Function_Return iRet End_Function // Fills in the Info of the Element in the currentLine // With iType you can force an ElementType // eg.: (MK_OBJECT+MK_CLASS) only Object or class are filled, if the current is // a Procedure it tries to find the parent element until the forced type is sathiesfied. Function GetCurrentElement Integer iType Returns Integer Integer iRet Get CM_GetSel False To iRet If iRet Begin Get LineToItemEx Of (phoParser(Self)) iType (piSelEndLine(Self)) To iRet Function_Return iRet End Function_Return 0 End_Function // Delivers the reference of the current element. // Like: ProcedureXXX.ObjectXX.ParentObjectXX Function GetCurrentRef Returns String String sRef If (GetCurrentElement(Self,MK_OBJECT)) Get psCEl_psRef Of (phoParser(Self)) To sRef Function_Return sRef End_Function // Delivers the Reference from the given Line (only object) Function GetRefFromLine Integer iLine Returns String String sRef If (GetElementFromLine(Self,MK_Object,iLine)) Get psCEl_psRef Of (phoParser(Self)) To sRef Function_Return sRef End_Function Function GetCurrentRefComplete Returns String String sRef If (GetCurrentElement(Self,0)) Get psCEl_psRef Of (phoParser(Self)) To sRef Function_Return sRef End_Function Procedure ShowLanguageList Integer iFlag Integer iMode Boolean bCanParse Integer iRet hoParser iLine hoID hoListObject iCmd String sRef sLine sTest Pointer pTest Get CanParseCurrentLanguage To bCanParse Get phoParser To hoParser If (iFlag<>0 and bCanParse) Begin Move (GetCurrentRefComplete(Self)) To sRef // No matter which type. Get ReplaceAllMethods sRef To sRef // Remove Procedures and Functions Send FillCurrentPosition // Retrieve the Absolute Position of the cursor Get CM_GetSel False To iRet // Retrieve Line and Column in the Edit. Set piInListCol To (piSelEndCol(Self)) // and Set piInListLine To (piSelEndLine(Self)) // save them. Move (piSelEndLine(Self)) To iLine // If there was a code list active before this one and the user typed out the full selection then // that will cancel out the popup list, but not reset this property. // If we're here it should be false! Manually cancel the list if needed. If (pbIsCodelistActive(Self)) Begin Send DoCodeListCancel End Get phoCodelisthandler To hoListObject Case Begin Case (iMode Eq MK_LR_OBJECTS) Set piListReason Of hoListObject To MK_LR_OBJECTS Set piSourceObject Of hoListObject To hoParser Set piSourceLine Of hoListObject To iLine Set psSourceRefVal Of hoListObject To sRef Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_VARS) Set piListReason Of hoListObject To MK_LR_VARS Set piSourceObject Of hoListObject To hoParser Set piSourceLine Of hoListObject To iLine Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_KEYS) Set piListReason Of hoListObject To MK_LR_KEYS Set piSourceObject Of hoListObject To (oKeysArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_IDETAGS) Set piListReason Of hoListObject To MK_LR_IDETAGS Set piSourceObject Of hoListObject To (oIDETagsArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_COMMANDS) Set piListReason of hoListObject to MK_LR_COMMANDS Set piSourceObject of hoListObject to (oCommandsArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 to iCmd Case Break Case (iMode Eq MK_LR_TYPES) Set piListReason of hoListObject to MK_LR_TYPES Set piSourceObject of hoListObject to (oTypesArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 to iCmd Case Break Case (iMode Eq MK_LR_ATTRIBUTES) Set piListReason of hoListObject to MK_LR_ATTRIBUTES Set piSourceObject of hoListObject to (oAttrArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 to iCmd Case Break Case (iMode Eq MK_LR_PROCEDURES) Set piListReason Of hoListObject To MK_LR_PROCEDURES Set piSourceObject Of hoListObject To hoParser Set piSourceLine Of hoListObject To iLine Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_FUNCTIONS) Set piListReason Of hoListObject To MK_LR_FUNCTIONS Set piSourceObject Of hoListObject To hoParser Set piSourceLine Of hoListObject To iLine Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_DATABASEFIELDS) Set piListReason Of hoListObject To MK_LR_DATABASEFIELDS Set piSourceObject Of hoListObject To (oFDFileReader(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_CLASSES) Get Value To sLine Set piListReason Of hoListObject To MK_LR_CLASSES Set psSourceLine Of hoListObject To sLine Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode = MK_LR_DATAFILES) Set piListReason of hoListObject to MK_LR_DATAFILES Set piSourceObject of hoListObject to (oDataFilesArray(Self)) Send Fill to (oDataFilesArray(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 to iCmd Case Break Case (iMode Eq MK_LR_INDEXES) Set piListReason Of hoListObject To MK_LR_INDEXES Set piSourceObject Of hoListObject To (fhoIndexArray(oIndexReader(Self))) Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case break Case (iMode Eq MK_LR_SOURCEFILES) Set piListReason Of hoListObject To MK_LR_SOURCEFILES Set piSourceObject Of hoListObject To (oSourceFilesList(Self)) Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case Break Case (iMode Eq MK_LR_METHODS) Get Value To sLine Set piListReason Of hoListObject To MK_LR_METHODS Set piSourceObject Of hoListObject To hoParser Set piSourceLine Of hoListObject To iLine Set psSourceLine Of hoListObject To sLine Get CM_ExecuteCmd CMD_CODELIST 0 To iCmd Case Break Case End End End_Procedure Function isReasonForCommandList Integer iLastKey String sLine Returns Integer If (not(pbShowCommands(ghoEditorProperties))) Function_Return 0 Integer iLine iRet Move (Uppercase(Trim(sLine))) To sLine If (iLastKey <> VK_Space) Begin If ((sLine<>"")and(Left(sLine,1)<>"/")and(Pos(' ', sLine)=0)and(Length(sLine)=1)) Begin Function_Return 1 End End Function_Return 0 End_Function Function isReasonForDataFileList Integer iLastKey String sLine Returns Integer If (not(pbShowCommands(ghoEditorProperties))) Function_Return 0 String sCmd Handle hoLine Move (Trim(Uppercase(sLine))) to sLine If (iLastKey = VK_Space) Begin Get ParseLineTmp " " True sLine to hoLine Get Value of hoLine item 0 to sCmd If (("OPEN"=sCmd) or ("CLOSE"=sCmd) or ("REREAD"=sCmd) or ("CLEAR"=sCmd) or ; ("SAVE"=sCmd) or ("SAVERECORD"=sCmd) or ("DELETE"=sCmd) or ; ("RELATE"=sCmd) or ("ATTACH"=sCmd)) Function_Return 1 If ((sCmd = "FIND") and (Item_Count(hoLine)=2)) Function_Return 1 If ((sCmd = "CONSTRAINED_FIND") and (Item_Count(hoLine)=2)) Function_Return 1 If ((sCmd = "CONSTRAINED_CLEAR") and (Item_Count(hoLine)=2)) Function_Return 1 If ((sCmd = "FOR_ALL") and (Item_Count(hoLine)=1)) Function_Return 1 End Function_Return 0 End_Function Function isReasonForAttrList Integer iLastKey String sLine Returns Integer If (not(pbShowAttributes(ghoEditorProperties))) Function_Return 0 Move (Trim(Uppercase(sLine))) to sLine If (("GET_ATTRIBUTE"=sLine) or ("SET_ATTRIBUTE"=sLine)) Function_Return 1 Function_Return 0 End_Function Function isReasonForTypeList Integer iLastKey String sLine Returns Integer Handle hoID String sCmd If (not(pbShowTypes(ghoEditorProperties))) Function_Return 0 If (iLastKey = VK_Space) Begin Move (Uppercase(Trim(sLine))) to sLine Get ParseLineTmp " " True sLine to hoID Get Value of hoID item 0 to sCmd Move (Uppercase(sCmd)) to sCmd If ((sCmd="PROCEDURE") or (sCmd="FUNCTION")) Begin Get Value of hoID item (Item_Count(hoID)-1) to sCmd Move (Uppercase(sCmd)) to sCmd If (sCmd="RETURNS") Function_Return 1 End End Function_Return 0 End_Function // Does the current typing request an autosuggester - IndexList // Uh made it a bit smarter //@ RRS made it a bit more smarter - hopefully Function isReasonForIndexList Integer iLastKey String sLine Returns Integer String sFile Integer hoID iOk iLine iRet String sCmd sNext sChr If (Not(pbShowIndexes(ghoEditorProperties))) Function_Return 0 Move (Uppercase(Trim(sLine))) To sLine If (iLastKey = VK_Space) Begin Send StripConcatenatingSpaces (&sLine)// multiple concatenating spaces reduced to 1 space Move (Replaces("( ", sLine, "(")) To sLine Move (Replaces(" )", sLine, ")")) To sLine Get ParseLineTmp " " True sLine To hoID Get Value Of hoID Item 0 To sCmd Move (Uppercase(sCmd)) To sCmd Move 0 To iOk If ((sCmd = "FIND")And(Item_Count(hoId)=4)) Begin Get Value Of hoID Item 2 To sFile Move 1 To iOk End If ((sCmd = "CONSTRAINED_FIND")And(Item_Count(hoId)=4)) Begin //@ Get Value Of hoID Item 2 To sFile Move 1 To iOk End If ((sCmd = "CONSTRAINED_CLEAR")And(Item_Count(hoId)=4)) Begin //@ Get Value Of hoID Item 2 To sFile Move 1 To iOk End If ((sCmd = "FOR_ALL")And(Item_Count(hoId)=3)) Begin Get Value Of hoID Item 1 To sFile Move 1 To iOk End If ((sCmd = "SEND")And(Item_Count(hoId)=5)) Begin Get Value Of hoID Item 1 To sNext If (sNext="FIND") Begin Get Value Of hoID Item 2 To sNext If (sNext="TO" or sNext="OF") Get Value Of hoID Item 3 To sFile Else Get Value Of hoID Item 2 To sFile Ifnot "_DD" In sFile Function_Return 0 Move "" To sNext While (Length(sFile)<>0) Move (Left(sFile, 1)) To sChr Move (Replace(sChr, sFile, "")) To sFile If (sChr<>"(") Move (sNext+sChr) To sNext Else Begin If "_DD" In sNext Move "" To sFile Else Move "" To sNext End Loop Ifnot "_DD" In sNext Function_Return 0 Move (Replace("_DD", sNext,"")) To sFile Send mInitObjectEx To oIndexReader (CurrentFileListPath(ghoWorkSpaceHandlerEx)) (CurrentDataPath(ghoWorkSpaceHandlerEx)) sFile 1 // No prefix Move 0 To iOk If (Item_Count(oIndexReader(Self))) Function_Return 1 End End If ((sCmd = "SEND")And(Item_Count(hoId)=6)) Begin Get Value Of hoID Item 1 To sNext If (sNext="REQUEST_FIND") Begin Get Value Of hoID Item 2 To sNext If (sNext="TO" or sNext="OF") Get Value Of hoID Item 3 To sFile Else Get Value Of hoID Item 2 To sFile Ifnot "_DD" In sFile Function_Return 0 Move "" To sNext While (Length(sFile)<>0) Move (Left(sFile, 1)) To sChr Move (Replace(sChr, sFile, "")) To sFile If (sChr<>"(") Move (sNext+sChr) To sNext Else Begin If "_DD" In sNext Move "" To sFile Else Move "" To sNext End Loop Ifnot "_DD" In sNext Function_Return 0 Move (Replace("_DD", sNext,"")) To sFile Send mInitObjectEx To oIndexReader (CurrentFileListPath(ghoWorkSpaceHandlerEx)) (CurrentDataPath(ghoWorkSpaceHandlerEx)) sFile 1 // No prefix Move 0 To iOk If (Item_Count(oIndexReader(Self))) Function_Return 1 End End If (iOk) Begin //@RRS Start Get CM_GetSel False To iRet Get piSelEndLine To iLine Get value Item iLine To sLine //Move (UppercaseFirstLetterWords(sLine)) To sLine Send EditorMessage SCI_BEGINUNDOACTION Get CM_DeleteLine iLine To iRet Get CM_InsertLine iLine sLine To iRet Send EditorMessage SCI_ENDUNDOACTION Set piSelEndCol To (Length(sLine)) // ToDo: Setting piSelEndCol manually? // **WvA; Scintilla needs the cursor position restored, or else your cursor ends up at the start of the line Get CM_SetSel iLine (piSelEndCol(Self)) iLine (piSelEndCol(Self)) False to iRet //@RRS End Send mInitObjectEx To oIndexReader (CurrentFileListPath(ghoWorkSpaceHandlerEx)) (CurrentDataPath(ghoWorkSpaceHandlerEx)) sFile 0 If (Item_Count(oIndexReader(Self))) Function_Return 1 End End Function_Return 0 End_Function Function FindFileInSearchPath String sPath String sFile Returns String String sInd If ";" In sPath Begin While ";" In sPath Move (Left(sPath, (Pos(";", sPath)-1))) To sInd Move (Trim(Replace((sInd+";"), sPath, ""))) To sPath // **WvA: 07-06-2006 fix error on typing dots if file not exists // ignore file not open errors Send Ignore_Error of Error_Object_Id 33 Direct_Input (sInd+"\"+sFile) Send Trap_Error of Error_Object_Id 33 If (Not(seqeof)) Begin Close_Input Function_Return (sInd+"\"+sFile) End Close_Input Loop End Send Ignore_Error of Error_Object_Id 33 Direct_Input (sPath+"\"+sFile) Send Trap_Error of Error_Object_Id 33 If (Not(seqeof)) Begin Close_Input Function_Return (sPath+"\"+sFile) End Close_Input Function_Return "" End_Function // // Returns .fd for the word passed. Note that the word sPart can be anything like // "Orderhea." or "((OrderHea." or "(Mid(OrderHea." or "(Mid(OrderHea.,i,length(s))" // So we have to filter for out the non ascii characters and everything before the dot. // also note that the filename should not be tested for a specific length. // This is used for showing the fieldlist. Function ExtractDataFileName String sPart Returns String Integer iCnt String sFile sChr Move (Left(sPart, Pos(".",sPart)-1)) To sPart Move "" To sFile For iCnt From 1 To (Length(sPart)) Move (Mid(sPart, 1, iCnt)) To sChr If (Uppercase(sChr)) In "ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" Move (sFile+sChr) To sFile Else Move "" To sFile Loop Function_Return (sFile+".FD") End_Function // Does the current typing request an autosuggester - FieldList // ** SVN fix for FD files search... (do not popups TH files if same name) //@ RRS Mod to Function isReasonForFieldList Function isReasonForFieldList Integer iLastKey String sLine Returns Integer String sPart sPath If (Not(pbShowFields(ghoEditorProperties))) Function_Return 0 If (MapVirtualKey(iLastKey,2)) Eq (Ascii(".")) Begin Get CM_GetCurrentWord3 To sPart If (Right(Trim(sPart),1)) Eq "." Begin Get ExtractDataFileName sPart To sPart If sPart Ne "" Begin Get FindFileInSearchPath (CurrentDDSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentAppSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentDataPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath<>"") Begin //Send AdjustFileNameCase (UppercaseFirstLetter(Replace(".FD",sPart,""))) Send AdjustFileNameCase (Replace(".FD",sPart,"")) Send Fill To oFDFileReader sPath Function_Return 1 End End End End End_Function // // Tests the word under the cursor against the current datafiles. // If it is a match for a table name then it will return the path to the table // The full path will return a .int or .dat filename. (tests are in that order // we do not verify what's in the filelist at this stage) // Function isCurrentWordaTable String sWord Returns String Boolean bExists String sPart sPath String sTableName Move "" To sTableName If (Pos(".",sWord)) Begin Move (Left(sWord,Pos(".",sWord)-1)) To sPart End Else Move sWord To sPart Get ExtractDataFileName (sPart+".") To sPart // got a .FD filename here If (sPart <> "") Begin Get FindFileInSearchPath (CurrentDDSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentAppSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentDataPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath<>"") Begin Move (Replace(".FD",sPart,".INT")) To sPart Get FindFileInSearchPath (CurrentDataPath(ghoWorkSpaceHandlerEx)) sPart To sPath // Does the file exist? If (sPath<>"") Begin Get vFilePathExists sPath To bExists If (bExists) Begin Move sPath To sTableName End End Else Begin Move (Replace(".INT",sPart,".DAT")) To sPart Get FindFileInSearchPath (CurrentDataPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath<>"") Begin Get vFilePathExists sPath To bExists If (bExists) Begin Move sPath to sTableName End End End End End Function_Return sTableName End_Function //@ New Function Function IsReasonForNormalizeDBText Integer iLastKey String sLine Returns Integer Integer hoID iRet iLine isOK iEndCol String sCmd sPart sPath If iLastKey Eq VK_RETURN Move 1 To isOK If (isOK=0) If iLastKey Eq VK_SPACE Move 1 To isOK //If (isOK=0) If iLastKey Eq VK_DOWN Move 1 To isOK //If (isOK=0) If iLastKey Eq VK_UP Move 1 To isOK If (isOK) Begin //Move (piSelEndLine(Self)) To iLine Move (Uppercase(Trim(sLine))) To sLine Send StripConcatenatingSpaces (&sLine)// reduce multiple concatenating spaces to 1 space character Move (Replaces("( ", sLine, "(")) To sLine Move (Replaces(" )", SLINE, ")")) To SLINE Get CM_GetSel False To iRet Get piSelEndCol to iEndCol Get PARSELINETMP " " True SLINE To HOID Get Value Of hoID Item 0 To sCmd If (sCmd="OPEN" Or ; sCmd="CLEAR" Or ; sCmd="RELATE" Or ; sCmd="REREAD" Or ; sCmd="SAVE" Or ; sCmd="SAVERECORD" Or ; sCmd="DELETE" Or ; sCmd="DELETERECORD" Or ; sCmd="CLOSE" Or ; sCmd="FILE_MODE" Or ; sCmd="FILE_SIZE") Begin //@START Get Value Of hoID Item 1 To sPart If (sPart<>'') Begin Move (sPart+'.FD') To sPart //@showln 'IsReasonForNormalizeDBText.sPart=' sPart //@ Get FindFileInSearchPath (CurrentDDSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentAppSrcPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath="") Get FindFileInSearchPath (CurrentDataPath(ghoWorkSpaceHandlerEx)) sPart To sPath If (sPath<>"") Begin Set piSelEndCol To (Length(sLine)) // // ToDo: Should NEVER set piSelEndCol manually //Send AdjustFileNameCase (UppercaseFirstLetter(Replace(".FD",sPart,""))) Send AdjustFileNameCase (Replace(".FD",sPart,"")) // **WvA: Restore cursor position as the cursor has been put just after the sCmd statement Get CM_SetSel (piSelEndLine(Self)) iEndCol (piSelEndLine(Self)) iEndCol False to iRet End End //@End End End //Set pbShowKeys of ghoEditorProperties to True End_Function // Does the current typing request an autosuggester - OBJECTLIST Function isReasonForObjectList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowObjects(ghoEditorProperties)) Begin If iLastKey Eq VK_Space Begin Send ClearFirstCompoundBeforeMethod (&sLine) Move (Ltrim(sLine)) To sLine If (("GET " = Uppercase(Left(sLine,4))) Or ("SET " = Uppercase(Left(sLine,4))) or ; ("WEBGET " = Uppercase(Left(sLine,7))) Or ("WEBSET " = Uppercase(Left(sLine,7)))) Begin If (Right(sLine,3)) Eq " of" Move 1 To iReason End Else If "SEND " Eq (Uppercase(Left(sLine,5))) Begin If (Right(sLine,3)) Eq " to" ; Move 1 To iReason Else Begin // **WvA: 11-07-2004 Add support for "Send Of " If (Right(sLine,3)) Eq " of" ; Move 1 To iReason End End End End Function_Return iReason End_Function // Does the current typing request an autosuggester - KEYLIST Function isReasonForKeyList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowKeys(ghoEditorProperties)) Begin If iLastKey Eq VK_Space Begin If "ON_KEY" Eq (Uppercase(Trim(sLine))) Begin Move 1 To iReason End Else If "ON_KEY " Eq (Uppercase(Left(sLine,7))) Begin If (Right(sLine,1)) Eq "+" ; Move 1 To iReason End End Else If iLastKey Eq VK_ADD Begin If "ON_KEY " Eq (Uppercase(Left(sLine,7))) Begin Move 1 To iReason End End End Function_Return iReason End_Function // Does the current typing request an autosuggester - IDETAG List Function isReasonForIDETAGList Integer iLastKey String sLine Returns Integer Integer iReason String sUpStartLine Move 0 To iReason If (pbShowIDETags(ghoEditorProperties)) Begin If iLastKey Eq VK_Space Begin Move (Uppercase(Trim(sLine))) To sUpStartLine If ( ("/"+"/A" Eq sUpStartLine) Or ("/"+"/D" Eq sUpStartLine) Or ("/"+"/I" Eq sUpStartLine)) Begin Move 1 To iReason End End End Function_Return iReason End_Function // Does the current typing request an autosuggester - CREATOR Function isReasonForCreator Integer iLastKey String sLine Returns Integer Integer iReason String sTmp Move 0 To iReason If iLastKey Eq VK_RETURN Begin Append sTmp "@" (Lowercase(Trim(sLine))) "@" If sTmp In "@get@set@move@send@" Move 1 To iReason End Function_Return iReason End_Function // Does the current typing request an autosuggester - PROCEDURELIST Function isReasonForProcedureList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowMethods(ghoEditorProperties)) Begin If ((iLastKey = VK_SPACE) and (Uppercase(Trim(sLine)) = "PROCEDURE")) ; Move 1 To iReason End Function_Return iReason End_Function // Does the current typing request an autosuggester - PROCEDURELIST Function isReasonForFunctionList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowMethods(ghoEditorProperties)) Begin If ((iLastKey = VK_SPACE) and (Uppercase(Trim(sLine)) = "FUNCTION")) ; Move 1 To iReason End Function_Return iReason End_Function // Does current typing request an autosuggester - CLASSLIST Function isReasonForClassList Integer iLastKey String sLine Returns Integer Integer iReason Integer iOK Move 0 To iReason If (pbShowClasses(ghoEditorProperties)) Begin If (iLastKey = VK_SPACE) Begin Move (Uppercase(Trim(sLine))) To sLine If ((Right(sLine,2) Eq " A") Or (Right(sLine,3) Eq " AN")) Begin If (Left(sLine,6)) Eq "CLASS " ; Move 1 To iReason Else Begin If (Left(sLine,7)) Eq "OBJECT " ; Move 1 To iReason End End End End Function_Return iReason End_Function Function isReasonForCodeTip Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbCodeTipAutoPopup(phoIniHandler(Self))) Begin If (iLastKey = VK_SPACE) Begin Move (uppercase(" " + sLine)) To sLine If (Pos(" GET ",sLine)) Ne 0 ; Move 1 To iReason Else Begin If (Pos(" SEND ",sLine)) Ne 0 ; Move 1 To iReason End End End Function_Return iReason End_Function Function isReasonForSourceFileList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowSourceFiles(ghoEditorProperties)) Begin If (iLastKey = VK_Space) Begin Move (Uppercase(Trim(sLine))) To sLine If ("USE" = sLine) Begin Move 1 To iReason End Else If ("#INCLUDE" = sLine) Begin Move 1 To iReason End End End Function_Return iReason End_Function Function isReasonForMethodList Integer iLastKey String sLine Returns Integer Integer iReason Move 0 To iReason If (pbShowSourceFiles(ghoEditorProperties)) Begin If (iLastKey = VK_Space) Begin Send ClearFirstCompoundBeforeMethod (&sLine) Move (Uppercase(Trim(sLine))) To sLine If ("SEND" = sLine) Begin Move 1 To iReason End Else If ("GET" = sLine) Begin Move 1 To iReason End Else If ("SET" = sLine) Begin Move 1 To iReason End End End Function_Return iReason End_Function // Tests if the auto list shall come up. Function isListReason Integer iLastKey Returns Integer Boolean bIsComment String sLine sTmp Get StyleAtCurrentPosIsComment To bIsComment If (bIsComment=false) Begin Get value To sLine Move (Lowercase(sLine)) To sLine Move (Trim(sLine)) To sLine If (isReasonForObjectList(Self,iLastKey,sLine)) Function_Return MK_LR_OBJECTS If (isReasonForCreator(Self,iLastKey,sLine)) Function_Return MK_LR_CREATOR If (isReasonForProcedureList(Self,iLastKey,sLine)) Function_Return MK_LR_PROCEDURES If (isReasonForFunctionList(Self,iLastKey,sLine)) Function_Return MK_LR_FUNCTIONS If (isReasonForKeyList(Self,iLastKey,sLine)) Function_Return MK_LR_KEYS If (isReasonForFieldList(Self,iLastKey,sLine)) Function_Return MK_LR_DATABASEFIELDS If (isReasonForClassList(Self,iLastKey,sLine)) Function_Return MK_LR_CLASSES If (isReasonForDataFileList(Self,iLastKey,sLine)) Function_Return MK_LR_DATAFILES If (isReasonForIndexList(Self,iLastKey,sLine)) Function_Return MK_LR_INDEXES If (isReasonForIDETAGList(Self,iLastKey,sLine)) Function_Return MK_LR_IDETAGS If (isReasonForCommandList(Self,iLastKey,sLine)) Function_Return MK_LR_COMMANDS If (isReasonForTypeList(Self,iLastKey,sLine)) Function_Return MK_LR_TYPES If (isReasonForAttrList(Self,iLastKey,sLine)) Function_Return MK_LR_ATTRIBUTES If (isReasonForSourceFileList(Self,iLastKey,sLine)) Function_Return MK_LR_SOURCEFILES If (isReasonForMethodList(Self,iLastKey,sLine)) Function_Return MK_LR_METHODS If (isReasonForCodeTip(Self,iLastKey,sLine)) Begin Send CodeTip Function_Return MK_LW_NO End If (IsReasonForNormalizeDBText(Self,iLastKey,sLine)) Function_Return 0 End End_Function Procedure DestroyObject_Extentions Send Request_Destroy_Object End_Procedure Procedure StartFillList String sFile //send Delete_Data to (oObjects(Self)) Get GetFileName To sFile Send StartFillList To (phoElements(Self)) sFile End_Procedure Procedure EndFillList Integer iC iCount Move 0 To iC // Changed this loop that items that are no longer valid (deleted) are really deleted // and not only set to "" (speeds up the search a little bit) // 28.1.2003 BP While (iC Lt (item_count(oItems(Self)))) If (Value(oItemsTouched(Self),iC)) Ne "J" Begin Send DeleteEntry To (phoElements(Self)) (Value(oItemHandles(Self),iC)) Send delete_item To oItemsTouched iC Send delete_item To oItemHandles iC Send delete_item To oItems iC End Else Begin Set value Of oItemsTouched Item iC To "" Increment iC End End Send EndFillList To (phoElements(Self)) End_Procedure Procedure NewUsedFile String sFile Integer iC Get Find_Element Of oUsedFiles sFile To iC If iC Lt 0 Send Add_Element To oUsedFiles sFile Send AddFile To (phoElements(Self)) sFile False End_Procedure Procedure RemoveAllFiles Integer hoID iC String sFile Move (oUsedFiles(Self)) To hoID For iC From 0 To (Item_Count(hoID)-1) Send RemoveFile To (phoElements(Self)) (Value(hoID,iC)) Loop Get GetFileName To sFile Send RemoveFile To (phoElements(Self)) sFile End_Procedure Procedure AddNewListEntry String sName String sClass String sRef Integer iParent Integer iPrev Integer iLine Integer iType Integer pElement Boolean bOnFileLoad Integer iRet iOldItem iC iItemCount Move (CString(sRef)) To sRef Move (CString(sClass)) To sClass Get Find_Element Of oItems sRef To iC If iC Ge 0 Begin Get pbParseOnFileLoad of (phoParser(Self)) to bOnFileLoad If (bOnFileLoad) Begin Move (sName+"#duplicate#") To sName End Else Begin Get Value Of oItemHandles Item iC To iOldItem End End Else Get Item_Count Of oItems To iC Set value Of oItemsTouched Item iC To "J" If iOldItem Begin Send UpdateLineNr To (phoElements(Self)) iOldItem iLine Procedure_Return iOldItem End Get Msg_AddNewListEntry Of (phoElements(Self)) iPrev sName sClass iParent iLine iType pElement To iRet Set Value Of oItems Item iC To sRef Set value Of oItemHandles Item iC To iRet Procedure_Return iRet End_Procedure // Rebuilds the Procedure ForceReBuildCodeView Send Delete_Data To oItemsTouched Send EndFillList Send Delete_Data To oItems Send Delete_Data To oItemHandles Send ParseBuffer End_Procedure // // Currently the parser only understands dataflex, do not try to parse // another language and then choke on that. // Function CanParseCurrentLanguage Returns Boolean Boolean bCanParse String sLang Move False To bCanParse // ShowLanguageInfo Get CM_GetLanguage To sLang If (sLang="VDF" Or Uppercase(sLang)="PASCAL" Or Uppercase(sLang)="JAVASCRIPT") Begin Move True To bCanParse End Function_Return bCanParse End_Function // Parses the Buffer and fills the TreeView. Procedure ParseBuffer Boolean bCanParse Integer hoID hoEd String sLang //Procedure_return // Skip parsing for the moment. If (gbDisableParser) Begin Procedure_Return End Get CanParseCurrentLanguage To bCanParse If (bCanParse) Begin Set piOnce To True // For internal use... Move (phoParser(Self)) To hoID Move Self To hoED Get CM_GetLanguage To sLang Set Language of hoID To sLang Send CreateParseTask To hoID hoED Send DoParsing To hoID End End_Procedure // Is sent when a file was opened succesful. // and Rebuilds the object list. Procedure onPreOpenFile String sFile //@ //@SHOWLN (Name(self)) '::OnPreOpenFile:' sFile //@ Send SetLanguage sFile //@ End_Procedure //@ //@Procedure onPostOpenFile String sFile //@ SHOWLN (Name(self)) '::OnPostOpenFile:' sFile //@ //@ Send SetLanguage sFile //@End_Procedure // Some Procedures to support a FloatingPopupMenu // 17.05.01 Bernhard Procedure FloatPaste Integer iRet Get CM_PASTE To iRet End_Procedure Procedure FloatCopy Integer iRet Get CM_COPY To iRet End_Procedure Procedure FloatCut Integer iRet Get CM_CUT To iRet End_Procedure Procedure FloatToggleWhitespace Integer iRet Get CM_EnableWhitespaceDisplay (Not(CM_IsWhitespaceDisplayEnabled(Self))) To iRet End_Procedure Procedure FloatMakeUppercase Integer iRet Get CM_ExecuteCmd CMD_UPPERCASESELECTION 0 To iRet End_Procedure Procedure FloatMakeLowercase Integer iRet Get CM_ExecuteCmd CMD_LOWERCASESELECTION 0 To iRet End_Procedure Procedure FloatUndo Integer iRet Get CM_UNDO To iRet End_Procedure Procedure FloatRedo Integer iRet Get CM_REDO To iRet End_Procedure Procedure FloatBookmarkToggle Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKTOGGLE 0 To iRet End_Procedure Procedure FloatBookmarkClearAll Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKCLEARALL 0 To iRet End_Procedure Procedure FloatBookmarkFirst Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKJUMPTOFIRST 0 To iRet End_Procedure Procedure FloatBookmarkLast Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKJUMPTOLAST 0 To iRet End_Procedure Procedure FloatBookmarkNext Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKNEXT 0 To iRet End_Procedure Procedure FloatBookmarkPrevious Integer iRet Get CM_ExecuteCmd CMD_BOOKMARKPREV 0 To iRet End_Procedure Procedure FloatGotoIndentation Integer iRet Get CM_ExecuteCmd CMD_GOTOINDENTATION 0 To iRet End_Procedure Procedure FloatGotoMatchBrace Integer iRet Get CM_ExecuteCmd CMD_GOTOMATCHBRACE 0 To iRet End_Procedure // Macro procedures... Procedure FloatRecordMacro Integer iRet Get CM_ExecuteCmd CMD_RECORDMACRO 0 To iRet End_Procedure Procedure FloatPlayMacro1 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO1 0 To iRet End_Procedure Procedure FloatPlayMacro2 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO2 0 To iRet End_Procedure Procedure FloatPlayMacro3 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO3 0 To iRet End_Procedure Procedure FloatPlayMacro4 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO4 0 To iRet End_Procedure Procedure FloatPlayMacro5 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO5 0 To iRet End_Procedure Procedure FloatPlayMacro6 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO6 0 To iRet End_Procedure Procedure FloatPlayMacro7 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO7 0 To iRet End_Procedure Procedure FloatPlayMacro8 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO8 0 To iRet End_Procedure Procedure FloatPlayMacro9 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO9 0 To iRet End_Procedure Procedure FloatPlayMacro10 Integer iRet Get CM_ExecuteCmd CMD_PLAYMACRO10 0 To iRet End_Procedure // **SVN 18-01-2003 Procedure CodeTip Integer iRet If (pbCodeTipAutoPopup(phoIniHandler(Self))) Begin Get CM_ExecuteCmd CMD_CODETIP 0 To iRet End End_Procedure // Conversion routines mapped to the poupmenu. Procedure FloatToggle_OnItem_AddItem Send Toggle_OnItem_AddItem End_Procedure Procedure FloatConvertCStructToVDF Send ConvertCStructToVDF End_Procedure Procedure FloatConvertCDllCallToVDF Send ConvertCDllCallToVDF End_Procedure Procedure FloatConvertVDFTypeToHandler Send ConvertVDFTypeToHandler End_Procedure // Inserts a colorvalue into the codemax edit Procedure FloatInsertColor Send InsertColorValue End_Procedure Procedure FloatInsertHexColor Send InsertHexColorValue End_Procedure // Inserts a Bitmap reference into the codemax edit Procedure FloatInsertBitmap Send InsertBitmapValue End_Procedure End_Class Register_Procedure ContextSensitiveHelp // WvA: 06-05-2002 Context Help Key // Short note: // **WvA Translated doc from german to english // // 1.There is a criteria that leads to Ausloesen of a List // 2.Down- and UpArrow are rerouted to the list // 3. Use cDefaultLanguageDefinitions.pkg Use cSciLexerRefactor.pkg Use cEditorHotKey_Mixin.pkg Class cCodeEdit is a cSciLexerRefactor Import_Class_Protocol cEditorHotKey_Mixin End_Class // Editor class for the codemax editor. Class cEditorEdit Is a cCodeEdit Import_Class_Protocol cEditExtentionsMixin Procedure Construct_Object Integer iRet Forward Send Construct_Object Property Integer piInSetFocus 0 Property Integer piLastKeyTranslated False Property String psOpenBracketTip "" Send Define_cEditExtentionsMixin On_Key Key_F1 Send ContextSensitiveHelp // Used to be ctrl+F1, which unfortunately is out of sync with DAWs On_Key Key_Ctrl+Key_F1 Send Help // as that depends on muscle memory bring it back in sync. Property Integer piEnterIsDown 0 Set phoCodeTipHandler To ghoCodeTip Set phoCodeListHandler To ghoCodeList Set phoIniHandler To ghoEditorProperties Property Integer piLastLineNumber 0 Property Integer piCurrClassID 0 Property Integer piProcedureState 0 // Parameters are inserted too. End_Procedure Procedure end_construct_object Forward Send end_construct_object Object oRevisionMaskHandler Is a cRevisionMaskHandler End_Object On_Key kCancel Send Request_Cancel End_Procedure // **WvA Added logic to cancel the output pane with the escape key. // Just trying to avoid to have to use the mouse too much ;) // This is similar to how it works in most other editors. Procedure Request_Cancel If (ghoOutputPane<>0) Begin Send CloseOutputPane of ghoOutputPane End Forward Send Request_Cancel End_Procedure // Request_Cancel // // For simulating keyboard navigation by sending VK_xxx keyboard commands with // postmessage WM_KEYDOWN / WM_KEYUP into the Windows message queue // Procedure PostVirtualKey Integer iVkKey Integer iRet Move (PostMessage (window_Handle(Self), WM_KEYDOWN, iVkKey, 0)) To iRet Move (PostMessage (window_Handle(Self), WM_KEYUP, iVkKey, 0)) To iRet End_Procedure // // This will test if the method at line iStartLine already has a matching end method eg. // procedure should have end_procedure at the end, so that any of the // auto suggestion logic can act properly on that. // Function MethodIsClosed Integer iProcState Integer iStartLine Returns Boolean Boolean bIsClose Boolean bStop Integer iLine Integer iLineCount String sLine Move False to bIsClose Move iStartLine To iLine Get SC_LineCount To iLineCount Increment iLine While (iLine < iLineCount and (bStop=false)) Get Value Item iLine To sLine Move (ltrim(lowercase(sLine))) To sLine If (Left(sLine,10)="procedure ") Begin Move True To bStop End Else If (Left(sLine,9)="function ") Begin Move True To bStop End Else If (Left(sLine,13)="end_procedure") Begin If (iProcState=MK_PROC_PROCEDURE) Begin Move True To bIsClose End Move True To bStop End Else If (Left(sLine,12)="end_function") Begin If (iProcState=MK_PROC_FUNCTION) Begin Move True To bIsClose End Move True To bStop End Increment iLine Loop Function_Return bIsClose End_Function // // This will test if the method at line iStartLine already has a matching end method eg. // procedure should have end_procedure at the end, so that any of the // auto suggestion logic can act properly on that. // Function ScopeIsClosed Integer iProcState Integer iStartLine Returns Boolean Boolean bIsClose Boolean bStop Integer iLine Integer iLineCount String sLine Move False to bIsClose Move iStartLine To iLine Get SC_LineCount To iLineCount Increment iLine While (iLine < iLineCount and (bStop=false)) Get PreParsedLine iLine To sLine Move (ltrim(lowercase(sLine))) To sLine If (Left(sLine,13)="end_procedure") Begin Move True To bStop End Else If (Left(sLine,12)="end_function") Begin Move True To bStop End Else If (Left(sLine,3)="end") Begin // must be AFTER end_xxx checks! If (iProcState=MK_PROC_BEGIN) Begin Move True To bIsClose Move True To bStop End End Else If (Left(sLine,4)="loop") Begin If (iProcState=MK_PROC_WHILE) Begin Move True To bIsClose End Move True To bStop End Else If (Left(sLine,5)="until") Begin If (iProcState=MK_PROC_REPEAT) Begin Move True To bIsClose End Move True To bStop End Else If (sLine<>"") Begin Move True To bStop End Increment iLine Loop Function_Return bIsClose End_Function // Tests if the current line starts with a method declaration // If that's the case then it will check if that method has a matching end_xxx statement. // If it has one, then it returns MK_PROC_NONE. // if it is a procedure and has a missing end_proc statement then it returns MK_PROC_PROCEDURE. // if is is a function and has a missing end_func statement then it returns MK_PROC_FUNCTION. Function AutoCloseScope Returns Integer Boolean bIsClosed Integer iLine Integer iActive String sLine String sLang Move MK_PROC_NONE To iActive If (pbIsCodelistActive(Self)=false) Begin Get CM_GetLanguage To sLang If (sLang="VDF") Begin Get CurrentLine To iLine Get SC_GetLine Item iLine To sLine Move (LTrim(Lowercase(sLine))) To sLine If (Left(sLine,10)="procedure ") Begin Get MethodIsClosed MK_PROC_PROCEDURE iLine To bIsClosed If (bIsClosed=false) Begin Move MK_PROC_PROCEDURE To iActive End End If (Left(sLine,9)="function ") Begin Get MethodIsClosed MK_PROC_FUNCTION iLine To bIsClosed If (bIsClosed=false) Begin Move MK_PROC_FUNCTION To iActive End End If (Left(sLine,3)="if " or Left(sLine,5)="else ") Begin If (Right(RTrim(sLine),6)=" begin") Begin Get ScopeIsClosed MK_PROC_BEGIN iLine To bIsClosed If (bIsClosed=false) Begin Move MK_PROC_BEGIN To iActive End End End If (Left(sLine,6)="while ") Begin Get ScopeIsClosed MK_PROC_WHILE iLine To bIsClosed If (bIsClosed=false) Begin Move MK_PROC_WHILE To iActive End End If (Left(sLine,7)="repeat ") Begin Get ScopeIsClosed MK_PROC_REPEAT iLine To bIsClosed If (bIsClosed=false) Begin Move MK_PROC_REPEAT To iActive End End End End Function_Return iActive End_Function // Function CodelistCurrentMethodValue String sVal Integer iRec Returns String Boolean bIsClosed Integer iCur Integer iLine Integer iProcState String sParas sName sRet Move sVal To sName Get piProcedureState to iProcState If (iProcState<>MK_PROC_NONE) Begin Move (piSourceLine(phoCodelistHandler(Self))) To iLine Send OpenTH3DB of ghoApplication ASDB.File_Number Clear Asdb Move iRec To ASDB.RecNum Find Eq ASDB by RecNum If ASDB.SetCode Ne "" Move (Append("Set ",sVal)) To sVal Append sVal (ASDBParametersList(True)) If "returns" In sVal Begin Move (Right(sVal,Length(sVal)-Pos("returns",sVal)-7)) To sRet Move (Trim(sRet)) To sRet Append sVal "\n\t\tab" sRet " " (Left(sRet,1)) "RetVal" Append sVal "\n\t\tab" "Forward Get " If (iProcState = MK_PROC_PROCEDURE) Append sVal "Msg_" Append sVal sName (ASDBParametersList(False)) " to " (Left(sRet,1)) "RetVal" If (iProcState = MK_PROC_PROCEDURE) Append sVal "\n\t\tabProcedure_Return " (Left(sRet,1)) "RetVal" Else Append sVal "\n\t\tabFunction_Return " (Left(sRet,1)) "RetVal" End Else Begin Append sVal "\n\t\tab" "Forward " If ASDB.SetCode Ne "" Append sVal "Set " Else Append sVal "Send " Append sVal sName (ASDBParametersList(False)) End Get MethodIsClosed iProcState iLine To bIsClosed If (bIsClosed=false) Begin If (iProcState = MK_PROC_PROCEDURE) Append sVal "\n\t" "End_Procedure" Else Append sVal "\n\t" "End_Function" End Send CloseTH3DB of ghoApplication ASDB.File_Number End Function_Return sVal End_Function Function ClassCodeTemplate String sTab String sVal Returns String //____Procedure_Construct_Object... Append sVal "\n" sTab "\tab" "/" "/" (_T("Insert your Properties here.", 1552)) Append sVal "\n" sTab "\tabProcedure Construct_Object" Append sVal "\n" sTab "\tab\tab" "Forward send Construct_Object" Append sVal "\n" sTab "\tabEnd_Procedure" //____Procedure_End_Construct_Object... Append sVal "\n" sTab "\tab" "/" "/" (_T("Finish object construction", 1553)) Append sVal "\n" sTab "\tabProcedure End_Construct_Object" Append sVal "\n" sTab "\tab\tab" "Forward send End_Construct_Object" Append sVal "\n" sTab "\tabEnd_Procedure" Append sVal "\n" sTab "End_Class" Function_Return (Trim(sVal)) End_Function Function CodelistCurrentClassValue String sVal Returns String // String sLine sTab sRet // Integer isVar iIndent // Move (psSourceLine(phoCodelistHandler(Self))) To sLine // If (Left(Uppercase(Trim(sLine)),6)) Eq "CLASS " Begin // Move (Length(sLine)-Length(LTrim(sLine))) To iIndent // Move (Repeat(" ",iIndent)) To sTab // // //____Procedure_Construct_Object... // Append sVal "\n" sTab "\tab\tab" "/" "/Insert your Properties here." // Append sVal "\n" sTab "\tabProcedure Construct_Object" // Append sVal "\n" sTab "\tab\tab" "Forward send Construct_Object" // Append sVal "\n" sTab "\tabEnd_Procedure" // // //____Procedure_End_Construct_Object... // Append sVal "\n" sTab "\tab\tab" "/" "/Finish object construction" // Append sVal "\n" sTab "\tabProcedure End_Construct_Object" // Append sVal "\n" sTab "\tab\tab" "Forward send End_Construct_Object" // Append sVal "\n" sTab "\tabEnd_Procedure" // Append sVal "\n" sTab "End_Class" // End Function_Return (Trim(sVal)) End_Function Function CodelistCurrentDataFileValue String sVal Returns String Function_Return (Trim(sVal)) End_Function Function CodelistCurrentCommandValue String sVal Integer iRef Returns String Integer iStart Integer iItem iIndent String sLine sTab // Indent Get CM_GetSel False to iStart Get piSelStartLine to iStart Get value item iStart to sLine Move (Length(sLine)-Length(LTrim(sLine))) to iIndent Move (Repeat(" ",iIndent)) to sTab // Move (Codelist_current_item(phoCodelistHandler(Self))) to iItem Get Value of (oCommandsArray(Self)) item iItem to sVal If (Uppercase(sVal)="CLASS") Get ClassCodeTemplate sTab sVal to sVal If (Uppercase(sVal)="OBJECT") Move (sVal+"\n"+sTab+"End_Object") to sVal If (Uppercase(sVal)="PROCEDURE") Move (sVal+"\n"+sTab+"End_Procedure") to sVal If (Uppercase(sVal)="FUNCTION") Move (sVal+"\n"+sTab+"End_Function") to sVal If (Uppercase(sVal)="FOR_ALL") Move (sVal+"\n"+sTab+"\tabDo"+"\n\tab"+sTab+"\n"+sTab+"End_For_All") to sVal If (Uppercase(sVal)="BEGIN") Move (sVal+"\n"+sTab+"End") to sVal Set piInListCol to (piInListCol(Self)-1) Function_Return sVal End_Function Function CodelistCurrentTypeValue String sVal Integer iRef Returns String Boolean bAutoComment Integer iStart Integer iItem iIndent String sLine sTab sType sVar sMethod String sCloseStmt sName Handle hoLine // Indent Get CM_GetSel False to iStart Get piSelStartLine to iStart Get value item iStart to sLine // Get value item (iStart+1) to sCloseStmt Move (Trim(sCloseStmt)) to sCloseStmt // Move (Length(sLine)-Length(LTrim(sLine))) to iIndent Move (Repeat(" ",iIndent)) to sTab Move "Function" to sMethod If (Left(Uppercase(Trim(sLine)), 4)="PROC") Move "Procedure" to sMethod // Trailing comment [ // mName (Type Function|Procedure) ] Get pbMethodSuffixComment Of ghoEditorProperties To bAutoComment If (bAutoComment) Begin If ("END_"=Uppercase(Left(sCloseStmt, 4))) Begin Get ParseLineTmp " " True sLine to hoLine Get Value Of hoLine Item 1 to sName Move (sTab+sCloseStmt * "//" * sName * '('+sVal * sMethod +')') to sCloseStmt Set Value item (iStart+1) to sCloseStmt End End // Move (Codelist_current_item(phoCodelistHandler(Self))) to iItem Get Value of (oTypesArray(Self)) item iItem to sVal //Set piInListCol to (piInListCol(Self)-1) Move (Uppercase(sVal)) to sType If (sType="ADDRESS") Move "aRetVal" To sVar Else If (sType="BIGINT") Move "biRetVal" to sVar Else If (sType="BOOLEAN") Move "bRetVal" to sVar Else If (sType="CHAR") Move "cRetVal" to sVar Else If (sType="DATE") Move "dRetVal" to sVar Else If (sType="DATETIME") Move "dtRetVal" to sVar Else If (sType="HANDLE") Move "hRetVal" to sVar Else If (sType="INTEGER") Move "iRetVal" to sVar Else If (sType="LONGPTR") Move "lpRetVal" to sVar Else If (sType="NUMBER") Move "nRetVal" to sVar Else If (sType="POINTER") Move "pRetVal" to sVar Else If (sType="REAL") Move "rRetVal" to sVar Else If (sType="ROWID") Move "riRetVal" to sVar Else If (sType="SHORT") Move "siRetVal" to sVar Else If (sType="STRING") Move "sRetVal" to sVar Else If (sType="TIME") Move "tmRetVal" to sVar Else If (sType="TIMESPAN") Move "tsRetVal" to sVar Else If (sType="UBIGINT") Move "ubiRetVal" to sVar Else If (sType="UCHAR") Move "ucRetVal" to sVar Else If (sType="UINTEGER") Move "uiRetVal" to sVar Else If (sType="ULONGPTR") Move "ulpRetVal" to sVar Else If (sType="USHORT") Move "usRetVal" to sVar Else If (sType="VARIANT") Move "vRetVal" to sVar Else If (sType="WSTRING") Move "wsRetVal" to sVar Else Move ("l"+sVal) to sVar Move (sVal+"\n"+sTab+"\tab"+sVal*sVar+"\n"+sTab+"\tab"+sMethod+"_Return"*sVar) to sVal Function_Return sVal End_Function Function CodelistCurrentAttributeValue String sVal Integer iRef Returns String Integer iStart Integer iItem iIndent String sLine sTab // Indent Get CM_GetSel False to iStart Get piSelStartLine to iStart Get value item iStart to sLine Move (Length(sLine)-Length(LTrim(sLine))) to iIndent Move (Repeat(" ",iIndent)) to sTab // Move (Codelist_current_item(phoCodelistHandler(Self))) to iItem Get Value of (oAttrArray(Self)) item iItem to sVal //Set piInListCol to (piInListCol(Self)-1) Function_Return sVal // DF_FIELD_STORE_TIME End_Function Function CodelistCurrentObjectValue String sVal Integer iRef Returns String String sRef Integer isVar If iRef Eq -1 Function_Return sVal // desktop or variable Move (LTrim(sVal)) To sVal Move (psSourceRefVal(phoCodelistHandler(Self))) To sRef Move (ReduceReference(sVal,sRef)) To sVal Move (ReferenceToObject(sVal)) To sVal Function_Return sVal End_Function // **WvA: 11.07.2004 Added Function CodelistCurrentIDETagValue String sVal Returns String Handle hoIDETag Integer iItem Move (Codelist_current_item(phoCodelistHandler(Self))) To iItem Move (oIDETagsArray(Self)) To hoIDETag Get FindTagsForItem Of hoIDETag sVal To sVal Function_Return sVal End_Function // CodelistCurrentIDETagValue Procedure InsertCodelistText String sVal Integer iLine iCol iRet iLen Send EditorMessage SCI_BEGINUNDOACTION Get CM_GetSel True To iRet Move (piSelEndLine(Self)) To iLine Move (piSelEndCol(Self)) To iCol Move (CM_SetSel(Self,iLine,piInListCol(Self),iLine,iCol,False)) To iRet Move (CM_DeleteSel(Self)) To iRet Send InsertTextAtPosition iLine (piInListCol(Self)) sVal If "\n" In sVal Move (Pos("\n",sVal)-1) To iLen Else Move (Length(sVal)) To iLen Move (piInListCol(Self)+iLen) To iCol Move (CM_SetSel(Self,iLine,iCol,iLine,iCol,False)) To iRet Send EditorMessage SCI_ENDUNDOACTION End_Procedure Procedure CodelistSimulateEnter Send DoKeyReturn End_Procedure Procedure AutoCloseMethod Integer iAutoClose Integer iLine Integer iCol Get AutoCloseScope to iAutoClose If (iAutoClose<>MK_PROC_NONE) Begin Get CurrentLine To iLine Get CurrentColumn To iCol If (iAutoClose=MK_PROC_PROCEDURE) Begin Send InsertTextAtPosition iLine iCol "\n\tEnd_Procedure" End Else If (iAutoClose=MK_PROC_FUNCTION) Begin Send InsertTextAtPosition iLine iCol "\n\tEnd_Function" End End End_Procedure // SVN CodeList support Procedure CM_CodeListItemSelected String sItem Integer iRefVal Integer iLine iCol iRet iLen iCodeTip iReason String sVal sLine sWord sFunc Set pbIsCodelistActive To False Move (piListReason(phoCodelistHandler(Self))) To iReason If iReason Eq MK_LR_INDEXES Get CM_GetCurrentWordIncludingDot To sWord Else Get CM_GetCurrentWord To sWord If ( (iReason Eq MK_LR_DATABASEFIELDS) And (sWord Eq ".") ) Move "" To sWord If (uppercase(sWord)) Eq (uppercase(Left(sItem,(length(sWord))))) Begin Case Begin Case (iReason Eq MK_LR_OBJECTS) Get CodelistCurrentObjectValue sItem iRefVal To sVal Send InsertCodelistText sVal Case Break Case (iReason Eq MK_LR_CLASSES) Get CodelistCurrentClassValue sItem To sVal Send InsertCodelistText sVal Case Break Case (iReason Eq MK_LR_PROCEDURES) Get CodelistCurrentMethodValue sItem iRefVal To sVal Send InsertCodelistText sVal Case Break Case (iReason Eq MK_LR_FUNCTIONS) Get CodelistCurrentMethodValue sItem iRefVal To sVal Send InsertCodelistText sVal Case Break Case ( (iReason Eq MK_LR_INDEXES) or (iReason Eq MK_LR_DATABASEFIELDS) or (iReason Eq MK_LR_VARS) or (iReason Eq MK_LR_KEYS) or (iReason Eq MK_LR_IDETAGS) or (iReason Eq MK_LR_COMMANDS) or (iReason Eq MK_LR_TYPES) or (iReason Eq MK_LR_ATTRIBUTES) or (iReason=MK_LR_DATAFILES)) Move (Trim(sItem)) To sVal If (iReason Eq MK_LR_KEYS) Begin Get value To sLine Move (Mid(sLine,1,(piInListCol(Self)))) To sLine If ( (sVal Eq "KEY_SHIFT") Or (sVal Eq "KEY_ALT") Or (sVal Eq "KEY_CTRL") ) Begin If sLine Ne "(" Move ("("+sVal) To sVal Move (sVal + "+") To sVal End Else Begin If sLine Eq "+" Move (sVal+")") To sVal Move (sVal + " Send") To sVal Set piEnterIsDown To FALSE End End Else If (iReason Eq MK_LR_IDETAGS) Begin Get CodelistCurrentIDETagValue sItem To sVal End Else If (iReason=MK_LR_COMMANDS) Begin Get CodelistCurrentCommandValue sItem to sVal End Else If (iReason=MK_LR_DATAFILES) Begin Get CodelistCurrentDataFileValue sItem to sVal End Else If (iReason=MK_LR_TYPES) Begin Send EditorMessage SCI_BEGINUNDOACTION If (pbNormalizeCase(Self)) Begin Send doNormalizeCase End Send AutoCloseMethod Get CodelistCurrentTypeValue sItem to sVal End Else If (iReason=MK_LR_ATTRIBUTES) Begin Get CodelistCurrentAttributeValue sItem to sVal End Send InsertCodelistText sVal If ( (iReason Eq MK_LR_KEYS) And ( (Right(sVal,1)) Eq "+") ) Begin Set piInListCol To ( (piInListCol(Self)) + (length(sVal)) ) Get CM_GetSel True To iRet Move (piSelEndLine(Self)) To iLine Move (piSelEndCol(Self)) To iCol Move (CM_SetSel(Self,iLine,(iCol-1),iLine,(iCol-1),False)) To iRet Send Codelist_Beginning_Of_Data To (phoCodelistHandler(Self)) Set pbIsCodelistActive To True Procedure_Return TRUE End If (iReason Eq MK_LR_DATABASEFIELDS) Begin //@RRS Set piEnterIsDown To False //@RRS End //@RRS If (iReason Eq MK_LR_INDEXES) Begin Set piEnterIsDown To False //@RRS End Case Break Case (iReason Eq MK_LR_SOURCEFILES) //Get CodelistCurrentMethodValue sItem iRefVal To sVal Send InsertCodelistText sItem Case Break Case (iReason Eq MK_LR_METHODS) Send InsertCodelistText sItem Case Break Case Else Get CodeTipFunction Of (phoCodeTipHandler(Self)) sItem To sFunc Move sFunc To sVal Get Value To sLine Move (RTrim(sLine)) To sLine Get CM_GetCurrentWord To sWord Move (Left(sLine,(Length(sLine)-Length(sWord)))) To sLine Move (Trim(Left(sVal, (Pos("(",sVal)-1)))) To sVal Move (sLine+sVal+"(") To sVal If sVal Ne "" Begin Get CM_GetSel True To iRet Move (piSelEndLine(Self)) To iLine Move (piSelEndCol(Self)) To iCol Append sVal " " Move (CM_SetSel(Self,iLine,0,iLine,iCol,False)) To iRet Move (CM_DeleteSel(Self)) To iRet Send InsertTextAtPosition iLine (piSelEndCol(Self)) sVal If "\n" In sVal Move (Pos("\n",sVal)-1) To iLen Else Move (Length(sVal)) To iLen Move (piInListCol(Self)+iLen-1) To iCol Move (CM_SetSel(Self,iLine,iCol,iLine,iCol,False)) To iRet End Set psCodeTipCurrent To sFunc Get pbCodeTipAutoPopup Of (phoIniHandler(Self)) To iCodeTip Set pbCodeTipAutoPopup Of (phoIniHandler(Self)) To True Send CodeTip Set pbCodeTipAutoPopup Of (phoIniHandler(Self)) To iCodeTip Case Break Case End End Set piListReason Of (phoCodelistHandler(Self)) To 0 Set piSourceObject Of (phoCodelistHandler(Self)) To 0 Send BlockKey VK_HOME CM_KEY_CTRL False Send BlockKey VK_END CM_KEY_CTRL False // Repositiones Cursor If ((iReason=MK_LR_COMMANDS)or(iReason Eq MK_LR_ATTRIBUTES)or(iReason=MK_LR_DATAFILES)) Begin Send EditorMessage SCI_LINEEND End If (iReason Eq MK_LR_TYPES) Begin Send EditorMessage SCI_LINEDOWN Send EditorMessage SCI_LINEEND Send CodelistSimulateEnter Send EditorMessage SCI_ENDUNDOACTION End If (iReason Eq MK_LR_CLASSES) Begin Send EditorMessage SCI_LINEDOWN Send EditorMessage SCI_LINEDOWN Send EditorMessage SCI_LINEDOWN Send EditorMessage SCI_LINEEND Send CodelistSimulateEnter End End_Procedure Procedure SelectClosestCodelistMatch String sWord Integer iRet If (piListReason(phoCodelistHandler(Self))) Eq MK_LR_INDEXES Get CM_GetCurrentWordIncludingDot To sWord Else Get CM_GetCurrentWord To sWord Send ShowAutoComplete sWord End_Procedure Procedure OnCodelistCancel Set piListReason Of (phoCodelistHandler(Self)) To 0 Set piSourceObject Of (phoCodelistHandler(Self)) To 0 Set pbIsCodelistActive To False Send BlockKey VK_HOME CM_KEY_CTRL False Send BlockKey VK_END CM_KEY_CTRL False End_Procedure // Fills the Codelist with all Methods. Procedure FillCodeListWithMethodsData Integer iType Integer iProcState Boolean bFound Integer hoParser iLine iRet iClsCode String sCls Set piCurrClassID To 0 Set piProcedureState To iProcState Move (piSourceObject(phoCodelistHandler(Self))) To hoParser Move (piSourceLine(phoCodelistHandler(Self))) To iLine If (LineToItemEx(hoParser,MK_OBJECT+MK_CLASS,iLine)) Begin Get psCEl_psClass Of hoParser To sCls If sCls Ne "" Begin Get VDFCls_Search sCls 0 0 to iClsCode If (iClsCode<>0) Begin Send OpenTH3DB of ghoApplication ASDB.File_Number Set piCurrClassID To iClsCode Clear ASDB Move iClsCode To ASDB.VDFCls Move iType To ASDB.Type Repeat Find Gt ASDB by Index.3 Move (Found) To bFound If iClsCode Ne ASDB.VDFCls Move False To bFound If iType Ne ASDB.Type Move False To bFound If bFound Begin Get Codelist_add_item Of (phoCodelistHandler(Self)) (Trim(asdb.name)) "" asdb.recnum To iRet End Until (Not(bFound)) Send CloseTH3DB of ghoApplication ASDB.File_Number End End End End_Procedure Procedure FillCodelistWithArrayData Integer hoSource iItem iRet String sVal Move (piSourceObject(phoCodelistHandler(Self))) To hoSource Move ( (item_count(hoSource)) -1) To iItem While (iItem Ge 0) Get value Of hoSource Item iItem To sVal Get Codelist_add_item Of (phoCodelistHandler(Self)) sVal "" 0 To iRet Decrement iItem End End_Procedure Procedure FillCodelistWithVarData Integer hoSource iLine iRet iItem tParseParam[] ParseParams tParseVar[] ParseVars Move (piSourceObject(phoCodelistHandler(Self))) To hoSource Move (piSourceLine(phoCodelistHandler(Self))) To iLine Get GetParameterListFromLine Of hoSource iLine To ParseParams Get GetVariablenListFromLine Of hoSource iLine To ParseVars For iItem From 0 To (SizeOfArray(ParseVars)-1) Get codelist_add_item Of (phoCodelistHandler(Self)) ParseVars[iItem].sName "" 0 To iRet Loop For iItem From 0 To (SizeOfArray(ParseParams)-1) Get codelist_add_item Of (phoCodelistHandler(Self)) ParseParams[iItem].sName "" 0 To iRet Loop End_Procedure Procedure FillCodelistWithMethodData Integer hoSource iLine iRet iItem iObject iClass Integer iMethod Handle hoID String sLine String sClass tParseMethod[] ParseMethods tParseObject[] ParseObjects tParseClass[] ParseClasses tParseProperty[] ParseProperties Move (piSourceObject(phoCodelistHandler(Self))) To hoSource Move (piSourceLine(phoCodelistHandler(Self))) To iLine Get psSourceLine Of (phoCodelistHandler(Self)) To sLine Send ClearFirstCompoundBeforeMethod (&sLine) Move (Uppercase(Trim(sLine))) To sLine If ("SEND" = sLine) Begin Move MK_PROCEDURE To iMethod End Else If ("GET" = sLine) Begin Move (MK_FUNCTION+MK_PROPERTY) To iMethod End Else If ("SET" = sLine) Begin Move (MK_PROPERTY+MK_SETPROCEDURE) To iMethod End Get pParseObjects of hoSource to ParseObjects If (SizeOfArray(ParseObjects)>0) Begin For iObject from 0 to (SizeOfArray(ParseObjects)-1) Move ParseObjects[iObject].sClass to sClass Move ParseObjects[iObject].pElement to hoID If (hoID<>0) Begin Get GetElementsList of hoSource hoID to ParseMethods For iItem From 0 To (SizeOfArray(ParseMethods)-1) If (ParseMethods[iItem].iType iAnd iMethod) Begin Get codelist_add_item Of (phoCodelistHandler(Self)) ParseMethods[iItem].sName "" 0 To iRet End Loop End Loop End Get pParseClasses of hoSource to ParseClasses If (SizeOfArray(ParseClasses)>0) Begin For iClass from 0 to (SizeOfArray(ParseClasses)-1) Move ParseClasses[iClass].sClass to sClass Move ParseClasses[iClass].pElement to hoID If (hoID<>0) Begin Get GetElementsList of hoSource hoID to ParseMethods For iItem from 0 to (SizeOfArray(ParseMethods)-1) If (ParseMethods[iItem].iType iAnd iMethod) Begin Get codelist_add_item of (phoCodelistHandler(Self)) ParseMethods[iItem].sName "" 0 to iRet End Loop End Loop End If (iMethod iAnd MK_Property) Begin // not quite getting why properties are not in the methods list, but we add them this way Get pParseProperties Of hoSource To ParseProperties For iItem From 0 To (SizeOfArray(ParseProperties)-1) Get codelist_add_item of (phoCodelistHandler(Self)) ParseProperties[iItem].sName "" 0 to iRet Loop End End_Procedure Procedure FillCodelistWithClassData String sBmp sLine Integer iRet hoCache Move (psSourceLine(phoCodelistHandler(Self))) To sLine Move (oClassDataCache(phoCodelistHandler(Self))) to hoCache If (item_count(hoCache)<>0) Begin Send FillCodelistFromCache To (phoCodelistHandler(Self)) End Else Begin Send OpenTH3DB of ghoApplication VDFCLS.File_Number Clear VDFCls Repeat Find Gt VDFCls by Index.1 If (Found and (VDFCLS.Base Eq "Y")) Begin Get codelist_add_CachedItem Of (phoCodelistHandler(Self)) (Trim(vdfcls.name)) (Trim(vdfcls.bitmap)) 0 To iRet End Until (Not(found)) Send CloseTH3DB of ghoApplication VDFCLS.File_Number End End_Procedure Procedure FillCodelistWithObjectData Boolean bStrip Boolean bAddLevel Boolean bRecreateShort Integer iPos Integer iC iItem iTextMaxX iTextX iDel iCur hoParser iLine Integer iVarType iRet Integer iObjCount Number nVdfVersion String sObj sCls sVarName sRef String sObjNext sObjShort tParseObject[] ParseObjects tParseParam[] ParseParams tParseVar[] ParseVars Move (piSourceObject(phoCodelistHandler(Self))) To hoParser Move (piSourceLine(phoCodelistHandler(Self))) To iLine Move (psSourceRefVal(phoCodelistHandler(Self))) To sRef Get fnCurrentVdfVersion Of ghoWorkspaceHandlerEx To nVdfVersion If (nVdfVersion>70) Move True To bStrip Else Move False To bStrip // Add Desktop Get codelist_add_item Of (phoCodelistHandler(Self)) "Desktop" (ClassBitmaps(desktop,"Desktop",MK_CLASS)) -1 To iRet // Add Variables Get GetVariablenListFromLine Of hoParser iLine To ParseVars For iItem From 0 To (SizeOfArray(ParseVars)-1) Move ParseVars[iItem].sName To sVarName Move ParseVars[iItem].iType To iVarType If ((iVarType Eq MK_INTEGER) Or (iVarType Eq MK_HANDLE)) If (Left(Uppercase(sVarName),2)) Eq "HO" Begin Get codelist_add_item Of (phoCodelistHandler(Self)) sVarName "" -1 To iRet End Loop // Add Parameters Get GetParameterListFromLine Of hoParser iLine To ParseParams For iItem From 0 To (SizeOfArray(ParseParams)-1) Move ParseParams[iItem].sName To sVarName Move ParseParams[iItem].iType To iVarType If ((iVarType Eq MK_INTEGER) Or (iVarType Eq MK_HANDLE)) If (Left(Uppercase(sVarName),2)) Eq "HO" Begin Get codelist_add_item Of (phoCodelistHandler(Self)) sVarName "" -1 To iRet End Loop // AddObject Get pParseObjects Of hoParser To ParseObjects Move (SortArray(ParseObjects)) To ParseObjects Move (SizeOfArray(ParseObjects)) To iObjCount If (iObjCount>0) Begin Move False to bAddLevel For iC From 0 To (iObjCount-1) Move ParseObjects[iC].sObject To sObj Move ParseObjects[iC].sClass To sCls Get ReplaceAllMethods sObj To sObj // Remove Procedures and Functions (happens when object in methods) If (bStrip) Begin // Don't show the full object reference, seeing multiple objects per Move False To bRecreateShort // line in a list is distracting Move (Pos(".",sObj)) To iPos If (iPos>0) Begin Move (Left(sObj,iPos-1)) To sObjShort End Else Move sObj To sObjShort If ((iC+1)<(iObjCount-1)) Begin Move (Left(ParseObjects[iC+1].sObject,Pos(".",ParseObjects[iC+1].sObject)-1)) To sObjNext If (sObjNext=sObjShort) Begin // add a level Move True To bAddLevel Move True To bRecreateShort End Else Begin If (bAddLevel) Begin // last in the list with same Move True To bRecreateShort End Move False To bAddLevel End End If (bRecreateShort) Begin // The short notation had multiple entries, add a level to try and make unique Move ParseObjects[iC].sObject To sObj Get ReplaceAllMethods sObj To sObj // Remove Procedures and Functions (happens when object in methods) Move (Pos(".",sObj,iPos+1)) To iPos If (iPos>0) Begin Move (Left(sObj,iPos-1)) To sObjShort End Else Move sObj To sObjShort End End Else Move sObj To sObjShort Get codelist_add_item Of (phoCodelistHandler(Self)) sObjShort (ClassBitmaps(desktop,sCls,MK_CLASS)) iC To iRet Loop End End_Procedure // MK_LR_SOURCEFILES Procedure FillCodelistWithSourceFileData Integer iRet Integer iFile Integer iCount tSourceFile[] SourceFiles Get EnumerateFilesInWorkspace Of oSourceFilesList To SourceFiles Move (SizeOfArray(SourceFiles)) To iCount For iFile From 0 To (iCount-1) // Add Desktop Get codelist_add_item Of (phoCodelistHandler(Self)) SourceFiles[iFile].sFileName "" 0 To iRet Loop End_Procedure // Function DoCodeListInit Handle hCodeList Returns Integer Integer iRet iUseBitmaps hoSource hoIDParas hoIDVars iLine // Integer iItem iCnt iReason iStyle Boolean bInit String sFunc sWord sVal sLang Move True to bInit Get CM_GetLanguage To sLang If (sLang="VDF") Begin // Move (pbCodeListUseBitmaps(phoIniHandler(Self))) To iUseBitmaps Move (piListReason(phoCodelistHandler(Self))) To iReason Case Begin Case ( (iReason Eq MK_LR_INDEXES) or (iReason Eq MK_LR_DATABASEFIELDS) or (iReason Eq MK_LR_KEYS)or (iReason Eq MK_LR_IDETAGS)or (iReason Eq MK_LR_COMMANDS) or (iReason Eq MK_LR_TYPES) or (iReason Eq MK_LR_ATTRIBUTES) or (iReason Eq MK_LR_DATAFILES)) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False // connect the codelist-object without bitmaps Send FillCodelistWithArraydata Case break Case (iReason Eq MK_LR_VARS) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False // connect the codelist-object without bitmaps Send FillCodelistWithVarData Case break Case (iReason Eq MK_LR_METHODS) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False // connect the codelist-object without bitmaps Send FillCodelistWithMethodData Case break Case (iReason Eq MK_LR_CLASSES) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist iUseBitmaps // connect the codelist-object with bitmaps Send FillCodelistWithClassData Case break Case (iReason Eq MK_LR_PROCEDURES) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False // connect the codelist-object without bitmaps Send FillCodelistWithMethodsData ASDB_TYPE_PROCEDURE MK_PROC_PROCEDURE Case break Case (iReason Eq MK_LR_FUNCTIONS) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False // connect the codelist-object without bitmaps Send FillCodelistWithMethodsData ASDB_TYPE_FUNCTION MK_PROC_FUNCTION Case break Case (iReason Eq MK_LR_OBJECTS) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist iUseBitmaps // connect the codelist-object with bitmaps Send FillCodelistWithObjectData Case break Case (iReason Eq MK_LR_SOURCEFILES) Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist False Send FillCodelistWithSourceFileData Case break Case Else // Get Item_Count Of (phoCodeTipHandler(Self)) To iCnt If (iCnt) Begin Send Codelist_connect To (phoCodelistHandler(Self)) hCodelist iUseBitmaps // connect the codelist-object with the delivered listview handle. the second parameter tells the object to use bitmaps (faster) or not (slower) For iItem From 0 To (iCnt-1) Get Value Of (phoCodeTipHandler(Self)) Item iItem To sFunc Get Codelist_add_item Of (phoCodelistHandler(Self)) sFunc "function16.bmp" 0 To iRet Loop End Case End Send SelectClosestCodelistMatch // Set pbIsCodelistActive To True Send BlockKey VK_HOME CM_KEY_CTRL True Send BlockKey VK_END CM_KEY_CTRL True End Else Begin Move False to bInit End Function_Return bInit End_Function // Searches a function xy or procedure xy line in the current edit-buffer // and returns the line or blank if not found // 12.2.2003 BP Function SearchFunctioninParser String sFunction Returns String Integer hoParser iC String sVal Move (phoParser(Self)) To hoParser Move (Trim(sFunction)) To sFunction If (Left(uppercase(sFunction),4)) Eq "MSG_" Move ("procedure " + (Replace("MSG_",(uppercase(sFunction)),""))) To sFunction Else Move ("function " + sFunction) To sFunction Move (SearchBufferForText(hoParser,sFunction)) To sVal Send StripConcatenatingSpaces (&sVal)// no double spaces as it confuses the argument counting logic Function_Return sVal End_Function // Searches a procedure xy line in the current edit-buffer // and returns the line or blank if not found // 12.2.2003 BP Function SearchProcedureinParser String sFunction Returns String Integer hoParser iC String sVal Move (phoParser(Self)) To hoParser Move (Trim(sFunction)) To sFunction Move ("procedure " + sFunction) To sFunction Move (SearchBufferForText(hoParser,sFunction)) To sVal Send StripConcatenatingSpaces (&sVal)// no double spaces as it confuses the argument counting logic Function_Return sVal End_Function // Removes the object reference from a parameter list when calling a method using // get or send. // // Precondition: sParams is uppercase and the object reference is the first thing from // the left. Function RemoveObjectFromMethodParameters String sParams String sRef Returns String Integer iLength String sObjectName Move (Uppercase(sRef)) To sRef // sRef = "of" / "to" Move (Length(sRef)) To iLength If (Left(sParams,iLength)=sRef) Begin // get abc of oObject "1" 2 "three" to iResult // send abc to oObject "1" 1 "three" Move (Trim(Replace(sRef,sParams,""))) To sParams Move (Left(sParams,Pos(" ",sParams))) To sObjectName // oObject If (sObjectName<>"") Move (Trim(Replace(sObjectName,sParams,""))) To sParams Else Move "" To sParams End Function_Return sParams End_Function // // Counts the number of parameters in the expression passed. // Can pass the full expression. // It does this by simply counting the number of comma's in the expression. // This is used for what you type as well as the tooltip // Function ExpressionParamCount String sExpression Returns Integer Integer iParaCount Move 0 To iParaCount While (Pos(",",sExpression)<>0) Increment iParaCount Move (Replace(",",sExpression,"")) To sExpression Loop Function_Return iParaCount End_Function // ExpressionParamCount // // Used to count the parameters in a method (get/set). // Should only pass the parameters, not the full method. // This is used both for what you type as well as the tooltip. When you are typing we need to know if // you are before the parameters (-1) so we can highlight accordingly. Function MethodParamCount String sParams Returns Integer Integer iParamCount String sPart Move -1 To iParamCount // count which parameter we are editing While (sParams<>"") Move (Left(sParams,Pos(" ",sParams))) To sPart If (sPart<>"") Move (Trim(Replace(sPart,sParams,""))) To sParams Else Move "" To sParams Increment iParamCount Loop Function_Return iParamCount End_Function // MethodParamCount // Parse the current Line for a displayable codetip and set's the according properties // returns true if codetip found else returns false // 12.2.2003 BP Function ParseLineForCodeTip Returns Integer Integer iRet iSelLine iLine iCol iPos iBraceLevel iStartBraceLevel iTipArg iOpenBraces String sLine sCurChar sStringMarker sParseString sExpression sTip String sMethodName Set piCodeTipType To C_TIPTYPE_UNDEFINED Get CM_GetSel True To iRet Move (piCodeTipCurrLine(Self)) To iSelLine Move (piSelEndLine(Self)) To iLine Move (piSelEndCol(Self)) To iCol // set the current tip-line if not set (-1) If (iSelLine Eq -1) Set piCodeTipCurrLine To iLine Else If (iSelLine Ne iLine) Begin // remove tip if line was changed Function_Return False End // take the line Get CM_GETLINE iLine To sLine Move (cString(sLine)) To sLine // Take the left part, the right part is not interesting Move (Left(sLine,iCol)) To sLine // Remove all strings (' ', " " and remarks //) For iPos From 1 To (length(sLine)) Move (Mid(sLine,1,iPos)) To sCurChar If sStringMarker Eq "" Begin // not a string If ( (sCurChar Eq "'") Or (sCurChar Eq '"') ) Begin // string starts Move sCurChar To sStringMarker Move (sParseString+" ") To sParseString End Else Begin // not a string If (Mid(sLine,2,iPos)) Eq "//" Move (length(sLine)) To iPos // Remark found - cut the remark Else Move (sParseString+sCurChar) To sParseString End End Else Begin // it is a string If sCurChar Eq sStringMarker Begin // string ends Move (sParseString+" ") To sParseString Move "" To sStringMarker End Else Move (sParseString+" ") To sParseString End Loop Move (Replaces(Character(9),sParseString," ")) To sParseString // replace all horizontal tab characters with spaces // now search for first function that can display a tooltip from right to left Move 0 To iStartBraceLevel Move (length(sParseString)) To iPos Move iStartBraceLevel To iBraceLevel While (iPos Gt 0) Move (Mid(sParseString,1,iPos)) To sCurChar If sCurChar Eq ")" Begin Increment iBraceLevel Increment iOpenBraces End If sCurChar Eq "(" Begin Decrement iBraceLevel Decrement iOpenBraces End If ( (sCurChar Eq ",") And (iBracelevel Le -1) ) Decrement iBraceLevel If iBraceLevel Lt (iStartBraceLevel - 1) Begin If (Pos("(",sExpression)<>0) Move (Left(sExpression,( (Pos("(",sExpression))-1))) To sMethodName Else Move sExpression To sMethodName Move (Trim(sMethodName)) To sMethodName // Search in Edit-Buffer for function or msg_ definition Get SearchFunctionInParser sMethodName To sTip // if not found search in codetiphandler If (sTip = "") Get CodeTipFunction Of (phoCodeTipHandler(Self)) sMethodName To sTip // we have a tooltip (yippie) If (sTip <> "") Begin Set psCodeTipCurrent To sTip Get ExpressionParamCount sExpression To iTipArg Set piCodeTipType To C_TIPTYPE_EXPRESSION Set piCodeTipArgument To iTipArg Function_Return True End // no tooltip for this function, get next one Else Begin Decrement iStartBraceLevel Move 0 To iBraceLevel Move "" To sExpression End End Else If iBraceLevel Le iStartBraceLevel Move (sCurChar + (sExpression)) To sExpression Decrement iPos Loop // no tooltip found in function expression, now check for a get or send expression Move (uppercase((" " + sParsestring))) To sExpression Send StripConcatenatingSpaces (&sExpression) // no gap of more as one space as it will confuse parameter counting If (Pos(" GET ",sExpression)<>0) Begin Move (Right(sExpression,((length(sExpression)) - 4 - (Pos(" GET ",sExpression))))) To sExpression Move (Trim(sExpression)) To sExpression If (Pos(" ",sExpression)<>0) Begin Move (Left(sExpression,(Pos(" ",sExpression)))) To sMethodName // removes any parameters, leaving bare function name Move (Trim(Replace(sMethodName,sExpression,""))) To sExpression // only contains parameters now End Else Begin Move sExpression To sMethodName Move "" To sExpression End Get SearchFunctionInParser sMethodName To sTip If (sTip <> "") Begin Get RemoveObjectFromMethodParameters sExpression "of" to sExpression Move (Replaces(" TO ",sExpression," ")) To sExpression // remove to as well if it is there Get MethodParamCount sExpression To iTipArg Set psCodeTipCurrent To sTip Set piCodeTipArgument To iTipArg Set piCodeTipType To C_TIPTYPE_FUNCTION Function_Return True End End If (Pos(" SEND ",sExpression)<>0) Begin Move (Right(sExpression,((length(sExpression)) - 5 - (Pos(" SEND ",sExpression))))) To sExpression Move (Trim(sExpression)) To sExpression If (Pos(" ",sExpression)<>0) Begin Move (Left(sExpression,(Pos(" ",sExpression)))) To sMethodName // removes any parameters, leaving bare function name Move (Trim(Replace(sMethodName,sExpression,""))) To sExpression // only contains parameters now End Else Begin Move sExpression To sMethodName Move "" To sExpression End Get SearchProcedureInParser sMethodName To sTip If (sTip <> "") Begin Get RemoveObjectFromMethodParameters sExpression "of" to sExpression Get RemoveObjectFromMethodParameters sExpression "to" to sExpression Get MethodParamCount sExpression To iTipArg Set psCodeTipCurrent To sTip Set piCodeTipArgument To iTipArg Set piCodeTipType To C_TIPTYPE_PROCEDURE Function_Return True End End If iOpenBraces Ge 0 Function_Return False // no open function expression and no get/send expression found. remove tooltip If (psCodeTipCurrent(Self)) Ne "" Function_Return True Function_Return False End_Function // Codetip is requested, return true (1) to display codetip or false (0) to not display a codetip // changed the initial codetip request so that it is returned false if no codetip is to display // otherwise there is always a codetip created (invisible) and immediately destroyed in OnCodetipUpdate // 12.2.2003 BP Procedure OnCodeTip Integer iEnabled iRet // Should not be zero if successfull... Get pbUseCodeTips Of (phoIniHandler(Self)) To iEnabled If ( (Not(iEnabled)) And (psOpenBracketTip(Self)) Ne "") Begin Set psCodeTipCurrent To (psOpenBracketTip(Self)) Set piCodeTipArgument To -2 Set piCodeTipCurrLine To -1 Procedure_Return True End If (Not(iEnabled)) Procedure_Return False Get CodeTipInitialize Of (phoCodeTipHandler(Self)) To iRet If (Not(iRet)) Procedure_Return False If (psOpenBracketTip(Self)) Eq "" Set piCodeTipCurrLine To -1 // Reset, new tip requested Get ParseLineForCodeTip To iRet If ( (Not(iRet)) And (psOpenBracketTip(Self)) Ne "") Begin Set psCodeTipCurrent To (psOpenBracketTip(Self)) Set piCodeTipArgument To -2 Set piCodeTipCurrLine To -1 Move 1 To iRet End Procedure_Return iRet End_Procedure // Codetip is to be updated, return true (1) to update the codetip or false (0) to not updating codetip // Check the line for codetip and remove it if necessary // 12.2.2003 BP Procedure OnCodeTipUpdate Integer iRet Get ParseLineForCodeTip To iRet If ( (Not(iRet)) And (psOpenBracketTip(Self)) Ne "") Begin Set psCodeTipCurrent To (psOpenBracketTip(Self)) Set piCodeTipArgument To -2 Set piCodeTipCurrLine To -1 Move 1 To iRet End If (Not(iRet)) Send DoCodeTipCancel Procedure_Return iRet End_Procedure // **WvA 06-05-2002: Added context sensitive help for the VDF-user. // The code windowshelp in VDF is up to Vdf8 SP2 in the vdfcode.hlp file. This method will // invoke the windows helpfile and show the topic that is currently under the cursor. // Normally invoked by CTRL+F1 Procedure ContextSensitiveHelp Integer iVoid String sHelpFile sWord sVdfRootDir Number nVer Handle hoHelp Get psVdfRootDir Of ghoWorkSpaceHandlerEx To sVdfRootDir Get vFolderFormat sVdfRootDir to sVdfRootDir Get fnCurrentVdfVersion Of ghoWorkSpaceHandlerEx To nVer // 70=VDF7, 82=VDF8.2 // ** SVN 29/01-2003: // I do not like to get something like "(Trim(sStr))" in Help window! Get CM_GetCurrentWord To sWord If (nVer <= 90) Begin Move (sVdfRootDir +'\Help\VdfCode.hlp') To sHelpFile If (Length(sWord)>1) Move (WinHelpStr(Container_Handle(Self), sHelpFile, HELP_PARTIALKEY, sWord)) To iVoid End Else Begin // Get Create u_cHtmlHelp to hoHelp If (hoHelp) Begin // Disable the "always on top" state as it is not very convenient. // It breaks alt-tab and can no longer edit the file under the helpfile. Set pbAlwaysOnTop of hoHelp To False If (nVer=91) Begin // vdf9.1 only Set psHelpFile of hoHelp to (sVdfRootDir+"Help\VDF9.chm") End Else If (nVer<180) Begin Set psHelpFile of hoHelp to (sVdfRootDir+"Help\VisualDataFlex.chm") End Else Begin Set psHelpFile of hoHelp to (sVdfRootDir+"Help\DataFlex.chm") End If (Length(sWord)>1) Begin Send DoDisplayKeyword of hoHelp (sWord+Character(0)) End Else Begin Send DoDisplayIndex of hoHelp End Send Destroy of hoHelp End End End_Procedure // ContextSensitiveHelp Function GetLeftFromPrnLine String sLine Returns String Integer iFinished iPos String sLeft Move 1 To iPos While iPos Le (length(sLine)) If (Mid(sLine,1,iPos)) In ">1234567890" Move (sLeft + (Mid(sLine,1,iPos)) ) To sLeft Else Move (length(sLine)) To iPos Increment iPos End Function_Return sLeft End_Function Function GetDepth String sLine Returns Integer Integer iRetVal While (Pos(">",sLine)) Ne 0 Increment iRetVal Move (Replace(">",sLine,"")) To sLine End Function_Return iRetVal End_Function // Fixed to work with VDF8 and higher // 02.01.2004 BP Function FindCurrentInclude Returns String Integer iRet iFinished iPos iCur iCurDepth iNewDepth iCurLine iCurCol String sCurrentFindText sLine sFile sLeft sRight sNewLine Get CM_GetSel False To iRet Move (piSelEndLine(Self)) To iCurLine Move (piSelEndCol(Self)) To iCurCol Get value To sLine If (Left(uppercase(Trim(sLine)),16)) Eq "INCLUDING FILE: " Begin Move (Replace("INCLUDING FILE: ",(uppercase(Trim(sLine))),"")) To sFile If (Pos(" ",sFile)<>0) Begin Move (Left(sFile,(Pos(" ",sFile)))) To sFile Move (Trim(sFile)) To sFile End Function_Return sFile End Get GetLeftFromPrnLine sLine To sLeft If (Trim(sLeft)) Eq "" Begin Function_Return "" End Move (Replace(sLeft,sLine,"")) To sRight If (Left(uppercase(Trim(sRight)),4)) Eq "USE " Begin Move (Replace("USE ",(uppercase(Trim(sRight))),"")) To sLine Move (Trim(sLine)) To sLine Move 1 To iPos Move "" To sFile While (iPos Le (length(sLine)) ) If ( ((Mid(sLine,1,iPos)) Eq " ") Or ((Mid(sLine,1,iPos)) Eq "/") ) Move (length(sLine)) To iPos Else Move (sFile + (Mid(sLine,1,iPos)) ) To sFile Increment iPos End If (Pos(" ",sFile)<>0) Begin Move (Left(sFile,(Pos(" ",sFile)))) To sFile Move (Trim(sFile)) To sFile End Function_Return sFile End Move (GetDepth(Self,sLeft)) To iCurDepth If iCurDepth Eq 1 Begin // must be main-source Get value Item 0 To sLine Move (Replace("COMPILING PROGRAM: ",(uppercase(Trim(sLine))),"")) To sFile If (Pos(" ",sFile)<>0) Begin Move (Left(sFile,(Pos(" ",sFile)))) To sFile Move (Trim(sFile)) To sFile End Function_Return sFile End Set dynamic_update_state1 To False Get CM_GetFindText To sCurrentFindText Get CM_SetFindText "INCLUDING FILE: " To iRet Move 0 To iFinished While (Not(iFinished)) Move (current_item(Self)) To iCur Send FindPrevious If (current_item(Self)) Eq iCur Move 1 To iFinished Else Begin Get value Item ((current_item(Self))-1) To sNewLine Get GetLeftFromPrnLine sNewLine To sNewLine Move (GetDepth(Self,sNewLine)) To iNewDepth If iNewDepth Lt iCurDepth Begin Get value To sLine Move (Replace("INCLUDING FILE: ",(uppercase(Trim(sLine))),"")) To sFile Get CM_SetSel iCurLine iCurCol iCurLine iCurCol True To iRet Set dynamic_update_state1 To True If (Pos(" ",sFile)<>0) Begin Move (Left(sFile,(Pos(" ",sFile)))) To sFile Move (Trim(sFile)) To sFile End Function_Return sFile End End End Get CM_SetSel iCurLine iCurCol iCurLine iCurCol True To iRet Set dynamic_update_state1 To True Function_Return "" End_Function // Tries to open the file under the cursor. Procedure OpenFileUnderCursor String sWord sPathWord sFileName String sEditedFile sTable sExt sErr Boolean bIsHttp Get GetFileName To sEditedFile // handle prn's different Get ParseFileExtension sEditedFile To sExt If ( uppercase(sExt) = "PRN" Or uppercase(sExt) = "PRP" ) Begin Set LexerProperty "fold.dataflex.compilerlist" To "1" // enable advanced code folding for prn/prp files Get FindCurrentInclude To sWord If (sWord Eq "") Procedure_Return End Else Begin Get CM_GetCurrentWordIncludingDot To sWord // Gets current word with not stopping on "." only with blanks! If (sWord = "") Begin Error 200 (_T("OpenFileUnderCursor: There is no word under the cursor.", 1554)) Procedure_Return End End Move false To bIsHttp If (Left(lowercase(sWord),5)="http:" or Left(lowercase(sWord),6)="https:") Move True to bIsHttp If (bIsHttp) Begin // open associated browser Send vShellExecute "OPEN" sWord "" "" End Else Begin Move sWord To sPathWord If Not "." In sPathWord Append sPathWord ".pkg" Get FindFileForWorkspace of ghoWorkSpaceHandlerEx sPathWord to sFileName If (sFileName="") Get FindFirstFileInTHWorkspaceFolder of ghoApplication sPathWord to sFileName If (sFileName <> "") Begin Get FileNameOnDisk sFileName To sFileName // Case sensitivity correction if needed Delegate Send CAOpenFile sFileName End Else Begin Get isCurrentWordaTable sWord To sTable If (sTable<>"") Begin Send LaunchDBEUtility sTable End Else Begin #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[1555], sWord)) to sErr #ELSE Move ('OpenFileUnderCursor: File "'+sWord+'" not found.') to sErr #ENDIF Error 200 sErr End End End End_Procedure // Not USED // Tries to find the method in the current line. Procedure TryToIdentifyCurrentMethod Boolean bFound Integer hoID String sL sMethod sClass sInfo Delegate Send ShowMethodInfo "" Get value To sL Move (Trim(lowercase(sL))) To sL Move (oLineParser(Self)) To hoID Set psSepCharacter Of hoID To " " Set piSkipEmptyParts Of hoID To True Send ParseLine To hoID sL If (Value(hoID,0)) In "send,get,set,procedure,function" Begin Get value Of hoID Item 1 To sMethod End If (Value(hoID,0)) Eq "move" Begin Get value Of hoID Item 1 To sMethod If (Left(sMethod,1)) Eq "(" Begin Move (Replace("(",sMethod,"")) To sMethod Move (Left(sMethod,Pos("(",sMethod)-1)) To sMethod End End If sMethod Ne "" Begin Send OpenTH3DB of ghoApplication VDFPROP.File_Number Clear VDFProp Move sMethod To VDFProp.Name Find Ge VDFProp by Index.2 Move (Found) To bFound If (VDFProp.Name <> sMethod) Move False To bFound If (bFound) Delegate Send ShowMethodInfo (Trim(VDFProp.Descr)) Send CloseTH3DB of ghoApplication VDFPROP.File_Number // if (GetCurrentElement(Self,MK_OBJECT+MK_CLASS)) Begin // Get the current element-> only Object or Class! // get psCEl_psClass of (phoParser(Self)) to sClass // move (Trim(sClass)) to sClass // Clear VDFCLS // move sClass to VDFCLS.Name // Find eq VDFCLS by Index.1 // [Found] Begin // Open ASDB // Clear ASDB // move VDFCLS.Code to ASDB.VdfCls // move sMethod to ASDB.Name // Find eq ASDB by Index.1 // [Found] Begin // Delegate send ShowMethodInfo (ASDBInfoString(0)) // End // End // End End End_Procedure Procedure ListCreator Boolean bInsert Integer iRet iLine hoParser String sRef sLine sValue sStart Move (phoParser(Self)) To hoParser Get CM_GetSel False To iRet Move (piSelEndLine(Self)) To iLine Move (GetCurrentRef(Self)) To sRef Get Value Item iLine To sValue If (Trim(sValue)) Ne "" ; If Not (Trim(Lowercase(sValue))) In "get@set@send@move@" Move True To bInsert Move (Left(Trim(sValue),4)) To sValue Move (Lowercase(Trim(sValue))) To sValue Move "Set" To sStart If sValue In "get@set@send@move@" Move sValue To sStart Get GetCreatorLine Of Desktop sRef hoParser iLine sStart To sLine If sLine Ne "" Begin If bInsert Send Insert sLine Else Set ValueSmart Item iLine To sLine End End_Procedure Procedure ListObjects Send ShowLanguageList True MK_LR_OBJECTS End_Procedure Procedure ListVars Send ShowLanguageList True MK_LR_VARS End_Procedure Procedure ListKeys Send ShowLanguageList True MK_LR_KEYS End_Procedure Procedure ListIDETags Send ShowLanguageList True MK_LR_IDETAGS End_Procedure Procedure ListCommands Send ShowLanguageList True MK_LR_COMMANDS End_Procedure Procedure ListProcedures Send ShowLanguageList True MK_LR_PROCEDURES End_Procedure Procedure ListFunctions Send ShowLanguageList True MK_LR_FUNCTIONS End_Procedure Procedure ListClasses Send ShowLanguageList True MK_LR_CLASSES End_Procedure Procedure ListDataFiles Send ShowLanguageList True MK_LR_DATAFILES End_Procedure Procedure ListSourceFiles Send ShowLanguageList True MK_LR_SOURCEFILES End_Procedure // Synchronisiert den Element mit Procedure SyncCodeView Integer iRet iL Get CM_GetSel False To iRet If iRet Begin Get LineToItem Of (phoParser(Self)) (piSelEndLine(Self)) To iRet If iRet Begin Get piCEl_pItemNr Of (phoParser(Self)) To iRet Set Current_Item Of (phoElements(Self)) To iRet End End End_Procedure Procedure VDFSyntaxCheck Integer iLine String sLine sChar sTextchar sLineAbove String sEOLComment sTemp Integer iBraces iPos iLength iIsText iRet iLineTmp iCurHighline iECPos If iLine Gt (SC_LineCount(Self)) Procedure_Return Get CM_GETLINE iLine To sLine Get cm_getHighlightedLine To iCurHighLine Move (cString(sLine)) To sLine Move "//" To sEOLComment Move (Pos(sEOLComment,sLine)) to iECPos If (iECPos <> 0) Begin // test if not a EOL comment in a string! For iPos From 1 to iECPos Move (Mid(sLine,1,iPos)) To sChar If (sTextchar Eq "") Begin If sChar Eq '"' Move sChar To sTextchar If sChar Eq "'" Move sChar To sTextchar End Else If sChar Eq sTextchar Move "" To sTextchar Loop If (sTextchar="") Begin Move (Left(sLine,iECPos-1)) To sLine End End If (Right(Trim(sLine),1)) Eq ";" Procedure_Return Move (iLine -1) To iLineTmp While (iLineTmp Ge 0) Get CM_GETLINE iLineTmp To sLineAbove Move (cString(sLineAbove)) To sLineAbove If (Pos("//",sLineAbove)) Ne 0 Move (Left(sLineAbove,((Pos("//",sLineAbove))-1))) To sLineAbove If (Right(Trim(sLineAbove),1)) Eq ";" Move (sLineAbove + sLine) To sLine Else If (length(Trim(sLineAbove))) Gt 0 Move -1 To iLineTmp Decrement iLineTmp End If (length(sLine)) Le 0 Begin If ( ((psOpenBracketTip(Self)) Ne "") And (iLine Eq iCurHighLine) ) Begin Set psOpenBracketTip To "" Send DoCodeTipCancel Get CM_SetHighlightedLine -1 To iRet End Procedure_Return End If (length(sLine)) Gt 3000 Procedure_Return For iPos From 1 To (length(sLine)) Move (Mid(sLine,1,iPos)) To sChar If (sTextchar Eq "") Begin If sChar Eq '"' Move sChar To sTextchar If sChar Eq "'" Move sChar To sTextchar End Else If sChar Eq sTextchar Move "" To sTextchar If sTextchar Eq "" Begin If sChar Eq "(" Increment iBraces If sChar Eq ")" Decrement iBraces End Loop If iBraces Ne 0 Begin #IFDEF TH_TRANSLATION If iBraces Gt 0 Set psOpenBracketTip to (Replace("%1", gILanguage[1556], ")")) If iBraces Lt 0 Set psOpenBracketTip to (Replace("%1", gILanguage[1556], "(")) #ELSE If iBraces Gt 0 Set psOpenBracketTip to ('*** WARNING: A ")" is missing in the marked Line! ***') If iBraces Lt 0 Set psOpenBracketTip to ('*** WARNING: A "(" is missing in the marked Line! ***') #ENDIF Send CodeTip Get CM_SetHighlightedLine iLine To iRet Get cm_setbookmark iLine True To iRet End Else Begin If ( ((psOpenBracketTip(Self)) Ne "") And (iLine Eq iCurHighLine) ) Begin Set psOpenBracketTip To "" Send DoCodeTipCancel Get CM_SetHighlightedLine -1 To iRet End End End_Procedure Procedure onKeyUp Longptr iKey Longptr LParam Forward Send onKeyUp iKey LParam //if iKey eq VK_Return send ParseBuffer // Better here becouse Line is already inserted End_Procedure // Trapped for current pos -> StatusBar Procedure onSelChange Integer iRet iLine iCol iLineCount iOldLine String sLang Get CM_GetSel False To iRet // Keep doing this as there will be code that depends on the properties it sets Get CurrentLine to iLine Get CurrentColumn to iCol Delegate Send ShowCursorPosition iLine iCol If (pbIsCodelistActive(Self)) Send SelectClosestCodelistMatch If (piLastLineNumber(Self) <> piSelEndLine(Self)) Begin Send CheckCurrentFileReadOnlyState Get CM_GetLanguage To sLang Delegate Send ShowLanguageInfo sLang Get piLastLineNumber To iOldLine Set piLastLineNumber To (piSelEndLine(Self)) If (sLang Eq "VDF") Begin If ( ((CM_GetHighlightedLine(Self)) Eq -1) And ( (psOpenBracketTip(Self)) Ne "") ) Begin Set psOpenBracketTip To "" Send DoCodeTipCancel End Send VDFSyntaxcheck iOldLine End End End_Procedure Procedure SetCurrentLineToOwerDraw Integer iRet iLine iCol iLineCount Get CM_GetSel False To iRet // not normalize becouse then isnt EndPosition the cursor pos. If iRet Begin // Shows the position in the StatusBar. Move (piSelEndLine(Self)) To iLine Move (piSelEndCol(Self)) To iCol Move (CM_SetLineStyle(Self,iLine,CML_OwnerDraw)) To iRet End End_Procedure // Trapped for INS/OVR -> StatusBar Procedure onOvertypeChange Integer iMode Move (CM_IsOvertypeEnabled(Self)) To iMode Delegate Send ShowInsert (Not(iMode)) End_Procedure Procedure Toggle_Overtype Integer iRet Move (CM_EnableOvertype(Self, (Not(CM_IsOvertypeEnabled(Self))))) To iRet End_Procedure // Only for demonstration purposes. // Openes a file if it is dragged into it. Procedure OnFileDropped String sFile Delegate Send CAOpenFile sFile End_Procedure // Returns the Position of a corresponding "(" for the last ")" // 15.05.2001 Bernhard Function OpenBracketPos String sLine Returns Integer Integer iLevel iString String sPart Move 0 To iString While sLine Ne "" Move (Mid(sLine,1,(length(sLine)) )) To sPart Move (Left(sLine,((length(sLine)) -1) )) To sLine If sPart Eq "'" Move (Not(iString)) To iString If sPart Eq '"' Move (Not(iString)) To iString If ( (Not(iString)) And (sPart Eq ")")) Increment iLevel If ( (Not(iString)) And (sPart Eq "(")) Decrement iLevel If iLevel Eq 0 Function_Return ((length(sLine)) + 1) End Function_Return -1 End_Function // Key capturing... Procedure onCMKeyDown Longptr iKeyCode Longptr iKeyExt If ( (pbIsCodelistActive(Self)) And (iKeyCode Eq VK_HOME) And (iKeyExt Eq CM_KEY_CTRL) ) Send Codelist_Beginning_Of_Data To (phoCodeListHandler(Self)) If ( (pbIsCodelistActive(Self)) And (iKeyCode Eq VK_END) And (iKeyExt Eq CM_KEY_CTRL) ) Send Codelist_End_Of_Data To (phoCodeListHandler(Self)) If iKeyCode Eq VK_RETURN Set piEnterIsDown To True End_Procedure // Key capturing... Procedure onCMKeyUp Longptr iKeyCode Longptr iKeyExt Integer iRet iEnde String sLine If iKeyExt Ne 0 If iKeyCode Eq VK_RIGHT Move 0 To iKeyCode If iKeyCode Eq VK_RETURN If (Not(piEnterIsDown(Self))) Move 0 To iKeyCode If iKeyCode Eq VK_RETURN Set piEnterIsDown To False Get isListReason iKeyCode To iRet If iRet Ne MK_LW_NO If iRet Ne MK_LR_CREATOR Begin If (pbCodeTipRequest(Self)) Begin Send CancelCodetip // there can be only one, codetip OR autocomplete Set pbHadTipBeforeAutocomplete To True End Else Begin Send CodeTipReset End Send ShowLanguageList True iRet End If (pbCodeTipRequest(Self)) Begin Set pbCodeTipRequest To False Send CodeTip End Else Begin // **WvA 15-11-2004 Added support to cancel the debugwindow with the Escape key If (iKeyCode Eq VK_ESCAPE) Send Request_Cancel End End_Procedure Function TranslateCharacter Integer iKeyCode Returns Integer Integer iChar String sCharTrans Move 0 To iChar Move (Mid(psCharTranslation(ghoEditorProperties),9,(Pos(("|"+(String(iKeyCode))+";"),(psCharTranslation(ghoEditorProperties)))) )) To sCharTrans Move (Mid(sCharTrans,5,(Pos(";",sCharTrans)))) To sCharTrans Move (Left(sCharTrans,(Pos("|",sCharTrans)))) To sCharTrans Move (Replaces(";",sCharTrans,"")) To sCharTrans Move (Replaces("|",sCharTrans,"")) To sCharTrans If (sCharTrans<>"") Move (Integer(sCharTrans)) To iChar Function_Return iChar End_Function Function ShouldTranslateCharacter Integer iKeyCode Returns Boolean Function_Return ((Pos(("|"+(String(iKeyCode))+";"),(psCharTranslation(ghoEditorProperties)))) Ne 0) End_Function // Capturing KeyPress for Mark of Brackets. It must be KeyPress because KeyDown/KeyUp deliver // Scan-Codes (which would be a problem if using different keyboard-layouts) // whereas KeyPress delivers the Ascii-Value Of the Key pressed. 15.05.2001 Bernhard // Added Character translation so if a specified key is pressed some other char is inserted. // 7.2.2003 BP Procedure onCMKeyPress Longptr iKeyCode Longptr iKeyExt Forward Send onCMKeyPress iKeyCode iKeyExt If ( (iKeyCode Eq (Ascii(" "))) And (pbIsCodelistActive(Self)) ) Send CancelCodelist If ( (iKeyCode Eq (Ascii("("))) And (pbIsCodelistActive(Self)) ) Begin If (piListReason(phoCodelistHandler(Self))) Ne MK_LR_KEYS Send CancelCodelist Else Set piInListCol To ((piInListCol(Self))+1) End // automatic CodeTip support. property pbCodeTipRequest is checked in onCmKeyUp since codetip need the ( that was currently typed // 30.1.2003 BP If (iKeyCode Eq (Ascii("("))) Begin If (pbCodetipRequest(Self)=False) Set psCodeTipCurrent to "" // reset the content, don't show old lingering tooltips Set pbCodeTipRequest To True End End_Procedure // To allow selection with enter. Procedure DoKeyReturn Integer iLine iCol Integer iAutoClose If (isListReason(Self,VK_RETURN)) Eq MK_LR_CREATOR Begin Send BlockKeyOnce VK_RETURN CM_KEY_NOEXT True Send ListCreator End Else If Not (isKeyBlocked(Self,VK_RETURN,0)) Begin Get AutoCloseScope To iAutoClose Forward Send DoKeyReturn If (iAutoClose<>MK_PROC_NONE) Begin Get CurrentLine To iLine Get CurrentColumn To iCol If (iAutoClose=MK_PROC_PROCEDURE) Begin Send InsertTextAtPosition iLine iCol "\n\tEnd_Procedure" End Else If (iAutoClose=MK_PROC_FUNCTION) Begin Send InsertTextAtPosition iLine iCol "\n\tEnd_Function" End Else If (iAutoClose=MK_PROC_BEGIN) Begin Send InsertTextAtPosition iLine iCol "\n\tEnd" End Else If (iAutoClose=MK_PROC_WHILE) Begin Send InsertTextAtPosition iLine iCol "\n\tLoop" End Else If (iAutoClose=MK_PROC_REPEAT) Begin Send InsertTextAtPosition iLine iCol "\n\tUntil (false)" End End End End_Procedure // Property change notification... Register_Object oEditorElements Procedure onPropsChange Set psEditorHotKeys Of (phoIniHandler(Self)) to (CMGetHotkeys()) Set piLineNumbering Of (phoIniHandler(Self)) To (CM_GetLineNumbering(Self)) // Set psLanguage Of (phoIniHandler(Self)) To (CM_GetLanguage(Self)) Set pbScrollBarH Of (phoIniHandler(Self)) To (CM_HasScrollBar(Self,True)) Set pbScrollBarV Of (phoIniHandler(Self)) To (CM_HasScrollBar(Self,False)) Set pbLeftMargin Of (phoIniHandler(Self)) To (CM_IsLeftMarginEnabled(Self)) Set pbDragDrop Of (phoIniHandler(Self)) To (CM_IsDragDropEnabled(Self)) Set pbColumnSel Of (phoIniHandler(Self)) To (CM_IsColumnSelEnabled(Self)) Set piAutoIndentMode Of (phoIniHandler(Self)) To (CM_GetAutoIndentMode(Self)) Set piTabSize Of (phoIniHandler(Self)) To (CM_GetTabSize(Self)) Set pbTabExpand Of (phoIniHandler(Self)) To (CM_IsTabExpandEnabled(Self)) Set pbNormalizeCase Of (phoIniHandler(Self)) To (CM_IsNormalizeCaseEnabled(Self)) Set pbSelBounds Of (phoIniHandler(Self)) To (CM_IsSelBoundsEnabled(Self)) Set pbCaseSensitive Of (phoIniHandler(Self)) To (CM_IsCaseSensitiveEnabled(Self)) Set pbWholeWord Of (phoIniHandler(Self)) To (CM_IsWholeWordEnabled(Self)) Send NotifyColorEditorChange To (oEditorElements(Parent(Self))) End_Procedure Procedure SetLanguage String sFile Integer iRet hoIni Handle hoID String sLang Move (phoIniHandler(Self)) To hoIni Move (LanguageForFile(hoIni,sFile)) To sLang // If sLang eq "" move (psLanguage(hoIni)) To sLang Move (CM_SetLanguage(Self,sLang)) to iRet Get phoParser to hoID Set Language of hoID to sLang End_Procedure // Sets all... (sent by Page_Object & ApplyToEditor) Procedure SetAdjustments Boolean bIsPaged Boolean bIsOemMode Boolean bIsUtf8Mode Integer hoIni iRet // Font Face String sLanguage String sFontData String sFontTemp String sFontFace Integer iFontSize Integer iCharSet // Move (CM_ENABLEGLOBALPROPS(Self,False)) To iRet Move ghoEditorProperties to hoIni Move (CM_SetLineNumbering(Self,Low(piLineNumbering(hoIni)),Hi(piLineNumbering(hoIni)),Low(piLineNumbering(hoIni)))) to iRet Move (CM_EnableLeftMargin(Self,pbLeftMargin(hoIni))) to iRet Get psLanguage of hoIni to sLanguage Move (CM_SetLanguage(Self,sLanguage)) to iRet Move (CM_ShowScrollBar(Self,True,pbScrollBarH(hoIni))) To iRet Move (CM_ShowScrollBar(Self,False,pbScrollBarV(hoIni))) To iRet // Editor font face? Move (psFontFace(ghoEditorProperties)) to sFontData If (sFontData="") Begin Move "11pt; 0; Courier New" to sFontData End // Font Size Move (Left(sFontData, Pos(";", sFontData))) to sFontTemp Move (Trim(Replace(sFontTemp, sFontData, ""))) to sFontData Move (Trim(Replace("PT;", Uppercase(sFontTemp), ""))) to iFontSize // Code Page Move (Left(sFontData, Pos(";", sFontData))) to sFontTemp Move (Trim(Replace(sFontTemp, sFontData, ""))) to sFontData Move (Trim(Replace(";", sFontTemp, ""))) To iCharSet Get pbIsOemMode Of ghoEditorProperties To bIsOemMode If (bIsPaged) Begin Get pbIsUtf8Mode Of ghoEditorProperties To bIsUtf8Mode End Else Begin // Don't change an existing UTF8 mode of a document when this method is called from the // Hammer Options screen. Get pbUtf8Mode to bIsUtf8Mode End // If (bIsUtf8Mode) Begin Send EditorMessage SCI_SETCODEPAGE SC_CP_UTF8 Move SC_CHARSET_ANSI to iCharSet Set pbOemMode To False Set pbUtf8Mode To True End Else Begin // Send EditorMessage SCI_SETCODEPAGE 0 // must tell scintilla to switch to single byte mode // Set pbUtf8Mode To False Set pbOemMode To bIsOemMode If (bIsOemMode) Begin If (iCharSet<=0) Begin Move SC_CHARSET_OEM to iCharSet End End End // Font Face Move (Trim(sFontData)) to sFontFace // Send EditorMessage SCI_STYLESETFONT STYLE_DEFAULT (AddressOf(sFontFace)) Send EditorMessage SCI_STYLESETSIZE STYLE_DEFAULT iFontSize Send EditorMessage SCI_STYLESETCHARACTERSET STYLE_DEFAULT iCharSet Send EditorMessage SCI_STYLESETSIZE STYLE_LINENUMBER (iFontSize-1) // Set font size // Set pbShowMatchingBraces to (pbShowMatchingBraces(hoIni)) If (pbShowIndentGuides(hoIni)) Begin Send ShowIndentationGuides End Send SelectTillEndOfLine (pbSelectWholeLine(hoIni)) Move (CM_EnableDragDrop(Self,pbDragDrop(hoIni))) To iRet Move (CM_EnableColumnSel(Self,pbColumnSel(hoIni))) To iRet Move (CM_SetAutoIndentMode(Self,piAutoIndentMode(hoIni))) To iRet Move (CM_SetTabSize(Self,piTabSize(hoIni))) To iRet Move (CM_EnableTabExpand(Self,pbTabExpand(hoIni))) To iRet Move (CM_EnableNormalizeCase(Self,pbNormalizeCase(hoIni))) To iRet Move (CM_EnableSelBounds(Self,pbSelBounds(hoIni))) To iRet Move (CM_EnableCaseSensitive(Self,pbCaseSensitive(hoIni))) To iRet Move (CM_EnableWholeWord(Self,pbWholeWord(hoIni))) To iRet End_Procedure Procedure onModifiedChange Integer bModified Delegate Send onModifiedChange bModified End_Procedure // Sets the Undo and Redo buttons in the toolbar. Procedure onChange Integer iUndo iRedo // Move (CM_CanUndo(Self)) To iUndo Move (CM_CanRedo(Self)) To iRedo Delegate Send ShadowToolBarItem TBItem_Undo (Not(iUndo)) Delegate Send ShadowToolBarItem TBItem_Redo (Not(iRedo)) Send ToggleLineChanged Set pbShowMatchingBraces to (pbShowMatchingBraces(ghoEditorProperties)) If (pbShowIndentGuides(ghoEditorProperties)) Begin Send ShowIndentationGuides End Send SelectTillEndOfLine (pbSelectWholeLine(ghoEditorProperties)) End_Procedure // // Some actions like undo/redo do not trigger onSelchange and as such you don't // always get to see the correct line/column. This should fix that. // Procedure onUpdateCursorPosition Integer iCol Integer iLine Get CurrentLine to iLine Get CurrentColumn to iCol Delegate Send ShowCursorPosition iLine iCol End_Procedure // Fills Properties with the FileDateTime. Procedure FillFileTimeStamp String sFile Date dDat Integer iH iM Is Get_File_Path sFile To sFile If sFile Eq "" Procedure_Return Set pnFileTimeStamp To (MKTimeStampOfFile(sFile)) End_Procedure // To check if file was changed outside of the editor. Function isFileTimeChanged String sFile Returns Integer If sFile Eq "" Function_Return 0 Function_Return (MKTimeStampOfFile(sFile) Ne pnFileTimeStamp(Self)) End_Function // Save and Restore BookMarks. Procedure SaveBookMarks String sFile String sData iCount Move (CM_GetAllBookMarks(Self)) To sData Move (piBookMarkCnt(Self)) To iCount Send THWS_SaveBookmarks sFile sData iCount End_Procedure Procedure LoadBookMarks String sFile Integer iRet iFile tTHWorkspace THWorkspace Get THWS_FindFile sFile To iFile Get pTHWorkspace of ghoApplication To THWorkspace If (iFile>=0) ; Move (CM_SetAllBookMarks(Self,THWorkspace.taSources[iFile].iBookmarkCount,THWorkspace.taSources[iFile].sBookmarks)) to iRet End_Procedure Procedure DeleteBookMarks End_Procedure // Save and Restore the current position if a file. Procedure SaveCurrentPos String sFile Integer iRet Get CM_GetSel False To iRet Send THWS_SaveCursorPosition sFile (piSelEndLine(Self)) (piSelEndCol(Self)) End_Procedure Procedure LoadCurrentPos String sFile Integer iFile iLine iCol iRet tTHWorkspace THWorkspace Get THWS_FindFile sFile to iFile If (iFile>=0) Begin Get pTHWorkspace of ghoApplication To THWorkspace Move THWorkspace.taSources[iFile].iCursorLine to iLine Move THWorkspace.taSources[iFile].iCursorColumn to iCol Move (CM_SetSel(Self,iLine,iCol,iLine,iCol,True)) to iRet End End_Procedure // // Checks the current file if it is readonly and verifies it against // the state of the codemax edit control for the current file. // If they are not the same then the codemax control is set to comply with // the actual file state. // In that case the color of the foldertab is updated if needed as well. // Procedure CheckCurrentFileReadOnlyState Integer iRet Handle hoIni String sFile String sColors Boolean bIsReadOnly Boolean bChanged Move False to bChanged Move "" To sColors Move (CM_isReadOnly(Self)) To bIsReadOnly Move (phoIniHandler(Self)) To hoIni Get psFileName To sFile If (sFile<>CM_NEWFILENAME and sFile<>"") Begin // Check if file attrib is readonly: If (MKisFileReadOnly(sFile)) Begin If (bIsReadOnly=false) Begin Move True To bChanged Move (CM_SetReadOnly(Self,True)) To iRet // Set it to readonly Get psReadOnlyColors Of hoIni To sColors // if there is a different End // set of colors stored use it End Else Begin If (bIsReadOnly) Begin Move True To bChanged Move (CM_SetReadOnly(Self,False)) To iRet Get psColors Of hoIni To sColors End End If (bChanged) Begin Send CAOnLabelChanged (Parent(Self)) If (sColors <> "") Begin Send NotifyColorEditorChange To (oEditorElements(Parent(Self))) End End End End_Procedure // CheckFileReadOnlyState Function CM_OpenFile String sFile Returns Integer Integer iRet iIsPrn iCaseEnabled // Switch off the normalize Case feature if we load a prn or prp file. // Since this files are sometimes quite large loading of this files is // much faster if this feature is turned off. // 2.3.2003 BP If ( ((Right(Trim(uppercase(sFile)),4)) Eq ".PRN" ) Or ((Right(Trim(uppercase(sFile)),4)) Eq ".PRP") ) Begin Set LexerProperty "fold.dataflex.compilerlist" To "1" // enable advanced code folding for prn/prp files Move (CM_IsNormalizeCaseEnabled(Self)) To iCaseEnabled Get CM_EnableNormalizeCase False To iRet Move 1 To iIsPrn End If (sFile<>CM_NewFileName) Begin Forward Get CM_OpenFile sFile To iRet Send UpdateTextEncodingPane End // Reset the normalize case feature to the orginal value if it is a prn file. If (iIsPrn) Get CM_EnableNormalizeCase iCaseEnabled To iCaseEnabled If iRet Send FillFileTimeStamp sFile // Update the filetime. If iRet Set psFileName To sFile If iRet Begin Send AddRecentFile To ghoEditorProperties sFile Send LoadBookMarks sFile Send LoadCurrentPos sFile Send CheckCurrentFileReadOnlyState End Function_Return iRet End_Function Procedure SaveEditorStatus String sFile Send SaveBookMarks sFile Send SaveCurrentPos sFile Send THDoWriteWorkspace End_Procedure // Changed to reflect the new ini-setting piSaveLocal which speed's up the file-saving on a network drive dramatically // 19.02.02 Bernhard // Function CM_SaveFile String sFile Integer bUndo Returns Integer Integer iRet iCopy String sFileName sTemp If (pbTrimEOLOnSave(ghoEditorProperties)) Begin Send BufferTextRTrim // right trim the lines with space endings End If (Not(piSaveLocal(ghoEditorProperties))) Forward Get CM_SaveFile sFile bUndo To iRet Else Begin Get FileFromPath sFile To sFileName Get TempDirectory To sTemp Forward Get CM_SaveFile (sTemp + "\" + sFileName) bUndo To iRet If (iRet) Get copyFileEx (sTemp + "\" + sFileName) sFile True To iRet Send FillFileTimeStamp sFile // Update the filetime if something fails in the file-copy. End If iRet Begin Send FillFileTimeStamp sFile // Update the filetime. Set psFileName To sFile Send AddRecentFile To ghoEditorProperties sFile Send MarkChangedLinesAsSaved Send SaveEditorStatus sFile End Function_Return iRet End_Function // // The text encoding in scintilla's buffer is still in the original encoding, we have to // fix that up as well. // Procedure ConvertEditorTextEncoding Integer iOldEncoding Integer iEncoding Integer iCurrentLine Integer iLine Integer iLineCount String sLine String sLineSave UChar[] ucaLine Address aTextData UChar[] TextData Move (ResizeArray(TextData,0)) To TextData Get CurrentLine To iCurrentLine Get SC_LineCount To iLineCount Send GotoLine iLineCount Send PumpMsgQueue Of Desktop Send GotoLine 1 For iLine From 0 To (iLineCount-1) Get SC_GetLineNativeFormat Item iLine to sLine Case Begin Case (iOldEncoding=eTE_UTF8) If (iEncoding=eTE_OEM) Begin Move (Utf8ToOem(sLine)) to sLine End Else If (iEncoding=eTE_ANSI) Begin Move (Utf8ToAnsi(sLine)) to sLine End Case Break Case (iOldEncoding=eTE_OEM) If (iEncoding=eTE_UTF8) Begin Move (OemToUtf8(sLine)) to sLine End Else If (iEncoding=eTE_ANSI) Begin CompilerWarnings Off Move (ToAnsi(sLine)) to sLine CompilerWarnings On End Case Break Case (iOldEncoding=eTE_ANSI) If (iEncoding=eTE_UTF8) Begin Move (AnsiToUtf8(sLine)) to sLine End Else If (iEncoding=eTE_OEM) Begin CompilerWarnings Off Move (ToOem(sLine)) to sLine CompilerWarnings On End Case Break Case End Move (StringToUCharArray(sLine)) To ucaLine Move (AppendArray(TextData,ucaLine)) To TextData Loop Move 0 To TextData[SizeOfArray(TextData)] // add a zero at the end Move (AddressOf(TextData)) To aTextData If (aTextData<>0) Begin Send EditorMessage SCI_CLEARALL 0 0 Send EditorMessage SCI_SETTEXT 0 aTextData End Send GotoLine iCurrentLine End_Procedure Procedure UpdateTextEncodingPane Integer iEncoding Get TextEncoding To iEncoding Delegate Send ShowTextEncoding iEncoding End_Procedure Procedure ChangeTextEncoding Integer iEncoding Integer iOldEncoding Integer iCharSet Boolean bConvertText Get TextEncoding To iEncoding Move iEncoding To iOldEncoding Send RequestEncodingDetails of oTextEncodingDialog (&iEncoding) (&bConvertText) If ((iEncoding<>-1) and (iEncoding<>iOldEncoding)) Begin Send EditorMessage SCI_BEGINUNDOACTION If (bConvertText) Begin Send ConvertEditorTextEncoding iOldEncoding iEncoding End Case Begin Case (iEncoding=eTE_UTF8) // 1 Send EditorMessage SCI_SETCODEPAGE SC_CP_UTF8 Send EditorMessage SCI_STYLESETCHARACTERSET STYLE_DEFAULT SC_CHARSET_ANSI Set pbOemMode to False Set pbUtf8Mode to True Case Break Case (iEncoding=eTE_OEM) // 2 Send EditorMessage SCI_SETCODEPAGE 0 // must tell scintilla to switch to single byte mode Send EditorMessage SCI_STYLESETCHARACTERSET STYLE_DEFAULT SC_CHARSET_OEM Set pbOemMode to True Set pbUtf8Mode to False Case Break Case (iEncoding=eTE_ANSI) // 3 Send EditorMessage SCI_SETCODEPAGE 0 // must tell scintilla to switch to single byte mode Send EditorMessage SCI_STYLESETCHARACTERSET STYLE_DEFAULT SC_CHARSET_ANSI Set pbOemMode to False Set pbUtf8Mode to False Case Break Case End Send ApplyEditorOptions Send EditorMessage SCI_ENDUNDOACTION Send UpdateTextEncodingPane End End_Procedure // Here a check is run to see if the file was altered outside of this program. Procedure Set Focus Integer hoID Integer hoID2 Integer iRet Integer iLine String sMsg String sFileName Handle hoMain Boolean bFileExists Boolean bUserModified Boolean bHasChangedExternal Boolean bDoReloadFile Forward Set Focus To hoID hOID2 Send onSelChange Send onOvertypeChange Move false To bDoReloadFile Get Main_Panel_Id to hoMain // If not (piInSetFocus(Self)) Begin // recursive protection Set piInSetFocus To True Get psFileName To sFileName Get isFileTimeChanged sFileName to bHasChangedExternal Get CM_IsModified To bUserModified If (bHasChangedExternal and bUserModified) Begin #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[1557], sFileName)) to sMsg #ELSE Move ('File'*'"'+sFileName+'"'*"was changed by another application.\n\n") to sMsg #ENDIF If (bUserModified) Begin Append sMsg (_T("You have made changes to this file as well.\n\n", 1558)) End Append sMsg (_T("Do you want to load the external changes?\n", 1559)) If (bUserModified) Begin Append sMsg (_T("Pressing YES will discard any changes you made to this file.\n", 1560)) End Get YesNo_Box sMsg (Label(hoMain)) to iRet If iRet Eq MBR_Yes Begin Move True to bDoReloadFile End Else Send FillFileTimeStamp sFileName // Update the filetime. End // If file has changed externally, but we didn't edit, then do not ask, just bloody refresh If (bHasChangedExternal and bUserModified=False) Begin Get vFilePathExists sFileName to bFileExists // if the file was deleted DO NOT try to reload If (bFileExists) Begin Move True to bDoReloadFile End End If bDoReloadFile Begin Get CurrentLine To iLine Get CM_OpenFile sFileName to iRet Send EditorMessage SCI_SETSAVEPOINT // reset the changed state of the document Send GotoLine iLine End Set piInSetFocus To False End // Start the parse whenever the editor get's the focus // 28.1.2003 BP Send ParseBuffer End_Procedure Procedure Activate Integer iRet Forward Send Activate // update the text encoding statusbar pane Send UpdateTextEncodingPane If (psOpenBracketTip(Self)) Eq "" Get CM_SetHighlightedLine -1 to iRet Send onUpdateCursorPosition End_Procedure Procedure EditShadowToolBarItem Integer iLoseFocus // Send ShadowToolBarItem TBItem_Save iLoseFocus Send ShadowToolBarItem TBItem_SaveAll iLoseFocus Send ShadowToolBarItem TBItem_Print iLoseFocus // Send ShadowToolBarItem TBItem_Cut iLoseFocus Send ShadowToolBarItem TBItem_Copy iLoseFocus Send ShadowToolBarItem TBItem_Paste iLoseFocus // If (iLoseFocus) Begin Send ShadowToolBarItem TBItem_Undo iLoseFocus Send ShadowToolBarItem TBItem_Redo iLoseFocus End // Send ShadowToolBarItem TBItem_Find iLoseFocus Send ShadowToolBarItem TBItem_Replace iLoseFocus // Send ShadowToolBarItem TBItem_Compile iLoseFocus If (gsCurrentProgramFile <> "") Begin Send ShadowToolBarItem TBItem_Run iLoseFocus Send ShadowToolBarItem TBItem_Debug iLoseFocus Send ShadowToolBarItem TBItem_Execute iLoseFocus End // End_Procedure Procedure onSetFocus Send EditShadowToolBarItem False End_Procedure Procedure onKillFocus Send EditShadowToolBarItem True End_Procedure Procedure DestroyObject Send RemoveAllFiles Send Request_Destroy_Object End_Procedure Function DragAndDrop_CanReceiveData String sDataType Returns Integer If (HitTestCurrentMouse(Self)) Eq CM_EDITSPACE Begin If sDataType Eq "DD_CLASS" Function_Return 1 If sDataType Eq "DD_OBJECT" Function_Return 1 If sDataType Eq "DD_METHOD" Function_Return 1 End Else Function_Return 0 End_Function Function DragAndDrop_DropData Integer hoSrcObj Returns Integer Integer iLine String sData sDataType sCR sRef sObj Get DragAndDrop_DataType Of hoSrcObj To sDataType If (DragAndDrop_CanReceiveData(Self,sDataType)) Begin Move (LineRowUnderMouseCursor(Self)) To iLine Move (Hi (iLine)) To iLine Get GetRefFromLine iLine To sRef Get DragAndDrop_GetData Of hoSrcObj To sData If sDataType Eq "DD_OBJECT" Begin Get ReduceReference sData sRef To sData Get ReferenceToObject sData To sData End If sDataType Eq "DD_METHOD" Begin Move (Left(sData,Pos("@",sData))) To sObj Move (Replace(sObj,sData,"")) To sData Move (Replace("@",sObj,"")) To sObj Get ReduceReference sObj sRef To sObj Get ReferenceToObject sObj To sObj Move (Replace("@DEST@",sData,sObj)) To sData End Send EditorMessage SCI_BEGINUNDOACTION Send Request_InsertTextUnderMouseCursor sData Send EditorMessage SCI_ENDUNDOACTION End Function_Return 0 End_Function Procedure ShowToolTip String sStr End_Procedure // Additional Commands: // -Procedure // -Function // -End_Procedure // -End_Function // -Forward Function FindCommand String sSub Returns String Move (Uppercase(Trim(sSub))) To sSub If (Left(sSub,1)) Eq "P" Function_Return "Procedure" If (Left(sSub,2)) Eq "FU" Function_Return "Function" If (Left(sSub,5)) Eq "END_P" Function_Return "End_Procedure" If (Left(sSub,5)) Eq "END_F" Function_Return "End_Function" If (Left(sSub,2)) Eq "FO" Function_Return "Forward" Function_Return "" End_Function // To understand "\tab" for inserting a TabBlanks. Procedure InsertTextAtPosition Integer iLine Integer iCol String sTxt String sTab Move (Repeat(" ",piTabSize(ghoEditorProperties))) To sTab Move (Replaces("\tab",sTxt,sTab)) To sTxt Forward Send InsertTextAtPosition iLine iCol sTxt End_Procedure // Should deliver a name of the Project. Function GetProjectName Returns String String sRet Get CurrentWorkSpaceDescription Of ghoWorkSpaceHandlerEx To sRet Function_Return sRet End_Function // Inserta the contents of the given file, neither on the top of a file // or if a AB created file insert an AB-StoreTopStart -End block and inserts // the file there. // Some special TAGS are replaces by the other information. Procedure InsertHeaderFromFile String sTplFile Integer iArgSize iSize iRet iStartRev iEndRev String sFileName sBuffer String sProjectName String sUserName String sComputerName String sDD sDM sDY String sTH sTM sTS String sLine sTmp String sSubHeader //@ RRS Integer iLine iLineCount iABStoreStart iABIgnoreStart Integer iChannel Date dToday Get value Item 0 To sLine Append sTmp "/" "/AB/ Project" If (Left(sLine,13)) Eq sTmp Begin Move "" To sTmp Append sTmp "/" "/AB-STORETOPSTART" Get SC_LineCount To iLineCount For iLine From 0 To (iLineCount-1) Get value Item iLine To sLine If (Uppercase(Left(Trim(sLine),11))) Eq ("/"+"/TH-HEADER") Begin Send GotoLine iLine Procedure_Return End If (Uppercase( Left(Trim(sLine),16))) Eq ("/"+"/AB-IGNORESTART") Move iLine To iABIgnoreStart If (Uppercase( Left(Trim(sLine),18))) Eq sTmp Move iLine To iABStoreStart If (Uppercase( Left(Trim(sLine),7))) Eq "OBJECT " Break If (Uppercase(Left(Trim(sLine),16))) Eq "CD_POPUP_OBJECT " Break Loop If iABStoreStart Gt 0 Move (iABStoreStart+1) To iLine Else Begin Move "" To sTmp Append sTmp "/" "/AB-StoreTopStart" (Character(13)) (Character(10)) Append sTmp "/" "/AB-StoreTopEnd" (Character(13)) (Character(10)) (Character(13)) (Character(10)) Move (CM_InsertText(Self,sTmp,iABIgnoreStart,0)) To iRet Move (iABIgnoreStart+1) To iLine End End Else Begin Get SC_LineCount To iLineCount If iLineCount Gt 50 Move 50 To iLineCount For iLine From 0 To (iLineCount-1) Get value Item iLine To sLine If (Uppercase(Left(Trim(sLine),11))) Eq ("/"+"/TH-HEADER") Begin Send GotoLine iLine Procedure_Return End Loop Move 0 To iLine End // 27-06-2003 **WvA Added channel logic to the sequential // file access in here to avoid getting // channel in use errors. Get Seq_New_Channel To iChannel If (iChannel <> DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin Direct_Input Channel iChannel sTplFile If (seqeof) Begin Send Seq_Release_Channel iChannel Procedure_Return -1 End If (Not(seqeof)) Begin Set_Channel_Position iChannel To -1 // Set to end of file. Get_Channel_Position iChannel To iSize // Gets the size of the File. Set_Channel_Position iChannel To 0 // Set to beginning of file End Get_Argument_Size To iArgSize If iArgSize Lt iSize Set_Argument_Size iSize Read_Block Channel iChannel sBuffer iSize Close_Input Channel iChannel Send Seq_Release_Channel iChannel Move (ComputerName(Desktop)) To sComputerName Move (NetzwerkBenutzer(Desktop)) To sUserName Get GetFileName To sFileName Get GetProjectName To sProjectName Move (Replaces("@FILENAME@" ,sBuffer,sFileName)) To sBuffer // FileName Move (Replaces("@PROJECTNAME@" ,sBuffer,sProjectName)) To sBuffer // ProjectName Move (Replaces("@USERNAME@" ,sBuffer,sUserName)) To sBuffer // UserName Move (Replaces("@COMPUTERNAME@" ,sBuffer,sComputerName)) To sBuffer // UserName // Date parts. Sysdate dToday sTH sTM sTS Move (DateGetDay(dToday)) to sDD Move (DateGetMonth(dToday)) to sDM Move (DateGetYear(dToday)) to sDY Move (Right("00"+sDD,2)) to sDD Move (Right("00"+sDM,2)) to sDM Move (Replaces("@DD@" ,sBuffer,sDD)) To sBuffer // Day Move (Replaces("@DM@" ,sBuffer,sDM)) To sBuffer // Month Move (Replaces("@DY@" ,sBuffer,sDY)) To sBuffer // Year // Time parts. Move (Right("0"+sTH,2)) To sTH Move (Right("0"+sTM,2)) To sTM Move (Right("0"+sTS,2)) To sTS Move (Replaces("@TH@" ,sBuffer,sTH)) To sBuffer // Hour Move (Replaces("@TM@" ,sBuffer,sTM)) To sBuffer // Minute Move (Replaces("@TS@" ,sBuffer,sTH)) To sBuffer // Second If iArgSize Lt iSize Set_Argument_Size iArgSize Move (Pos(("/"+"/TH-REVISIONSTART"),Uppercase(sBuffer))) To iStartRev Move (Pos(("/"+"/TH-REVISIONEND"),Uppercase(sBuffer))) To iEndRev If iStartRev Gt 0 If iEndRev Gt 0 Begin Move (Remove(sBuffer,iStartRev+18,iEndRev-iStartRev-20)) To sBuffer End If iStartRev Gt 0 Begin //@ RRS Get InsertRevisionEntrySubHeader "" to sSubHeader //@ RRS Move (Rtrim(sSubHeader)) to sSubHeader //@ RRS If (sSubHeader<>"") Begin //@ RRS Move (Character(10)+sSubHeader) to sSubHeader //@ RRS Move (Insert(sSubHeader,sBuffer,iStartRev+18)) to sBuffer //@ RRS End //@ RRS End //@ RRS Move (CM_InsertText(Self,sBuffer,iLine,0)) to iRet Send GotoLine iLine End Else Begin Send Info_Box (_T("No free channels available to insert the header", 1561)) (_T("Problem", 1562)) End End_Procedure //@ RRS Customised revision entry header // Is used to insert the new SubHeader tpl or Subheader.tpl file. // The subheader file is inserted after the header.tpl and after the "TH-RevisionStart" marker. // It's a template to add column headers to your revisions columns. // // For example: // // // ******************** // // MODIFICATION SUMMARY // // ******************** // // ####### DD/MM/YYYY WHO COMMENT <- Subheader (4 lines) // // 104141 11/05/2015 RRS Fixed: Minor Issue <- revision text Function InsertRevisionEntrySubHeader String sTplFile Returns String //@ RRS Integer iChannel iSize iArgSize String sBuffer sFile If (sTplFile="") Begin Move ("SubHeader"+gsUserName+".tpl") to sTplFile Get_File_Path sTplFile to sTplFile End If (sTplFile="") Begin Move "SubHeader.tpl" to sTplFile Get_File_Path sTplFile to sTplFile End If (sTplFile="") Function_Return "" Get Seq_New_Channel to iChannel If (iChannel <> DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin Direct_Input channel iChannel sTplFile If (SeqEof) Begin Send Seq_Release_Channel iChannel Procedure_Return -1 End If (not(SeqEof)) Begin Set_Channel_Position iChannel to -1 // Set to end of file. Get_Channel_Position iChannel to iSize // Gets the size of the File. Set_Channel_Position iChannel to 0 // Set to beginning of file End Get_Argument_Size to iArgSize If iArgSize Lt iSize Set_Argument_Size iSize Read_Block channel iChannel sBuffer iSize Close_Input channel iChannel Send Seq_Release_Channel iChannel End Function_Return sBuffer End_Function // Inserts a Header into the current file. // -1st tries to find userspecific header names UserName+Header.Tpl // -2nd the global Header named Header.Tpl Procedure InsertHeaderUser String sFile sErr Move ("Header"+gsUserName+".tpl") To sFile Get_File_Path sFile To sFile //@ Move (_T("Unable to locate Header.tpl", 1563)) to sErr If sFile Eq "" Get_File_Path "Header.Tpl" To sFile //@ If sFile Ne "" Send InsertHeaderFromFile sFile //@ Else Error 300 sErr //@ End_Procedure Procedure InsertHeaderGlobal String sFile sErr //@ Get_File_Path "Header.Tpl" To sFile //@ Move (_T("Unable to locate Header.tpl", 1563)) to sErr If sFile Ne "" Send InsertHeaderFromFile sFile //@ Else Error 300 sErr //@ End_Procedure // Can be used to insert a string at the revisionmarks. Procedure InsertRevisionString String sStr Integer iC iLineCount iRet iCurLine String sLine sCR sErr Get CM_GetSel False To iRet Get piSelEndLine To iCurLine Append sStr "\n" Append sCR (Character(13)) (Character(10)) Move (Replaces("\n",sStr,sCR)) To sStr Get SC_LineCount To iLineCount //@ RRS Removed line //@ If iLineCount Gt 50 Move 50 to iLineCount //@ RRS changed 500 to 50 // A limitation to prevent long searchers. For iC From 0 To (iLineCount-1) Get value Item iC To sLine If (Uppercase(Trim(sLine))) Eq ("/"+"/TH-REVISIONEND") Begin Send StartUndoTransaction //@ Use REVISIONEND instead //@ RRS Move (CM_InsertText(Self,sStr,iCurLine,0)) To iRet // current line is always below revision entry so insert first so that line# is correct Move (CM_InsertText(Self,sStr,iC,0)) To iRet Send EndUndoTransaction Procedure_Return End Loop Move (_T("InsertRevision: Revisionend marker not found!", 1564)) to sErr Error 200 sErr End_Procedure // Inserts a revision entry. Procedure InsertRevision String sMaskedValue sText sIssue Integer hoID iDataLen Move (oRevisionMaskHandler(Self)) to hoID Send LoadRevisionMask to hoID Get piMaskIssueLen of oAddRevisionEntryPanel to iDataLen If (iDataLen=0) Begin Get DataMaskedValueLen of hoID "@ISSUE@" to iDataLen Set piMaskIssueLen of oAddRevisionEntryPanel to iDataLen End Get piMaskUserLen of oAddRevisionEntryPanel to iDataLen If (iDataLen=0) Begin Get DataMaskedValueLen of hoID "@THUSER@" to iDataLen Set piMaskUserLen of oAddRevisionEntryPanel to iDataLen End Send Popup of oAddRevisionEntryPanel Get psRevisionText Of oAddRevisionEntryPanel To sText If (sText = "#CANCEL") Procedure_Return //@ Just use defined Templates //@ ---------------------------------------------------------- //@ RRS Get psIssue of oAddRevisionEntryPanel to sIssue //@ RRS If (sIssue<>"") Move ('(#'+sIssue+'):' * sRet) to sRet Get CreateMaskedValue Of hoID sText To sMaskedValue Send InsertRevisionString sMaskedValue End_Procedure // We now use cWinFunc.pkg version // // Converts a 8 Bit value to hex. (For HTML RGB support) // Function ByteToHex Integer iByte Returns String // Integer iLow iHi // String sHexchars sLow sHi // Move "0123456789ABCDEF" To sHexchars // Move (iByte/16) To iHi // Move (iByte-(iHi*16)) To iLow // Move (Mid(sHexchars,1,iHi+1)) To sHi // Move (Mid(sHexchars,1,iLow+1)) To sLow // Function_Return (sHi+sLow) // End_Function // Inserts a color value. Procedure InsertColorValue Integer hoID bRet iColor iR iG iB Integer iCurLine iCurCol String sRGB Object oColorDlg Is a ColorDialog Set SelectedColor To (RGB(255, 0, 0)) Move Self To hoID End_Object Get Show_Dialog Of hoID To bRet If bRet Begin Get CM_GetSel False To bRet Get piSelEndLine To iCurLine Get piSelEndCol To iCurCol Get SelectedColor Of hoID To iColor Move (R_From_RGB(iColor)) To iR Move (G_From_RGB(iColor)) To iG Move (B_From_RGB(iColor)) To iB If (Left(Value(Self,0),1)) Eq "<" Append sRGB "#" (ByteToHex(iR)) (ByteToHex(iG)) (ByteToHex(iB)) Else Begin Append sRGB "(RGB(" iR "," iG "," iB "))" If iColor Eq clAqua Move "clAqua" To sRGB If iColor Eq clBlack Move "clBlack" To sRGB If iColor Eq clBlue Move "clBlue" To sRGB If iColor Eq clDkGray Move "clDkGray" To sRGB If iColor Eq clFuchsia Move "clFuchsia" To sRGB If iColor Eq clGray Move "clGray" To sRGB If iColor Eq clGreen Move "clGreen" To sRGB If iColor Eq clLime Move "clLime" To sRGB If iColor Eq clLtGray Move "clLtGray" To sRGB If iColor Eq clMaroon Move "clMaroon" To sRGB If iColor Eq clNavy Move "clNavy" To sRGB If iColor Eq clOlive Move "clOlive" To sRGB If iColor Eq clPurple Move "clPurple" To sRGB If iColor Eq clRed Move "clRed" To sRGB If iColor Eq clSilver Move "clSilver" To sRGB If iColor Eq clTeal Move "clTeal" To sRGB If iColor Eq clWhite Move "clWhite" To sRGB If iColor Eq clYellow Move "clYellow" To sRGB End Move (CM_InsertText(Self,sRGB,iCurLine,iCurCol)) To bRet End Send Request_Destroy_Object To hoID End_Procedure // Inserts a HEX color value. Procedure InsertHexColorValue Integer hoID bRet iColor iR iG iB Integer iCurLine iCurCol String sRGB Object oColorDlg is a ColorDialog Set SelectedColor to (RGB(255, 0, 0)) Move Self to hoID End_Object Get Show_Dialog of hoID to bRet If bRet Begin Get CM_GetSel False to bRet Get piSelEndLine to iCurLine Get piSelEndCol to iCurCol Get SelectedColor of hoID to iColor Move (R_From_RGB(iColor)) to iR Move (G_From_RGB(iColor)) to iG Move (B_From_RGB(iColor)) to iB Append sRGB "#" (ByteToHex(iR)) (ByteToHex(iG)) (ByteToHex(iB)) Move (CM_InsertText(Self,'"'+sRGB+'"',iCurLine,iCurCol)) to bRet End Send Request_Destroy_Object to hoID End_Procedure // Inserts a bitmap value. Procedure InsertBitmapValue Integer hoID bRet Integer iCurLine iCurCol String sFileName sBmpDir Object oOpenDialog Is a OpenDialog Set Location To 5 471 Set Dialog_Caption to (_T("Please Select Bitmap file", 1565)) Set Filter_String to (_T("Bitmaps|*.BMP|Icons|*.ICO|All Files|*.*", 1566)) Set NoChangeDir_State To True Move Self To hoID End_Object // oOpenDialog If (hoID <> 0) Begin Get CurrentBitmapPath Of ghoWorkSpaceHandlerEx To sBmpDir Set Initial_Folder Of hoID To sBmpDir Get Show_Dialog Of hoID To bRet If bRet Begin Get CM_GetSel False To bRet Get piSelEndLine To iCurLine Get piSelEndCol To iCurCol Get File_Title Of hoID To sFileName Move (CM_InsertText(Self,('"'+sFileName+'"'),iCurLine,iCurCol)) To bRet End End Send Request_Destroy_Object To hoID End_Procedure // Procedure LaunchUtility String sPath String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchUtility sPath sFile Else Delegate Send LaunchUtility sPath "" End_Procedure // Procedure LaunchIDEUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchIDEUtility sFile Else Delegate Send LaunchIDEUtility End_Procedure // Procedure LaunchMergeUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchMergeUtility sFile Else Delegate Send LaunchMergeUtility End_Procedure // Procedure LaunchVCSUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchVCSUtility sFile Else Delegate Send LaunchVCSUtility End_Procedure // Procedure LaunchDBBUtility String sFile String sExt sLExt Get psFileName to sFile Get ParseFileExtension sFile to sExt If (sExt<>"") Begin Move (Lowercase(sExt)) to sLExt If (sLExt="dd" or sLExt="fd" or sLExt="tag" or sLExt="def") Begin Move (Replace("."+sExt,sFile,"")) to sFile End Else If (sLExt<>"int") Begin Move CM_NewFileName to sFile End End If (sFile<>CM_NewFileName) Begin Get ParseFileName sFile to sFile // Don't want the path part Delegate Send LaunchDBBUtility ('-t'+trim(sFile)) End Else Delegate Send LaunchDBBUtility End_Procedure // Procedure LaunchDBEUtility String sFile String sWorkspace String sTable Move "" To sTable Move "" To sWorkspace If (Num_Arguments>0) Move sFile To sTable If (sTable<>"") Begin Move ('"-t'+sTable+'"') To sTable //Move ('-xNoWorkspace') To sWorkspace End //Else Begin Get CurrentWorkSpaceName of ghoWorkspaceHandlerEx To sWorkspace Move ('-x"'+sWorkspace+'"') To sWorkspace //End Delegate Send LaunchDBEUtility (sWorkspace+" "+sTable) End_Procedure // Procedure LaunchDBCUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchDBCUtility sFile Else Delegate Send LaunchDBCUtility End_Procedure // Procedure LaunchDBUUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchDBUUtility sFile Else Delegate Send LaunchDBUUtility End_Procedure // Procedure LaunchRptUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchRptUtility sFile Else Delegate Send LaunchRptUtility End_Procedure // Procedure LaunchCodeArt String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchCodeArt sFile Else Delegate Send LaunchCodeArt End_Procedure // Procedure LaunchCodePub String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchCodePub sFile Else Delegate Send LaunchCodePub End_Procedure // Procedure LaunchMenuUtility String sFile Get psFileName To sFile If (sFile<>CM_NewFileName) Delegate Send LaunchMenuUtility sFile Else Delegate Send LaunchMenuUtility End_Procedure // Procedure PreCompileDFAllEnt Delegate Send PreCompileDFAllEnt End_Procedure // Procedure PreCompileWindows Delegate Send PreCompileWindows End_Procedure // Procedure CACurrentCompile Delegate Send CACurrentCompile End_Procedure // As ClearFirstCompoundBeforeMethod, but now for every keyword, not just send/get/set // The exception is if the next keyword is "begin" because in that case the whole line is just // a code block. Also note that a keyword within an expression just after the trigger word should // be ignored. // Example: // If (Left(sValue,1)="x") Move a to b // should wipe out all characters before "move", not "Left" Procedure ClearFirstCompoundBeforeKeyWord Integer iLine String ByRef sLine Integer iChar Integer iPos iStart Integer iSciLineStartPos iSciPos iSciMatchPos iSciEndPos Integer eStyle String sChar String sWord String sLtrimLine Move (lowercase(LTrim(sLine))) To sLTrimLine If (Left(sLtrimLine,3)="if " or Left(sLtrimLine,5)="else " or Left(sLtrimLine,7)="on_key ") Begin // locate out trigger words (if/else/on_key) and clear that part already Move (Pos("if ",lowercase(sLine))) To iPos If (iPos>0) Move (iPos+3) To iStart Else Begin Move (Pos("else ",lowercase(sLine))) To iPos If (iPos>0) Move (iPos+5) To iStart Else Begin Move (Pos("on_key ",lowercase(sLine))) To iPos If (iPos>0) Move (iPos+7) To iStart End End Send WipeUntilPosition iStart (&sLine) // next up is to test for an expression after our trigger word and wipe the expression Move (lowercase(LTrim(sLine))) To sLTrimLine If (Left(sLTrimLine,1)="(") Begin // need to find the matching brace Move (Pos("(",sLine)) To iPos Get EditorMessage SCI_POSITIONFROMLINE iLine To iSciLineStartPos Move (iSciLineStartPos+iPos-1) To iSciPos Get EditorMessage SCI_GETCHARAT iSciPos To iChar Move (Character(iChar)) To sChar If (sChar="(") Begin // extra safe guard-- I think redundant Get EditorMessage SCI_BRACEMATCH iSciPos to iSciMatchPos If (iSciMatchPos>iSciPos) Begin Move (iSciMatchPos-iSciLineStartPos+1) To iStart // it's ")" Send WipeUntilPosition (iStart+1) (&sLine) // iStart+1 as we also have to wipe the closing parenthesis End End End // and finally wipe until the first keyword Get EditorMessage SCI_POSITIONFROMLINE iLine To iSciLineStartPos Get EditorMessage SCI_GETLINEENDPOSITION iLine To iSciEndPos Move (iSciLineStartPos+iStart) To iSciPos // we're testing against the real line, so start from our last test position or you'll test "if" again and that's a dataflex key word itself While (iSciPos < iSciEndPos) Get EditorMessage SCI_GETSTYLEAT iSciPos to eStyle If (eStyle=SCE_DF_WORD) Begin // Found a DataFlex key word, note that "begin" is a scope word, so ignored Move (iSciPos-iSciLineStartPos+1) to iStart Get CM_GetWord iLine iStart to sWord // no need to ask for it, but handy for debugging Send WipeUntilPosition iStart (&sLine) Move iSciEndPos To iSciPos // stop while loop End Increment iSciPos Loop End End_Procedure // // Retrieve the leftmost object from a object reference that looks like // ( oFoo ( oBar(oTree(oWoods(Self))))) // We only want "oFoo" back // Function LeftMostObject String sObjects Returns String String sRef String sLeftMost Move "" To sLeftMost Get ObjectToReference sObjects to sRef // first step is to rewrite to reference instead If (Pos(".",sRef)<>0) Begin Move (Left(sRef,Pos(".",sRef)-1)) To sLeftMost End Else Move sRef To sLeftMost Function_Return sLeftMost End_Function // // Fills the short name of the objects into the sObjectLabel field of the entire array. // In order to make searching easier it will lowercase the data before putting it into the field. // Procedure FillObjectShortNames tParseObject[] ByRef ParseObjects Integer iC Integer iObjCount Integer iPos String sObj Move (SizeOfArray(ParseObjects)) To iObjCount If (iObjCount>0) Begin For iC From 0 To (iObjCount-1) Move ParseObjects[iC].sObject To sObj Get ReplaceAllMethods sObj To sObj // Remove Procedures and Functions (happens when object in methods) Move (Pos(".",sObj)) To iPos If (iPos>0) Begin Move (lowercase(Left(sObj,iPos-1))) To ParseObjects[iC].sObjectLabel End Else Move (lowercase(sObj)) To ParseObjects[iC].sObjectLabel Loop End End_Procedure Function CompareParseObjectShortNames tParseObject Object1 tParseObject Object2 Returns Integer If (Object1.sObjectLabel > Object2.sObjectLabel) ; Function_Return (GT) If (Object1.sObjectLabel < Object2.sObjectLabel) ; Function_Return (LT) Function_Return (EQ) End_Function // // sObject is the shortname notation of the object // function returns the first match in the ParseObjects array // Function FindFirstObjectShortName String sObject tParseObject[] ByRef ParseObjects Returns Integer Integer iSearchIndex tParseObject SearchObject Move (lowercase(sObject)) To SearchObject.sObjectLabel Move (SearchArray(SearchObject, ParseObjects, Self, (RefFunc(CompareParseObjectShortNames)))) to iSearchIndex Function_Return iSearchIndex End_Function Function ObjectNeighborhoodReplaceForObject Integer iLine String sFind tParseObject[] ByRef ParseObjects Returns String Integer iFirst Integer iObjCount String sLeftMostObject String sReplace String sLineRef String sRef Move sFind To sReplace Get LeftMostObject sFind to sLeftMostObject Get FindFirstObjectShortName sLeftMostObject (&ParseObjects) to iFirst If (iFirst>-1) Begin // found the object Move (SizeOfArray(ParseObjects)) To iObjCount If (iFirst<(iObjCount-1)) Begin If (Lowercase(sLeftMostObject)=ParseObjects[iFirst+1].sObjectLabel) Begin // there are more objects with the same short name! // Use current line object reference logic to write the object in the shortest way Get GetRefFromLine iLine To sLineRef Get ReduceReference ParseObjects[iFirst].sObject sLineRef To sRef Get ReferenceToObject sRef To sReplace End Else Move sLeftMostObject To sReplace End Else Move sLeftMostObject To sReplace End Function_Return sReplace End_Function Procedure RefactorObjectNeighborhood Boolean bAutoResponse Boolean bSuggestReplace Boolean bPadded Boolean bCanceled Boolean bRemember Handle hoParser Integer iPos Integer iPosStart Integer iPosEnd Integer iLevel Integer iStartLine Integer iLine Integer iLineCount Integer iLength Integer eResponse String sLine String sFind String sReplace String sWhitespace tParseObject[] ParseObjects Move False To bCanceled Send ClearRefactorAutoResponse Get pbRefactorPadReplaceString to bPadded Get CurrentLine to iStartLine Get SC_LineCount to iLineCount Get phoParser to hoParser If (hoParser) Get pParseObjects Of hoParser To ParseObjects Move (SortArray(ParseObjects)) To ParseObjects Send FillObjectShortNames (&ParseObjects) For iLine from iStartLine To iLineCount Move False to bSuggestReplace Get PreParsedLine iLine to sLine Move (Lowercase(sLine)) To sLine Move (Pos("(",sLine)) To iPos If (iPos>0) Begin Send ClearFirstCompoundBeforeMethod (&sLine) // a line that starts with an if or else can still call a method Move (Pos("(",sLine)) To iPos // if that line had indeed if/else then our first ( position might have been incorrect End If (iPos>0) Begin // only check if there's a "(" in the line If (Left(Ltrim(sLine),5)="send ") Begin Move (Pos(" to ",sLine)) To iPosStart If (iPosStart=0) Move (Pos(" of ",sLine)) To iPosStart If (iPosStart<>0) Begin Move (Length(sLine)) To iLength Send RefactorLocateSourceObject sLine iPos iLength (&iPosStart) (&iPosEnd) (&iLevel) Get Value iLine to sLine // real line data Move (Mid(sLine,iPosEnd-iPosStart+1,iPosStart)) To sFind // our source object reference If (iLevel>=2) Begin Get ObjectNeighborhoodReplaceForObject iLine sFind (&ParseObjects) to sReplace If (Length(sReplace)0) Begin Move (Pos(" to ",sLine)) To iLength // don't search past the " to " bit Send RefactorLocateSourceObject sLine iPos iLength (&iPosStart) (&iPosEnd) (&iLevel) Get Value iLine to sLine // real line data Move (Mid(sLine,iPosEnd-iPosStart+1,iPosStart)) To sFind If (iLevel>=2) Begin Get ObjectNeighborhoodReplaceForObject iLine sFind (&ParseObjects) to sReplace If (Length(sReplace)"") Begin Get LineIsDfImage iLine sLine To bIsDfImage If (bIsDfImage=false) Begin Move (Rtrim(sLine)) To sLine // Don't let whitespace characters at the end of the line play a role. Move (LTrim(sLine)) To sTrimLine Get ReIndentLineIndentation iLine iLineCount iTabSize bUseTabs (&iPrevLevel) To sIndent If (Length(sLine)<>Length(sIndent+sTrimLine)) Begin Move True to bMismatch Move iLineCount to iLine End End End Loop If (bMisMatch=false) Begin Send EditorMessage SCI_GOTOPOS iCurrentPos Send Info_Box "No Indentation mismatch found." End End_Procedure Function FindMethodFirstLine Integer iLine Returns Integer Integer iStartLine String sLine Move -1 To iStartLine While (iLine>0) Get Value item iLine to sLine Move (Ltrim(Lowercase(sLine))) To sLine If (Left(sLine,10)="procedure ") Begin Move iLine To iStartLine Move 0 To iLine End Else If (Left(sLine,9)="function ") Begin Move iLine To iStartLine Move 0 To iLine End Decrement iLine Loop Function_Return iStartLine End_Function // You have to pass the first line of the method. If pass the correct line then // we can just use this simple code. Function FindMethodLastLine Integer iLine Returns Integer Integer iLastLine Get Editormessage SCI_GETLASTCHILD iLine -1 to iLastLine Function_Return iLastLine End_Function // // This function takes as a start the first line of the method that you are extracting // a method from. If there's comment lines before then the insertion point should be before the // comment // Function FindExtractMethodInsertLine Integer iLine Returns Integer Integer iStartLine String sLine Move -1 To iStartLine While (iLine>0) Get Value item iLine to sLine Move (LTrim(Lowercase(sLine))) To sLine If (sLine="" or Left(sLine,2)<>"//") Begin Move iLine To iStartLine Move 0 To iLine End Decrement iLine Loop Function_Return iStartLine End_Function Procedure ShowMethodExtractPopup Integer iStartLine Integer iEndLine tRefactorVar[] Variables Boolean bExtract Integer iCount Integer iItem Integer iFirstLine Integer iLine Integer iPos Integer iRet String sLine String sText String sIndent String sMethodInvoke tRefactorVar Variable Move "" To sText For iLine From iStartLine To iEndLine Get Value Item iLine To sLine Move (sText+sLine+CS_CRLF) To sText Loop Get MethodExtractConfirmation Of oMethodExtract_dg sText Variables To bExtract If (bExtract) Begin Get FindMethodFirstLine iStartLine To iFirstLine Get FindExtractMethodInsertLine (iFirstLine-1) To iLine If (iLine>-1) Begin Send StartUndoTransaction Send Cut Get MethodInvoke Of oMethodExtract_dg To sMethodInvoke Move (sMethodInvoke+CS_CRLF) To sMethodInvoke Get IndentStringForLine (iStartLine-1) To sIndent Get CM_InsertText (sIndent+sMethodInvoke) iStartLine 0 To iRet Get IndentStringForLine (iFirstLine-1) To sIndent Get psComposedMethodText of oMethodExtract_dg to sText If (sText<>"") Move (sText+CS_CRLF) To sText While (sText<>"") Move (Pos(CS_CRLF,sText)) To iPos If (iPos<>0) Begin Move (Left(sText,iPos-1)) To sLine Move (Replace(sLine+CS_CRLF,sText,"")) To sText End Else Begin Move sText To sLine Move "" To sText End Get CM_InsertText (sIndent+sLine+CS_CRLF) iLine 0 To iRet Increment iLine Loop Send EndUndoTransaction End Else Begin Send Info_Box "Could not find start of method and as such can't find where to insert the new method." End End End_Procedure Function VariablesOfMethodAtLine Integer iLine Returns tRefactorVar[] Integer iItem Integer iCount Handle hoParser tParseParam[] ParseParams tParseVar[] ParseVars tRefactorVar[] Variables Get phoParser To hoParser Move (ResizeArray(Variables,0)) To Variables Get GetParameterListFromLine Of hoParser iLine To ParseParams Get GetVariablenListFromLine Of hoParser iLine To ParseVars For iItem From 0 To (SizeOfArray(ParseVars)-1) Move (SizeOfArray(Variables)) To iCount Move (Trim(ParseVars[iItem].sName)) To Variables[iCount].sName Move ParseVars[iItem].iType To Variables[iCount].iType Loop For iItem From 0 To (SizeOfArray(ParseParams)-1) Move (SizeOfArray(Variables)) To iCount Move (Trim(ParseParams[iItem].sName)) To Variables[iCount].sName Move ParseParams[iItem].iType To Variables[iCount].iType Move True To Variables[iCount].bParam Loop Function_Return Variables End_Function // Custom comparison function as the following did not work: // Move (SearchArray(SearchVar,Variables,Desktop,RefFunc(DFSTRICMP) )) To iItem // Returns (GT) if struct value in first parameter > struct value in second parameter. // Returns (LT) if struct value in first parameter < struct value in second parameter. // Otherwise returns (EQ). Function CompareVariables tRefactorVar Var1 tRefactorVar Var2 Returns Integer Move (Lowercase(Var1.sName)) To Var1.sName Move (Lowercase(Var2.sName)) To Var2.sName If (Var1.sName > Var2.sName) ; Function_Return (GT) If (Var1.sName < Var2.sName) ; Function_Return (LT) Function_Return (EQ) End_Function Procedure AddParamToVariableList String sParam String sDir tRefactorVar[] ByRef Variables Integer iItem Integer iCount tRefactorVar SearchVar Move sParam To SearchVar.sName Move (SearchArray(SearchVar,Variables,Self,RefFunc(CompareVariables) )) To iItem If (iItem>-1) Begin If (Variables[iItem].bWrite=false) Begin // if a var is $out$ before it is $in$ then the $in$ was overwritten and it is not really input If (sDir="$in$") Move True To Variables[iItem].bRead End If (sDir="$out$") Move True To Variables[iItem].bWrite End Else Begin If (sDir<>"$fun$") Begin Move (SizeOfArray(Variables)) To iCount Move sParam To Variables[iCount].sName Move -1 To Variables[iCount].iType Move True To Variables[iCount].bUsed If (sDir="$in$") Move True To Variables[iCount].bRead If (sDir="$out$") Move True To Variables[iCount].bWrite End End End_Procedure // // We processed one token and want the next one // Procedure NextVariableToken String ByRef sDir String ByRef sTemplate Integer iPos If (sDir<>"") Begin Move (Replace(sDir,sTemplate,"")) To sTemplate End Move (LTrim(sTemplate)) To sTemplate Move "" To sDir Move (Pos(" ",sTemplate)) To iPos If (iPos>0) Begin // get the direction of the next parameter Move (Left(sTemplate,iPos-1)) To sDir End Else Begin Move sTemplate To sDir Move "" To sTemplate End End_Procedure // // Does not depend on our parser for retrieving variables, this way we try to catch, global variables, // window variables, variables defined elsewhere. We won't know the data type but for the moment // that is OK. // Procedure AnalyzeVariablesOnLine Integer iLine String sLine tRefactorVar[] ByRef Variables Handle hoRefactor Integer iItem Integer iPos Integer iLength Integer iStartPos iEndPos Integer iSciPos iSciLineStartPos iSciEndPos Integer iChar iSciMatchPos Integer eStyle String sWord sTemplate sDir String sChar sParam sVoid // Find the parts of the line that has our statement (start position until end position) Move 0 To iStartPos Move 0 To iEndPos Move 0 To iSciMatchPos Move "" To sTemplate Move (Length(sLine)) To iLength For iPos From 1 To iLength If (Mid(sLine,1,iPos)<>"") Begin Move iPos To iStartPos Move iLength To iPos End Loop Move iLength To iPos While (iPos>0) If (Mid(sLine,1,iPos)<>"") Begin Move iPos To iEndPos Move 0 To iPos End Decrement iPos Loop If (iStartPos<>0 and iEndPos<>0) Begin Get EditorMessage SCI_POSITIONFROMLINE iLine To iSciLineStartPos Move (iSciLineStartPos+iStartPos-1) To iSciPos Move (iSciLineStartPos+iEndPos-1) To iSciEndPos While (iSciPos <= iSciEndPos) Get EditorMessage SCI_GETCHARAT iSciPos To iChar Move (Character(iChar)) To sChar Get EditorMessage SCI_GETSTYLEAT iSciPos to eStyle If (eStyle=SCE_DF_DEFAULT) Begin If (sChar="(" and iSciMatchPos=0 and sTemplate<>"") Begin // parameter is an expression (joy!) Get EditorMessage SCI_BRACEMATCH iSciPos to iSciMatchPos End End If (iSciPos>iSciMatchPos and iSciMatchPos<>0) Begin Move 0 To iSciMatchPos Send NextVariableToken (&sDir) (&sTemplate) End If (eStyle=SCE_DF_IDENTIFIER) Begin If (sDir<>"") Begin Move (iSciPos-iSciLineStartPos+1) to iPos Get WordVariable iLine iPos To sParam If (sParam<>"") Begin Send AddParamToVariableList sParam sDir (&Variables) If (iSciMatchPos=0) Begin Send NextVariableToken (&sDir) (&sTemplate) End Move (iSciPos+length(sParam)-1) To iSciPos End End End If (eStyle=SCE_DF_WORD) Begin Move (iSciPos-iSciLineStartPos+1) to iPos If (iSciMatchPos=0) Begin If (lowercase(sDir)="to") Begin Get CM_GetWord iLine iPos to sVoid If (lowercase(sVoid)="to") Begin Send NextVariableToken (&sDir) (&sTemplate) Move (iSciPos+length(sVoid)-1) To iSciPos End End Else Begin Get CM_GetWord iLine iPos To sWord If (sWord<>"") Begin Get KeywordParamTemplate Of hoRefactor sWord To sTemplate If (sTemplate<>"") Begin Move (Replace(lowercase(sWord),sTemplate,"")) To sTemplate Move (LTrim(sTemplate)) To sTemplate Move "" To sDir Send NextVariableToken (&sDir) (&sTemplate) // get the direction of the first parameter End Move (iSciPos+length(sWord)-1) To iSciPos End End End Else Begin // keyword in an expression .. ignore Get CM_GetWord iLine iPos to sVoid If (sVoid<>"") Begin Move (iSciPos+length(sVoid)-1) To iSciPos End End End If ((eStyle=SCE_DF_STRING or eStyle=SCE_DF_NUMBER or eStyle=SCE_DF_HEXNUMBER) and sTemplate<>"") Begin Move (iSciPos-iSciLineStartPos+1) to iPos Get CM_GetWord iLine iPos To sParam If (sParam<>"") Begin If (iSciMatchPos=0) Begin Send NextVariableToken (&sDir) (&sTemplate) End Move (iSciPos+length(sParam)-1) To iSciPos End End Increment iSciPos Loop End End_Procedure // // First phase on method extraction is the inspection. Works when text is selected and // displays how the variables are affected. // Procedure RefactorMethodExtract Integer iStartLine iEndLine iEndCol iRet Integer iMethodStartLine iMethodLastLine Integer iLine Handle hoRefactor String sLine String sLine2 tRefactorVar[] Variables Get CM_GetSel False To iRet // Retrieve Line and Column in the Edit. Get piSelEndLine To iEndLine Get piSelStartLine To iStartLine Get piSelEndCol to iEndCol If (iEndCol=0) Decrement iEndLine // selection end before first column means previous line selected, not current line Get VariablesOfMethodAtLine iStartLine To Variables // gets the variables for the method detected by our parser Get Create (RefClass(cRefactorMethodExtract)) To hoRefactor If (hoRefactor) Begin For iLine From iStartLine To iEndLine Get PreParsedLine iLine to sLine Move (Lowercase(sLine)) To sLine Move sLine To sLine2 Send ClearFirstCompoundBeforeKeyWord iLine (&sLine2) Send AnalyzeVariablesOnLine iLine sLine2 (&Variables) hoRefactor If (sLine<>sLine2) Begin // Simplify the check by breaking up compound statements Move (Replace(ltrim(sLine2),sLine,"")) To sLine Send AnalyzeVariablesOnLine iLine sLine (&Variables) hoRefactor End Loop Send VariablesToIsolate Of hoRefactor Variables For iLine From iStartLine To iEndLine // check which variables are used within the selected lines Get PreParsedLine iLine to sLine Move (Lowercase(sLine)) To sLine Move sLine To sLine2 Send ClearFirstCompoundBeforeKeyWord iLine (&sLine2) Send CheckVariableUsage Of hoRefactor sLine2 If (sLine<>sLine2) Begin // Simplify the check by breaking up compound statements Move (Replace(ltrim(sLine2),sLine,"")) To sLine Send CheckVariableUsage Of hoRefactor sLine End Loop Get FindMethodFirstLine iStartLine to iMethodStartLine If (iMethodStartLine>-1) Begin // Loop through the method part before our potential cut out to see what variables are used there. For iLine From (iMethodStartLine+1) To (iStartLine-1) Get PreParsedLine iLine to sLine Move (Lowercase(sLine)) To sLine Move sLine To sLine2 Send ClearFirstCompoundBeforeKeyWord iLine (&sLine2) Send CheckVariableBefore Of hoRefactor sLine2 If (sLine<>sLine2) Begin // Simplify the check by breaking up compound statements Move (Replace(ltrim(sLine2),sLine,"")) To sLine Send CheckVariableBefore Of hoRefactor sLine End Loop End Else Begin Send Info_Box "Could not find start of method and as such can't find where to insert the new method." Send Destroy of hoRefactor Procedure_return End // check what methods are used with parent method below the selection Get FindMethodLastLine iMethodStartLine To iMethodLastLine If (iMethodLastLine>iEndLine) Begin For iLine From (iEndLine+1) To (iMethodLastLine-1) Get PreParsedLine iLine To sLine Move (Lowercase(sLine)) To sLine Move sLine To sLine2 Send CheckVariableAfter Of hoRefactor sLine2 If (sLine<>sLine2) Begin // Simplify the check by breaking up compound statements Move (Replace(ltrim(sLine2),sLine,"")) To sLine Send CheckVariableAfter Of hoRefactor sLine End Loop End Get pVariables of hoRefactor To Variables Send Destroy of hoRefactor End Send ShowMethodExtractPopup iStartLine iEndLine Variables End_Procedure Function SupportedLexer Integer iLexer Returns Boolean Boolean bSupported If (iLexer=SCLEX_PASCAL or iLexer=SCLEX_SQL or iLexer=SCLEX_HTML or iLexer=SCLEX_CPP) Begin Move True To bSupported End Function_Return bSupported End_Function Procedure SetLexer Boolean bInit Boolean bSupported Integer iRet Integer iLanguage Integer iLexer Integer eResponse Handle hoDefaults String sKeywords sScopeKeywords1 sScopeKeywords2 sOperators String sTagElements sTagAttributes String sLanguage sLexerLang String sQuestion sTitle String sFile Get psFileName of (Parent(Self)) to sFile If (sFile<>"") Begin Get LanguageForFile of (phoIniHandler(Self)) sFile To sLanguage End Else Begin Get psLanguage of ghoEditorProperties To sLanguage End Move (CM_SetLanguage(Self,sLanguage)) to iRet Get EditorMessage SCI_GETLEXER to iLexer Move (ZeroString(255)) To sLexerLang Get EditorMessage SCI_GETLEXERLANGUAGE 0 (AddressOf(sLexerLang)) To iRet If (sLanguage<>"Text" and sLanguage<>"Ini" and sLanguage<>"XML") Begin Get FindLanguage of ghoEditorProperties sLanguage to iLanguage If (iLanguage=-1) Begin // Should it return? Yes, no definition, so no keywords to set. Move MBR_No To eResponse Move " Language Definition was not found.\nDo you want to load a default definition file?" To sQuestion Move "Definition not found" To sTitle Get SupportedLexer iLexer to bSupported If (bSupported) Begin #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[1567], sLanguage)) to sQuestion Get YesNo_Box sQuestion gILanguage[1568] MB_DEFBUTTON1 to eResponse #ELSE Get YesNo_Box (sLanguage+sQuestion) sTitle MB_DEFBUTTON1 to eResponse #ENDIF End Else Begin #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[1569], sLanguage)) to sLanguage Send Info_Box sLanguage gILanguage[1570] #ELSE Send Info_Box ("Default Language '"+sLanguage+"' definition not found") #ENDIF Procedure_Return End If (eResponse=MBR_Yes) Begin Get Create (RefClass(cDefaultLanguageDefinitions)) to hoDefaults If (hoDefaults) Begin If (iLexer=SCLEX_PASCAL) Get CreatePascalLanguageDefinition of hoDefaults to iLanguage Else If (iLexer=SCLEX_SQL) Get CreateSQLLanguageDefinition of hoDefaults to iLanguage Else If (iLexer=SCLEX_HTML) Get CreateHtmlLanguageDefinition of hoDefaults to iLanguage Else If (iLexer=SCLEX_CPP) Begin If (sLanguage="Java") Get CreateJavaLanguageDefinition of hoDefaults to iLanguage Else If (sLanguage="Javascript") Get CreateJavascriptLanguageDefinition of hoDefaults to iLanguage Else If (sLanguage="CSharp") Get CreateCSharpLanguageDefinition of hoDefaults to iLanguage Else If (sLanguage="Go") Get CreateGoLanguageDefinition of hoDefaults to iLanguage Else If (sLanguage="Swift") Get CreateSwiftLanguageDefinition of hoDefaults to iLanguage Else Get CreateCppLanguageDefinition of hoDefaults to iLanguage End Send Destroy of hoDefaults End End Else Begin Procedure_Return End End End If (iLexer=SCLEX_DATAFLEX) Begin Get SCKeywords (psLanguages.szKeywords(ghoEditorProperties, iLanguage)) to sKeywords Get SCKeywords (psLanguages.szScopeKeywords1(ghoEditorProperties, iLanguage)) to sScopeKeywords1 Get SCKeywords (psLanguages.szScopeKeywords2(ghoEditorProperties, iLanguage)) to sScopeKeywords2 Get SCKeywords (psLanguages.szOperators(ghoEditorProperties,iLanguage)) to sOperators Move (Replaces("^",sOperators,"")) To sOperators // The ^ char is a wildcard match in scintilla, the result is EVERYTHING is an operator, so remove it before passing it, it is a hardcoded operator in scintilla. // Fill the arrays for normalizing case feature when typing Get InitializedLanguage of oNormalizeCase SCLEX_DATAFLEX to bInit If (bInit=False) Begin Send AddKeywords of oNormalizeCase SCLEX_DATAFLEX sKeywords Send AddScopewords of oNormalizeCase SCLEX_DATAFLEX sScopeKeywords1 Send AddScopewords of oNormalizeCase SCLEX_DATAFLEX sScopeKeywords2 End // Supply the keywords/scope keywords in lower case as the lexer matches on lowercase characters Move (Lowercase(sKeywords)) to sKeywords Move (sKeywords+Character(0)) to sKeywords Move (Lowercase(sScopeKeywords1)) To sScopeKeywords1 Move (Lowercase(sScopeKeywords2)) To sScopeKeywords2 Move (Lowercase(sOperators)) To sOperators Send EditorMessage SCI_SETKEYWORDS 0 (AddressOf(sKeywords)) // language keywords Send EditorMessage SCI_SETKEYWORDS 1 (AddressOf(sScopeKeywords1)) // scope open Send EditorMessage SCI_SETKEYWORDS 2 (AddressOf(sScopeKeywords2)) // scope close Send EditorMessage SCI_SETKEYWORDS 3 (AddressOf(sOperators)) // operators // //debug //String sValue //String sName //Move (ZeroString(40)) to sValue //Move ("position.width"+Character(0)) to sName //Get EditorMessage SCI_GETPROPERTYEXPANDED (AddressOf(sName)) (AddressOf(sValue)) to iRet // found? End Else If (iLexer=SCLEX_PASCAL) Begin Get SCKeywords (psLanguages.szKeywords(ghoEditorProperties, iLanguage)) to sKeywords Get SCKeywords (psLanguages.szScopeKeywords1(ghoEditorProperties, iLanguage)) to sScopeKeywords1 Get SCKeywords (psLanguages.szScopeKeywords2(ghoEditorProperties, iLanguage)) to sScopeKeywords2 Get SCKeywords (psLanguages.szOperators(ghoEditorProperties,iLanguage)) to sOperators Move (Replaces("^",sOperators,"")) To sOperators // The ^ char is a wildcard match in scintilla, the result is EVERYTHING is an operator, so remove it before passing it, it is a hardcoded operator in scintilla. //// Fill the arrays for normalizing case feature when typing --> default are all lowercase for now //Get InitializedLanguage of oNormalizeCase SCLEX_DATAFLEX to bInit //If (bInit=False) Begin // Send AddKeywords of oNormalizeCase SCLEX_DATAFLEX sKeywords // Send AddScopewords of oNormalizeCase SCLEX_DATAFLEX sScopeKeywords1 // Send AddScopewords of oNormalizeCase SCLEX_DATAFLEX sScopeKeywords2 //End // Supply the keywords/scope keywords in lower case as the lexer matches on lowercase characters Move (Lowercase(sKeywords)) to sKeywords Move (Lowercase(sScopeKeywords1)) To sScopeKeywords1 Move (Lowercase(sScopeKeywords2)) To sScopeKeywords2 Move (Lowercase(sOperators)) To sOperators // <--- ignored for now Move (sKeywords*sScopeKeywords1*sScopeKeywords2+Character(0)) to sKeywords Send EditorMessage SCI_SETKEYWORDS 0 (AddressOf(sKeywords)) // End Else If (iLexer=SCLEX_SQL) Begin Get SCKeywords (psLanguages.szKeywords(ghoEditorProperties, iLanguage)) to sKeywords Get SCKeywords (psLanguages.szScopeKeywords1(ghoEditorProperties, iLanguage)) to sScopeKeywords1 Get SCKeywords (psLanguages.szScopeKeywords2(ghoEditorProperties, iLanguage)) to sScopeKeywords2 Get SCKeywords (psLanguages.szOperators(ghoEditorProperties,iLanguage)) to sOperators //Move (Replaces("^",sOperators,"")) To sOperators // The ^ char is a wildcard match in scintilla, the result is EVERYTHING is an operator, so remove it before passing it, it is a hardcoded operator in scintilla. // Supply the keywords/scope keywords in lower case as the lexer matches on lowercase characters Move (Lowercase(sKeywords)) to sKeywords Move (Lowercase(sScopeKeywords1)) To sScopeKeywords1 Move (Lowercase(sScopeKeywords2)) To sScopeKeywords2 Move (Lowercase(sOperators)) To sOperators // <--- ignored for now Move (sKeywords*sScopeKeywords1*sScopeKeywords2+Character(0)) to sKeywords Send EditorMessage SCI_SETKEYWORDS 0 (AddressOf(sKeywords)) // End Else If (iLexer=SCLEX_HTML) Begin Get SCKeywords (psLanguages.szKeywords(ghoEditorProperties, iLanguage)) to sKeywords Get SCKeywords (psLanguages.pszTagElementNames(ghoEditorProperties, iLanguage)) to sTagElements Get SCKeywords (psLanguages.pszTagAttributeNames(ghoEditorProperties, iLanguage)) to sTagAttributes // Supply the keywords/scope keywords in lower case as the lexer matches on lowercase characters Move (Lowercase(sKeywords)) to sKeywords Move (Lowercase(sTagElements)) To sTagElements Move (Lowercase(sTagAttributes)) To sTagAttributes Move (sTagElements*sTagAttributes+Character(0)) To sTagElements Move (sKeywords+Character(0)) to sKeywords Send EditorMessage SCI_SETKEYWORDS 0 (AddressOf(sTagElements)) Send EditorMessage SCI_SETKEYWORDS 1 (AddressOf(sKeywords)) // End Else If (iLexer=SCLEX_CPP) Begin // iLanguage has the correct reference for: // Cpp/Java/Javascript/Swift/Go Get SCKeywords (psLanguages.szKeywords(ghoEditorProperties, iLanguage)) to sKeywords Move (Lowercase(sKeywords)) to sKeywords Move (sKeywords+Character(0)) to sKeywords Send EditorMessage SCI_SETKEYWORDS 0 (AddressOf(sKeywords)) // End End_Procedure End_Class