Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/lay/lay/layMainWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,33 @@ MainWindow::cm_clone ()
clone_current_view ();
}

void
MainWindow::cm_prev_panel ()
{
int n = int (views ());
int index = current_view_index ();
if (index >= 0 && n > 0) {
// avoid select_view for a no-op switch: it would cancel an interactive operation
int target = (index + n - 1) % n;
if (target != index) {
select_view (target);
}
}
}

void
MainWindow::cm_next_panel ()
{
int n = int (views ());
int index = current_view_index ();
if (index >= 0 && n > 0) {
int target = (index + 1) % n;
if (target != index) {
select_view (target);
}
}
}

void
MainWindow::clone_current_view ()
{
Expand Down Expand Up @@ -4103,6 +4130,10 @@ MainWindow::menu_activated (const std::string &symbol)
cm_new_layout ();
} else if (symbol == "cm_clone") {
cm_clone ();
} else if (symbol == "cm_prev_panel") {
cm_prev_panel ();
} else if (symbol == "cm_next_panel") {
cm_next_panel ();
} else if (symbol == "cm_close_all") {
cm_close_all ();
} else if (symbol == "cm_close") {
Expand Down Expand Up @@ -4587,6 +4618,8 @@ class MainWindowPluginDeclaration
menu_entries.push_back (lay::menu_item ("cm_close", "close:edit", at, tl::to_string (QObject::tr ("Close(Ctrl+W)"))));
menu_entries.push_back (lay::menu_item ("cm_close_all", "close_all:edit", at, tl::to_string (QObject::tr ("Close All(Shift+Ctrl+W)"))));
menu_entries.push_back (lay::menu_item ("cm_clone", "clone", at, tl::to_string (QObject::tr ("Clone Panel"))));
menu_entries.push_back (lay::menu_item ("cm_prev_panel", "prev_panel", at, tl::to_string (QObject::tr ("Previous Panel(Ctrl+PgUp)"))));
menu_entries.push_back (lay::menu_item ("cm_next_panel", "next_panel", at, tl::to_string (QObject::tr ("Next Panel(Ctrl+PgDown)"))));
menu_entries.push_back (lay::menu_item ("cm_reload", "reload:edit", at, tl::to_string (QObject::tr ("Reload(Ctrl+R)"))));
menu_entries.push_back (lay::menu_item ("cm_refresh", "refresh:edit", at, tl::to_string (QObject::tr ("Refresh Libraries"))));
menu_entries.push_back (lay::menu_item ("cm_pull_in", "pull_in:edit", at, tl::to_string (QObject::tr ("Pull In Other Layout"))));
Expand Down
2 changes: 2 additions & 0 deletions src/lay/lay/layMainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ protected slots:
void cm_new_panel ();
void cm_new_layout ();
void cm_clone ();
void cm_prev_panel ();
void cm_next_panel ();
void cm_close_all ();
void cm_close ();
void cm_packages ();
Expand Down
Loading