Jump to content
How to Install Plugins ×

Copy Selection Bounding Box


MJW

Recommended Posts

Copy Selection Bounding Box copies the bounding box of the current selection to the clipboard. Paste Selection can then be used to activate the bounding-box selection. The bounding box can be expanded by adding margins to each side. It's a little confusing, since you have to press the Copy to Clipboard button to save to the clipboard. There was no easy way to make the save occur automatically when the plugin exits.

 

I didn't mention this in the Help menu, but if there's no selection, or the selection would not produce a proper selection when clipped to the canvas (such as when the selection is entirely outside the canvas) , a selection covering entire canvas is copied to the clipboard. These are uninteresting cases, so I decided it would be simpler and better to produce valid selections rather than displaying error messages in MessageBoxes (which is the only other simple alternative).

 

The DLL: Copy Selection Bounding Box.zip

 

The Help Menu:

 

Quote

Copy Selection Bounding Box copies the bounding box of the current selection to the clipboard. The bounding-box selection can then be enabled using the built-in Paste Selection command. The bounding box is cropped to the canvas and is always on pixel boundaries.

 

The controls are:

 

Margin: The pixel distance added to each side of the bounding box when Use Individual Margins is disabled.

 

Left Margin: The pixel distance added to the left when Use Individual Margins is enabled.

 

Right Margin: The pixel distance added to the right when Use Individual Margins is enabled.

 

Top Margin: The pixel distance added to the top when Use Individual Margins is enabled.

 

Bottom Margin: The pixel distance added to the bottom when Use Individual Margins is enabled.

 

Use Individual Margins: Specifies that the margins on each side are individually specified.

 

Copy to Clipboard: Causes the bounding box, as currently modified, to be copied to the clipboard. The copy only occurs when this button is pressed.

 

 

The User Interface:

 

Copy-Selection-Bounding-Box-UI.png

  • Like 3
  • Upvote 4
Link to comment
Share on other sites

Effects > Selection ;)

 

I was half expecting to have the contents of the bounding box copied to the clipboard. Took me a minute to realize it was the selection geometry that was being copied.

 

How about an option to do either?

 

I'm not sure if this is aligned to plugin principles, but why not disable the OK button until the Copy button has been clicked?

 

Link to comment
Share on other sites

1 hour ago, Ego Eram Reputo said:

but why not disable the OK button until the Copy button has been clicked?

 

I didn't know that could be done in an IndirectUI plugin. I not aware of any control the plugin has over the OK button.

 

What I'd much rather do is to make clicking the OK button initiate the copy to the clipboard, but there seems there's no IndirectUI mechanism to do that. Perhaps someday I'll rewrite the plugin to not use IndirectUI, but this was just sort of a quick CodeLab hack I wrote on a whim.

 

(I wish CodeLab allowed sliders to be linked, since that would have been more elegant than two sets of controls.)

Link to comment
Share on other sites

2 hours ago, MJW said:
3 hours ago, Ego Eram Reputo said:

but why not disable the OK button until the Copy button has been clicked?

 

I didn't know that could be done in an IndirectUI plugin.

 

It can't.

 

2 hours ago, MJW said:

I wish CodeLab allowed sliders to be linked, since that would have been more elegant than two sets of controls.

 

Export to a Visual Studio project and add your additional rules there. It's a piece of cake.

Link to comment
Share on other sites

1 hour ago, BoltBait said:

Export to a Visual Studio project and add your additional rules there. It's a piece of cake.

 

Many (most) of my recent plugins have been VS projects, but this is just a quickie. It's convenient not to have anything but the CodeLab text file. If I could make it work with the OK button, I'd do what you suggest in a second, but just to link the controls for a bit more elegance doesn't seem worth it.

 

(That is in no way intended to denigrate the CodeLab Export option, which is a wonderful feature.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...