Example #1
0
            /// <summary>
            /// Paints the control's window area. Strategy is to find the spans that make up
            /// the whole segment, and paint them one at a time.
            /// </summary>
            /// <param name="g"></param>
            public Address PaintWindow(Graphics g, Size cellSize, Point ptAddr, bool render)
            {
                this.cellSize = cellSize;
                //$TODO: these should be user-configurable.
                codeTheme = new BrushTheme {
                    Background = Brushes.Pink, Foreground = SystemBrushes.WindowText, StartMarker = Brushes.Red
                };
                dataTheme = new BrushTheme {
                    Background = Brushes.LightBlue, Foreground = SystemBrushes.WindowText, StartMarker = Brushes.Blue
                };
                defaultTheme = new BrushTheme {
                    Background = SystemBrushes.Window, Foreground = SystemBrushes.ControlText
                };
                selectTheme = new BrushTheme {
                    Background = SystemBrushes.Highlight, Foreground = SystemBrushes.HighlightText
                };

                if (ctrl.arch == null || ctrl.imageMap == null)
                {
                    return(null);
                }
                // Enumerate all segments visible on screen.

                ulong laEnd = ctrl.ProgramImage.BaseAddress.ToLinear() + (uint)ctrl.image.Bytes.Length;

                if (ctrl.addrTopVisible.ToLinear() >= laEnd || !ctrl.image.IsValidAddress(ctrl.addrTopVisible))
                {
                    return(null);
                }
                ImageReader rdr  = ctrl.arch.CreateImageReader(ctrl.ProgramImage, ctrl.addrTopVisible);
                Rectangle   rc   = ctrl.ClientRectangle;
                Size        cell = ctrl.CellSize;

                rc.Height = cell.Height;

                ulong laSegEnd = 0;

                while (rc.Top < ctrl.Height && rdr.Address.ToLinear() < laEnd)
                {
                    ImageMapSegment seg;
                    if (!ctrl.ImageMap.TryFindSegment(ctrl.addrTopVisible, out seg))
                    {
                        return(null);
                    }
                    if (rdr.Address.ToLinear() >= laSegEnd)
                    {
                        laSegEnd = seg.Address.ToLinear() + seg.Size;
                        rdr      = ctrl.arch.CreateImageReader(ctrl.ProgramImage, seg.Address + (rdr.Address - seg.Address));
                    }
                    Address addr = PaintLine(g, rc, rdr, ptAddr, render);
                    if (addr != null)
                    {
                        return(addr);
                    }
                    rc.Offset(0, ctrl.CellSize.Height);
                }
                return(null);
            }
Example #2
0
            private void GetColorPreferences()
            {
                var uiPrefs = this.ctrl.Services.RequireService <IUiPreferencesService>();
                var wind    = uiPrefs.Styles[UiStyles.MemoryWindow];
                var code    = uiPrefs.Styles[UiStyles.MemoryCode];
                var data    = uiPrefs.Styles[UiStyles.MemoryData];
                var heur    = uiPrefs.Styles[UiStyles.MemoryHeuristic];

                codeTheme = new BrushTheme {
                    Background = code.Background, Foreground = code.Foreground ?? SystemBrushes.ControlText, StartMarker = Brushes.Red
                };
                dataTheme = new BrushTheme {
                    Background = data.Background, Foreground = data.Foreground ?? SystemBrushes.ControlText, StartMarker = Brushes.Blue
                };
                defaultTheme = new BrushTheme {
                    Background = wind.Background ?? SystemBrushes.Window, Foreground = wind.Foreground ?? SystemBrushes.ControlText
                };
                selectTheme = new BrushTheme {
                    Background = SystemBrushes.Highlight, Foreground = SystemBrushes.HighlightText
                };
            }
Example #3
0
            /// <summary>
            /// Paints the control's window area. Strategy is to find the spans that make up
            /// the whole segment, and paint them one at a time.
            /// </summary>
            /// <param name="g"></param>
            public Address PaintWindow(Graphics g, Size cellSize, Point ptAddr, bool render)
            {
                this.cellSize = cellSize;
                //$TODO: these should be user-configurable.
                codeTheme = new BrushTheme { Background = Brushes.Pink, Foreground = SystemBrushes.WindowText, StartMarker = Brushes.Red };
                dataTheme = new BrushTheme { Background = Brushes.LightBlue, Foreground = SystemBrushes.WindowText, StartMarker = Brushes.Blue };
                defaultTheme = new BrushTheme { Background = SystemBrushes.Window, Foreground = SystemBrushes.ControlText };
                selectTheme = new BrushTheme { Background = SystemBrushes.Highlight, Foreground = SystemBrushes.HighlightText };

                if (ctrl.arch == null || ctrl.imageMap == null)
                    return null;
                // Enumerate all segments visible on screen.

                ulong laEnd = ctrl.ProgramImage.BaseAddress.ToLinear() + (uint) ctrl.image.Bytes.Length;
                if (ctrl.addrTopVisible.ToLinear() >= laEnd || !ctrl.image.IsValidAddress(ctrl.addrTopVisible))
                    return null;
                ImageReader rdr = ctrl.arch.CreateImageReader(ctrl.ProgramImage, ctrl.addrTopVisible);
                Rectangle rc = ctrl.ClientRectangle;
                Size cell = ctrl.CellSize;
                rc.Height = cell.Height;

                ulong laSegEnd = 0;
                while (rc.Top < ctrl.Height && rdr.Address.ToLinear() < laEnd)
                {
                    ImageMapSegment seg;
                    if (!ctrl.ImageMap.TryFindSegment(ctrl.addrTopVisible, out seg))
                        return null;
                    if (rdr.Address.ToLinear() >= laSegEnd)
                    {
                        laSegEnd = seg.Address.ToLinear() + seg.Size;
                        rdr = ctrl.arch.CreateImageReader(ctrl.ProgramImage, seg.Address + (rdr.Address - seg.Address));
                    }
                    Address addr = PaintLine(g, rc, rdr, ptAddr, render);
                    if (addr != null)
                        return addr;
                    rc.Offset(0, ctrl.CellSize.Height);
                }
                return null;
            }
Example #4
0
 private void GetColorPreferences()
 {
     var uiPrefs = this.ctrl.Services.RequireService<IUiPreferencesService>();
     var wind = uiPrefs.Styles[UiStyles.MemoryWindow];
     var code = uiPrefs.Styles[UiStyles.MemoryCode];
     var data = uiPrefs.Styles[UiStyles.MemoryData];
     var heur = uiPrefs.Styles[UiStyles.MemoryHeuristic];
     codeTheme = new BrushTheme { Background = code.Background, Foreground = code.Foreground ?? SystemBrushes.ControlText, StartMarker = Brushes.Red };
     dataTheme = new BrushTheme { Background = data.Background, Foreground = data.Foreground ?? SystemBrushes.ControlText, StartMarker = Brushes.Blue };
     defaultTheme = new BrushTheme { Background = wind.Background ?? SystemBrushes.Window, Foreground = wind.Foreground ?? SystemBrushes.ControlText };
     selectTheme = new BrushTheme { Background = SystemBrushes.Highlight, Foreground = SystemBrushes.HighlightText };
 }