fix typo, beautify
This commit is contained in:
parent
57a2791bc8
commit
d01e04c978
|
@ -10,7 +10,6 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
/* class WinEDAListBox */
|
/* class WinEDAListBox */
|
||||||
/***********************/
|
/***********************/
|
||||||
|
@ -33,10 +32,11 @@ END_EVENT_TABLE()
|
||||||
/*******************************/
|
/*******************************/
|
||||||
/* Constructeur et destructeur */
|
/* Constructeur et destructeur */
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|
||||||
/* Permet l'affichage d'une liste d'elements pour selection.
|
/* Permet l'affichage d'une liste d'elements pour selection.
|
||||||
itemlist = pointeur sur la liste des pinteurs de noms
|
* itemlist = pointeur sur la liste des pinteurs de noms
|
||||||
reftext = preselection
|
* reftext = preselection
|
||||||
movefct = fonction de création de commentaires a afficher
|
* movefct = fonction de création de commentaires a afficher
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
|
WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
|
||||||
|
@ -62,17 +62,23 @@ int ii;
|
||||||
if( itemlist )
|
if( itemlist )
|
||||||
for( names = m_ItemList, ii = 0; *names != NULL; names++ )
|
for( names = m_ItemList, ii = 0; *names != NULL; names++ )
|
||||||
ii++;
|
ii++;
|
||||||
else ii = 30;
|
|
||||||
|
else
|
||||||
|
ii = 30;
|
||||||
|
|
||||||
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
SetSizer( GeneralBoxSizer );
|
SetSizer( GeneralBoxSizer );
|
||||||
|
|
||||||
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
GeneralBoxSizer->Add( MainBoxSizer, 0, wxGROW | wxEXPAND | wxALL, 1 );
|
GeneralBoxSizer->Add( MainBoxSizer, 0, wxGROW | wxEXPAND | wxALL, 1 );
|
||||||
|
|
||||||
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||||
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
size.x = 200;
|
size.x = 200;
|
||||||
|
@ -82,6 +88,7 @@ int ii;
|
||||||
wxDefaultPosition, size,
|
wxDefaultPosition, size,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL );
|
wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL );
|
||||||
|
|
||||||
if( colour != wxNullColour )
|
if( colour != wxNullColour )
|
||||||
{
|
{
|
||||||
m_List->SetBackgroundColour( colour );
|
m_List->SetBackgroundColour( colour );
|
||||||
|
@ -97,10 +104,12 @@ int ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxButton* butt = new wxButton( this, wxID_OK, _( "OK" ) );
|
wxButton* butt = new wxButton( this, wxID_OK, _( "OK" ) );
|
||||||
|
|
||||||
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
|
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
|
||||||
butt->SetDefault();
|
butt->SetDefault();
|
||||||
|
|
||||||
butt = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
butt = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
||||||
|
|
||||||
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
|
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
if( m_MoveFct )
|
if( m_MoveFct )
|
||||||
|
@ -108,6 +117,7 @@ int ii;
|
||||||
size.x = -1; size.y = 60;
|
size.x = -1; size.y = 60;
|
||||||
m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, size,
|
m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition, size,
|
||||||
wxTE_READONLY | wxTE_MULTILINE );
|
wxTE_READONLY | wxTE_MULTILINE );
|
||||||
|
|
||||||
GeneralBoxSizer->Add( m_WinMsg, 0, wxGROW | wxALL, 5 );
|
GeneralBoxSizer->Add( m_WinMsg, 0, wxGROW | wxALL, 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +132,10 @@ int ii;
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
m_Parent->GetPosition( &pos.x, &pos.y );
|
m_Parent->GetPosition( &pos.x, &pos.y );
|
||||||
if ( pos.x < 0 ) pos.x = 0;
|
if( pos.x < 0 )
|
||||||
if ( pos.y < 0 ) pos.y = 0;
|
pos.x = 0;
|
||||||
|
if( pos.y < 0 )
|
||||||
|
pos.y = 0;
|
||||||
pos.x += 20; pos.y += 30;
|
pos.x += 20; pos.y += 30;
|
||||||
Move( pos );
|
Move( pos );
|
||||||
}
|
}
|
||||||
|
@ -149,21 +161,25 @@ int orgy = m_List->GetRect().GetTop();
|
||||||
WarpPointer( x + orgx + 20, y + orgy + (list_size.y / 2) );
|
WarpPointer( x + orgx + 20, y + orgy + (list_size.y / 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
wxString WinEDAListBox::GetTextSelection()
|
wxString WinEDAListBox::GetTextSelection()
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
{
|
{
|
||||||
wxString text = m_List->GetStringSelection();
|
wxString text = m_List->GetStringSelection();
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void WinEDAListBox::WinEDAListBox::Append(const wxString & item)
|
void WinEDAListBox::Append( const wxString& item )
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
{
|
{
|
||||||
m_List->Append( item );
|
m_List->Append( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position )
|
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 );
|
m_List->InsertItems( itemlist, position );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
|
void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
@ -178,6 +195,7 @@ void WinEDAListBox::OnCancelClick(wxCommandEvent& event)
|
||||||
EndModal( -1 );
|
EndModal( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
void WinEDAListBox::ClickOnList( wxCommandEvent& event )
|
void WinEDAListBox::ClickOnList( wxCommandEvent& event )
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
|
@ -193,11 +211,13 @@ wxString text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
|
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
{
|
{
|
||||||
int ii = m_List->GetSelection();
|
int ii = m_List->GetSelection();
|
||||||
|
|
||||||
EndModal( ii );
|
EndModal( ii );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,9 +227,11 @@ void WinEDAListBox::OnOkClick(wxCommandEvent& event)
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
{
|
{
|
||||||
int ii = m_List->GetSelection();
|
int ii = m_List->GetSelection();
|
||||||
|
|
||||||
EndModal( ii );
|
EndModal( ii );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
void WinEDAListBox::OnClose( wxCloseEvent& event )
|
void WinEDAListBox::OnClose( wxCloseEvent& event )
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
@ -221,6 +243,7 @@ void WinEDAListBox::OnClose(wxCloseEvent& event)
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
|
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
/* Routines de comparaison pour le tri tri alphabetique,
|
/* Routines de comparaison pour le tri tri alphabetique,
|
||||||
* avec traitement des nombres en tant que valeur numerique
|
* avec traitement des nombres en tant que valeur numerique
|
||||||
*/
|
*/
|
||||||
|
@ -236,7 +259,8 @@ void WinEDAListBox:: SortList()
|
||||||
int ii, NbItems = m_List->GetCount();
|
int ii, NbItems = m_List->GetCount();
|
||||||
const wxString** BufList;
|
const wxString** BufList;
|
||||||
|
|
||||||
if( NbItems <= 0 ) return;
|
if( NbItems <= 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
|
BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
|
||||||
for( ii = 0; ii < NbItems; ii++ )
|
for( ii = 0; ii < NbItems; ii++ )
|
||||||
|
@ -264,4 +288,3 @@ void WinEDAListBox::OnKeyEvent(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue