Exemple #1
0
        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;
        }
Exemple #2
0
        public NewValueDialog(string title)
        {
            Dialog = Far.Api.CreateDialog(-1, -1, 77, 9);
            Dialog.AddBox(3, 1, 0, 0, title);
            int x = 11;

            // use last history, it is useful
            Dialog.AddText(5, -1, 0, "&Name");
            Name                = Dialog.AddEdit(x, 0, 71, string.Empty);
            Name.History        = "PowerPanelNames";
            Name.UseLastHistory = true;

            // do not use last history!
            Dialog.AddText(5, -1, 0, "&Type");
            Type         = Dialog.AddEdit(x, 0, 71, string.Empty);
            Type.History = "PowerPanelTypes";

            // do not use last history!
            Dialog.AddText(5, -1, 0, "&Value");
            Value         = Dialog.AddEdit(x, 0, 71, string.Empty);
            Value.History = "PowerPanelValues";

            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, Res.Cancel);

            buttonCancel.CenterGroup = true;
        }
Exemple #3
0
        public NewValueDialog(string title)
        {
            Dialog = Far.Api.CreateDialog(-1, -1, 77, 9);
            Dialog.AddBox(3, 1, 0, 0, title);
            int x = 11;

            // use last history, it is useful
            Dialog.AddText(5, -1, 0, "&Name");
            Name = Dialog.AddEdit(x, 0, 71, string.Empty);
            Name.History = "PowerPanelNames";
            Name.UseLastHistory = true;

            // do not use last history!
            Dialog.AddText(5, -1, 0, "&Type");
            Type = Dialog.AddEdit(x, 0, 71, string.Empty);
            Type.History = "PowerPanelTypes";

            // do not use last history!
            Dialog.AddText(5, -1, 0, "&Value");
            Value = Dialog.AddEdit(x, 0, 71, string.Empty);
            Value.History = "PowerPanelValues";

            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, Res.Cancel);
            buttonCancel.CenterGroup = true;
        }
Exemple #4
0
 public Doc Apply(IEdit edit)
 {
     Items = edit.Apply(Items);
     Edits = Edits.Push(edit);
     Redos = EmptyEditStack;
     return(this);
 }
Exemple #5
0
 public CursorAndIME(IEdit controls)
 {
     this.CousorPointForEdit = new Point();
     this.CousorPointForWord = new Point();
     this.pIEdit             = controls;
     this.HIMEContext        = ImmGetContext(this.pIEdit.GetHandle);
 }
Exemple #6
0
 public AuthService(IRegister register, ILogin login, IEdit edit, IIncrement increment, IRefreshProfile refresh)
 {
     _register  = register;
     _login     = login;
     _edit      = edit;
     _increment = increment;
     _refresh   = refresh;
 }
Exemple #7
0
        void DeleteCurrentLine()
        {
            IEdit atb = fm.CurrentControl as IEdit;

            if (atb != null && ((Control)atb).Focused)
            {
                atb.DeleteCurrentLine();
            }
        }
Exemple #8
0
        void SelectAll()
        {
            IEdit atb = fm.CurrentControl as IEdit;

            if (atb != null && ((Control)atb).Focused)
            {
                atb.SelectAll();
            }
        }
Exemple #9
0
        public static void InvokeSelectedCode()
        {
            string     code;
            bool       toCleanCmdLine = false;
            WindowKind wt             = Far.Api.Window.Kind;

            if (wt == WindowKind.Editor)
            {
                var editor = Far.Api.Editor;
                code = editor.GetSelectedText();
                if (string.IsNullOrEmpty(code))
                {
                    code = editor[editor.Caret.Y].Text;
                }
            }
            else if (wt == WindowKind.Dialog)
            {
                IDialog dialog = Far.Api.Dialog;
                IEdit   edit   = dialog.Focused as IEdit;
                if (edit == null)
                {
                    Far.Api.Message("The current control must be an edit box.", Res.Me);
                    return;
                }
                code = edit.Line.SelectedText;
                if (string.IsNullOrEmpty(code))
                {
                    code = edit.Text;
                }
            }
            else
            {
                ILine cl = Far.Api.CommandLine;
                code = cl.SelectedText;
                if (string.IsNullOrEmpty(code))
                {
                    code           = cl.Text;
                    toCleanCmdLine = true;
                }

                string prefix;
                Entry.SplitCommandWithPrefix(ref code, out prefix);
            }
            if (code.Length == 0)
            {
                return;
            }

            // go
            bool ok = A.Psf.Act(code, null, wt != WindowKind.Editor);

            // clean the command line if ok
            if (ok && toCleanCmdLine && wt != WindowKind.Editor)
            {
                Far.Api.CommandLine.Text = string.Empty;
            }
        }
Exemple #10
0
        void Paste()
        {
            IEdit atb = fm.CurrentControl as IEdit;

            if (atb != null && ((Control)atb).Focused)
            {
                atb.Paste();
            }
        }
Exemple #11
0
        ExportDialog(string title, string filePath, bool useDepth)
        {
            int h = 8;

            if (useDepth)
            {
                ++h;
            }

            _Dialog = Far.Api.CreateDialog(-1, -1, 77, h);
            _Dialog.AddBox(3, 1, 0, 0, title);
            const int x = 16;
            int       y = 1;

            _Dialog.AddText(5, ++y, 0, "&File name");
            _File                = _Dialog.AddEdit(x, y, 71, string.Empty);
            _File.History        = "NewEdit";
            _File.IsPath         = true;
            _File.UseLastHistory = true;
            if (filePath != null)
            {
                _File.Text = filePath;
            }

            _Dialog.AddText(5, ++y, 0, "&Encoding");
            _Encoding = _Dialog.AddComboBox(x, y, 71, string.Empty);
            _Encoding.DropDownList = true;
            _Encoding.Text         = "Unicode";
            _Encoding.Add("Default");
            _Encoding.Add("Unicode");
            _Encoding.Add("UTF8");
            _Encoding.Add("BigEndianUnicode");
            _Encoding.Add("ASCII");
            _Encoding.Add("UTF7");
            _Encoding.Add("UTF32");
            _Encoding.Add("OEM");

            if (useDepth)
            {
                _Dialog.AddText(5, ++y, 0, "&Depth");
                _Depth = _Dialog.AddEdit(x, y, 71, string.Empty);
            }

            _Dialog.AddText(5, ++y, 0, string.Empty).Separator = 1;

            IButton buttonOK = _Dialog.AddButton(0, ++y, "Ok");

            buttonOK.CenterGroup = true;
            _Dialog.Default      = buttonOK;

            IButton buttonCancel = _Dialog.AddButton(0, y, Res.Cancel);

            buttonCancel.CenterGroup = true;
            _Dialog.Cancel           = buttonCancel;
        }
Exemple #12
0
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        public new void Add(IEdit <T> item)
        {
            base.Add(item);

            foreach (string source in item.Sources)
            {
                _sources.Add(source);
            }

            _log.Debug(m => m("Edit_t {0} added to EditEvaluatingCollection", item.ToString()));
        }
Exemple #13
0
        public EditViewModel(IEdit <Control_t> underlyingEdit)
        {
            _underlyingEdit = underlyingEdit;

            if (underlyingEdit.Edits.Count > 0)
            {
                _edits = new ViewModelEditCollection(underlyingEdit.Edits);

                _edits.StateChanged += new EventHandler <StateChangedEventArgs>(OnEditsStateChanged);
            }
        }
        ExportDialog(string title, string filePath, bool useDepth)
        {
            int h = 8;
            if (useDepth)
                ++h;

            _Dialog = Far.Api.CreateDialog(-1, -1, 77, h);
            _Dialog.AddBox(3, 1, 0, 0, title);
            const int x = 16;
            int y = 1;

            _Dialog.AddText(5, ++y, 0, "&File name");
            _File = _Dialog.AddEdit(x, y, 71, string.Empty);
            _File.History = "NewEdit";
            _File.IsPath = true;
            _File.UseLastHistory = true;
            if (filePath != null)
                _File.Text = filePath;

            _Dialog.AddText(5, ++y, 0, "&Encoding");
            _Encoding = _Dialog.AddComboBox(x, y, 71, string.Empty);
            _Encoding.DropDownList = true;
            _Encoding.Text = "Unicode";
            _Encoding.Add("Default");
            _Encoding.Add("Unicode");
            _Encoding.Add("UTF8");
            _Encoding.Add("BigEndianUnicode");
            _Encoding.Add("ASCII");
            _Encoding.Add("UTF7");
            _Encoding.Add("UTF32");
            _Encoding.Add("OEM");

            if (useDepth)
            {
                _Dialog.AddText(5, ++y, 0, "&Depth");
                _Depth = _Dialog.AddEdit(x, y, 71, string.Empty);
            }

            _Dialog.AddText(5, ++y, 0, string.Empty).Separator = 1;

            IButton buttonOK = _Dialog.AddButton(0, ++y, "Ok");
            buttonOK.CenterGroup = true;
            _Dialog.Default = buttonOK;

            IButton buttonCancel = _Dialog.AddButton(0, y, Res.Cancel);
            buttonCancel.CenterGroup = true;
            _Dialog.Cancel = buttonCancel;
        }
Exemple #15
0
        public UIWordDialog(string stem1, string stem2)
        {
            const int h = 6;
            const int x = 20;

            _Dialog = Far.Api.CreateDialog(-1, -1, 77, h);
            _Dialog.AddBox(3, 1, 0, 0, My.AddToDictionary);
            int y = 1;

            _Dialog.AddText(5, ++y, 0, My.NewWord);
            _Stem1 = _Dialog.AddEdit(x, y, 71, stem1);

            _Dialog.AddText(5, ++y, 0, My.ExampleStem);
            _Stem2 = _Dialog.AddEdit(x, y, 71, stem2);
            _Stem2.History = "RightWordsStem";
        }
Exemple #16
0
        public UIWordDialog(string stem1, string stem2)
        {
            const int h = 6;
            const int x = 20;

            _Dialog = Far.Api.CreateDialog(-1, -1, 77, h);
            _Dialog.AddBox(3, 1, 0, 0, My.AddToDictionary);
            int y = 1;

            _Dialog.AddText(5, ++y, 0, My.NewWord);
            _Stem1 = _Dialog.AddEdit(x, y, 71, stem1);

            _Dialog.AddText(5, ++y, 0, My.ExampleStem);
            _Stem2         = _Dialog.AddEdit(x, y, 71, stem2);
            _Stem2.History = "RightWordsStem";
        }
Exemple #17
0
        void Copy()
        {
            IEdit atb = fm.CurrentControl as IEdit;

            if (atb != null && ((Control)atb).Focused)
            {
                try
                {
                    atb.Copy();
                }
                catch (System.Runtime.InteropServices.ExternalException)
                {
                    // something is breaking the clipboard
                    Trace.WriteLine("Could not copy to clipboard, is VNC open? This is a known error.");
                }
            }
        }
Exemple #18
0
        void Create()
        {
            if (Prompt == null)
            {
                Prompt = new string[] { }
            }
            ;

            int w = Far.Api.UI.WindowSize.X - 7;
            int h = 5 + Prompt.Count;

            uiDialog        = Far.Api.CreateDialog(-1, -1, w, h);
            uiDialog.TypeId = TypeId;
            uiDialog.AddBox(3, 1, w - 4, h - 2, Title);

            var uiPrompt = new List <IText>(Prompt.Count);

            foreach (var s in Prompt)
            {
                uiPrompt.Add(uiDialog.AddText(5, -1, w - 6, s));
            }

            uiEdit                = uiDialog.AddEdit(5, -1, w - 6, string.Empty);
            uiEdit.IsPath         = true;
            uiEdit.Text           = Text ?? string.Empty;
            uiEdit.History        = History;
            uiEdit.UseLastHistory = UseLastHistory;

            // hotkeys
            uiEdit.KeyPressed += (sender, e) =>
            {
                switch (e.Key.VirtualKeyCode)
                {
                case KeyCode.Tab:
                    e.Ignore = true;
                    EditorKit.ExpandCode(uiEdit.Line, null);
                    break;

                case KeyCode.F1:
                    e.Ignore = true;
                    Help.ShowHelpForContext(HelpTopic.InvokeCommandsDialog);
                    break;
                }
            };
        }
Exemple #19
0
        public bool Show()
        {
            string prompt = Prompt ?? "";
            var size = Far.Api.UI.WindowSize;

            _Dialog = Far.Api.CreateDialog(0, size.Y - 2, size.X - 1, size.Y - 1);
            _Dialog.TypeId = TypeId;
            _Dialog.NoShadow = true;
            _Dialog.KeepWindowTitle = true;

            if (Password)
            {
                _Edit = _Dialog.AddEditPassword(prompt.Length, 0, size.X - 1, string.Empty);
            }
            else
            {
                int right = string.IsNullOrEmpty(History) ? size.X - 1 : size.X - 2;
                _Edit = _Dialog.AddEdit(prompt.Length, 0, right, string.Empty);
                _Edit.History = History;
            }
            _Edit.Coloring += Coloring.ColorEditAsConsole;

            if (prompt.Length > 0)
            {
                var uiText = _Dialog.AddText(0, 0, prompt.Length - 1, prompt);
                uiText.Coloring += Coloring.ColorTextAsConsole;
            }

            var uiArea = _Dialog.AddText(0, 1, size.X - 1, string.Empty);
            uiArea.Coloring += Coloring.ColorTextAsConsole;

            // hotkeys
            _Edit.KeyPressed += OnKey;

            // ignore clicks outside
            _Dialog.MouseClicked += (sender, e) =>
            {
                if (e.Control == null)
                    e.Ignore = true;
            };

            return _Dialog.Show();
        }
Exemple #20
0
        public O3D3xx()
            : base()
        {
            CameraIP        = "192.168.1.172";
            XMLRPCPort      = 80;
            ImageOutputPort = 50010;
            session         = XmlRpcProxyGen.Create <ISession>();
            device          = XmlRpcProxyGen.Create <IDevice>();
            appImager       = XmlRpcProxyGen.Create <IAppImager>();
            app             = XmlRpcProxyGen.Create <IApp>();
            edit            = XmlRpcProxyGen.Create <IEdit>();
            editeDevice     = XmlRpcProxyGen.Create <IEditDevice>();
            server          = XmlRpcProxyGen.Create <IServer>();

            updateWorker = new BackgroundWorker();
            updateWorker.WorkerSupportsCancellation = true;
            updateWorker.DoWork             += UpdateWorker_DoWork;
            updateWorker.RunWorkerCompleted += UpdateWorker_RunWorkerCompleted;
        }
Exemple #21
0
        public ConnectionDialog(string title)
        {
            _Dialog = Far.Api.CreateDialog(-1, -1, 77, 8);
            _Dialog.AddBox(3, 1, 0, 0, title);

            _Dialog.AddText(5, -1, 0, "&Computer");
            _ComputerName = _Dialog.AddEdit(x, 0, 71, string.Empty);
            _ComputerName.History = "ComputerName";
            _ComputerName.UseLastHistory = true;

            _Dialog.AddText(5, -1, 0, "&User name");
            _UserName = _Dialog.AddEdit(x, 0, 71, string.Empty);
            _UserName.History = "UserName";
            _UserName.UseLastHistory = true;

            _Dialog.AddText(5, -1, 0, string.Empty).Separator = 1;
            IButton buttonOK = _Dialog.AddButton(0, -1, "Ok");
            buttonOK.CenterGroup = true;
            _Dialog.Default = buttonOK;
            _Dialog.Cancel = _Dialog.AddButton(0, 0, Res.Cancel);
            _Dialog.Cancel.CenterGroup = true;
        }
Exemple #22
0
        public ConnectionDialog(string title)
        {
            _Dialog = Far.Api.CreateDialog(-1, -1, 77, 8);
            _Dialog.AddBox(3, 1, 0, 0, title);

            _Dialog.AddText(5, -1, 0, "&Computer");
            _ComputerName                = _Dialog.AddEdit(x, 0, 71, string.Empty);
            _ComputerName.History        = "ComputerName";
            _ComputerName.UseLastHistory = true;

            _Dialog.AddText(5, -1, 0, "&User name");
            _UserName                = _Dialog.AddEdit(x, 0, 71, string.Empty);
            _UserName.History        = "UserName";
            _UserName.UseLastHistory = true;

            _Dialog.AddText(5, -1, 0, string.Empty).Separator = 1;
            IButton buttonOK = _Dialog.AddButton(0, -1, "Ok");

            buttonOK.CenterGroup       = true;
            _Dialog.Default            = buttonOK;
            _Dialog.Cancel             = _Dialog.AddButton(0, 0, Res.Cancel);
            _Dialog.Cancel.CenterGroup = true;
        }
Exemple #23
0
        public BreakpointDialog(int type, string script, int line)
        {
            Type = type;
            string typeName = type == 0 ? "Line" : type == 1 ? "Command" : "Variable";

            int h = 9;
            if (Type == 2)
                ++h;

            UIDialog = Far.Api.CreateDialog(-1, -1, 77, h);
            UIDialog.Closing += OnClosing;
            UIDialog.HelpTopic = Far.Api.GetHelpTopic("BreakpointDialog");

            // title
            UIDialog.AddBox(3, 1, 0, 0, typeName + " breakpoint");
            const int x = 14;
            int y = 1;

            UIDialog.AddText(5, ++y, 0, "&" + typeName);
            UIMatter = UIDialog.AddEdit(x, y, 71, string.Empty);
            switch (type)
            {
                case 0:
                    if (line > 0)
                        UIMatter.Text = Kit.ToString(line);
                    break;
                case 1:
                    UIMatter.History = Res.HistoryCommand;
                    UIMatter.UseLastHistory = true;
                    break;
                case 2:
                    UIMatter.History = Res.HistoryVariable;
                    UIMatter.UseLastHistory = true;
                    break;
            }

            if (Type == 2)
            {
                UIDialog.AddText(5, ++y, 0, "&Mode");
                UIMode = UIDialog.AddComboBox(x, y, 71, variableAccessMode.ToString());
                UIMode.DropDownList = true;
                UIMode.Add(VariableAccessMode.Read.ToString());
                UIMode.Add(VariableAccessMode.Write.ToString());
                UIMode.Add(VariableAccessMode.ReadWrite.ToString());
            }

            UIDialog.AddText(5, ++y, 0, "&Script");
            UIScript = UIDialog.AddEdit(x, y, 71, string.Empty);
            UIScript.History = Res.HistoryScript;
            UIScript.IsPath = true;
            if (script != null)
                UIScript.Text = script;

            UIDialog.AddText(5, ++y, 0, "&Action");
            UIAction = UIDialog.AddEdit(x, y, 71, string.Empty);
            UIAction.History = Res.HistoryAction;

            UIDialog.AddText(5, ++y, 0, string.Empty).Separator = 1;

            IButton buttonOK = UIDialog.AddButton(0, ++y, "Ok");
            buttonOK.CenterGroup = true;

            IButton buttonCancel = UIDialog.AddButton(0, y, Res.Cancel);
            buttonCancel.CenterGroup = true;
        }
Exemple #24
0
 //private LineNode pRoot;
 //public LineNode PRootNode;
 //private bool IsStart = true;
 /// <summary>
 ///
 /// </summary>
 /// <param name="parser"></param>
 public CharFontStyle(IEdit iedit /*, LineColsProperty lcPro*/)
 {
     this.pIEdit = iedit;
     //this.PLCProperty = lcPro;
     //this.pSetWordWidth = new SetWordWidth(this.SetWordWidthEvent);
 }
Exemple #25
0
        public BreakpointDialog(int type, string script, int line)
        {
            Type = type;
            string typeName = type == 0 ? "Line" : type == 1 ? "Command" : "Variable";

            int h = 9;

            if (Type == 2)
            {
                ++h;
            }

            UIDialog           = Far.Api.CreateDialog(-1, -1, 77, h);
            UIDialog.Closing  += OnClosing;
            UIDialog.HelpTopic = Far.Api.GetHelpTopic("BreakpointDialog");

            // title
            UIDialog.AddBox(3, 1, 0, 0, typeName + " breakpoint");
            const int x = 14;
            int       y = 1;

            UIDialog.AddText(5, ++y, 0, "&" + typeName);
            UIMatter = UIDialog.AddEdit(x, y, 71, string.Empty);
            switch (type)
            {
            case 0:
                if (line > 0)
                {
                    UIMatter.Text = Kit.ToString(line);
                }
                break;

            case 1:
                UIMatter.History        = Res.HistoryCommand;
                UIMatter.UseLastHistory = true;
                break;

            case 2:
                UIMatter.History        = Res.HistoryVariable;
                UIMatter.UseLastHistory = true;
                break;
            }

            if (Type == 2)
            {
                UIDialog.AddText(5, ++y, 0, "&Mode");
                UIMode = UIDialog.AddComboBox(x, y, 71, variableAccessMode.ToString());
                UIMode.DropDownList = true;
                UIMode.Add(VariableAccessMode.Read.ToString());
                UIMode.Add(VariableAccessMode.Write.ToString());
                UIMode.Add(VariableAccessMode.ReadWrite.ToString());
            }

            UIDialog.AddText(5, ++y, 0, "&Script");
            UIScript         = UIDialog.AddEdit(x, y, 71, string.Empty);
            UIScript.History = Res.HistoryScript;
            UIScript.IsPath  = true;
            if (script != null)
            {
                UIScript.Text = script;
            }

            UIDialog.AddText(5, ++y, 0, "&Action");
            UIAction         = UIDialog.AddEdit(x, y, 71, string.Empty);
            UIAction.History = Res.HistoryAction;

            UIDialog.AddText(5, ++y, 0, string.Empty).Separator = 1;

            IButton buttonOK = UIDialog.AddButton(0, ++y, "Ok");

            buttonOK.CenterGroup = true;

            IButton buttonCancel = UIDialog.AddButton(0, y, Res.Cancel);

            buttonCancel.CenterGroup = true;
        }
Exemple #26
0
 public ApiController(IEdit edit)
 {
     _edit = edit;
 }
Exemple #27
0
        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 EditingItemCommand(IEdit vm)
 {
     this.vm = vm;
 }