Пример #1
0
        private void draw_item(int col, int row, Graphics g, bool isSelected)
        {
            if (table == null || row < 0 ||
                (focus == -1 && (col < 0 || col >= table.Count || row >= table[col].Count)) ||
                (focus != -1 && (focus < 0 || focus >= table.Count || row >= table[focus].Count)))
            {
                return;
            }
            TaskVarOp t = table[(focus == -1) ? col : focus][row];

            Point pt = AutoScrollPosition;

            if (focus == -1)
            {
                draw_entry(t, g, col, row, pt, isSelected);
            }
            else
            {
                for (int tid = 0; tid < max_tid[focus]; tid++)
                {
                    if (tid != t.tid - 1)
                    {
                        draw_enabled(t, g, tid, row, pt);
                    }
                }
                draw_entry(t, g, t.tid - 1, row, pt, isSelected);
            }
        }
Пример #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (current_column < 0)
            {
                // no entries yet
                return;
            }
            Point    pt = AutoScrollPosition;
            Graphics g  = e.Graphics;

            if (focus == -1)
            {
                int col, row, curr_row, curr_col;
                get_col_row_from_scroll(out col, out row);
                curr_col = col;

                // heading
                //while (curr_col <= current_column && (curr_col - col) * col_sz < ClientSize.Width)
                //{
                //   g.FillRectangle(new SolidBrush(Color.AliceBlue), pt.X + curr_col * col_sz, pt.Y, col_sz, row_sz);
                //    g.DrawRectangle(line, pt.X + curr_col * col_sz, pt.Y, col_sz, row_sz);
                //    Brush wsb = new SolidBrush(Color.Black);
                //    Font f = new Font("Courier New", 8);
                //    g.DrawString("T"+(System.Convert.ToString(curr_col)), f, wsb, pt.X + curr_col * col_sz, pt.Y + 8);
                //    curr_col++;
                //}
                // curr_col = col;

                // table
                while (curr_col <= current_column && (curr_col - col) * col_sz < ClientSize.Width)
                {
                    curr_row = row;
                    while (curr_row < table[curr_col].Count && (curr_row - row) * row_sz < ClientSize.Height)
                    {
                        draw_item(curr_col, curr_row, g, false);
                        curr_row++;
                    }
                    curr_col++;
                }
                draw_selection(g);
                this.AutoScrollMinSize = new Size(current_column * col_sz, row_max * row_sz);
            }
            else
            {
                int row, curr_row;
                get_row_from_scroll(out row);
                curr_row = row;
                while (curr_row < table[focus].Count && (curr_row - row) * row_sz < ClientSize.Height)
                {
                    TaskVarOp elem = table[focus][curr_row];
                    draw_item(elem.tid - 1, curr_row, g, false);
                    curr_row++;
                }
                if (prev_row != -1)
                {
                    draw_item(table[focus][prev_row].tid - 1, prev_row, g, true);
                }
                this.AutoScrollMinSize = new Size(ClientSize.Width, table[focus].Count * row_sz);
            }
        }
Пример #3
0
        private void display_file_line(TaskVarOp tvo, bool selected)
        {
            int i      = tid_to_index[tvo.entry.record.tid];
            var record = tvo.entry.record;

            lock (record)
            {
                if (record.stack != null && record.stack.Count > 0)
                {
                    var subitems = listView1.Items[i].SubItems;
                    var format   = formatter.GetFormat(tvo.entry, true, false);
                    subitems[2].Text = record.tid.ToString();
                    if (record.stack[0].file != null)
                    {
                        subitems[1].Text = record.stack[0].file.Name;
                    }
                    if (record.stack[0].proc != null)
                    {
                        subitems[3].Text = record.stack[0].proc;
                    }
                    subitems[4].Text = format.text;
                }
            }
            threads[i].GotoFileLine(tvo.entry, selected);
        }
Пример #4
0
        public bool NewColumnEntry(int index, Entry entry)
        {
            var tvo = new TaskVarOp(index, entry);

            check_for_tid(index, entry.record.tid);

            seqno_to_row[entry.seqno] = tvo_list.Count;
            tvo_list.Add(tvo);

            if (tvo.entry.status.Equals("p"))
            {
                // preemption
                var newitem = new ListViewItem("Pre");
                newitem.SubItems.Add("emp");
                newitem.SubItems.Add("tion");
                newitem.BackColor = Color.Orange;
                listView2.Items.Add(newitem);
            }
            else
            {
                var record = tvo.entry.record;
                lock (record)
                {
                    var format  = formatter.GetFormat(tvo.entry, true, false);
                    var newitem = new ListViewItem(record.tid.ToString());
                    newitem.BackColor = format.threadColor;
                    newitem.ForeColor = format.textColor;
                    if (format.fatBorder)
                    {
                        newitem.ForeColor = format.lineColor;
                    }
                    newitem.SubItems.Add(format.text);
                    newitem.SubItems.Add(format.objs);
                    listView2.Items.Add(newitem);
                }
            }
            return(true);
        }
Пример #5
0
        internal bool NewColumnEntry(TaskVarOp tvo)
        {
            current_row++;
            entries[tvo.entry.seqno] = new Coord(current_column, current_row);
            if (replay && focus != -1)
            {
                // TODO: should check for consistency
                // highlight current place
                // draw_item(new SolidBrush(Color.Yellow), tid - 1, current_row, CreateGraphics());
                // check to see if we have a set a break point at current entry
                // System.Threading.Thread.Sleep(500);
                //return selected[current_row];
                return(false);
            }
            else
            {
                // we are expanding the test
                // swap these two lines for the two below if you use the repeat execution marks (BFS)
                //if (current_row + 1 > row_max)
                //    row_max = current_row + 1;
                if (current_row > row_max)
                {
                    row_max = current_row;
                }
                table[current_column].Add(tvo);
                if (tvo.tid > max_tid[current_column])
                {
                    max_tid[current_column] = tvo.tid;
                }

                // paint the current one
                draw_item(current_column, current_row, CreateGraphics(), false);
                // make sure we are visible (scroll to focus area)
                return(false);
            }
        }
Пример #6
0
        private void draw_entry(TaskVarOp t, Graphics g, int col, int row, Point pt, bool isSelected)
        {
            if (t.entry.status == "p")
            {
                // draw preemption marker
                g.FillEllipse(isSelected ? selbrush : preemptbrush, new Rectangle(pt.X + col * col_sz, pt.Y + row * row_sz, col_sz, row_sz));
                return;
            }

            // Draw a pink circle at the bottom of repeat executions (BFS)
            if (t.entry.status.Contains("r"))
            {
                // draw repeat execution marker
                g.FillEllipse(isSelected ? selbrush : repeatbrush, new Rectangle(pt.X + col * col_sz, pt.Y + row * row_sz, col_sz, row_sz));
                return;
            }

            Format format     = formatter.GetFormat(t.entry, focus != -1, isSelected);
            Pen    line_pen   = new Pen(format.lineColor, format.fatBorder ? 3 : 1);
            Brush  text_brush = new SolidBrush(format.textColor);

            float div = format.fillBrushes.Length;

            for (int i = format.fillBrushes.Length - 1; i >= 0; --i)
            {
                g.FillRectangle(format.fillBrushes[i],
                                pt.X + (col + i / div) * col_sz, pt.Y + row * row_sz, col_sz / div, row_sz);
            }
            if (focus == -1 || formatter.useOldStyle)
            {
                g.DrawRectangle(line_pen, pt.X + col * col_sz, pt.Y + row * row_sz, col_sz, row_sz);
            }

            if (isSelected && formatter.useOldStyle)
            {
                g.DrawRectangle(white_pen, pt.X + col * col_sz + 3, pt.Y + row * row_sz + 3, col_sz - 5, row_sz - 5);
            }

            if (!System.String.IsNullOrEmpty(format.text))
            {
                g.DrawString(format.text, format.font, text_brush, pt.X + 10 + col * col_sz, pt.Y + row * row_sz + 8);
            }

            if (format.cross)
            {
                g.DrawLine(line_pen, pt.X + col * col_sz, pt.Y + row * row_sz, pt.X + (col + 1) * col_sz, pt.Y + (row + 1) * row_sz);
                g.DrawLine(line_pen, pt.X + col * col_sz, pt.Y + (row + 1) * row_sz, pt.X + (col + 1) * col_sz, pt.Y + row * row_sz);
            }

            if (t.entry.marked)
            {
                int diam = 10;
                if (row_sz < diam)
                {
                    diam = row_sz;
                }
                if (col_sz < diam)
                {
                    diam = col_sz;
                }
                g.FillEllipse(new SolidBrush(Color.Red), new Rectangle(pt.X + col * col_sz, pt.Y + row * row_sz, diam, diam));
            }
        }
Пример #7
0
        private void draw_enabled(TaskVarOp t, Graphics g, int col, int row, Point pt)
        {
            //int exec = focus + 1;
            //int thread = col + 1;
            EnableInfo info = EnableInfo.Error;

            lock (t.entry)
            {
                info = t.entry.enableinfo[col];
            }
            int left   = pt.X + col * col_sz;
            int top    = pt.Y + 1 + row * row_sz;
            int right  = left + col_sz;
            int bottom = top + row_sz - 1;
            int mid    = bottom - (bottom - top) / 4;

            if (info == EnableInfo.Disabled)
            {
                g.FillRectangle(new SolidBrush(disabledcolor),
                                left, top, right - left, bottom - top);
            }
            else if (info == EnableInfo.Enabled)
            {
                g.FillRectangle(new SolidBrush(enabledcolor),
                                left, top, right - left, bottom - top);
            }
            else if (info == EnableInfo.Enable)
            {
                // ALT 1 : smooth
                //Brush b = new LinearGradientBrush(new Point(left, top), new Point(left, bottom),
                //                                                      disabledcolor, enabledcolor);
                //g.FillRectangle(b,
                //   left, top, right-left, bottom-top);

                // ALT2 : triangles
                //g.FillPolygon(disabledbrush, new Point[] {
                //    new Point(left, top), new Point (right, top), new Point(left, bottom)
                //});
                //g.FillPolygon(enabledbrush, new Point[] {
                //    new Point(left, bottom), new Point (right, top), new Point(right, bottom)
                //});

                // ALT3 : middle
                g.FillRectangle(new SolidBrush(disabledcolor),
                                left, top, right - left, mid - top);
                g.FillRectangle(Brushes.DarkGray,
                                left, mid, right - left, bottom - mid);
            }
            else if (info == EnableInfo.Disable)
            {
                g.FillRectangle(new SolidBrush(enabledcolor),
                                left, top, right - left, mid - top);
                g.FillRectangle(Brushes.DarkGray,
                                left, mid, right - left, bottom - mid);
            }
            else if (info == EnableInfo.Error)
            {
                g.FillRectangle(Brushes.Crimson,
                                left, top, right - left, bottom - top);
            }
        }