Esempio n. 1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);
            if (e.Index == -1)
            {
                return;
            }
            e.DrawBackground();
            if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
            {
                e.DrawFocusRectangle();
            }
            ElementType type  = (ElementType)this.Items[e.Index];
            string      s     = type.ToString();
            Image       image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(type)];

            e.Graphics.DrawImage(image, e.Bounds.Location);
            Rectangle bounds = e.Bounds;

            bounds.X     += LabyrinthData.ElementImages.ImageSize.Width;
            bounds.Width -= LabyrinthData.ElementImages.ImageSize.Width;
            SolidBrush solidBrush = new SolidBrush(e.ForeColor);

            e.Graphics.DrawString(s, e.Font, (Brush)solidBrush, (RectangleF)bounds, this.fFormat);
        }
Esempio n. 2
0
        protected override void OnMeasureItem(MeasureItemEventArgs e)
        {
            base.OnMeasureItem(e);
            Image image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex((ElementType)this.Items[e.Index])];

            e.ItemHeight = image.Height;
        }
Esempio n. 3
0
 private void update_results(SearchResult[] results, ListView control)
 {
     control.BeginUpdate();
     control.Items.Clear();
     if (results.Length != 0)
     {
         ArrayList arrayList = new ArrayList();
         foreach (SearchResult result in results)
         {
             arrayList.Add((object)new ListViewItem(result.Data.ToString())
             {
                 SubItems =
                 {
                     result.Data.GetType().Name,
                     result.Details != null ? result.Details.ToString() : ""
                 },
                 ImageIndex = LabyrinthData.GetImageIndex(result.Data),
                 Tag        = (object)result
             });
         }
         control.Items.AddRange((ListViewItem[])arrayList.ToArray(typeof(ListViewItem)));
     }
     else
     {
         ListViewItem listViewItem = control.Items.Add("No results were found.");
         listViewItem.ImageIndex = 0;
         listViewItem.ForeColor  = SystemColors.GrayText;
     }
     control.EndUpdate();
 }
Esempio n. 4
0
 private Image get_element_icon(Element e)
 {
     if (this.TopLevelControl is MainForm)
     {
         return(LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(e.Type)]);
     }
     return((Image)null);
 }
Esempio n. 5
0
 public MergeElementsDlg()
 {
     this.InitializeComponent();
     this.ElementList.SmallImageList     = LabyrinthData.ElementImages;
     this.ElementList.ListViewItemSorter = (IComparer) new ListViewSorter();
     foreach (Element element in LabyrinthData.Project.Elements)
     {
         ListViewItem listViewItem = this.ElementList.Items.Add(element.Name);
         listViewItem.ImageIndex = LabyrinthData.GetImageIndex(element.Type);
         listViewItem.Tag        = (object)element;
     }
     this.light_ok();
 }
Esempio n. 6
0
 private void draw_row_headers(Graphics g, Rectangle rect)
 {
     for (int e_index = 0; e_index != this.fTimeline.ElementIDs.Count; ++e_index)
     {
         Element element = this.get_element(this.fTimeline.ElementIDs[e_index]);
         RectangleF layoutRectangle = this.rect_for_cell(e_index, -1, rect);
         Image image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(element.Type)];
         Rectangle rect1 = new Rectangle(new Point((int)layoutRectangle.X, (int)layoutRectangle.Top + ((int)layoutRectangle.Height - image.Height) / 2), image.Size);
         g.DrawImage(image, rect1);
         g.DrawRectangle(SystemPens.ControlDark, layoutRectangle.X, layoutRectangle.Y, layoutRectangle.Width, layoutRectangle.Height);
         Font font = element == this.SelectedElement ? this.fBoldFont : this.Font;
         layoutRectangle.X += (float)rect1.Width;
         layoutRectangle.Width -= (float)rect1.Width;
         g.DrawString(element.Name, font, SystemBrushes.ControlText, layoutRectangle, this.fRowHdrFormat);
     }
 }
Esempio n. 7
0
        private void update_items()
        {
            SelectionRange selectionRange = this.Calendar.SelectionRange;

            this.ItemList.BeginUpdate();
            this.ItemList.Items.Clear();
            ArrayList arrayList = new ArrayList();

            foreach (Timeline timeline in LabyrinthData.Project.Timelines)
            {
                foreach (TimelinePoint point in timeline.Points)
                {
                    if (point.UseSchedule != ScheduleType.None && point.Schedule >= selectionRange.Start && point.Schedule <= selectionRange.End)
                    {
                        foreach (TimelineItem timelineItem in point.Items)
                        {
                            Element element = (Element)null;
                            int     index   = LabyrinthData.Project.Elements.IndexOf(timelineItem.ElementID);
                            if (index != -1)
                            {
                                element = LabyrinthData.Project.Elements[index];
                            }
                            arrayList.Add((object)new ListViewItem(timelineItem.Annotation.Title)
                            {
                                SubItems =
                                {
                                    element != null ? element.Name : "",
                                    point.Name,
                                    timeline.Name
                                },
                                ImageIndex = LabyrinthData.GetImageIndex((Annotation)timelineItem.Annotation),
                                Tag        = (object)timelineItem
                            });
                        }
                    }
                }
            }
            this.ItemList.Items.AddRange((ListViewItem[])arrayList.ToArray(typeof(ListViewItem)));
            if (this.ItemList.Items.Count == 0)
            {
                ListViewItem listViewItem = this.ItemList.Items.Add("No timeline items");
                listViewItem.ForeColor  = SystemColors.GrayText;
                listViewItem.ImageIndex = -1;
            }
            this.ItemList.EndUpdate();
        }
Esempio n. 8
0
 private ListViewItem get_annotation(Annotation a, object source)
 {
     if (a is TextAnnotation && !this.fShowText)
     {
         return((ListViewItem)null);
     }
     if (a is LinkAnnotation && !this.fShowLink)
     {
         return((ListViewItem)null);
     }
     if (a is SketchAnnotation && !this.fShowSketch)
     {
         return((ListViewItem)null);
     }
     return(new ListViewItem(a.Title)
     {
         SubItems =
         {
             source.ToString()
         },
         ImageIndex = LabyrinthData.GetImageIndex(a),
         Tag = (object)a
     });
 }
Esempio n. 9
0
        public void update_tasks()
        {
            this.TaskList.BeginUpdate();
            this.TaskList.Items.Clear();
            Font font = new Font(this.Font, FontStyle.Bold);

            if (LabyrinthData.Project.Tasks.Count != 0)
            {
                ArrayList arrayList = new ArrayList();
                foreach (Task task in LabyrinthData.Project.Tasks)
                {
                    Font  prototype = this.Font;
                    Color color1    = SystemColors.WindowText;
                    Color color2    = SystemColors.WindowText;
                    Color window    = SystemColors.Window;
                    switch (task.Importance)
                    {
                    case Importance.Low:
                        color1 = SystemColors.GrayText;
                        break;

                    case Importance.High:
                        prototype = new Font(prototype, prototype.Style | FontStyle.Bold);
                        break;
                    }
                    if (task.HasDeadline)
                    {
                        TimeSpan timeSpan = task.Deadline - DateTime.Now;
                        if (!(timeSpan > new TimeSpan(1, 0, 0, 0)))
                        {
                            if (timeSpan > TimeSpan.Zero)
                            {
                                color2 = Color.Red;
                            }
                            else
                            {
                                color1 = Color.Red;
                                color2 = Color.Red;
                            }
                        }
                    }
                    if (task.Completed)
                    {
                        prototype = new Font(prototype, prototype.Style | FontStyle.Strikeout);
                        color1    = SystemColors.GrayText;
                    }
                    arrayList.Add((object)new ListViewItem(task.Title)
                    {
                        UseItemStyleForSubItems = false,
                        Font       = prototype,
                        ForeColor  = color1,
                        ImageIndex = LabyrinthData.GetImageIndex(task),
                        Tag        = (object)task,
                        SubItems   =
                        {
                            {
                                task.HasDeadline?task.Deadline.ToShortDateString() : "",
                                color2,
                                window,
                                prototype
                            },
                            {
                                task.Importance.ToString(),
                                color1,
                                window,
                                prototype
                            },
                            {
                                task.Completed.ToString(),
                                color1,
                                window,
                                prototype
                            }
                        }
                    });
                }
                this.TaskList.Items.AddRange((ListViewItem[])arrayList.ToArray(typeof(ListViewItem)));
            }
            else
            {
                ListViewItem listViewItem = this.TaskList.Items.Add("No tasks");
                listViewItem.ForeColor  = SystemColors.GrayText;
                listViewItem.ImageIndex = -1;
            }
            this.TaskList.EndUpdate();
        }