First pass at DSN token file generator and other minor changes.
* Add CMake script to generate DSN token header and source file from token list file. * Add preliminary component library DSN token list and lexer file to test script and prepare for new component library file lexer. * EESchema: right click on ERC check mark displays error in message panel. * Remove PCBNew header file dependency from common DSN lexer source. * Minor code clean ups.
This commit is contained in:
parent
58b5da01be
commit
143526462c
|
@ -0,0 +1,213 @@
|
|||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2010 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, you may find one here:
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
# or you may search the http://www.gnu.org website for the version 2 license,
|
||||
# or you may write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
#
|
||||
# This script converts a plain text file with a line feed separated list
|
||||
# of token names into the appropriate source and header files required by
|
||||
# the DSN lexer. See files "<base_source_path>/common/dsnlexer.cpp" and
|
||||
# "<base_source_path>/include/dsnlexer.h" for more information about how
|
||||
# the DSN lexer works. The token list file format requires a single token
|
||||
# per line. Tokens can only contain lower case letters, numbers, and
|
||||
# underscores. The first letter of each token must be a lower case letter.
|
||||
# Tokens must be unique. If any of the above criteria are not met, the
|
||||
# source and header files will not be generated and a build error will
|
||||
# occur.
|
||||
#
|
||||
# Valid tokens: a a1 foo_1 foo_bar2
|
||||
# Invalid tokens: 1 A _foo bar_ foO
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# add_custom_command(
|
||||
# OUTPUT ${CMAKE_BINARY_DIR}/cmp_library_base.h
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/token_list_file
|
||||
# -P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
|
||||
# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
|
||||
# )
|
||||
#
|
||||
# Input parameters:
|
||||
#
|
||||
# inputFile - The name of the token list file.
|
||||
# outputPath - Optional output path to save the generated files. If not defined,
|
||||
# the output path is the same path as the token list file path.
|
||||
#
|
||||
|
||||
set( tokens "" )
|
||||
set( lineCount 0 )
|
||||
set( dsnErrorMsg "DSN token file generator failure:" )
|
||||
if( NOT EXISTS ${inputFile} )
|
||||
message( FATAL_ERROR "${dsnErrorMsg} file ${inputFile} cannot be found." )
|
||||
endif( NOT EXISTS ${inputFile} )
|
||||
|
||||
if( NOT EXISTS ${outputPath} )
|
||||
get_filename_component( outputPath "${inputFile}" PATH )
|
||||
endif( NOT EXISTS ${outputPath} )
|
||||
|
||||
# Separate the file name without extension from the full file path.
|
||||
get_filename_component( result "${inputFile}" NAME_WE )
|
||||
|
||||
message( STATUS "Extracted file name ${result} from path ${inputFile}" )
|
||||
|
||||
# Create include and source file name from the list file name.
|
||||
set( includeFileName "${outputPath}/${result}_base.h" )
|
||||
set( sourceFileName "${outputPath}/${result}_base.cpp" )
|
||||
|
||||
# Create tag for generating header file.
|
||||
string( TOUPPER "${result}" fileNameTag )
|
||||
set( headerTag "_${fileNameTag}_H_" )
|
||||
|
||||
set( includeFileHeader
|
||||
"
|
||||
/*
|
||||
* Do not modify this file it was automatically generated by the TokenList2DsnLexer CMake
|
||||
* script.
|
||||
*/
|
||||
|
||||
#ifndef ${headerTag}
|
||||
#define ${headerTag}
|
||||
|
||||
#include \"dsnlexer.h\"
|
||||
|
||||
namespace DSN {
|
||||
|
||||
enum DSN_T {
|
||||
|
||||
// these first few are negative special ones for syntax, and are
|
||||
// inherited from DSNLEXER.
|
||||
T_NONE = DSN_NONE,
|
||||
T_COMMENT = DSN_COMMENT,
|
||||
T_STRING_QUOTE = DSN_STRING_QUOTE,
|
||||
T_QUOTE_DEF = DSN_QUOTE_DEF,
|
||||
T_DASH = DSN_DASH,
|
||||
T_SYMBOL = DSN_SYMBOL,
|
||||
T_NUMBER = DSN_NUMBER,
|
||||
T_RIGHT = DSN_RIGHT, // right bracket, ')'
|
||||
T_LEFT = DSN_LEFT, // left bracket, '('
|
||||
T_STRING = DSN_STRING, // a quoted string, stripped of the quotes
|
||||
T_EOF = DSN_EOF, // special case for end of file
|
||||
|
||||
"
|
||||
)
|
||||
|
||||
set( sourceFileHeader
|
||||
"
|
||||
/*
|
||||
* Do not modify this file it was automatically generated by the TokenList2DsnLexer CMake
|
||||
* script.
|
||||
*
|
||||
* Include this file in your lexer class to provide the keywords for you DSN lexer.
|
||||
*/
|
||||
|
||||
#include \"fctsys.h\"
|
||||
#include \"macros.h\"
|
||||
|
||||
#include \"${result}_base.h\"
|
||||
|
||||
|
||||
namespace DSN {
|
||||
|
||||
#define TOKDEF(x) { #x, T_##x }
|
||||
|
||||
const KEYWORD ${result}_keywords[] = {
|
||||
|
||||
"
|
||||
)
|
||||
|
||||
file( STRINGS ${inputFile} tmpTokens NO_HEX_CONVERSION )
|
||||
|
||||
foreach( tmpToken ${tmpTokens} )
|
||||
math( EXPR lineCount "${lineCount} + 1" )
|
||||
|
||||
string( STRIP tmpToken "${tmpToken}" )
|
||||
|
||||
# Ignore empty lines.
|
||||
if( tmpToken )
|
||||
# Make sure token is valid.
|
||||
string( REGEX MATCH "[a-z][_0-9a-z]*[0-9a-z]$" validToken "${tmpToken}" )
|
||||
if( validToken STREQUAL tmpToken )
|
||||
list( APPEND tokens "${validToken}" )
|
||||
else( validToken STREQUAL tmpToken )
|
||||
message( FATAL_ERROR
|
||||
"Invalid token string \"${tmpToken}\" at line ${lineCount} in file "
|
||||
"<${inputFile}>." )
|
||||
endif( validToken STREQUAL tmpToken )
|
||||
endif( tmpToken )
|
||||
endforeach( tmpToken ${tmpTokens} )
|
||||
|
||||
list( SORT tokens )
|
||||
|
||||
# Check for duplicates.
|
||||
list( LENGTH tokens tokensBefore )
|
||||
list( REMOVE_DUPLICATES tokens )
|
||||
list( LENGTH tokens tokensAfter )
|
||||
|
||||
if( NOT ( tokensBefore EQUAL tokensAfter ) )
|
||||
message( FATAL_ERROR "Duplicate tokens found in file <${inputFile}>." )
|
||||
endif( NOT ( tokensBefore EQUAL tokensAfter ) )
|
||||
|
||||
file( WRITE "${includeFileName}" "${includeFileHeader}" )
|
||||
file( WRITE "${sourceFileName}" "${sourceFileHeader}" )
|
||||
|
||||
set( lineCount 1 )
|
||||
|
||||
foreach( token ${tokens} )
|
||||
if( lineCount EQUAL 1 )
|
||||
file( APPEND "${includeFileName}" " T_${token} = 0" )
|
||||
else( lineCount EQUAL 1 )
|
||||
file( APPEND "${includeFileName}" " T_${token}" )
|
||||
endif( lineCount EQUAL 1 )
|
||||
|
||||
file(APPEND "${sourceFileName}" " TOKDEF( ${token} )" )
|
||||
|
||||
if( lineCount EQUAL tokensAfter )
|
||||
file( APPEND "${includeFileName}" "\n" )
|
||||
file( APPEND "${sourceFileName}" "\n" )
|
||||
else( lineCount EQUAL tokensAfter )
|
||||
file( APPEND "${includeFileName}" ",\n" )
|
||||
file( APPEND "${sourceFileName}" ",\n" )
|
||||
endif( lineCount EQUAL tokensAfter )
|
||||
math( EXPR lineCount "${lineCount} + 1" )
|
||||
endforeach( token ${tokens} )
|
||||
|
||||
file( APPEND "${includeFileName}"
|
||||
"};
|
||||
|
||||
|
||||
} // End namespace DSN
|
||||
|
||||
|
||||
#endif // End ${headerTag}
|
||||
"
|
||||
)
|
||||
|
||||
file( APPEND "${sourceFileName}"
|
||||
"};
|
||||
|
||||
|
||||
const unsigned ${result}_keyword_count = DIM( ${result}_keywords );
|
||||
|
||||
|
||||
} // End namespace DSN
|
||||
"
|
||||
)
|
|
@ -235,10 +235,8 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
|||
for( unsigned i = 0; i < screen->m_GridList.GetCount(); i++ )
|
||||
{
|
||||
tmp = screen->m_GridList[i];
|
||||
double gridValueInch = To_User_Unit( 0, tmp.m_Size.x,
|
||||
m_InternalUnits );
|
||||
double gridValue_mm = To_User_Unit( 1, tmp.m_Size.x,
|
||||
m_InternalUnits );
|
||||
double gridValueInch = To_User_Unit( 0, tmp.m_Size.x, m_InternalUnits );
|
||||
double gridValue_mm = To_User_Unit( 1, tmp.m_Size.x, m_InternalUnits );
|
||||
|
||||
if( tmp.m_Id == ID_POPUP_GRID_USER )
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ set(EESCHEMA_SRCS
|
|||
class_text-label.cpp
|
||||
classes_body_items.cpp
|
||||
cleanup.cpp
|
||||
cmp_library_lexer.cpp
|
||||
controle.cpp
|
||||
cross-probing.cpp
|
||||
dangling_ends.cpp
|
||||
|
@ -153,13 +154,33 @@ if(APPLE)
|
|||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.eeschema)
|
||||
endif(APPLE)
|
||||
|
||||
add_executable(eeschema WIN32 MACOSX_BUNDLE ${EESCHEMA_SRCS} ${EESCHEMA_EXTRA_SRCS} ${EESCHEMA_RESOURCES})
|
||||
# Generate DSN lexer header and source files for the component library file
|
||||
# format.
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
|
||||
-P ${CMAKE_MODULE_PATH}/TokenList2DsnLexer.cmake
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst
|
||||
COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h(.cpp)
|
||||
from ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library.lst"
|
||||
)
|
||||
|
||||
set_source_files_properties( cmp_library_lexer.cpp
|
||||
PROPERTIES
|
||||
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cmp_library_base.h
|
||||
)
|
||||
|
||||
add_executable(eeschema WIN32 MACOSX_BUNDLE ${EESCHEMA_SRCS} ${EESCHEMA_EXTRA_SRCS}
|
||||
${EESCHEMA_RESOURCES})
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(eeschema PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
set_target_properties(eeschema PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries(eeschema common bitmaps kbool polygon ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
|
||||
target_link_libraries(eeschema common bitmaps kbool polygon ${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES})
|
||||
|
||||
install(TARGETS eeschema
|
||||
DESTINATION ${KICAD_BIN}
|
||||
|
|
|
@ -135,3 +135,15 @@ EDA_Rect SCH_MARKER::GetBoundingBox()
|
|||
return GetBoundingBoxMarker();
|
||||
}
|
||||
|
||||
|
||||
void SCH_MARKER::DisplayInfo( WinEDA_DrawFrame* aFrame )
|
||||
{
|
||||
if( aFrame == NULL )
|
||||
return;
|
||||
|
||||
wxString msg;
|
||||
|
||||
aFrame->ClearMsgPanel();
|
||||
aFrame->AppendMsgPanel( _( "Electronics rule check error" ),
|
||||
GetReporter().GetErrorText(), DARKRED );
|
||||
}
|
||||
|
|
|
@ -100,13 +100,20 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Compare DRC marker main and auxilary text against search string.
|
||||
* Compare DRC marker main and auxiliary text against search string.
|
||||
*
|
||||
* @param aSearchData - Criteria to search against.
|
||||
* @return True if the DRC main or auxiliary text matches the search criteria.
|
||||
*/
|
||||
virtual bool Matches( wxFindReplaceData& aSearchData );
|
||||
|
||||
/**
|
||||
* Show the marker electronics rule check error on the message panel.
|
||||
*
|
||||
* @param aFrame - Top window that owns the message panel.
|
||||
*/
|
||||
void DisplayInfo( WinEDA_DrawFrame* aFrame );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
header
|
||||
version
|
||||
name
|
||||
author
|
||||
comment
|
||||
license
|
||||
url
|
||||
copyright
|
||||
symbol
|
||||
component
|
||||
field
|
||||
tags
|
||||
docs
|
||||
drawing
|
||||
arc
|
||||
start
|
||||
end
|
||||
rectangle
|
||||
position
|
||||
width
|
||||
height
|
||||
polyline
|
||||
circle
|
||||
center
|
||||
radius
|
||||
text
|
||||
orientation
|
||||
pin
|
||||
number
|
||||
length
|
||||
electical_type
|
||||
style
|
||||
fill_style
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Do not delete this file. It will eventually become the new component
|
||||
* library file DSN lexer which will replace the current library and library
|
||||
* document file formats.
|
||||
*/
|
||||
#include "cmp_library_base.cpp"
|
|
@ -35,8 +35,7 @@
|
|||
*
|
||||
* For some items, characteristics are displayed on the screen.
|
||||
*/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
|
||||
bool IncludePin )
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
|
||||
{
|
||||
SCH_ITEM* DrawStruct;
|
||||
wxString msg;
|
||||
|
@ -115,10 +114,8 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay(
|
|||
*
|
||||
* For some items, characteristics are displayed on the screen.
|
||||
*/
|
||||
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
|
||||
const wxPoint& refpoint,
|
||||
bool
|
||||
IncludePin )
|
||||
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
||||
bool IncludePin )
|
||||
{
|
||||
SCH_ITEM* DrawStruct;
|
||||
LIB_PIN* Pin;
|
||||
|
@ -129,9 +126,10 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
|
|||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKERITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
ClearMsgPanel();
|
||||
DrawStruct->DisplayInfo( this );
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NOCONNECTITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
|
|
|
@ -80,8 +80,7 @@ void WinEDA_SchematicFrame::LoadLibraries( void )
|
|||
{
|
||||
wxString prompt;
|
||||
|
||||
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
|
||||
Error: %s" ),
|
||||
prompt.Printf( _( "Component library <%s> failed to load.\n\n\Error: %s" ),
|
||||
GetChars( fn.GetFullPath() ),
|
||||
GetChars( errMsg ) );
|
||||
DisplayError( this, prompt );
|
||||
|
|
|
@ -99,7 +99,8 @@ IMPLEMENT_APP( WinEDA_App )
|
|||
/* 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;
|
||||
WinEDA_SchematicFrame * frame = ((WinEDA_SchematicFrame*) GetTopWindow());
|
||||
|
||||
|
@ -168,9 +169,12 @@ bool WinEDA_App::OnInit()
|
|||
/* Load file specified in the command line. */
|
||||
if( filename.IsOk() )
|
||||
{
|
||||
wxLogDebug( wxT( "Loading schematic file " ) + filename.GetFullPath() );
|
||||
|
||||
if( filename.GetExt() != SchematicFileExtension )
|
||||
filename.SetExt( SchematicFileExtension );
|
||||
wxSetWorkingDirectory( filename.GetPath() );
|
||||
|
||||
if( frame->DrawPanel
|
||||
&& frame->LoadOneEEProject( filename.GetFullPath(), false ) <= 0 )
|
||||
frame->DrawPanel->Refresh( true );
|
||||
|
|
|
@ -50,8 +50,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
|||
* Schematic root file and its subhierarchies, the configuration and the libs
|
||||
* which are not already loaded)
|
||||
*/
|
||||
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||
bool IsNew )
|
||||
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
wxString FullFileName, msg;
|
||||
|
@ -59,8 +58,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||
screen = ScreenList.GetNext() )
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
if( screen->IsModify() )
|
||||
break;
|
||||
|
@ -157,9 +155,11 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
* and after (due to code change): <root_name>-cache.lib
|
||||
* so if the <name>-cache.lib is not found, the old way will be tried
|
||||
*/
|
||||
bool use_oldcachename = false;
|
||||
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
|
||||
bool use_oldcachename = false;
|
||||
wxString cachename = fn.GetName() + wxT("-cache");
|
||||
|
||||
fn.SetName( cachename );
|
||||
fn.SetExt( CompLibFileExtension );
|
||||
if( ! fn.FileExists() )
|
||||
|
@ -197,8 +197,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
{
|
||||
wxString prompt;
|
||||
|
||||
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
|
||||
Error: %s" ),
|
||||
prompt.Printf( _( "Component library <%s> failed to load.\n\n\Error: %s" ),
|
||||
GetChars( fn.GetFullPath() ),
|
||||
GetChars( errMsg ) );
|
||||
DisplayError( this, prompt );
|
||||
|
|
|
@ -24,21 +24,16 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
|||
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
||||
static void ListeObjetConnection( SCH_SHEET_PATH* sheetlist,
|
||||
NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||
NETLIST_OBJECT& ObjNet );
|
||||
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus,
|
||||
int start );
|
||||
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus,
|
||||
int start );
|
||||
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, NETLIST_OBJECT& ObjNet );
|
||||
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start );
|
||||
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus, int start );
|
||||
static void LabelConnect( NETLIST_OBJECT* Label );
|
||||
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||
|
||||
// Sort functions used here:
|
||||
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
|
||||
const NETLIST_OBJECT* Objet2 );
|
||||
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
|
||||
const NETLIST_OBJECT* Objet2 );
|
||||
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
||||
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
||||
|
||||
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
|
||||
static int LastNetCode, LastBusNetCode;
|
||||
|
@ -86,7 +81,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
|||
|
||||
NetNumber = 1;
|
||||
|
||||
activity = _( "List" );
|
||||
activity = _( "Building net list:" );
|
||||
SetStatusText( activity );
|
||||
|
||||
FreeNetObjectsList( g_NetObjectslist );
|
||||
|
@ -103,16 +98,14 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
|||
if( g_NetObjectslist.size() == 0 )
|
||||
return; // no objects
|
||||
|
||||
activity.Empty();
|
||||
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) <<
|
||||
g_NetObjectslist.size();
|
||||
activity << wxT( " " ) << _( "net count =" ) << wxT( " " ) << g_NetObjectslist.size();
|
||||
SetStatusText( activity );
|
||||
|
||||
/* Sort objects by Sheet */
|
||||
|
||||
sort( g_NetObjectslist.begin(), g_NetObjectslist.end(), SortItemsBySheet );
|
||||
|
||||
activity << wxT( "; " ) << _( "Conn" );
|
||||
activity << wxT( ", " ) << _( "connections" ) << wxT( "..." );
|
||||
SetStatusText( activity );
|
||||
|
||||
sheet = &(g_NetObjectslist[0]->m_SheetList);
|
||||
|
@ -214,13 +207,13 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
|||
#endif
|
||||
|
||||
|
||||
activity << wxT( " " ) << _( "Done" );
|
||||
activity << _( "done" );
|
||||
SetStatusText( activity );
|
||||
|
||||
/* Updating the Bus Labels Netcode connected by Bus */
|
||||
ConnectBusLabels( g_NetObjectslist );
|
||||
|
||||
activity << wxT( "; " ) << _( "Labels" );
|
||||
activity << wxT( ", " ) << _( "bus labels" ) << wxT( "..." );;
|
||||
SetStatusText( activity );
|
||||
|
||||
/* Group objects by label. */
|
||||
|
@ -259,11 +252,11 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
|||
dumpNetTable();
|
||||
#endif
|
||||
|
||||
activity << wxT( " " ) << _( "Done" );
|
||||
activity << _( "done" );
|
||||
SetStatusText( activity );
|
||||
|
||||
/* Connection hierarchy. */
|
||||
activity << wxT( "; " ) << _( "Hierar." );
|
||||
activity << wxT( ", " ) << _( "hierarchy..." );
|
||||
SetStatusText( activity );
|
||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||
{
|
||||
|
@ -280,7 +273,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
|||
dumpNetTable();
|
||||
#endif
|
||||
|
||||
activity << wxT( " " ) << _( "Done" );
|
||||
activity << _( "done" );
|
||||
SetStatusText( activity );
|
||||
|
||||
/* Compress numbers of Netcode having consecutive values. */
|
||||
|
|
|
@ -22,17 +22,14 @@
|
|||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#define EraseItem( item ) item->Draw( Panel, DC, wxPoint( 0,\
|
||||
0 ), -1, g_XorMode, NULL,\
|
||||
#define EraseItem( item ) item->Draw( Panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, \
|
||||
DefaultTransformMatrix )
|
||||
|
||||
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre );
|
||||
static void ComputeArcRadiusAngles( LIB_ARC* arc );
|
||||
static wxPoint ComputeCircumCenter( wxPoint A, wxPoint B, wxPoint C );
|
||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
|
||||
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
|
||||
|
||||
|
@ -309,8 +306,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "WinEDA_LibeditFrame::CreateGraphicItem() \
|
||||
error" ) );
|
||||
DisplayError( this, wxT( "WinEDA_LibeditFrame::CreateGraphicItem() error" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -380,9 +376,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
|||
/*
|
||||
* Redraw the graphic shape while moving
|
||||
*/
|
||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase )
|
||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
LIB_DRAW_ITEM* item;
|
||||
|
||||
|
@ -398,8 +392,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
|||
if( erase )
|
||||
{
|
||||
pos = ItemPreviousPos - StartCursor;
|
||||
item->Draw( panel, DC, pos, -1, g_XorMode, NULL,
|
||||
DefaultTransformMatrix );
|
||||
item->Draw( panel, DC, pos, -1, g_XorMode, NULL, DefaultTransformMatrix );
|
||||
}
|
||||
|
||||
/* Redraw moved shape */
|
||||
|
@ -551,7 +544,8 @@ void WinEDA_LibeditFrame::StartModifyDrawSymbol( wxDC* DC )
|
|||
+ (cursor - startPoint).y * (cursor - startPoint).y;
|
||||
|
||||
// Find the right index of the point to be dragged
|
||||
BOOST_FOREACH( wxPoint point, ( ( (LIB_POLYLINE*) m_drawItem )->m_PolyPoints ) ) {
|
||||
BOOST_FOREACH( wxPoint point, ( ( (LIB_POLYLINE*) m_drawItem )->m_PolyPoints ) )
|
||||
{
|
||||
int distancePoint = (cursor - point).x * (cursor - point).x +
|
||||
(cursor - point).y * (cursor - point).y;
|
||||
|
||||
|
@ -662,7 +656,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
> MINIMUM_SELECTION_DISTANCE )
|
||||
{
|
||||
newCenterPoint = ComputeCircumCenter( arcState.startPoint,
|
||||
currentCursorPosition, arcState.endPoint );
|
||||
currentCursorPosition,
|
||||
arcState.endPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -670,14 +665,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
}
|
||||
|
||||
// Determine if the arc angle is larger than 180 degrees -> this happens if both
|
||||
// points (cursor position, center point) lie on the same side of the vector start-end
|
||||
int crossA = CrossProduct( TwoPointVector( arcState.startPoint, arcState.endPoint ),
|
||||
// points (cursor position, center point) lie on the same side of the vector
|
||||
// start-end
|
||||
int crossA = CrossProduct( TwoPointVector( arcState.startPoint,
|
||||
arcState.endPoint ),
|
||||
TwoPointVector( arcState.endPoint,
|
||||
currentCursorPosition ) );
|
||||
int crossB = CrossProduct( TwoPointVector( arcState.startPoint, arcState.endPoint ),
|
||||
int crossB = CrossProduct( TwoPointVector( arcState.startPoint,
|
||||
arcState.endPoint ),
|
||||
TwoPointVector( arcState.endPoint, newCenterPoint ) );
|
||||
|
||||
bool isLarger180degrees = (crossA < 0 && crossB < 0) || (crossA >=0 && crossB >=0);
|
||||
bool isLarger180degrees = ( crossA < 0 && crossB < 0 ) ||
|
||||
( crossA >= 0 && crossB >= 0 );
|
||||
|
||||
if( isLarger180degrees )
|
||||
newCenterPoint = ( (LIB_ARC*) item )->m_Pos;
|
||||
|
@ -804,14 +803,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
if( arcState.stateDrawArc == 1 )
|
||||
{
|
||||
int Color = ReturnLayerColor( LAYER_DEVICE );
|
||||
GRLine( &panel->m_ClipBox,
|
||||
DC,
|
||||
arcState.startPoint.x,
|
||||
-arcState.startPoint.y,
|
||||
arcState.endPoint.x,
|
||||
-arcState.endPoint.y,
|
||||
0,
|
||||
Color );
|
||||
GRLine( &panel->m_ClipBox, DC, arcState.startPoint.x, -arcState.startPoint.y,
|
||||
arcState.endPoint.x, -arcState.endPoint.y, 0, Color );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -973,8 +966,8 @@ static void ComputeArcRadiusAngles( LIB_ARC* arc )
|
|||
/*
|
||||
* Routine for adjusting the parameters of the arc currently being drawn.
|
||||
* Calculates the center, radius, angles for the arc current
|
||||
* Passes through the points arcState.startPoint.x, arcState.endPoint.x Y and Y with the nearest center
|
||||
* of the mouse position.
|
||||
* Passes through the points arcState.startPoint.x, arcState.endPoint.x Y and Y with the
|
||||
* nearest center of the mouse position.
|
||||
* Note: The center is obviously not on the grid
|
||||
*/
|
||||
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
|
||||
|
@ -1100,8 +1093,7 @@ static wxPoint ComputeCircumCenter( wxPoint A, wxPoint B, wxPoint C )
|
|||
*/
|
||||
void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|
||||
{
|
||||
if( m_drawItem == NULL
|
||||
|| m_drawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
|
||||
if( m_drawItem == NULL || m_drawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
|
||||
return;
|
||||
|
||||
LIB_POLYLINE* Poly = (LIB_POLYLINE*) m_drawItem;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <string>
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "pcbnew.h"
|
||||
|
||||
#include "richio.h"
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "dsnlexer.h"
|
||||
|
||||
#include "pcbnew.h"
|
||||
|
||||
|
||||
class TYPE_COLLECTOR; // outside the DSN namespace
|
||||
|
||||
|
|
Loading…
Reference in New Issue