Beispiel #1
0
        public void UpdateUI()
        {
            // This routine is a huge memory eater.
            return;

#if false
            richTextBox1.Clear();
            if (document == null)
            {
                return;
            }

            listingView = new ListingViewModel(document.Disassembler);

            StringBuilder sb       = new StringBuilder();
            int           rowCount = listingView.Rows.Count;
            int[]         rowStart = new int[rowCount + 1];
            for (int i = 0; i < rowCount; i++)
            {
                ListingRow row = listingView.Rows[i];
                rowStart[i] = sb.Length;
                sb.AppendFormat("{0} {1}\n", row.Location, row.Text);
            }
            rowStart[rowCount] = sb.Length;
            richTextBox1.Text  = sb.ToString();
            return;

#if false
#if false
            //richTextBox1.Test();
#else
            // Format the text.
            //richTextBox1.Visible = false;
            ITextDocument textDocument = richTextBox1.GetTextDocument();
            //textDocument.Freeze();
            int nUndoLimit = richTextBox1.SetUndoLimit(0);
            //textDocument.BeginEditCollection(); -- not implemented
#if false
            richTextBox1.SelectAll();
            richTextBox1.SelectionColor = Color.Blue;
            richTextBox1.DeselectAll();
#else
            //richTextBox1.SelectedRtf
            System.Diagnostics.Debug.WriteLine("Formatting " + rowCount + " lines...");
            for (int i = rowCount - 1; i >= 0; i--)
            {
                richTextBox1.Select(rowStart[i], 9);
                //richTextBox1.SelectionColor = Color.Blue;
                richTextBox1.SelectedText = "NEW";
            }
#endif
            //richTextBox1.Visible = true;
            //textDocument.Unfreeze();
            //textDocument.EndEditCollection();
#endif
#endif
#endif
        }
        private void lvListing_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtStatus.Text = "";
            if (lvListing.SelectedIndices.Count == 0)
            {
                return;
            }

            int i = lvListing.SelectedIndices[0];

            activeRowIndex = i;

            // Display brief description of instruction.
            ListingRow row = viewModel.Rows[viewportBeginIndex + i];

            if (row is CodeListingRow)
            {
                Operation op   = ((CodeListingRow)row).Instruction.Operation;
                string    desc = op.GetDescription();
                if (desc != null)
                {
                    txtStatus.Text = string.Format("{0} - {1}",
                                                   op.ToString().ToUpperInvariant(), desc);
                }
            }

            Pointer        address = row.Location;
            ByteProperties b       = document.Image[address];

            if (b == null) // TBD: we should also do something for an unanalyzed byte.
            {
                return;
            }

            // Update the current location.
            document.Navigator.SetLocation(row.Location, this, LocationChangeType.Minor);

            // this.ActiveSegment = address.Segment;
        }