Example #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="FrmLogWindow"/> window.
        /// </summary>
        /// <param name="logProvider">The <see cref="ILogProvider"/> that sends messages to this window.</param>
        /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param>
        public FrmLogWindow(ILogProvider logProvider, ILogContainer logContainer)
        {
            InitializeComponent();

              mLogcontainer = logContainer;
              mBookmarks    = new List<LogMessage>();
              InitializeColumns(logProvider);

              if (!logProvider.HasLoggerTree)
              {
            // Remove the synchronize tree menu item if no tree is available.
            cmLogMessage.Items.Remove(cmsSynchronizeTree);
              }

              ThemeManager.CurrentApplicationTheme.ApplyTo(cmColumns);
              ThemeManager.CurrentApplicationTheme.ApplyTo(cmLogMessage);

              if (!string.IsNullOrEmpty(Settings.Default.LogMessagesFontName))
              {
            try
            {
              dtgLogMessages.DefaultCellStyle.Font = new Font(
              Settings.Default.LogMessagesFontName
            , Settings.Default.LogMessagesFontSize);
            }
            catch
            {
              // Reset the font on error.
              dtgLogMessages.Font = new Font(
              DEFAULT_FONT_NAME
            , DEFAULT_FONT_SIZE);

              mRowHeight = dtgLogMessages.RowTemplate.Height;

              // Save the changed settings as new default.
              Settings.Default.LogMessagesFontName = DEFAULT_FONT_NAME;
              Settings.Default.LogMessagesFontSize = DEFAULT_FONT_SIZE;

              Settings.Default.SaveSettings();
            }
              }

              if (Settings.Default.EnableColorMap)
              {
            tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 1);
            colorMap1.Visible = true;
              }
              else
              {
            colorMap1.Visible = false;
            tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 2);
              }

              // Listening for settings changes.
              Settings.Default.SettingChanging += DefaultSettingChanging;
        }
Example #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="FrmLogScript"/> window.
        /// </summary>
        /// <param name="bookmarkProvider">The <see cref="IBookmarkProvider"/> instance that provides bookmarked <see cref="LogMessage"/>s.</param>
        /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param>
        public FrmLogScript(IBookmarkProvider bookmarkProvider, ILogContainer logContainer)
        {
            InitializeComponent();

              // Apply the current application theme to the control.
              ThemeManager.CurrentApplicationTheme.ApplyTo(tsCuCommands);
              ThemeManager.CurrentApplicationTheme.ApplyTo(tsOutput);
              ThemeManager.CurrentApplicationTheme.ApplyTo(cmsLuaEdit);

              DockHandler.CloseButton        = false;
              DockHandler.CloseButtonVisible = false;

              mLogContainer     = logContainer;
              mBookmarkProvider = bookmarkProvider;

              if (mBookmarkProvider != null)
              {
            mBookmarkProvider.RegisterBookmarkObserver(this);
              }

              // Intialize the edit control.
              InitializeScintilaCtrl();

              // Prevent the undo of the initial text.
              scintilla.EmptyUndoBuffer();

              // Listening for settings changes.
              Settings.Default.SettingChanging += DefaultSettingChanging;
        }