ProcessEditorEventW suggestions

A place where plug-in developers can share their knowledge and experience.
Post Reply
pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

ProcessEditorEventW suggestions

Post by pepak » Tue 06 May, 2014 11:56

Hi!

For my plugins, I would find it quite useful if the ProcessEditorEventW function got expanded. Specifically, I need:

- EE_CANCLOSE, which would get called just before EE_CLOSE and with the same arguments. If it returned TRUE (the default value), then normal closing would commence, otherwise the closing would be aborted and the edited file would remain in the editor.

- Split EE_SAVE into "EE_BEFORESAVE" and "EE_AFTERSAVE".

- I don't need that yet, but it would follow that EE_LOAD would also have a BEFORE and AFTER variant.

Any chance of these functions being implemented? I expect the CANCLOSE event should be simple enough. Thanks.

User avatar
Skirda
Posts: 3474
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 1 time

Re: ProcessEditorEventW suggestions

Post by Skirda » Tue 06 May, 2014 13:54

==> mantis
We are the Borg. You will be assimilated.
So Say We All!

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 13:32

Consider another approach: what if we had some special option for Editor function?
There are flags like EF_NONMODAL, EF_IMMEDIATERETURN, etc.
Maybe you need new flag EF_RETURN_BEFORE_QUIT?

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 13:51

If I understand it correctly (maybe I don't), then it would not be suitable for my needs. How would it behave? In my opinion, it would only work for modal editors, and I can achieve much the same result for modal editors already.

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 13:56

It should behave like modal but return BEFORE quit, so you will get access to final editor content.

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 13:59

Then I understood correctly. No, that would not help me at all - I can already do that for modal editors. I need to solve the task for non-modal editors.

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 14:04

In fact, I can do it even for non-modal forms, but it's somewhat ugly. A EE_CANCLOSE event would solve my issues much better.

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 14:20

It's interesting. How you do it for non-modal editors?

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 14:24

When I create a non-modal editor, my plugin stores some state information to a list. When a EE_CLOSE event arrives, I first check whether it is my editor which is getting closed, and if it is, I perform some operations before I allow ProcessEditorEventW to quit. Check my new DirSync for details.

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 14:26

My problem lies not in detecting the quit and doing something at the time, but in preventing the quit completely. The only way I can do it now is to copy the editor's file to a new name and open a new editor in ProcessEditorEventW. It works, but it is ugly.

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 14:30

Why do you need to prevent quit?

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 14:34

Suppose that I have a file in the editor. I want to provide a function which would filter some lines (think grep). Then the user could edit the filtered lines and eventually quit the editor. At that moment I would recognize that a filter was in effect, so instead of actually quitting I would apply the filtered lines to the original file and show the original file again.

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 14:43

When user hits F10, doesn't he want actually to quit?

pepak
Posts: 330
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 3 times
Been thanked: 9 times

Re: ProcessEditorEventW suggestions

Post by pepak » Wed 14 May, 2014 14:44

Not if he uses DirSync :-)

User avatar
John Doe
Бюрократ
Posts: 11387
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 16 times
Been thanked: 100 times

Re: ProcessEditorEventW suggestions

Post by John Doe » Wed 14 May, 2014 14:59

Then you should not complain about ugliness of your workarounds :-)

Post Reply

Return to “Plug-In Developers”