Multiple clipboards

Discussion about CodeLite development process and patches
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Multiple clipboards

Post by RickCHodgin »

Is there a feature in CodeLite that has multiple clipboards? If not, I'd like to contribute that code to the project.

I'm thinking:
Ctrl+Shift+C -- Copy-And-Add-To-Clipboard-Ring.
Ctrl+Shift+X -- Cut-And-Add-To-Clipboard-Ring.
Ctrl+Shift+V -- select from clipboard ring to paste, and make that the current clipboard content.

It would be similar to how Whole Tomato's Visual Assist X (Visual Studio plugin) works for clipboards. When you press Ctrl+Shift+V a little contextual menu shows up with the last Nn clipboard entries (however many are setup to be maintained) and you can paste from them.

It would also make CodeLite clipboard context sticky, so it persists beyond sessions.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by eranif »

Hi Rick,
We don't have such feature in CodeLite.

the only thing that comes close to this is the ability to copy / paste using the mouse middle button with selection (Linux style)

Feel free to contribute
Make sure you have read the HOW TO POST thread
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by RickCHodgin »

eranif wrote: Sat Jan 23, 2021 10:33 pm Hi Rick,
We don't have such feature in CodeLite.

the only thing that comes close to this is the ability to copy / paste using the mouse middle button with selection (Linux style)

Feel free to contribute
Eran, thank you. Will try to get it completed this week. May need some help. Please check your gmail.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by eranif »

Actually, the gitter chat is a more suitable place (David is also there and can assist if I am not available)
https://gitter.im/eranif/codelite
Make sure you have read the HOW TO POST thread
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by RickCHodgin »

eranif wrote: Mon Jan 25, 2021 5:28 pm Actually, the gitter chat is a more suitable place (David is also there and can assist if I am not available)
https://gitter.im/eranif/codelite
Eran, I was able to get with David on IRC. On my computer it's taking a long to compile when I make changes. I may go ahead and code up the logic in a stand-alone program, and then submit it like that so you can integrate this feature into CodeLite yourself without having to do all the work of design, just the integration part.

It was taking almost an hour to rebuild in debug mode. And about six minutes when I would change a few files and recompile. I have a 2.4 GHz quad-core Intel machine with 8 GB of memory, running on a SSD.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by eranif »

Sure, looking forward to see your PR
Make sure you have read the HOW TO POST thread
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by RickCHodgin »

Scintilla already has a MultiPaste() member function defined for a multi-paste operation (to multiple simultaneous selections).

Am going to rename this to RingCut(), RingCopy(), and RingPaste().

UPDATE: I have the logic all coded. Will try and finish testing / debugging and submit this week.
UPDATE 2: I have it all tested and debugged. Will design the forms for the settings and submit it. Am not sure how to intercept keystrokes taken on a PopupMenu. I assume it's a specific Connect() event, so for right now you have to click on the menu item to paste from. Any help on that would be appreciated.
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by RickCHodgin »

Eran, attached is the code, and below are the notes regarding RingClip. Please let me know of any bugs or issues and I'll correct them. I've only built the Debug project, so all the linker options are there.

Thank you for letting me contribute to CodeLite.


-----
Important components are (main.cpp):

Code: Select all

    RCFrame::OnRingCut()
    RCFrame::OnRingCopy()
    RCFrame::OnRingPaste()
    RCFrame::OnRingPasteMenu()
And search for ID_RingCut, ID_RingCopy, ID_RingPaste.

In OnRingPaste() it builds a menu. I couldn't figure out how to
read keystrokes from the PopupMenu(), but if you wanted to add
letters to each menu item that would be nice. It might be better
to create A..Z icons and add those icons for each one so they
really stand out off to the side.


-----
ringclip.cpp
RingClip::RingClip() has variables that are hard-coded populated.
They should be taken from CodeLite's configuration loader:

Code: Select all

    // Read CodeLite settings file here, set these values:
    m_useRing           = true;
    m_ringCount         = 20;
    m_ringPerProject    = true;
    m_ringPersists      = true;

    // Relative to Codelite's home folder or project settings file
    m_folder            = mc_folder;
    m_diskFile          = mc_diskFile;
-----
The RingClip dialog should contain these fields:

1) Use MultiClip clipboard ring? Y/N

2) Number of items in ring: ##
* Note: Should be a maximum of 26 if we use letters for the item identifiers

3) Ring persists beyond current session? Y/N

If answer to 3) is Yes, then:
3a) Ring is stored per project? Y/N

If answer to 3a) is Yes, then:
3aa) RingClip Filename: [................]
Else
3ab) Full Pathname: [................]

I don't know how you save them in CodeLite, but they should be these variable types:

Code: Select all

    bool       m_useRing;
    int        m_ringCount;
    bool       m_ringPerProject;
    bool       m_ringPersists;

    wxString   m_folder;
    wxString   m_diskFile;
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by eranif »

Do you have screenshot on how it should look like from visual assist? (the context menu)
Make sure you have read the HOW TO POST thread
RickCHodgin
CodeLite Curious
Posts: 7
Joined: Mon Jan 18, 2021 11:33 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Multiple clipboards

Post by RickCHodgin »

eranif wrote: Sat Feb 13, 2021 7:52 pm Do you have screenshot on how it should look like from visual assist? (the context menu)
See attached. Note the second item is auto-selected on popup because the top item is what's in the clipboard right now. So if you press Ctrl+Shift+V in Visual Assist X you will only need then press Enter to select most recently used clipboard contents before the current one. For other items, the numbers or letters are used.
You do not have the required permissions to view the files attached to this post.
Post Reply