Pcbnew: allows autopan when editin or creating a zone

This commit is contained in:
charras 2009-01-09 19:09:13 +00:00
parent 31e3e98522
commit 0c0b2a40de
4 changed files with 54 additions and 49 deletions

View File

@ -113,7 +113,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
if( !GetBoard() )
return;
bool erase;
bool erase = false;
int Color;
bool filled;

View File

@ -168,7 +168,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id ) // Execute command
{
case ID_EXIT:
Close( TRUE );
Close( true );
break;
case ID_OPEN_MODULE_EDITOR:
@ -179,11 +179,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
_( "Module Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
m_ModuleEditFrame->Show( TRUE );
m_ModuleEditFrame->Zoom_Automatique( TRUE );
m_ModuleEditFrame->Show( true );
m_ModuleEditFrame->Zoom_Automatique( true );
}
else
m_ModuleEditFrame->Iconize( FALSE );
m_ModuleEditFrame->Iconize( false );
break;
case ID_NEW_PROJECT:
@ -197,14 +197,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
HandleBlockPlace( &dc );
break;
case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
HandleBlockPlace( &dc );
break;
@ -259,7 +259,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DisplayTrackSettings();
if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
{
Compile_Ratsnest( &dc, TRUE );
Compile_Ratsnest( &dc, true );
}
break;
@ -308,7 +308,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_PCB_SHOW_1_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) );
if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
Compile_Ratsnest( &dc, TRUE );
Compile_Ratsnest( &dc, true );
break;
case ID_POPUP_CLOSE_CURRENT_TOOL:
@ -354,11 +354,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetCurItem() == NULL )
break;
{
bool resize_vias = TRUE, resize_track = TRUE;
bool resize_vias = true, resize_track = true;
if( id == ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE )
resize_track = FALSE;
resize_track = false;
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE )
resize_vias = FALSE;
resize_vias = false;
if( Resize_Pistes_Vias( &dc, resize_track, resize_vias ) )
GetScreen()->SetModify();
}
@ -425,27 +425,27 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
Attribut_Segment( (TRACK*) GetCurItem(), &dc, TRUE );
Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
break;
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
Attribut_Segment( (TRACK*) GetCurItem(), &dc, FALSE );
Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
break;
case ID_POPUP_PCB_LOCK_ON_TRACK:
Attribut_Track( (TRACK*) GetCurItem(), &dc, TRUE );
Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
break;
case ID_POPUP_PCB_LOCK_OFF_TRACK:
Attribut_Track( (TRACK*) GetCurItem(), &dc, FALSE );
Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
break;
case ID_POPUP_PCB_LOCK_ON_NET:
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), TRUE );
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), true );
break;
case ID_POPUP_PCB_LOCK_OFF_NET:
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), FALSE );
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNet(), false );
break;
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
@ -466,11 +466,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
DrawPanel->MouseToCursorSchema();
DrawPanel->m_AutoPAN_Request = true;
Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
DrawPanel->MouseToCursorSchema();
DrawPanel->m_AutoPAN_Request = true;
Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
@ -490,6 +492,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( &dc,
zone_cont,
zone_cont->m_CornerSelection,
@ -501,6 +504,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Drag_Outline_Edge( &dc,
zone_cont,
zone_cont->m_CornerSelection );
@ -511,6 +515,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Outlines( &dc, zone_cont );
break;
}
@ -531,6 +536,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
pos.y );
zone_cont->m_CornerSelection++;
zone_cont->Draw( DrawPanel, &dc, GR_XOR );
DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( &dc,
zone_cont,
zone_cont->m_CornerSelection,
@ -544,6 +550,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
DrawPanel->m_AutoPAN_Request = false;
break;
}
@ -590,11 +597,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
Process_Move_Item( this, GetCurItem(), &dc );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
break;
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
g_Drag_Pistes_On = TRUE;
g_Drag_Pistes_On = true;
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
@ -603,7 +610,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
{
g_Drag_Pistes_On = FALSE;
g_Drag_Pistes_On = false;
break;
}
DrawPanel->MouseToCursorSchema();
@ -643,7 +650,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, TRUE );
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, true );
break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
@ -655,7 +662,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, TRUE );
Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, true );
break;
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
@ -681,7 +688,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
g_Drag_Pistes_On = TRUE;
g_Drag_Pistes_On = true;
DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetCurItem(), &dc );
break;
@ -780,7 +787,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer =
(int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_POPUP_PCB_EDIT_TEXTEPCB:
@ -867,6 +874,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( End_Zone( &dc ) )
SetCurItem( NULL );
}
DrawPanel->m_AutoPAN_Request = false;
break;
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
@ -887,8 +895,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings.m_CurrentTrackWidth =
g_DesignSettings.m_TrackWidthHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
m_SelTrackWidthBox_Changed = false;
m_SelViaSizeBox_Changed = false;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
@ -930,8 +938,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings.m_CurrentViaSize =
g_DesignSettings.m_ViaSizeHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
m_SelTrackWidthBox_Changed = false;
m_SelViaSizeBox_Changed = false;
}
break;
@ -1014,11 +1022,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_MENU_ARCHIVE_NEW_MODULES:
Archive_Modules( wxEmptyString, TRUE );
Archive_Modules( wxEmptyString, true );
break;
case ID_MENU_ARCHIVE_ALL_MODULES:
Archive_Modules( wxEmptyString, FALSE );
Archive_Modules( wxEmptyString, false );
break;
default:
@ -1029,7 +1037,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolbars();
DrawPanel->CursorOn( &dc );
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->m_IgnoreMouseEvents = false;
}

View File

@ -96,8 +96,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
if( aTrack == NULL ) /* Starting a new track */
{
D(printf("Begin_Route NULL\n");)
/* erase old highlight */
OldNetCodeSurbrillance = g_HightLigth_NetCode;
OldEtatSurbrillance = g_HightLigt_Status;
@ -148,10 +146,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
Hight_Light( DC );
/* done above
g_CurrentTrackSegment->m_Flags = IS_NEW;
*/
g_CurrentTrackSegment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
@ -205,8 +199,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
}
else /* Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor*/
{
D(printf("Begin_Route in progress\n");)
/* Tst for a D.R.C. error: */
if( Drc_On )
{

View File

@ -30,7 +30,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
@ -40,7 +40,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
case TYPE_ZONE_CONTAINER:
if ( (DrawStruct->m_Flags & IS_NEW) )
{
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( DC );
}
else
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER *) DrawStruct );
exit = true;
@ -98,7 +101,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
}
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->m_IgnoreMouseEvents = false;
DrawPanel->CursorOn( DC );
if ( exit ) return;
}
@ -225,6 +228,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
if ( Begin_Zone( DC ) )
{
DrawPanel->m_AutoPAN_Request = true;
DrawStruct = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
@ -233,6 +237,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->Type() == TYPE_ZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) )
{
DrawPanel->m_AutoPAN_Request = true;
Begin_Zone( DC );
DrawStruct = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
@ -251,7 +256,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else if( DrawStruct->Type() == TYPE_TEXTE )
{
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
else
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
@ -269,7 +274,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else if( DrawStruct->Type() == TYPE_MODULE )
{
Place_Module( (MODULE*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
else
DisplayError( this, wxT( "Internal err: Struct not TYPE_MODULE" ) );
@ -363,7 +368,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct->m_Flags & IS_NEW )
{
End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
else if( DrawStruct->m_Flags == 0 )
{
@ -421,14 +426,14 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
break;
case ID_PCB_ZONES_BUTT:
if ( End_Zone( DC ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
break;
@ -441,13 +446,13 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
break;
}
if( (DrawStruct->m_Flags & IS_NEW) )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
break;