ctrl-left arrow / ctrl-right arrow to quickly move between tabs

This commit is contained in:
Stefan Frederik 2022-01-10 04:30:51 +01:00
parent a19bdc01a6
commit b81ce64c0c
4 changed files with 93 additions and 6 deletions

View File

@ -92,12 +92,14 @@ LeftButton Double click Terminate Polygon placement
- BackSpace Back to parent schematic
- Delete Delete selected objects
- Insert Insert element from library
- Down Move down
ctrl Enter Confirm closing dialog boxes
- Escape Abort, redraw, unselect
ctrl Enter Confirm closing dialog boxes
- Down Move down
- Left Move right
- Right Move left
- Up Move up
ctrl Left Previous tab (if tabbed interface enabled)
ctrl Right Next tab (if tabbed interface enabled)
- '\' Toggle fullscreen
- '!' Break selected wires at any wire or component pin
connection

View File

@ -1321,7 +1321,15 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(xctx->semaphore >= 2) break;
delete(1/* to_push_undo */);break;
}
if(key==XK_Right) /* left */
if(key==XK_Left && state == ControlMask) /* previous tab */
{
tcleval("prev_tab");
}
if(key==XK_Right && state == ControlMask) /* next tab */
{
tcleval("next_tab");
}
if(key==XK_Right && state == 0) /* left */
{
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
@ -1332,7 +1340,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
redraw_w_a_l_r_p_rubbers();
break;
}
if(key==XK_Left) /* right */
if(key==XK_Left && state == 0) /* right */
{
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);

View File

@ -51,12 +51,14 @@ LeftButton Double click Terminate Polygon placement
- BackSpace Back to parent schematic
- Delete Delete selected objects
- Insert Insert element from library
- Down Move down
ctrl Enter Confirm closing dialog boxes
- Escape Abort, redraw, unselect
ctrl Enter Confirm closing dialog boxes
- Down Move down
- Left Move right
- Right Move left
- Up Move up
ctrl Left Previous tab (if tabbed interface enabled)
ctrl Right Next tab (if tabbed interface enabled)
- '\' Toggle fullscreen
- '!' Break selected wires at any wire or component pin
connection

View File

@ -3749,7 +3749,57 @@ proc delete_tab {path} {
destroy $top_path.tabs$path
}
proc prev_tab {} {
global tabbed_interface
if { !$tabbed_interface} { return}
set top_path [xschem get top_path]
set currwin [xschem get current_win_path]
regsub {\.drw} $currwin {} tabname
if {$tabname eq {}} { set tabname .x0}
regsub {\.x} $tabname {} number
set next_tab $number
set highest -10000000
set xcoord [winfo rootx $top_path.tabs$tabname]
for {set i 0} {$i < $tctx::max_new_windows} { incr i} {
if { $i == $number} { continue}
if { [winfo exists ${top_path}.tabs.x$i] } {
set tab_coord [winfo rootx $top_path.tabs.x$i]
if {$tab_coord < $xcoord && $tab_coord > $highest} {
set next_tab $i
set highest $tab_coord
}
}
}
$top_path.tabs.x$next_tab invoke
}
proc next_tab {} {
global tabbed_interface
if { !$tabbed_interface} {return}
set top_path [xschem get top_path]
set currwin [xschem get current_win_path]
regsub {\.drw} $currwin {} tabname
if {$tabname eq {}} { set tabname .x0}
regsub {\.x} $tabname {} number
set next_tab $number
set lowest 10000000
set xcoord [winfo rootx $top_path.tabs$tabname]
for {set i 0} {$i < $tctx::max_new_windows} { incr i} {
if { $i == $number} { continue}
if { [winfo exists ${top_path}.tabs.x$i] } {
set tab_coord [winfo rootx $top_path.tabs.x$i]
if {$tab_coord > $xcoord && $tab_coord < $lowest} {
set next_tab $i
set lowest $tab_coord
}
}
}
$top_path.tabs.x$next_tab invoke
}
proc create_new_tab {} {
global tabbed_interface
if { !$tabbed_interface} {return}
set top_path [xschem get top_path]
set found 0
for { set i 1} { $i < $tctx::max_new_windows} { incr i} {
@ -3783,6 +3833,31 @@ proc set_tab_names {} {
}
}
proc test1 {} {
global tabbed_interface
set tabbed_interface 1
setup_tabbed_interface
xschem load [abs_sym_path rom8k.sch]
create_new_tab
xschem load [abs_sym_path poweramp.sch]
create_new_tab
xschem load [abs_sym_path mos_power_ampli.sch]
create_new_tab
xschem load [abs_sym_path rom8k.sch]
create_new_tab
xschem load [abs_sym_path autozero_comp.sch]
create_new_tab
xschem load [abs_sym_path LCC_instances.sch]
create_new_tab
xschem load [abs_sym_path simulate_ff.sch]
create_new_tab
xschem load [abs_sym_path led_driver.sch]
create_new_tab
xschem load [abs_sym_path solar_panel.sch]
}
proc raise_dialog {parent window_path } {
if {[winfo exists .dialog] && [winfo ismapped .dialog] && [winfo ismapped $parent] &&
[wm stackorder .dialog isbelow $parent ]} {