Commit 73f37365 authored by jean-pierre charras's avatar jean-pierre charras

Code cleanup. Minor fixes. Added drag labels patch from Marco Mattila

parents 30a54500 6292dcba
...@@ -423,6 +423,8 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -423,6 +423,8 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_ID_current_state = id; m_ID_current_state = id;
if( m_VToolBar )
m_VToolBar->Refresh( );
} }
......
...@@ -605,23 +605,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -605,23 +605,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
// Sel .m_Flags to selected for a wire or bus in selected area if there is for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
// only one item:
if( pickedlist->GetCount() == 1 )
{
Struct = (SCH_ITEM*) pickedlist->GetPickedItem( 0 );
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
Struct->m_Flags = SELECTED;
}
// Sel .m_Flags to selected for a wire or bus in selected area for a list
// of items:
else
{ {
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ ) Struct = (SCH_ITEM*) pickedlist->GetPickedItem( ii );
{ Struct->m_Flags = SELECTED;
Struct = (SCH_ITEM*) pickedlist->GetPickedItem( ii );
Struct->m_Flags = SELECTED;
}
} }
if( screen->m_BlockLocate.m_Command != BLOCK_DRAG ) if( screen->m_BlockLocate.m_Command != BLOCK_DRAG )
...@@ -653,6 +640,18 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -653,6 +640,18 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ ) for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{ {
Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii ); Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
if( ( Struct->Type() == TYPE_SCH_LABEL )
|| ( Struct->Type() == TYPE_SCH_GLOBALLABEL )
|| ( Struct->Type() == TYPE_SCH_HIERLABEL ) )
{
#undef STRUCT
#define STRUCT ( (SCH_TEXT*) Struct )
if( !screen->m_BlockLocate.Inside( STRUCT->m_Pos ) )
{
AddPickedItem( screen, STRUCT->m_Pos );
}
}
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
// Add all pins of the selected component to list // Add all pins of the selected component to list
......
...@@ -54,42 +54,21 @@ void TestLabelForDangling( SCH_TEXT* label, ...@@ -54,42 +54,21 @@ void TestLabelForDangling( SCH_TEXT* label,
DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ); DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList );
/* Returns TRUE if the point P is on the segment S. /* Returns true if the point P is on the segment S. */
* The segment is assumed horizontal or vertical. bool SegmentIntersect( wxPoint aSegStart, wxPoint aSegEnd, wxPoint aTestPoint )
*/
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
int Px1, int Py1 )
{ {
int Sxmin, Sxmax, Symin, Symax; wxPoint vectSeg = aSegEnd - aSegStart; // Vector from S1 to S2
wxPoint vectPoint = aTestPoint - aSegStart; // Vector from S1 to P
if( Sx1 == Sx2 ) /* Line S is vertical. */
{
Symin = MIN( Sy1, Sy2 );
Symax = MAX( Sy1, Sy2 );
if( Px1 != Sx1 ) // Use long long here to avoid overflow in calculations
return FALSE; if( (long long)vectSeg.x * vectPoint.y - (long long)vectSeg.y * vectPoint.x )
return false; /* Cross product non-zero, vectors not parallel */
if( Py1 >= Symin && Py1 <= Symax ) if( ((long long)vectSeg.x * vectPoint.x + (long long)vectSeg.y * vectPoint.y) <
return TRUE; ((long long)vectPoint.x * vectPoint.x + (long long)vectPoint.y * vectPoint.y) )
else return false; /* Point not on segment */
return FALSE;
}
else if( Sy1 == Sy2 ) /* Line S is horizontal. */
{
Sxmin = MIN( Sx1, Sx2 );
Sxmax = MAX( Sx1, Sx2 );
if( Py1 != Sy1 ) return true;
return FALSE;
if( Px1 >= Sxmin && Px1 <= Sxmax )
return TRUE;
else
return FALSE;
}
else
return FALSE;
} }
...@@ -133,7 +112,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC ) ...@@ -133,7 +112,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
break; break;
if( STRUCT->GetLayer() == LAYER_BUS ) if( STRUCT->GetLayer() == LAYER_BUS )
{ {
STRUCT->m_StartIsDangling = STRUCT->m_EndIsDangling = FALSE; STRUCT->m_StartIsDangling = STRUCT->m_EndIsDangling = false;
break; break;
} }
break; break;
...@@ -168,9 +147,9 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, ...@@ -168,9 +147,9 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
NEGATE( pinpos.y ); // In libraries Y axis is bottom to top NEGATE( pinpos.y ); // In libraries Y axis is bottom to top
// and in schematic Y axis is top to bottom // and in schematic Y axis is top to bottom
else // calculate the pin position in schematic else // calculate the pin position in schematic
pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos ) pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos )
+ DrawLibItem->m_Pos; + DrawLibItem->m_Pos;
if( pos == pinpos ) if( pos == pinpos )
return Pin; return Pin;
...@@ -182,7 +161,7 @@ void TestWireForDangling( SCH_LINE* DrawRef, WinEDA_SchematicFrame* frame, ...@@ -182,7 +161,7 @@ void TestWireForDangling( SCH_LINE* DrawRef, WinEDA_SchematicFrame* frame,
wxDC* DC ) wxDC* DC )
{ {
DanglingEndHandle* terminal_item; DanglingEndHandle* terminal_item;
bool Sdangstate = TRUE, Edangstate = TRUE; bool Sdangstate = true, Edangstate = true;
for( terminal_item = ItemList; terminal_item != NULL; for( terminal_item = ItemList; terminal_item != NULL;
terminal_item = terminal_item->m_Pnext ) terminal_item = terminal_item->m_Pnext )
...@@ -192,13 +171,13 @@ void TestWireForDangling( SCH_LINE* DrawRef, WinEDA_SchematicFrame* frame, ...@@ -192,13 +171,13 @@ void TestWireForDangling( SCH_LINE* DrawRef, WinEDA_SchematicFrame* frame,
if( (DrawRef->m_Start.x == terminal_item->m_Pos.x) if( (DrawRef->m_Start.x == terminal_item->m_Pos.x)
&& (DrawRef->m_Start.y == terminal_item->m_Pos.y) ) && (DrawRef->m_Start.y == terminal_item->m_Pos.y) )
Sdangstate = FALSE; Sdangstate = false;
if( (DrawRef->m_End.x == terminal_item->m_Pos.x) if( (DrawRef->m_End.x == terminal_item->m_Pos.x)
&& (DrawRef->m_End.y == terminal_item->m_Pos.y) ) && (DrawRef->m_End.y == terminal_item->m_Pos.y) )
Edangstate = FALSE; Edangstate = false;
if( (Sdangstate == FALSE) && (Edangstate == FALSE) ) if( (Sdangstate == false) && (Edangstate == false) )
break; break;
} }
...@@ -220,7 +199,7 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame, ...@@ -220,7 +199,7 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
wxDC* DC ) wxDC* DC )
{ {
DanglingEndHandle* terminal_item; DanglingEndHandle* terminal_item;
bool dangstate = TRUE; bool dangstate = true;
for( terminal_item = ItemList; terminal_item != NULL; for( terminal_item = ItemList; terminal_item != NULL;
terminal_item = terminal_item->m_Pnext ) terminal_item = terminal_item->m_Pnext )
...@@ -235,16 +214,14 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame, ...@@ -235,16 +214,14 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
case SHEET_LABEL_END: case SHEET_LABEL_END:
if( ( label->m_Pos.x == terminal_item->m_Pos.x ) if( ( label->m_Pos.x == terminal_item->m_Pos.x )
&& ( label->m_Pos.y == terminal_item->m_Pos.y ) ) && ( label->m_Pos.y == terminal_item->m_Pos.y ) )
dangstate = FALSE; dangstate = false;
break; break;
case WIRE_START_END: case WIRE_START_END:
case BUS_START_END: case BUS_START_END:
dangstate = !SegmentIntersect( terminal_item->m_Pos.x, dangstate = !SegmentIntersect( terminal_item->m_Pos,
terminal_item->m_Pos.y, terminal_item->m_Pnext->m_Pos,
terminal_item->m_Pnext->m_Pos.x, label->m_Pos );
terminal_item->m_Pnext->m_Pos.y,
label->m_Pos.x, label->m_Pos.y );
terminal_item = terminal_item->m_Pnext; terminal_item = terminal_item->m_Pnext;
break; break;
...@@ -256,7 +233,7 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame, ...@@ -256,7 +233,7 @@ void TestLabelForDangling( SCH_TEXT* label, WinEDA_SchematicFrame* frame,
break; break;
} }
if( dangstate == FALSE ) if( dangstate == false )
break; break;
} }
...@@ -322,7 +299,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -322,7 +299,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|| (STRUCT->GetLayer() == LAYER_WIRE ) ) || (STRUCT->GetLayer() == LAYER_WIRE ) )
{ {
item = new DanglingEndHandle( item = new DanglingEndHandle(
(STRUCT->GetLayer() == LAYER_BUS) ? (STRUCT->GetLayer() == LAYER_BUS) ?
BUS_START_END : WIRE_START_END ); BUS_START_END : WIRE_START_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
...@@ -334,7 +311,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -334,7 +311,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
lastitem = item; lastitem = item;
item = item =
new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ? new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
BUS_END_END : WIRE_END_END ); BUS_END_END : WIRE_END_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
item->m_Pos = STRUCT->m_End; item->m_Pos = STRUCT->m_End;
...@@ -387,7 +364,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -387,7 +364,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
break; break;
for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL; for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL;
Pin = Entry->GetNextPin( Pin ) ) Pin = Entry->GetNextPin( Pin ) )
{ {
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE );
...@@ -417,8 +394,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -417,8 +394,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) DrawItem; SCH_SHEET* sheet = (SCH_SHEET*) DrawItem;
BOOST_FOREACH( SCH_SHEET_PIN pinsheet, sheet->GetSheetPins() ) BOOST_FOREACH( SCH_SHEET_PIN pinsheet, sheet->GetSheetPins() ) {
{
wxASSERT( pinsheet.Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ); wxASSERT( pinsheet.Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
item = new DanglingEndHandle( SHEET_LABEL_END ); item = new DanglingEndHandle( SHEET_LABEL_END );
......
...@@ -386,14 +386,16 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -386,14 +386,16 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_ADD_LABEL: case HK_ADD_LABEL:
// switch to m_ID_current_state = ID_LABEL_BUTT; if( !ItemInEdit )
if( m_ID_current_state != ID_LABEL_BUTT ) {
SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) ); // switch to m_ID_current_state = ID_LABEL_BUTT;
OnLeftClick( DC, MousePos ); if( m_ID_current_state != ID_LABEL_BUTT )
break; SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
OnLeftClick( DC, MousePos );
}
break;
case HK_BEGIN_WIRE: case HK_BEGIN_WIRE:
/* An item is selected. If edited and not a wire, a new command is not /* An item is selected. If edited and not a wire, a new command is not
* possible */ * possible */
if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
...@@ -578,10 +580,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -578,10 +580,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
wxPostEvent( this, eventMoveOrDragComponent ); wxPostEvent( this, eventMoveOrDragComponent );
break; break;
case TYPE_SCH_TEXT:
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
wxPostEvent( this, eventMoveOrDragComponent );
break;
case TYPE_SCH_TEXT:
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
if( HK_Descr->m_Idcommand != HK_DRAG ) if( HK_Descr->m_Idcommand != HK_DRAG )
......
...@@ -1031,9 +1031,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, ...@@ -1031,9 +1031,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
continue; continue;
} }
if( SegmentIntersect( Segment->m_Start.x, Segment->m_Start.y, if( SegmentIntersect( Segment->m_Start, Segment->m_End, Jonction->m_Start ) )
Segment->m_End.x, Segment->m_End.y,
Jonction->m_Start.x, Jonction->m_Start.y ) )
{ {
/* Propagation Netcode has all the objects of the same Netcode. */ /* Propagation Netcode has all the objects of the same Netcode. */
if( IsBus == 0 ) if( IsBus == 0 )
......
...@@ -342,6 +342,9 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel ) ...@@ -342,6 +342,9 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
...@@ -376,6 +379,9 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel ) ...@@ -376,6 +379,9 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
...@@ -409,6 +415,9 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label ) ...@@ -409,6 +415,9 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr,
HK_COPY_COMPONENT_OR_LABEL ); HK_COPY_COMPONENT_OR_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
...@@ -523,7 +532,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* fr ...@@ -523,7 +532,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* fr
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm ); msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm );
// Add global label command only if the cursor is over one end of the wire. // Add global label command only if the cursor is over one end of the wire.
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y) if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
#include "class_pin.h" #include "class_pin.h"
/* Local Variables : */ /* Local functions : */
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
SCH_SHEET_PIN* Struct );
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem, static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, bool IsMulti, int DrawMode ); int FieldNumber, bool IsMulti, int DrawMode );
...@@ -304,46 +302,6 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText ) ...@@ -304,46 +302,6 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
} }
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
SCH_SHEET_PIN* aHierarchical_PIN )
{
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
int posx, tposx, posy, size;
static std::vector <wxPoint> Poly;
txtcolor = ReturnLayerColor( aHierarchical_PIN->GetLayer() );
posx = aHierarchical_PIN->m_Pos.x;
posy = aHierarchical_PIN->m_Pos.y;
size = aHierarchical_PIN->m_Size.x;
GRTextHorizJustifyType side;
if( aHierarchical_PIN->m_Edge )
{
tposx = posx - size;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size + (size / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
int thickness = aHierarchical_PIN->GetPenSize();
plotter->set_current_line_width( thickness );
plotter->text( wxPoint( tposx, posy ), txtcolor, aHierarchical_PIN->m_Text,
TEXT_ORIENT_HORIZ, wxSize( size, size ),
side, GR_TEXT_VJUSTIFY_CENTER, thickness,
aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
/* Draw the associated graphic symbol */
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct ) static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
{ {
EDA_Colors txtcolor = UNSPECIFIED_COLOR; EDA_Colors txtcolor = UNSPECIFIED_COLOR;
...@@ -399,9 +357,9 @@ static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct ) ...@@ -399,9 +357,9 @@ static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
plotter->set_color( ReturnLayerColor( Struct->m_Layer ) ); plotter->set_color( ReturnLayerColor( Struct->m_Layer ) );
/* Draw texts : SheetLabel */ /* Draw texts : SheetLabel */
BOOST_FOREACH( SCH_SHEET_PIN& label, Struct->GetSheetPins() ) BOOST_FOREACH( SCH_SHEET_PIN& pin_sheet, Struct->GetSheetPins() )
{ {
label.Plot( plotter ); pin_sheet.Plot( plotter );
} }
} }
......
...@@ -31,7 +31,7 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, ...@@ -31,7 +31,7 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
/*********************/ /*********************/
/* DANGLING_ENDS.CPP */ /* DANGLING_ENDS.CPP */
/*********************/ /*********************/
bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2, int Px1, int Py1 ); bool SegmentIntersect( wxPoint aSegStart, wxPoint aSegEnd, wxPoint aTestPoint );
/****************/ /****************/
/* BUS_WIRE_JUNCTION.CPP */ /* BUS_WIRE_JUNCTION.CPP */
......
...@@ -414,7 +414,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -414,7 +414,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) or a hierachical sheet // component, like Field, text..) or a hierachical sheet
// or a label
if( (screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT) if( (screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT)
&& (screen->GetCurItem()->Type() != TYPE_SCH_LABEL)
&& (screen->GetCurItem()->Type() != TYPE_SCH_GLOBALLABEL)
&& (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL)
&& (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) ) && (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
......
...@@ -71,8 +71,6 @@ enum main_id ...@@ -71,8 +71,6 @@ enum main_id
ID_V_TOOLBAR, ID_V_TOOLBAR,
ID_OPT_TOOLBAR, ID_OPT_TOOLBAR,
ID_AUX_TOOLBAR, ID_AUX_TOOLBAR,
ID_AUX_V_TOOLBAR,
ID_TOOLBAR_UNUSED,
ID_GENERAL_HELP, ID_GENERAL_HELP,
ID_LOCAL_HELP, ID_LOCAL_HELP,
......
...@@ -269,7 +269,7 @@ public: ...@@ -269,7 +269,7 @@ public:
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar(); void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void ReCreateAuxVToolbar(); void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateMenuBar(); void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
......
This diff is collapsed.
...@@ -378,7 +378,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -378,7 +378,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->DrawGridAxis( DC, GR_XOR ); DrawPanel->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur; GetScreen()->m_GridOrigin = GetScreen()->m_Curseur;
DrawPanel->DrawGridAxis( DC, GR_COPY ); DrawPanel->DrawGridAxis( DC, GR_COPY );
GetScreen()->SetModify();
break; break;
default: default:
......
...@@ -319,7 +319,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -319,7 +319,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateVToolbar(); ReCreateVToolbar();
ReCreateOptToolbar(); ReCreateOptToolbar();
ReCreateAuxVToolbar(); ReCreateMicrowaveVToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
...@@ -370,6 +370,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -370,6 +370,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
m_show_layer_manager_tools ); m_show_layer_manager_tools );
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_show_microwave_tools );
m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).Show( m_show_microwave_tools );
} }
if( DrawPanel ) if( DrawPanel )
...@@ -542,8 +545,7 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -542,8 +545,7 @@ void WinEDA_PcbFrame::SaveSettings()
config->Write( PCB_SHOW_FULL_RATSNET_OPT, tmp ); config->Write( PCB_SHOW_FULL_RATSNET_OPT, tmp );
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption ); config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, config->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools );
( m_AuxVToolBar && m_AuxVToolBar->IsShown() ) ? true : false );
config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools ); config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools );
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
enum pcbnew_ids enum pcbnew_ids
{ {
ID_MAIN_MENUBAR = ID_END_LIST, ID_MAIN_MENUBAR = ID_END_LIST,
ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_EDITOR,
ID_READ_NETLIST, ID_READ_NETLIST,
ID_PCB_CIRCLE_BUTT, ID_PCB_CIRCLE_BUTT,
......
...@@ -476,13 +476,13 @@ void WinEDA_PcbFrame::ReCreateVToolbar() ...@@ -476,13 +476,13 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
/* Create the auxiliary vertical right toolbar, showing tools for /* Create the auxiliary vertical right toolbar, showing tools for
* microwave applications * microwave applications
*/ */
void WinEDA_PcbFrame::ReCreateAuxVToolbar() void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
{ {
if( m_AuxVToolBar ) if( m_AuxVToolBar )
return; return;
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this,
ID_AUX_V_TOOLBAR, FALSE ); ID_MICROWAVE_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
......
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