diff --git a/ide/codetemplatesdlg.pas b/ide/codetemplatesdlg.pas index ccbe0594b7..2d2d735736 100644 --- a/ide/codetemplatesdlg.pas +++ b/ide/codetemplatesdlg.pas @@ -624,26 +624,30 @@ var begin CodeTemplatesMenuRoot := RegisterIDEMenuRoot(CodeTemplatesMenuRootName); Path := CodeTemplatesMenuRoot.Name; - CodeTemplateCutIDEMenuCommand := RegisterIDEMenuCommand(Path,'Cut','Cut'); - CodeTemplateCopyIDEMenuCommand := RegisterIDEMenuCommand(Path,'Copy','Copy'); - CodeTemplatePasteIDEMenuCommand := RegisterIDEMenuCommand(Path,'Paste','Paste'); + CodeTemplateCutIDEMenuCommand := RegisterIDEMenuCommand(Path, 'Cut', + lisMenuCut); + CodeTemplateCopyIDEMenuCommand := RegisterIDEMenuCommand(Path, 'Copy', + lisMenuCopy); + CodeTemplatePasteIDEMenuCommand := RegisterIDEMenuCommand(Path, 'Paste', + lisMenuPaste); CodeTemplateInsertMacroIDEMenuCommand := RegisterIDEMenuCommand(Path, - 'InsertMacro','Insert Macro'); + 'InsertMacro', + lisCTInsertMacro); end; procedure CreateStandardCodeMacros; begin IDECodeMacros:=TLazCodeMacros.Create; - RegisterCodeMacro('Upper','uppercase string', - 'Uppercase string given as parameter', + RegisterCodeMacro('Upper', lisUppercaseString, + lisUppercaseStringGivenAsParameter, @CodeMacroUpper,nil); - RegisterCodeMacro('Lower','lowercase string', - 'Lowercase string given as parameter', + RegisterCodeMacro('Lower', lisLowercaseString, + lisLowercaseStringGivenAsParameter, @CodeMacroLower,nil); - RegisterCodeMacro('Paste','paste clipboard', - 'Paste text from clipboard', + RegisterCodeMacro('Paste', lisPasteClipboard, + lisPasteTextFromClipboard, @CodeMacroPaste,nil); - RegisterCodeMacro('ProcedureHead','insert procedure head', + RegisterCodeMacro('ProcedureHead', lisInsertProcedureHead, 'Insert header of current procedure'#13 +#13 +'Optional Parameters (comma separated):'#13 @@ -670,29 +674,28 @@ begin +'WithoutBrackets, // skip start- and end-bracket of parameter list'#13 +'WithoutSemicolon, // skip semicolon at end'#13, @CodeMacroProcedureHead,nil); - RegisterCodeMacro('ProcedureName','insert procedure name', - 'Insert name of current procedure', + RegisterCodeMacro('ProcedureName', lisInsertProcedureName, + lisInsertNameOfCurrentProcedure, @CodeMacroProcedureName,nil); - RegisterCodeMacro('Date','insert date', - 'Insert date. Optional: format string', + RegisterCodeMacro('Date', lisInsertDate, + lisInsertDateOptionalFormatString, @CodeMacroDate,nil); - RegisterCodeMacro('Time','insert time', - 'Insert time. Optional: format string', + RegisterCodeMacro('Time', lisInsertTime, + lisInsertTimeOptionalFormatString, @CodeMacroTime,nil); - RegisterCodeMacro('DateTime','insert date and time', - 'Insert date and time. Optional: format string', + RegisterCodeMacro('DateTime', lisInsertDateAndTime, + lisInsertDateAndTimeOptionalFormatString, @CodeMacroDateTime,nil); - RegisterCodeMacro('AddMissingEnd','insert end if needed', - 'check if the next token in source' - +' is an end and if not returns lineend + end; + lineend', + RegisterCodeMacro('AddMissingEnd', lisInsertEndIfNeeded, + lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL, @CodeMacroAddMissingEnd,nil); - RegisterCodeMacro('OfAll','list of all case values', - 'returns list of all values of case variable in front of variable', + RegisterCodeMacro('OfAll', lisListOfAllCaseValues, + lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria, @CodeMacroOfAll,nil); - RegisterCodeMacro('WordAtCursor','get word at current cursor position', - 'get word at current cursor position', + RegisterCodeMacro('WordAtCursor', lisGetWordAtCurrentCursorPosition, + lisGetWordAtCurrentCursorPosition, @CodeMacroWordAtCursor,nil); - RegisterCodeMacro('PrevWord','Preceding word', + RegisterCodeMacro('PrevWord', lisPrecedingWord, 'Returns parameter-indexed word from the current line preceding cursor position.'+LineEnding+LineEnding+ 'Words in a line are numbered 1,2,3,... from left to right, but the last word'+LineEnding+ 'which is always a macro command to be expanded has number 0, thus $PrevWord(0)'+LineEnding+ diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 4a7773e601..a890de3133 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -4269,6 +4269,30 @@ resourcestring +'source!'; lisCouldNotAddIToMainSource = 'Could not add %s{$I %s%s} to main source!'; lisFailedToLoadFoldStat = 'Failed to load fold state'; + lisUppercaseString = 'uppercase string'; + lisUppercaseStringGivenAsParameter = 'Uppercase string given as parameter'; + lisLowercaseString = 'lowercase string'; + lisLowercaseStringGivenAsParameter = 'Lowercase string given as parameter'; + lisPasteClipboard = 'paste clipboard'; + lisPasteTextFromClipboard = 'Paste text from clipboard'; + lisInsertProcedureHead = 'insert procedure head'; + lisInsertProcedureName = 'insert procedure name'; + lisInsertNameOfCurrentProcedure = 'Insert name of current procedure'; + lisInsertDate = 'insert date'; + lisInsertDateOptionalFormatString = 'Insert date. Optional: format string'; + lisInsertTime = 'insert time'; + lisInsertTimeOptionalFormatString = 'Insert time. Optional: format string'; + lisInsertDateAndTime = 'insert date and time'; + lisInsertDateAndTimeOptionalFormatString = 'Insert date and time. Optional: ' + +'format string'; + lisInsertEndIfNeeded = 'insert end if needed'; + lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL = 'check if the next ' + +'token in source is an end and if not returns lineend + end; + lineend'; + lisListOfAllCaseValues = 'list of all case values'; + lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'returns list of ' + +'all values of case variable in front of variable'; + lisGetWordAtCurrentCursorPosition = 'get word at current cursor position'; + lisPrecedingWord = 'Preceding word'; implementation diff --git a/ideintf/propedits.pp b/ideintf/propedits.pp index 12f8644a53..8e2e4f374c 100644 --- a/ideintf/propedits.pp +++ b/ideintf/propedits.pp @@ -6805,6 +6805,7 @@ var edClass: TPropertyEditorClass; ed: TPropertyEditor; obj: TPersistent; + PropCnt: LongInt; begin ti := A.GetPropInfo^.PropType; //DebugLn('IsInteresting: ', ti^.Name); @@ -6833,21 +6834,25 @@ var // so we must avoid infinite recursion. if visited.IndexOf(ti) >= 0 then exit; visited.Add(ti); - for i := 0 to GetPropList(ti, propList) - 1 do begin - if not (propList^[i]^.PropType^.Kind in AFilter + [tkClass]) then continue; - edClass := GetEditorClass(propList^[i], obj); - if edClass = nil then continue; - ed := edClass.Create(AEditor.FPropertyHook, 1); - try - ed.SetPropEntry(0, obj, propList^[i]); - ed.Initialize; - Rec(ed); - finally - ed.Free; + PropCnt:=GetPropList(ti, propList); + try + for i := 0 to PropCnt - 1 do begin + if not (propList^[i]^.PropType^.Kind in AFilter + [tkClass]) then continue; + edClass := GetEditorClass(propList^[i], obj); + if edClass = nil then continue; + ed := edClass.Create(AEditor.FPropertyHook, 1); + try + ed.SetPropEntry(0, obj, propList^[i]); + ed.Initialize; + Rec(ed); + finally + ed.Free; + end; + if Result then break; end; - if Result then break; + finally + FreeMem(propList); end; - FreeMem(propList); visited.Delete(visited.Count - 1); end;