Commit c25e5c31 authored by dickelbeck's avatar dickelbeck

bug fixes

parent 3237ea13
...@@ -5,6 +5,23 @@ Started 2007-June-11 ...@@ -5,6 +5,23 @@ 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.
2008-Apr-28 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* Layer names were not being set into the htoolbar listbox properly if the
BOARD was loaded via the command line as happens when kicad chain loads
pcbnew. Also, layer names were not being set if a second board was loaded
that had the same number of layers as the previous board. The solution was
to comment out the listbox rebuild test in WinEDAChoiceBox*
WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
* files.cpp: added Clear_Pcb( false ) to LoadOnePcbFile() and call it if
not appending. This way a user can get into the file selection dialog and
still abort (change his mind) without losing the current board. Removed calls to
Clear_Pcb() where LoadOnePcbFile() would now do that.
* edtxtmod.cpp: fixed the drawing relics when moving and rotating module texts.
2008-Apr-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
...@@ -522,6 +522,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -522,6 +522,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
if( delta.y <= 0 ) if( delta.y <= 0 )
delta.y = 1; delta.y = 1;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "dialog_edit_mod_text.h" #include "dialog_edit_mod_text.h"
extern wxPoint MoveVector; // Move vector for move edge, imported from dialog_edit mod_text.cpp extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp
////@begin XPM images ////@begin XPM images
////@end XPM images ////@end XPM images
......
This diff is collapsed.
...@@ -74,14 +74,15 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -74,14 +74,15 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* module = (MODULE*) Text->m_Parent; MODULE* module = (MODULE*) Text->m_Parent;
Text->Draw( DrawPanel, DC, GR_XOR ); // we expect MoveVector to be (0,0) if there is no move in progress
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
Text->m_Orient += 900; Text->m_Orient += 900;
while( Text->m_Orient >= 1800 ) while( Text->m_Orient >= 1800 )
Text->m_Orient -= 1800; Text->m_Orient -= 1800;
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( DrawPanel, DC, GR_XOR ); Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
Text->Display_Infos( this ); Text->Display_Infos( this );
...@@ -107,10 +108,11 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -107,10 +108,11 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC )
if( Text->m_Type == TEXT_is_DIVERS ) if( Text->m_Type == TEXT_is_DIVERS )
{ {
Text->Draw( DrawPanel, DC, GR_XOR ); // Text->Draw( DrawPanel, DC, GR_XOR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
/* liberation de la memoire : */ /* liberation de la memoire : */
Text ->DeleteStructure(); Text->DeleteStructure();
GetScreen()->SetModify(); GetScreen()->SetModify();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
} }
...@@ -137,10 +139,15 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -137,10 +139,15 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
return; return;
Module = (MODULE*) Text->m_Parent; Module = (MODULE*) Text->m_Parent;
Text->Draw( Panel, DC, GR_XOR, MoveVector ); Text->Draw( Panel, DC, GR_XOR, MoveVector );
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( Panel, DC, GR_OR ); // Text->Draw( Panel, DC, GR_OR );
Panel->PostDirtyRect( Text->GetBoundingBox() );
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
Text->m_Flags = 0; Text->m_Flags = 0;
Module->m_Flags = 0; Module->m_Flags = 0;
...@@ -167,6 +174,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -167,6 +174,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Module->m_Flags |= IN_EDIT; Module->m_Flags |= IN_EDIT;
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = Text->m_Pos; CursorInitialPosition = Text->m_Pos;
Text->Display_Infos( this ); Text->Display_Infos( this );
...@@ -189,6 +197,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -189,6 +197,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{ {
if( Text != NULL ) if( Text != NULL )
{ {
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->m_Curseur;
/* mise a jour des coordonnes relatives a l'ancre */ /* mise a jour des coordonnes relatives a l'ancre */
MODULE* Module = (MODULE*) Text->m_Parent; MODULE* Module = (MODULE*) Text->m_Parent;
...@@ -205,10 +215,14 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -205,10 +215,14 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( DrawPanel, DC, GR_OR ); //Text->Draw( DrawPanel, DC, GR_OR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
} }
} }
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
} }
......
...@@ -34,8 +34,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -34,8 +34,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
{ {
case ID_MENU_LOAD_FILE: case ID_MENU_LOAD_FILE:
case ID_LOAD_FILE: case ID_LOAD_FILE:
Clear_Pcb(TRUE ); LoadOnePcbFile( wxEmptyString, false );
LoadOnePcbFile( wxEmptyString,FALSE );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
...@@ -64,8 +63,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -64,8 +63,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
break; break;
} }
Clear_Pcb( TRUE ); LoadOnePcbFile( filename, false );
LoadOnePcbFile( filename, FALSE );
GetScreen()->m_FileName = oldfilename; GetScreen()->m_FileName = oldfilename;
SetTitle( GetScreen()->m_FileName ); SetTitle( GetScreen()->m_FileName );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
...@@ -95,7 +93,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -95,7 +93,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_LOAD_FILE_8: case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9: case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10: case ID_LOAD_FILE_10:
Clear_Pcb(TRUE );
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) ); wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(), LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
false ); false );
...@@ -153,10 +150,12 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -153,10 +150,12 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
} }
wxString fileName;
if( FullFileName == wxEmptyString ) if( FullFileName == wxEmptyString )
{ {
msg = wxT( "*" ) + PcbExtBuffer; msg = wxT( "*" ) + PcbExtBuffer;
wxString FileName = fileName =
EDA_FileSelector( _( "Load board files:" ), EDA_FileSelector( _( "Load board files:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
GetScreen()->m_FileName, /* nom fichier par defaut */ GetScreen()->m_FileName, /* nom fichier par defaut */
...@@ -166,12 +165,17 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -166,12 +165,17 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
wxFD_OPEN, wxFD_OPEN,
FALSE FALSE
); );
if( FileName == wxEmptyString )
if( fileName == wxEmptyString )
return FALSE; return FALSE;
GetScreen()->m_FileName = FileName;
} }
else else
GetScreen()->m_FileName = FullFileName; fileName = FullFileName;
if( !Append )
Clear_Pcb( false ); // pass false since we prompted above for a modified board
GetScreen()->m_FileName = fileName;
/* Start read PCB file /* Start read PCB file
*/ */
...@@ -202,7 +206,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -202,7 +206,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
} }
else if ( ver < g_CurrentVersionPCB ) else if ( ver < g_CurrentVersionPCB )
{ {
DisplayInfo( this, _( "This file was created by an older version of EESchema. It will be stored in the new file format when you save this file again.")); DisplayInfo( this, _( "This file was created by an older version of PCBnew. It will be stored in the new file format when you save this file again."));
} }
SetTitle( GetScreen()->m_FileName ); SetTitle( GetScreen()->m_FileName );
......
...@@ -139,6 +139,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) ...@@ -139,6 +139,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
/* init pointeurs et variables */ /* init pointeurs et variables */
GetScreen()->m_FileName.Empty(); GetScreen()->m_FileName.Empty();
memset( buf_work, 0, BUFMEMSIZE ); memset( buf_work, 0, BUFMEMSIZE );
adr_lowmem = adr_max = buf_work; adr_lowmem = adr_max = buf_work;
......
...@@ -369,7 +369,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -369,7 +369,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
{
if( m_Pcb->m_ZoneDescriptorList.size() > 0 ) if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
...@@ -380,11 +379,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -380,11 +379,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
}
break; break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
{
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(), ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
ID_POPUP_PCB_SELECT_WIDTH, ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm ); _( "Select Track Width" ), width_track_xpm );
...@@ -393,7 +390,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -393,7 +390,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR,
_( "Select layer pair for vias" ), select_layer_pair_xpm ); _( "Select layer pair for vias" ), select_layer_pair_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
}
break; break;
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
......
...@@ -205,7 +205,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -205,7 +205,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens {
// simple mise a jour de la liste des fichiers anciens
wxMenuItem* item; wxMenuItem* item;
for( ii = 9; ii >=0; ii-- ) for( ii = 9; ii >=0; ii-- )
{ {
...@@ -630,10 +631,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -630,10 +631,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
/**************************************************************************/ /**************************************************************************/
{ {
int ii, jj, ll; int ii, jj, ll;
unsigned lenght = 0; unsigned length = 0;
bool rebuild = FALSE;
long current_mask_layer;
if( m_SelLayerBox == NULL ) if( m_SelLayerBox == NULL )
{ {
if( parent == NULL ) if( parent == NULL )
...@@ -655,27 +653,39 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -655,27 +653,39 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
parent->AddControl( m_SelLayerBox ); parent->AddControl( m_SelLayerBox );
} }
// Test si reconstruction de la liste necessaire
current_mask_layer = 0; int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
Masque_Layer |= ALL_NO_CU_LAYERS; layer_mask |= ALL_NO_CU_LAYERS;
// This is commented out because testing the number of layer is no longer
// sufficient since the layer names may also have changed. And the time
// required to test layer names is probably longer than the time required
// to simply reconstruct the list.
#if 0
// Test if reconstruction of the list is necessary
int current_layer_mask = 0;
for( ii = 0; ii < (int) m_SelLayerBox->GetCount(); ii++ ) for( ii = 0; ii < (int) m_SelLayerBox->GetCount(); ii++ )
{ {
jj = (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) ); jj = (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) );
current_mask_layer |= g_TabOneLayerMask[jj]; current_mask_layer |= g_TabOneLayerMask[jj];
} }
if( current_mask_layer != Masque_Layer ) bool rebuild = FALSE;
if( current_layer_mask != layer_mask )
rebuild = TRUE; rebuild = TRUE;
// Construction de la liste // Construction de la liste
if( rebuild ) if( rebuild )
#endif
{ {
m_SelLayerBox->Clear(); m_SelLayerBox->Clear();
for( ii = 0, jj = 0; ii <= EDGE_N; ii++ ) for( ii = 0, jj = 0; ii <= EDGE_N; ii++ )
{ {
// List to append hotkeys in layer box selection // List to append hotkeys in layer box selection
static int HK_SwitchLayer[EDGE_N + 1] = { static const int HK_SwitchLayer[EDGE_N + 1] = {
HK_SWITCH_LAYER_TO_COPPER, HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_INNER1, HK_SWITCH_LAYER_TO_INNER1,
HK_SWITCH_LAYER_TO_INNER2, HK_SWITCH_LAYER_TO_INNER2,
...@@ -694,20 +704,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -694,20 +704,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
HK_SWITCH_LAYER_TO_COMPONENT HK_SWITCH_LAYER_TO_COMPONENT
}; };
if( (g_TabOneLayerMask[ii] & Masque_Layer) ) if( (g_TabOneLayerMask[ii] & layer_mask) )
{ {
wxString msg = m_Pcb->GetLayerName( ii ); wxString msg = m_Pcb->GetLayerName( ii );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[ii] ); msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[ii] );
m_SelLayerBox->Append( msg ); m_SelLayerBox->Append( msg );
m_SelLayerBox->SetClientData( jj, (void*) ii ); m_SelLayerBox->SetClientData( jj, (void*) ii );
lenght = max( lenght, msg.Len() ); length = MAX( length, msg.Len() );
jj++; jj++;
} }
} }
// Test me: // Test me:
// int lchar = m_SelLayerBox->GetFont().GetPointSize(); // int lchar = m_SelLayerBox->GetFont().GetPointSize();
// m_SelLayerBox->SetSize(wxSize(lenght * lchar,-1)); // m_SelLayerBox->SetSize(wxSize(length * lchar,-1));
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
} }
......
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