From 57cd512bf913a31836a245a2d3f98ee77c943bcb Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 18 Aug 2025 23:33:44 +0200 Subject: [PATCH] WIP: via up and via down --- src/db/db/dbVia.cc | 5 +++-- src/db/db/dbVia.h | 2 +- src/edt/edt/edtMainService.cc | 24 +++++++++++++++++++++++- src/edt/edt/edtMainService.h | 13 ++++++++++++- src/edt/edt/edtPlugin.cc | 2 ++ src/edt/edt/edtService.cc | 2 +- src/edt/edt/edtService.h | 4 +++- src/edt/edt/edtServiceImpl.cc | 4 ++-- src/edt/edt/edtServiceImpl.h | 2 +- 9 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/db/db/dbVia.cc b/src/db/db/dbVia.cc index 5287c29f9..65e875568 100644 --- a/src/db/db/dbVia.cc +++ b/src/db/db/dbVia.cc @@ -45,7 +45,7 @@ ViaType::init () // --------------------------------------------------------------------------------------- std::vector -find_via_definitions_for (const std::string &technology, const db::LayerProperties &layer) +find_via_definitions_for (const std::string &technology, const db::LayerProperties &layer, int dir) { std::vector via_defs; @@ -63,7 +63,8 @@ find_via_definitions_for (const std::string &technology, const db::LayerProperti auto via_types = pcell->via_types (); for (auto vt = via_types.begin (); vt != via_types.end (); ++vt) { - if ((vt->bottom.log_equal (layer) && vt->bottom_wired) || (vt->top.log_equal (layer) && vt->top_wired)) { + if ((dir >= 0 && vt->bottom.log_equal (layer) && vt->bottom_wired) || + (dir <= 0 && vt->top.log_equal (layer) && vt->top_wired)) { via_defs.push_back (SelectedViaDefinition (lib, pc->second, *vt)); } } diff --git a/src/db/db/dbVia.h b/src/db/db/dbVia.h index 91bad19ff..78f24a304 100644 --- a/src/db/db/dbVia.h +++ b/src/db/db/dbVia.h @@ -194,7 +194,7 @@ struct SelectedViaDefinition }; DB_PUBLIC std::vector -find_via_definitions_for (const std::string &technology, const db::LayerProperties &layer); +find_via_definitions_for (const std::string &technology, const db::LayerProperties &layer, int dir); } diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 93e99303c..701fe2691 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -213,6 +213,10 @@ MainService::menu_activated (const std::string &symbol) cm_make_cell_variants (); } else if (symbol == "edt::via") { cm_via (); + } else if (symbol == "edt::via_up") { + cm_via_up (); + } else if (symbol == "edt::via_down") { + cm_via_down (); } } @@ -2443,6 +2447,24 @@ MainService::cm_tap () void MainService::cm_via () +{ + via_impl (0); +} + +void +MainService::cm_via_up () +{ + via_impl (1); +} + +void +MainService::cm_via_down () +{ + via_impl (-1); +} + +void +MainService::via_impl (int dir) { #if ! defined(HAVE_QT) tl_assert (false); // see TODO @@ -2461,7 +2483,7 @@ MainService::cm_via () edt::Service *es = dynamic_cast (view ()->canvas ()->active_service ()); if (es) { - es->via (); + es->via (dir); } else { #if 0 // @@@ diff --git a/src/edt/edt/edtMainService.h b/src/edt/edt/edtMainService.h index 698ede7f4..c21e94d7c 100644 --- a/src/edt/edt/edtMainService.h +++ b/src/edt/edt/edtMainService.h @@ -201,10 +201,20 @@ public: void cm_tap (); /** - * @brief Via operation + * @brief Via operation (up or down) */ void cm_via (); + /** + * @brief Via operation (down) + */ + void cm_via_down (); + + /** + * @brief Via operation (up) + */ + void cm_via_up (); + /** * @brief "paste" operation */ @@ -247,6 +257,7 @@ private: edt::MakeArrayOptionsDialog *mp_make_array_options_dialog; #endif + void via_impl (int dir); void boolean_op (int mode); void check_no_guiding_shapes (); void descend (bool make_new_top); diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 956883d01..7a9bb5f84 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -383,6 +383,8 @@ public: // Key binding only menu_entries.push_back (lay::menu_item ("edt::via", "via:edit_mode", "@secrets.end", tl::to_string (tr ("Via")) + "(V)")); + menu_entries.push_back (lay::menu_item ("edt::via_up", "via_up:edit_mode", "@secrets.end", tl::to_string (tr ("Via up")))); + menu_entries.push_back (lay::menu_item ("edt::via_down", "via_down:edit_mode", "@secrets.end", tl::to_string (tr ("Via down")))); } bool configure (const std::string &name, const std::string &value) diff --git a/src/edt/edt/edtService.cc b/src/edt/edt/edtService.cc index b7c584d78..69fa801fe 100644 --- a/src/edt/edt/edtService.cc +++ b/src/edt/edt/edtService.cc @@ -1718,7 +1718,7 @@ Service::tap (const db::DPoint & /*initial*/) } void -Service::via () +Service::via (int) { // .. nothing here .. } diff --git a/src/edt/edt/edtService.h b/src/edt/edt/edtService.h index 226994a6d..d20a83f6e 100644 --- a/src/edt/edt/edtService.h +++ b/src/edt/edt/edtService.h @@ -379,8 +379,10 @@ public: /** * @brief Implements the via feature + * + * "dir" is 0 for up or down, -1 for down and +1 for up. */ - virtual void via (); + virtual void via (int dir); /** * @brief Delete the selected rulers diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index 6e65b6cee..afff27a52 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -1453,7 +1453,7 @@ PathService::selection_applies (const lay::ObjectInstPath &sel) const } void -PathService::via () +PathService::via (int dir) { #if ! defined(HAVE_QT) tl_assert (false); // see TODO @@ -1469,7 +1469,7 @@ PathService::via () } db::LayerProperties lp = layout ().get_properties (layer ()); - std::vector via_defs = db::find_via_definitions_for (layout ().technology_name (), lp); + std::vector via_defs = db::find_via_definitions_for (layout ().technology_name (), lp, dir); db::SelectedViaDefinition via_def; diff --git a/src/edt/edt/edtServiceImpl.h b/src/edt/edt/edtServiceImpl.h index 921cf5b8e..7b002a6df 100644 --- a/src/edt/edt/edtServiceImpl.h +++ b/src/edt/edt/edtServiceImpl.h @@ -238,7 +238,7 @@ public: virtual void do_finish_edit (); virtual void do_cancel_edit (); virtual bool do_activated (); - virtual void via (); + virtual void via (int dir); virtual bool selection_applies (const lay::ObjectInstPath &sel) const; protected: