Replace WinEDA_TextFrame with wxSingleChoiceDialog.
This commit is contained in:
parent
1bfe830689
commit
86b6feb95d
|
@ -606,74 +606,18 @@ void MyFree( void* pt_mem )
|
||||||
free( pt_mem );
|
free( pt_mem );
|
||||||
}
|
}
|
||||||
|
|
||||||
enum textbox {
|
|
||||||
ID_TEXTBOX_LIST = 8010
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA_TextFrame, wxDialog )
|
|
||||||
EVT_LISTBOX_DCLICK( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList )
|
|
||||||
EVT_LISTBOX( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList )
|
|
||||||
EVT_CLOSE( WinEDA_TextFrame::OnClose )
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent,
|
|
||||||
const wxString& title ) :
|
|
||||||
wxDialog( parent,
|
|
||||||
-1, title,
|
|
||||||
wxPoint( -1, -1 ),
|
|
||||||
wxSize( 250, 350 ),
|
|
||||||
wxDEFAULT_DIALOG_STYLE |
|
|
||||||
wxFRAME_FLOAT_ON_PARENT |
|
|
||||||
MAYBE_RESIZE_BORDER )
|
|
||||||
{
|
|
||||||
wxSize size;
|
|
||||||
|
|
||||||
m_Parent = parent;
|
|
||||||
|
|
||||||
CentreOnParent();
|
|
||||||
|
|
||||||
size = GetClientSize();
|
|
||||||
m_List = new wxListBox( this,
|
|
||||||
ID_TEXTBOX_LIST,
|
|
||||||
wxPoint( 0, 0 ),
|
|
||||||
size,
|
|
||||||
0, NULL,
|
|
||||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
|
||||||
|
|
||||||
SetReturnCode( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_TextFrame::Append( const wxString& text )
|
|
||||||
{
|
|
||||||
m_List->Append( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
int ii = m_List->GetSelection();
|
|
||||||
|
|
||||||
EndModal( ii );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
|
||||||
{
|
|
||||||
EndModal( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GetTimeStamp()
|
int GetTimeStamp()
|
||||||
{
|
{
|
||||||
static int OldTimeStamp, NewTimeStamp;
|
static int OldTimeStamp, NewTimeStamp;
|
||||||
|
|
||||||
NewTimeStamp = time( NULL );
|
NewTimeStamp = time( NULL );
|
||||||
|
|
||||||
if( NewTimeStamp <= OldTimeStamp )
|
if( NewTimeStamp <= OldTimeStamp )
|
||||||
NewTimeStamp = OldTimeStamp + 1;
|
NewTimeStamp = OldTimeStamp + 1;
|
||||||
|
|
||||||
OldTimeStamp = NewTimeStamp;
|
OldTimeStamp = NewTimeStamp;
|
||||||
|
|
||||||
return NewTimeStamp;
|
return NewTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,12 +395,10 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
D_CODE* pt_D_code;
|
D_CODE* pt_D_code;
|
||||||
wxString Line;
|
wxString Line;
|
||||||
WinEDA_TextFrame* List;
|
wxArrayString list;
|
||||||
int scale = 10000;
|
int scale = 10000;
|
||||||
int curr_layer = getActiveLayer();
|
int curr_layer = getActiveLayer();
|
||||||
|
|
||||||
List = new WinEDA_TextFrame( this, _( "List D codes" ) );
|
|
||||||
|
|
||||||
for( int layer = 0; layer < 32; layer++ )
|
for( int layer = 0; layer < 32; layer++ )
|
||||||
{
|
{
|
||||||
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
||||||
|
@ -416,7 +414,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
||||||
else
|
else
|
||||||
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
|
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
|
||||||
|
|
||||||
List->Append( Line );
|
list.Add( Line );
|
||||||
|
|
||||||
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
|
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -442,16 +440,15 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
||||||
if( !pt_D_code->m_InUse )
|
if( !pt_D_code->m_InUse )
|
||||||
Line += wxT( " *" );
|
Line += wxT( " *" );
|
||||||
|
|
||||||
List->Append( Line );
|
list.Add( Line );
|
||||||
jj++;
|
jj++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ii = List->ShowModal();
|
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, NULL,
|
||||||
List->Destroy();
|
wxCHOICEDLG_STYLE & ~wxCANCEL );
|
||||||
|
|
||||||
if( ii < 0 )
|
dlg.ShowModal();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,27 +95,6 @@ enum UserUnitType {
|
||||||
class LibNameList;
|
class LibNameList;
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
|
||||||
/* Class to display text */
|
|
||||||
/***********************************/
|
|
||||||
class WinEDA_TextFrame : public wxDialog
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
wxWindow* m_Parent;
|
|
||||||
wxListBox* m_List;
|
|
||||||
|
|
||||||
public:
|
|
||||||
WinEDA_TextFrame( wxWindow* parent, const wxString& title );
|
|
||||||
void Append( const wxString& text );
|
|
||||||
|
|
||||||
private:
|
|
||||||
void D_ClickOnList( wxCommandEvent& event );
|
|
||||||
void OnClose( wxCloseEvent& event );
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Class to handle pages sizes:
|
/* Class to handle pages sizes:
|
||||||
*/
|
*/
|
||||||
class Ki_PageDescr
|
class Ki_PageDescr
|
||||||
|
@ -131,8 +110,7 @@ public:
|
||||||
int m_BottomMargin;
|
int m_BottomMargin;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ki_PageDescr( const wxSize& size, const wxPoint& offset,
|
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
|
||||||
const wxString& name );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -691,45 +691,42 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
||||||
int ii;
|
int ii;
|
||||||
MODULE* Module, * pt_aux;
|
MODULE* Module, * pt_aux;
|
||||||
int NbModulesNetListe, nberr = 0;
|
int NbModulesNetListe, nberr = 0;
|
||||||
WinEDA_TextFrame* List;
|
wxArrayString tmp;
|
||||||
wxArrayString ModuleListFromNetlist;
|
wxArrayString list;
|
||||||
|
|
||||||
if( aPcb->m_Modules == NULL )
|
if( aPcb->m_Modules == NULL )
|
||||||
{
|
{
|
||||||
DisplayInfoMessage( aFrame, _( "No modules" ), 10 );
|
DisplayInfoMessage( aFrame, _( "No modules" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the list of references of the net list modules. */
|
/* Build the list of references of the net list modules. */
|
||||||
|
|
||||||
NbModulesNetListe =
|
NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename, tmp );
|
||||||
BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
|
|
||||||
ModuleListFromNetlist );
|
|
||||||
if( NbModulesNetListe < 0 )
|
if( NbModulesNetListe < 0 )
|
||||||
return; /* File not found */
|
return; /* File not found */
|
||||||
|
|
||||||
if( NbModulesNetListe == 0 )
|
if( NbModulesNetListe == 0 )
|
||||||
{
|
{
|
||||||
DisplayError( aFrame, _( "No modules in NetList" ), 10 );
|
DisplayError( aFrame, _( "No modules in NetList" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List = new WinEDA_TextFrame( aFrame, _( "Check Modules" ) );
|
|
||||||
|
|
||||||
/* Search for duplicate footprints. */
|
/* Search for duplicate footprints. */
|
||||||
List->Append( _( "Duplicates" ) );
|
list.Add( _( "Duplicates" ) );
|
||||||
|
|
||||||
Module = aPcb->m_Modules;
|
Module = aPcb->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
pt_aux = Module->Next();
|
pt_aux = Module->Next();
|
||||||
|
|
||||||
for( ; pt_aux != NULL; pt_aux = pt_aux->Next() )
|
for( ; pt_aux != NULL; pt_aux = pt_aux->Next() )
|
||||||
{
|
{
|
||||||
if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->
|
if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference-> m_Text ) == 0 )
|
||||||
m_Text ) == 0 )
|
|
||||||
{
|
{
|
||||||
List->Append( Module->m_Reference->m_Text );
|
list.Add( Module->m_Reference->m_Text );
|
||||||
nberr++;
|
nberr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -737,15 +734,15 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the missing module by the net list. */
|
/* Search for the missing module by the net list. */
|
||||||
List->Append( _( "Lack:" ) );
|
list.Add( _( "Missing:" ) );
|
||||||
|
|
||||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||||
{
|
{
|
||||||
Module = (MODULE*) aPcb->m_Modules;
|
Module = (MODULE*) aPcb->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
if( Module->m_Reference->m_Text.CmpNoCase(
|
if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
||||||
ModuleListFromNetlist[ii] ) == 0 )
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -753,21 +750,21 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
||||||
|
|
||||||
if( Module == NULL ) // Module missing, not found in board
|
if( Module == NULL ) // Module missing, not found in board
|
||||||
{
|
{
|
||||||
List->Append( ModuleListFromNetlist[ii] );
|
list.Add( tmp[ii] );
|
||||||
nberr++;
|
nberr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for modules not in net list. */
|
/* Search for modules not in net list. */
|
||||||
List->Append( _( "Not in Netlist:" ) );
|
list.Add( _( "Not in Netlist:" ) );
|
||||||
|
|
||||||
Module = (MODULE*) aPcb->m_Modules;
|
Module = (MODULE*) aPcb->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||||
{
|
{
|
||||||
if( Module->m_Reference->m_Text.CmpNoCase(
|
if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
||||||
ModuleListFromNetlist[ii] ) == 0 )
|
|
||||||
{
|
{
|
||||||
break; /* Module is in net list. */
|
break; /* Module is in net list. */
|
||||||
}
|
}
|
||||||
|
@ -775,12 +772,15 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
||||||
|
|
||||||
if( ii == NbModulesNetListe ) /* Module not found in netlist */
|
if( ii == NbModulesNetListe ) /* Module not found in netlist */
|
||||||
{
|
{
|
||||||
List->Append( Module->m_Reference->m_Text );
|
list.Add( Module->m_Reference->m_Text );
|
||||||
nberr++;
|
nberr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List->ShowModal(); List->Destroy();
|
wxSingleChoiceDialog dlg( aFrame, wxEmptyString, _( "Check Modules" ), list, NULL,
|
||||||
|
wxCHOICEDLG_STYLE & ~wxCANCEL );
|
||||||
|
|
||||||
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,43 +26,45 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net;
|
NETINFO_ITEM* net;
|
||||||
wxString netFilter;
|
wxString netFilter;
|
||||||
int selection;
|
wxArrayString list;
|
||||||
|
|
||||||
netFilter = wxT( "*" );
|
netFilter = wxT( "*" );
|
||||||
wxTextEntryDialog dlg( this, _( "Filter for net names:" ), _( "Net Filter" ), netFilter );
|
wxTextEntryDialog dlg( this, _( "Filter Net Names" ), _( "Net Filter" ), netFilter );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return; // cancelled by user
|
return; // cancelled by user
|
||||||
|
|
||||||
netFilter = dlg.GetValue( );
|
netFilter = dlg.GetValue( );
|
||||||
|
|
||||||
if( netFilter.IsEmpty() )
|
if( netFilter.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WinEDA_TextFrame List( this, _( "List Nets" ) );
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
|
||||||
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
|
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
|
||||||
GetChars( net->GetNetname() ) );
|
GetChars( net->GetNetname() ) );
|
||||||
List.Append( Line );
|
list.Add( Line );
|
||||||
}
|
}
|
||||||
|
|
||||||
selection = List.ShowModal();
|
wxSingleChoiceDialog choiceDlg( this, wxEmptyString, _( "Select Net" ), list, NULL );
|
||||||
|
|
||||||
if( selection < 0 )
|
if( (choiceDlg.ShowModal() == wxID_CANCEL) || (choiceDlg.GetSelection() == wxNOT_FOUND) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
unsigned netcode = (unsigned) selection;
|
unsigned netcode = (unsigned) choiceDlg.GetSelection();
|
||||||
|
|
||||||
// Search for the net selected.
|
// Search for the net selected.
|
||||||
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
||||||
|
|
||||||
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue