← Back to team overview

kicad-developers team mailing list archive

Re: Add close shortcut to Library Editor -- patch

 

On 07/22/2010 01:15 AM, Yury Khalyavin wrote:
> On Wed, Jul 21, 2010 at 07:34:30AM -0500, Dick Hollenbeck wrote:
>>
>>
>>
>> On 07/21/2010 01:11 AM, Yury Khalyavin wrote:
>>> === modified file eeschema/libeditframe.cpp
>>> --- eeschema/libeditframe.cpp	2010-03-20 19:57:59 +0000
>>> +++ eeschema/libeditframe.cpp	2010-07-21 05:36:11 +0000
>>> @@ -116,6 +116,8 @@
>>>                  WinEDA_LibeditFrame::Process_Special_Functions )
>>>  
>>>  /* menubar commands */
>>> +EVT_MENU( wxID_EXIT,
>>> +          WinEDA_LibeditFrame::CloseWindow )
>>>  EVT_MENU( ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
>>>            WinEDA_LibeditFrame::SaveActiveLibrary )
>>>  EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE,
>>> @@ -307,6 +309,15 @@
>>>  
>>>  
>>>  /**
>>> + * Call close event, which process by EVT_CLOSE
>>> + */
>>
>>
>> This comment should go in the header file, not in the C++ file, for the benefit of
>> "one place of comment maintenance" and for access by doxygen.  Doxygen
>> is configured to pick from the header file the function comments, as a higher priority
>> than from the C++ file.
>>
> 
>> /**
>>  * Function CloseWindow
>>  * will close the window.
>>  */
>>
>> Doxygen puts the above text in a single sentence which reads well.
>>
>> "Function CloseWindow will close the window."
>>
>>
> 
> Done.
> 
>>> +void WinEDA_LibeditFrame::CloseWindow( wxCommandEvent& WXUNUSED(event) )
>>> +{
>>> +    Close();
>>> +}
>>> +
>>> +
>>> +/**
>>>   * Save library editor frame specific configuration settings.
>>>   *
>>>   * Don't forget to call this base method from any derived classes or the
>>>
>>> === modified file eeschema/libeditframe.h
>>> --- eeschema/libeditframe.h	2010-03-28 14:46:49 +0000
>>> +++ eeschema/libeditframe.h	2010-07-21 05:36:11 +0000
>>> @@ -84,6 +84,7 @@
>>>      void DisplayLibInfos();
>>>      void RedrawActiveWindow( wxDC* DC, bool EraseBg );
>>>      void OnCloseWindow( wxCloseEvent& Event );
>>> +    void CloseWindow( wxCommandEvent& WXUNUSED(event) );
>>>      void ReCreateHToolbar();
>>>      void ReCreateVToolbar();
>>>      void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
>>>
>>> === modified file eeschema/menubar_libedit.cpp
>>> --- eeschema/menubar_libedit.cpp	2010-06-30 11:15:34 +0000
>>> +++ eeschema/menubar_libedit.cpp	2010-07-21 05:36:11 +0000
>>> @@ -68,6 +68,16 @@
>>>      item->SetBitmap( plot_xpm );
>>>      filesMenu->Append( item );
>>>  
>>> +    /* Quit on all platforms except WXMAC */
>>
>>
>> Please say why not a MAC,  and use C++ comments for single line ones.
>>
>>
>>> +#if !defined(__WXMAC__)
>>> +
>>> +    filesMenu->AppendSeparator();
>>> +    item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ),
>>> +                           _( "Quit Library Editor" ) );
>>> +    filesMenu->Append( item );
>>> +
>>> +#endif /* !defined( __WXMAC__) */
>>> +
>>>      /**
>>>       * Edit menu
>>>       */
> I found this way in several other files:
> 
> kicad]$grep "except WXMAC" . -IR           (07-21 17:55)
> ./cvpcb/menucfg.cpp:    /* Quit on all platforms except WXMAC */
> ./cvpcb/menucfg.cpp:    /* About on all platforms except WXMAC */
> ./kicad/menubar.cpp:    /* Quit on all platforms except WXMAC */
> ./kicad/menubar.cpp:    /* About on all platforms except WXMAC */
> ./eeschema/menubar.cpp:    /* Quit on all platforms except WXMAC */
> ./eeschema/menubar.cpp:    /* About on all platforms except WXMAC */
> ./eeschema/menubar_libedit.cpp:    /* Quit on all platforms except WXMAC */
> ./pcbnew/menubar_pcbframe.cpp:    /* Quit on all platforms except WXMAC */
> ./pcbnew/menubar_pcbframe.cpp:    /* About on all platforms except WXMAC */
> 
> I never work with MAC, but I think this comment not useless. May
> be it`s author (jerryja) can say something?
> 
> 
> New patch in attachment.
> 
> Regards,
> --
>     Yury Khalyavin

Committed with minor tweaks.  This email is in response to one that was sent to me
personally (erroneously I assume), so I include the full text in my reply.

Dick




References