12

我正在编写一个插件来Delphi IDE Theme Editor与 Rad Studio IDE 集成(该工具的当前版本作为外部应用程序运行)到目前为止一切正常(见下图),除了我无法弄清楚的事实如何在 Delphi IDE 中刷新选定的语法高亮颜色

在此处输入图像描述

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

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

我搜索了 ToolsAPI 单元,找到了IOTAEditOptions,IOTAHighlighterIOTAHighlightServices接口,但似乎没有一个包含刷新(重新加载)修改设置的选项。

我还尝试了 unmangle(使用 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 __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)?

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

4

2 回答 2

2

A slight hack that should have the desired effect would be to have your plugin bring up the Environment Options dialog, and have the operator close it manually. This causes the IDE to reinitialize its configuration based on the submitted settings.

To do this, obtain a handle onto a Project (IOTAProject object) and call...

AProject.ProjectOptions.EditOptions;

Where AProject is defined as AProject: IOTAProject.

I know this isn't the most elegant of solutions, but if it has the desired effect, at least it's somewhat practical.

于 2012-03-28T21:24:14.363 回答
2

我会说你最好的选择是四处窥探coreide*.@Envoptions@TEnvironmentOptions@EditorSourceOptionsBeforeSavecoreide*.@Envoptions@TEnvironmentOptions@EditorSourceOptionsAfterSave

当点击 Ok 按钮时,它们会被调用。我不太擅长阅读程序集,但从外观上看,环境选项是在 IDE 初始化期间从注册表加载的,所做的任何更改都会根据需要写回,但 IDE 取决于内存中的实例TEnvironmentOptions作为权威表示所有环境选项。

coreide*.@Envoptions@TEnvironmentOptions@GetEdColors似乎是从环境选项中检索颜色以进行编辑的位置TEditorColor

不幸的是,这些类都没有暴露给 OTA 或 NTA。

于 2014-03-27T19:08:25.040 回答