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(); }
void UpdateCenterMark() { for (int oldindex = 0; oldindex < MapController.Controls.Count; oldindex++) { Object o = MapController.Controls[oldindex]; if (o is NumericUpDown) { ((NumericUpDown)o).BackColor = OptionForm.Color_Input_BackColor(); ((NumericUpDown)o).ForeColor = OptionForm.Color_Input_ForeColor(); } } CenterX = (int)this.B2.Value; CenterY = (int)this.B3.Value; int newindex = (CenterX + (CenterY * BoxWidth)); if (newindex < MapController.Controls.Count) { Object o = MapController.Controls[newindex]; if (o is NumericUpDown) { ((NumericUpDown)o).BackColor = OptionForm.Color_Keyword_BackColor(); ((NumericUpDown)o).ForeColor = OptionForm.Color_Keyword_ForeColor(); } } }
public void LoadScreen() { if (Tab.SelectedIndex != 0) {//地図ではない場合、非表示にはなるため、 MapPicture.OnLoadが呼ばれないらしい... Tab.SelectedIndex = 0; } Bitmap map = ImageUtil.Blank(320, 240); map = ImageUtil.DrawGrid(map, OptionForm.Color_Keyword_ForeColor(), 16); MAP.ClearAllPoint(); MAP.LoadMap(map); MAP.SetChipSize(1); Bitmap icon = ImageSystemIconForm.YubiTate(); U.MakeTransparent(icon); MAP.SetDefaultIcon(icon, -8, -14); if (!MAP.IsMapLoad()) { return; } int width = MAP.GetMapBitmapWidth(); int height = MAP.GetMapBitmapHeight() + this.MAP.CommandBar.Height * 2; this.Tab.Width = width; this.Tab.Height = height; this.MAP.Width = width; this.MAP.Height = height; Tab.SelectedIndex = 0; this.Width = width; this.Height = height; }
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(); } }
SolidBrush ListBoxForeKeywordBrush; //キーワードのブラシ public SongTrackForm() { InitializeComponent(); fixDocsBugs = new U.FixDocsBugs(this); this.TrackListBoxs = new ListBoxEx[] { Track1, Track2, Track3, Track4, Track5, Track6, Track7, Track8, Track9, Track10, Track11, Track12, Track13, Track14, Track15, Track16 }; this.TrackLabels = new Label[] { TrackLabel1, TrackLabel2, TrackLabel3, TrackLabel4, TrackLabel5, TrackLabel6, TrackLabel7, TrackLabel8, TrackLabel9, TrackLabel10, TrackLabel11, TrackLabel12, TrackLabel13, TrackLabel14, TrackLabel15, TrackLabel16 }; this.InputFormRef = Init(this); this.InputFormRef.MakeGeneralAddressListContextMenu(true); this.InputFormRef.IsMemoryNotContinuous = true; //メモリは連続していないので警告不可能 this.InputFormRef.UseWriteProtectionID00 = true; //ID:0x00を書き込み禁止 this.InputFormRef.CheckProtectionPaddingALIGN4 = false; //ALIGN 4である必要はない. this.ListBoxForeKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor()); this.ListBoxForeBrush = new SolidBrush(OptionForm.Color_Control_ForeColor()); for (int i = 0; i < this.TrackLabels.Length; i++) { this.TrackLabels[i].Click += TrackLabel_Click; this.TrackListBoxs[i].OwnerDraw(DrawTrack, DrawMode.OwnerDrawFixed, false); this.TrackListBoxs[i].ItemHeight = 12; } InputFormRef.markupJumpLabel(this.AllTracksLabel); U.SetIcon(ImportButton, Properties.Resources.icon_upload); U.SetIcon(ExportButton, Properties.Resources.icon_arrow); U.SetIcon(SONGPLAY, Properties.Resources.icon_music); InputFormRef.markupJumpLabel(LinkInternt); U.AllowDropFilename(this, new string[] { ".S", ".MID", ".MIDI", ".WAV", ".INSTRUMENT" }, (string filename) => { using (ImageFormRef.AutoDrag ad = new ImageFormRef.AutoDrag(filename)) { ImportButton_Click(null, null); } }); }
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)); }
public void SimpleKeywordHighLight(RichTextBoxEx target) { target.LockWindowUpdate(); Color keywordBackColor = OptionForm.Color_Keyword_BackColor(); Color keywordForeColor = OptionForm.Color_Keyword_ForeColor(); Color commentBackColor = OptionForm.Color_Input_BackColor(); Color commentForeColor = OptionForm.Color_Comment_ForeColor(); string[] keywords = new string[] { "LSL", "LSR", "ASR", "ADD", "SUB", "MOV", "CMP", "AND", "EOR", "ADC", "SBC", "ROR", "TST", "NEG", "CMP", "CMN", "ORR", "BIC", "MVN", "BX", "LDR", "LDRH", "LDRB", "STR", "STRH", "STRB", "LDSB", "LDSH", "PUSH", "POP", "STMIA", "LDMIA", "BEQ", "BNE", "BCS", "BCC", "BMI", "BPL", "BVS", "BVC", "BHI", "BLS", "BGE", "BLT", "BGT", "BLE", "SWI", "B", "BL", ".THUMB", ".ORG", ".EQU", ".LTORG" }; //ハイライトを解除. target.SelectionStart = 0; target.SelectionLength = target.TextLength; target.SelectionColor = OptionForm.Color_Input_ForeColor(); target.SelectionBackColor = OptionForm.Color_Input_BackColor(); //改行コードが違うので、必ず取得しなおす string text = target.Text; int length = text.Length; for (int i = 0; i < length;) { if (U.Wordrap(text[i])) { i++; continue; } int start = i; for (i = i + 1; i < length; i++) { if (U.Wordrap(text[i])) { break; } } string token = text.Substring(start, i - start); if (token.IndexOf('@') == 0) {//コメント int term = text.IndexOf("\n", i); if (term > 0) { i = term; } target.SelectionStart = start; target.SelectionLength = i - start; target.SelectionColor = commentForeColor; target.SelectionBackColor = commentBackColor; continue; } token = token.ToUpper(); foreach (string k in keywords) { if (token == k) {//キーワード target.SelectionStart = start; target.SelectionLength = i - start; target.SelectionColor = keywordForeColor; target.SelectionBackColor = keywordBackColor; break; } } } target.UnLockWindowUpdate(); }
public Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw) { if (index < 0 || index >= lb.Items.Count) { return(new Size(listbounds.X, listbounds.Y)); } SolidBrush brush = new SolidBrush(lb.ForeColor); SolidBrush foreKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor()); Font normalFont = lb.Font; Font boldFont = new Font(lb.Font, FontStyle.Bold); Rectangle bounds = listbounds; int lineHeight = normalFont.Height; UseFlagID current = this.FlagList[index]; string text; int maxWidth = 0; if (index == 0 || current.ID != this.FlagList[index - 1].ID) { //フラグ名を描画 if (index != 0) { //空行を入れる bounds.Y += lineHeight; } //フラグのアイコンを描画 Bitmap bitmap = ImageSystemIconForm.FlagIcon(); U.MakeTransparent(bitmap); Rectangle b = bounds; b.Width = lineHeight; b.Height = lineHeight; bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b); bitmap.Dispose(); //フラグ名を書く string dummy; text = ":"; bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds); text = U.ToHexString(current.ID); bounds.X += U.DrawText(text, g, boldFont, brush, isWithDraw, bounds); text = " " + InputFormRef.GetFlagName(current.ID, out dummy); bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds); //次の行へ maxWidth = bounds.X; bounds.Y += lineHeight; bounds.X = listbounds.X; } //名称の表示 bounds.X += 10; text = MainSimpleMenuEventErrorForm.TypeToString(current.DataType, current.Addr, current.Tag); bounds.X += U.DrawText(text, g, boldFont, foreKeywordBrush, isWithDraw, bounds); //次の行へ maxWidth = Math.Max(bounds.X, maxWidth); bounds.Y += lineHeight; bounds.X = listbounds.X; //情報を書く. bounds.X += 6; text = current.Info; Size ss; if (current.DataType == FELint.Type.BATTTLE_TALK || current.DataType == FELint.Type.HAIKU) { ss = DrawUnitAllowToAllow(text, lb, g, bounds, isWithDraw); } else if (current.DataType == FELint.Type.EVENT_COND_ALWAYS) { ss = EventCondForm.DrawEventListAlwaysOneLiner(current.Addr, lb, g, bounds, isWithDraw); } else if (current.DataType == FELint.Type.EVENT_COND_OBJECT) { ss = EventCondForm.DrawEventListObjectOneLiner(current.Addr, lb, g, bounds, isWithDraw); } else if (current.DataType == FELint.Type.EVENT_COND_TALK) { ss = EventCondForm.DrawEventListTalkOneLiner(current.Addr, lb, g, bounds, isWithDraw); } else if (current.DataType == FELint.Type.EVENT_COND_TURN) { ss = EventCondForm.DrawEventListTurnOneLiner(current.Addr, lb, g, bounds, isWithDraw); } else if (current.DataType == FELint.Type.EVENTSCRIPT) { EventScript.OneCode code = Program.EventScript.DisAseemble(Program.ROM.Data, current.Tag); ss = EventScriptForm.DrawCode(lb, g, bounds, isWithDraw, code); } else { bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds); bounds.Y += lineHeight; ss = new Size(bounds.X, bounds.Y); } bounds.X = ss.Width; bounds.Y = ss.Height; brush.Dispose(); foreKeywordBrush.Dispose(); //最後の改行 maxWidth = Math.Max(bounds.X, maxWidth); return(new Size(maxWidth, bounds.Y)); }