Author Topic: REGRESSION: Tiling Issues - Windows not staying tiled  (Read 4274 times)

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
REGRESSION: Tiling Issues - Windows not staying tiled
« on: February 22, 2013, 07:06:08 PM »
I've been using slickedit for nearly 20 years, for the first 19 or so tiled windows stayed tiled. Now they are not. I've been waiting to try to have a set of reproducible steps but no luck. But, I can't take it anymore so I'm hoping that posting something will lead to a solution or fix.

Basically I'm in 'brief' mode. I maximize the first window and from that point on I use F3 (create-tile) to split windows and F4 (delete-tile) to unsplit them. Alt-Arrow moves between windows (window-right, window-left, window-up, window-down). This has always stayed perfectly tiled for many years... until recently.

Now, after a certain combination of splits/unsplits I get slickedit into a state where switching between windows brings up hidden tiles. So like I might have just 2 tiles. Pressing Alt-Left (switching from the right tile to the left tile) suddenly brings up a bunch of other windows.

See screenshots

tile-issue-01.png shows 2 tiles. The left tile is the active window. I press Alt-Right (window-right) and suddenly a 3rd tile shows up. (tile-issue-02.png). It's not really a tile though because it's overlapping what was the left most tile as opposed to splitting it (though it shouldn't have shown up at all)

Any ideas how to fix this?

« Last Edit: February 22, 2013, 07:08:07 PM by greggman »

sndom

  • Community Member
  • Posts: 70
  • Hero Points: 1
Re: REGRESSION: Tiling Issues - Windows not staying tiled
« Reply #1 on: March 22, 2013, 12:24:57 PM »
Ditto - I've seen the same thing happening, but without a specific cause I can identify.

Dom

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6990
  • Hero Points: 533
Re: REGRESSION: Tiling Issues - Windows not staying tiled
« Reply #2 on: March 22, 2013, 03:59:14 PM »
I use tiled windows all the time. Sometimes my tiles get out of wack and I can never reproduce it either. I'm sure there's a reproducable test case for this but I've never found it.

The only good news I have is that you won't find this bug in v18. The MDI support is being completely rewritten and the tiles will be enforced (no support for cascaded windows).

V18:
  • Sizing MDI frame will size tiles proportional!!!
  • Ability to drag edit window tiles outside MDI frame
  • Tabbed style windowing
  • After horizontal split, can vertical split and vice versa
  • Zoom and unzoom tile

If you use tiled windowing, v18 will be MUCH better. I size the MDI frame all the time and the current tiled windowing just doesn't support it. This drives me nuts (or used to - I'm using the alpha version).

Keep monitoring the forum for a beta announcement. It's only a matter of weeks.

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Re: REGRESSION: Tiling Issues - Windows not staying tiled
« Reply #3 on: March 22, 2013, 04:11:44 PM »
Tile linkage can be broken if the tiles are resized so that their height/width no longer are equal along the seam, or if they are not adjacent (seam gap). I will post some window activation code that may help as a substitute, basically the code activates a window relative to the currently active window in 8 directions, up,down,left,right and diagonals. Adjust the key bindings to your liking before loading the module. Note: This code is guaranteed to not work perfectly in all cases :)

How it works: Using the center of the active window as a starting point, points are queried in the direction given to find a window that has a portion showing. The step of the query is given a granularity of 150 pixels -- this means it may miss windows showing only a small part of themselves (which is by design for coding expediency sake). The upshot of it all is that the code will work as expected so long as your window layout is reasonably tidy, otherwise it may activate something you do not expect.

Also, the diagonal search is not on 45 degrees, but takes its angle from the shape of the active window -- this means the search for a bottom-right window for example is going to follow a line from the center of the active window to its bottom-right corner.

CORRECTION: It does not filter for the state of the window (oops), so minimized windows are candidates also according to their restored size. Correction has been posted in winact_wins, I think this works now to ignore windows that are not p_window_state='restored'.
Code: [Select]
    #pragma option(strict2,on)
    #pragma option(strictprotos,on)
    #include "slick.sh"
    defeventtab default_keys;
    def '`' 'DOWN'= winact_d;
    def '`' 'UP'= winact_u;
    def '`' 'RIGHT'= winact_r;
    def '`' 'LEFT'= winact_l;
    def '`' 'HOME'= winact_ul;
    def '`' 'END'= winact_dl;
    def '`' 'PGUP'= winact_ur;
    def '`' 'PGDN'= winact_dr;
      definit(){
        //The definit module is called before defload
        //the definit procedure is invoked each time the editor is invoked
        if (arg(1)!="L")  {
          //  This is an editor invocation
        }
      }
      defload(){
      }
      _command void winact_test() name_info(','){
        int i=winact_pane_get('r');
        //Msg(i);
        if (i!=0) {
          activate_window(i);
          _set_focus();
        }
      }
      _command int winact_dir(_str udlr=''){
        if (udlr=='') {
          return 1;
        }
        int i=winact_pane_get(udlr);
        if (i!=0) {
          activate_window(i);
          _set_focus();
          return 0;
        }
        return 1;
      }
      _command int winact_r(){
        return winact_dir('r');
      }
      _command int winact_l(){
        return winact_dir('l');
      }
      _command int winact_u(){
        return winact_dir('u');
      }
      _command int winact_d(){
        return winact_dir('d');
      }
      _command int winact_ur(){
        return winact_dir('ur');
      }
      _command int winact_ul(){
        return winact_dir('ul');
      }
      _command int winact_dr(){
        return winact_dir('dr');
      }
      _command int winact_dl(){
        return winact_dir('dl');
      }
      static int winact_pane_get(_str udlr,int gran=150){
        // was winp_pane_get
        //winact_win_list();
        typeless a=winact_wins();
        if (a._length()<2) {
          //Msg('ok');
          return 0;
        }
        if (0) {
          int cx,cy,cw,ch;
          _MDIChildGetWindow(cx,cy,cw,ch);
          say('x:'(cx));
          say('x+w:'(cx+cw));
          //_MDIChildSetWindow(cx+cw,cy,cw,ch);
          //return 0;
        }
         double xi=0.0;
         double yi=0;
         if (pos('u',udlr)) {yi=-1;}
         if (pos('d',udlr)) {yi=1;}
         if (pos('l',udlr)) {xi=-1;}
         if (pos('r',udlr)) {xi=1;}
         //say('A xi:'xi' yi:'yi);
         int x_,y_;
         winact_child_center(x_,y_);
         int wid=p_window_id;
         double w_w=(wid.p_window_state=='I')?wid.p_old_width:wid.p_width;
         double w_h=(wid.p_window_state=='I')?wid.p_old_height:wid.p_height;
         int nid=wid;
         xi=xi*gran;
         //say('xi:'xi' yi:'yi);
         yi=yi*gran;
         yi=yi*(w_h/w_w);
         yi=yi intdiv 1;
         //say('xi:'xi' yi:'yi);
         int z=0;
         int y=y_;
         int x=x_;
         //msg_2(gran);
         int xyh=0;
         //p_client_width
         //p_client_height
         int mx,my,mx2,my2;
         mx=0;my=0;
         mx2=_mdi.p_client_width;
         my2=_mdi.p_client_height;
         //winp_mdi_screen_pos(mx,my,mx2,my2);
         int zzz=0;
         while (1) {
            x+=(1*xi);
            y+=(1*yi);
            z++;
            if (z>1000) {
              //say('z>100');
              //Msg('>1000');
              int x1;
              for (x1=0;x1<a._length();x1++) {
                int ii=a[x1];
                if (ii!=wid) {
                  return ii;
                }
              }
              return 0;
            }
            //gdi_rop_rect_on_desk(x,y,x+10,y+10);
            //gdi_focus_rects_on_desk_zoom(x,y,x+20,y+20,.04,2,1);
            //say('x:'x' y:'y);
            nid=winact_first_child_with_xy(x,y);
            if (nid!=0) {
              break;
            }
            if (x<mx||x>mx2) {
               xi=xi*-1;
               xyh++;
               if (xyh>2) {
                  yi=yi+10;
                  xyh=0;
               }
            }
            if (y<my||y>my2) {
               yi=yi*-1;
               xyh++;
               if (xyh>2) {
                  xi=xi+10;
                  xyh=0;
               }
            }
            if (z>200) {
               //break;
            }
         }
         if (nid==0) {
            if (gran>4) {
               winact_pane_get(udlr,(gran intdiv 2));
            }
         }
         //Msg('nid:'nid);
         return(nid);
      }
      static typeless winact_wins(){
        typeless a[];
        int first_window_id=p_window_id;
        if (p_window_id==0) {
          return a;
        }
        a[a._length()]=p_window_id;
        int view_id=0;
        get_window_id(view_id);
        for (;;) {
           _next_window('HR');
           if ( p_window_id==first_window_id ) {
              return a;
           }
           //Corrected code to deal with only restored windows
           if (p_window_id.p_window_state=='N') {
             a[a._length()]=p_window_id;
           }
        }
        return a;
      }
      static winact_win_list(){
        int wid=p_window_id;
        typeless a=winact_wins();
        int x;
        for (x=0;x<a._length();x++) {
          //int view_id=wid.p_view_id;
          //int buf_id=view_id.p_buf_id;
          activate_window(a[x]);
          say(p_buf_name);
        }
        activate_window(wid);
      }
      static int winact_first_child_with_xy(int x_,int y_){
        int wid=p_window_id;
        typeless a=winact_wins();
        int rv=0;
        int x;
        for (x=1;x<a._length()-1;x++) {
          if (winact_win_has_xy(a[x],x_, y_)) {
            if (!winact_win_has_xy(a[0],x_, y_)) {
              return a[x];
            }
          }
        }
        return rv;
      }
      static void winact_say_bufname(int w,_str pfx=''){
        int wid=p_window_id;
        activate_window(w);
        say(pfx p_buf_name);
        activate_window(wid);
      }
      static boolean winact_win_has_xy(int w_,int x_,int y_){
        int wid=p_window_id;
        activate_window(w_);
        int w=w_;
        int cx,cy,cw,ch;
        _MDIChildGetWindow(cx,cy,cw,ch);
        activate_window(wid);
        if (cx<x_&&(cx+cw)>x_&&
            cy<y_&&(cy+ch)>y_
            ) {
          return true;
        }
        return false;
      }
      static void winact_child_center(int &x_,int &y_){
        int t_,r_,l_,b_;
        winact_child_trlb(t_,r_,l_,b_);
        x_=l_+((r_-l_)intdiv 2);
        y_=t_+((b_-t_)intdiv 2);
      }
      static void winact_child_trlb(int &t_,int &r_,int &l_,int &b_){
        int cx,cy,cw,ch;
        _MDIChildGetWindow(cx,cy,cw,ch);
         int x=cx;
         int y=cy;
         int ww=cw;
         int hh=ch;
         t_=y;
         l_=x;
         r_=x+ww;
         b_=y+hh;
      }

 
« Last Edit: March 22, 2013, 04:50:39 PM by MindprisM »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6990
  • Hero Points: 533
Re: REGRESSION: Tiling Issues - Windows not staying tiled
« Reply #4 on: March 22, 2013, 04:14:42 PM »
That's as designed, not a bug. Once you size a tile, the tiles are intentionally broken except when it's an edge between tiles.

v18 won't have this limitation either.
« Last Edit: March 22, 2013, 04:18:34 PM by Clark »

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
Re: REGRESSION: Tiling Issues - Windows not staying tiled
« Reply #5 on: March 23, 2013, 12:37:41 AM »
Awesome! Looking forward to V18 ;-)