fixed bugs 593546 ( 'Update module' in module editor becomes sometimes unavailable after undo ) and 593547 ('no' confirmation in module editor overlaps modules)

This commit is contained in:
jean-pierre charras 2010-06-14 22:16:47 +02:00
parent 6eb66721c9
commit 12a0e4942a
5 changed files with 62 additions and 25 deletions

View File

@ -213,7 +213,6 @@ public:
void Archive_Modules( const wxString& LibName,
bool NewModulesOnly );
MODULE* Select_1_Module_From_BOARD( BOARD* Pcb );
MODULE* GetModuleByName();
/** Function OnModify()

View File

@ -1089,6 +1089,11 @@ public:
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** function LoadModuleFromBoard
* called from the main toolbar
* to load a footprint from board mainly to edit it
*/
void LoadModuleFromBoard( wxCommandEvent& event );
/** Virtual Function OnModify()
@ -1173,10 +1178,23 @@ public:
void RemoveStruct( EDA_BaseStruct* Item );
void Transform( MODULE* module, int transform );
// loading Footprint
// loading/exporting Footprint
MODULE* Import_Module( wxDC* DC );
void Export_Module( MODULE* ptmod, bool createlib );
void Load_Module_From_BOARD( MODULE* Module );
/** function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool Load_Module_From_BOARD( MODULE* Module );
/** Function Select_1_Module_From_BOARD
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* Select_1_Module_From_BOARD( BOARD* aPcb );
// functions to edit footprint edges

View File

@ -101,6 +101,7 @@ void MODULE::Copy( MODULE* aModule )
m_CntRot90 = aModule->m_CntRot90;
m_CntRot180 = aModule->m_CntRot180;
m_LastEdit_Time = aModule->m_LastEdit_Time;
m_Link = aModule->m_Link;
m_Path = aModule->m_Path; //is this correct behavior?
m_TimeStamp = GetTimeStamp();
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;

View File

@ -41,27 +41,30 @@ static void ReadDocLib( const wxString& ModLibName );
static ModList* MList;
void WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
/** function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
{
MODULE* NewModule;
WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent();
if( Module == NULL )
{
if( parent->GetBoard() == NULL
|| parent->GetBoard()->m_Modules == NULL )
return;
if( ! parent->GetBoard() || ! parent->GetBoard()->m_Modules )
return false;
Module = Select_1_Module_From_BOARD( parent->GetBoard() );
}
if( Module == NULL )
return;
return false;
SetCurItem( NULL );
Clear_Pcb( TRUE );
Clear_Pcb( false );
GetBoard()->m_Status_Pcb = 0;
NewModule = new MODULE( GetBoard() );
@ -80,9 +83,11 @@ void WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
Place_Module( Module, NULL );
if( Module->GetLayer() != LAYER_N_FRONT )
Module->Flip( Module->m_Pos );
Rotate_Module( NULL, Module, 0, FALSE );
Rotate_Module( NULL, Module, 0, false );
GetScreen()->ClrModify();
Zoom_Automatique( TRUE );
return true;
}
@ -117,7 +122,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
if( ModuleName[0] == '=' ) // Selection by keywords
{
AllowWildSeach = FALSE;
AllowWildSeach = false;
keys = ModuleName.AfterFirst( '=' );
ModuleName = Select_1_Module_From_List( this, library, wxEmptyString,
keys );
@ -130,7 +135,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
else if( ( ModuleName.Contains( wxT( "?" ) ) )
|| ( ModuleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
{
AllowWildSeach = FALSE;
AllowWildSeach = false;
ModuleName = Select_1_Module_From_List( this, library, ModuleName,
wxEmptyString );
if( ModuleName.IsEmpty() )
@ -140,11 +145,11 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
}
}
module = Get_Librairie_Module( library, ModuleName, FALSE );
module = Get_Librairie_Module( library, ModuleName, false );
if( ( module == NULL ) && AllowWildSeach ) /* Search with wildcard */
{
AllowWildSeach = FALSE;
AllowWildSeach = false;
wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' );
ModuleName = wildname;
ModuleName = Select_1_Module_From_List( this, library, ModuleName,
@ -445,7 +450,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
ListBox->Append( msg );
NbModules++;
}
else if( WildCompareString( aMask, msg, FALSE ) )
else if( WildCompareString( aMask, msg, false ) )
{
ListBox->Append( msg );
NbModules++;
@ -594,11 +599,12 @@ static void ReadDocLib( const wxString& ModLibName )
}
/* Display the list of modules currently PCB
* Returns a pointer if module selected
* Returns NULL otherwise
/** Function Select_1_Module_From_BOARD
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* WinEDA_BasePcbFrame::Select_1_Module_From_BOARD( BOARD* Pcb )
MODULE* WinEDA_ModuleEditFrame::Select_1_Module_From_BOARD( BOARD* aPcb )
{
int ii;
MODULE* Module;
@ -610,7 +616,7 @@ MODULE* WinEDA_BasePcbFrame::Select_1_Module_From_BOARD( BOARD* Pcb )
wxColour( 200, 200, 255 ) );
ii = 0;
Module = Pcb->m_Modules;
Module = aPcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Next() )
{
ii++;
@ -635,7 +641,7 @@ MODULE* WinEDA_BasePcbFrame::Select_1_Module_From_BOARD( BOARD* Pcb )
OldName = CmpName;
Module = Pcb->m_Modules;
Module = aPcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Next() )
{
if( CmpName.CmpNoCase( Module->m_Reference->m_Text ) == 0 )

View File

@ -131,11 +131,23 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
return item;
}
/** function LoadModuleFromBoard
* called from the main toolbar
* to load a footprint from board mainly to edit it
*/
void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
{
if( GetScreen()->IsModify() )
{
if( !IsOK( this,
_( "Current footprint changes will be lost and this operation cannot be undone. Continue ?" ) ) )
return;
}
if( ! Load_Module_From_BOARD( NULL ) )
return;
GetScreen()->ClearUndoRedoList();
Load_Module_From_BOARD( NULL );
GetScreen()->ClrModify();
if( m_Draw3DFrame )
@ -333,9 +345,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_MODEDIT_IMPORT_PART:
if( ! Clear_Pcb( true ) )
break; // //this command is aborted
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
Clear_Pcb( true );
GetScreen()->m_Curseur = wxPoint( 0, 0 );
Import_Module( NULL );
redraw = true;