Browse Source

Beweglichkeit von fenstern verbessert

Kolja Strohm 5 years ago
parent
commit
da058c8e31
2 changed files with 33 additions and 19 deletions
  1. 32 19
      Fenster.cpp
  2. 1 0
      Fenster.h

+ 32 - 19
Fenster.cpp

@@ -801,17 +801,17 @@ void WFenster::ladeRahmenFenster( Bild *zBild, HINSTANCE hinst ) // setzt einen
     if( RegisterClassEx( &wcl ) )
     {
         rahmen = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_LAYERED,
-                                 wcl.lpszClassName,
-                                 TEXT( "Transparentes Fenster" ),
-                                 WS_POPUP,
-                                 0,
-                                 0,
-                                 zBild->getBreite(),
-                                 zBild->getHeight(),
-                                 0,
-                                 0,
-                                 wcl.hInstance,
-                                 0
+            wcl.lpszClassName,
+            TEXT( "Transparentes Fenster" ),
+            WS_POPUP,
+            0,
+            0,
+            zBild->getBreite(),
+            zBild->getHeight(),
+            0,
+            0,
+            wcl.hInstance,
+            0
         );
         if( rahmen )
         {
@@ -1114,6 +1114,7 @@ Fenster::Fenster()
     kMax( 0, 0 ),
     closeKlick( 0 ),
     klick( 0 ),
+    moving( 0 ),
     mx( 0 ),
     my( 0 )
 {
@@ -1651,7 +1652,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
             th = titel->getHeight();
         bool hSc = hatStyle( Style::HScroll ) && hScroll;
         bool vSc = hatStyle( Style::VScroll ) && vScroll;
-        if( !me.verarbeitet && me.id == ME_Bewegung && klick )
+        if( me.id == ME_Bewegung && moving && getMausStand( M_Links ) )
         {
             if( hatStyle( Style::Beweglich ) || hatStyle( Style::HeightChangeable ) || hatStyle( Style::BreiteChangeable ) || hatStyle( Style::TitelHeightChangeable ) )
             {
@@ -1705,7 +1706,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                     minXb |= kMinXb, maxXb |= kMaxXb, minYb |= kMinYb, maxYb |= kMaxYb;
                     if( hatStyle( Style::HeightChangeable ) )
                     {
-                        if( mx > -5 && mx < gr.x + 5 && my > -5 && my < rbr )
+                        if( ( moving | 0x1 ) == moving ) // top
                         {
                             pos.y -= my - me.my;
                             gr.y += my - me.my;
@@ -1724,7 +1725,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                             rend = 1;
                             ret1 = 1;
                         }
-                        else if( mx > -5 && mx < gr.x + 5 && my > gr.y - rbr && my < gr.y + 5 )
+                        else if( ( moving | 0x2 ) == moving ) // bottom
                         {
                             gr.y += me.my - my;
                             if( gr.y < fMinHi )
@@ -1743,7 +1744,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                     }
                     if( hatStyle( Style::BreiteChangeable ) )
                     {
-                        if( mx > -5 && mx < rbr && my > -5 && my < gr.y + 5 )
+                        if( ( moving | 0x4 ) == moving ) // left
                         {
                             pos.x -= mx - me.mx;
                             gr.x += mx - me.mx;
@@ -1762,7 +1763,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                             rend = 1;
                             ret1 = 1;
                         }
-                        else if( mx > gr.x - rbr && mx < gr.x + 5 && my > -5 && my < gr.y + 5 )
+                        else if( ( moving | 0x8 ) == moving ) // right
                         {
                             gr.x += me.mx - mx;
                             if( gr.x < rbr * 2 + fMinBr )
@@ -1779,7 +1780,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                             ret1 = 1;
                         }
                     }
-                    if( hatStyle( Style::TitelHeightChangeable ) && titel && mx > -5 && mx < gr.x + 5 && my < rbr + th + 5 && my > rbr + th )
+                    if( hatStyle( Style::TitelHeightChangeable ) && titel && ( moving | 0x10 ) == moving ) // titel height
                     {
                         int maxTh = gr.y - rbr * 2 - schi;
                         if( kMaxYb )
@@ -1802,7 +1803,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                             mx = me.mx, my = me.my;
                         me.verarbeitet = 1;
                     }
-                    if( hatStyle( Style::Beweglich ) && mx > rbr && mx < gr.x - th - rbr && my > rbr && my < rbr + th )
+                    if( hatStyle( Style::Beweglich ) && ( moving | 0x20 ) == moving ) // move
                     {
                         pos.x += me.mx - mx;
                         pos.y += me.my - my;
@@ -1822,6 +1823,7 @@ void Fenster::doMausEreignis( MausEreignis &me )
                 if( closeKlick )
                     rend = 1;
                 closeKlick = 0, klick = 0;
+                moving = 0;
                 mx = -1, my = -1;
             }
             if( me.id == ME_Leaves )
@@ -1829,7 +1831,6 @@ void Fenster::doMausEreignis( MausEreignis &me )
                 if( closeKlick != 0 )
                     rend = 1;
                 closeKlick = 0, klick = 0;
-                mx = -1, my = -1;
             }
             if( !me.verarbeitet )
             {
@@ -1837,6 +1838,18 @@ void Fenster::doMausEreignis( MausEreignis &me )
                 {
                     klick = 1;
                     mx = me.mx, my = me.my;
+                    if( me.mx >= 0 && me.mx < gr.x && me.my >= 0 && me.my < rbr + 5 )
+                        moving |= 0x1;
+                    if( me.mx >= 0 && me.mx < gr.x && me.my >= gr.y - ( rbr + 5 ) && me.my < gr.y )
+                        moving |= 0x2;
+                    if( me.mx >= 0 && me.mx < rbr + 5 && me.my >= 0 && me.my < gr.y )
+                        moving |= 0x4;
+                    if( me.mx >= gr.x - rbr - 5 && me.mx < gr.x && me.my >= 0 && me.my < gr.y )
+                        moving |= 0x8;
+                    if( titel && me.mx >= 0 && me.mx < gr.x && me.my >= titel->getHeight() && me.my < titel->getHeight() + 2 * ( rbr + 5 ) )
+                        moving |= 0x10;
+                    if( titel && me.mx >= 0 && me.mx < gr.x && me.my >= rbr + 5 && me.my < titel->getHeight() )
+                        moving |= 0x20;
                 }
                 if( hatStyle( Style::Closable ) && me.my <= th + rbr && me.mx >= gr.x + rbr - th && me.my >= rbr && me.mx <= gr.x - rbr )
                 {

+ 1 - 0
Fenster.h

@@ -295,6 +295,7 @@ namespace Framework
         Punkt min, max;
         Punkt kMin, kMax;
         bool closeKlick, klick;
+        int moving;
         int mx, my;
 
     public: