diff --git a/src/laybasic/laybasic/layBitmapsToImage.cc b/src/laybasic/laybasic/layBitmapsToImage.cc index f3587e08e..13403920b 100644 --- a/src/laybasic/laybasic/layBitmapsToImage.cc +++ b/src/laybasic/laybasic/layBitmapsToImage.cc @@ -386,7 +386,7 @@ render_scanline_cross (const uint32_t *dp, unsigned int ds, const lay::Bitmap *p } } -static void create_precursor_bitmaps (const std::vector &view_ops_in, const std::vector &vo_map, const std::vector &pbitmaps_in, const std::vector &bm_map, const lay::LineStyles &ls, unsigned int width, unsigned int height, std::map &precursors, QMutex *mutex) +static void create_precursor_bitmaps (const std::vector &view_ops_in, const std::vector &vo_map, const std::vector &pbitmaps_in, const std::vector &bm_map, const lay::LineStyles &ls, unsigned int width, unsigned int height, std::map &precursors, tl::Mutex *mutex) { tl_assert (bm_map.size () == vo_map.size ()); @@ -430,7 +430,7 @@ bitmaps_to_image_rgb (const std::vector &view_ops_in, QImage *pimage, unsigned int width, unsigned int height, bool use_bitmap_index, bool transparent, - QMutex *mutex) + tl::Mutex *mutex) { std::vector bm_map; std::vector vo_map; @@ -668,7 +668,7 @@ bitmaps_to_image_mono (const std::vector &view_ops_in, const lay::LineStyles &ls, QImage *pimage, unsigned int width, unsigned int height, bool use_bitmap_index, - QMutex *mutex) + tl::Mutex *mutex) { std::vector bm_map; std::vector vo_map; @@ -873,7 +873,7 @@ bitmaps_to_image (const std::vector &view_ops_in, const lay::LineStyles &ls, QImage *pimage, unsigned int width, unsigned int height, bool use_bitmap_index, - QMutex *mutex) + tl::Mutex *mutex) { if (pimage->depth () <= 1) { bitmaps_to_image_mono (view_ops_in, pbitmaps_in, dp, ls, pimage, width, height, use_bitmap_index, mutex); diff --git a/src/laybasic/laybasic/layBitmapsToImage.h b/src/laybasic/laybasic/layBitmapsToImage.h index 88930dca3..411369705 100644 --- a/src/laybasic/laybasic/layBitmapsToImage.h +++ b/src/laybasic/laybasic/layBitmapsToImage.h @@ -25,10 +25,10 @@ #define HDR_layBitmapsToImage #include "layViewOp.h" +#include "tlThreads.h" #include -class QMutex; class QImage; namespace lay @@ -46,7 +46,7 @@ class Bitmap; * with the given width and height. * The "view_ops" and "pbitmaps" vectors must have the same size. * The QImage must be initialized to the given width and height. - * If the QMutex pointer is not 0, the mutex is locked between operations + * If the tl::Mutex pointer is not 0, the mutex is locked between operations * if the bitmap is accessed. The set of dither pattern specifies any custom * pattern that are used bz the view operands. * The "use_bitmap_index" parameter specifies whether the bitmap_index @@ -60,7 +60,7 @@ bitmaps_to_image (const std::vector &view_ops, const lay::LineStyles &ls, QImage *pimage, unsigned int width, unsigned int height, bool use_bitmap_index, - QMutex *mutex); + tl::Mutex *mutex); /** * @brief Convert a lay::Bitmap to a unsigned char * data field to be passed to QBitmap diff --git a/src/laybasic/laybasic/layConverters.h b/src/laybasic/laybasic/layConverters.h index 8965fc369..472b22026 100644 --- a/src/laybasic/laybasic/layConverters.h +++ b/src/laybasic/laybasic/layConverters.h @@ -27,7 +27,9 @@ #include "laybasicCommon.h" #include "layColor.h" -#include +#if defined(HAVE_QT) +# include +#endif namespace lay { @@ -37,9 +39,11 @@ namespace lay */ struct LAYBASIC_PUBLIC ColorConverter { +#if defined(HAVE_QT) std::string to_string (const QColor &c) const; - std::string to_string (const lay::Color &c) const; void from_string (const std::string &s, QColor &c) const; +#endif + std::string to_string (const lay::Color &c) const; void from_string (const std::string &s, lay::Color &c) const; }; diff --git a/src/laybasic/laybasic/layFinder.cc b/src/laybasic/laybasic/layFinder.cc index 7bd3dac16..214705fc4 100644 --- a/src/laybasic/laybasic/layFinder.cc +++ b/src/laybasic/laybasic/layFinder.cc @@ -267,7 +267,7 @@ struct LPContextCompareOp bool ShapeFinder::find (LayoutViewBase *view, const db::DBox ®ion_mu) { - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); + tl::AbsoluteProgress progress (tl::to_string (tr ("Selecting ..."))); progress.set_unit (1000); progress.set_format (""); mp_progress = &progress; @@ -332,7 +332,7 @@ ShapeFinder::find (LayoutViewBase *view, const db::DBox ®ion_mu) bool ShapeFinder::find (lay::LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu) { - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); + tl::AbsoluteProgress progress (tl::to_string (tr ("Selecting ..."))); progress.set_unit (1000); progress.set_format (""); mp_progress = &progress; @@ -626,7 +626,7 @@ InstFinder::InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, b bool InstFinder::find (lay::LayoutViewBase *view, const db::DBox ®ion_mu) { - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); + tl::AbsoluteProgress progress (tl::to_string (tr ("Selecting ..."))); progress.set_unit (1000); progress.set_format (""); mp_progress = &progress; @@ -643,7 +643,7 @@ InstFinder::find (lay::LayoutViewBase *view, const db::DBox ®ion_mu) bool InstFinder::find (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox ®ion_mu) { - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Selecting ..."))); + tl::AbsoluteProgress progress (tl::to_string (tr ("Selecting ..."))); progress.set_unit (1000); progress.set_format (""); mp_progress = &progress; diff --git a/src/laybasic/laybasic/layGridNet.cc b/src/laybasic/laybasic/layGridNet.cc index f7f205ad1..47fc79b81 100644 --- a/src/laybasic/laybasic/layGridNet.cc +++ b/src/laybasic/laybasic/layGridNet.cc @@ -23,13 +23,17 @@ #include "laybasicConfig.h" #include "layGridNet.h" -#include "layWidgets.h" +#if defined(HAVE_QT) // @@@ +# include "layWidgets.h" +#endif #include "layLayoutView.h" #include "layConverters.h" #include "layFixedFont.h" #include "laySnap.h" #include "dbTrans.h" -#include "ui_GridNetConfigPage.h" +#if defined(HAVE_QT) // @@@ +# include "ui_GridNetConfigPage.h" +#endif namespace lay { @@ -64,7 +68,7 @@ public: return; } } - throw tl::Exception (tl::to_string (QObject::tr ("Invalid grid net style: ")) + value); + throw tl::Exception (tl::to_string (tr ("Invalid grid net style: ")) + value); } std::string @@ -97,12 +101,14 @@ GridNetPluginDeclaration::get_options (std::vector < std::pair config_decl (new GridNetPlugi // ------------------------------------------------------------ // Implementation of the configuration page +#if defined(HAVE_QT) GridNetConfigPage::GridNetConfigPage (QWidget *parent) : lay::ConfigPage (parent) { @@ -188,6 +195,7 @@ GridNetConfigPage::commit (lay::Dispatcher *root) root->config_set (cfg_grid_style1, lay::GridNet::GridStyle (mp_ui->style1_cbx->currentIndex ()), GridNetStyleConverter ()); root->config_set (cfg_grid_style2, lay::GridNet::GridStyle (mp_ui->style2_cbx->currentIndex ()), GridNetStyleConverter ()); } +#endif // ------------------------------------------------------------ // Implementation of the GridNet object @@ -210,25 +218,25 @@ GridNet::configure (const std::string &name, const std::string &value) if (name == cfg_grid_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); need_update = test_and_set (m_color, color); } else if (name == cfg_grid_grid_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); need_update = test_and_set (m_grid_color, color); } else if (name == cfg_grid_axis_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); need_update = test_and_set (m_axis_color, color); } else if (name == cfg_grid_ruler_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); need_update = test_and_set (m_ruler_color, color); @@ -283,7 +291,7 @@ GridNet::configure (const std::string &name, const std::string &value) return taken; } - +#if defined(HAVE_QT) // @@@ class ImagePainter { public: @@ -427,27 +435,28 @@ private: double m_resolution; int m_width, m_height; }; +#endif void GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas) { if (m_visible) { - QColor color; - if (m_color.isValid ()) { + lay::Color color; + if (m_color.is_valid ()) { color = m_color; } else { - color = QColor (128, 128, 128); // TODO: this is not a "real" automatic color .. + color = lay::Color (128, 128, 128); // TODO: this is not a "real" automatic color .. } - QColor grid_color = color, axis_color = color, ruler_color = color; - if (m_grid_color.isValid ()) { + lay::Color grid_color = color, axis_color = color, ruler_color = color; + if (m_grid_color.is_valid ()) { grid_color = m_grid_color; } - if (m_axis_color.isValid ()) { + if (m_axis_color.is_valid ()) { axis_color = m_axis_color; } - if (m_ruler_color.isValid ()) { + if (m_ruler_color.is_valid ()) { ruler_color = m_ruler_color; } @@ -457,6 +466,7 @@ GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas) return; } +#if defined(HAVE_QT) // @@@ ImagePainter painter (*bmp_canvas); db::DCplxTrans trans = vp.trans (); @@ -769,11 +779,10 @@ GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas) } } +#endif } - } - } // namespace lay diff --git a/src/laybasic/laybasic/layGridNet.h b/src/laybasic/laybasic/layGridNet.h index 0a7ab5d95..011091d6e 100644 --- a/src/laybasic/laybasic/layGridNet.h +++ b/src/laybasic/laybasic/layGridNet.h @@ -26,7 +26,10 @@ #include "layViewObject.h" #include "layPlugin.h" -#include "layPluginConfigPage.h" +#if defined(HAVE_QT) +# include "layPluginConfigPage.h" +#endif +#include "layColor.h" #include "dbTypes.h" #include "dbBox.h" @@ -44,11 +47,14 @@ class GridNetPluginDeclaration { public: virtual void get_options (std::vector < std::pair > &options) const; +#if defined(HAVE_QT) virtual lay::ConfigPage *config_page (QWidget *parent, std::string &title) const; +#endif virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const; }; -class GridNetConfigPage +#if defined(HAVE_QT) // @@@ +class GridNetConfigPage : public lay::ConfigPage { Q_OBJECT @@ -67,6 +73,7 @@ private: lay::ColorButton *mp_grid_axis_color_cbtn; lay::ColorButton *mp_grid_ruler_color_cbtn; }; +#endif class GridNet : public lay::BackgroundViewObject, @@ -95,10 +102,10 @@ private: bool m_visible; bool m_show_ruler; double m_grid; - QColor m_color; - QColor m_grid_color; - QColor m_axis_color; - QColor m_ruler_color; + lay::Color m_color; + lay::Color m_grid_color; + lay::Color m_axis_color; + lay::Color m_ruler_color; GridStyle m_style0; GridStyle m_style1; GridStyle m_style2; diff --git a/src/laybasic/laybasic/layLayerProperties.cc b/src/laybasic/laybasic/layLayerProperties.cc index a6cdd3726..75aed4563 100644 --- a/src/laybasic/laybasic/layLayerProperties.cc +++ b/src/laybasic/laybasic/layLayerProperties.cc @@ -439,7 +439,7 @@ public: void execute (const tl::ExpressionParserContext &context, tl::Variant &out, const std::vector &vv) const { if (vv.size () != 0) { - throw tl::EvalError (tl::to_string (QObject::tr ("Layer source function must not have arguments")), context); + throw tl::EvalError (tl::to_string (tr ("Layer source function must not have arguments")), context); } out = tl::Variant (); diff --git a/src/laybasic/laybasic/layLayoutCanvas.cc b/src/laybasic/laybasic/layLayoutCanvas.cc index 6e60f4a2f..e13a125fb 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.cc +++ b/src/laybasic/laybasic/layLayoutCanvas.cc @@ -20,14 +20,15 @@ */ - -#include -#include -#include -#include -#include -#include -#include +#if defined(HAVE_QT) +# include +# include +# include +# include +# include +# include +# include +#endif #include "tlTimer.h" #include "tlLog.h" @@ -36,9 +37,13 @@ #include "layRedrawThread.h" #include "layLayoutView.h" #include "layMarker.h" -#include "gtf.h" +#if defined(HAVE_QT) // @@@ +# include "gtf.h" +#endif +#if defined(HAVE_QT) // @@@ #include "layBitmapsToImage.h" +#endif #include #include @@ -131,6 +136,7 @@ std::string ImageCacheEntry::to_string () const // ---------------------------------------------------------------------------- +#if defined(HAVE_QT) // @@@ static void blowup (const QImage &src, QImage &dest, unsigned int os) { @@ -273,7 +279,9 @@ invert (unsigned char *data, unsigned int width, unsigned int height) } } } +#endif +#if defined(HAVE_QT) // @@@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const char *name) : lay::ViewObjectWidget (parent, name), mp_view (view), @@ -288,6 +296,22 @@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const ch m_do_update_image_dm (this, &LayoutCanvas::do_update_image), m_do_end_of_drawing_dm (this, &LayoutCanvas::do_end_of_drawing), m_image_cache_size (1) +#else +LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view) + : lay::ViewObjectWidget (), + mp_view (view), +// @@@ mp_image (0), mp_image_bg (0), mp_pixmap (0), + m_background (0), m_foreground (0), m_active (0), + m_oversampling (1), + m_dpr (1), + m_need_redraw (false), + m_redraw_clearing (false), + m_redraw_force_update (true), + m_update_image (true), + m_do_update_image_dm (this, &LayoutCanvas::do_update_image), + m_do_end_of_drawing_dm (this, &LayoutCanvas::do_end_of_drawing), + m_image_cache_size (1) +#endif { #if QT_VERSION > 0x050000 m_dpr = devicePixelRatio (); @@ -302,11 +326,13 @@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const ch mp_redraw_thread = new lay::RedrawThread (this, view); +#if defined(HAVE_QT) // @@@ setBackgroundRole (QPalette::NoRole); set_colors (lay::Color (palette ().color (QPalette::Normal, QPalette::Window).rgb ()), lay::Color (palette ().color (QPalette::Normal, QPalette::Text).rgb ()), lay::Color (palette ().color (QPalette::Normal, QPalette::Mid).rgb ())); setAttribute (Qt::WA_NoSystemBackground); +#endif } LayoutCanvas::~LayoutCanvas () @@ -314,6 +340,7 @@ LayoutCanvas::~LayoutCanvas () // Detach all listeners so we don't trigger events in the destructor viewport_changed_event.clear (); +#if defined(HAVE_QT) // @@@ if (mp_image) { delete mp_image; mp_image = 0; @@ -326,6 +353,7 @@ LayoutCanvas::~LayoutCanvas () delete mp_pixmap; mp_pixmap = 0; } +#endif if (mp_redraw_thread) { delete mp_redraw_thread; mp_redraw_thread = 0; @@ -337,6 +365,7 @@ LayoutCanvas::~LayoutCanvas () void LayoutCanvas::key_event (unsigned int key, unsigned int buttons) { +#if defined(HAVE_QT) // @@@ if (! (buttons & lay::ShiftButton)) { if (int (key) == Qt::Key_Down) { emit down_arrow_key_pressed (); @@ -358,6 +387,7 @@ LayoutCanvas::key_event (unsigned int key, unsigned int buttons) emit right_arrow_key_pressed_with_shift (); } } +#endif } void @@ -385,10 +415,12 @@ LayoutCanvas::set_colors (lay::Color background, lay::Color foreground, lay::Col m_active = active.rgb (); // force regeneration of background image .. +#if defined(HAVE_QT) // @@@ if (mp_image_bg) { delete mp_image_bg; } mp_image_bg = 0; +#endif update_image (); } @@ -427,6 +459,7 @@ LayoutCanvas::prepare_drawing () BitmapViewObjectCanvas::set_size (m_viewport_l.width (), m_viewport_l.height (), 1.0 / double (m_oversampling * m_dpr)); +#if defined(HAVE_QT) // @@@ if (! mp_image || (unsigned int) mp_image->width () != m_viewport_l.width () || (unsigned int) mp_image->height () != m_viewport_l.height ()) { @@ -444,6 +477,7 @@ LayoutCanvas::prepare_drawing () } mp_image->fill (m_background); +#endif // Cancel any pending "finish" event so there is no race between finish and restart (important for caching) m_do_end_of_drawing_dm.cancel (); @@ -546,12 +580,15 @@ LayoutCanvas::update_image () void LayoutCanvas::free_resources () { +#if defined(HAVE_QT) // @@@ if (mp_pixmap) { delete mp_pixmap; mp_pixmap = 0; } +#endif } +#if defined(HAVE_QT) // @@@ void LayoutCanvas::paintEvent (QPaintEvent *) { @@ -692,7 +729,9 @@ LayoutCanvas::paintEvent (QPaintEvent *) } } +#endif +#if defined(HAVE_QT) // @@@ class DetachedViewObjectCanvas : public BitmapViewObjectCanvas { @@ -769,14 +808,18 @@ private: QImage *mp_image_l; double m_gamma; }; +#endif +#if defined(HAVE_QT) // @@@ QImage LayoutCanvas::image (unsigned int width, unsigned int height) { return image_with_options (width, height, -1, -1, -1.0, lay::Color (), lay::Color (), lay::Color (), db::DBox (), false); } +#endif -QImage +#if defined(HAVE_QT) // @@@ +QImage LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool is_mono) { if (oversampling <= 0) { @@ -866,8 +909,10 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l return img; } +#endif -QImage +#if defined(HAVE_QT) // @@@ +QImage LayoutCanvas::screenshot () { // if required, start the redraw thread .. @@ -896,7 +941,9 @@ LayoutCanvas::screenshot () return img; } +#endif +#if defined(HAVE_QT) void LayoutCanvas::resizeEvent (QResizeEvent *) { @@ -910,6 +957,7 @@ LayoutCanvas::resizeEvent (QResizeEvent *) do_redraw_all (true); viewport_changed_event (); } +#endif void LayoutCanvas::update_viewport () @@ -979,6 +1027,7 @@ LayoutCanvas::do_update_image () update_image (); } +#if defined(HAVE_QT) // @@@ bool LayoutCanvas::event (QEvent *e) { @@ -997,6 +1046,7 @@ LayoutCanvas::event (QEvent *e) return QWidget::event (e); } } +#endif void LayoutCanvas::redraw_all () diff --git a/src/laybasic/laybasic/layLayoutCanvas.h b/src/laybasic/laybasic/layLayoutCanvas.h index de403bc88..c4a8fb8c4 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.h +++ b/src/laybasic/laybasic/layLayoutCanvas.h @@ -29,8 +29,6 @@ #include #include -#include - #include "dbTrans.h" #include "dbBox.h" #include "layViewport.h" @@ -43,6 +41,7 @@ #include "layRedrawThreadCanvas.h" #include "layRedrawLayerInfo.h" #include "tlDeferredExecution.h" +#include "tlThreads.h" namespace lay { @@ -146,7 +145,7 @@ public: #if defined(HAVE_QT) LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const char *name = "canvas"); #else - LayoutCanvas (lay::LayoutViewBase *view, const char *name = "canvas"); + LayoutCanvas (lay::LayoutViewBase *view); #endif ~LayoutCanvas (); @@ -171,9 +170,11 @@ public: return m_view_ops; } +#if defined(HAVE_QT) // @@@ QImage screenshot (); QImage image (unsigned int width, unsigned int height); QImage image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active_color, const db::DBox &target_box, bool monochrome); +#endif void update_image (); @@ -315,6 +316,7 @@ public: return lay::Color (m_active); } +#if defined(HAVE_QT) // @@@ /** * @brief Reimplementation of ViewObjectCanvas: background image */ @@ -322,6 +324,7 @@ public: { return *mp_image; } +#endif /** * @brief Reimplementation of RedrawThreadCanvas: signal end of drawing @@ -359,9 +362,11 @@ public: private: lay::LayoutViewBase *mp_view; +#if defined(HAVE_QT) // @@@ QImage *mp_image; QImage *mp_image_bg; QPixmap *mp_pixmap; +#endif db::DBox m_precious_box; lay::Viewport m_viewport, m_viewport_l; lay::color_t m_background; @@ -388,11 +393,13 @@ private: std::vector m_image_cache; size_t m_image_cache_size; - QMutex m_mutex; + tl::Mutex m_mutex; +#if defined(HAVE_QT) virtual void paintEvent (QPaintEvent *); virtual void resizeEvent (QResizeEvent *); virtual bool event (QEvent *e); +#endif virtual void key_event (unsigned int key, unsigned int buttons); // implementation of the lay::Drawings interface diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index d9b0014d9..438a72bdf 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -20,6 +20,7 @@ */ +#if defined(HAVE_QT) #include #include @@ -1107,3 +1108,26 @@ LayoutView::sizeHint () const } } // namespace lay + +#else // defined(HAVE_QT) + +#include "layLayoutView.h" + +namespace lay +{ + +LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) + : LayoutViewBase (mgr, editable, plugin_parent, options) +{ + // .. nothing yet .. +} + +LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) + : LayoutViewBase (source, mgr, editable, plugin_parent, options) +{ + // .. nothing yet .. +} + +} // namespace lay + +#endif diff --git a/src/laybasic/laybasic/layLayoutView.h b/src/laybasic/laybasic/layLayoutView.h index 1594dfd08..d47a22e89 100644 --- a/src/laybasic/laybasic/layLayoutView.h +++ b/src/laybasic/laybasic/layLayoutView.h @@ -26,6 +26,8 @@ #include "laybasicCommon.h" +#if defined(HAVE_QT) + #include #include #include @@ -764,4 +766,36 @@ protected: } +#else // defined(HAVE_QT) + +#include "layLayoutViewBase.h" + +namespace lay +{ + +/** + * @brief The layout view object + * + * The layout view is responsible for displaying one or a set of layouts. + * It manages the layer display list and many other components. + */ +class LAYBASIC_PUBLIC LayoutView + : public LayoutViewBase +{ +public: + /** + * @brief Constructor + */ + LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); + + /** + * @brief Constructor (clone from another view) + */ + LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); +}; + +} + +#endif + #endif diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index ab539b49f..233414df7 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -25,6 +25,8 @@ #include #include +#include "laybasicConfig.h" + #include "tlInternational.h" #include "tlExpression.h" #include "tlTimer.h" @@ -35,7 +37,6 @@ #include "layLayoutViewBase.h" #include "layViewOp.h" #include "layViewObject.h" -#include "laybasicConfig.h" #include "layConverters.h" #include "layGridNet.h" #include "layMove.h" @@ -45,30 +46,19 @@ #include "layFixedFont.h" #include "laySelector.h" #include "layLayoutCanvas.h" -#include "layLayerControlPanel.h" -#include "layHierarchyControlPanel.h" -#include "layLibrariesView.h" -#include "layBrowser.h" #include "layRedrawThread.h" #include "layRedrawThreadWorker.h" #include "layParsedLayerSource.h" -#include "layBookmarkManagementForm.h" -#include "layNetlistBrowserDialog.h" -#include "layBookmarksView.h" -#include "layEditorOptionsFrame.h" -#include "layEditorOptionsPages.h" #include "dbClipboard.h" #include "dbLayout.h" #include "dbLayoutUtils.h" #include "dbManager.h" #include "dbLibrary.h" #include "rdb.h" -#include "rdbMarkerBrowserDialog.h" #include "dbLayoutToNetlist.h" #include "dbTechnology.h" #include "tlXMLParser.h" #include "gsi.h" -#include "gtf.h" #if defined(HAVE_QT) # include @@ -634,7 +624,7 @@ LayoutViewBase::title () const if (! m_title.empty ()) { return m_title; } else if (cellviews () == 0) { - return tl::to_string (QObject::tr ("")); + return tl::to_string (tr ("")); } else { int cv_index = active_cellview_index (); @@ -4836,7 +4826,7 @@ LayoutViewBase::paste_interactive () { clear_selection (); - std::unique_ptr trans (new db::Transaction (manager (), tl::to_string (QObject::tr ("Paste and move")))); + std::unique_ptr trans (new db::Transaction (manager (), tl::to_string (tr ("Paste and move")))); { // let the receivers sort out who is pasting what .. @@ -4872,7 +4862,7 @@ LayoutViewBase::cut () lay::Editables::transient_to_selection (); } - db::Transaction trans (manager (), tl::to_string (QObject::tr ("Cut"))); + db::Transaction trans (manager (), tl::to_string (tr ("Cut"))); lay::Editables::cut (); } diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 9b8d0d67c..0047975fc 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -34,7 +34,6 @@ #include #include "layLayerProperties.h" -#include "layAbstractMenu.h" #include "layAnnotationShapes.h" #include "layDispatcher.h" #include "layLayoutCanvas.h" diff --git a/src/laybasic/laybasic/layLineStylePalette.cc b/src/laybasic/laybasic/layLineStylePalette.cc index a6b56f6a8..ab8ec99de 100644 --- a/src/laybasic/laybasic/layLineStylePalette.cc +++ b/src/laybasic/laybasic/layLineStylePalette.cc @@ -149,16 +149,16 @@ LineStylePalette::from_string (const std::string &s) } 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 (styles () == 0) { - throw tl::Exception (tl::to_string (QObject::tr ("invalid line style palette - no styles"))); + throw tl::Exception (tl::to_string (tr ("invalid line style palette - no styles"))); } } catch (std::exception &ex) { // reformat error message - throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Line style palette string format error: %s")), ex.what ())); + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Line style palette string format error: %s")), ex.what ())); } } diff --git a/src/laybasic/laybasic/layLineStyles.cc b/src/laybasic/laybasic/layLineStyles.cc index f31fcc1ab..c7c0e9adb 100644 --- a/src/laybasic/laybasic/layLineStyles.cc +++ b/src/laybasic/laybasic/layLineStyles.cc @@ -27,6 +27,7 @@ #include #include +#include namespace lay { @@ -162,6 +163,7 @@ LineStyleInfo::is_bit_set (unsigned int n) const return (pattern () [(n / 32) % pattern_stride ()] & (1 << (n % 32))) != 0; } +#if defined(HAVE_QT) // @@@ QBitmap LineStyleInfo::get_bitmap (int width, int height) const { @@ -196,6 +198,7 @@ LineStyleInfo::get_bitmap (int width, int height) const return bitmap; } +#endif void LineStyleInfo::set_pattern (uint32_t pt, unsigned int w) @@ -351,8 +354,11 @@ struct ReplaceLineStyleOp LineStyleInfo m_old, m_new; }; -LineStyles::LineStyles () - : QObject (), db::Object (0) +LineStyles::LineStyles () : +#if defined(HAVE_QT) + QObject (), +#endif + db::Object (0) { for (unsigned int d = 0; d < sizeof (style_strings) / sizeof (style_strings [0]); d += 2) { m_styles.push_back (LineStyleInfo ()); @@ -361,17 +367,20 @@ LineStyles::LineStyles () } } +LineStyles::LineStyles (const LineStyles &p) : +#if defined(HAVE_QT) + QObject (), +#endif + db::Object (0) +{ + m_styles = p.m_styles; +} + LineStyles::~LineStyles () { // .. nothing yet .. } -LineStyles::LineStyles (const LineStyles &p) - : QObject (), db::Object (0) -{ - m_styles = p.m_styles; -} - LineStyles & LineStyles::operator= (const LineStyles &p) { @@ -418,7 +427,9 @@ LineStyles::replace_style (unsigned int i, const LineStyleInfo &p) // if something has changed emit the signal if (chg) { +#if defined(HAVE_QT) // @@@ emit changed (); +#endif } } diff --git a/src/laybasic/laybasic/layMarker.cc b/src/laybasic/laybasic/layMarker.cc index 959f3601a..29f822673 100644 --- a/src/laybasic/laybasic/layMarker.cc +++ b/src/laybasic/laybasic/layMarker.cc @@ -37,7 +37,7 @@ namespace lay // ------------------------------------------------------------------------ -void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, const db::CplxTrans &tr, lay::Renderer &r, +void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, const db::CplxTrans &trans, lay::Renderer &r, unsigned int font, lay::CanvasPlane *fill, lay::CanvasPlane *contour, lay::CanvasPlane *vertex, lay::CanvasPlane *text, bool cell_name_text_transform, int min_size_for_label, bool draw_outline, size_t max_shapes) { @@ -83,29 +83,29 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, db::Vector av(a), bv(b); // fallback to simpler representation using a description text - db::CplxTrans tbox (tr * inst.complex_trans ()); + db::CplxTrans tbox (trans * inst.complex_trans ()); // one representative instance r.draw (cell_box, tbox, fill, contour, 0, text); - r.draw (cell_box, db::CplxTrans (tr * (av * long (amax - 1))) * tbox, fill, contour, 0, text); - r.draw (cell_box, db::CplxTrans (tr * (bv * long (bmax - 1))) * tbox, fill, contour, 0, text); - r.draw (cell_box, db::CplxTrans (tr * (av * long (amax - 1) + bv * long (bmax - 1))) * tbox, fill, contour, 0, text); + r.draw (cell_box, db::CplxTrans (trans * (av * long (amax - 1))) * tbox, fill, contour, 0, text); + r.draw (cell_box, db::CplxTrans (trans * (bv * long (bmax - 1))) * tbox, fill, contour, 0, text); + r.draw (cell_box, db::CplxTrans (trans * (av * long (amax - 1) + bv * long (bmax - 1))) * tbox, fill, contour, 0, text); db::DBox cb (tbox * cell_box); db::DPolygon p; db::DPoint points[] = { db::DPoint (cb.lower_left ()), - db::DPoint (cb.lower_left () + tr * (av * long (amax - 1))), - db::DPoint (cb.lower_left () + tr * (av * long (amax - 1) + bv * long (bmax - 1))), - db::DPoint (cb.lower_left () + tr * (bv * long (bmax - 1))), + db::DPoint (cb.lower_left () + trans * (av * long (amax - 1))), + db::DPoint (cb.lower_left () + trans * (av * long (amax - 1) + bv * long (bmax - 1))), + db::DPoint (cb.lower_left () + trans * (bv * long (bmax - 1))), }; p.assign_hull (points, points + sizeof (points) / sizeof (points[0])); r.draw (p, fill, contour, 0, text); if (text) { - db::DBox arr_box (db::DPoint (), db::DPoint () + tr * (av * long (amax - 1) + bv * long (bmax - 1))); + db::DBox arr_box (db::DPoint (), db::DPoint () + trans * (av * long (amax - 1) + bv * long (bmax - 1))); arr_box *= cb; - r.draw (arr_box, tl::sprintf (tl::to_string (QObject::tr ("Array %ldx%ld")), amax, bmax), db::Font (font), db::HAlignCenter, db::VAlignCenter, db::DFTrans (db::DFTrans::r0), 0, 0, 0, text); + r.draw (arr_box, tl::sprintf (tl::to_string (tr ("Array %ldx%ld")), amax, bmax), db::Font (font), db::HAlignCenter, db::VAlignCenter, db::DFTrans (db::DFTrans::r0), 0, 0, 0, text); } } else { @@ -113,7 +113,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, for (db::CellInstArray::iterator arr = inst.begin (); ! arr.at_end (); ++arr) { // fallback to simpler representation using a description text - db::CplxTrans tbox (tr * inst.complex_trans ()); + db::CplxTrans tbox (trans * inst.complex_trans ()); r.draw (cell_box, tbox, fill, contour, 0, 0); @@ -149,7 +149,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, while (! shapes.at_end ()) { for (db::CellInstArray::iterator arr = inst.begin (); ! arr.at_end (); ++arr) { - r.draw (*shapes, tr * inst.complex_trans (*arr) * shapes.trans (), fill, contour, 0 /*use vertex for origin*/, text); + r.draw (*shapes, trans * inst.complex_trans (*arr) * shapes.trans (), fill, contour, 0 /*use vertex for origin*/, text); } ++shapes; @@ -167,7 +167,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, while (! shapes.at_end ()) { for (db::CellInstArray::iterator arr = inst.begin (); ! arr.at_end (); ++arr) { - r.draw (*shapes, tr * inst.complex_trans (*arr) * shapes.trans (), fill, contour, 0 /*use vertex for origin*/, text); + r.draw (*shapes, trans * inst.complex_trans (*arr) * shapes.trans (), fill, contour, 0 /*use vertex for origin*/, text); } ++shapes; @@ -179,7 +179,7 @@ void render_cell_inst (const db::Layout &layout, const db::CellInstArray &inst, if (render_origins && vertex) { for (db::CellInstArray::iterator arr = inst.begin (); ! arr.at_end (); ++arr) { - db::DPoint dp = db::DPoint () + (tr * inst.complex_trans (*arr)).disp (); + db::DPoint dp = db::DPoint () + (trans * inst.complex_trans (*arr)).disp (); r.draw (db::DEdge (dp, dp), 0, 0, vertex, 0); } diff --git a/src/laybasic/laybasic/layMove.cc b/src/laybasic/laybasic/layMove.cc index 9e6102f39..9667ccb77 100644 --- a/src/laybasic/laybasic/layMove.cc +++ b/src/laybasic/laybasic/layMove.cc @@ -89,6 +89,7 @@ bool MoveService::key_event (unsigned int key, unsigned int /*buttons*/) { double dx = 0.0, dy = 0.0; +#if defined(HAVE_QT) // @@@ if (int (key) == Qt::Key_Down) { dy = -1.0; } else if (int (key) == Qt::Key_Up) { @@ -98,6 +99,7 @@ MoveService::key_event (unsigned int key, unsigned int /*buttons*/) } else if (int (key) == Qt::Key_Right) { dx = 1.0; } +#endif if (! m_dragging && fabs (dx + dy) > 0.0 && mp_editables->has_selection ()) { diff --git a/src/laybasic/laybasic/layNetColorizer.cc b/src/laybasic/laybasic/layNetColorizer.cc new file mode 100644 index 000000000..46639fa40 --- /dev/null +++ b/src/laybasic/laybasic/layNetColorizer.cc @@ -0,0 +1,153 @@ + +/* + + 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 "layNetColorizer.h" +#include "dbNet.h" +#include "dbCircuit.h" + +namespace lay +{ + +// ---------------------------------------------------------------------------------- +// NetColorizer implementation + +NetColorizer::NetColorizer () +{ + m_auto_colors_enabled = false; + m_update_needed = false; + m_signals_enabled = true; +} + +void +NetColorizer::configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors) +{ + m_marker_color = marker_color; + if (auto_colors) { + m_auto_colors = *auto_colors; + m_auto_colors_enabled = true; + } else { + m_auto_colors_enabled = false; + } + + emit_colors_changed (); +} + +bool +NetColorizer::has_color_for_net (const db::Net *net) +{ + return net != 0 && (m_auto_colors_enabled || m_custom_color.find (net) != m_custom_color.end ()); +} + +void +NetColorizer::set_color_of_net (const db::Net *net, const lay::Color &color) +{ + m_custom_color[net] = color; + emit_colors_changed (); +} + +void +NetColorizer::reset_color_of_net (const db::Net *net) +{ + m_custom_color.erase (net); + emit_colors_changed (); +} + +void +NetColorizer::clear () +{ + m_net_index_by_object.clear (); + m_custom_color.clear (); + emit_colors_changed (); +} + +void +NetColorizer::begin_changes () +{ + if (m_signals_enabled) { + m_update_needed = false; + m_signals_enabled = false; + } +} + +void +NetColorizer::end_changes () +{ + if (! m_signals_enabled) { + m_signals_enabled = true; + if (m_update_needed) { + colors_changed (); + } + m_update_needed = false; + } +} + +void +NetColorizer::emit_colors_changed () +{ + if (! m_signals_enabled) { + m_update_needed = true; + } else { + colors_changed (); + } +} + +lay::Color +NetColorizer::color_of_net (const db::Net *net) const +{ + if (! net) { + return lay::Color (); + } + + std::map::const_iterator c = m_custom_color.find (net); + if (c != m_custom_color.end ()) { + return c->second; + } + + if (m_auto_colors_enabled) { + + const db::Circuit *circuit = net->circuit (); + + size_t index = 0; + + std::map::iterator cc = m_net_index_by_object.find (net); + if (cc == m_net_index_by_object.end ()) { + + size_t i = 0; + for (db::Circuit::const_net_iterator n = circuit->begin_nets (); n != circuit->end_nets (); ++n, ++i) { + m_net_index_by_object.insert (std::make_pair (n.operator-> (), i)); + if (n.operator-> () == net) { + index = i; + } + } + + } else { + index = cc->second; + } + + return m_auto_colors.color_by_index ((unsigned int) index); + + } else { + return lay::Color (); + } +} + +} diff --git a/src/laybasic/laybasic/layNetColorizer.h b/src/laybasic/laybasic/layNetColorizer.h new file mode 100644 index 000000000..489a4ed7b --- /dev/null +++ b/src/laybasic/laybasic/layNetColorizer.h @@ -0,0 +1,85 @@ + +/* + + 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_layNetColorizer +#define HDR_layNetColorizer + +#include "laybasicCommon.h" +#include "layColorPalette.h" +#include "layColor.h" +#include "tlEvents.h" + +#include +#include + +namespace db +{ + class Net; +} + +namespace lay +{ + +// ---------------------------------------------------------------------------------- +// NetColorizer definition + +class LAYBASIC_PUBLIC NetColorizer + : public tl::Object +{ +public: + NetColorizer (); + + void configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors); + bool has_color_for_net (const db::Net *net); + void set_color_of_net (const db::Net *net, const lay::Color &color); + void reset_color_of_net (const db::Net *net); + void clear (); + + lay::Color color_of_net (const db::Net *net) const; + + const lay::Color &marker_color () const + { + return m_marker_color; + } + + void begin_changes (); + void end_changes (); + + tl::Event colors_changed; + +private: + lay::Color m_marker_color; + lay::ColorPalette m_auto_colors; + bool m_auto_colors_enabled; + std::map m_custom_color; + bool m_update_needed; + bool m_signals_enabled; + mutable std::map m_net_index_by_object; + + void emit_colors_changed (); +}; + +} // namespace lay + +#endif + diff --git a/src/laybasic/laybasic/layNetlistBrowserModel.cc b/src/laybasic/laybasic/layNetlistBrowserModel.cc index 82e5f05a4..8ed6a964b 100644 --- a/src/laybasic/laybasic/layNetlistBrowserModel.cc +++ b/src/laybasic/laybasic/layNetlistBrowserModel.cc @@ -100,129 +100,6 @@ NetlistObjectsPath::second () const return p; } -// ---------------------------------------------------------------------------------- -// NetColorizer implementation - -NetColorizer::NetColorizer () -{ - m_auto_colors_enabled = false; - m_update_needed = false; - m_signals_enabled = true; -} - -void -NetColorizer::configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors) -{ - m_marker_color = marker_color; - if (auto_colors) { - m_auto_colors = *auto_colors; - m_auto_colors_enabled = true; - } else { - m_auto_colors_enabled = false; - } - - emit_colors_changed (); -} - -bool -NetColorizer::has_color_for_net (const db::Net *net) -{ - return net != 0 && (m_auto_colors_enabled || m_custom_color.find (net) != m_custom_color.end ()); -} - -void -NetColorizer::set_color_of_net (const db::Net *net, const lay::Color &color) -{ - m_custom_color[net] = color; - emit_colors_changed (); -} - -void -NetColorizer::reset_color_of_net (const db::Net *net) -{ - m_custom_color.erase (net); - emit_colors_changed (); -} - -void -NetColorizer::clear () -{ - m_net_index_by_object.clear (); - m_custom_color.clear (); - emit_colors_changed (); -} - -void -NetColorizer::begin_changes () -{ - if (m_signals_enabled) { - m_update_needed = false; - m_signals_enabled = false; - } -} - -void -NetColorizer::end_changes () -{ - if (! m_signals_enabled) { - m_signals_enabled = true; - if (m_update_needed) { - emit colors_changed (); - } - m_update_needed = false; - } -} - -void -NetColorizer::emit_colors_changed () -{ - if (! m_signals_enabled) { - m_update_needed = true; - } else { - emit colors_changed (); - } -} - -lay::Color -NetColorizer::color_of_net (const db::Net *net) const -{ - if (! net) { - return lay::Color (); - } - - std::map::const_iterator c = m_custom_color.find (net); - if (c != m_custom_color.end ()) { - return c->second; - } - - if (m_auto_colors_enabled) { - - const db::Circuit *circuit = net->circuit (); - - size_t index = 0; - - std::map::iterator cc = m_net_index_by_object.find (net); - if (cc == m_net_index_by_object.end ()) { - - size_t i = 0; - for (db::Circuit::const_net_iterator n = circuit->begin_nets (); n != circuit->end_nets (); ++n, ++i) { - m_net_index_by_object.insert (std::make_pair (n.operator-> (), i)); - if (n.operator-> () == net) { - index = i; - } - } - - } else { - index = cc->second; - } - - return m_auto_colors.color_by_index ((unsigned int) index); - - } else { - return lay::Color (); - } -} - // ---------------------------------------------------------------------------------- // Implementation of the item classes diff --git a/src/laybasic/laybasic/layNetlistBrowserModel.h b/src/laybasic/laybasic/layNetlistBrowserModel.h index b18c4bbe7..3028792bc 100644 --- a/src/laybasic/laybasic/layNetlistBrowserModel.h +++ b/src/laybasic/laybasic/layNetlistBrowserModel.h @@ -30,6 +30,7 @@ #include "dbLayoutToNetlist.h" #include "dbLayoutVsSchematic.h" +#include "layNetColorizer.h" #include "tlList.h" #include "tlTypeTraits.h" @@ -46,48 +47,6 @@ namespace lay class IndexedNetlistModel; -// ---------------------------------------------------------------------------------- -// NetColorizer definition - -class LAYBASIC_PUBLIC NetColorizer - : public QObject -{ -Q_OBJECT - -public: - NetColorizer (); - - void configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors); - bool has_color_for_net (const db::Net *net); - void set_color_of_net (const db::Net *net, const Color &color); - void reset_color_of_net (const db::Net *net); - void clear (); - - lay::Color color_of_net (const db::Net *net) const; - - const lay::Color &marker_color () const - { - return m_marker_color; - } - - void begin_changes (); - void end_changes (); - -signals: - void colors_changed (); - -private: - lay::Color m_marker_color; - lay::ColorPalette m_auto_colors; - bool m_auto_colors_enabled; - std::map m_custom_color; - bool m_update_needed; - bool m_signals_enabled; - mutable std::map m_net_index_by_object; - - void emit_colors_changed (); -}; - // ---------------------------------------------------------------------------------- // NetlistBrowserModel definition diff --git a/src/laybasic/laybasic/layObjectInstPath.h b/src/laybasic/laybasic/layObjectInstPath.h index 91d3ef681..13c4ca095 100644 --- a/src/laybasic/laybasic/layObjectInstPath.h +++ b/src/laybasic/laybasic/layObjectInstPath.h @@ -31,8 +31,6 @@ #include #include -#include - #include "dbInstElement.h" #include "dbClipboardData.h" #include "dbClipboard.h" diff --git a/src/laybasic/laybasic/layParsedLayerSource.cc b/src/laybasic/laybasic/layParsedLayerSource.cc index 5e7dee250..66130f12f 100644 --- a/src/laybasic/laybasic/layParsedLayerSource.cc +++ b/src/laybasic/laybasic/layParsedLayerSource.cc @@ -415,7 +415,7 @@ extract_base (tl::Extractor &ex) } else if (ex.test ("!=")) { eq = false; } else { - ex.error (tl::to_string (QObject::tr ("'==' or '!=' operator expected"))); + ex.error (tl::to_string (tr ("'==' or '!=' operator expected"))); } ex.read (v); return new PropertySelectorEqual (n, v, eq); @@ -1376,7 +1376,7 @@ ParsedLayerSource::parse_from_string (const char *cp) if (sp == "CellFrame" || sp == "cellframe" || sp == "CF" || sp == "cell-frame") { m_special_purpose = SP_CellFrame; } else { - throw tl::Exception (tl::to_string (QObject::tr ("Invalid special purpose '%s'")), sp); + throw tl::Exception (tl::to_string (tr ("Invalid special purpose '%s'")), sp); } } else if (x.test ("(")) { diff --git a/src/laybasic/laybasic/layPlugin.cc b/src/laybasic/laybasic/layPlugin.cc index 15685bf13..0cea0604a 100644 --- a/src/laybasic/laybasic/layPlugin.cc +++ b/src/laybasic/laybasic/layPlugin.cc @@ -33,12 +33,13 @@ #include "tlExceptions.h" #include "tlClassRegistry.h" +#if defined(HAVE_QT) #include "gtf.h" +#endif #include #include #include -#include namespace lay { @@ -93,6 +94,7 @@ PluginDeclaration::menu_symbols () return symbols; } +#if defined(HAVE_QT) namespace { class GenericMenuAction @@ -142,10 +144,12 @@ private: }; } +#endif void PluginDeclaration::init_menu (lay::Dispatcher *dispatcher) { +#if defined(HAVE_QT) // @@@ lay::AbstractMenu &menu = *dispatcher->menu (); mp_editable_mode_action.reset ((Action *) 0); @@ -255,11 +259,13 @@ PluginDeclaration::init_menu (lay::Dispatcher *dispatcher) menu.insert_item (m->second.first, name + ":mode_group", mp_mouse_mode_action.get ()); } +#endif } void PluginDeclaration::remove_menu_items (Dispatcher *dispatcher) { +#if defined(HAVE_QT) // @@@ lay::AbstractMenu *menu = dispatcher->menu (); menu->delete_items (mp_editable_mode_action.get ()); menu->delete_items (mp_mouse_mode_action.get ()); @@ -274,6 +280,7 @@ PluginDeclaration::remove_menu_items (Dispatcher *dispatcher) menu->delete_items (*a); } m_menu_actions.clear (); +#endif } void @@ -281,9 +288,11 @@ PluginDeclaration::set_editable_enabled (bool f) { if (f != m_editable_enabled) { m_editable_enabled = f; +#if defined(HAVE_QT) // @@@ if (mp_editable_mode_action.get ()) { mp_editable_mode_action->set_checked (f); } +#endif editable_enabled_changed_event (); } } @@ -358,7 +367,7 @@ Plugin::config_set (const std::string &name, const std::string &value) return; } } catch (tl::Exception &ex) { - tl::error << tl::to_string (QObject::tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg (); + tl::error << tl::to_string (tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg (); } } } @@ -481,7 +490,7 @@ Plugin::do_config_set (const std::string &name, const std::string &value, bool f return true; } } catch (tl::Exception &ex) { - tl::error << tl::to_string (QObject::tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg (); + tl::error << tl::to_string (tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg (); } // propagate to all children (not only the first that takes it!) diff --git a/src/laybasic/laybasic/layPlugin.h b/src/laybasic/laybasic/layPlugin.h index c03fae38e..4a0b57ff8 100644 --- a/src/laybasic/laybasic/layPlugin.h +++ b/src/laybasic/laybasic/layPlugin.h @@ -455,8 +455,10 @@ public: #if defined(HAVE_QT) private slots: - void toggle_editable_enabled (); +#else +private: #endif + void toggle_editable_enabled (); private: int m_id; diff --git a/src/laybasic/laybasic/layRedrawThread.cc b/src/laybasic/laybasic/layRedrawThread.cc index 25d1a24b3..478437441 100644 --- a/src/laybasic/laybasic/layRedrawThread.cc +++ b/src/laybasic/laybasic/layRedrawThread.cc @@ -21,9 +21,6 @@ */ -#include -#include - #include "layRedrawThread.h" #include "layRedrawThreadWorker.h" #include "tlLog.h" @@ -63,7 +60,7 @@ RedrawThread::~RedrawThread () void RedrawThread::layout_changed () { if (is_running () && tl::verbosity () >= 30) { - tl::info << tl::to_string (QObject::tr ("Layout changed: redraw thread stopped")); + tl::info << tl::to_string (tr ("Layout changed: redraw thread stopped")); } // if something changed on the layouts we observe, stop the redraw thread @@ -228,9 +225,9 @@ RedrawThread::do_start (bool clear, const db::Vector *shift_vector, const std::v { if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Preparing to draw")); + tl::info << tl::to_string (tr ("Preparing to draw")); } - tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (QObject::tr ("Preparing to draw"))); + tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Preparing to draw"))); // detach from all layout objects tl::Object::detach_from_all_events (); diff --git a/src/laybasic/laybasic/layRedrawThread.h b/src/laybasic/laybasic/layRedrawThread.h index 47ac943e2..4dc328aff 100644 --- a/src/laybasic/laybasic/layRedrawThread.h +++ b/src/laybasic/laybasic/layRedrawThread.h @@ -28,10 +28,6 @@ #include #include -#include -#include -#include - #include "dbBox.h" #include "dbTrans.h" #include "dbLayout.h" @@ -41,6 +37,7 @@ #include "layRedrawLayerInfo.h" #include "layCanvasPlane.h" #include "tlTimer.h" +#include "tlThreads.h" #include "tlThreadedWorkers.h" namespace lay { @@ -120,8 +117,8 @@ private: bool m_start_recursion_sentinel; tl::Clock m_clock; - QMutex m_initial_wait_lock; - QWaitCondition m_initial_wait_cond; + tl::Mutex m_initial_wait_lock; + tl::WaitCondition m_initial_wait_cond; std::unique_ptr m_main_timer; }; diff --git a/src/laybasic/laybasic/layRedrawThreadCanvas.cc b/src/laybasic/laybasic/layRedrawThreadCanvas.cc index b6d2964f4..e47eb19ab 100644 --- a/src/laybasic/laybasic/layRedrawThreadCanvas.cc +++ b/src/laybasic/laybasic/layRedrawThreadCanvas.cc @@ -23,11 +23,15 @@ #include "layRedrawThreadCanvas.h" #include "layCanvasPlane.h" +#if defined(HAVE_QT) #include "layBitmapsToImage.h" +#endif #include "layDrawing.h" #include "layBitmap.h" +#if defined(HAVE_QT) // @@@ #include +#endif namespace lay { @@ -393,6 +397,7 @@ BitmapRedrawThreadCanvas::initialize_plane (lay::CanvasPlane *plane, unsigned in unlock (); } +#if defined(HAVE_QT) // @@@ void BitmapRedrawThreadCanvas::to_image (const std::vector &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, lay::Color background, lay::Color foreground, lay::Color active, const lay::Drawings *drawings, QImage &img, unsigned int width, unsigned int height) { @@ -412,6 +417,7 @@ BitmapRedrawThreadCanvas::to_image (const std::vector &view_ops, c bitmaps_to_image (d->get_view_ops (*this, background, foreground, active), *bt, dp, ls, &img, width, height, true, &mutex ()); } } +#endif } diff --git a/src/laybasic/laybasic/layRedrawThreadCanvas.h b/src/laybasic/laybasic/layRedrawThreadCanvas.h index eb22d4717..b231aa557 100644 --- a/src/laybasic/laybasic/layRedrawThreadCanvas.h +++ b/src/laybasic/laybasic/layRedrawThreadCanvas.h @@ -29,13 +29,10 @@ #include "dbTrans.h" #include "layViewOp.h" #include "layBitmapRenderer.h" +#include "tlThreads.h" #include -#include - -class QImage; - namespace lay { class CanvasPlane; @@ -151,7 +148,7 @@ public: /** * @brief Access to the mutex object */ - QMutex &mutex () + tl::Mutex &mutex () { return m_mutex; } @@ -186,7 +183,7 @@ public: virtual lay::Renderer *create_renderer () = 0; private: - QMutex m_mutex; + tl::Mutex m_mutex; double m_resolution; unsigned int m_width, m_height; }; @@ -318,10 +315,12 @@ public: return new lay::BitmapRenderer (m_width, m_height, resolution ()); } +#if defined(HAVE_QT) // @@@ /** * @brief Transfer the content to an QImage */ void to_image (const std::vector &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, lay::Color background, lay::Color foreground, lay::Color active, const lay::Drawings *drawings, QImage &img, unsigned int width, unsigned int height); +#endif /** * @brief Gets the current bitmap data as a BitmapCanvasData object diff --git a/src/laybasic/laybasic/layRedrawThreadWorker.cc b/src/laybasic/laybasic/layRedrawThreadWorker.cc index 661d61224..da0905be8 100644 --- a/src/laybasic/laybasic/layRedrawThreadWorker.cc +++ b/src/laybasic/laybasic/layRedrawThreadWorker.cc @@ -194,9 +194,9 @@ RedrawThreadWorker::perform_task (tl::Task *task) m_layer = li.layer_index; if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Drawing layer: ")) << mp_layout->get_properties (m_layer).name; + tl::info << tl::to_string (tr ("Drawing layer: ")) << mp_layout->get_properties (m_layer).name; } - tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (QObject::tr ("Drawing layer"))); + tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Drawing layer"))); // configure renderer .. mp_renderer->set_xfill (m_xfill); @@ -220,9 +220,9 @@ RedrawThreadWorker::perform_task (tl::Task *task) // if no specific layer is assigned, draw cell boxes with the style given if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Drawing custom frames")); + tl::info << tl::to_string (tr ("Drawing custom frames")); } - tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (QObject::tr ("Drawing frames"))); + tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Drawing frames"))); for (std::set< std::pair >::const_iterator b = m_box_variants.begin (); b != m_box_variants.end (); ++b) { if (b->second == li.cellview_index) { @@ -245,9 +245,9 @@ RedrawThreadWorker::perform_task (tl::Task *task) // draw the bounding boxes if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Drawing frames and guiding shapes")); + tl::info << tl::to_string (tr ("Drawing frames and guiding shapes")); } - tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (QObject::tr ("Drawing frames and guiding shapes"))); + tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Drawing frames and guiding shapes"))); // No xfill for cell boxes mp_renderer->set_xfill (false); @@ -416,9 +416,9 @@ RedrawThreadWorker::perform_task (tl::Task *task) // draw the decorations if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Drawing decorations")); + tl::info << tl::to_string (tr ("Drawing decorations")); } - tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (QObject::tr ("Drawing decorations"))); + tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Drawing decorations"))); m_buffers.clear (); mp_canvas->initialize_plane (m_planes[0], m_nlayers * planes_per_layer + special_planes_before); @@ -2172,7 +2172,7 @@ RedrawThreadWorker::iterate_variants (const std::vector &redraw_region m_from_level = fl; if (tl::verbosity () >= 40) { - tl::info << tl::to_string (QObject::tr ("Cell variant cache hits/misses: ")) << m_cache_hits << "/" << m_cache_misses; + tl::info << tl::to_string (tr ("Cell variant cache hits/misses: ")) << m_cache_hits << "/" << m_cache_misses; } } else { diff --git a/src/laybasic/laybasic/laySnap.cc b/src/laybasic/laybasic/laySnap.cc index 6c005d933..1243a7218 100644 --- a/src/laybasic/laybasic/laySnap.cc +++ b/src/laybasic/laybasic/laySnap.cc @@ -129,6 +129,7 @@ int draw_round (double x) } } +#if defined(HAVE_QT) QPoint draw_round (db::DPoint p, int h) { return QPoint (draw_round (p.x ()), h - 1 - draw_round (p.y ())); @@ -140,6 +141,7 @@ draw_round (const db::DPoint &p1, const db::DPoint &p2, int h) std::pair dp = draw_round_dbl (p1, p2, h); return std::make_pair (draw_round (dp.first, h), draw_round (dp.second, h)); } +#endif std::pair draw_round_dbl (const db::DPoint &p1, const db::DPoint &p2, int /*h*/) diff --git a/src/laybasic/laybasic/layStipplePalette.cc b/src/laybasic/laybasic/layStipplePalette.cc index 72e0898e2..b3f8e1469 100644 --- a/src/laybasic/laybasic/layStipplePalette.cc +++ b/src/laybasic/laybasic/layStipplePalette.cc @@ -205,16 +205,16 @@ StipplePalette::from_string (const std::string &s) } 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 (stipples () == 0 || standard_stipples () == 0) { - throw tl::Exception (tl::to_string (QObject::tr ("invalid palette - no stipples and/or standard stipples"))); + throw tl::Exception (tl::to_string (tr ("invalid palette - no stipples and/or standard stipples"))); } } catch (std::exception &ex) { // reformat error message - throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Stipple palette string format error: %s")), ex.what ())); + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Stipple palette string format error: %s")), ex.what ())); } } diff --git a/src/laybasic/laybasic/layViewObject.cc b/src/laybasic/laybasic/layViewObject.cc index 7a3ecb3a0..9f8ac62d8 100644 --- a/src/laybasic/laybasic/layViewObject.cc +++ b/src/laybasic/laybasic/layViewObject.cc @@ -20,12 +20,13 @@ */ - -#include -#include -#include -#include -#include +#if defined(HAVE_QT) +# include +# include +# include +# include +# include +#endif #include "layViewObject.h" #include "layCanvasPlane.h" @@ -51,6 +52,7 @@ const char *drag_drop_mime_type () return "application/klayout-ddd"; } +#if defined(HAVE_QT) // @@@ QMimeData * DragDropDataBase::to_mime_data () const { @@ -58,10 +60,12 @@ DragDropDataBase::to_mime_data () const mimeData->setData (QString::fromUtf8 (drag_drop_mime_type ()), serialized ()); return mimeData; } +#endif // --------------------------------------------------------------- // Implementation of CellDragDropData +#if defined(HAVE_QT) // @@@ QByteArray CellDragDropData::serialized () const { @@ -119,10 +123,12 @@ CellDragDropData::deserialize (const QByteArray &ba) } } +#endif // --------------------------------------------------------------- // A helper function to convert a Qt modifier/buttons to klayout buttons +#if defined(HAVE_QT) static unsigned int qt_to_buttons (Qt::MouseButtons b, Qt::KeyboardModifiers m) { @@ -139,6 +145,7 @@ qt_to_buttons (Qt::MouseButtons b, Qt::KeyboardModifiers m) ((m & Qt::ControlModifier) != 0 ? ControlButton : 0) | ((m & Qt::AltModifier) != 0 ? AltButton : 0); } +#endif // --------------------------------------------------------------- // BackgroundViewObject implementation @@ -225,7 +232,9 @@ ViewObject::redraw () if (m_static) { widget ()->touch (); } else { - widget ()->update (); +#if defined(HAVE_QT) + widget ()->update (); // @@@ +#endif } } } @@ -280,6 +289,7 @@ ViewService::set_cursor (lay::Cursor::cursor_shape cursor) // --------------------------------------------------------------- // ViewObject implementation +#if defined(HAVE_QT) // @@@ ViewObjectWidget::ViewObjectWidget (QWidget *parent, const char *name) : QWidget (parent), m_view_objects_dismissed (false), @@ -299,6 +309,22 @@ ViewObjectWidget::ViewObjectWidget (QWidget *parent, const char *name) m_objects.changed ().add (this, &ViewObjectWidget::objects_changed); } +#else +ViewObjectWidget::ViewObjectWidget () + : m_view_objects_dismissed (false), + m_needs_update_static (false), + m_needs_update_bg (false), + mp_active_service (0), + m_mouse_pressed_state (false), + m_mouse_buttons (0), + m_in_mouse_move (false), + m_mouse_inside (false), + m_cursor (lay::Cursor::none), + m_default_cursor (lay::Cursor::none) +{ + m_objects.changed ().add (this, &ViewObjectWidget::objects_changed); +} +#endif ViewObjectWidget::~ViewObjectWidget () { @@ -369,6 +395,7 @@ ViewObjectWidget::set_cursor (lay::Cursor::cursor_shape cursor) void ViewObjectWidget::set_default_cursor (lay::Cursor::cursor_shape cursor) { +#if defined(HAVE_QT) // @@@ if (cursor != m_default_cursor) { m_default_cursor = cursor; if (m_cursor == lay::Cursor::none) { @@ -379,14 +406,17 @@ ViewObjectWidget::set_default_cursor (lay::Cursor::cursor_shape cursor) } } } +#endif } void ViewObjectWidget::ensure_entered () { +#if defined(HAVE_QT) // @@@ if (! m_mouse_inside) { enterEvent (0); } +#endif } void @@ -398,6 +428,7 @@ ViewObjectWidget::begin_mouse_event (lay::Cursor::cursor_shape cursor) void ViewObjectWidget::end_mouse_event () { +#if defined(HAVE_QT) // @@@ if (m_cursor == lay::Cursor::none) { if (m_default_cursor == lay::Cursor::none) { unsetCursor (); @@ -407,8 +438,10 @@ ViewObjectWidget::end_mouse_event () } else if (m_cursor != lay::Cursor::keep) { setCursor (lay::Cursor::qcursor (m_cursor)); } +#endif } +#if defined(HAVE_QT) // @@@ bool ViewObjectWidget::focusNextPrevChild (bool /*next*/) { @@ -555,6 +588,7 @@ BEGIN_PROTECTED do_mouse_move (); END_PROTECTED } +#endif void ViewObjectWidget::do_mouse_move () @@ -637,7 +671,8 @@ ViewObjectWidget::do_mouse_move () m_in_mouse_move = false; } -void +#if defined(HAVE_QT) // @@@ +void ViewObjectWidget::mouseDoubleClickEvent (QMouseEvent *e) { BEGIN_PROTECTED @@ -883,17 +918,38 @@ END_PROTECTED m_mouse_pressed_state = false; } +#endif -db::DPoint -ViewObjectWidget::pixel_to_um (const QPoint &pt) const +int +ViewObjectWidget::widget_height () const { - return m_trans.inverted () * db::DPoint (pt.x (), height () - 1 - pt.y ()); +#if defined(HAVE_QT) + return height (); +#else + return 500; // @@@ +#endif +} + +int +ViewObjectWidget::widget_width () const +{ +#if defined(HAVE_QT) + return width (); +#else + return 800; // @@@ +#endif } db::DPoint -ViewObjectWidget::pixel_to_um (const QPointF &pt) const +ViewObjectWidget::pixel_to_um (const db::Point &pt) const { - return m_trans.inverted () * db::DPoint (pt.x (), height () - 1 - pt.y ()); + return m_trans.inverted () * db::DPoint (pt.x (), widget_height () - 1 - pt.y ()); +} + +db::DPoint +ViewObjectWidget::pixel_to_um (const db::DPoint &pt) const +{ + return m_trans.inverted () * db::DPoint (pt.x (), widget_height () - 1 - pt.y ()); } void @@ -1018,6 +1074,14 @@ ViewObjectWidget::thaw (ViewObject *obj) } } +#if !defined(HAVE_QT) +void +ViewObjectWidget::update () +{ + // @@@ +} +#endif + void ViewObjectWidget::touch () { @@ -1057,7 +1121,7 @@ db::DBox ViewObjectWidget::mouse_event_viewport () const { db::DPoint p1 = m_trans.inverted () * db::DPoint (0, 0); - db::DPoint p2 = m_trans.inverted () * db::DPoint (width (), height ()); + db::DPoint p2 = m_trans.inverted () * db::DPoint (widget_width (), widget_height ()); return db::DBox (p1, p2); } diff --git a/src/laybasic/laybasic/layViewObject.h b/src/laybasic/laybasic/layViewObject.h index f69ad4efc..fa0552136 100644 --- a/src/laybasic/laybasic/layViewObject.h +++ b/src/laybasic/laybasic/layViewObject.h @@ -32,10 +32,12 @@ #include #include -#include -#include -#include -#include +#if defined(HAVE_QT) +# include +# include +# include +# include +#endif #include "tlObjectCollection.h" #include "tlVariant.h" @@ -45,6 +47,7 @@ #include "layCursor.h" #include "layBitmapRenderer.h" +#if defined(HAVE_QT) class QMouseEvent; class QImage; class QDragEnterEvent; @@ -52,6 +55,7 @@ class QDragMoveEvent; class QDragLeaveEvent; class QDropEvent; class QMimeData; +#endif namespace db { @@ -89,6 +93,7 @@ public: */ virtual ~DragDropDataBase () { } +#if defined(HAVE_QT) // @@@ /** * @brief Serializes itself to an QByteArray */ @@ -105,6 +110,7 @@ public: * @brief Create a QMimeData object from the object */ QMimeData *to_mime_data () const; +#endif }; /** @@ -176,6 +182,7 @@ public: return m_is_pcell; } +#if defined(HAVE_QT) // @@@ /** * @brief Serializes itself to an QByteArray */ @@ -187,6 +194,7 @@ public: * Returns false, if deserialization failed. */ bool deserialize (const QByteArray &ba); +#endif private: const db::Layout *mp_layout; @@ -644,8 +652,10 @@ enum ButtonState { * painting. */ -class LAYBASIC_PUBLIC ViewObjectWidget - : public QWidget, +class LAYBASIC_PUBLIC ViewObjectWidget : +#if defined(HAVE_QT) + public QWidget, +#endif public tl::Object { public: @@ -657,7 +667,11 @@ public: /** * @brief ctor */ +#if defined(HAVE_QT) ViewObjectWidget (QWidget *view, const char *name); +#else + ViewObjectWidget (); +#endif /** * @brief dtor @@ -984,7 +998,7 @@ public: /** * @brief Gets the current mouse position */ - QPoint mouse_position () const + db::Point mouse_position () const { return m_mouse_pos; } @@ -1000,12 +1014,12 @@ public: /** * @brief Translates a screen coordinate in micrometer coordinates */ - db::DPoint pixel_to_um (const QPoint &pt) const; + db::DPoint pixel_to_um (const db::Point &pt) const; /** * @brief Translates a screen coordinate in micrometer coordinates */ - db::DPoint pixel_to_um (const QPointF &pt) const; + db::DPoint pixel_to_um (const db::DPoint &pt) const; /** * @brief Gets a flag indicating whether the mouse is inside the window @@ -1016,6 +1030,7 @@ public: } protected: +#if defined(HAVE_QT) /** * @brief Qt focus event handler */ @@ -1084,6 +1099,11 @@ protected: * @brief Qt mouse wheel event handler */ void wheelEvent (QWheelEvent *e); +#endif + +#if !defined(HAVE_QT) + void update (); +#endif /** * @brief Set the transformation for mouse events @@ -1104,8 +1124,8 @@ private: bool m_needs_update_bg; lay::ViewService *mp_active_service; db::DCplxTrans m_trans; - QPoint m_mouse_pos; - QPoint m_mouse_pressed; + db::Point m_mouse_pos; + db::Point m_mouse_pressed; bool m_mouse_pressed_state; unsigned int m_mouse_buttons; bool m_in_mouse_move; @@ -1117,6 +1137,8 @@ private: void begin_mouse_event (lay::Cursor::cursor_shape cursor = lay::Cursor::keep); void end_mouse_event (); void objects_changed (); + int widget_height () const; + int widget_width () const; /** * @brief Register a service @@ -1328,10 +1350,12 @@ public: */ void clear_fg_bitmaps (); +#if defined(HAVE_QT) // @@@ /** * @brief Return the background image */ virtual QImage &bg_image () = 0; +#endif /** * @brief Set the width and height and resolution diff --git a/src/laybasic/laybasic/laybasic.pro b/src/laybasic/laybasic/laybasic.pro index 6010e29b0..f2f707d15 100644 --- a/src/laybasic/laybasic/laybasic.pro +++ b/src/laybasic/laybasic/laybasic.pro @@ -93,7 +93,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY gtf.cc \ layAbstractMenu.cc \ layBackgroundAwareTreeStyle.cc \ - layBitmapRenderer.cc \ layBitmapsToImage.cc \ layBookmarkList.cc \ layBookmarkManagementForm.cc \ @@ -121,7 +120,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY layEditorServiceBase.cc \ layFileDialog.cc \ layGenericSyntaxHighlighter.cc \ - layGridNet.cc \ layHierarchyControlPanel.cc \ layIndexedNetlistModel.cc \ layItemDelegates.cc \ @@ -129,10 +127,8 @@ DEFINES += MAKE_LAYBASIC_LIBRARY layLayerMappingWidget.cc \ layLayerToolbox.cc \ layLayerTreeModel.cc \ - layLayoutCanvas.cc \ layLayoutPropertiesForm.cc \ layLayoutStatisticsForm.cc \ - layLayoutView.cc \ layLayoutViewConfigPages.cc \ layLayoutViewFunctions.cc \ layLibrariesView.cc \ @@ -154,6 +150,7 @@ DEFINES += MAKE_LAYBASIC_LIBRARY laySelectLineStyleForm.cc \ laySelectStippleForm.cc \ laySelector.cc \ + layStream.cc \ layTechnology.cc \ layTipDialog.cc \ layWidgets.cc \ @@ -168,7 +165,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY layAbstractMenu.h \ layBackgroundAwareTreeStyle.h \ layBitmap.h \ - layBitmapRenderer.h \ layBitmapsToImage.h \ layBookmarkList.h \ layBookmarkManagementForm.h \ @@ -197,7 +193,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY layEditorServiceBase.h \ layFileDialog.h \ layGenericSyntaxHighlighter.h \ - layGridNet.h \ layHierarchyControlPanel.h \ layIndexedNetlistModel.h \ layItemDelegates.h \ @@ -205,10 +200,8 @@ DEFINES += MAKE_LAYBASIC_LIBRARY layLayerMappingWidget.h \ layLayerToolbox.h \ layLayerTreeModel.h \ - layLayoutCanvas.h \ layLayoutPropertiesForm.h \ layLayoutStatisticsForm.h \ - layLayoutView.h \ layLayoutViewConfigPages.h \ layLayoutViewFunctions.h \ layLibrariesView.h \ @@ -230,6 +223,7 @@ DEFINES += MAKE_LAYBASIC_LIBRARY laySelectLineStyleForm.h \ laySelectStippleForm.h \ laySelector.h \ + layStream.h \ layTechnology.h \ layTipDialog.h \ layWidgets.h \ @@ -246,6 +240,7 @@ SOURCES += \ gsiDeclLayLayers.cc \ layAnnotationShapes.cc \ layBitmap.cc \ + layBitmapRenderer.cc \ layColor.cc \ layColorPalette.cc \ layDispatcher.cc \ @@ -254,12 +249,16 @@ SOURCES += \ layDrawing.cc \ layEditable.cc \ layFinder.cc \ + layGridNet.cc \ layFixedFont.cc \ + layLayoutCanvas.cc \ + layLayoutView.cc \ layLineStylePalette.cc \ layLineStyles.cc \ layMarker.cc \ layMouseTracker.cc \ layMove.cc \ + layNetColorizer.cc \ layObjectInstPath.cc \ layParsedLayerSource.cc \ layPlugin.cc \ @@ -271,7 +270,6 @@ SOURCES += \ layRubberBox.cc \ laySnap.cc \ layStipplePalette.cc \ - layStream.cc \ layCanvasPlane.cc \ layLayoutViewBase.cc \ layLayerProperties.cc \ @@ -282,20 +280,25 @@ SOURCES += \ HEADERS += \ layAnnotationShapes.h \ layBitmap.h \ + layBitmapRenderer.h \ layColorPalette.h \ layDispatcher.h \ layDisplayState.h \ layDitherPattern.h \ layDrawing.h \ layEditable.h \ + layLayoutCanvas.h \ + layLayoutView.h \ layFinder.h \ layFixedFont.h \ + layGridNet.h \ layLayoutViewBase.h \ layLineStylePalette.h \ layLineStyles.h \ layMarker.h \ layMouseTracker.h \ layMove.h \ + layNetColorizer.h \ layObjectInstPath.h \ layParsedLayerSource.h \ layPlugin.h \ @@ -307,7 +310,6 @@ HEADERS += \ layRubberBox.h \ laySnap.h \ layStipplePalette.h \ - layStream.h \ layLayerProperties.h \ layCanvasPlane.h \ layViewObject.h \ diff --git a/src/laybasic/unit_tests/layAbstractMenuTests.cc b/src/laybasic/unit_tests/layAbstractMenuTests.cc index 16b1ab1ff..3f6c67ada 100644 --- a/src/laybasic/unit_tests/layAbstractMenuTests.cc +++ b/src/laybasic/unit_tests/layAbstractMenuTests.cc @@ -20,6 +20,8 @@ */ +#if defined(HAVE_QT) + #include "layAbstractMenu.h" #include "tlUnitTest.h" @@ -184,3 +186,4 @@ TEST(3_ActionReferences) EXPECT_EQ (action.get () == 0, true); } +#endif diff --git a/src/laybasic/unit_tests/layBitmapsToImage.cc b/src/laybasic/unit_tests/layBitmapsToImage.cc index e38c1c0d0..120c3eafc 100644 --- a/src/laybasic/unit_tests/layBitmapsToImage.cc +++ b/src/laybasic/unit_tests/layBitmapsToImage.cc @@ -20,7 +20,7 @@ */ - +#if defined(HAVE_QT) // @@@ #include "layBitmapsToImage.h" #include "layBitmap.h" #include "layDitherPattern.h" @@ -940,3 +940,4 @@ TEST(1) } +#endif diff --git a/src/laybasic/unit_tests/layNetlistBrowserTreeModelTests.cc b/src/laybasic/unit_tests/layNetlistBrowserTreeModelTests.cc index b6dff3fbd..f87df3f2f 100644 --- a/src/laybasic/unit_tests/layNetlistBrowserTreeModelTests.cc +++ b/src/laybasic/unit_tests/layNetlistBrowserTreeModelTests.cc @@ -20,6 +20,8 @@ */ +#if defined(HAVE_QT) // @@@ + #include "layNetlistBrowserTreeModel.h" #include "tlUnitTest.h" @@ -103,3 +105,5 @@ TEST (2) EXPECT_EQ (model->parent (model->index (1, 0, inv2PairIndex)).isValid (), true); EXPECT_EQ (model->parent (model->index (1, 0, inv2PairIndex)).internalId () == inv2PairIndex.internalId (), true); } + +#endif