public Custom(frmMain Main, Graphics g, TabControl TabControlMain, TabControl TabControlProperties) { this.Main = Main; this.g = g; this.TabControlMain = TabControlMain; this.TabControlProperties = TabControlProperties; }
public void ProcessFields(frmMain Main, TabControl MainTabControl, Dictionary<string, List<TabPage>> CustomTabPages, Dictionary<string, List<CustomUIObject>> Objects, Graphics g) { foreach (KeyValuePair<string, List<CustomUIObject>> kvp in Objects) { // This is the TabPage where these objects go to TabPage Page = GetCustomTabPage(Main, MainTabControl, CustomTabPages, kvp.Key); if (Page == null) continue; InitEnvironment(); foreach (CustomUIObject CObj in kvp.Value) { int PosX = GetObjectValue(CObj.PosX, CommonPosX); int PosY = GetObjectValue(CObj.PosY, CommonPosY); Point Position = new Point(PosX, PosY); if (CObj is LabelObject) { Page.Controls.Add(CreateLabelControl((LabelObject)CObj, Position)); } else if (CObj is FieldObject) { FieldObject FObj = (FieldObject)CObj; if (FObj.DataType == "bool") Page.Controls.Add(CreateCheckBoxControl((FieldObject)CObj, Position)); else { // Label-->[Space]-->NumericControl Page.Controls.Add(CreateLabelControl(CObj.Text, new Point(PosX, PosY), 0)); int Space = GetObjectValue(FObj.Space, CommonSpace); Page.Controls.Add(CreateNumericControl(FObj, new Point(PosX + Space, PosY - 2))); } } else if (CObj is CommonObject) { CommonObject IObj = (CommonObject)CObj; IfNonZeroSet(IObj.Space, ref CommonSpace.Value); IfNonZeroSet(IObj.IncX, ref IncX); IfNonZeroSet(IObj.IncY, ref IncY); IfNonZeroSet(IObj.Min, ref CommonMin.Value); IfNonZeroSet(IObj.Max, ref CommonMax.Value); IfNonZeroSet(IObj.Width, ref CommonWidth.Value); IfNonZeroSet(IObj.PosX, ref CommonPosX); IfNonZeroSet(IObj.PosY, ref CommonPosY); IfNonZeroSet(IObj.ItemTab, ref CommonItemTab); } if (!(CObj is CommonObject)) { CommonPosX += IncX; CommonPosY += IncY; } } } }
private void frmMain_Load(object sender, EventArgs e) { this.Text = "FOnline Object Editor " + Utils.GetVersion(); MainObj = this; System.Windows.Forms.ToolTip ToolTip = new System.Windows.Forms.ToolTip(); ToolTip.SetToolTip(this.txtSearch, "Enter text to search for in any visible column (name, pid, script function etc.). Case insensitive."); this.Size = new Size(Config.WindowSizeX, Config.WindowSizeY); this.Location = new Point(Config.WindowLocationX, Config.WindowLocationY); if (!Data.LoadDefines(Config)) Exit(); OptionsForm = new frmOptions(Config); Utils.SerializeObjectListView("." + Path.DirectorySeparatorChar + "listview.bin", ref lstProtos, true); InitGuiDefines(); SetListViewFormatters(); Translate.WriteTemplateLanguageFile(this); Data.Init(); InitData(); SetTabPages(); ItemProtoParser ProtoParser = new ItemProtoParser(); if (Config.ScriptingEnabled) { Utils.Log("Starting script thread..."); ScriptThread = new Thread(new ThreadStart(UpdateScripts_Tick)); ScriptThread.Start(); } Utils.Log("Initializing successful."); }
private TabPage GetCustomTabPage(frmMain Main, TabControl MainTabControl, Dictionary<string, List<TabPage>> CustomTabPages, String TabPageName) { TabPage Page = null; Page = GetTabPageFromTabControl(MainTabControl, TabPageName); if (Page == null) Page = GetSubTabPageByName(Main.HardcodedTabs.Values, TabPageName); if (Page == null) { foreach (List<TabPage> Pages in CustomTabPages.Values) { Page = GetTabPageByName(Pages, TabPageName); if (Page != null) break; } } return Page; }