public void SetDescription(Rn reg, AsmDudeTools asmDudeTools)
        {
            string regStr = reg.ToString();

            this.Description.Inlines.Add(new Run("Register ")
            {
                FontWeight = FontWeights.Bold, Foreground = this._foreground
            });
            this.Description.Inlines.Add(new Run(regStr)
            {
                FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(AsmDudeToolsStatic.ConvertColor(Settings.Default.SyntaxHighlighting_Register))
            });

            Arch   arch    = RegisterTools.GetArch(reg);
            string archStr = (arch == Arch.ARCH_NONE) ? "" : " [" + ArchTools.ToString(arch) + "] ";
            string descr   = asmDudeTools.Get_Description(regStr);

            if (regStr.Length > (AsmDudePackage.maxNumberOfCharsInToolTips / 2))
            {
                descr = "\n" + descr;
            }
            string full_Descr = AsmSourceTools.Linewrap(":" + archStr + descr, AsmDudePackage.maxNumberOfCharsInToolTips);

            this.Description.Inlines.Add(new Run(full_Descr)
            {
                Foreground = this._foreground
            });
        }
Exemple #2
0
        public AsmDocMouseHandler(
            IWpfTextView view,
            IClassifier aggregator,
            ITextStructureNavigator navigator,
            CtrlKeyState state,
            AsmDudeTools asmDudeTools)
        {
            //AsmDudeToolsStatic.Output_INFO("AsmDocMouseHandler:constructor: file=" + AsmDudeToolsStatic.GetFileName(view.TextBuffer));
            this._view         = view;
            this._state        = state;
            this._aggregator   = aggregator;
            this._navigator    = navigator;
            this._asmDudeTools = asmDudeTools;

            this._state.CtrlKeyStateChanged += (sender, args) =>
            {
                if (Settings.Default.AsmDoc_On)
                {
                    if (this._state.Enabled)
                    {
                        this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this._view.VisualElement)));
                    }
                    else
                    {
                        this.Set_Highlight_Span(null);
                    }
                }
            };

            // Some other points to clear the highlight span:
            this._view.LostAggregateFocus       += (sender, args) => this.Set_Highlight_Span(null);
            this._view.VisualElement.MouseLeave += (sender, args) => this.Set_Highlight_Span(null);
        }
        public AsmDocMouseHandler(
            IWpfTextView view,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            CtrlKeyState state,
            AsmDudeTools asmDudeTools)
        {
            AsmDudeToolsStatic.Output_INFO(string.Format("{0}:constructor: file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(view.TextBuffer)));
            this._view         = view;
            this._state        = state;
            this._aggregator2  = AsmDudeToolsStatic.GetOrCreate_Aggregator(view.TextBuffer, aggregatorFactory);
            this._asmDudeTools = asmDudeTools;

            this._state.CtrlKeyStateChanged += (sender, args) =>
            {
                if (Settings.Default.AsmDoc_On)
                {
                    if (this._state.Enabled)
                    {
                        this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this._view.VisualElement)));
                    }
                    else
                    {
                        this.Set_Highlight_Span(null);
                    }
                }
            };

            // Some other points to clear the highlight span:
            this._view.LostAggregateFocus       += (sender, args) => this.Set_Highlight_Span(null);
            this._view.VisualElement.MouseLeave += (sender, args) => this.Set_Highlight_Span(null);
        }
        public AsmDocMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IClassifier aggregator,
                                  ITextStructureNavigator navigator, CtrlKeyState state, AsmDudeTools asmDudeTools)
        {
            this._view          = view;
            this._commandTarget = commandTarget;
            this._state         = state;
            this._aggregator    = aggregator;
            this._navigator     = navigator;
            this._asmDudeTools  = asmDudeTools;

            this._state.CtrlKeyStateChanged += (sender, args) => {
                if (_state.Enabled)
                {
                    this.TryHighlightItemUnderMouse(RelativeToView(Mouse.PrimaryDevice.GetPosition(_view.VisualElement)));
                }
                else
                {
                    this.SetHighlightSpan(null);
                }
            };

            // Some other points to clear the highlight span:
            _view.LostAggregateFocus       += (sender, args) => this.SetHighlightSpan(null);
            _view.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null);
        }
        public void SetPerformanceInfo(Mnemonic mnemonic, AsmDudeTools asmDudeTools)
        {
            if (Settings.Default.PerformanceInfo_On)
            {
                this.PerformanceExpander.IsExpanded = !Settings.Default.PerformanceInfo_IsDefaultCollapsed;

                bool       empty  = true;
                bool       first  = true;
                FontFamily family = new FontFamily("Consolas");
                string     format = "{0,-14}{1,-24}{2,-7}{3,-9}{4,-20}{5,-9}{6,-11}{7,-10}";

                MicroArch selectedMicroarchitures = AsmDudeToolsStatic.Get_MicroArch_Switched_On();
                foreach (PerformanceItem item in asmDudeTools.Performance_Store.GetPerformance(mnemonic, selectedMicroarchitures))
                {
                    empty = false;
                    if (first)
                    {
                        first = false;
                        this.Performance.Inlines.Add(new Run(string.Format(
                                                                 format,
                                                                 string.Empty, string.Empty, "µOps", "µOps", "µOps", string.Empty, string.Empty, string.Empty))
                        {
                            FontFamily = family,
                            FontStyle  = FontStyles.Italic,
                            FontWeight = FontWeights.Bold,
                            Foreground = this._foreground,
                        });
                        this.Performance.Inlines.Add(new Run(string.Format(
                                                                 "\n" + format,
                                                                 "Architecture", "Instruction", "Fused", "Unfused", "Port", "Latency", "Throughput", string.Empty))
                        {
                            FontFamily = family,
                            FontStyle  = FontStyles.Italic,
                            FontWeight = FontWeights.Bold,
                            Foreground = this._foreground,
                        });
                    }
                    this.Performance.Inlines.Add(new Run(string.Format(
                                                             "\n" + format,
                                                             item._microArch + " ",
                                                             item._instr + " " + item._args + " ",
                                                             item._mu_Ops_Fused + " ",
                                                             item._mu_Ops_Merged + " ",
                                                             item._mu_Ops_Port + " ",
                                                             item._latency + " ",
                                                             item._throughput + " ",
                                                             item._remark))
                    {
                        FontFamily = family,
                        Foreground = this._foreground,
                    });
                }
                this.PerformanceExpander.Visibility = empty ? Visibility.Collapsed : Visibility.Visible;
                this.PerformanceBorder.Visibility   = empty ? Visibility.Collapsed : Visibility.Visible;
            }
        }
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     ITagAggregator <AsmTokenTag> aggregator,
     ILabelGraph labelGraph)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = aggregator;
     this._labelGraph   = labelGraph;
     this._asmDudeTools = AsmDudeTools.Instance;
 }
Exemple #7
0
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     IBufferTagAggregatorFactoryService aggregatorFactory,
     LabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, aggregatorFactory);
     this._labelGraph   = labelGraph;
     this._asmSimulator = asmSimulator;
     this._asmDudeTools = AsmDudeTools.Instance;
 }
Exemple #8
0
 public AsmQuickInfoSource(
     ITextBuffer textBuffer,
     IBufferTagAggregatorFactoryService aggregatorFactory,
     LabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this.textBuffer_   = textBuffer ?? throw new ArgumentNullException(nameof(textBuffer));
     this.aggregator_   = AsmDudeToolsStatic.GetOrCreate_Aggregator(textBuffer, aggregatorFactory);
     this.labelGraph_   = labelGraph ?? throw new ArgumentNullException(nameof(labelGraph));
     this.asmSimulator_ = asmSimulator ?? throw new ArgumentNullException(nameof(asmSimulator));
     this.asmDudeTools_ = AsmDudeTools.Instance;
 }
Exemple #9
0
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     ITagAggregator <AsmTokenTag> aggregator,
     ILabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = aggregator;
     this._labelGraph   = labelGraph;
     this._asmSimulator = asmSimulator;
     this._asmDudeTools = AsmDudeTools.Instance;
     this._foreground   = AsmDudeToolsStatic.GetFontColor();
 }
        public void SetDescription(Mnemonic mnemonic, AsmDudeTools asmDudeTools)
        {
            string mnemonicStr = mnemonic.ToString();

            this.Description.Inlines.Add(new Run("Mnemonic ")
            {
                FontWeight = FontWeights.Bold, Foreground = this._foreground
            });
            this.Description.Inlines.Add(new Run(mnemonicStr)
            {
                FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(AsmDudeToolsStatic.ConvertColor((AsmSourceTools.IsJump(mnemonic) ? Settings.Default.SyntaxHighlighting_Jump : Settings.Default.SyntaxHighlighting_Opcode)))
            });

            string archStr    = ":" + ArchTools.ToString(asmDudeTools.Mnemonic_Store.GetArch(mnemonic)) + " ";
            string descr      = asmDudeTools.Mnemonic_Store.GetDescription(mnemonic);
            string full_Descr = AsmSourceTools.Linewrap(archStr + descr, AsmDudePackage.maxNumberOfCharsInToolTips);

            this.Description.Inlines.Add(new Run(full_Descr)
            {
                Foreground = this._foreground
            });
        }
Exemple #11
0
        public AsmDocMouseHandler(
            IWpfTextView view,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            CtrlKeyState state,
            AsmDudeTools asmDudeTools)
        {
            AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:constructor: file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(view.TextBuffer)));
            this.view_         = view ?? throw new ArgumentNullException(nameof(view));
            this.state_        = state ?? throw new ArgumentNullException(nameof(state));
            this.aggregator2_  = AsmDudeToolsStatic.GetOrCreate_Aggregator(view.TextBuffer, aggregatorFactory);
            this.asmDudeTools_ = asmDudeTools ?? throw new ArgumentNullException(nameof(asmDudeTools));

            this.state_.CtrlKeyStateChanged += (sender, args) =>
            {
                if (Settings.Default.AsmDoc_On)
                {
                    if (this.state_.Enabled)
                    {
                        this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this.view_.VisualElement)));
                    }
                    else
                    {
                        this.Set_Highlight_Span(null);
                    }
                }
            };

            // Some other points to clear the highlight span:
            this.view_.LostAggregateFocus += (sender, args) =>
            {
                AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: LostAggregateFocus", this.ToString()));
                this.Set_Highlight_Span(null);
            };
            this.view_.VisualElement.MouseLeave += (sender, args) =>
            {
                AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: MouseLeave", this.ToString()));
                this.Set_Highlight_Span(null);
            };
        }