//***************************************************************************************** // 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 // //***************************************************************************************** Use cIniManager.pkg // Class cIniManager Use mPointer.pkg Use mAssignFilesToExecuteable.Pkg // To Assign extention to this program. Use mEditorMacros.pkg // Save and Load Macros. Use mFiles.pkg Use vWin32fh.pkg Use cSciCommandHotKeySupport.pkg #COMMAND PUT_POINTEREx R R R "TO" R "AT" R Local_Buffer !1 !2 Move !3 To !1 Move (Replaces("\n",!1,Character(10))) To !1 GetAddress Of !1 To !2 Put !2 To !5 At !7 !8 #ENDCOMMAND // Stores all Parameter which should been saved to disk. // Added Property piSaveLocal to speed-up the saving of a file on a network drive // 19.02.02 Bernhard // INI_GLOBAL Class cEditorProperties Is a cIniProperties INI_Begin_Properties "CODEMAXEDIT.INI" INI_USER INI_Property String psFileTypes Public "" INI_Property Integer piLineNumbering Public False INI_Property Integer pbLeftMargin Public False INI_Property String psColors Public "" INI_Property String psReadOnlyColors Public "" // By WvA 20170417 - Scintilla hot keys INI_Property String psEditorHotKeys Public "" INI_Property Integer piRecentFilesLimit Public 0 INI_Property String psRecentFiles Public "" MULTI // By SVN 22-03-2017 INI_Property Integer piRecentWSLimit Public 15 INI_Property String psRecentWorkspaces Public "" MULTI INI_Property.Sub String sDescription Public "" INI_Property.Sub String sVersion Public "" // INI_Property Integer piViewMode Public 0 INI_Property Integer piViewSize.Y Public 0 INI_Property Integer piViewSize.X Public 0 INI_Property Integer pbColorSyntax Public 0 INI_Property String psLanguage Public "" INI_Property Integer pbScrollBarH Public 0 INI_Property Integer pbScrollBarV Public 0 INI_Property Integer pbSplitterH Public 0 INI_Property Integer pbSplitterV Public 0 INI_Property Integer pbSmoothScrolling Public 0 INI_Property Integer pbLineToolTips Public 0 INI_Property Integer pbDragDrop Public 0 INI_Property Integer pbColumnSel Public 0 INI_Property Integer piUndoLimit Public 0 INI_Property Integer piAutoIndentMode Public 0 INI_Property Integer piTabSize Public 0 INI_Property Integer pbTabExpand Public 0 INI_Property Integer pbNormalizeCase Public 0 INI_Property Integer pbCloseOutputPaneOnEscape Public 0 // close output pane when pressing Escape key INI_Property Integer pbTrimEOLOnSave Public 0 // trim line endings on save INI_Property Integer pbFileSaveBackup Public True // create a .bak file on save INI_Property Integer pbOemToAnsi Public True // do an OEM to ANSI conversion on load and save INI_Property Integer pbUtf8Support Public False // support Utf8 load/save INI_Property Integer pbMethodSuffixComment Public False // automatically add a comment behind the method end INI_Property Integer pbPreserveCase Public 0 INI_Property Integer pbSelBounds Public 0 INI_Property Integer pbWholeWord Public 0 INI_Property Integer pbCaseSensitive Public 0 INI_Property String psFont Public "" INI_Property String psLanguages Public "" MULTI INI_Property.Sub Integer dwStyle Public 0 INI_Property.Sub Integer bIsCaseSensitive Public 0 INI_Property.Sub String szKeywords Public "" INI_Property.Sub String szOperators Public "" INI_Property.Sub String szSingleLineComments Public "" INI_Property.Sub String szMultiLineComments1 Public "" INI_Property.Sub String szMultiLineComments2 Public "" INI_Property.Sub String szScopeKeywords1 Public "" INI_Property.Sub String szScopeKeywords2 Public "" INI_Property.Sub String szStringDelims Public "" INI_Property.Sub String chEscape Public "" INI_Property.Sub String chTerminator Public "" INI_Property.Sub String pszTagElementNames Public "" INI_Property.Sub String pszTagAttributeNames Public "" INI_Property.Sub String pszTagEntities Public "" INI_Property String psFontStyles Public "" INI_Property Integer piUseWorkSpace Public 0 INI_Property Integer pbCompileAutoSave Public 0 INI_Property String psCompiler Public "" INI_Property String psCompiler.CompOptions Public "" INI_Property String psCompiler.PreCompOptions Public "" INI_Property String psDebugger Public "" INI_Property Integer piCompiler4Debug Public "" INI_Property String psDebugCompiler Public "" INI_Property Integer piCompileShowErrorMsg Public 0 INI_Property String psStartUpPath Public "" INI_Property Integer piSaveLocal Public False INI_Property Integer piErrorListHeight Public 0 INI_Property Integer pbErrorListVisible Public 0 INI_Property Integer piCodeViewWidth Public 0 INI_Property Integer pbCodeViewVisible Public 0 INI_Property String psVDFRegistryVersion Public "" // SVN 21-03-2017 INI_Property Integer pbToolsPaneVisible Public True INI_Property Integer pbOutputPaneVisible Public False // // ** SVN 07/04-2017 -- TH3 New Tokens INI file INI_Property String psTokensIniFile Public "tokens.ini" INI_Property String psCodeTipIniFile Public "" INI_Property Integer pbUseCodeTips Public True INI_Property Integer pbCodeTipAutoPopup Public True INI_Property String pbCodeListUseBitmaps Public True INI_Property Integer pbShowClasses Public True INI_Property Integer pbShowObjects Public True INI_Property Integer pbShowMethods Public True INI_Property Integer pbShowKeys Public True INI_Property Integer pbShowFields Public True INI_Property Integer pbShowIndexes Public True INI_Property Integer pbShowVariables Public True INI_Property Integer pbShowIDETags Public True // ** SVN 07/04-2017 -- TH3 New CodeLists Auto Popup INI_Property Integer pbShowStructures Public True INI_Property Integer pbShowCommands Public True INI_Property Integer pbShowTypes Public True INI_Property Integer pbShowAttributes Public True INI_Property Integer pbShowSourceFiles Public True INI_Property String psIDEPath Public "" INI_Property String psDBBPath Public "" INI_Property String psDBEPath Public "" INI_Property String psMergePath Public "" INI_Property String psVCSPath Public "" INI_Property String psRptPath Public "" INI_Property String psDbcPath Public "" INI_Property String psDbuPath Public "" INI_Property String psCodeArtPath Public "" INI_Property String psCodeSpyPath Public "" INI_Property String psCodePubPath Public "" INI_Property String psMenuPath Public "" // ** SVN -- CodeArt INI_Property Integer pbCodeArtInsertErrors Public False INI_Property Integer pbCodeArtInsertDateTime Public False INI_Property Integer pbCodeArtInsertComments Public True // ** SVN -- CodePub INI_Property String psCodePubHeaderFile Public "" INI_Property String psCodePubFooterFile Public "" // // INI_Property String psDfrun Public "" INI_Property String psLangAssign Public "" MULTI INI_Property.Sub String Ext Public "" INI_Property.Sub String Language Public "" // BP -- Character translation INI_Property String psCharTranslation Public "" // BP -- Watch Compiler Messages during Compile INI_Property Integer piWatchCompiler Public 0 INI_Property Integer piDisplayWatchAutomatic Public 0 INI_Property Integer piDebugAlways Public 0 // By SVN -- 14-04-2017 Window // By SVN -- 14-04-2017 Skinning INI_Property Integer piUseSkins Public 0 INI_Property String psCurrentSkinFile Public "" INI_Property String psCurrentSkinIni Public "" // Tabs INI_Property String psFileTabsLocation Public "Bottom" INI_Property String psFileTabsAppearance Public "" INI_Property String psFileTabsColor Public "" INI_Property Integer pbFileTabsMultiRow Public False // Color Schemas (By SVN) INI_Property String psColorSchema Public "" INI_Property String psColorSchemas Public "" MULTI INI_Property.Sub Integer psSchemaColors Public "" INI_Property.Sub Integer psSchemaFontStyles Public "" INI_Property String psFontFace Public "" // Custom Utility (By SVN on 27-04-2017) INI_Property String psCustomMenuUtilities Public "" MULTI // Code Maintenance... INI_Property.Sub Integer psUtilityType Public "" // DATABASE, SOURCE, TOOLS INI_Property.Sub Integer psUtilityOrder Public "" // 0, 1, 2, ... INI_Property.Sub Integer psUtilityCommand Public "" // C:\...\Bin\... .exe %1 etc // INI_Property String psSignAppPath Public "" INI_Property Integer pbExtCompilerOnly Public 0 INI_Property Integer pbShowMatchingBraces Public True INI_Property Integer pbShowIndentGuides Public True INI_Property Integer pbSelectWholeLine Public True INI_Property String psLastEditedFile Public "" // Interface Language INI_Property String psInterfaceLanguage Public "" // INI_End_Properties // Delivers the language for Function LanguageForFile String sFile Returns String Integer iCount iItem String sExt sLangExt sLang Move (CString(sFile)) To sFile // Not sure if we need to do this? Get ParseFileExtension sFile To sExt Get psLangAssign.Count To iCount For iItem From 0 To (iCount-1) Get psLangAssign.Ext item iItem To sLangExt Move (CString(sLangExt)) To sLangExt Move (Replaces("*",sLangExt,"")) To sLangExt // If user enters "*.html" in language detection than it will never match the actual file extension Move (Replaces(".",sLangExt,"")) To sLangExt // same for .html Move (Trim(Uppercase(sExt))) To sExt Move (Trim(Uppercase(sLangExt))) To sLangExt If (sExt = sLangExt) Begin Get psLangAssign.Language Item iItem To sLang Function_Return sLang End End Function_Return (psLanguage(Self)) End_Function // Adds a Entry to the RecentFiles List, previous it tests // if the same file is already in the list and removes it. // By SVN on 22-03-2017 Procedure AddRecentWorkspace String sWorkspace String sName String sVersion Integer iCount iC iLimit Move (Trim(sWorkspace)) to sWorkspace Move (psRecentWorkspaces.Count(Self)) to iCount For iC from 0 to (iCount-1) If (Uppercase(psRecentWorkspaces(Self,iC)) = Uppercase(sWorkspace)) Begin Send psRecentWorkspaces.DeleteItem iC Move iCount to iC End End Move (psRecentWorkspaces.Count(Self)) to iCount Set psRecentWorkspaces item iCount to sWorkspace Set psRecentWorkspaces.sDescription item iCount to sName Set psRecentWorkspaces.sVersion item iCount to sVersion // Limit to the max RecentFileList length Move (psRecentWorkspaces.Count(Self)) to iCount Move (piRecentWSLimit(Self)) to iLimit For iC from 0 to (iCount-1-iLimit) Send psRecentWorkspaces.DeleteItem iC End End_Procedure // Adds a Entry to the RecentFiles List, previous it tests // if the same file is already in the list and removes it. Procedure AddRecentFile String sFile Integer iCount iC iLimit Move (Trim(sFile)) to sFile Move (psRecentFiles.Count(Self)) to iCount For iC from 0 to (iCount-1) If (Uppercase(psRecentFiles(Self,iC))) Eq (Uppercase(sFile)) Begin Send psRecentFiles.DeleteItem iC Move iCount to iC End End Move (psRecentFiles.Count(Self)) to iCount Set psRecentFiles item iCount to sFile // Limit to the max RecentFileList length Move (psRecentFiles.Count(Self)) to iCount Move (piRecentFilesLimit(Self)) to iLimit For iC from 0 to (iCount-1-iLimit) Send psRecentFiles.DeleteItem iC Loop End_Procedure // Finds a language by Name... Function FindLanguage String sName Returns Integer Integer iC iCount String sStr Move (Trim(sName)) to sName Get psLanguages.Count to iCount For iC from 0 to (iCount-1) Get psLanguages item iC to sStr If (sStr = sName) Begin Function_Return iC End End Function_Return -1 End_Function Procedure DeleteLanguage String sName Integer iCount iC Move (Uppercase(Trim(sName))) to sName Move (psLanguages.Count(Self)) to iCount For iC from 0 to (iCount-1) If (Uppercase(psLanguages(Self,iC))=sName) Begin Send psLanguages.DeleteItem iC Move iCount to iC End Loop End_Procedure // Finds a color schema by Name... Function FindColorSchema String sName Returns Integer Integer iC iCount String sStr Move (Trim(sName)) to sName Get psColorSchemas.Count to iCount For iC from 0 to (iCount-1) Get psColorSchemas item iC to sStr If (sStr = sName) Begin Function_Return iC End Loop Function_Return -1 End_Function Procedure DeleteColorSchema String sName Integer iCount iC Move (Uppercase(Trim(sName))) to sName Move (psColorSchemas.Count(Self)) to iCount For iC from 0 to (iCount-1) If (Uppercase(psColorSchemas(Self,iC))=sName) Begin Send psColorSchemas.DeleteItem iC Move iCount to iC End Loop End_Procedure // Registers the language with the given item nr. // (for Highlighting) Procedure RegisterLanguage Integer iC // codemax only! End_Procedure // Does a RegisterLanguage for every language. // (so all Languages are registerd ) Procedure RegisterAllLanguages Integer iC iCount Get psLanguages.Count To iCount For iC From 0 To (iCount-1) Send RegisterLanguage iC End End_Procedure // Overwritten to Procedure LoadIni Integer iRet String sStartupPath Forward Send LoadIni Get CMSetHotkeys (psEditorHotKeys(Self)) To iRet // Sets the Hotkeys. Send RegisterAllLanguages // Registers all Languages for Highlighting // **WvA: 05-03-03, Changed to eliminate a "RAW file Error" Get psStartUpPath To sStartUpPath If sStartUpPath Ne "" Begin Send DoChangeCurrentFolder sStartUpPath End Send Editor_LoadAllMacros gsUserName End_Procedure Procedure SaveIni Forward Send SaveIni Send Editor_SaveAllMacros gsUserName End_Procedure End_Class // This method will change the current windowsfolder for a given directory // // Just blindly checking the current folder using the Set_Directory command // evokes a cryptic "RAW-file error" // Procedure DoChangeCurrentFolder Global String sFolder String sMessage String sHome If (vFolderExists(sFolder)) Begin Set_Directory sFolder // Sets the current workfolder End Else Begin Get psHome of (phoWorkspace(ghoApplication)) to sHome If (sFolder<>"") Begin // don't tell anything on first startup, just change the startup folder // Cannot have a translation here as this is before the array gets populated, so you'll get error 4509. //#IFDEF TH_TRANSLATION //Move gILanguage[1592] to sMessage //#ELSE Move ("The Hammer tried to set the following folder as your current directory.\n\n") to sMessage Move (sMessage+"Folder: '%1'\n\n") to sMessage Move (sMessage+"This folder does not appear to exist on your system.\n\n") to sMessage Move (sMessage+"Changing current directory to '%2' instead.") to sMessage //#ENDIF Move (Replace("%1", sMessage, sFolder)) to sMessage Move (Replace("%2", sMessage, sHome)) to sMessage Send Info_Box sMessage (_T("Problem", 1593)) End Set_Directory sHome End End_Procedure