Enhance two dialog boxes for Pcbnew, and rename two unused files

This commit is contained in:
g_harland 2007-10-11 04:56:44 +00:00
parent 787cf5851e
commit 942116c49d
5 changed files with 116 additions and 101 deletions

View File

@ -4,6 +4,20 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
* The "Target Properties" dialog box can now (otherwise) be cancelled by pressing
the "Esc" key, and the caption of the "OK" button within the "Cotation
properties" dialog box has been capitalised (so that an icon is now provided
within that button within the Linux version of KiCad).
* The pcbpiste.cpp file (which is no longer used) has been removed, and replaced
with pcbpiste.cpp.notused
+ cvpcb
* The affiche.cpp file (which is no longer used) has been removed, and replaced
with affiche.cpp.notused
2007-Oct-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Oct-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ pcbnew + pcbnew

View File

@ -26,8 +26,7 @@ enum id_pad_global_edit
{ {
ID_CHANGE_CURRENT_MODULE = 1900, ID_CHANGE_CURRENT_MODULE = 1900,
ID_CHANGE_ID_MODULES, ID_CHANGE_ID_MODULES,
ID_CHANGE_GET_PAD_SETTINGS, ID_CHANGE_GET_PAD_SETTINGS
ID_CLOSE_PAD_GLOBAL_CHANGE
}; };
@ -54,13 +53,11 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_PadGlobalEditFrame(WinEDA_BasePcbFrame *parent, WinEDA_PadGlobalEditFrame(WinEDA_BasePcbFrame *parent,
D_PAD * Pad, wxDC * DC, const wxPoint & pos); D_PAD * Pad, wxDC * DC, const wxPoint & pos);
~WinEDA_PadGlobalEditFrame() ~WinEDA_PadGlobalEditFrame() { }
{
}
private: private:
void PadPropertiesAccept(wxCommandEvent& event); void PadPropertiesAccept(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event); void OnCancelClick(wxCommandEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -69,7 +66,7 @@ BEGIN_EVENT_TABLE(WinEDA_PadGlobalEditFrame, wxDialog)
EVT_BUTTON(ID_CHANGE_CURRENT_MODULE, WinEDA_PadGlobalEditFrame::PadPropertiesAccept) EVT_BUTTON(ID_CHANGE_CURRENT_MODULE, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
EVT_BUTTON(ID_CHANGE_ID_MODULES, WinEDA_PadGlobalEditFrame::PadPropertiesAccept) EVT_BUTTON(ID_CHANGE_ID_MODULES, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
EVT_BUTTON(ID_CHANGE_GET_PAD_SETTINGS, WinEDA_PadGlobalEditFrame::PadPropertiesAccept) EVT_BUTTON(ID_CHANGE_GET_PAD_SETTINGS, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
EVT_BUTTON(ID_CLOSE_PAD_GLOBAL_CHANGE, WinEDA_PadGlobalEditFrame::OnQuit) EVT_BUTTON(wxID_CANCEL, WinEDA_PadGlobalEditFrame::OnCancelClick)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -91,12 +88,13 @@ wxButton * Button;
CurrentPad = Pad; CurrentPad = Pad;
/* Creation des boutons de commande */ /* Creation des boutons de commande */
pos.x = 150; pos.y = 10; pos.x = 150;
pos.y = 10;
Button = new wxButton(this, ID_CHANGE_GET_PAD_SETTINGS, Button = new wxButton(this, ID_CHANGE_GET_PAD_SETTINGS,
_("Pad Settings"), pos); _("Pad Settings..."), pos);
Button->SetForegroundColour( wxColor(0, 80, 0) ); Button->SetForegroundColour( wxColor(0, 80, 0) );
pos.y += Button->GetDefaultSize().y + 10; pos.y += Button->GetDefaultSize().y + 50;
Button = new wxButton(this, ID_CHANGE_CURRENT_MODULE, Button = new wxButton(this, ID_CHANGE_CURRENT_MODULE,
_("Change Module"), pos); _("Change Module"), pos);
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
@ -107,15 +105,16 @@ wxButton * Button;
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
pos.y += Button->GetDefaultSize().y + 10; pos.y += Button->GetDefaultSize().y + 10;
Button = new wxButton(this, ID_CLOSE_PAD_GLOBAL_CHANGE, Button = new wxButton(this, wxID_CANCEL, _("Cancel"), pos);
_("Cancel"), pos);
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
pos.x = 5; pos.y = 5;
// Selection des filtres de selection des pads : // Selection des filtres de selection des pads :
pos.x = 5;
pos.y = 5;
new wxStaticBox(this, -1, _("Pad Filter :"), pos, wxSize(130, 75) ); new wxStaticBox(this, -1, _("Pad Filter :"), pos, wxSize(130, 75) );
pos.x += 5; pos.y += 18;
pos.x += 5;
pos.y += 18;
m_Pad_Shape_Filter = new wxCheckBox(this, -1, _("Shape Filter"), pos); m_Pad_Shape_Filter = new wxCheckBox(this, -1, _("Shape Filter"), pos);
m_Pad_Shape_Filter->SetValue(Pad_Shape_Filter); m_Pad_Shape_Filter->SetValue(Pad_Shape_Filter);
@ -128,9 +127,12 @@ wxButton * Button;
m_Pad_Orient_Filter->SetValue(Pad_Orient_Filter); m_Pad_Orient_Filter->SetValue(Pad_Orient_Filter);
// Items a editer // Items a editer
pos.x -= 5; pos.y += 25; pos.x -= 5;
pos.y += 25;
new wxStaticBox(this, -1, _("Change Items :"), pos, wxSize(130, 95) ); new wxStaticBox(this, -1, _("Change Items :"), pos, wxSize(130, 95) );
pos.x += 5; pos.y += 18;
pos.x += 5;
pos.y += 18;
m_Pad_Size_Change = new wxCheckBox(this, -1, _("Change Size"), pos); m_Pad_Size_Change = new wxCheckBox(this, -1, _("Change Size"), pos);
m_Pad_Size_Change->SetValue(Pad_Size_Change); m_Pad_Size_Change->SetValue(Pad_Size_Change);
@ -145,37 +147,35 @@ wxButton * Button;
pos.y += 18; pos.y += 18;
m_Pad_Orient_Change = new wxCheckBox(this, -1, _("Change Orient"), pos); m_Pad_Orient_Change = new wxCheckBox(this, -1, _("Change Orient"), pos);
m_Pad_Orient_Change->SetValue(Pad_Orient_Change); m_Pad_Orient_Change->SetValue(Pad_Orient_Change);
} }
/**********************************************************************/ /**********************************************************************/
void WinEDA_PadGlobalEditFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void WinEDA_PadGlobalEditFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/**********************************************************************/ /**********************************************************************/
{ {
Close(true); // true is to force the frame to close EndModal( -1 );
} }
/*************************************************************************/ /*************************************************************************/
void WinEDA_PadGlobalEditFrame::PadPropertiesAccept(wxCommandEvent& event) void WinEDA_PadGlobalEditFrame::PadPropertiesAccept(wxCommandEvent& event)
/*************************************************************************/ /*************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'édition /* Met a jour les differents parametres pour le composant en cours d'édition
*/ */
{ {
int returncode = 1; int returncode = 0;
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_CLOSE_PAD_GLOBAL_CHANGE:
EndModal(0);
case ID_CHANGE_GET_PAD_SETTINGS: case ID_CHANGE_GET_PAD_SETTINGS:
m_Parent->InstallPadOptionsFrame( NULL, NULL, wxPoint(-1, -1) ); m_Parent->InstallPadOptionsFrame( NULL, NULL, wxPoint(-1, -1) );
break; break;
case ID_CHANGE_ID_MODULES: case ID_CHANGE_ID_MODULES:
returncode = -1; returncode = 1;
// Fall through
case ID_CHANGE_CURRENT_MODULE: case ID_CHANGE_CURRENT_MODULE:
Pad_Shape_Filter = m_Pad_Shape_Filter->GetValue(); Pad_Shape_Filter = m_Pad_Shape_Filter->GetValue();
Pad_Layer_Filter = m_Pad_Layer_Filter->GetValue(); Pad_Layer_Filter = m_Pad_Layer_Filter->GetValue();
@ -186,21 +186,19 @@ int returncode = 1;
Pad_Orient_Change = m_Pad_Orient_Change->GetValue(); Pad_Orient_Change = m_Pad_Orient_Change->GetValue();
EndModal( returncode ); EndModal( returncode );
break; break;
} }
} }
/***************************************************************************/ /***************************************************************************/
void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD * Pad, wxDC * DC) void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD * Pad, wxDC * DC)
/***************************************************************************/ /***************************************************************************/
/* /*
Routine de selection et de correction des dimensions des pastilles * Routine de selection et de correction des dimensions des pastilles
de tous les modules * de tous les modules
- semblables a l'module de reference selectionnee, * - semblables a l'module de reference selectionnee,
c.a.d de meme nom de librairie * c.a.d de meme nom de librairie
- ou sur l'module localisee, selon le menu d'appel * - ou sur l'module localisee, selon le menu d'appel
*/ */
{ {
D_PAD* pt_pad ; D_PAD* pt_pad ;
@ -208,7 +206,8 @@ MODULE * Module_Ref , * Module;
int diag; int diag;
bool Edit_Same_Modules = FALSE; bool Edit_Same_Modules = FALSE;
if( Pad == NULL ) return ; if( Pad == NULL )
return;
Module = (MODULE *) Pad->m_Parent; Module = (MODULE *) Pad->m_Parent;
@ -224,10 +223,13 @@ wxString ref_name_module = Module->m_LibRef;
WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC, WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
wxPoint(-1,-1)); wxPoint(-1,-1));
diag = frame->ShowModal(); frame->Destroy(); diag = frame->ShowModal();
frame->Destroy();
if ( (diag != 1) && (diag != -1) ) return; if( diag == -1 )
if ( diag == -1 ) Edit_Same_Modules = TRUE; return;
if( diag == 1 )
Edit_Same_Modules = TRUE;
/* Recherche et copie du nom librairie de reference: */ /* Recherche et copie du nom librairie de reference: */
Module_Ref = Module; Module_Ref = Module;
@ -238,7 +240,8 @@ WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
{ {
if( ! Edit_Same_Modules ) if( ! Edit_Same_Modules )
if (Module != Module_Ref) continue; if( Module != Module_Ref )
continue;
if( ref_name_module != Module->m_LibRef ) if( ref_name_module != Module->m_LibRef )
continue ; continue ;
@ -254,7 +257,8 @@ WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
/* Filtrage des modifications interdites */ /* Filtrage des modifications interdites */
if( Pad_Shape_Filter ) if( Pad_Shape_Filter )
{ {
if (pt_pad->m_PadShape != g_Pad_Master.m_PadShape) continue; if( pt_pad->m_PadShape != g_Pad_Master.m_PadShape )
continue;
} }
if( Pad_Orient_Filter ) if( Pad_Orient_Filter )
@ -265,8 +269,10 @@ WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
if( Pad_Layer_Filter ) if( Pad_Layer_Filter )
{ {
if (pt_pad->m_Masque_Layer != g_Pad_Master.m_Masque_Layer) continue; if( pt_pad->m_Masque_Layer != g_Pad_Master.m_Masque_Layer )
else m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); continue;
else
m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK);
} }
/* Modif des caracteristiques: */ /* Modif des caracteristiques: */
@ -295,6 +301,7 @@ WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
{ {
pt_pad->m_Orient = g_Pad_Master.m_Orient + Module->m_Orient; pt_pad->m_Orient = g_Pad_Master.m_Orient + Module->m_Orient;
} }
/* Traitement des cas particuliers : */ /* Traitement des cas particuliers : */
if( g_Pad_Master.m_PadShape != TRAPEZE ) if( g_Pad_Master.m_PadShape != TRAPEZE )
{ {
@ -311,17 +318,15 @@ WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
pt_pad->m_Drill = wxSize(0, 0); pt_pad->m_Drill = wxSize(0, 0);
pt_pad->m_Offset.x = 0; pt_pad->m_Offset.x = 0;
pt_pad->m_Offset.y = 0; pt_pad->m_Offset.y = 0;
} break;
default:
break;
}
pt_pad->ComputeRayon(); pt_pad->ComputeRayon();
} }
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->Draw(DrawPanel, DC, wxPoint(0, 0), GR_OR); Module->Draw(DrawPanel, DC, wxPoint(0, 0), GR_OR);
} }
GetScreen()->SetModify(); GetScreen()->SetModify();
} }

View File

@ -20,9 +20,7 @@ static wxPoint OldPos;
static int MireDefaultSize = 5000; static int MireDefaultSize = 5000;
enum id_mire_properties { enum id_mire_properties {
ID_ACCEPT_MIRE_PROPERTIES = 1900, ID_SIZE_MIRE = 1900, // (Not currently used anywhere else)
ID_CANCEL_MIRE_PROPERTIES,
ID_SIZE_MIRE,
ID_LISTBOX_SHAPE_MIRE ID_LISTBOX_SHAPE_MIRE
}; };
@ -46,21 +44,18 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
MIREPCB* Mire, wxDC* DC, const wxPoint& pos ); MIREPCB* Mire, wxDC* DC, const wxPoint& pos );
~WinEDA_MirePropertiesFrame() ~WinEDA_MirePropertiesFrame() { }
{
}
private: private:
void MirePropertiesAccept( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog )
EVT_BUTTON( ID_ACCEPT_MIRE_PROPERTIES, WinEDA_MirePropertiesFrame::MirePropertiesAccept ) EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick )
EVT_BUTTON( ID_CANCEL_MIRE_PROPERTIES, WinEDA_MirePropertiesFrame::OnQuit ) EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -72,7 +67,8 @@ void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb,
WinEDA_MirePropertiesFrame* frame = new WinEDA_MirePropertiesFrame( this, WinEDA_MirePropertiesFrame* frame = new WinEDA_MirePropertiesFrame( this,
MirePcb, DC, pos ); MirePcb, DC, pos );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
} }
@ -100,11 +96,11 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */ /* Creation des boutons de commande */
Button = new wxButton( this, ID_ACCEPT_MIRE_PROPERTIES, _( "Ok" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, ID_CANCEL_MIRE_PROPERTIES, _( "Cancel" ) ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
@ -133,15 +129,15 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
/**********************************************************************/ /**********************************************************************/
void WinEDA_MirePropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/ /**********************************************************************/
{ {
Close( true ); // true is to force the frame to close EndModal( -1 );
} }
/**************************************************************************/ /**************************************************************************/
void WinEDA_MirePropertiesFrame::MirePropertiesAccept( wxCommandEvent& event ) void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
/**************************************************************************/ /**************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'édition /* Met a jour les differents parametres pour le composant en cours d'édition
@ -156,7 +152,7 @@ void WinEDA_MirePropertiesFrame::MirePropertiesAccept( wxCommandEvent& event )
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR ); m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_OR );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
Close( TRUE ); EndModal( 1 );
} }