Skip to content

Commit 9441024

Browse files
Merge pull request #1943 from KLayout/hotfix-0.29.10
Hotfix 0.29.10
2 parents e51a89b + d9957be commit 9441024

File tree

15 files changed

+169
-97
lines changed

15 files changed

+169
-97
lines changed

Changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
0.29.10 (2024-12-03):
2+
* Bug: %GITHUB%/issues/1941 Crash with the navigator open
3+
* Bug: %GITHUB%/issues/1942 Syntax error in pyi stubs
4+
As a bonus, added defaults for Box#enlarge and Box#enlarged (dx, dy)
5+
* Bugfix: Partial mode snapping now is object first, then grid
6+
* Bugfix: Key bindings have not been properly read from the configuration file
7+
The change in the configuration string structure triggered an old bug:
8+
Toolbar buttons had a twofold configuration and only the last one was
9+
considered. Changing the order of the entries could spoil the configuration.
10+
111
0.29.9 (2024-12-01):
212
* Bug: %GITHUB%/issues/1907 Locking layouts against modification during recursive iteration of instances and shapes
313
This prevents crashes in write-white-iterating scenarios

Changelog.Debian

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
klayout (0.29.10-1) unstable; urgency=low
2+
3+
* New features and bugfixes
4+
- See changelog
5+
6+
-- Matthias Köfferlein <[email protected]> Mon, 02 Dec 2024 22:23:47 +0100
7+
18
klayout (0.29.9-1) unstable; urgency=low
29

310
* New features and bugfixes

scripts/regenerate_stubs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# clean up
66
rm -rf build dist
7+
rm -rf python3-venv-make_stubs
78

89
python3 setup.py build
910
python3 setup.py bdist_wheel

src/db/db/gsiDeclDbBox.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ struct box_defs
388388
"\n"
389389
"@return A reference to this box.\n"
390390
) +
391-
method_ext ("moved", &box_defs<C>::moved, gsi::arg ("dx, 0"), gsi::arg ("dy", 0),
391+
method_ext ("moved", &box_defs<C>::moved, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
392392
"@brief Moves the box by a certain distance\n"
393393
"\n"
394394
"This is a convenience method which takes two values instead of a Point object.\n"
@@ -419,7 +419,7 @@ struct box_defs
419419
"\n"
420420
"@return The moved box.\n"
421421
) +
422-
method_ext ("enlarge", &box_defs<C>::enlarge, gsi::arg ("dx"), gsi::arg ("dy"),
422+
method_ext ("enlarge", &box_defs<C>::enlarge, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
423423
"@brief Enlarges the box by a certain amount.\n"
424424
"\n"
425425
"\n"
@@ -436,7 +436,7 @@ struct box_defs
436436
"\n"
437437
"@return A reference to this box.\n"
438438
) +
439-
method_ext ("enlarged", &box_defs<C>::enlarged, gsi::arg ("dx"), gsi::arg ("dy"),
439+
method_ext ("enlarged", &box_defs<C>::enlarged, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
440440
"@brief Enlarges the box by a certain amount.\n"
441441
"\n"
442442
"\n"

src/edt/edt/edtPartialService.cc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,11 +1808,38 @@ PartialService::mouse_move_event (const db::DPoint &p, unsigned int buttons, boo
18081808
// for a single selected point or edge, m_start is the original position and we snap the target -
18091809
// thus, we can bring the point on grid or to an object's edge or vertex
18101810
snap_details = snap2 (p);
1811+
18111812
if (snap_details.object_snap == lay::PointSnapToObjectResult::NoObject) {
1813+
18121814
m_current = m_start + snap_move (p - m_start);
1815+
18131816
} else {
1814-
m_current = m_start + snap_move (snap_details.snapped_point - m_start);
1817+
1818+
auto snapped_to_object = snap_details.snapped_point;
1819+
m_current = snapped_to_object;
1820+
1821+
if (snap_details.object_snap != lay::PointSnapToObjectResult::ObjectVertex) {
1822+
// snap to grid on longer side of reference edge and to object on shorter
1823+
auto snapped_to_object_and_grid = m_start + snap_move (snapped_to_object - m_start);
1824+
if (std::abs (snap_details.object_ref.dx ()) > std::abs (snap_details.object_ref.dy ())) {
1825+
m_current.set_x (snapped_to_object_and_grid.x ());
1826+
// project to edge, so we always hit it
1827+
auto cp = snap_details.object_ref.cut_point (db::DEdge (m_current, m_current + db::DVector (0, 1.0)));
1828+
if (cp.first) {
1829+
m_current.set_y (cp.second.y ());
1830+
}
1831+
} else if (std::abs (snap_details.object_ref.dy ()) > std::abs (snap_details.object_ref.dx ())) {
1832+
m_current.set_y (snapped_to_object_and_grid.y ());
1833+
// project to edge, so we always hit it
1834+
auto cp = snap_details.object_ref.cut_point (db::DEdge (m_current, m_current + db::DVector (1.0, 0)));
1835+
if (cp.first) {
1836+
m_current.set_x (cp.second.x ());
1837+
}
1838+
}
1839+
}
1840+
18151841
mouse_cursor_from_snap_details (snap_details);
1842+
18161843
}
18171844

18181845
} else {

src/lay/lay/layMacroController.cc

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ MacroController::uninitialize (lay::Dispatcher * /*root*/)
208208
bool
209209
MacroController::configure (const std::string &key, const std::string &value)
210210
{
211-
if (key == cfg_key_bindings) {
212-
m_key_bindings = unpack_key_binding (value);
213-
} else if (key == cfg_menu_items_hidden) {
214-
m_menu_items_hidden = unpack_menu_items_hidden (value);
215-
}
216211
return false;
217212
}
218213

@@ -810,21 +805,9 @@ MacroController::do_update_menu_with_macros ()
810805
add_macro_items_to_menu (m_temp_macros, used_names, groups, tech);
811806
add_macro_items_to_menu (lym::MacroCollection::root (), used_names, groups, tech);
812807

813-
// apply the custom keyboard shortcuts
814-
for (std::vector<std::pair<std::string, std::string> >::const_iterator kb = m_key_bindings.begin (); kb != m_key_bindings.end (); ++kb) {
815-
if (mp_mw->menu ()->is_valid (kb->first)) {
816-
lay::Action *a = mp_mw->menu ()->action (kb->first);
817-
a->set_shortcut (kb->second);
818-
}
819-
}
820-
821-
// apply the custom hidden flags
822-
for (std::vector<std::pair<std::string, bool> >::const_iterator hf = m_menu_items_hidden.begin (); hf != m_menu_items_hidden.end (); ++hf) {
823-
if (mp_mw->menu ()->is_valid (hf->first)) {
824-
lay::Action *a = mp_mw->menu ()->action (hf->first);
825-
a->set_hidden (hf->second);
826-
}
827-
}
808+
// apply the custom keyboard shortcuts and hidden flags
809+
mp_mw->apply_key_bindings ();
810+
mp_mw->apply_hidden ();
828811
}
829812

830813
void

src/lay/lay/layMacroController.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ private slots:
249249
tl::DeferredMethod<MacroController> dm_do_sync_with_external_sources;
250250
tl::DeferredMethod<MacroController> dm_sync_file_watcher;
251251
tl::DeferredMethod<MacroController> dm_sync_files;
252-
std::vector<std::pair<std::string, std::string> > m_key_bindings;
253-
std::vector<std::pair<std::string, bool> > m_menu_items_hidden;
254252

255253
void sync_implicit_macros (bool ask_before_autorun);
256254
void add_macro_items_to_menu (lym::MacroCollection &collection, std::set<std::string> &used_names, std::set<std::string> &groups, const db::Technology *tech);

src/lay/lay/layMainWindow.cc

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,8 @@ MainWindow::configure (const std::string &name, const std::string &value)
11921192

11931193
} else if (name == cfg_menu_items_hidden) {
11941194

1195-
std::vector<std::pair<std::string, bool> > hidden = unpack_menu_items_hidden (value);
1196-
apply_hidden (hidden);
1195+
m_hidden = unpack_menu_items_hidden (value);
1196+
apply_hidden ();
11971197
return true;
11981198

11991199
} else if (name == cfg_initial_technology) {
@@ -1213,12 +1213,15 @@ MainWindow::configure (const std::string &name, const std::string &value)
12131213
}
12141214

12151215
void
1216-
MainWindow::apply_hidden (const std::vector<std::pair<std::string, bool> > &hidden)
1216+
MainWindow::apply_hidden ()
12171217
{
1218-
for (std::vector<std::pair<std::string, bool> >::const_iterator hf = hidden.begin (); hf != hidden.end (); ++hf) {
1219-
if (menu ()->is_valid (hf->first)) {
1220-
lay::Action *a = menu ()->action (hf->first);
1221-
a->set_hidden (hf->second);
1218+
for (std::vector<std::pair<std::string, bool> >::const_iterator hf = m_hidden.begin (); hf != m_hidden.end (); ++hf) {
1219+
lay::AbstractMenuItem *item = menu ()->find_item_exact (hf->first);
1220+
if (item && item->primary ()) {
1221+
lay::Action *a = item->action ();
1222+
if (a) {
1223+
a->set_hidden (hf->second);
1224+
}
12221225
}
12231226
}
12241227
}
@@ -1227,9 +1230,12 @@ void
12271230
MainWindow::apply_key_bindings ()
12281231
{
12291232
for (std::vector<std::pair<std::string, std::string> >::const_iterator kb = m_key_bindings.begin (); kb != m_key_bindings.end (); ++kb) {
1230-
if (menu ()->is_valid (kb->first)) {
1231-
lay::Action *a = menu ()->action (kb->first);
1232-
a->set_shortcut (kb->second);
1233+
lay::AbstractMenuItem *item = menu ()->find_item_exact (kb->first);
1234+
if (item && item->primary ()) {
1235+
lay::Action *a = item->action ();
1236+
if (a) {
1237+
a->set_shortcut (kb->second);
1238+
}
12331239
}
12341240
}
12351241
}

src/lay/lay/layMainWindow.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,16 @@ Q_OBJECT
534534
*/
535535
static std::vector<std::string> menu_symbols ();
536536

537+
/**
538+
* @brief For internal use: apply current key bindings
539+
*/
540+
void apply_key_bindings ();
541+
542+
/**
543+
* @brief For internal use: apply hidden menu flags
544+
*/
545+
void apply_hidden ();
546+
537547
/**
538548
* @brief Open a new layout in mode 'mode'
539549
*
@@ -770,6 +780,7 @@ protected slots:
770780
double m_default_grid;
771781
bool m_default_grids_updated;
772782
std::vector<std::pair<std::string, std::string> > m_key_bindings;
783+
std::vector<std::pair<std::string, bool> > m_hidden;
773784
bool m_new_layout_current_panel;
774785
bool m_synchronized_views;
775786
bool m_synchronous;
@@ -864,8 +875,6 @@ protected slots:
864875
void plugin_removed (lay::PluginDeclaration *cls);
865876

866877
void libraries_changed ();
867-
void apply_key_bindings ();
868-
void apply_hidden (const std::vector<std::pair <std::string, bool> > &hidden);
869878
};
870879

871880
}

src/laybasic/laybasic/layAbstractMenu.cc

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,22 @@ parse_menu_title (const std::string &s, std::string &title, std::string &shortcu
220220
// AbstractMenuItem implementation
221221

222222
AbstractMenuItem::AbstractMenuItem (Dispatcher *dispatcher)
223-
: mp_action (new Action ()), mp_dispatcher (dispatcher), m_has_submenu (false), m_remove_on_empty (false)
223+
: mp_action (new Action ()), mp_dispatcher (dispatcher), m_has_submenu (false), m_remove_on_empty (false), m_primary (false)
224224
{
225225
// ... nothing yet ..
226226
}
227227

228228
AbstractMenuItem::AbstractMenuItem (const AbstractMenuItem &item)
229-
: mp_action (new Action ()), mp_dispatcher (item.dispatcher ()), m_has_submenu (false), m_remove_on_empty (false)
229+
: mp_action (new Action ()), mp_dispatcher (item.dispatcher ()), m_has_submenu (false), m_remove_on_empty (false), m_primary (false)
230230
{
231231
// ... nothing yet ..
232232
}
233233

234234
void
235-
AbstractMenuItem::setup_item (const std::string &pn, const std::string &s, Action *a)
235+
AbstractMenuItem::setup_item (const std::string &pn, const std::string &s, Action *a, bool primary)
236236
{
237+
m_primary = primary;
238+
237239
m_basename.clear ();
238240

239241
tl::Extractor ex (s.c_str ());
@@ -1587,6 +1589,8 @@ AbstractMenu::items (const std::string &path) const
15871589
void
15881590
AbstractMenu::insert_item (const std::string &p, const std::string &name, Action *action)
15891591
{
1592+
bool primary = true;
1593+
15901594
tl::Extractor extr (p.c_str ());
15911595
while (! extr.at_end ()) {
15921596

@@ -1601,7 +1605,8 @@ AbstractMenu::insert_item (const std::string &p, const std::string &name, Action
16011605
parent->children.insert (iter, AbstractMenuItem (mp_dispatcher));
16021606
--iter;
16031607

1604-
iter->setup_item (parent->name (), name, action);
1608+
iter->setup_item (parent->name (), name, action, primary);
1609+
primary = false;
16051610

16061611
// find any items with the same name and remove them
16071612
for (std::list<AbstractMenuItem>::iterator existing = parent->children.begin (); existing != parent->children.end (); ) {
@@ -1635,7 +1640,7 @@ AbstractMenu::insert_separator (const std::string &p, const std::string &name)
16351640
--iter;
16361641
Action *action = new Action ();
16371642
action->set_separator (true);
1638-
iter->setup_item (parent->name (), name, action);
1643+
iter->setup_item (parent->name (), name, action, true);
16391644

16401645
}
16411646

@@ -1655,7 +1660,7 @@ AbstractMenu::insert_menu (const std::string &p, const std::string &name, Action
16551660

16561661
parent->children.insert (iter, AbstractMenuItem (mp_dispatcher));
16571662
--iter;
1658-
iter->setup_item (parent->name (), name, action);
1663+
iter->setup_item (parent->name (), name, action, true);
16591664
iter->set_has_submenu ();
16601665

16611666
// find any items with the same name and remove them
@@ -1945,7 +1950,7 @@ AbstractMenu::find_item (tl::Extractor &extr)
19451950
if (parent) {
19461951
parent->children.insert (iter, AbstractMenuItem (mp_dispatcher));
19471952
--iter;
1948-
iter->setup_item (parent->name (), n, new Action ());
1953+
iter->setup_item (parent->name (), n, new Action (), true);
19491954
iter->set_has_submenu ();
19501955
iter->set_remove_on_empty ();
19511956
iter->set_action_title (ndesc.empty () ? n : ndesc);
@@ -2055,16 +2060,17 @@ AbstractMenu::get_shortcuts (const std::string &root, std::map<std::string, std:
20552060
std::vector<std::string> items = this->items (root);
20562061
for (std::vector<std::string>::const_iterator i = items.begin (); i != items.end (); ++i) {
20572062
if (i->size () > 0) {
2058-
if (is_valid (*i) && action (*i)->is_visible ()) {
2059-
if (is_menu (*i)) {
2063+
const AbstractMenuItem *item = find_item_exact (*i);
2064+
if (item && item->action () && item->action ()->is_visible ()) {
2065+
if (item->has_submenu ()) {
20602066
// a menu must be listed (so it can be hidden), but does not have a shortcut
20612067
// but we don't include special menus
20622068
if (i->at (0) != '@') {
20632069
bindings.insert (std::make_pair (*i, std::string ()));
20642070
}
20652071
get_shortcuts (*i, bindings, with_defaults);
2066-
} else if (! is_separator (*i)) {
2067-
bindings.insert (std::make_pair (*i, with_defaults ? action (*i)->get_default_shortcut () : action (*i)->get_effective_shortcut ()));
2072+
} else if (! item->action ()->is_separator () && item->primary ()) {
2073+
bindings.insert (std::make_pair (*i, with_defaults ? item->action ()->get_default_shortcut () : item->action ()->get_effective_shortcut ()));
20682074
}
20692075
}
20702076
}

0 commit comments

Comments
 (0)