Example #1
0
        protected void UpdateLogText()
        {
            int playbackTime = Session.PlaybackPosition;

            rtfDummy.SuspendLayout();
            this.rtfDummy.Text = "";

            BindingSource logFlagColors = UserPreferencesManager.Instance.UserPreferences.LogFlagColors;

            if (tracker.SelectedItem != null)
            {
                int             current = 0;
                int             count   = 0;
                List <LogEntry> entries = new List <LogEntry>(tracker.SelectedItem.Log.LogEntries);
                foreach (LogEntry entry in entries)
                {
                    int    colorIndex = (entry.HasFlags() ? (entry.GetHighestFlagBit() + 1) : 0);
                    string newEntry   = entry.TimeAsText + " " + entry.Content + "\n";
                    rtfDummy.AppendText(newEntry);
                    rtfDummy.Select(current, newEntry.Length);

                    bool inPast = playbackTime >= entry.Time;

                    LogFlagColor lfc       = logFlagColors[colorIndex] as LogFlagColor;
                    Color        textColor = Color.FromArgb(inPast ? 255 : 128, lfc.Color.R / 3, lfc.Color.G / 3, lfc.Color.B / 3);

                    rtfDummy.SelectionFont  = inPast ? logFont : logFontTransparent;
                    rtfDummy.SelectionColor = textColor;

                    current += newEntry.Length;
                    count++;
                }
            }
            this.logTextBox.Rtf = rtfDummy.Rtf;
        }
Example #2
0
        /// <summary>
        /// Someone clicks / checks one of the log flag filter buttons
        /// </summary>
        private void logFlagFilterButton_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb = sender as CheckBox;

            if (cb != null)
            {
                LogFlagColor lfc = cb.Tag as LogFlagColor;
                SetShowFlag(lfc.LogFlagBit, cb.Checked);
                cb.Text = cb.Checked ? "+ " + lfc.Name : "- " + lfc.Name;
            }
        }
Example #3
0
 private void logFlagColorGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 2 && e.RowIndex >= 0 && e.RowIndex < UserPreferencesManager.Instance.UserPreferences.LogFlagColors.Count)
     {
         LogFlagColor lfc = UserPreferencesManager.Instance.UserPreferences.LogFlagColors[e.RowIndex] as LogFlagColor;
         ColorDialog  dlg = new ColorDialog();
         dlg.FullOpen = true;
         dlg.Color    = lfc.Color;
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             lfc.Color = dlg.Color;
         }
     }
 }