Beispiel #1
0
    private void AddMessageHandler(object o, EventArgs e)
    {
        var msg = (OutputMessage)o;
        var end = OutputTextView.Buffer.EndIter;

        var tag = new TextTag(null);

        OutputTextView.Buffer.TagTable.Add(tag);

        switch (msg.OutputType)
        {
        case OutputType.Info:
            tag.Foreground = "#000000";
            break;

        case OutputType.Warn:
            tag.Foreground = "#cccc00";
            break;

        case OutputType.Error:
            tag.Foreground = "#cc0000";
            tag.Weight     = Weight.Bold;
            break;
        }

        OutputTextView.Buffer.InsertWithTags(ref end, msg.Message + "\n", tag);

        OutputTextView.ScrollToIter(OutputTextView.Buffer.EndIter, 0, false, 0, 0);
    }
Beispiel #2
0
    protected void hdConnectDB(object sender, EventArgs e)
    {
        String dbName = DbNameInput.Buffer.Text;

        SQLiteConnectionSb = new SQLiteConnectionStringBuilder {
            DataSource = dbName
        };
        OutputTextView.overriteText("Connection successful!\n");
    }
Beispiel #3
0
 public MainWindow() : base(Gtk.WindowType.Toplevel)
 {
     this.GdkWindow.Background = Gdk.Color.
                                 SQLiteConnectionSb = new SQLiteConnectionStringBuilder {
         DataSource = ":memory:"
     };
     OutputTextView.overriteText(sqlCommonExecuter("select sqlite_version()") + "\n");
     OutputTextView.postscriptText("Hello SQLite!\n");
     Build();
 }
        void ReleaseDesignerOutlets()
        {
            if (IsDottedCheck != null)
            {
                IsDottedCheck.Dispose();
                IsDottedCheck = null;
            }

            if (IsTripletCheck != null)
            {
                IsTripletCheck.Dispose();
                IsTripletCheck = null;
            }

            if (LengthMenu != null)
            {
                LengthMenu.Dispose();
                LengthMenu = null;
            }

            if (NoteMenu != null)
            {
                NoteMenu.Dispose();
                NoteMenu = null;
            }

            if (OctaveMenu != null)
            {
                OctaveMenu.Dispose();
                OctaveMenu = null;
            }

            if (OutputTextView != null)
            {
                OutputTextView.Dispose();
                OutputTextView = null;
            }

            if (SystemVoicesMenu != null)
            {
                SystemVoicesMenu.Dispose();
                SystemVoicesMenu = null;
            }

            if (TempoField != null)
            {
                TempoField.Dispose();
                TempoField = null;
            }
        }
Beispiel #5
0
    protected void exec(object sender, EventArgs e)
    {
        String query = InputTextView.getText();

        try
        {
            OutputTextView.overriteText(sqlCommonExecuter(query));
            OutputTextView.postscriptText("Query executed.\n");
        }
        catch (Exception exc)
        {
            OutputTextView.postscriptText(exc.Message);
        }
    }
    protected virtual void Preferences_OnActivated(object sender, System.EventArgs e)
    {
        PrefWin Pref = new PrefWin();

        Pref.DebugFile = DebugFile;

        Pref.PipeFont   = PipeTextView.Style.FontDescription.ToString();
        Pref.TextFont   = InputTextView.Style.FontDescription.ToString();
        Pref.ErrorsFont = ErrorsTextView.Style.FontDescription.ToString();

        Pref.WrapText = InputTextView.WrapMode != WrapMode.None;
        Pref.CommandAutoCompletion = commandAutoCompletion;

        try
        {
            if (Pref.Run() == (int)ResponseType.Ok)
            {
                DebugFile = Pref.DebugFile;

                PipeTextView.ModifyFont(Pango.FontDescription.FromString(Pref.PipeFont));
                ArgsEntry.ModifyFont(Pango.FontDescription.FromString(Pref.PipeFont));
                InputTextView.ModifyFont(Pango.FontDescription.FromString(Pref.TextFont));
                OutputTextView.ModifyFont(Pango.FontDescription.FromString(Pref.TextFont));
                ErrorsTextView.ModifyFont(Pango.FontDescription.FromString(Pref.ErrorsFont));

                if (Pref.WrapText)
                {
                    InputTextView.WrapMode  = WrapMode.Word;
                    OutputTextView.WrapMode = WrapMode.Word;
                }
                else
                {
                    InputTextView.WrapMode  = WrapMode.None;
                    OutputTextView.WrapMode = WrapMode.None;
                }

                commandAutoCompletion = Pref.CommandAutoCompletion;

                SaveConfiguration();
            }
        }

        finally
        {
            Pref.Destroy();
        }
    }
Beispiel #7
0
        public void AppendText(string text)
        {
            if (OutputTextView.Document.Blocks.Count == 0)
            {
                OutputTextView.Document.Blocks.Add(new Paragraph());
                TextPointer pos = OutputTextView.Document.ContentEnd;
                OutputTextView.Selection.Select(pos, pos);
            }

            TextPointer ptr   = OutputTextView.Document.ContentEnd;
            int         delta = OutputTextView.Selection.End.GetOffsetToPosition(OutputTextView.Document.ContentEnd);

            ptr.InsertTextInRun(text);
            ptr = OutputTextView.Document.ContentEnd;
            ptr.InsertLineBreak();
            ptr = OutputTextView.Document.ContentEnd;

            if (delta < 10)
            {
                OutputTextView.Selection.Select(ptr, ptr);
                OutputTextView.ScrollToEnd();
            }
        }
    /// <summary>
    /// Configures the application.
    /// </summary>
    private void LoadConfiguration()
    {
        try
        {
            if (!File.Exists(ConfigFile))
            {
                // Configuration file doesn't exist. Create it:

                string configContents =
                    "<Config>" + System.Environment.NewLine +
                    "  <DebugFile>" + applDataFolder + System.IO.Path.DirectorySeparatorChar + "Debug.txt</DebugFile>" + System.Environment.NewLine +
                    "  <TextWrapping>True</TextWrapping>" + System.Environment.NewLine +
                    "  <CmdAutoCompletion>True</CmdAutoCompletion>" + System.Environment.NewLine +
                    "  <PipeFont>FreeMono Bold 10</PipeFont>" + System.Environment.NewLine +
                    "  <TextFont>FreeMono 10</TextFont>" + System.Environment.NewLine +
                    "  <ErrorFont>FreeMono 10</ErrorFont>" + System.Environment.NewLine +
                    "</Config>" + System.Environment.NewLine;

                File.WriteAllText(ConfigFile, configContents);
            }

            // Load the configuration file:

            XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.Load(ConfigFile);
            XmlElement RootElem = XmlDoc["Config"];

            // Configure debugging:

            XmlElement Elem = RootElem["DebugFile"];
            DebugFile = Elem.InnerText;

            // Configure text wrapping:

            Elem = RootElem["TextWrapping"];

            if (Elem.InnerText.ToUpper() == "TRUE")
            {
                InputTextView.WrapMode  = WrapMode.Word;
                OutputTextView.WrapMode = WrapMode.Word;
            }
            else
            {
                InputTextView.WrapMode  = WrapMode.None;
                OutputTextView.WrapMode = WrapMode.None;
            }

            // Configure command auto-completion:

            Elem = RootElem["CmdAutoCompletion"];
            commandAutoCompletion = Elem.InnerText.ToUpper() == "TRUE";

            // Configure fonts:

            string tempStr = LoadFont("PipeFont", RootElem);
            PipeTextView.ModifyFont(Pango.FontDescription.FromString(tempStr));
            ArgsEntry.ModifyFont(Pango.FontDescription.FromString(tempStr));
            InputTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("TextFont", RootElem)));
            OutputTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("TextFont", RootElem)));
            ErrorsTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("ErrorFont", RootElem)));
        }

        catch (Exception)
        {
            throw new PipeWrenchEngineException("Could not create/load app. configuration (" +
                                                ConfigFile + ").");
        }
    }