ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Pasting from clipboard into text editor vs image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jrpcguru

USA
254 Posts

Posted - Mar 26 2019 :  16:05:51  Show Profile  Reply
I note that you provide the normal keyboard shortcut keys for copy/cut/paste both in the text editor and for layers. But when pasting a layer it pastes in directly on top of the layer that was copied to the clipboard. This gives the user no visual feedback that the paste worked.

I have a right click menu with copy and paste on it. The following code solves the problem of pasting on top of the layer:

    ImageEnView1.Proc.PasteFromClipboard( iecpLayer );
    ImageEnView1.CurrentLayer.PosX := ImageEnView1.CurrentLayer.PosX + 30;   //try to shift pasted layer/image
    ImageEnView1.CurrentLayer.PosY := ImageEnView1.CurrentLayer.PosY + 30;
    ImageEnView1.Update();



The problem arises when I assign the normal hotkeys to this right click menu. That prevents the hot keys from working in the text editor. I very much prefer to have consistent use of hot keys, so I'm wondering about possible solutions:

1. Provide a property for pasting in layers that sets the offset value.
2. I assume your text editor is a TEdit. Is there a programmatic way to address it so my code executes the clipboard functions from the right click menu? Apparently I can differentiate between the text editor and normal layers via LayersEditingLayer, but I've found no way to directly use the TEdit.
3. Is there any way to replace the default right click menu on the text editor? It currently has options which I think would confuse many users.

J.R.

jrpcguru

USA
254 Posts

Posted - Mar 26 2019 :  16:08:32  Show Profile  Reply
Sorry for the addition. I just remembered that I wanted to ask about using PointPasteFromClip with layers. It seemed to ignore a layer on the clipboard, but it might represent another option for pasting layers to the desired coordinate.

J.R.
Go to Top of Page

xequte

38219 Posts

Posted - Mar 28 2019 :  16:31:52  Show Profile  Reply
Hi

I agree that the situation is not ideal, but unfortunately the fix is not simple. If you CUT and paste, then you do not want a position increment. If you COPY and paste, you want an increment, but only if the old object is still there. If you paste twice, then you need two increments, paste three times, three increments, etc.

Naturally the logical way would to keep incrementing the position of a pasted object until you find a position where an identical layer does not exist, but for this I need to write a method to compare two layers. I'll put it on the to-do list.

FTR, I note that the image editors I have, Fireworks, MS Paint, etc., paste to the same position.

In the meantime you can enable IncrementLayerPosOnPaste in ie.inc in the current beta release.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Mar 28 2019 :  17:51:29  Show Profile  Reply
Could you suggest an answer to my other questions about the shortcut keys?

I can see where the problem is a bit more complex than I realized. I will look forward to using IncrementLayerPosOnPaste.

It seems that if PointPasteFromClip worked with layers, that should allow the user to paste where they clicked the mouse. But the regular paste could do an offset like you have provided now.



J.R.
Go to Top of Page

xequte

38219 Posts

Posted - Mar 28 2019 :  18:29:47  Show Profile  Reply
Hi JR

Email me for the updated source with IncrementLayerPosOnPaste. That will resolve the shortcut problem.

(Note: That it shifts even a cut layer).

For pasting from the right-click menu to a position, just manually call paste and adjust the PosX and PosY of the layer.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Mar 28 2019 :  19:00:13  Show Profile  Reply
My bad. I realized that you had solved the shortcut problem with your new property, about an hour after my reply. Thanks for the help.

J.R.
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Mar 30 2019 :  18:44:55  Show Profile  Reply
I've tried sending an email to you to get the beta version as you instructed, but no answer. Is there a better email address?

I've continued working with layers and find another minor problem. If I have an image on the clipboard and use:

ImageEnView1.Proc.PasteFromClipboard( iecpLayer ); 


This auto creates the new image layer. But if the current layer is not an image layer and I use Ctrl+V, your default shortcut, I get an error "Active layer does not contain a bitmap." So I wanted to trap this error and provide a useful instruction of which feature to use in my program to fix the problem. I thought of using TIELayerEvent via OnLayerNotifyEx, but there is no TIELayerEvent for clipboard operations. Is there a way to trap this error?

J.R.
Go to Top of Page

xequte

38219 Posts

Posted - Mar 31 2019 :  03:12:32  Show Profile  Reply
Hi JR

I did receive your email and thought I forwarded the beta. I will check the new issue you mentioned and resend it (probably tomorrow).


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38219 Posts

Posted - Apr 01 2019 :  23:42:59  Show Profile  Reply
I've emailed an updated beta, which should also resolve the paste issue.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Apr 22 2019 :  19:35:33  Show Profile  Reply
I just installed 8.5.0 and I'm puzzled. I can't find the property IncrementLayerPosOnPaste that you mentioned above. The desired result seems to be the default, so I wonder if you decided against having this property?



J.R.
Go to Top of Page

xequte

38219 Posts

Posted - Apr 22 2019 :  19:43:14  Show Profile  Reply
Hi JR

It is a define in ie.inc. You need to enable IncrementLayerPosOnPaste and recompile your source. Though actually, this is already enabled in 8.5.0. From 8.5.1, it won't be enabled by default.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Apr 23 2019 :  11:59:56  Show Profile  Reply
Thanks. But in my most recent testing, I discovered in 8.5.0 that IncrementLayerPosOnPaste is not implemented by default. I found that when testing with your All Layers demo. I was originally testing it with my program and forgetting that I had implemented a work around.

J.R.
Go to Top of Page

xequte

38219 Posts

Posted - Apr 23 2019 :  19:40:28  Show Profile  Reply
OK. Then please define it and recompile your ImageEn packages.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: