Menu

#126 Nassi Shneiderman Plugin: Menu entry for create diagram

Next_Nightly
fixed
None
2016-01-30
2015-01-04
scarphin
No

A simple patch to insert a menu item for 'Create diagram' so that a shortcut can be assigned. The menu item must be disabled when no text is selected or else cb will crash. Unfortunately, I don't know how to accomplish that.

1 Attachments

Discussion

  • scarphin

    scarphin - 2015-01-05

    Attached a new patch which also disables the menu item when no text is selected.

     
  • Teodor Petrov

    Teodor Petrov - 2015-01-05

    Some comments:
    1. Please place the return statements on new lines and not on the same line as the ifs.
    2. Don't add spaces around conditions. if (bla) ...; instead of if ( bla ) ...;
    3. Don't exit early in the OnTextSelected method, but instead always set a value. Replace all early returns with Enabled(false); or even better rework the function to use a bool variable and only set it to true if the right condition is met.
    4. OnTextSelected is not the most appropriate name for the method. Use something like OnUpdateUIMenuItem.
    5. There is an indent error on this line: wxMenu* viewmenu = menuBar->GetMenu(pos);

     
    • scarphin

      scarphin - 2015-01-05
      1. That is not my coding style but the original authors. I tried to respect that and left it as it is, otherwise the whole file should go into a revision imo.
      2. Same as 1.
      3. That fixed the 'enabled menu item' problem I posted on cb forum. Thanks.
      4. 'OnTextSelected' changed to 'OnUpdateUIMenuItem'.
      5. If you're talking about the tab character, it's fixed.

      Patch attached.

       
  • Teodor Petrov

    Teodor Petrov - 2015-01-05

    Please fix 1 and 2 and I'm going to commit this patch.
    If you don't fix them I'll have, too do it anyway.

     
    • scarphin

      scarphin - 2015-01-06

      I don't think it's right but if you'd like it that way I attached the new patch.

       
  • Teodor Petrov

    Teodor Petrov - 2015-01-07
    • status: open --> fixed
    • assigned_to: Teodor Petrov
     
  • Teodor Petrov

    Teodor Petrov - 2015-01-07

    Applied in head (with slight modifications).

     

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.