Commit e9921a71 authored by dickelbeck's avatar dickelbeck
Browse files

resizeable borders option

parent dac25cdb
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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;
+1 −1
Original line number Original line Diff line number Diff line
@@ -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:
+239 −218
Original line number Original line Diff line number Diff line
@@ -45,8 +45,8 @@ 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 )
@@ -76,39 +76,44 @@ wxSize winsize;
    {
    {
        g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" );
        g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" );
    }
    }

    pos.x = 5; pos.y = START_Y;
    pos.x = 5; pos.y = START_Y;
    m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ),
    m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ),
			pos, wxSize(-1,-1), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS);
                                  pos, wxSize( -1,
                                               -1 ), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS );


    winsize.y = m_LayerList->GetRect().GetBottom();
    winsize.y = m_LayerList->GetRect().GetBottom();


    pos.x  = m_LayerList->GetRect().GetRight() + 12;
    pos.x  = m_LayerList->GetRect().GetRight() + 12;
    Button = new wxButton( this, ID_SWAP_LAYER_CANCEL,
    Button = new wxButton( this, ID_SWAP_LAYER_CANCEL,
                           _( "Cancel" ), pos );
                           _( "Cancel" ), pos );

    Button->SetForegroundColour( *wxRED );
    Button->SetForegroundColour( *wxRED );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );


    pos.y += Button->GetSize().y + 5;
    pos.y += Button->GetSize().y + 5;
    Button = new wxButton( this, ID_SWAP_LAYER_EXECUTE,
    Button = new wxButton( this, ID_SWAP_LAYER_EXECUTE,
                           _( "OK" ), pos );
                           _( "OK" ), pos );

    Button->SetForegroundColour( *wxBLUE );
    Button->SetForegroundColour( *wxBLUE );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );


    pos.y += Button->GetSize().y + 15;
    pos.y += Button->GetSize().y + 15;
    Button = new wxButton( this, ID_SWAP_LAYER_DESELECT,
    Button = new wxButton( this, ID_SWAP_LAYER_DESELECT,
                           _( "Deselect" ), pos );
                           _( "Deselect" ), pos );

    Button->SetForegroundColour( wxColour( 0, 100, 0 ) );
    Button->SetForegroundColour( wxColour( 0, 100, 0 ) );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );


    pos.y += Button->GetSize().y + 5;
    pos.y += Button->GetSize().y + 5;
    Button = new wxButton( this, ID_SWAP_LAYER_BUTTON_SELECT,
    Button = new wxButton( this, ID_SWAP_LAYER_BUTTON_SELECT,
                           _( "Select" ), pos );
                           _( "Select" ), pos );

    Button->SetForegroundColour( wxColour( 0, 100, 100 ) );
    Button->SetForegroundColour( wxColour( 0, 100, 100 ) );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
    winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );


    winsize.x += 10; winsize.y += 10;
    winsize.x += 10; winsize.y += 10;
    SetClientSize( winsize );
    SetClientSize( winsize );

}
}




@@ -134,18 +139,21 @@ void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event)
    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;
            New_Layer[ii] = jj;
            m_LayerList->SetString( ii,
            m_LayerList->SetString( ii,
						ReturnPcbLayerName(ii) + wxT(" -> ") + ReturnPcbLayerName(jj) );
                                   ReturnPcbLayerName( ii ) + wxT( " -> " ) +
                                   ReturnPcbLayerName( jj ) );
        }
        }
        break;
        break;
    }
    }
}
}



/*********************************************************/
/*********************************************************/
void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event )
void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event )
/*********************************************************/
/*********************************************************/
@@ -153,6 +161,7 @@ void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event)
    EndModal( -1 );
    EndModal( -1 );
}
}



/*********************************************************/
/*********************************************************/
void WinEDA_SwapLayerFrame::Execute( wxCommandEvent& event )
void WinEDA_SwapLayerFrame::Execute( wxCommandEvent& event )
/*********************************************************/
/*********************************************************/
@@ -173,12 +182,15 @@ 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 );
    WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this );

    ii = frame->ShowModal(); frame->Destroy();
    ii = frame->ShowModal(); frame->Destroy();


	if ( ii != 1 ) return;
    if( ii != 1 )
        return;


    /* Modifications des pistes */
    /* Modifications des pistes */
    pt_segm = (TRACK*) m_Pcb->m_Track;
    pt_segm = (TRACK*) m_Pcb->m_Track;
@@ -188,7 +200,8 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this);
        if( pt_segm->Type() == TYPEVIA )
        if( pt_segm->Type() == TYPEVIA )
        {
        {
            SEGVIA* Via = (SEGVIA*) pt_segm;
            SEGVIA* Via = (SEGVIA*) pt_segm;
			if ( Via->Shape() == VIA_NORMALE ) continue;
            if( Via->Shape() == VIA_NORMALE )
                continue;
            int     top_layer, bottom_layer;
            int     top_layer, bottom_layer;
            Via->ReturnLayerPair( &top_layer, &bottom_layer );
            Via->ReturnLayerPair( &top_layer, &bottom_layer );
            if( New_Layer[bottom_layer] >= 0 )
            if( New_Layer[bottom_layer] >= 0 )
@@ -200,7 +213,8 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this);
        else
        else
        {
        {
            jj = pt_segm->m_Layer;
            jj = pt_segm->m_Layer;
			if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj];
            if( New_Layer[jj] >= 0 )
                pt_segm->m_Layer = New_Layer[jj];
        }
        }
    }
    }


@@ -210,7 +224,8 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this);
    {
    {
        m_CurrentScreen->SetModify();
        m_CurrentScreen->SetModify();
        jj = pt_segm->m_Layer;
        jj = pt_segm->m_Layer;
		if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj];
        if( New_Layer[jj] >= 0 )
            pt_segm->m_Layer = New_Layer[jj];
    }
    }


    /* Modifications des autres segments */
    /* Modifications des autres segments */
@@ -222,12 +237,15 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this);
            m_CurrentScreen->SetModify();
            m_CurrentScreen->SetModify();
            pt_drawsegm = (DRAWSEGMENT*) PtStruct;
            pt_drawsegm = (DRAWSEGMENT*) PtStruct;
            jj = pt_drawsegm->m_Layer;
            jj = pt_drawsegm->m_Layer;
			if( New_Layer[jj] >= 0) pt_drawsegm->m_Layer = New_Layer[jj];
            if( New_Layer[jj] >= 0 )
                pt_drawsegm->m_Layer = New_Layer[jj];
        }
        }
    }
    }

    DrawPanel->Refresh( TRUE );
    DrawPanel->Refresh( TRUE );
}
}



/*********************************************************/
/*********************************************************/
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
/*********************************************************/
/*********************************************************/
@@ -239,7 +257,8 @@ 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" ) );


@@ -248,21 +267,25 @@ int ii, jj;
    {
    {
        wxString Line;
        wxString Line;
        /* calcul adr relative du nom de la pastille reference de la piste */
        /* calcul adr relative du nom de la pastille reference de la piste */
		if( ! WildCompareString(msg, Equipot->m_Netname, FALSE ) ) continue ;
        if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
            continue;


        Line.Printf( wxT( "net_code = %3.3d  [%.16s] " ), Equipot->m_NetCode,
        Line.Printf( wxT( "net_code = %3.3d  [%.16s] " ), Equipot->m_NetCode,
                    Equipot->m_Netname.GetData() );
                    Equipot->m_Netname.GetData() );
        List->Append( Line );
        List->Append( Line );
    }
    }

    ii = List->ShowModal(); List->Destroy();
    ii = List->ShowModal(); List->Destroy();
	if (ii < 0) return;
    if( ii < 0 )
        return;


    /* Recherche du numero de net rellement selectionn */
    /* Recherche du numero de net rellement selectionn */
    Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
    Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
    for( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
    for( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
    {
    {
        /* calcul adr relative du nom de la pastille reference de la piste */
        /* calcul adr relative du nom de la pastille reference de la piste */
		if( ! WildCompareString(msg, Equipot->m_Netname, FALSE) ) continue ;
        if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
            continue;
        if( ii == jj )
        if( ii == jj )
        {
        {
            ii = Equipot->m_NetCode;
            ii = Equipot->m_NetCode;
@@ -271,14 +294,12 @@ int ii, jj;
        jj++;
        jj++;
    }
    }



    wxClientDC dc( DrawPanel );
    wxClientDC dc( DrawPanel );

    DrawPanel->PrepareGraphicContext( &dc );
    DrawPanel->PrepareGraphicContext( &dc );


	if(g_HightLigt_Status) Hight_Light(&dc);
    if( g_HightLigt_Status )
        Hight_Light( &dc );
    g_HightLigth_NetCode = ii;
    g_HightLigth_NetCode = ii;
    Hight_Light( &dc );
    Hight_Light( &dc );
}
}