如何指导Delphi IDE使用OTA(Open Tools API)刷新修改的语法高亮颜色? [英] How instruct to the Delphi IDE refresh the modified syntax highlight colors using OTA (Open Tools API)?

查看:821
本文介绍了如何指导Delphi IDE使用OTA(Open Tools API)刷新修改的语法高亮颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个插件来整合 Delphi IDE主题编辑器 与Rad Studio IDE(当前版本的此工具作为外部应用程序运行)到目前为止,一切都正常工作(见下图),除了事实我不知道如何刷新Delphi IDE中选定的语法高亮颜色





让我解释一下,在标准选项中更改语法高亮颜色(编辑器选项 - >颜色)可以自定义任何元素并分配新的前景色和背景色,然后按。 OK。按钮IDE应用更改,IDE编辑器窗口将使用新设置进行更新。



目前,我可以修改和存储新的值,但是我不能指示Delphi IDE应用新的配置,更改只有在IDE重新启动。



我搜索了ToolsAPI单元,我发现 IOTAEditOptions IOTAHighlighter IOTAHighlightServices 接口,但似乎没有包含刷新(重新加载)修改的设置的选项。



此外,我也尝试解开(使用tdump)并直接调用coreide1XX.bpl文件的功能,但这并没有起作用。

  00420B94 17411 1F39 Editcolorpage :: TEditorColor :: 
00422188 17400 1F3A __fastcall Editcolorpage :: TEditorColor :: ColorClick(System :: TObject *)
0042174C 17407 1F3B __fastcall Editcolorpage :: TEditorColor :: ColorSpeedSettingClick (System :: TObject *)
004224BC 17396 1F3C __fastcall Editcolorpage :: TEditorColor :: DefaultClick(System :: TObject *)
00422414 17397 1F3D __fast调用Editcolorpage :: TEditorColor :: EditorColorBroadcast(System :: TObject *,Winapi :: Messages :: TMessage&)
00421584 17409 1F3E __fastcall Editcolorpage :: TEditorColor :: EditorColorCreate(System :: TObject *)
00421730 17408 1F3F __fastcall Editcolorpage :: TEditorColor :: EditorColorDestroy(System :: TObject *)
004217B0 17406 1F40 __fastcall Editcolorpage :: TEditorColor :: ElementListClick(System :: TObject *)
004222E8 17399 1F41 __fastcall Editcolorpage: :TEditorColor :: FontClick(System :: TObject *)
004225DC 17395 1F42 __fastcall Editcolorpage :: TEditorColor :: HelpClick(System :: TObject *)
00421AE8 17404 1F43 __fastcall Editcolorpage :: TEditorColor :: InitLineFlags const System :: DelphiInterface& Toolsapi :: IOTAHighlighterPreview>)
004219B8 17405 1F44 __fastcall Editcolorpage :: TEditorColor :: InitSamplePane()
00421BC8 17403 1F45 __fastcall Editcolorpage :: TEditorColor :: InitSyntaxEditView(const System :: DelphiInterface< ; Toolsapi :: IOTAHighlighterPreview>)
0042262 C 17393 1F46 __fastcall Editcolorpage :: TEditorColor :: LoadHighlightPreviews()
004225F4 17394 1F47 __fastcall Editcolorpage :: TEditorColor :: MarkDirty()
004220E4 17401 1F48 __fastcall Editcolorpage :: TEditorColor :: SampleClick(System :: TObject *)
00422080 17402 1F49 __fastcall Editcolorpage :: TEditorColor :: SetColorSpeedSetting(Vedopts :: TColorSpeedSetting)
0042238C 17398 1F4A __fastcall Editcolorpage :: TEditorColor :: UpdateSamplePane()
00422814 17392 1F4B __fastcall Editcolorpage: :TEditorColor :: tbsetPreviewsChange(System :: TObject *,int,bool&)
004AA8D4 17390 1F4C __fastcall Editcolorpage :: initialization()
00423C38 17413 1F4D __fastcall Editdisplaypage :: Finalization()


如何指示Delphi IDE使用OTA刷新修改后的语法高亮颜色(Open Tools API )?



如果您需要更多信息或问题不清楚,请告知我。

解决方案

我'e说你最好的选择是围绕 coreide *。@ Envoptions @ TEnvironmentOptions @ EditorSourceOptionsBeforeSave coreide *。@ Envoptions @ TEnvironmentOptions @ EditorSourceOptionsAfterSave



当Ok按钮被点击时,这些被调用。我不太在阅读程序集,但从外观看,环境选项在IDE初始化期间从寄存器加载,所做的任何更改都会根据需要进行备份,但IDE取决于内存中的 TEnvironmentOptions 作为所有环境选项的权威性表示。



coreide *。@ Envoptions @ TEnvironmentOptions @ GetEdColors 似乎是通过 TEditorColor



从环境选项中检索颜色不幸的是,这些课程没有暴露于OTA或NTA。


I'm writting a plugin to integrate the Delphi IDE Theme Editor with the Rad Studio IDE (the current version of this tool run as an external application) so far everything is working fine (see the below image), except the fact which I can't figure out how refresh the selected syntax highlight colors in the Delphi IDE

Let me explain, in the standard option to change the syntax highlight colors (Editor Options-> Color) you can customize any element and assign a new foreground and background color, then if you press the . OK . button the IDE apply the changes and the IDE editor windows are updated with new settings.

Currently i can modify and store the new values, but I can't instruct to the Delphi IDE to apply the the new configuration, the changes are only visible if the IDE is restarted.

I searched the ToolsAPI unit and i found the IOTAEditOptions, IOTAHighlighter and IOTAHighlightServices interfaces but none it seems include an option to refresh (reload) the modified setting.

Also I tried unmangle (using tdump) and calling the functions of the coreide1XX.bpl file directly, but this did not work too.

00420B94 17411 1F39 Editcolorpage::TEditorColor::
00422188 17400 1F3A __fastcall Editcolorpage::TEditorColor::ColorClick(System::TObject *)
0042174C 17407 1F3B __fastcall Editcolorpage::TEditorColor::ColorSpeedSettingClick(System::TObject *)
004224BC 17396 1F3C __fastcall Editcolorpage::TEditorColor::DefaultClick(System::TObject *)
00422414 17397 1F3D __fastcall Editcolorpage::TEditorColor::EditorColorBroadcast(System::TObject *, Winapi::Messages::TMessage&)
00421584 17409 1F3E __fastcall Editcolorpage::TEditorColor::EditorColorCreate(System::TObject *)
00421730 17408 1F3F __fastcall Editcolorpage::TEditorColor::EditorColorDestroy(System::TObject *)
004217B0 17406 1F40 __fastcall Editcolorpage::TEditorColor::ElementListClick(System::TObject *)
004222E8 17399 1F41 __fastcall Editcolorpage::TEditorColor::FontClick(System::TObject *)
004225DC 17395 1F42 __fastcall Editcolorpage::TEditorColor::HelpClick(System::TObject *)
00421AE8 17404 1F43 __fastcall Editcolorpage::TEditorColor::InitLineFlags(const System::DelphiInterface<Toolsapi::IOTAHighlighterPreview>)
004219B8 17405 1F44 __fastcall Editcolorpage::TEditorColor::InitSamplePane()
00421BC8 17403 1F45 __fastcall Editcolorpage::TEditorColor::InitSyntaxEditView(const System::DelphiInterface<Toolsapi::IOTAHighlighterPreview>)
0042262C 17393 1F46 __fastcall Editcolorpage::TEditorColor::LoadHighlightPreviews()
004225F4 17394 1F47 __fastcall Editcolorpage::TEditorColor::MarkDirty()
004220E4 17401 1F48 __fastcall Editcolorpage::TEditorColor::SampleClick(System::TObject *)
00422080 17402 1F49 __fastcall Editcolorpage::TEditorColor::SetColorSpeedSetting(Vedopts::TColorSpeedSetting)
0042238C 17398 1F4A __fastcall Editcolorpage::TEditorColor::UpdateSamplePane()
00422814 17392 1F4B __fastcall Editcolorpage::TEditorColor::tbsetPreviewsChange(System::TObject *, int, bool&)
004AA8D4 17390 1F4C __fastcall Editcolorpage::initialization()
00423C38 17413 1F4D __fastcall Editdisplaypage::Finalization()

How I can instruct to the Delphi IDE refresh the modified syntax highlight colors using OTA (Open Tools API)?

Let me know if you need more info or if the question is not clear.

解决方案

I'd say your best bet would be to snoop around coreide*.@Envoptions@TEnvironmentOptions@EditorSourceOptionsBeforeSave or coreide*.@Envoptions@TEnvironmentOptions@EditorSourceOptionsAfterSave

These get called when the Ok button gets clicked. I'm not very good at reading assembly but from the looks of it the environment options are loaded from the registery during IDE initialization and any changes made are written back as needed but the IDE depends on the in memory instance of TEnvironmentOptions to be the authoritative representation of all environment options.

coreide*.@Envoptions@TEnvironmentOptions@GetEdColors appears to be where the colors are retrieved from the environment options for editing by TEditorColor

It's unfortunate none of these classes is exposed to the OTA or NTA.

这篇关于如何指导Delphi IDE使用OTA(Open Tools API)刷新修改的语法高亮颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆