/[RomCheater]/trunk/RomCheater/Docking/UI/UIMemoryViewer.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/UI/UIMemoryViewer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 08:10:25	201
+++ trunk/RomCheater/Docking/UI/UIMemoryViewer.cs	2012/05/31 08:38:16	202
@@ -40,7 +40,10 @@
                 lblAddressMarker.Text = lblAddressMarker.Text + string.Format("{0:X2} ", i);
             }
             this.AcceptedPlugin = null; this.AcceptedProcess = null;
-        }
+
+            txtAddresses.MouseWheel += new MouseEventHandler(txtAddresses_MouseWheel);
+            txtData.MouseWheel += new MouseEventHandler(txtData_MouseWheel);
+        } 
         #region IProcessConfig Members
         private Process _AcceptedProcess;
         public Process AcceptedProcess
@@ -359,6 +362,45 @@
         private void txtData_KeyDown(object sender, KeyEventArgs e) { this.Handle_KeyDown(sender, e); }
 
         private void ramScroll_Scroll(object sender, ScrollEventArgs e) { this.Handle_Scroll(sender, e); }
+
+        private ScrollEventArgs GetMouseWheelScrollChange(int WheelDelta)
+        {
+            ScrollEventArgs args = new ScrollEventArgs(ScrollEventType.SmallIncrement,1);
+            if (WheelDelta < 0)
+            {
+                //// negative: scroll down
+                //// SmallDecrement -or- LargeDecrement
+                //if (WheelDelta <= small_scroll_change)
+                //{
+                //    args = new ScrollEventArgs(ScrollEventType.SmallDecrement,(int)small_scroll_change);
+                //}
+                //if (WheelDelta > small_scroll_change && WheelDelta <= large_scroll_change)
+                //{
+                //    args = new ScrollEventArgs(ScrollEventType.LargeDecrement, (int)large_scroll_change);
+                //}
+                args = new ScrollEventArgs(ScrollEventType.SmallIncrement, 1);
+            }
+            else
+            {
+                //// positive: scroll up
+                //// SmallIncrement  -or- LargeIncrement
+                //if (WheelDelta <= small_scroll_change)
+                //{
+                //    args = new ScrollEventArgs(ScrollEventType.SmallIncrement, (int)small_scroll_change);
+                //}
+                //if (WheelDelta > small_scroll_change && WheelDelta <= large_scroll_change)
+                //{
+                //    args = new ScrollEventArgs(ScrollEventType.LargeIncrement, (int)large_scroll_change);
+                //}
+                args = new ScrollEventArgs(ScrollEventType.SmallDecrement, 1);
+            }
+            return args;
+        }
+
+        void txtAddresses_MouseWheel(object sender, MouseEventArgs e) { this.Handle_Scroll(sender, GetMouseWheelScrollChange(e.Delta)); }
+        void txtData_MouseWheel(object sender, MouseEventArgs e) { this.Handle_Scroll(sender, GetMouseWheelScrollChange(e.Delta)); }
+       
+
         private void Handle_Scroll(object sender, ScrollEventArgs e)
         {
             //isScrolling = true;
@@ -374,14 +416,28 @@
             switch (e.Type)
             {
                 case ScrollEventType.SmallDecrement:
-                    this.CURRENT_TOP_ADDR -= (small_scroll_change);
+                    if (this.CURRENT_TOP_ADDR == 0 && ((this.CURRENT_TOP_ADDR - small_scroll_change) > this.CURRENT_TOP_ADDR))
+                    {
+                        this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
+                    }
+                    else
+                    {
+                        this.CURRENT_TOP_ADDR -= (small_scroll_change);
+                    }
                     break;
                 case ScrollEventType.SmallIncrement:
                     this.CURRENT_TOP_ADDR += (small_scroll_change);
                     break;
 
                 case ScrollEventType.LargeDecrement:
-                    this.CURRENT_TOP_ADDR -= (large_scroll_change);
+                    if (this.CURRENT_TOP_ADDR == 0 && ((this.CURRENT_TOP_ADDR - large_scroll_change) > this.CURRENT_TOP_ADDR))
+                    {
+                        this.CURRENT_TOP_ADDR = ORIGINAL_ADDR;
+                    }
+                    else
+                    {
+                        this.CURRENT_TOP_ADDR -= (large_scroll_change);
+                    }
                     break;
                 case ScrollEventType.LargeIncrement:
                     this.CURRENT_TOP_ADDR += (large_scroll_change);

 

  ViewVC Help
Powered by ViewVC 1.1.22