Menu

#1437 Patch: wxSmithTreeContextMenu CopyPaste

Next_Release
applied
ollydbg
Patch
2024-02-20
2023-12-19
Tiger Beard
No

Commit info
This patch adds a context menu to all wxSmith tree items except the main dialog. The context menu is just a shortcut for the following combinations
Cut Menu/Edit/Cut
Copy Menu/Edit/Copy
PasteBefore Button "InsertBefore" and then Menu/Edit/Paste
PasteInto Button "InsertInto" and then Menu/Edit/Paste
PasteAfter Button "InsertAfter" and then Menu/Edit/Paste
The patch speeds up refactoring work on exisitng wxSmith dialogs dramatically.

The patch was tested under Linux 22.04 only with wxGTK3 3.0.5.

1 Attachments

Discussion

  • ollydbg

    ollydbg - 2023-12-19
    • labels: v0.1 --> v0.1, wxSmith
     
  • ollydbg

    ollydbg - 2023-12-19
     
  • ollydbg

    ollydbg - 2023-12-19

    Nice contribution.

    One question:

    What is the "2" mean in the patch:

    @@ -898,9 +915,20 @@
     void wxsItemEditor::ShowPopup(wxsItem* Item,wxMenu* Popup)
     {
         m_PopupCaller = Item;
    -    PopupMenu(Popup);
    +
    +    Item->SetIsSelected( true );
    +
    +    //wxMenu* Popup = new wxMenu( wxEmptyString );
    +    Popup->Append(wxsCutId,_("Cut2"));
    +    Popup->Append(wxsCopyId,_("Copy2"));
    +    Popup->Append(wxsInsBeforeId,_("Paste Before Selected2"));
    +    Popup->Append(wxsInsIntoId,_("Paste Inside Selected2"));
    +    Popup->Append(wxsInsAfterId,_("Paste After Selected2"));
    +    wxWindow::PopupMenu(Popup);
    +    //delete Popup;
     }
    

    Also, some TABs in the source code should be replaced by spaces if I remember correct.

    I will test it in my C::B, I use C::B and wxSmith in many of my personal projects(mainly under Windows).

    Thanks.

     
  • Tiger Beard

    Tiger Beard - 2023-12-19

    Thanks for your feedback.
    The "Cut2" was an leftover from debugging (my first implementation used wxSmith menu items but that proved much less efficient than the context menu. I'll correct that.

    The tabs. I had to change the patch manually, because it had loads of changes from my AStyle setting which seems very different than the code style CB svn is using. I think the editor tab preferences also affect hat.

    I have not found anything on the wiki about the settings to use for SVN commits. Obviously one is "use spacess for tabs", but what is the AStyle setting?

    Attached the corrected patch, I hope I caught all tabs

     
  • ollydbg

    ollydbg - 2023-12-20

    Hi, I got a linker error:

    wxsItemEditor::OnMouseClick is not defined.

    Do you forget to add this function implementation in your patch file?

     

    Last edit: ollydbg 2023-12-20
    • Tiger Beard

      Tiger Beard - 2023-12-20

      Hm. Interesting.
      I was sure this was already there as function with header but no CPP body but the compiler did not complain. In fact I added an implementation first but found that it was not called, so I deleted the CPP part again. Not sure why the compiler complains.
      So I did not use it and would have deleted it.

       
      • ollydbg

        ollydbg - 2023-12-21

        OK, this is a bit strange, so let me comment out that line in the event handler macro table, and continue building. Thanks.

         
  • ollydbg

    ollydbg - 2023-12-20

    I think I can't find a "astyle" format which can direct format the code.

    see here: Coding style - Code::Blocks — https://wiki.codeblocks.org/index.php/Coding_style

    There is a "space" after the "if", but there is no space between the function definition like

    void f();
    
     

    Last edit: ollydbg 2023-12-20
    • Tiger Beard

      Tiger Beard - 2023-12-20

      So according to the wiki, the AStyle option "ANSI" should do it, then, thanks
      I will try next time.

       
  • Tiger Beard

    Tiger Beard - 2023-12-20

    Thanks. Is there anything expected from me now?

     
    • ollydbg

      ollydbg - 2023-12-21

      Currently, no question. Give me some time for testing and reading your code. Thanks.

       
  • Tiger Beard

    Tiger Beard - 2023-12-21

    <moved to="" #1436=""></moved>

     

    Last edit: Tiger Beard 2023-12-31
  • Tiger Beard

    Tiger Beard - 2024-01-02

    I am using it for a while not and its speeding up things a lot. There is one thing I failed to track down, because I got lost in the code complexity a bit.

    When pasting an item, e.g. after copy, the current properties are not all maintained. For example the Border Settings are always reset to 5 and all sides ON. Same for Proportion that is set to 1.
    I think it would be better if all properties except the Varname and IDs remain as the source item.

     
  • Tiger Beard

    Tiger Beard - 2024-01-31

    @ollydbg any chance to look at he code yet?

     
  • ollydbg

    ollydbg - 2024-02-17

    Hi, when review the code in my local git , I see one code changes:

    ~~~~
    @@ -949,6 +960,9 @@ BEGIN_EVENT_TABLE(wxsItemEditor,wxsEditor)
    EVT_BUTTON(wxsPreviewId,wxsItemEditor::OnPreview)
    EVT_BUTTON(wxsQuickPropsId,wxsItemEditor::OnQuickProps)
    EVT_BUTTON(-1,wxsItemEditor::OnButton)
    +// EVT_BUTTON(wxsCutId,wxsItemEditor::OnCut)
    +// EVT_BUTTON(wxsCopyId,wxsItemEditor::OnCopy)
    EVT_KEY_DOWN(wxsItemEditor::OnKeyDown)
    + EVT_RIGHT_UP(wxsItemEditor::OnMouseClick)
    EVT_MENU(wxID_ANY,wxsItemEditor::OnPopup)
    END_EVENT_TABLE()
    ~~~~

    I try to find the two functionswxsItemEditor::OnCut and wxsItemEditor::OnCopy, maybe those two functions are your test functions? So I will remove them in the commit.

    Thanks.

     
  • ollydbg

    ollydbg - 2024-02-17

    It's in svn rev13453 now. Thanks.

     
  • ollydbg

    ollydbg - 2024-02-20
    • status: open --> applied
    • assigned_to: ollydbg
     
  • ollydbg

    ollydbg - 2024-02-20

    Nice contribution.

    One question:

    What is the "2" mean in the patch:

    @@ -898,9 +915,20 @@
     void wxsItemEditor::ShowPopup(wxsItem* Item,wxMenu* Popup)
     {
         m_PopupCaller = Item;
    -    PopupMenu(Popup);
    +
    +    Item->SetIsSelected( true );
    +
    +    //wxMenu* Popup = new wxMenu( wxEmptyString );
    +    Popup->Append(wxsCutId,_("Cut2"));
    +    Popup->Append(wxsCopyId,_("Copy2"));
    +    Popup->Append(wxsInsBeforeId,_("Paste Before Selected2"));
    +    Popup->Append(wxsInsIntoId,_("Paste Inside Selected2"));
    +    Popup->Append(wxsInsAfterId,_("Paste After Selected2"));
    +    wxWindow::PopupMenu(Popup);
    +    //delete Popup;
     }
    

    Also, some TABs in the source code should be replaced by spaces if I remember correct.

    I will test it in my C::B, I use C::B and wxSmith in many of my personal projects(mainly under Windows).

    Thanks.

     
  • Tiger Beard

    Tiger Beard - 2024-02-20

    Removed.

     

    Last edit: Tiger Beard 2024-02-20
  • ollydbg

    ollydbg - 2024-02-20

    Sorry, firefox sent my comments which was months ago.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.