diff --git a/src/ant/ant/antConfigPage.h b/src/ant/ant/antConfigPage.h index a99d37b34..b032c254a 100644 --- a/src/ant/ant/antConfigPage.h +++ b/src/ant/ant/antConfigPage.h @@ -26,6 +26,7 @@ #define HDR_antConfigPage #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "antTemplate.h" class QListWidgetItem; diff --git a/src/klayout.pro b/src/klayout.pro index e65f610a0..11e00817d 100644 --- a/src/klayout.pro +++ b/src/klayout.pro @@ -13,6 +13,7 @@ SUBDIRS = \ unit_tests \ buddies \ lym \ + laybasic \ equals(HAVE_RUBY, "1") { SUBDIRS += drc lvs @@ -23,7 +24,6 @@ equals(HAVE_RUBY, "1") { # TODO: make buddies able to build without Qt SUBDIRS += \ klayout_main \ - laybasic \ lay \ ant \ img \ @@ -66,6 +66,7 @@ plugins.depends += lib rdb db buddies.depends += plugins lym $$LANG_DEPENDS lym.depends += gsi $$LANG_DEPENDS +laybasic.depends += rdb lym equals(HAVE_RUBY, "1") { MAIN_DEPENDS += drc lvs @@ -94,7 +95,6 @@ equals(HAVE_RUBY, "1") { plugins.depends += lay ant - laybasic.depends += rdb lym ant.depends += laybasic img.depends += laybasic edt.depends += laybasic diff --git a/src/lay/lay/layMacroEditorSetupPage.h b/src/lay/lay/layMacroEditorSetupPage.h index b8a693d7b..b6de86b0d 100644 --- a/src/lay/lay/layMacroEditorSetupPage.h +++ b/src/lay/lay/layMacroEditorSetupPage.h @@ -25,6 +25,7 @@ #define HDR_layMacroEditorSetupPage #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "ui_MacroEditorSetupPage.h" namespace lay diff --git a/src/lay/lay/layMainConfigPages.h b/src/lay/lay/layMainConfigPages.h index 7b15fc78f..92d6fe97a 100644 --- a/src/lay/lay/layMainConfigPages.h +++ b/src/lay/lay/layMainConfigPages.h @@ -28,6 +28,7 @@ #include #include "layPlugin.h" +#include "layPluginConfigPage.h" #include diff --git a/src/lay/lay/laySearchReplaceConfigPage.h b/src/lay/lay/laySearchReplaceConfigPage.h index acf2e3d67..9a7889ae4 100644 --- a/src/lay/lay/laySearchReplaceConfigPage.h +++ b/src/lay/lay/laySearchReplaceConfigPage.h @@ -25,6 +25,7 @@ #define HDR_laySearchReplaceConfigPage #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "laySearchReplaceDialog.h" #include "ui_SearchReplaceConfigPage.h" diff --git a/src/lay/lay/laySettingsForm.cc b/src/lay/lay/laySettingsForm.cc index 0b8f64e02..74bf43bc5 100644 --- a/src/lay/lay/laySettingsForm.cc +++ b/src/lay/lay/laySettingsForm.cc @@ -31,6 +31,7 @@ #include "layMainWindow.h" #include "layApplication.h" +#include "layPluginConfigPage.h" #include "tlExceptions.h" #include "tlLog.h" #include "dbHershey.h" diff --git a/src/laybasic/laybasic/gsiDeclLayLayers.cc b/src/laybasic/laybasic/gsiDeclLayLayers.cc index 8fc610bee..df088a76a 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayers.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayers.cc @@ -22,6 +22,7 @@ #include "gsiDecl.h" +#include "layLayerProperties.h" #include "layLayoutView.h" namespace gsi diff --git a/src/laybasic/laybasic/layAbstractMenu.cc b/src/laybasic/laybasic/layAbstractMenu.cc index 248e43bb5..61a91e89d 100644 --- a/src/laybasic/laybasic/layAbstractMenu.cc +++ b/src/laybasic/laybasic/layAbstractMenu.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include diff --git a/src/laybasic/laybasic/layBrowseInstancesForm.h b/src/laybasic/laybasic/layBrowseInstancesForm.h index 7e7937dfc..ae4d5e2b0 100644 --- a/src/laybasic/laybasic/layBrowseInstancesForm.h +++ b/src/laybasic/laybasic/layBrowseInstancesForm.h @@ -28,6 +28,7 @@ #include "ui_BrowseInstancesConfigPage.h" #include "layLayoutView.h" +#include "layPluginConfigPage.h" #include "layBrowser.h" #include "layMarker.h" diff --git a/src/laybasic/laybasic/layBrowseShapesForm.h b/src/laybasic/laybasic/layBrowseShapesForm.h index d933f0520..d4c74afff 100644 --- a/src/laybasic/laybasic/layBrowseShapesForm.h +++ b/src/laybasic/laybasic/layBrowseShapesForm.h @@ -28,6 +28,7 @@ #include "ui_BrowseShapesConfigPage.h" #include "layLayoutView.h" +#include "layPluginConfigPage.h" #include "layBrowser.h" #include "layMarker.h" diff --git a/src/laybasic/laybasic/layCellView.h b/src/laybasic/laybasic/layCellView.h index 758decfaf..99c6c18d3 100644 --- a/src/laybasic/laybasic/layCellView.h +++ b/src/laybasic/laybasic/layCellView.h @@ -30,8 +30,6 @@ #include #include "tlObject.h" -#include "tlFileSystemWatcher.h" -#include "layTechnology.h" #include "dbLayout.h" #include "dbMetaInfo.h" #include "dbReader.h" @@ -40,6 +38,11 @@ #include "dbInstElement.h" #include "gsi.h" +#if defined(HAVE_QT) +# include "layTechnology.h" +# include "tlFileSystemWatcher.h" +#endif + namespace lay { @@ -287,10 +290,12 @@ public: */ void layout_changed (); +#if defined(HAVE_QT) /** * @brief Gets the file system watcher that delivers events when one of the layouts gets updated */ static tl::FileSystemWatcher &file_watcher (); +#endif private: db::Layout *mp_layout; @@ -305,7 +310,9 @@ private: void on_technology_changed (); static std::map ms_dict; +#if defined(HAVE_QT) static tl::FileSystemWatcher *mp_file_watcher; +#endif }; /** diff --git a/src/laybasic/laybasic/layColor.cc b/src/laybasic/laybasic/layColor.cc new file mode 100644 index 000000000..67e0c700e --- /dev/null +++ b/src/laybasic/laybasic/layColor.cc @@ -0,0 +1,119 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#include "layColor.h" +#include "tlString.h" + +#include + +namespace lay +{ + +Color::Color () + : m_color (0) +{ + // .. nothing yet .. +} + +Color::Color (color_t color) + : m_color (color | 0xff000000) +{ + // .. nothing yet .. +} + +Color::Color (unsigned int r, unsigned int g, unsigned int b, unsigned int alpha) + : m_color ((b & 0xff) | ((g & 0xff) << 8) | ((r & 0xff) << 16) | ((alpha & 0xff) << 24)) +{ + // .. nothing yet .. +} + +Color::Color (const std::string &name) +{ + m_color = 0; + + tl::Extractor ex (name.c_str ()); + + unsigned int n = 0; + + ex.test ("#"); + while (! ex.at_end ()) { + char c = tolower (*ex.get ()); + if (c >= '0' && c <= '9') { + m_color <<= 4; + m_color |= (c - '0'); + ++n; + } else if (c >= 'a' && c <= 'f') { + m_color <<= 4; + m_color |= (c - 'a') + 10; + ++n; + } + ++ex; + } + + if (n == 0) { + m_color = 0; + } else if (n <= 3) { + m_color = ((m_color & 0xf) * 0x11) | ((m_color & 0xf0) * 0x110) | ((m_color & 0xf00) * 0x1100) | 0xff000000; + } else if (n <= 4) { + m_color = ((m_color & 0xf) * 0x11) | ((m_color & 0xf0) * 0x110) | ((m_color & 0xf00) * 0x1100) | ((m_color & 0xf000) * 0x11000); + } else if (n <= 6) { + m_color |= 0xff000000; + } +} + +std::string +Color::to_string () const +{ + if (! is_valid ()) { + + return std::string (); + + } else { + + unsigned int n = 8; + if ((m_color & 0xff000000) == 0xff000000) { + n = 6; + } + + uint32_t c = m_color; + char s [10]; + s[n + 1] = 0; + s[0] = '#'; + while (n > 0) { + s [n] = "0123456789abcdef" [c & 0xf]; + c >>= 4; + --n; + } + + return std::string (s); + + } +} + +bool +Color::is_valid () const +{ + return (m_color & 0xff000000) != 0; +} + +} diff --git a/src/laybasic/laybasic/layColor.h b/src/laybasic/laybasic/layColor.h new file mode 100644 index 000000000..836252fff --- /dev/null +++ b/src/laybasic/laybasic/layColor.h @@ -0,0 +1,95 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#ifndef HDR_layColor +#define HDR_layColor + +#include "laybasicCommon.h" + +#include +#include + +namespace lay +{ + +/** + * @brief The basic color type for a RGB triplet + */ +typedef uint32_t color_t; + +/** + * @brief A wrapper for a color value + * + * This class is a replacement for QColor. It offers invalid color values and + * string conversion. + */ +class LAYBASIC_PUBLIC Color +{ +public: + /** + * @brief Default constructor - creates an invalid color + */ + Color (); + + /** + * @brief Creates a color from a RGB triplet + */ + Color (color_t color); + + /** + * @brief Creates a color from a RGB triplet and alpha value + * + * An alpha value of 0 generates an invalid color. + */ + Color (unsigned int r, unsigned int g, unsigned int b, unsigned int alpha = 0xff); + + /** + * @brief Creates a color value from a string + */ + Color (const std::string &name); + + /** + * @brief Gets the string value from a color + */ + std::string to_string () const; + + /** + * @brief Gets a value indicating whether the color is valid + */ + bool is_valid () const; + + /** + * @brief Gets the RGB triplet + */ + color_t rgb () const + { + return m_color; + } + +private: + color_t m_color; +}; + +} + +#endif diff --git a/src/laybasic/laybasic/layColorPalette.cc b/src/laybasic/laybasic/layColorPalette.cc index 7c5ad2bcd..e24cb73c9 100644 --- a/src/laybasic/laybasic/layColorPalette.cc +++ b/src/laybasic/laybasic/layColorPalette.cc @@ -232,16 +232,16 @@ ColorPalette::from_string (const std::string &s, bool simple) } if (! x.at_end ()) { - throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("unexpected characters: %s")), x.skip ())); + throw tl::Exception (tl::sprintf (tl::to_string (tr ("unexpected characters: %s")), x.skip ())); } if (! simple && (colors () == 0 || luminous_colors () == 0)) { - throw tl::Exception (tl::to_string (QObject::tr ("invalid palette - no colors and/or default colors"))); + throw tl::Exception (tl::to_string (tr ("invalid palette - no colors and/or default colors"))); } } catch (std::exception &ex) { // reformat error message - throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Color palette string format error: %s")), ex.what ())); + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Color palette string format error: %s")), ex.what ())); } } diff --git a/src/laybasic/laybasic/layConfigurationDialog.cc b/src/laybasic/laybasic/layConfigurationDialog.cc index 63d9edeb5..6a10774ac 100644 --- a/src/laybasic/laybasic/layConfigurationDialog.cc +++ b/src/laybasic/laybasic/layConfigurationDialog.cc @@ -28,6 +28,7 @@ #include "ui_ConfigurationDialog.h" #include "layConfigurationDialog.h" #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "layDispatcher.h" #include "tlLog.h" diff --git a/src/laybasic/laybasic/layDispatcher.cc b/src/laybasic/laybasic/layDispatcher.cc index 8f1280b08..dce1ec93b 100644 --- a/src/laybasic/laybasic/layDispatcher.cc +++ b/src/laybasic/laybasic/layDispatcher.cc @@ -36,7 +36,9 @@ static Dispatcher *ms_dispatcher_instance = 0; Dispatcher::Dispatcher (Plugin *parent, bool standalone) : Plugin (parent, standalone), +#if defined(HAVE_QT) mp_menu_parent_widget (0), +#endif mp_delegate (0) { if (! parent && ! ms_dispatcher_instance) { @@ -44,6 +46,7 @@ Dispatcher::Dispatcher (Plugin *parent, bool standalone) } } +#if defined(HAVE_QT) Dispatcher::Dispatcher (QWidget *menu_parent_widget, Plugin *parent, bool standalone) : Plugin (parent, standalone), mp_menu_parent_widget (menu_parent_widget), @@ -56,10 +59,13 @@ Dispatcher::Dispatcher (QWidget *menu_parent_widget, Plugin *parent, bool standa ms_dispatcher_instance = this; } } +#endif Dispatcher::Dispatcher (DispatcherDelegate *delegate, Plugin *parent, bool standalone) : Plugin (parent, standalone), +#if defined(HAVE_QT) mp_menu_parent_widget (0), +#endif mp_delegate (delegate) { if (! parent && ! ms_dispatcher_instance) { @@ -67,6 +73,7 @@ Dispatcher::Dispatcher (DispatcherDelegate *delegate, Plugin *parent, bool stand } } +#if defined(HAVE_QT) Dispatcher::Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent, bool standalone) : Plugin (parent, standalone), mp_menu_parent_widget (menu_parent_widget), @@ -79,6 +86,7 @@ Dispatcher::Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegat ms_dispatcher_instance = this; } } +#endif Dispatcher::~Dispatcher () { @@ -90,12 +98,14 @@ Dispatcher::~Dispatcher () bool Dispatcher::configure (const std::string &name, const std::string &value) { +#if defined(HAVE_QT) if (mp_menu) { std::vector ca = mp_menu->configure_actions (name); for (std::vector::const_iterator a = ca.begin (); a != ca.end (); ++a) { (*a)->configure (value); } } +#endif if (mp_delegate) { return mp_delegate->configure (name, value); @@ -264,7 +274,7 @@ Dispatcher::read_config (const std::string &config_file) try { config_structure (this).parse (*file, *this); } catch (tl::Exception &ex) { - std::string msg = tl::to_string (QObject::tr ("Problem reading config file ")) + config_file + ": " + ex.msg (); + std::string msg = tl::to_string (tr ("Problem reading config file ")) + config_file + ": " + ex.msg (); throw tl::Exception (msg); } diff --git a/src/laybasic/laybasic/layDispatcher.h b/src/laybasic/laybasic/layDispatcher.h index 777092aad..703b4eec0 100644 --- a/src/laybasic/laybasic/layDispatcher.h +++ b/src/laybasic/laybasic/layDispatcher.h @@ -34,6 +34,10 @@ #include #include +#if defined(HAVE_QT) +class QWidget; +#endif + namespace lay { @@ -117,6 +121,7 @@ public: */ Dispatcher (Plugin *parent = 0, bool standalone = false); +#if defined(HAVE_QT) /** * @brief The constructor * @@ -125,6 +130,7 @@ public: * @param standalone The standalone flag passed to the plugin constructor. */ Dispatcher (QWidget *menu_parent_widget, Plugin *parent = 0, bool standalone = false); +#endif /** * @brief The root constructor @@ -133,6 +139,7 @@ public: */ Dispatcher (DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false); +#if defined(HAVE_QT) /** * @brief The root constructor * @@ -140,6 +147,7 @@ public: * @param delegate The notification receiver for dispatcher events */ Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false); +#endif /** * @brief Destructor @@ -216,6 +224,7 @@ public: } } +#if defined(HAVE_QT) /** * @brief Gets the parent widget */ @@ -238,6 +247,14 @@ public: { return (dispatcher () == this) ? mp_menu.get () : dispatcher ()->menu (); } +#else + + /** + * @brief Returns true, if the dispatcher supplies a user interface + */ + bool has_ui () { return false; } + +#endif protected: // capture the configuration events so we can change the value of the configuration actions @@ -248,8 +265,10 @@ private: Dispatcher (const Dispatcher &); Dispatcher &operator= (const Dispatcher &); +#if defined(HAVE_QT) std::unique_ptr mp_menu; QWidget *mp_menu_parent_widget; +#endif DispatcherDelegate *mp_delegate; }; diff --git a/src/laybasic/laybasic/layDisplayState.cc b/src/laybasic/laybasic/layDisplayState.cc index 2a06334cd..11faee3e7 100644 --- a/src/laybasic/laybasic/layDisplayState.cc +++ b/src/laybasic/laybasic/layDisplayState.cc @@ -190,7 +190,7 @@ DisplayState::cellview (unsigned int index, lay::LayoutHandle *layout_h) const cell_path.push_back (pci.second); valid_path = true; } else { - tl::warn << tl::to_string (QObject::tr ("Cellname cannot be reconstructed: ")) << *cn; + tl::warn << tl::to_string (tr ("Cellname cannot be reconstructed: ")) << *cn; valid_path = false; break; } @@ -215,8 +215,8 @@ DisplayState::cellview (unsigned int index, lay::LayoutHandle *layout_h) const pc = &layout_h->layout ().cell (ie.second.inst_ptr.cell_index ()); valid_path = true; } else { - tl::warn << tl::to_string (QObject::tr ("Specific instance cannot be reconstructed: instantiated cell is ")) << ci->cell_name - << tl::to_string (QObject::tr (", parent cell is ")) << layout_h->layout ().cell_name (pc->cell_index ()); + tl::warn << tl::to_string (tr ("Specific instance cannot be reconstructed: instantiated cell is ")) << ci->cell_name + << tl::to_string (tr (", parent cell is ")) << layout_h->layout ().cell_name (pc->cell_index ()); valid_path = false; } } diff --git a/src/laybasic/laybasic/layDitherPattern.cc b/src/laybasic/laybasic/layDitherPattern.cc index 0e24576bc..243f8a5e0 100644 --- a/src/laybasic/laybasic/layDitherPattern.cc +++ b/src/laybasic/laybasic/layDitherPattern.cc @@ -26,6 +26,7 @@ #include "tlAssert.h" #include +#include #include namespace lay @@ -555,6 +556,8 @@ DitherPatternInfo::operator< (const DitherPatternInfo &d) const return m_order_index < d.m_order_index; } +#if defined(HAVE_QT) + // TODO including a scaling algorithm in this formula, or give more resolution to the dither QBitmap DitherPatternInfo::get_bitmap (int width, int height) const @@ -593,6 +596,8 @@ DitherPatternInfo::get_bitmap (int width, int height) const return bitmap; } +#endif + void DitherPatternInfo::set_pattern (const uint32_t *pt, unsigned int w, unsigned int h) { @@ -771,8 +776,11 @@ struct ReplaceDitherPatternOp DitherPatternInfo m_old, m_new; }; -DitherPattern::DitherPattern () - : QObject (), db::Object (0) +DitherPattern::DitherPattern () : +#if defined(HAVE_QT) + QObject (), +#endif + db::Object (0) { for (unsigned int d = 0; d < sizeof (dither_strings) / sizeof (dither_strings [0]); d += 2) { m_pattern.push_back (DitherPatternInfo ()); @@ -786,8 +794,11 @@ DitherPattern::~DitherPattern () // .. nothing yet .. } -DitherPattern::DitherPattern (const DitherPattern &p) - : QObject (), db::Object (0) +DitherPattern::DitherPattern (const DitherPattern &p) : +#if defined(HAVE_QT) + QObject (), +#endif + db::Object (0) { m_pattern = p.m_pattern; } @@ -807,6 +818,7 @@ DitherPattern::operator= (const DitherPattern &p) return *this; } +#if defined(HAVE_QT) QBitmap DitherPattern::get_bitmap (unsigned int i, int width, int height) const { @@ -816,6 +828,7 @@ DitherPattern::get_bitmap (unsigned int i, int width, int height) const return m_pattern [1].get_bitmap (width, height); } } +#endif const DitherPatternInfo & DitherPattern::pattern (unsigned int i) const @@ -848,7 +861,9 @@ DitherPattern::replace_pattern (unsigned int i, const DitherPatternInfo &p) // if something has changed emit the signal if (chg) { +#if defined(HAVE_QT) emit changed (); +#endif } } diff --git a/src/laybasic/laybasic/layDitherPattern.h b/src/laybasic/laybasic/layDitherPattern.h index 5373c72d0..de1e88ca8 100644 --- a/src/laybasic/laybasic/layDitherPattern.h +++ b/src/laybasic/laybasic/layDitherPattern.h @@ -27,8 +27,10 @@ #include "laybasicCommon.h" -#include -#include +#if defined(HAVE_QT) +# include +# include +#endif #include "dbObject.h" @@ -126,6 +128,7 @@ public: m_order_index = oi; } +#if defined(HAVE_QT) /** * @brief Get a monochrome bitmap object for this pattern * @@ -133,6 +136,7 @@ public: * @param height The desired height (-1 for default) */ QBitmap get_bitmap (int width = -1, int height = -1) const; +#endif /** * @brief Gets the the dither pattern @@ -225,10 +229,15 @@ private: * replaced with a new pattern, except for the first pattern which * cannot be changed. */ -class LAYBASIC_PUBLIC DitherPattern - : public QObject, public db::Object +class LAYBASIC_PUBLIC DitherPattern : +#if defined(HAVE_QT) + public QObject, +#endif + public db::Object { +#if defined(HAVE_QT) Q_OBJECT +#endif public: typedef std::vector pattern_vector; @@ -272,8 +281,9 @@ public: return m_pattern != p.m_pattern; } +#if defined(HAVE_QT) /** - * @brief Get a monochrome bitmap object for this pattern + * @brief Gets a monochrome bitmap object for this pattern * * If the index is not valid, an empty bitmap is returned. * @@ -282,6 +292,7 @@ public: * @param height The desired height (-1 for default) */ QBitmap get_bitmap (unsigned int i, int width = -1, int height = -1) const; +#endif /** * @brief Deliver the pattern with the given index @@ -373,12 +384,14 @@ public: */ static const DitherPattern &default_pattern (); +#if defined(HAVE_QT) signals: /** * @brief This signal is emitted if a pattern is changed */ void changed (); - +#endif + private: std::vector m_pattern; }; diff --git a/src/laybasic/laybasic/layDrawing.h b/src/laybasic/laybasic/layDrawing.h index a52c71da1..6545ed3db 100644 --- a/src/laybasic/laybasic/layDrawing.h +++ b/src/laybasic/laybasic/layDrawing.h @@ -34,8 +34,6 @@ #include "layViewOp.h" #include "dbTrans.h" -#include - namespace lay { diff --git a/src/laybasic/laybasic/layEditable.cc b/src/laybasic/laybasic/layEditable.cc index a391c6845..c90cc7663 100644 --- a/src/laybasic/laybasic/layEditable.cc +++ b/src/laybasic/laybasic/layEditable.cc @@ -25,7 +25,9 @@ #include "dbClipboard.h" #include "tlAssert.h" -#include "layPropertiesDialog.h" +#if defined(HAVE_QT) +# include "layPropertiesDialog.h" +#endif #include #include @@ -72,25 +74,29 @@ Editable::~Editable () // Editables implementation Editables::Editables (db::Manager *manager) - : db::Object (manager), mp_properties_dialog (0), m_move_selection (false), m_any_move_operation (false) + : db::Object (manager), m_move_selection (false), m_any_move_operation (false) { - // .. nothing yet .. +#if defined(HAVE_QT) + mp_properties_dialog = 0; +#endif } Editables::~Editables () { cancel_edits (); +#if defined(HAVE_QT) if (mp_properties_dialog) { delete mp_properties_dialog; mp_properties_dialog = 0; } +#endif } void Editables::del (db::Transaction *transaction) { - std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Delete")))); + std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (tr ("Delete")))); if (has_selection ()) { @@ -169,9 +175,9 @@ Editables::selection_catch_bbox () } void -Editables::transform (const db::DCplxTrans &tr, db::Transaction *transaction) +Editables::transform (const db::DCplxTrans &t, db::Transaction *transaction) { - std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Transform")))); + std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (tr ("Transform")))); if (has_selection ()) { @@ -183,7 +189,7 @@ Editables::transform (const db::DCplxTrans &tr, db::Transaction *transaction) manager ()->queue (this, new db::Op ()); for (iterator e = begin (); e != end (); ++e) { - e->transform (tr); + e->transform (t); } } catch (...) { @@ -597,7 +603,7 @@ Editables::move_transform (const db::DPoint &p, db::DFTrans t, lay::angle_constr void Editables::end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction) { - std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Move")))); + std::unique_ptr trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (tr ("Move")))); if (m_any_move_operation) { @@ -660,10 +666,12 @@ Editables::edit_cancel () void Editables::cancel_edits () { +#if defined(HAVE_QT) // close the property dialog if (mp_properties_dialog) { mp_properties_dialog->hide (); } +#endif // cancel any edit operations for (iterator e = begin (); e != end (); ++e) { @@ -671,6 +679,7 @@ Editables::cancel_edits () } } +#if defined(HAVE_QT) void Editables::show_properties (QWidget *parent) { @@ -686,6 +695,7 @@ Editables::show_properties (QWidget *parent) mp_properties_dialog = new lay::PropertiesDialog (parent, manager (), this); mp_properties_dialog->show (); } +#endif } diff --git a/src/laybasic/laybasic/layEditable.h b/src/laybasic/laybasic/layEditable.h index f1f54f164..40721d5a0 100644 --- a/src/laybasic/laybasic/layEditable.h +++ b/src/laybasic/laybasic/layEditable.h @@ -37,14 +37,18 @@ #include #include +#if defined(HAVE_QT) class QWidget; +#endif namespace lay { class Editables; +#if defined(HAVE_QT) class PropertiesPage; class PropertiesDialog; +#endif /** * @brief The "editable" interface @@ -353,6 +357,7 @@ public: return false; } +#if defined(HAVE_QT) /** * @brief Create a "properties page" object * @@ -368,6 +373,7 @@ public: { return 0; } +#endif /** * @brief Destruction callback by the properties page @@ -584,10 +590,12 @@ public: return m_editables.end (); } +#if defined(HAVE_QT) /** * @brief The "show properties" operation */ void show_properties (QWidget *parent); +#endif /** * @brief An event triggered if the selection changed @@ -643,7 +651,9 @@ private: tl::shared_collection m_editables; std::set m_enabled; +#if defined(HAVE_QT) lay::PropertiesDialog *mp_properties_dialog; +#endif bool m_move_selection; bool m_any_move_operation; db::DBox m_last_selected_point; diff --git a/src/laybasic/laybasic/layGridNet.h b/src/laybasic/laybasic/layGridNet.h index 728eadf65..98063d9bd 100644 --- a/src/laybasic/laybasic/layGridNet.h +++ b/src/laybasic/laybasic/layGridNet.h @@ -26,6 +26,7 @@ #include "layViewObject.h" #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "dbTypes.h" #include "dbBox.h" diff --git a/src/laybasic/laybasic/layLayoutViewConfigPages.h b/src/laybasic/laybasic/layLayoutViewConfigPages.h index 176e0e633..04eb8ec4c 100644 --- a/src/laybasic/laybasic/layLayoutViewConfigPages.h +++ b/src/laybasic/laybasic/layLayoutViewConfigPages.h @@ -25,6 +25,7 @@ #define HDR_layLayoutViewConfigPages #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "layColorPalette.h" #include "layStipplePalette.h" #include "layLineStylePalette.h" diff --git a/src/laybasic/laybasic/layLineStyles.h b/src/laybasic/laybasic/layLineStyles.h index 5e506dfa5..2ffa00824 100644 --- a/src/laybasic/laybasic/layLineStyles.h +++ b/src/laybasic/laybasic/layLineStyles.h @@ -27,8 +27,10 @@ #include "laybasicCommon.h" -#include -#include +#if defined(HAVE_QT) +# include +# include +#endif #include "dbObject.h" @@ -141,6 +143,7 @@ public: return m_pattern; } +#if defined(HAVE_QT) /** * @brief Get a monochrome bitmap object for this pattern * @@ -148,6 +151,7 @@ public: * @param height The desired height (-1 for default) */ QBitmap get_bitmap (int width = -1, int height = -1) const; +#endif /** * @brief Replaces the pattern string @@ -215,10 +219,15 @@ private: * replaced with a new pattern, except for the first styles which * cannot be changed. */ -class LAYBASIC_PUBLIC LineStyles - : public QObject, public db::Object +class LAYBASIC_PUBLIC LineStyles : +#if defined(HAVE_QT) + public QObject, +#endif + public db::Object { +#if defined(HAVE_QT) Q_OBJECT +#endif public: typedef std::vector pattern_vector; @@ -352,12 +361,14 @@ public: */ static const LineStyles &default_style (); +#if defined(HAVE_QT) signals: /** * @brief This signal is emitted if a style is changed */ void changed (); - +#endif + private: std::vector m_styles; }; diff --git a/src/laybasic/laybasic/layNetlistBrowser.h b/src/laybasic/laybasic/layNetlistBrowser.h index 96b55874d..96f333ce7 100644 --- a/src/laybasic/laybasic/layNetlistBrowser.h +++ b/src/laybasic/laybasic/layNetlistBrowser.h @@ -25,6 +25,7 @@ #define HDR_layNetlistBrowser #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "layColorPalette.h" #include "ui_NetlistBrowserConfigPage.h" #include "ui_NetlistBrowserConfigPage2.h" diff --git a/src/laybasic/laybasic/layPlugin.h b/src/laybasic/laybasic/layPlugin.h index 59b356d2f..8f634c0a9 100644 --- a/src/laybasic/laybasic/layPlugin.h +++ b/src/laybasic/laybasic/layPlugin.h @@ -26,13 +26,13 @@ #include "laybasicCommon.h" -#include - #include "tlString.h" #include "tlClassRegistry.h" #include "tlDeferredExecution.h" #include "gsiObject.h" -#include "layAbstractMenu.h" +#if defined(HAVE_QT) +# include "layAbstractMenu.h" +#endif #include #include @@ -49,53 +49,15 @@ namespace lay class Plugin; class Dispatcher; class LayoutView; -class Browser; class ViewService; class Editable; class Drawing; class TechnologyComponentProvider; +#if defined(HAVE_QT) +class Browser; class EditorOptionsPage; - -/** - * @brief The base class for configuration pages - * - * This interface defines some services the configuration page - * must provide (i.e. setup, commit) - */ -class LAYBASIC_PUBLIC ConfigPage - : public QFrame -{ -public: - ConfigPage (QWidget *parent) - : QFrame (parent) - { - // .. nothing else .. - } - - /** - * @brief Load the page - * - * The implementation is supposed to fetch the configuration from the - * Plugin object provided and load the widgets accordingly. - */ - virtual void setup (Dispatcher * /*root*/) - { - // the default implementation does nothing. - } - - /** - * @brief Commit the page - * - * The implementation is supposed to read the configuration (and - * throw exceptions if the configuration something is invalid) - * and commit the changes through - */ - virtual void commit (Dispatcher * /*root*/) - { - // the default implementation does nothing. - } - -}; +class ConfigPage; +#endif /** * @brief A menu entry declaration @@ -184,11 +146,15 @@ LAYBASIC_PUBLIC MenuEntry config_menu_item (const std::string &menu_name, const * mechanism (instantiate a tl::Registrar::Class * object). */ -class LAYBASIC_PUBLIC PluginDeclaration - : public QObject, +class LAYBASIC_PUBLIC PluginDeclaration : +#if defined(HAVE_QT) + public QObject, +#endif public gsi::ObjectBase { -Q_OBJECT +#if defined(HAVE_QT) +Q_OBJECT +#endif public: /** @@ -211,6 +177,7 @@ public: // the default implementation does not add any options } +#if defined(HAVE_QT) /** * @brief Fetch the configuration page for the configuration dialog * @@ -222,7 +189,7 @@ public: { return 0; } - + /** * @brief Fetch the configuration pages for the configuration dialog * @@ -235,6 +202,7 @@ public: { return std::vector > (); } +#endif /** * @brief The global configuration @@ -352,6 +320,7 @@ public: return false; } +#if defined(HAVE_QT) /** * @brief Gets the editor options pages * @@ -364,6 +333,7 @@ public: { // .. no pages in the default implementation .. } +#endif /** * @brief Tells if the plugin implements a "lay::ViewService" active mouse mode @@ -483,14 +453,18 @@ public: */ tl::Event editable_enabled_changed_event; +#if defined(HAVE_QT) private slots: void toggle_editable_enabled (); +#endif private: int m_id; +#if defined(HAVE_QT) tl::weak_ptr mp_editable_mode_action; tl::weak_ptr mp_mouse_mode_action; tl::weak_collection m_menu_actions; +#endif bool m_editable_enabled; }; @@ -730,6 +704,7 @@ public: // .. this implementation does nothing .. } +#if defined(HAVE_QT) /** * @brief Return the lay::Browser interface if this object has one * @@ -740,6 +715,7 @@ public: { return 0; } +#endif /** * @brief Return the lay::ViewService interface if this object has one diff --git a/src/laybasic/laybasic/layPluginConfigPage.cc b/src/laybasic/laybasic/layPluginConfigPage.cc new file mode 100644 index 000000000..680e76f01 --- /dev/null +++ b/src/laybasic/laybasic/layPluginConfigPage.cc @@ -0,0 +1,33 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#include "laybasicCommon.h" + +#include "layPluginConfigPage.h" + +namespace lay +{ + +// .. nothing yet .. + +} diff --git a/src/laybasic/laybasic/layPluginConfigPage.h b/src/laybasic/laybasic/layPluginConfigPage.h new file mode 100644 index 000000000..e190ac15a --- /dev/null +++ b/src/laybasic/laybasic/layPluginConfigPage.h @@ -0,0 +1,82 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#ifndef HDR_layPluginConfigPage +#define HDR_layPluginConfigPage + +#include "laybasicCommon.h" + +#include + +namespace lay +{ + +class Dispatcher; +class EditorOptionsPage; + +/** + * @brief The base class for configuration pages + * + * This interface defines some services the configuration page + * must provide (i.e. setup, commit) + */ +class LAYBASIC_PUBLIC ConfigPage + : public QFrame +{ +public: + ConfigPage (QWidget *parent) + : QFrame (parent) + { + // .. nothing else .. + } + + /** + * @brief Load the page + * + * The implementation is supposed to fetch the configuration from the + * Plugin object provided and load the widgets accordingly. + */ + virtual void setup (Dispatcher * /*root*/) + { + // the default implementation does nothing. + } + + /** + * @brief Commit the page + * + * The implementation is supposed to read the configuration (and + * throw exceptions if the configuration something is invalid) + * and commit the changes through + */ + virtual void commit (Dispatcher * /*root*/) + { + // the default implementation does nothing. + } + +}; + +} + +#endif + + diff --git a/src/laybasic/laybasic/laySnap.h b/src/laybasic/laybasic/laySnap.h index 506f19e60..c05eabda3 100644 --- a/src/laybasic/laybasic/laySnap.h +++ b/src/laybasic/laybasic/laySnap.h @@ -27,7 +27,9 @@ #include "laybasicCommon.h" +#if defined(HAVE_QT) #include +#endif #include #include @@ -244,6 +246,7 @@ namespace lay */ LAYBASIC_PUBLIC int draw_round (double x); +#if defined(HAVE_QT) /** * @brief rounding (and height-transformation) of a double point */ @@ -253,6 +256,7 @@ namespace lay * @brief rounding (and height-transformation) of a two-point vector */ LAYBASIC_PUBLIC std::pair draw_round (const db::DPoint &p1, const db::DPoint &p2, int h); +#endif /** * @brief rounding (and height-transformation) of a two-point vector diff --git a/src/laybasic/laybasic/layStream.h b/src/laybasic/laybasic/layStream.h index 333e86331..55d4fde00 100644 --- a/src/laybasic/laybasic/layStream.h +++ b/src/laybasic/laybasic/layStream.h @@ -31,6 +31,8 @@ #include "tlXMLWriter.h" #include "dbLoadLayoutOptions.h" +#include + namespace db { class StreamFormatDeclaration; diff --git a/src/laybasic/laybasic/layViewOp.h b/src/laybasic/laybasic/layViewOp.h index f9cf704c6..5527288c5 100644 --- a/src/laybasic/laybasic/layViewOp.h +++ b/src/laybasic/laybasic/layViewOp.h @@ -26,14 +26,13 @@ #define HDR_layViewOp #include "laybasicCommon.h" +#include "layColor.h" #include namespace lay { -typedef unsigned int color_t; - const unsigned int wordlen = 32; const unsigned int wordbits = 5; const unsigned int wordones = 0xffffffff; diff --git a/src/laybasic/laybasic/laybasic.pro b/src/laybasic/laybasic/laybasic.pro index ed2625d9d..5c370f207 100644 --- a/src/laybasic/laybasic/laybasic.pro +++ b/src/laybasic/laybasic/laybasic.pro @@ -6,67 +6,69 @@ include($$PWD/../../lib.pri) DEFINES += MAKE_LAYBASIC_LIBRARY -FORMS = \ - AlignCellOptionsDialog.ui \ - BookmarkManagementForm.ui \ - BrowseInstancesConfigPage.ui \ - BrowseInstancesForm.ui \ - BrowserDialog.ui \ - BrowserPanel.ui \ - BrowseShapesConfigPage.ui \ - BrowseShapesForm.ui \ - CellSelectionForm.ui \ - ClearLayerModeDialog.ui \ - ConfigurationDialog.ui \ - CopyCellModeDialog.ui \ - DeleteCellModeDialog.ui \ - DuplicateLayerDialog.ui \ - EditStipplesForm.ui \ - FlattenInstOptionsDialog.ui \ - GridNetConfigPage.ui \ - LayerMappingWidget.ui \ - LayerSourceDialog.ui \ - LayoutProperties.ui \ - LayoutViewConfigPage1.ui \ - LayoutViewConfigPage2a.ui \ - LayoutViewConfigPage2b.ui \ - LayoutViewConfigPage2c.ui \ - LayoutViewConfigPage2d.ui \ - LayoutViewConfigPage3a.ui \ - LayoutViewConfigPage3b.ui \ - LayoutViewConfigPage3c.ui \ - LayoutViewConfigPage3f.ui \ - LayoutViewConfigPage4.ui \ - LayoutViewConfigPage5.ui \ - LayoutViewConfigPage6.ui \ - LayoutViewConfigPage7.ui \ - LayoutViewConfigPage.ui \ - LibraryCellSelectionForm.ui \ - LoadLayoutOptionsDialog.ui \ - MarkerBrowserConfigPage2.ui \ - MarkerBrowserConfigPage.ui \ - MarkerBrowserDialog.ui \ - MarkerBrowserPage.ui \ - MarkerBrowserSnapshotView.ui \ - MoveOptionsDialog.ui \ - MoveToOptionsDialog.ui \ - NewCellPropertiesDialog.ui \ - NewLayerPropertiesDialog.ui \ - NewLayoutPropertiesDialog.ui \ - OpenLayoutModeDialog.ui \ - PropertiesDialog.ui \ - RenameCellDialog.ui \ - ReplaceCellOptionsDialog.ui \ - SaveLayoutOptionsDialog.ui \ - SaveLayoutAsOptionsDialog.ui \ - SelectStippleForm.ui \ - TipDialog.ui \ - UserPropertiesForm.ui \ - UserPropertiesEditForm.ui \ - SpecificLoadLayoutOptionsDialog.ui \ - SelectLineStyleForm.ui \ - LayoutViewConfigPage6a.ui \ - EditLineStylesForm.ui \ +!equals(HAVE_QT, "0") { + + FORMS = \ + AlignCellOptionsDialog.ui \ + BookmarkManagementForm.ui \ + BrowseInstancesConfigPage.ui \ + BrowseInstancesForm.ui \ + BrowserDialog.ui \ + BrowserPanel.ui \ + BrowseShapesConfigPage.ui \ + BrowseShapesForm.ui \ + CellSelectionForm.ui \ + ClearLayerModeDialog.ui \ + ConfigurationDialog.ui \ + CopyCellModeDialog.ui \ + DeleteCellModeDialog.ui \ + DuplicateLayerDialog.ui \ + EditStipplesForm.ui \ + FlattenInstOptionsDialog.ui \ + GridNetConfigPage.ui \ + LayerMappingWidget.ui \ + LayerSourceDialog.ui \ + LayoutProperties.ui \ + LayoutViewConfigPage1.ui \ + LayoutViewConfigPage2a.ui \ + LayoutViewConfigPage2b.ui \ + LayoutViewConfigPage2c.ui \ + LayoutViewConfigPage2d.ui \ + LayoutViewConfigPage3a.ui \ + LayoutViewConfigPage3b.ui \ + LayoutViewConfigPage3c.ui \ + LayoutViewConfigPage3f.ui \ + LayoutViewConfigPage4.ui \ + LayoutViewConfigPage5.ui \ + LayoutViewConfigPage6.ui \ + LayoutViewConfigPage7.ui \ + LayoutViewConfigPage.ui \ + LibraryCellSelectionForm.ui \ + LoadLayoutOptionsDialog.ui \ + MarkerBrowserConfigPage2.ui \ + MarkerBrowserConfigPage.ui \ + MarkerBrowserDialog.ui \ + MarkerBrowserPage.ui \ + MarkerBrowserSnapshotView.ui \ + MoveOptionsDialog.ui \ + MoveToOptionsDialog.ui \ + NewCellPropertiesDialog.ui \ + NewLayerPropertiesDialog.ui \ + NewLayoutPropertiesDialog.ui \ + OpenLayoutModeDialog.ui \ + PropertiesDialog.ui \ + RenameCellDialog.ui \ + ReplaceCellOptionsDialog.ui \ + SaveLayoutOptionsDialog.ui \ + SaveLayoutAsOptionsDialog.ui \ + SelectStippleForm.ui \ + TipDialog.ui \ + UserPropertiesForm.ui \ + UserPropertiesEditForm.ui \ + SpecificLoadLayoutOptionsDialog.ui \ + SelectLineStyleForm.ui \ + LayoutViewConfigPage6a.ui \ + EditLineStylesForm.ui \ NetlistBrowserPage.ui \ NetlistBrowserConfigPage.ui \ NetlistBrowserConfigPage2.ui \ @@ -74,231 +76,243 @@ FORMS = \ NetInfoDialog.ui \ NetExportDialog.ui \ SelectCellViewForm.ui \ - LayoutStatistics.ui + LayoutStatistics.ui \ -RESOURCES = \ + RESOURCES = \ laybasicResources.qrc \ - layLayoutStatistics.qrc + layLayoutStatistics.qrc \ -SOURCES = \ - gtf.cc \ - gsiDeclLayDialogs.cc \ - gsiDeclLayLayers.cc \ - gsiDeclLayLayoutView.cc \ - gsiDeclLayMarker.cc \ - gsiDeclLayMenu.cc \ - gsiDeclLayPlugin.cc \ - gsiDeclLayStream.cc \ - layAbstractMenu.cc \ - layAnnotationShapes.cc \ - layBitmap.cc \ - layBitmapRenderer.cc \ - layBitmapsToImage.cc \ - layBookmarkList.cc \ - layBookmarkManagementForm.cc \ - layBrowseInstancesForm.cc \ - layBrowser.cc \ - layBrowserDialog.cc \ - layBrowserPanel.cc \ - layBrowseShapesForm.cc \ - layBusy.cc \ - layCanvasPlane.cc \ - layCellSelectionForm.cc \ - layCellTreeModel.cc \ - layCellView.cc \ - layColorPalette.cc \ - layConfigurationDialog.cc \ - layConverters.cc \ - layCursor.cc \ - layDialogs.cc \ - layDisplayState.cc \ - layDitherPattern.cc \ - layDrawing.cc \ - layEditable.cc \ - layEditStipplesForm.cc \ - layEditStippleWidget.cc \ - layEditorOptionsFrame.cc \ - layEditorOptionsPage.cc \ - layEditorOptionsPages.cc \ - layEditorServiceBase.cc \ - layFileDialog.cc \ - layFinder.cc \ - layFixedFont.cc \ - layGridNet.cc \ - layHierarchyControlPanel.cc \ - layLayerControlPanel.cc \ - layLayerMappingWidget.cc \ - layLayerProperties.cc \ - layLayerToolbox.cc \ - layLayerTreeModel.cc \ - layLayoutCanvas.cc \ - layLayoutPropertiesForm.cc \ - layLayoutView.cc \ - layLayoutViewConfigPages.cc \ - layLoadLayoutOptionsDialog.cc \ - layMarker.cc \ - layMouseTracker.cc \ - layMove.cc \ - layObjectInstPath.cc \ - layParsedLayerSource.cc \ - layPlugin.cc \ - layProperties.cc \ - layPropertiesDialog.cc \ - layQtTools.cc \ - layRedrawLayerInfo.cc \ - layRedrawThreadCanvas.cc \ - layRedrawThread.cc \ - layRedrawThreadWorker.cc \ - layRenderer.cc \ - layRubberBox.cc \ - laySaveLayoutOptionsDialog.cc \ - laySelector.cc \ - laySelectStippleForm.cc \ - laySnap.cc \ - layStipplePalette.cc \ - layStream.cc \ - layTechnology.cc \ - layTipDialog.cc \ - layViewObject.cc \ - layViewOp.cc \ - layViewport.cc \ - layWidgets.cc \ - layZoomBox.cc \ - rdbInfoWidget.cc \ - rdbMarkerBrowser.cc \ - rdbMarkerBrowserDialog.cc \ - rdbMarkerBrowserPage.cc \ - layLineStyles.cc \ - laySelectLineStyleForm.cc \ - layLineStylePalette.cc \ - layEditLineStylesForm.cc \ - layEditLineStyleWidget.cc \ - layBackgroundAwareTreeStyle.cc \ + SOURCES = \ + gsiDeclLayDialogs.cc \ + gsiDeclLayLayoutView.cc \ + gsiDeclLayMarker.cc \ + gsiDeclLayMenu.cc \ + gsiDeclLayNetlistBrowserDialog.cc \ + gsiDeclLayPlugin.cc \ + gsiDeclLayStream.cc \ + gtf.cc \ + layAbstractMenu.cc \ + layBackgroundAwareTreeStyle.cc \ + layBitmapRenderer.cc \ + layBitmapsToImage.cc \ + layBookmarkList.cc \ + layBookmarkManagementForm.cc \ + layBookmarksView.cc \ + layBrowseInstancesForm.cc \ + layBrowseShapesForm.cc \ + layBrowser.cc \ + layBrowserDialog.cc \ + layBrowserPanel.cc \ + layBusy.cc \ + layCellSelectionForm.cc \ + layCellTreeModel.cc \ + layCellView.cc \ + layConfigurationDialog.cc \ + layConverters.cc \ + layCursor.cc \ + layDialogs.cc \ + layEditLineStyleWidget.cc \ + layEditLineStylesForm.cc \ + layEditStippleWidget.cc \ + layEditStipplesForm.cc \ + layEditorOptionsFrame.cc \ + layEditorOptionsPage.cc \ + layEditorOptionsPages.cc \ + layEditorServiceBase.cc \ + layFileDialog.cc \ + layGenericSyntaxHighlighter.cc \ + layGridNet.cc \ + layHierarchyControlPanel.cc \ + layIndexedNetlistModel.cc \ + layItemDelegates.cc \ + layLayerControlPanel.cc \ + layLayerMappingWidget.cc \ + layLayerToolbox.cc \ + layLayerTreeModel.cc \ + layLayoutCanvas.cc \ + layLayoutPropertiesForm.cc \ + layLayoutStatisticsForm.cc \ + layLayoutView.cc \ + layLayoutViewConfigPages.cc \ + layLayoutViewFunctions.cc \ + layLibrariesView.cc \ + layLoadLayoutOptionsDialog.cc \ + layNetExportDialog.cc \ + layNetInfoDialog.cc \ layNetlistBrowser.cc \ layNetlistBrowserDialog.cc \ - layNetlistBrowserPage.cc \ - layItemDelegates.cc \ - layNetInfoDialog.cc \ - layNetExportDialog.cc \ layNetlistBrowserModel.cc \ - layIndexedNetlistModel.cc \ - layNetlistCrossReferenceModel.cc \ + layNetlistBrowserPage.cc \ layNetlistBrowserTreeModel.cc \ - layLibrariesView.cc \ - layBookmarksView.cc \ - layGenericSyntaxHighlighter.cc \ - layDispatcher.cc \ + layNetlistCrossReferenceModel.cc \ + layPluginConfigPage.cc \ + layProperties.cc \ + layPropertiesDialog.cc \ + layQtTools.cc \ + laySaveLayoutOptionsDialog.cc \ laySelectCellViewForm.cc \ - layLayoutStatisticsForm.cc \ - gsiDeclLayNetlistBrowserDialog.cc \ - layLayoutViewFunctions.cc + laySelectLineStyleForm.cc \ + laySelectStippleForm.cc \ + laySelector.cc \ + layTechnology.cc \ + layTipDialog.cc \ + layWidgets.cc \ + layZoomBox.cc \ + rdbInfoWidget.cc \ + rdbMarkerBrowser.cc \ + rdbMarkerBrowserDialog.cc \ + rdbMarkerBrowserPage.cc \ -HEADERS = \ - gtf.h \ - layAbstractMenu.h \ - layAnnotationShapes.h \ - layBitmap.h \ - layBitmapRenderer.h \ - layBitmapsToImage.h \ - layBookmarkList.h \ - layBookmarkManagementForm.h \ - layBrowseInstancesForm.h \ - layBrowserDialog.h \ - layBrowser.h \ - layBrowserPanel.h \ - layBrowseShapesForm.h \ - layBusy.h \ - layCanvasPlane.h \ - layCellSelectionForm.h \ - layCellTreeModel.h \ - layCellView.h \ - layColorPalette.h \ - layConfigurationDialog.h \ - layConverters.h \ - layCursor.h \ - layDialogs.h \ - layDisplayState.h \ - layDitherPattern.h \ - layDrawing.h \ - layEditable.h \ - layEditStipplesForm.h \ - layEditStippleWidget.h \ - layEditorOptionsFrame.h \ - layEditorOptionsPage.h \ - layEditorOptionsPages.h \ - layEditorServiceBase.h \ - layFileDialog.h \ - layFinder.h \ - layFixedFont.h \ - layGridNet.h \ - layHierarchyControlPanel.h \ - layLayerControlPanel.h \ - layLayerMappingWidget.h \ - layLayerProperties.h \ - layLayerToolbox.h \ - layLayerTreeModel.h \ - layLayoutCanvas.h \ - layLayoutPropertiesForm.h \ - layLayoutViewConfigPages.h \ - layLayoutView.h \ - layLoadLayoutOptionsDialog.h \ - layMarker.h \ - layMouseTracker.h \ - layMove.h \ - layObjectInstPath.h \ - layParsedLayerSource.h \ - layPlugin.h \ - layPropertiesDialog.h \ - layProperties.h \ - layQtTools.h \ - layRedrawLayerInfo.h \ - layRedrawThreadCanvas.h \ - layRedrawThread.h \ - layRedrawThreadWorker.h \ - layRenderer.h \ - layRubberBox.h \ - laySaveLayoutOptionsDialog.h \ - laySelector.h \ - laySelectStippleForm.h \ - laySnap.h \ - layStipplePalette.h \ - layStream.h \ - layTechnology.h \ - layTipDialog.h \ - layViewObject.h \ - layViewOp.h \ - layViewport.h \ - layWidgets.h \ - layZoomBox.h \ - rdbInfoWidget.h \ - rdbMarkerBrowserDialog.h \ - rdbMarkerBrowser.h \ - rdbMarkerBrowserPage.h \ - layLineStyles.h \ - laySelectLineStyleForm.h \ - layLineStylePalette.h \ - layEditLineStylesForm.h \ - layEditLineStyleWidget.h \ - laybasicCommon.h \ - laybasicConfig.h \ - layBackgroundAwareTreeStyle.h \ + HEADERS = \ + gtf.h \ + layAbstractMenu.h \ + layBackgroundAwareTreeStyle.h \ + layBitmap.h \ + layBitmapRenderer.h \ + layBitmapsToImage.h \ + layBookmarkList.h \ + layBookmarkManagementForm.h \ + layBookmarksView.h \ + layBrowseInstancesForm.h \ + layBrowseShapesForm.h \ + layBrowser.h \ + layBrowserDialog.h \ + layBrowserPanel.h \ + layBusy.h \ + layCellSelectionForm.h \ + layCellTreeModel.h \ + layCellView.h \ + layConfigurationDialog.h \ + layConverters.h \ + layColor.h \ + layCursor.h \ + layDialogs.h \ + layEditLineStyleWidget.h \ + layEditLineStylesForm.h \ + layEditStippleWidget.h \ + layEditStipplesForm.h \ + layEditorOptionsFrame.h \ + layEditorOptionsPage.h \ + layEditorOptionsPages.h \ + layEditorServiceBase.h \ + layFileDialog.h \ + layGenericSyntaxHighlighter.h \ + layGridNet.h \ + layHierarchyControlPanel.h \ + layIndexedNetlistModel.h \ + layItemDelegates.h \ + layLayerControlPanel.h \ + layLayerMappingWidget.h \ + layLayerToolbox.h \ + layLayerTreeModel.h \ + layLayoutCanvas.h \ + layLayoutPropertiesForm.h \ + layLayoutStatisticsForm.h \ + layLayoutView.h \ + layLayoutViewConfigPages.h \ + layLayoutViewFunctions.h \ + layLibrariesView.h \ + layLoadLayoutOptionsDialog.h \ + layNetExportDialog.h \ + layNetInfoDialog.h \ layNetlistBrowser.h \ layNetlistBrowserDialog.h \ - layNetlistBrowserPage.h \ - layItemDelegates.h \ - layNetInfoDialog.h \ - layNetExportDialog.h \ layNetlistBrowserModel.h \ - layIndexedNetlistModel.h \ - layNetlistCrossReferenceModel.h \ + layNetlistBrowserPage.h \ layNetlistBrowserTreeModel.h \ - layLibrariesView.h \ - layBookmarksView.h \ - layGenericSyntaxHighlighter.h \ - layDispatcher.h \ + layNetlistCrossReferenceModel.h \ + layPluginConfigPage.h \ + layProperties.h \ + layPropertiesDialog.h \ + layQtTools.h \ + laySaveLayoutOptionsDialog.h \ laySelectCellViewForm.h \ - layLayoutStatisticsForm.h \ - layLayoutViewFunctions.h + laySelectLineStyleForm.h \ + laySelectStippleForm.h \ + laySelector.h \ + layTechnology.h \ + layTipDialog.h \ + layWidgets.h \ + layZoomBox.h \ + laybasicConfig.h \ + rdbInfoWidget.h \ + rdbMarkerBrowser.h \ + rdbMarkerBrowserDialog.h \ + rdbMarkerBrowserPage.h \ + +} + +SOURCES += \ + gsiDeclLayLayers.cc \ + layAnnotationShapes.cc \ + layBitmap.cc \ + layColor.cc \ + layColorPalette.cc \ + layDispatcher.cc \ + layDisplayState.cc \ + layDitherPattern.cc \ + layDrawing.cc \ + layEditable.cc \ + layFinder.cc \ + layFixedFont.cc \ + layLineStylePalette.cc \ + layLineStyles.cc \ + layMarker.cc \ + layMouseTracker.cc \ + layMove.cc \ + layObjectInstPath.cc \ + layParsedLayerSource.cc \ + layPlugin.cc \ + layRedrawLayerInfo.cc \ + layRedrawThread.cc \ + layRedrawThreadCanvas.cc \ + layRedrawThreadWorker.cc \ + layRenderer.cc \ + layRubberBox.cc \ + laySnap.cc \ + layStipplePalette.cc \ + layStream.cc \ + layCanvasPlane.cc \ + layLayerProperties.cc \ + layViewObject.cc \ + layViewOp.cc \ + layViewport.cc \ + +HEADERS += \ + layAnnotationShapes.h \ + layBitmap.h \ + layColorPalette.h \ + layDispatcher.h \ + layDisplayState.h \ + layDitherPattern.h \ + layDrawing.h \ + layEditable.h \ + layFinder.h \ + layFixedFont.h \ + layLineStylePalette.h \ + layLineStyles.h \ + layMarker.h \ + layMouseTracker.h \ + layMove.h \ + layObjectInstPath.h \ + layParsedLayerSource.h \ + layPlugin.h \ + layRedrawLayerInfo.h \ + layRedrawThread.h \ + layRedrawThreadCanvas.h \ + layRedrawThreadWorker.h \ + layRenderer.h \ + layRubberBox.h \ + laySnap.h \ + layStipplePalette.h \ + layStream.h \ + layLayerProperties.h \ + layCanvasPlane.h \ + layViewObject.h \ + layViewOp.h \ + layViewport.h \ + laybasicCommon.h \ + INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC diff --git a/src/laybasic/laybasic/rdbMarkerBrowser.h b/src/laybasic/laybasic/rdbMarkerBrowser.h index 8c9feb344..b2a14a25b 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowser.h +++ b/src/laybasic/laybasic/rdbMarkerBrowser.h @@ -25,6 +25,7 @@ #define HDR_rdbMarkerBrowser #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "ui_MarkerBrowserConfigPage.h" #include "ui_MarkerBrowserConfigPage2.h" diff --git a/src/laybasic/unit_tests/layColorTests.cc b/src/laybasic/unit_tests/layColorTests.cc new file mode 100644 index 000000000..c90b0d722 --- /dev/null +++ b/src/laybasic/unit_tests/layColorTests.cc @@ -0,0 +1,114 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "layColor.h" + +#include "tlUnitTest.h" + +#if defined(HAVE_QT) +#include +#endif + +TEST(1) +{ + EXPECT_EQ (lay::Color ().is_valid (), false); + EXPECT_EQ (lay::Color ().to_string (), ""); + EXPECT_EQ (lay::Color ().rgb (), 0x00000000); + +#if defined(HAVE_QT) + EXPECT_EQ (QColor ().isValid (), false); + EXPECT_EQ (tl::to_string (QColor ().name ()), "#000000"); // why? + EXPECT_EQ (QColor ().rgb (), 0xff000000); +#endif +} + +TEST(2) +{ + EXPECT_EQ (lay::Color (0x102030).is_valid (), true); + EXPECT_EQ (lay::Color (0x102030).to_string (), "#102030"); + EXPECT_EQ (lay::Color (0x102030).rgb (), 0xff102030); + +#if defined(HAVE_QT) + EXPECT_EQ (QColor (0x102030).isValid (), true); + EXPECT_EQ (tl::to_string (QColor (0x102030).name ()), "#102030"); + EXPECT_EQ (QColor (0x102030).rgb (), 0xff102030); +#endif +} + +TEST(3) +{ + EXPECT_EQ (lay::Color (std::string ()).is_valid (), false); + EXPECT_EQ (lay::Color ("#102030").is_valid (), true); + EXPECT_EQ (lay::Color ("#102030").to_string (), "#102030"); + EXPECT_EQ (lay::Color ("#102030").rgb (), 0xff102030); + EXPECT_EQ (lay::Color ("102030").is_valid (), true); + EXPECT_EQ (lay::Color ("102030").to_string (), "#102030"); + EXPECT_EQ (lay::Color ("102030").rgb (), 0xff102030); + +#if defined(HAVE_QT) + EXPECT_EQ (QColor (tl::to_qstring ("#102030")).isValid (), true); + EXPECT_EQ (tl::to_string (QColor (tl::to_qstring ("#102030")).name ()), "#102030"); + EXPECT_EQ (QColor (tl::to_qstring ("#102030")).rgb (), 0xff102030); +#endif +} + +TEST(4) +{ + EXPECT_EQ (lay::Color ("#123").is_valid (), true); + EXPECT_EQ (lay::Color ("#123").to_string (), "#112233"); + EXPECT_EQ (lay::Color ("#123").rgb (), 0xff112233); +} + +TEST(5) +{ + EXPECT_EQ (lay::Color ("#80102030").is_valid (), true); + EXPECT_EQ (lay::Color ("#80102030").to_string (), "#80102030"); + EXPECT_EQ (lay::Color ("#80102030").rgb (), 0x80102030); + +#if defined(HAVE_QT) + // no alpha support in Qt + EXPECT_EQ (QColor (tl::to_qstring ("#80102030")).isValid (), true); + EXPECT_EQ (tl::to_string (QColor (tl::to_qstring ("#80102030")).name ()), "#102030"); + EXPECT_EQ (QColor (tl::to_qstring ("#80102030")).rgb (), 0xff102030); +#endif +} + +TEST(6) +{ + EXPECT_EQ (lay::Color ("#8123").is_valid (), true); + EXPECT_EQ (lay::Color ("#8123").to_string (), "#88112233"); + EXPECT_EQ (lay::Color ("#8123").rgb (), 0x88112233); +} + +TEST(7) +{ + EXPECT_EQ (lay::Color (16, 32, 48, 128).is_valid (), true); + EXPECT_EQ (lay::Color (16, 32, 48, 128).to_string (), "#80102030"); + EXPECT_EQ (lay::Color (16, 32, 48, 128).rgb (), 0x80102030); + +#if defined(HAVE_QT) + // no alpha support in Qt + EXPECT_EQ (QColor (16, 32, 48, 128).isValid (), true); + EXPECT_EQ (tl::to_string (QColor (16, 32, 48, 128).name ()), "#102030"); + EXPECT_EQ (QColor (16, 32, 48, 128).rgb (), 0xff102030); +#endif +} diff --git a/src/laybasic/unit_tests/unit_tests.pro b/src/laybasic/unit_tests/unit_tests.pro index d948a1d87..0da4329f9 100644 --- a/src/laybasic/unit_tests/unit_tests.pro +++ b/src/laybasic/unit_tests/unit_tests.pro @@ -10,6 +10,7 @@ SOURCES = \ layAnnotationShapes.cc \ layBitmap.cc \ layBitmapsToImage.cc \ + layColorTests.cc \ layLayerProperties.cc \ layParsedLayerSource.cc \ layRenderer.cc \ diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerConfig.h b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerConfig.h index 91c02f9ce..395a87d20 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerConfig.h +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerConfig.h @@ -28,6 +28,7 @@ #include "ui_NetTracerConfigPage.h" #include "layPlugin.h" +#include "layPluginConfigPage.h" #include "layColorPalette.h" namespace lay