Update "Swap Layers:" and "Layer selection" dialog boxes again

This commit is contained in:
g_harland 2007-11-05 06:14:55 +00:00
parent 82d17cc236
commit 67feced1bf
4 changed files with 412 additions and 361 deletions

View File

@ -4,6 +4,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Nov-05 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ eeschema
* The previously provided "Close" button within the "Netlist" dialog box has
now been replaced with a "Cancel" button, and this dialog can now (otherwise)
be cancelled by pressing the "Esc" key. General cleanup and beautification of
eeschema/netlist_control.cpp.
+ pcbnew
* The color of each text string provided within the "Swap Layers:" dialog box is
now set to blue for each string specifying that the associated layer is *not*
being swapped with any other layer, or to fushia for each string specifying that
the associated layer *is* being swapped with another layer. (This change was
made after being suggested by Dick Hollenbeck.)
+ gerbview
* The color of each text string provided within the "Layer selection" dialog box
is similarly now set to blue for each string specifying that the associated
Gerber layer is *not* being exported to any pcbnew layer, or to fushia for each
string specifying that the associated Gerber layer *is* being exported to a
pcbnew layer.
2007-Nov-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================

View File

@ -1,5 +1,5 @@
/**********************************/
/* Dilaog box for netlist outputs */
/* Dialog box for netlist outputs */
/**********************************/
#include "fctsys.h"
@ -25,7 +25,6 @@
enum id_netlist {
ID_CREATE_NETLIST = 1550,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CLOSE_NETLIST,
ID_RUN_SIMULATOR,
ID_SETUP_PLUGIN,
ID_NETLIST_NOTEBOOK
@ -39,6 +38,7 @@ enum panel_netlist_index {
PANELCUSTOMBASE // Start auxiliary panels (custom netlists)
};
/* wxPanels for creating the NoteBook pages for each netlist format:
*/
class EDA_NoteBookPage: public wxPanel
@ -65,7 +65,7 @@ EDA_NoteBookPage::EDA_NoteBookPage(wxNotebook* parent, const wxString & title,
wxPanel(parent, -1 )
/*****************************************************************************/
/* Contructor to create a setup page for one netlist format.
Used in Netlist format Dialog box creation
* Used in Netlist format Dialog box creation
*/
{
SetFont(*g_DialogFont);
@ -94,39 +94,31 @@ EDA_NoteBookPage::EDA_NoteBookPage(wxNotebook* parent, const wxString & title,
wxStaticText * text = new wxStaticText(this, -1, _("Options:"));
m_LeftBoxSizer->Add(text, 0, wxGROW|wxALL, 5);
m_IsCurrentFormat = new wxCheckBox(this, idCheckBox,
_("Default format"));
m_IsCurrentFormat = new wxCheckBox(this, idCheckBox, _("Default format"));
m_LeftBoxSizer->Add(m_IsCurrentFormat, 0, wxGROW|wxALL, 5);
if( g_NetFormat == m_IdNetType )
m_IsCurrentFormat->SetValue(TRUE);
}
if ( idCreateFile ) // Create the 2 standard buttons: Create File ans Cancel
if( idCreateFile ) // Create the 2 standard buttons: Create File and Cancel
{
wxButton * Button;
if( idCreateFile == ID_SETUP_PLUGIN )
{
Button = new wxButton(this, idCreateFile,
_("&Browse Plugin"));
}
Button = new wxButton(this, idCreateFile, _("&Browse Plugin"));
else
{
Button = new wxButton(this, idCreateFile,
_("&Netlist"));
}
Button = new wxButton(this, idCreateFile, _("&Netlist"));
Button->SetForegroundColour(*wxRED);
m_RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
m_ButtonCancel =
Button = new wxButton(this, ID_CLOSE_NETLIST,
_("&Close"));
Button = new wxButton(this, wxID_CANCEL, _("&Cancel"));
Button->SetForegroundColour(*wxBLUE);
m_RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
}
}
#define CUSTOMPANEL_COUNTMAX 8
/* Dialog frame for creating netlists */
class WinEDA_NetlistFrame: public wxDialog
@ -149,13 +141,13 @@ private:
void GenNetlist(wxCommandEvent& event);
void RunSimulator(wxCommandEvent& event);
void NetlistUpdateOpt();
void NetlistExit(wxCommandEvent& event);
void OnCancelClick(wxCommandEvent& event);
void SelectNetlistType(wxCommandEvent& event);
void SetupPlugin(wxCommandEvent& event);
DECLARE_EVENT_TABLE()};
BEGIN_EVENT_TABLE(WinEDA_NetlistFrame, wxDialog)
EVT_BUTTON(ID_CLOSE_NETLIST, WinEDA_NetlistFrame::NetlistExit)
EVT_BUTTON(wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick)
EVT_BUTTON(ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist)
EVT_BUTTON(ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPlugin)
EVT_CHECKBOX(ID_CURRENT_FORMAT_IS_DEFAULT, WinEDA_NetlistFrame::SelectNetlistType)
@ -170,12 +162,14 @@ void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint & pos)
*/
{
WinEDA_NetlistFrame * frame = new WinEDA_NetlistFrame(parent, pos);
frame->ShowModal(); frame->Destroy();
frame->ShowModal();
frame->Destroy();
}
#define H_SIZE 370
#define V_SIZE 300
/*************************************************************************************/
WinEDA_NetlistFrame::WinEDA_NetlistFrame(WinEDA_SchematicFrame *parent, wxPoint& framepos):
wxDialog(parent, -1, _("Netlist"), framepos, wxSize(H_SIZE, V_SIZE), DIALOG_STYLE | MAYBE_RESIZE_BORDER)
@ -195,7 +189,8 @@ int ii;
m_PanelNetType[ii] = NULL;
}
if ( (framepos.x == -1) && (framepos.x == -1) ) Centre();
if( (framepos.x == -1) && (framepos.y == -1) )
Centre();
wxBoxSizer * GeneralBoxSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(GeneralBoxSizer);
@ -230,7 +225,6 @@ int ii;
m_PanelNetType[PANELPCBNEW]->GetSizer()->Fit(this);
m_PanelNetType[PANELPCBNEW]->GetSizer()->SetSizeHints(this);
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
}
@ -247,8 +241,7 @@ EDA_NoteBookPage * page;
page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage(m_NoteBook, wxT("Spice"), NET_TYPE_SPICE, 0, 0);
page->m_IsCurrentFormat = new wxCheckBox(page,ID_CURRENT_FORMAT_IS_DEFAULT,
_("Default format"));
page->m_IsCurrentFormat = new wxCheckBox(page, ID_CURRENT_FORMAT_IS_DEFAULT, _("Default format"));
page->m_IsCurrentFormat->SetValue( g_NetFormat == NET_TYPE_SPICE );
page->m_LeftBoxSizer->Add(page->m_IsCurrentFormat, 0, wxGROW|wxALL, 5);
@ -256,7 +249,8 @@ wxString netlist_opt[2] = { _("Use Net Names"), _("Use Net Numbers") };
m_UseNetNamesInNetlist = new wxRadioBox(page, -1, _("Netlist Options:"),
wxDefaultPosition, wxDefaultSize,
2, netlist_opt, 1, wxRA_SPECIFY_COLS);
if ( ! g_OptNetListUseNames ) m_UseNetNamesInNetlist->SetSelection(1);
if( ! g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection(1);
page->m_LeftBoxSizer->Add(m_UseNetNamesInNetlist, 0, wxGROW|wxALL, 5);
page->m_CommandStringCtrl = new WinEDA_EnterText( page,
@ -271,11 +265,12 @@ wxString netlist_opt[2] = { _("Use Net Names"), _("Use Net Numbers") };
Button->SetForegroundColour( wxColour(0, 100, 0) );
page->m_RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(page, ID_CLOSE_NETLIST, _("&Close"));
Button = new wxButton(page, wxID_CANCEL, _("&Cancel"));
Button->SetForegroundColour(*wxBLUE);
page->m_RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
}
/*************************************************/
void WinEDA_NetlistFrame::InstallCustomPages()
/*************************************************/
@ -290,11 +285,13 @@ EDA_NoteBookPage * CurrPage;
previoustitle = wxT("dummy_title");
for( ii = 0; ii < CustomCount; ii++ )
{
msg = CUSTOM_NETLIST_TITLE; msg << ii+1;
msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1;
title = m_Parent->m_Parent->m_EDA_Config->Read(msg);
// Install the panel only if it is the first panel not initialised
if ( (title.IsEmpty()) && ( previoustitle.IsEmpty() ) ) break;
if( title.IsEmpty() && previoustitle.IsEmpty() )
break;
previoustitle = title;
if( title.IsEmpty() )
@ -308,7 +305,8 @@ EDA_NoteBookPage * CurrPage;
NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CREATE_NETLIST);
msg = CUSTOM_NETLIST_COMMAND; msg << ii+1;
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
wxString Command = m_Parent->m_Parent->m_EDA_Config->Read(msg);
CurrPage->m_CommandStringCtrl = new WinEDA_EnterText( CurrPage,
_("Netlist command:"), Command,
@ -339,15 +337,17 @@ wxString FullFileName, Mask, Path;
wxFD_OPEN,
TRUE
);
if ( FullFileName.IsEmpty() ) return;
if( FullFileName.IsEmpty() )
return;
EDA_NoteBookPage * CurrPage;
CurrPage = (EDA_NoteBookPage *) m_NoteBook->GetCurrentPage();
if ( CurrPage == NULL ) return;
if( CurrPage == NULL )
return;
CurrPage->m_CommandStringCtrl->SetValue(FullFileName);
/* Get a title for thgis page */
/* Get a title for this page */
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() )
DisplayInfo(this, _("Now, you must choose a title for this netlist control page\nand close the dialog box"));
@ -367,13 +367,14 @@ EDA_NoteBookPage * CurrPage;
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue(FALSE);
CurrPage = (EDA_NoteBookPage *) m_NoteBook->GetCurrentPage();
if ( CurrPage == NULL ) return;
if( CurrPage == NULL )
return;
g_NetFormat = CurrPage->m_IdNetType;
CurrPage->m_IsCurrentFormat->SetValue(TRUE);
}
/***********************************************/
void WinEDA_NetlistFrame::NetlistUpdateOpt()
/***********************************************/
@ -386,7 +387,8 @@ int ii;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
{
if ( m_PanelNetType[ii] == NULL ) break;
if( m_PanelNetType[ii] == NULL )
break;
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == TRUE )
g_NetFormat = m_PanelNetType[ii]->m_IdNetType;
}
@ -396,11 +398,13 @@ int ii;
g_OptNetListUseNames = FALSE;
}
/**********************************************************/
void WinEDA_NetlistFrame::GenNetlist(wxCommandEvent& event)
/**********************************************************/
{
wxString FullFileName, FileExt, Mask;
wxString msg, Command;
int netformat_tmp = g_NetFormat;
NetlistUpdateOpt();
@ -418,9 +422,11 @@ EDA_NoteBookPage * CurrPage;
case NET_TYPE_SPICE:
FileExt = wxT(".cir");
break;
case NET_TYPE_CADSTAR:
FileExt = wxT(".frp");
break;
default:
FileExt = g_NetExtBuffer;
break;
@ -438,7 +444,8 @@ EDA_NoteBookPage * CurrPage;
wxFD_SAVE,
TRUE
);
if ( FullFileName.IsEmpty() ) return;
if( FullFileName.IsEmpty() )
return;
m_Parent->MsgPanel->EraseMsgBox();
@ -455,8 +462,8 @@ EDA_NoteBookPage * CurrPage;
{
bool ModifyWires;
ModifyWires = screen->SchematicCleanUp(NULL);
/* if wire list has changed, delete the Undo Redo list to avoid
pointer problems with deleted data */
// if wire list has changed, delete the Undo Redo list to avoid
// pointer problems with deleted data
if( ModifyWires )
screen->ClearUndoRedoList();
}
@ -464,7 +471,8 @@ EDA_NoteBookPage * CurrPage;
m_Parent->BuildNetListBase();
if( CurrPage->m_CommandStringCtrl )
g_NetListerCommandLine = CurrPage->m_CommandStringCtrl->GetValue();
else g_NetListerCommandLine.Empty();
else
g_NetListerCommandLine.Empty();
switch( g_NetFormat )
{
@ -486,28 +494,22 @@ EDA_NoteBookPage * CurrPage;
FreeTabNetList( g_TabObjNet, g_NbrObjNet );
g_NetFormat = netformat_tmp;
NetlistExit(event);
}
/***********************************************************/
void WinEDA_NetlistFrame::NetlistExit(wxCommandEvent& event)
/***********************************************************/
{
wxString msg, Command;
NetlistUpdateOpt();
// Update the new titles
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
{
EDA_NoteBookPage * CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if ( CurrPage == NULL ) break;
msg = wxT("Custom"); msg << ii+1;
if( CurrPage == NULL )
break;
msg = wxT("Custom");
msg << ii + 1;
if( CurrPage->m_TitleStringCtrl )
{
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( msg != title ) // Title has changed, Update config
{
msg = CUSTOM_NETLIST_TITLE; msg << ii+1;
msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1;
m_Parent->m_Parent->m_EDA_Config->Write(msg, title);
}
}
@ -515,11 +517,20 @@ wxString msg, Command;
if( CurrPage->m_CommandStringCtrl )
{
Command = CurrPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND; msg << ii+1;
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
m_Parent->m_Parent->m_EDA_Config->Write(msg, Command);
}
}
Close();
EndModal( 0 );
}
/***********************************************************/
void WinEDA_NetlistFrame::OnCancelClick(wxCommandEvent& event)
/***********************************************************/
{
EndModal( -1 );
}
@ -545,4 +556,3 @@ wxString NetlistFullFileName, ExecFile, CommandLine;
ExecuteFile(this, ExecFile, CommandLine);
}

View File

@ -176,8 +176,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent) :
// pcbnew layer that the Gerber layer has been mapped to). Each of those items are
// placed into the left hand column, middle column, and right hand column
// (respectively) of the Flexgrid sizer, and the color of the second text string
// is set to blue (to indicate that the actual text changes depending upon which
// pcbnew layer has been selected by the child dialog box).
// is set to fushia or blue (to respectively indicate whether the Gerber layer has
// been mapped to a pcbnew layer or is not being exported at all).
// (Experimentation has shown that if a text control is used to depict which
// pcbnew layer that each Gerber layer is mapped to (instead of a static text
// string), then those controls do not behave in a fully satisfactory manner in
@ -224,7 +224,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent) :
// Provide another text string to specify which pcbnew layer that this
// Gerber layer is initially mapped to, and set the initial text to
// specify the appropriate pcbnew layer, and set the foreground color
// of the text to blue (to indicate that the text can be changed).
// of the text to fushia (to indicate that the layer is being exported).
item_ID = ID_TEXT_0 + ii;
// When the first of these text strings is being added, determine what size is necessary to
@ -252,7 +252,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent) :
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition, wxDefaultSize, 0 );
}
text->SetMinSize( goodSize );
text->SetForegroundColour( *wxBLUE );
text->SetForegroundColour( wxColour(255, 0, 128) );
FlexColumnBoxSizer->Add(text, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
layer_list[ii] = text;
@ -278,7 +278,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_GerberFrame *parent) :
// using that type of sizer results in those buttons being automatically
// located in positions appropriate for each (OS) version of KiCad.
StdDialogButtonSizer = new wxStdDialogButtonSizer;
OuterBoxSizer->Add(StdDialogButtonSizer, 0, wxALIGN_RIGHT|wxALL, 10);
OuterBoxSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
Button = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour( *wxRED );
@ -323,9 +323,19 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event)
{
LayerLookUpTable[ButtonTable[ii]] = jj;
if( jj == NB_LAYERS )
{
layer_list[ii]->SetLabel( _( "Do not export" ) );
// Change the text color to blue (to highlight
// that this layer is *not* being exported)
layer_list[ii]->SetForegroundColour( *wxBLUE );
}
else
{
layer_list[ii]->SetLabel( ReturnPcbLayerName( jj ) );
// Change the text color to fushia (to highlight
// that this layer *is* being exported)
layer_list[ii]->SetForegroundColour( wxColour(255, 0, 128) );
}
}
}

View File

@ -125,9 +125,9 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
// layer is mapped to), and a second static text string (to depict which layer
// that the layer has been mapped to). Each of those items are placed into
// the left hand column, middle column, and right hand column (respectively)
// of the Flexgrid sizer, and the color of the second text string is set to blue
// (to indicate that the actual text changes depending upon which layer has been
// selected by the child dialog box).
// of the Flexgrid sizer, and the color of the second text string is set to
// fushia or blue (to respectively indicate whether the layer has been
// swapped to another layer or is not being swapped at all).
// (Experimentation has shown that if a text control is used to depict which
// layer that each layer is mapped to (instead of a static text string), then
// those controls do not behave in a fully satisfactory manner in the Linux
@ -165,7 +165,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
// Provide another text string to specify which layer that this layer is
// mapped to, set the initial text to "No Change" (to indicate that this
// layer is currently unmapped to any other layer), and set the foreground
// color of the text to blue (to indicate that the text can be changed).
// color of the text to blue (which also indicates that the layer is
// currently unmapped to any other layer).
item_ID = ID_TEXT_0 + ii;
// When the first of these text strings is being added, determine what size is necessary to
@ -213,7 +214,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
// using that type of sizer results in those buttons being automatically
// located in positions appropriate for each (OS) version of KiCad.
StdDialogButtonSizer = new wxStdDialogButtonSizer;
OuterBoxSizer->Add(StdDialogButtonSizer, 0, wxALIGN_RIGHT|wxALL, 10);
OuterBoxSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
Button = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour( *wxRED );
@ -270,9 +271,19 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
{
New_Layer[ii] = jj;
if( jj == NB_LAYERS )
{
layer_list[ii]->SetLabel( _( "No Change" ) );
// Change the text color to blue (to highlight
// that this layer is *not* being swapped)
layer_list[ii]->SetForegroundColour( *wxBLUE );
}
else
{
layer_list[ii]->SetLabel( ReturnPcbLayerName( jj ) );
// Change the text color to fushia (to highlight
// that this layer *is* being swapped)
layer_list[ii]->SetForegroundColour( wxColour(255, 0, 128) );
}
}
}