zone outlines edition: added drag outline edge

This commit is contained in:
CHARRAS 2008-02-01 21:30:45 +00:00
parent a60cbb91b5
commit 7055a2bc47
14 changed files with 783 additions and 617 deletions

View File

@ -351,7 +351,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
switch( STRUCT->m_Orient )
{
case 0: /* HORIZONTAL */
case 0: /* HORIZONTAL Left justified */
x2 += dx; y2 -= dy;
break;
@ -359,12 +359,12 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
x2 -= dy; y2 -= dx;
break;
case 2: /* horizontal inverse */
x2 -= dx; y2 += dy;
case 2: /* horizontal Right justified */
x2 -= dx; y2 -= dy;
break;
case 3: /* vertical DOWN */
x2 += dy; y2 += dx;
x2 -= dy; y2 += dx;
break;
}
@ -571,7 +571,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
switch( STRUCT->m_Orient )
{
case 0: /* HORIZONTAL */
case 0: /* HORIZONTAL Left justified */
xt2 += dx; yt2 -= dy;
break;
@ -579,12 +579,12 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
xt2 -= dy; yt2 -= dx;
break;
case 2: /* horizontal inverse */
xt2 -= dx; yt2 += dy;
case 2: /* horizontal Right justified */
xt2 -= dx; yt2 -= dy;
break;
case 3: /* vertical DOWN */
xt2 += dy; yt2 += dx;
xt2 -= dy; yt2 += dx;
break;
}

View File

@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2008-01-22)"))
(wxT("(2008-02-01)"))
#endif
;

View File

@ -564,8 +564,8 @@ enum main_id {
ID_POPUP_PCB_DELETE_ZONE_CUTOUT,
ID_POPUP_PCB_MOVE_ZONE_OUTLINES,
ID_POPUP_PCB_PLACE_ZONE_OUTLINES,
ID_POPUP_ZONE_UNUSED1,
ID_POPUP_ZONE_UNUSED2,
ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT,
ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
ID_POPUP_ZONE_UNUSED3,
ID_POPUP_ZONE_UNUSED4,

View File

@ -561,6 +561,14 @@ public:
bool IsNewCorner );
/**
* Function Start_Move_Zone_Corner
* Prepares a drag edge in an existing zone outline,
*/
void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id );
/**
* Function End_Move_Zone_Corner_Or_Outlines
* Terminates a move corner in a zone outline, or a move zone outlines
* @param DC = current Device Context (can be NULL)

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
/* XPM */
static const char * drag_outline_segment_xpm[] = {
"16 16 40 1",
" c None",
"! c black",
"# c #C00000",
"$ c #5C6A00",
"% c #800028",
"& c #0D0D1E",
"' c #9B9B9B",
"( c #565656",
") c #32323E",
"* c #DCDCEF",
"+ c #4A4A4A",
", c #D2D2D2",
"- c #84849B",
". c white",
"0 c #F1F1FF",
"1 c #31313D",
"2 c #E7E5FF",
"3 c #646489",
"4 c #232332",
"5 c #FBFBFF",
"6 c #EAEAFF",
"7 c #E2E1FF",
"8 c #DBDBFF",
"9 c #D5D3FF",
": c #CDCDFF",
"; c #C8C6FF",
"< c #C1C1FF",
"= c #9F9DDB",
"> c #30303B",
"? c #7A7A96",
"@ c #D2D0FF",
"A c #5A5981",
"B c #20202F",
"C c #C8C8FF",
"D c #C0BFFF",
"E c #5C5C82",
"F c #B8B8FF",
"G c #56557D",
"H c #9493D6",
"I c #1D1D2C",
" ",
" %%########$ ",
" %%#########$ ",
" %#$ #$",
" %#$''()*)+ ,,,",
" %#$ !-.-!! ",
"%#$ !.! ",
"#$ ! !0! ! ",
"$ 1-!!!2!!!34 ",
" !*506789:;<=!",
" >?!!!@!!!AB ",
" ! !C! !! ",
" ! !D! ! ",
" !EFG!! ",
" BHI! ",
" ! "};

View File

@ -564,7 +564,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
}
/* Geometric transformations: */
/* Geometric transforms: */
/**
* Function Move
@ -575,16 +575,40 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
{
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
{
m_Poly->corner[ii].x += offset.x;
m_Poly->corner[ii].y += offset.y;
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
}
m_Poly->Hatch();
}
/**
* Function MoveEdge
* Move the outline Edge. m_CornerSelection is the start point of the outline edge
* @param offset = moving vector
*/
void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
{
int ii = m_CornerSelection;
// Move the start point of the selected edge:
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
// Move the end point of the selected edge:
if ( m_Poly->corner[ii].end_contour || ii == GetNumCorners() - 1)
{
int icont = m_Poly->GetContour( ii );
ii = m_Poly->GetContourStart( icont );
}
else
ii++;
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
m_Poly->Hatch();
}
/**
* Function Move
* Function Rotate
* Move the outlines
* @param centre = rot centre
* @param angle = in 0.1 degree

View File

@ -147,7 +147,14 @@ public:
void Move( const wxPoint& offset );
/**
* Function Move
* Function MoveEdge
* Move the outline Edge. m_CornerSelection is the start point of the outline edge
* @param offset = moving vector
*/
void MoveEdge( const wxPoint& offset );
/**
* Function Rotate
* Move the outlines
* @param centre = rot centre
* @param angle = in 0.1 degree

View File

@ -68,13 +68,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
case ID_POPUP_PCB_FILL_ALL_ZONES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
case ID_POPUP_PCB_DELETE_ZONE:
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
case ID_POPUP_PCB_ADD_ZONE_CORNER:
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
case ID_POPUP_PCB_ADD_ZONE_CORNER:
case ID_POPUP_PCB_DELETE_TRACKSEG:
case ID_POPUP_PCB_DELETE_TRACK:
case ID_POPUP_PCB_DELETE_TRACKNET:
@ -84,8 +85,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
case ID_POPUP_PCB_SELECT_WIDTH:
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3:
@ -340,7 +341,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_EDIT_NET:
case ID_POPUP_PCB_EDIT_NET:
if( GetCurItem() == NULL )
break;
Edit_Net_Width( &dc, ( (TRACK*) GetCurItem() )->GetNet() );
@ -379,8 +380,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_PLACE_MICROVIA:
if ( ! GetScreen()->IsMicroViaAcceptable() )
break;
if( !GetScreen()->IsMicroViaAcceptable() )
break;
case ID_POPUP_PCB_PLACE_VIA:
DrawPanel->MouseToCursorSchema();
if( GetCurItem()->m_Flags & IS_DRAGGED )
@ -389,17 +391,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
}
else
{
int v_type = g_DesignSettings.m_CurrentViaType;
if ( id == ID_POPUP_PCB_PLACE_MICROVIA )
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
int v_type = g_DesignSettings.m_CurrentViaType;
if( id == ID_POPUP_PCB_PLACE_MICROVIA )
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
g_DesignSettings.m_CurrentViaType = v_type;
g_DesignSettings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
}
break;
case ID_POPUP_PCB_DELETE_TRACKSEG:
case ID_POPUP_PCB_DELETE_TRACKSEG:
if( GetCurItem() == NULL )
break;
DrawPanel->MouseToCursorSchema();
@ -460,72 +462,81 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL ); // Outlines can have changed
SetCurItem( NULL ); // Outlines can have changed
break;
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
DrawPanel->MouseToCursorSchema();
Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
break;
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
DrawPanel->MouseToCursorSchema();
Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
break;
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
DrawPanel->MouseToCursorSchema();
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*)GetCurItem() );
SetCurItem( NULL );
break;
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
Remove_Zone_Corner( &dc, (ZONE_CONTAINER*)GetCurItem() );
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL );
break;
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
Start_Move_Zone_Corner(&dc, zone_cont, zone_cont->m_CornerSelection, false);
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
Remove_Zone_Corner( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL );
break;
}
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
{
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
Start_Move_Zone_Outlines(&dc, zone_cont);
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false );
break;
}
}
case ID_POPUP_PCB_ADD_ZONE_CORNER:
{
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
wxPoint pos = GetScreen()->m_Curseur;
/* add corner between zone_cont->m_CornerSelection
* and zone_cont->m_CornerSelection+1
* and start move the new corner
*/
zone_cont->Draw(DrawPanel, &dc, wxPoint(0,0), GR_XOR);
zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y );
zone_cont->m_CornerSelection++;
zone_cont->Draw(DrawPanel, &dc, wxPoint(0,0), GR_XOR);
Start_Move_Zone_Corner(&dc, zone_cont, zone_cont->m_CornerSelection, true);
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection );
break;
}
}
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
{
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
End_Move_Zone_Corner_Or_Outlines(&dc, zone_cont);
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
Start_Move_Zone_Outlines( &dc, zone_cont );
break;
}
}
case ID_POPUP_PCB_ADD_ZONE_CORNER:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
wxPoint pos = GetScreen()->m_Curseur;
/* add corner between zone_cont->m_CornerSelection
* and zone_cont->m_CornerSelection+1
* and start move the new corner
*/
zone_cont->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_XOR );
zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y );
zone_cont->m_CornerSelection++;
zone_cont->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_XOR );
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true );
break;
}
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
break;
}
case ID_POPUP_PCB_FILL_ALL_ZONES:
DrawPanel->MouseToCursorSchema();
@ -534,7 +545,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema();
Fill_Zone( &dc, (ZONE_CONTAINER*)GetCurItem() );
Fill_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
case ID_PCB_DELETE_ITEM_BUTT:
@ -811,8 +822,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{
if ( End_Zone( &dc ) )
SetCurItem( NULL );
if( End_Zone( &dc ) )
SetCurItem( NULL );
}
break;
@ -820,8 +831,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{
if ( Delete_LastCreatedCorner( &dc ) == 0) // No more segment in outline,
SetCurItem(NULL);
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
SetCurItem( NULL );
}
break;
@ -835,8 +846,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
@ -848,7 +859,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = false;
g_DesignSettings.m_UseConnectedTrackWidth = false;
{
int ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidthHistory[ii];
@ -856,13 +867,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
break;
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = true;
g_DesignSettings.m_UseConnectedTrackWidth = true;
break;
case ID_POPUP_PCB_SELECT_VIASIZE:

View File

@ -50,6 +50,7 @@
#include "Width_Net.xpm"
#include "Width_Track_Via.xpm"
#include "Select_Layer_Pair.xpm"
#include "Drag_Outline_Segment.xpm"
#include "Flag.xpm"
@ -660,7 +661,13 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
/* Create the wxMenuitem list for zone outlines editing and zone filling
*/
{
if( edge_zone->m_Flags )
if( edge_zone->m_Flags == IS_DRAGGED)
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
_( "Place Edge Outline" ), apply_xpm );
}
else if( edge_zone->m_Flags )
{
if( (edge_zone->m_Flags & IN_EDIT ) )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
@ -686,6 +693,8 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
{
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), Add_Corner_xpm );
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT,
_( "Drag Outline Segment" ), drag_outline_segment_xpm );
}
zones_menu->AppendSeparator();

View File

@ -14,13 +14,13 @@
#include "protos.h"
#define ROUTER
#define PSCALE 1
/* routines internes */
#ifdef ROUTER
static void Out_Pads( BOARD* Pcb, FILE* outfile );
static int GenEdges( BOARD* Pcb, FILE* outfile );
#endif
static void GenExistantTracks( BOARD* Pcb, FILE* outfile, int current_net_code, int type );
static void ReturnNbViasAndTracks( BOARD* Pcb, int netcode, int* nb_vias, int* nb_tracks );
@ -143,7 +143,7 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC )
/************************************************/
static void Out_Pads( BOARD* Pcb, FILE* outfile )
void Out_Pads( BOARD* Pcb, FILE* outfile )
/************************************************/
{
D_PAD* pt_pad;
@ -314,7 +314,7 @@ static void Out_Pads( BOARD* Pcb, FILE* outfile )
/**************************************************************************/
static void ReturnNbViasAndTracks( BOARD* Pcb, int netcode, int* nb_vias,
void ReturnNbViasAndTracks( BOARD* Pcb, int netcode, int* nb_vias,
int* nb_tracks )
/**************************************************************************/
@ -345,7 +345,7 @@ static void ReturnNbViasAndTracks( BOARD* Pcb, int netcode, int* nb_vias,
/*************************************************************/
static void GenExistantTracks( BOARD* Pcb, FILE* outfile,
void GenExistantTracks( BOARD* Pcb, FILE* outfile,
int current_net_code, int type )
/*************************************************************/
/* generation des pistes existantes */
@ -429,7 +429,7 @@ static void GenExistantTracks( BOARD* Pcb, FILE* outfile,
/***********************************************/
static int GenEdges( BOARD* Pcb, FILE* outfile )
int GenEdges( BOARD* Pcb, FILE* outfile )
/***********************************************/
/* Generation des contours (edges).

View File

@ -37,7 +37,7 @@ bool verbose = false; // false if zone outline diags mst not be shown
// Outline creation:
static void Abort_Zone_Create_Outline( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Show_New_Zone_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
// Corner moving
static void Abort_Zone_Move_Corner_Or_Outlines( WinEDA_DrawPanel* Panel, wxDC* DC );
@ -175,8 +175,8 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
if( zone->GetNumCorners() > 2 )
{
zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 );
if ( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur(DrawPanel, DC, false);
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
}
else
{
@ -184,7 +184,7 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
zone->RemoveAllContours();
zone->m_Flags = 0;
zone->m_Flags = 0;
}
return zone->GetNumCorners();
}
@ -241,14 +241,34 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
zone_container->m_Flags = IN_EDIT;
DrawPanel->ManageCurseur = Show_Zone_Corner_Or_Outline_While_Move_Mouse;
DrawPanel->ForceCloseManageCurseur = Abort_Zone_Move_Corner_Or_Outlines;
s_CornerInitialPosition.x = zone_container->m_Poly->GetX( corner_id );
s_CornerInitialPosition.y = zone_container->m_Poly->GetY( corner_id );
s_CornerInitialPosition = zone_container->GetCornerPosition( corner_id );
s_CornerIsNew = IsNewCorner;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
/**************************************************************************************/
void WinEDA_PcbFrame::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id )
/**************************************************************************************/
/**
* Function Start_Move_Zone_Corner
* Prepares a drag edge for an existing zone outline,
*/
{
zone_container->m_Flags = IS_DRAGGED;
zone_container->m_CornerSelection = corner_id;
DrawPanel->ManageCurseur = Show_Zone_Corner_Or_Outline_While_Move_Mouse;
DrawPanel->ForceCloseManageCurseur = Abort_Zone_Move_Corner_Or_Outlines;
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->m_Curseur;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
/*******************************************************************************************************/
void WinEDA_PcbFrame::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
/*******************************************************************************************************/
@ -380,6 +400,12 @@ void Abort_Zone_Move_Corner_Or_Outlines( WinEDA_DrawPanel* Panel, wxDC* DC )
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone_container->Move( offset );
}
else if( zone_container->m_Flags == IS_DRAGGED )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone_container->MoveEdge( offset );
}
else
{
if( s_CornerIsNew )
@ -411,26 +437,32 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( WinEDA_DrawPanel* Panel, wxDC
*/
{
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent;
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( erase ) /* Undraw edge in old position*/
{
zone_container->Draw( Panel, DC, wxPoint(0,0), GR_XOR );
zone->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR );
}
wxPoint pos = pcbframe->GetScreen()->m_Curseur;
if( zone_container->m_Flags == IS_MOVED )
if( zone->m_Flags == IS_MOVED )
{
wxPoint offset;
offset.x = pos.x - s_CursorLastPosition.x;
offset.y = pos.y - s_CursorLastPosition.y;
zone_container->Move( offset );
offset = pos - s_CursorLastPosition;
zone->Move( offset );
s_CursorLastPosition = pos;
}
else if( zone->m_Flags == IS_DRAGGED )
{
wxPoint offset;
offset = pos - s_CursorLastPosition;
zone->MoveEdge( offset );
s_CursorLastPosition = pos;
}
else
zone_container->m_Poly->MoveCorner( zone_container->m_CornerSelection, pos.x, pos.y );
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
zone_container->Draw( Panel, DC, wxPoint(0,0), GR_XOR );
zone->Draw( Panel, DC, wxPoint( 0, 0 ), GR_XOR );
}
@ -531,7 +563,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
}
SetCurItem( zone );
DrawPanel->ManageCurseur = Show_New_Zone_Edge_While_Move_Mouse;
DrawPanel->ManageCurseur = Show_New_Edge_While_Move_Mouse;
DrawPanel->ForceCloseManageCurseur = Abort_Zone_Create_Outline;
}
// edge in progress:
@ -539,14 +571,14 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
{
ii = zone->GetNumCorners() - 1;
/* edge in progress : the current corner coordinate was set by Show_New_Zone_Edge_While_Move_Mouse */
/* edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse */
if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
{
if( Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC ) // Ok, we can add a new corner
{
{
zone->AppendCorner( GetScreen()->m_Curseur );
SetCurItem( zone ); // calls Display_Infos().
}
SetCurItem( zone ); // calls Display_Infos().
}
}
}
@ -592,7 +624,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
zone->m_Flags = 0;
zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR );
zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
@ -646,7 +678,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
/******************************************************************************************/
static void Show_New_Zone_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/******************************************************************************************/
/* Redraws the edge zone when moving mouse
@ -663,7 +695,7 @@ static void Show_New_Zone_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC*
if( erase ) /* Undraw edge in old position*/
{
zone->DrawWhileCreateOutline( panel, DC );
zone->DrawWhileCreateOutline( panel, DC );
}
/* Redraw the curent edge in its new position */

View File

@ -1,4 +1,4 @@
release version:
19 nov 2007
01 feb 2008
files (.zip,.tgz):
kicad-2007-11-19
kicad-2007-02-01