← Back to team overview

kicad-developers team mailing list archive

Re: Component library files remove -- patch

 

On 07/19/2010 01:19 AM, Yury Khalyavin wrote:
> Hi again,
>
> This path select next item in "Component library files" after deleted
> item. I may be very useful if you want to remove all standard libs, and
> add self-written components. Without this patch you need select item in
> "Component library files", press "Remove" button again and again -- this
> very tired. With this patch you only once select item and press "Remove"
> button quantum placet :)
>
> Regards,
>   Yury
>
> === modified file 'eeschema/dialog_eeschema_config.cpp'
> --- eeschema/dialog_eeschema_config.cpp 2010-04-02 14:26:27 +0000
> +++ eeschema/dialog_eeschema_config.cpp 2010-07-15 07:56:40 +0000
> @@ -272,6 +272,14 @@
>          m_ListLibr->Delete(selections[ii] );
>          m_LibListChanged = TRUE;
>      }
> +
> +    /* Select next item after deleted in m_ListLibr */
> +    if (m_ListLibr->GetCount() > 0 && selections.GetCount() > 0) {
> +        int pos = selections[selections.GetCount()-1];
> +        if (pos == m_ListLibr->GetCount())
> +            pos = m_ListLibr->GetCount() - 1;
> +        m_ListLibr->SetSelection( pos );
> +    }
>  }
>   

This patch does not follow established coding style, will not commit.

Use C++ comment style for single line comments please.

No space after if

{ in wrong place.

Add space before ) and after (

And then if it is not objected to on function, it could be committed
after these revisions.

Thanks,

Dick




References