Ejemplo n.º 1
0
 private void ToolFELintForm_Load(object sender, EventArgs e)
 {
     this.X_SUCCESSMESSAGE.BackColor = OptionForm.Color_Keyword_BackColor();
     this.X_SUCCESSMESSAGE.ForeColor = OptionForm.Color_Keyword_ForeColor();
     this.X_ERRORMESSAGE.BackColor   = OptionForm.Color_Error_BackColor();
     this.X_ERRORMESSAGE.ForeColor   = OptionForm.Color_Error_ForeColor();
 }
Ejemplo n.º 2
0
        private Size DrawErrorList(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            U.AddrResult ar    = InputFormRef.SelectToAddrResult(lb, index);
            uint         mapid = ar.addr;

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            SolidBrush errorBrush = new SolidBrush(OptionForm.Color_Error_ForeColor());

            Font normalFont = lb.Font;
            Font boldFont   = new Font(lb.Font, FontStyle.Bold);

            string    text;
            Rectangle bounds = listbounds;

            int lineHeight = (int)lb.Font.Height;
            int maxHeight  = (int)lb.Font.Height;


            bounds.X += U.DrawText(ar.name, g, boldFont, brush, isWithDraw, bounds);
            bounds.X += 20;

            text      = R._("//エラー:{0}個のエラーがあります", ar.tag);
            bounds.X += U.DrawText(text, g, boldFont, errorBrush, isWithDraw, bounds);


            bounds.Y += maxHeight;
            return(new Size(bounds.X, bounds.Y));
        }
Ejemplo n.º 3
0
        public void SetErrorMessage(string str)
        {
            this.Error_MessageLabel.Text = str;

            Color Color_Error_BackColor = OptionForm.Color_Error_BackColor();
            Color Color_Error_ForeColor = OptionForm.Color_Error_ForeColor();

            Error_MessageLabel.BackColor = Color_Error_BackColor;
            Error_MessageLabel.ForeColor = Color_Error_ForeColor;
        }
        private Size DrawEventList(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= this.ErrorList.Count || this.MapID == U.NOT_FOUND)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }

            FELint.ErrorSt est = this.ErrorList[index];

            SolidBrush brush      = new SolidBrush(lb.ForeColor);
            SolidBrush errorBrush = new SolidBrush(OptionForm.Color_Error_ForeColor());

            Font normalFont = lb.Font;
            Font boldFont   = new Font(lb.Font, FontStyle.Bold);

            Rectangle bounds = listbounds;

            int lineHeight = (int)lb.Font.Height;
            int maxWidth   = 0;

            string text = TypeToString(est.DataType, est.Addr, est.Tag);

            U.DrawText(text, g, boldFont, errorBrush, isWithDraw, bounds);
            if (Program.LintCache.CheckFast(est.Addr))
            {
                string comment = "//" + R._("このエラーは非表示になっています。理由:「{0}」", Program.LintCache.At(est.Addr));

                bounds.X = listbounds.X + (lineHeight * 25);

                SolidBrush commentBrush = new SolidBrush(OptionForm.Color_Comment_ForeColor());
                bounds.X += U.DrawText(comment, g, normalFont, commentBrush, isWithDraw, bounds);
                commentBrush.Dispose();

                maxWidth = Math.Max(maxWidth, bounds.X);
            }
            bounds.Y += lineHeight;

            text     = est.ErrorMessage;
            bounds.X = listbounds.X;
            Size size = U.DrawTextMulti(text, g, normalFont, brush, isWithDraw, bounds);

            bounds.X += size.Width;

            maxWidth = Math.Max(maxWidth, bounds.X);

            brush.Dispose();
            boldFont.Dispose();

            bounds.X  = maxWidth;
            bounds.Y += size.Height + lineHeight;
            return(new Size(bounds.X, bounds.Y));
        }
Ejemplo n.º 5
0
 public void Init(int trackNumber, bool isMute, string instName)
 {
     if (isMute)
     {
         label1.Text            = R._("トラック({0})をミュート解除にしますか?\r\n{1}", trackNumber, instName);
         ToggleButton.Text      = R._("ミュート解除する");
         ToggleButton.ForeColor = OptionForm.Color_Keyword_ForeColor();
     }
     else
     {
         label1.Text            = R._("トラック({0})をミュートしますか?\r\n{1}", trackNumber, instName);
         ToggleButton.Text      = R._("ミュートする");
         ToggleButton.ForeColor = OptionForm.Color_Error_ForeColor();
     }
 }
Ejemplo n.º 6
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_IME_COMPOSITION)
            {
                if (((int)m.LParam & GCS_RESULTSTR) > 0)
                {
                    PushUndo();
                }
            }

            base.WndProc(ref m);

            if (m.Msg == 15) //  WM_PAINT == 15
            {
                using (var g = this.CreateGraphics())
                {
                    if (this.BackgroundImage != null)
                    {
                        g.DrawImage(this.BackgroundImage, 0, 0);
                    }
                    else if (this.Enabled && !this.ReadOnly && (_Placeholder.Length > 0) && (this.TextLength == 0))
                    {
                        // 描画を一旦消してしまう
                        Brush b = new System.Drawing.SolidBrush(this.BackColor);
                        g.FillRectangle(b, this.ClientRectangle);
                        b.Dispose();

                        // プレースホルダのテキスト色を、前景色と背景色の中間として文字列を描画する
                        var placeholderTextColor = System.Drawing.Color.FromArgb(
                            (this.ForeColor.A + this.BackColor.A) / 2
                            , (this.ForeColor.R + this.BackColor.R) / 2
                            , (this.ForeColor.G + this.BackColor.G) / 2
                            , (this.ForeColor.B + this.BackColor.B) / 2);
                        b = new System.Drawing.SolidBrush(placeholderTextColor);
                        g.DrawString(_Placeholder, this.Font, b, 1, 1);
                        b.Dispose();
                    }

                    //エラーがあれば枠の色を変える.
                    if (_ErrorMessage.Length > 0 && _ToolTipEx != null)
                    {
                        Pen pen = new Pen(OptionForm.Color_Error_ForeColor(), 3);
                        g.DrawRectangle(pen, this.ClientRectangle);
                        pen.Dispose();
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void HexBox_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            SetData(Program.ROM.Data);

            PanelForeBrush       = new SolidBrush(OptionForm.Color_Control_ForeColor());
            PanelBackBrush       = new SolidBrush(OptionForm.Color_Control_BackColor());
            ControlForeBrush     = new SolidBrush(OptionForm.Color_Input_ForeColor());
            ControlBackBrush     = new SolidBrush(OptionForm.Color_Input_BackColor());
            ControlSelectedBrush = new SolidBrush(OptionForm.Color_List_SelectedColor());
            RefColorBrush        = new SolidBrush(OptionForm.Color_NotifyWrite_BackColor());
            MarkColorBrush       = new SolidBrush(OptionForm.Color_Error_ForeColor());

            this.OneWidth  = (uint)(this.Font.SizeInPoints * 2);
            this.OneHeight = (uint)(this.Font.Height + 2);
            ClearUndoBuffer();
        }
Ejemplo n.º 8
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg == 15) //  WM_PAINT == 15
            {
                using (var g = this.CreateGraphics())
                {
                    if (this.BackgroundImage != null)
                    {
                        g.DrawImage(this.BackgroundImage, 0, 0);
                    }

                    //エラーがあれば枠の色を変える.
                    if (_ErrorMessage.Length > 0 && _ToolTipEx != null)
                    {
                        Pen pen = new Pen(OptionForm.Color_Error_ForeColor(), 3);
                        g.DrawRectangle(pen, this.ClientRectangle);
                        pen.Dispose();
                    }
                }
            }
        }
        private Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= this.ChangeDataList.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            ChangeDataSt code = this.ChangeDataList[index];

            SolidBrush brush         = new SolidBrush(lb.ForeColor);
            SolidBrush selectedBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor());
            Font       normalFont    = lb.Font;

            string    text;
            Rectangle bounds = listbounds;

            int lineHeight = (int)lb.Font.Height;
            int maxHeight  = (int)lb.Font.Height;

            if (code.mark)
            {//マークの背景になる部分を描画
                Brush markColorBrush = new SolidBrush(OptionForm.Color_Error_ForeColor());

                Rectangle rc = new Rectangle(listbounds.X, listbounds.Y, listbounds.Width, lineHeight);
                g.FillRectangle(markColorBrush, rc);

                markColorBrush.Dispose();
            }


            uint   addr   = code.addr;
            uint   length = Math.Min(code.length, 32);
            string whatis = WhatIs(addr);

            if (whatis == "")
            {
                whatis = WhatIs(addr + length);
            }

            bounds.X = HeaderLength;
            string writeof = "";

            if (code.method == MargeMethod.A)
            {
                writeof = R._("<<対処法:{0}>>", this.ALabel);
            }
            else if (code.method == MargeMethod.B)
            {
                writeof = R._("<<対処法:{0}>>", this.BLabel);
            }
            else if (code.method == MargeMethod.C)
            {
                writeof = R._("<<対処法:{0}>>", this.CLabel);
            }

            text = R._("{0} 長さ:{1} {2} {3}", U.To0xHexString(addr), code.length, writeof, whatis);
            int labelEnd = U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

            bounds.Y += lineHeight;

            text = U.HexDumpLiner(this.AData, addr, length);
            if (code.method == MargeMethod.A)
            {
                bounds.X = HeaderLength;
                U.DrawText(this.ALabel, g, normalFont, selectedBrush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, selectedBrush, isWithDraw, bounds);
            }
            else
            {
                bounds.X = HeaderLength;
                U.DrawText(this.ALabel, g, normalFont, brush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
            }
            bounds.Y += lineHeight;

            text = U.HexDumpLiner(this.BData, addr, length);
            if (code.method == MargeMethod.B)
            {
                bounds.X = HeaderLength;
                U.DrawText(this.BLabel, g, normalFont, selectedBrush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, selectedBrush, isWithDraw, bounds);
            }
            else
            {
                bounds.X = HeaderLength;
                U.DrawText(this.BLabel, g, normalFont, brush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
            }
            bounds.Y += lineHeight;

            text = U.HexDumpLiner(this.CData, addr, length);
            if (code.method == MargeMethod.C)
            {
                bounds.X = HeaderLength;
                U.DrawText(this.CLabel, g, normalFont, selectedBrush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, selectedBrush, isWithDraw, bounds);
            }
            else
            {
                bounds.X = HeaderLength;
                U.DrawText(this.CLabel, g, normalFont, brush, isWithDraw, bounds);
                bounds.X = LabelLength;
                U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
            }
            bounds.Y += lineHeight;
            bounds.Y += lineHeight;

            if (code.method != MargeMethod.NONE)
            {
                Rectangle rc = new Rectangle(listbounds.X, listbounds.Y, HeaderLength, bounds.Y - listbounds.Y);
                g.FillRectangle(selectedBrush, rc);
            }
            if (code.mark)
            {//マークの縦線になる部分を描画
                Brush markColorBrush = new SolidBrush(OptionForm.Color_Error_ForeColor());

                Rectangle rc = new Rectangle(listbounds.Width - HeaderLength, listbounds.Y, listbounds.Width, bounds.Y - listbounds.Y);
                g.FillRectangle(markColorBrush, rc);

                markColorBrush.Dispose();
            }

            brush.Dispose();
            selectedBrush.Dispose();
            return(new Size(bounds.X, bounds.Y));
        }