Jump to content
Kryvich

Reset the editor modified status in IDE

Recommended Posts

I am trying to write a small plug-in to the Delphi IDE using ToolsAPI. (If I succeed, it will be distributed free of charge.)

 

1. Is it possible to reset the status of a file in editor after changes via IOTAEditWriter? Here is IOTAEditor.Modified but It's readonly. Or somehow make him think that the file has already been saved.

IDEEditor.jpg.4ba5cbdb58e97dfc63b655e7c1c349de.jpg

 

2. Is it possible to hook view mode switchings for opened DFM/FMX forms (View as Form / View as Text), using ToolsAPI only?

Share this post


Link to post

With reference to 1) The coloured bars are an interval feature of the editor and are not (AFAIK) exposed via the OTA. The only other way to re-set these, not sure why you want this, is to close the module and then  reopen it.

With reference to 2) the OTA does not expose a method for this (AFAIK) but you might be able to fudge it by sending a keystroke combination to the editor / form designer.

What are you actually trying to do as we may be able to suggest an alternate way of doing it?

Share this post


Link to post

@David Hoyle 1) Just setting the Modified status of IOTAEditor (or corresponding IOTAModule) to False would be fine.

2) The plugin must perform certain actions when an user toggles any open form from design view to text view, and back.

Actually it's the Forms Humanizer plugin, I wrote about him here: 

 

Share this post


Link to post

In instance 1) you either need to Save the file or rollback all the changes. If you're trying to show an alternate view of a line of text in the editor then I think you getting into the territory of hacking the IDE and drawing something over the top of the information in the editor. I think David Millington wrote at least one article on this before he joined Embarcadero (https://parnassus.co/mysteries-ide-plugins-painting-code-editor-part-2/). On point 2, you might need to see if the editor is viewing a DFM file to understand whether the editor is viewing a .pas file of the .dfm file. You might need notifiers so have a look at the following:

  • Thanks 1

Share this post


Link to post

It seems there is no simple solution for 1). Need to learn more.

As for 2) yes, I thought about notifiers. Then I need to know

  1. When an user opens a form and creates a new one, to set notifiers for this form.
  2. When an user toggles between design mode and text mode of the form.

Creating plugins for IDE is an interesting thing. Thank you for articles, I have to study it more deeply!

Share this post


Link to post

For the DFM editor, you're looking for the module's current active editor (have a look at IOTAModule) and from that you can tell what it is, eg the DFM, and should be able to tell if it's a form or form-as-text editor.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×