Commit d01e04c9 authored by dickelbeck's avatar dickelbeck
Browse files

fix typo, beautify

parent 57a2791b
Loading
Loading
Loading
Loading
+187 −164
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
#include "macros.h"



/***********************/
/* class WinEDAListBox */
/***********************/
@@ -33,10 +32,11 @@ END_EVENT_TABLE()
/*******************************/
/* Constructeur et destructeur */
/*******************************/

/* Permet l'affichage d'une liste d'elements pour selection.
	itemlist = pointeur sur la liste des pinteurs de noms
	reftext = preselection
	movefct = fonction de cration de commentaires a afficher
 *  itemlist = pointeur sur la liste des pinteurs de noms
 *  reftext = preselection
 *  movefct = fonction de cration de commentaires a afficher
 */

WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
@@ -62,17 +62,23 @@ int ii;
    if( itemlist )
        for( names = m_ItemList, ii = 0; *names != NULL; names++ )
            ii++;
	else ii = 30;

    else
        ii = 30;

    wxBoxSizer* GeneralBoxSizer = new   wxBoxSizer( wxVERTICAL );

    SetSizer( GeneralBoxSizer );

    wxBoxSizer* MainBoxSizer = new      wxBoxSizer( wxHORIZONTAL );

    GeneralBoxSizer->Add( MainBoxSizer, 0, wxGROW | wxEXPAND | wxALL, 1 );

    wxBoxSizer* LeftBoxSizer = new      wxBoxSizer( wxVERTICAL );

    MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
    wxBoxSizer* RightBoxSizer = new     wxBoxSizer( wxVERTICAL );

    MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

    size.x = 200;
@@ -82,6 +88,7 @@ int ii;
                            wxDefaultPosition, size,
                            0, NULL,
                            wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL );

    if( colour != wxNullColour )
    {
        m_List->SetBackgroundColour( colour );
@@ -97,10 +104,12 @@ int ii;
        }

    wxButton* butt = new    wxButton( this, wxID_OK, _( "OK" ) );

    RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
    butt->SetDefault();

    butt = new              wxButton( this, wxID_CANCEL, _( "Cancel" ) );

    RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );

    if( m_MoveFct )
@@ -108,6 +117,7 @@ int ii;
        size.x   = -1; size.y = 60;
        m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, size,
                                   wxTE_READONLY | wxTE_MULTILINE );

        GeneralBoxSizer->Add( m_WinMsg, 0, wxGROW | wxALL, 5 );
    }

@@ -122,8 +132,10 @@ int ii;
    {
        wxPoint pos;
        m_Parent->GetPosition( &pos.x, &pos.y );
		if ( pos.x < 0 ) pos.x = 0;
		if ( pos.y < 0 ) pos.y = 0;
        if( pos.x < 0 )
            pos.x = 0;
        if( pos.y < 0 )
            pos.y = 0;
        pos.x += 20; pos.y += 30;
        Move( pos );
    }
@@ -149,21 +161,25 @@ int orgy = m_List->GetRect().GetTop();
    WarpPointer( x + orgx + 20, y + orgy + (list_size.y / 2) );
}


/*********************************************/
wxString WinEDAListBox::GetTextSelection()
/*********************************************/
{
    wxString text = m_List->GetStringSelection();

    return text;
}


/***************************************************************/
void WinEDAListBox::WinEDAListBox::Append(const wxString & item)
void WinEDAListBox::Append( const wxString& item )
/***************************************************************/
{
    m_List->Append( item );
}


/******************************************************************************/
void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position )
/******************************************************************************/
@@ -171,6 +187,7 @@ void WinEDAListBox::InsertItems(const wxArrayString & itemlist, int position)
    m_List->InsertItems( itemlist, position );
}


/************************************************/
void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
/************************************************/
@@ -178,6 +195,7 @@ void WinEDAListBox::OnCancelClick(wxCommandEvent& event)
    EndModal( -1 );
}


/*****************************************************/
void WinEDAListBox::ClickOnList( wxCommandEvent& event )
/*****************************************************/
@@ -193,11 +211,13 @@ wxString text;
    }
}


/*******************************************************/
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
/*******************************************************/
{
    int ii = m_List->GetSelection();

    EndModal( ii );
}

@@ -207,9 +227,11 @@ void WinEDAListBox::OnOkClick(wxCommandEvent& event)
/***********************************************/
{
    int ii = m_List->GetSelection();

    EndModal( ii );
}


/***********************************************/
void WinEDAListBox::OnClose( wxCloseEvent& event )
/***********************************************/
@@ -221,6 +243,7 @@ void WinEDAListBox::OnClose(wxCloseEvent& event)
/********************************************************************/
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
/********************************************************************/

/* Routines de comparaison pour le tri tri alphabetique,
 * avec traitement des nombres en tant que valeur numerique
 */
@@ -236,7 +259,8 @@ void WinEDAListBox:: SortList()
    int ii, NbItems = m_List->GetCount();
    const wxString** BufList;

	if( NbItems <= 0 ) return;
    if( NbItems <= 0 )
        return;

    BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
    for( ii = 0; ii < NbItems; ii++ )
@@ -264,4 +288,3 @@ void WinEDAListBox::OnKeyEvent(wxKeyEvent& event)
{
    event.Skip();
}