public SportDashboardCanvas(IWidget widget)
     : base(widget)
 {
     Accuracy = 5;
     Mode = DashboardMode.Edit;
     FitMode = FitMode.Fit;
     CurrentTime = new Time (0);
     AddTag = new Tag ("", "");
     BackgroundColor = App.Current.Style.PaletteBackground;
 }
示例#2
0
 public void ClickButton(DashboardButton button, Tag tag = null)
 {
     tagger.Click (button, tag);
 }
示例#3
0
        public void FilterEventTag(EventType evType, Tag tag, bool visible)
        {
            List<Tag> tags;

            if (visible) {
                FilterEventType (evType, true);
                tags = eventsFilter [evType];
                if (!tags.Contains (tag))
                    tags.Add (tag);
            } else {
                if (eventsFilter.ContainsKey (evType)) {
                    tags = eventsFilter [evType];
                    if (tags.Contains (tag))
                        tags.Remove (tag);
                }
            }
            Update ();
        }
示例#4
0
 public void FilterTag(Tag tag, bool visible)
 {
     if (visible) {
         if (!tagsFilter.Contains (tag))
             tagsFilter.Add (tag);
     } else {
         if (tagsFilter.Contains (tag))
             tagsFilter.Remove (tag);
     }
 }
示例#5
0
 public void ClickButton(DashboardButton button, Tag tag = null)
 {
     codingwidget.ClickButton (button, tag);
 }
示例#6
0
 void AddTagsGroup(TimelineEventLongoMatch evt, string grp, List<Tag> tags, SizeGroup sgroup)
 {
     HBox box = new HBox ();
     Label label = new Label (String.IsNullOrEmpty (grp) ? Catalog.GetString ("Common tags") : grp);
     Table tagstable = new Table ((uint)(tags.Count / TAGS_PER_ROW), TAGS_PER_ROW, true);
     RadioButton first = null;
     Tag noneTag = new Tag (Catalog.GetString ("None"));
     label.WidthRequest = 200;
     if (!String.IsNullOrEmpty (grp)) {
         tags.Insert (0, noneTag);
     }
     for (int i = 0; i < tags.Count; i++) {
         uint row_top, row_bottom, col_left, col_right;
         Tag t = tags [i];
         CheckButton tb;
         if (String.IsNullOrEmpty (grp)) {
             tb = new CheckButton (t.Value);
         } else {
             if (first == null) {
                 tb = first = new RadioButton (t.Value);
             } else {
                 tb = new RadioButton (first, t.Value);
             }
         }
         tb.Active = evt.Tags.Contains (t);
         tb.Toggled += (sender, e) => {
             if (tb.Active && t != noneTag) {
                 evt.Tags.Add (t);
             } else {
                 evt.Tags.Remove (t);
             }
         };
         row_top = (uint)(i / tagstable.NColumns);
         row_bottom = (uint)row_top + 1;
         col_left = (uint)i % tagstable.NColumns;
         col_right = (uint)col_left + 1;
         tagstable.Attach (tb, col_left, col_right, row_top, row_bottom);
     }
     sgroup.AddWidget (label);
     box.PackStart (label, false, true, 0);
     box.PackEnd (tagstable, true, true, 0);
     box.Spacing = 5;
     tagsvbox.PackStart (box, false, true, 0);
     tagsvbox.PackStart (new HSeparator ());
 }
示例#7
0
 void RemoveTag(Tag tag, TagsGroup g)
 {
     string msg = Catalog.GetString ("Do you want to remove this tag?");
     if (Config.GUIToolkit.QuestionMessage (msg, null, this)) {
         EventType.Tags.Remove (tag);
         g.tags.Remove (tag);
         g.container.Remove (g.table);
         g.container.PackStart (CreateTagsTable (g), true, true, 0);
         g.container.ShowAll ();
     }
 }
示例#8
0
 void AddTag(TagsGroup g)
 {
     Tag t = new Tag (Catalog.GetString ("New tag"), g.nameEntry.Text);
     EventType.Tags.Add (t);
     g.tags.Add (t);
     g.container.Remove (g.table);
     g.container.PackStart (CreateTagsTable (g), true, true, 0);
     g.container.ShowAll ();
     if (focusEntry != null) {
         focusEntry.GrabFocus ();
     }
 }
示例#9
0
        void CreateTagBox(Table t, Tag tag, int i, TagsGroup g)
        {
            HBox box = new HBox (false, 2);
            Entry tagEntry = new Entry (tag.Value);
            Label hotkeyLabel = new Label (tag.HotKey.ToString ());
            Button editHK = Button ("gtk-edit");
            Button b = Button ("gtk-remove");

            b.Clicked += (sender, e) => RemoveTag (tag, g);

            editHK.Clicked += (sender, e) => {
                HotKey hotkey = Config.GUIToolkit.SelectHotkey (tag.HotKey);
                if (hotkey != null) {
                    try {
                        if (EventType.Tags.Select (tt => tt.HotKey).Contains (hotkey)) {
                            throw new HotkeyAlreadyInUse (hotkey);
                        }
                        tag.HotKey = hotkey;
                        hotkeyLabel.Text = hotkey.ToString ();
                    } catch (HotkeyAlreadyInUse ex) {
                        Config.GUIToolkit.ErrorMessage (ex.Message, this);
                    }
                }
            };

            tagEntry.Changed += (o, e) => {
                tag.Value = tagEntry.Text;
            };
            focusEntry = tagEntry;

            box.PackStart (tagEntry, false, false, 0);
            box.PackStart (hotkeyLabel, false, false, 0);
            box.PackStart (editHK, false, false, 0);
            box.PackStart (b, false, false, 0);
            InsertInTable (t, box, i);
        }
示例#10
0
        void FillTags(Project project, TimelineEvent evt)
        {
            Dictionary<string, List<Tag>> tagsByGroup;
            SizeGroup sgroup = new SizeGroup (SizeGroupMode.Horizontal);

            if (evt.EventType is AnalysisEventType) {
                tagsByGroup = (evt.EventType as AnalysisEventType).TagsByGroup;
            } else {
                tagsByGroup = new Dictionary<string, List<Tag>> ();
            }

            tagsByGroup = tagsByGroup.Concat (project.Dashboard.CommonTagsByGroup)
                .ToDictionary (x => x.Key, x => x.Value);

            tagsvbox.PackStart (new HSeparator ());
            foreach (string grp in tagsByGroup.Keys) {
                HBox box = new HBox ();
                Label label = new Label (String.IsNullOrEmpty (grp) ? Catalog.GetString ("Common tags") : grp);
                List<Tag> tags = tagsByGroup [grp];
                Table tagstable = new Table ((uint)(tags.Count / TAGS_PER_ROW), TAGS_PER_ROW, true);
                RadioButton first = null;
                Tag noneTag = new Tag (Catalog.GetString ("None"));

                label.WidthRequest = 200;
                if (!String.IsNullOrEmpty (grp)) {
                    tags.Insert (0, noneTag);
                }

                for (int i = 0; i < tags.Count; i++) {
                    uint row_top, row_bottom, col_left, col_right;
                    Tag t = tags [i];
                    CheckButton tb;

                    if (String.IsNullOrEmpty (grp)) {
                        tb = new CheckButton (t.Value);
                    } else {
                        if (first == null) {
                            tb = first = new RadioButton (t.Value);
                        } else {
                            tb = new RadioButton (first, t.Value);
                        }
                    }
                    tb.Active = evt.Tags.Contains (t);
                    tb.Toggled += (sender, e) => {
                        if (tb.Active && t != noneTag) {
                            evt.Tags.Add (t);
                        } else {
                            evt.Tags.Remove (t);
                        }
                    };
                    row_top = (uint)(i / tagstable.NColumns);
                    row_bottom = (uint)row_top + 1;
                    col_left = (uint)i % tagstable.NColumns;
                    col_right = (uint)col_left + 1;
                    tagstable.Attach (tb, col_left, col_right, row_top, row_bottom);
                }
                sgroup.AddWidget (label);
                box.PackStart (label, false, true, 0);
                box.PackEnd (tagstable, true, true, 0);
                box.Spacing = 5;
                tagsvbox.PackStart (box, false, true, 0);
                tagsvbox.PackStart (new HSeparator ());
            }
            tagsvbox.ShowAll ();
        }
示例#11
0
 void TagClicked(Tag tag)
 {
     if (SelectedTags.Contains (tag)) {
         SelectedTags.Remove (tag);
     } else {
         SelectedTags.RemoveAll (t => t.Group == tag.Group);
         SelectedTags.Add (tag);
     }
     if (Button.TagMode == TagMode.Free) {
         StartRecording ();
     } else {
         Active = true;
         delayEvent = true;
     }
     ReDraw ();
 }
示例#12
0
        void AddSubcatAnchor(Tag tag, Point point, double width, double height)
        {
            LinkAnchorObject anchor;

            if (subcatAnchors.ContainsKey (tag)) {
                anchor = subcatAnchors [tag];
                anchor.RelativePosition = point;
            } else {
                anchor = new LinkAnchorObject (this, new List<Tag> { tag }, point);
                anchor.RedrawEvent += (co, area) => {
                    EmitRedrawEvent (anchor, area);
                };
                subcatAnchors.Add (tag, anchor);
            }
            anchor.Width = width;
            anchor.Height = height;
        }
示例#13
0
 public void ClickTag(Tag tag)
 {
     SelectedTags.Add (tag);
     ReDraw ();
 }