public ConfigDrawerDialog(IModuleDrawer drawer, string helpTopic) { Dialog = Far.Api.CreateDialog(-1, -1, 77, 8); Dialog.HelpTopic = helpTopic; // Box Dialog.AddBox(3, 1, 0, 0, drawer.Name); int x = 14; // Mask Dialog.AddText(5, -1, 0, "&Mask"); Mask = Dialog.AddEdit(x, 0, 71, drawer.Mask); // Priority Dialog.AddText(5, -1, 0, "&Priority"); Priority = Dialog.AddEdit(x, 0, 71, string.Format(null, "{0}", drawer.Priority)); Dialog.AddText(5, -1, 0, string.Empty).Separator = 1; IButton buttonOK = Dialog.AddButton(0, -1, "Ok"); buttonOK.CenterGroup = true; IButton buttonCancel = Dialog.AddButton(0, 0, "Cancel"); buttonCancel.CenterGroup = true; }
public static void Show(IList <IModuleDrawer> drawers, string helpTopic) { if (drawers == null) { return; } IMenu menu = Far.Api.CreateMenu(); menu.AutoAssignHotkeys = true; menu.HelpTopic = helpTopic; menu.Title = Res.ModuleDrawers; foreach (IModuleDrawer it in drawers) { menu.Add(Utility.FormatConfigMenu(it)).Data = it; } while (menu.Show()) { FarItem mi = menu.Items[menu.Selected]; IModuleDrawer drawer = (IModuleDrawer)mi.Data; var dialog = new ConfigDrawerDialog(drawer, helpTopic); while (dialog.Dialog.Show()) { var mask = ConfigTool.ValidateMask(dialog.Mask.Text); if (mask == null) { continue; } int priority; string priorityText = dialog.Priority.Text.Trim(); if (!int.TryParse(priorityText, out priority)) { Far.Api.Message("Invalid Priority."); continue; } // set drawer.Mask = mask; drawer.Priority = priority; drawer.Manager.SaveSettings(); break; } } }
public abstract void RegisterProxyDrawer(IModuleDrawer info);
/// <summary> /// Adds the drawer to this editor. /// </summary> /// <param name="drawer">The drawer.</param> public abstract void AddDrawer(IModuleDrawer drawer);