Commit e9921a71 authored by dickelbeck's avatar dickelbeck

resizeable borders option

parent dac25cdb
...@@ -319,7 +319,7 @@ END_EVENT_TABLE() ...@@ -319,7 +319,7 @@ END_EVENT_TABLE()
/***************************************************************************/ /***************************************************************************/
WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) : WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) :
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxSize( 250, 350 ), wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxSize( 250, 350 ),
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT ) wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER )
/***************************************************************************/ /***************************************************************************/
{ {
wxSize size; wxSize size;
......
...@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo ...@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
#if 1 && defined(DEBUG) #if 0 && defined(DEBUG)
// note this seems to freeze up pcbnew when run under the kicad project // note this seems to freeze up pcbnew when run under the kicad project
// manager. runs fine from command prompt. // manager. runs fine from command prompt.
// output the board object tree to stdout: // output the board object tree to stdout:
......
/******************************************************/ /******************************************************/
/* Fonctions diverses (swap..) relatives au pistes */ /* Fonctions diverses (swap..) relatives au pistes */
/* et fonctions de test */ /* et fonctions de test */
/******************************************************/ /******************************************************/
/* Fichier PCBPISTE.CPP */ /* Fichier PCBPISTE.CPP */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
static int New_Layer[32]; static int New_Layer[32];
enum swap_layer_id { enum swap_layer_id {
ID_SWAP_LAYER_EXECUTE = 1800, ID_SWAP_LAYER_EXECUTE = 1800,
ID_SWAP_LAYER_CANCEL, ID_SWAP_LAYER_CANCEL,
ID_SWAP_LAYER_BUTTON_SELECT, ID_SWAP_LAYER_BUTTON_SELECT,
ID_SWAP_LAYER_DESELECT, ID_SWAP_LAYER_DESELECT,
ID_SWAP_LAYER_SELECT ID_SWAP_LAYER_SELECT
}; };
...@@ -29,256 +29,277 @@ enum swap_layer_id { ...@@ -29,256 +29,277 @@ enum swap_layer_id {
/* classe pour la frame de selection de layers */ /* classe pour la frame de selection de layers */
/***********************************************/ /***********************************************/
class WinEDA_SwapLayerFrame: public wxDialog class WinEDA_SwapLayerFrame : public wxDialog
{ {
private: private:
WinEDA_BasePcbFrame *m_Parent; WinEDA_BasePcbFrame* m_Parent;
wxRadioBox * m_LayerList; wxRadioBox* m_LayerList;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent); WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame * parent );
~WinEDA_SwapLayerFrame() {}; ~WinEDA_SwapLayerFrame() { };
private: private:
void Sel_Layer(wxCommandEvent& event); void Sel_Layer( wxCommandEvent& event );
void Cancel(wxCommandEvent& event); void Cancel( wxCommandEvent& event );
void Execute(wxCommandEvent& event); void Execute( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SwapLayerFrame */ /* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog) BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog )
EVT_BUTTON(ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute) EVT_BUTTON( ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute )
EVT_BUTTON(ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel) EVT_BUTTON( ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel )
EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON( ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON( ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_RADIOBOX( ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent): WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
wxDialog(parent, -1, _("Swap Layers:"),wxPoint(-1,-1), wxDialog( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ),
wxSize(470, 450), DIALOG_STYLE ) wxSize( 470, 450 ), DIALOG_STYLE )
{ {
#define START_Y 15 #define START_Y 15
wxButton * Button; wxButton* Button;
int ii; int ii;
wxPoint pos; wxPoint pos;
wxString g_Layer_Name_Pair[32]; wxString g_Layer_Name_Pair[32];
wxSize winsize; wxSize winsize;
m_Parent = parent;
SetFont(*g_DialogFont);
for ( ii = 0; ii < NB_LAYERS; ii++ )
{
g_Layer_Name_Pair[ii] = ReturnPcbLayerName(ii) + wxT(" -> ") + _("No Change");
}
pos.x = 5; pos.y = START_Y;
m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"),
pos, wxSize(-1,-1), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS);
winsize.y = m_LayerList->GetRect().GetBottom();
pos.x = m_LayerList->GetRect().GetRight() + 12;
Button = new wxButton(this,ID_SWAP_LAYER_CANCEL,
_("Cancel"), pos);
Button->SetForegroundColour(*wxRED);
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 5;
Button = new wxButton(this,ID_SWAP_LAYER_EXECUTE,
_("OK"), pos);
Button->SetForegroundColour(*wxBLUE);
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 15;
Button = new wxButton(this,ID_SWAP_LAYER_DESELECT,
_("Deselect"), pos);
Button->SetForegroundColour(wxColour(0,100,0));
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 5;
Button = new wxButton(this,ID_SWAP_LAYER_BUTTON_SELECT,
_("Select"), pos);
Button->SetForegroundColour(wxColour(0,100,100));
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
winsize.x += 10; winsize.y += 10;
SetClientSize(winsize);
m_Parent = parent;
SetFont( *g_DialogFont );
for( ii = 0; ii < NB_LAYERS; ii++ )
{
g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" );
}
pos.x = 5; pos.y = START_Y;
m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ),
pos, wxSize( -1,
-1 ), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS );
winsize.y = m_LayerList->GetRect().GetBottom();
pos.x = m_LayerList->GetRect().GetRight() + 12;
Button = new wxButton( this, ID_SWAP_LAYER_CANCEL,
_( "Cancel" ), pos );
Button->SetForegroundColour( *wxRED );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 5;
Button = new wxButton( this, ID_SWAP_LAYER_EXECUTE,
_( "OK" ), pos );
Button->SetForegroundColour( *wxBLUE );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 15;
Button = new wxButton( this, ID_SWAP_LAYER_DESELECT,
_( "Deselect" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 0 ) );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 5;
Button = new wxButton( this, ID_SWAP_LAYER_BUTTON_SELECT,
_( "Select" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 100 ) );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
winsize.x += 10; winsize.y += 10;
SetClientSize( winsize );
} }
/***************************************************************/ /***************************************************************/
void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event) void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
int ii, jj; int ii, jj;
ii = m_LayerList->GetSelection(); ii = m_LayerList->GetSelection();
switch ( event.GetId()) switch( event.GetId() )
{ {
case ID_SWAP_LAYER_DESELECT: case ID_SWAP_LAYER_DESELECT:
if ( New_Layer[ii] != -1 ) if( New_Layer[ii] != -1 )
{ {
New_Layer[ii] = -1; New_Layer[ii] = -1;
m_LayerList->SetString(ii, ReturnPcbLayerName(ii) + m_LayerList->SetString( ii, ReturnPcbLayerName( ii ) +
+ wxT(" -> ") + _("No Change") ); + wxT( " -> " ) + _( "No Change" ) );
} }
break; break;
case ID_SWAP_LAYER_BUTTON_SELECT: case ID_SWAP_LAYER_BUTTON_SELECT:
case ID_SWAP_LAYER_SELECT: case ID_SWAP_LAYER_SELECT:
jj = m_Parent->SelectLayer(ii, -1, -1); jj = m_Parent->SelectLayer( ii, -1, -1 );
if ( (jj < 0) || (jj >= 29) ) return; if( (jj < 0) || (jj >= 29) )
return;
if ( ii != jj )
{ if( ii != jj )
New_Layer[ii] = jj; {
m_LayerList->SetString(ii, New_Layer[ii] = jj;
ReturnPcbLayerName(ii) + wxT(" -> ") + ReturnPcbLayerName(jj) ); m_LayerList->SetString( ii,
} ReturnPcbLayerName( ii ) + wxT( " -> " ) +
break; ReturnPcbLayerName( jj ) );
} }
break;
}
} }
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event) void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EndModal(-1); EndModal( -1 );
} }
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Execute(wxCommandEvent& event) void WinEDA_SwapLayerFrame::Execute( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EndModal(1); EndModal( 1 );
} }
/********************************************************/ /********************************************************/
void WinEDA_PcbFrame::Swap_Layers(wxCommandEvent & event) void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
/********************************************************/ /********************************************************/
/* Swap layers */ /* Swap layers */
{ {
int ii, jj ; int ii, jj;
TRACK * pt_segm ; TRACK* pt_segm;
DRAWSEGMENT * pt_drawsegm; DRAWSEGMENT* pt_drawsegm;
EDA_BaseStruct * PtStruct; EDA_BaseStruct* PtStruct;
/* Init default values */ /* Init default values */
for ( ii = 0 ; ii < 32 ; ii++ ) New_Layer[ii] = -1 ; for( ii = 0; ii < 32; ii++ )
New_Layer[ii] = -1;
WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this);
ii = frame->ShowModal(); frame->Destroy(); WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this );
if ( ii != 1 ) return; ii = frame->ShowModal(); frame->Destroy();
/* Modifications des pistes */ if( ii != 1 )
pt_segm = (TRACK*) m_Pcb->m_Track; return;
for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext )
{ /* Modifications des pistes */
m_CurrentScreen->SetModify(); pt_segm = (TRACK*) m_Pcb->m_Track;
if( pt_segm->Type() == TYPEVIA ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ {
SEGVIA * Via = (SEGVIA *) pt_segm; m_CurrentScreen->SetModify();
if ( Via->Shape() == VIA_NORMALE ) continue; if( pt_segm->Type() == TYPEVIA )
int top_layer, bottom_layer; {
Via->ReturnLayerPair(&top_layer, &bottom_layer); SEGVIA* Via = (SEGVIA*) pt_segm;
if( New_Layer[bottom_layer] >= 0) if( Via->Shape() == VIA_NORMALE )
bottom_layer = New_Layer[bottom_layer]; continue;
if( New_Layer[top_layer] >= 0) int top_layer, bottom_layer;
top_layer = New_Layer[top_layer]; Via->ReturnLayerPair( &top_layer, &bottom_layer );
Via->SetLayerPair(top_layer, bottom_layer); if( New_Layer[bottom_layer] >= 0 )
} bottom_layer = New_Layer[bottom_layer];
else if( New_Layer[top_layer] >= 0 )
{ top_layer = New_Layer[top_layer];
jj = pt_segm->m_Layer; Via->SetLayerPair( top_layer, bottom_layer );
if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj]; }
} else
} {
jj = pt_segm->m_Layer;
/* Modifications des zones */ if( New_Layer[jj] >= 0 )
pt_segm = (TRACK*) m_Pcb->m_Zone; pt_segm->m_Layer = New_Layer[jj];
for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext ) }
{ }
m_CurrentScreen->SetModify();
jj = pt_segm->m_Layer; /* Modifications des zones */
if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj]; pt_segm = (TRACK*) m_Pcb->m_Zone;
} for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{
/* Modifications des autres segments */ m_CurrentScreen->SetModify();
PtStruct = m_Pcb->m_Drawings; jj = pt_segm->m_Layer;
for ( ; PtStruct != NULL ; PtStruct = PtStruct->Pnext ) if( New_Layer[jj] >= 0 )
{ pt_segm->m_Layer = New_Layer[jj];
if( PtStruct->Type() == TYPEDRAWSEGMENT ) }
{
m_CurrentScreen->SetModify(); /* Modifications des autres segments */
pt_drawsegm = (DRAWSEGMENT *) PtStruct; PtStruct = m_Pcb->m_Drawings;
jj = pt_drawsegm->m_Layer; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
if( New_Layer[jj] >= 0) pt_drawsegm->m_Layer = New_Layer[jj]; {
} if( PtStruct->Type() == TYPEDRAWSEGMENT )
} {
DrawPanel->Refresh(TRUE); m_CurrentScreen->SetModify();
pt_drawsegm = (DRAWSEGMENT*) PtStruct;
jj = pt_drawsegm->m_Layer;
if( New_Layer[jj] >= 0 )
pt_drawsegm->m_Layer = New_Layer[jj];
}
}
DrawPanel->Refresh( TRUE );
} }
/*********************************************************/ /*********************************************************/
void WinEDA_PcbFrame::Liste_Equipot(wxCommandEvent & event) void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EQUIPOT * Equipot ; EQUIPOT* Equipot;
wxString msg; wxString msg;
WinEDA_TextFrame * List; WinEDA_TextFrame* List;
int ii, jj; int ii, jj;
msg = wxT("*"); msg = wxT( "*" );
Get_Message(_("Filter for net names:"),msg, this); Get_Message( _( "Filter for net names:" ), msg, this );
if ( msg.IsEmpty() ) return; if( msg.IsEmpty() )
return;
List = new WinEDA_TextFrame(this, _("List Nets") );
List = new WinEDA_TextFrame( this, _( "List Nets" ) );
Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
for ( ; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext ) Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
{ for( ; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
wxString Line; {
/* calcul adr relative du nom de la pastille reference de la piste */ wxString Line;
if( ! WildCompareString(msg, Equipot->m_Netname, FALSE ) ) continue ; /* calcul adr relative du nom de la pastille reference de la piste */
if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
Line.Printf( wxT("net_code = %3.3d [%.16s] "),Equipot->m_NetCode, continue;
Equipot->m_Netname.GetData());
List->Append(Line); Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), Equipot->m_NetCode,
} Equipot->m_Netname.GetData() );
ii = List->ShowModal(); List->Destroy(); List->Append( Line );
if (ii < 0) return; }
/* Recherche du numero de net rellement selectionn */ ii = List->ShowModal(); List->Destroy();
Equipot = (EQUIPOT*) m_Pcb->m_Equipots; if( ii < 0 )
for ( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext ) return;
{
/* calcul adr relative du nom de la pastille reference de la piste */ /* Recherche du numero de net rellement selectionn */
if( ! WildCompareString(msg, Equipot->m_Netname, FALSE) ) continue ; Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
if ( ii == jj ) for( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
{ {
ii = Equipot->m_NetCode; /* calcul adr relative du nom de la pastille reference de la piste */
break; if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
} continue;
jj++; if( ii == jj )
} {
ii = Equipot->m_NetCode;
break;
wxClientDC dc(DrawPanel); }
DrawPanel->PrepareGraphicContext(&dc); jj++;
}
if(g_HightLigt_Status) Hight_Light(&dc);
g_HightLigth_NetCode = ii; wxClientDC dc( DrawPanel );
Hight_Light(&dc);
DrawPanel->PrepareGraphicContext( &dc );
if( g_HightLigt_Status )
Hight_Light( &dc );
g_HightLigth_NetCode = ii;
Hight_Light( &dc );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment