WIP: via up and via down

This commit is contained in:
Matthias Koefferlein 2025-08-18 23:33:44 +02:00
parent 331d16ab7c
commit 57cd512bf9
9 changed files with 48 additions and 10 deletions

View File

@ -45,7 +45,7 @@ ViaType::init ()
// ---------------------------------------------------------------------------------------
std::vector<SelectedViaDefinition>
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<SelectedViaDefinition> 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));
}
}

View File

@ -194,7 +194,7 @@ struct SelectedViaDefinition
};
DB_PUBLIC std::vector<SelectedViaDefinition>
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);
}

View File

@ -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<edt::Service *> (view ()->canvas ()->active_service ());
if (es) {
es->via ();
es->via (dir);
} else {
#if 0 // @@@

View File

@ -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);

View File

@ -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)

View File

@ -1718,7 +1718,7 @@ Service::tap (const db::DPoint & /*initial*/)
}
void
Service::via ()
Service::via (int)
{
// .. nothing here ..
}

View File

@ -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

View File

@ -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<db::SelectedViaDefinition> via_defs = db::find_via_definitions_for (layout ().technology_name (), lp);
std::vector<db::SelectedViaDefinition> via_defs = db::find_via_definitions_for (layout ().technology_name (), lp, dir);
db::SelectedViaDefinition via_def;

View File

@ -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: