Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormDialogScriptLoad"/> class.
        /// </summary>
        public FormDialogScriptLoad()
        {
            // Add this form to be positioned..
            PositionForms.Add(this);

            // add positioning..
            PositionCore.Bind(ApplicationType.WinForms);

            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            // get the code snippets in the database..
            codeSnippets = ScriptNotepadDbContext.DbContext.CodeSnippets.ToArray();

            // localize the script type default names..
            defaultNameScriptTemplateText =
                DBLangEngine.GetMessage("msgDefaultScriptSnippetText", "A text script snippet|As in a script for manipulating Scintilla contents as text");

            defaultNameScriptTemplateLines =
                DBLangEngine.GetMessage("msgDefaultScriptSnippetLines", "A line script snippet|As in a script for manipulating Scintilla contents as lines");

            // localize the currently supported script types..
            cmbScriptType.Items.Clear();
            cmbScriptType.Items.Add(
                DBLangEngine.GetMessage("msgScriptTypeText", "Script text|As in the C# script type should be handling the Scintilla's contents as text")
                );

            cmbScriptType.Items.Add(
                DBLangEngine.GetMessage("msgScriptTypeLines", "Script lines|As in the C# script type should be handling the Scintilla's contents as lines")
                );

            cmbScriptType.SelectedIndex = 0;

            cmbScriptType.SelectedItem =
                DBLangEngine.GetMessage("msgScriptTypeText", "Script text|As in the C# script type should be handling the Scintilla's contents as text");

            // set the OK button's state based on the value if any script is selected from the script list box..
            btOK.Enabled = lbScriptList.SelectedIndex != -1;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSearchResultTree"/> class.
        /// </summary>
        public FormSearchResultTree()
        {
            // Add this form to be positioned..
            PositionForms.Add(this);

            // add positioning..
            PositionCore.Bind(ApplicationType.WinForms);

            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            ttMain.SetToolTip(pnPreviousResult,
                              DBLangEngine.GetMessage("msgPreviousResult",
                                                      "Previous result|A tool-tip message describing that the button would go to the previous search result"));

            ttMain.SetToolTip(pnNextResult,
                              DBLangEngine.GetMessage("msgNextResult",
                                                      "Advance result|A tool-tip message describing that the button would go to the next search result"));

            ttMain.SetToolTip(pnClose,
                              DBLangEngine.GetMessage("msgButtonClose",
                                                      "Close|A message describing a tool-tip for a button which would close something"));

            // don't allow multiple instances of this..
            if (PreviousInstance != null)
            {
                if (PreviousInstance.IsDocked)
                {
                    RequestDockReleaseMainForm?.Invoke(PreviousInstance, new EventArgs());
                }
                else
                {
                    PreviousInstance?.Close();
                }
            }

            // save this as the new previous instance..
            PreviousInstance = this;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormHelp"/> class.
        /// </summary>
        public FormHelp()
        {
            // Add this form to be positioned..
            PositionForms.Add(this);

            InitializeComponent();

            // ReSharper disable once StringLiteralTypo
            DBLangEngine.DBName = "lang.sqlite";
            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("amp.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more.
            }
            DBLangEngine.InitializeLanguage("amp.Messages");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormHexEdit"/> class.
        /// </summary>
        public FormHexEdit()
        {
            // Add this form to be positioned..
            PositionForms.Add(this, PositionCore.SizeChangeMode.MoveTopLeft);

            // add positioning..
            PositionCore.Bind(ApplicationType.WinForms);

            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            hexEditor.ForegroundSecondColor = Brushes.Blue;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormFileDiffView"/> class.
        /// </summary>
        public FormFileDiffView()
        {
            // Add this form to be positioned..
            PositionForms.Add(this);

            // add positioning..
            PositionCore.Bind(ApplicationType.WinForms);

            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            ThisInstance = this;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormScript"/> class.
        /// </summary>
        public FormScript()
        {
            // Add this form to be positioned..
            PositionForms.Add(this);

            // add positioning..
            PositionCore.Bind(ApplicationType.WinForms);

            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            suspendChangedEvent = true; // suspend the event handler as the contents of the script is about to change..

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            // localize the script type default names..
            defaultNameScriptTemplateText =
                DBLangEngine.GetMessage("msgDefaultScriptSnippetText", "A text script snippet|As in a script for manipulating Scintilla contents as text");

            defaultNameScriptTemplateLines =
                DBLangEngine.GetMessage("msgDefaultScriptSnippetLines", "A line script snippet|As in a script for manipulating Scintilla contents as lines");

            // localize the currently supported script types..
            tsbComboScriptType.Items.Clear();
            tsbComboScriptType.Items.Add(
                DBLangEngine.GetMessage("msgScriptTypeText", "Script text|As in the C# script type should be handling the Scintilla's contents as text")
                );

            tsbComboScriptType.Items.Add(
                DBLangEngine.GetMessage("msgScriptTypeLines", "Script lines|As in the C# script type should be handling the Scintilla's contents as lines")
                );

            tsbComboScriptType.SelectedItem =
                DBLangEngine.GetMessage("msgScriptTypeText", "Script text|As in the C# script type should be handling the Scintilla's contents as text");

            // set the default script for manipulating text..
            scintillaScript.Text = scriptRunnerText.CSharpScriptBase;

            // set the text for the default script snippet..
            tstScriptName.Text = defaultNameScriptTemplateText;

            CreateNewCodeSnippet(); // create a new CODE_SNIPPETS class instance..

            // set the lexer as C#..
            ScintillaLexers.CreateLexer(scintillaScript, LexerType.Cs);

            // highlight the braces..
            SetBraceHighlights();

            suspendChangedEvent = false; // "resume" the event handler..

            // track the instances of this form so the changes can be delegated to each other..
            FormScriptInstances.Add(this);
        }