21.14 Heapview Interface

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/utils/groupbox';
INCLUDE '../graphics';
INCLUDE '~beta/sysutils/heapinfo';
INCLUDE '~beta/basiclib/numberio';
-- windowLib: Attributes --
heapview: canvas
  (#
     onUpdate:<Object;
     ou:@onUpdate;
     t:@timer
       (# 
          action::<(# do
               ou; (* onUpdate; *)
               true->Ioacanvas.drawingarea.update;
               true->aoacanvas.drawingarea.update;
               true->CBFAcanvas.drawingarea.update;
            #);
       #);

     open::< 
       (# 
       do
          (360,130)->size;
          IOAcanvas.open;
          AOAcanvas.open;
          CBFAcanvas.open;
          50->t.start;
          INNER
       #);
     
     graphview: groupbox
     (# solution:(# exit 50#);
        priv:@
          (# data:[solution]@integer;
             max:@integer;
          #);
        
        name:<(# t:^text; do INNER; exit t[] #);
        nm:@name;
        value:<IntegerObject;
        val:@value;
        drawingArea:@canvas
          (# draw:@
               graphics
               (# dx:@real;
                  dy:@real;
                  imax:@max;
                  width,height:@integer;
                  mt:@moveto;
                  dt:@drawto;
               do this(canvas).size->(width,height);
                  (for i:solution-1 repeat 
                       priv.data[i+1]->priv.data[i];
                  for);
                  val (*value*) ->priv.data[solution];
                  
                  (priv.max,priv.data[solution])->imax->priv.max;
                  
                  width/solution->dx;
                  priv.max/height->dy;
                  
                  (dx,height-priv.data[1]/dy)->mt;
                  (for i:solution repeat
                       (i*dx,height-priv.data[i]/dy)->dt;
                  for);
               #);
             eventhandler::
               (# 
                  onrefresh::
                    (# cptext:^text;
                    do &text[]->cptext[];
                       draw;
                       nm->cptext.puttext;
                       ':'->cptext.put;
                       priv.data[solution]->cptext.putint;
                       cptext[]->title;
                    #);
               #);
             open::
               (# w,h:@integer;
               do father.size->(w,h);
                  (w-5,h-10)->size;
                  (3,14)->position;
                  true->bindleft;
                  true->bindright;
                  1->priv.max;
               #);
          #);                    
        open::<
          (# 
          do name->title; 
             drawingArea.open;
             INNER
          #);
     #);

     IOAcanvas: @graphview
       (#
          Value::
            (# do 5->getHeapInfo->value; #);
          name::(# do 'IOA'->t[];#);
          open::< 
            (# 
            do
               (110,120)->size;
               (5,5)->position;
               INNER
            #)
       #);
     AOAcanvas: @graphview
       (#
          Value::
            (# do 35->getHeapInfo->value;
               value-(36->getHeapInfo)->value;
            #);
          name::(# do 'AOA'->t[];#);          
          open::< 
            (# 
            do
               (110,120)->size;
               (125,5)->position;
               INNER
            #)
       #);
     CBFAcanvas: @graphview
       (# 
          Value::
            (# do 15->getHeapInfo->value; #);
          name::(# do 'CBFA'->t[];#);          
          open::< 
            (# 
            do
               (110,120)->size;
               (245,5)->position;
               INNER
            #)
       #)
  #)


21.14 Heapview Interface
© 1994-2002 Mjølner Informatics
[Modified: Wednesday August 2nd 2000 at 16:31]