public void Show(IModuleEditor editor) { EditorGUI.FocusTextInControl(""); if (editor.Initialize()) { current_editor = editor; save_CurrentEditor.String = editor.GetType().FullName; OhMyFrameworkPanelTabAttribute attribute = (OhMyFrameworkPanelTabAttribute)editor.GetType().GetCustomAttributes(true).FirstOrDefault(x => x is OhMyFrameworkPanelTabAttribute); editorAttribute = attribute; editorRender = editor.OnGUI; } }
public static void Show(IList <IModuleEditor> editors, string helpTopic) { if (editors == null) { return; } IMenu menu = Far.Api.CreateMenu(); menu.AutoAssignHotkeys = true; menu.HelpTopic = helpTopic; menu.Title = Res.ModuleEditors; foreach (IModuleEditor it in editors) { menu.Add(Utility.FormatConfigMenu(it)).Data = it; } while (menu.Show()) { FarItem mi = menu.Items[menu.Selected]; IModuleEditor editor = (IModuleEditor)mi.Data; IInputBox ib = Far.Api.CreateInputBox(); ib.EmptyEnabled = true; ib.HelpTopic = helpTopic; ib.History = "Masks"; ib.Prompt = "Mask"; ib.Text = editor.Mask; ib.Title = editor.Name; if (!ib.Show()) { continue; } var mask = ConfigTool.ValidateMask(ib.Text); if (mask == null) { continue; } // set editor.Mask = mask; editor.Manager.SaveSettings(); } }
void OnGUI() { Styles.Update(); if (!style_IsInitialized) { InitializeStyles(); } if (BPLogo == null) { BPLogo = EditorIcons.GetIcon("BPLogo"); } // GUI.DrawTexture(EditorGUILayout.GetControlRect(GUILayout.Width(BPLogo.width), GUILayout.Height(BPLogo.height)), BPLogo); EditorGUILayout.Space(); if (editorRender == null || current_editor == null) { editorRender = null; current_editor = null; } defalutColor = GUI.backgroundColor; using (new GUIHelper.Horizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { using (new GUIHelper.Vertical(Styles.berryArea, GUILayout.Width(256), GUILayout.ExpandHeight(true))) { tabsScroll = EditorGUILayout.BeginScrollView(tabsScroll); DrawTabs(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); Rect editorRect = EditorGUILayout.BeginVertical(Styles.berryArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); editorScroll = EditorGUILayout.BeginScrollView(editorScroll); if (current_editor != null && editorRender != null) { if (editorAttribute != null) { DrawTitle(editorAttribute.Title); } if (EditorApplication.isCompiling) { GUILayout.Label("Compiling...", Styles.centeredMiniLabel, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); } else { if (Event.current.type == EventType.Repaint) { currectEditorRect = editorRect; } editorRender.Invoke(); } } else { GUILayout.Label("Nothing selected", Styles.centeredMiniLabel, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); } EditorGUILayout.EndScrollView(); } } GUILayout.Label(string.Format("Simple Rules Tools Panel\n@Copyright 2015 - {0} by Droidman", DateTime.Now.Year), Styles.centeredMiniLabel, GUILayout.ExpandWidth(true)); }
public abstract void RegisterProxyEditor(IModuleEditor info);