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 );
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
static int OldTimeStamp, NewTimeStamp;
|
||||
|
||||
NewTimeStamp = time( NULL );
|
||||
|
||||
if( NewTimeStamp <= OldTimeStamp )
|
||||
NewTimeStamp = OldTimeStamp + 1;
|
||||
|
||||
OldTimeStamp = NewTimeStamp;
|
||||
|
||||
return NewTimeStamp;
|
||||
}
|
||||
|
||||
|
|
|
@ -395,12 +395,10 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
|||
int ii, jj;
|
||||
D_CODE* pt_D_code;
|
||||
wxString Line;
|
||||
WinEDA_TextFrame* List;
|
||||
wxArrayString list;
|
||||
int scale = 10000;
|
||||
int curr_layer = getActiveLayer();
|
||||
|
||||
List = new WinEDA_TextFrame( this, _( "List D codes" ) );
|
||||
|
||||
for( int layer = 0; layer < 32; layer++ )
|
||||
{
|
||||
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
||||
|
@ -416,7 +414,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
|||
else
|
||||
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
|
||||
|
||||
List->Append( Line );
|
||||
list.Add( Line );
|
||||
|
||||
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 )
|
||||
Line += wxT( " *" );
|
||||
|
||||
List->Append( Line );
|
||||
list.Add( Line );
|
||||
jj++;
|
||||
}
|
||||
}
|
||||
|
||||
ii = List->ShowModal();
|
||||
List->Destroy();
|
||||
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, NULL,
|
||||
wxCHOICEDLG_STYLE & ~wxCANCEL );
|
||||
|
||||
if( ii < 0 )
|
||||
return;
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -95,27 +95,6 @@ enum UserUnitType {
|
|||
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 Ki_PageDescr
|
||||
|
@ -131,8 +110,7 @@ public:
|
|||
int m_BottomMargin;
|
||||
|
||||
public:
|
||||
Ki_PageDescr( const wxSize& size, const wxPoint& offset,
|
||||
const wxString& name );
|
||||
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -689,47 +689,44 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
|||
#define MAX_LEN_TXT 32
|
||||
{
|
||||
int ii;
|
||||
MODULE* Module, * pt_aux;
|
||||
int NbModulesNetListe, nberr = 0;
|
||||
WinEDA_TextFrame* List;
|
||||
wxArrayString ModuleListFromNetlist;
|
||||
MODULE* Module, * pt_aux;
|
||||
int NbModulesNetListe, nberr = 0;
|
||||
wxArrayString tmp;
|
||||
wxArrayString list;
|
||||
|
||||
if( aPcb->m_Modules == NULL )
|
||||
{
|
||||
DisplayInfoMessage( aFrame, _( "No modules" ), 10 );
|
||||
DisplayInfoMessage( aFrame, _( "No modules" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build the list of references of the net list modules. */
|
||||
|
||||
NbModulesNetListe =
|
||||
BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
|
||||
ModuleListFromNetlist );
|
||||
NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename, tmp );
|
||||
|
||||
if( NbModulesNetListe < 0 )
|
||||
return; /* File not found */
|
||||
|
||||
if( NbModulesNetListe == 0 )
|
||||
{
|
||||
DisplayError( aFrame, _( "No modules in NetList" ), 10 );
|
||||
DisplayError( aFrame, _( "No modules in NetList" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
List = new WinEDA_TextFrame( aFrame, _( "Check Modules" ) );
|
||||
|
||||
/* Search for duplicate footprints. */
|
||||
List->Append( _( "Duplicates" ) );
|
||||
list.Add( _( "Duplicates" ) );
|
||||
|
||||
Module = aPcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
pt_aux = Module->Next();
|
||||
|
||||
for( ; pt_aux != NULL; pt_aux = pt_aux->Next() )
|
||||
{
|
||||
if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->
|
||||
m_Text ) == 0 )
|
||||
if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference-> m_Text ) == 0 )
|
||||
{
|
||||
List->Append( Module->m_Reference->m_Text );
|
||||
list.Add( Module->m_Reference->m_Text );
|
||||
nberr++;
|
||||
break;
|
||||
}
|
||||
|
@ -737,15 +734,15 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
|||
}
|
||||
|
||||
/* Search for the missing module by the net list. */
|
||||
List->Append( _( "Lack:" ) );
|
||||
list.Add( _( "Missing:" ) );
|
||||
|
||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||
{
|
||||
Module = (MODULE*) aPcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
if( Module->m_Reference->m_Text.CmpNoCase(
|
||||
ModuleListFromNetlist[ii] ) == 0 )
|
||||
if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -753,21 +750,21 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
|||
|
||||
if( Module == NULL ) // Module missing, not found in board
|
||||
{
|
||||
List->Append( ModuleListFromNetlist[ii] );
|
||||
list.Add( tmp[ii] );
|
||||
nberr++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Search for modules not in net list. */
|
||||
List->Append( _( "Not in Netlist:" ) );
|
||||
list.Add( _( "Not in Netlist:" ) );
|
||||
|
||||
Module = (MODULE*) aPcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||
{
|
||||
if( Module->m_Reference->m_Text.CmpNoCase(
|
||||
ModuleListFromNetlist[ii] ) == 0 )
|
||||
if( Module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
||||
{
|
||||
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 */
|
||||
{
|
||||
List->Append( Module->m_Reference->m_Text );
|
||||
list.Add( Module->m_Reference->m_Text );
|
||||
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;
|
||||
wxString netFilter;
|
||||
int selection;
|
||||
wxArrayString list;
|
||||
|
||||
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 )
|
||||
return; // cancelled by user
|
||||
|
||||
netFilter = dlg.GetValue( );
|
||||
|
||||
if( netFilter.IsEmpty() )
|
||||
return;
|
||||
|
||||
WinEDA_TextFrame List( this, _( "List Nets" ) );
|
||||
|
||||
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
||||
{
|
||||
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
||||
wxString Line;
|
||||
|
||||
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
||||
continue;
|
||||
|
||||
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
|
||||
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;
|
||||
|
||||
bool found = false;
|
||||
unsigned netcode = (unsigned) selection;
|
||||
unsigned netcode = (unsigned) choiceDlg.GetSelection();
|
||||
|
||||
// Search for the net selected.
|
||||
for( unsigned ii = 0; ii < GetBoard()->m_NetInfo->GetCount(); ii++ )
|
||||
{
|
||||
net = GetBoard()->m_NetInfo->GetNetItem( ii );
|
||||
|
||||
if( !WildCompareString( netFilter, net->GetNetname(), false ) )
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue