Commit 7055a2bc authored by CHARRAS's avatar CHARRAS

zone outlines edition: added drag outline edge

parent a60cbb91
......@@ -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;
}
......
......@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2008-01-22)"))
(wxT("(2008-02-01)"))
#endif
;
......
......@@ -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,
......
......@@ -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)
......
No preview for this file type
This diff is collapsed.
/* 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! ",
" ! "};
......@@ -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
......
......@@ -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
......
This diff is collapsed.
......@@ -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();
......
......@@ -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).
......
......@@ -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 */
......
release version:
19 nov 2007
01 feb 2008
files (.zip,.tgz):
kicad-2007-11-19
kicad-2007-02-01
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment