pcbnew: onleftclick.cpp added. move onleftclick() and OnLeftDClick() from edit.cpp to it
This commit is contained in:
parent
f066aa1898
commit
bfb03b8fa6
|
@ -4,6 +4,14 @@ 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.
|
||||||
|
|
||||||
|
|
||||||
|
2007-Sep-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
|
================================================================================
|
||||||
|
+ pcbnew
|
||||||
|
create new file onleftclick.cpp
|
||||||
|
move onleftcligk() and onleftDcligk() from edit.cpp to onleftclick.cpp
|
||||||
|
|
||||||
|
|
||||||
2007-Sep-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
2007-Sep-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ all
|
+ all
|
||||||
|
|
|
@ -92,6 +92,13 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
|
|
||||||
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
||||||
|
|
||||||
|
if( BlockActive )
|
||||||
|
{
|
||||||
|
AddMenusForBlock( PopMenu, this );
|
||||||
|
PopMenu->AppendSeparator();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Simple localisation des elements si possible
|
// Simple localisation des elements si possible
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
|
@ -121,18 +128,13 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
{
|
{
|
||||||
if( BlockActive )
|
|
||||||
AddMenusForBlock( PopMenu, this );
|
|
||||||
else
|
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( BlockActive )
|
|
||||||
return;
|
|
||||||
if( DrawStruct == NULL )
|
if( DrawStruct == NULL )
|
||||||
{
|
{
|
||||||
if( m_CurrentScreen != ScreenSch )
|
if( m_CurrentScreen != ScreenSch )
|
||||||
|
|
428
pcbnew/edit.cpp
428
pcbnew/edit.cpp
|
@ -19,306 +19,6 @@
|
||||||
static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
||||||
EDA_BaseStruct* DrawStruct, wxDC* DC );
|
EDA_BaseStruct* DrawStruct, wxDC* DC );
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/* Handle the left buttom mouse click, when a tool is active
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
|
||||||
bool exit = false;
|
|
||||||
|
|
||||||
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
|
|
||||||
{
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
|
|
||||||
{
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
|
||||||
DrawPanel->CursorOff( DC );
|
|
||||||
|
|
||||||
switch( DrawStruct->Type() )
|
|
||||||
{
|
|
||||||
case TYPETRACK:
|
|
||||||
case TYPEVIA:
|
|
||||||
if( DrawStruct->m_Flags & IS_DRAGGED )
|
|
||||||
{
|
|
||||||
PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPETEXTE:
|
|
||||||
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPETEXTEMODULE:
|
|
||||||
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEPAD:
|
|
||||||
PlacePad( (D_PAD*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEMODULE:
|
|
||||||
Place_Module( (MODULE*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEMIRE:
|
|
||||||
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEDRAWSEGMENT:
|
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
{
|
|
||||||
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
|
|
||||||
exit = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
{
|
|
||||||
DisplayError( this,
|
|
||||||
wxT( "WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0" ) );
|
|
||||||
exit = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
|
||||||
DrawPanel->CursorOn( DC );
|
|
||||||
if ( exit ) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
|
|
||||||
!wxGetKeyState(WXK_CONTROL) )
|
|
||||||
{
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
if( DrawStruct )
|
|
||||||
SendMessageToEESCHEMA( DrawStruct );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
|
||||||
{
|
|
||||||
case ID_MAIN_MENUBAR:
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_NO_SELECT_BUTT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
|
||||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
|
||||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
|
||||||
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
|
||||||
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
|
||||||
MuWaveCommand( DC, MousePos );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_HIGHLIGHT_BUTT:
|
|
||||||
{
|
|
||||||
int netcode = Select_High_Light( DC );
|
|
||||||
if( netcode < 0 )
|
|
||||||
m_Pcb->Display_Infos( this );
|
|
||||||
else
|
|
||||||
Affiche_Infos_Equipot( netcode, this );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
|
||||||
#if 0
|
|
||||||
DrawStruct = m_Pcb->FindPadOrModule( GetScreen()->RefPos(true),
|
|
||||||
GetScreen()->m_Active_Layer );
|
|
||||||
#else
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
#endif
|
|
||||||
Show_1_Ratsnest( DrawStruct, DC );
|
|
||||||
|
|
||||||
if( DrawStruct )
|
|
||||||
SendMessageToEESCHEMA( DrawStruct );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_MIRE_BUTT:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
SetCurItem( Create_Mire( DC ) );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
}
|
|
||||||
else if( DrawStruct->Type() == TYPEMIRE )
|
|
||||||
{
|
|
||||||
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPEMIRE" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_CIRCLE_BUTT:
|
|
||||||
case ID_PCB_ARC_BUTT:
|
|
||||||
case ID_LINE_COMMENT_BUTT:
|
|
||||||
{
|
|
||||||
int shape = S_SEGMENT;
|
|
||||||
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
|
||||||
shape = S_CIRCLE;
|
|
||||||
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
|
||||||
shape = S_ARC;
|
|
||||||
|
|
||||||
if( GetScreen()->m_Active_Layer <= CMP_N )
|
|
||||||
{
|
|
||||||
DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
else if( DrawStruct
|
|
||||||
&& (DrawStruct->Type() == TYPEDRAWSEGMENT)
|
|
||||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case ID_TRACK_BUTT:
|
|
||||||
if( GetScreen()->m_Active_Layer > CMP_N )
|
|
||||||
{
|
|
||||||
DisplayError( this, _( "Tracks on Copper layers only " ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = Begin_Route( NULL, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
if( DrawStruct )
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
else if( DrawStruct &&
|
|
||||||
|
|
||||||
// (DrawStruct->Type() == TYPETRACK) &&
|
|
||||||
(DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
|
|
||||||
if( track ) // c'est a dire si OK
|
|
||||||
SetCurItem( DrawStruct = track );
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case ID_PCB_ZONES_BUTT:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
SetCurItem( DrawStruct = Begin_Zone() );
|
|
||||||
}
|
|
||||||
else if( DrawStruct
|
|
||||||
&& (DrawStruct->Type() == TYPEEDGEZONE)
|
|
||||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
SetCurItem( DrawStruct = Begin_Zone() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( this, wxT( "Edit: zone internal error" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_TEXT_COMMENT_BUTT:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
SetCurItem( Create_Texte_Pcb( DC ) );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
else if( DrawStruct->Type() == TYPETEXTE )
|
|
||||||
{
|
|
||||||
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPETEXTE" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_COMPONENT_BUTT:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
if( DrawStruct )
|
|
||||||
StartMove_Module( (MODULE*) DrawStruct, DC );
|
|
||||||
}
|
|
||||||
else if( DrawStruct->Type() == TYPEMODULE )
|
|
||||||
{
|
|
||||||
Place_Module( (MODULE*) DrawStruct, DC );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPEMODULE" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_COTATION_BUTT:
|
|
||||||
if( GetScreen()->m_Active_Layer <= CMP_N )
|
|
||||||
{
|
|
||||||
DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = Begin_Cotation( NULL, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
else if( DrawStruct
|
|
||||||
&& (DrawStruct->Type() == TYPECOTATION)
|
|
||||||
&& (DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DisplayError( this, wxT( "Internal err: Struct not COTATION" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_DELETE_ITEM_BUTT:
|
|
||||||
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
RemoveStruct( DrawStruct, DC );
|
|
||||||
SetCurItem( DrawStruct = NULL );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
|
||||||
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_XOR );
|
|
||||||
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
|
|
||||||
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY );
|
|
||||||
GetScreen()->SetModify();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
|
||||||
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
|
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// see wxstruct.h
|
// see wxstruct.h
|
||||||
void WinEDA_PcbFrame::SendMessageToEESCHEMA( EDA_BaseStruct* objectToSync )
|
void WinEDA_PcbFrame::SendMessageToEESCHEMA( EDA_BaseStruct* objectToSync )
|
||||||
{
|
{
|
||||||
|
@ -363,7 +63,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
pos.y += 20;
|
pos.y += 20;
|
||||||
|
|
||||||
switch( id ) // Arret eventuel de la commande de d<>placement en cours
|
switch( id ) // Some (not all ) edit commands must be finished or aborted
|
||||||
{
|
{
|
||||||
case wxID_CUT:
|
case wxID_CUT:
|
||||||
case wxID_COPY:
|
case wxID_COPY:
|
||||||
|
@ -456,7 +156,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
/* ne devrait pas etre execute, sauf bug */
|
/* Should not be executed, just in case */
|
||||||
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE )
|
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE;
|
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
|
@ -469,7 +169,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Arret de la commande de d<>placement en cours
|
default: // Finish (abort ) the command
|
||||||
if( DrawPanel->ManageCurseur
|
if( DrawPanel->ManageCurseur
|
||||||
&& DrawPanel->ForceCloseManageCurseur )
|
&& DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
|
@ -479,7 +179,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( id ) // Traitement des commandes
|
switch( id ) // Execute command
|
||||||
{
|
{
|
||||||
case ID_EXIT:
|
case ID_EXIT:
|
||||||
Close( TRUE );
|
Close( TRUE );
|
||||||
|
@ -1230,126 +930,6 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
|
||||||
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|
||||||
/********************************************************************************/
|
|
||||||
|
|
||||||
/* Appel<65> sur un double click:
|
|
||||||
* pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
|
|
||||||
* appel de l'editeur correspondant.
|
|
||||||
* pour une connexion en cours:
|
|
||||||
* termine la connexion
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
|
||||||
wxPoint pos = GetPosition();
|
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
SendMessageToEESCHEMA( DrawStruct );
|
|
||||||
|
|
||||||
// Element localis<69>
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
|
|
||||||
switch( DrawStruct->Type() )
|
|
||||||
{
|
|
||||||
case TYPETRACK:
|
|
||||||
case TYPEVIA:
|
|
||||||
if( DrawStruct->m_Flags & IS_NEW )
|
|
||||||
{
|
|
||||||
End_Route( (TRACK*) DrawStruct, DC );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
}
|
|
||||||
else if( DrawStruct->m_Flags == 0 )
|
|
||||||
{
|
|
||||||
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPETEXTE:
|
|
||||||
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct,
|
|
||||||
DC, ( (TEXTE_PCB*) DrawStruct )->m_Pos );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEPAD:
|
|
||||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEMODULE:
|
|
||||||
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc, pos );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEMIRE:
|
|
||||||
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPETEXTEMODULE:
|
|
||||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEDRAWSEGMENT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break; // end case 0
|
|
||||||
|
|
||||||
case ID_TRACK_BUTT:
|
|
||||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
End_Route( (TRACK*) DrawStruct, DC );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PCB_ZONES_BUTT:
|
|
||||||
End_Zone( DC );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
SetCurItem( NULL );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_LINE_COMMENT_BUTT:
|
|
||||||
case ID_PCB_ARC_BUTT:
|
|
||||||
case ID_PCB_CIRCLE_BUTT:
|
|
||||||
if( DrawStruct == NULL )
|
|
||||||
break;
|
|
||||||
if( DrawStruct->Type() != TYPEDRAWSEGMENT )
|
|
||||||
{
|
|
||||||
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( (DrawStruct->m_Flags & IS_NEW) )
|
|
||||||
{
|
|
||||||
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
|
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
|
||||||
SetCurItem( NULL );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
|
void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Generation du fichier de percage en format EXCELLON
|
* Generation du fichier de percage en format EXCELLON
|
||||||
Variantes supportees:
|
* Variantes supportees:
|
||||||
- Decimal : coord flottantes en pouces
|
* - Decimal : coord flottantes en pouces
|
||||||
- Metric : coord entieres en 1/10000 mm
|
* - Metric : coord entieres en 1/10000 mm
|
||||||
format "Trailling Zero" ( TZ )
|
* format "Trailling Zero" ( TZ )
|
||||||
|
*
|
||||||
On peut aussi generer le plan de percage en format HPGL ou PS
|
* On peut aussi generer le plan de percage en format HPGL ou PS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Routines importees */
|
/* Routines importees */
|
||||||
|
@ -57,9 +57,12 @@ enum zeros_fmt {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Routines Locales */
|
/* Routines Locales */
|
||||||
static void Fin_Drill();
|
static void Write_End_Of_File_Drill();
|
||||||
static void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int format );
|
static void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int format );
|
||||||
static void PlotOvalDrillSymbol(const wxPoint & position,const wxSize & size,int orient,int format);
|
static void PlotOvalDrillSymbol( const wxPoint& position,
|
||||||
|
const wxSize& size,
|
||||||
|
int orient,
|
||||||
|
int format );
|
||||||
|
|
||||||
/* Variables locales : */
|
/* Variables locales : */
|
||||||
static int DrillToolsCount; /* Nombre de forets a utiliser */
|
static int DrillToolsCount; /* Nombre de forets a utiliser */
|
||||||
|
@ -67,6 +70,7 @@ static float conv_unit; /* coeff de conversion des unites drill / pcb */
|
||||||
static bool Unit_Drill_is_Inch = TRUE; /* INCH,LZ (2:4) */
|
static bool Unit_Drill_is_Inch = TRUE; /* INCH,LZ (2:4) */
|
||||||
static int s_Zeros_Format = DECIMAL_FORMAT;
|
static int s_Zeros_Format = DECIMAL_FORMAT;
|
||||||
static DrillPrecision s_Precision( 2, 4 );
|
static DrillPrecision s_Precision( 2, 4 );
|
||||||
|
|
||||||
static bool DrillOriginIsAuxAxis; // Axis selection (main / auxiliary) for Drill Origin coordinates
|
static bool DrillOriginIsAuxAxis; // Axis selection (main / auxiliary) for Drill Origin coordinates
|
||||||
static wxPoint File_Drill_Offset; /* Offset des coord de percage pour le fichier généré */
|
static wxPoint File_Drill_Offset; /* Offset des coord de percage pour le fichier généré */
|
||||||
static bool Minimal = false;
|
static bool Minimal = false;
|
||||||
|
@ -96,7 +100,6 @@ enum id_drill {
|
||||||
|
|
||||||
class WinEDA_DrillFrame : public wxDialog
|
class WinEDA_DrillFrame : public wxDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
WinEDA_PcbFrame* m_Parent;
|
WinEDA_PcbFrame* m_Parent;
|
||||||
wxRadioBox* m_Choice_Drill_Map;
|
wxRadioBox* m_Choice_Drill_Map;
|
||||||
wxRadioBox* m_Choice_Drill_Report;
|
wxRadioBox* m_Choice_Drill_Report;
|
||||||
|
@ -170,7 +173,8 @@ wxString choice_unit_msg[] =
|
||||||
_( "Drill Units:" ),
|
_( "Drill Units:" ),
|
||||||
wxDefaultPosition, wxSize( -1, -1 ),
|
wxDefaultPosition, wxSize( -1, -1 ),
|
||||||
2, choice_unit_msg, 1, wxRA_SPECIFY_COLS );
|
2, choice_unit_msg, 1, wxRA_SPECIFY_COLS );
|
||||||
if ( Unit_Drill_is_Inch )m_Choice_Unit->SetSelection(1);
|
if( Unit_Drill_is_Inch )
|
||||||
|
m_Choice_Unit->SetSelection( 1 );
|
||||||
LeftBoxSizer->Add( m_Choice_Unit, 0, wxGROW | wxALL, 5 );
|
LeftBoxSizer->Add( m_Choice_Unit, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxString choice_zeros_format_msg[] = {
|
wxString choice_zeros_format_msg[] = {
|
||||||
|
@ -200,7 +204,8 @@ wxString choice_precision_metric_msg[] = { _("3:2"), _("3:3")};
|
||||||
wxString ps;
|
wxString ps;
|
||||||
ps << s_Precision.m_lhs << wxT( ":" ) << s_Precision.m_rhs;
|
ps << s_Precision.m_lhs << wxT( ":" ) << s_Precision.m_rhs;
|
||||||
m_Choice_Precision->SetStringSelection( ps );
|
m_Choice_Precision->SetStringSelection( ps );
|
||||||
if (s_Zeros_Format==DECIMAL_FORMAT) m_Choice_Precision->Enable(false);
|
if( s_Zeros_Format==DECIMAL_FORMAT )
|
||||||
|
m_Choice_Precision->Enable( false );
|
||||||
|
|
||||||
wxString choice_drill_offset_msg[] =
|
wxString choice_drill_offset_msg[] =
|
||||||
{ _( "absolute" ), _( "auxiliary axis" ) };
|
{ _( "absolute" ), _( "auxiliary axis" ) };
|
||||||
|
@ -208,7 +213,8 @@ wxString choice_drill_offset_msg[] =
|
||||||
_( "Drill Origin:" ),
|
_( "Drill Origin:" ),
|
||||||
wxDefaultPosition, wxSize( -1, -1 ),
|
wxDefaultPosition, wxSize( -1, -1 ),
|
||||||
2, choice_drill_offset_msg, 1, wxRA_SPECIFY_COLS );
|
2, choice_drill_offset_msg, 1, wxRA_SPECIFY_COLS );
|
||||||
if ( DrillOriginIsAuxAxis ) m_Choice_Drill_Offset->SetSelection(1);
|
if( DrillOriginIsAuxAxis )
|
||||||
|
m_Choice_Drill_Offset->SetSelection( 1 );
|
||||||
LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxGROW | wxALL, 5 );
|
LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
/* second column */
|
/* second column */
|
||||||
|
@ -228,8 +234,10 @@ wxString choice_drill_report_msg[] =
|
||||||
2, choice_drill_report_msg, 1, wxRA_SPECIFY_COLS );
|
2, choice_drill_report_msg, 1, wxRA_SPECIFY_COLS );
|
||||||
MiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxGROW | wxALL, 5 );
|
MiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_ViaDrillCtrl = new WinEDA_ValueCtrl(this, _("Via Drill"),
|
m_ViaDrillCtrl = new WinEDA_ValueCtrl( this, _(
|
||||||
g_DesignSettings.m_ViaDrill, g_UnitMetric, MiddleBoxSizer,
|
"Via Drill" ),
|
||||||
|
g_DesignSettings.m_ViaDrill, g_UnitMetric,
|
||||||
|
MiddleBoxSizer,
|
||||||
m_Parent->m_InternalUnits );
|
m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
m_PenNum = new WinEDA_ValueCtrl( this, _( "Pen Number" ),
|
m_PenNum = new WinEDA_ValueCtrl( this, _( "Pen Number" ),
|
||||||
|
@ -282,7 +290,7 @@ void WinEDA_DrillFrame::SetParams()
|
||||||
File_Drill_Offset = m_Parent->m_Auxiliary_Axis_Position;
|
File_Drill_Offset = m_Parent->m_Auxiliary_Axis_Position;
|
||||||
|
|
||||||
/* get precision from radio box strings (this just makes it easier to
|
/* get precision from radio box strings (this just makes it easier to
|
||||||
change options later)*/
|
* change options later)*/
|
||||||
wxString ps = m_Choice_Precision->GetStringSelection();
|
wxString ps = m_Choice_Precision->GetStringSelection();
|
||||||
wxString l = ps.substr( 0, 1 );
|
wxString l = ps.substr( 0, 1 );
|
||||||
wxString r = ps.substr( 2, 1 );
|
wxString r = ps.substr( 2, 1 );
|
||||||
|
@ -294,10 +302,12 @@ void WinEDA_DrillFrame::SetParams()
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
void WinEDA_PcbFrame::InstallDrillFrame( wxCommandEvent& event )
|
void WinEDA_PcbFrame::InstallDrillFrame( wxCommandEvent& event )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* This function displays and deletes the dialog frame for drill tools
|
/* This function displays and deletes the dialog frame for drill tools
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxConfig* Config = m_Parent->m_EDA_Config;
|
wxConfig* Config = m_Parent->m_EDA_Config;
|
||||||
|
|
||||||
if( Config )
|
if( Config )
|
||||||
{
|
{
|
||||||
Config->Read( ZerosFormatKey, &s_Zeros_Format );
|
Config->Read( ZerosFormatKey, &s_Zeros_Format );
|
||||||
|
@ -359,7 +369,8 @@ wxString msg;
|
||||||
|
|
||||||
/* Calcul des echelles de conversion */
|
/* Calcul des echelles de conversion */
|
||||||
conv_unit = 0.0001; /* unites = INCHES */
|
conv_unit = 0.0001; /* unites = INCHES */
|
||||||
if( ! Unit_Drill_is_Inch) conv_unit = 0.000254; /* unites = mm */
|
if( !Unit_Drill_is_Inch )
|
||||||
|
conv_unit = 0.000254; /* unites = mm */
|
||||||
|
|
||||||
/* Init nom fichier */
|
/* Init nom fichier */
|
||||||
FullFileName = m_Parent->m_CurrentScreen->m_FileName;
|
FullFileName = m_Parent->m_CurrentScreen->m_FileName;
|
||||||
|
@ -399,15 +410,18 @@ wxString msg;
|
||||||
msg.Printf( wxT( "%d" ), ii );
|
msg.Printf( wxT( "%d" ), ii );
|
||||||
Affiche_1_Parametre( m_Parent, 45, _( "Drill" ), msg, GREEN );
|
Affiche_1_Parametre( m_Parent, 45, _( "Drill" ), msg, GREEN );
|
||||||
|
|
||||||
Fin_Drill();
|
Write_End_Of_File_Drill();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_Choice_Drill_Map->GetSelection() )
|
switch( m_Choice_Drill_Map->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
GenDrillMap( PLOT_FORMAT_HPGL );
|
GenDrillMap( PLOT_FORMAT_HPGL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
GenDrillMap( PLOT_FORMAT_POST );
|
GenDrillMap( PLOT_FORMAT_POST );
|
||||||
break;
|
break;
|
||||||
|
@ -419,6 +433,7 @@ wxString msg;
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
|
void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
@ -429,7 +444,8 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions(wxCommandEvent& event)
|
||||||
m_Choice_Precision->SetString( 1, _( "2:4" ) );
|
m_Choice_Precision->SetString( 1, _( "2:4" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* metric options */
|
{
|
||||||
|
/* metric options */
|
||||||
m_Choice_Precision->SetString( 0, _( "3:2" ) );
|
m_Choice_Precision->SetString( 0, _( "3:2" ) );
|
||||||
m_Choice_Precision->SetString( 1, _( "3:3" ) );
|
m_Choice_Precision->SetString( 1, _( "3:3" ) );
|
||||||
}
|
}
|
||||||
|
@ -439,12 +455,14 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions(wxCommandEvent& event)
|
||||||
m_Choice_Precision->Enable( true );
|
m_Choice_Precision->Enable( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
int WinEDA_DrillFrame::Gen_Drill_File_EXCELLON( FORET* buffer )
|
int WinEDA_DrillFrame::Gen_Drill_File_EXCELLON( FORET* buffer )
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* Create the drill file in EXECELLON format
|
/* Create the drill file in EXECELLON format
|
||||||
Return hole count
|
* Return hole count
|
||||||
buffer: Drill tools list
|
* buffer: Drill tools list
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
FORET* foret;
|
FORET* foret;
|
||||||
|
@ -468,16 +486,21 @@ char line[1024];
|
||||||
pt_piste = m_Parent->m_Pcb->m_Track;
|
pt_piste = m_Parent->m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
||||||
{
|
{
|
||||||
if(pt_piste->Type() != TYPEVIA) continue;
|
if( pt_piste->Type() != TYPEVIA )
|
||||||
if ( pt_piste->m_Drill == 0 ) continue;
|
continue;
|
||||||
int via_drill = ( pt_piste->m_Drill < 0 ) ? g_DesignSettings.m_ViaDrill : pt_piste->m_Drill;
|
if( pt_piste->m_Drill == 0 )
|
||||||
|
continue;
|
||||||
|
int via_drill = ( pt_piste->m_Drill <
|
||||||
|
0 ) ? g_DesignSettings.m_ViaDrill : pt_piste->m_Drill;
|
||||||
if( foret->m_Diameter != via_drill )
|
if( foret->m_Diameter != via_drill )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
x0 = pt_piste->m_Start.x - File_Drill_Offset.x;
|
x0 = pt_piste->m_Start.x - File_Drill_Offset.x;
|
||||||
y0 = pt_piste->m_Start.y - File_Drill_Offset.y;
|
y0 = pt_piste->m_Start.y - File_Drill_Offset.y;
|
||||||
|
|
||||||
//<ryan's edit>
|
//<ryan's edit>
|
||||||
if (!Mirror) y0 *= -1;
|
if( !Mirror )
|
||||||
|
y0 *= -1;
|
||||||
|
|
||||||
xt = float (x0) * conv_unit; yt = float (y0) * conv_unit;
|
xt = float (x0) * conv_unit; yt = float (y0) * conv_unit;
|
||||||
if( Unit_Drill_is_Inch )
|
if( Unit_Drill_is_Inch )
|
||||||
|
@ -486,7 +509,8 @@ char line[1024];
|
||||||
}
|
}
|
||||||
//</ryan's edit>
|
//</ryan's edit>
|
||||||
else
|
else
|
||||||
{ /* metric 3:3 */
|
{
|
||||||
|
/* metric 3:3 */
|
||||||
Gen_Line_EXCELLON( line, xt * 10, yt * 10 );
|
Gen_Line_EXCELLON( line, xt * 10, yt * 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,16 +530,21 @@ char line[1024];
|
||||||
pt_pad = (D_PAD*) Module->m_Pads;
|
pt_pad = (D_PAD*) Module->m_Pads;
|
||||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
||||||
{
|
{
|
||||||
if ( pt_pad->m_DrillShape != CIRCLE ) continue;
|
if( pt_pad->m_DrillShape != CIRCLE )
|
||||||
|
continue;
|
||||||
diam = pt_pad->m_Drill.x;
|
diam = pt_pad->m_Drill.x;
|
||||||
if ( diam == 0 ) continue;
|
if( diam == 0 )
|
||||||
if(diam != foret->m_Diameter) continue;
|
continue;
|
||||||
|
if( diam != foret->m_Diameter )
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Compute the hole coordinates: */
|
/* Compute the hole coordinates: */
|
||||||
x0 = pt_pad->m_Pos.x - File_Drill_Offset.x;
|
x0 = pt_pad->m_Pos.x - File_Drill_Offset.x;
|
||||||
y0 = pt_pad->m_Pos.y - File_Drill_Offset.y;
|
y0 = pt_pad->m_Pos.y - File_Drill_Offset.y;
|
||||||
|
|
||||||
//<ryan's edit>
|
//<ryan's edit>
|
||||||
if (!Mirror) y0 *= -1;
|
if( !Mirror )
|
||||||
|
y0 *= -1;
|
||||||
|
|
||||||
xt = float (x0) * conv_unit; yt = float (y0) * conv_unit;
|
xt = float (x0) * conv_unit; yt = float (y0) * conv_unit;
|
||||||
if( Unit_Drill_is_Inch )
|
if( Unit_Drill_is_Inch )
|
||||||
|
@ -526,8 +555,12 @@ char line[1024];
|
||||||
to_point( line ); // Internationalization compensation (, to . for floats)
|
to_point( line ); // Internationalization compensation (, to . for floats)
|
||||||
fputs( line, dest );
|
fputs( line, dest );
|
||||||
nb_trous++;
|
nb_trous++;
|
||||||
} /* Fin examen 1 module */
|
}
|
||||||
} /* Fin 1 passe de foret */
|
|
||||||
|
/* Fin examen 1 module */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fin 1 passe de foret */
|
||||||
|
|
||||||
/* Read pad list and create Drill infos for oblong holes only: */
|
/* Read pad list and create Drill infos for oblong holes only: */
|
||||||
Module = m_Parent->m_Pcb->m_Modules;
|
Module = m_Parent->m_Pcb->m_Modules;
|
||||||
|
@ -537,11 +570,14 @@ char line[1024];
|
||||||
pt_pad = (D_PAD*) Module->m_Pads;
|
pt_pad = (D_PAD*) Module->m_Pads;
|
||||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
||||||
{
|
{
|
||||||
if ( pt_pad->m_DrillShape != OVALE ) continue;
|
if( pt_pad->m_DrillShape != OVALE )
|
||||||
|
continue;
|
||||||
|
|
||||||
diam = MIN( pt_pad->m_Drill.x, pt_pad->m_Drill.y );
|
diam = MIN( pt_pad->m_Drill.x, pt_pad->m_Drill.y );
|
||||||
if ( diam == 0 ) continue;
|
if( diam == 0 )
|
||||||
if(diam != foret->m_Diameter) continue;
|
continue;
|
||||||
|
if( diam != foret->m_Diameter )
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Compute the hole coordinates: */
|
/* Compute the hole coordinates: */
|
||||||
xc = x0 = xf = pt_pad->m_Pos.x - File_Drill_Offset.x;
|
xc = x0 = xf = pt_pad->m_Pos.x - File_Drill_Offset.x;
|
||||||
|
@ -560,8 +596,12 @@ char line[1024];
|
||||||
}
|
}
|
||||||
RotatePoint( &x0, &y0, xc, yc, pt_pad->m_Orient );
|
RotatePoint( &x0, &y0, xc, yc, pt_pad->m_Orient );
|
||||||
RotatePoint( &xf, &yf, xc, yc, pt_pad->m_Orient );
|
RotatePoint( &xf, &yf, xc, yc, pt_pad->m_Orient );
|
||||||
|
|
||||||
//<ryan's edit>
|
//<ryan's edit>
|
||||||
if (!Mirror) { y0 *= -1; yf *= -1; }
|
if( !Mirror )
|
||||||
|
{
|
||||||
|
y0 *= -1; yf *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
// sprintf(line,"T%d\n",ii+1); fputs(line,dest);
|
// sprintf(line,"T%d\n",ii+1); fputs(line,dest);
|
||||||
|
|
||||||
|
@ -575,6 +615,7 @@ char line[1024];
|
||||||
for( int kk = 0; line[kk] != 0; kk++ )
|
for( int kk = 0; line[kk] != 0; kk++ )
|
||||||
if( line[kk] == '\n' || line[kk] =='\r' )
|
if( line[kk] == '\n' || line[kk] =='\r' )
|
||||||
line[kk] = 0;
|
line[kk] = 0;
|
||||||
|
|
||||||
fputs( line, dest );
|
fputs( line, dest );
|
||||||
|
|
||||||
fputs( "G85", dest );
|
fputs( "G85", dest );
|
||||||
|
@ -587,13 +628,20 @@ char line[1024];
|
||||||
to_point( line ); fputs( line, dest );
|
to_point( line ); fputs( line, dest );
|
||||||
fputs( "G05\n", dest );
|
fputs( "G05\n", dest );
|
||||||
nb_trous++;
|
nb_trous++;
|
||||||
} /* Fin examen 1 module */
|
|
||||||
} /* fin analyse des trous de modules pour le foret en cours*/
|
|
||||||
} /* fin analyse des forets */
|
|
||||||
|
|
||||||
return(nb_trous);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fin examen 1 module */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fin analyse des trous de modules pour le foret en cours*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fin analyse des forets */
|
||||||
|
|
||||||
|
return nb_trous;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
void WinEDA_DrillFrame::Gen_Line_EXCELLON( char* line, float x, float y )
|
void WinEDA_DrillFrame::Gen_Line_EXCELLON( char* line, float x, float y )
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
@ -601,6 +649,7 @@ void WinEDA_DrillFrame::Gen_Line_EXCELLON(char *line, float x, float y)
|
||||||
wxString xs, ys;
|
wxString xs, ys;
|
||||||
int xpad = s_Precision.m_lhs + s_Precision.m_rhs;
|
int xpad = s_Precision.m_lhs + s_Precision.m_rhs;
|
||||||
int ypad = xpad;
|
int ypad = xpad;
|
||||||
|
|
||||||
/* I need to come up with an algorithm that handles any lhs:rhs format.*/
|
/* I need to come up with an algorithm that handles any lhs:rhs format.*/
|
||||||
/* one idea is to take more inputs for xpad/ypad when metric is used. */
|
/* one idea is to take more inputs for xpad/ypad when metric is used. */
|
||||||
|
|
||||||
|
@ -613,24 +662,35 @@ void WinEDA_DrillFrame::Gen_Line_EXCELLON(char *line, float x, float y)
|
||||||
|
|
||||||
case SUPPRESS_LEADING: /* that should work now */
|
case SUPPRESS_LEADING: /* that should work now */
|
||||||
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
||||||
{ x*=10; y*=10; }
|
{
|
||||||
|
x *= 10; y *= 10;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf( line, "X%dY%d\n", (int) round( x ), (int) round( y ) );
|
sprintf( line, "X%dY%d\n", (int) round( x ), (int) round( y ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SUPPRESS_TRAILING:
|
case SUPPRESS_TRAILING:
|
||||||
{
|
{
|
||||||
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
||||||
{ x *= 10; y*=10; }
|
{
|
||||||
if (x<0)xpad++;
|
x *= 10; y *= 10;
|
||||||
if (y<0)ypad++;
|
}
|
||||||
|
|
||||||
|
if( x<0 )
|
||||||
|
xpad++;
|
||||||
|
if( y<0 )
|
||||||
|
ypad++;
|
||||||
|
|
||||||
xs.Printf( wxT( "%0*d" ), xpad, (int) round( x ) );
|
xs.Printf( wxT( "%0*d" ), xpad, (int) round( x ) );
|
||||||
ys.Printf( wxT( "%0*d" ), ypad, (int) round( y ) );
|
ys.Printf( wxT( "%0*d" ), ypad, (int) round( y ) );
|
||||||
|
|
||||||
size_t j = xs.Len() - 1;
|
size_t j = xs.Len() - 1;
|
||||||
while (xs[j] == '0' && j) xs.Truncate(j--);
|
while( xs[j] == '0' && j )
|
||||||
|
xs.Truncate( j-- );
|
||||||
|
|
||||||
j = ys.Len() - 1;
|
j = ys.Len() - 1;
|
||||||
while (ys[j] == '0' && j) ys.Truncate(j--);
|
while( ys[j] == '0' && j )
|
||||||
|
ys.Truncate( j-- );
|
||||||
|
|
||||||
sprintf( line, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) );
|
sprintf( line, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) );
|
||||||
break;
|
break;
|
||||||
|
@ -638,28 +698,37 @@ void WinEDA_DrillFrame::Gen_Line_EXCELLON(char *line, float x, float y)
|
||||||
|
|
||||||
case KEEP_ZEROS:
|
case KEEP_ZEROS:
|
||||||
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
for( int i = 0; i< s_Precision.m_rhs; i++ )
|
||||||
{ x *= 10; y*=10; }
|
{
|
||||||
if (x<0)xpad++;
|
x *= 10; y *= 10;
|
||||||
if (y<0)ypad++;
|
}
|
||||||
|
|
||||||
|
if( x<0 )
|
||||||
|
xpad++;
|
||||||
|
if( y<0 )
|
||||||
|
ypad++;
|
||||||
xs.Printf( wxT( "%0*d" ), xpad, (int) round( x ) );
|
xs.Printf( wxT( "%0*d" ), xpad, (int) round( x ) );
|
||||||
ys.Printf( wxT( "%0*d" ), ypad, (int) round( y ) );
|
ys.Printf( wxT( "%0*d" ), ypad, (int) round( y ) );
|
||||||
sprintf( line, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) );
|
sprintf( line, "X%sY%s\n", CONV_TO_UTF8( xs ), CONV_TO_UTF8( ys ) );
|
||||||
break;
|
break;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
/***************************************************/
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
FORET* GetOrAddForet( FORET* buffer, int diameter )
|
FORET* GetOrAddForet( FORET* buffer, int diameter )
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
/* Search the drill tool for the diameter "diameter"
|
/* Search the drill tool for the diameter "diameter"
|
||||||
Create a new one if not found
|
* Create a new one if not found
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
FORET* foret;
|
FORET* foret;
|
||||||
|
|
||||||
if(diameter == 0) return NULL;
|
if( diameter == 0 )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Search for an existing tool: */
|
/* Search for an existing tool: */
|
||||||
for( ii = 0, foret = buffer; ii < DrillToolsCount; ii++, foret++ )
|
for( ii = 0, foret = buffer; ii < DrillToolsCount; ii++, foret++ )
|
||||||
|
@ -676,22 +745,25 @@ FORET * foret;
|
||||||
return foret;
|
return foret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Sort function by drill value */
|
/* Sort function by drill value */
|
||||||
int Sort_by_Drill_Value( void* foret1, void* foret2 )
|
int Sort_by_Drill_Value( void* foret1, void* foret2 )
|
||||||
{
|
{
|
||||||
return( ((FORET*)foret1)->m_Diameter - ((FORET*)foret2)->m_Diameter);
|
return ( (FORET*) foret1 )->m_Diameter - ( (FORET*) foret2 )->m_Diameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
int WinEDA_DrillFrame::Gen_Liste_Forets( FORET* buffer, bool print_header )
|
int WinEDA_DrillFrame::Gen_Liste_Forets( FORET* buffer, bool print_header )
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* Etablit la liste des forets de percage, dans l'ordre croissant des
|
|
||||||
diametres
|
|
||||||
Retourne:
|
|
||||||
Nombre de Forets
|
|
||||||
|
|
||||||
Mise a jour: DrillToolsCount = nombre de forets differents
|
/* Etablit la liste des forets de percage, dans l'ordre croissant des
|
||||||
Genere une liste de DrillToolsCount structures FORET a partir de buffer
|
* diametres
|
||||||
|
* Retourne:
|
||||||
|
* Nombre de Forets
|
||||||
|
*
|
||||||
|
* Mise a jour: DrillToolsCount = nombre de forets differents
|
||||||
|
* Genere une liste de DrillToolsCount structures FORET a partir de buffer
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
FORET* foret;
|
FORET* foret;
|
||||||
|
@ -706,13 +778,16 @@ char line[1024];
|
||||||
TRACK* pt_piste = m_Parent->m_Pcb->m_Track;
|
TRACK* pt_piste = m_Parent->m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
||||||
{
|
{
|
||||||
if(pt_piste->Type() != TYPEVIA) continue;
|
if( pt_piste->Type() != TYPEVIA )
|
||||||
if ( pt_piste->m_Drill == 0 ) continue;
|
continue;
|
||||||
|
if( pt_piste->m_Drill == 0 )
|
||||||
|
continue;
|
||||||
int via_drill = g_DesignSettings.m_ViaDrill;
|
int via_drill = g_DesignSettings.m_ViaDrill;
|
||||||
if( pt_piste->m_Drill > 0 ) // Drill value is not the default value
|
if( pt_piste->m_Drill > 0 ) // Drill value is not the default value
|
||||||
via_drill = pt_piste->m_Drill;
|
via_drill = pt_piste->m_Drill;
|
||||||
foret = GetOrAddForet( buffer, via_drill );
|
foret = GetOrAddForet( buffer, via_drill );
|
||||||
if ( foret ) foret->m_TotalCount++;
|
if( foret )
|
||||||
|
foret->m_TotalCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the pad tools : */
|
/* Create the pad tools : */
|
||||||
|
@ -725,17 +800,22 @@ char line[1024];
|
||||||
{
|
{
|
||||||
if( pt_pad->m_DrillShape == CIRCLE )
|
if( pt_pad->m_DrillShape == CIRCLE )
|
||||||
diam = pt_pad->m_Drill.x;
|
diam = pt_pad->m_Drill.x;
|
||||||
else diam = MIN (pt_pad->m_Drill.x, pt_pad->m_Drill.y);
|
else
|
||||||
|
diam = MIN( pt_pad->m_Drill.x, pt_pad->m_Drill.y );
|
||||||
|
|
||||||
if(diam == 0) continue;
|
if( diam == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
foret = GetOrAddForet( buffer, diam );
|
foret = GetOrAddForet( buffer, diam );
|
||||||
if( foret )
|
if( foret )
|
||||||
{
|
{
|
||||||
foret->m_TotalCount++;
|
foret->m_TotalCount++;
|
||||||
if ( pt_pad->m_DrillShape == OVALE )foret->m_OvalCount++;
|
if( pt_pad->m_DrillShape == OVALE )
|
||||||
|
foret->m_OvalCount++;
|
||||||
}
|
}
|
||||||
} /* Fin examen 1 module */
|
}
|
||||||
|
|
||||||
|
/* Fin examen 1 module */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tri des forets par ordre de diametre croissant */
|
/* tri des forets par ordre de diametre croissant */
|
||||||
|
@ -754,19 +834,24 @@ char line[1024];
|
||||||
else
|
else
|
||||||
sprintf( line, "T%dC%.3f\n", ii + 1,
|
sprintf( line, "T%dC%.3f\n", ii + 1,
|
||||||
float (foret->m_Diameter) * conv_unit * 10.0 );
|
float (foret->m_Diameter) * conv_unit * 10.0 );
|
||||||
|
|
||||||
//</ryan's edit>
|
//</ryan's edit>
|
||||||
to_point( line );
|
to_point( line );
|
||||||
fputs( line, dest );
|
fputs( line, dest );
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs( "%\n", dest );
|
fputs( "%\n", dest );
|
||||||
if (!Minimal) fputs("M47\n",dest); /* Operator message */
|
if( !Minimal )
|
||||||
|
fputs( "M47\n", dest ); /* Operator message */
|
||||||
fputs( "G05\n", dest ); /* Drill mode */
|
fputs( "G05\n", dest ); /* Drill mode */
|
||||||
/* Units : */
|
/* Units : */
|
||||||
if (Unit_Drill_is_Inch && !Minimal) fputs("M72\n",dest); /* M72 = inch mode */
|
if( Unit_Drill_is_Inch && !Minimal )
|
||||||
else if (!Minimal) fputs("M71\n",dest); /* M71 = metric mode */
|
fputs( "M72\n", dest ); /* M72 = inch mode */
|
||||||
|
else if( !Minimal )
|
||||||
|
fputs( "M71\n", dest ); /* M71 = metric mode */
|
||||||
}
|
}
|
||||||
|
|
||||||
return(DrillToolsCount);
|
return DrillToolsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -793,8 +878,10 @@ char Line[256];
|
||||||
fputs( "R,T\nVER,1\nFMAT,2\n", dest );
|
fputs( "R,T\nVER,1\nFMAT,2\n", dest );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Unit_Drill_is_Inch ) fputs("INCH",dest); // Si unites en INCHES
|
if( Unit_Drill_is_Inch )
|
||||||
else fputs("METRIC",dest); // Si unites en mm
|
fputs( "INCH", dest ); // Si unites en INCHES
|
||||||
|
else
|
||||||
|
fputs( "METRIC", dest ); // Si unites en mm
|
||||||
|
|
||||||
switch( s_Zeros_Format )
|
switch( s_Zeros_Format )
|
||||||
{
|
{
|
||||||
|
@ -810,16 +897,16 @@ char Line[256];
|
||||||
case KEEP_ZEROS:
|
case KEEP_ZEROS:
|
||||||
fputs( ",TZ\n", dest ); // TZ is acceptable when all zeros are kept
|
fputs( ",TZ\n", dest ); // TZ is acceptable when all zeros are kept
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Minimal )
|
if( !Minimal )
|
||||||
fputs( "TCST,OFF\nICI,OFF\nATC,ON\n", dest );
|
fputs( "TCST,OFF\nICI,OFF\nATC,ON\n", dest );
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************/
|
|
||||||
void Fin_Drill()
|
/*****************************/
|
||||||
/************************/
|
void Write_End_Of_File_Drill()
|
||||||
|
/*****************************/
|
||||||
{
|
{
|
||||||
//add if minimal here
|
//add if minimal here
|
||||||
fputs( "T0\nM30\n", dest ); fclose( dest );
|
fputs( "T0\nM30\n", dest ); fclose( dest );
|
||||||
|
@ -829,6 +916,7 @@ void Fin_Drill()
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
void WinEDA_DrillFrame::GenDrillMap( int format )
|
void WinEDA_DrillFrame::GenDrillMap( int format )
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
|
||||||
/* Genere le plan de percage (Drill map) format HPGL ou POSTSCRIPT
|
/* Genere le plan de percage (Drill map) format HPGL ou POSTSCRIPT
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -880,7 +968,8 @@ wxString msg;
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
TRUE
|
TRUE
|
||||||
);
|
);
|
||||||
if ( FullFileName.IsEmpty()) return;
|
if( FullFileName.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
g_PlotOrient = 0;
|
g_PlotOrient = 0;
|
||||||
/* calcul des dimensions et centre du PCB */
|
/* calcul des dimensions et centre du PCB */
|
||||||
|
@ -996,7 +1085,7 @@ wxString msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWidth = (int)(50 * scale_x); // Set Drill Symbols width
|
TextWidth = 50; // Set Drill Symbols width in 1/10000 mils
|
||||||
|
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
{
|
{
|
||||||
|
@ -1009,8 +1098,9 @@ wxString msg;
|
||||||
Affiche_1_Parametre( m_Parent, 64, _( "Drill" ), msg, GREEN );
|
Affiche_1_Parametre( m_Parent, 64, _( "Drill" ), msg, GREEN );
|
||||||
|
|
||||||
/* Impression de la liste des symboles utilises */
|
/* Impression de la liste des symboles utilises */
|
||||||
CharSize = 600; /* hauteur des textes en 1/10000 mils */
|
CharSize = 800; /* text size in 1/10000 mils */
|
||||||
float CharScale = 1.0;
|
float CharScale = 1.0 / scale_x; /* real scale will be CharScale * scale_x,
|
||||||
|
* because the global plot scale is scale_x */
|
||||||
TextWidth = (int) (50 * CharScale); // Set text width
|
TextWidth = (int) (50 * CharScale); // Set text width
|
||||||
intervalle = (int) (CharSize * CharScale) + TextWidth;
|
intervalle = (int) (CharSize * CharScale) + TextWidth;
|
||||||
|
|
||||||
|
@ -1031,9 +1121,11 @@ wxString msg;
|
||||||
sprintf( line, "%d setlinewidth\n", TextWidth );
|
sprintf( line, "%d setlinewidth\n", TextWidth );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: *line = 0;
|
default:
|
||||||
|
*line = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs( line, dest );
|
fputs( line, dest );
|
||||||
|
|
||||||
switch( format )
|
switch( format )
|
||||||
|
@ -1058,6 +1150,9 @@ wxString msg;
|
||||||
x = plotX; y = plotY;
|
x = plotX; y = plotY;
|
||||||
x = +g_PlotOffset.x + (int) (x * fTextScale);
|
x = +g_PlotOffset.x + (int) (x * fTextScale);
|
||||||
y = g_PlotOffset.y - (int) (y * fTextScale);
|
y = g_PlotOffset.y - (int) (y * fTextScale);
|
||||||
|
|
||||||
|
plotY += (int) ( intervalle * 1.2) + 200;
|
||||||
|
|
||||||
switch( format )
|
switch( format )
|
||||||
{
|
{
|
||||||
case PLOT_FORMAT_HPGL:
|
case PLOT_FORMAT_HPGL:
|
||||||
|
@ -1076,14 +1171,14 @@ wxString msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
plotY += (int)( intervalle * 1.2) + 200;
|
|
||||||
|
|
||||||
for( ii = 0, foret = (FORET*) adr_lowmem; ii < DrillToolsCount; ii++, foret++ )
|
for( ii = 0, foret = (FORET*) adr_lowmem; ii < DrillToolsCount; ii++, foret++ )
|
||||||
{
|
{
|
||||||
int plot_diam;
|
int plot_diam;
|
||||||
if ( foret->m_TotalCount == 0 ) continue;
|
if( foret->m_TotalCount == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
plot_diam = (int)(foret->m_Diameter * scale_x);
|
plot_diam = (int) (foret->m_Diameter);
|
||||||
x = plotX; y = plotY;
|
x = plotX; y = plotY;
|
||||||
x = -g_PlotOffset.x + (int) (x * fTextScale);
|
x = -g_PlotOffset.x + (int) (x * fTextScale);
|
||||||
y = g_PlotOffset.y - (int) (y * fTextScale);
|
y = g_PlotOffset.y - (int) (y * fTextScale);
|
||||||
|
@ -1092,7 +1187,8 @@ wxString msg;
|
||||||
intervalle = (int) (CharSize * CharScale) + TextWidth;
|
intervalle = (int) (CharSize * CharScale) + TextWidth;
|
||||||
intervalle = (int) ( intervalle * 1.2);
|
intervalle = (int) ( intervalle * 1.2);
|
||||||
|
|
||||||
if ( intervalle < (plot_diam + 200 + TextWidth) ) intervalle = plot_diam + 200 + TextWidth;
|
if( intervalle < (plot_diam + 200 + TextWidth) )
|
||||||
|
intervalle = plot_diam + 200 + TextWidth;
|
||||||
|
|
||||||
int rayon = plot_diam / 2;
|
int rayon = plot_diam / 2;
|
||||||
x = plotX + rayon + (int) (CharSize * CharScale); y = plotY;
|
x = plotX + rayon + (int) (CharSize * CharScale); y = plotY;
|
||||||
|
@ -1103,6 +1199,7 @@ wxString msg;
|
||||||
switch( format )
|
switch( format )
|
||||||
{
|
{
|
||||||
case PLOT_FORMAT_HPGL:
|
case PLOT_FORMAT_HPGL:
|
||||||
|
|
||||||
// List the diameter of each drill in the selected Drill Unit,
|
// List the diameter of each drill in the selected Drill Unit,
|
||||||
// and then its diameter in the other Drill Unit.
|
// and then its diameter in the other Drill Unit.
|
||||||
if( Unit_Drill_is_Inch )
|
if( Unit_Drill_is_Inch )
|
||||||
|
@ -1118,6 +1215,7 @@ wxString msg;
|
||||||
float (foret->m_Diameter) * 0.00254,
|
float (foret->m_Diameter) * 0.00254,
|
||||||
float (foret->m_Diameter) * 0.0001 );
|
float (foret->m_Diameter) * 0.0001 );
|
||||||
fputs( line, dest );
|
fputs( line, dest );
|
||||||
|
|
||||||
// Now list how many holes and ovals are associated with each drill.
|
// Now list how many holes and ovals are associated with each drill.
|
||||||
if( ( foret->m_TotalCount == 1 ) && ( foret->m_OvalCount == 0 ) )
|
if( ( foret->m_TotalCount == 1 ) && ( foret->m_OvalCount == 0 ) )
|
||||||
sprintf( line, "(1 hole)\n" );
|
sprintf( line, "(1 hole)\n" );
|
||||||
|
@ -1138,6 +1236,7 @@ wxString msg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLOT_FORMAT_POST:
|
case PLOT_FORMAT_POST:
|
||||||
|
|
||||||
// List the diameter of each drill in the selected Drill Unit,
|
// List the diameter of each drill in the selected Drill Unit,
|
||||||
// and then its diameter in the other Drill Unit.
|
// and then its diameter in the other Drill Unit.
|
||||||
if( Unit_Drill_is_Inch )
|
if( Unit_Drill_is_Inch )
|
||||||
|
@ -1149,6 +1248,7 @@ wxString msg;
|
||||||
float (foret->m_Diameter) * 0.00254,
|
float (foret->m_Diameter) * 0.00254,
|
||||||
float (foret->m_Diameter) * 0.0001 );
|
float (foret->m_Diameter) * 0.0001 );
|
||||||
msg = CONV_FROM_UTF8( line );
|
msg = CONV_FROM_UTF8( line );
|
||||||
|
|
||||||
// Now list how many holes and ovals are associated with each drill.
|
// Now list how many holes and ovals are associated with each drill.
|
||||||
if( ( foret->m_TotalCount == 1 ) && ( foret->m_OvalCount == 0 ) )
|
if( ( foret->m_TotalCount == 1 ) && ( foret->m_OvalCount == 0 ) )
|
||||||
sprintf( line, "(1 hole)" );
|
sprintf( line, "(1 hole)" );
|
||||||
|
@ -1176,6 +1276,7 @@ wxString msg;
|
||||||
plotY += intervalle;
|
plotY += intervalle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch( format )
|
switch( format )
|
||||||
{
|
{
|
||||||
case PLOT_FORMAT_HPGL:
|
case PLOT_FORMAT_HPGL:
|
||||||
|
@ -1186,6 +1287,7 @@ wxString msg;
|
||||||
CloseFilePS( dest );
|
CloseFilePS( dest );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_PlotOrient = old_g_PlotOrient;
|
g_PlotOrient = old_g_PlotOrient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1193,11 +1295,11 @@ wxString msg;
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
int WinEDA_DrillFrame::Plot_Drill_PcbMap( FORET* buffer, int format )
|
int WinEDA_DrillFrame::Plot_Drill_PcbMap( FORET* buffer, int format )
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Trace la liste des trous a percer en format HPGL ou POSTSCRIPT
|
|
||||||
Retourne:
|
/** Trace la liste des trous a percer en format HPGL ou POSTSCRIPT
|
||||||
Nombre de trous
|
* @return drill count
|
||||||
Utilise:
|
* @param buffer = drill list buffer
|
||||||
liste des forets pointee par buffer
|
* @param format = ouput format (hpgl / ps)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
FORET* foret;
|
FORET* foret;
|
||||||
|
@ -1214,7 +1316,9 @@ wxSize size;
|
||||||
if( DrillToolsCount > 13 )
|
if( DrillToolsCount > 13 )
|
||||||
{
|
{
|
||||||
DisplayInfo( this,
|
DisplayInfo( this,
|
||||||
_(" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values"), 10);
|
_(
|
||||||
|
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
|
||||||
|
10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ii = 0, foret = (FORET*) buffer; ii < DrillToolsCount; ii++, foret++ )
|
for( ii = 0, foret = (FORET*) buffer; ii < DrillToolsCount; ii++, foret++ )
|
||||||
|
@ -1224,11 +1328,14 @@ wxSize size;
|
||||||
pt_piste = m_Parent->m_Pcb->m_Track;
|
pt_piste = m_Parent->m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
||||||
{
|
{
|
||||||
if(pt_piste->Type() != TYPEVIA) continue;
|
if( pt_piste->Type() != TYPEVIA )
|
||||||
if(pt_piste->m_Drill == 0) continue;
|
continue;
|
||||||
|
if( pt_piste->m_Drill == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
int via_drill = g_DesignSettings.m_ViaDrill;
|
int via_drill = g_DesignSettings.m_ViaDrill;
|
||||||
if (pt_piste->m_Drill >= 0) via_drill = pt_piste->m_Drill;
|
if( pt_piste->m_Drill >= 0 )
|
||||||
|
via_drill = pt_piste->m_Drill;
|
||||||
pos = pt_piste->m_Start;
|
pos = pt_piste->m_Start;
|
||||||
PlotDrillSymbol( pos, via_drill, ii, format );
|
PlotDrillSymbol( pos, via_drill, ii, format );
|
||||||
|
|
||||||
|
@ -1245,43 +1352,55 @@ wxSize size;
|
||||||
{
|
{
|
||||||
case CIRCLE:
|
case CIRCLE:
|
||||||
diam = pt_pad->m_Drill.x;
|
diam = pt_pad->m_Drill.x;
|
||||||
if(diam != foret->m_Diameter) continue;
|
if( diam != foret->m_Diameter )
|
||||||
|
continue;
|
||||||
PlotDrillSymbol( pt_pad->m_Pos, diam, ii, format );
|
PlotDrillSymbol( pt_pad->m_Pos, diam, ii, format );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OVALE:
|
case OVALE:
|
||||||
if ( pt_pad->m_DrillShape != OVALE ) continue;
|
if( pt_pad->m_DrillShape != OVALE )
|
||||||
|
continue;
|
||||||
diam = MIN( pt_pad->m_Drill.x, pt_pad->m_Drill.y );
|
diam = MIN( pt_pad->m_Drill.x, pt_pad->m_Drill.y );
|
||||||
if(diam != foret->m_Diameter) continue;
|
if( diam != foret->m_Diameter )
|
||||||
|
continue;
|
||||||
PlotOvalDrillSymbol( pt_pad->m_Pos, pt_pad->m_Drill, pt_pad->m_Orient, format );
|
PlotOvalDrillSymbol( pt_pad->m_Pos, pt_pad->m_Drill, pt_pad->m_Orient, format );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nb_trous++;
|
nb_trous++;
|
||||||
} /* Fin examen 1 module */
|
}
|
||||||
} /* Fin 1 passe de foret */
|
|
||||||
} /* fin analyse des trous de modules */
|
|
||||||
|
|
||||||
return(nb_trous);
|
/* Fin examen 1 module */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fin 1 passe de foret */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fin analyse des trous de modules */
|
||||||
|
|
||||||
|
return nb_trous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int format )
|
void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int format )
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
|
||||||
/* Trace un motif de numero de forme num_forme, aux coord x0, y0.
|
/* Trace un motif de numero de forme num_forme, aux coord x0, y0.
|
||||||
x0, y0 = coordonnees tables
|
* x0, y0 = coordonnees tables
|
||||||
diametre = diametre (coord table) du trou
|
* diametre = diametre (coord table) du trou
|
||||||
num_forme = index ( permet de gererer des formes caract )
|
* num_forme = index ( permet de gererer des formes caract )
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int rayon = diametre / 2;
|
int rayon = diametre / 2;
|
||||||
|
|
||||||
void (*FctPlume)( wxPoint pos, int state );
|
void (*FctPlume)( wxPoint pos, int state );
|
||||||
int x0, y0;
|
int x0, y0;
|
||||||
|
|
||||||
x0 = position.x; y0 = position.y;
|
x0 = position.x; y0 = position.y;
|
||||||
FctPlume = Move_Plume_HPGL;
|
FctPlume = Move_Plume_HPGL;
|
||||||
if(format == PLOT_FORMAT_POST) FctPlume = LineTo_PS;
|
if( format == PLOT_FORMAT_POST )
|
||||||
|
FctPlume = LineTo_PS;
|
||||||
|
|
||||||
switch( num_forme )
|
switch( num_forme )
|
||||||
{
|
{
|
||||||
|
@ -1337,16 +1456,24 @@ int x0, y0;
|
||||||
|
|
||||||
case 6: /* forme en carre */
|
case 6: /* forme en carre */
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: /* forme en losange */
|
case 7: /* forme en losange */
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: /* forme en carre barre par un X*/
|
case 8: /* forme en carre barre par un X*/
|
||||||
|
@ -1355,9 +1482,13 @@ int x0, y0;
|
||||||
FctPlume( wxPoint( x0 + rayon, y0 - rayon ), 'U' );
|
FctPlume( wxPoint( x0 + rayon, y0 - rayon ), 'U' );
|
||||||
FctPlume( wxPoint( x0 - rayon, y0 + rayon ), 'D' );
|
FctPlume( wxPoint( x0 - rayon, y0 + rayon ), 'D' );
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: /* forme en losange barre par un +*/
|
case 9: /* forme en losange barre par un +*/
|
||||||
|
@ -1366,36 +1497,52 @@ int x0, y0;
|
||||||
FctPlume( wxPoint( x0 + rayon, y0 ), 'U' );
|
FctPlume( wxPoint( x0 + rayon, y0 ), 'U' );
|
||||||
FctPlume( wxPoint( x0 - rayon, y0 ), 'D' );
|
FctPlume( wxPoint( x0 - rayon, y0 ), 'D' );
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE);
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE);
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10: /* forme en carre barre par un '/' */
|
case 10: /* forme en carre barre par un '/' */
|
||||||
FctPlume( wxPoint( x0 - rayon, y0 - rayon ), 'U' );
|
FctPlume( wxPoint( x0 - rayon, y0 - rayon ), 'U' );
|
||||||
FctPlume( wxPoint( x0 + rayon, y0 + rayon ), 'D' );
|
FctPlume( wxPoint( x0 + rayon, y0 + rayon ), 'D' );
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 0, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 0,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11: /* forme en losange barre par un |*/
|
case 11: /* forme en losange barre par un |*/
|
||||||
FctPlume( wxPoint( x0, y0 - rayon ), 'U' );
|
FctPlume( wxPoint( x0, y0 - rayon ), 'U' );
|
||||||
FctPlume( wxPoint( x0, y0 + rayon ), 'D' );
|
FctPlume( wxPoint( x0, y0 + rayon ), 'D' );
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12: /* forme en losange barre par un -*/
|
case 12: /* forme en losange barre par un -*/
|
||||||
FctPlume( wxPoint( x0 - rayon, y0 ), 'U' );
|
FctPlume( wxPoint( x0 - rayon, y0 ), 'U' );
|
||||||
FctPlume( wxPoint( x0 + rayon, y0 ), 'D' );
|
FctPlume( wxPoint( x0 + rayon, y0 ), 'D' );
|
||||||
if( format == PLOT_FORMAT_HPGL )
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
trace_1_pad_TRAPEZE_HPGL(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
if( format == PLOT_FORMAT_POST )
|
if( format == PLOT_FORMAT_POST )
|
||||||
trace_1_pad_TRAPEZE_POST(wxPoint(x0,y0),wxSize(rayon, rayon),wxSize(0,0), 450, FILAIRE) ;
|
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
|
||||||
|
0 ), 450,
|
||||||
|
FILAIRE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1405,7 +1552,9 @@ int x0, y0;
|
||||||
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
|
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( format == PLOT_FORMAT_HPGL) Plume_HPGL('U');
|
|
||||||
|
if( format == PLOT_FORMAT_HPGL )
|
||||||
|
Plume_HPGL( 'U' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1425,11 +1574,13 @@ void PlotOvalDrillSymbol(const wxPoint & position,const wxSize & size,int orient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
void WinEDA_DrillFrame::GenDrillReport()
|
void WinEDA_DrillFrame::GenDrillReport()
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a list of drill values and drill count
|
* Create a list of drill values and drill count
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString FileName, Mask( wxT( "*" ) ), Ext( wxT( ".rpt" ) );
|
wxString FileName, Mask( wxT( "*" ) ), Ext( wxT( ".rpt" ) );
|
||||||
|
@ -1451,7 +1602,8 @@ wxString msg;
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
TRUE
|
TRUE
|
||||||
);
|
);
|
||||||
if ( FileName.IsEmpty()) return;
|
if( FileName.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
dest = wxFopen( FileName, wxT( "w" ) );
|
dest = wxFopen( FileName, wxT( "w" ) );
|
||||||
if( dest == 0 )
|
if( dest == 0 )
|
||||||
|
|
|
@ -11,6 +11,7 @@ OBJECTS= $(TARGET).o classpcb.o\
|
||||||
modedit_undo_redo.o\
|
modedit_undo_redo.o\
|
||||||
block_module_editor.o\
|
block_module_editor.o\
|
||||||
onrightclick.o\
|
onrightclick.o\
|
||||||
|
onleftclick.o\
|
||||||
modedit_onclick.o\
|
modedit_onclick.o\
|
||||||
via_edit.o\
|
via_edit.o\
|
||||||
wxprint.o \
|
wxprint.o \
|
||||||
|
|
|
@ -0,0 +1,434 @@
|
||||||
|
/**************************************************************/
|
||||||
|
/* onleftclick.cpp: */
|
||||||
|
/* function called when the left button is clicked (released) */
|
||||||
|
/* function called when the left button is double clicked */
|
||||||
|
/**************************************************************/
|
||||||
|
|
||||||
|
#include "fctsys.h"
|
||||||
|
|
||||||
|
#include "gr_basic.h"
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "pcbnew.h"
|
||||||
|
#include "autorout.h"
|
||||||
|
|
||||||
|
#include "id.h"
|
||||||
|
#include "protos.h"
|
||||||
|
#include "eda_dde.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
/********************************************************************/
|
||||||
|
|
||||||
|
/* Handle the left buttom mouse click, when a tool is active
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
|
bool exit = false;
|
||||||
|
|
||||||
|
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
|
||||||
|
{
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
|
||||||
|
{
|
||||||
|
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
|
DrawPanel->CursorOff( DC );
|
||||||
|
|
||||||
|
switch( DrawStruct->Type() )
|
||||||
|
{
|
||||||
|
case TYPETRACK:
|
||||||
|
case TYPEVIA:
|
||||||
|
if( DrawStruct->m_Flags & IS_DRAGGED )
|
||||||
|
{
|
||||||
|
PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPETEXTE:
|
||||||
|
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPETEXTEMODULE:
|
||||||
|
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEPAD:
|
||||||
|
PlacePad( (D_PAD*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEMODULE:
|
||||||
|
Place_Module( (MODULE*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEMIRE:
|
||||||
|
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEDRAWSEGMENT:
|
||||||
|
if( m_ID_current_state == 0 )
|
||||||
|
{
|
||||||
|
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
|
||||||
|
exit = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if( m_ID_current_state == 0 )
|
||||||
|
{
|
||||||
|
DisplayError( this,
|
||||||
|
wxT( "WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0" ) );
|
||||||
|
exit = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||||
|
DrawPanel->CursorOn( DC );
|
||||||
|
if ( exit ) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
|
||||||
|
!wxGetKeyState(WXK_CONTROL) )
|
||||||
|
{
|
||||||
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
if( DrawStruct )
|
||||||
|
SendMessageToEESCHEMA( DrawStruct );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( m_ID_current_state )
|
||||||
|
{
|
||||||
|
case ID_MAIN_MENUBAR:
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_NO_SELECT_BUTT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||||
|
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||||
|
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||||
|
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
||||||
|
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
||||||
|
MuWaveCommand( DC, MousePos );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_HIGHLIGHT_BUTT:
|
||||||
|
{
|
||||||
|
int netcode = Select_High_Light( DC );
|
||||||
|
if( netcode < 0 )
|
||||||
|
m_Pcb->Display_Infos( this );
|
||||||
|
else
|
||||||
|
Affiche_Infos_Equipot( netcode, this );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
||||||
|
#if 0
|
||||||
|
DrawStruct = m_Pcb->FindPadOrModule( GetScreen()->RefPos(true),
|
||||||
|
GetScreen()->m_Active_Layer );
|
||||||
|
#else
|
||||||
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
#endif
|
||||||
|
Show_1_Ratsnest( DrawStruct, DC );
|
||||||
|
|
||||||
|
if( DrawStruct )
|
||||||
|
SendMessageToEESCHEMA( DrawStruct );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_MIRE_BUTT:
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
SetCurItem( Create_Mire( DC ) );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
}
|
||||||
|
else if( DrawStruct->Type() == TYPEMIRE )
|
||||||
|
{
|
||||||
|
Place_Mire( (MIREPCB*) DrawStruct, DC );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, wxT( "Internal err: Struct not TYPEMIRE" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_CIRCLE_BUTT:
|
||||||
|
case ID_PCB_ARC_BUTT:
|
||||||
|
case ID_LINE_COMMENT_BUTT:
|
||||||
|
{
|
||||||
|
int shape = S_SEGMENT;
|
||||||
|
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
||||||
|
shape = S_CIRCLE;
|
||||||
|
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
||||||
|
shape = S_ARC;
|
||||||
|
|
||||||
|
if( GetScreen()->m_Active_Layer <= CMP_N )
|
||||||
|
{
|
||||||
|
DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawStruct = Begin_DrawSegment( NULL, shape, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
else if( DrawStruct
|
||||||
|
&& (DrawStruct->Type() == TYPEDRAWSEGMENT)
|
||||||
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case ID_TRACK_BUTT:
|
||||||
|
if( GetScreen()->m_Active_Layer > CMP_N )
|
||||||
|
{
|
||||||
|
DisplayError( this, _( "Tracks on Copper layers only " ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawStruct = Begin_Route( NULL, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
if( DrawStruct )
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
else if( DrawStruct &&
|
||||||
|
|
||||||
|
// (DrawStruct->Type() == TYPETRACK) &&
|
||||||
|
(DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
|
||||||
|
if( track ) // c'est a dire si OK
|
||||||
|
SetCurItem( DrawStruct = track );
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case ID_PCB_ZONES_BUTT:
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
SetCurItem( DrawStruct = Begin_Zone() );
|
||||||
|
}
|
||||||
|
else if( DrawStruct
|
||||||
|
&& (DrawStruct->Type() == TYPEEDGEZONE)
|
||||||
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
SetCurItem( DrawStruct = Begin_Zone() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, wxT( "Edit: zone internal error" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_TEXT_COMMENT_BUTT:
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
SetCurItem( Create_Texte_Pcb( DC ) );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
else if( DrawStruct->Type() == TYPETEXTE )
|
||||||
|
{
|
||||||
|
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, wxT( "Internal err: Struct not TYPETEXTE" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_COMPONENT_BUTT:
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
DrawStruct = Load_Module_From_Library( wxEmptyString, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
if( DrawStruct )
|
||||||
|
StartMove_Module( (MODULE*) DrawStruct, DC );
|
||||||
|
}
|
||||||
|
else if( DrawStruct->Type() == TYPEMODULE )
|
||||||
|
{
|
||||||
|
Place_Module( (MODULE*) DrawStruct, DC );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, wxT( "Internal err: Struct not TYPEMODULE" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_COTATION_BUTT:
|
||||||
|
if( GetScreen()->m_Active_Layer <= CMP_N )
|
||||||
|
{
|
||||||
|
DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawStruct = Begin_Cotation( NULL, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
else if( DrawStruct
|
||||||
|
&& (DrawStruct->Type() == TYPECOTATION)
|
||||||
|
&& (DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, wxT( "Internal err: Struct not COTATION" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_DELETE_ITEM_BUTT:
|
||||||
|
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
RemoveStruct( DrawStruct, DC );
|
||||||
|
SetCurItem( DrawStruct = NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
||||||
|
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_XOR );
|
||||||
|
m_Auxiliary_Axis_Position = GetScreen()->m_Curseur;
|
||||||
|
DrawPanel->m_Draw_Auxiliary_Axis( DC, GR_COPY );
|
||||||
|
GetScreen()->SetModify();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
||||||
|
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
|
||||||
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************************/
|
||||||
|
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
/********************************************************************************/
|
||||||
|
|
||||||
|
/* handle the double click on the mouse left button
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
|
wxPoint pos = GetPosition();
|
||||||
|
wxClientDC dc( DrawPanel );
|
||||||
|
|
||||||
|
DrawPanel->PrepareGraphicContext( &dc );
|
||||||
|
|
||||||
|
switch( m_ID_current_state )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
{
|
||||||
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
SendMessageToEESCHEMA( DrawStruct );
|
||||||
|
|
||||||
|
// An item is found
|
||||||
|
SetCurItem( DrawStruct );
|
||||||
|
|
||||||
|
switch( DrawStruct->Type() )
|
||||||
|
{
|
||||||
|
case TYPETRACK:
|
||||||
|
case TYPEVIA:
|
||||||
|
if( DrawStruct->m_Flags & IS_NEW )
|
||||||
|
{
|
||||||
|
End_Route( (TRACK*) DrawStruct, DC );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
}
|
||||||
|
else if( DrawStruct->m_Flags == 0 )
|
||||||
|
{
|
||||||
|
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPETEXTE:
|
||||||
|
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct,
|
||||||
|
DC, ( (TEXTE_PCB*) DrawStruct )->m_Pos );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEPAD:
|
||||||
|
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEMODULE:
|
||||||
|
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc, pos );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEMIRE:
|
||||||
|
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPETEXTEMODULE:
|
||||||
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
|
||||||
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPEDRAWSEGMENT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break; // end case 0
|
||||||
|
|
||||||
|
case ID_TRACK_BUTT:
|
||||||
|
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
End_Route( (TRACK*) DrawStruct, DC );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PCB_ZONES_BUTT:
|
||||||
|
End_Zone( DC );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
SetCurItem( NULL );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_LINE_COMMENT_BUTT:
|
||||||
|
case ID_PCB_ARC_BUTT:
|
||||||
|
case ID_PCB_CIRCLE_BUTT:
|
||||||
|
if( DrawStruct == NULL )
|
||||||
|
break;
|
||||||
|
if( DrawStruct->Type() != TYPEDRAWSEGMENT )
|
||||||
|
{
|
||||||
|
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( (DrawStruct->m_Flags & IS_NEW) )
|
||||||
|
{
|
||||||
|
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
|
||||||
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
|
SetCurItem( NULL );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -120,11 +120,20 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
|
|
||||||
DrawPanel->CursorOff( &dc );
|
|
||||||
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
|
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
|
||||||
|
|
||||||
|
|
||||||
// If command in progress: Put the Cancel command (if needed) and End command
|
// If command or block in progress: Put the Cancel command (if needed) and the End command
|
||||||
|
|
||||||
|
if( BlockActive )
|
||||||
|
{
|
||||||
|
createPopUpBlockMenu( aPopMenu );
|
||||||
|
aPopMenu->AppendSeparator();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawPanel->CursorOff( &dc );
|
||||||
|
|
||||||
if( m_ID_current_state )
|
if( m_ID_current_state )
|
||||||
{
|
{
|
||||||
if( item && item->m_Flags )
|
if( item && item->m_Flags )
|
||||||
|
@ -141,24 +150,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (item && item->m_Flags) || BlockActive )
|
if( item && item->m_Flags )
|
||||||
{
|
|
||||||
if( BlockActive )
|
|
||||||
createPopUpBlockMenu( aPopMenu );
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||||
_( "Cancel" ), cancel_xpm );
|
_( "Cancel" ), cancel_xpm );
|
||||||
}
|
|
||||||
aPopMenu->AppendSeparator();
|
aPopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( BlockActive )
|
|
||||||
{
|
|
||||||
DrawPanel->CursorOn( &dc );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Select a proper item */
|
/* Select a proper item */
|
||||||
if( !item || !item->m_Flags )
|
if( !item || !item->m_Flags )
|
||||||
|
@ -434,9 +433,9 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
/*********************************************************/
|
||||||
void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
|
void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
|
||||||
/****************************************/
|
/*********************************************************/
|
||||||
|
|
||||||
/* Create Pop sub menu for block commands
|
/* Create Pop sub menu for block commands
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -743,7 +743,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
int localrealbutt = 0, localbutt = 0, localkey = 0;
|
int localrealbutt = 0, localbutt = 0, localkey = 0;
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
static WinEDA_DrawPanel* LastPanel;
|
static WinEDA_DrawPanel* LastPanel;
|
||||||
static bool LastClickIsADoubleClick = false;
|
static bool IgnoreNextLeftButtonRelease = false;
|
||||||
|
|
||||||
if( event.Leaving() || event.Entering() )
|
if( event.Leaving() || event.Entering() )
|
||||||
{
|
{
|
||||||
|
@ -846,14 +846,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
|
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
|
||||||
{
|
{
|
||||||
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
|
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
|
||||||
LastClickIsADoubleClick = true;
|
IgnoreNextLeftButtonRelease = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK )
|
else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK )
|
||||||
if ( ! LastClickIsADoubleClick )
|
if ( ! IgnoreNextLeftButtonRelease )
|
||||||
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
||||||
|
|
||||||
if( event.LeftUp() ) LastClickIsADoubleClick = false;
|
if( event.LeftUp() ) IgnoreNextLeftButtonRelease = false;
|
||||||
|
|
||||||
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
{
|
{
|
||||||
|
@ -878,7 +878,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
m_CanStartBlock = -1;
|
m_CanStartBlock = -1;
|
||||||
|
|
||||||
// A new command block can start after a release buttons
|
// A new command block can start after a release buttons
|
||||||
// Avoid a false start block when a dialog bos is demiss,
|
// Avoid a false start block when a dialog box is demiss,
|
||||||
// or when changing panels in hierachy navigation
|
// or when changing panels in hierachy navigation
|
||||||
if( !event.LeftIsDown() && !event.MiddleIsDown() )
|
if( !event.LeftIsDown() && !event.MiddleIsDown() )
|
||||||
{
|
{
|
||||||
|
@ -900,6 +900,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
m_Parent->HandleBlockPlace( &DC );
|
m_Parent->HandleBlockPlace( &DC );
|
||||||
|
IgnoreNextLeftButtonRelease = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( (m_CanStartBlock >= 0 )
|
else if( (m_CanStartBlock >= 0 )
|
||||||
|
|
Loading…
Reference in New Issue