diff --git a/CMakeLists.txt b/CMakeLists.txt index 27adae47..5a515a66 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ ADD_SUBDIRECTORY( qucs-activefilter ) ADD_SUBDIRECTORY( qucs-attenuator ) #ADD_SUBDIRECTORY( qucs-doc ) ADD_SUBDIRECTORY( qucs-filter ) -ADD_SUBDIRECTORY( qucs-lib ) +ADD_SUBDIRECTORY( library ) ADD_SUBDIRECTORY( qucs-transcalc ) #ADD_SUBDIRECTORY( examples ) ADD_SUBDIRECTORY( translations ) diff --git a/qucs-lib/library/AnalogueCM.lib b/library/AnalogueCM.lib similarity index 100% rename from qucs-lib/library/AnalogueCM.lib rename to library/AnalogueCM.lib diff --git a/qucs-lib/library/AnalogueCM/CMakeLists.txt b/library/AnalogueCM/CMakeLists.txt similarity index 100% rename from qucs-lib/library/AnalogueCM/CMakeLists.txt rename to library/AnalogueCM/CMakeLists.txt diff --git a/qucs-lib/library/AnalogueCM/FNXSPICECM.ifs b/library/AnalogueCM/FNXSPICECM.ifs similarity index 100% rename from qucs-lib/library/AnalogueCM/FNXSPICECM.ifs rename to library/AnalogueCM/FNXSPICECM.ifs diff --git a/qucs-lib/library/AnalogueCM/FNXSPICECM.mod b/library/AnalogueCM/FNXSPICECM.mod similarity index 100% rename from qucs-lib/library/AnalogueCM/FNXSPICECM.mod rename to library/AnalogueCM/FNXSPICECM.mod diff --git a/qucs-lib/library/AnalogueCM/RFind.ifs b/library/AnalogueCM/RFind.ifs similarity index 100% rename from qucs-lib/library/AnalogueCM/RFind.ifs rename to library/AnalogueCM/RFind.ifs diff --git a/qucs-lib/library/AnalogueCM/RFind.mod b/library/AnalogueCM/RFind.mod similarity index 100% rename from qucs-lib/library/AnalogueCM/RFind.mod rename to library/AnalogueCM/RFind.mod diff --git a/qucs-lib/library/AnalogueCM/etd.ifs b/library/AnalogueCM/etd.ifs similarity index 100% rename from qucs-lib/library/AnalogueCM/etd.ifs rename to library/AnalogueCM/etd.ifs diff --git a/qucs-lib/library/AnalogueCM/etd.mod b/library/AnalogueCM/etd.mod similarity index 100% rename from qucs-lib/library/AnalogueCM/etd.mod rename to library/AnalogueCM/etd.mod diff --git a/qucs-lib/library/BF998.lib b/library/BF998.lib similarity index 100% rename from qucs-lib/library/BF998.lib rename to library/BF998.lib diff --git a/qucs-lib/library/Bridges.lib b/library/Bridges.lib similarity index 100% rename from qucs-lib/library/Bridges.lib rename to library/Bridges.lib diff --git a/qucs-lib/library/CMakeLists.txt b/library/CMakeLists.txt similarity index 100% rename from qucs-lib/library/CMakeLists.txt rename to library/CMakeLists.txt diff --git a/qucs-lib/library/Cores.lib b/library/Cores.lib similarity index 100% rename from qucs-lib/library/Cores.lib rename to library/Cores.lib diff --git a/qucs-lib/library/Crystal.lib b/library/Crystal.lib similarity index 100% rename from qucs-lib/library/Crystal.lib rename to library/Crystal.lib diff --git a/qucs-lib/library/Diodes.lib b/library/Diodes.lib similarity index 100% rename from qucs-lib/library/Diodes.lib rename to library/Diodes.lib diff --git a/qucs-lib/library/Ideal.lib b/library/Ideal.lib similarity index 100% rename from qucs-lib/library/Ideal.lib rename to library/Ideal.lib diff --git a/qucs-lib/library/JFETs.lib b/library/JFETs.lib similarity index 100% rename from qucs-lib/library/JFETs.lib rename to library/JFETs.lib diff --git a/qucs-lib/library/LEDs.lib b/library/LEDs.lib similarity index 100% rename from qucs-lib/library/LEDs.lib rename to library/LEDs.lib diff --git a/qucs-lib/library/MESFETs.lib b/library/MESFETs.lib similarity index 100% rename from qucs-lib/library/MESFETs.lib rename to library/MESFETs.lib diff --git a/qucs-lib/library/MESFETs/CMakeLists.txt b/library/MESFETs/CMakeLists.txt similarity index 100% rename from qucs-lib/library/MESFETs/CMakeLists.txt rename to library/MESFETs/CMakeLists.txt diff --git a/qucs-lib/library/MESFETs/curtice1.ifs b/library/MESFETs/curtice1.ifs similarity index 100% rename from qucs-lib/library/MESFETs/curtice1.ifs rename to library/MESFETs/curtice1.ifs diff --git a/qucs-lib/library/MESFETs/curtice1.mod b/library/MESFETs/curtice1.mod similarity index 100% rename from qucs-lib/library/MESFETs/curtice1.mod rename to library/MESFETs/curtice1.mod diff --git a/qucs-lib/library/MOSFETs.lib b/library/MOSFETs.lib similarity index 100% rename from qucs-lib/library/MOSFETs.lib rename to library/MOSFETs.lib diff --git a/qucs-lib/library/NMOSFETs.lib b/library/NMOSFETs.lib similarity index 100% rename from qucs-lib/library/NMOSFETs.lib rename to library/NMOSFETs.lib diff --git a/qucs-lib/library/OpAmps.lib b/library/OpAmps.lib similarity index 100% rename from qucs-lib/library/OpAmps.lib rename to library/OpAmps.lib diff --git a/qucs-lib/library/PMOSFETs.lib b/library/PMOSFETs.lib similarity index 100% rename from qucs-lib/library/PMOSFETs.lib rename to library/PMOSFETs.lib diff --git a/qucs-lib/library/Regulators.lib b/library/Regulators.lib similarity index 100% rename from qucs-lib/library/Regulators.lib rename to library/Regulators.lib diff --git a/qucs-lib/library/SpiceOpamp.lib b/library/SpiceOpamp.lib similarity index 100% rename from qucs-lib/library/SpiceOpamp.lib rename to library/SpiceOpamp.lib diff --git a/qucs-lib/library/Substrates.lib b/library/Substrates.lib similarity index 100% rename from qucs-lib/library/Substrates.lib rename to library/Substrates.lib diff --git a/qucs-lib/library/Transformers.lib b/library/Transformers.lib similarity index 100% rename from qucs-lib/library/Transformers.lib rename to library/Transformers.lib diff --git a/qucs-lib/library/Transistors.lib b/library/Transistors.lib similarity index 100% rename from qucs-lib/library/Transistors.lib rename to library/Transistors.lib diff --git a/qucs-lib/library/Tubes.lib b/library/Tubes.lib similarity index 100% rename from qucs-lib/library/Tubes.lib rename to library/Tubes.lib diff --git a/qucs-lib/library/Varistors.lib b/library/Varistors.lib similarity index 100% rename from qucs-lib/library/Varistors.lib rename to library/Varistors.lib diff --git a/qucs-lib/library/Xanalogue.lib b/library/Xanalogue.lib similarity index 100% rename from qucs-lib/library/Xanalogue.lib rename to library/Xanalogue.lib diff --git a/qucs-lib/library/XyceDigital.lib b/library/XyceDigital.lib similarity index 100% rename from qucs-lib/library/XyceDigital.lib rename to library/XyceDigital.lib diff --git a/qucs-lib/library/XyceDigital/A2DBRIDGE.sym b/library/XyceDigital/A2DBRIDGE.sym similarity index 100% rename from qucs-lib/library/XyceDigital/A2DBRIDGE.sym rename to library/XyceDigital/A2DBRIDGE.sym diff --git a/qucs-lib/library/XyceDigital/A2DBRIDGEX2.sym b/library/XyceDigital/A2DBRIDGEX2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/A2DBRIDGEX2.sym rename to library/XyceDigital/A2DBRIDGEX2.sym diff --git a/qucs-lib/library/XyceDigital/A2DBRIDGEX4.sym b/library/XyceDigital/A2DBRIDGEX4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/A2DBRIDGEX4.sym rename to library/XyceDigital/A2DBRIDGEX4.sym diff --git a/qucs-lib/library/XyceDigital/A2DBRIDGEX8.sym b/library/XyceDigital/A2DBRIDGEX8.sym similarity index 100% rename from qucs-lib/library/XyceDigital/A2DBRIDGEX8.sym rename to library/XyceDigital/A2DBRIDGEX8.sym diff --git a/qucs-lib/library/XyceDigital/AND2.sym b/library/XyceDigital/AND2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/AND2.sym rename to library/XyceDigital/AND2.sym diff --git a/qucs-lib/library/XyceDigital/AND4.sym b/library/XyceDigital/AND4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/AND4.sym rename to library/XyceDigital/AND4.sym diff --git a/qucs-lib/library/XyceDigital/ANDOR4X2.sym b/library/XyceDigital/ANDOR4X2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/ANDOR4X2.sym rename to library/XyceDigital/ANDOR4X2.sym diff --git a/qucs-lib/library/XyceDigital/BUF.sym b/library/XyceDigital/BUF.sym similarity index 100% rename from qucs-lib/library/XyceDigital/BUF.sym rename to library/XyceDigital/BUF.sym diff --git a/qucs-lib/library/XyceDigital/CMakeLists.txt b/library/XyceDigital/CMakeLists.txt similarity index 100% rename from qucs-lib/library/XyceDigital/CMakeLists.txt rename to library/XyceDigital/CMakeLists.txt diff --git a/qucs-lib/library/XyceDigital/D2ABRIDGE.sym b/library/XyceDigital/D2ABRIDGE.sym similarity index 100% rename from qucs-lib/library/XyceDigital/D2ABRIDGE.sym rename to library/XyceDigital/D2ABRIDGE.sym diff --git a/qucs-lib/library/XyceDigital/D2ABRIDGEX2.sym b/library/XyceDigital/D2ABRIDGEX2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/D2ABRIDGEX2.sym rename to library/XyceDigital/D2ABRIDGEX2.sym diff --git a/qucs-lib/library/XyceDigital/D2ABRIDGEX4.sym b/library/XyceDigital/D2ABRIDGEX4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/D2ABRIDGEX4.sym rename to library/XyceDigital/D2ABRIDGEX4.sym diff --git a/qucs-lib/library/XyceDigital/D2ABRIDGEX8.sym b/library/XyceDigital/D2ABRIDGEX8.sym similarity index 100% rename from qucs-lib/library/XyceDigital/D2ABRIDGEX8.sym rename to library/XyceDigital/D2ABRIDGEX8.sym diff --git a/qucs-lib/library/XyceDigital/FADDER.sym b/library/XyceDigital/FADDER.sym similarity index 100% rename from qucs-lib/library/XyceDigital/FADDER.sym rename to library/XyceDigital/FADDER.sym diff --git a/qucs-lib/library/XyceDigital/GEN0OR1X4.sym b/library/XyceDigital/GEN0OR1X4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/GEN0OR1X4.sym rename to library/XyceDigital/GEN0OR1X4.sym diff --git a/qucs-lib/library/XyceDigital/GEN0OR1X8.sym b/library/XyceDigital/GEN0OR1X8.sym similarity index 100% rename from qucs-lib/library/XyceDigital/GEN0OR1X8.sym rename to library/XyceDigital/GEN0OR1X8.sym diff --git a/qucs-lib/library/XyceDigital/INV.sym b/library/XyceDigital/INV.sym similarity index 100% rename from qucs-lib/library/XyceDigital/INV.sym rename to library/XyceDigital/INV.sym diff --git a/qucs-lib/library/XyceDigital/LOGIC0.sym b/library/XyceDigital/LOGIC0.sym similarity index 100% rename from qucs-lib/library/XyceDigital/LOGIC0.sym rename to library/XyceDigital/LOGIC0.sym diff --git a/qucs-lib/library/XyceDigital/LOGIC1.sym b/library/XyceDigital/LOGIC1.sym similarity index 100% rename from qucs-lib/library/XyceDigital/LOGIC1.sym rename to library/XyceDigital/LOGIC1.sym diff --git a/qucs-lib/library/XyceDigital/MUX2TO1.sym b/library/XyceDigital/MUX2TO1.sym similarity index 100% rename from qucs-lib/library/XyceDigital/MUX2TO1.sym rename to library/XyceDigital/MUX2TO1.sym diff --git a/qucs-lib/library/XyceDigital/MUX4TO1.sym b/library/XyceDigital/MUX4TO1.sym similarity index 100% rename from qucs-lib/library/XyceDigital/MUX4TO1.sym rename to library/XyceDigital/MUX4TO1.sym diff --git a/qucs-lib/library/XyceDigital/MUX8TO1.sym b/library/XyceDigital/MUX8TO1.sym similarity index 100% rename from qucs-lib/library/XyceDigital/MUX8TO1.sym rename to library/XyceDigital/MUX8TO1.sym diff --git a/qucs-lib/library/XyceDigital/NAND2.sym b/library/XyceDigital/NAND2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/NAND2.sym rename to library/XyceDigital/NAND2.sym diff --git a/qucs-lib/library/XyceDigital/NAND4.sym b/library/XyceDigital/NAND4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/NAND4.sym rename to library/XyceDigital/NAND4.sym diff --git a/qucs-lib/library/XyceDigital/NOR2.sym b/library/XyceDigital/NOR2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/NOR2.sym rename to library/XyceDigital/NOR2.sym diff --git a/qucs-lib/library/XyceDigital/NOR4.sym b/library/XyceDigital/NOR4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/NOR4.sym rename to library/XyceDigital/NOR4.sym diff --git a/qucs-lib/library/XyceDigital/NXOR.sym b/library/XyceDigital/NXOR.sym similarity index 100% rename from qucs-lib/library/XyceDigital/NXOR.sym rename to library/XyceDigital/NXOR.sym diff --git a/qucs-lib/library/XyceDigital/OR2.sym b/library/XyceDigital/OR2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/OR2.sym rename to library/XyceDigital/OR2.sym diff --git a/qucs-lib/library/XyceDigital/OR4.sym b/library/XyceDigital/OR4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/OR4.sym rename to library/XyceDigital/OR4.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX1.sym b/library/XyceDigital/PATGENX1.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX1.sym rename to library/XyceDigital/PATGENX1.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX128.sym b/library/XyceDigital/PATGENX128.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX128.sym rename to library/XyceDigital/PATGENX128.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX2.sym b/library/XyceDigital/PATGENX2.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX2.sym rename to library/XyceDigital/PATGENX2.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX32.sym b/library/XyceDigital/PATGENX32.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX32.sym rename to library/XyceDigital/PATGENX32.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX4.sym b/library/XyceDigital/PATGENX4.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX4.sym rename to library/XyceDigital/PATGENX4.sym diff --git a/qucs-lib/library/XyceDigital/PATGENX8.sym b/library/XyceDigital/PATGENX8.sym similarity index 100% rename from qucs-lib/library/XyceDigital/PATGENX8.sym rename to library/XyceDigital/PATGENX8.sym diff --git a/qucs-lib/library/XyceDigital/XOR.sym b/library/XyceDigital/XOR.sym similarity index 100% rename from qucs-lib/library/XyceDigital/XOR.sym rename to library/XyceDigital/XOR.sym diff --git a/qucs-lib/library/Xyce_Digital_TTL_Technology.lib b/library/Xyce_Digital_TTL_Technology.lib similarity index 100% rename from qucs-lib/library/Xyce_Digital_TTL_Technology.lib rename to library/Xyce_Digital_TTL_Technology.lib diff --git a/qucs-lib/library/Z-Diodes.lib b/library/Z-Diodes.lib similarity index 100% rename from qucs-lib/library/Z-Diodes.lib rename to library/Z-Diodes.lib diff --git a/qucs-lib/library/ngspice.blacklist b/library/ngspice.blacklist similarity index 100% rename from qucs-lib/library/ngspice.blacklist rename to library/ngspice.blacklist diff --git a/qucs-lib/library/qucs.blacklist b/library/qucs.blacklist similarity index 100% rename from qucs-lib/library/qucs.blacklist rename to library/qucs.blacklist diff --git a/qucs-lib/library/xyce.blacklist b/library/xyce.blacklist similarity index 100% rename from qucs-lib/library/xyce.blacklist rename to library/xyce.blacklist diff --git a/qucs-lib/CMakeLists.txt b/qucs-lib/CMakeLists.txt deleted file mode 100644 index 0f7799cb..00000000 --- a/qucs-lib/CMakeLists.txt +++ /dev/null @@ -1,93 +0,0 @@ -PROJECT(qucslib CXX C) -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) -cmake_policy(VERSION 3.0) - -SET(QUCS_NAME "qucs-s") - -# use top VERSION file -file (STRINGS ${PROJECT_SOURCE_DIR}/../VERSION QUCS_VERSION) -message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${QUCS_VERSION}") - -set(PROJECT_VERSION "${QUCS_VERSION}") - -set(PROJECT_VENDOR "Qucs team. This program is licensed under the GNU GPL") -set(PROJECT_COPYRIGHT_YEAR "2014") -set(PROJECT_DOMAIN_FIRST "qucs") -set(PROJECT_DOMAIN_SECOND "org") - -#SET(CMAKE_BUILD_TYPE Debug) - -ADD_DEFINITIONS( -DHAVE_CONFIG_H ) - -# configure the header config.h -CONFIGURE_FILE ( - "${PROJECT_SOURCE_DIR}/../config.h.cmake" - "${PROJECT_BINARY_DIR}/config.h" -) - -INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR} "../qucs" ) - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ") # enable warning level -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ") # enable C++11 - - -FIND_PACKAGE( Qt5 COMPONENTS Core Gui Widgets Svg Xml PrintSupport REQUIRED) -#INCLUDE( ${QT_USE_FILE} ) - -INCLUDE_DIRECTORIES( - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} - ) - -# bug, the find package does not seem to set the QT_LIBRARIES, do it manually -SET(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ) - - -ADD_DEFINITIONS(${QT_DEFINITIONS}) - -SET(QUCSLIB_SRCS -main.cpp qucslib.cpp displaydialog.cpp symbolwidget.cpp librarydialog.cpp -) - -SET(QUCSLIB_MOC_HDRS -qucslib.h displaydialog.h symbolwidget.h librarydialog.h -) - -QT5_WRAP_CPP( QUCSLIB_MOC_SRCS ${QUCSLIB_MOC_HDRS} ) - -SET(RESOURCES qucslib.qrc) -QT5_ADD_RESOURCES(RESOURCES_SRCS ${RESOURCES}) - -IF(APPLE) - # set information on Info.plist file - SET(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") - SET(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}") - SET(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}") - SET(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}") - SET(MACOSX_BUNDLE_ICON_FILE qucslib.icns) - - # set where in the bundle to put the icns file - SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/../qucs/bitmaps/qucslib.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - # include the icns file in the target - SET(QUCSLIB_SRCS ${QUCSLIB_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../qucs/bitmaps/qucslib.icns) - -ENDIF(APPLE) - -ADD_EXECUTABLE(${QUCS_NAME}lib MACOSX_BUNDLE WIN32 - ${QUCSLIB_SRCS} - ${QUCSLIB_MOC_SRCS} - ${RESOURCES_SRCS} ) - -TARGET_LINK_LIBRARIES(${QUCS_NAME}lib ${QT_LIBRARIES}) - -INSTALL(TARGETS ${QUCS_NAME}lib - BUNDLE DESTINATION bin COMPONENT Runtime - RUNTIME DESTINATION bin COMPONENT Runtime - ) - -ADD_SUBDIRECTORY( library ) - - diff --git a/qucs-lib/ChangeLog b/qucs-lib/ChangeLog deleted file mode 100644 index a9a3e90a..00000000 --- a/qucs-lib/ChangeLog +++ /dev/null @@ -1,136 +0,0 @@ -2011-03-01 Stefan Jahn - - * library/Ideal.lib: Fixed HardLimiter and Abs components. - -2010-10-23 Stefan Jahn - - * symbolwidget.cpp (createSymbol): Adjusted symbol for new HICUM - models. - -2010-03-27 Stefan Jahn - - * library/Ideal.lib (VSub): Fixed model ports. - -2010-03-04 Stefan Jahn - - * library/Transistors.lib: Added BFG425W transistor. Thanks to - Frans Schreuder! - -2009-09-12 Stefan Jahn - - * library/Transistors.lib: Added BD139 transistor provided by - Frans Schreuder. Thanks! - -2009-05-04 Stefan Jahn - - * library/Ideal.lib: Fixed symbols of LP1 and VSum. - -2009-03-25 Stefan Jahn - - * library/Transistors.lib: Added yet another transistor provided - by Frans Schreuder. Thanks! - - * library/OpAmps.lib: Reworked symbols of Mike Brinson's - operational amplifiers. Unified layout and put them onto grid. - -2009-02-01 Stefan Jahn - - * library/Transistors.lib: Added 6 new transistors provided by - Peter Lemmens. Thanks a lot. - -2008-10-27 Stefan Jahn - - * library/Transistors.lib: Added 4 new transistors provided by - Frans Schreuder. Thanks! - -2008-09-20 Stefan Jahn - - * symbolwidget.cpp (createSymbol): Added symbol code for new - HICUM/L0 v1.2 model. - -2008-07-11 Stefan Jahn - - * symbolwidget.cpp (createSymbol): Added symbol code for HICUM - transistor models. - -2008-06-07 Stefan Jahn - - * library/Varistors.lib: Added new varistor library. Thanks a lot - to Gunther Kraut! - -2008-05-29 Stefan Jahn - - * library/Regulators.lib: Added new library containing some - voltage regulators based on SPICE models. - -2008-05-28 Stefan Jahn - - * library/Transistors.lib: Added few more BJT transistors from - Zetex (FZT's in SOT223 packages). - -2008-05-05 Stefan Jahn - - * library/Makefile.am (COMPLIBS): Added three more libraries - (Ideal, PMOSFETs and NMOSFETs) provided by Gunther. Thanks a lot! - -2008-01-07 Stefan Jahn - - * searchdialog.cpp (slotSearch): Fixed bug avoiding displaying - wrong symbol within search results. Thanks to Michael! - -2007-12-28 Stefan Jahn - - * library/JFETs.lib: Added loads of new jfet models. - -2007-12-26 Stefan Jahn - - * library/Transistors.lib: Added some more transistor models. - -2007-11-22 Stefan Jahn - - * displaydialog.cpp (DisplayDialog): Fixed bug in help display - window due to reuse as model display window. - -2007-05-12 Stefan Jahn - - * librarydialog.cpp (slotRename): Also rename the library - subdirectory. - (slotDelete): Additionally remove all files in the library - subdirectory as well as the subdirectory itself. - - * displaydialog.cpp (DisplayDialog): Showing now all three type of - models: Analog, VHDL and Verilog. - -2007-05-10 Stefan Jahn - - * qucslib.cpp (slotShowComponent): Allow also VHDL and Verilog - entries to define a model. Fixed drag'n'drop ability for digital - only models. - -2007-03-07 Stefan Jahn - - * library/OpAmps.lib: Added Mike's opamp models. - -2006-12-09 Michael Margraf - - * added new LED components - -2006-08-06 Michael Margraf - - * library/Transistors.lib: Added new transistor components - by Gunther Kraut - -2006-05-14 Stefan Jahn - - * symbolwidget.cpp: Added "#include " where necessary - for SuSE installation. - -2006-04-27 Stefan Jahn - - * library/Diodes.lib: Added BAS40 and BAS70 models from - Philips. - -2006-01-04 Stefan Jahn - - * library/Transistors.lib: Added some more transistor models - supplied by a user. Thanks! diff --git a/qucs-lib/bitmaps/big.qucs.xpm b/qucs-lib/bitmaps/big.qucs.xpm deleted file mode 100644 index b69901cf..00000000 --- a/qucs-lib/bitmaps/big.qucs.xpm +++ /dev/null @@ -1,225 +0,0 @@ -/* XPM */ -static char *big_qucs_xpm[] = { -"32 32 190 2", -" c None", -". c #BCA2BC", -"+ c #B4B2D4", -"@ c #BC96BC", -"# c #7C6E9C", -"$ c #ACB2CC", -"% c #9C869C", -"& c #BCA2CC", -"* c #CCC6E4", -"= c #140A1C", -"- c #140A14", -"; c #0C0A14", -"> c #5C5A64", -", c #ACB6C4", -"' c #CCC6D4", -") c #0C0614", -"! c #0C0A1C", -"~ c #1C121C", -"{ c #1C1224", -"] c #0C060C", -"^ c #1C0A1C", -"/ c #2C2234", -"( c #0C0A24", -"_ c #140A24", -": c #1C0E2C", -"< c #240E24", -"[ c #3C323C", -"} c #B49EC4", -"| c #AC9ECC", -"1 c #CCCEE4", -"2 c #84768C", -"3 c #140E24", -"4 c #241634", -"5 c #4C324C", -"6 c #341A3C", -"7 c #645E7C", -"8 c #8472AC", -"9 c #9486BC", -"0 c #D4D6EC", -"a c #4C4664", -"b c #443A64", -"c c #DCEAF4", -"d c #CCBADC", -"e c #1C1634", -"f c #342644", -"g c #7C628C", -"h c #6C567C", -"i c #4C3654", -"j c #2C1634", -"k c #1C0E24", -"l c #645A7C", -"m c #8C7AB4", -"n c #9C92C4", -"o c #D4DEF4", -"p c #ACAECC", -"q c #544A6C", -"r c #A4A2C4", -"s c #E4EEF4", -"t c #CCCAE4", -"u c #DCD2E4", -"v c #540E1C", -"w c #840E14", -"x c #440E1C", -"y c #24264C", -"z c #44365C", -"A c #ACAAC4", -"B c #C4C6DC", -"C c #8C7AAC", -"D c #5C426C", -"E c #3C2A44", -"F c #2C162C", -"G c #A49EB4", -"H c #9492AC", -"I c #8C82A4", -"J c #340E1C", -"K c #7C0E14", -"L c #14122C", -"M c #3C3A64", -"N c #3C3E74", -"O c #ACA6CC", -"P c #D4DEEC", -"Q c #BCB2DC", -"R c #846694", -"S c #5C3E64", -"T c #2C1E3C", -"U c #341E34", -"V c #C4C2CC", -"W c #ECEAEC", -"X c #2C2A4C", -"Y c #242254", -"Z c #1C1A4C", -"` c #7466A4", -" . c #BCBADC", -".. c #CCDEEC", -"+. c #745A84", -"@. c #24162C", -"#. c #3C2A3C", -"$. c #241E2C", -"%. c #1C1E4C", -"&. c #242654", -"*. c #142E64", -"=. c #1C326C", -"-. c #1C265C", -";. c #34366C", -">. c #8476AC", -",. c #CCD2EC", -"'. c #C4CAE4", -"). c #4C4254", -"!. c #44325C", -"~. c #4C2E54", -"{. c #141234", -"]. c #142654", -"^. c #144274", -"/. c #1C3E74", -"(. c #1C2254", -"_. c #1C1E54", -":. c #4C4A7C", -"<. c #A492C4", -"[. c #6C6A7C", -"}. c #64628C", -"|. c #847A8C", -"1. c #644A74", -"2. c #14224C", -"3. c #1C3674", -"4. c #14427C", -"5. c #143E7C", -"6. c #1C3A7C", -"7. c #2C2644", -"8. c #D4E2F4", -"9. c #B4AACC", -"0. c #8C7AA4", -"a. c #140E2C", -"b. c #141634", -"c. c #14366C", -"d. c #1C427C", -"e. c #1C3E7C", -"f. c #141E44", -"g. c #C4CEEC", -"h. c #DCE6EC", -"i. c #C4C6C4", -"j. c #6C5E74", -"k. c #445274", -"l. c #A4B6DC", -"m. c #2C528C", -"n. c #6472AC", -"o. c #14163C", -"p. c #4C4684", -"q. c #BCB6DC", -"r. c #D4CEDC", -"s. c #9C9EA4", -"t. c #B4C2DC", -"u. c #2C365C", -"v. c #5C6A94", -"w. c #8CA2CC", -"x. c #BCBEE4", -"y. c #8C86AC", -"z. c #1C2A64", -"A. c #74769C", -"B. c #CCCADC", -"C. c #C4CEE4", -"D. c #A49EBC", -"E. c #1C162C", -"F. c #8C8AB4", -"G. c #445A8C", -"H. c #A49EC4", -"I. c #B4BAD4", -"J. c #B4B2DC", -"K. c #CCCEEC", -"L. c #CCDAF4", -"M. c #BCC6E4", -"N. c #746A8C", -"O. c #949AB4", -"P. c #9C8EB4", -"Q. c #544E74", -"R. c #342E4C", -"S. c #242A54", -"T. c #6C7AA4", -"U. c #4C5E94", -"V. c #7486B4", -"W. c #9CAAD4", -"X. c #C4D2EC", -"Y. c #D4E2EC", -"Z. c #DCEEF4", -"`. c #D4DAEC", -" + c #C4C6E4", -".+ c #B4AED4", -"++ c #7C7AA4", -"@+ c #9496B4", -"#+ c #9492B4", -"$+ c #8C92AC", -" ", -" ", -" . + ", -" @ # $ ", -" % & * $ ", -" = - ; = = - > , ' ", -" = ; ; = ) = ! ) = ! ", -" ~ ; ) ) ; = ! = ! = { ", -" = ; ] ) ; ) ) = ! = = ^ / ", -" = ; ) ! ) = ! ( ! ! _ : < _ [ } | 1 2 ", -" 3 = ) ! ) ( ( ( ( _ 3 4 5 6 { = 7 8 9 0 a b 0 c d ", -" = ( = = ( = ! _ ! e f g h i j k l m n o p q r s t u ", -" 3 _ v w x ) _ ( _ y z A B C D E j F n r C G H I ", -" _ J w K < _ _ L M b N O P Q R S T E U V V W ", -" _ _ x ^ _ 3 X M Y Z X ` ...| +.@.T #. ", -" $.= _ _ L %.&.*.=.-.Z ;.>.,.'.).!.~. ", -" = ! = 3 {.].^././.*.(._.:.<.[.}.|.1. ", -" > = ! ( L 2.3.4.5.6.*._.Y 7.}.8.9. ", -" 0.@.M 3 = a.b.].c.d.e.3.f.a.&.8 g.h. ", -" i.j.k.l.b ; ( 3 f.*.4.m.n.o.Z %.p.q. ", -" r.s.t.l. = ! 3 u.v.w.x.y.*.z._.A. ", -" B.C.D.t. ! E.x.Q 9.+ F.6.G. ", -" H.I.I. ! J. .K...'. ", -"r.J.A L.M.D.N.O. ", -"P.9. Q.R.%.S.T. ", -" N U.V.W.X. ", -" M.X.Y.c c ", -" c Z.c `. + ", -" B .+n ++@+ ", -" #+$+p A ", -" ", -" "}; diff --git a/qucs-lib/bitmaps/home.png b/qucs-lib/bitmaps/home.png deleted file mode 100644 index 37a5231b..00000000 Binary files a/qucs-lib/bitmaps/home.png and /dev/null differ diff --git a/qucs-lib/displaydialog.cpp b/qucs-lib/displaydialog.cpp deleted file mode 100644 index 0d13fc26..00000000 --- a/qucs-lib/displaydialog.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - displaydialog.cpp - ------------------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "displaydialog.h" - -//#include -#include -#include -#include -#include - - - -DisplayDialog::DisplayDialog(QWidget *parent, QString Text, QString VHDLText, QString VerilogText) - // QDialog(parent, 0, false, Qt::WDestructiveClose) - : QDialog(parent) -{ - vLayout = new QVBoxLayout(this); - vLayout->setMargin(3); - - QGroupBox *Analog = new QGroupBox (tr("Analogue"), this); - QVBoxLayout *AnalogLayout = new QVBoxLayout(); - - QText = new QTextEdit(); - QText->setText(Text); - //QText->setTextFormat(Qt::PlainText); - QText->setReadOnly(true); - QText->setMinimumSize(200, 80); - QText->setLineWrapMode(QTextEdit::NoWrap); - - AnalogLayout->addWidget(QText); - Analog->setLayout(AnalogLayout); - - vLayout->addWidget(Analog); - - QGroupBox *VHDL = new QGroupBox (tr("VHDL"), this); - QVBoxLayout *VHDLLayout = new QVBoxLayout(); - - QVHDLText = new QTextEdit(VHDL); - QVHDLText->setText(VHDLText); - //QVHDLText->setTextFormat(Qt::PlainText); - QVHDLText->setReadOnly(true); - QVHDLText->setMinimumSize(200, 80); - QVHDLText->setLineWrapMode(QTextEdit::NoWrap); - - VHDLLayout->addWidget(QVHDLText); - VHDL->setLayout(VHDLLayout); - - vLayout->addWidget(VHDL); - - QGroupBox *Verilog = new QGroupBox (tr("Verilog"), this); - QVBoxLayout *VerilogLayout = new QVBoxLayout(); - - QVerilogText = new QTextEdit(Verilog); - QVerilogText->setText(VerilogText); - //QVerilogText->setTextFormat(Qt::PlainText); - QVerilogText->setReadOnly(true); - QVerilogText->setMinimumSize(200, 80); - QVerilogText->setLineWrapMode(QTextEdit::NoWrap); - - VerilogLayout->addWidget(QVerilogText); - Verilog->setLayout(VerilogLayout); - - vLayout->addWidget(Verilog); - - - QWidget *h = new QWidget(this); - //h->setStretchFactor(new QWidget(h),5); // stretchable placeholder - QHBoxLayout *hLayout = new QHBoxLayout(); - - QPushButton *ButtonClose = new QPushButton(tr("Close")); - connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose())); - ButtonClose->setFocus(); - - QWidget *dummy1 = new QWidget(); - hLayout->addWidget(dummy1); - - hLayout->addWidget(ButtonClose); - - QWidget *dummy2 = new QWidget(); - hLayout->addWidget(dummy2); - hLayout->setStretchFactor(dummy1, 5); - hLayout->setStretchFactor(dummy2, 5); - h->setLayout(hLayout); - - vLayout->addWidget(h); - -} - -DisplayDialog::~DisplayDialog() -{ - delete vLayout; -} - -// ************************************************************ -void DisplayDialog::slotClose() -{ - accept(); -} diff --git a/qucs-lib/displaydialog.h b/qucs-lib/displaydialog.h deleted file mode 100644 index 308d3318..00000000 --- a/qucs-lib/displaydialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - displaydialog.h - ----------------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef DISPLAYDIALOG_H -#define DISPLAYDIALOG_H - -#include -#include - -class QTextEdit; -class QVBoxLayout; - - -class DisplayDialog : public QDialog { - Q_OBJECT -public: - DisplayDialog(QWidget *parent = 0, QString Text="", QString VHDLText="", QString VerilogText=""); - ~DisplayDialog(); - -private slots: - void slotClose(); - -private: - QVBoxLayout *vLayout; - QTextEdit *QText, *QVHDLText, *QVerilogText; -}; - -#endif diff --git a/qucs-lib/librarydialog.cpp b/qucs-lib/librarydialog.cpp deleted file mode 100644 index c341d28f..00000000 --- a/qucs-lib/librarydialog.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/*************************************************************************** - librarydialog.cpp - ------------------- - begin : Sun Jun 04 2006 - copyright : (C) 2006 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "librarydialog.h" -#include "qucslib.h" - -#include -#include -#include -#include -#include -#include -//#include //-->QAbstractScrollArea and QScrollArea -#include -#include -#include -#include -#include -#include - - -LibraryDialog::LibraryDialog(QWidget *App_) : QDialog(App_) -{ - setWindowTitle(tr("Manage User Libraries")); - - Expr.setPattern("[\\w_]+"); - Validator = new QRegExpValidator(Expr, this); - - // ........................................................... - QVBoxLayout *all = new QVBoxLayout(this); - all->setMargin(5); - all->setSpacing(6); - - Group = new QGroupBox(tr("Choose library:"), this); - all->addWidget(Group); -/* TODO insert the group of radio buttons into an scrollable area - Q3ScrollView *Dia_Scroll = new Q3ScrollView(Group); - Dia_Scroll->setMargin(5); - Dia_Box = new Q3VBox(Dia_Scroll->viewport()); - Dia_Scroll->addChild(Dia_Box); -*/ - QHBoxLayout *h1 = new QHBoxLayout(); - theLabel = new QLabel(tr("New Name:")); - NameEdit = new QLineEdit(); - NameEdit->setValidator(Validator); - h1->addWidget(theLabel); - h1->addWidget(NameEdit); - all->addLayout(h1); - - // ........................................................... - QHBoxLayout *h2 = new QHBoxLayout(); - ButtDelete = new QPushButton(tr("Delete")); - connect(ButtDelete, SIGNAL(clicked()), SLOT(slotDelete())); - ButtRename = new QPushButton(tr("Rename")); - connect(ButtRename, SIGNAL(clicked()), SLOT(slotRename())); - ButtClose = new QPushButton(tr("Close")); - connect(ButtClose, SIGNAL(clicked()), SLOT(reject())); - ButtClose->setDefault(true); - h2->addWidget(ButtDelete); - h2->addWidget(ButtRename); - h2->addWidget(ButtClose); - all->addLayout(h2); - - // ........................................................... - // insert all user libraries as radio buttons - QStringList LibFiles = UserLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name); - - QVBoxLayout *vbox = new QVBoxLayout; - //previousLib = 0; - - QButtonGroup *radiogroup = new QButtonGroup(this); //for exclusive check - - // inserts all user libs as named RadioButton into a list - //qDebug() << "Starting"; - QStringList::iterator it; - for(it = LibFiles.begin(); it != LibFiles.end(); it++) { - //qDebug() << *it; - radioButton.append(new QRadioButton((*it).left((*it).length()-4))); - } - - // populate button group and vertical layout - for(int i = 0; i < LibFiles.count(); i++){ - //qDebug() << radioButton[i]->text(); - radiogroup->addButton(radioButton[i]); - vbox->addWidget(radioButton[i]); - } - - Group->setLayout(vbox); - -/* - - QColor theColor; - QAbstractButton *rButton = toggleGroup->find(0); //?indexOf - if(rButton) - theColor = rButton->paletteBackgroundColor(); - else { - ButtDelete->setEnabled(false); - ButtRename->setEnabled(false); - theColor = - (new QLabel(tr("No user library!"), Dia_Box))->paletteBackgroundColor(); - } - Dia_Scroll->viewport()->setPaletteBackgroundColor(theColor); -*/ -} - -LibraryDialog::~LibraryDialog() -{ - delete Validator; -} - -// --------------------------------------------------------------- -// Renames selected user library. -void LibraryDialog::slotRename() -{ - if(NameEdit->text().isEmpty()) { - QMessageBox::critical(this, tr("Error"), tr("Please insert a new library name!")); - return; - } - - // pick the clicked radio - QRadioButton *rButton =0; - for(int i = 0; i < radioButton.count(); i++){ - if (radioButton[i]->isChecked()){ - rButton = radioButton[i]; - break; - } - } - - if(rButton == 0) { - QMessageBox::critical(this, tr("Error"), tr("Please choose a library!")); - return; - } - - QString oldName = UserLibDir.absoluteFilePath(rButton->text()); - QString newName = UserLibDir.absoluteFilePath(NameEdit->text()); - qDebug() << oldName + ".lib"; - qDebug() << newName + ".lib"; - - QFile NewLibFile(QucsSettings.LibDir + NameEdit->text() + ".lib"); - if(NewLibFile.exists()) { - QMessageBox::critical(this, tr("Error"), tr("A system library with this name already exists!")); - return; - } - - NewLibFile.setFileName(newName + ".lib"); - if(NewLibFile.exists()) { - QMessageBox::critical(this, tr("Error"), tr("A library with this name already exists!")); - return; - } - - QDir LibSubdir(oldName); - if(LibSubdir.exists()) { - if(!LibSubdir.rename(oldName, newName)) { - QMessageBox::critical(this, tr("Error"), tr("Cannot rename library subdirectory!")); - } - } - - QFile LibFile(oldName + ".lib"); - if(!LibFile.open(QIODevice::ReadOnly)) { - QMessageBox::critical(this, tr("Error"), tr("Cannot open library!")); - return; - } - - QByteArray FileContent = LibFile.readAll(); -// LibFile.close(); - - // rename library name within file - char *p, *Name; - char *Config = FileContent.data(); - for(;;) { - p = strstr(Config, ""); - if(p == 0) break; - - if(!NewLibFile.open(QIODevice::WriteOnly)) { - QMessageBox::critical(this, tr("Error"), tr("No permission to modify library!")); - return; - } - int count = 0; - count += NewLibFile.write(Config, Name-Config); - count += NewLibFile.write(NameEdit->text().toLatin1(), NameEdit->text().length()); - count += NewLibFile.write(p, FileContent.count() - (p-Config) ); - NewLibFile.close(); - count -= FileContent.count() + NameEdit->text().length() - (p-Name); - if(count != 0) { - QMessageBox::critical(this, tr("Error"), tr("Writing new library not successful!")); - return; - } - - if(!LibFile.remove()) { - QMessageBox::critical(this, tr("Error"), tr("Cannot delete old library.")); - //toggleGroup->insert(new QRadioButton(NameEdit->text(), Dia_Box)); - NameEdit->clear(); - return; - } - - rButton->setText(NameEdit->text()); - NameEdit->clear(); - return; - } - - QMessageBox::critical(this, tr("Error"), tr("Library file is corrupt!")); -} - -// --------------------------------------------------------------- -// Deletes the selected user library. -void LibraryDialog::slotDelete() -{ - // pick the clicked radio - QRadioButton *rButton =0; - for(int i = 0; i < radioButton.count(); i++){ - if (radioButton[i]->isChecked()){ - rButton = radioButton[i]; - break; - } - } - - if(rButton == 0) { - QMessageBox::critical(this, tr("Error"), tr("Please choose a library!")); - return; - } - - QString oldName = UserLibDir.absoluteFilePath(rButton->text()); - qDebug() << oldName +".lib"; - QFile LibFile(oldName + ".lib"); - if(!LibFile.remove()) { - QMessageBox::critical(this, tr("Error"), - tr("No permission to delete library \"%1\".").arg(rButton->text())); - return; - } - - QDir LibSubdir(oldName); - if(LibSubdir.exists()) { - QStringList DirFiles; - QStringList::iterator it; - DirFiles = LibSubdir.entryList(QStringList("*"), QDir::Files, QDir::Name); - for(it = DirFiles.begin(); it != DirFiles.end(); it++) - LibSubdir.remove(*it); - if(!LibSubdir.rmdir(oldName)) { - QMessageBox::critical(this, tr("Error"), - tr("No permission to delete library subdirectory \"%1\"."). - arg(rButton->text())); - return; - } - } - - delete rButton; -} diff --git a/qucs-lib/librarydialog.h b/qucs-lib/librarydialog.h deleted file mode 100644 index c12db62d..00000000 --- a/qucs-lib/librarydialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - librarydialog.h - ----------------- - begin : Sun Jun 04 2006 - copyright : (C) 2006 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef LIBRARYDIALOG_H -#define LIBRARYDIALOG_H - -#include -#include -#include -#include -#include - -class QLabel; -class QLineEdit; -class QPushButton; -class QVBoxLayout; -class QRadioButton; -class QGroupBox; -class QRegExpValidator; - - -class LibraryDialog : public QDialog { - Q_OBJECT -public: - LibraryDialog(QWidget*); - ~LibraryDialog(); - -private slots: - void slotDelete(); - void slotRename(); - -private: - //QRadioButton *previousLib; - - QList radioButton; - - QVBoxLayout *all; // the mother of all widgets - //Q3VBox *Dia_Box; - QLabel *theLabel; - QLineEdit *NameEdit; - //Q3VButtonGroup *toggleGroup; - QGroupBox *Group; - QPushButton *ButtDelete, *ButtRename, *ButtClose; - - QRegExp Expr; - QRegExpValidator *Validator; -}; - -#endif diff --git a/qucs-lib/main.cpp b/qucs-lib/main.cpp deleted file mode 100644 index a640ff46..00000000 --- a/qucs-lib/main.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - main.cpp - ---------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "qucslib.h" - -tQucsSettings QucsSettings; -QDir UserLibDir; -QDir SysLibDir; - - -// ######################################################################### -// Loads the settings file and stores the settings. -bool loadSettings() -{ - QSettings settings("qucs","qucs_s"); - // Qucs Library Tool specific settings - settings.beginGroup("QucsLib"); - if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt(); - if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt(); - if(settings.contains("dx"))QucsSettings.dx=settings.value("dx").toInt(); - if(settings.contains("dy"))QucsSettings.dy=settings.value("dy").toInt(); - settings.endGroup(); - // Qucs general settings - if(settings.contains("QucsHomeDir")) - if(settings.value("QucsHomeDir").toString() != "") - QucsSettings.QucsHomeDir.setPath(settings.value("QucsHomeDir").toString()); - if(settings.contains("font"))QucsSettings.font.fromString(settings.value("font").toString()); - if(settings.contains("Language"))QucsSettings.Language=settings.value("Language").toString(); - - if(settings.contains("DefaultSimulator")) - QucsSettings.DefaultSimulator = settings.value("DefaultSimulator").toInt(); - else QucsSettings.DefaultSimulator = spicecompat::simNotSpecified; - return true; -} - - -// ######################################################################### -// Saves the settings in the settings file. -bool saveApplSettings(QucsLib *qucs) -{ - QSettings settings ("qucs","qucs_s"); - settings.beginGroup("QucsLib"); - settings.setValue("x", qucs->x()); - settings.setValue("y", qucs->y()); - settings.setValue("dx", qucs->width()); - settings.setValue("dy", qucs->height()); - settings.endGroup(); - return true; - -} - - -// ######################################################################### -// ########## ########## -// ########## Program Start ########## -// ########## ########## -// ######################################################################### - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - - // apply default settings - QucsSettings.x = 100; - QucsSettings.y = 50; - QucsSettings.dx = 600; - QucsSettings.dy = 350; - QucsSettings.font = QFont("Helvetica", 12); - QucsSettings.QucsHomeDir.setPath(QDir::homePath() + "/.qucs"); - - // is application relocated? - QDir QucsDir; - QString QucsApplicationPath = QCoreApplication::applicationDirPath(); -#ifdef __APPLE__ - QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); -#else - QucsDir = QDir(QucsApplicationPath); - QucsDir.cdUp(); -#endif - QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/" QUCS_NAME "/lang/"; - QucsSettings.LibDir = QucsDir.canonicalPath() + "/share/" QUCS_NAME "/library/"; - - loadSettings(); - - SysLibDir.setPath(QucsSettings.LibDir); - UserLibDir.setPath(QucsSettings.QucsHomeDir.canonicalPath() + "/user_lib/"); - - QTranslator tor( 0 ); - QString lang = QucsSettings.Language; - if(lang.isEmpty()) - lang = QString(QLocale::system().name()); - tor.load( QString("qucs_") + lang, QucsSettings.LangDir); - a.installTranslator( &tor ); - - QucsLib *qucs = new QucsLib(); - qucs->raise(); - qucs->resize(QucsSettings.dx, QucsSettings.dy); // size and position ... - qucs->move(QucsSettings.x, QucsSettings.y); // ... before "show" !!! - qucs->show(); - - int result = a.exec(); - saveApplSettings(qucs); - delete qucs; - return result; -} diff --git a/qucs-lib/qucslib.1 b/qucs-lib/qucslib.1 deleted file mode 100644 index f0cd3322..00000000 --- a/qucs-lib/qucslib.1 +++ /dev/null @@ -1,40 +0,0 @@ -.TH QucsLib "1" "July 2005" "Debian/GNU Linux" "User Commands" -.SH NAME -QucsLib \- A component library manager for Qucs. -.SH SYNOPSIS -.B qucslib -[\fIOPTION\fR] ... -.SH DESCRIPTION - -\fBQucs\fR is an integrated circuit simulator which means you are able -to setup a circuit with a graphical user interface (GUI) and simulate -the large-signal, small-signal and noise behaviour of the circuit. -After that simulation has finished you can view the simulation results -on a presentation page or window. - -The software aims to support all kinds of circuit simulation types, -e.g. DC, AC, S-parameter, harmonic balance analysis, noise analysis, -etc. - -\fBQucsLib\fR is a program to manage Qucs component libraries. On the -left side of the application window the available libraries can be -browsed to find the wanted component. By clicking on the component -name its description can be seen on the right side. The selected -component is transported to the Qucs application by clicking on the -button "Copy to Clipboard". Being back in the schematic window the -component can be inserted by pressing CTRL-V (paste from clipboard). - -.SH AVAILABILITY -The latest version of Qucs can always be obtained from -\fBwww.sourceforge.net\fR or \fBwww.freshmeat.net\fR -.SH "REPORTING BUGS" -Known bugs are documented within the BUGS file. Report bugs to -. -.SH COPYRIGHT -Copyright \(co 2005 Michael Margraf -.PP -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -.SH AUTHORS -Written by Michael Margraf and -Stefan Jahn . diff --git a/qucs-lib/qucslib.cpp b/qucs-lib/qucslib.cpp deleted file mode 100644 index b0a26dae..00000000 --- a/qucs-lib/qucslib.cpp +++ /dev/null @@ -1,593 +0,0 @@ -/************************************************************************** - qucslib.cpp - ------------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qucslib.h" -#include "qucslib_common.h" -#include "librarydialog.h" -#include "displaydialog.h" -#include "symbolwidget.h" - -struct compInfoStruct -{ - QString libName; // the name of the library where the component is defined - QString libPath; // the library path (absolute for user libs, relative for system libs) - QString compDef; // the component definition string -}; - -struct libInfoStruct // a struct is not really needed but useful if we need to add further data... -{ - QString libPath; // the library path (absolute for user libs, relative for system libs) -}; - -Q_DECLARE_METATYPE(compInfoStruct) -Q_DECLARE_METATYPE(libInfoStruct) - -/* Constructor setups the GUI. */ -QucsLib::QucsLib() -{ - // set application icon - setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm")); - setWindowTitle("Qucs Library Tool " PACKAGE_VERSION); - - // create file menu - fileMenu = new QMenu(tr("&File")); - - QAction * manageLib =new QAction (tr("Manage User &Libraries..."), this); - manageLib->setShortcut(Qt::CTRL+Qt::Key_M); - connect(manageLib, SIGNAL(triggered()), SLOT(slotManageLib())); - - QAction * fileQuit = new QAction(tr("&Quit"), this); - fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q); - connect(fileQuit, SIGNAL(triggered()), SLOT(slotQuit())); - - fileMenu->addAction(manageLib); - fileMenu->addSeparator(); - fileMenu->addAction(fileQuit); - - - // create help menu - helpMenu = new QMenu(tr("&Help")); - - QAction * helpHelp = new QAction(tr("&Help"), this); - helpHelp->setShortcut(Qt::Key_F1); - helpMenu->addAction(helpHelp); - connect(helpHelp, SIGNAL(triggered()), SLOT(slotHelp())); - - QAction * helpAbout = new QAction(tr("About"), this); - helpMenu->addAction(helpAbout); - connect(helpAbout, SIGNAL(triggered()), SLOT(slotAbout())); - QAction * helpAboutQt = new QAction(tr("About Qt"), this); - helpMenu->addAction(helpAboutQt); - connect(helpAboutQt, SIGNAL(triggered()), SLOT(slotAboutQt())); - - // use Escape key to clear search - QAction *escape = new QAction(this); - escape->setShortcut(Qt::Key_Escape); - connect(escape, SIGNAL(triggered()), SLOT(slotSearchClear())); - this->addAction(escape); - - // setup menu bar - menuBar()->addMenu(fileMenu); - menuBar()->addSeparator(); - menuBar()->addMenu(helpMenu); - - // main box - QWidget *main = new QWidget(this); - setCentralWidget(main); - all = new QVBoxLayout(); - main->setLayout(all); - all->setSpacing (0); - all->setMargin (0); - - - // library and component choice - QGroupBox *LibGroup = new QGroupBox(tr("Component Selection")); - QVBoxLayout *LibGroupLayout = new QVBoxLayout(); - Library = new QComboBox(); - connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int))); - CompList = new QListWidget(); - connect(CompList, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(slotShowComponent(QListWidgetItem*))); - connect(CompList,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),SLOT(slotShowComponent(QListWidgetItem*))); - connect(CompList, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(slotShowComponent(QListWidgetItem*))); - - CompSearch = new QLineEdit(this); - CompSearch->setPlaceholderText(tr("Search Lib Components")); - QPushButton *CompSearchClear = new QPushButton(tr("Clear")); - connect(CompSearch, SIGNAL(textEdited(const QString &)), SLOT(slotSearchComponent(const QString &))); - connect(CompSearchClear, SIGNAL(clicked()), SLOT(slotSearchClear())); - - LibGroupLayout->addWidget(Library); - LibGroupLayout->addWidget(CompList); - QHBoxLayout *CompSearchLayout = new QHBoxLayout(); - LibGroupLayout->addLayout(CompSearchLayout); - CompSearchLayout->addWidget(CompSearch); - CompSearchLayout->addWidget(CompSearchClear); - - LibGroup->setLayout(LibGroupLayout); - - - QGroupBox *CompGroup = new QGroupBox(tr("Component")); - QVBoxLayout *CompGroupLayout = new QVBoxLayout(); - CompDescr = new QTextEdit(); - CompDescr->setReadOnly(true); - CompDescr->setWordWrapMode(QTextOption::NoWrap); - - - Symbol = new SymbolWidget(); - - QGroupBox *ButtonGroup = new QGroupBox(); - QHBoxLayout *ButtonGroupLayout = new QHBoxLayout(); - - QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard")); - connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard())); - QPushButton * ShowButton = new QPushButton (tr("Show Model")); - connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel())); - - ButtonGroupLayout->addWidget(CopyButton); - ButtonGroupLayout->addWidget(ShowButton); - ButtonGroup->setLayout(ButtonGroupLayout); - - - CompGroupLayout->addWidget(CompDescr); - CompGroupLayout->addWidget(Symbol); - CompGroupLayout->addWidget(ButtonGroup); - CompGroup->setLayout(CompGroupLayout); - - - // main layout - QWidget *h = new QWidget(); - QHBoxLayout *lh = new QHBoxLayout(); - lh->addWidget(LibGroup); - lh->addWidget(CompGroup); - h->setLayout(lh); - all->addWidget(h); - - putLibrariesIntoCombobox(); - -} - -/* Destructor destroys the application. */ -QucsLib::~QucsLib() -{ -} - -// ---------------------------------------------------- -// Put all available libraries into ComboBox. -void QucsLib::putLibrariesIntoCombobox() -{ - QList > LibFiles; - ComponentLibrary parsedlib; - QString libPath; - libInfoStruct lineLibInfo; - QVariant v; - - QPixmap userLibPixmap = QPixmap(":/bitmaps/home.png"); - QPixmap sysLibPixmap = QPixmap(":/bitmaps/big.qucs.xpm"); - - Library->clear(); - UserLibCount = 0; - - // user libraries - QStringList UserLibFiles = UserLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name); - QStringList blacklist = getBlacklistedLibraries(UserLibDir.absolutePath()); - foreach(QString ss, blacklist) { // exclude blacklisted files - UserLibFiles.removeAll(ss); - } - UserLibCount = UserLibFiles.count(); - foreach(QString s, UserLibFiles) // build list with full path - LibFiles.append(qMakePair(UserLibDir.absoluteFilePath(s), false)); - - // system libraries - QStringList SysLibFiles = SysLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name); - blacklist = getBlacklistedLibraries(QucsSettings.LibDir); - foreach(QString ss, blacklist) { // exclude blacklisted files - SysLibFiles.removeAll(ss); - } - foreach(QString s, SysLibFiles) // build list with relative path - LibFiles.append(qMakePair(s, true)); - - for (int i = 0; i < LibFiles.count(); ++i ) { - libPath = LibFiles[i].first; - libPath.chop(4); // remove extension - int result = parseComponentLibrary(libPath, parsedlib, QUCS_COMP_LIB_HEADER_ONLY); // need just the library name - switch (result) { - case QUCS_COMP_LIB_IO_ERROR: - { - QString filename = getLibAbsPath(LibFiles[i].first); - QMessageBox::critical(0, tr ("Error"), tr("Cannot open \"%1\".").arg (filename)); - return; - } - case QUCS_COMP_LIB_CORRUPT: - QMessageBox::critical(0, tr("Error"), tr("Library is corrupt.")); - return; - default: - break; - } - - lineLibInfo = libInfoStruct{libPath}; - v.setValue(lineLibInfo); - if (LibFiles[i].second) { // it's a system library ? - Library->addItem(sysLibPixmap, parsedlib.name, v); - } else { - Library->addItem(userLibPixmap, parsedlib.name, v); - } - } - if (UserLibCount > 0) { - // add a separator to distinguish between user libraries and system libs - Library->insertSeparator(UserLibCount); - } - slotSelectLibrary(0); -} - -// ---------------------------------------------------- -void QucsLib::slotAbout() -{ - QMessageBox::about(this, tr("About..."), - "QucsLib Version " PACKAGE_VERSION "\n"+ - tr("Library Manager for Qucs\n")+ - tr("Copyright (C) 2011-2016 Qucs Team\n")+ - tr("Copyright (C) 2005 by Michael Margraf\n")+ - "\nThis is free software; see the source for copying conditions." - "\nThere is NO warranty; not even for MERCHANTABILITY or " - "\nFITNESS FOR A PARTICULAR PURPOSE."); -} - -void QucsLib::slotAboutQt() -{ - QMessageBox::aboutQt(this); -} - -// ---------------------------------------------------- -void QucsLib::slotQuit() -{ - int tmp; - tmp = x(); // call size and position function in order to ... - tmp = y(); // ... set them correctly before closing the ... - tmp = width(); // dialog !!! Otherwise the frame of the window ... - tmp = height(); // will not be recognized (a X11 problem). - Q_UNUSED(tmp); - - qApp->quit(); -} - -// ---------------------------------------------------- -void QucsLib::closeEvent(QCloseEvent *Event) -{ - int tmp; - tmp = x(); // call size and position function in order to ... - tmp = y(); // ... set them correctly before closing the ... - tmp = width(); // dialog !!! Otherwise the frame of the window ... - tmp = height(); // will not be recognized (a X11 problem). - Q_UNUSED(tmp); - - Event->accept(); -} - -// ---------------------------------------------------- -void QucsLib::slotManageLib() -{ - (new LibraryDialog(this))->exec(); - putLibrariesIntoCombobox(); - CompSearch->clear(); // in case "search mode" was previously active -} - -// ---------------------------------------------------- -void QucsLib::slotHelp() -{ - QMessageBox helpBox; - helpBox.setWindowTitle(tr("QucsLib Help")); - helpBox.setText(tr("QucsLib is a program to manage Qucs component libraries. " - "On the left side of the application window the available " - "libraries can be browsed to find the wanted component. " - "By clicking on the component name its description can be " - "seen on the right side. The selected component is " - "transported to the Qucs application by clicking on the " - "button \"Copy to Clipboard\". Being back in the schematic " - "window the component can be inserted by pressing CTRL-V " - " (paste from clipboard).") + "\n" + - tr("A more comfortable way: The component can also be placed " - "onto the schematic by using Drag n'Drop.")); - helpBox.exec(); -} - -// ---------------------------------------------------- -void QucsLib::slotCopyToClipBoard() -{ - QString s = "\n"; - s += "\n " + - Symbol->theModel() + - "\n\n"; - - // put resulting schematic into clipboard - QClipboard *cb = QApplication::clipboard(); - cb->setText(s); -} - -// ---------------------------------------------------- -void QucsLib::slotShowModel() -{ - DisplayDialog *d = new DisplayDialog(this, Symbol->ModelString, Symbol->VHDLModelString, Symbol->VerilogModelString); - d->setWindowTitle(tr("Model")); - d->resize(500, 150); - d->show(); -} - -// ---------------------------------------------------- -void QucsLib::slotSelectLibrary(int Index) -{ - compInfoStruct lineCompInfo; - QVariant v; - - // was in "search mode" ? - if (Library->itemText(0) == tr("Search results")) { - if (Index == 0) // user selected "Search results" item - return; - Library->removeItem(0); // remove the added "Search results" item - CompSearch->clear(); - --Index; // adjust requested index since item 0 was removed - } - - // make sure the right index is selected - // (might have been called by a cleared search and not by user action) - Library->setCurrentIndex(Index); - - CompList->clear (); - - libInfoStruct lineLibInfo; - v = Library->itemData(Index, Qt::UserRole); - lineLibInfo = v.value(); - - ComponentLibrary parsedlib; - int result = parseComponentLibrary (lineLibInfo.libPath, parsedlib); - - switch (result) - { - case QUCS_COMP_LIB_IO_ERROR: - { - QString filename = getLibAbsPath(lineLibInfo.libPath); - QMessageBox::critical(0, tr ("Error"), tr("Cannot open \"%1\".").arg (filename)); - return; - } - case QUCS_COMP_LIB_CORRUPT: - QMessageBox::critical(0, tr("Error"), tr("Library is corrupt.")); - return; - default: - break; - } - - // Now go through the rest of the component library, extracting each - // component name - for (int i = 0; i < parsedlib.components.count (); i++) - { - QListWidgetItem *CompItem = new QListWidgetItem(parsedlib.components[i].name); - lineCompInfo = compInfoStruct{parsedlib.name, lineLibInfo.libPath, parsedlib.components[i].definition}; - v.setValue(lineCompInfo); - CompItem->setData(Qt::UserRole, v); - CompList->addItem(CompItem); - } - - CompList->setCurrentRow(0); // select first item - slotShowComponent(CompList->item(0)); // and make the corresponding component info appear as well... -} - -// ---------------------------------------------------- -void QucsLib::slotSearchComponent(const QString &searchText) -{ - QList > LibFiles; - QString libPath; - compInfoStruct lineCompInfo; - QVariant v; - - // clear the components view - // (search restarts anew at every keypress) - CompList->clear (); - - if (Library->itemText(0) != tr("Search results")) { - // not already in "search mode" - libCurIdx = Library->currentIndex(); // remember current selected item - // insert "Search results" at the beginning, so that it is visible - Library->insertItem(-1, tr("Search results")); - Library->setCurrentIndex(0); - } - - if(searchText.isEmpty()) { - return; - } - - bool findComponent = false; - - // user libraries - QStringList UserLibFiles = UserLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name); - foreach(QString s, UserLibFiles) // build list with full path - LibFiles.append(qMakePair(UserLibDir.absoluteFilePath(s), false)); - - // system libraries - QStringList SysLibFiles = SysLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name); - foreach(QString s, SysLibFiles) // build list with relative path - LibFiles.append(qMakePair(s, true)); - - QFile File; - QTextStream ReadWhole; - QString LibraryString, LibName, CompName; - int Start, End, NameStart, NameEnd; - for(auto it = LibFiles.begin(); it != LibFiles.end(); it++) { // all library files - QString libPath = (*it).first; - libPath.chop(4); // remove extension - File.setFileName(getLibAbsPath(libPath)); - if(!File.open(QIODevice::ReadOnly)) continue; - - ReadWhole.setDevice(&File); - LibraryString = ReadWhole.readAll(); - File.close(); - - Start = LibraryString.indexOf("', Start); - if(End < 0) continue; - LibName = LibraryString.mid(Start, End-Start).section('"', 1, 1); - - // check all components of the current library - while((Start=LibraryString.indexOf("\n 0) { - Start++; - NameStart = Start + 11; - NameEnd = LibraryString.indexOf('>', NameStart); - if(NameEnd < 0) continue; - CompName = LibraryString.mid(NameStart, NameEnd-NameStart); - - End = LibraryString.indexOf("\n", NameEnd); - if(End < 0) continue; - End += 13; - - // does search criterion match ? - if(CompName.indexOf(searchText, 0, Qt::CaseInsensitive) >= 0) { - if(!findComponent) { - CompList->clear(); - } - findComponent = true; - QListWidgetItem *CompItem = new QListWidgetItem(CompName); - - lineCompInfo = compInfoStruct{LibName, libPath, LibraryString.mid(Start, End-Start)}; - v.setValue(lineCompInfo); - CompItem->setData(Qt::UserRole, v); - CompList->addItem(CompItem); - } - Start = End; - } - } -} - - -void QucsLib::slotSearchClear() -{ - // was in "search mode" ? - if (Library->itemText(0) == tr("Search results")) { - Library->removeItem(0); // remove the added "Search results" item - CompSearch->clear(); - // go back to the panel selected before search started - slotSelectLibrary(libCurIdx); - } -} - - -// ---------------------------------------------------- -void QucsLib::slotShowComponent(QListWidgetItem *Item) -{ - compInfoStruct lineCompInfo; - QVariant v; - libInfoStruct lineLibInfo; - QVariant vLib; - int i; - - if(!Item) return; - - // get component info - v = Item->data(Qt::UserRole); - lineCompInfo = v.value(); - - CompDescr->setText("Name: " + Item->text()); - CompDescr->append("Library: " + lineCompInfo.libName); - CompDescr->append("----------------------------"); - - // find corresponding library index in the libraries combobox - - // findData() below does not work: in Qt4 comparison operators for MetaTypes are not available (but are in Qt5) - //lineLibInfo = libInfoStruct{lineCompInfo.libPath}; - //vLib.setValue(lineLibInfo); - //int i = Library->findData(lineLibInfo, Qt::UserRole); - - // compare component library path and combobox selected library path - for (i = 0; i < Library->count(); i++ ) - { - vLib = Library->itemData(i); - lineLibInfo = vLib.value(); - if (lineLibInfo.libPath == lineCompInfo.libPath) - break; - } - - QString content; - if(!getSection("Description", lineCompInfo.compDef, content)) - { - QMessageBox::critical(this, tr("Error"), tr("Library is corrupt.")); - return; - } - CompDescr->append(content); - - if(!getSection("Model", lineCompInfo.compDef, content)) - { - QMessageBox::critical(this, tr("Error"), tr("Library is corrupt.")); - return; - } - Symbol->ModelString = content; - - if(!getSection("VHDLModel", lineCompInfo.compDef, content)) - { - QMessageBox::critical(this, tr("Error"), tr("Library is corrupt.")); - return; - } - Symbol->VHDLModelString = content; - - if(!getSection("VerilogModel", lineCompInfo.compDef, content)) - { - QMessageBox::critical(this, tr("Error"), tr("Library is corrupt.")); - return; - } - Symbol->VerilogModelString = content; - - if(!getSection("Symbol", lineCompInfo.compDef, content)) - { - QMessageBox::critical(this, tr("Error"), tr("Library is corrupt.")); - return; - } - Symbol->setSymbol(content, lineCompInfo.libPath, Item->text()); - - // change currently selected category, so the user will - // learn where the component comes from - Library->setCurrentIndex(i); - // remove 1 to find the actual index (when in Search Mode ther is one more - // item due to the added "Search Results" item) - libCurIdx = i-1; // remember the category to select when exiting search - //!! comment out the above two lines if you would like that the search - //!! returns back to the last selected category instead -} diff --git a/qucs-lib/qucslib.h b/qucs-lib/qucslib.h deleted file mode 100644 index dc1df120..00000000 --- a/qucs-lib/qucslib.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - qucslib.h - ----------- - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef QUCSLIB_H -#define QUCSLIB_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "symbolwidget.h" - -#include "../qucs/extsimkernels/spicecompat.h" - - -// Application settings. -struct tQucsSettings { - int DefaultSimulator; - int x, y, dx, dy; // position and size of main window - QFont font; // font - QString LangDir; // translation directory - QString LibDir; // library directory - QString Language; - QDir QucsWorkDir; // Qucs user directory where user works (usually same as QucsWorkDir - QDir QucsHomeDir; // Qucs user directory where all projects are located -}; - -extern tQucsSettings QucsSettings; -extern QDir UserLibDir; -extern QDir SysLibDir; - -class QucsLib : public QMainWindow { - Q_OBJECT -public: - QucsLib(); - ~QucsLib(); - - QListWidget *CompList; - QComboBox *Library; - -private slots: - void slotAbout(); - void slotAboutQt(); - void slotQuit(); - void slotHelp(); - void slotCopyToClipBoard(); - void slotShowModel(); - void slotSelectLibrary(int); - void slotSearchComponent(const QString &); - void slotSearchClear(); - void slotShowComponent(QListWidgetItem*); - void slotManageLib(); - -private: - void closeEvent(QCloseEvent*); - void putLibrariesIntoCombobox(); -// bool getSection(QString, QString &, QString &); - - QMenu *fileMenu, *helpMenu; - - int UserLibCount; - int libCurIdx; - SymbolWidget *Symbol; - QTextEdit *CompDescr; - QVBoxLayout *all; - QLineEdit *CompSearch; -}; - -#endif /* QUCSLIB_H */ diff --git a/qucs-lib/qucslib.qrc b/qucs-lib/qucslib.qrc deleted file mode 100644 index cdabdf43..00000000 --- a/qucs-lib/qucslib.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - bitmaps/big.qucs.xpm - bitmaps/home.png - - diff --git a/qucs-lib/qucslib_common.h b/qucs-lib/qucslib_common.h deleted file mode 100644 index e56c7c9b..00000000 --- a/qucs-lib/qucslib_common.h +++ /dev/null @@ -1,527 +0,0 @@ -/*************************************************************************** - qucslib.h - ----------- - begin : Thur Jan 30 2014 - copyright : (C) 2014 by Richard Crozier - email : richard DOT crozier AT yahoo DOT co DOT uk - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef _QUCSLIB_COMMON_H_ -#define _QUCSLIB_COMMON_H_ - -#include -#include -#include -#include - -#include "../qucs/extsimkernels/spicecompat.h" - -// global functions and data structures for the processing of -// qucs library files - -enum LIB_PARSE_RESULT { QUCS_COMP_LIB_OK, - QUCS_COMP_LIB_IO_ERROR, - QUCS_COMP_LIB_CORRUPT, - QUCS_COMP_LIB_EMPTY }; - -enum LIB_PARSE_WHAT { QUCS_COMP_LIB_HEADER_ONLY, - QUCS_COMP_LIB_FULL }; - -struct ComponentLibraryItem -{ - QString name; - QString definition; - QString symbol; - QString modelString; -} ; - -struct ComponentLibrary -{ - QString name; - QString defaultSymbol; - QList components; -} ; - -// convert relative path to system library path -// absolute paths (user libs) remain unchanged -inline QString getLibAbsPath(QString libPath) -{ - QDir libdir(QucsSettings.LibDir); // system libraries paths - QString libAbsPath = libdir.absoluteFilePath(libPath + ".lib"); - return libAbsPath; -} - -// gets the contents of a section from a component description -// -// sections are between pairs -inline bool getSection(QString section, QString &list, QString &content) -{ - int Start, End; - Start = list.indexOf("<"+section+">"); - content = ""; - if(Start > 0) - { - Start += section.length()+2; - End = list.indexOf("", Start); - if(End < 0) - { - return false; - } - content = list.mid(Start, End-Start); - content.replace(QRegExp("\\n\\x20+"), "\n").remove(0, 1); - } - return true; -} - - -inline bool getCompLineIntegers(const QString& s, - int *i1=0, int *i2=0, int *i3=0, int *i4=0, int *i5=0, int *i6=0) -{ - bool ok; - QString n; - - if(!i1) return true; - n = s.section(' ',1,1); - *i1 = n.toInt(&ok); - if(!ok) return false; - - if(!i2) return true; - n = s.section(' ',2,2); - *i2 = n.toInt(&ok); - if(!ok) return false; - - if(!i3) return true; - n = s.section(' ',3,3); - *i3 = n.toInt(&ok); - if(!ok) return false; - - if(!i4) return true; - n = s.section(' ',4,4); - *i4 = n.toInt(&ok); - if(!ok) return false; - - if(!i5) return true; - n = s.section(' ',5,5); - *i5 = n.toInt(&ok); - if(!ok) return false; - - if(!i6) return true; - n = s.section(' ',6,6); - *i6 = n.toInt(&ok); - if(!ok) return false; - - return true; -} - - -// constructs the model string used to paste component libraries -// into a schematic -// -// returns an empty string if it couldn't be constructed -inline int makeModelString (QString libPath, QString compname, QString compstring, QString &modelstring, QString default_sym) -{ - - if (!getSection("Model", compstring, modelstring)) - { - return QUCS_COMP_LIB_CORRUPT; - } - - // check for a single component line - if(!modelstring.isEmpty()) - { - if(modelstring.count('\n') < 2) - { - modelstring = modelstring.remove('\n'); - return QUCS_COMP_LIB_OK; - } - } - - // The model wasn't a single line so we have to pick through the - // symbol definition to get the ID for the model string - QString symbolSection; - if (!getSection("Symbol", compstring, symbolSection)) - { - return QUCS_COMP_LIB_CORRUPT; - } - if(symbolSection.isEmpty()) - { // component definition contains no symbol, use library default - if (default_sym.isEmpty()) - { // library does not define a default symbol - return QUCS_COMP_LIB_CORRUPT; - } - symbolSection = default_sym; // use library default symbol - } - - QStringList symbolstringLines = symbolSection.split ("\n"); - - QString Prefix = ""; - int Text_x = 0; - int Text_y = 0; - - for (int i = 0; i < symbolstringLines.count (); i++) - { - // remove white space from start and end of line - symbolstringLines[i] = symbolstringLines[i].trimmed (); - - if(symbolstringLines[i].isEmpty()) continue; - - // check for and strip the surrounding < >, returning an empty - // string if they're not found - if(symbolstringLines[i].at(0) != '<') - { - return QUCS_COMP_LIB_CORRUPT; - } - if(symbolstringLines[i].at(symbolstringLines[i].length()-1) != '>') - { - return QUCS_COMP_LIB_CORRUPT; - } - - // cut off start and end character - symbolstringLines[i] = symbolstringLines[i].mid(1, symbolstringLines[i].length()-2); - - // get the first statement which contains the component type - QString s = symbolstringLines[i].section(' ',0,0); - // check if it's the ID - if(s == ".ID") - { - - if (!getCompLineIntegers(symbolstringLines[i], &Text_x, &Text_y)) return QUCS_COMP_LIB_OK; - - Prefix = symbolstringLines[i].section(' ',3,3); - - if(Prefix.isEmpty()) - { - Prefix = "X"; - } - - break; - } - - } - - // construct the library model string - modelstring = ""; - - return QUCS_COMP_LIB_OK; - -} - - -inline int parseQucsComponentLibrary (QString libPath, ComponentLibrary &library, LIB_PARSE_WHAT what = QUCS_COMP_LIB_FULL) -{ - int Start, End, NameStart, NameEnd; - - QString filename = getLibAbsPath(libPath); - - QFile file (filename); - - if(!file.open(QIODevice::ReadOnly)) - { - return QUCS_COMP_LIB_IO_ERROR; - } - - // Read the whole library file into a string then close it - QTextStream ReadWhole(&file); - QString LibraryString = ReadWhole.readAll(); - file.close(); - - LibraryString.replace(QRegExp("\\r\\n"), "\n"); - - // The libraries have a header statement like the following: - // - // - // - // First do some checking on this statement - // - // Check for presence of correctly formatted header statement - // if it's not present assume it is corrupt and exit - Start = LibraryString.indexOf(" of the header - End = LibraryString.indexOf('>', Start); - // If the closing > is not found assume corrupt and exit - if(End < 0) - { - - return QUCS_COMP_LIB_CORRUPT; - } - // Still ok, so try to extract the library name - library.name = LibraryString.mid(Start, End-Start).section('"', 1, 1); - // look for nex opening brace of a tag sequence - Start = LibraryString.indexOf("\n<", End); - - if(Start < 0) - { - // nothing else found, library is empty - return QUCS_COMP_LIB_EMPTY; - } - - // libraries can have a default symbol section, parse this - if(LibraryString.mid(Start+2, 14) == "DefaultSymbol>") - { - End = LibraryString.indexOf("\n"); - if(End < 0) - { - return QUCS_COMP_LIB_CORRUPT; - } - // copy the contents of default symbol section to a string - library.defaultSymbol = LibraryString.mid(Start+16, End-Start-16); - Start = End + 3; - } - - if (what == QUCS_COMP_LIB_HEADER_ONLY) - { - // only the header was requested, stop here - return QUCS_COMP_LIB_OK; - } - - // Now go through the rest of the component library, extracting each - // component name - while((Start=LibraryString.indexOf("\n 0) - { - Start++; - NameStart = Start + 11; - NameEnd = LibraryString.indexOf('>', NameStart); - if(NameEnd < 0) continue; - - End = LibraryString.indexOf("\n", NameEnd); - if(End < 0) continue; - End += 13; - - ComponentLibraryItem component; - - component.name = LibraryString.mid(NameStart, NameEnd-NameStart); - component.definition = LibraryString.mid(Start, End-Start); - - // construct model string - int result = makeModelString (libPath, component.name, component.definition, component.modelString, library.defaultSymbol); - if (result != QUCS_COMP_LIB_OK) return result; - - library.components.append (component); - - Start = End; - } - - return QUCS_COMP_LIB_OK; - -} - -/*! - * \brief parseSPICEComponentLibrary Parse SPICE component library as set of subcircuits. - * \param filename[in] - * \param library[out] - * \return - */ -inline int parseSPICEComponentLibrary (QString libPath, ComponentLibrary &library) -{ - - QString filename = getLibAbsPath(libPath); - - QFile file (filename); - - if(!file.open(QIODevice::ReadOnly)) - { - return QUCS_COMP_LIB_IO_ERROR; - } - - // Read the whole library file into a string then close it - QTextStream ReadWhole(&file); - QString LibraryString = ReadWhole.readAll(); - file.close(); - - QFileInfo inf(filename); - library.name = inf.baseName(); - - // Attach default symbol (library_name.sym) if exists - library.defaultSymbol = ""; - QString defsym_filename = inf.canonicalPath() + QDir::separator() - + inf.baseName() + QDir::separator() + library.name + ".sym"; - QFile defsym_file(defsym_filename); - if (defsym_file.open(QIODevice::ReadOnly)) { - QTextStream ts(&defsym_file); - library.defaultSymbol = ts.readAll(); - defsym_file.close(); - } else { // Attach dummy symbol - library.defaultSymbol = "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "<.ID -40 39 SUB>\n" - "\n" - "\n" - "\n" - "\n"; - } - - QTextStream content(&LibraryString); - while(!content.atEnd()) { - QString lin = content.readLine(); - lin = lin.trimmed(); - if (lin.toLower().startsWith(".subckt ")) { - - QString pars; // Has subckt parameters? - int idx = lin.indexOf('='); - if (idx>0) { - if (lin.at(idx-1).isSpace()) { - idx--; - while (lin.at(idx).isSpace()) idx--; - while (lin.at(idx).isLetterOrNumber()) idx--; - } else idx = lin.lastIndexOf(QRegExp("[ \t]"),idx); - pars = lin.mid(idx); - } else pars = ""; - - ComponentLibraryItem comp; - comp.name = lin.section(" ",1,1,QString::SectionSkipEmpty); - // Form fake component definition - comp.modelString = QString("") - .arg(filename).arg(comp.name).arg(pars); - comp.definition += QString("\n").arg(comp.name); - comp.definition += "\n"; - comp.definition += QString("%1 device from %2 library").arg(comp.name).arg(library.name); - comp.definition += "\n"; - comp.definition += "\n"; - comp.definition += lin + "\n.ends\n"; - comp.definition += "\n"; - comp.definition += ""; // Hack! It's needed to make Qucs to use SpiceLibComp - comp.definition += "<"+comp.modelString; - comp.definition += "\n\n"; - comp.definition += "\n"; - // Symbol section - // Try to load symbol from resources - QString sym_filename = inf.canonicalPath() + QDir::separator() - + inf.baseName() + QDir::separator() + comp.name + ".sym"; - QFile sym_file(sym_filename); - if (sym_file.open(QIODevice::ReadOnly)) { - QTextStream ts(&sym_file); - QString sym_content =ts.readAll(); - comp.definition += sym_content; - comp.symbol += sym_content; - sym_file.close(); - } - comp.definition += "\n"; - library.components.append(comp); - } else if (lin.toLower().startsWith(".model")) { - QStringList mod_lines; - mod_lines.append(lin); - QString clin = content.readLine(); - int pos = content.pos(); - while (clin.startsWith('+')) { // get the rest of .MODEL - pos = content.pos(); - mod_lines.append(clin); - clin = content.readLine(); - } - content.seek(pos); // revert one line back - - ComponentLibraryItem comp; - comp.name = lin.section(" ",1,1,QString::SectionSkipEmpty); - // Form fake component definition - QString m_str = QString("M_%1_1").arg(comp.name); - comp.modelString = QString("3) comp.modelString += QString(" \"Line_%1=%2\" %3") - .arg(lin_cnt+1).arg(p).arg(visible); - else comp.modelString += QString(" \"%1\" %2").arg(p).arg(visible); - lin_cnt++; - visible = "0"; - } - comp.modelString += ">"; - - comp.definition += QString("\n").arg(comp.name); - comp.definition += "\n"; - comp.definition += QString("%1 model from %2 library\n" - "This component is model-only (.MODEL).\n" - "No subcircuit definition!\n" - "Use appropriate device to attach this model.").arg(comp.name).arg(library.name); - comp.definition += "\n"; - comp.definition += "\n"; - comp.definition += mod_lines.join("\n"); - comp.definition += "\n"; - comp.definition += ""; // Hack! It's needed to make Qucs to use SpiceLibComp - comp.definition += "<"+comp.modelString; - comp.definition += "\n\n"; - comp.definition += "\n"; - QString symstr = "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "<.ID -40 39 SUB>\n" - "\n"; - comp.definition +=symstr; - comp.symbol += symstr; - comp.definition += "\n"; - library.components.append(comp); - } - } - - return QUCS_COMP_LIB_OK; -} - -inline int parseComponentLibrary (QString filename, ComponentLibrary &library, LIB_PARSE_WHAT what = QUCS_COMP_LIB_FULL) -{ - int r = parseQucsComponentLibrary(filename,library,what); - if (r!=QUCS_COMP_LIB_OK) { - r = parseSPICEComponentLibrary(filename,library); - } - return r; -} - -inline QStringList getBlacklistedLibraries(QString dir) -{ - QString filename; - QStringList blacklisted_libs; - blacklisted_libs.clear(); - switch (QucsSettings.DefaultSimulator) { - case spicecompat::simQucsator : filename = dir + QDir::separator()+ "qucs.blacklist"; - break; - case spicecompat::simXycePar: - case spicecompat::simXyceSer: filename = dir + QDir::separator()+ "xyce.blacklist"; - break; - case spicecompat::simNgspice: - case spicecompat::simSpiceOpus: filename = dir + QDir::separator() + "ngspice.blacklist"; - break; - default:break; - } - - QFile f_blist(filename); - if (!f_blist.open(QIODevice::ReadOnly)) return blacklisted_libs; - - QTextStream ts(&f_blist); - while (!ts.atEnd()) { - QString lib = ts.readLine(); - if (!lib.isEmpty()) blacklisted_libs.append(lib); - } - f_blist.close(); - return blacklisted_libs; -} - -#endif // _QUCSLIB_COMMON_H_ diff --git a/qucs-lib/symbolwidget.cpp b/qucs-lib/symbolwidget.cpp deleted file mode 100644 index ec2caa7c..00000000 --- a/qucs-lib/symbolwidget.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/*************************************************************************** - symbolwidget.cpp - ------------------ - begin : Sat May 28 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include -#include - -#include -#include -#include - -#include "symbolwidget.h" -#include "qucslib.h" -#include "qucslib_common.h" - -/*! - * \file symbolwidget.cpp - * \brief Implementation of the SymbolWidget class. - */ - -const char *empty_xpm[] = { // for drag n'drop -"1 1 1 1", " c None", " "}; - - -SymbolWidget::SymbolWidget(QWidget *parent) : QWidget(parent) -{ - - Text_x = Text_y = 0; - cx = 0; - cy = 0; - x1 = 0; - x2 = 0; - y1 = 0; - y2 = 0; - PaintText = tr("Symbol:"); - setFont(QucsSettings.font); - QFontMetrics metrics(QucsSettings.font, 0); // use the the screen-compatible metric - TextWidth = metrics.width(PaintText) + 4; // get size of text - - DragNDropText = tr("! Drag n'Drop me !"); - DragNDropWidth = metrics.width(DragNDropText); // get size of text - TextHeight = metrics.lineSpacing(); - - ///setPaletteBackgroundColor(Qt::white); - QPalette palette; - palette.setColor(backgroundRole(), Qt::white); - setPalette(palette); - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); -} - -SymbolWidget::~SymbolWidget() -{ -} - -// ************************************************************ -QString SymbolWidget::theModel() -{ - // single component line - if(!ModelString.isEmpty()) - if((ModelString.count('\n') < 2)|| - (ModelString.startsWith(""; -} - -// ************************************************************ -void SymbolWidget::mouseMoveEvent(QMouseEvent*) -{ - - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText("QucsComponent:"+theModel()); - drag->setMimeData(mimeData); - drag->setPixmap( QPixmap(empty_xpm)); - drag->setHotSpot(QPoint(drag->pixmap().width()/2,drag->pixmap().height())); - drag->exec(); - -} - -// ************************************************************ -void SymbolWidget::paintEvent(QPaintEvent*) -{ - QPainter Painter(this); - Painter.drawText(2, 2, 0, 0, Qt::AlignLeft | Qt::TextDontClip, PaintText); - - QFontMetrics metrics(QucsSettings.font, 0); - Painter.drawText(2, metrics.height(), 0, 0, Qt::AlignLeft | Qt::TextDontClip, Warning); - - int dx = (x2-x1)/2 + TextWidth - DragNDropWidth/2; - if(dx < 2) dx = 2; - Painter.drawText(dx, y2-y1+2, 0, 0, Qt::AlignLeft | Qt::TextDontClip, DragNDropText); - - // paint all lines - for(int i=0; istyle); - Painter.drawLine(cx+pl->x1, cy+pl->y1, cx+pl->x2, cy+pl->y2); - } - - // paint all arcs - for(int i=0; istyle); - Painter.drawArc(cx+pc->x, cy+pc->y, pc->w, pc->h, pc->angle, pc->arclen); - } - - // paint all rectangles - for(int i=0; iPen); - Painter.setBrush(pa->Brush); - Painter.drawRect(cx+pa->x, cy+pa->y, pa->w, pa->h); - } - - // paint all ellipses - for(int i=0; iPen); - Painter.setBrush(pa->Brush); - Painter.drawEllipse(cx+pa->x, cy+pa->y, pa->w, pa->h); - } - - Painter.setPen(QPen(Qt::black,1)); - QFont Font = Painter.font(); // save current font - Font.setWeight(QFont::Light); - // write all text - for(int i=0; iSize); - Painter.setFont(Font); - Painter.setPen(pt->Color); - Painter.drawText(cx+pt->x, cy+pt->y, 0, 0, Qt::TextDontClip, pt->s); - } -} - -/*! - * \brief Creates a symbol from the model name of a standard component. - * \param Lib_ - * \param Comp_ - * \return number of symbol ports - */ -int SymbolWidget::createStandardSymbol(const QString& Lib_, const QString& Comp_) -{ - Arcs.clear(); - Lines.clear(); - Rects.clear(); - Ellips.clear(); - Texts.clear(); - LibraryPath = Lib_; - ComponentName = Comp_; - - Warning.clear(); - - int PortNo = 0; - QString Comp = ModelString.section(' ', 0,0); - Comp.remove(0, 1); // remove '<' - - QString FirstProp = ModelString.section('"', 1,1); - - if(Comp == "_BJT") { - Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-30, 0,-10, 0,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10, -5, 0,-15,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0,-15, 0,-30,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10, 5, 0, 15,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0, 15, 0, 30,QPen(Qt::darkBlue,2))); - - if(FirstProp == "npn") { - Lines.append(new qucs::Line( -6, 15, 0, 15,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0, 9, 0, 15,QPen(Qt::darkBlue,2))); - } - else { - Lines.append(new qucs::Line( -5, 10, -5, 16,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -5, 10, 1, 10,QPen(Qt::darkBlue,2))); - } - - Arcs.append(new struct qucs::Arc(-34, -4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, -34, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, 26, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - - PortNo = 3; - x1 = -34; y1 = -34; - x2 = 4; y2 = 34; - } - else if(Comp == "JFET") { - Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-30, 0,-10, 0,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10,-10, 0,-10,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0,-10, 0,-30,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10, 10, 0, 10,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0, 10, 0, 30,QPen(Qt::darkBlue,2))); - - Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkBlue,2))); - - if(FirstProp == "nfet") { - Lines.append(new qucs::Line(-16, -5,-11, 0,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-16, 5,-11, 0,QPen(Qt::darkBlue,2))); - } - else { - Lines.append(new qucs::Line(-18, 0,-13, -5,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-18, 0,-13, 5,QPen(Qt::darkBlue,2))); - } - - Arcs.append(new struct qucs::Arc(-34, -4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, -34, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, 26, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - - PortNo = 3; - x1 = -30; y1 = -30; - x2 = 4; y2 = 30; - } - else if(Comp == "_MOSFET") { - Lines.append(new qucs::Line(-14,-13,-14, 13,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-30, 0,-14, 0,QPen(Qt::darkBlue,2))); - - Lines.append(new qucs::Line(-10,-11, 0,-11,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0,-11, 0,-30,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10, 11, 0, 11,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0, 0, 0, 30,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-10, 0, 0, 0,QPen(Qt::darkBlue,2))); - - Lines.append(new qucs::Line(-10,-16,-10, -7,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-10, 7,-10, 16,QPen(Qt::darkBlue,3))); - - if(FirstProp == "nfet") { - Lines.append(new qucs::Line( -9, 0, -4, -5,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -9, 0, -4, 5,QPen(Qt::darkBlue,2))); - } - else { - Lines.append(new qucs::Line( -1, 0, -6, -5,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -1, 0, -6, 5,QPen(Qt::darkBlue,2))); - } - - // depletion or enhancement MOSFET ? - if((ModelString.section('"', 3,3).trimmed().at(0) == '-') == - (FirstProp == "nfet")) - Lines.append(new qucs::Line(-10, -8,-10, 8,QPen(Qt::darkBlue,3))); - else - Lines.append(new qucs::Line(-10, -4,-10, 4,QPen(Qt::darkBlue,3))); - - Arcs.append(new struct qucs::Arc(-34, -4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, -34, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(-4, 26, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - - PortNo = 3; - x1 = -34; y1 = -34; - x2 = 4; y2 = 34; - } - else if(Comp == "Diode") { - Lines.append(new qucs::Line(-30, 0, 30, 0,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -6, -9, -6, 9,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 6, -9, 6, 9,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -6, 0, 6, -9,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( -6, 0, 6, 9,QPen(Qt::darkBlue,2))); - - Arcs.append(new struct qucs::Arc(-34, -4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - Arcs.append(new struct qucs::Arc(26, -4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - - PortNo = 2; - x1 = -34; y1 = -9; - x2 = 34; y2 = 9; - } - else if(Comp == "SUBST") { - Lines.append(new qucs::Line(-30,-16, 30,-16,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-30,-12, 30,-12,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-30, 16, 30, 16,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-30, 12, 30, 12,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-30,-16,-30, 16,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 30,-16, 30, 16,QPen(Qt::darkBlue,2))); - - Lines.append(new qucs::Line(-30,-16, 16,-40,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 30,-16, 80,-40,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 30,-12, 80,-36,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 30, 12, 80,-16,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 30, 16, 80,-12,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 16,-40, 80,-40,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 80,-40, 80,-12,QPen(Qt::darkBlue,2))); - - Lines.append(new qucs::Line(-30, 0,-18,-12,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line(-22, 12, 2,-12,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line( -2, 12, 22,-12,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line( 18, 12, 30, 0,QPen(Qt::darkBlue,1))); - - Lines.append(new qucs::Line( 30, 1, 37, 8,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line( 37,-15, 52, 0,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line( 52,-22, 66, -8,QPen(Qt::darkBlue,1))); - Lines.append(new qucs::Line( 66,-30, 80,-16,QPen(Qt::darkBlue,1))); - - PortNo = 0; - x1 = -34; y1 =-44; - x2 = 84; y2 = 20; - } - else { - // Warn in case a default component symbol is not - // mapped or implemented. - if (!((Comp=="SpLib")||(Comp=="SpiceModel"))) - Warning = tr("Warning: Symbol '%1' missing in Qucs Library.\n" - "Drag and Drop may still work.\n" - "Please contact the developers.").arg(Comp); - } - - x1 -= 4; // enlarge component boundings a little - x2 += 4; - y1 -= 4; - y2 += 4; - cx = -x1 + TextWidth; - cy = -y1; - - int dx = x2-x1 + TextWidth; - if((x2-x1) < DragNDropWidth) - dx = (x2-x1 + DragNDropWidth)/2 + TextWidth; - if(dx < DragNDropWidth) - dx = DragNDropWidth; - setMinimumSize(dx, y2-y1 + TextHeight+4); - if(width() > dx) dx = width(); - resize(dx, y2-y1 + TextHeight+4); - update(); - return PortNo; -} - -/*! - * \brief Loads the symbol for the component from the symbol field - * or create a default symbol for a standard component - * or use the library default symbol if the component does not define one - * \param SymbolString - * \param Lib_ - * \param Comp_ - * \return the number of painting elements or a negative nuber if error - */ -int SymbolWidget::setSymbol( QString& SymbolString, - const QString& Lib_, const QString& Comp_) -{ - Warning.clear(); // clear any message possibly previously set by createStandardSymbol() - - if(ModelString.count('\n') < 2) // single-line model: is a standard component - return createStandardSymbol(Lib_, Comp_); // build symbol from component type - - if (SymbolString.isEmpty())//Whenever SymbolString is empty, it tries to load the default symbol - { - //Load the default symbol for the current Qucs library - ComponentLibrary parsedlib; - int result = parseComponentLibrary (Lib_, parsedlib, QUCS_COMP_LIB_HEADER_ONLY); // need just the default symbol - - switch (result)//Check if the library was properly loaded - { - case QUCS_COMP_LIB_IO_ERROR: - { - QString filename = getLibAbsPath(Lib_); - QMessageBox::critical(0, tr ("Error"), tr("Cannot open \"%1\".").arg (filename)); - return -1; - } - case QUCS_COMP_LIB_CORRUPT: - QMessageBox::critical(0, tr("Error"), tr("Library is corrupt.")); - return -1; - default: - break; - } - - // copy the contents of default symbol section to a string - SymbolString = parsedlib.defaultSymbol; - } - - if (SymbolString.isEmpty()) return -1; // should not happen... - - Arcs.clear(); - Lines.clear(); - Rects.clear(); - Ellips.clear(); - Texts.clear(); - LibraryPath = Lib_; - ComponentName = Comp_; - - QString Line; - ///QString foo = SymbolString; - QTextStream stream(&SymbolString, QIODevice::ReadOnly); - - x1 = y1 = INT_MAX; - x2 = y2 = INT_MIN; - - int z=0, Result; - while(!stream.atEnd()) { - Line = stream.readLine(); - Line = Line.trimmed(); - if(Line.isEmpty()) continue; - - if(Line.at(0) != '<') return -1; // check for start char - if(Line.at(Line.length()-1) != '>') return -1; // check for end char - Line = Line.mid(1, Line.length()-2); // cut off start and end character - Result = analyseLine(Line); - if(Result < 0) return -6; // line format error - z += Result; - } - - x1 -= 4; // enlarge component boundings a little - x2 += 4; - y1 -= 4; - y2 += 4; - cx = -x1 + TextWidth; - cy = -y1; - - int dx = x2-x1 + TextWidth; - if((x2-x1) < DragNDropWidth) - dx = (x2-x1 + DragNDropWidth)/2 + TextWidth; - if(dx < DragNDropWidth) - dx = DragNDropWidth; - setMinimumSize(dx, y2-y1 + TextHeight+4); - if(width() > dx) dx = width(); - resize(dx, y2-y1 + TextHeight+4); - update(); - return z; // return number of ports -} - -// --------------------------------------------------------------------- -int SymbolWidget::analyseLine(const QString& Row) -{ - QPen Pen; - QBrush Brush; - QColor Color; - QString s; - int i1, i2, i3, i4, i5, i6; - - s = Row.section(' ',0,0); // component type - if(s == ".PortSym") { // here: ports are open nodes - if(!getCompLineIntegers(Row, &i1, &i2, &i3)) return -1; - Arcs.append(new struct qucs::Arc(i1-4, i2-4, 8, 8, 0, 16*360, - QPen(Qt::red,1))); - - if((i1-4) < x1) x1 = i1-4; // keep track of component boundings - if((i1+4) > x2) x2 = i1+4; - if((i2-4) < y1) y1 = i2-4; - if((i2+4) > y2) y2 = i2+4; - return 0; // do not count Ports - } - else if(s == "Line") { - if(!getCompLineIntegers(Row, &i1, &i2, &i3, &i4)) return -1; - if(!getPen(Row, Pen, 5)) return -1; - i3 += i1; - i4 += i2; - Lines.append(new qucs::Line(i1, i2, i3, i4, Pen)); - - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i1 > x2) x2 = i1; - if(i2 < y1) y1 = i2; - if(i2 > y2) y2 = i2; - if(i3 < x1) x1 = i3; - if(i3 > x2) x2 = i3; - if(i4 < y1) y1 = i4; - if(i4 > y2) y2 = i4; - return 1; - } - else if(s == "EArc") { - if(!getCompLineIntegers(Row, &i1, &i2, &i3, &i4, &i5, &i6)) return -1; - if(!getPen(Row, Pen, 7)) return -1; - Arcs.append(new struct qucs::Arc(i1, i2, i3, i4, i5, i6, Pen)); - - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i1+i3 > x2) x2 = i1+i3; - if(i2 < y1) y1 = i2; - if(i2+i4 > y2) y2 = i2+i4; - return 1; - } - else if(s == ".ID") { - if(!getCompLineIntegers(Row, &i1, &i2)) return -1; - Text_x = i1; - Text_y = i2; - Prefix = Row.section(' ',3,3); - if(Prefix.isEmpty()) Prefix = "X"; - return 0; // do not count IDs - } - else if(s == "Arrow") { - if(!getCompLineIntegers(Row, &i1, &i2, &i3, &i4, &i5, &i6)) return -1; - if(!getPen(Row, Pen, 7)) return -1; - - double beta = atan2(double(i6), double(i5)); - double phi = atan2(double(i4), double(i3)); - double Length = sqrt(double(i6*i6 + i5*i5)); - - i3 += i1; - i4 += i2; - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i1 > x2) x2 = i1; - if(i3 < x1) x1 = i3; - if(i3 > x2) x2 = i3; - if(i2 < y1) y1 = i2; - if(i2 > y2) y2 = i2; - if(i4 < y1) y1 = i4; - if(i4 > y2) y2 = i4; - - Lines.append(new qucs::Line(i1, i2, i3, i4, Pen)); // base line - - double w = beta+phi; - i5 = i3-int(Length*cos(w)); - i6 = i4-int(Length*sin(w)); - Lines.append(new qucs::Line(i3, i4, i5, i6, Pen)); // arrow head - if(i5 < x1) x1 = i5; // keep track of component boundings - if(i5 > x2) x2 = i5; - if(i6 < y1) y1 = i6; - if(i6 > y2) y2 = i6; - - w = phi-beta; - i5 = i3-int(Length*cos(w)); - i6 = i4-int(Length*sin(w)); - Lines.append(new qucs::Line(i3, i4, i5, i6, Pen)); - if(i5 < x1) x1 = i5; // keep track of component boundings - if(i5 > x2) x2 = i5; - if(i6 < y1) y1 = i6; - if(i6 > y2) y2 = i6; - - return 1; - } - else if(s == "Ellipse") { - if(!getCompLineIntegers(Row, &i1, &i2, &i3, &i4)) return -1; - if(!getPen(Row, Pen, 5)) return -1; - if(!getBrush(Row, Brush, 8)) return -1; - Ellips.append(new qucs::Area(i1, i2, i3, i4, Pen, Brush)); - - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i1 > x2) x2 = i1; - if(i2 < y1) y1 = i2; - if(i2 > y2) y2 = i2; - if(i1+i3 < x1) x1 = i1+i3; - if(i1+i3 > x2) x2 = i1+i3; - if(i2+i4 < y1) y1 = i2+i4; - if(i2+i4 > y2) y2 = i2+i4; - return 1; - } - else if(s == "Rectangle") { - if(!getCompLineIntegers(Row, &i1, &i2, &i3, &i4)) return -1; - if(!getPen(Row, Pen, 5)) return -1; - if(!getBrush(Row, Brush, 8)) return -1; - Rects.append(new qucs::Area(i1, i2, i3, i4, Pen, Brush)); - - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i1 > x2) x2 = i1; - if(i2 < y1) y1 = i2; - if(i2 > y2) y2 = i2; - if(i1+i3 < x1) x1 = i1+i3; - if(i1+i3 > x2) x2 = i1+i3; - if(i2+i4 < y1) y1 = i2+i4; - if(i2+i4 > y2) y2 = i2+i4; - return 1; - } - else if(s == "Text") { // must be last in order to reuse "s" ********* - if(!getCompLineIntegers(Row, &i1, &i2, &i3)) return -1; - Color.setNamedColor(Row.section(' ',4,4)); - if(!Color.isValid()) return -1; - - s = Row.mid(Row.indexOf('"')+1); // Text (can contain " !!!) - s = s.left(s.length()-1); - if(s.isEmpty()) return -1; - s.replace("\\n", "\n"); - s.replace("\\\\", "\\"); - - Texts.append(new Text(i1, i2, s, Color, float(i3))); - - QFont Font(QucsSettings.font); - Font.setPointSizeF(float(i3)); - QFontMetrics metrics(Font, 0); // use the the screen-compatible metric - QSize r = metrics.size(0, s); // get size of text - i3 = i1 + r.width(); - i4 = i2 + r.height(); - - if(i1 < x1) x1 = i1; // keep track of component boundings - if(i3 > x2) x2 = i3; - if(i2 < y1) y1 = i2; - if(i4 > y2) y2 = i4; - } - - return 0; -} - - -// --------------------------------------------------------------------- -bool SymbolWidget::getPen(const QString& s, QPen& Pen, int i) -{ - bool ok; - QString n; - - n = s.section(' ',i,i); // color - QColor co; - co.setNamedColor(n); - Pen.setColor(co); - if(!Pen.color().isValid()) return false; - - i++; - n = s.section(' ',i,i); // thickness - Pen.setWidth(n.toInt(&ok)); - if(!ok) return false; - - i++; - n = s.section(' ',i,i); // line style - Pen.setStyle((Qt::PenStyle)n.toInt(&ok)); - if(!ok) return false; - - return true; -} - -// --------------------------------------------------------------------- -bool SymbolWidget::getBrush(const QString& s, QBrush& Brush, int i) -{ - bool ok; - QString n; - - n = s.section(' ',i,i); // fill color - QColor co; - co.setNamedColor(n); - Brush.setColor(co); - if(!Brush.color().isValid()) return false; - - i++; - n = s.section(' ',i,i); // fill style - Brush.setStyle((Qt::BrushStyle)n.toInt(&ok)); - if(!ok) return false; - - i++; - n = s.section(' ',i,i); // filled - if(n.toInt(&ok) == 0) Brush.setStyle(Qt::NoBrush); - if(!ok) return false; - - return true; -} diff --git a/qucs-lib/symbolwidget.h b/qucs-lib/symbolwidget.h deleted file mode 100644 index dd0405e0..00000000 --- a/qucs-lib/symbolwidget.h +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - symbolwidget.h - ---------------- - begin : Sat May 29 2005 - copyright : (C) 2005 by Michael Margraf - email : michael.margraf@alumni.tu-berlin.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#ifndef SYMBOLWIDGET_H -#define SYMBOLWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "element.h" - -/*! - * \file symbolwidget.h - * \brief Definition of the SymbolWidget class. - */ - -class QPaintEvent; -class QSizePolicy; - -class SymbolWidget : public QWidget { - Q_OBJECT -public: - SymbolWidget(QWidget *parent = 0); - ~SymbolWidget(); - - QString theModel(); - int setSymbol( QString&, const QString&, const QString&); - - // component properties - int Text_x, Text_y; - QString Prefix, LibraryPath, ComponentName; - QString ModelString, VerilogModelString, VHDLModelString; - -protected: - void mouseMoveEvent(QMouseEvent*); - -private: - int createStandardSymbol(const QString&, const QString&); - - void paintEvent(QPaintEvent*); - - int analyseLine(const QString&); - - bool getPen (const QString&, QPen&, int); - bool getBrush(const QString&, QBrush&, int); - - QString PaintText; - QString DragNDropText; - QString Warning; - int TextWidth, DragNDropWidth, TextHeight; - int cx, cy, x1, x2, y1, y2; - QList Lines; - QList Arcs; - QList Rects, Ellips; - QList Texts; -}; - -#endif // SYMBOLWIDGET_H diff --git a/qucs/symbolwidget.cpp b/qucs/symbolwidget.cpp index 3997ce77..297a2f61 100644 --- a/qucs/symbolwidget.cpp +++ b/qucs/symbolwidget.cpp @@ -24,7 +24,7 @@ #include "symbolwidget.h" #include "main.h" -#include "../qucs-lib/qucslib_common.h" +#include "qucslib_common.h" /*! * \file symbolwidget.cpp