diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index 7fe8733ce..5c6db1ec2 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -759,9 +759,9 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas) int basic_width = int(0.5 + 1.0 / canvas.resolution ()); - QColor c (mp_rulers->color ()); - if (! c.isValid ()) { - c = QColor (canvas.foreground_color ().rgb ()); + lay::Color c (mp_rulers->color ()); + if (! c.is_valid ()) { + c = canvas.foreground_color (); } // obtain bitmap to render on @@ -819,7 +819,7 @@ Service::configure (const std::string &name, const std::string &value) if (name == cfg_ruler_color) { - QColor color; + lay::Color color; lay::ColorConverter ().from_string (value, color); // make the color available for the dynamic view objects too. @@ -910,7 +910,7 @@ Service::annotations_changed () } std::vector -Service::get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColor foreground, QColor /*active*/) const +Service::get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color /*active*/) const { int basic_width = int(0.5 + 1.0 / canvas.resolution ()); @@ -920,7 +920,7 @@ Service::get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColo if (m_halo) { view_ops.push_back (lay::ViewOp (background.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, 3 * basic_width, 0)); } - if (m_color.isValid ()) { + if (m_color.is_valid ()) { view_ops.push_back (lay::ViewOp (m_color.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, basic_width, 0)); } else { view_ops.push_back (lay::ViewOp (foreground.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, basic_width, 0)); diff --git a/src/ant/ant/antService.h b/src/ant/ant/antService.h index 2856ba067..9b53cbe03 100644 --- a/src/ant/ant/antService.h +++ b/src/ant/ant/antService.h @@ -387,7 +387,7 @@ public: /** * @brief Color accessor */ - QColor color () const + lay::Color color () const { return m_color; } @@ -498,7 +498,7 @@ public: private: // Ruler display and snapping configuration - QColor m_color; + lay::Color m_color; bool m_halo; lay::angle_constraint_type m_snap_mode; double m_grid; @@ -599,7 +599,7 @@ private: /** * @brief implementation of the "Drawing" interface: configuration */ - std::vector get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColor foreground, QColor active) const; + std::vector get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color active) const; /** * @brief Update m_rulers to reflect the selection diff --git a/src/edt/edt/edtPartialService.cc b/src/edt/edt/edtPartialService.cc index fe5bf02df..a22882651 100644 --- a/src/edt/edt/edtPartialService.cc +++ b/src/edt/edt/edtPartialService.cc @@ -1220,7 +1220,7 @@ PartialService::clear_partial_transient_selection () } void -PartialService::set_colors (QColor /*background*/, QColor color) +PartialService::set_colors (lay::Color /*background*/, lay::Color color) { m_color = color.rgb (); if (mp_box) { diff --git a/src/edt/edt/edtPartialService.h b/src/edt/edt/edtPartialService.h index 03d09da96..0781dcf81 100644 --- a/src/edt/edt/edtPartialService.h +++ b/src/edt/edt/edtPartialService.h @@ -282,7 +282,7 @@ public: /** * @brief Reimplementation of the ViewService interface: set the colors */ - virtual void set_colors (QColor background, QColor text); + virtual void set_colors (lay::Color background, lay::Color text); /** * @brief Cancel any edit operations (in this case, unselect all & cancel any drag operation) diff --git a/src/img/img/imgLandmarksDialog.cc b/src/img/img/imgLandmarksDialog.cc index 1a8d3d152..16d9142cf 100644 --- a/src/img/img/imgLandmarksDialog.cc +++ b/src/img/img/imgLandmarksDialog.cc @@ -345,7 +345,7 @@ public: widget ()->ungrab_mouse (this); } - void set_colors (QColor /*background*/, QColor /*color*/) + void set_colors (lay::Color /*background*/, lay::Color /*color*/) { // ... } diff --git a/src/lay/lay/layNavigator.cc b/src/lay/lay/layNavigator.cc index 20f828626..5855b403d 100644 --- a/src/lay/lay/layNavigator.cc +++ b/src/lay/lay/layNavigator.cc @@ -72,18 +72,18 @@ public: void background_color_changed () { - QColor c = mp_view->background_color (); + lay::Color c = mp_view->background_color (); // replace by "real" background color if required - if (! c.isValid ()) { - c = mp_view->palette ().color (QPalette::Normal, QPalette::Base); + if (! c.is_valid ()) { + c = lay::Color (mp_view->palette ().color (QPalette::Normal, QPalette::Base).rgb ()); } - QColor contrast; + lay::Color contrast; if (c.green () > 128) { - contrast = QColor (0, 0, 0); + contrast = lay::Color (0, 0, 0); } else { - contrast = QColor (255, 255, 255); + contrast = lay::Color (255, 255, 255); } set_colors (c, contrast); @@ -388,7 +388,7 @@ public: widget ()->ungrab_mouse (this); } - void set_colors (QColor /*background*/, QColor color) + void set_colors (lay::Color /*background*/, lay::Color color) { // set zoom box color m_color = color.rgb (); diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc index e5bf11472..1cf36d029 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc @@ -330,13 +330,13 @@ static void save_as2 (lay::LayoutView *view, unsigned int index, const std::stri #if defined(HAVE_QTBINDINGS) static QImage get_image_with_options (lay::LayoutView *view, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box, bool monochrome) { - return view->get_image_with_options (width, height, linewidth, oversampling, resolution, QColor (), QColor (), QColor (), target_box, monochrome); + return view->get_image_with_options (width, height, linewidth, oversampling, resolution, lay::Color (), lay::Color (), lay::Color (), target_box, monochrome); } #endif static void save_image_with_options (lay::LayoutView *view, const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box, bool monochrome) { - view->save_image_with_options (fn, width, height, linewidth, oversampling, resolution, QColor (), QColor (), QColor (), target_box, monochrome); + view->save_image_with_options (fn, width, height, linewidth, oversampling, resolution, lay::Color (), lay::Color (), lay::Color (), target_box, monochrome); } static std::vector diff --git a/src/laybasic/laybasic/gsiDeclLayMarker.cc b/src/laybasic/laybasic/gsiDeclLayMarker.cc index ff048605e..5e23b71aa 100644 --- a/src/laybasic/laybasic/gsiDeclLayMarker.cc +++ b/src/laybasic/laybasic/gsiDeclLayMarker.cc @@ -37,13 +37,13 @@ lay::DMarker *create_marker (lay::LayoutView *view) static void reset_frame_color (lay::DMarker *marker) { - marker->set_frame_color (QColor ()); + marker->set_frame_color (lay::Color ()); } static void set_frame_color (lay::DMarker *marker, unsigned int color) { - marker->set_frame_color (QColor (color)); + marker->set_frame_color (lay::Color (color)); } static @@ -55,19 +55,19 @@ unsigned int get_frame_color (const lay::DMarker *marker) static bool has_frame_color (const lay::DMarker *marker) { - return marker->get_frame_color ().isValid (); + return marker->get_frame_color ().is_valid (); } static void reset_color (lay::DMarker *marker) { - marker->set_color (QColor ()); + marker->set_color (lay::Color ()); } static void set_color (lay::DMarker *marker, unsigned int color) { - marker->set_color (QColor (color)); + marker->set_color (lay::Color (color)); } static @@ -79,7 +79,7 @@ unsigned int get_color (const lay::DMarker *marker) static bool has_color (const lay::DMarker *marker) { - return marker->get_color ().isValid (); + return marker->get_color ().is_valid (); } Class decl_Marker ("lay", "Marker", diff --git a/src/laybasic/laybasic/layBookmarksView.cc b/src/laybasic/laybasic/layBookmarksView.cc index 39df8be5e..4c104316c 100644 --- a/src/laybasic/laybasic/layBookmarksView.cc +++ b/src/laybasic/laybasic/layBookmarksView.cc @@ -134,18 +134,18 @@ BookmarksView::follow_selection (bool f) } void -BookmarksView::set_background_color (QColor c) +BookmarksView::set_background_color (lay::Color c) { QPalette pl (mp_bookmarks->palette ()); - pl.setColor (QPalette::Base, c); + pl.setColor (QPalette::Base, QColor (c.rgb ())); mp_bookmarks->setPalette (pl); } void -BookmarksView::set_text_color (QColor c) +BookmarksView::set_text_color (lay::Color c) { QPalette pl (mp_bookmarks->palette ()); - pl.setColor (QPalette::Text, c); + pl.setColor (QPalette::Text, QColor (c.rgb ())); mp_bookmarks->setPalette (pl); } diff --git a/src/laybasic/laybasic/layBookmarksView.h b/src/laybasic/laybasic/layBookmarksView.h index 54bc6214d..70c6958a6 100644 --- a/src/laybasic/laybasic/layBookmarksView.h +++ b/src/laybasic/laybasic/layBookmarksView.h @@ -27,6 +27,7 @@ #include "laybasicCommon.h" #include "layBookmarkList.h" +#include "layColor.h" #include #include @@ -51,8 +52,8 @@ public: BookmarksView (LayoutView *view, QWidget *parent, const char *name); ~BookmarksView (); - void set_background_color (QColor c); - void set_text_color (QColor c); + void set_background_color (lay::Color c); + void set_text_color (lay::Color c); void follow_selection (bool f); std::set selected_bookmarks (); diff --git a/src/laybasic/laybasic/layColor.h b/src/laybasic/laybasic/layColor.h index 836252fff..77cccebc8 100644 --- a/src/laybasic/laybasic/layColor.h +++ b/src/laybasic/laybasic/layColor.h @@ -68,6 +68,30 @@ public: */ Color (const std::string &name); + /** + * @brief Comparison: equal + */ + bool operator== (const Color &color) const + { + return m_color == color.m_color; + } + + /** + * @brief Comparison: not equal + */ + bool operator!= (const Color &color) const + { + return m_color != color.m_color; + } + + /** + * @brief Comparison: less + */ + bool operator< (const Color &color) const + { + return m_color < color.m_color; + } + /** * @brief Gets the string value from a color */ @@ -86,6 +110,38 @@ public: return m_color; } + /** + * @brief Gets the alpha component + */ + unsigned int alpha () const + { + return (m_color & 0xff000000) >> 24; + } + + /** + * @brief Gets the red component + */ + unsigned int red () const + { + return (m_color & 0xff0000) >> 16; + } + + /** + * @brief Gets the green component + */ + unsigned int green () const + { + return (m_color & 0xff00) >> 8; + } + + /** + * @brief Gets the blue component + */ + unsigned int blue () const + { + return (m_color & 0xff); + } + private: color_t m_color; }; diff --git a/src/laybasic/laybasic/layConverters.cc b/src/laybasic/laybasic/layConverters.cc index 98c56cbe3..3a5f0497a 100644 --- a/src/laybasic/laybasic/layConverters.cc +++ b/src/laybasic/laybasic/layConverters.cc @@ -41,7 +41,17 @@ ColorConverter::to_string (const QColor &c) const } } -void +std::string +ColorConverter::to_string (const lay::Color &c) const +{ + if (! c.is_valid ()) { + return "auto"; + } else { + return c.to_string (); + } +} + +void ColorConverter::from_string (const std::string &s, QColor &c) const { std::string t (tl::trim (s)); @@ -52,5 +62,16 @@ ColorConverter::from_string (const std::string &s, QColor &c) const } } +void +ColorConverter::from_string (const std::string &s, lay::Color &c) const +{ + std::string t (tl::trim (s)); + if (t == "auto") { + c = lay::Color (); + } else { + c = lay::Color (t); + } +} + } diff --git a/src/laybasic/laybasic/layConverters.h b/src/laybasic/laybasic/layConverters.h index ed3c2b6aa..8965fc369 100644 --- a/src/laybasic/laybasic/layConverters.h +++ b/src/laybasic/laybasic/layConverters.h @@ -25,6 +25,7 @@ #define HDR_layConverters #include "laybasicCommon.h" +#include "layColor.h" #include @@ -37,7 +38,9 @@ namespace lay struct LAYBASIC_PUBLIC ColorConverter { 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; + void from_string (const std::string &s, lay::Color &c) const; }; } diff --git a/src/laybasic/laybasic/layDrawing.h b/src/laybasic/laybasic/layDrawing.h index 6545ed3db..20791ca70 100644 --- a/src/laybasic/laybasic/layDrawing.h +++ b/src/laybasic/laybasic/layDrawing.h @@ -121,7 +121,7 @@ public: /** * @brief Get the current appearance */ - virtual std::vector get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColor foreground, QColor active) const = 0; + virtual std::vector get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color active) const = 0; private: unsigned int m_num_planes; diff --git a/src/laybasic/laybasic/layEditorServiceBase.cc b/src/laybasic/laybasic/layEditorServiceBase.cc index 388bd4487..7dbc0fad1 100644 --- a/src/laybasic/laybasic/layEditorServiceBase.cc +++ b/src/laybasic/laybasic/layEditorServiceBase.cc @@ -59,11 +59,11 @@ public: uint32_t cursor_color (lay::ViewObjectCanvas &canvas) const { - QColor color; + lay::Color color; if (mp_service) { color = mp_service->tracking_cursor_color (); } - if (! color.isValid ()) { + if (! color.is_valid ()) { color = canvas.foreground_color (); } return color.rgb (); @@ -263,7 +263,7 @@ EditorServiceBase::configure (const std::string &name, const std::string &value) if (name == cfg_tracking_cursor_color) { - QColor color; + lay::Color color; lay::ColorConverter ().from_string (value, color); if (color != m_cursor_color) { diff --git a/src/laybasic/laybasic/layEditorServiceBase.h b/src/laybasic/laybasic/layEditorServiceBase.h index d088c22fe..276f1a66a 100644 --- a/src/laybasic/laybasic/layEditorServiceBase.h +++ b/src/laybasic/laybasic/layEditorServiceBase.h @@ -92,7 +92,7 @@ public: /** * @brief Gets the tracking cursor color */ - QColor tracking_cursor_color () const + lay::Color tracking_cursor_color () const { return m_cursor_color; } @@ -128,7 +128,7 @@ protected: private: // The marker representing the mouse cursor std::vector m_mouse_cursor_markers; - QColor m_cursor_color; + lay::Color m_cursor_color; bool m_cursor_enabled; bool m_has_tracking_position; db::DPoint m_tracking_position; diff --git a/src/laybasic/laybasic/layHierarchyControlPanel.cc b/src/laybasic/laybasic/layHierarchyControlPanel.cc index 1f21ae24c..947b2f3c7 100644 --- a/src/laybasic/laybasic/layHierarchyControlPanel.cc +++ b/src/laybasic/laybasic/layHierarchyControlPanel.cc @@ -655,23 +655,23 @@ HierarchyControlPanel::current_cell (int cv_index, HierarchyControlPanel::cell_p } void -HierarchyControlPanel::set_background_color (QColor c) +HierarchyControlPanel::set_background_color (lay::Color c) { m_background_color = c; for (std::vector ::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { QPalette pl ((*f)->palette ()); - pl.setColor (QPalette::Base, c); + pl.setColor (QPalette::Base, QColor (c.rgb ())); (*f)->setPalette (pl); } } void -HierarchyControlPanel::set_text_color (QColor c) +HierarchyControlPanel::set_text_color (lay::Color c) { m_text_color = c; for (std::vector ::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { QPalette pl ((*f)->palette ()); - pl.setColor (QPalette::Text, c); + pl.setColor (QPalette::Text, QColor (c.rgb ())); (*f)->setPalette (pl); } } @@ -895,11 +895,11 @@ HierarchyControlPanel::do_update_content (int cv_index) cell_list->setUniformRowHeights (true); pl = cell_list->palette (); - if (m_text_color.isValid ()) { - pl.setColor (QPalette::Text, m_text_color); + if (m_text_color.is_valid ()) { + pl.setColor (QPalette::Text, QColor (m_text_color.rgb ())); } - if (m_background_color.isValid ()) { - pl.setColor (QPalette::Base, m_background_color); + if (m_background_color.is_valid ()) { + pl.setColor (QPalette::Base, QColor (m_background_color.rgb ())); } cell_list->setPalette (pl); diff --git a/src/laybasic/laybasic/layHierarchyControlPanel.h b/src/laybasic/laybasic/layHierarchyControlPanel.h index 516ec1d46..be6c29db8 100644 --- a/src/laybasic/laybasic/layHierarchyControlPanel.h +++ b/src/laybasic/laybasic/layHierarchyControlPanel.h @@ -125,12 +125,12 @@ public: /** * @brief Changing of the background color */ - void set_background_color (QColor c); + void set_background_color (lay::Color c); /** * @brief Changing of the text color */ - void set_text_color (QColor c); + void set_text_color (lay::Color c); /** * @brief Select the active cellview @@ -304,8 +304,8 @@ private: QFrame *mp_search_frame; QCheckBox *mp_search_close_cb; QSplitter *mp_splitter; - QColor m_background_color; - QColor m_text_color; + lay::Color m_background_color; + lay::Color m_text_color; tl::DeferredMethod m_do_update_content_dm; tl::DeferredMethod m_do_full_update_content_dm; std::unique_ptr mp_tree_style; diff --git a/src/laybasic/laybasic/layLayerControlPanel.cc b/src/laybasic/laybasic/layLayerControlPanel.cc index bdb0a3004..931f5fd1c 100644 --- a/src/laybasic/laybasic/layLayerControlPanel.cc +++ b/src/laybasic/laybasic/layLayerControlPanel.cc @@ -1640,21 +1640,21 @@ LayerControlPanel::set_no_stipples (bool ns) } void -LayerControlPanel::set_background_color (QColor c) +LayerControlPanel::set_background_color (lay::Color c) { QPalette pl (mp_layer_list->palette ()); - pl.setColor (QPalette::Base, c); + pl.setColor (QPalette::Base, QColor (c.rgb ())); mp_layer_list->setPalette (pl); - mp_model->set_background_color (c); + mp_model->set_background_color (QColor (c.rgb ())); } void -LayerControlPanel::set_text_color (QColor c) +LayerControlPanel::set_text_color (lay::Color c) { QPalette pl (mp_layer_list->palette ()); - pl.setColor (QPalette::Text, c); + pl.setColor (QPalette::Text, QColor (c.rgb ())); mp_layer_list->setPalette (pl); - mp_model->set_text_color (c); + mp_model->set_text_color (QColor (c.rgb ())); } void diff --git a/src/laybasic/laybasic/layLayerControlPanel.h b/src/laybasic/laybasic/layLayerControlPanel.h index 1db2ee13c..d3b322c88 100644 --- a/src/laybasic/laybasic/layLayerControlPanel.h +++ b/src/laybasic/laybasic/layLayerControlPanel.h @@ -166,12 +166,12 @@ public: /** * @brief Changing of the background color */ - void set_background_color (QColor c); + void set_background_color (lay::Color c); /** * @brief Changing of the text color */ - void set_text_color (QColor c); + void set_text_color (lay::Color c); /** * @brief Set the "hide empty layers" flag diff --git a/src/laybasic/laybasic/layLayoutCanvas.cc b/src/laybasic/laybasic/layLayoutCanvas.cc index 152644176..99a6200dd 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.cc +++ b/src/laybasic/laybasic/layLayoutCanvas.cc @@ -303,9 +303,9 @@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char * mp_redraw_thread = new lay::RedrawThread (this, view); setBackgroundRole (QPalette::NoRole); - set_colors (palette ().color (QPalette::Normal, QPalette::Window), - palette ().color (QPalette::Normal, QPalette::Text), - palette ().color (QPalette::Normal, QPalette::Mid)); + 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); } @@ -378,7 +378,7 @@ LayoutCanvas::set_oversampling (unsigned int os) } void -LayoutCanvas::set_colors (QColor background, QColor foreground, QColor active) +LayoutCanvas::set_colors (lay::Color background, lay::Color foreground, lay::Color active) { m_background = background.rgb (); m_foreground = foreground.rgb (); @@ -697,7 +697,7 @@ class DetachedViewObjectCanvas : public BitmapViewObjectCanvas { public: - DetachedViewObjectCanvas (QColor bg, QColor fg, QColor ac, unsigned int width_l, unsigned int height_l, double resolution, QImage *img) + DetachedViewObjectCanvas (lay::Color bg, lay::Color fg, lay::Color ac, unsigned int width_l, unsigned int height_l, double resolution, QImage *img) : BitmapViewObjectCanvas (width_l, height_l, resolution), m_bg (bg), m_fg (fg), m_ac (ac), mp_image (img) { @@ -722,17 +722,17 @@ public: } } - QColor background_color () const + lay::Color background_color () const { return m_bg; } - QColor foreground_color () const + lay::Color foreground_color () const { return m_fg; } - QColor active_color () const + lay::Color active_color () const { return m_ac; } @@ -764,7 +764,7 @@ public: } private: - QColor m_bg, m_fg, m_ac; + lay::Color m_bg, m_fg, m_ac; QImage *mp_image; QImage *mp_image_l; double m_gamma; @@ -773,11 +773,11 @@ private: QImage LayoutCanvas::image (unsigned int width, unsigned int height) { - return image_with_options (width, height, -1, -1, -1.0, QColor (), QColor (), QColor (), db::DBox (), false); + return image_with_options (width, height, -1, -1, -1.0, lay::Color (), lay::Color (), lay::Color (), db::DBox (), false); } QImage -LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, QColor background, QColor foreground, QColor active, const db::DBox &target_box, bool is_mono) +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) { oversampling = m_oversampling; @@ -788,13 +788,13 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l if (resolution <= 0.0) { resolution = 1.0 / oversampling; } - if (background == QColor ()) { + if (! background.is_valid ()) { background = background_color (); } - if (foreground == QColor ()) { + if (! foreground.is_valid ()) { foreground = foreground_color (); } - if (active == QColor ()) { + if (! active.is_valid ()) { active = active_color (); } diff --git a/src/laybasic/laybasic/layLayoutCanvas.h b/src/laybasic/laybasic/layLayoutCanvas.h index bbdbfcfcd..aa4d9e624 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.h +++ b/src/laybasic/laybasic/layLayoutCanvas.h @@ -144,7 +144,7 @@ public: LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char *name = "canvas"); ~LayoutCanvas (); - void set_colors (QColor background, QColor foreground, QColor active); + void set_colors (lay::Color background, lay::Color foreground, lay::Color active); /** * @brief Set the view ops for the layers @@ -167,7 +167,7 @@ public: 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, QColor background, QColor foreground, QColor active_color, const db::DBox &target_box, bool monochrome); + 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); void update_image (); @@ -288,25 +288,25 @@ public: /** * @brief Reimplementation of ViewObjectCanvas: Background color */ - QColor background_color () const + lay::Color background_color () const { - return QColor (m_background); + return lay::Color (m_background); } /** * @brief Reimplementation of ViewObjectCanvas: Foreground color */ - QColor foreground_color () const + lay::Color foreground_color () const { - return QColor (m_foreground); + return lay::Color (m_foreground); } /** * @brief Reimplementation of ViewObjectCanvas: Active color */ - QColor active_color () const + lay::Color active_color () const { - return QColor (m_active); + return lay::Color (m_active); } /** diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index d780fd482..9fd12f057 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -404,7 +404,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/) m_paste_display_mode = 2; m_guiding_shape_visible = true; m_guiding_shape_line_width = 1; - m_guiding_shape_color = QColor (); + m_guiding_shape_color = lay::Color (); m_guiding_shape_vertex_size = 5; m_to_level = 0; m_ctx_dimming = 50; @@ -1151,7 +1151,7 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_background_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); background_color (color); // do not take - let others receive the background color events as well @@ -1196,7 +1196,7 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_ctx_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); ctx_color (color); return true; @@ -1217,7 +1217,7 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_child_ctx_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); child_ctx_color (color); return true; @@ -1301,14 +1301,14 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_cell_box_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); cell_box_color (color); return true; } else if (name == cfg_text_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); text_color (color); return true; @@ -1427,14 +1427,14 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_guiding_shape_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); guiding_shapes_color (color); return true; } else if (name == cfg_guiding_shape_color) { - QColor color; + lay::Color color; ColorConverter ().from_string (value, color); guiding_shapes_color (color); return true; @@ -1589,7 +1589,7 @@ LayoutView::configure (const std::string &name, const std::string &value) } else if (name == cfg_sel_color) { - QColor color; + lay::Color color; lay::ColorConverter ().from_string (value, color); // Change the color @@ -2991,7 +2991,7 @@ LayoutView::get_image (unsigned int width, unsigned int height) QImage LayoutView::get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, - QColor background, QColor foreground, QColor active, const db::DBox &target_box, bool monochrome) + lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool monochrome) { tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Save image"))); @@ -3034,7 +3034,7 @@ LayoutView::save_image (const std::string &fn, unsigned int width, unsigned int void LayoutView::save_image_with_options (const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, - QColor background, QColor foreground, QColor active, const db::DBox &target_box, bool monochrome) + lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool monochrome) { tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Save image"))); @@ -4128,11 +4128,11 @@ LayoutView::set_view_ops () std::vector view_ops; view_ops.reserve (nlayers * planes_per_layer + special_planes_before + special_planes_after); - lay::color_t box_color; - if (! m_box_color.isValid ()) { - box_color = mp_canvas->foreground_color ().rgb (); + lay::Color box_color; + if (! m_box_color.is_valid ()) { + box_color = mp_canvas->foreground_color (); } else { - box_color = m_box_color.rgb (); + box_color = m_box_color; } // cell boxes @@ -4141,10 +4141,10 @@ LayoutView::set_view_ops () lay::ViewOp vop; // context level - if (m_ctx_color.isValid ()) { + if (m_ctx_color.is_valid ()) { vop = lay::ViewOp (m_ctx_color.rgb (), lay::ViewOp::Copy, 0, 0, 0); } else { - vop = lay::ViewOp (lay::LayerProperties::brighter (box_color, brightness_for_context), lay::ViewOp::Copy, 0, 0, 0); + vop = lay::ViewOp (lay::LayerProperties::brighter (box_color.rgb (), brightness_for_context), lay::ViewOp::Copy, 0, 0, 0); } // fill, frame, text, vertex @@ -4154,10 +4154,10 @@ LayoutView::set_view_ops () view_ops.push_back (lay::ViewOp (0, lay::ViewOp::Or, 0, 0, 0)); // child level - if (m_child_ctx_color.isValid ()) { + if (m_child_ctx_color.is_valid ()) { vop = lay::ViewOp (m_child_ctx_color.rgb (), lay::ViewOp::Copy, 0, 0, 0); } else { - vop = lay::ViewOp (lay::LayerProperties::brighter (box_color, brightness_for_context), lay::ViewOp::Copy, 0, 0, 0); + vop = lay::ViewOp (lay::LayerProperties::brighter (box_color.rgb (), brightness_for_context), lay::ViewOp::Copy, 0, 0, 0); } // fill, frame, text, vertex @@ -4167,7 +4167,7 @@ LayoutView::set_view_ops () view_ops.push_back (lay::ViewOp (0, lay::ViewOp::Or, 0, 0, 0)); // current level - vop = lay::ViewOp (box_color, lay::ViewOp::Copy, 0, 0, 0); + vop = lay::ViewOp (box_color.rgb (), lay::ViewOp::Copy, 0, 0, 0); // fill, frame, text, vertex view_ops.push_back (lay::ViewOp (0, lay::ViewOp::Or, 0, 0, 0)); @@ -4187,8 +4187,8 @@ LayoutView::set_view_ops () // produce the ViewOps for the guiding shapes - color_t gs_color = box_color; - if (m_guiding_shape_color.isValid ()) { + color_t gs_color = box_color.rgb (); + if (m_guiding_shape_color.is_valid ()) { gs_color = m_guiding_shape_color.rgb (); } @@ -4202,7 +4202,7 @@ LayoutView::set_view_ops () if (ctx == 0) { // context planes - if (m_ctx_color.isValid ()) { + if (m_ctx_color.is_valid ()) { frame_color = text_color = fill_color = m_ctx_color.rgb (); } else { frame_color = text_color = fill_color = lay::LayerProperties::brighter (gs_color, brightness_for_context); @@ -4215,7 +4215,7 @@ LayoutView::set_view_ops () } else if (ctx == 1) { // child level planes (if used) - if (m_child_ctx_color.isValid ()) { + if (m_child_ctx_color.is_valid ()) { frame_color = text_color = fill_color = m_child_ctx_color.rgb (); } else { frame_color = text_color = fill_color = lay::LayerProperties::brighter (gs_color, brightness_for_child_context); @@ -4318,12 +4318,12 @@ LayoutView::set_view_ops () if (ctx == 0) { // context planes - if (m_ctx_color.isValid ()) { + if (m_ctx_color.is_valid ()) { frame_color = text_color = fill_color = m_ctx_color.rgb (); } else { fill_color = l->eff_fill_color_brighter (true /*real*/, brightness_for_context); frame_color = l->eff_frame_color_brighter (true /*real*/, brightness_for_context); - if (m_text_color.isValid ()) { + if (m_text_color.is_valid ()) { text_color = lay::LayerProperties::brighter (m_text_color.rgb (), brightness_for_context); } else { text_color = frame_color; @@ -4337,12 +4337,12 @@ LayoutView::set_view_ops () } else if (ctx == 1) { // child level planes (if used) - if (m_child_ctx_color.isValid ()) { + if (m_child_ctx_color.is_valid ()) { frame_color = text_color = fill_color = m_child_ctx_color.rgb (); } else { fill_color = l->eff_fill_color_brighter (true /*real*/, brightness_for_child_context); frame_color = l->eff_frame_color_brighter (true /*real*/, brightness_for_child_context); - if (m_text_color.isValid ()) { + if (m_text_color.is_valid ()) { text_color = lay::LayerProperties::brighter (m_text_color.rgb (), brightness_for_child_context); } else { text_color = frame_color; @@ -4358,7 +4358,7 @@ LayoutView::set_view_ops () // current level planes fill_color = l->eff_fill_color (true /*real*/); frame_color = l->eff_frame_color (true /*real*/); - if (m_text_color.isValid ()) { + if (m_text_color.is_valid ()) { text_color = m_text_color.rgb (); } else { text_color = frame_color; @@ -4414,7 +4414,7 @@ LayoutView::guiding_shapes_visible (bool v) } void -LayoutView::guiding_shapes_color (QColor c) +LayoutView::guiding_shapes_color (lay::Color c) { if (c != m_guiding_shape_color) { m_guiding_shape_color = c; @@ -4477,7 +4477,7 @@ LayoutView::drop_small_cells_cond (drop_small_cells_cond_type t) } void -LayoutView::cell_box_color (QColor c) +LayoutView::cell_box_color (lay::Color c) { if (c != m_box_color) { m_box_color = c; @@ -4627,7 +4627,7 @@ LayoutView::set_palette (const lay::LineStylePalette &p) } void -LayoutView::ctx_color (QColor c) +LayoutView::ctx_color (lay::Color c) { if (c != m_ctx_color) { m_ctx_color = c; @@ -4654,7 +4654,7 @@ LayoutView::ctx_hollow (bool h) } void -LayoutView::child_ctx_color (QColor c) +LayoutView::child_ctx_color (lay::Color c) { if (c != m_child_ctx_color) { m_child_ctx_color = c; @@ -4711,22 +4711,22 @@ LayoutView::abstract_mode_enabled (bool e) } void -LayoutView::background_color (QColor c) +LayoutView::background_color (lay::Color c) { if (c == mp_canvas->background_color ()) { return; } // replace by "real" background color if required - if (! c.isValid ()) { - c = palette ().color (QPalette::Normal, QPalette::Base); + if (! c.is_valid ()) { + c = lay::Color (palette ().color (QPalette::Normal, QPalette::Base).rgb ()); } - QColor contrast; + lay::Color contrast; if (c.green () > 128) { - contrast = QColor (0, 0, 0); + contrast = lay::Color (0, 0, 0); } else { - contrast = QColor (255, 255, 255); + contrast = lay::Color (255, 255, 255); } if (mp_control_panel) { @@ -5267,7 +5267,7 @@ LayoutView::show_markers (bool f) } void -LayoutView::text_color (QColor c) +LayoutView::text_color (lay::Color c) { if (m_text_color != c) { m_text_color = c; diff --git a/src/laybasic/laybasic/layLayoutView.h b/src/laybasic/laybasic/layLayoutView.h index 9fd1519b9..17e4d20b5 100644 --- a/src/laybasic/laybasic/layLayoutView.h +++ b/src/laybasic/laybasic/layLayoutView.h @@ -918,13 +918,13 @@ public: * @param linewidth The width of a line in pixels (usually 1) or 0 for default * @param oversampling The oversampling factor (1..3) or 0 for default * @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default - * @param background The background color or QColor() for default - * @param foreground The foreground color or QColor() for default - * @param active The active color or QColor() for default + * @param background The background color or lay::Color() for default + * @param foreground The foreground color or lay::Color() for default + * @param active The active color or lay::Color() for default * @param target_box The box to draw or db::DBox() for default * @param monochrome If true, monochrome images will be produced */ - void save_image_with_options (const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, QColor background, QColor foreground, QColor active_color, const db::DBox &target_box, bool monochrome); + void save_image_with_options (const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, Color background, Color foreground, Color active_color, const db::DBox &target_box, bool monochrome); /** * @brief Get the screen content as a QImage object with the given width and height @@ -939,13 +939,13 @@ public: * @param linewidth The width of a line in pixels (usually 1) or 0 for default * @param oversampling The oversampling factor (1..3) or 0 for default * @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default - * @param background The background color or QColor() for default - * @param foreground The foreground color or QColor() for default - * @param active The active color or QColor() for default + * @param background The background color or lay::Color() for default + * @param foreground The foreground color or lay::Color() for default + * @param active The active color or lay::Color() for default * @param target_box The box to draw or db::DBox() for default * @param monochrome If true, monochrome images will be produced */ - QImage get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, QColor background, QColor foreground, QColor active_color, const db::DBox &target_box, bool monochrome); + QImage get_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); /** * @brief Hierarchy level selection setter @@ -1002,12 +1002,12 @@ public: /** * @brief Cell box/label color setter */ - void cell_box_color (QColor c); + void cell_box_color (lay::Color c); /** * @brief Cell box/label getter */ - QColor cell_box_color () const + lay::Color cell_box_color () const { return m_box_color; } @@ -1200,12 +1200,12 @@ public: /** * @brief Text object color */ - void text_color (QColor c); + void text_color (lay::Color c); /** * @brief Text object color */ - QColor text_color () const + lay::Color text_color () const { return m_text_color; } @@ -1811,7 +1811,7 @@ public: /** * @brief Background color property */ - QColor background_color () const + lay::Color background_color () const { return mp_canvas->background_color (); } @@ -1819,7 +1819,7 @@ public: /** * @brief Foreground color property */ - QColor foreground_color () const + lay::Color foreground_color () const { return mp_canvas->foreground_color (); } @@ -1827,7 +1827,7 @@ public: /** * @brief Active color property */ - QColor active_color () const + lay::Color active_color () const { return mp_canvas->active_color (); } @@ -1887,7 +1887,7 @@ public: /** * @brief Gets the guiding shapes color */ - QColor guiding_shapes_color () const + lay::Color guiding_shapes_color () const { return m_guiding_shape_color; } @@ -1895,7 +1895,7 @@ public: /** * @brief Sets the guiding shapes color */ - void guiding_shapes_color (QColor c); + void guiding_shapes_color (lay::Color c); /** * @brief Gets the guiding shapes line width @@ -2231,7 +2231,7 @@ public: /** * @brief Get the default color for markers */ - QColor default_marker_color () const + lay::Color default_marker_color () const { return m_marker_color; } @@ -2791,15 +2791,15 @@ private: int m_paste_display_mode; int m_wheel_mode; bool m_guiding_shape_visible; - QColor m_guiding_shape_color; + lay::Color m_guiding_shape_color; int m_guiding_shape_line_width; int m_guiding_shape_vertex_size; - QColor m_ctx_color; + lay::Color m_ctx_color; int m_ctx_dimming; bool m_ctx_hollow; - QColor m_child_ctx_color; + lay::Color m_child_ctx_color; int m_child_ctx_dimming; bool m_child_ctx_hollow; bool m_child_ctx_enabled; @@ -2807,13 +2807,13 @@ private: double m_abstract_mode_width; bool m_abstract_mode_enabled; - QColor m_box_color; + lay::Color m_box_color; bool m_box_text_transform; unsigned int m_box_font; int m_min_size_for_label; bool m_cell_box_visible; - QColor m_marker_color; + lay::Color m_marker_color; int m_marker_line_width; int m_marker_vertex_size; int m_marker_dither_pattern; @@ -2831,7 +2831,7 @@ private: bool m_text_lazy_rendering; bool m_bitmap_caching; bool m_show_properties; - QColor m_text_color; + lay::Color m_text_color; bool m_apply_text_trans; double m_default_text_size; unsigned int m_text_font; @@ -2892,11 +2892,11 @@ private: void do_redraw (int layer); void do_redraw (); - void background_color (QColor c); - void ctx_color (QColor c); + void background_color (lay::Color c); + void ctx_color (lay::Color c); void ctx_dimming (int percent); void ctx_hollow (bool h); - void child_ctx_color (QColor c); + void child_ctx_color (lay::Color c); void child_ctx_dimming (int percent); void child_ctx_hollow (bool h); void child_ctx_enabled (bool e); diff --git a/src/laybasic/laybasic/layLibrariesView.cc b/src/laybasic/laybasic/layLibrariesView.cc index 4b1246666..0849a306b 100644 --- a/src/laybasic/laybasic/layLibrariesView.cc +++ b/src/laybasic/laybasic/layLibrariesView.cc @@ -489,23 +489,23 @@ LibrariesView::double_clicked (const QModelIndex & /*index*/) } void -LibrariesView::set_background_color (QColor c) +LibrariesView::set_background_color (lay::Color c) { m_background_color = c; for (std::vector ::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { QPalette pl ((*f)->palette ()); - pl.setColor (QPalette::Base, c); + pl.setColor (QPalette::Base, QColor (c.rgb ())); (*f)->setPalette (pl); } } void -LibrariesView::set_text_color (QColor c) +LibrariesView::set_text_color (lay::Color c) { m_text_color = c; for (std::vector ::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { QPalette pl ((*f)->palette ()); - pl.setColor (QPalette::Text, c); + pl.setColor (QPalette::Text, QColor (c.rgb ())); (*f)->setPalette (pl); } } @@ -637,11 +637,11 @@ LibrariesView::do_update_content (int lib_index) cell_list->setUniformRowHeights (true); pl = cell_list->palette (); - if (m_text_color.isValid ()) { - pl.setColor (QPalette::Text, m_text_color); + if (m_text_color.is_valid ()) { + pl.setColor (QPalette::Text, QColor (m_text_color.rgb ())); } - if (m_background_color.isValid ()) { - pl.setColor (QPalette::Base, m_background_color); + if (m_background_color.is_valid ()) { + pl.setColor (QPalette::Base, QColor (m_background_color.rgb ())); } cell_list->setPalette (pl); diff --git a/src/laybasic/laybasic/layLibrariesView.h b/src/laybasic/laybasic/layLibrariesView.h index 3b12f3a20..48b650583 100644 --- a/src/laybasic/laybasic/layLibrariesView.h +++ b/src/laybasic/laybasic/layLibrariesView.h @@ -122,12 +122,12 @@ public: /** * @brief Changing of the background color */ - void set_background_color (QColor c); + void set_background_color (lay::Color c); /** * @brief Changing of the text color */ - void set_text_color (QColor c); + void set_text_color (lay::Color c); /** * @brief Sets the active library by name @@ -247,8 +247,8 @@ private: QFrame *mp_search_frame; QCheckBox *mp_search_close_cb; QSplitter *mp_splitter; - QColor m_background_color; - QColor m_text_color; + lay::Color m_background_color; + lay::Color m_text_color; tl::DeferredMethod m_do_update_content_dm; tl::DeferredMethod m_do_full_update_content_dm; std::unique_ptr mp_tree_style; diff --git a/src/laybasic/laybasic/layMarker.cc b/src/laybasic/laybasic/layMarker.cc index ac08e6d95..8e1f7ab7d 100644 --- a/src/laybasic/laybasic/layMarker.cc +++ b/src/laybasic/laybasic/layMarker.cc @@ -196,7 +196,7 @@ MarkerBase::MarkerBase (lay::LayoutView *view) } void -MarkerBase::set_frame_color (QColor color) +MarkerBase::set_frame_color (lay::Color color) { if (color != m_frame_color) { m_frame_color = color; @@ -205,7 +205,7 @@ MarkerBase::set_frame_color (QColor color) } void -MarkerBase::set_color (QColor color) +MarkerBase::set_color (lay::Color color) { if (color != m_color) { m_color = color; @@ -292,16 +292,16 @@ MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay: int basic_width = int(0.5 + 1.0 / resolution); // obtain bitmaps - QColor color = m_color; - if (! color.isValid ()) { + lay::Color color = m_color; + if (! color.is_valid ()) { color = mp_view->default_marker_color (); } - if (! color.isValid ()) { + if (! color.is_valid ()) { color = canvas.foreground_color (); } - QColor frame_color = m_frame_color; - if (! frame_color.isValid ()) { + lay::Color frame_color = m_frame_color; + if (! frame_color.is_valid ()) { frame_color = color; } diff --git a/src/laybasic/laybasic/layMarker.h b/src/laybasic/laybasic/layMarker.h index c3a140a87..7b18deab6 100644 --- a/src/laybasic/laybasic/layMarker.h +++ b/src/laybasic/laybasic/layMarker.h @@ -41,8 +41,6 @@ #include "dbArray.h" #include "gsi.h" -#include - namespace lay { @@ -68,7 +66,7 @@ public: * * If the color is invalid, the marker is drawn with the canvases foreground color. */ - QColor get_color () const + lay::Color get_color () const { return m_color; } @@ -78,14 +76,14 @@ public: * * If the color is invalid, the marker is drawn with the canvases foreground color. */ - void set_color (QColor color); + void set_color (lay::Color color); /** * @brief Get the color by which the marker's frame is drawn * * If the color is invalid, the marker's frame is drawn with the fill color. */ - QColor get_frame_color () const + lay::Color get_frame_color () const { return m_frame_color; } @@ -95,7 +93,7 @@ public: * * If the color is invalid, the marker's frame is drawn with the fill color. */ - void set_frame_color (QColor color); + void set_frame_color (lay::Color color); /** * @brief Get the line width with which the marker is drawn @@ -228,8 +226,8 @@ public: protected: void get_bitmaps (const Viewport &vp, ViewObjectCanvas &canvas, lay::CanvasPlane *&fill, lay::CanvasPlane *&frame, lay::CanvasPlane *&vertex, lay::CanvasPlane *&text); - QColor m_color; - QColor m_frame_color; + lay::Color m_color; + lay::Color m_frame_color; char m_line_width, m_vertex_size, m_halo; bool m_text_enabled; lay::ViewOp::Shape m_vertex_shape; diff --git a/src/laybasic/laybasic/layNetlistBrowserDialog.cc b/src/laybasic/laybasic/layNetlistBrowserDialog.cc index 4ecf301b4..820ebdf32 100644 --- a/src/laybasic/laybasic/layNetlistBrowserDialog.cc +++ b/src/laybasic/laybasic/layNetlistBrowserDialog.cc @@ -555,7 +555,7 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val } else if (name == cfg_l2ndb_marker_color) { - QColor color; + lay::Color color; if (! value.empty ()) { lay::ColorConverter ().from_string (value, color); } diff --git a/src/laybasic/laybasic/layNetlistBrowserDialog.h b/src/laybasic/laybasic/layNetlistBrowserDialog.h index b8e929cfa..ebebe1c14 100644 --- a/src/laybasic/laybasic/layNetlistBrowserDialog.h +++ b/src/laybasic/laybasic/layNetlistBrowserDialog.h @@ -119,7 +119,7 @@ private: lay::NetlistBrowserConfig::net_window_type m_window; double m_window_dim; unsigned int m_max_shape_count; - QColor m_marker_color; + lay::Color m_marker_color; lay::ColorPalette m_auto_colors; bool m_auto_color_enabled; int m_marker_line_width; diff --git a/src/laybasic/laybasic/layNetlistBrowserModel.cc b/src/laybasic/laybasic/layNetlistBrowserModel.cc index 61126be03..82e5f05a4 100644 --- a/src/laybasic/laybasic/layNetlistBrowserModel.cc +++ b/src/laybasic/laybasic/layNetlistBrowserModel.cc @@ -111,7 +111,7 @@ NetColorizer::NetColorizer () } void -NetColorizer::configure (const QColor &marker_color, const lay::ColorPalette *auto_colors) +NetColorizer::configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors) { m_marker_color = marker_color; if (auto_colors) { @@ -131,7 +131,7 @@ NetColorizer::has_color_for_net (const db::Net *net) } void -NetColorizer::set_color_of_net (const db::Net *net, const QColor &color) +NetColorizer::set_color_of_net (const db::Net *net, const lay::Color &color) { m_custom_color[net] = color; emit_colors_changed (); @@ -183,14 +183,14 @@ NetColorizer::emit_colors_changed () } } -QColor +lay::Color NetColorizer::color_of_net (const db::Net *net) const { if (! net) { - return QColor (); + return lay::Color (); } - std::map::const_iterator c = m_custom_color.find (net); + std::map::const_iterator c = m_custom_color.find (net); if (c != m_custom_color.end ()) { return c->second; } @@ -219,7 +219,7 @@ NetColorizer::color_of_net (const db::Net *net) const return m_auto_colors.color_by_index ((unsigned int) index); } else { - return QColor (); + return lay::Color (); } } @@ -823,9 +823,9 @@ static QIcon icon_for_subcircuit () return icon; } -static QIcon colored_icon (const QColor &color, const QIcon &original_icon) +static QIcon colored_icon (const lay::Color &color, const QIcon &original_icon) { - if (! color.isValid ()) { + if (! color.is_valid ()) { return icon_for_net (); } @@ -857,12 +857,12 @@ static QIcon colored_icon (const QColor &color, const QIcon &original_icon) return colored_icon; } -static QIcon net_icon_with_color (const QColor &color) +static QIcon net_icon_with_color (const lay::Color &color) { return colored_icon (color, light_icon_for_net ()); } -static QIcon connection_icon_with_color (const QColor &color) +static QIcon connection_icon_with_color (const lay::Color &color) { return colored_icon (color, light_icon_for_connection ()); } @@ -2869,7 +2869,7 @@ NetlistBrowserModel::icon_for_nets (const std::pairhas_color_for_net (net)) { - QColor color = mp_colorizer->color_of_net (net); + lay::Color color = mp_colorizer->color_of_net (net); lay::color_t rgb = lay::color_t (color.rgb ()); std::map::const_iterator c = m_net_icon_per_color.find (rgb); @@ -2891,7 +2891,7 @@ NetlistBrowserModel::icon_for_connection (const std::pairhas_color_for_net (net)) { - QColor color = mp_colorizer->color_of_net (net); + lay::Color color = mp_colorizer->color_of_net (net); lay::color_t rgb = lay::color_t (color.rgb ()); std::map::const_iterator c = m_connection_icon_per_color.find (rgb); diff --git a/src/laybasic/laybasic/layNetlistBrowserModel.h b/src/laybasic/laybasic/layNetlistBrowserModel.h index 005664a6f..b18c4bbe7 100644 --- a/src/laybasic/laybasic/layNetlistBrowserModel.h +++ b/src/laybasic/laybasic/layNetlistBrowserModel.h @@ -25,6 +25,7 @@ #define HDR_layNetlistBrowserModel #include "layColorPalette.h" +#include "layColor.h" #include "laybasicCommon.h" #include "dbLayoutToNetlist.h" @@ -34,7 +35,6 @@ #include "tlTypeTraits.h" #include -#include #include #include @@ -57,15 +57,15 @@ Q_OBJECT public: NetColorizer (); - void configure (const QColor &marker_color, const lay::ColorPalette *auto_colors); + 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 QColor &color); + void set_color_of_net (const db::Net *net, const Color &color); void reset_color_of_net (const db::Net *net); void clear (); - QColor color_of_net (const db::Net *net) const; + lay::Color color_of_net (const db::Net *net) const; - const QColor &marker_color () const + const lay::Color &marker_color () const { return m_marker_color; } @@ -77,10 +77,10 @@ signals: void colors_changed (); private: - QColor m_marker_color; + lay::Color m_marker_color; lay::ColorPalette m_auto_colors; bool m_auto_colors_enabled; - std::map m_custom_color; + std::map m_custom_color; bool m_update_needed; bool m_signals_enabled; mutable std::map m_net_index_by_object; diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.cc b/src/laybasic/laybasic/layNetlistBrowserPage.cc index f69b537d7..ef1fdc4f0 100644 --- a/src/laybasic/laybasic/layNetlistBrowserPage.cc +++ b/src/laybasic/laybasic/layNetlistBrowserPage.cc @@ -229,7 +229,7 @@ NetlistBrowserPage::set_dispatcher (lay::Dispatcher *pr) } void -NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors) +NetlistBrowserPage::set_highlight_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors) { m_colorizer.configure (color, auto_colors); m_marker_line_width = line_width; @@ -492,13 +492,13 @@ NetlistBrowserPage::selection_changed () } void -NetlistBrowserPage::set_color_for_selected_nets (const QColor &color) +NetlistBrowserPage::set_color_for_selected_nets (const lay::Color &color) { std::vector nets = selected_nets (); m_colorizer.begin_changes (); for (std::vector::const_iterator n = nets.begin (); n != nets.end (); ++n) { - if (color.isValid ()) { + if (color.is_valid ()) { m_colorizer.set_color_of_net (*n, color); } else { m_colorizer.reset_color_of_net (*n); @@ -514,7 +514,7 @@ NetlistBrowserPage::browse_color_for_net () { QColor c = QColorDialog::getColor (QColor (), this); if (c.isValid ()) { - set_color_for_selected_nets (c); + set_color_for_selected_nets (lay::Color (c.rgb ())); } } @@ -523,7 +523,7 @@ NetlistBrowserPage::select_color_for_net () { QAction *action = dynamic_cast (sender ()); if (action) { - set_color_for_selected_nets (action->data ().value ()); + set_color_for_selected_nets (lay::Color (action->data ().value ().rgb ())); } } @@ -1095,11 +1095,11 @@ NetlistBrowserPage::adjust_view () } } -QColor -NetlistBrowserPage::make_valid_color (const QColor &color) +lay::Color +NetlistBrowserPage::make_valid_color (const lay::Color &color) { - if (! color.isValid () && mp_view) { - return mp_view->background_color ().green () < 128 ? QColor (Qt::white) : QColor (Qt::black); + if (! color.is_valid () && mp_view) { + return mp_view->background_color ().green () < 128 ? lay::Color (255, 255, 255) : lay::Color (0, 0, 0); } else { return color; } @@ -1110,7 +1110,7 @@ NetlistBrowserPage::produce_highlights_for_device (const db::Device *device, siz { const db::Layout *layout = mp_database->internal_layout (); - QColor color = make_valid_color (m_colorizer.marker_color ()); + lay::Color color = make_valid_color (m_colorizer.marker_color ()); db::Box device_bbox = bbox_for_device_abstract (layout, device->device_abstract (), device->trans ()); if (! device_bbox.empty ()) { @@ -1159,7 +1159,7 @@ NetlistBrowserPage::produce_highlights_for_circuit (const db::Circuit *circuit, { const db::Layout *layout = mp_database->internal_layout (); - QColor color = make_valid_color (m_colorizer.marker_color ()); + lay::Color color = make_valid_color (m_colorizer.marker_color ()); db::Box circuit_bbox = bbox_for_circuit (layout, circuit); if (circuit_bbox.empty ()) { return false; @@ -1188,8 +1188,8 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma db::cell_index_type cell_index = net->circuit ()->cell_index (); size_t cluster_id = net->cluster_id (); - QColor net_color = m_colorizer.color_of_net (net); - QColor fallback_color = make_valid_color (m_colorizer.marker_color ()); + lay::Color net_color = m_colorizer.color_of_net (net); + lay::Color fallback_color = make_valid_color (m_colorizer.marker_color ()); const db::Connectivity &conn = mp_database->connectivity (); for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) { @@ -1212,7 +1212,7 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma mp_markers.push_back (new lay::Marker (mp_view, m_cv_index)); mp_markers.back ()->set (shapes->polygon_ref (), shapes.trans (), tv); - if (net_color.isValid ()) { + if (net_color.is_valid ()) { mp_markers.back ()->set_color (net_color); mp_markers.back ()->set_frame_color (net_color); diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.h b/src/laybasic/laybasic/layNetlistBrowserPage.h index 77cf489e7..d11f126e9 100644 --- a/src/laybasic/laybasic/layNetlistBrowserPage.h +++ b/src/laybasic/laybasic/layNetlistBrowserPage.h @@ -141,7 +141,7 @@ public: * @param halo The halo flag or -1 for default * @param dither_pattern The dither pattern index of -1 to take the default */ - void set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors); + void set_highlight_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors); /** * @brief Gets a value indicating whether all items in the netlist tree are shown (specifically for cross-reference DBs) @@ -253,9 +253,9 @@ private: std::vector selected_devices (); std::vector selected_subcircuits (); std::vector selected_circuits (); - void set_color_for_selected_nets (const QColor &color); + void set_color_for_selected_nets (const lay::Color &color); void layer_list_changed (int); - QColor make_valid_color (const QColor &color); + lay::Color make_valid_color (const lay::Color &color); bool produce_highlights_for_net(const db::Net *net, size_t &n_markers, const std::map &display_by_lp, const std::vector &tv); bool produce_highlights_for_device (const db::Device *device, size_t &n_markers, const std::vector &tv); bool produce_highlights_for_circuit (const db::Circuit *circuit, size_t &n_markers, const std::vector &tv); diff --git a/src/laybasic/laybasic/layRedrawThreadCanvas.cc b/src/laybasic/laybasic/layRedrawThreadCanvas.cc index 94125b20a..b6d2964f4 100644 --- a/src/laybasic/laybasic/layRedrawThreadCanvas.cc +++ b/src/laybasic/laybasic/layRedrawThreadCanvas.cc @@ -394,7 +394,7 @@ BitmapRedrawThreadCanvas::initialize_plane (lay::CanvasPlane *plane, unsigned in } void -BitmapRedrawThreadCanvas::to_image (const std::vector &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, QColor background, QColor foreground, QColor active, const lay::Drawings *drawings, QImage &img, unsigned int width, unsigned int height) +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) { if (width > m_width) { width = m_width; diff --git a/src/laybasic/laybasic/layRedrawThreadCanvas.h b/src/laybasic/laybasic/layRedrawThreadCanvas.h index b765b3fcd..abaf8085b 100644 --- a/src/laybasic/laybasic/layRedrawThreadCanvas.h +++ b/src/laybasic/laybasic/layRedrawThreadCanvas.h @@ -322,7 +322,7 @@ public: /** * @brief Transfer the content to an QImage */ - void to_image (const std::vector &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, QColor background, QColor foreground, QColor active, const lay::Drawings *drawings, QImage &img, unsigned int width, unsigned int height); + 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); /** * @brief Gets the current bitmap data as a BitmapCanvasData object diff --git a/src/laybasic/laybasic/laySelector.cc b/src/laybasic/laybasic/laySelector.cc index 1c85416c1..e1dea2f3b 100644 --- a/src/laybasic/laybasic/laySelector.cc +++ b/src/laybasic/laybasic/laySelector.cc @@ -62,7 +62,7 @@ SelectionService::~SelectionService () } void -SelectionService::set_colors (QColor /*background*/, QColor color) +SelectionService::set_colors (lay::Color /*background*/, lay::Color color) { m_color = color.rgb (); if (mp_box) { diff --git a/src/laybasic/laybasic/laySelector.h b/src/laybasic/laybasic/laySelector.h index 85ba64d76..b7f5f5e22 100644 --- a/src/laybasic/laybasic/laySelector.h +++ b/src/laybasic/laybasic/laySelector.h @@ -49,7 +49,7 @@ public: SelectionService (lay::LayoutView *view); ~SelectionService (); - void set_colors (QColor background, QColor color); + void set_colors (lay::Color background, lay::Color color); void begin (const db::DPoint &pos); bool dragging () const { return mp_box != 0; } diff --git a/src/laybasic/laybasic/layViewObject.h b/src/laybasic/laybasic/layViewObject.h index 3e10c0b0d..f69ad4efc 100644 --- a/src/laybasic/laybasic/layViewObject.h +++ b/src/laybasic/laybasic/layViewObject.h @@ -373,7 +373,7 @@ public: /** * @brief This method is called to set the background and text (foreground) color */ - virtual void set_colors (QColor /*background*/, QColor /*text*/) { } + virtual void set_colors (lay::Color /*background*/, lay::Color /*text*/) { } /** * @brief This method is called when a drag operation should be cancelled @@ -1152,17 +1152,17 @@ public: /** * @brief Background color property: background color of the canvas */ - virtual QColor background_color () const = 0; + virtual lay::Color background_color () const = 0; /** * @brief Foreground color property: foreground color of the canvas (some "contrast" color to background) */ - virtual QColor foreground_color () const = 0; + virtual lay::Color foreground_color () const = 0; /** * @brief Active color property: color of active elements on the canvas (some "contrast" color to background and different from foreground) */ - virtual QColor active_color () const = 0; + virtual lay::Color active_color () const = 0; /** * @brief Get the resolution diff --git a/src/laybasic/laybasic/layZoomBox.cc b/src/laybasic/laybasic/layZoomBox.cc index 50af13b8a..bef7e40f2 100644 --- a/src/laybasic/laybasic/layZoomBox.cc +++ b/src/laybasic/laybasic/layZoomBox.cc @@ -54,7 +54,7 @@ ZoomService::drag_cancel () } void -ZoomService::set_colors (QColor /*background*/, QColor color) +ZoomService::set_colors (lay::Color /*background*/, lay::Color color) { m_color = color.rgb (); if (mp_box) { diff --git a/src/laybasic/laybasic/layZoomBox.h b/src/laybasic/laybasic/layZoomBox.h index 27fb82ff8..a0a497a83 100644 --- a/src/laybasic/laybasic/layZoomBox.h +++ b/src/laybasic/laybasic/layZoomBox.h @@ -41,7 +41,7 @@ public: ZoomService (lay::LayoutView *view); ~ZoomService (); - void set_colors (QColor background, QColor text); + void set_colors (lay::Color background, lay::Color text); void begin (const db::DPoint &pos); void begin_pan (const db::DPoint &pos); diff --git a/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc b/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc index 76baf7e1d..c85b40024 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowserDialog.cc @@ -474,7 +474,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu } else if (name == cfg_rdb_marker_color) { - QColor color; + lay::Color color; if (! value.empty ()) { lay::ColorConverter ().from_string (value, color); } diff --git a/src/laybasic/laybasic/rdbMarkerBrowserDialog.h b/src/laybasic/laybasic/rdbMarkerBrowserDialog.h index b15dd5369..5e0bd782e 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserDialog.h +++ b/src/laybasic/laybasic/rdbMarkerBrowserDialog.h @@ -73,7 +73,7 @@ private: window_type m_window; double m_window_dim; unsigned int m_max_marker_count; - QColor m_marker_color; + lay::Color m_marker_color; int m_marker_line_width; int m_marker_vertex_size; int m_marker_halo; diff --git a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc index 1342fa14b..df28158db 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserPage.cc +++ b/src/laybasic/laybasic/rdbMarkerBrowserPage.cc @@ -1609,7 +1609,7 @@ MarkerBrowserPage::set_dispatcher (lay::Dispatcher *pr) } void -MarkerBrowserPage::set_marker_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern) +MarkerBrowserPage::set_marker_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern) { m_marker_color = color; m_marker_line_width = line_width; diff --git a/src/laybasic/laybasic/rdbMarkerBrowserPage.h b/src/laybasic/laybasic/rdbMarkerBrowserPage.h index a4d82da0c..f879884a6 100644 --- a/src/laybasic/laybasic/rdbMarkerBrowserPage.h +++ b/src/laybasic/laybasic/rdbMarkerBrowserPage.h @@ -27,6 +27,7 @@ #include "ui_MarkerBrowserPage.h" #include "rdbMarkerBrowser.h" #include "tlDeferredExecution.h" +#include "layColor.h" #include "dbBox.h" #include @@ -136,7 +137,7 @@ public: * @param halo The halo flag or -1 for default * @param dither_pattern The dither pattern index of -1 to take the default */ - void set_marker_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern); + void set_marker_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern); /** * @brief Enable or disable updates @@ -195,7 +196,7 @@ private: rdb::window_type m_window; double m_window_dim; size_t m_max_marker_count; - QColor m_marker_color; + lay::Color m_marker_color; int m_marker_line_width; int m_marker_vertex_size; int m_marker_halo; diff --git a/src/laybasic/unit_tests/layColorTests.cc b/src/laybasic/unit_tests/layColorTests.cc index c90b0d722..c1d44c744 100644 --- a/src/laybasic/unit_tests/layColorTests.cc +++ b/src/laybasic/unit_tests/layColorTests.cc @@ -81,6 +81,10 @@ TEST(4) TEST(5) { EXPECT_EQ (lay::Color ("#80102030").is_valid (), true); + EXPECT_EQ (lay::Color ("#80102030").alpha (), 128); + EXPECT_EQ (lay::Color ("#80102030").red (), 16); + EXPECT_EQ (lay::Color ("#80102030").green (), 32); + EXPECT_EQ (lay::Color ("#80102030").blue (), 48); EXPECT_EQ (lay::Color ("#80102030").to_string (), "#80102030"); EXPECT_EQ (lay::Color ("#80102030").rgb (), 0x80102030); diff --git a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc index f175b1c82..f77581b7b 100644 --- a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc +++ b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.cc @@ -339,13 +339,13 @@ NetTracerSymbolInfo::parse (tl::Extractor &ex) // Net implementation NetTracerNet::NetTracerNet () - : m_dbu (0.001), m_incomplete (true), m_trace_path (false) + : m_dbu (0.001), m_incomplete (true), m_color (0), m_trace_path (false) { // .. nothing yet .. } NetTracerNet::NetTracerNet (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data) - : m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_trace_path (false) + : m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_color (0), m_trace_path (false) { m_dbu = layout.dbu (); m_top_cell_name = layout.cell_name (cell_index); diff --git a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h index 2262bcf7e..ec98182e2 100644 --- a/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h +++ b/src/plugins/tools/net_tracer/db_plugin/dbNetTracerIO.h @@ -196,11 +196,10 @@ public: return m_net_shapes.size (); } -#if defined(HAVE_QT) /** * @brief Gets the color in which the net is drawn */ - QColor color () const + uint32_t color () const { return m_color; } @@ -208,11 +207,10 @@ public: /** * @brief Sets the color in which the net is drawn */ - void set_color (QColor c) + void set_color (uint32_t c) { m_color = c; } -#endif /** * @brief Get a name for the net @@ -355,9 +353,7 @@ private: db::Shapes m_shapes; std::map > m_layers; std::map m_cell_names; -#if defined(HAVE_QT) - QColor m_color; -#endif + uint32_t m_color; db::DBox m_start_search_box, m_stop_search_box; bool m_trace_path; diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc index cf543dfa2..132d46a4a 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.cc @@ -187,7 +187,7 @@ NetTracerDialog::mouse_click_event (const db::DPoint &p, unsigned int buttons, b // do auto coloring if (m_auto_color_enabled) { if (m_auto_color_index < int (m_auto_colors.colors ())) { - mp_nets.back ()->set_color (QColor (m_auto_colors.color_by_index (m_auto_color_index))); + mp_nets.back ()->set_color (m_auto_colors.color_by_index (m_auto_color_index)); } ++m_auto_color_index; if (m_auto_color_index >= int (m_auto_colors.colors ())) { @@ -476,7 +476,7 @@ NetTracerDialog::configure (const std::string &name, const std::string &value) } else if (name == cfg_nt_marker_color) { - QColor color; + lay::Color color; if (! value.empty ()) { lay::ColorConverter ().from_string (value, color); } @@ -594,7 +594,7 @@ NetTracerDialog::net_color_changed (QColor color) int item_index = net_list->row (*item); if (item_index >= 0 && item_index < int (mp_nets.size ())) { if (color != mp_nets [item_index]->color ()) { - mp_nets [item_index]->set_color (color); + mp_nets [item_index]->set_color (color.rgb ()); changed = true; } } @@ -1092,7 +1092,7 @@ NetTracerDialog::update_list () item->setData (Qt::DisplayRole, tl::to_qstring (mp_nets [i]->name ())); - if (mp_nets [i]->color ().isValid ()) { + if (lay::Color (mp_nets [i]->color ()).is_valid ()) { QPixmap pxmp (icon_size); QPainter pxpainter (&pxmp); @@ -1595,7 +1595,7 @@ NetTracerDialog::update_highlights () std::map llmap; - QColor net_color = mp_nets [item_index]->color (); + lay::Color net_color = mp_nets [item_index]->color (); // Create markers for the shapes for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) { @@ -1648,10 +1648,10 @@ NetTracerDialog::update_highlights () } } - if (net_color.isValid ()) { + if (net_color.is_valid ()) { mp_markers.back ()->set_color (net_color); mp_markers.back ()->set_frame_color (net_color); - } else if (m_marker_color.isValid ()) { + } else if (m_marker_color.is_valid ()) { mp_markers.back ()->set_color (m_marker_color); mp_markers.back ()->set_frame_color (m_marker_color); } diff --git a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h index 6acf2cf93..4bff2255f 100644 --- a/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h +++ b/src/plugins/tools/net_tracer/lay_plugin/layNetTracerDialog.h @@ -92,7 +92,7 @@ private: nt_window_type m_window; double m_window_dim; unsigned int m_max_marker_count; - QColor m_marker_color; + lay::Color m_marker_color; int m_marker_line_width; int m_marker_vertex_size; int m_marker_halo; diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc b/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc index 94e7f2705..9fa1f77d6 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc @@ -1089,7 +1089,7 @@ D25ViewWidget::paintGL () const qreal retina_scale = devicePixelRatio (); glViewport (0, 0, width () * retina_scale, height () * retina_scale); - QColor c = mp_view->background_color (); + lay::Color c = mp_view->background_color (); float foreground_rgb = (c.green () > 128 ? 0.0f : 1.0f); float ambient = (c.green () > 128 ? 0.8f : 0.25f); float mist_factor = (c.green () > 128 ? 0.2f : 0.4f);