Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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;
        }