Re: Can I write custom editor-plugins? Sample code anywhere? I havecertain "idioms" in delphi that I would love to write macros for.


2005-12-05 09:30:20 AM
delphi23
Warren Postma writes:
Quote
Can anyone suggest if the OTAPI can let me write little macros to
transform some simple text into some other simple text?
Yes, you would probably use IOTAEditBlock to read the selected text,
IOTAEditReader to parse the source code and find the right place to add
your generated code, and then IOTAEditWriter to write back the generated
code. The hardest part is likely parsing the class to locate the proper
place to insert the generated code.
Quote
Name := IniFile.ReadString( section, 'Name', '' );
IniFile.WriteString( section, 'Name', FName );
Yes, you could write this as an addin, similar to the above suggestion.
You might be able to get most of the way there by creative use of the
IDE's editor keyboard macros, but probably not all of the way. GExperts
1.3 allows you to save and playback the IDE editor keyboard macros, by the
way, in case that helps.
Erik