Cleanup some unused files

This commit is contained in:
Ian McInerney 2020-06-19 12:34:15 +01:00
parent aa7ce74ad5
commit fe1e835471
37 changed files with 3 additions and 12611 deletions

View File

@ -43,17 +43,15 @@ our [Forum](https://forum.kicad.info/).
* [include](include) - Interfaces to the common library
* [kicad](kicad) - Sourcecode of the project manager
* [libs](libs) - Sourcecode of kicad utilities (geometry and others)
* [new](new) - Staging area for the new schematic library format
* [pagelayout_editor](pagelayout_editor) - Sourcecode of the pagelayout editor
* [patches](patches) - Collection of patches for external dependencies
* [pcbnew](pcbnew) - Sourcecode of the printed circuit board editor
* [plugins](plugins) - Sourcecode of the new plugin concept
* [polygon](polygon) - Sourcecode of the polygon library
* [qa](qa) - Testcases using the python interface
* [plugins](plugins) - Sourcecode for the 3d viewer plugins
* [qa](qa) - Unit testing framework for KiCad
* [resources](resources) - Resources for freedesktop mime-types for linux
* [scripting](scripting) - SWIG Python scripting definitions and build scripts
* [scripts](scripts) - Example scripts for distribution with KiCad
* [template](template) - Project and pagelayout templates
* [template](template) - Project template
* [thirdparty](thirdparty) - Sourcecode of external libraries used in kicad but not written by Kicad team
* [tools](tools) - Other miscellaneous helpers for testing
* [utils](utils) - Small utils for kicad, e.g. IDF, STEP and OGL tools and converters

View File

@ -1,50 +0,0 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012-2017 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
*/
#include <core/settings.h>
void SETTINGS::Load( wxConfigBase *aConfig )
{
for( PARAM_CFG* param : m_params )
{
if( !!param->m_Group )
aConfig->SetPath( param->m_Group );
else
aConfig->SetPath( wxT("") );
param->ReadParam( aConfig );
}
}
void SETTINGS::Save( wxConfigBase *aConfig )
{
for( PARAM_CFG* param : m_params )
{
if( !!param->m_Group )
aConfig->SetPath( param->m_Group );
else
aConfig->SetPath( wxT("") );
param->SaveParam( aConfig );
}
}

View File

@ -1,127 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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
*/
#ifndef __SETTINGS_H
#define __SETTINGS_H
#include <wx/confbase.h>
#include <config_params.h>
/**
* TOOL_SETTINGS
*
* Manages persistent settings for a tool (just a simple wrapper to wxConfigBase)
*/
class SETTINGS
{
public:
SETTINGS()
{}
virtual ~SETTINGS()
{}
/** Set a prefix that will be prepent to the keywords when adding a setting in list
* @param aPrefix is the string to prepend to the keywords
*/
void SetConfigPrefix( const wxString& aPrefix )
{
m_prefix = aPrefix;
}
/** @return the current prefix
*/
const wxString& GetConfigPrefix()
{
return m_prefix;
}
virtual void Load( wxConfigBase *aConfig );
virtual void Save( wxConfigBase *aConfig );
#if 0
template<class T>
T Get( const wxString& aName, T aDefaultValue ) const
{
wxConfigBase* config = getConfigBase();
if( !config )
return aDefaultValue;
T tmp = aDefaultValue;
config->Read( getKeyName( aName ), &tmp );
return tmp;
}
template<class T>
void Set( const wxString& aName, const T &aValue )
{
wxConfigBase* config = getConfigBase();
if( !config )
return;
config->Write( getKeyName( aName ), aValue );
}
#endif
void Add( const wxString& name, int* aPtr, int aDefaultValue )
{
m_params.push_back( new PARAM_CFG_INT ( m_prefix+name, aPtr, aDefaultValue ) );
}
void Add( const wxString& name, bool* aPtr, bool aDefaultValue )
{
m_params.push_back( new PARAM_CFG_BOOL ( m_prefix+name, aPtr, aDefaultValue ) );
}
void Add( const wxString& name, KIGFX::COLOR4D* aPtr, KIGFX::COLOR4D aDefaultValue )
{
m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
}
void Add( const wxString& name, KIGFX::COLOR4D* aPtr, EDA_COLOR_T aDefaultValue )
{
m_params.push_back( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
}
protected:
virtual wxString getKeyName( const wxString& aEntryName ) const
{
return aEntryName;
}
wxString m_prefix;
std::vector<PARAM_CFG*> m_params;
};
#endif

View File

@ -1,91 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 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
*/
/**
* @file pcbstruct.h
* @brief Classes and definitions used in Pcbnew.
*/
#ifndef PCBSTRUCT_H_
#define PCBSTRUCT_H_
/**
* Enum TRACE_CLEARANCE_DISPLAY_MODE_T
* is the set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
* This parameter controls how to show tracks and vias clearance area.
*/
enum TRACE_CLEARANCE_DISPLAY_MODE_T {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas
SHOW_CLEARANCE_NEW_TRACKS, /* Show clearance areas only for new track
* during track creation. */
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, /* Show clearance areas only for new track
* during track creation, and shows a via
* clearance area at end of current new
* segment (guide to place a new via
*/
SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS,
/* Show clearance for new, moving and
* dragging tracks and vias
*/
SHOW_CLEARANCE_ALWAYS /* Show Always clearance areas
* for track and vias
*/
};
/**
* DISPLAY_OPTIONS
* handles display options like enable/disable some optional drawings.
*/
class DISPLAY_OPTIONS
{
public:
bool m_DisplayPadFill;
bool m_DisplayViaFill;
bool m_DisplayPadNum; // show pads numbers
bool m_DisplayPadIsol;
bool m_DisplayModEdgeFill; // How to display module drawings ( sketch/ filled )
bool m_DisplayModTextFill; // How to display module texts ( sketch/ filled )
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
int m_DisplayZonesMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads
*/
bool m_ContrastModeDisplay;
int m_MaxLinksShowed; // in track creation: number of hairwires shown
bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest
public:
DISPLAY_OPTIONS();
};
#endif // PCBSTRUCT_H_

View File

@ -1,251 +0,0 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2011 Kicad Developers, see change_log.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
#
# for now, this is a stand alone project
if( 1 )
project(kicad-new)
cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ )
# message( "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" )
# Path to local CMake modules.
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
include( CheckFindPackageResult )
find_package(Doxygen)
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
if(APPLE)
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else()
find_package(wxWidgets COMPONENTS gl adv html core net base xml aui QUIET )
endif()
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
# make config.h
include( PerformFeatureChecks )
perform_feature_checks()
# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )
include_directories( ${PROJECT_SOURCE_DIR}/include )
if(CMAKE_COMPILER_IS_GNUCXX)
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG ")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
endif(CMAKE_COMPILER_IS_GNUCXX)
include(Functions)
endif()
#================================================
# Doxygen Output
#================================================
if(DOXYGEN_FOUND)
add_custom_target( new-docs ${DOXYGEN_EXECUTABLE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS Doxyfile )
else(DOXYGEN_FOUND)
message( STATUS "WARNING: Doxygen not found - new-docs (Source Docs) target not created" )
endif()
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
include_directories( ${CMAKE_BINARY_DIR} )
#=====<on standby for possible C++ unit testing>================================
if( false )
add_executable( test_dir_lib_source
sch_dir_lib_source.cpp
)
target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
add_executable( test_sch_part sch_part.cpp )
target_link_libraries( test_sch_part ${wxWidgets_LIBRARIES} )
add_executable( test_lpid
sch_lpid.cpp
)
target_link_libraries( test_lpid ${wxWidgets_LIBRARIES} )
endif( false )
#=====</on standby for possible C++ unit testing>===============================
add_library( sweet SHARED
sch_lib_table.cpp
sch_lib.cpp
sch_lpid.cpp
sch_dir_lib_source.cpp
sch_part.cpp
sch_sweet_parser.cpp
${PROJECT_SOURCE_DIR}/common/richio.cpp
${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp
)
make_lexer(
sweet
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table.keywords
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_keywords.cpp
LT
)
make_lexer(
sweet
${CMAKE_CURRENT_SOURCE_DIR}/sweet.keywords
${CMAKE_CURRENT_SOURCE_DIR}/sweet_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/sweet_keywords.cpp
PR
)
target_link_libraries( sweet ${wxWidgets_LIBRARIES} )
# talk to import_export.h
set_target_properties( sweet PROPERTIES
DEFINE_SYMBOL COMPILING_DLL
)
add_executable( test_sch_lib_table test_sch_lib_table.cpp )
if( MINGW )
set_target_properties( test_sch_lib_table PROPERTIES
LINK_FLAGS -Wl,--enable-auto-import
)
endif()
target_link_libraries( test_sch_lib_table sweet )
if( 1 )
find_library( gal_LIBRARY "libgal.a"
PATHS
"${CMAKE_CURRENT_SOURCE_DIR}/../../kicad-gal/build"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../kicad-gal/build"
DOC
"Where is the static GAL library"
)
find_path( gal_ROOT NAMES "README.txt"
PATHS
"${CMAKE_CURRENT_SOURCE_DIR}/../../kicad-gal"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../kicad-gal"
DOC
"Where is the base include directory for the GAL library"
)
else()
# we build the GAL library, therefore we know where it is, no need to find_library() it.
set( gal_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gal-src" )
set( gal_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/gal-src/libgal.a" )
include( ExternalProject )
ExternalProject_Add( ki_gal
# skip the install step, build in source, use from source
SOURCE_DIR "${gal_ROOT}"
STAMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/gal-stamps"
TIMEOUT 120
DOWNLOAD_COMMAND bzr export ${gal_ROOT} lp:~kicad-testing-committers/kicad/kicad-gal
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${gal_ROOT}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND ""
)
endif()
include_directories( "${gal_ROOT}" )
# Find pkg-config in order find cairo.
find_package( PkgConfig REQUIRED )
# Find cairo.
#pkg_search_module( CAIRO REQUIRED cairo>=1.8.1 )
#include_directories( ${CAIRO_INCLUDE_DIRS} )
# Find the OpenGL libraries (gl and glu)
find_package( OpenGL )
# Find GLEW
pkg_search_module( GLEW REQUIRED glew>=1.5.0 )
include_directories( ${GLEW_INCLUDE_DIRS} )
include_directories( ${gal_ROOT} )
add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp sch_canvas.cpp )
target_link_libraries( sweet_edit
sweet
${OPENGL_LIBRARIES}
${gal_LIBRARY}
${wxWidgets_LIBRARIES}
${GLEW_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
#=====<USE_SWIG>============================================================
# if you want a Python scripting layer on top for unit testing or driving.
# reference: http://www.swig.org/Doc1.3/Introduction.html#Introduction_build_system
option( USE_SWIG "Use SWIG to build a python scripting interface (default OFF)." OFF)
if( USE_SWIG )
find_package( SWIG REQUIRED )
include( ${SWIG_USE_FILE} )
# first install "python-dev" linux package for this:
find_package( PythonLibs )
include_directories( ${PYTHON_INCLUDE_PATH} )
set( CMAKE_SWIG_FLAGS "" )
set_source_files_properties( sweet.i PROPERTIES CPLUSPLUS ON )
#set_source_files_properties( sweet.i PROPERTIES SWIG_FLAGS "-includeall" )
swig_add_module( sweet python sweet.i )
swig_link_libraries( sweet ${PYTHON_LIBRARIES} sweet )
# @todo need a separate interface for each DSNLEXER
endif()

File diff suppressed because it is too large Load Diff

View File

@ -1,476 +0,0 @@
namespace SCH {
/** @mainpage
This file describes the design of a new Distributed Library System for KiCad's
EESCHEMA. Many of the concepts can be adapted with modest modification to PCBNEW
also, in the future.
@author Dick Hollenbeck <dick@softplc.com>
@date October 2010 - January 2011
@section intr_sec Introduction
Schematic <b>parts</b> are frequently needed to complete a circuit design
schematic. Computer data entry of parts can be a rate limiting step in the
design of an overall PCB. Having ready made access to all needed parts in a
design significantly improves the productivity of a circuit designer. Sharing
parts within an organization is one step in the right direction, but there is
opportunity to share across organizational boundaries to improve productivity
even more. Using a part that someone else in another organization has already
entered into the computer can eliminate the first data input process for that
part. The more complicated the part and the board, the larger the positive
impact on productivity because the larger the time savings.
<p> Sharing parts within an organization is best done by directly accessing a
known internal source for those parts, say on a company network. Sharing parts
across organizational boundaries is best done using the Internet in real-time.
Having the ability to search for a part based on arbitrary search criteria can
speed up the pace at which new parts are found and used.
<p> Electronic component manufacturers need and look for ways to differentiate
their products from their competitors. With this Distributed Library System
facility in KiCad, one way for manufacturers to differentiate themselves and
their parts is to publish a part library on the Internet and save their
customers the work of doing the data entry of the part into the KiCad design
system.
<p> Maintaining a comprehensive part library is a fairly labor intensive
activity. New parts come into the market everyday. By being able to publish a
superior library on the Internet, it may be possible to make a for profit
business out of doing this. The KiCad eco-system would benefit should this
happen, and there could even be competition between such businesses. Or there
can be library specializations or niches.
<p> Often a found part is close to what is needed but not exactly what is
needed. This Distributed Library System design incorporates the concept of part
inheritance using a part description language called <b>Sweet</b>. Sweet is
based on s-expression syntax. Inheritance is the ability to incrementally change
an existing part without completely re-designing it. It is sometimes easier to
modify an existing part than it is to create the new part entirely from scratch.
<p> This Distributed Library System design will have the capability to
significantly benefit the KiCad eco-system, and that should mean expanding the
numbers of users and contributors to the project, and hopefully making for a
better KiCad tool-set for all.
@section definitions Definitions
Only new terms or changes in the definition of terms are given here.
<dl>
<dt>S-Expression</dt><dd>This is a syntactical textual envelop in the same vain as
XML. It may be used to express any number of domain specific grammars. It uses
parentheses to indicate the start and end of an element. A domain specific
grammar is a set of rules that dictate what keywords may be used, and in what
context. A grammar also establishes the allowed places and types of constants.
There can be any number of grammars which all use s-expressions to hold the
individual elements within the grammar. A grammar is at a higher level than
s-expressions, in the same way that a sentence will have grammatical rules which
are at a higher level than the rules used to spell words. Technically, grammars
nest within grammars. So once you are inside a grammatical element, it will have
its own set of rules as to which nested elements it may hold, and once you enter
one of those nested elements, then that nested element's grammar pertains,
etc.<p> In the case of the grammar for a part, the grammar itself is being given
the name Sweet. The name does not extend to the grammar for the schematic,
only the part grammar.</dd>
<dt>Schematic</dt><dd>This consists of one or more sheets and will be different
in three ways from existing schematics. <ul>
<li>All sheets will be in one file, thus the entire schematic is in one file.
<li>The schematic file will have its own s-expression grammar.
<li> There will be a <b>parts list</b> within the schematic, and within the
parts list will be <b>all</b> the parts for the schematic. yes <b>all</b> of
them. See class PARTS_LIST.</ul>
Within the sheets of the schematic will be components.</dd>
<dt>Component</dt><dd>A component is an instantiated part. The keyword for
component is (comp). A component does not have any of its own properties other
than: <ul> <li>rerence designator <li>part pointer or reference into the parts
list <li>location <li>rotation <li>stuff i.e. DNS or do stuff the part
<li>visual textual effect overrides </ul> Note that the (comp) may not have any
properties or fields of its own, and that it may not exist without a
corresponding part in the parts_list. A reason for this is to ensure that a
BOM can be made simply from the parts_list.</dd>
<dt>Component, again for good measure.</dt><dd>A component is an instantiation
of a part. A component exists within a schematic which has a parts list
containing the part from which the component is instantiated. A component has a
unique reference designator, part ref, its own location, orientation,
stuff/DNS, and text attributes but <b>not</b> its own text fields/strings (other
than reference designator). The part which is instantiated must exist in the
parts list of the same schematic.</dd>
<dt>Inheritance</dt><dd>Is the ability to mimic form and function from another
entity. In our case we use it only for parts. One part may "inherit from" or
"extend" another single part.</dd>
<dt>Part</dt><dd>A part is a symbolic schematic circuit element found within an
EESCHEMA library (or within a parts list). It is re-usable and may be
instantiated more than once within a schematic. For it to be instantiated, it
must be copied or inherited into the parts list of the instantiating schematic.
If inherited into the parts list, then only a concise reference is needed into
the originating library. If instead it is copied into the parts list, then the
part is fully autonomous and need have no reference to its original copy.</dd>
<dt>Parts List</dt><dd>A parts list, keyword (parts_list), is an entirely new
construct. It exists within a schematic and is the complete set of parts used
within a particular schematic. Each schematic has exactly one parts list
contained within it. A parts list is also a library source and a library sink
for the current schematic. A parts list in any schematic may also be a library
source for any other schematic, but not a library sink. The parts list construct
makes it almost wholly unnecessary to write to other types of library
sinks.</dd>
<dt>Library</dt><dd>A library is no longer a file. It is a memory cache of
parts, consistent with the normal definition of memory cache. Each library is
backed up with a <b>library source</b>. In rare cases, some libraries may also
have a <b>library sink</b>.</dd>
<dt>Library Source</dt><dd>A library source is an abstract read only repository
of parts. The repository itself might exist on the moon. The difference between
a library source and a library sink is that a source is a readable entity.</dd>
<dt>Library Sink</dt><dd>A library sink is an abstract place that parts can be
written to for future reading. The difference between a library source and a
library sink is that a library sink is a writable entity.</dd>
<dt>Symbol</dt><dd>The term "symbol" is not used in a specific way in this
document. There is no symbol in any of the grammars, so use of it on the
developers list will not be understood without explanation. Of course it is
possible to have multiple parts all extend a common base part, and you can think
of the base part as having most if not all the graphical lines for any
derivatives. But we do not need to use the term symbol to describe that
relationship, the term "part" is sufficient.</dd>
<dt>LPID</dt><dd>This stands for "Logical Part ID", and is a reference to any
part within any known library. The term "logical" is used because the contained
library name is logical, not a full library name. The LPID consists of 3 main
portions: logical library name, part name, and revision number.</dd>
<dt>Library Table</dt><dd>This is a lookup table that maps a logical library
name (i.e. a short name) into a fully specified library name and library type.
An applicable library table consists of rows from (at least) two sources:<ol>
<li>A schematic resident library table.
<li>A personal library table.
</ol>
These rows from the two sources are conceptually concatonated (although they may
not be physically concatonated in the implementation, TBD). The schematic
resident rows take presedence over the personal library table if there are
logical library names duplicately defined. (Or we will simply ask that any remote
(i.e. public) libraries use uppercase first letters in logical names, TBD.)
<p> Eventually there will be an external publicly available internet based
logical library table also, but this will need to be glued down at a hard coded
URL that we have control over. The internet based library table allows us to
advertise remote libraries without having to issue an update to KiCad.</dd>
<dt>Query Language</dt><dd>This is a means of searching for something that is
contained within a container. Since some library sources are remote, it is
important to be able to ask the library source for a part that matches some
criteria, for performance reasons.</dd>
</dl>
@section changes Required Changes
In order fulfill the vision embodied by this Distributed Library System design,
it will be necessary to change many APIs and file formats within EESCHEMA. In
fact, the entire schematic file format will be new, based on s-expressions,
the schematic grammar, and the Sweet language for parts.
Here are some of the changes required: <ul>
<li> All sheets which make up a schematic will go into a single s-expression
file. The multiple sheet support will still exist, but all the sheets for a
single schematic are all in a single file.
<li> A "library" is a collection of "parts". The unit of retrieval from a
library is a part as a textual string in the Sweet language. Sweet is a
particular "grammar" expressed in s-expression form, and can be used to fully
describe parts. Because EESCHEMA does not actually see a "library file",
(remember, EESCHEMA can only ask for a part), the actual file format for a
library is no longer pertinent nor visible to the core of EESCHEMA. The unit of
retrieval from the API is the part, so EESCHEMA gets an entire part s-expression
and must then parse it as a RAM resident Sweet string.
<li>EESCHEMA knows of no library files, instead there is a library API which
abstracts the actual part storage strategy used within any library
implementation. The API can be implemented by anyone wanting to provide a
library under a given storage strategy. The API provides a storage strategy
abstraction in classes LIB_SOURCE and LIB_SINK. The actual storage strategy used
in any particular library implementation is not technically part of the
conceptual core of EESCHEMA. This is an important concept to grasp. Eventually
the library implementations may be jetisoned into a plug-in structure, but
initially they are statically linked into EESCHEMA. Should the plug-in strategy
ever get done, the boundary of the plug-in interface will remain the C++ library
API as given here (mostly in class LIB_SOURCE). The only reason to introduce a
plug-in design is to allow proprietary closed source library implementations,
and this could eventually come about if a part vendor wanted to provide one for
the KiCad project. If a Texas Instruments type of company wants to maintain a
KiCad library, we will be positioned to accommodate them. Until then, the
LIB_SOURCE implementations can be statically linked into EESCHEMA and there is
no conceptual disruption either way.
<li> Most library implementations are read only. There are only two library
types that are writable, the "dir" type, and the "parts list". All other types
are read only from the perspective of the API. Stuffing those read only
libraries and maintaining them will be done using the normal update mechanisms
pertinent to the library's respective type of repository. The most common place
to do incremental enhancements to a part before using it is not in the external
library, but now in the parts list with this new design.
<li> The design will support classical clipboard usage. The part in the Sweet
language can be placed onto the clipboard for use by other applications and
instances of EESCHEMA. Eventually larger blocks of components may also be
supported on the clipboard, since the Sweet language allows these blocks to be
descributed textually in a very readable fashion. (Clipboard support beyond part
manipulation is not currently in this revision of the design however, it can be
a future separate enhancement. Perhaps someday complete sheets may be passed
through the clipboard.)
<li> The cumulative set of required changes are significant, and are tantamount
to saying that EESCHEMA will need its part handling foundations re-written. A
conversion program will convert everything over to the new architecture. The
conversion program can simplify things by simply putting all schematic parts
into a parts list within each schematic.
<li> An Internet connection is required to use some of the library sources. It
will be possible to omit these library sources and run KiCad by doing a
configuration change. Eventually, some library sources will spring up and will
not technically be part of the KiCad project, so they will remain remote, but
fully usable to those with an internet connection and permission from the
library source's owner.
<li>By far, even as radical as the distributed library concept is, complete with
remote access, the most significant conceptual change is the introduction of the
<b>parts list</b>. This is a special library that exists in a schematic, and is
the complete record of all parts used within that same schematic. It is
impossible to put a component into a schematic without that component's part
first existing within the parts list of that schematic.
<li> Because of inheritance, multi-body-form parts, alternate body styles, see
also references, and other needs, it is necessary to have a <b>part reference
mechanism</b>. A component has to reference a part, the one it "is". A part has
to be able to reference another part, either in the same library or elsewhere.
Enter the Logical Part ID, or LPID to serve this need. An LPID consists of a
logical library name, a part name, and an optional revision. It is used to
reference parts, from anywhere. If the reference is from a sheet's component,
then the logical library name of the LPID is not needed. Why? Well if you've
been paying attention you know. A comp can only be based on a part that exists
within the parts_list of the same schematic in which it resides. Likewise, a
part within any library that references another part in that <b>same</b> library
will also omit the logical library name from the LPID, and it must omit it. Why?
Well because it makes renaming the library easier, for one. Two, the logical
library name is only a lookup key into a "library table". The library table maps
the logical library name into an actual library source [and sink, iff writable].
See LIB_SOURCE and LIB_SINK.
<p> In the case of the component referencing the part that it "is", there is no
revision number allowed in the LPID. This is because that reference is to the
part in the parts list, and the parts list only holds a single revision of any
part (where "revision" is what you understand from version control systems).
<li> There needs to be a new query language designed and each library source
needs to support it. See LIB_SOURCE::FindParts() for a brief description of one.
</ul>
@section philosophy Design Philosophies
<p> Class names are chosen to be as concise as possible. Separate namespaces can be
used should these same class names be needed in both EESCHEMA and PCBNEW (later).
However, this design does not yet address PCBNEW. Suggested namespaces are
SCH for EESCHEMA, and PCB for PCBNEW.
<p> Since most if not all the APIs deal with file or non-volatile storage, only
8 bit string types are used. For international strings, UTF-8 is used, and
that is what is currently in use within the KiCad file storage formats.
<p> The typedef <b>STRINGS</b> is used frequently as a holder for multiple
std::strings. After some research, I chose std::dequeue<STRING> to hold a list of
STRINGs. I thought it best when considering overall speed, memory
fragmentation, memory efficiency, and speed of insertion and expansion.
<p> A part description language is introduced called <b>(Sweet)</b>. It supports
inheritance and its syntax is based on s-expressions.
<p> Since a part can be based on another part using inheritance, it is important
to understand the idea of library dependencies. A part in one library can be
dependent on another part in another library, or on another part in the same
library as itself. There are several library sources, some far away and some
very close to the schematic. The closest library to the schematic is the
<b>(parts list)</b> class PARTS_LIST. Circular dependencies are not allowed. All
dependencies must be resolvable in a straight forward way. This means that a
part in a remote library cannot be dependent on any part which is not always
resolvable.
<p> NRVO described:
http://msdn.microsoft.com/en-us/library/ms364057%28VS.80%29.aspx
Even with NRVO provided by most C++ compilers, I don't see it being as lean as
having class LIB keep expanded members STRING fetch and STRINGS vfetch for the
aResults values. But at the topmost API, client convenience is worth a minor
sacrifice in speed, so the topmost API does return these complex string objects
for convenience. So there is a different strategy underneath the hood than what
is used on the hood ornament. When aResults pointer is passed as an argument, I
won't refer to this as 'returning' a value, but rather 'fetching' a result to
distinguish between the two strategies.
<p> Functions named as lookupSomething() or LookupSomething() are to be understood
as "find and load if needed". This is different than a simple find operation only, in
that an implied load operation is also done, but only if needed.
@section architecture Architecture
This document set later shows some <b>library sources</b> derived from class
LIB_SOURCE. A library source is the backing to a library. The class name for a
library in the new design is LIB.
<p>
<IMG SRC="../drawing.png" ALT="You should see design architecture here">
*/
/**
* @defgroup string_types STRING Types
* Provide some string types for use within the API.
*/
/**
* @defgroup exception_types Exception Types
* Provide some exception types for use within the API.
*/
/**
* HTTP_LIB_SOURCE
* implements a LIB_SOURCE to access a remote document root repository using http protocol.
*/
class HTTP_LIB_SOURCE : public LIB_SOURCE
{
friend class LIB_TABLE; ///< constructor the LIB uses these functions.
protected:
/**
* Constructor ( const STRING& aHttpURL )
* sets up a LIB_SOURCE using aHttpURI which points to a subversion
* repository.
* @see LIB_TABLE::LookupPart()
*
* @param aHttpURL is a full URL of a document root repo directory. Example might
* be "http://kicad.org/libs"
*
* @param aOptions is the options string from the library table. It can be any
* string that the LIB_SOURCE can parse and understand, perhaps using comma separation
* between options. Options and their syntax is LIB_SOURCE implementation specific.
*/
HTTP_LIB_SOURCE( const STRING& aHttpURL, const STRING& aOptions ) throws( IO_ERROR );
};
/**
* SVN_LIB_SOURCE
* implements a LIB_SOURCE to access a [remote or local] subversion repository
* using subversion client protocol.
*/
class SVN_LIB_SOURCE : public LIB_SOURCE
{
friend class LIB_TABLE; ///< constructor the LIB uses these functions.
protected:
/**
* Constructor SVN_LIB_SOURCE( const STRING& aSvnURL )
* sets up a LIB_SOURCE using aSvnURI which points to a subversion
* repository.
* @see LIB_TABLE::LookupPart().
*
* @param aSvnURL is a full URL of a subversion repo directory. Example might
* be "svn://kicad.org/repos/library/trunk"
*
* @param aOptions is the options string from the library table. It can be any
* string that the LIB_SOURCE can parse and understand, perhaps using comma separation
* between options. Options and their syntax is LIB_SOURCE implementation specific.
*/
SVN_LIB_SOURCE( const STRING& aSvnURL, const STRING& aOptions ) throws( IO_ERROR );
};
/**
* SCHEMATIC_LIB_SOURCE
* implements a LIB_SOURCE in by reading a parts list from schematic file
* unrelated to the schematic currently being edited.
*/
class SCHEMATIC_LIB_SOURCE : public LIB_SOURCE
{
friend class LIB_TABLE; ///< constructor the LIB uses these functions.
protected:
/**
* Constructor SCHEMATIC_LIB_SOURCE( const STRING& aSchematicFile )
* sets up a LIB_SOURCE using aSchematicFile which is a full path and filename
* for a schematic not related to the schematic being editing in
* this EESCHEMA session.
* @see LIB_TABLE::LookupPart().
*
* @param aSchematicFile is a full path and filename. Example:
* "/home/user/kicadproject/design.sch"
*
* @param aOptions is the options string from the library table. It can be any
* string that the LIB_SOURCE can parse and understand, perhaps using comma separation
* between options. Options and their syntax is LIB_SOURCE implementation specific.
*/
SCHEMATIC_LIB_SOURCE( const STRING& aSchematicFile, const STRING& aOptions ) throws( IO_ERROR );
};
/**
* PARTS_LIST
* is a LIB which resides in a SCHEMATIC, and it is a table model for a
* spread sheet both. When columns are added or removed to/from the spreadsheet,
* this is adding or removing fields/properties to/from ALL the contained PARTS.
*/
class PARTS_LIST : public LIB
{
public:
/**
* Function GetModel
* returns a spreadsheet table model that allows both reading and writing to
* rows in a spreadsheet. The UI holds the actual screen widgets, but
* this is the table model, i.e. the PARTS_LIST is.
*/
SPREADSHEET_TABLE_MODEL* GetModel();
};
} // namespace SCH
/// @todo remove endsWithRev() in favor of EndsWithRev(), find home for it.
/// @todo add simple unit test infrastructure.
/// @todo review: http://www.sfml-dev.org/tutorials/1.2/graphics-wxwidgets.php
// EOF

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

View File

@ -1,964 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1012.09"
height="754.09998"
id="svg2"
version="1.1"
inkscape:version="0.47 r22583"
sodipodi:docname="drawing.svg"
inkscape:export-filename="/svn/kicad/new_design/new/drawing.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4">
<marker
inkscape:stockid="Arrow2Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Lend"
style="overflow:visible;">
<path
id="path3674"
style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(1.1) rotate(180) translate(1,0)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<inkscape:perspective
id="perspective2852"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2885"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2932"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2965"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4115"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<marker
inkscape:stockid="Arrow2Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lend-9"
style="overflow:visible">
<path
id="path3674-3"
style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(-1.1,0,0,-1.1,-1.1,0)" />
</marker>
<inkscape:perspective
id="perspective4352"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4990"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="575.26689"
inkscape:cy="1269.5904"
inkscape:document-units="px"
inkscape:current-layer="svg2"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1119"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
units="in"
inkscape:snap-global="false"
objecttolerance="10000"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="false">
<inkscape:grid
type="xygrid"
id="grid2955"
empspacing="10"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="10px"
spacingy="10px"
dotted="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3942"
width="168.57143"
height="41.42857"
x="556.42859"
y="688.38568" />
<rect
style="fill:#00bad5;fill-opacity:0.9605735;stroke:#000000;stroke-width:0.95887607;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect4976"
width="234.49751"
height="98.013084"
x="755.58539"
y="508.26596" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.29770339;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect5805"
width="188.37473"
height="93.374725"
x="793.24127"
y="650.91266" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-298.25658)" />
<rect
style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:1.6983366px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2816"
width="872.59253"
height="273.89703"
x="95.277359"
y="22.688547"
sodipodi:insensitive="true" />
<text
xml:space="preserve"
style="font-size:44.65415192px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="329.44296"
y="69.284828"
id="text2818"
transform="scale(1.086331,0.92052975)"
sodipodi:insensitive="true"><tspan
sodipodi:role="line"
x="329.44296"
y="69.284828"
id="tspan2828">schematic</tspan></text>
<rect
style="fill:#00bad5;fill-rule:evenodd;stroke:#000000;stroke-width:1.41801190000000021px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:0.96057349"
id="rect2826"
width="452.43915"
height="129.58199"
x="90.923286"
y="508.6037" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="175.85715"
y="657.25031"
id="text2828"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2830"
x="175.85715"
y="657.25031">HTTP_LIB_SOURCE</tspan></text>
<g
id="g3856">
<g
transform="translate(18,0)"
id="g3851">
<rect
style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect2833"
width="67.913422"
height="40.639297"
x="130.19307"
y="73.140556" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="138.37057"
y="97.500824"
id="text2835"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="138.37057"
y="97.500824"
id="tspan2839">comp</tspan></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="big blocks" />
<g
id="g3790"
transform="translate(60,-0.71428569)"
sodipodi:insensitive="true">
<rect
y="204.09998"
x="77.85714"
height="75"
width="801.42859"
id="rect2988"
style="fill:#f4d7d7;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3786"
y="221.24283"
x="440"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="221.24283"
x="440"
id="tspan3788"
sodipodi:role="line">parts_list</tspan></text>
</g>
<g
id="g3822">
<g
transform="translate(-12.857147,6.4285736)"
id="g3801">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3795"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text3797"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3799"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<g
id="g3828"
transform="translate(133.32018,-0.3941193)">
<g
id="g3830"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect3832"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3834"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan3836"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<g
transform="translate(259.32018,-0.3941193)"
id="g3838">
<g
transform="translate(-12.857147,6.4285736)"
id="g3840">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3842"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text3844"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3846"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<g
id="g3862"
transform="translate(130,0)">
<g
id="g3864"
transform="translate(18,0)">
<rect
y="73.140556"
x="130.19307"
height="40.639297"
width="67.913422"
id="rect3866"
style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3868"
y="97.500824"
x="138.37057"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
id="tspan3870"
y="97.500824"
x="138.37057"
sodipodi:role="line">comp</tspan></text>
</g>
</g>
<g
transform="translate(256,0)"
id="g3872">
<g
transform="translate(18,0)"
id="g3874">
<rect
style="fill:#ff8080;stroke:#000000;stroke-width:0.76680511;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3876"
width="67.913422"
height="40.639297"
x="130.19307"
y="73.140556" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="138.37057"
y="97.500824"
id="text3878"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="138.37057"
y="97.500824"
id="tspan3880">comp</tspan></text>
</g>
</g>
<g
id="g3882"
transform="translate(471.32018,-0.3941193)">
<g
id="g3884"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect3886"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3888"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan3890"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<rect
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.11650062;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3894"
width="473.64505"
height="82.716003"
x="493.0127"
y="368.03632" />
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="684.51794"
y="389.21155"
id="text3896"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan3898"
x="684.51794"
y="389.21155">LIBS manager</tspan></text>
<g
id="g4102">
<path
id="path2876"
d="M 179.80715,116.16834 180,226.09998"
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)" />
<text
sodipodi:linespacing="125%"
id="text4098"
y="157.6049"
x="181.70563"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="157.6049"
x="181.70563"
id="tspan4100"
sodipodi:role="line">is</tspan></text>
</g>
<g
transform="translate(134,-4e-6)"
id="g4102-9">
<path
id="path2876-0"
d="M 179.80715,116.16834 180,226.09998"
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)" />
<text
sodipodi:linespacing="125%"
id="text4098-8"
y="157.6049"
x="181.70563"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="157.6049"
x="181.70563"
id="tspan4100-8"
sodipodi:role="line">is</tspan></text>
</g>
<g
id="g4144"
transform="translate(260,-4e-6)">
<path
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)"
d="M 179.80715,116.16834 180,226.09998"
id="path4146" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="181.70563"
y="157.6049"
id="text4148"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4150"
x="181.70563"
y="157.6049">is</tspan></text>
</g>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 439.67732,268.09998 0.32268,46 210,0 0,-40"
id="path4152" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="520.22858"
y="330.28006"
id="text4340"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4342"
x="520.22858"
y="330.28006">extends</tspan></text>
<g
id="g3828-4"
transform="translate(133.32018,329.60589)">
<g
id="g3830-8"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect3832-1"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3834-0"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan3836-3"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<g
transform="translate(-2.67982,329.60589)"
id="g4378">
<g
transform="translate(-12.857147,6.4285736)"
id="g4380">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect4382"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text4384"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4386"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<g
transform="translate(267.32018,329.60589)"
id="g4388">
<g
transform="translate(-12.857147,6.4285736)"
id="g4390">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect4392"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text4394"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4396"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<path
style="fill:none;stroke:#000000;stroke-width:1.101;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow2Lend-9)"
d="M 180.35714,268.49409 180,554.09998"
id="path4398" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 313.67732,268.09998 0,290.49749"
id="path4400" />
<text
sodipodi:linespacing="125%"
id="text4774"
y="354.28006"
x="184.22858"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="354.28006"
x="184.22858"
id="tspan4776"
sodipodi:role="line">extends</tspan></text>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="316.22858"
y="354.28006"
id="text4778"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4780"
x="316.22858"
y="354.28006">extends</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 313.9049,598.53648 0,48.73986 137.63329,0.25254 0.25254,-48.73986"
id="path4782" />
<text
sodipodi:linespacing="125%"
id="text4970"
y="664.28003"
x="348.22858"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="664.28003"
x="348.22858"
id="tspan4972"
sodipodi:role="line">extends</tspan></text>
<rect
style="fill:#00bad5;fill-opacity:0.9605735;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect4974"
width="145.46196"
height="128.28937"
x="564.67529"
y="508.6329" />
<text
sodipodi:linespacing="125%"
id="text4978"
y="661.25031"
x="581.85718"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="661.25031"
x="581.85718"
id="tspan4980"
sodipodi:role="line">DIR_LIB_SOURCE</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4978-6"
y="631.6189"
x="792.89563"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="631.6189"
x="792.89563"
id="tspan4980-2"
sodipodi:role="line">SCHEMATIC_LIB_SOURCE</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 512.14734,451.05421 -0.50507,55.05331"
id="path5007" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 637.91133,451.55929 -0.50507,55.05331"
id="path5009" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 849.03322,450.54913 0,55.55839"
id="path5011" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 740,298.38569 0,67.14286"
id="path5571" />
<g
id="g5759"
transform="translate(457.32018,329.60589)">
<g
id="g5761"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect5763"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text5765"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan5767"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<g
transform="translate(447.32018,339.60589)"
id="g5779">
<g
transform="translate(-12.857147,6.4285736)"
id="g5781">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect5783"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text5785"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5787"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="567.28571"
y="139.38568"
id="text5799"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5801"
x="567.28571"
y="139.38568">All sheets are in one schematic object</tspan></text>
<rect
style="fill:#f4d7d7;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect5803"
width="123.57143"
height="63.57143"
x="814.57141"
y="673.95709" />
<g
transform="translate(703.32018,451.60589)"
id="g5769">
<g
transform="translate(-12.857147,6.4285736)"
id="g5771">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect5773"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text5775"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5777"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<g
id="g5789"
transform="translate(693.32018,461.60589)">
<g
id="g5791"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect5793"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text5795"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan5797"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="826.71429"
y="663.95709"
id="text5807"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan5809"
x="826.71429"
y="663.95709">other schematic</tspan></text>
<rect
style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.10099995;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect5811"
width="154.28572"
height="57.142857"
x="167.85715"
y="676.24286" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="202.85715"
y="711.24286"
id="text5813"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5815"
x="202.85715"
y="711.24286">Internet</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 245,638.38569 -0.71428,37.14286"
id="path5817" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="495.57144"
y="527.95709"
id="text2962"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2964"
x="495.57144"
y="527.95709">LIB</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 638.57143,638.38569 -0.71429,47.14286"
id="path2966" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="566"
y="712.95709"
id="text3938"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3940"
x="566"
y="712.95709">part files in a dir</tspan></text>
<text
sodipodi:linespacing="125%"
id="text3944"
y="527.95709"
x="669.57141"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="527.95709"
x="669.57141"
id="tspan3946"
sodipodi:role="line">LIB</tspan></text>
<flowRoot
xml:space="preserve"
id="flowRoot3948"
style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:18px;-inkscape-font-specification:Bitstream Vera Sans;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
id="flowRegion3950"><rect
id="rect3952"
width="240.71428"
height="148.57143"
x="740"
y="508.38568" /></flowRegion><flowPara
id="flowPara3954" /></flowRoot> <text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="953.57141"
y="527.95709"
id="text3956"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3958"
x="953.57141"
y="527.95709">LIB</tspan></text>
<g
transform="translate(695.32018,305.60589)"
id="g3960">
<g
transform="translate(-12.857147,6.4285736)"
id="g3962">
<rect
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3964"
width="56.64537"
height="39.502518"
x="164.8916"
y="222.563" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="172.85715"
y="247.6714"
id="text3966"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3968"
x="172.85715"
y="247.6714">part</tspan></text>
</g>
</g>
<g
id="g3970"
transform="translate(685.32018,315.60589)">
<g
id="g3972"
transform="translate(-12.857147,6.4285736)">
<rect
y="222.563"
x="164.8916"
height="39.502518"
width="56.64537"
id="rect3974"
style="fill:#999999;stroke:#000000;stroke-width:0.78319448;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<text
sodipodi:linespacing="125%"
id="text3976"
y="247.6714"
x="172.85715"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
xml:space="preserve"><tspan
y="247.6714"
x="172.85715"
id="tspan3978"
sodipodi:role="line">part</tspan></text>
</g>
</g>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="m 877.85714,607.6714 0,41.42858"
id="path3980" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
x="840.89563"
y="219.6189"
id="text4168"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4170"
x="840.89563"
y="219.6189">LIB</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1.26530874px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend-9)"
d="M 851.17116,365.3959 850.285,225.65964"
id="path4172" />
</svg>

Before

Width:  |  Height:  |  Size: 39 KiB

View File

@ -1,150 +0,0 @@
#!/bin/sh
BASEDIR=/tmp/eeschema-lib
CATEGORIES="lions tigers kitties"
PARTS="eyes ears feet"
REVS="rev1 rev5 rev10"
REFERENCE="
(reference U?
(effects (at 12 13 180)(font (size 7 10))(visible yes))
)"
LINE="
(line
(pts (xy 12 13)(xy 12 20))(stroke 1.5)
)"
RECT="
(rectangle
(start 4 5)(end 6 8)(stroke 2.3)(fill transparent)
)"
CIRCLE="
(circle
(center 1 0)(radius 5)(stroke 2.1)(fill none)
)"
ARC="
(arc
(pos 22 33)(radius 12)(start 2 4)(end 13 33)(stroke 2.3)(fill filled)
)"
BEZIER="
(bezier
(fill none)(stroke 2.0)(pts (xy 0 1)(xy 2 4))
)"
TEXT="
(text (at 23 23 90.0) \"This is some text\" (justify left bottom)(visible yes)(fill filled)
(font arial (size 8 12))
)"
PIN1="
(pin out line (at 7 8 90)
(signal #WE (font (size 8 10) bold)(visible no))
(pad A23 (font (size 9 11) italic bold))
)"
PIN2="
(pin in line (at 8 8)(visible yes)
(signal #WAIT (visible yes))
(pad A24 (visible yes))
)"
PIN3="
(pin (pad A25))"
PINS="
(pin (pad Z12))(pin (pad Y14))(pin (pad Z13))(pin (pad Y15))"
PIN_SWAP="
(pin_swap A23 A24)"
PIN_RENUM="
(pin_renum A24 B24)"
PIN_RENAME="
(pin_rename B24 LED)"
PIN_DELETE="
(pin_del B24)"
PIN_MERGE="(pin_merge A23 (pads Z12 Y14))(pin_merge A25 (pads Z13 Y15))"
PROP1="
(property mWatts 12
(effects (at 1 34 270)(font (size 5 9) italic bold)(visible no))
)"
KEYWORDS="
(keywords varistor batcave einstein)"
ALTERNATES="
(alternates 7400/7400_b 7400/7400_c)"
for C in ${CATEGORIES}; do
mkdir -p $BASEDIR/$C
for P in ${PARTS}; do
for R in ${REVS}; do
echo "(part $C/$P (value 22)(footprint SM0805)(model Airplane)(datasheet http://favorite.pdf)
$REFERENCE
$LINE
$RECT
$CIRCLE
$ARC
$BEZIER
$TEXT
$PIN1
$PIN2
$PIN3
$PINS
$PROP1
$KEYWORDS
$ALTERNATES
$PIN_SWAP
$PIN_RENUM
$PIN_RENAME
$PIN_DELETE
$PIN_MERGE
)" > $BASEDIR/$C/$P.part.$R
done
# also make the part without a rev:
echo "(part $C/$P (value 22)(footprint SM0805)(model Airplane)(datasheet http://favorite.pdf)
$REFERENCE
$LINE
$RECT
$CIRCLE
$ARC
$BEZIER
$TEXT
$PIN1
$PIN2
$PIN3
$PINS
$PROP1
$KEYWORDS
$ALTERNATES
$PIN_SWAP
$PIN_RENUM
$PIN_RENAME
$PIN_DELETE
$PIN_MERGE
)" > $BASEDIR/$C/$P.part
done
done

View File

@ -1,3 +0,0 @@
# run this from the <kicad>/new directory
doxygen

View File

@ -1,148 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 KiCad Developers, see change_log.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
*/
#include <sch_canvas.h>
#include <sch_part.h>
#include <gal/font/newstroke_font.h>
#define SWEET_UNIT 50 ///< world units comprizing a sweet grid cell
namespace SCH {
CANVAS::CANVAS( wxWindow* aParent ) :
OPENGL_GAL( aParent, NULL, this ) // I am my own PaintListener
{
Connect( EVT_GAL_REDRAW, wxCommandEventHandler( CANVAS::onRedraw ) );
// Set the world unit length
SetWorldUnitLength( 0.01 );
SetScreenDPI( 100 );
ComputeWorldScreenMatrix();
// Set the world unit length
// SetLookAtPoint( VECTOR2D( size.x / 2, size.y / 2 ) );
// Load Font
if( !m_font.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize ) )
{
printf( "Loading of the font failed.\n" );
}
m_font.SetGraphicsAbstractionLayer( this );
}
void CANVAS::onRedraw( wxCommandEvent& event )
{
PaintScene();
}
void CANVAS::PaintScene()
{
BeginDrawing();
SetBackgroundColor( COLOR4D( 0x6c/255.0, 0x53/255.0, 0x53/255.0, 1.0 ) );
ClearScreen();
SetLayerDepth( -10 );
SetGridSize( VECTOR2D( SWEET_UNIT, SWEET_UNIT ) );
DrawGrid();
PaintRectangle();
SetLayerDepth( 0 );
Flush();
EndDrawing();
}
void CANVAS::PaintRectangle()
{
VECTOR2D worldSize = GetSize();
#if 1
SetLineWidth( 1 );
SetIsFill( true );
SetIsStroke( true );
SetFillColor( COLOR4D( 1, 1, 1, 1 ) );
SetStrokeColor( COLOR4D( 0, 0, 0, 1 ) );
DrawRectangle( VECTOR2D( worldSize.x/4, worldSize.y/4 ), VECTOR2D( 3*worldSize.x/4, 3*worldSize.y/4 ) );
#else
D( cout << worldSize << endl; )
int k = 0;
double alpha = 0;
for( double y = 0; y < worldSize.y - worldSize.y / 4; y += worldSize.y / 8 )
{
double index = 1;
double y2 = y;
for( double x = 0; x < worldSize.x - worldSize.x / 4; x += worldSize.x / 8 )
{
SetLineWidth( index + 1 );
SetIsFill( ( k == 1 ) || ( k == 2 ) );
SetIsStroke( ( k == 0 ) || ( k == 2 ) );
SetFillColor( COLOR4D( 1 - alpha, 1, 1, 1 - alpha ) );
SetStrokeColor( COLOR4D( alpha, alpha, 1 - alpha, alpha ) );
DrawRectangle( VECTOR2D( x, y2 ), VECTOR2D( x + index * 10, y2 + index * 10 ) );
x += index * 5;
y2 += index * 5;
index += 1;
}
k = ( k + 1 ) % 3;
alpha += 0.1;
}
#endif
}
} // namespace SCH

View File

@ -1,69 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 KiCad Developers, see change_log.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
*/
#ifndef SCH_CANVAS_H_
#define SCH_CANVAS_H_
#include <gal/opengl/opengl_gal.h>
#include <gal/common/stroke_font.h>
namespace SCH {
class PART;
class CANVAS : public OPENGL_GAL
{
protected:
PART* m_part; ///< which PART to draw
STROKE_FONT m_font;
void onRedraw( wxCommandEvent& event );
public:
CANVAS( wxWindow* aParent );
/**
* Function SetPart
* sets the PART to draw, returns the previous PART.
*/
PART* SetPart( PART* aPart )
{
PART* ret = m_part;
m_part = aPart;
return ret;
}
void PaintScene();
void PaintRectangle();
};
} // namespace SCH
#endif // SCH_PART_H_

View File

@ -1,728 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
/* Note: this LIB_SOURCE implementation relies on the posix specified opendir() and
related functions rather than wx functions which might do the same thing. This
is because I did not want to become very dependent on wxWidgets at such a low
level as this, in case someday this code needs to be used on kde or whatever.
Mingw and unix, linux, & osx will all have these posix functions.
MS Visual Studio may need the posix compatible opendir() functions brought in
http://www.softagalleria.net/dirent.php
wx has these but they are based on wxString which can be wchar_t based and wx should
not be introduced at a level this low.
Part files: have the general form partname.part[.revN...]
Categories: are any subdirectories immediately below the sourceURI, one level only.
Part names: [category/]partname[/revN...]
*/
#include <dirent.h>
#include <sys/stat.h>
#include <cstring>
#include <cstdio>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <sch_dir_lib_source.h>
using namespace SCH;
/**
* DIR_WRAP
* provides a destructor which is invoked if an exception is thrown.
*/
class DIR_WRAP
{
DIR* dir;
public:
DIR_WRAP( DIR* aDir ) : dir( aDir ) {}
~DIR_WRAP()
{
if( dir )
closedir( dir );
}
DIR* operator->() { return dir; }
DIR* operator*() { return dir; }
operator bool () { return dir!=0; }
};
/**
* FILE_WRAP
* provides a destructor which is invoked if an exception is thrown.
*/
class FILE_WRAP
{
int fh;
public:
FILE_WRAP( int aFileHandle ) : fh( aFileHandle ) {}
~FILE_WRAP()
{
if( fh != -1 )
close( fh );
}
operator int () { return fh; }
};
/**
* Function strrstr
* finds the last instance of needle in haystack, if any.
*/
static const char* strrstr( const char* haystack, const char* needle )
{
const char* ret = 0;
const char* next = haystack;
// find last instance of haystack
while( (next = strstr( next, needle )) != 0 )
{
ret = next;
++next; // don't keep finding the same one.
}
return ret;
}
#if 1 // @todo switch over to EndsWithRev() global
static inline bool isDigit( char c )
{
return c >= '0' && c <= '9';
}
/**
* Function endsWithRev
* returns a pointer to the final string segment: "revN[N..]" or NULL if none.
* @param start is the beginning of string segment to test, the partname or
* any middle portion of it.
* @param tail is a pointer to the terminating nul, or one past inclusive end of
* segment, i.e. the string segment of interest is [start,tail)
* @param separator is the separating byte, expected: '.' or '/', depending on context.
*/
static const char* endsWithRev( const char* start, const char* tail, char separator = '/' )
{
bool sawDigit = false;
while( tail > start && isDigit( *--tail ) )
{
sawDigit = true;
}
// if sawDigit, tail points to the 'v' here.
if( sawDigit && tail-3 >= start )
{
tail -= 3;
if( tail[0]==separator && tail[1]=='r' && tail[2]=='e' && tail[3]=='v' )
{
return tail+1; // omit separator, return "revN[N..]"
}
}
return 0;
}
static inline const char* endsWithRev( const STRING& aPartName, char separator = '/' )
{
return endsWithRev( aPartName.c_str(), aPartName.c_str()+aPartName.size(), separator );
}
#endif
// see struct BY_REV
bool BY_REV::operator() ( const STRING& s1, const STRING& s2 ) const
{
// avoid instantiating new STRINGs, and thank goodness that c_str() is const.
const char* rev1 = endsWithRev( s1 );
const char* rev2 = endsWithRev( s2 );
int rootLen1 = rev1 ? rev1 - s1.c_str() : s1.size();
int rootLen2 = rev2 ? rev2 - s2.c_str() : s2.size();
int r = memcmp( s1.c_str(), s2.c_str(), min( rootLen1, rootLen2 ) );
if( r )
{
return r < 0;
}
if( rootLen1 != rootLen2 )
{
return rootLen1 < rootLen2;
}
// root strings match at this point, compare the revision number numerically,
// and chose the higher numbered version as "less", according to std::set lingo.
if( bool(rev1) != bool(rev2) )
{
return bool(rev1) < bool(rev2);
}
if( rev1 && rev2 )
{
int rnum1 = atoi( rev1+3 );
int rnum2 = atoi( rev2+3 );
// higher numbered revs are "less" so that they bubble to top.
return rnum1 > rnum2;
}
return false; // strings are equal, and they don't have a rev
}
bool DIR_LIB_SOURCE::makePartName( STRING* aPartName, const char* aEntry,
const STRING& aCategory )
{
const char* cp = strrstr( aEntry, SWEET_EXT );
// if base name is not empty, contains SWEET_EXT, && cp is not NULL
if( cp > aEntry )
{
const char* limit = cp + strlen( cp );
// If versioning, then must find a trailing "revN.." type of string.
if( useVersioning )
{
const char* rev = endsWithRev( cp + SWEET_EXTZ, limit, '.' );
if( rev )
{
if( aCategory.size() )
*aPartName = aCategory + "/";
else
aPartName->clear();
aPartName->append( aEntry, cp - aEntry );
aPartName->append( "/" );
aPartName->append( rev );
return true;
}
}
// If using versioning, then all valid partnames must have a rev string,
// so we don't even bother to try and load any other partfile down here.
else
{
// if file extension is exactly SWEET_EXT, and no rev
if( cp==limit-5 )
{
if( aCategory.size() )
*aPartName = aCategory + "/";
else
aPartName->clear();
aPartName->append( aEntry, cp - aEntry );
return true;
}
}
}
return false;
}
STRING DIR_LIB_SOURCE::makeFileName( const STRING& aPartName )
{
// create a fileName for the sweet string, using a reversible
// partname <-> fileName conversion protocol:
STRING fileName = sourceURI + "/";
const char* rev = endsWithRev( aPartName );
if( rev )
{
int basePartLen = rev - aPartName.c_str() - 1; // omit '/' separator
fileName.append( aPartName, 0, basePartLen );
fileName += SWEET_EXT;
fileName += '.';
fileName += rev;
}
else
{
fileName += aPartName;
fileName += SWEET_EXT;
}
return fileName;
}
void DIR_LIB_SOURCE::readString( STRING* aResult, const STRING& aFileName )
{
FILE_WRAP fw = open( aFileName.c_str(), O_RDONLY );
if( fw == -1 )
{
STRING msg = strerror( errno );
msg += "; cannot open(O_RDONLY) file " + aFileName;
THROW_IO_ERROR( msg );
}
struct stat fs;
fstat( fw, &fs );
// sanity check on file size
if( fs.st_size > (1*1024*1024) )
{
STRING msg = aFileName;
msg += " seems too big. ( > 1 mbyte )";
THROW_IO_ERROR( msg );
}
#if 0
// I read somewhere on the Internet that std::string chars are not guaranteed
// (over time) to be contiguous in future implementations of C++, so this
// strategy is here for that eventuality. We buffer through readBuffer here.
// reuse same readBuffer, which is not thread safe, but the API
// is not advertising thread safe (yet, if ever).
if( (int) fs.st_size > (int) readBuffer.size() )
readBuffer.resize( fs.st_size + 1000 );
int count = read( fw, &readBuffer[0], fs.st_size );
if( count != (int) fs.st_size )
{
STRING msg = strerror( errno );
msg += "; cannot read file " + aFileName;
THROW_IO_ERROR( msg );
}
aResult->assign( &readBuffer[0], count );
#else
// read into the string directly
aResult->resize( fs.st_size );
int count = read( fw, &(*aResult)[0], fs.st_size );
if( count != (int) fs.st_size )
{
STRING msg = strerror( errno );
msg += "; cannot read file " + aFileName;
THROW_IO_ERROR( msg );
}
// test trailing nul is there, which should have been put there with resize() above
// printf( "'%s'\n", aResult->c_str() ); // checked OK.
#endif
}
void DIR_LIB_SOURCE::cache()
{
partnames.clear();
categories.clear();
cacheOneDir( "" );
}
DIR_LIB_SOURCE::DIR_LIB_SOURCE( const STRING& aDirectoryPath,
const STRING& aOptions ) :
useVersioning( strstr( aOptions.c_str(), "useVersioning" ) )
{
sourceURI = aDirectoryPath;
sourceType = "dir";
if( sourceURI.size() == 0 )
{
THROW_IO_ERROR( STRING("aDirectoryPath cannot be empty") );
}
// remove any trailing separator, so we can add it back later without ambiguity
if( strchr( "/\\", sourceURI[sourceURI.size()-1] ) )
sourceURI.erase( sourceURI.size()-1 );
cache();
}
DIR_LIB_SOURCE::~DIR_LIB_SOURCE()
{
}
void DIR_LIB_SOURCE::GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory )
{
PN_ITER end = aCategory.size() ?
partnames.lower_bound( aCategory + char( '/' + 1 ) ) :
partnames.end();
PN_ITER it = aCategory.size() ?
partnames.upper_bound( aCategory + "/" ) :
partnames.begin();
aResults->clear();
if( useVersioning )
{
STRING partName;
while( it != end )
{
const char* rev = endsWithRev( *it );
// all cached partnames have a rev string in useVersioning mode
assert( rev );
// partName is substring which omits the rev AND the rev separator
partName.assign( *it, 0, rev - it->c_str() - 1 );
aResults->push_back( partName );
// skip over all other versions of the same partName.
it = partnames.lower_bound( partName + char( '/' + 1 ) );
}
}
else
{
while( it != end )
aResults->push_back( *it++ );
}
}
void DIR_LIB_SOURCE::GetRevisions( STRINGS* aResults, const STRING& aPartName )
{
aResults->clear();
if( useVersioning )
{
STRING partName;
const char* rev = endsWithRev( aPartName );
if( rev )
// partName is substring which omits the rev and the separator
partName.assign( aPartName, 0, rev - aPartName.c_str() - 1 );
else
partName = aPartName;
PN_ITER it = partnames.upper_bound( partName +'/' );
PN_ITER end = partnames.lower_bound( partName + char( '/' +1 ) );
for( ; it != end; ++it )
{
const char* rev = endsWithRev( *it );
assert( rev );
aResults->push_back( it->substr( rev - it->c_str() ) );
}
}
else
{
// In non-version mode, there were no revisions read in, only part
// files without a revision. But clients higher up expect to see
// at least one revision in order for the API to work, so we return
// a revision ""
aResults->push_back( "" );
}
}
void DIR_LIB_SOURCE::ReadPart( STRING* aResult, const STRING& aPartName, const STRING& aRev )
{
STRING partName = aPartName;
const char* hasRev = endsWithRev( partName );
if( useVersioning )
{
if( aRev.size() )
{
// a supplied rev replaces any in aPartName
if( hasRev )
partName.resize( hasRev - partName.c_str() - 1 );
partName += '/';
partName + aRev;
// find this exact revision
PN_ITER it = partnames.find( partName );
if( it == partnames.end() ) // part not found
{
partName += " not found.";
THROW_IO_ERROR( partName );
}
readString( aResult, makeFileName( partName ) );
}
else
{
// There's no rev on partName string. Find the most recent rev, i.e. highest,
// which will be first because of the BY_REV compare method, which treats
// higher numbered revs as first.
STRING search = partName + '/';
// There's no rev on partName string. Find the most recent rev, i.e. highest,
// which will be first because of the BY_REV compare method, which treats
// higher numbered revs as first.
PN_ITER it = partnames.upper_bound( search );
// verify that this one that is greater than partName is a match and not
// some unrelated name that is larger.
if( it == partnames.end() ||
it->compare( 0, search.size(), search ) != 0 )
{
partName += " is not present without a revision.";
THROW_IO_ERROR( partName );
}
readString( aResult, makeFileName( *it ) );
}
}
else // !useVersioning
{
#if 1
if( hasRev || aRev.size() )
{
STRING msg = "this type 'dir' LIB_SOURCE not using 'useVersioning' option, cannot ask for a revision";
THROW_IO_ERROR( msg );
}
#else
// no revisions allowed, strip it
if( hasRev )
partName.resize( hasRev - partName.c_str() - 1 );
#endif
// find the part name without any revision
PN_ITER it = partnames.find( partName );
if( it == partnames.end() ) // part not found
{
partName += " not found.";
THROW_IO_ERROR( partName );
}
readString( aResult, makeFileName( partName ) );
}
}
void DIR_LIB_SOURCE::ReadParts( STRINGS* aResults, const STRINGS& aPartNames )
{
aResults->clear();
for( STRINGS::const_iterator n = aPartNames.begin(); n!=aPartNames.end(); ++n )
{
aResults->push_back( STRING() );
ReadPart( &aResults->back(), *n );
}
}
void DIR_LIB_SOURCE::GetCategories( STRINGS* aResults )
{
aResults->clear();
// caller fetches them sorted.
for( NAME_CACHE::const_iterator it = categories.begin(); it!=categories.end(); ++it )
{
aResults->push_back( *it );
}
}
#if defined(DEBUG)
void DIR_LIB_SOURCE::Show()
{
printf( "Show categories:\n" );
for( NAME_CACHE::const_iterator it = categories.begin(); it!=categories.end(); ++it )
printf( " '%s'\n", it->c_str() );
printf( "\n" );
printf( "Show parts:\n" );
for( PART_CACHE::const_iterator it = partnames.begin(); it != partnames.end(); ++it )
{
printf( " '%s'\n", it->c_str() );
}
}
#endif
void DIR_LIB_SOURCE::cacheOneDir( const STRING& aCategory )
{
STRING curDir = sourceURI;
if( aCategory.size() )
curDir += "/" + aCategory;
DIR_WRAP dir = opendir( curDir.c_str() );
if( !dir )
{
STRING msg = strerror( errno );
msg += "; scanning directory " + curDir;
THROW_IO_ERROR( msg );
}
struct stat fs;
STRING partName;
STRING fileName;
dirent* entry;
while( (entry = readdir( *dir )) != NULL )
{
if( !strcmp( ".", entry->d_name ) || !strcmp( "..", entry->d_name ) )
continue;
fileName = curDir + "/" + entry->d_name;
if( !stat( fileName.c_str(), &fs ) )
{
// is this a valid part name?
if( S_ISREG( fs.st_mode ) && makePartName( &partName, entry->d_name, aCategory ) )
{
std::pair<NAME_CACHE::iterator, bool> pair = partnames.insert( partName );
if( !pair.second )
{
STRING msg = partName;
msg += " has already been encountered";
THROW_IO_ERROR( msg );
}
}
// is this an acceptable category name?
else if( S_ISDIR( fs.st_mode ) && !aCategory.size() && isCategoryName( entry->d_name ) )
{
// only one level of recursion is used, controlled by the
// emptiness of aCategory.
categories.insert( entry->d_name );
// somebody needs to test Windows (mingw), make sure it can
// handle opendir() recursively
cacheOneDir( entry->d_name );
}
else
{
//D( printf( "ignoring %s\n", entry->d_name );)
}
}
}
}
#if 0 && defined(DEBUG)
void DIR_LIB_SOURCE::Test( int argc, char** argv )
{
STRINGS partnames;
STRINGS sweets;
try
{
STRINGS::const_iterator pn;
// DIR_LIB_SOURCE uut( argv[1] ? argv[1] : "", "" );
DIR_LIB_SOURCE uut( argv[1] ? argv[1] : "", "useVersioning" );
// show the cached content, only the directory information is cached,
// parts are cached in class LIB, not down here.
uut.Show();
uut.GetCategoricalPartNames( &partnames, "lions" );
printf( "\nGetCategoricalPartNames( aCatagory = 'lions' ):\n" );
for( STRINGS::const_iterator it = partnames.begin(); it!=partnames.end(); ++it )
{
printf( " '%s'\n", it->c_str() );
}
uut.ReadParts( &sweets, partnames );
printf( "\nSweets for Category = 'lions' parts:\n" );
pn = partnames.begin();
for( STRINGS::const_iterator it = sweets.begin(); it!=sweets.end(); ++it, ++pn )
{
printf( " %s: %s", pn->c_str(), it->c_str() );
}
// fetch the part names for ALL categories.
uut.GetCategoricalPartNames( &partnames );
printf( "\nGetCategoricalPartNames( aCategory = '' i.e. ALL):\n" );
for( STRINGS::const_iterator it = partnames.begin(); it!=partnames.end(); ++it )
{
printf( " '%s'\n", it->c_str() );
}
uut.ReadParts( &sweets, partnames );
printf( "\nSweets for ALL parts:\n" );
pn = partnames.begin();
for( STRINGS::const_iterator it = sweets.begin(); it!=sweets.end(); ++it, ++pn )
{
printf( " %s: %s", pn->c_str(), it->c_str() );
}
}
catch( std::exception& ex )
{
printf( "std::exception\n" );
}
catch( const IO_ERROR& ioe )
{
printf( "exception: %s\n", (const char*) ioe.errorText.ToUTF8() ) );
}
}
int main( int argc, char** argv )
{
DIR_LIB_SOURCE::Test( argc, argv );
return 0;
}
#endif

View File

@ -1,198 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef DIR_LIB_SOURCE_H_
#define DIR_LIB_SOURCE_H_
#include <set>
#include <vector>
#include <sch_lib.h>
/// This file extension is an implementation detail specific to this LIB_SOURCE
/// and to a corresponding LIB_SINK.
/// Core EESCHEMA should never have to see this.
#define SWEET_EXT ".part"
#define SWEET_EXTZ (sizeof(SWEET_EXT)-1)
/**
* struct BY_REV
* is here to provide a custom way to compare STRINGs. Namely, the revN[N..]
* string if present, is collated according to a 'higher revision first', but
* any part string without a revision, is even 'before' that.
*/
struct BY_REV
{
bool operator() ( const STRING& s1, const STRING& s2 ) const;
};
/**
* Type PART_CACHE
* holds a set of part names in sorted order, according to the sort
* order given by struct BY_REV.
*/
typedef std::set< STRING, BY_REV > PART_CACHE;
/**
* Type NAME_CACHE
* holds a set of categories in sorted order.
*/
typedef std::set< STRING > NAME_CACHE;
namespace SCH {
/**
* DIR_LIB_SOURCE
* implements a LIB_SOURCE in a file system directory.
*
* @author Dick Hollenbeck
*/
class DIR_LIB_SOURCE : public LIB_SOURCE
{
friend class LIB_TABLE; ///< constructor is protected, LIB_TABLE can construct
bool useVersioning; ///< use files with extension ".revNNN..", else not
/// normal partnames, some of which may be prefixed with a category,
/// and some of which may have legal "revN[N..]" type strings.
PART_CACHE partnames;
typedef PART_CACHE::const_iterator PN_ITER;
/// categories which we expect to find in the set of @a partnames
NAME_CACHE categories;
std::vector<char> readBuffer; ///< used by readString()
/**
* Function cache
* [re-]loads the directory cache(s).
*/
void cache();
/**
* Function isCategoryName
* returns true iff aName is a valid category name.
*/
bool isCategoryName( const char* aName )
{
return true;
}
/**
* Function makePartName
* returns true iff aEntry holds a valid part filename, in the form of
* "someroot.part[.revNNNN]" where NNN are number characters [0-9]
* @param aEntry is the raw directory entry without path information.
* @param aCategory is the last portion of the directory path.
* @param aPartName is where to put a part name, assuming @a aEntry is legal.
* @return bool - true only if aEntry is a legal part file name.
*/
bool makePartName( STRING* aPartName, const char* aEntry, const STRING& aCategory );
/**
* Function readString
* reads a Sweet string into aResult. Candidate for virtual function later.
*/
void readString( STRING* aResult, const STRING& aFileName );
/**
* Function cacheOneDir
* loads part names [and categories] from a directory given by
* "sourceURI + '/' + category"
* Categories are only loaded if processing the top most directory because
* only one level of categories is supported. We know we are in the
* top most directory if aCategory is empty.
*/
void cacheOneDir( const STRING& aCategory );
/**
* Function makeFileName
* converts a part name into a filename and returns it.
*/
STRING makeFileName( const STRING& aPartName );
protected:
/**
* Constructor DIR_LIB_SOURCE( const STRING& aDirectoryPath )
* sets up a LIB_SOURCE using aDirectoryPath in a file system.
* @see LIB_TABLE::LookupPart().
*
* @param aDirectoryPath is a full file pathname of a directory which contains
* the library source of part files. Examples might be "C:\kicad_data\mylib" or
* "/home/designer/mylibdir". This is not a URI, but an OS specific path that
* can be given to opendir().
*
* @param aOptions is the options string from the library table, currently
* the only supported option, that this LIB_SOURCE knows about is
* "useVersioning". If present means support versioning in the directory
* tree, otherwise only a single version of each part is recognized, namely the
* one without the ".revN[N..]" trailer.
*/
DIR_LIB_SOURCE( const STRING& aDirectoryPath, const STRING& aOptions = "" );
~DIR_LIB_SOURCE();
//-----<LIB_SOURCE implementation functions >------------------------------
void ReadPart( STRING* aResult, const STRING& aPartName, const STRING& aRev = "" );
void ReadParts( STRINGS* aResults, const STRINGS& aPartNames );
void GetCategories( STRINGS* aResults );
void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory = "" );
void GetRevisions( STRINGS* aResults, const STRING& aPartName );
void FindParts( STRINGS* aResults, const STRING& aQuery )
{
// @todo
}
//-----</LIB_SOURCE implementation functions >------------------------------
#if defined(DEBUG)
/**
* Function Show
* will output a debug dump of contents.
*/
void Show();
public:
static void Test( int argc, char** argv );
#endif
};
} // namespace SCH
#endif // DIR_LIB_SOURCE_H_

View File

@ -1,278 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#include <memory> // std::auto_ptr
#include <wx/string.h>
#include <sch_lib.h>
#include <sch_lpid.h>
#include <sch_part.h>
#include <sch_sweet_parser.h>
#include <sch_lib_table.h>
#if 1
#include <map>
/*
The LIB part cache consists of a std::map of partnames without revisions at the
top level. Each top level map entry can point to another std::map which it owns
and which holds all the revisions for that part name. At any point in the tree,
there can be NULL pointers which allow for lazy loading, including the very top
most root pointer itself, which is PARTS* parts. We use the key to hold the
partName at one level, and revision at the deeper nested level.
1) Only things which are asked for are done.
2) Anything we learn we remember.
*/
namespace SCH {
/**
* Struct LTREV
* is for PART_REVS, and provides a custom way to compare rev STRINGs.
* Namely, the revN[N..] string if present, is collated according to a
* 'higher revision first'.
*/
struct LTREV
{
bool operator() ( const STRING& s1, const STRING& s2 ) const
{
return RevCmp( s1.c_str(), s2.c_str() ) < 0;
}
};
/**
* PART_REVS
* contains the collection of revisions for a particular part name, in the
* form of cached PARTs. The tuple consists of a rev string and a PART pointer.
* The rev string is like "rev1", the PART pointer will be NULL until the PART
* gets loaded, lazily.
*/
class PART_REVS : public std::map< STRING, PART*, LTREV >
{
public:
~PART_REVS()
{
for( iterator it = begin(); it != end(); ++it )
{
delete it->second; // second may be NULL, no problem
}
}
};
/**
* PARTS
* contains the collection of PART_REVS for all PARTs in the lib.
* The tuple consists of a part name and a PART_REVS pointer.
* The part name does not have the revision attached (of course this is understood
* by definition of "part name"). The PART_REVS pointer will be NULL until a client
* askes about the revisions for a part name, so the loading is done lazily.
*/
class PARTS : public std::map< STRING, PART_REVS* >
{
public:
~PARTS()
{
for( iterator it = begin(); it != end(); ++it )
{
delete it->second; // second may be NULL, no problem
}
}
};
} // namespace SCH
#else // was nothing but grief:
#include <boost/ptr_container/ptr_map.hpp>
namespace SCH {
/// PARTS' key is revision, like "rev12", PART pointer may be null until loaded.
typedef boost::ptr_map< STRING, boost::nullable<PART> > PARTS;
typedef PARTS::iterator PARTS_ITER;
typedef PARTS::const_iterator PARTS_CITER;
/// PART_REVS' key is part name, w/o rev, PART pointer may be null until loaded.
typedef boost::ptr_map< STRING, boost::nullable<PARTS> > PART_REVS;
typedef PART_REVS::iterator PART_REVS_ITER;
typedef PART_REVS::const_iterator PART_REVS_CITER;
} // namespace SCH
#endif
using namespace SCH;
LIB::LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink ) :
logicalName( aLogicalLibrary ),
source( aSource ),
sink( aSink ),
cachedCategories( false ),
parts( 0 )
{
}
LIB::~LIB()
{
delete source;
delete sink;
delete parts;
}
const PART* LIB::lookupPart( const LPID& aLPID )
{
if( !parts )
{
parts = new PARTS;
source->GetCategoricalPartNames( &vfetch );
// insert a PART_REVS for each part name
for( STRINGS::const_iterator it = vfetch.begin(); it!=vfetch.end(); ++it )
{
D(printf("lookupPart:%s\n", it->c_str() );)
(*parts)[*it] = new PART_REVS;
}
}
// load all the revisions for this part name, only if it has any
PARTS::iterator pi = parts->find( aLPID.GetPartName() );
PART_REVS* revs = pi != parts->end() ? pi->second : NULL;
// D(printf("revs:%p partName:%s\n", revs, aLPID.GetPartName().c_str() );)
// if the key for parts has no aLPID.GetPartName() the part is not in this lib
if( revs )
{
if( revs->size() == 0 ) // assume rev list has not been loaded yet
{
// load all the revisions for this part.
source->GetRevisions( &vfetch, aLPID.GetPartName() );
// create a PART_REV entry for each revision, but leave the PART* NULL
for( STRINGS::const_iterator it = vfetch.begin(); it!=vfetch.end(); ++it )
{
D(printf("lookupPartRev:%s\n", it->c_str() );)
(*revs)[*it] = 0;
}
}
PART_REVS::iterator rev;
// If caller did not say what revision, find the highest numbered one and return that.
if( !aLPID.GetRevision().size() && revs->size() )
{
rev = revs->begin(); // sort order has highest rev first
if( !rev->second ) // the PART has never been instantiated before
{
rev->second = new PART( this, LPID::Format( "", aLPID.GetPartName(), rev->first ) );
}
D(printf("lookupPartLatestRev:%s\n", rev->second->partNameAndRev.c_str() );)
return rev->second;
}
else
{
rev = revs->find( aLPID.GetRevision() );
if( rev != revs->end() )
{
if( !rev->second ) // the PART has never been instantiated before
{
rev->second = new PART( this, aLPID.GetPartNameAndRev() );
}
return rev->second;
}
}
}
return 0; // no such part name in this lib
}
PART* LIB::LookupPart( const LPID& aLPID, LIB_TABLE* aLibTable )
{
PART* part = (PART*) lookupPart( aLPID );
if( !part ) // part does not exist in this lib
{
wxString msg = wxString::Format( _("part \"%s\" not found in lib %s" ),
wxString::FromUTF8( aLPID.GetPartNameAndRev().c_str() ).GetData(),
wxString::FromUTF8( logicalName.c_str() ).GetData() );
THROW_IO_ERROR( msg );
}
if( part->body.empty() )
{
// load body
source->ReadPart( &part->body, aLPID.GetPartName(), aLPID.GetRevision() );
#if 0 && defined(DEBUG)
const STRING& body = part->body;
printf( "body: %s", body.c_str() );
if( !body.size() || body[body.size()-1] != '\n' )
printf( "\n" );
#endif
// @todo consider changing ReadPart to return a "source"
SWEET_PARSER sp( part->body, wxString::FromUTF8( aLPID.Format().c_str() ) );
part->Parse( &sp, aLibTable );
}
return part;
}
#if 0 && defined(DEBUG)
void LIB::Test( int argc, char** argv );
{
}
int main( int argc, char** argv )
{
LIB::Test( argc, argv );
return 0;
}
#endif

View File

@ -1,357 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef SCH_LIB_H_
#define SCH_LIB_H_
#include <utf8.h>
#include <richio.h>
#include <import_export.h>
namespace SCH {
class LPID;
class PART;
class LIB_TABLE;
/**
* LIB_SOURCE
* is an abstract class from which implementation specific LIB_SOURCEs
* may be derived, one for each kind of library type allowed in the library table.
* The class name stems from the fact that this interface only provides READ ONLY
* functions.
*
* @author Dick Hollenbeck
*/
class LIB_SOURCE
{
friend class LIB; ///< the LIB uses these functions.
protected: ///< derived classes must implement
/**
* Function GetSourceType
* returns the library table entry's type for this library source.
*/
const STRING& GetSourceType() { return sourceType; }
/**
* Function GetSourceURI
* returns absolute location of the library source.
*/
const STRING& GetSourceURI() { return sourceURI; }
//-----<abstract for implementors>---------------------------------------
/**
* Function ReadPart
* fetches @a aPartName's s-expression into @a aResult after clear()ing aResult.
*/
virtual void ReadPart( STR_UTF* aResult, const STRING& aPartName, const STRING& aRev = "" ) = 0;
/**
* Function ReadParts
* fetches the s-expressions for each part given in @a aPartNames, into @a aResults,
* honoring the array indices respectfully.
* @param aPartNames is a list of part names, one name per list element. If a part name
* does not have a version string, then the most recent version is fetched.
* @param aResults receives the s-expressions
*/
virtual void ReadParts( STR_UTFS* aResults, const STRINGS& aPartNames ) = 0;
/**
* Function GetCategories
* fetches all categories present in the library source into @a aResults
*/
virtual void GetCategories( STRINGS* aResults ) = 0;
/**
* Function GetCategoricalPartNames
* fetches all the part names for @a aCategory, which was returned by GetCategories().
*
* @param aCategory is a subdividing navigator within the library source,
* but may default to empty which will be taken to mean all categories.
*
* @param aResults is a place to put the fetched result, one category per STRING.
*/
virtual void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory="" ) = 0;
/**
* Function GetRevisions
* fetches all revisions for @a aPartName into @a aResults. Revisions are strings
* like "rev12", "rev279", and are library source agnostic. These do not have to be
* in a contiguous order, but the first 3 characters must be "rev" and subsequent
* characters must consist of at least one decimal digit. If the LIB_SOURCE
* does not support revisions, it is allowed to return a single "" string as
* the only result. This means aPartName is present in the libsource, only once
* without a revision. This is a special case.
*/
virtual void GetRevisions( STRINGS* aResults, const STRING& aPartName ) = 0;
/**
* Function FindParts
* fetches part names for all parts matching the criteria given in @a
* aQuery, into @a aResults. The query string is designed to be easily marshalled,
* i.e. serialized, so that long distance queries can be made with minimal overhead.
* The library source needs to have an intelligent friend on the other end if
* the actual library data is remotely located, otherwise it will be too slow
* to honor this portion of the API contract.
*
* @param aQuery is a string holding a domain specific query language expression.
* One candidate here is an s-expression that uses (and ..) and (or ..) operators
* and uses them as RPN. For example "(and (footprint 0805)(value 33ohm)(category passives))".
* The UI can shield the user from this if it wants.
*
* @param aResults is a place to put the fetched part names, one part per STRING.
*/
virtual void FindParts( STRINGS* aResults, const STRING& aQuery ) = 0;
//-----</abstract for implementors>--------------------------------------
protected:
STRING sourceType;
STRING sourceURI;
};
/**
* LIB_SINK
* is an abstract class from which implementation specific LIB_SINKs
* may be derived, one for each kind of library type in the library table that
* supports writing. The class name stems from the fact that this interface
* only provides WRITE functions.
*
* @author Dick Hollenbeck
*/
class LIB_SINK
{
friend class LIB; ///< only the LIB uses these functions.
protected: ///< derived classes must implement
/**
* Function GetSinkType
* returns the library table entry's type for this library sink.
*/
const STRING& GetSinkType() { return sinkType; }
/**
* Function GetSinkURI
* returns absolute location of the library sink.
*/
const STRING& GetSinkURI() { return sinkURI; }
/**
* Function WritePart
* saves the part to non-volatile storage. @a aPartName may have the revision
* portion present. If it is not present, and a overwrite of an existhing
* part is done, then LIB::ReloadPart() must be called on this same part
* and all parts that inherit it must be reparsed.
* @return STRING - if the LIB_SINK support revision numbering, then return a
* revision name that was next in the sequence, e.g. "rev22", else "".
*/
virtual STRING WritePart( const STRING& aPartName, const STRING& aSExpression ) = 0;
protected:
STRING sinkType;
STRING sinkURI;
};
class PARTS;
/**
* LIB
* is a cache of parts, and because the LIB_SOURCE is abstracted, there
* should be no need to extend from this class in any case except for the
* PARTS_LIST.
*
* @author Dick Hollenbeck
*/
class MY_API LIB
{
friend class LIB_TABLE; ///< protected constructor, LIB_TABLE may construct
protected: // constructor is not public, called from LIB_TABLE only.
/**
* Constructor LIB
* is not public and is only called from class LIB_TABLE
*
* @param aLogicalLibrary is the name of a well known logical library, and is
* known because it already exists in the library table.
*
* @param aSource is an open LIB_SOURCE whose ownership is
* given over to this LIB.
*
* @param aSink is an open LIB_SINK whose ownership is given over
* to this LIB, and it is normally NULL.
*/
LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink = NULL );
public:
~LIB();
/**
* Function HasSink
* returns true if this library has write/save capability. Most LIBs
* are read only.
*/
bool HasSink() { return sink != NULL; }
/**
* Function LogicalName
* returns the logical name of this LIB.
*/
STRING LogicalName();
//-----<use delegates: source and sink>---------------------------------
/**
* Function LookupPart
* returns a PART given @a aPartName, such as "passives/R". No ownership
* is given to the PART, it stays in the cache that is this LIB.
*
* @param aLPID is the part to lookup. The logicalLibName can be empty in it
* since yes, we know which LIB is in play.
*
* @param aLibTable is the LIB_TABLE view that is in effect for inheritance,
* and comes from the big containing SCHEMATIC object.
*
* @return PART* - The desired PART and will never be NULL. No ownership is
* given to caller. PARTs always reside in the cache that is a LIB.
*
* @throw IO_ERROR if the part cannot be found or loaded.
*/
PART* LookupPart( const LPID& aLPID, LIB_TABLE* aLibTable );
/**
* Function ReloadPart
* will reload the part assuming the library source has a changed content
* for it.
*/
void ReloadPart( PART* aPart );
/**
* Function GetCategories
* returns all categories of parts within this LIB into @a aResults.
*/
STRINGS GetCategories();
/**
* Function GetCategoricalPartNames
* returns the part names for @a aCategory, and at the same time
* creates cache entries for the very same parts if they do not already exist
* in this LIB (i.e. cache).
*/
STRINGS GetCategoricalPartNames( const STRING& aCategory = "" );
//-----<.use delegates: source and sink>--------------------------------
/**
* Function WritePart
* saves the part to non-volatile storage and returns the next new revision
* name in the sequence established by the LIB_SINK.
*/
STRING WritePart( PART* aPart );
void SetPartBody( PART* aPart, const STRING& aSExpression );
/**
* Function GetRevisions
* returns the revisions of @a aPartName that are present in this LIB.
* The returned STRINGS will look like "rev1", "rev2", etc.
*/
STRINGS GetRevisions( const STRING& aPartName );
/**
* Function FindParts
* returns part names for all parts matching the criteria given in @a
* aQuery, into @a aResults. The query string is designed to be easily marshalled,
* i.e. serialized, so that long distance queries can be made with minimal overhead.
* The library source needs to have an intelligent friend on the other end if
* the actual library data is remotely located, otherwise it will be too slow
* to honor this portion of the API contract.
*
* @param aQuery is a string holding a domain specific language expression. One candidate
* here is an RPN s-expression that uses (and ..) and (or ..) operators. For example
* "(and (footprint 0805)(value 33ohm)(category passives))"
*/
STRINGS FindParts( const STRING& aQuery )
{
// run the query on the cached data first for any PARTS which are fully
// parsed (i.e. cached), then on the LIB_SOURCE to find any that
// are not fully parsed, then unify the results.
return STRINGS();
}
#if defined(DEBUG)
static void Test( int argc, char** argv );
#endif
protected:
STR_UTF fetch; // scratch, used to fetch things, grows to worst case size.
STR_UTFS vfetch; // scratch, used to fetch things.
STRING logicalName;
LIB_SOURCE* source;
LIB_SINK* sink;
STRINGS categories;
bool cachedCategories; /// < is true only after reading categories
/** parts are in various states of readiness:
* 1) not even loaded (if cachedParts is false)
* 2) present, but without member 'body' having been read() yet.
* 3) body has been read, but not parsed yet.
* 4) parsed and inheritance if any has been applied.
*/
PARTS* parts;
/**
* Function lookupPart
* looks up a PART, returns NULL if cannot find in source. Does not parse
* the part. Does not even load the part's Sweet string. No ownership
* is given to the PART, it stays in the cache that is this LIB.
*
* @throw IO_ERROR if there is some kind of communications error reading
* the original list of parts.
*
* @return PART* - the cached PART, or NULL if not found. No ownership transferred.
*/
const PART* lookupPart( const LPID& aLPID );
};
} // namespace SCH
#endif // SCH_LIB_H_

View File

@ -1,336 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#include <set>
#include <assert.h>
#include <sch_lib_table_lexer.h>
#include <sch_lpid.h>
#include <sch_lib_table.h>
#include <sch_dir_lib_source.h>
using namespace SCH;
using namespace LT; // tokens, enum T for LIB_TABLE
LIB_TABLE::LIB_TABLE( LIB_TABLE* aFallBackTable ):
fallBack( aFallBackTable )
{
// not copying fall back, simply search aFallBackTable separately
// if "logicalName not found".
}
void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in )
{
/* grammar:
(lib_table
(lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
(lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
(lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
)
note: "(lib_table" has already been read in.
*/
T tok;
while( ( tok = in->NextTok() ) != T_RIGHT )
{
// (lib (logical "LOGICAL")(type "TYPE")(full_uri "FULL_URI")(options "OPTIONS"))
if( tok == T_EOF )
in->Expecting( T_RIGHT );
if( tok != T_LEFT )
in->Expecting( T_LEFT );
if( ( tok = in->NextTok() ) != T_lib )
in->Expecting( T_lib );
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_logical )
in->Expecting( T_logical );
in->NeedSYMBOLorNUMBER();
std::auto_ptr<ROW> row( new ROW( this ) );
row->SetLogicalName( in->CurText() );
in->NeedRIGHT();
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_type )
in->Expecting( T_type );
in->NeedSYMBOLorNUMBER();
// verify that type is one of: {dir, schematic, subversion, http}
if( strcmp( in->CurText(), "dir" ) &&
strcmp( in->CurText(), "schematic" ) &&
strcmp( in->CurText(), "subversion" ) &&
strcmp( in->CurText(), "http" ) )
{
in->Expecting( "dir|schematic|subversion|http" );
}
row->SetType( in->CurText() );
in->NeedRIGHT();
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_full_uri )
in->Expecting( T_full_uri );
in->NeedSYMBOLorNUMBER();
row->SetFullURI( in->CurText() );
in->NeedRIGHT();
in->NeedLEFT();
if( ( tok = in->NextTok() ) != T_options )
in->Expecting( T_options );
in->NeedSYMBOLorNUMBER();
row->SetOptions( in->CurText() );
in->NeedRIGHT();
in->NeedRIGHT(); // terminate the (lib..)
// all logicalNames within this table fragment must be unique, so we do not
// use doReplace in InsertRow(). However a fallBack table can have a
// conflicting logicalName and ours will supercede that one since in
// FindLib() we search this table before any fall back.
if( !InsertRow( row ) )
{
STRING msg;
msg += '\'';
msg += row->logicalName;
msg += '\'';
msg += " is a duplicate logical lib name";
THROW_IO_ERROR( msg );
}
}
}
void LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
{
out->Print( nestLevel, "(lib_table\n" );
for( ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
it->second->Format( out, nestLevel+1 );
out->Print( nestLevel, ")\n" );
}
void LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
{
out->Print( nestLevel, "(lib (logical %s)(type %s)(full_uri %s)(options %s))\n",
out->Quotes( logicalName ).c_str(),
out->Quotes( libType ).c_str(),
out->Quotes( fullURI ).c_str(),
out->Quotes( options ).c_str()
);
}
STRINGS LIB_TABLE::GetLogicalLibs()
{
// Only return unique logical library names. Use std::set::insert() to
// quietly reject any duplicates, which can happen when encountering a duplicate
// logical lib name from one of the fall back table(s).
std::set<STRING> unique;
STRINGS ret;
const LIB_TABLE* cur = this;
do
{
for( ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
{
unique.insert( it->second->logicalName );
}
} while( ( cur = cur->fallBack ) != 0 );
// return a sorted, unique set of logical lib name STRINGS to caller
for( std::set<STRING>::const_iterator it = unique.begin(); it!=unique.end(); ++it )
ret.push_back( *it );
return ret;
}
PART* LIB_TABLE::LookupPart( const LPID& aLPID, LIB* aLocalLib )
{
LIB* lib = lookupLib( aLPID, aLocalLib );
return lib->LookupPart( aLPID, this );
}
LIB* LIB_TABLE::lookupLib( const LPID& aLPID, LIB* aFallBackLib )
{
if( aLPID.GetLogicalLib().size() )
{
ROW* row = FindRow( aLPID.GetLogicalLib() );
if( !row )
{
STRING msg = "lib table contains no logical lib '";
msg += aLPID.GetLogicalLib();
msg += '\'';
THROW_IO_ERROR( msg );
}
if( !row->lib )
{
loadLib( row );
}
assert( row->lib ); // fix loadLib() to throw if cannot load
return row->lib;
}
if( aFallBackLib )
{
return aFallBackLib;
}
STRING msg = "lookupLib() requires logicalLibName or a fallback lib";
THROW_IO_ERROR( msg );
}
void LIB_TABLE::loadLib( ROW* aRow )
{
assert( !aRow->lib ); // caller should know better.
const STRING& libType = aRow->GetType();
if( !libType.compare( "dir" ) )
{
// autor_ptr wrap source while we create sink, in case sink throws.
std::auto_ptr<LIB_SOURCE> source(
new DIR_LIB_SOURCE(
aRow->GetFullURI(),
aRow->GetOptions() ) );
/* @todo load LIB_SINK
std::auto_ptr<LIB_SINK> sink(
new DIR_LIB_SINK(
aRow->GetFullURI(),
aRow->GetOptions() ) );
*/
// LIB::LIB( const STRING& aLogicalLibrary, LIB_SOURCE* aSource, LIB_SINK* aSink = NULL );
aRow->lib = new LIB( aRow->GetLogicalName(), source.release(), NULL );
}
/*
else if( !libType.compare( "schematic" ) )
{
// @todo code and load SCHEMATIC_LIB_SOURCE
}
else if( !libType.compare( "subversion" ) )
{
// @todo code and load SVN_LIB_SOURCE
}
else if( !libType.compare( "http" ) )
{
// @todo code and load HTTP_LIB_SOURCE
}
*/
else
{
STRING msg = "cannot load unknown libType: '";
msg += libType;
msg += '\'';
THROW_IO_ERROR( msg );
}
}
LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName ) const
{
// this function must be *super* fast, so therefore should not instantiate
// anything which would require using the heap. This function is the reason
// ptr_map<> was used instead of ptr_set<>, which would have required
// instantiating a ROW just to find a ROW.
const LIB_TABLE* cur = this;
do
{
ROWS_CITER it = cur->rows.find( aLogicalName );
if( it != cur->rows.end() )
{
// reference: http://myitcorner.com/blog/?p=361
return (LIB_TABLE::ROW*) it->second; // found
}
// not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 );
return 0; // not found
}
bool LIB_TABLE::InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace )
{
// this does not need to be super fast.
ROWS_CITER it = rows.find( aRow->logicalName );
if( it == rows.end() )
{
// be careful here, key is needed because aRow can be
// release()ed before logicalName is captured.
const STRING& key = aRow->logicalName;
rows.insert( key, aRow );
return true;
}
if( doReplace )
{
rows.erase( aRow->logicalName );
// be careful here, key is needed because aRow can be
// release()ed before logicalName is captured.
const STRING& key = aRow->logicalName;
rows.insert( key, aRow );
return true;
}
return false;
}

View File

@ -1,387 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef SCH_LIB_TABLE_H_
#define SCH_LIB_TABLE_H_
#include <string>
#include <boost/ptr_container/ptr_map.hpp>
#include <import_export.h>
#include <sch_lib.h>
class OUTPUTFORMATTER;
class SCH_LIB_TABLE_LEXER;
namespace SCH {
class LPID;
class PART;
/**
* LIB_TABLE
* holds LIB_TABLE::ROW records, and can be searched in a very high speed
* way based on logical library name.
* <p>
* This class owns the <b>library table</b>, which is like fstab in concept and maps logical
* library name to library URI, type, and options. It has the following columns:
* <ul>
* <li> Logical Library Name
* <li> Library Type
* <li> Library URI. The full URI to the library source, form dependent on Type.
* <li> Options, used for access, such as password
* </ul>
* <p>
* The Library Type can be one of:
* <ul>
* <li> "dir"
* <li> "schematic" i.e. a parts list from another schematic.
* <li> "subversion"
* <li> "http"
* </ul>
* <p>
* For now, the Library URI types needed to support the various types can be one of those
* shown below, which are typical of each type:
* <ul>
* <li> "file://C:/mylibdir"
* <li> "file://home/user/kicadwork/jtagboard.sch"
* <li> "svn://kicad.org/partlib/trunk"
* <li> "http://kicad.org/partlib"
* </ul>
* <p>
* The applicable library table is built up from several additive rows (table fragments),
* and the final table is a (conceptual) merging of the table fragments. Two
* anticipated sources of the rows are a personal table, and a schematic resident
* table. The schematic resident table rows are considered a higher priority in
* the final dynamically assembled library table. A row in the schematic
* contribution to the library table takes precedence over the personal table
* if there is a collision on logical library name, otherwise the rows simply
* combine without issue to make up the applicable library table.
*
* @author Dick Hollenbeck
*/
class MY_API LIB_TABLE
{
public:
/**
* ROW
* holds a record identifying a LIB in the LIB_TABLE.
*/
class ROW
{
friend class LIB_TABLE;
public:
/**
* Function GetLogicalName
* returns the logical name of this library table entry.
*/
const STRING& GetLogicalName() const
{
return logicalName;
}
/**
* Function GetType
* returns the type of LIB represented by this record.
*/
const STRING& GetType() const
{
return libType;
}
/**
* Function GetFullURI
* returns the full location specifying URI for the LIB.
*/
const STRING& GetFullURI() const
{
return fullURI;
}
/**
* Function GetOptions
* returns the options string, which may hold a password or anything else needed to
* instantiate the underlying LIB_SOURCE.
*/
const STRING& GetOptions() const
{
return options;
}
~ROW()
{
delete lib;
}
/**
* Function Format
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
* @param out is an OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
*/
void Format( OUTPUTFORMATTER* out, int nestLevel ) const;
protected:
ROW( LIB_TABLE* aOwner ) :
owner( aOwner ),
lib( 0 )
{}
/**
* Function SetLogicalName
* changes the logical name of this library, useful for an editor.
*/
void SetLogicalName( const STRING& aLogicalName )
{
logicalName = aLogicalName;
}
/**
* Function SetType
* changes the type represented by this record.
*/
void SetType( const STRING& aType )
{
libType = aType;
}
/**
* Function SetFullURI
* changes the full URI for the library, useful from a library table editor.
*/
void SetFullURI( const STRING& aFullURI )
{
fullURI = aFullURI;
}
/**
* Function SetOptions
* changes the options string for this record, and is useful from
* the library table editor.
*/
void SetOptions( const STRING& aOptions )
{
options = aOptions;
}
private:
LIB_TABLE* owner;
STRING logicalName;
STRING libType;
STRING fullURI;
STRING options;
LIB* lib; ///< ownership of the loaded LIB is here
};
/**
* Constructor LIB_TABLE
* builds a library table by pre-pending this table fragment in front of
* @a aFallBackTable. Loading of this table fragment is done by using Parse().
*
* @param aFallBackTable is another LIB_TABLE which is searched only when
* a record is not found in this table. No ownership is taken of aFallBackTable.
*/
LIB_TABLE( LIB_TABLE* aFallBackTable = NULL );
/**
* Function Parse
* fills this table fragment from information in the input stream \a aParser, which
* is a DSNLEXER customized for the grammar needed to describe instances of this object.
* The entire textual element spec is <br>
*
* <pre>
* (lib_table
* (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
* (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
* (lib (logical LOGICAL)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
* )
* </pre>
*
* When this function is called, the input token stream given by \a aParser
* is assumed to be positioned at the '^' in the following example, i.e. just
* after the identifying keyword and before the content specifying stuff.
* <br>
* (lib_table ^ (....) )
*
* @param aParser is the input token stream of keywords and symbols.
*/
void Parse( SCH_LIB_TABLE_LEXER* aParser ) throw( IO_ERROR, PARSE_ERROR );
/**
* Function Format
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
*
* @param out is an OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
*/
void Format( OUTPUTFORMATTER* out, int nestLevel ) const;
/**
* Function LookupPart
* finds and loads a PART, and parses it. As long as the part is
* accessible in any LIB_SOURCE, opened or not opened, this function
* will find it and load it into its containing LIB, even if that means
* having to open a LIB in this table that was not previously opened.
*
* @param aLogicalPartID holds the partName and may also hold the logicalLibName. If
* logicalLibName is empty, then @a aFallBackLib should not be NULL.
*
* @param aFallBackLib is used only if aLogicalPartID has an empty logicalLibName.
* This is for the case when an LPID has no logicalLibName because the LPID is using
* a partName from the same LIB as was the referring content.
*
* @return PART* - this will never be NULL, and no ownership is transfered because
* all PARTs live in LIBs. You only get to point to them in some LIB. If the PART
* cannot be found, then an exception is thrown.
*
* @throw IO_ERROR if any problem occurs or if the part cannot be found.
*/
PART* LookupPart( const LPID& aLogicalPartID, LIB* aFallBackLib = NULL );
/**
* Function GetLogicalLibs
* returns the logical library names, all of them that are in pertinent to
* a lookup done on this LIB_TABLE.
*/
STRINGS GetLogicalLibs();
//----<read accessors>----------------------------------------------------
// the returning of a const STRING* tells if not found, but might be too
// promiscuous?
/**
* Function GetLibURI
* returns the full library path from a logical library name.
* @param aLogicalLibraryName is the short name for the library of interest.
* @return const STRING* - or NULL if not found.
*/
const STRING* GetLibURI( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->fullURI : 0;
}
/**
* Function GetLibType
* returns the type of a logical library.
* @param aLogicalLibraryName is the short name for the library of interest.
* @return const STRING* - or NULL if not found.
*/
const STRING* GetLibType( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->libType : 0;
}
/**
* Function GetLibOptions
* returns the options string for \a aLogicalLibraryName.
* @param aLogicalLibraryName is the short name for the library of interest.
* @return const STRING* - or NULL if not found.
*/
const STRING* GetLibOptions( const STRING& aLogicalLibraryName ) const
{
const ROW* row = FindRow( aLogicalLibraryName );
return row ? &row->options : 0;
}
//----</read accessors>---------------------------------------------------
#if 1 || defined(DEBUG)
/// implement the tests in here so we can honor the priviledge levels of the
/// accessors, something difficult to do from int main(int, char**)
void Test();
#endif
protected: // only a table editor can use these
/**
* Function InsertRow
* adds aRow if it does not already exist or if doReplace is true. If doReplace
* is not true and the key for aRow already exists, the function fails and returns false.
* The key for the table is the logicalName, and all in this table must be unique.
* @param aRow is the new row to insert, or to forcibly add if doReplace is true.
* @param doReplace if true, means insert regardless of whether aRow's key already
* exists. If false, then fail if the key already exists.
* @return bool - true if the operation succeeded.
*/
bool InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace = false );
/**
* Function FindRow
* returns a ROW* if aLogicalName is found in this table or in any chained
* fallBack table fragment, else NULL.
*/
ROW* FindRow( const STRING& aLogicalName ) const;
private:
/**
* Function lookupLib
* finds or loads a LIB based on @a aLogicalPartID or @a aFallBackLib.
* If the LIB is already loaded then it is returned as is, else it is loaded.
*
* @param aLogicalPartID holds the partName and may also hold the logicalLibName. If
* logicalLibName is empty, then @a aFallBackLib should not be NULL.
*
* @param aFallBackLib is used only if aLogicalPartID has an empty logicalLibName.
* This is for the case when an LPID has no logicalLibName because the LPID is using
* a partName from the same LIB as was the referring content.
*
* @return LIB* - this will never be NULL, and no ownership is transfered because
* all LIBs live in the LIB_TABLEs. You only get to point to them in some LIB_TABLE.
* If the LIB cannot be found, then an exception is thrown.
*
* @throw IO_ERROR if any problem occurs or if the LIB cannot be found or cannot be loaded.
*/
LIB* lookupLib( const LPID& aLogicalPartID, LIB* aFallBackLib = NULL );
/**
* Function loadLib
* loads a LIB using information in @a aRow. Call only if LIB not
* already loaded.
*/
void loadLib( ROW* aRow );
typedef boost::ptr_map<STRING, ROW> ROWS;
typedef ROWS::iterator ROWS_ITER;
typedef ROWS::const_iterator ROWS_CITER;
ROWS rows;
LIB_TABLE* fallBack;
};
} // namespace SCH
#endif // SCH_LIB_TABLE_H_

View File

@ -1,6 +0,0 @@
lib_table
logical
type
full_uri
options
lib

View File

@ -1,501 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#include <cstring>
#include <wx/wx.h> // _()
#include <sch_lpid.h>
using namespace SCH;
static inline bool isDigit( char c )
{
return c >= '0' && c <= '9';
}
const char* EndsWithRev( const char* start, const char* tail, char separator )
{
bool sawDigit = false;
while( tail > start && isDigit( *--tail ) )
{
sawDigit = true;
}
// if sawDigit, tail points to the 'v' here.
if( sawDigit && tail-3 >= start )
{
tail -= 3;
if( tail[0]==separator && tail[1]=='r' && tail[2]=='e' && tail[3]=='v' )
{
return tail+1; // omit separator, return "revN[N..]"
}
}
return 0;
}
int RevCmp( const char* s1, const char* s2 )
{
int r = strncmp( s1, s2, 3 );
if( r || strlen(s1)<4 || strlen(s2)<4 )
{
return r;
}
int rnum1 = atoi( s1+3 );
int rnum2 = atoi( s2+3 );
return -(rnum1 - rnum2); // swap the sign, higher revs first
}
//----<Policy and field test functions>-------------------------------------
// These all return -1 on success, or >= 0 if there is an error at a
// particular character offset into their respective arguments. If >=0,
// then that return value gives the character offset of the error.
static inline int okLogical( const STRING& aField )
{
// std::string::npos is largest positive number, casting to int makes it -1.
// Returning that means success.
return int( aField.find_first_of( ":/" ) );
}
static inline int okBase( const STRING& aField )
{
int offset = int( aField.find_first_of( ":/" ) );
if( offset != -1 )
return offset;
// cannot be empty
if( !aField.size() )
return 0;
return offset; // ie. -1
}
static inline int okCategory( const STRING& aField )
{
return int( aField.find_first_of( ":/" ) );
}
static int okRevision( const STRING& aField )
{
char rev[32]; // C string for speed
if( aField.size() >= 4 )
{
strcpy( rev, "x/" );
strcat( rev, aField.c_str() );
if( EndsWithRev( rev, rev + strlen(rev) ) == rev+2 )
return -1; // success
}
return 0; // first character position "is in error", is best we can do.
}
//----</Policy and field test functions>-------------------------------------
void LPID::clear()
{
logical.clear();
category.clear();
baseName.clear();
partName.clear();
revision.clear();
}
int LPID::Parse( const STRING& aLPID )
{
clear();
const char* rev = EndsWithRev( aLPID );
size_t revNdx;
size_t partNdx;
size_t baseNdx;
int offset;
//=====<revision>=========================================
if( rev )
{
revNdx = rev - aLPID.c_str();
// no need to check revision, EndsWithRev did that.
revision = aLPID.substr( revNdx );
--revNdx; // back up to omit the '/' which preceeds the rev
}
else
revNdx = aLPID.size();
//=====<logical>==========================================
if( ( partNdx = aLPID.find( ':' ) ) != aLPID.npos )
{
offset = SetLogicalLib( aLPID.substr( 0, partNdx ) );
if( offset > -1 )
{
return offset;
}
++partNdx; // skip ':'
}
else
partNdx = 0;
//=====<rawName && category>==============================
// "length limited" search:
const char* base = (const char*) memchr( aLPID.c_str() + partNdx, '/', revNdx - partNdx );
if( base )
{
baseNdx = base - aLPID.c_str();
offset = SetCategory( aLPID.substr( partNdx, baseNdx - partNdx ) );
if( offset > -1 )
{
return offset + partNdx;
}
++baseNdx; // skip '/'
}
else
{
baseNdx = partNdx;
}
//=====<baseName>==========================================
offset = SetBaseName( aLPID.substr( baseNdx, revNdx - baseNdx ) );
if( offset > -1 )
{
return offset + baseNdx;
}
return -1;
}
LPID::LPID( const STRING& aLPID ) throw( PARSE_ERROR )
{
int offset = Parse( aLPID );
if( offset != -1 )
{
THROW_PARSE_ERROR(
_( "Illegal character found in LPID string" ),
wxString::FromUTF8( aLPID.c_str() ),
aLPID.c_str(),
0,
offset
);
}
}
int LPID::SetLogicalLib( const STRING& aLogical )
{
int offset = okLogical( aLogical );
if( offset == -1 )
{
logical = aLogical;
}
return offset;
}
int LPID::SetCategory( const STRING& aCategory )
{
int offset = okCategory( aCategory );
if( offset == -1 )
{
category = aCategory;
// set the partName too
if( category.size() )
{
partName = category;
partName += '/';
partName += baseName;
}
else
partName = baseName;
}
return offset;
}
int LPID::SetBaseName( const STRING& aBaseName )
{
int offset = okBase( aBaseName );
if( offset == -1 )
{
baseName = aBaseName;
// set the partName too
if( category.size() )
{
partName = category;
partName += '/';
partName += baseName;
}
else
partName = baseName;
}
return offset;
}
int LPID::SetPartName( const STRING& aPartName )
{
STRING category;
STRING base;
int offset;
int separation = int( aPartName.find_first_of( "/" ) );
if( separation != -1 )
{
category = aPartName.substr( 0, separation );
base = aPartName.substr( separation+1 );
}
else
{
// leave category empty
base = aPartName;
}
if( (offset = SetCategory( category )) != -1 )
return offset;
if( (offset = SetBaseName( base )) != -1 )
{
return offset + separation + 1;
}
return -1;
}
int LPID::SetRevision( const STRING& aRevision )
{
int offset = okRevision( aRevision );
if( offset == -1 )
{
revision = aRevision;
}
return offset;
}
STRING LPID::Format() const
{
STRING ret;
if( logical.size() )
{
ret += logical;
ret += ':';
}
if( category.size() )
{
ret += category;
ret += '/';
}
ret += baseName;
if( revision.size() )
{
ret += '/';
ret += revision;
}
return ret;
}
STRING LPID::GetPartNameAndRev() const
{
STRING ret;
if( category.size() )
{
ret += category;
ret += '/';
}
ret += baseName;
if( revision.size() )
{
ret += '/';
ret += revision;
}
return ret;
}
STRING LPID::Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision )
throw( PARSE_ERROR )
{
STRING ret;
int offset;
if( aLogicalLib.size() )
{
offset = okLogical( aLogicalLib );
if( offset != -1 )
{
THROW_PARSE_ERROR(
_( "Illegal character found in logical lib name" ),
wxString::FromUTF8( aLogicalLib.c_str() ),
aLogicalLib.c_str(),
0,
offset
);
}
ret += aLogicalLib;
ret += ':';
}
{
STRING category;
STRING base;
int separation = int( aPartName.find_first_of( "/" ) );
if( separation != -1 )
{
category = aPartName.substr( 0, separation );
base = aPartName.substr( separation+1 );
}
else
{
// leave category empty
base = aPartName;
}
if( (offset = okCategory( category )) != -1 )
{
THROW_PARSE_ERROR(
_( "Illegal character found in category" ),
wxString::FromUTF8( aRevision.c_str() ),
aRevision.c_str(),
0,
offset
);
}
if( (offset = okBase( base )) != -1 )
{
THROW_PARSE_ERROR(
_( "Illegal character found in base name" ),
wxString::FromUTF8( aRevision.c_str() ),
aRevision.c_str(),
0,
offset + separation + 1
);
}
if( category.size() )
{
ret += category;
ret += '/';
}
ret += base;
}
if( aRevision.size() )
{
offset = okRevision( aRevision );
if( offset != -1 )
{
THROW_PARSE_ERROR(
_( "Illegal character found in revision" ),
wxString::FromUTF8( aRevision.c_str() ),
aRevision.c_str(),
0,
offset
);
}
ret += '/';
ret += aRevision;
}
return ret;
}
#if 0 && defined(DEBUG)
// build this with Debug CMAKE_BUILD_TYPE
void LPID::Test()
{
static const char* lpids[] = {
"me:passives/R/rev0",
"passives/R/rev2",
":passives/R/rev3",
"C/rev22",
"passives/C22",
"R",
"me:R",
// most difficult:
"me:/R/rev0",
"me:R/rev0",
};
for( unsigned i=0; i<sizeof(lpids)/sizeof(lpids[0]); ++i )
{
// test some round tripping
LPID lpid( lpids[i] ); // parse
// format
printf( "input:'%s' full:'%s' base:'%s' partName:'%s' cat:'%s' rev:'%s'\n",
lpids[i],
lpid.Format().c_str(),
lpid.GetBaseName().c_str(),
lpid.GetPartName().c_str(),
lpid.GetCategory().c_str(),
lpid.GetRevision().c_str()
);
}
}
int main( int argc, char** argv )
{
LPID::Test();
return 0;
}
#endif

View File

@ -1,245 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef SCH_LPID_H_
#define SCH_LPID_H_
#include <utf8.h>
#include <richio.h>
namespace SCH {
/**
* LPID
* (aka GUID) is a Logical Part ID and consists of various portions much like a URI.
* It is a container for the separated portions of a logical part id STRING so they
* can be accessed individually. The various portions of an LPID are:
* logicalLibraryName, category, baseName, and revision. Only the baseName is
* mandatory. There is another construct called "partName" which consists of
* [category/]baseName. That is the category followed by a slash, but only if
* the category is not empty.
* <p>
* partName = [category/]baseName
* <p>
* Example LPID string:
* "kicad:passives/R/rev6".
* <p>
* <ul>
* <li> "kicad" is the logical library name.
* <li> "passives" is the category.
* <li> "passives/R" is the partname.
* <li> "rev6" is the revision, which is optional. If missing then its
* / delimiter should also not be present. A revision must begin with
* "rev" and be followed by at least one or more decimal digits.
* </ul>
* @author Dick Hollenbeck
*/
class LPID // aka GUID
{
public:
LPID() {}
/**
* Constructor LPID
* takes aLPID string and parses it. A typical LPID string uses a logical
* library name followed by a part name.
* e.g.: "kicad:passives/R/rev2", or
* e.g.: "mylib:R33"
*/
LPID( const STRING& aLPID ) throw( PARSE_ERROR );
/**
* Function Parse
* [re-]stuffs this LPID with the information from @a aLPID.
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into aLPID at which an error was detected.
*/
int Parse( const STRING& aLPID );
/**
* Function GetLogicalLib
* returns the logical library portion of a LPID. There is not Set accessor
* for this portion since it comes from the library table and is considered
* read only here.
*/
const STRING& GetLogicalLib() const
{
return logical;
}
/**
* Function SetCategory
* overrides the logical lib name portion of the LPID to @a aLogical, and can be empty.
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into the parameter at which an error was detected, usually
* because it contained '/' or ':'.
*/
int SetLogicalLib( const STRING& aLogical );
/**
* Function GetCategory
* returns the category of this part id, "passives" in the example at the
* top of the class description.
*/
const STRING& GetCategory() const
{
return category;
}
/**
* Function SetCategory
* overrides the category portion of the LPID to @a aCategory and is typically
* either the empty string or a single word like "passives".
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into the parameter at which an error was detected, usually
* because it contained '/' or ':'.
*/
int SetCategory( const STRING& aCategory );
/**
* Function GetBaseName
* returns the part name without the category.
*/
const STRING& GetBaseName() const
{
return baseName;
}
/**
* Function SetBaseName
* overrides the base name portion of the LPID to @a aBaseName
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into the parameter at which an error was detected, usually
* because it contained '/' or ':', or is blank.
*/
int SetBaseName( const STRING& aBaseName );
/**
* Function GetPartName
* returns the part name, i.e. category/baseName without revision.
*/
const STRING& GetPartName() const
{
return partName;
}
/**
* Function GetPartNameAndRev
* returns the part name with revision if any, i.e. [category/]baseName[/revN..]
*/
STRING GetPartNameAndRev() const;
/**
* Function SetPartName
* overrides the part name portion of the LPID to @a aPartName
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into the parameter at which an error was detected, usually
* because it contained more than one '/', or one or more ':', or is blank.
* A single '/' is allowed, since that is used to separate the category from the
* base name.
*/
int SetPartName( const STRING& aPartName );
/**
* Function GetRevision
* returns the revision portion of the LPID.
*/
const STRING& GetRevision() const
{
return revision;
}
/**
* Function SetRevision
* overrides the revision portion of the LPID to @a aRevision and must
* be in the form "rev<num>" where "<num>" is "1", "2", etc.
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the
* character offset into the parameter at which an error was detected,
* because it did not look like "rev23"
*/
int SetRevision( const STRING& aRevision );
/**
* Function Format
* returns the full text of the LPID.
*/
STRING Format() const;
/**
* Function Format
* returns a STRING in the proper format as an LPID for a combination of
* aLogicalLib, aPartName, and aRevision.
* @throw PARSE_ERROR if any of the pieces are illegal.
*/
static STRING Format( const STRING& aLogicalLib, const STRING& aPartName, const STRING& aRevision="" )
throw( PARSE_ERROR );
void clear();
#if defined(DEBUG)
static void Test();
#endif
protected:
STRING logical; ///< logical lib name or empty
STRING category; ///< or empty
STRING baseName; ///< without category
STRING revision; ///< "revN[N..]" or empty
STRING partName; ///< cannot be set directory, set via SetBaseName() & SetCategory()
};
} // namespace SCH
/**
* Function EndsWithRev
* returns a pointer to the final string segment: "revN[N..]" or NULL if none.
* @param start is the beginning of string segment to test, the partname or
* any middle portion of it.
* @param tail is a pointer to the terminating nul, or one past inclusive end of
* segment, i.e. the string segment of interest is [start,tail)
* @param separator is the separating byte, expected: '.' or '/', depending on context.
*/
const char* EndsWithRev( const char* start, const char* tail, char separator = '/' );
static inline const char* EndsWithRev( const STRING& aPartName, char separator = '/' )
{
return EndsWithRev( aPartName.c_str(), aPartName.c_str()+aPartName.size(), separator );
}
/**
* Function RevCmp
* compares two rev strings in a way like strcmp() except that the highest numbered
* revision is considered first in the sort order. The function probably won't work
* unless you give it two rev strings.
* @param s1 is a rev string like "rev10"
* @param s2 is a rev string like "rev1".
* @return int - either negative, zero, or positive depending on whether the revision
* is greater, equal, or less on the left hand side.
*/
int RevCmp( const char* s1, const char* s2 );
#endif // SCH_LPID_H_

View File

@ -1,659 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#include <wx/wx.h> // _()
#include <sch_part.h>
#include <sch_sweet_parser.h>
#include <sch_lpid.h>
#include <sch_lib_table.h>
#include <macros.h>
/**
* Function formatAt
* outputs a formatted "(at X Y [ANGLE])" s-expression
*/
static void formatAt( OUTPUTFORMATTER* out, const SCH::POINT& aPos, ANGLE aAngle, int indent=0 )
{
// if( aPos.x || aPos.y || aAngle )
{
out->Print( indent, aAngle!=0.0 ? "(at %.6g %.6g %.6g)" : "(at %.6g %.6g)",
InternalToLogical( aPos.x ), InternalToLogical( aPos.y ),
double( aAngle ) );
}
}
static void formatStroke( OUTPUTFORMATTER* out, STROKE aStroke, int indent=0 )
{
if( aStroke == STROKE_DEFAULT )
out->Print( indent, "(stroke %.6g)", InternalToWidth( aStroke ) );
}
using namespace SCH;
PART::PART( LIB* aOwner, const STRING& aPartNameAndRev ) :
owner( aOwner ),
contains( 0 ),
partNameAndRev( aPartNameAndRev ),
extends( 0 ),
base( 0 )
{
// Our goal is to have class LIB only instantiate what is needed, so print here
// what it is doing. It is the only class where PART can be instantiated.
D(printf("PART::PART(%s)\n", aPartNameAndRev.c_str() );)
for( int i=REFERENCE; i<END; ++i )
mandatory[i] = 0;
}
void PART::clear()
{
if( extends )
{
delete extends;
extends = 0;
}
// clear the mandatory fields
for( int ndx = REFERENCE; ndx < END; ++ndx )
{
delete mandatory[ndx];
mandatory[ndx] = 0;
}
// delete properties I own, since their container will not destroy them:
for( PROPERTIES::iterator it = properties.begin(); it != properties.end(); ++it )
delete *it;
properties.clear();
// delete graphics I own, since their container will not destroy them:
for( GRAPHICS::iterator it = graphics.begin(); it != graphics.end(); ++it )
delete *it;
graphics.clear();
// delete PINs I own, since their container will not destroy them.
for( PINS::iterator it = pins.begin(); it != pins.end(); ++it )
delete *it;
pins.clear();
alternates.clear();
keywords.clear();
pin_merges.clear();
contains = 0;
}
PROPERTY* PART::FieldLookup( PROP_ID aPropertyId )
{
wxASSERT( unsigned(aPropertyId) < unsigned(END) );
PROPERTY* p = mandatory[aPropertyId];
if( !p )
{
switch( aPropertyId )
{
case REFERENCE:
p = new PROPERTY( this, wxT( "reference" ) );
p->text = wxT( "U?" );
break;
case VALUE:
p = new PROPERTY( this, wxT( "value" ) );
break;
case FOOTPRINT:
p = new PROPERTY( this, wxT( "footprint" ) );
break;
case DATASHEET:
p = new PROPERTY( this, wxT( "datasheet" ) );
break;
case MODEL:
p = new PROPERTY( this, wxT( "model" ) );
break;
default:
;
}
mandatory[aPropertyId] = p;
}
return p;
}
PROPERTY& PROPERTY::operator = ( const PROPERTY& r )
{
*(BASE_GRAPHIC*) this = (BASE_GRAPHIC&) r;
name = r.name;
text = r.text;
delete effects;
if( r.effects )
effects = new TEXT_EFFECTS( *r.effects );
else
effects = 0;
return *this;
}
PINS::iterator PART::pinFindByPad( const wxString& aPad )
{
PINS::iterator it;
for( it = pins.begin(); it != pins.end(); ++it )
{
if( (*it)->pad.text == aPad )
break;
}
return it;
}
void PART::PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal )
{
for( PINS::const_iterator it = pins.begin(); it != pins.end(); ++it )
{
if( (*it)->signal.text == aSignal )
{
aResults->push_back( *it );
}
}
}
bool PART::PinDelete( const wxString& aPad )
{
PINS::iterator it = pinFindByPad( aPad );
if( it != pins.end() )
{
delete *it;
pins.erase( it );
return true;
}
// there is only one reason this can fail: not found:
return false;
}
PART::~PART()
{
clear();
}
void PART::setExtends( LPID* aLPID )
{
delete extends;
extends = aLPID;
}
void PART::inherit( const PART& r )
{
// Inherit can be called at any time, even from an interactive text
// editor, so cannot assume 'this' object is new. Clear it.
clear();
// copy anything inherited, such as drawables, properties, pins, etc. here
contains = r.contains;
base = &r;
anchor = r.anchor;
for( int i=REFERENCE; i<END; ++i )
{
if( r.mandatory[i] )
mandatory[i] = (PROPERTY*) r.mandatory[i]->Clone( this );
}
for( PROPERTIES::const_iterator it = r.properties.begin(); it != r.properties.end(); ++it )
properties.push_back( (PROPERTY*) (*it)->Clone( this ) );
for( GRAPHICS::const_iterator it = r.graphics.begin(); it != r.graphics.end(); ++it )
graphics.push_back( (*it)->Clone( this ) );
for( PINS::const_iterator it = r.pins.begin(); it != r.pins.end(); ++it )
pins.push_back( (PIN*) (*it)->Clone( this ) );
/* not sure about this concept yet:
for( PART_REFS::const_iterator it = r.alternates.begin(); it != r.alternates.end(); ++it )
alternates.push_back( *it );
*/
for( KEYWORDS::const_iterator it = r.keywords.begin(); it != r.keywords.end(); ++it )
keywords.insert( *it );
for( MERGE_SETS::const_iterator it = r.pin_merges.begin(); it != r.pin_merges.end(); ++it )
{
pin_merges[ *it->first ] = * new MERGE_SET( *it->second );
}
}
PART& PART::operator=( const PART& r )
{
// maintain in concert with inherit(), which is a partial assignment operator.
inherit( r );
owner = r.owner;
partNameAndRev = r.partNameAndRev;
body = r.body;
base = r.base;
setExtends( r.extends ? new LPID( *r.extends ) : 0 );
return *this;
}
void PART::Parse( SWEET_PARSER* aParser , LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_ERROR )
{
aParser->Parse( this, aTable );
}
bool PART::PropDelete( const wxString& aPropertyName )
{
PROPERTIES::iterator it = propertyFind( aPropertyName );
if( it != properties.end() )
{
delete *it;
properties.erase( it );
return true;
}
return false;
}
PROPERTIES::iterator PART::propertyFind( const wxString& aPropertyName )
{
PROPERTIES::iterator it;
for( it = properties.begin(); it!=properties.end(); ++it )
if( (*it)->name == aPropertyName )
break;
return it;
}
void PART::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
out->Print( indent, "(part %s", partNameAndRev.c_str() );
if( extends )
out->Print( 0, " inherits %s", extends->Format().c_str() );
out->Print( 0, "\n" );
for( int i = REFERENCE; i < END; ++i )
{
PROPERTY* prop = Field( PROP_ID( i ) );
if( prop )
prop->Format( out, indent+1, ctl );
}
for( PROPERTIES::const_iterator it = properties.begin(); it != properties.end(); ++it )
{
(*it)->Format( out, indent+1, ctl );
}
if( anchor.x || anchor.y )
{
out->Print( indent+1, "(anchor (at %.6g %.6g))\n",
InternalToLogical( anchor.x ),
InternalToLogical( anchor.y ) );
}
if( keywords.size() )
{
out->Print( indent+1, "(keywords" );
for( KEYWORDS::iterator it = keywords.begin(); it != keywords.end(); ++it )
out->Print( 0, " %s", out->Quotew( *it ).c_str() );
out->Print( 0, ")\n" );
}
for( GRAPHICS::const_iterator it = graphics.begin(); it != graphics.end(); ++it )
{
(*it)->Format( out, indent+1, ctl );
}
for( PINS::const_iterator it = pins.begin(); it != pins.end(); ++it )
{
(*it)->Format( out, indent+1, ctl );
}
if( alternates.size() )
{
out->Print( indent+1, "(alternates" );
for( PART_REFS::const_iterator it = alternates.begin(); it!=alternates.end(); ++it )
out->Print( 0, " %s", out->Quotes( it->Format() ).c_str() );
out->Print( 0, ")\n" );
}
for( MERGE_SETS::const_iterator mit = pin_merges.begin(); mit != pin_merges.end(); ++mit )
{
out->Print( indent+1, "(pin_merge %s (pads", out->Quotew( mit->first ).c_str() );
const MERGE_SET& mset = *mit->second;
for( MERGE_SET::const_iterator pit = mset.begin(); pit != mset.end(); ++pit )
{
out->Print( 0, " %s", out->Quotew( *pit ).c_str() );
}
out->Print( 0, "))\n" );
}
out->Print( indent, ")\n" );
}
//-----< PART objects >------------------------------------------------------
void PROPERTY::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
wxASSERT( owner ); // all PROPERTYs should have an owner.
int i;
for( i = PART::REFERENCE; i < PART::END; ++i )
{
if( owner->Field( PART::PROP_ID(i) ) == this )
break;
}
if( i < PART::END ) // is a field not a property
out->Print( indent, "(%s", TO_UTF8( name ) );
else
out->Print( indent, "(property %s", out->Quotew( name ).c_str() );
if( effects )
{
out->Print( 0, " %s\n", out->Quotew( text ).c_str() );
effects->Format( out, indent+1, ctl | CTL_OMIT_NL );
out->Print( 0, ")\n" );
}
else
{
out->Print( 0, " %s)\n", out->Quotew( text ).c_str() );
}
}
TEXT_EFFECTS* PROPERTY::EffectsLookup()
{
if( !effects )
{
effects = new TEXT_EFFECTS();
}
return effects;
}
void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
if( propName.IsEmpty() )
out->Print( indent, "(effects " );
else
out->Print( indent, "(effects %s ", out->Quotew( propName ).c_str() );
formatAt( out, pos, angle );
font.Format( out, 0, ctl | CTL_OMIT_NL );
out->Print( 0, "(visible %s))%s",
isVisible ? "yes" : "no",
ctl & CTL_OMIT_NL ? "" : "\n" );
}
void FONT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
if( italic || bold || !name.IsEmpty() || size.height != FONTZ_DEFAULT || size.width != FONTZ_DEFAULT )
{
if( name.IsEmpty() )
out->Print( indent, "(font " );
else
out->Print( indent, "(font %s ", out->Quotew( name ).c_str() );
out->Print( 0, "(size %.6g %.6g)",
InternalToFontz( size.height ),
InternalToFontz( size.width ) );
if( italic )
out->Print( 0, " italic" );
if( bold )
out->Print( 0, " bold" );
out->Print( 0, ")%s", (ctl & CTL_OMIT_NL) ? "" : "\n" );
}
}
void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
bool hasSignal = !signal.text.IsEmpty();
bool hasPad = !pad.text.IsEmpty();
out->Print( indent, "(pin" );
if( connectionType != PIN_CONN_DEFAULT )
out->Print( 0, " %s", ShowType() );
if( shape != PIN_SHAPE_DEFAULT )
out->Print( 0, " %s", ShowShape() );
out->Print( 0, " " );
if( pos.x || pos.y || angle )
formatAt( out, pos, angle );
if( length != PIN_LEN_DEFAULT )
out->Print( 0, "(length %.6g)", InternalToLogical( length ) );
if( !isVisible )
out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
if( hasSignal )
signal.Format( out, "signal", 0, CTL_OMIT_NL );
if( hasPad )
pad.Format( out, "pad", 0, CTL_OMIT_NL );
out->Print( 0, ")\n" );
}
PIN::~PIN()
{
}
void PINTEXT::Format( OUTPUTFORMATTER* out, const char* aElement, int indent, int ctl ) const
{
out->Print( indent, "(%s %s", aElement, out->Quotew( text ).c_str() );
font.Format( out, 0, CTL_OMIT_NL );
if( !isVisible )
out->Print( 0, " (visible %s)", isVisible ? "yes" : "no" );
out->Print( 0, ")%s", ctl & CTL_OMIT_NL ? "" : "\n" );
}
void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
out->Print( indent, "(%s ", pts.size() == 2 ? "line" : "polyline" );
formatContents( out, indent, ctl );
}
void POLY_LINE::formatContents( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
formatStroke( out, stroke );
if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) );
out->Print( 0, "\n" );
if( pts.size() )
{
const int maxLength = 75;
int len = 10;
len += out->Print( indent+1, "(pts " );
for( POINTS::const_iterator it = pts.begin(); it != pts.end(); ++it )
{
if( len > maxLength )
{
len = 10;
out->Print( 0, "\n" );
out->Print( indent+2, "(xy %.6g %.6g)",
InternalToLogical( it->x ), InternalToLogical( it->y ) );
}
else
out->Print( 0, "(xy %.6g %.6g)",
InternalToLogical( it->x ), InternalToLogical( it->y ) );
}
out->Print( 0, ")" );
}
out->Print( 0, ")\n" );
}
void BEZIER::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
out->Print( indent, "(bezier " );
formatContents( out, indent, ctl ); // inherited from POLY_LINE
}
void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
// (rectangle (start X Y) (end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
out->Print( indent, "(rectangle (start %.6g %.6g)(end %.6g %.6g)",
InternalToLogical( start.x ), InternalToLogical( start.y ),
InternalToLogical( end.x ), InternalToLogical( end.y )
);
formatStroke( out, stroke );
if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) );
out->Print( 0, ")\n" );
}
void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
/*
(circle (center X Y)(radius LENGTH) [(stroke WIDTH)] (fill FILL_TYPE))
*/
out->Print( indent, "(circle (center %.6g %.6g)(radius %.6g)",
InternalToLogical( center.x ), InternalToLogical( center.y ),
InternalToLogical( radius) );
formatStroke( out, stroke );
if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) );
out->Print( 0, ")\n" );
}
void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
/*
(arc (pos X Y)(radius RADIUS)(start X Y)(end X Y) [(stroke WIDTH)] (fill FILL_TYPE))
*/
out->Print( indent, "(arc (pos %.6g %.6g)(radius %.6g)(start %.6g %.6g)(end %.6g %.6g)",
InternalToLogical( pos.x ), InternalToLogical( pos.y ),
InternalToLogical( radius),
InternalToLogical( start.x ), InternalToLogical( start.y ),
InternalToLogical( end.x ), InternalToLogical( end.y )
);
formatStroke( out, stroke );
if( fillType != PR::T_none )
out->Print( 0, "(fill %s)", ShowFill( fillType ) );
out->Print( 0, ")\n" );
}
void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
/*
(text "This is the text that gets drawn."
(at X Y [ANGLE])(justify HORIZONTAL_JUSTIFY VERTICAL_JUSTIFY)(visible YES)(fill FILL_TYPE)
(font [FONT] (size HEIGHT WIDTH) [italic] [bold])
)
*/
out->Print( indent, "(text %s\n", out->Quotew( text ).c_str() );
formatAt( out, pos, angle, indent+1 );
if( hjustify != PR::T_left || vjustify != PR::T_bottom )
out->Print( 0, "(justify %s %s)",
ShowJustify( hjustify ), ShowJustify( vjustify ) );
if( !isVisible )
out->Print( 0, "(visible %s)", isVisible ? "yes" : "no" );
if( fillType != PR::T_filled )
out->Print( 0, "(fill %s)", ShowFill( fillType ) );
font.Format( out, 0, CTL_OMIT_NL );
out->Print( 0, ")\n" );
}

View File

@ -1,894 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef SCH_PART_H_
#define SCH_PART_H_
#include <sch_lib.h>
#include <sch_lib_table.h>
#include <sch_lpid.h>
//#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_map.hpp>
#define INTERNAL_PER_LOGICAL 10000 ///< no. internal units per logical unit
/**
* Function InternalToLogical
* converts an internal coordinate to a logical coordinate. Logical coordinates
* are defined as the standard distance between pins being equal to one.
* Internal coordinates are currently INTERNAL_PER_LOGICAL times that.
*/
static inline double InternalToLogical( int aCoord )
{
return double( aCoord ) / INTERNAL_PER_LOGICAL;
}
/**
* Function LogicalToInternal
* converts a logical coordinate to an internal coordinate. Logical coordinates
* are defined as the standard distance between pins being equal to one.
* Internal coordinates are currently INTERNAL_PER_LOGICAL times that.
*/
static inline int LogicalToInternal( double aCoord )
{
return int( aCoord * INTERNAL_PER_LOGICAL );
}
static inline int WidthToInternal( double aWidth )
{
// sweet line widths are a "percent of a logical unit"
return LogicalToInternal( aWidth ) / 100;
}
static inline double InternalToWidth( int aWidth )
{
// sweet line widths are a "percent of a logical unit"
return InternalToLogical( aWidth ) * 100;
}
static inline int FontzToInternal( double aFontSize )
{
// sweet font sizes are deci-pins
return LogicalToInternal( aFontSize ) / 10;
}
static inline double InternalToFontz( int aFontSize )
{
// sweet font sizes are deci-pins
return InternalToLogical( aFontSize ) * 10;
}
//-----<temporary home for PART sub objects, move after stable>------------------
#include <wx/gdicmn.h>
#include <deque>
#include <vector>
#include <set>
#include <sweet_lexer.h>
class OUTPUTFORMATTER;
/// Control Bits for Format() functions
#define CTL_OMIT_NL (1<<0) ///< omit new line in Format()s.
namespace SCH {
class PART;
class SWEET_PARSER;
class PROPERTY;
class POINT : public wxPoint
{
public:
POINT( int x, int y ) :
wxPoint( x, y )
{}
POINT( const POINT& r ) :
wxPoint( r )
{}
POINT() :
wxPoint()
{}
// assume assignment operator is inherited.
};
};
/// a set of pin padnames that are electrically equivalent for a PART.
typedef std::set< wxString > MERGE_SET;
/// The key is the VISIBLE_PIN from
/// (pin_merge VISIBLE_PIN (hide HIDDEN_PIN1 HIDDEN_PIN2...))
typedef boost::ptr_map< wxString, MERGE_SET > MERGE_SETS;
/**
* FONTZ
* is the size of a font, and comes with a constructor which initializes
* height and width to special values which defer font size decision to
* a higher control.
*/
class FONTZ
{
public:
#define FONTZ_DEFAULT -1 ///< when size defers to higher control
FONTZ() :
height( FONTZ_DEFAULT ),
width( FONTZ_DEFAULT )
{}
int height;
int width;
};
typedef float ANGLE;
typedef int STROKE; ///< will be a class someday, currently only line width
namespace SCH {
class FONT
{
friend class PART;
friend class SWEET_PARSER;
protected:
wxString name; ///< name or other id such as number, TBD
FONTZ size;
bool italic;
bool bold;
public:
FONT() :
italic( false ),
bold( false )
{}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
// trust compiler to write its own assignment operator for this class OK.
};
struct TEXT_EFFECTS
{
POINT pos;
ANGLE angle;
FONT font;
bool isVisible;
PROPERTY* property; ///< only used from a COMPONENT, specifies PROPERTY in PART
wxString propName; ///< only used from a COMPONENT, specifies PROPERTY in PART
TEXT_EFFECTS() :
angle( 0 ),
isVisible( false ),
property( 0 )
{}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
// trust compiler to write its own assignment operator for this class OK.
};
#define STROKE_DEFAULT -1 ///< defer line width decision to higher control
#define FILL_TYPE_DEFAULT PR::T_none ///< fillType defaut
class BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
PART* owner;
PART* birthplace; ///< at which PART in inheritance chain was 'this' added
public:
BASE_GRAPHIC( PART* aOwner ) :
owner( aOwner ),
birthplace( aOwner )
{}
virtual ~BASE_GRAPHIC() {}
/**
* Function Clone
* invokes the copy constructor on a heap allocated object of this same
* type and creates a deep copy of 'this' into it
* @param aOwner is the owner of the returned, new object.
*/
virtual BASE_GRAPHIC* Clone( PART* aOwner ) const = 0;
static const char* ShowFill( int aFillType )
{
return SWEET_LEXER::TokenName( PR::T( aFillType ) );
}
/**
* Function Format
* outputs this object to @a aFormatter in s-expression form.
*/
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
{}
};
typedef std::deque<POINT> POINTS;
class POLY_LINE : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent
POINTS pts;
void formatContents( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
public:
POLY_LINE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
stroke( STROKE_DEFAULT ),
fillType( PR::T_none )
{
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
POLY_LINE* n = new POLY_LINE( *this );
n->owner = aOwner;
return n;
}
};
class BEZIER : public POLY_LINE
{
friend class PART;
friend class SWEET_PARSER;
public:
BEZIER( PART* aOwner ) :
POLY_LINE( aOwner )
{
stroke = STROKE_DEFAULT;
fillType = PR::T_none;
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
BEZIER* n = new BEZIER( *this );
n->owner = aOwner;
return n;
}
};
class RECTANGLE : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent
POINT start;
POINT end;
public:
RECTANGLE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
stroke( STROKE_DEFAULT ),
fillType( FILL_TYPE_DEFAULT )
{
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
RECTANGLE* n = new RECTANGLE( *this );
n->owner = aOwner;
return n;
}
};
class CIRCLE : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
POINT center;
int radius;
STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent
public:
CIRCLE( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
radius( LogicalToInternal( 0.5 ) ),
stroke( STROKE_DEFAULT ),
fillType( FILL_TYPE_DEFAULT )
{
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
CIRCLE* n = new CIRCLE( *this );
n->owner = aOwner;
return n;
}
};
class ARC : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
POINT pos;
STROKE stroke;
int fillType; // T_none, T_filled, or T_transparent
int radius;
POINT start;
POINT end;
public:
ARC( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
stroke( STROKE_DEFAULT ),
fillType( FILL_TYPE_DEFAULT ),
radius( LogicalToInternal( 0.5 ) )
{
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
ARC* n = new ARC( *this );
n->owner = aOwner;
return n;
}
};
class GR_TEXT : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
POINT pos;
ANGLE angle;
int fillType; ///< T_none, T_filled, or T_transparent
int hjustify; ///< T_center, T_right, or T_left
int vjustify; ///< T_center, T_top, or T_bottom
bool isVisible;
wxString text;
FONT font;
public:
GR_TEXT( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
angle( 0 ),
fillType( PR::T_filled ),
hjustify( PR::T_left ),
vjustify( PR::T_bottom ),
isVisible( true )
{}
static const char* ShowJustify( int aJustify )
{
return SWEET_LEXER::TokenName( PR::T( aJustify ) );
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
GR_TEXT* n = new GR_TEXT( *this );
n->owner = aOwner;
return n;
}
};
class PROPERTY : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
protected:
wxString name;
wxString text;
TEXT_EFFECTS* effects;
void clear()
{
delete effects;
effects = 0;
name = wxEmptyString;
text = wxEmptyString;
}
public:
PROPERTY( PART* aOwner, const wxChar* aName = wxT( "" ) ) :
BASE_GRAPHIC( aOwner ),
name( aName ),
effects( 0 )
{}
PROPERTY( const PROPERTY& r ) :
BASE_GRAPHIC( NULL ),
effects( 0 )
{
// use assignment operator
*this = r;
}
PROPERTY& operator = ( const PROPERTY& r ); // @todo
~PROPERTY()
{
clear();
}
/**
* Function Effects
* returns a pointer to the TEXT_EFFECTS object for this PROPERTY, and optionally
* will lazily allocate one if it did not exist previously.
* @param doAlloc if true, means do an allocation of a new TEXT_EFFECTS if one
* currently does not exist, otherwise return NULL if non-existent.
*/
TEXT_EFFECTS* EffectsLookup();
TEXT_EFFECTS* Effects() const
{
return effects;
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
PROPERTY* n = new PROPERTY( *this );
n->owner = aOwner;
return n;
}
};
struct PINTEXT
{
wxString text;
FONT font;
bool isVisible;
PINTEXT() :
isVisible( true )
{}
void Format( OUTPUTFORMATTER* aFormatter, const char* aElement, int aNestLevel, int aControlBits ) const;
};
#define PIN_LEN_DEFAULT -1 ///< use standard pin length for given type
#define PIN_SHAPE_DEFAULT PR::T_line ///< use standard pin shape
#define PIN_CONN_DEFAULT PR::T_in ///< use standard pin connection type
class PIN : public BASE_GRAPHIC
{
friend class PART;
friend class SWEET_PARSER;
public:
PIN( PART* aOwner ) :
BASE_GRAPHIC( aOwner ),
angle( 0 ),
connectionType( PIN_CONN_DEFAULT ),
shape( PIN_SHAPE_DEFAULT ),
length( PIN_LEN_DEFAULT ),
isVisible( true )
{}
~PIN();
const char* ShowType() const
{
return SWEET_LEXER::TokenName( PR::T( connectionType ) );
}
const char* ShowShape() const
{
return SWEET_LEXER::TokenName( PR::T( shape ) );
}
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
BASE_GRAPHIC* Clone( PART* aOwner ) const
{
PIN* n = new PIN( *this );
n->owner = aOwner;
return n;
}
protected:
POINT pos;
ANGLE angle;
PINTEXT pad;
PINTEXT signal;
int connectionType; ///< T_in, T_out, T_inout, T_tristate, T_passive, T_unspecified,
///< T_power_in, T_power_out, T_open_collector, T_open_emitter, or T_unconnected.
int shape; ///< T_none, T_line, T_inverted, T_clock, T_inverted_clk, T_input_low, T_clock_low,
///< T_falling_edge, T_non_logic.
int length; ///< length of pin in internal units
bool isVisible; ///< pin is visible
wxString pin_merge; ///< pad of (pin_merge ...) that I am a member of, else empty if none
};
/**
* PART_REF
* is an LPID with a pointer to the "looked up" PART, which is looked up lazily.
*/
class PART_REF : public LPID
{
public:
PART_REF() :
LPID(),
part(0)
{}
/**
* Constructor LPID
* takes aLPID string and parses it. A typical LPID string uses a logical
* library name followed by a part name.
* e.g.: "kicad:passives/R/rev2", or
* e.g.: "mylib:R33"
*/
PART_REF( const STRING& aLPID ) throw( PARSE_ERROR ) :
LPID( aLPID ),
part(0)
{
}
/**
* Function Lookup
* returns the PART that this LPID refers to. Never returns NULL, because
* instead an exception would be thrown.
* @throw IO_ERROR if any problem occurs or if the part cannot be found.
*/
PART* Lookup( LIB_TABLE* aLibTable, LIB* aFallBackLib )
{
if( !part )
{
part = aLibTable->LookupPart( *this, aFallBackLib );
}
return part;
}
protected:
PART* part; ///< The looked-up PART,
///< no ownership (duh, PARTs are always owned by a LIB)
};
typedef std::vector<PART_REF> PART_REFS;
} // namespace SCH
//-----</temporary home for PART sub objects, move after stable>-----------------
typedef std::set< wxString > KEYWORDS;
namespace SCH {
typedef std::vector< BASE_GRAPHIC* > GRAPHICS;
typedef std::vector< PROPERTY* > PROPERTIES;
typedef std::vector< PIN* > PINS;
typedef std::vector< PIN* > PIN_LIST; ///< no ownership, used for searches
class LPID;
class SWEET_PARSER;
/**
* PART
* will have to be unified with what Wayne is doing. I want a separate copy
* here until I can get the state management correct. Since a PART only lives
* within a cache called a LIB, its constructor is private (only a LIB
* can instantiate one), and it exists in various states of freshness and
* completeness relative to the LIB_SOURCE within the LIB.
*/
class PART
{
friend class LIB; // is the owner of all PARTS, afterall
friend class SWEET_PARSER;
public:
/**
* Enum PROP_ID
* is the set of "mandatory" properties within a PART. These are used by
* PART as array indices into PART::mandatory[].
*/
enum PROP_ID
{
REFERENCE, ///< reference prefix, a template for instantiation at COMPONENT level
VALUE, ///< value, e.g. "3.3K"
FOOTPRINT, ///< name of PCB module, e.g. "16DIP300"
DATASHEET, ///< URI of datasheet
MODEL, ///< spice model name
END ///< array sentinel, not a valid index
};
virtual ~PART();
PART& operator = ( const PART& other );
/**
* Function Owner
* returns the LIB* owner of this part.
*/
LIB* Owner() { return owner; }
/**
* Function Parse
* translates a Sweet string into a binary form that is represented
* by the normal fields of this class. Parse is expected to call Inherit()
* if this part extends any other.
*
* @param aParser is an instance of SWEET_PARSER, rewound at the first line.
*
* @param aLibTable is the LIB_TABLE "view" that is in effect for inheritance,
* and comes from the big containing SCHEMATIC object.
*/
void Parse( SWEET_PARSER* aParser, LIB_TABLE* aLibTable ) throw( IO_ERROR, PARSE_ERROR );
/**
* Function Format
* outputs this PART in UTF8 encoded s-expression format to @a aFormatter.
* @param aFormatter is the output sink to write to.
* @param aNestLevel is the initial indent level
* @param aControlBits are bit flags ORed together which control how the output
* is done.
*/
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits = 0 ) const;
/**
* Function PropDelete
* deletes the property with aPropertyName if found and returns true, else false
* if not found.
*/
bool PropDelete( const wxString& aPropertyName );
/**
* Function Field
* returns a pointer to one of the mandatory properties, or NULL
* if non-existent. Use FieldLookup() to potentially allocate it.
*/
PROPERTY* Field( PROP_ID aPropertyId ) const
{
wxASSERT( unsigned(aPropertyId) < unsigned(END) );
return mandatory[aPropertyId];
}
/**
* Function FieldLookup
* returns a pointer to one of the mandatory properties, which is lazily
* constructed by this function if need be.
* @param aPropertyId tells which field.
*/
PROPERTY* FieldLookup( PROP_ID aPropertyId );
/**
* Function PinFindByPad
* finds a PIN based on aPad or returns NULL if not found.
* @param aPad is the pin to find
* @return PIN* - the found PIN or NULL if not found.
*/
PIN* PinFindByPad( const wxString& aPad )
{
PINS::iterator it = pinFindByPad( aPad );
return it != pins.end() ? *it : NULL;
}
/**
* Function PinsFindBySignal
* fetches all the pins matching aSignal into aResults.
*/
void PinsFindBySignal( PIN_LIST* aResults, const wxString& aSignal );
/**
* Function PinDelete
* deletes the pin with aPad if found and returns true, else false
* if not found.
*/
bool PinDelete( const wxString& aPad );
/*
void SetValue( const wxString& aValue )
{
value = aValue;
}
const wxString& GetValue()
{
return value;
}
void SetFootprint( const wxString& aFootprint )
{
footprint = aFootprint;
}
const wxString& GetFootprint()
{
return footprint;
}
void SetModel( const wxString& aModel )
{
model = aModel;
}
const wxString& GetModel()
{
return model;
}
*/
/*
void SetBody( const STR_UTF& aSExpression )
{
body = aSExpression;
}
*/
protected: // not likely to have C++ descendants, but protected none-the-less.
/// a protected constructor, only a LIB can instantiate a PART.
PART( LIB* aOwner, const STRING& aPartNameAndRev );
/**
* Function destroy
* clears out this object, deleting everything that this PART owns and
* initializing values back to a state as if the object was just constructed
* empty.
*/
void clear();
/**
* Function inherit
* is a specialized assignment function that copies a specific subset, enough
* to fulfill the requirements of the Sweet s-expression language.
*/
void inherit( const PART& aBasePart );
/**
* Function propertyFind
* searches for aPropertyName and returns a PROPERTIES::iterator which
* is the found item or properties.end() if not found.
*/
PROPERTIES::iterator propertyFind( const wxString& aPropertyName );
/**
* Function pinFindByPad
* searches for a PIN with aPad and returns a PROPERTIES::iterator which
* is the found item or pins.end() if not found.
*/
PINS::iterator pinFindByPad( const wxString& aPad );
LIB* owner; ///< which LIB am I a part of (pun if you want)
int contains; ///< has bits from Enum PartParts
STRING partNameAndRev; ///< example "passives/R[/revN..]", immutable.
LPID* extends; ///< of base part, NULL if none, otherwise I own it.
const PART* base; ///< which PART am I extending, if any. no ownership.
POINT anchor;
/// encapsulate the old version deletion, take ownership of @a aLPID
void setExtends( LPID* aLPID );
/// s-expression text for the part, initially empty, and read in as this part
/// actually becomes cached in RAM.
STRING body;
/// mandatory properties, aka fields. Index into mandatory[] is PROP_ID.
PROPERTY* mandatory[END];
/**
* Member properties
* holds the non-mandatory properties.
*/
PROPERTIES properties;
/**
* Member graphics
* owns : POLY_LINE, RECTANGLE, CIRCLE, ARC, BEZIER, and GR_TEXT objects.
*/
GRAPHICS graphics;
/**
* Member pins
* owns all the PINs in pins.
*/
PINS pins;
/// Alternate body forms.
PART_REFS alternates;
/// searching aids
KEYWORDS keywords;
/**
* A pin_merge set is a set of pins that are all electrically equivalent
* and whose anchor pin is the only one visible. The visible pin is the
* key in the MERGE_SETS boost::ptr_map::map
*/
MERGE_SETS pin_merges;
};
} // namespace PART
#endif // SCH_PART_

File diff suppressed because it is too large Load Diff

View File

@ -1,132 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#ifndef SCH_SWEET_PARSER_H_
#define SCH_SWEET_PARSER_H_
#include <utf8.h>
#include <sweet_lexer.h>
typedef int STROKE;
namespace SCH {
class LIB_TABLE;
class PART;
class POINT;
// GRAPHICS
class POLY_LINE;
class RECTANGLE;
class CIRCLE;
class ARC;
class BEZIER;
class GR_TEXT;
class PIN;
class FONT;
class PROPERTY;
struct PINTEXT;
struct TEXT_EFFECTS;
/**
* SWEET_PARSER
* scans a Sweet string as input and stuffs a PART.
* <p>
* Most functions in this class throw IO_ERROR and PARSE_ERROR. The IO_ERROR can
* happen if there is difficulty reading the input stream.
*/
class SWEET_PARSER : public SWEET_LEXER
{
LIB_TABLE* libs;
int contains; // separate from PART::contains until done
// so we can see what we inherited from base PART
// all these private functions rely on libs having been set via the public API, Parse( PART*)
void parseExtends( PART* me );
void parsePolyLine( POLY_LINE* me );
void parseBezier( BEZIER* me );
void parseRectangle( RECTANGLE* me );
void parseCircle( CIRCLE* me );
void parseArc( ARC* me );
void parseText( GR_TEXT* me );
void parseAt( POINT* pos, float* angle );
void parseBool( bool* aBool );
void parseFont( FONT* me );
void parsePinText( PINTEXT* me );
void parseTextEffects( TEXT_EFFECTS* me );
void parseKeywords( PART* me );
void parseAlternates( PART* me );
void parsePropertyDel( PART* me );
void parsePin( PIN* me );
void parsePinDel( PART* me );
void parsePinSwap( PART* me );
void parsePinRenum( PART* me );
void parsePinRename( PART* me );
void parsePinMerge( PART* me );
void parseStroke( STROKE* me );
public:
/**
* Constructor SWEET_PARSER
* takes aSweet string and gets ready to parse it.
* @param aSweet is the full description of a PART.
* @param aSource is used in error reporting and describes where the Sweet
* string came from in any appropriate way.
*/
SWEET_PARSER( const STRING& aSweet, const wxString& aSource = wxEmptyString ) :
SWEET_LEXER( aSweet, aSource ),
libs( 0 ),
contains( 0 )
{
}
SWEET_PARSER( LINE_READER* aLineReader ) :
SWEET_LEXER( aLineReader ),
libs( 0 ),
contains( 0 )
{
}
/**
* Function Parse
* stuffs @a aPart with data from this SWEET_LEXER, which has its own
* sweet string source.
* @param aPart is what is to be stuffed.
* @param aTable is the view of the LIBs in play.
*/
void Parse( PART* aPart, LIB_TABLE* aTable ) throw( IO_ERROR, PARSE_ERROR );
};
} // namespace SCH
#endif // SCH_SWEET_PARSER_H_

View File

@ -1,38 +0,0 @@
/**
* Interface Sweet
* is a Python interface file for SWIG. Languages other than Python can
* possibly also be supported with little addtional work.
*/
%module sweet
%{
#include <dsnlexer.h>
#include <sch_lib_table_lexer.h>
#include <sch_lib_table.h>
#include <sch_lpid.h>
#include <sweet_lexer.h>
#include <sch_part.h>
%}
%include "std_string.i"
%include "std_deque.i"
%include "utf8.h"
%ignore LINE_READER::operator char* () const;
namespace SCH {
%ignore PART::operator=( const PART& other );
}
%include "import_export.h"
%include "richio.h"
%include "dsnlexer.h"
//%include "sch_lib_table_lexer.h"
%include "sch_lpid.h"
%include "sch_lib.h"
%include "sch_lib_table.h"
%include "sweet_lexer.h"
%include "sch_part.h"

View File

@ -1,81 +0,0 @@
alternates
anchor
arc
at
bezier
bold
bottom
center
circle
clock
clock_low
datasheet
effects
end
end_angle
extends
falling_edge
fill
filled
font
footprint
hide
in
inout
input_low
inverted
inverted_clk
italic
justify
keywords
left
length
line
model
no
non_logic
none
open_collector
open_emitter
out
pad
pads
part
passive
pin
pin_del
pin_merge
pin_rename
pin_renum
pin_swap
polyline
pos
power_in
power_out
property
property_del
pts
radius
rectangle
reference
right
route_alt_swap
route_pin_swap
signal
signals
size
start
start_angle
stroke
text
top
transparent
tristate
unconnected
units
unspecified
value
visible
xy
yes

View File

@ -1,244 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 KiCad Developers, see change_log.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
*/
// wxWidgets imports
#include <wx/wx.h>
#include <wx/graphics.h>
#include <wx/timer.h>
#include <wx/event.h>
#include <wx/wxprec.h>
#include <wx/cmdline.h>
// Graphics Abstraction Layer imports
#include <gal/common/definitions.h>
#include <gal/common/graphics_abstraction_layer.h>
#include <gal/opengl/opengl_gal.h>
#include <gal/common/stroke_font.h>
#include <gal/common/color4d.h>
#include <gal/font/newstroke_font.h>
#include <math/vector2d.h>
#include <math/matrix3x3.h>
#include <sweet_editor_panel.h>
#define screenSizeX 640
#define screenSizeY 480
/**
* SWEET_EDIT
* implements an editor for SWEET, including support for inheritance and
* LIB_TABLE configuration.
*/
class SWEET_FRAME: public wxFrame
{
public:
// @brief Constructor
SWEET_FRAME( wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size );
// @brief Destructor
~SWEET_FRAME();
private:
bool m_isReady;
bool m_isPanning;
SCH::CANVAS* m_gal;
wxSize m_screenSize;
VECTOR2D m_worldSize;
VECTOR2D m_startMousePoint;
VECTOR2D m_startLookAtPoint;
/*
double m_alpha;
MATRIX3x3D m_startMatrix;
STROKE_FONT m_font;
*/
// Event handlers
void OnMotion( wxMouseEvent& event );
void OnMouseWheel( wxMouseEvent& event );
void OnRightDown( wxMouseEvent& event );
void OnRightUp( wxMouseEvent& event );
// void OnRedraw( wxCommandEvent& event );
};
SWEET_FRAME::SWEET_FRAME( wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size ) :
wxFrame( parent, id, title, pos, size ),
m_screenSize( size.x, size.y )
{
m_isPanning = false;
SWEET_EDITOR_PANEL* panel =
new SWEET_EDITOR_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), wxSize( -1, -1 ), 0 );
m_gal = (SCH::CANVAS*) panel->FindWindowByName( wxT( "GLCanvas" ), panel );
wxASSERT( m_gal );
m_gal->SetMouseListener( this );
Connect( wxEVT_MOTION, wxMouseEventHandler( SWEET_FRAME::OnMotion ) );
Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( SWEET_FRAME::OnMouseWheel ) );
Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( SWEET_FRAME::OnRightDown ) );
Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( SWEET_FRAME::OnRightUp ) );
}
SWEET_FRAME::~SWEET_FRAME()
{
delete m_gal;
}
void SWEET_FRAME::OnMotion( wxMouseEvent& event )
{
VECTOR2D mousePoint( event.GetX(), event.GetY() );
if( event.Dragging() )
{
if( m_isPanning )
{
MATRIX3x3D matrix = m_gal->GetWorldScreenMatrix().Inverse();
VECTOR2D delta = matrix.GetScale().x * ( m_startMousePoint - mousePoint );
m_gal->SetLookAtPoint( m_startLookAtPoint + delta );
m_gal->PaintScene();
}
}
else
{
m_gal->DrawCursor( mousePoint );
}
}
void SWEET_FRAME::OnMouseWheel( wxMouseEvent& event )
{
double zoomScale = ( event.GetWheelRotation() > 0.0 ) ? 1.1 : 0.9;
m_gal->SetZoomFactor( m_gal->GetZoomFactor() * zoomScale );
m_gal->PaintScene();
}
void SWEET_FRAME::OnRightDown( wxMouseEvent& event )
{
m_isPanning = true;
m_startMousePoint = VECTOR2D( event.GetX(), event.GetY() );
m_startLookAtPoint = m_gal->GetLookAtPoint();
}
void SWEET_FRAME::OnRightUp( wxMouseEvent& event )
{
m_isPanning = false;
}
static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
{
wxCMD_LINE_PARAM,
NULL,
NULL,
"filename of libtable",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE
},
{ wxCMD_LINE_NONE }
};
class GAL_TEST_APPLICATION: public wxApp
{
public:
GAL_TEST_APPLICATION();
private:
virtual bool OnInit();
virtual int OnExit();
virtual int OnRun();
virtual void OnInitCmdLine( wxCmdLineParser& aParser );
virtual bool OnCmdLineParsed( wxCmdLineParser& aParser );
};
GAL_TEST_APPLICATION::GAL_TEST_APPLICATION()
{
}
bool GAL_TEST_APPLICATION::OnInit()
{
if ( !wxApp::OnInit() )
return false;
SWEET_FRAME* frame = new SWEET_FRAME( (wxFrame *) NULL,
-1, wxT( "SWEET Editor" ),
wxPoint( screenSizeX + 10, 0 ),
wxSize( screenSizeX, screenSizeY ) );
frame->Show( true );
return true;
}
int GAL_TEST_APPLICATION::OnExit()
{
return 0;
}
int GAL_TEST_APPLICATION::OnRun()
{
int exitcode = wxApp::OnRun();
return exitcode;
}
void GAL_TEST_APPLICATION::OnInitCmdLine( wxCmdLineParser& parser )
{
parser.SetDesc( g_cmdLineDesc );
parser.SetSwitchChars( wxT( "-" ) );
}
bool GAL_TEST_APPLICATION::OnCmdLineParsed( wxCmdLineParser& parser )
{
return true;
}
DECLARE_APP( GAL_TEST_APPLICATION )
IMPLEMENT_APP( GAL_TEST_APPLICATION )

View File

@ -1,76 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include <sweet_editor_panel.h>
///////////////////////////////////////////////////////////////////////////
SWEET_EDITOR_PANEL::SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_top_bottom = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
m_top_bottom->SetSashGravity( 1 );
m_top_bottom->Connect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_top_bottomOnIdle ), NULL, this );
m_panel9 = new wxPanel( m_top_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxVERTICAL );
m_splitter3 = new wxSplitterWindow( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
m_splitter3->Connect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_splitter3OnIdle ), NULL, this );
m_scrolledTextWindow = new wxScrolledWindow( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_scrolledTextWindow->SetScrollRate( 5, 5 );
wxStaticBoxSizer* m_scrolledTextSizer;
m_scrolledTextSizer = new wxStaticBoxSizer( new wxStaticBox( m_scrolledTextWindow, wxID_ANY, _("Sweet") ), wxVERTICAL );
m_sweet_scroll_window = new wxTextCtrl( m_scrolledTextWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxALWAYS_SHOW_SB );
m_scrolledTextSizer->Add( m_sweet_scroll_window, 1, wxALL|wxEXPAND, 5 );
m_scrolledTextWindow->SetSizer( m_scrolledTextSizer );
m_scrolledTextWindow->Layout();
m_scrolledTextSizer->Fit( m_scrolledTextWindow );
m_gal_scrolled_window = new wxScrolledWindow( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL );
m_gal_scrolled_window->SetScrollRate( 5, 5 );
wxStaticBoxSizer* m_gal_sizer;
m_gal_sizer = new wxStaticBoxSizer( new wxStaticBox( m_gal_scrolled_window, wxID_ANY, _("Visual Part") ), wxVERTICAL );
m_gal = new SCH::CANVAS( m_gal_scrolled_window );
m_gal_sizer->Add( m_gal, 1, wxEXPAND, 5 );
m_gal_scrolled_window->SetSizer( m_gal_sizer );
m_gal_scrolled_window->Layout();
m_gal_sizer->Fit( m_gal_scrolled_window );
m_splitter3->SplitVertically( m_scrolledTextWindow, m_gal_scrolled_window, 0 );
bSizer10->Add( m_splitter3, 1, wxEXPAND, 5 );
m_panel9->SetSizer( bSizer10 );
m_panel9->Layout();
bSizer10->Fit( m_panel9 );
m_scrolledWindow3 = new wxScrolledWindow( m_top_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_scrolledWindow3->SetScrollRate( 5, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_scrolledWindow3, wxID_ANY, _("Parsing Errors") ), wxVERTICAL );
m_htmlWin2 = new wxHtmlWindow( m_scrolledWindow3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
sbSizer1->Add( m_htmlWin2, 1, wxALL|wxEXPAND, 5 );
m_scrolledWindow3->SetSizer( sbSizer1 );
m_scrolledWindow3->Layout();
sbSizer1->Fit( m_scrolledWindow3 );
m_top_bottom->SplitHorizontally( m_panel9, m_scrolledWindow3, 0 );
bSizer2->Add( m_top_bottom, 1, wxEXPAND, 5 );
this->SetSizer( bSizer2 );
this->Layout();
}
SWEET_EDITOR_PANEL::~SWEET_EDITOR_PANEL()
{
}

View File

@ -1,938 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">sweet_editor_panel</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">MyProject1</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">SWEET_EDITOR_PANEL</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">500,300</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_top_bottom</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="sashgravity">1</property>
<property name="sashpos">0</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_HORIZONTAL</property>
<property name="style">wxSP_3D</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSplitterDClick"></event>
<event name="OnSplitterSashPosChanged"></event>
<event name="OnSplitterSashPosChanging"></event>
<event name="OnSplitterUnsplit"></event>
<event name="OnUpdateUI"></event>
<object class="splitteritem" expanded="1">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel9</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer10</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_splitter3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="sashgravity">0.0</property>
<property name="sashpos">0</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_VERTICAL</property>
<property name="style">wxSP_3D</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSplitterDClick"></event>
<event name="OnSplitterSashPosChanged"></event>
<event name="OnSplitterSashPosChanging"></event>
<event name="OnSplitterUnsplit"></event>
<event name="OnUpdateUI"></event>
<object class="splitteritem" expanded="1">
<object class="wxScrolledWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_scrolledTextWindow</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="scroll_rate_x">5</property>
<property name="scroll_rate_y">5</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Sweet</property>
<property name="minimum_size"></property>
<property name="name">m_scrolledTextSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_sweet_scroll_window</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxALWAYS_SHOW_SB</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
<object class="splitteritem" expanded="0">
<object class="wxScrolledWindow" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gal_scrolled_window</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="scroll_rate_x">5</property>
<property name="scroll_rate_y">5</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Visual Part</property>
<property name="minimum_size"></property>
<property name="name">m_gal_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="CustomControl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="class">SCH::CANVAS</property>
<property name="close_button">1</property>
<property name="construction">m_gal = new SCH::CANVAS( m_gal_scrolled_window );</property>
<property name="context_help"></property>
<property name="context_menu">0</property>
<property name="declaration">SCH::CANVAS* m_gal;</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="include">#include &lt;sch_canvas.h&gt;</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gal</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="settings"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="splitteritem" expanded="1">
<object class="wxScrolledWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_scrolledWindow3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="scroll_rate_x">5</property>
<property name="scroll_rate_y">5</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Parsing Errors</property>
<property name="minimum_size"></property>
<property name="name">sbSizer1</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxHtmlWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_htmlWin2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxHW_SCROLLBAR_AUTO</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHtmlCellClicked"></event>
<event name="OnHtmlCellHover"></event>
<event name="OnHtmlLinkClicked"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,67 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __sweet_editor_panel__
#define __sweet_editor_panel__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/scrolwin.h>
#include <sch_canvas.h>
#include <wx/splitter.h>
#include <wx/panel.h>
#include <wx/html/htmlwin.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class SWEET_EDITOR_PANEL
///////////////////////////////////////////////////////////////////////////////
class SWEET_EDITOR_PANEL : public wxPanel
{
private:
protected:
wxSplitterWindow* m_top_bottom;
wxPanel* m_panel9;
wxSplitterWindow* m_splitter3;
wxScrolledWindow* m_scrolledTextWindow;
wxTextCtrl* m_sweet_scroll_window;
wxScrolledWindow* m_gal_scrolled_window;
SCH::CANVAS* m_gal;
wxScrolledWindow* m_scrolledWindow3;
wxHtmlWindow* m_htmlWin2;
public:
SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
~SWEET_EDITOR_PANEL();
void m_top_bottomOnIdle( wxIdleEvent& )
{
m_top_bottom->SetSashPosition( 0 );
m_top_bottom->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_top_bottomOnIdle ), NULL, this );
}
void m_splitter3OnIdle( wxIdleEvent& )
{
m_splitter3->SetSashPosition( 0 );
m_splitter3->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SWEET_EDITOR_PANEL::m_splitter3OnIdle ), NULL, this );
}
};
#endif //__sweet_editor_panel__

View File

@ -1,732 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2011-04-18T01:23:31</meta:creation-date>
<meta:editing-duration>PT17M33S</meta:editing-duration>
<meta:editing-cycles>4</meta:editing-cycles>
<meta:generator>LibreOffice/3.4$Unix LibreOffice_project/340m1$Build-301</meta:generator>
<dc:date>2011-08-25T22:29:36</dc:date><dc:creator>Dick Hollenbeck</dc:creator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="11" meta:paragraph-count="340" meta:word-count="2770" meta:character-count="17364" meta:non-whitespace-character-count="13943"/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="long">65</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">23670</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">12026</config:config-item>
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">8008</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">11061</config:config-item>
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">65</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">23668</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">12090</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
<config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">205</config:config-item>
<config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
<config:config-item-set config:name="ooo:configuration-settings">
<config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
<config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
<config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item>
<config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
<config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
<config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
<config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
<config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
<config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
<config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
<config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
<config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
<config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
<config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
<config:config-item config:name="PrinterName" config:type="string"/>
<config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
<config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
<config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
<config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
<config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintFaxName" config:type="string"/>
<config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
<config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
<config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
<config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
</config:config-item-set>
</office:settings>
<office:scripts>
<office:script script:language="ooo:Basic">
<ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink">
<ooo:library-embedded ooo:name="Standard"/>
</ooo:libraries>
</office:script>
</office:scripts>
<office:font-face-decls>
<style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>
<style:font-face style:name="Bitstream Vera Sans Mono" svg:font-family="&apos;Bitstream Vera Sans Mono&apos;" style:font-adornments="Roman" style:font-family-generic="modern" style:font-pitch="fixed"/>
<style:font-face style:name="Times New Roman" svg:font-family="&apos;Times New Roman&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Lucida Sans Unicode" svg:font-family="&apos;Lucida Sans Unicode&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties fo:wrap-option="wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>
<style:text-properties style:use-window-font-color="true" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Tahoma" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text"/>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/>
<style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
</style:style>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in"/>
</style:style>
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
<style:text-properties style:font-name-complex="Tahoma1"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-top="0.0835in" fo:margin-bottom="0.0835in" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Tahoma1" style:font-size-complex="12pt" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-name-complex="Tahoma1"/>
</style:style>
<style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-left="0.1965in" fo:margin-right="0in" fo:text-indent="-0.1965in" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="code0" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="chapter">
<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0201in">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:font-name="Bitstream Vera Sans Mono" fo:font-size="10pt"/>
</style:style>
<style:style style:name="comment" style:family="paragraph" style:parent-style-name="code0" style:class="chapter">
<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0201in"/>
<style:text-properties fo:color="#006b6b"/>
</style:style>
<style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
</style:style>
<style:style style:name="Table_20_Heading" style:display-name="Table Heading" style:family="paragraph" style:parent-style-name="Table_20_Contents" style:class="extra">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text">
<style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
<style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="4" style:class="text">
<style:text-properties fo:font-size="85%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="85%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="5" style:class="text">
<style:text-properties fo:font-size="85%" fo:font-weight="bold" style:font-size-asian="85%" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="6" style:class="text">
<style:text-properties fo:font-size="75%" fo:font-weight="bold" style:font-size-asian="75%" style:font-weight-asian="bold" style:font-size-complex="75%" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
<style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
<style:text-properties style:text-position="super 58%"/>
</style:style>
<style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
<style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
</style:style>
<style:style style:name="Visited_20_Internet_20_Link" style:display-name="Visited Internet Link" style:family="text">
<style:text-properties fo:color="#800000" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
</style:style>
<text:outline-style style:name="Outline">
<text:outline-level-style text:level="1" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.3in" fo:text-indent="-0.3in" fo:margin-left="0.3in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="2" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.4in" fo:text-indent="-0.4in" fo:margin-left="0.4in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="3" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.5in" fo:text-indent="-0.5in" fo:margin-left="0.5in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="4" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.6in" fo:text-indent="-0.6in" fo:margin-left="0.6in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="5" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.7in" fo:text-indent="-0.7in" fo:margin-left="0.7in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="6" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.8in" fo:text-indent="-0.8in" fo:margin-left="0.8in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="7" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.9in" fo:text-indent="-0.9in" fo:margin-left="0.9in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="8" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1in" fo:text-indent="-1in" fo:margin-left="1in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="9" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.1in" fo:text-indent="-1.1in" fo:margin-left="1.1in"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="10" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.2in" fo:text-indent="-1.2in" fo:margin-left="1.2in"/>
</style:list-level-properties>
</text:outline-level-style>
</text:outline-style>
<text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
<text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/>
<style:default-page-layout>
<style:page-layout-properties style:writing-mode="lr-tb" style:layout-grid-standard-mode="true"/>
</style:default-page-layout>
</office:styles>
<office:automatic-styles>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="code0">
<style:text-properties fo:color="#000000"/>
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="code0">
<style:text-properties style:use-window-font-color="true"/>
</style:style>
<style:style style:name="P3" style:family="paragraph" style:parent-style-name="comment">
<style:text-properties fo:color="#800000"/>
</style:style>
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="comment">
<style:text-properties fo:color="#008080"/>
</style:style>
<style:style style:name="P5" style:family="paragraph" style:parent-style-name="code0">
<style:paragraph-properties fo:break-before="page"/>
</style:style>
<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:break-before="page"/>
</style:style>
<style:style style:name="P7" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name=""/>
<style:style style:name="P9" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P10" style:family="paragraph" style:parent-style-name="Heading_20_1" style:list-style-name="">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P11" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:break-before="page"/>
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:color="#0000ff"/>
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties fo:color="#800000"/>
</style:style>
<style:style style:name="T3" style:family="text">
<style:text-properties fo:color="#006b6b"/>
</style:style>
<style:style style:name="T4" style:family="text">
<style:text-properties fo:color="#000000"/>
</style:style>
<style:style style:name="T5" style:family="text">
<style:text-properties style:use-window-font-color="true"/>
</style:style>
<style:style style:name="T6" style:family="text">
<style:text-properties style:text-position="super 58%"/>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in">
<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1"/>
</office:master-styles>
<office:body>
<office:text text:use-soft-page-breaks="true">
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:h text:style-name="P7" text:outline-level="1">SWEET <text:s/>S-Expression Grammar Describing a </text:h>
<text:h text:style-name="P10" text:outline-level="1">Schematic Part String Format Specification </text:h>
<text:h text:style-name="P7" text:outline-level="1"/>
<text:h text:style-name="P8" text:outline-level="1">Authors:</text:h>
<text:h text:style-name="P8" text:outline-level="1">Wayne Stambaugh</text:h>
<text:h text:style-name="P8" text:outline-level="1">Dick Hollenbeck</text:h>
<text:h text:style-name="P8" text:outline-level="1"/>
<text:h text:style-name="P8" text:outline-level="1"/>
<text:h text:style-name="P8" text:outline-level="1">Original Edits: <text:tab/>January 2011</text:h>
<text:h text:style-name="P8" text:outline-level="1">Latest Edits:<text:tab/> <text:tab/>August 2011</text:h>
<text:h text:style-name="P8" text:outline-level="1"/>
<text:h text:style-name="P6" text:outline-level="1">Introduction</text:h>
<text:p text:style-name="Text_20_body">The purpose of this document is to define the new format for the Kicad schematic part descriptions, as expressed using the new SWEET grammar. <text:s/>This format supersedes the old file format defined in the file “library_file_format_EN.odt. <text:s/>The idea of component library files is no longer valid. <text:s/>The unit of retrieval from the new distributed library system is the part, not a library. <text:s text:c="2"/>To learn more about the new distributed library system see the design.h document in the Kicad source tree, or better yet, the Doxygen generated material therefrom.</text:p>
<text:p text:style-name="Text_20_body">The SWEET grammar format is based on the Specttra DSN lexer<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body>
<text:p text:style-name="Footnote">See source files dsnlexer.cpp and dsnlexer.h in the Kicad source code for more information about how the DSN lexer works.</text:p></text:note-body></text:note> work graciously coded and contributed by Dick Hollenbeck. <text:s/>For those not familiar with the DSN format, it is very similar the the LISP programming language in that keywords are delimited by braces. <text:s/>It is also known as an S-expression format. <text:s/>A keyword may have zero or more tokens that behave like parameters for the keyword. <text:s/>Tokens may be defined as additional keywords creating a programming language like structure. <text:s/>The decision to change to this format is driven by a desire to provide a more robust file lexer, a human readable file format, better retrieval error reporting, and improved extensibility. <text:s/>The other driving factor is to provide a more robust format for handling the various requirements of the component library developers.</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1">Front Matter</text:h>
<text:p text:style-name="Text_20_body">This is a living document designed to be kept synchronized with the actual source code. <text:s/>If you modify the lexer, please update this specification as courtesy to other developers. <text:s/>There are many third party tools that are used to generate, manipulate, and parse component library files. <text:s/>Keeping this document current is vital to developers of these tools.</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1">Formatting</text:h>
<text:p text:style-name="Text_20_body">The DSN lexer enforces strict formatting requirements. <text:s/>Files must be encoded in UTF8 format. <text:s/>All lexer keywords are comprised of lower case letters, numbers, and underscores. <text:s/>Tokens may be any alphanumeric character delimited by a white space character. <text:s/>Each new delimited level of keywords is indented to make files easier to read and edit with a plain text editor. <text:s/>Comments are supported as separate lines indented at the same level as the current keyword delimiter and begin with the # character. <text:s/>In line comments are not allowed. <text:s/>There is more information on s-expression support in the Kicad source tree in file Documentation/s-expressions.txt.</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1">Using this document</text:h>
<text:p text:style-name="Text_20_body">This document is nothing more than several well commented part files. <text:s/>You should always be able to copy the text from the opening delimiter “(“ to the closing delimeter “)” into a file and open it with the library part file editor or library part viewer in Kicad&apos;s schematic capture program EESchema. <text:s/>It may not actually draw a useful component or be a very useful part but it should always be syntactically correct. <text:s/>The comments for a specific keyword always appears above the keyword it describes. <text:s/>Keywords defined within brackets [] are optional. <text:s/>A simple syntax coloring scheme has been employed to make this document more readable. <text:s/>Keywords are highlighted in <text:span text:style-name="T1">blue</text:span>, <text:s/>comments are highlighted in <text:span text:style-name="T3">turquoise</text:span>, and strings are highlighted in <text:span text:style-name="T2">red</text:span>.</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1"><text:soft-page-break/>Logical coordinates.</text:h>
<text:p text:style-name="Text_20_body">The SWEET grammar expresses schematic parts using a coordinate system without units of measure. <text:s/>That is, logical coordinates used and are dimensionless. <text:s/>The advantage of having coordinates without units is any item that has an integer (non-fractional) coordinate in x and y, will be “on grid”. <text:s/>This helps ensure all connectable items such as pins, wires, junctions, etc., can be easily connected using normal grid snap. <text:s/>The normal spacing between neighboring part pins is 1 logical unit, and it is dimensionless. <text:s/>In fact, this is the definition of what a logical unit is, the normal spacing between two neighboring pins. <text:s text:c="3"/>Only non-connectable objects (e.g. arcs, text, etc.) should have non-integer coordinates. <text:s/>The zoom factor at time of printing or plotting determines the physical size of any drawing output.</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1">Line Widths</text:h>
<text:p text:style-name="Text_20_body">Line widths are given as a percent of a logical unit. <text:s/>In other words, a line width of 1 means 1/100<text:span text:style-name="T6">th</text:span> of a logical unit. <text:s/>Recall that a logical unit of 1 is the normal spacing between two neighboring schematic pins. <text:s text:c="2"/>So a line width of 50 would mean 50/100 of a pin interval, or half the normal space between two pins. <text:s/>A line width of 50 represents a very wide line indeed, a more normal line width would be about 1-5 <text:s/>(percent).</text:p>
<text:h text:style-name="Heading_20_1" text:outline-level="1">An example file showing syntax for all drawable item types.</text:h>
<text:p text:style-name="comment"># The schematic part element is the largest entity addressed by the SWEET grammar.</text:p>
<text:p text:style-name="comment"># A schematic part can be inherited from another part by using the “extends”</text:p>
<text:p text:style-name="comment"># keyword.</text:p>
<text:p text:style-name="comment"># The part name is normally the file name, although SWEET parts will not always</text:p>
<text:p text:style-name="comment"># exist as mere files. <text:s/>They are actually best thought of as strings held in a</text:p>
<text:p text:style-name="comment"># a container called a lib_source. The NAME_HINT is to be used in a manner yet to</text:p>
<text:p text:style-name="comment"># be determined, depending on the context from which the SWEET part came from.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T5">NAME_HINT [</text:span><text:span text:style-name="T1">extends</text:span> <text:span text:style-name="T5">LPID]</text:span> </text:p>
<text:p text:style-name="P2"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Change the anchor position to something other than 0, 0. <text:s/>Anchor coordinates</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># must be integers.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">anchor</text:span> (<text:span text:style-name="T1">at </text:span>X Y))]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># The reference token is a reserved property. <text:s/>Other reserved properties are</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># value, footprint, datasheet, model, and keywords.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T5">REF</text:span> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Effects define how a property is displayed. <text:s/>If no effect is defined then</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># the property is not displayed. <text:s/>Effects can also be used to override the</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># effects of a property in an inherited part. <text:s/>When (effects...) is used</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># in a COMPONENT to override the effects of a PART, the PROPERTY </text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># specifier must be present.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[<text:bookmark-start text:name="__DdeLink__1991_2022311872"/>(<text:span text:style-name="T1">effects</text:span> [PROPERTY]</text:p>
<text:p text:style-name="P3"/>
<text:p text:style-name="comment"><text:s text:c="6"/># Position requires an X and Y coordinate. <text:s/>Position coordinates can be</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># non-integer. <text:s/>Angle is in degrees and defaults to 0 if not defined.</text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">at </text:span>X Y [ANGLE])</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="6"/><text:bookmark-start text:name="__DdeLink__1994_2124759253"/># The FONT value needs to be defined. <text:s/>Currently, EESchema does not support</text:p>
<text:p text:style-name="comment"><text:soft-page-break/><text:s text:c="6"/># different fonts. <text:s/>In the future this feature may be implemented and at</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># that time FONT will have to be defined. <text:s/>Initially, only the font size &amp;</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># style are required. <text:s/>Italic and bold styles are optional. <text:s/>The font size</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># height and width are in units yet to be determined. <text:s/>Only a variance</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># from defaults needs to be stated.</text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])<text:bookmark-end text:name="__DdeLink__1994_2124759253"/>]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="6"/># Default visibility for fields is no, only a variance from the</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># the default needs to be stated.</text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">visible yes</text:span>)]</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>)<text:bookmark-end text:name="__DdeLink__1991_2022311872"/>]</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Add a new user defined property to this part. <text:s/>Also can be used to override</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># a property defined in an inherited part.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">property</text:span> <text:span text:style-name="T5">NAME VALUE</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="4"/>[(</text:span><text:span text:style-name="T1">effects</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="6"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">X Y [ANGLE])</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="6"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="6"/># Default visibility for fields is no, only a variance from the</text:p>
<text:p text:style-name="comment"><text:s text:c="6"/># the default needs to be stated.</text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>[(<text:span text:style-name="T1">visible yes</text:span>)]</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>)]</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
<text:p text:style-name="comment"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Either polyline or line can be used to define a line or series of lines.</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># Coordinates can be non-integer.</text:p>
<text:p text:style-name="code0"><text:bookmark-start text:name="__DdeLink__1984_2124759253"/><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> <text:span text:style-name="T5">or</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">line</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">pts</text:span> (<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y)(<text:span text:style-name="T1">xy </text:span>X Y))</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Line widths are in units as defined above.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(stroke [WIDTH] <text:bookmark-start text:name="__DdeLink__2025_599115402"/>[(style [(dashed...)]...)]<text:bookmark-end text:name="__DdeLink__2025_599115402"/>)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Valid fill types are none, filled, and transparent. <text:s/>Default fill for</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># a poly_line is none. <text:s/>Only a variance from the default needs to be stated.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)]</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1984_2124759253"/> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:s text:c="2"/><text:bookmark-start text:name="__DdeLink__1986_2124759253"/>(<text:span text:style-name="T1">rectangle </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">start </text:span>X Y) (<text:span text:style-name="T1">end </text:span>X Y) (<text:span text:style-name="T1">stroke </text:span>WIDTH) (<text:span text:style-name="T1">fill </text:span>FILL_TYPE))<text:bookmark-end text:name="__DdeLink__1986_2124759253"/> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:s/><text:bookmark-start text:name="__DdeLink__1988_2124759253"/><text:s/>(<text:span text:style-name="T1">circle</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">center</text:span> X Y)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">radius </text:span>LENGTH)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1988_2124759253"/> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:s text:c="2"/><text:bookmark-start text:name="__DdeLink__1990_2124759253"/>(<text:span text:style-name="T1">arc</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">pos</text:span> <text:span text:style-name="T5">X Y) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">RADIUS) (</text:span><text:span text:style-name="T1">start</text:span> X Y) (<text:span text:style-name="T1">end</text:span> X Y)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
<text:p text:style-name="code0"><text:s text:c="3"/>)<text:bookmark-end text:name="__DdeLink__1990_2124759253"/> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">bezier</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">pts </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y) (<text:span text:style-name="T1">xy </text:span>X Y))</text:p>
<text:p text:style-name="code0"><text:s text:c="5"/>(<text:span text:style-name="T1">stroke </text:span>WIDTH)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:bookmark-start text:name="__DdeLink__1992_2124759253"/><text:s text:c="2"/>(<text:span text:style-name="T1">text</text:span> <text:span text:style-name="T2">“This is the text that gets drawn.”</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T4"><text:s text:c="4"/>(</text:span><text:span text:style-name="T1">at </text:span><text:span text:style-name="T4">X Y [ANGLE])</text:span> </text:p>
<text:p text:style-name="P1"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Valid horizontal justification values are center, right, and left. <text:s/>Valid</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># vertical justification values are center, top, bottom. <text:s/>Defaults are</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># left and bottom. <text:s/>Only need to state a non-default.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">justify [</text:span>HORIZONTAL_JUSTIFY] [VERTICAL_JUSTIFY])]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># default visibility is yes, only need to state a variance from this default.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">visible no</text:span>)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># default fill type for text is filled, only need to state a non-default</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">fill </text:span>FILL_TYPE)]</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)<text:bookmark-end text:name="__DdeLink__1992_2124759253"/> </text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># A pin&apos;s type is it&apos;s electrical connection. <text:s/>Valid connection types are</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># input, output, bidirectional, tristate, passive, unspecified, power_in,</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># power_out, open_collector, open_emitter, unconnected. <text:s/>Valid pin shape</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># values are none, line, inverted, clock, inverted_clk, input_low, clock_low,</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># falling_edge, and non_logic.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">TYPE SHAPE</text:span> </text:p>
<text:p text:style-name="P2"/>
<text:p text:style-name="P4"><text:s text:c="4"/># Pin coordinates must be integers. <text:s/>The angle values 0, 180, 90, and 270</text:p>
<text:p text:style-name="P4"><text:s text:c="4"/># replace the current right, left, up, and down specifiers respectively,</text:p>
<text:p text:style-name="P4"><text:s text:c="4"/># and are the only angles currently supported.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">at </text:span>X Y [ANGLE])</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Length of the pin in logical units. <text:s/>This is optional, depending on </text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># SHAPE, which in some cases may imply a fixed length</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">length</text:span> LENGTH)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Use signal to describe the purpose of the pin. <text:s/>Signals do not have to be</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># uniquely named within a part. <text:s/>Signal can be blank.</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>[</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">signal</text:span> <text:span text:style-name="T2">“NAME” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic][bold]) </text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">YES</text:span>))]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="4"/># Use pad to uniquely identify the pin, according to the pin number</text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># in the datasheet for the part. <text:s/>Padnames may not be blank and must be</text:p>
<text:p text:style-name="comment"><text:bookmark-start text:name="__DdeLink__2027_599115402"/><text:s text:c="4"/># be unique within the part.</text:p>
<text:p text:style-name="code0"><text:bookmark-end text:name="__DdeLink__2027_599115402"/><text:s text:c="2"/><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“NUMBER” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic][bold])</text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">YES</text:span>))</text:p>
<text:p text:style-name="code0"><text:s/></text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># default visibility for pins is yes, so only a deviation from the </text:p>
<text:p text:style-name="comment"><text:s text:c="4"/># the default needs to be stated.</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>[(<text:span text:style-name="T1">visible no</text:span>)]</text:p>
<text:p text:style-name="code0"><text:s text:c="3"/>)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="P5"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Pin merge is used to group a number of pins that are connected to the same</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># net externally and show only one pin symbolizing the group. <text:s/>The group is</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># called a merge set or merge group. <text:s/>It is typically used to hide all but </text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># one power pin on parts that have a large number of power connections </text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># such as FPGAs and micro-contollers. <text:s/>VISIBLE_PAD is the pad of</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># the one pin which remains visible within the merge set. <text:s/>Pins with pads</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># listed within the (pads...) element are all made invisible, and so</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># are are all pins which may have any of the signal names listed in the </text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># (signals...) element. <text:s/>A pin may only exist within one merge group.</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># Any number of (pin_merge...) statements maybe made, including more than</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># one re-stating the same VISIBLE_PAD, which is the anchor pin for the </text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># merge set.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_merge</text:span> VISIBLE_PAD </text:p>
<text:p text:style-name="code0"><text:tab/>[(pads HIDDEN_PAD1 …)][(signals HIDDEN_SIGNAL1 …)])]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># The pin swap hinting flag is used to indicate to an external tool ( i.e. an</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># auto router ) that the pins defined are functionally equivalent and</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># interchangeable.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">hint_pin_swap</text:span> NUMBER1 NUMBER2 ...)]</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:h text:style-name="Heading_20_1" text:outline-level="1">Inheritance syntax example file.</text:h>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T5">NAME_HINT </text:span><text:span text:style-name="T1">extends</text:span> <text:span text:style-name="T5">LPID</text:span> </text:p>
<text:p text:style-name="comment"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Remove pin PAD defined in the base part. <text:s/>Only valid for extended parts.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_del </text:span>PAD)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Swap pin PAD1 and pin PAD2 in the base part. <text:s/></text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_swap </text:span>PAD1 PAD2)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Change the pad of pin OLDPAD to NEWPAD in the base part.</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_renum</text:span> OLDPAD NEWPAD)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Change the signal of pin PAD to NEWSIGNAL in the base part. <text:s/></text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># Only valid for extended parts.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">pin_rename</text:span> PAD NEWSIGNAL)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Remove property NAME from the base part. <text:s/>Only valid for extended parts.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">property_del </text:span>NAME)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Alternates are used to define multiple part per package devices and/or</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># alternate body styles (DeMorgan). <text:s/>Parts must be defined in order. <text:s/>There</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># can more than one alternates defined.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">alternates </text:span>LP<text:span text:style-name="T5">ID [LPID...]</text:span>)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># Add a new property to this part. <text:s/>Also can be use to override a property</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># defined in the base part.</text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>[(<text:span text:style-name="T1">property</text:span> <text:span text:style-name="T5">NAME VALUE</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="4"/>[(</text:span><text:span text:style-name="T1">effects </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">X Y [ANGLE])</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="6"/>(</text:span><text:span text:style-name="T1">font</text:span> <text:span text:style-name="T5">[</text:span>FONT] (<text:span text:style-name="T1">size </text:span>HEIGHT WIDTH) [italic] [bold])</text:p>
<text:p text:style-name="code0"><text:s text:c="6"/>(<text:span text:style-name="T1">visible </text:span>YES)]</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)]</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"><text:s text:c="2"/># The alternates swap hinting flag is used to indicate to an external tool</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># that the parts defined in the alternates list are functionally equivalent</text:p>
<text:p text:style-name="comment"><text:s text:c="2"/># and interchangeable.</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>[(<text:span text:style-name="T1">hint_alt_swap</text:span> LPID1 LPID2 ...)]</text:p>
<text:p text:style-name="Text_20_body">)</text:p>
<text:p text:style-name="Text_20_body"/>
<text:p text:style-name="comment"># This is an example of a dual input NAND gate A of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_a”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T2">“U”</text:span>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">2 0) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">0.4) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">2</text:span> -4) (<text:span text:style-name="T1">start_angle</text:span> -90) (<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">2</text:span> 4)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end_angle</text:span> 90)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">2</text:span> 4) (<text:span text:style-name="T1">xy </text:span>-6 4) (<text:span text:style-name="T1">xy </text:span>-6 -4) (<text:span text:style-name="T1">xy </text:span>2 -4)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>0) (<text:span text:style-name="T1">fill </text:span>none))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 2 3.6 180)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“1” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> -2 3.6)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“2” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">output</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 0)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“3” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> -4 90)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“GND” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> 4 90)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“VCC” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_pin_swap</text:span> <text:span text:style-name="T2">“1”</text:span> <text:span text:style-name="T2">“2”</text:span>)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># All LPIDs below this point assume that the base part is located in the same</text:p>
<text:p text:style-name="comment"># library as the parts that are derived from them. <text:s/>See the “Distributed Library</text:p>
<text:p text:style-name="comment"># &amp; EESchema Parts List Design Documentation” in the Kicad source file “design.h”</text:p>
<text:p text:style-name="comment"># for more information on LPIDs.</text:p>
<text:p text:style-name="comment"/>
<text:p text:style-name="comment"># This is the B gate of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_b”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 4)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 5)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 6)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is the C gate of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_c”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 8 4)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 9 5)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 10 6)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is the D gate of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_b”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 11)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 12)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 13)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is a DeMorgan representation of a dual input NAND gate A.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_</text:span> <text:span text:style-name="T2">demorgan</text:span> <text:span text:style-name="T2">_a”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">reference</text:span> <text:span text:style-name="T2">“U”</text:span>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-9.3 0) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">0.518) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">-6</text:span> 4) (<text:span text:style-name="T1">start_angle</text:span> 50.4)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">-6</text:span> -4) (<text:span text:style-name="T1">end_angle</text:span> -50.4)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-0.22 2.86) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">7.06) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">0</text:span> -200) (<text:span text:style-name="T1">start_angle</text:span> -88.1)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">6</text:span> 0) (<text:span text:style-name="T1">end_angle</text:span> -24.6)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">arc (pos</text:span> <text:span text:style-name="T5">-0.2 2.82) (</text:span><text:span text:style-name="T1">radius</text:span> <text:span text:style-name="T5">6.8) (</text:span><text:span text:style-name="T1">start</text:span> <text:span text:style-name="T5">6</text:span> 0) (<text:span text:style-name="T1">start_angle</text:span> -24.4) (<text:span text:style-name="T1">end</text:span> <text:span text:style-name="T5">0</text:span> 4)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">end_angle</text:span> 88.3)<text:span text:style-name="T1"> </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">stroke</text:span> <text:span text:style-name="T5">0</text:span>) (<text:span text:style-name="T1">fill</text:span> <text:span text:style-name="T5">none</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">polyline</text:span> (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">-6</text:span> 4) (<text:span text:style-name="T1">xy </text:span>0 4) (<text:span text:style-name="T1">xy </text:span>0 -4) (<text:span text:style-name="T1">xy</text:span> <text:span text:style-name="T5">-6</text:span> -4)</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">stroke </text:span>0) (<text:span text:style-name="T1">fill </text:span>none))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 2 180) (<text:span text:style-name="T1">length</text:span> 6)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“1” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">input</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> -2 180) (<text:span text:style-name="T1">length</text:span> 6)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“2” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">output</text:span> line (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-12</text:span> 0) (<text:span text:style-name="T1">length</text:span> 7.4)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“3” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> 1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">yes</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> -4 90) (<text:span text:style-name="T1">length</text:span> 0)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“GND” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="6"/>(<text:span text:style-name="T1">pin</text:span> <text:span text:style-name="T5">power_in</text:span> none (<text:span text:style-name="T1">at</text:span> <text:span text:style-name="T5">-4</text:span> 4 90) (<text:span text:style-name="T1">length</text:span> 0)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/></text:span><text:span text:style-name="T5">(signal</text:span> <text:span text:style-name="T2">“VCC” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size </text:span>1.2 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T1"><text:s text:c="4"/>(pad</text:span> <text:span text:style-name="T2">“7” </text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">font </text:span>(<text:span text:style-name="T1">size</text:span> <text:span text:style-name="T5">1.2</text:span> 1.2)) (<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="4"/>(<text:span text:style-name="T1">visible </text:span><text:span text:style-name="T4">no</text:span>))</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_pin_swap</text:span> 1 2)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is the DeMorgan representation of gate B of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_b”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 4)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 5)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 6)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 1 <text:span text:style-name="T2">“D”</text:span>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 2 <text:span text:style-name="T2">“E”</text:span>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_rename</text:span> 3 <text:span text:style-name="T2">“F”</text:span>)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is the DeMorgan representation of gate C of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_c”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 8)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 9)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 10)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is the DeMorgan representation of gate D of a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“dual_input_nand_demorgan_d”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/><text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 7)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_del</text:span> 14)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 1 11)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 2 12)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">pin_renum</text:span> 3 13)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># An example of putting it all together to create a 7400.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“7400”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“7400”</text:span>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">alternates</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_b/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_c/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_d/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">alternates</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:soft-page-break/><text:s text:c="8"/><text:span text:style-name="T2">“dual_in_nand_demorgan_b/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_c/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_demorgan_d/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>(<text:span text:style-name="T1">hint_alt_swap</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_a/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_b/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_c/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="4"/><text:span text:style-name="T2">“dual_in_nand_d/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:s text:c="2"/>)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># A 74LS00 is as simple as this.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“74LS00”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“7400/rev1”</text:span> <text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“74LS00”</text:span> <text:span text:style-name="T5">)</text:span>)</text:p>
<text:p text:style-name="code0"/>
<text:p text:style-name="comment"># This is a so called heavy weight part definition of a Texas Instruments</text:p>
<text:p text:style-name="comment"># part number SN74HCT00NSR.</text:p>
<text:p text:style-name="code0">(<text:span text:style-name="T1">part</text:span> <text:span text:style-name="T2">“SN74HCT00NSR”</text:span> <text:span text:style-name="T1">inherits</text:span> <text:span text:style-name="T2">“7400/rev1”</text:span> </text:p>
<text:p text:style-name="code0"><text:span text:style-name="T2"><text:s text:c="2"/></text:span><text:span text:style-name="T5">(</text:span><text:span text:style-name="T1">value</text:span> <text:span text:style-name="T2">“SN74HCT00NSR”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">footprint</text:span> <text:span text:style-name="T2">“14-SOP”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">datasheet</text:span> <text:span text:style-name="T2">“http://focus.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=sn74hct00&amp;fileType=pdf”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">keywords</text:span> <text:span text:style-name="T2">“LOGIC” “NAND”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Description”</text:span> <text:span text:style-name="T2">“IC GATE POS-NAND QD 2IN 14-SOP”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Manufacturer”</text:span> <text:span text:style-name="T2">“Texas Instruments”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Vendor”</text:span> <text:span text:style-name="T2">“Digikey”</text:span>)</text:p>
<text:p text:style-name="code0"><text:span text:style-name="T5"><text:s text:c="2"/>(</text:span><text:span text:style-name="T1">property</text:span> <text:span text:style-name="T2">“Vendor Part Number”</text:span> <text:span text:style-name="T2">“SN74HCT00NSR-ND”</text:span>)</text:p>
<text:p text:style-name="code0">)</text:p>
<text:p text:style-name="code0"/>
</office:text>
</office:body>
</office:document>

View File

@ -1,128 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.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
*/
#include <sch_lib_table.h>
#include <sch_lib_table_lexer.h>
#include <sch_lpid.h>
#include <sch_part.h>
using namespace SCH;
// If LIB_TABLE::Test() is conditioned on DEBUG being defined, build with
// CMAKE_BUILD_TYPE=Debug, otherwise don't worry about it, because it will work
// on any CMAKE_BUILD_TYPE, including Release.
void LIB_TABLE::Test()
{
SCH_LIB_TABLE_LEXER slr(
"(lib_table \n"
" (lib (logical www) (type http) (full_uri http://kicad.org/libs) (options \"\"))\n"
" (lib (logical meparts) (type dir) (full_uri /tmp/eeschema-lib) (options useVersioning))\n"
// " (lib (logical meparts) (type dir) (full_uri /tmp/eeschema-lib) (options \"\"))\n"
" (lib (logical old-project) (type schematic)(full_uri /tmp/old-schematic.sch) (options \"\"))\n"
")\n"
,
wxT( "inline text" ) // source
);
// read the "( lib_table" pair of tokens
slr.NextTok();
slr.NextTok();
// parse the rest of input to slr
Parse( &slr );
STRING_FORMATTER sf;
// format this whole table into sf, it will be sorted by logicalName.
Format( &sf, 0 );
printf( "test 'Parse() <-> Format()' round tripping:\n" );
printf( "%s", sf.GetString().c_str() );
printf( "\ntest a lookup of 'www':\n" );
const LIB_TABLE::ROW* www = FindRow( "www" );
if( www )
{
// found, print it just to prove it.
sf.Clear();
www->Format( &sf, 1 );
printf( "%s", sf.GetString().c_str() );
}
else
printf( "not found\n" );
printf( "\nlist of logical libraries:\n" );
STRINGS logNames = GetLogicalLibs();
for( STRINGS::const_iterator it = logNames.begin(); it!=logNames.end(); ++it )
{
printf( "logicalName: %s\n", it->c_str() );
}
// find a part
LPID lpid( "meparts:tigers/ears" );
PART* part = LookupPart( lpid );
sf.Clear();
part->Format( &sf, 0, 0 );
printf( "%s", sf.GetString().c_str() );
}
int main( int argc, char** argv )
{
LIB_TABLE lib_table;
try
{
// test exceptions:
// THROW_PARSE_ERROR( wxT("test problem"), wxT("input"), 23, 46 );
//THROW_IO_ERROR( wxT("io test") );
lib_table.Test();
}
catch( PARSE_ERROR& ioe ) // most derived class first
{
printf( "%s\n", (const char*) ioe.errorText.ToUTF8() );
printf( "%s%s",
ioe.inputLine.c_str(),
ioe.inputLine.empty() || *ioe.inputLine.rbegin() != '\n' ?
"\n" : "" ); // rare not to have \n at end
printf( "%*s^\n", ioe.byteIndex>=1 ? ioe.byteIndex-1 : 0, "" );
}
catch( const IO_ERROR& ioe )
{
printf( "%s\n", (const char*) ioe.errorText.ToUTF8() );
}
return 0;
}

View File

@ -1,45 +0,0 @@
# This is a CMake toolchain file so we can using Mingw to build Windows32 binaries.
# http://vtk.org/Wiki/CMake_Cross_Compiling
# usage
# cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain-mingw32.cmake ../
set( CMAKE_SYSTEM_NAME Windows )
set( CMAKE_SYSTEM_PROCESSOR i686 )
#-----<configuration>-----------------------------------------------
# configure only the lines within this <configure> block, typically
set( TC_PATH /usr/bin )
set( CROSS_COMPILE x86_64-w64-mingw32- )
# specify the cross compiler
set( CMAKE_C_COMPILER ${TC_PATH}/${CROSS_COMPILE}gcc )
set( CMAKE_CXX_COMPILER ${TC_PATH}/${CROSS_COMPILE}g++ )
set( CMAKE_RC_COMPILER ${TC_PATH}/${CROSS_COMPILE}windres )
# One compiler generates either 32 bit or 64 bit code, -m32 says generate 32 bit:
set( CMAKE_CXX_FLAGS_INIT "-m32" CACHE STRING "C++ flag which generates 32 bit code." )
set( CMAKE_C_FLAGS_INIT "-m32" CACHE STRING "C flag which generates 32 bit code." )
set( CMAKE_SHARED_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
set( CMAKE_MODULE_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
set( CMAKE_EXE_LINKER_FLAGS "-m32" CACHE STRING "Linker flag which finds 32 bit code." )
# Tell the 64 bit toolchain to generate a PE32 object file when running windres:
set( CMAKE_RC_FLAGS "-F pe-i386" CACHE STRING "windres flag which generates 32 bit code." )
# where is the target environment
set( CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
#-----</configuration>-----------------------------------------------
# search for programs in the build host directories
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
# for libraries and headers in the target directories
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

View File

@ -1,35 +0,0 @@
# This is a CMake toolchain file so we can run Mingw64 to build a Windows64 binaries.
# http://vtk.org/Wiki/CMake_Cross_Compiling
# usage
# cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain-mingw64.cmake ../
set( CMAKE_SYSTEM_NAME Windows )
set( CMAKE_SYSTEM_PROCESSOR x86_64 )
#-----<configuration>-----------------------------------------------
# configure only the lines within this <configure> block, typically
set( TC_PATH /usr/bin )
set( CROSS_COMPILE x86_64-w64-mingw32- )
# specify the cross compiler
set( CMAKE_C_COMPILER ${TC_PATH}/${CROSS_COMPILE}gcc )
set( CMAKE_CXX_COMPILER ${TC_PATH}/${CROSS_COMPILE}g++ )
set( CMAKE_RC_COMPILER ${TC_PATH}/${CROSS_COMPILE}windres )
# where is the target environment
set( CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
#-----</configuration>-----------------------------------------------
# search for programs in the build host directories
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
# for libraries and headers in the target directories
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

View File

@ -1,59 +0,0 @@
#ifndef UTF8_H_
#define UTF8_H_
#include <string>
#include <deque>
/**
* @ingroup string_types
* @{
*/
/**
* Type STRING
* holds a sequence of 8 bit bytes that represent a sequence of variable
* length multi-byte international characters, with unspecified encoding.
*/
typedef std::string STRING;
/**
* Type STRINGS
* is an "array like" list of STRINGs
*/
typedef std::deque<STRING> STRINGS;
/**
* Type STR_UTF
* holds a UTF8 encoded sequence of 8 bit bytes that represent a sequence
* of variable multi-byte international characters. UTF8 is the chosen encoding
* for all KiCad data files so that they can be transported from one nation to another
* without ambiguity. Data files are those where KiCad controls the content.
* This is not the same thing as filenames, which are not file content.
* Filenames may be encoded on disk using an encoding chosen by the host operating
* system. Nonetheless, KiCad data file _content_ is always UTF8 encoded, regardless
* of host operating system.
* STR_UTF is UTF8 encoded, by definition.
*/
typedef STRING STR_UTF;
/**
* Type STR_UTFS
* is an "array like" list of STR_UTFs
*/
typedef std::deque<STRING> STR_UTFS;
/** @} string_types */
// @todo this does not belong here
#ifndef D
#ifdef DEBUG
#define D(x) x
#else
#define D(x) // nothing
#endif
#endif
#endif // UTF8_H_