public void Init(frmBaseEditor editor, Func <DataType> newData, Func <Control> newControl, Action <Control> initControl, bool fixWidth = true, Action updateUIAction = null) { Editor = editor; NewData = newData; NewControl = newControl; InitControl = initControl; UpdateUIAction = updateUIAction; Control temp = NewControl(); if (fixWidth) { Width = temp.Width + vsbDatasScroller.Width + DELETE_BUTTON_SIZE.X + DATA_SPACING * 2; } else { int widthCopy = pnlControls.Width; NewControl = () => { Control t = newControl(); t.Width = widthCopy - (DELETE_BUTTON_SIZE.X + DATA_SPACING); return(t); }; } NumDatasInOneScreen = (pnlContainer.Height + DATA_SPACING) / (temp.Height + DATA_SPACING); Height = NumDatasInOneScreen * (temp.Height + DATA_SPACING) - DATA_SPACING + btnAdd.Height + btnAdd.Top - vsbDatasScroller.Bottom; vsbDatasScroller.LargeChange = NumDatasInOneScreen; UpdateUI(); temp.Dispose(); }
public void Init(OpenFileDialog dlgOpen, frmBaseEditor editor, Action postOnClick = null) { MouseUp += OnClick; this.dlgOpen = dlgOpen; Editor = editor; tmrAnimate.Interval = 400; tmrAnimate.Tick += tmrAnimateTick; PostOnClick = postOnClick; SizeMode = PictureBoxSizeMode.Normal; switch (BorderStyle) { case BorderStyle.None: ImageWidth = Width; ImageHeight = Height; break; case BorderStyle.FixedSingle: ImageWidth = Width - 2; ImageHeight = Height - 2; break; case BorderStyle.Fixed3D: ImageWidth = Width - 4; ImageHeight = Height - 4; break; default: throw new Exception("What?"); } }
public void Init(OpenFileDialog dlgOpen, frmBaseEditor editor, Func <int, Palette> setPalette) { picLayer1.Init(dlgOpen, editor); picLayer1.PostOnClick = () => picLayer1.Palette = setPalette(1); picLayer2.Init(dlgOpen, editor); picLayer2.PostOnClick = () => picLayer2.Palette = setPalette(2); txtTileName.TextChanged += (s, e) => editor.Dirty = true; }
public void Init(frmBaseEditor editor) { EventHandler dirtyFunc = (s, e1) => editor.Dirty = true; pltPalette.Init(editor); appAI.Init(dirtyFunc); txtName.TextChanged += dirtyFunc; rdbPlayerController.CheckedChanged += dirtyFunc; cmbPortraitMode.SelectedIndexChanged += dirtyFunc; }
public void Init(frmBaseEditor editor, List <Palette> baseSpritePalettes, Action <Palette> onPaletteChange = null) { Editor = editor; OnPaletteChange = onPaletteChange; BaseSpritePalettes = baseSpritePalettes; // Fix TrackBar BG color Control tempParent = this; while (tempParent != null && tempParent.BackColor.A < 255) { tempParent = tempParent.Parent; } trkFGPalette.BackColor = tempParent?.BackColor ?? Color.Magenta; }
public void Init(frmBaseEditor baseEditor, Func <T> newT, Func <T, T> dataFromUI, Action <T> dataToUI, string fileName) { BaseEditor = baseEditor; NewT = newT; DataFromUI = dataFromUI; DataToUI = dataToUI; FileName = fileName; // Init ListBox DoubleClick += ListBox_DoubleClick; // Load JSON file if (BaseEditor.WorkingDirectory.CheckFileExist(fileName + ".json")) { Data = BaseEditor.WorkingDirectory.LoadFile(fileName, "", ".json").JsonToObject <List <T> >(); UpdateList(); } else { Data = new List <T>(); } }
public void Init(FilesController dataDirectory, frmBaseEditor editor) { // Load keywords string[] keywordsFile = dataDirectory.LoadFile("Keywords").Replace("\r", "").Split('\n'); for (int i = 0; i < keywordsFile.Length; i++) { string[] keyValue = keywordsFile[i].Split(':'); string[] values = keyValue[1].Split(','); Keywords.Add(ColorTranslator.FromHtml(keyValue[0]), values); } // Set methods TextChanged += EventTextBox_TextChanged; SelectionChanged += EventTextBox_TextChanged; VScroll += EventTextBox_TextChanged; KeyPress += EventTextBox_KeyPress; // Misc Editor = editor; Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); UserInput = true; this.ApplyPreferences(); }
public void Init(OpenFileDialog dlgOpen, frmBaseEditor editor) { picAnimation.Init(dlgOpen, editor); }
public void Init(frmBaseEditor editor, FilesController dataDirectory) { txtRequirement.Init(dataDirectory, editor); txtEvent.Init(dataDirectory, editor); }
public void Init(frmBaseEditor editor, Action <Palette> onPaletteChange = null) { Editor = editor; OnPaletteChange = onPaletteChange; }
public void Init(frmBaseEditor editor) { Editor = editor; }
public void Init(frmBaseEditor editor) { lstReplacedBy.Init(editor, () => "", () => new DataTextBox(), a => a.Init(editor), false); txtUnit.TextChanged += (sender, e) => editor.Dirty = true; }