Commit 2def9b3f authored by Dick Hollenbeck's avatar Dick Hollenbeck

merge from testing

parents 150373cb de6beac9
......@@ -4,6 +4,28 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-dec-21 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Doxygen comment warning fixes.
* Coding policy fixes.
++common
* Add clone method to EDA_ITEM object.
++EESchema
* Replace GenCopy() method with Clone() in all items derived from SCH_ITEM.
* Simplify repeat last schematic item with new Clone() method.
* Simplify duplicate schematic item method with new Clone() method.
* Separate objects in sch_items.h/cpp into separate files per object.
2010-dec-20, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
common:
Rename EDA_Rect::Inside to EDA_Rect::Contains
( EDA_Rect::Inside( const EDA_Rect& aRect ) was very ambiguous )
Fix some Doxygen warnings and erroneous comments
2010-Dec-19 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++new:
......
This diff is collapsed.
......@@ -282,7 +282,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/*
*
*/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& event )
{
bool ShowAboutDialog(wxWindow * parent);
ShowAboutDialog(this);
......@@ -364,7 +364,7 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
#endif
void WinEDA_BasicFrame::CopyVersionInfoToClipboard( wxCommandEvent& WXUNUSED( event ) )
void WinEDA_BasicFrame::CopyVersionInfoToClipboard( wxCommandEvent& event )
{
if( !wxTheClipboard->Open() )
{
......
......@@ -6,7 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-12-18 BZR 26xx)"
#define KICAD_BUILD_VERSION "(2010-12-22 BZR 2676)"
#endif
//#define VERSION_STABILITY "stable"
......
......@@ -59,6 +59,17 @@ void MARKER_BASE::init()
}
MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker )
{
m_Pos = aMarker.m_Pos;
m_Corners = aMarker.m_Corners;
m_MarkerType = aMarker.m_MarkerType;
m_Color = aMarker.m_Color;
m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox;
m_ScalingFactor = aMarker.m_ScalingFactor;
}
MARKER_BASE::MARKER_BASE()
{
m_ScalingFactor = M_SHAPE_SCALE;
......@@ -118,17 +129,10 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& refPos ) const
rel_pos.x /= m_ScalingFactor;
rel_pos.y /= m_ScalingFactor;
return m_ShapeBoundingBox.Inside( rel_pos );
return m_ShapeBoundingBox.Contains( rel_pos );
}
/**
* Function GetBoundingBoxMarker
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_Rect MARKER_BASE::GetBoundingBoxMarker() const
{
wxSize realsize = m_ShapeBoundingBox.GetSize();
......@@ -141,15 +145,8 @@ EDA_Rect MARKER_BASE::GetBoundingBoxMarker() const
return EDA_Rect( m_Pos, realsize );
}
/**********************************************************************/
void MARKER_BASE::DrawMarker( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode,
const wxPoint& aOffset )
/**********************************************************************/
/**
* Function DrawMarker
* The shape is the polygon defined in m_Corners (array of wxPoints)
*/
{
wxPoint corners[CORNERS_COUNT];
......@@ -172,15 +169,10 @@ void MARKER_BASE::DrawMarker( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode
}
/**
* Function DisplayMarkerInfo
* Displays the full info of this marker, within an HTML window
*/
void MARKER_BASE::DisplayMarkerInfo( WinEDA_DrawFrame* aFrame )
{
wxString msg = m_drc.ShowHtml();
DIALOG_DISPLAY_HTML_TEXT_BASE
infodisplay( (wxWindow*)aFrame, wxID_ANY, _("Marker Info"),
DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( (wxWindow*)aFrame, wxID_ANY, _( "Marker Info" ),
wxGetMousePosition(), wxSize( 550, 140 ) );
infodisplay.m_htmlWindow->SetPage( msg );
......
......@@ -879,7 +879,7 @@ void wxSVGFileDC::DoDrawIcon( const class wxIcon& myIcon, wxCoord x, wxCoord y )
void wxSVGFileDC::DoDrawBitmap( const class wxBitmap& bmp,
wxCoord x,
wxCoord y,
bool WXUNUSED ( bTransparent) /*=0*/ )
bool bTransparent /*=0*/ )
{
if( m_graphics_changed )
NewGraphics();
......
......@@ -251,7 +251,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
GetScreen()->Unscale( display_rect.m_Size );
#endif
return display_rect.Inside( ref_pos );
return display_rect.Contains( ref_pos );
}
......
......@@ -188,7 +188,7 @@ int GRMapY( int y )
*/
static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
{
if( aClipBox->Inside( x1, y1 ) && aClipBox->Inside( x2, y2 ) )
if( aClipBox->Contains( x1, y1 ) && aClipBox->Contains( x2, y2 ) )
return false;
wxRect rect = *aClipBox;
......@@ -206,7 +206,7 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
tmpY2 = y2;
#endif
if( aClipBox->Inside( x1, y1 ) )
if( aClipBox->Contains( x1, y1 ) )
{
if( x1 == x2 ) /* Vertical line, clip Y. */
{
......@@ -263,7 +263,7 @@ static bool clipLine( EDA_Rect* aClipBox, int& x1, int& y1, int& x2, int& y2 )
#endif
return false;
}
else if( aClipBox->Inside( x2, y2 ) )
else if( aClipBox->Contains( x2, y2 ) )
{
if( x1 == x2 ) /* Vertical line, clip Y. */
{
......@@ -704,7 +704,7 @@ void GRPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color )
void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color )
{
if( ClipBox && !ClipBox->Inside( x, y ) )
if( ClipBox && !ClipBox->Contains( x, y ) )
return;
GRSetColorPen( DC, Color );
......
......@@ -170,15 +170,14 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
}
/**
* Function AddHotkeyName
/* AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name
* @param aList = pointer to a Ki_HotkeyInfo list of commands
* @param aCommandId = Command Id value
* @param aIsShortCut = true to add <tab><keyname> (active shortcuts in menus)
* aText = a wxString. returns aText + key name
* aList = pointer to a Ki_HotkeyInfo list of commands
* aCommandId = Command Id value
* aIsShortCut = true to add <tab><keyname> (active shortcuts in menus)
* = false to add <spaces><(keyname)>
* @return a wxString (aTest + key name) if key found or aText without modification
* Return a wxString (aTest + key name) if key found or aText without modification
*/
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
int aCommandId, bool aIsShortCut )
......@@ -200,15 +199,14 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
}
/**
* Function AddHotkeyName
/* AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands
* @param aCommandId = Command Id value
* @param aIsShortCut = true to add <tab><keyname> (active shortcuts in menus)
* aText = a wxString. returns aText + key name
* aList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands
* aCommandId = Command Id value
* aIsShortCut = true to add <tab><keyname> (active shortcuts in menus)
* = false to add <spaces><(keyname)>
* @return a wxString (aTest + key name) if key found or aText without modification
* Return a wxString (aText + key name) if key found or aText without modification
*/
wxString AddHotkeyName( const wxString& aText,
struct Ki_HotkeyInfoSectionDescriptor* aDescList,
......@@ -325,13 +323,9 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
}
/**
* Function DisplayHotkeyList
/* DisplayHotkeyList
* Displays the current hotkey list
* @param aFrame = current active frame
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor list
*(Null terminated)
* @return none
* aList = a Ki_HotkeyInfoSectionDescriptor list(Null terminated)
*/
void DisplayHotkeyList( WinEDA_DrawFrame* aFrame,
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
......@@ -478,7 +472,6 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile(
return 1;
}
void ReadHotkeyConfig( const wxString& Appname,
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{
......@@ -496,11 +489,9 @@ void ReadHotkeyConfig( const wxString& Appname,
ParseHotkeyConfig( data, aDescList );
}
/**
* Function ReadHotkeyConfig
/* Function ReadHotkeyConfig
* Read configuration data and fill the current hotkey list with hotkeys
* @param aDescList = current hotkey list descr. to initialise.
* aDescList is the current hotkey list descr. to initialise.
*/
int WinEDA_BasicFrame::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{
......@@ -509,16 +500,14 @@ int WinEDA_BasicFrame::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor*
}
/**
* Function ParseHotkeyConfig
/* Function ParseHotkeyConfig
* the input format is: shortcut "key" "function"
* lines starting by # are ignored (comments)
* lines like [xxx] are tags (example: [common] or [libedit] which identify
* sections
* lines like [xxx] are tags (example: [common] or [libedit] which identify sections
*/
void ParseHotkeyConfig(
const wxString& data,
struct Ki_HotkeyInfoSectionDescriptor* DescList )
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{
/* Read the config */
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
......@@ -536,7 +525,7 @@ void ParseHotkeyConfig(
if( line_type[0] == '[' ) // A tag is found. search infos in list
{
CurrentHotkeyList = 0;
Ki_HotkeyInfoSectionDescriptor* DList = DescList;
Ki_HotkeyInfoSectionDescriptor* DList = aDescList;
for( ; DList->m_HK_InfoList; DList++ )
{
if( *DList->m_SectionTag == line_type )
......@@ -639,8 +628,7 @@ void WinEDA_BasicFrame::ExportHotkeyConfigToFile(
}
/** add hotkey config options submenu to a menu
* @param menu : root menu
/* add hotkey config options submenu to aMenu
*/
void AddHotkeyConfigMenu( wxMenu* aMenu )
{
......
......@@ -29,6 +29,13 @@ SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
}
SCH_ITEM::SCH_ITEM( const SCH_ITEM& aItem ) :
EDA_ITEM( aItem )
{
m_Layer = aItem.m_Layer;
}
SCH_ITEM::~SCH_ITEM()
{
// Do not let the connections container go out of scope with any ojbects or they
......@@ -101,5 +108,5 @@ bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
return false;
return DoIsConnected( aPosition );
return doIsConnected( aPosition );
}
......@@ -36,10 +36,12 @@ const wxString FootprintAliasFileWildcard( _( "Kicad footprint alias files (*.eq
const wxString titleLibLoadError( _( "Library Load Error" ) );
/* MacOSX: Needed for file association
/*
* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics
*/
void WinEDA_App::MacOpenFile(const wxString &fileName) {
void WinEDA_App::MacOpenFile(const wxString &fileName)
{
wxFileName filename = fileName;
wxString oldPath;
WinEDA_CvpcbFrame * frame = ((WinEDA_CvpcbFrame*)GetTopWindow());
......
/**
* @file menucfg.cpp
* (Re)Create the CvPCB main MenuBar
/*
* menubar.cpp
* Build the CvPCB MenuBar
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......
......@@ -108,11 +108,10 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*
* Redraw the BOARD items but not cursors, axis or grid.
*/
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset )
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
{
if( m_Modules )
{
m_Modules->Draw( aPanel, DC, GR_COPY );
m_Modules->Draw( aPanel, aDC, GR_COPY );
}
}
......@@ -115,10 +115,14 @@ set(EESCHEMA_SRCS
operations_on_items_lists.cpp
pinedit.cpp
plot.cpp
sch_bus_entry.cpp
sch_component.cpp
sch_field.cpp
sch_items.cpp
sch_line.cpp
sch_marker.cpp
sch_no_connect.cpp
sch_polyline.cpp
sch_screen.cpp
sch_sheet.cpp
sch_sheet_path.cpp
......
......@@ -16,8 +16,11 @@
#include "class_library.h"
#include "lib_pin.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_text.h"
#include "sch_component.h"
#include "sch_sheet.h"
......@@ -37,9 +40,9 @@ void DuplicateItemsInList( SCH_SCREEN* screen,
static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aComponent,
wxPoint& aPosition,
bool aSearchFirst );
LIB_PIN* aPin );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
......@@ -226,6 +229,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
}
if( DrawPanel->ManageCurseur != NULL )
{
switch( block->m_Command )
{
case BLOCK_IDLE:
......@@ -234,14 +238,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */
BreakSegmentOnJunction( GetScreen() );
// fall through
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
// fall through
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( block->GetCount() )
{
......@@ -301,6 +305,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_ABORT: /* not executed here */
break;
}
}
if( block->m_Command == BLOCK_ABORT )
{
......@@ -595,7 +600,8 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
}
/* creates the list of items found when a drag block is initiated.
/* Set in m_BlockLocate.m_ItemsSelection items members .m_Flags to SELECTED
* Creates the list of items found when a drag block is initiated.
* items are those selected in window block an some items outside this area but
* connected to a selected item (connected wires to a component or an entry )
*/
......@@ -624,14 +630,14 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Remove the displacement of segment and undo the selection. */
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
Struct = (SCH_ITEM*)pickedlist->GetPickedItem( ii );
if( Struct->Type() == SCH_LINE_T )
{
SegmStruct = (SCH_LINE*) Struct;
if( !screen->m_BlockLocate.Inside( SegmStruct->m_Start ) )
if( !screen->m_BlockLocate.Contains( SegmStruct->m_Start ) )
SegmStruct->m_Flags |= STARTPOINT;
if( !screen->m_BlockLocate.Inside( SegmStruct->m_End ) )
if( !screen->m_BlockLocate.Contains( SegmStruct->m_End ) )
SegmStruct->m_Flags |= ENDPOINT;
// Save m_Flags for Undo/redo drag operations:
......@@ -642,17 +648,16 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Search for other items to drag. They are end wires connected to selected
* items
*/
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{
Struct = (SCH_ITEM*)(SCH_ITEM*) pickedlist->GetPickedItem( ii );
Struct = (SCH_ITEM*)pickedlist->GetPickedItem( ii );
if( ( Struct->Type() == SCH_LABEL_T )
|| ( Struct->Type() == SCH_GLOBAL_LABEL_T )
|| ( Struct->Type() == SCH_HIERARCHICAL_LABEL_T ) )
{
#undef STRUCT
#define STRUCT ( (SCH_TEXT*) Struct )
if( !screen->m_BlockLocate.Inside( STRUCT->m_Pos ) )
if( !screen->m_BlockLocate.Contains( STRUCT->m_Pos ) )
{
AddPickedItem( screen, STRUCT->m_Pos );
}
......@@ -661,20 +666,20 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == SCH_COMPONENT_T )
{
// Add all pins of the selected component to list
LIB_PIN* pin;
wxPoint pos;
pin = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos, true );
LIB_PIN* pin = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos, NULL );
while( pin )
{
if( !screen->m_BlockLocate.Inside( pos ) )
if( !screen->m_BlockLocate.Contains( pos ) )
{
// This pin is outside area,
// but because it it the pin of a selected component
// but because it is a pin of a selected component
// we must also select connected items to this pin
// and mainly wires
AddPickedItem( screen, pos );
}
pin = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos, false );
pin = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos, pin );
}
}
......@@ -774,7 +779,6 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
Struct->m_Flags &= ~STARTPOINT;
// Save m_Flags for Undo/redo drag operations:
picker.m_PickerFlags = Struct->m_Flags;
pickedlist->PushItem( picker );
......@@ -783,7 +787,6 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
Struct->m_Flags &= ~ENDPOINT;
// Save m_Flags for Undo/redo drag operations:
picker.m_PickerFlags = Struct->m_Flags;
pickedlist->PushItem( picker );
......@@ -856,53 +859,45 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/** GetNextPinPosition()
* calculate position of the "next" pin of the aDrawLibItem component
* @param aDrawLibItem = component to test.
* @param aComponent = component to test.
* @param aPosition = the calculated pin position, according to the component
* orientation and position
* @param aSearchFirst = if true, search for the first pin
* @return a pointer to the pin
*/
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aComponent,
wxPoint& aPosition,
bool aSearchFirst )
LIB_PIN* aPin )
{
static LIB_COMPONENT* Entry;
static int Multi, convert;
TRANSFORM transform;
static wxPoint CmpPosition;
static LIB_PIN* Pin;
if( aSearchFirst )
if( aPin == NULL )
{
Entry = CMP_LIBRARY::FindLibraryComponent( aDrawLibItem->GetLibName() );
Entry = CMP_LIBRARY::FindLibraryComponent( aComponent->GetLibName() );
if( Entry == NULL )
return NULL;
Pin = Entry->GetNextPin();
Multi = aDrawLibItem->GetUnit();
convert = aDrawLibItem->GetConvert();
CmpPosition = aDrawLibItem->m_Pos;
transform = aDrawLibItem->GetTransform();
}
else
Pin = Entry->GetNextPin( Pin );
for( ; Pin != NULL; Pin = Entry->GetNextPin( Pin ) )
aPin = Entry->GetNextPin( aPin );
int multi = aComponent->GetUnit();
int convert = aComponent->GetConvert();
for( ; aPin != NULL; aPin = Entry->GetNextPin( aPin ) )
{
wxASSERT( Pin->Type() == LIB_PIN_T );
wxASSERT( aPin->Type() == LIB_PIN_T );
/* Skip items not used for this part */
if( Multi && Pin->GetUnit() && ( Pin->GetUnit() != Multi ) )
if( multi && aPin->GetUnit() && ( aPin->GetUnit() != multi ) )
continue;
if( convert && Pin->GetConvert() && ( Pin->GetConvert() != convert ) )
if( convert && aPin->GetConvert() && ( aPin->GetConvert() != convert ) )
continue;
/* Calculate the pin position (according to the component orientation)
*/
aPosition = DefaultTransform.TransformCoordinate( Pin->GetPosition() ) + CmpPosition;
return Pin;
aPosition = aComponent->GetPinPhysicalPosition( aPin );
return aPin;
}
return NULL;
......
......@@ -14,16 +14,18 @@
#include "lib_pin.h"
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_text.h"
#include "sch_component.h"
#include "sch_sheet.h"
/* Routines Locales */
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
static bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos );
......@@ -172,7 +174,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( g_HVLines ) // We need 2 segments to go from a given start pin to an end point
{
nextsegment = newsegment->GenCopy();
nextsegment = new SCH_LINE( *newsegment );
nextsegment->m_Flags = IS_NEW;
newsegment->SetNext( nextsegment );
nextsegment->SetBack( newsegment );
......@@ -220,7 +222,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
/* Create a new segment, and chain it after the current new segment */
if( nextsegment )
{
newsegment = nextsegment->GenCopy();
newsegment = new SCH_LINE( *nextsegment );
nextsegment->m_Start = newsegment->m_End;
nextsegment->SetNext( NULL );
nextsegment->SetBack( newsegment );
......@@ -229,7 +231,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
}
else
{
newsegment = oldsegment->GenCopy();
newsegment = new SCH_LINE( *oldsegment );
newsegment->m_Start = oldsegment->m_End;
}
......@@ -332,6 +334,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
if( !g_ItemToRepeat )
g_ItemToRepeat = segment;
}
segment->m_Flags = 0;
segment = segment->Next();
}
......@@ -372,7 +375,6 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
item = item->Next();
}
DrawPanel->CursorOn( DC ); // Display schematic cursor
SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE );
......@@ -442,6 +444,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
GRSetDrawMode( DC, g_XorMode );
int idx = NewPoly->GetCornerCount() - 1;
if( g_HVLines )
{
/* Coerce the line to vertical or horizontal one: */
......@@ -571,111 +574,30 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
*/
void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
{
wxPoint new_pos;
if( g_ItemToRepeat == NULL )
return;
switch( g_ItemToRepeat->Type() )
{
case SCH_JUNCTION_T:
#undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_NO_CONNECT_T:
#undef STRUCT
#define STRUCT ( (SCH_NO_CONNECT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_TEXT_T:
#undef STRUCT
#define STRUCT ( (SCH_TEXT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_LABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_HIERARCHICAL_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_HIERLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_GLOBAL_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_GLOBALLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_LINE_T:
#undef STRUCT
#define STRUCT ( (SCH_LINE*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Start += g_RepeatStep;
new_pos = STRUCT->m_Start;
STRUCT->m_End += g_RepeatStep;
break;
case SCH_BUS_ENTRY_T:
#undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_COMPONENT_T: // In repeat command the new component is put
// in move mode
#undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat )
// Create the duplicate component, position = mouse cursor
g_ItemToRepeat = STRUCT->GenCopy();
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
STRUCT->m_Pos = GetScreen()->m_Curseur;
STRUCT->m_Flags = IS_NEW;
STRUCT->m_TimeStamp = GetTimeStamp();
g_ItemToRepeat = g_ItemToRepeat->Clone();
for( int ii = 0; ii < STRUCT->GetFieldCount(); ii++ )
if( g_ItemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{
STRUCT->GetField( ii )->m_Pos += new_pos;
wxPoint pos = GetScreen()->m_Curseur - ( (SCH_COMPONENT*) g_ItemToRepeat )->m_Pos;
g_ItemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) g_ItemToRepeat )->m_TimeStamp = GetTimeStamp();
g_ItemToRepeat->Move( pos );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, g_XorMode );
StartMovePart( (SCH_COMPONENT*) g_ItemToRepeat, DC );
return;
}
RedrawOneStruct( DrawPanel, DC, STRUCT, g_XorMode );
StartMovePart( STRUCT, DC );
return;
break;
g_ItemToRepeat->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
default:
g_ItemToRepeat = NULL;
DisplayError( this, wxT( "Repeat Type Error" ), 10 );
break;
if( g_ItemToRepeat->Type() == SCH_TEXT_T
|| g_ItemToRepeat->Type() == SCH_LABEL_T
|| g_ItemToRepeat->Type() == SCH_HIERARCHICAL_LABEL_T
|| g_ItemToRepeat->Type() == SCH_GLOBAL_LABEL_T )
{
( (SCH_TEXT*) g_ItemToRepeat )->IncrementLabel();
}
if( g_ItemToRepeat )
......@@ -686,9 +608,6 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
g_ItemToRepeat->m_Flags = 0;
// GetScreen()->Curseur = new_pos;
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
}
}
......@@ -702,6 +621,7 @@ void IncrementLabelMember( wxString& name )
long number = 0;
ii = name.Len() - 1; nn = 0;
if( !isdigit( name.GetChar( ii ) ) )
return;
......@@ -712,6 +632,7 @@ void IncrementLabelMember( wxString& name )
ii++; /* digits are starting at ii position */
wxString litt_number = name.Right( nn );
if( litt_number.ToLong( &number ) )
{
number += g_RepeatDeltaLabel;
......@@ -778,11 +699,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = LibItem->GetScreenCoord( pin->GetPosition() );
itempos.x += LibItem->m_Pos.x;
itempos.y += LibItem->m_Pos.y;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE;
}
item = PickStruct( pos, screen, WIREITEM );
if( item )
return TRUE;
......
......@@ -13,7 +13,7 @@
#include "general.h"
#include "protos.h"
#include "sch_items.h"
#include "sch_bus_entry.h"
static int s_LastShape = '\\';
......@@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // not already in edit, save shape
{
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = BusEntry->GenCopy();
g_ItemToUndoCopy = BusEntry->Clone();
}
BusEntry->m_Flags |= IS_MOVED;
......
......@@ -12,7 +12,9 @@
#include "general.h"
#include "protos.h"
#include "netlist.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_line.h"
/* Routine to start/end segment (BUS or wires) on junctions.
......@@ -91,11 +93,11 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
* Segment connecte: doit etre coupe en 2 si px,py
* n'est
* pas une extremite */
if( ( segment->m_Start == aBreakpoint )
|| ( segment->m_End == aBreakpoint ) )
if( ( segment->m_Start == aBreakpoint ) || ( segment->m_End == aBreakpoint ) )
continue;
/* Here we must cut the segment into 2. */
NewSegment = segment->GenCopy();
NewSegment = new SCH_LINE( *segment );
NewSegment->m_Start = aBreakpoint;
segment->m_End = NewSegment->m_Start;
NewSegment->SetNext( segment->Next() );
......
......@@ -12,6 +12,7 @@
#include "protos.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_sheet.h"
#include "sch_text.h"
......
......@@ -297,7 +297,7 @@ void DIALOG_COLOR_CONFIG::UpdateLayerSettings()
}
void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event )
{
UpdateLayerSettings();
m_Parent->DrawPanel->Refresh();
......@@ -305,13 +305,13 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& WXUNUSED( event ) )
}
void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
{
UpdateLayerSettings();
m_Parent->DrawPanel->Refresh();
......
......@@ -239,7 +239,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& event )
{
if( m_Parent == NULL )
return;
......@@ -261,7 +261,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& event )
{
if( m_PartAliasListCtrl->FindString( m_Parent->GetAliasName() ) != wxNOT_FOUND )
{
......@@ -284,7 +284,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& WXU
/* Add a new name to the alias list box
* New name cannot be the root name, and must not exists
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event )
{
wxString aliasname;
LIB_COMPONENT* component = m_Parent->GetComponent();
......@@ -324,7 +324,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& event )
{
wxString aliasname = m_PartAliasListCtrl->GetStringSelection();
......@@ -444,7 +444,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event )
{
if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) )
{
......@@ -458,7 +458,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent&
/* Add a new name to the footprint filter list box
* Obvioulsy, cannot be void
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event )
{
wxString Line;
LIB_COMPONENT* component = m_Parent->GetComponent();
......@@ -494,7 +494,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& event )
{
LIB_COMPONENT* component = m_Parent->GetComponent();
int ii = m_FootprintFilterListBox->GetSelection();
......
......@@ -578,6 +578,22 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
m_StyleRadioBox->SetSelection( style );
// Select the right text justification
if( field.m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
else if( field.m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
m_FieldHJustifyCtrl->SetSelection(2);
else
m_FieldHJustifyCtrl->SetSelection(1);
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
fieldNameTextCtrl->SetValue( field.m_Name );
// the names of the fixed fields are not editable, others are.
......@@ -657,6 +673,19 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
// Copy the text justification
GRTextHorizJustifyType hjustify[3] = {
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_RIGHT
};
GRTextVertJustifyType vjustify[3] = {
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP
};
field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()];
field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()];
field.m_Name = fieldNameTextCtrl->GetValue();
/* Void fields texts for REFERENCE and VALUE (value is the name of the
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -29,7 +29,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
unitSizer->Add( unitChoice, 1, wxALL|wxEXPAND, 5 );
unitSizer->Add( unitChoice, 0, wxALL|wxEXPAND, 5 );
optionsSizer->Add( unitSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
......@@ -42,9 +42,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
orientationRadioBox->SetSelection( 0 );
orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( orientationRadioBox, 1, wxALL, 8 );
orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 );
optionsSizer->Add( orientationSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 0 );
optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxBoxSizer* mirrorSizer;
mirrorSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -57,7 +57,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 );
optionsSizer->Add( mirrorSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 0 );
optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 );
wxStaticBoxSizer* chipnameSizer;
chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL );
......@@ -71,7 +71,6 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 );
convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") );
optionsSizer->Add( convertCheckBox, 0, wxALL, 8 );
......@@ -113,11 +112,28 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 5, wxALL|wxEXPAND, 8 );
fieldsSizer->Add( gridStaticBoxSizer, 5, wxEXPAND|wxRIGHT|wxLEFT, 8 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
sbSizerOptions->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 1 );
sbSizerOptions->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( sbSizerOptions, 0, wxEXPAND, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
......@@ -125,13 +141,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
......@@ -146,7 +160,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND|wxTOP, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
......@@ -221,15 +235,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 1, wxEXPAND, 5 );
fieldEditBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
fieldEditBoxSizer->Add( positionBoxSizer, 0, wxEXPAND, 5 );
fieldEditBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 3, wxEXPAND, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 );
upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 );
......@@ -268,4 +276,5 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -48,6 +48,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
......@@ -61,25 +63,24 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxTextCtrl* posXTextCtrl;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void SetInitCmp( wxCommandEvent& event ){ event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 630,520 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 715,520 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
};
......
......@@ -92,24 +92,18 @@ void DialogLabelEditor::InitDialog()
break;
}
unsigned MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH )
{
wxString textWidth;
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
}
else if ( !multiLine )
int max_len = 0;
if ( !multiLine )
{
EnsureTextCtrlWidth( m_textLabel );
max_len =m_CurrentText->m_Text.Length();
}
else
{
// calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning
int max_len = 0;
int curr_len = 0;
int curr_len = MINTEXTWIDTH;
int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ )
{
......@@ -125,10 +119,13 @@ void DialogLabelEditor::InitDialog()
max_len = curr_len;
}
}
}
if( max_len < MINTEXTWIDTH )
max_len = MINTEXTWIDTH;
wxString textWidth;
textWidth.Append( 'M', max_len );
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
}
// Set validators
m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -107,4 +107,5 @@ DialogLabelEditor_Base::~DialogLabelEditor_Base()
m_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -54,12 +54,13 @@ class DialogLabelEditor_Base : public wxDialog
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnEnterKey( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 359,347 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base();
......
......@@ -611,7 +611,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
m_StyleRadioBox->SetSelection( style );
// Copy the text justification
// Select the right text justification
if( field.m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
else if( field.m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -50,21 +50,13 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL );
wxBoxSizer* orientationSizer;
orientationSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
orientationSizer->Add( m_FieldHJustifyCtrl, 1, wxALL, 8 );
optionsSizer->Add( orientationSizer, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL, 0 );
wxBoxSizer* mirrorSizer;
mirrorSizer = new wxBoxSizer( wxHORIZONTAL );
optionsSizer->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 8 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
......@@ -72,11 +64,9 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_FieldVJustifyCtrl->SetSelection( 1 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
mirrorSizer->Add( m_FieldVJustifyCtrl, 1, wxALL, 8 );
optionsSizer->Add( mirrorSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, 0 );
optionsSizer->Add( m_FieldVJustifyCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 8 );
fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxEXPAND|wxBOTTOM, 5 );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL );
......@@ -85,13 +75,11 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
bShowRotateSizer = new wxBoxSizer( wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 );
......@@ -101,7 +89,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 0 );
m_StyleRadioBox->SetSelection( 1 );
visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 );
......@@ -216,4 +204,5 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BAS
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -60,18 +60,19 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 773,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
......
......@@ -11,7 +11,7 @@
DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetSizeHints( wxSize( 350,-1 ), wxDefaultSize );
wxBoxSizer* m_mainSizer;
m_mainSizer = new wxBoxSizer( wxVERTICAL );
......@@ -21,6 +21,7 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 4, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
......@@ -85,7 +86,6 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
this->SetSizer( m_mainSizer );
this->Layout();
m_mainSizer->Fit( this );
this->Centre( wxBOTH );
}
......
......@@ -34,10 +34,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">350,-1</property>
<property name="name">DIALOG_SCH_EDIT_SHEET_PIN_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="size">350,189</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Sheet Pin Properties</property>
......@@ -100,7 +100,7 @@
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
......
......@@ -52,7 +52,7 @@ class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public wxDialog
public:
DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,189 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_EDIT_SHEET_PIN_BASE();
};
......
......@@ -42,7 +42,7 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
SCH_COMPONENT* comp = (SCH_COMPONENT*) aField->GetParent();
SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = comp->GenCopy();
g_ItemToUndoCopy = new SCH_COMPONENT( *comp );
pos = comp->m_Pos;
......
......@@ -41,7 +41,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
if( (TextStruct->m_Flags & IS_NEW) == 0 )
{
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->GenCopy();
g_ItemToUndoCopy = TextStruct->Clone();
}
TextStruct->m_Flags |= IS_MOVED;
......
......@@ -14,10 +14,14 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_bus_entry.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "build_version.h"
......@@ -185,8 +189,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case SCH_POLYLINE_T:
{
SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem;
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x,
Struct->m_PolyPoints[0].y + aOffset.y );
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x, Struct->m_PolyPoints[0].y + aOffset.y );
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
GRLineTo( &aPanel->m_ClipBox,
aDC,
......@@ -202,15 +206,16 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
{
SCH_LINE* Struct;
Struct = (SCH_LINE*) aItem;
if( (Struct->m_Flags & STARTPOINT) == 0 )
{
GRMoveTo( Struct->m_Start.x + aOffset.x,
Struct->m_Start.y + aOffset.y );
GRMoveTo( Struct->m_Start.x + aOffset.x, Struct->m_Start.y + aOffset.y );
}
else
{
GRMoveTo( Struct->m_Start.x, Struct->m_Start.y );
}
if( (Struct->m_Flags & ENDPOINT) == 0 )
{
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_End.x + aOffset.x,
......
......@@ -34,7 +34,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
case SCH_COMPONENT_T:
{
SCH_COMPONENT* newitem;
newitem = ((SCH_COMPONENT*) curr_item)->GenCopy();
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->m_TimeStamp = GetTimeStamp();
newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW;
......@@ -51,7 +51,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
{
SCH_TEXT* newitem = ((SCH_TEXT*) curr_item)->GenCopy();
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
newitem->m_Flags = IS_NEW;
StartMoveTexte( newitem, &dc );
/* Redraw the original part in XOR mode */
......
......@@ -420,7 +420,8 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
{
SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy();
g_ItemToUndoCopy = Component->Clone();
}
DrawPanel->CursorOff( DC );
......
......@@ -13,6 +13,7 @@
#include "libeditframe.h"
#include "class_libentry.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_component.h"
#include "sch_sheet.h"
......@@ -510,8 +511,10 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( DrawStruct->Type() == SCH_LINE_T )
{
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_BUS )
break;
// Bus in progress:
OnLeftClick( DC, MousePos );
}
......@@ -670,7 +673,12 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( DrawStruct == NULL )
{
// Find the schematic object to move under the cursor
// For a drag or copy command, try to find first a component:
if( DrawStruct == NULL && HK_Descr->m_Idcommand != HK_MOVE_COMPONENT_OR_ITEM )
DrawStruct = LocateSmallestComponent( GetScreen() );
// If no component, find the schematic object to move/drag or copy under the cursor
if( DrawStruct == NULL )
DrawStruct = SchematicGeneralLocateAndDisplay( false );
if( DrawStruct == NULL )
......@@ -748,7 +756,12 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
case SCH_LINE_T:
if( ( (SCH_ITEM*) DrawStruct )->GetLayer() == LAYER_WIRE )
{
if( HK_Descr->m_Idcommand == HK_DRAG )
wxPostEvent( this, eventDragWire );
else
wxPostEvent( this, eventMoveItem );
}
break;
default:
......
......@@ -263,8 +263,8 @@ void LIB_ARC::DoOffset( const wxPoint& aOffset )
bool LIB_ARC::DoTestInside( EDA_Rect& aRect ) const
{
return aRect.Inside( m_ArcStart.x, -m_ArcStart.y )
|| aRect.Inside( m_ArcEnd.x, -m_ArcEnd.y );
return aRect.Contains( m_ArcStart.x, -m_ArcStart.y )
|| aRect.Contains( m_ArcEnd.x, -m_ArcEnd.y );
}
......
......@@ -164,7 +164,7 @@ bool LIB_BEZIER::DoTestInside( EDA_Rect& aRect ) const
{
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{
if( aRect.Inside( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
return true;
}
......
......@@ -152,7 +152,7 @@ bool LIB_CIRCLE::DoTestInside( EDA_Rect& aRect ) const
* FIXME: This fails to take into account the radius around the center
* point.
*/
return aRect.Inside( m_Pos.x, -m_Pos.y );
return aRect.Contains( m_Pos.x, -m_Pos.y );
}
......
......@@ -326,8 +326,6 @@ void LIB_FIELD::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint&
if( aData )
text = *(wxString*)aData;
else if( InEditMode() )
text = GetFullText( m_Unit );
else
text = m_Text;
......@@ -350,6 +348,11 @@ void LIB_FIELD::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint&
bool LIB_FIELD::HitTest( const wxPoint& aPosition )
{
// Because HitTest is mainly used to select the field
// return always false if this field is void
if( IsVoid() )
return false;
return HitTest( aPosition, 0, DefaultTransform );
}
......@@ -466,7 +469,7 @@ bool LIB_FIELD::DoTestInside( EDA_Rect& rect ) const
* FIXME: This fails to take into acount the size and/or orientation of
* the text.
*/
return rect.Inside( m_Pos.x, -m_Pos.y );
return rect.Contains( m_Pos.x, -m_Pos.y );
}
......
......@@ -106,6 +106,15 @@ public:
void SetFields( const std::vector <LIB_FIELD> aFields );
/**
* Function IsVoid
* @return true if the field value is void (no text in this field)
*/
bool IsVoid()
{
return m_Text.IsEmpty();
}
/**
* Function IsVisible
* @return true is this field is visible, false if flagged invisible
......
......@@ -1653,7 +1653,7 @@ bool LIB_PIN::DoTestInside( EDA_Rect& rect ) const
{
wxPoint end = ReturnPinEndPoint();
return rect.Inside( m_position.x, -m_position.y ) || rect.Inside( end.x, -end.y );
return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
}
......
......@@ -162,7 +162,7 @@ bool LIB_POLYLINE::DoTestInside( EDA_Rect& aRect ) const
{
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{
if( aRect.Inside( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
return true;
}
......
......@@ -119,7 +119,7 @@ void LIB_RECTANGLE::DoOffset( const wxPoint& aOffset )
bool LIB_RECTANGLE::DoTestInside( EDA_Rect& aRect ) const
{
return aRect.Inside( m_Pos.x, -m_Pos.y ) || aRect.Inside( m_End.x, -m_End.y );
return aRect.Contains( m_Pos.x, -m_Pos.y ) || aRect.Contains( m_End.x, -m_End.y );
}
......
......@@ -223,7 +223,7 @@ bool LIB_TEXT::DoTestInside( EDA_Rect& rect ) const
* FIXME: This should calculate the text size and justification and
* use rectangle instect.
*/
return rect.Inside( m_Pos.x, -m_Pos.y );
return rect.Contains( m_Pos.x, -m_Pos.y );
}
......
......@@ -11,9 +11,13 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
#include "sch_polyline.h"
#include "sch_text.h"
#include "sch_sheet.h"
......
......@@ -11,9 +11,13 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "lib_pin.h"
#include "template_fieldnames.h"
......@@ -139,6 +143,7 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* aScreen )
for( ; item != NULL; item = item->Next() )
{
// an item is picked if its bounding box intersects the reference area
if( item->HitTest( area ) )
{
/* Put this structure in the picked list: */
......@@ -310,7 +315,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList )
EDA_Rect BoundaryBox = field->GetBoundingBox();
if( BoundaryBox.Inside( aPosRef ) )
if( BoundaryBox.Contains( aPosRef ) )
{
LastSnappedStruct = field;
return true;
......@@ -323,7 +328,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList )
#define STRUCT ( (SCH_COMPONENT*) DrawList )
EDA_Rect BoundaryBox = STRUCT->GetBoundingBox();
if( BoundaryBox.Inside( aPosRef ) )
if( BoundaryBox.Contains( aPosRef ) )
{
LastSnappedStruct = DrawList;
return true;
......
......@@ -14,6 +14,8 @@
#include "lib_pin.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_text.h"
#include "sch_sheet.h"
......
......@@ -12,9 +12,12 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_text.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
#include "sch_sheet.h"
......
......@@ -15,10 +15,13 @@
#include "protos.h"
#include "hotkeys.h"
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_text.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
......
......@@ -13,7 +13,11 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "sch_component.h"
#include "sch_items.h"
......@@ -30,8 +34,7 @@ void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& rotationPoint )
}
void DeleteItemsInList( WinEDA_DrawPanel* panel,
PICKED_ITEMS_LIST& aItemsList );
void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList );
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector );
......@@ -95,8 +98,7 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
if( item->Type() == SCH_SHEET_LABEL_T )
{
/* this item is depending on a sheet, and is not in global list */
wxMessageBox( wxT("DeleteItemsInList() err: unexpected \
SCH_SHEET_LABEL_T" ) );
wxMessageBox( wxT( "DeleteItemsInList() err: unexpected SCH_SHEET_LABEL_T" ) );
}
else
{
......@@ -218,82 +220,15 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
*/
SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone )
{
SCH_ITEM* NewDrawStruct = NULL;
wxCHECK_MSG( aDrawStruct != NULL, NULL,
wxT( "Cannot duplicate NULL schematic item! Bad programmer." ) );
if( aDrawStruct == NULL )
{
wxMessageBox( wxT( "DuplicateStruct error: NULL struct" ) );
return NULL;
}
switch( aDrawStruct->Type() )
{
case SCH_POLYLINE_T:
NewDrawStruct = ( (SCH_POLYLINE*) aDrawStruct )->GenCopy();
break;
case SCH_LINE_T:
NewDrawStruct = ( (SCH_LINE*) aDrawStruct )->GenCopy();
break;
case SCH_BUS_ENTRY_T:
NewDrawStruct = ( (SCH_BUS_ENTRY*) aDrawStruct )->GenCopy();
break;
case SCH_JUNCTION_T:
NewDrawStruct = ( (SCH_JUNCTION*) aDrawStruct )->GenCopy();
break;
case SCH_MARKER_T:
NewDrawStruct = ( (SCH_MARKER*) aDrawStruct )->GenCopy();
break;
case SCH_NO_CONNECT_T:
NewDrawStruct = ( (SCH_NO_CONNECT*) aDrawStruct )->GenCopy();
break;
case SCH_TEXT_T:
NewDrawStruct = ( (SCH_TEXT*) aDrawStruct )->GenCopy();
break;
case SCH_LABEL_T:
NewDrawStruct = ( (SCH_LABEL*) aDrawStruct )->GenCopy();
break;
case SCH_HIERARCHICAL_LABEL_T:
NewDrawStruct = ( (SCH_HIERLABEL*) aDrawStruct )->GenCopy();
break;
case SCH_GLOBAL_LABEL_T:
NewDrawStruct = ( (SCH_GLOBALLABEL*) aDrawStruct )->GenCopy();
break;
case SCH_COMPONENT_T:
NewDrawStruct = ( (SCH_COMPONENT*) aDrawStruct )->GenCopy();
break;
case SCH_SHEET_T:
NewDrawStruct = ( (SCH_SHEET*) aDrawStruct )->GenCopy();
if( aClone )
{
( (SCH_SHEET*) NewDrawStruct )->m_SheetName =
( (SCH_SHEET*) aDrawStruct )->m_SheetName;
}
break;
default:
{
wxString msg;
msg << wxT( "DuplicateStruct error: unexpected StructType " )
<< aDrawStruct->Type() << wxT( " " ) << aDrawStruct->GetClass();
wxMessageBox( msg );
}
break;
}
SCH_ITEM* NewDrawStruct = aDrawStruct->Clone();
if( aClone )
NewDrawStruct->m_TimeStamp = aDrawStruct->m_TimeStamp;
NewDrawStruct->m_Image = aDrawStruct;
return NewDrawStruct;
}
......@@ -14,7 +14,10 @@
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_text.h"
......
/***********************/
/* class SCH_BUS_ENTRY */
/***********************/
#include "fctsys.h"
#include "gr_basic.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "trigo.h"
#include "common.h"
#include "richio.h"
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
SCH_ITEM( NULL, SCH_BUS_ENTRY_T )
{
m_Pos = pos;
m_Size.x = 100;
m_Size.y = 100;
m_Layer = LAYER_WIRE;
m_Width = 0;
if( id == BUS_TO_BUS )
{
m_Layer = LAYER_BUS;
}
if( shape == '/' )
m_Size.y = -100;
}
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry ) :
SCH_ITEM( aBusEntry )
{
m_Pos = aBusEntry.m_Pos;
m_Size = aBusEntry.m_Size;
m_Width = aBusEntry.m_Width;
}
EDA_ITEM* SCH_BUS_ENTRY::doClone() const
{
return new SCH_BUS_ENTRY( *this );
}
wxPoint SCH_BUS_ENTRY::m_End() const
{
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
}
bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
{
bool success = true;
const char* layer = "Wire";
const char* width = "Line";
if( GetLayer() == LAYER_BUS )
{
layer = "Bus"; width = "Bus";
}
if( fprintf( aFile, "Entry %s %s\n", layer, width ) == EOF )
{
success = false;
}
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
m_Pos.x, m_Pos.y, m_End().x, m_End().y ) == EOF )
{
success = false;
}
return success;
}
bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
m_Layer = LAYER_WIRE;
if( Name1[0] == 'B' )
m_Layer = LAYER_BUS;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_Pos.x, &m_Pos.y,
&m_Size.x, &m_Size.y ) != 4 )
{
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
m_Size.x -= m_Pos.x;
m_Size.y -= m_Pos.y;
return true;
}
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() const
{
EDA_Rect box;
box.SetOrigin( m_Pos );
box.SetEnd( m_End() );
box.Normalize();
int width = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
box.Inflate( width / 2 );
return box;
}
int SCH_BUS_ENTRY::GetPenSize() const
{
int pensize = ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
if( m_Layer == LAYER_BUS && m_Width == 0 )
{
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 );
}
return pensize;
}
void SCH_BUS_ENTRY::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor )
{
int color;
if( aColor >= 0 )
color = aColor;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( aDC, aDrawMode );
GRLine( &aPanel->m_ClipBox, aDC, m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );
}
void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y );
m_Pos.y += aXaxis_position;
NEGATE( m_Size.y );
}
void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position )
{
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;
NEGATE( m_Size.x );
}
void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint )
{
RotatePoint( &m_Pos, rotationPoint, 900 );
RotatePoint( &m_Size.x, &m_Size.y, 900 );
}
void SCH_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
{
DANGLING_END_ITEM item( ENTRY_END, this );
item.m_Pos = m_Pos;
DANGLING_END_ITEM item1( ENTRY_END, this );
item1.m_Pos = m_End();
aItemList.push_back( item );
aItemList.push_back( item1 );
}
bool SCH_BUS_ENTRY::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
// If either end of the bus entry is inside the selection rectangle, the entire
// bus entry is selected. Bus entries have a fixed length and angle.
if( aRect.Contains( m_Pos ) || aRect.Contains( m_End() ) )
m_Flags |= SELECTED;
else
m_Flags &= ~SELECTED;
return previousState != IsSelected();
}
void SCH_BUS_ENTRY::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Pos );
aPoints.push_back( m_End() );
}
bool SCH_BUS_ENTRY::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
{
if( !( aFilter & BUS_ENTRY_T ) )
return false;
return TestSegmentHit( aPoint, m_Pos, m_End(), aAccuracy );
}
bool SCH_BUS_ENTRY::doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
/**
* @file sch_bus_entry.h
*
*/
#ifndef _SCH_BUS_ENTRY_H_
#define _SCH_BUS_ENTRY_H_
#include "sch_item_struct.h"
/* Flags for BUS ENTRY (bus to bus or wire to bus */
#define WIRE_TO_BUS 0
#define BUS_TO_BUS 1
/**
* Class SCH_BUS_ENTRY
*
* Defines a bus or wire entry.
*/
class SCH_BUS_ENTRY : public SCH_ITEM
{
public:
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
public:
SCH_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), int shape = '\\', int id = WIRE_TO_BUS );
SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry );
~SCH_BUS_ENTRY() { }
virtual wxString GetClass() const
{
return wxT( "SCH_BUS_ENTRY" );
}
wxPoint m_End() const;
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
/**
* Load schematic bus entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic bus entry from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic bus entry.
* @return True if the schematic bus entry loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display
* purposes. This box should be an enclosing perimeter for visible
* components of this object, and the units should be in the pcb or
* schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/
EDA_Rect GetBoundingBox() const;
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/**
* Function Move
* moves and item to a new position by \a aMoveVector.
* @param aMoveVector The displacement vector.
*/
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
}
/**
* Function Mirror_Y
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position The Y axis coordinate to mirror around.
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const;
};
#endif // _SCH_BUS_ENTRY_H_
......@@ -130,20 +130,21 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
}
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
SCH_ITEM( NULL, SCH_COMPONENT_T )
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
SCH_ITEM( aComponent )
{
/* assignment of all fields, including field vector elements, and linked
* list pointers */
*this = aTemplate;
/* set linked list pointers to null, before this they were copies of
* aTemplate's */
Pback = NULL;
Pnext = NULL;
m_Son = NULL;
// Re-parent the fields, which before this had aTemplate as parent
m_Parent = aComponent.m_Parent;
m_Pos = aComponent.m_Pos;
m_unit = aComponent.m_unit;
m_convert = aComponent.m_convert;
m_ChipName = aComponent.m_ChipName;
m_TimeStamp = aComponent.m_TimeStamp;
m_transform = aComponent.m_transform;
m_prefix = aComponent.m_prefix;
m_PathsAndReferences = aComponent.m_PathsAndReferences;
m_Fields = aComponent.m_Fields;
// Re-parent the fields, which before this had aComponent as parent
for( int i = 0; i<GetFieldCount(); ++i )
{
GetField( i )->SetParent( this );
......@@ -180,6 +181,12 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
}
EDA_ITEM* SCH_COMPONENT::doClone() const
{
return new SCH_COMPONENT( *this );
}
void SCH_COMPONENT::SetLibName( const wxString& aName )
{
if( m_ChipName != aName )
......@@ -273,18 +280,18 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
{
EDA_Rect BoundaryBox;
BoundaryBox = GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
#if 1
if( GetField( REFERENCE )->IsVisible() )
{
BoundaryBox = GetField( REFERENCE )->GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
}
if( GetField( VALUE )->IsVisible() )
{
BoundaryBox = GetField( VALUE )->GetBoundingBox();
GRRect( &panel->m_ClipBox, DC, BoundaryBox, BROWN );
GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN );
}
#endif
}
......@@ -1367,6 +1374,7 @@ EDA_Rect SCH_COMPONENT::GetBodyBoundingBox() const
// H and W must be > 0:
if( x2 < x1 )
EXCHG( x2, x1 );
if( y2 < y1 )
EXCHG( y2, y1 );
......@@ -1649,7 +1657,7 @@ LIB_DRAW_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aTy
}
bool SCH_COMPONENT::DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
bool SCH_COMPONENT::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
{
EDA_Rect bBox;
......@@ -1664,7 +1672,7 @@ bool SCH_COMPONENT::DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_
bBox = GetField( ii )->GetBoundingBox();
bBox.Inflate( aAccuracy );
if( bBox.Inside( aPoint ) )
if( bBox.Contains( aPoint ) )
return true;
}
}
......@@ -1674,7 +1682,7 @@ bool SCH_COMPONENT::DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_
bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy );
if( bBox.Inside( aPoint ) )
if( bBox.Contains( aPoint ) )
return true;
}
......@@ -1682,20 +1690,20 @@ bool SCH_COMPONENT::DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_
}
bool SCH_COMPONENT::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
bool SCH_COMPONENT::doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
EDA_Rect rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Inside( GetBoundingBox() );
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
bool SCH_COMPONENT::DoIsConnected( const wxPoint& aPosition ) const
bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
{
vector< wxPoint > pts;
......
......@@ -60,14 +60,11 @@ class SCH_COMPONENT : public SCH_ITEM
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
SCH_FIELDS m_Fields; ///< Variable length list of fields.
/* Hierarchical references.
* format is
* path reference multi
* with:
* path = /<timestamp1>/<timestamp2> (subsheet path, = / for the root sheet)
* reference = reference for this path (C23, R5, U78 ... )
* multi = part selection in multi parts per package (0 or 1 for one part
* per package)
/**
* Defines the hierarchical path and reference of the component. This allowa support
* for hierarchical sheets that reference the same schematic. The foramt for the path
* is /&ltsheet time stamp&gt/&ltsheet time stamp&gt/... A single / denotes the root
* sheet.
*/
wxArrayString m_PathsAndReferences;
......@@ -103,12 +100,12 @@ public:
/**
* Copy Constructor
* clones \a aTemplate into this object. All fields are copied as is except
* clones \a aComponent into a new object. All fields are copied as is except
* for the linked list management pointers which are set to NULL, and the
* SCH_FIELD's m_Parent pointers which are set to the new parent,
* i.e. this new object.
*/
SCH_COMPONENT( const SCH_COMPONENT& aTemplate );
SCH_COMPONENT( const SCH_COMPONENT& aComponent );
~SCH_COMPONENT() { }
......@@ -152,16 +149,6 @@ public:
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GenCopy
* returns a copy of this object but with the linked list pointers set to NULL.
* @return SCH_COMPONENT* - a copy of me.
*/
SCH_COMPONENT* GenCopy() const
{
return new SCH_COMPONENT( *this );
}
/**
* Function SetOrientation
* computes the new transform matrix based on \a aOrientation for the component which is
......@@ -260,7 +247,6 @@ public:
m_Fields = aFields; // vector copying, length is changed possibly
}
//-----</Fields>----------------------------------------------------------
/**
......@@ -409,9 +395,10 @@ public:
#endif
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual bool DoIsConnected( const wxPoint& aPosition ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const;
};
......
......@@ -29,8 +29,7 @@
#include "template_fieldnames.h"
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId,
SCH_COMPONENT* aParent, wxString aName ) :
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TextStruct()
{
......@@ -44,15 +43,27 @@ SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId,
}
SCH_FIELD::SCH_FIELD( const SCH_FIELD& aField ) :
SCH_ITEM( aField ),
EDA_TextStruct( aField )
{
m_FieldId = aField.m_FieldId;
m_Name = aField.m_Name;
m_AddExtraText = aField.m_AddExtraText;
}
SCH_FIELD::~SCH_FIELD()
{
}
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
EDA_ITEM* SCH_FIELD::doClone() const
{
return new SCH_FIELD( *this );
}
int SCH_FIELD::GetPenSize() const
{
int pensize = m_Thickness;
......@@ -71,9 +82,6 @@ int SCH_FIELD::GetPenSize() const
}
/**
* Draw schematic component fields.
*/
void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color )
{
......@@ -103,6 +111,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* Calculate the text orientation, according to the component
* orientation/mirror */
orient = m_Orient;
if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
{
if( orient == TEXT_ORIENT_HORIZ )
......@@ -136,9 +145,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( !m_AddExtraText || ( m_FieldId != REFERENCE ) )
{
DrawGraphicText( panel, DC, textpos, color, m_Text,
orient,
m_Size, hjustify, vjustify,
DrawGraphicText( panel, DC, textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
LineWidth, m_Italic, m_Bold );
}
else
......@@ -148,9 +155,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
wxString fulltext = m_Text;
fulltext << LIB_COMPONENT::ReturnSubReference( parentComponent->GetUnit() );
DrawGraphicText( panel, DC, textpos, color, fulltext,
orient,
m_Size, hjustify, vjustify,
DrawGraphicText( panel, DC, textpos, color, fulltext, orient, m_Size, hjustify, vjustify,
LineWidth, m_Italic, m_Bold );
}
......@@ -182,13 +187,6 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
}
/**
* Function ImportValues
* copy parameters from a source.
* Pointers and specific values (position, texts) are not copied
* used to init a field from the model read from a lib entry
* @param aSource = the LIB_FIELD to read
*/
void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
{
m_Orient = aSource.m_Orient;
......@@ -203,32 +201,23 @@ void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
}
/**
* Used if undo / redo command:
* swap data between this and copyitem
*/
void SCH_FIELD::SwapData( SCH_FIELD* copyitem )
void SCH_FIELD::SwapData( SCH_FIELD* aField )
{
EXCHG( m_Text, copyitem->m_Text );
EXCHG( m_Layer, copyitem->m_Layer );
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_Thickness, copyitem->m_Thickness );
EXCHG( m_Orient, copyitem->m_Orient );
EXCHG( m_Mirror, copyitem->m_Mirror );
EXCHG( m_Attributs, copyitem->m_Attributs );
EXCHG( m_Italic, copyitem->m_Italic );
EXCHG( m_Bold, copyitem->m_Bold );
EXCHG( m_HJustify, copyitem->m_HJustify );
EXCHG( m_VJustify, copyitem->m_VJustify );
EXCHG( m_Text, aField->m_Text );
EXCHG( m_Layer, aField->m_Layer );
EXCHG( m_Pos, aField->m_Pos );
EXCHG( m_Size, aField->m_Size );
EXCHG( m_Thickness, aField->m_Thickness );
EXCHG( m_Orient, aField->m_Orient );
EXCHG( m_Mirror, aField->m_Mirror );
EXCHG( m_Attributs, aField->m_Attributs );
EXCHG( m_Italic, aField->m_Italic );
EXCHG( m_Bold, aField->m_Bold );
EXCHG( m_HJustify, aField->m_HJustify );
EXCHG( m_VJustify, aField->m_VJustify );
}
/**
* Function GetBoundaryBox
* @return an EDA_Rect contains the real (user coordinates) boundary box for a text field.
* according to the component position, rotation, mirror ...
*/
EDA_Rect SCH_FIELD::GetBoundingBox() const
{
EDA_Rect BoundaryBox;
......@@ -459,7 +448,7 @@ void SCH_FIELD::Rotate( wxPoint rotationPoint )
}
bool SCH_FIELD::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
bool SCH_FIELD::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
// Do not hit test hidden fields.
if( !IsVisible() )
......@@ -469,11 +458,11 @@ bool SCH_FIELD::DoHitTest( const wxPoint& aPoint, int aAccuracy ) const
rect.Inflate( aAccuracy );
return rect.Inside( aPoint );
return rect.Contains( aPoint );
}
bool SCH_FIELD::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
bool SCH_FIELD::doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const
{
// Do not hit test hidden fields.
if( !IsVisible() )
......@@ -484,7 +473,7 @@ bool SCH_FIELD::DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy
rect.Inflate( aAccuracy );
if( aContained )
return rect.Inside( GetBoundingBox() );
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}
......@@ -5,14 +5,6 @@
#ifndef CLASS_SCH_FIELD_H
#define CLASS_SCH_FIELD_H
/* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used
* Fields 4 and more are user fields.
* They can be renamed and can appear in reports
*/
#include "sch_item_struct.h"
#include "general.h"
......@@ -25,11 +17,16 @@ class LIB_FIELD;
/**
* Class SCH_FIELD
* instances are attached to a component and provide a place for the
* component's value,
* reference designator, footprint, and user definable name-value pairs of
* arbitrary purpose.
* instances are attached to a component and provide a place for the component's value,
* reference designator, footprint, and user definable name-value pairs of arbitrary purpose.
*
* <ul> <li>Field 0 is reserved for the component reference.</li>
* <li>Field 1 is reserved for the component value.</li>
* <li>Field 2 is reserved for the component footprint.</li>
* <li>Field 3 is reserved for the component data sheet file.</li>
* <li>Fields 4 and higher are user defineable.</li></ul>
*/
class SCH_FIELD : public SCH_ITEM, public EDA_TextStruct
{
public:
......@@ -44,6 +41,8 @@ public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
wxString aName = wxEmptyString );
SCH_FIELD( const SCH_FIELD& aField );
~SCH_FIELD();
virtual wxString GetClass() const
......@@ -66,8 +65,13 @@ public:
return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) );
}
void SwapData( SCH_FIELD* copyitem );
/**
* Function SwapData
* exchanges the date between the field and \a aField.
*
* @param aField The field to exchange data with.
*/
void SwapData( SCH_FIELD* aField );
/**
* Function ImportValues
......@@ -160,8 +164,9 @@ public:
void* aAuxData, wxPoint * aFindLocation );
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const;
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* @file sch_line.h
*
*/
#ifndef _SCH_LINE_H_
#define _SCH_LINE_H_
#include "sch_item_struct.h"
/**
* Class SCH_LINE
* is a segment description base class to describe items which have 2 end
* points (track, wire, draw line ...)
*/
class SCH_LINE : public SCH_ITEM
{
bool m_StartIsDangling;
bool m_EndIsDangling; // TRUE if not connected (wires, tracks...)
public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
public:
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
SCH_LINE( const SCH_LINE& aLine );
~SCH_LINE() { }
SCH_LINE* Next() const { return (SCH_LINE*) Pnext; }
SCH_LINE* Back() const { return (SCH_LINE*) Pback; }
virtual wxString GetClass() const
{
return wxT( "SCH_LINE" );
}
bool IsEndPoint( const wxPoint& aPoint ) const
{
return aPoint == m_Start || aPoint == m_End;
}
bool IsNull() const { return m_Start == m_End; }
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_Rect GetBoundingBox() const;
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
/**
* Load schematic line from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic line from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic line.
* @return True if the schematic line loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/**
* Function Move
* moves the item by \a aMoveVector.
* @param aMoveVector The displacement vector
*/
virtual void Move( const wxPoint& aMoveVector );
virtual void Mirror_X( int aXaxis_position );
/**
* Function Mirror_Y
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Rotate( wxPoint rotationPoint );
/**
* Check line against \a aLine to see if it overlaps and merge if it does.
*
* This method will change the line to be equivalent of the line and \a aLine if the
* two lines overlap. This method is used to merge multple line segments into a single
* line.
*
* @param aLine - Line to compare.
* @return True if lines overlap and the line was merged with \a aLine.
*/
bool MergeOverlap( SCH_LINE* aLine );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDangling() const { return m_StartIsDangling || m_EndIsDangling; }
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const;
#endif
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const;
};
#endif // _SCH_LINE_H_
......@@ -44,19 +44,21 @@ SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
}
SCH_MARKER::~SCH_MARKER()
SCH_MARKER::SCH_MARKER( const SCH_MARKER& aMarker ) :
SCH_ITEM( aMarker ),
MARKER_BASE( aMarker )
{
}
SCH_MARKER* SCH_MARKER::GenCopy()
SCH_MARKER::~SCH_MARKER()
{
SCH_MARKER* newitem = new SCH_MARKER( GetPos(), GetReporter().GetMainText() );
}
newitem->SetMarkerType( GetMarkerType() );
newitem->SetErrorLevel( GetErrorLevel() );
return newitem;
EDA_ITEM* SCH_MARKER::doClone() const
{
return new SCH_MARKER( *this );
}
......@@ -76,7 +78,6 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os )
<< GetPos() << "/>\n";
}
#endif
/**
......@@ -194,7 +195,7 @@ bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect )
}
bool SCH_MARKER::DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
bool SCH_MARKER::doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const
{
if( !( aFilter & MARKER_T ) )
return false;
......
......@@ -30,6 +30,7 @@ class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
public:
SCH_MARKER();
SCH_MARKER( const wxPoint& aPos, const wxString& aText );
SCH_MARKER( const SCH_MARKER& aMarker );
~SCH_MARKER();
virtual wxString GetClass() const
......@@ -37,11 +38,8 @@ public:
return wxT( "SCH_MARKER" );
}
SCH_MARKER* GenCopy();
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDraw_mode,
int aColor = -1 );
virtual void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDraw_mode, int aColor = -1 );
/**
* Function Save
......@@ -104,7 +102,8 @@ public:
#endif
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual EDA_ITEM* doClone() const;
};
#endif /* _TYPE_SCH_MARKER_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -14,6 +14,7 @@
#include "protos.h"
#include "class_library.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_sheet.h"
#include "sch_component.h"
......@@ -203,11 +204,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
if( CreateCopy )
{
if( item->Type() == SCH_JUNCTION_T )
new_item = ( (SCH_JUNCTION*) item )->GenCopy();
else
new_item = ( (SCH_LINE*) item )->GenCopy();
new_item = item->Clone();
new_item->SetNext( GetDrawItems() );
SetDrawItems( new_item );
}
......
This diff is collapsed.
......@@ -47,11 +47,15 @@ private:
* orientation.
*/
virtual EDA_ITEM* doClone() const;
public:
SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
SCH_SHEET_PIN( const SCH_SHEET_PIN& aSheetLabel );
~SCH_SHEET_PIN() { }
virtual wxString GetClass() const
......@@ -59,11 +63,8 @@ public:
return wxT( "SCH_SHEET_PIN" );
}
bool operator ==( const SCH_SHEET_PIN* aPin ) const;
SCH_SHEET_PIN* GenCopy();
virtual void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
......@@ -101,6 +102,12 @@ public:
void SetNumber( int aNumber );
void SetEdge( int aEdge );
int GetEdge();
/**
* Function ConstraintOnEdge
* is used to adjust label position to egde based on proximity to vertical / horizontal edge
* of the parent sheet.
*/
void ConstraintOnEdge( wxPoint Pos );
/**
......@@ -223,6 +230,9 @@ public:
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_SHEET( const SCH_SHEET& aSheet );
~SCH_SHEET();
virtual wxString GetClass() const
......@@ -250,8 +260,6 @@ public:
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
/* there is no member for orientation in sch_sheet, to preserve file
......@@ -513,8 +521,9 @@ protected:
void renumberLabels();
private:
virtual bool DoHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool DoHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const;
};
#endif /* CLASS_DRAWSHEET_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,9 +10,13 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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