Example #1
0
        public swtMainWindow()
        {
            box.PackStart(fraMain);
            fraMain.Content = fraMainBox;
            fraMain.Label   = Locale.GetString("swtMainWindow");

            chkShowToolBar.Label   = Locale.GetString("SWTMWtoolbar");
            chkDiskButtons.Label   = Locale.GetString("SWTMWdiskbuttons");
            chkDiskListBox.Label   = Locale.GetString("SWTMWdisklistbox");
            chkPanelTitle.Label    = Locale.GetString("SWTMWpaneltitle");
            chkTableCollumns.Label = Locale.GetString("SWTMWtablecollumns");
            chkInfoBar.Label       = Locale.GetString("SWTMWinfobar");
            chkCmdLine.Label       = Locale.GetString("SWTMWcmdline");
            chkKeybHelp.Label      = Locale.GetString("SWTMWkeybhelp");
            lblBookmarks.Text      = Locale.GetString("SWTMWbookmars");

            chkDiskButtons.State   = CBSfromBool(fcmd.Properties.Settings.Default.ShowDiskList);
            chkPanelTitle.State    = CBSfromBool(fcmd.Properties.Settings.Default.ShowPanelUrlbox);
            chkTableCollumns.State = CBSfromBool(fcmd.Properties.Settings.Default.ShowPanelTableCaptions);
            chkInfoBar.State       = CBSfromBool(fcmd.Properties.Settings.Default.ShowFileInfo);
            chkKeybHelp.State      = CBSfromBool(fcmd.Properties.Settings.Default.ShowKeybrdHelp);
            txtBookmarks.Text      = fcmd.Properties.Settings.Default.BookmarksFile ?? "";

            fraMainBox.PackStart(chkShowToolBar);
            fraMainBox.PackStart(chkDiskButtons);
            fraMainBox.PackStart(chkDiskListBox);
            fraMainBox.PackStart(chkPanelTitle);
            fraMainBox.PackStart(chkTableCollumns);
            fraMainBox.PackStart(chkInfoBar);
            fraMainBox.PackStart(chkCmdLine);
            fraMainBox.PackStart(chkKeybHelp);
            fraMainBox.PackStart(lblBookmarks);
            fraMainBox.PackStart(txtBookmarks);
        }
Example #2
0
        private void UpdateTooltip()
        {
            if (bgImage)
            {
                bgImage.color = bgColor;
            }

            if (text)
            {
                text.color = textColor;
                text.text  = StringUtilities.IncreaseLinesIfNecessary(localizeText ? Localizator.GetString(tooltipString) : tooltipString, maxLineLength);
            }
        }
Example #3
0
        public swtMainWindowInfobar()
        {
            fraInfobar.Label   = Locale.GetString("SWTMWinfobar").Replace("	", "");
            fraInfobar.Content = Layout;
            Layout.PackStart(new Xwt.Label(
                                 Locale.GetString("SWTMWItext1")
                                 ));
            Layout.PackStart(txtText1);
            Layout.PackStart(new Xwt.Label(
                                 Locale.GetString("SWTMWItext2")
                                 ));
            Layout.PackStart(txtText2);
            Layout.PackStart(new Xwt.Label(
                                 Locale.GetString("SWTMWIhelp")
                                 )
            {
                Wrap = Xwt.WrapMode.Word
            }
                             );

            txtText1.Text = fcmd.Properties.Settings.Default.InfoBarContent1;
            txtText2.Text = fcmd.Properties.Settings.Default.InfoBarContent2;
        }
Example #4
0
        public swtViewerEditor()
        {
            //prepare UI
            fraView.Content         = fraViewBox;
            fraView.Label           = Locale.GetString("SWTVEviewer");
            optInternalViewer.Group = ViewerSelection;
            optInternalViewer.Label = Locale.GetString("SWTVEinternalv");
            optExternalViewer.Group = ViewerSelection;
            optExternalViewer.Label = Locale.GetString("SWTVEexternalv");
            cmdVEsetup.Label        = Locale.GetString("SWTVEvesetup");
            cmdVEsetup.Clicked     += (o, ea) => { new VEsettings().Run(); };

            fraViewBox.PackStart(optInternalViewer);
            fraViewBox.PackStart(optExternalViewer);
            fraViewBox.PackStart(txtExternalViewer, true, Xwt.WidgetPlacement.Start, Xwt.WidgetPlacement.Start, 24);

            fraEdit.Content         = fraEditBox;
            fraEdit.Label           = Locale.GetString("SWTVEeditor");
            optInternalEditor.Group = EditorSelection;
            optInternalEditor.Label = Locale.GetString("SWTVEinternaleditor");
            optExternalEditor.Group = EditorSelection;
            optExternalEditor.Label = Locale.GetString("SWTVEexternaleditor");

            txtExternalViewer.Sensitive = false;             //set default value...
            txtExternalEditor.Sensitive = false;             //...later, it will be confirmed

            ViewerSelection.ActiveRadioButtonChanged += (o, ea) => { txtExternalViewer.Sensitive = optExternalViewer.Active; };
            EditorSelection.ActiveRadioButtonChanged += (o, ea) => { txtExternalEditor.Sensitive = optExternalEditor.Active; };


            fraEditBox.PackStart(optInternalEditor);
            fraEditBox.PackStart(optExternalEditor);
            fraEditBox.PackStart(txtExternalEditor, true, Xwt.WidgetPlacement.Start, Xwt.WidgetPlacement.Start, 24);

            box.PackStart(fraView);
            box.PackStart(fraEdit);
            box.PackStart(cmdVEsetup);

            //write settings on UI
            optExternalViewer.Active          = fcmd.Properties.Settings.Default.UseExternalViewer;
            optExternalEditor.Active          = fcmd.Properties.Settings.Default.UseExternalEditor;
            txtExternalEditor.Text            = fcmd.Properties.Settings.Default.ExternalEditor;
            txtExternalViewer.Text            = fcmd.Properties.Settings.Default.ExternalViewer;
            txtExternalEditor.PlaceholderText = "vim $";
            txtExternalViewer.PlaceholderText = "cat $ | less";
        }
Example #5
0
        public swtMainWindowThemes()
        {
            chkUseThemes.Label = Locale.GetString("SWTMWTusethemes");
            if (fcmd.Properties.Settings.Default.UserTheme == null)
            {
                txtThemePath.Text  = "";
                chkUseThemes.State = CheckBoxState.Off;
            }
            else
            {
                txtThemePath.Text  = fcmd.Properties.Settings.Default.UserTheme;
                chkUseThemes.State = CheckBoxState.On;
            }

            txtThemePath.Sensitive = (chkUseThemes.State == CheckBoxState.On ? true : false);

            layout.Add(chkUseThemes, 0, 0);
            layout.Add(txtThemePath, 1, 0);

            chkUseThemes.Toggled += (o, ea) => { txtThemePath.Sensitive = (chkUseThemes.State == CheckBoxState.On ? true : false); };
        }
Example #6
0
        private void Main_Load(object sender, EventArgs e)
        {
            listBoxPrograms.Items.Clear();
            foreach (var program in EnumManager.GetValues <WashProgram>())
            {
                if (program != WashProgram.Nothing)
                {
                    listBoxPrograms.Items.Add(new WashingProgram(
                                                  program,
                                                  localizator.GetString($"Program_{(byte)program}", $"{program}")));
                }
            }

            labelTemperature.Text   = localizator.GetString("Label_Temperature", labelTemperature.Text);
            labelDuration.Text      = localizator.GetString("Label_Duration", labelDuration.Text);
            labelWashingSpeed.Text  = localizator.GetString("Label_WashingSpeed", labelWashingSpeed.Text);
            labelSpinningSpeed.Text = localizator.GetString("Label_SpinningSpeed", labelSpinningSpeed.Text);
            labelRinsingCycles.Text = localizator.GetString("Label_RinsingCycles", labelRinsingCycles.Text);
            labelWaterLevel.Text    = localizator.GetString("Label_WaterLevel", labelWaterLevel.Text);

            Connect();
        }
Example #7
0
        public swtMainWindowColumns()
        {
            box.PackStart(fraExtensions);
            box.PackStart(fraTabs);
            box.PackStart(fraOther);
            fraExtensions.Content = fraExtensionsBox;
            fraExtensions.Label   = Locale.GetString("SWTMWCFileExtView");
            fraTabs.Content       = fraTabsBox;
            fraTabs.Label         = Locale.GetString("SWTMWCCollumns");
            fraOther.Content      = fraOtherBox;

            optDisplayExtTogether.Group = rbgExtensionDisplayStyle;
            optDisplayExtFar.Group      = rbgExtensionDisplayStyle;
            optDisplayExtTogether.Label = Locale.GetString("SWTMWCExtTogether");
            optDisplayExtFar.Label      = Locale.GetString("SWTMWCExtFar");
            fraExtensionsBox.PackStart(optDisplayExtTogether);
            fraExtensionsBox.PackStart(optDisplayExtFar);

            fraTabsBox.Add(new Xwt.Label(Locale.GetString("SWTMWCExt")), 0, 0);
            fraTabsBox.Add(txtTabExtension, 1, 0);

            fraTabsBox.Add(new Xwt.Label(Locale.GetString("SWTMWCSize")), 0, 1);
            fraTabsBox.Add(txtTabSize, 1, 1);

            fraTabsBox.Add(new Xwt.Label(Locale.GetString("SWTMWCDate")), 0, 2);
            fraTabsBox.Add(txtTabDate, 1, 2);

            fraTabsBox.Add(new Xwt.Label(Locale.GetString("SWTMWCFileMode")), 0, 3);
            fraTabsBox.Add(txtTabFilemode, 1, 3);


            chkExpandName.Label       = Locale.GetString("SWTMWCExpandName");
            chkShowCentury.Label      = Locale.GetString("SWTMWCShowCentury");
            chkShowTimeAs12h.Label    = Locale.GetString("SWTMWCShowTimeAs12h");
            chkShowDirsInStatus.Label = Locale.GetString("SWTMWCShowDirsInStatus");

            fraOtherBox.Add(chkExpandName, 0, 0);
            fraOtherBox.Add(chkShowCentury, 0, 1);
            fraOtherBox.Add(chkShowTimeAs12h, 0, 2);
            fraOtherBox.Add(chkShowDirsInStatus, 0, 3);

            cmbPanelSizeDisplay.Items.Add("000", Locale.GetString("SizeDisplayPolicy000"));
            cmbPanelSizeDisplay.Items.Add("100", Locale.GetString("SizeDisplayPolicy100"));
            cmbPanelSizeDisplay.Items.Add("200", Locale.GetString("SizeDisplayPolicy200"));
            cmbPanelSizeDisplay.Items.Add("111", Locale.GetString("SizeDisplayPolicy111"));
            cmbPanelSizeDisplay.Items.Add("222", Locale.GetString("SizeDisplayPolicy222"));
            cmbPanelSizeDisplay.Items.Add("110", Locale.GetString("SizeDisplayPolicy110"));
            cmbPanelSizeDisplay.Items.Add("220", Locale.GetString("SizeDisplayPolicy220"));

            /*
             * SizeDisplayPolicy000=bytes
             * SizeDisplayPolicy100=kbytes
             * SizeDisplayPolicy200=kbytes (x.xx KB)
             * SizeDisplayPolicy111=dynamic (x.x К/М/Г)
             * SizeDisplayPolicy222=dynamic (x.xx К/М/Г)
             * SizeDisplayPolicy110=dynamic (x.x К/М)
             * SizeDisplayPolicy220=dynamic (x.xx K/M)
             */

            fraOtherBox.Add(new Xwt.Label(Locale.GetString("SWTMWCSizeDisplay")), 0, 4);
            fraOtherBox.Add(cmbPanelSizeDisplay, 1, 4);
            fraOtherBox.Add(new Xwt.Label(Locale.GetString("SWTMWCMaxHumanSizeStatus")), 0, 5);
            fraOtherBox.Add(txtMaxHumanySizeInStatus, 1, 5);


            //load settings

            switch (fcmd.Properties.Settings.Default.SizeShorteningPolicy)
            {
            case "000":
                cmbPanelSizeDisplay.SelectedIndex = 0;
                break;

            case "100":
                cmbPanelSizeDisplay.SelectedIndex = 1;
                break;

            case "200":
                cmbPanelSizeDisplay.SelectedIndex = 2;
                break;

            case "111":
                cmbPanelSizeDisplay.SelectedIndex = 3;
                break;

            case "222":
                cmbPanelSizeDisplay.SelectedIndex = 4;
                break;

            case "110":
                cmbPanelSizeDisplay.SelectedIndex = 5;
                break;

            case "220":
                cmbPanelSizeDisplay.SelectedIndex = 6;
                break;
            }
        }
Example #8
0
        private void OnGUI()
        {
            var keySearchBarStyle = new GUIStyle(EditorStyles.textField)
            {
                fixedWidth  = position.width * .99f,
                fixedHeight = 23f,
                alignment   = TextAnchor.MiddleCenter,
                fontSize    = 12
            };

            key = GUILayout.TextField(key, keySearchBarStyle);
            key = Localizator.ConvertRawToKey(key);

            GUILayout.Space(10f);
            Localizator.UpdateKeyFile();

            if (key != keyLastValue || values.Length != Localizator.GetLanguageCount())
            {
                values = new string[Localizator.GetLanguageCount()];
            }

            if (Localizator.DoesContainKey(key))
            {
                scrollPos = GUILayout.BeginScrollView(scrollPos, false, true);
                for (var i = 0; i < values.Length; i++)
                {
                    if (values[i] == null)
                    {
                        values[i] = Localizator.GetString(key, Localizator.GetAvailableLanguages()[i], false);
                    }
                    GUILayout.BeginHorizontal();

                    var isSameAsTheSavedValue = values[i] == Localizator.GetString(key, Localizator.GetAvailableLanguages()[i], false);
                    GUI.color = isSameAsTheSavedValue ? Color.green : Color.red;
                    EditorGUILayout.LabelField($"{Localizator.GetAvailableLanguages()[i]}: ",
                                               GUILayout.MaxWidth(50));
                    GUI.color = Color.white;

                    var customTextAreaStyle = EditorStyles.textArea;
                    customTextAreaStyle.wordWrap      = true;
                    customTextAreaStyle.fixedHeight   = 0;
                    customTextAreaStyle.stretchHeight = true;

                    values[i] = EditorGUILayout.TextArea(
                        values[i], customTextAreaStyle);

                    GUILayout.EndHorizontal();
                }

                GUILayout.EndScrollView();

                if (GUILayout.Button("Update Values"))
                {
                    for (var i = 0; i < values.Length; i++)
                    {
                        Localizator.AddLocalizedValue(key, values[i], Localizator.GetAvailableLanguages()[i]);
                    }

                    Localizator.RefreshAll();
                    RefreshKeyBrowser();
                }

                if (GUILayout.Button("Remove Key"))
                {
                    var dialogOutput = EditorUtility.DisplayDialog(
                        $"{key} will be removed permanently",
                        "Are you sure you want to remove this key?",
                        "Remove",
                        "Cancel");
                    if (dialogOutput)
                    {
                        Localizator.RemoveKey(key);
                        Localizator.RefreshAll();

                        RefreshKeyBrowser();
                    }
                }

                // Renaming
                EditorScriptingUtils.BeginCenter();

                var canRename = !Localizator.DoesContainKey(newName.Trim()) &&
                                !string.IsNullOrWhiteSpace(newName.Trim());
                if (GUILayout.Button("Rename Key", GUILayout.Width(this.position.width * .5f)))
                {
                    if (canRename)
                    {
                        Localizator.AddKey(newName.Trim());
                        foreach (var language in Localizator.GetAvailableLanguages())
                        {
                            Localizator.AddLocalizedValue(newName.Trim(), Localizator.GetString(key, language, returnErrorString: false), language);
                        }

                        Localizator.RemoveKey(key);

                        key     = newName.Trim();
                        newName = "";
                        RefreshKeyBrowser();
                    }
                }

                newName = Localizator.ConvertRawToKey(GUILayout.TextField(newName, GUILayout.Width(this.position.width * .5f)));
                EditorScriptingUtils.EndCenter();
                if (Localizator.DoesContainKey(newName.Trim()))
                {
                    EditorGUILayout.HelpBox("The key name entered is already in use.",
                                            MessageType.Warning);
                }
            }
            else if (GUILayout.Button("Add New Key") && !string.IsNullOrEmpty(key) && !string.IsNullOrWhiteSpace(key))
            {
                Localizator.AddKey(key);
                RefreshKeyBrowser();
            }

            keyLastValue = key;
        }
Example #9
0
 public void UpdateText()
 {
     versionText.text = Localizator.GetString(prefixKey, returnErrorString: false) + " " + Application.version;
 }