2718 |
2718 |
2719 makeToBaseLine:aLnNr |
2719 makeToBaseLine:aLnNr |
2720 "rotate lines to make the line #aLnNr be the new base line (i.e. |
2720 "rotate lines to make the line #aLnNr be the new base line (i.e. |
2721 subtract (aLnNr-1) from all lines and take modulu the number of lines" |
2721 subtract (aLnNr-1) from all lines and take modulu the number of lines" |
2722 |
2722 |
2723 |lineTopsOrLefts isHorizontal| |
2723 |listLocal lineTopsOrLefts isHorizontal| |
2724 |
2724 |
2725 isHorizontal := self isHorizontal. |
2725 isHorizontal := self isHorizontal. |
|
2726 |
|
2727 "sr: keep the list as a local copy, |
|
2728 because list is an instance variable, |
|
2729 which can be changed during the processing of this method. |
|
2730 which did happend to me. |
|
2731 calling #at: with an index fetched by #findFirst: |
|
2732 will fail, if the list has been modified in the meanwhile" |
|
2733 listLocal := list copy. |
2726 |
2734 |
2727 "collect per-lineNr offsets" |
2735 "collect per-lineNr offsets" |
2728 lineTopsOrLefts := (1 to:self numberOfLines) collect:[:lnr | |
2736 lineTopsOrLefts := (1 to:self numberOfLines) collect:[:lnr | |
2729 |tabNr layout| |
2737 |tabNr layout| |
2730 |
2738 |
2731 tabNr := list findFirst:[:aTab| aTab lineNr == lnr]. |
2739 "sr: calling #at: with an index fetched by #findFirst: |
2732 layout := (list at:tabNr) unselectedLayout. |
2740 will fail, if the list has been modified in the meanwhile" |
|
2741 tabNr := listLocal findFirst:[:aTab| aTab lineNr == lnr]. |
|
2742 layout := (listLocal at:tabNr) unselectedLayout. |
2733 isHorizontal ifTrue:[ |
2743 isHorizontal ifTrue:[ |
2734 layout top. |
2744 layout top. |
2735 ] ifFalse:[ |
2745 ] ifFalse:[ |
2736 layout left. |
2746 layout left. |
2737 ]. |
2747 ]. |
2738 ]. |
2748 ]. |
2739 |
2749 |
2740 "change offsets of all tabs" |
2750 "change offsets of all tabs" |
2741 list do:[:el | |
2751 listLocal do:[:el | |
2742 |layout topOrLeft nr newNr| |
2752 |layout topOrLeft nr newNr| |
2743 |
2753 |
2744 nr := el lineNr. |
2754 nr := el lineNr. |
2745 newNr := nr - aLnNr + 1. |
2755 newNr := nr - aLnNr + 1. |
2746 newNr <= 0 ifTrue:[ newNr := newNr + numberOfLines]. |
2756 newNr <= 0 ifTrue:[ newNr := newNr + numberOfLines]. |