Author Topic: wxSmith C&P in Releases 15.12 and 16.01  (Read 5304 times)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
wxSmith C&P in Releases 15.12 and 16.01
« on: March 05, 2016, 11:21:17 pm »
I can't get to work copy& paste via Ctrl-C/V keys in wxSmith.  Using Menu Edit/copy and Edit/Paste works fine though.

Use case:
  -Include a wxFrame +  Sizer + wPanel + Sizer with 3 Sizers inside.
 - click on insert mode button "Insert after current selection". Red checkmark is visible
  - in the tree view select the middle of the 3 sizers. Line gets highlighed and Sizer in the graphical view are marked
  - and press Ctrl-C - Ctrl-c
 - nothing happens.
Now select Menu Edit/Copy, Menu Edit/Copy . Now a copy of the sizer is inserted in the line below the sizer.

Similary, the only way to delete a difficult to pick sizer is via Menu Edit/Cut.

Does anyone else have the same behaviour?

Thx
Tiger

I am using Win7,x64, Standard Install of V15.12 and Zip install of V16.01.
« Last Edit: March 06, 2016, 01:17:43 pm by tigerbeard »

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #1 on: March 06, 2016, 06:23:27 pm »
I have been using wxSmith for quite some time (love it).

You are correct that ctrl-c/ctrl-v does not work, so I use the Edit menu for that when needed. Also, for difficult picks I find that the tree in resource view is really helpful. To delete I always use the big red cross button ("Delete current selection") under the insert mode buttons, that should be more convenient than the Edit/cut option.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #2 on: March 06, 2016, 06:35:16 pm »
I agree that it is a great tool. I had been using an external tool before which was really good, but had not the tight integration of wxSmith. Thats been the main bonus for me. It has a few edges and corners (e.g renaming), but after a while you get safely around these.

Using CTRL-C/V via keyboard has been a major performance plus since you could move around big chunks of structure in the tree.

I can not recall exactly when, but I am sure to have used it in earlier versions of CodeBlocks. I can not get my old copies to run on the new system any more, so I can not test those. As I recall the rev's  9677 from 2014 were fine.

I wonder that I did not find any other posts about this. Once a C and P had been lost, but that was rather long ago. Maybe I am just using wxSmith the wrong way? In complex dialogs it often happens that I need to move around substructures to, say, add an new high level box sizer. The items to be moved are sizers with several elements inside.
I was not able to get that woth drag&drop, so I am selecting the tree items to move, select a insertion button and open the menu to run copy and paste. I did not fimd out how to select multiple items to the procedure gets a bit lenthy when quite a few tree leafs have to be moved.

Maybe there is a better way to do things like that in the current version? I would be curious to know how others work with large dialogs in wxSmith. Large, say 30+ elements.


« Last Edit: March 07, 2016, 01:54:40 am by tigerbeard »

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #3 on: March 07, 2016, 03:45:29 pm »
partly resolved.

Settings/Editor/KeyboardShortcuts/Commands/Edit: Cut, Copy and Paste are were not assigned in the profile.
Assign to Ctrl-X,C,V and it works in wxSmith as I remember it.

It seems in my Profile the cbKeyBinder10.ini was corruped. The shortcuts editor forgot the settings after restart.
I got an error Keybinding file corrupt when I tried to add a new profile. After deleting it a new default profile file
was created. Now I could create a custom profile. However, I got the same behaviour:

C:B, V15.12:
 - the shortcuts Ctrl-X,C;V are displayed as unassigned, even when they work in the editor
 - they can be assigned to Edit/cut, copy, paste. Then they work find in wxSmith: Select a tree item and
   duplicate it with Ctrl-C, Ctrl-V.
 - reopen Settings/Editor/KeyboardShortcuts/. it fogot the assignments. The wxSmith procedure does
   not work any more.
 - Set the bindings again. Verfiy they work. Save Workspace and close C::B. Restart C::B and verify that
   they do not work any more.

I deleted my profile and tested the first steps again and got the same result. The assignemnt was missing,
but worked and was forgotten after restart of C::B.

So. The workaround for me is to set the key bindings Ctrl-C, V, X new for every session where I need to
work with wxSmith with Copy and Paste.

Anyone please confirm that behaviour?

All wxSmith users who are not working with Copy&Past are strongly recommended to try it out. Especially
if you thought the tool is not working efficiently. I am sure you will be surprised.

Cheers
Tiger

PS: if someone knows how to assign short cuts to the insert assignment buttons please tell. I checked the
      wxSmith section in the keyboaed shortcut tool but found only the menu entries.


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #4 on: March 08, 2016, 03:59:21 pm »
Anyone please confirm that behaviour?

Confirmed. Cut and Paste are removed on CB restart.

This is at the request of Linux users (I forget why) and users who do not use the cbKeyBinder plugin, or who use the safe mode of CB, so they will have the use of Ctrl-C and Ctrl-V.

In the past, there were reports that binding copy/cut/paste keys cause interference with the OS.

I do not know why wxSmith does not see the global (or OS) key definitions.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #5 on: March 08, 2016, 04:43:28 pm »
Anyone please confirm that behaviour?

Confirmed. Cut and Paste are removed on CB restart.

This is at the request of Linux users (I forget why) and users who do not use the cbKeyBinder plugin, or who use the safe mode of CB, so they will have the use of Ctrl-C and Ctrl-V.

In the past, there were reports that binding copy/cut/paste keys cause interference with the OS.

I do not know why wxSmith does not see the global (or OS) key definitions.

The problem with the old way of doing cut/copy/paste through an app level accelerator is that it overrides the native cut/copy/paste behavior of widgets. E.g. you try to ctrl+c on a widget (e.g. the text box for incremental search) that has the focus, and instead you copy whatever happens to be selected in the editor. Not good.

I think the fix is that wxSmith needs to handle wxID_CUT, wxID_COPY, and wxID_PASTE to respond to the system cut/copy/paste signals.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #6 on: March 08, 2016, 06:38:43 pm »
Quote
Confirmed. Cut and Paste are removed on CB restart.
Thanks.

Quote
In the past, there were reports that binding copy/cut/paste keys cause interference with the OS.
Ok, interesting what restrictions can come up when trying to be multi-plattform.

The problem with the old way of doing cut/copy/paste through an app level accelerator is that it overrides the native cut/copy/paste behavior of widgets. E.g. you try to ctrl+c on a widget (e.g. the text box for incremental search) that has the focus, and instead you copy whatever happens to be selected in the editor. Not good.
I am not sure how the accelerator exactly works, but wouldn't wxSmith in this case get the ctrl-c only when its active, i.e. I just clicked into the tree to highlight an item and wxSmith has focus. So another non-wxSmith widget should not have focus anyway?
Isn't C::B using wxWidgets for this? Then that would mean wxWidgets is behaving differntly between Win/Linux which would be a bad thing indeed.

I think the fix is that wxSmith needs to handle wxID_CUT, wxID_COPY, and wxID_PASTE to respond to the system cut/copy/paste signals.
At least it provides the right handling, as it works fine after the changes during the same session. I understood the wxAccelerator so, that on a keybutton it sends a specific event, e.g. wxID_COPY. If thats what is happening wxSmith does exactly that. It does not, however, process the key presses "WXK_CONTROL" and the C key, which I think would be very bad if every plugin had to do that.

If that behaviour is be design, maybe it is less surprising to remove the Cut,Copy,Paste options in the key handling tool completely, or at least disable them with a text hint?


Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #7 on: March 09, 2016, 09:50:40 pm »
At least it provides the right handling, as it works fine after the changes during the same session. I understood the wxAccelerator so, that on a keybutton it sends a specific event, e.g. wxID_COPY. If thats what is happening wxSmith does exactly that. It does not, however, process the key presses "WXK_CONTROL" and the C key, which I think would be very bad if every plugin had to do that.

If that behaviour is be design, maybe it is less surprising to remove the Cut,Copy,Paste options in the key handling tool completely, or at least disable them with a text hint?

Agree that plugins should not need to do their own keystroke processing. That said, I have attached an experimental patch connecting the wsSmith editor to wxID_CUT/COPY/PASTE event IDs and changing the Cut/Copy/Paste IDs used in the main menu of the App to those system default ones. This seems to work, but perhaps needs to be tweaked a bit.
« Last Edit: March 10, 2016, 12:37:12 am by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #8 on: March 09, 2016, 09:54:05 pm »
Also as a gist here: https://gist.github.com/spillz/6a76ab3929da9285c05b

Btw, I also agree that the keyboard shortcuts should stay set if you set them. That seems to be a bug.
« Last Edit: March 09, 2016, 09:59:45 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #9 on: March 10, 2016, 12:42:40 am »
And one more comment:

The problem with the old way of doing cut/copy/paste through an app level accelerator is that it overrides the native cut/copy/paste behavior of widgets. E.g. you try to ctrl+c on a widget (e.g. the text box for incremental search) that has the focus, and instead you copy whatever happens to be selected in the editor. Not good.
I am not sure how the accelerator exactly works, but wouldn't wxSmith in this case get the ctrl-c only when its active, i.e. I just clicked into the tree to highlight an item and wxSmith has focus. So another non-wxSmith widget should not have focus anyway?
Isn't C::B using wxWidgets for this? Then that would mean wxWidgets is behaving differntly between Win/Linux which would be a bad thing indeed.

The problem is not wxWidgets, but us. We are doing non-standard stuff with our menus (i.e. not using the standard IDs) and possibly with keybinder too. My hazy memory is that keybinder globally grabs the keystrokes that have been assigned in its config instead of remapping accelerators, but I could be wrong about that. I need to take a closer look.

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: wxSmith C&P in Releases 15.12 and 16.01
« Reply #10 on: March 10, 2016, 06:48:59 pm »
Cool. Thanks for the patch. I have not yet looked at teh sources of CB, but I was about to do it anyway.

also thx for theexplanations. Should i add an item to the issue tracker about the bug?