EnglishРусский  

   ..

   btnsys.g

   funcs.g

   gena.g

   gfe.g

   viseditor.gi

   winedit.g

Bookmark and Share

Ads

Perfect Automation tool
All-In-One: Script editor, Launcher, Scheduler, Keyboard & Mouse Recorder. Try now!

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

source\lib\visedit\winedit.g
   1 type evparQueryCreate <inherit=eventpos> 
   2 {   
   3    uint Owner      
   4    uint TypeId
   5    uint NewComp
   6 }
   7 
   8 type evQueryCreate <inherit=evEvent>
   9 {
  10 }
  11 
  12 
  13 method evQueryCreate evQueryCreate.init
  14 {
  15    this.eventtypeid = evparQueryCreate
  16    return this
  17 }
  18 
  19 
  20 type vVEEdit <inherit=vCtrl>
  21 {
  22    uint winn //Текущий выбранный элемент
  23    uint winparent   
  24    uint VEPanel //Главная панель
  25    
  26    uint typ
  27    uint oper
  28    
  29    //RECT currt
  30    //uint mouseleft
  31    //uint mousetop
  32    
  33 	RECT rectold
  34 	uint offx, offy	
  35 	uint  wdown	
  36 	uint pen, brush, brushgr
  37    POINT discr
  38    uint flgadd
  39    
  40    /*vPanel panNoVis
  41    vPanel panVis*/
  42 
  43    evEvent  onSelect               
  44    evEvent  onDelete
  45    evEvent  onstartchange
  46    evQueryCreate onQueryCreate
  47    
  48 }
  49 
  50 type vVEPanel <inherit=vPanel>
  51 {
  52    vScrollBox  VisPanel
  53    vListView   NoVisList
  54    vVEEdit     WE
  55    uint        pSelected
  56    
  57    evEvent            onSelect
  58    evQueryCreate   onQueryCreate
  59    oneventuint OnDblClick
  60 }
  61 extern 
  62 {
  63    property vComp vVEPanel.Selected()
  64    property vVEPanel.Selected( vComp newcomp )
  65    method vVEPanel.DblClick()
  66 }
  67 
  68 type vVEFrame <inherit=vCtrl>
  69 {   
  70    uint WE
  71 }
  72 
  73 include {   
  74    "funcs.g"
  75 }
  76 
  77 extern
  78 {
  79    method vVEEdit.releasecapture()
  80 }
  81 
  82 define {
  83    OPERMOVE = 0x1   //Перемещение 
  84    OPERSIZE = 0x2   //Изменение размеров
  85    OPERNEW  = 0x4   //Новый компонент
  86    OPERFIRST = 0x10000
  87    OPERCHANGE = 0x20000
  88    
  89    
  90 }
  91 
  92 method RECT.set( int x, y )
  93 {
  94 	this.left = this.right = x
  95 	this.top = this.bottom = y	
  96 }
  97 
  98 method RECT.reframe( uint wnd, RECT rnew )
  99 {
 100 	uint hdc
 101 subfunc frame ( RECT r )
 102 {
 103 	MoveToEx( hdc, r.left, r.top, 0->POINT )
 104 	LineTo( hdc, r.right - 1, r.top )
 105 	LineTo( hdc, r.right - 1, r.bottom - 1 )
 106 	LineTo( hdc, r.left, r.bottom - 1)
 107 	LineTo( hdc, r.left, r.top )
 108 }  
 109 	hdc = GetDC( 0 )
 110 	SetROP2( hdc, $R2_NOT )
 111 	frame( this )	
 112 	frame( rnew )	
 113 	this = rnew
 114 	ReleaseDC( 0, hdc )	
 115 }
 116 
 117 method RECT.frame_del( uint wnd )
 118 {
 119 	RECT rectnew
 120 	rectnew.set( -0, -0 )
 121 	this.reframe( wnd, rectnew )
 122 }
 123 
 124 method RECT.frame_sel( uint wnd, x, y ) 
 125 {
 126 	RECT rectnew
 127 		
 128 	rectnew.left = this.left
 129 	rectnew.top = this.top
 130 	rectnew.right = x
 131 	rectnew.bottom = y
 132 	this.reframe( wnd, rectnew )   	
 133 }
 134 
 135 method RECT.frame_move( uint wnd int x, y )
 136 {
 137 	RECT rectnew
 138 	rectnew.left = x
 139 	rectnew.top = y
 140 	rectnew.right = x + this.right - this.left
 141 	rectnew.bottom = y + this.bottom - this.top
 142 	this.reframe( wnd, rectnew )
 143 }
 144 
 145 method vVEEdit.green()
 146 {
 147    if this.winn 
 148    {
 149       RECT r,a
 150       GetWindowRect( this.winn->vCtrl.hwnd, r )
 151       POINT p          
 152       p.x = r.left
 153       p.y = r.top 
 154       ScreenToClient( this.hwnd, p)
 155       r.left = p.x
 156       r.top = p.y
 157       p.x = r.right
 158       p.y = r.bottom 
 159       ScreenToClient( this.hwnd, p)
 160       r.right = p.x
 161       r.bottom = p.y
 162       this.wdown->vCtrl.loc.left = r.left - 2
 163       this.wdown->vCtrl.loc.top = r.top - 2
 164       //print( "SETRGN \n" )
 165       
 166       this.Owner->vScrollBox.AutoScroll = 0
 167       setrgn( this.wdown->vCtrl.hwnd, r )
 168       this.Owner->vScrollBox.AutoScroll = 1
 169    }
 170 }
 171 
 172 method vVEEdit.refresh()
 173 {
 174 }
 175 
 176 method vVEEdit.select( vComp w )
 177 {
 178    //print( "x2 \(&this) \(this.wdown) \( &w )\n" )
 179    if this.winn = &w
 180    {      
 181       this.winparent = GetParent( w->vCtrl.hwnd )
 182       this.wdown->vCtrl.Visible = 1         
 183       this.green()         
 184       SetWindowPos( this.wdown->vCtrl.hwnd, 0, 0, 0, 0, 0, $SWP_NOACTIVATE | $SWP_NOMOVE | $SWP_NOSIZE )
 185    }
 186    else
 187    {    
 188 //      print( "x3 \(&this) \(this.wdown)\n" )
 189       this.wdown->vCtrl.Visible = 0
 190       //print( "x4" )
 191    }
 192  /*  print( "select zzz1 \(&w) \(w.p_designing)\n" )
 193    if w && this.winn != &w && w.p_designing
 194    {        
 195       if this.winn : this.refresh()        
 196       this.winn = &w
 197       //this.refresh()
 198       if w.TypeIs( vCtrl )
 199       {         
 200          this.winparent = GetParent( w->vCtrl.hwnd )
 201          this.wdown->vCtrl.Visible = 1         
 202          this.green()         
 203          SetWindowPos( this.wdown->vCtrl.hwnd, 0, 0, 0, 0, 0, $SWP_NOACTIVATE | $SWP_NOMOVE | $SWP_NOSIZE )
 204          
 205          //this.wdown->vCtrl.Visible = 1
 206       }  
 207       else
 208       {
 209          this.wdown->vCtrl.Visible = 0
 210       }    
 211    }    
 212    this.onSelect.run()
 213    */
 214    //->func(this.form)     
 215    //InvalidateRect( this.wdown->vCtrl.hwnd, 0->RECT, 1 )
 216 }
 217 
 218 method vVEEdit.nextobj( uint flgreserve )
 219 {
 220    uint ctrl = this.winn    
 221    uint level           
 222    do
 223    {
 224       if flgreserve
 225       {                
 226          ctrl = this.winn->vForm.form->vForm.prevCtrl( ctrl, &level, 0 )
 227       }
 228       else: ctrl = this.winn->vForm.form->vForm.nextctrl( ctrl, &level, 0)              
 229    }
 230    while !ctrl || !ctrl->vCtrl.p_designing            
 231    //this.select( ctrl->vCtrl )
 232    .VEPanel->vVEPanel.Selected = ctrl->vComp  
 233 }
 234 
 235 func int align( int val, off, discr )
 236 {
 237    int tail
 238    if tail = val % discr
 239    {      
 240       if tail < 0 : tail = discr + tail
 241       if off < 0 || ( !off && tail < discr / 2 )
 242       {
 243          val -= tail
 244       }   
 245       else
 246       {
 247          val += discr - tail
 248       }      
 249    }
 250    else
 251    {
 252       val += off * discr
 253    }
 254    return val
 255 }
 256 
 257 method int vVEEdit.alignx( int val, off )
 258 {
 259    return align( val, off, .discr.x )
 260 }
 261 
 262 method int vVEEdit.aligny( int val, off )
 263 {
 264    return align( val, off, .discr.y )
 265 }
 266 
 267 
 268 //method uint vVEFrame.mKey <alias=vVEFrame_mKey>( eventkey evk )
 269 method uint vVEEdit.mKey <alias=vVEEdit_mKey>( evparKey evk )
 270 {
 271    uint WE as this//.WE->vVEEdit
 272    if evk.evktype == $evkDown && WE.winn
 273    {
 274       if this.oper 
 275       {
 276          if evk.key == $VK_ESCAPE
 277          {  
 278             this.oper = 0                                                
 279             //Удаление остаточной рамки         	
 280             //this.framehide()
 281             //this.releasecapture()
 282             ReleaseCapture()
 283          }
 284          return 0
 285       }
 286       switch evk.key
 287       {
 288          case $VK_TAB
 289          {
 290             if evk.mstate & $mstCtrl
 291             {
 292                evk.mstate &= ~$mstCtrl
 293             }
 294             else
 295             {                  
 296                WE.nextobj( evk.mstate & $mstShift )          
 297                return 0   
 298             }
 299          }
 300          case $VK_LEFT//Влево
 301          {         
 302             if evk.mstate & $mstShift 
 303             {
 304                if evk.mstate & $mstAlt : WE.winn->vCtrl.Width = WE.winn->vCtrl.Width - 1 
 305                else : WE.winn->vCtrl.Width = .alignx( WE.winn->vCtrl.Width, -1 )
 306             } 
 307             else 
 308             {
 309                if evk.mstate & $mstAlt : WE.winn->vCtrl.Left = WE.winn->vCtrl.Left - 1 
 310                else : WE.winn->vCtrl.Left = .alignx( WE.winn->vCtrl.Left, -1 )
 311             }                                  
 312             return 0
 313          }
 314          case $VK_UP//0x26//Вверх
 315          {               
 316             if evk.mstate & $mstShift 
 317             {
 318                if evk.mstate & $mstAlt : WE.winn->vCtrl.Height = WE.winn->vCtrl.Height - 1 
 319                else : WE.winn->vCtrl.Height = .aligny( WE.winn->vCtrl.Height, -1 )
 320             } 
 321             else 
 322             {
 323                if evk.mstate & $mstAlt : WE.winn->vCtrl.Top = WE.winn->vCtrl.Top - 1 
 324                else : WE.winn->vCtrl.Top = .aligny( WE.winn->vCtrl.Top, -1 )
 325             }                        
 326             return 0
 327          }
 328          case $VK_RIGHT//0x27//Вправо
 329          {
 330             if evk.mstate & $mstShift 
 331             {
 332                if evk.mstate & $mstAlt : WE.winn->vCtrl.Width = WE.winn->vCtrl.Width + 1 
 333                else : WE.winn->vCtrl.Width = .alignx( WE.winn->vCtrl.Width, 1 )
 334             } 
 335             else 
 336             {
 337                if evk.mstate & $mstAlt : WE.winn->vCtrl.Left = WE.winn->vCtrl.Left + 1 
 338                else : WE.winn->vCtrl.Left = .alignx( WE.winn->vCtrl.Left, 1 )
 339             }         
 340             return 0
 341          }
 342          case $VK_DOWN//0x28//Вниз
 343          {            
 344             if evk.mstate & $mstShift 
 345             {
 346                if evk.mstate & $mstAlt : WE.winn->vCtrl.Height = WE.winn->vCtrl.Height + 1 
 347                else : WE.winn->vCtrl.Height = .aligny( WE.winn->vCtrl.Height, 1 )
 348             } 
 349             else 
 350             {
 351                if evk.mstate & $mstAlt : WE.winn->vCtrl.Top = WE.winn->vCtrl.Top + 1 
 352                else : WE.winn->vCtrl.Top = .aligny( WE.winn->vCtrl.Top, 1 )
 353             }                   
 354             return 0  
 355          }   
 356          case $VK_DELETE//0x2E//Удаление
 357          {
 358             if !WE.winn->vCtrl.TypeIs( vForm )
 359             {
 360                uint owner as WE.winn->vCtrl.Owner
 361                uint delobj as WE.winn->vCtrl
 362                .VEPanel->vVEPanel.Selected = owner             
 363                //WE.winn->vCtrl.DestroyComp()
 364                delobj.DestroyComp()
 365                
 366                
 367                /*uint ctrl = WE.winn
 368                WE.nextobj( 0 )
 369                ctrl->vCtrl.delcomp()//delete()
 370                WE.ondelete.run()*/
 371                //delcompdes( ctrl->vCtrl )
 372             }
 373          }   
 374       }
 375    }
 376    return 0
 377 }
 378 
 379 method vVEEdit.move( RECT rnew )
 380 {
 381    this.refresh()
 382    POINT offp
 383                
 384    offp.x = rnew.left
 385    offp.y = rnew.top
 386    ScreenToClient( this.winparent, offp )    
 387    //print( "+++++++++++++++off \(offp.Left) \(offp.Top) \n" )                                     
 388    //Сдвиг окна		
 389 	//MoveWindow( this.winn->vCtrl.hwnd, offp.Left, offp.Top,/*rnew.left + offp.Left, rnew.top + offp.Top,*/ rnew.right - rnew.left, rnew.bottom - rnew.top, 1 )
 390    /*this.winn->vCtrl.Left = offp.Left
 391    this.winn->vCtrl.Top = offp.Top
 392    this.winn->vCtrl.Width = rnew.right - rnew.left
 393    this.winn->vCtrl.Height = rnew.bottom - rnew.top*/
 394    eventpos ep   
 395    ep.loc.left = offp.x 
 396    ep.loc.top = offp.y 
 397    ep.loc.width = rnew.right - rnew.left
 398    ep.loc.height = rnew.bottom - rnew.top
 399    if this.winn->vCtrl.pOwner
 400    {
 401       //ep.loc.left += this.winn->vCtrl.pOwner->vCtrl.clloc.left
 402       //ep.loc.top += this.winn->vCtrl.pOwner->vCtrl.clloc.top      
 403       if this.winn->vCtrl.pAlign & ( $alhRight | $alhLeftRight ) 
 404       {
 405          this.winn->vCtrl.pRight = this.winn->vCtrl.Owner->vCtrl.clloc.width - ep.loc.left - ep.loc.width 
 406       }
 407       if this.winn->vCtrl.pAlign & ( $alvBottom | $alvTopBottom ) 
 408       {
 409          this.winn->vCtrl.pBottom = this.winn->vCtrl.Owner->vCtrl.clloc.height - ep.loc.top - ep.loc.height 
 410       }
 411    }
 412    //this.wdown->vCtrl.Visible = 0
 413    ep.code = $e_poschanging
 414    ep.move = 1
 415    this.winn->vCtrl.Virtual( $mPosChanging, &ep )   
 416    //this.refresh()
 417    //this.green()
 418    //this.wdown->vCtrl.Visible = 1  
 419    this.onSelect.run()//->func(this.form)   
 420     
 421 }
 422 
 423 method vVEEdit.framenew( POINT pnt )
 424 {
 425    RECT rectnew//, rectold
 426    this.typ = 3	                                      	
 427 	this.rectold.set( -0, -0 )   
 428    ScreenToClient( this.winparent, pnt )
 429    pnt.x = .alignx( pnt.x, 0 )
 430    pnt.y = .aligny( pnt.y, 0 )
 431    //print( "new \(pnt.x) \(pnt.y)\n" )
 432    ClientToScreen( this.winparent, pnt )
 433    this.offx = pnt.x
 434    this.offy = pnt.y
 435    rectnew.left = pnt.x
 436    rectnew.top = pnt.y		
 437    rectnew.right = pnt.x
 438    rectnew.bottom = pnt.y   	
 439 	this.rectold.reframe( this.hwnd, rectnew )	
 440 }
 441 
 442 method vVEEdit.frameshow( uint typ )
 443 {
 444    RECT rectnew//, rectold
 445    this.typ = typ
 446 	GetWindowRect( this.winn->vCtrl.hwnd, rectnew )                                      	
 447 	this.rectold.set( -0, -0 )				
 448 	this.rectold.reframe( this.hwnd, rectnew )	
 449 }
 450 
 451 method vVEEdit.framehide()
 452 {
 453    RECT rectnew
 454    //RECT rectold
 455 	//RECT rect               
 456    //Удаление остаточной рамки
 457 	//rect = rectold
 458 	rectnew.set( -0, -0 )				
 459 	this.rectold.reframe( this.hwnd, rectnew )   	
 460 }
 461 
 462 method vVEEdit.framemove( POINT pnt )
 463 {
 464 //print( "framemove \n" )
 465    pnt.x -= this.offx
 466    pnt.y -= this.offy
 467    ScreenToClient( this.winparent, pnt )
 468    pnt.x = .alignx( pnt.x, 0 )
 469    pnt.y = .aligny( pnt.y, 0 )
 470    ClientToScreen( this.winparent, pnt )
 471    this.rectold.frame_move( this.hwnd, pnt.x, pnt.y )
 472 }
 473 
 474 method vVEEdit.framesize( POINT pnt )
 475 {
 476 //print( "X \(this.typ)\n" )
 477    RECT rectnew   
 478    int tmp 
 479    rectnew = this.rectold
 480    ScreenToClient( this.winparent, pnt )
 481    pnt.x = .alignx( pnt.x, 0 )
 482    pnt.y = .aligny( pnt.y, 0 )
 483    ClientToScreen( this.winparent, pnt )      
 484    switch this.typ 
 485    {
 486       case 1
 487       {  
 488          rectnew.left = this.offx
 489          rectnew.right = pnt.x         
 490       }
 491       case 2
 492       {       
 493          rectnew.top = this.offy
 494          rectnew.bottom = pnt.y  
 495       }
 496       case 3
 497       {
 498          rectnew.left = this.offx
 499          rectnew.right = pnt.x
 500          rectnew.top = this.offy
 501          rectnew.bottom = pnt.y  
 502       } 
 503    }
 504    if rectnew.left > rectnew.right 
 505    {
 506       tmp = rectnew.left
 507       rectnew.left = rectnew.right
 508       rectnew.right = tmp  
 509    }
 510    if rectnew.top > rectnew.bottom
 511    {  
 512       tmp = rectnew.top
 513       rectnew.top = rectnew.bottom
 514       rectnew.bottom = tmp
 515    }     
 516    this.rectold.reframe( this.hwnd, rectnew )
 517 }
 518 method vVEEdit.setcapture()
 519 {   
 520    RECT rt   
 521    uint wparent = this.winparent//GetParent( this.winn )
 522    if !wparent : wparent = GetDesktopWindow() 
 523    GetWindowRect( wparent, rt )   
 524    ClipCursor( rt )
 525    //SetWindowPos( wup, 0, 0, 0, 0, 0, $SWP_NOMOVE | $SWP_NOSIZE )
 526    SetCapture( this.hwnd )
 527    InvalidateRect( this.wdown->vCtrl.hwnd, 0->RECT, 1 )
 528    //UpdateWindow( this.wdown->vCtrl.hwnd )
 529    //SetForegroundWindow( this.hwnd )
 530 }
 531 method vVEEdit.releasecapture()
 532 {
 533    this.oper = 0                                          
 534    //Удаление остаточной рамки   	
 535    this.framehide()
 536    ClipCursor( 0->RECT )
 537    //SetBackgroundWindow( this.hwnd )
 538    //SetForegroundWindow( this.hwnd )
 539 //UpdateWindow( this.wdown->vCtrl.hwnd )
 540 this.wdown->vCtrl.Visible = 0
 541 
 542 this.wdown->vCtrl.Visible = 1
 543 
 544  InvalidateRect( this.wdown->vCtrl.hwnd, 0->RECT, 1 )
 545  UpdateWindow( this.wdown->vCtrl.hwnd )
 546   
 547 }
 548 
 549 method vVEEdit.startmove( POINT pnt )
 550 {   
 551    this.oper = $OPERMOVE
 552    this.setcapture()
 553    //print( "Start\n")   
 554                          
 555    this.frameshow( 0 )               
 556 	this.offx = pnt.x - this.rectold.left
 557 	this.offy = pnt.y - this.rectold.top
 558    this.onstartchange.run()   
 559    //print( "Start 2\n")
 560 }
 561 
 562 method vVEEdit.stop( uint flgsave )
 563 {  
 564    if this.oper
 565    {
 566       RECT rect 
 567       uint curoper = this.oper
 568       rect = this.rectold      
 569       //this.releasecapture()
 570       ReleaseCapture()
 571       if flgsave && ( curoper & $OPERCHANGE ) 
 572       {
 573          if ( curoper & ( $OPERMOVE | $OPERSIZE ))
 574    	   {           
 575             //rect.left -= this.Owner->vCtrl.clloc.left
 576             //rect.top -= this.Owner->vCtrl.clloc.top              
 577             this.move( rect )  
 578             //this.releasecapture()         
 579          }
 580          elif curoper & $OPERNEW
 581          {            
 582           //  this.releasecapture()
 583             /*eventuint eu
 584             loc r
 585             eu.value = &r
 586             r.Left = rect.left
 587             r.Top = rect.right
 588             this.onnew.run( eu )*/
 589             POINT offp
 590                
 591             offp.x = rect.left
 592             offp.y = rect.top
 593             ScreenToClient( this.winn->vCtrl.hwnd /*parent*/, offp )    
 594                                        
 595             //Сдвиг окна		
 596          	//MoveWindow( this.winn->vCtrl.hwnd, offp.Left, offp.Top,/*rnew.left + offp.Left, rnew.top + offp.Top,*/ rnew.right - rnew.left, rnew.bottom - rnew.top, 1 )
 597             /*this.winn->vCtrl.Left = offp.Left
 598             this.winn->vCtrl.Top = offp.Top
 599             this.winn->vCtrl.Width = rnew.right - rnew.left
 600             this.winn->vCtrl.Height = rnew.bottom - rnew.top*/
 601             evparQueryCreate ep
 602             ep.loc.left = offp.x
 603             ep.loc.top = offp.y
 604             ep.loc.width = rect.right - rect.left
 605             ep.loc.height = rect.bottom - rect.top
 606             ep.Owner = .winn  
 607             //print( " N1\n" )                      
 608             this.onQueryCreate.run( ep )
 609             //print( " N2\n" )
 610             //print( "N\n" )
 611             if ep.NewComp
 612             {  
 613                //print( " N3\n" )
 614                //print( "NEW 11\n" )
 615                //.select( ep.NewComp->vComp )
 616                .VEPanel->vVEPanel.Selected = ep.NewComp->vComp
 617             }
 618          }
 619       }      
 620             
 621    }
 622 }
 623 
 624 
 625 
 626 /*------------------------------------------------------------------------------
 627    Windows Mesages Methods
 628 */
 629 method uint vVEEdit.wmlbuttondown <alias=vVEEdit_wmlbuttondown>(winmsgmouse wmsg)
 630 {
 631 //print( "EditBtn\n" )
 632    POINT pnt
 633    SetFocus( this.hwnd )
 634    uint ww                  
 635    //Определение координат
 636    //mousetopoint( lpar, pnt )
 637    pnt.x = wmsg.x
 638    pnt.y = wmsg.y
 639    ClientToScreen( this.hwnd, pnt )
 640    //ScreenToClient( wnd, pnt ) 
 641    //print( "mousepoint \(pnt.Left ) \(pnt.Top)\n" );
 642    ww = gettopwindow( this.Owner->vCtrl.hwnd, pnt )
 643    //print( "top=\(ww) \(this.p_owner->vCtrl.hwnd)\n" )         
 644    //Захват окна
 645 	if ww && ww != this.Owner->vCtrl.hwnd 
 646 	{      
 647       uint ctrl as getctrl( ww )
 648       if &ctrl
 649       {
 650          //Sleep( 1000 )
 651          //this.select( ctrl )
 652          .VEPanel->vVEPanel.Selected = ctrl
 653          //Sleep( 1000 )  
 654          /*POINT pnts 
 655          //mousetopoint( lpar, pnt )
 656          winmsgmouse wm
 657          pnts.Left = wmsg.Left//em.Left
 658          pnts.Top = wmsg.Top//em.Top
 659          ClientToScreen( this.hwnd, pnts )
 660          //ScreenToClient( this.hwnd, pnts )
 661          wm.Left = pnts.Left
 662          wm.Top = pnts.Top
 663          wm.wpar = wmsg.wpar 
 664          ctrl.WinMsg( $WM_NCLBUTTONDOWN, wm.wpar, wm->winmsg.lpar )*/
 665          if this.flgadd
 666          {                  
 667             //this.startmove( pnt )
 668             this.oper = $OPERNEW | $OPERCHANGE                 
 669             this.setcapture()    
 670             POINT pnt 
 671             
 672             this.winparent = this.winn->vCtrl.hwnd
 673             //mousetopoint( lpar, pnt )
 674             pnt.x = wmsg.x//em.Left
 675             pnt.y = wmsg.y//em.Top
 676             ClientToScreen( this.hwnd, pnt )              
 677             this.framenew( pnt )
 678             this.framesize( pnt )
 679          }
 680          else
 681          {   
 682             //this.mouseleft = wmsg.x
 683             //this.mouseright = wmsg.y
 684             this.startmove( pnt )
 685          }
 686       } 
 687    }
 688 //print( "EditBtn 2\n" )   
 689    return 0          
 690 }
 691 
 692 method uint vVEEdit.wmmousemove <alias=vVEEdit_wmmousemove>(winmsgmouse wmsg)
 693 { 
 694    //if this.oper & $OPERCHANGE 
 695    //print("MOUSEMOVE \(this.oper)\n" )   
 696    if this.oper 
 697    {
 698       if !( this.oper & $OPERFIRST ) //Первый move откидываем т.к. он генерируется SetCapture
 699       {
 700          this.oper |= $OPERFIRST
 701          return 0
 702       }
 703       this.oper |= $OPERCHANGE         	
 704    //	case 1 :	frame_sel( wnd, int( ( &lpar )->short ), int( ( &lpar + 2 )->short) )
 705       POINT pnt 
 706       //mousetopoint( lpar, pnt )
 707       pnt.x = wmsg.x
 708       pnt.y = wmsg.y
 709       ClientToScreen( this.hwnd, pnt )
 710    	if this.oper & $OPERMOVE : this.framemove( pnt )
 711       elif this.oper & $OPERSIZE : this.framesize( pnt )
 712       elif this.oper & $OPERNEW : this.framesize( pnt )            				
 713    }
 714    return 0			
 715 }	
 716 method uint vVEEdit.wmlbottonup <alias=vVEEdit_wmlbuttonup>(winmsg wmsg)
 717 {
 718 //print( "edit.up\n" )
 719    this.stop( 1 )
 720    return 0
 721 }
 722 
 723 method uint vVEEdit.wmcapturechanged <alias=vVEEdit_wmcapturechanged>( winmsg wmsg )
 724 {
 725 //print( "RELEASE++++++++\n" )
 726    this.releasecapture()
 727    wmsg.flags = 1
 728    return 0
 729 }
 730 
 731 method uint vVEFrame.wmmousemove <alias=vVEFrame_wmmousemove>(winmsgmouse wmsg)
 732 {
 733 uint we as this.WE->vVEEdit//this.Owner->vVEEdit
 734    
 735    if !we.oper
 736    {
 737       POINT pnt
 738       uint t		         
 739       //Определение координат           
 740       //mousetopoint( lpar, pnt )
 741       pnt.x = wmsg.x
 742       pnt.y = wmsg.y
 743       //ClientToScreen( wnd, pnt )
 744       t = getcursorsize( this.hwnd, pnt )
 745       if t  
 746       {
 747          SetCursor( LoadCursor( 0, $IDC_SIZENWSE + ( t - 1 )%4 ) )
 748       }
 749       else : SetCursor( LoadCursor( 0, $IDC_ARROW ) )
 750    }         
 751    return 0
 752 }
 753          
 754 method uint vVEFrame.wmlbuttondown <alias=vVEFrame_wmlbuttondown>(winmsgmouse wmsg)
 755 {         
 756 //print( "FrameBtn\n" )
 757 uint we as this.WE->vVEEdit//this.Owner->vVEEdit
 758    POINT pnt
 759    uint t
 760    uint typ		         
 761    //Определение координат           
 762    pnt.x = wmsg.x
 763    pnt.y = wmsg.y
 764    t = getcursorsize( this.hwnd, pnt )
 765    if t  
 766    {     
 767           
 768       RECT r
 769       GetWindowRect( we.winn->vCtrl.hwnd, r )    
 770       arr art of uint
 771       arr arx of uint
 772       arr ary of uint 
 773       art = %{ 0, 3, 3, 1, 2, 3, 3, 1, 2 }            
 774       arx = %{ 0, 1, 0, 1,-1, 0, 1, 0,-1 }            
 775       ary = %{ 0, 1, 1,-1, 1, 0, 0,-1, 0 }
 776       we.offx = ?( arx[t], r.right, r.left )
 777       we.offy = ?( ary[t], r.bottom, r.top )
 778       typ = art[t]
 779 //      print( "t \(t) \(typ) \(art[0]) \(art[1]) \(art[2])\n" )
 780       
 781       we.oper = $OPERSIZE
 782       we.setcapture()
 783       
 784       SetCursor( LoadCursor( 0, $IDC_SIZENWSE + ( t - 1 )%4 ) )
 785       we.frameshow( typ )
 786    }
 787    else
 788    {
 789       ClientToScreen( this.hwnd, pnt )            
 790       we.startmove( pnt )
 791    }     
 792    return 0    
 793 }
 794 
 795 method uint vVEEdit.wmlbuttondblclk <alias=vVEEdit_wmlbuttondblclk>(winmsgmouse wmsg)
 796 {
 797    .VEPanel->vVEPanel.DblClick()    
 798    return 0
 799 }
 800 
 801 method uint vVEFrame.wmpaint <alias=vVEFrame_wmpaint>(winmsg wmsg)
 802 {  
 803    uint we as this.WE->vVEEdit//as this.Owner->vVEEdit
 804    //print( "paint frame\n" )       
 805 	uint hdc
 806 	PAINTSTRUCT lp
 807    uint r = CreateRectRgn( 0, 0, 1, 1 )
 808    GetWindowRgn( this.hwnd, r )
 809    InvalidateRgn( this.hwnd, r, 0 )
 810    //RECT r
 811    //GetWindowRect( this.hwnd, r )
 812    //InvalidateRect( this.hwnd, r, 0 )
 813    hdc = BeginPaint( this.hwnd, lp )   
 814    FillRgn( hdc, r, ?( we.oper, we.brushgr, we.brush ) )   
 815 	EndPaint( this.hwnd, lp )
 816    DeleteObject( r )   
 817    wmsg.flags = 1
 818 	return 0		   
 819 }
 820 
 821 /*method uint vVEEdit.wmpaint <alias=vVEEdit_wmpaint>(winmsg wmsg)
 822 {     
 823 	PAINTSTRUCT lp  
 824    uint hdc 
 825    hdc = BeginPaint( this.hwnd, lp )			
 826    	print( "paint\n" )
 827 	EndPaint( this.hwnd, lp )
 828    wmsg.flags = 1
 829 	return 1		   
 830 }*/
 831 /*------------------------------------------------------------------------------
 832    Virtual Methods
 833 */
 834 
 835 method vVEFrame vVEFrame.mCreateWin <alias=vVEFrame_mCreateWin>()
 836 {
 837    //uint we as this.Owner->vVEEdit
 838    
 839    //gclass_register( "GWDown", 0, 0, 0, we.brush, gwapp, 
 840    //             &gw_app, &gwapp_setnotify, &gwapp_getnotify )
 841    //this.loc.left = -1
 842    //this.loc.top = -1
 843    //this.Owner->vCtrl.CreateWin( "GVForm".ustr(), 0, $WS_OVERLAPPED | $WS_CLIPSIBLINGS  | $WS_CHILD | $WS_VISIBLE )
 844    /*this.hwnd = CreateWindowEx(  //$WS_EX_TRANSPARENT
 845    0, "STATIC".ustr().ptr(), "w".ustr().ptr(), 
 846    //  $WS_OVERLAPPED  
 847    $WS_CLIPSIBLINGS  | $WS_CLIPCHILDREN | $WS_CHILD | $WS_VISIBLE, 
 848       -1, -1, 1, 1, this.Owner->vCtrl.Owner->vCtrl.hwnd, 0, 0, &this )*/
 849    //this.CreateWin( "STATIC".ustr(), /*$WS_EX_TRANSPARENT*/0,/* $WS_CHILD |*/ $WS_VISIBLE | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
 850    this.CreateWin( "GVTr".ustr(), 0, $WS_CHILD | $WS_VISIBLE | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
 851    this.prevwndproc = -1   
 852    this->vCtrl.mCreateWin() 
 853    //this.prevwndproc = 0     
 854    this.VertAlign = $alvTop
 855    this.HorzAlign = $alhLeft
 856      
 857    
 858    
 859    return this
 860 }
 861 
 862 method vVEEdit vVEEdit.mCreateWin <alias=vVEEdit_mCreateWin>()
 863 {
 864    
 865    this.discr.x = 5 
 866    this.discr.y = 5   
 867    this.brush = CreateSolidBrush( GetSysColor( 13))//0xFF00 )//COLOR_HIGHLIGHT
 868    this.brushgr = CreateSolidBrush( GetSysColor( 16) )//0x666666 ) //COLOR_BTNSHADOW     
 869 	this.pen = CreatePen( $PS_INSIDEFRAME	| $PS_SOLID, 1, 0xFF00 )   
 870    
 871   	//gclass_register( "GWUp", 0, 0, 0, 0, gwapp, 
 872    //             &gw_app, &gwapp_setnotify, &gwapp_getnotify )	
 873    
 874    this.CreateWin( "GVTr".ustr(), $WS_EX_TRANSPARENT, $WS_TABSTOP | $WS_VISIBLE | $WS_CHILD /*| $WS_CLIPSIBLINGS*/ )
 875    this.prevwndproc = -1
 876    this->vCtrl.mCreateWin() 
 877    //this.prevwndproc = 0
 878    //this.Caption = "wup".ustr()
 879    /*this.hwnd = CreateWindowEx(  $WS_EX_TRANSPARENT , "GVUp".ustr().ptr(), "wup".ustr().ptr(),                    
 880       $WS_TABSTOP | $WS_VISIBLE | $WS_CHILD , 
 881       0, 0, 300, 300, this.p_owner->vCtrl.hwnd, 0, 0, &this )*/     
 882    //win_customproc( this.hwnd, &upproc )
 883    SetParent( this.hwnd, this.Owner->vCtrl.hwnd )
 884         
 885    //this.wdown = &newcomp( vVEFrame, this )
 886    this.wdown = &this.Owner.CreateComp( vVEFrame )
 887    this.wdown->vVEFrame.WE = &this
 888    //this.wdown = &this.CreateComp( vVEFrame )   
 889    //SetParent( this.wdown->vVEFrame.hwnd, this.Owner->vCtrl.hwnd )
 890    //SetWindowPos( this.wdown->vVEFrame.hwnd, 0, 0, 0, 0, 0, $SWP_NOACTIVATE | $SWP_NOMOVE | $SWP_NOSIZE )   
 891    this.VertAlign = $alvClient
 892    this.HorzAlign = $alhClient
 893    /*
 894    .panVis.Owner = this
 895    .panVis.VertAlign = $alvTopBottom
 896    .panVis.Top = 0
 897    .panVis.Bottom = 100
 898    .panVis.HorzAlign = $alhClient   
 899    
 900    .panNoVis.Owner = this
 901    .panNoVis.Height = .panVis.Bottom
 902    .panNoVis.Bottom = 0 
 903    .panNoVis.VertAlign = $alvBottom
 904    .panNoVis.HorzAlign = $alhClient   
 905    */
 906    //gui_showapp( wup, $SW_MAXIMIZE, 0 )   
 907    //DeleteObject( brush )
 908    //DeleteObject( pen )
 909    //gui_deinit()
 910    return this
 911 }
 912 
 913 
 914 property vComp vVEPanel.Selected()
 915 {
 916    return .pSelected->vComp 
 917 }
 918 
 919 property vVEPanel.Selected( vComp newcomp )
 920 {   
 921    if newcomp.p_designing 
 922    {
 923       //print( "VE Selected \(&newcomp) \(&.WE)\n" )
 924       if .pSelected != &newcomp
 925       {
 926          if newcomp    
 927          {
 928             //.pSelected != &newcomp
 929             //print( "VE Selected 1\(&newcomp)\n" )
 930             .pSelected = &newcomp          
 931             //this.refresh()
 932             if newcomp.TypeIs( vCtrl )
 933             {         
 934                .NoVisList.Selected = 0->LVItem
 935                .WE.select( newcomp )
 936             }  
 937             else
 938             {
 939                //print( "z1\n")
 940                .WE.select( 0->vComp )
 941                //print( "z2\n")
 942                foreach item, .NoVisList.Root
 943                {
 944                   //print( "z3\n")
 945                   if item->LVItem.Tag == &newcomp
 946                   {
 947                      //print( "z4\n")
 948                      .NoVisList.Selected = item->LVItem
 949                      break
 950                   }
 951                }    
 952             }
 953          }
 954          else
 955          {
 956             .WE.select( 0->vComp )
 957          }
 958       }
 959       this.onSelect.run()
 960    }
 961 }
 962 
 963 method vVEPanel.WESelect <alias=vVEPanel_WESelect> ( evparEvent ev )
 964 {
 965    this.onSelect.run()
 966    //.Selected = .WE.winn->vComp  
 967 }
 968 
 969 method vVEPanel.WEQueryCreate <alias=vVEPanel_WEQueryCreate> ( evparQueryCreate  evpQ )
 970 {
 971    .onQueryCreate.run( evpQ ) 
 972 }
 973 
 974   
 975 
 976 method vVEPanel.BeforeScroll <alias=vVEPanel_BeforeScroll> ( evparQuery  pQ )
 977 {
 978    .WE.Visible =0     
 979 }
 980 
 981 method vVEPanel.AfterScroll <alias=vVEPanel_AfterScroll> ( evparEvent ev )
 982 {
 983    .WE.Visible =1    
 984 }
 985 
 986 
 987 method vVEPanel.NoVisList_Select <alias=vVEPanel_NoVisList_Select> ( /* vComp sender,*/ evparTVAfter ea )  
 988 {   
 989    uint comp as ea.CurItem->LVItem.Tag->vComp
 990    if &comp
 991    {
 992       //.VEPanel.WE.select( comp )
 993       //print( "SELECT \( ea.CurItem->LVItem.Tag ) \(ea.CurItem->LVItem.Tag->vComp.Name)\n")
 994       this.Selected = comp
 995    }
 996 }
 997 
 998 /*method vVEPanel.NoVisList_Focus <alias=vVEPanel_NoVisList_Focus> (eventuint ev) 
 999 {
1000    if ev.val 
1001    {
1002       if &this.NoVisList.Selected()
1003       {
1004          uint comp as this.NoVisList.Selected.Tag->vComp
1005          if &comp
1006          {
1007             //.VEPanel.WE.select( comp )
1008             this.Selected = comp            
1009          }         
1010       }
1011    }   
1012 }
1013 */
1014 method vVEPanel.DblClick()
1015 {
1016    evparValUint eu
1017    eu.val = &.Selected()
1018    .OnDblClick.run( eu )   
1019 }
1020 
1021 method vVEPanel.Mouse <alias=vVEPanel_Mouse> (/*vComp sender,*/evparMouse evm) 
1022 {
1023    if evm.evmtype == $evmLDbl && &.Selected()
1024    {  
1025       .DblClick()
1026    }   
1027 }
1028 
1029 method vVEPanel.NoVisList_Key <alias=vVEPanel_NoVisList_Key> (/*vComp sender,*/evparKey evk) 
1030 {
1031    if evk.evktype == $evkDown && evk.key = $VK_DELETE && &.NoVisList.Selected()
1032    {        
1033       uint owner as .Selected.Owner
1034       uint curcomp as .Selected
1035       .NoVisList.Selected.Del()
1036       if ( !&.NoVisList.Selected() )
1037       {  
1038          .Selected = owner
1039       }      
1040       curcomp.DestroyComp()
1041    }   
1042 }
1043 
1044 method vVEPanel.Update()
1045 {
1046    .NoVisList.Clear()
1047    foreach comp, .VisPanel.Comps[0]->vForm.Comps
1048    {
1049       comp as vComp        
1050       if !comp.TypeIs( vCtrl  ) 
1051       {
1052          .NoVisList.Append( comp->vComp.Name.ustr(), &comp )
1053       }
1054    } 
1055 
1056 }
1057 
1058 method vVEPanel.mDesChanging <alias=vVEPanel_mDesChanging>( vCtrl ctrl )
1059 {   
1060    if this.WE.winn
1061    {
1062       this.WE.wdown->vCtrl.Visible = 0         
1063       UpdateWindow( this.WE.wdown->vCtrl.hwnd )
1064       UpdateWindow( this.WE.winn->vCtrl.hwnd )
1065    }
1066 }
1067 
1068 method vVEPanel.mDesChanged <alias=vVEPanel_mDesChanged>( vCtrl ctrl )
1069 {
1070    if this.WE.winn
1071    {
1072       this.WE.green()
1073       this.WE.wdown->vCtrl.Visible = 1
1074       //UpdateWindow( this.winn->vCtrl.hwnd )    
1075       //WE.Visible = 1
1076       //WE.SetFocus()
1077       if &ctrl == &this.WE.winn//Selected() 
1078       {      
1079          this.WE.onSelect.run()
1080       }      
1081    }   
1082 } 
1083 
1084 method vVEPanel vVEPanel.mCreateWin <alias=vVEPanel_mCreateWin>()
1085 {
1086    this->vPanel.mCreateWin()
1087       
1088    with .NoVisList
1089    {      
1090       
1091       .Owner = this
1092       .Height = 100
1093       .Top = this.Height - .Height
1094       .HorzAlign = $alhClient
1095       .VertAlign = $alvBottom
1096       .ShowSelection = 1
1097       .OnAfterSelect.Set( this, vVEPanel_NoVisList_Select )
1098       //.onfocus.set( this, vVEPanel_NoVisList_Focus )
1099       .OnMouse.Set( this, vVEPanel_Mouse )
1100       .OnKey.Set( this, vVEPanel_NoVisList_Key )
1101    }
1102    with .VisPanel
1103    {  
1104       .Owner = this      
1105       .Top = 0
1106       .HorzAlign = $alhClient
1107       .VertAlign = $alvTopBottom
1108       .Bottom = this.NoVisList.Height
1109       .AutoScroll = 1
1110       .OnBeforeScroll.Set( this, vVEPanel_BeforeScroll )
1111       .OnAfterScroll.Set( this, vVEPanel_AfterScroll )      
1112    } 
1113    
1114    .WE.Owner = .VisPanel
1115    .WE.VEPanel = &this
1116    .WE.onSelect.Set( this, vVEPanel_WESelect )
1117    .WE.onQueryCreate.Set( this, vVEPanel_WEQueryCreate )
1118    .WE.OnMouse.Set( this, vVEPanel_Mouse )
1119    return this
1120 }
1121         
1122 /*------------------------------------------------------------------------------
1123    Registration
1124 */
1125 method vVEFrame vVEFrame.init()
1126 {    
1127    this.pTypeId = vVEFrame
1128    return this
1129 }
1130 
1131 method vVEEdit vVEEdit.init()
1132 {
1133    this.pTypeId = vVEEdit
1134    this.pCanContain = 1
1135    this.pTabStop = 1
1136    return this
1137 }
1138 
1139 method vVEPanel vVEPanel.init()
1140 {
1141    this.pTypeId = vVEPanel
1142    this.pCanContain = 1
1143    this.pTabStop = 1
1144    return this
1145 }
1146 
1147 func init_vVEEdit <entry>()
1148 {
1149    WNDCLASSEX visclass
1150    ustr classname = "GVTr"    
1151    with visclass
1152    {
1153       .cbSize      = sizeof( WNDCLASSEX )
1154       .style       = $CS_HREDRAW | $CS_VREDRAW | $CS_DBLCLKS 
1155       .lpfnWndProc = callback( &myproc, 4 )
1156       .cbClsExtra  = 0
1157       .cbWndExtra  = 0
1158       .hInstance   = GetModuleHandle( 0 )
1159       .hIcon       = 0
1160       .hCursor     = LoadCursor( 0, $IDC_ARROW )
1161       .hbrBackground = 0
1162       .lpszMenuName  = 0
1163       .lpszClassName = classname.ptr()
1164       .hIconSm     = 0
1165    } 
1166    uint hclass = RegisterClassEx( &visclass )
1167    
1168    regcomp( vVEEdit, "vVEEdit", vCtrl, $vCtrl_last,      
1169       %{ %{$mCreateWin,          vVEEdit_mCreateWin},
1170          %{$mKey,                vVEEdit_mKey}
1171        },
1172       %{ %{$WM_LBUTTONDOWN, vVEEdit_wmlbuttondown},
1173          %{$WM_LBUTTONUP, vVEEdit_wmlbuttonup},
1174          %{$WM_MOUSEMOVE ,  vVEEdit_wmmousemove},
1175          %{$WM_LBUTTONDBLCLK, vVEEdit_wmlbuttondblclk},
1176          //%{$WM_MBUTTONDBLCLK,  vVEEdit_wmlbuttondblclk},
1177          %{$WM_CAPTURECHANGED, vVEEdit_wmcapturechanged} /*,
1178          %{$WM_PAINT ,  vVEEdit_wmpaint}          */        
1179        })
1180   
1181    regcomp( vVEFrame, "vVEFrame", vCtrl, $vCtrl_last,
1182       %{ %{$mCreateWin,          vVEFrame_mCreateWin}/*,
1183          %{$mKey,                vVEFrame_mKey}*/},
1184        %{ %{$WM_LBUTTONDOWN, vVEFrame_wmlbuttondown},
1185          %{$WM_MOUSEMOVE ,  vVEFrame_wmmousemove},
1186          %{$WM_PAINT ,  vVEFrame_wmpaint}
1187                     
1188        })
1189        
1190    regcomp( vVEPanel, "vVEPanel", vPanel, $vCtrl_last,
1191       %{ %{$mCreateWin,          vVEPanel_mCreateWin},
1192          %{$mDesChanging,  vVEPanel_mDesChanging },
1193          %{$mDesChanged,  vVEPanel_mDesChanged }},
1194       0->collection )
1195       
1196 }