Inheritance: SelectionCanvas
        public override void EditPlayer(Text text)
        {
            playerText = text;
            if (playerDialog == null) {
                Gtk.Dialog d = new Gtk.Dialog (Catalog.GetString ("Select player"),
                                   this, DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                   Stock.Cancel, ResponseType.Cancel);
                d.WidthRequest = 600;
                d.HeightRequest = 400;

                DrawingArea da = new DrawingArea ();
                TeamTagger tagger = new TeamTagger (new WidgetWrapper (da));
                tagger.ShowSubstitutionButtons = false;
                tagger.LoadTeams ((ViewModel.Project as ProjectLongoMatch).LocalTeamTemplate, (ViewModel.Project as ProjectLongoMatch).VisitorTeamTemplate,
                                  (ViewModel.Project as ProjectLongoMatch).Dashboard.FieldBackground);
                tagger.PlayersSelectionChangedEvent += players => {
                    if (players.Count == 1) {
                        Player p = players [0];
                        playerText.Value = p.ToString ();
                        d.Respond (ResponseType.Ok);
                    }
                    tagger.ResetSelection ();
                };
                d.VBox.PackStart (da, true, true, 0);
                d.ShowAll ();
                playerDialog = d;
            }
            if (playerDialog.Run () != (int)ResponseType.Ok) {
                text.Value = null;
            }
            playerDialog.Hide ();
        }
Example #2
0
 public PlayEditor(Window parent)
 {
     TransientFor = parent;
     this.Build ();
     teamtagger = new TeamTagger (new WidgetWrapper (drawingarea3));
     teamtagger.Compact = true;
     teamtagger.ShowSubstitutionButtons = false;
     teamtagger.SelectionMode = MultiSelectionMode.Multiple;
     teamtagger.PlayersSelectionChangedEvent += HandlePlayersSelectionChangedEvent;
     teamtagger.TeamSelectionChangedEvent += HandleTeamSelectionChangedEvent;
     teamtagger.ShowTeamsButtons = true;
     nameentry.Changed += HandleChanged;
 }
        public TeamTemplateEditor()
        {
            this.Build ();

            teamtagger = new TeamTagger (new WidgetWrapper (drawingarea));
            teamtagger.SelectionMode = MultiSelectionMode.MultipleWithModifier;
            teamtagger.PlayersSelectionChangedEvent += HandlePlayersSelectionChangedEvent;
            teamtagger.PlayersSubstitutionEvent += HandlePlayersSubstitutionEvent;
            shieldimage.HeightRequest = shieldvbox.WidthRequest = SHIELD_SIZE;
            colorbutton1.Color = Misc.ToGdkColor (Color.Red1);
            colorbutton1.ColorSet += HandleColorSet;
            colorbutton2.Color = Misc.ToGdkColor (Color.Green1);
            colorbutton2.ColorSet += HandleColorSet;

            ConnectSignals ();

            ClearPlayer ();
        }
Example #4
0
        public CodingWidget()
        {
            this.Build ();

            LoadIcons ();

            notebook.ShowBorder = false;
            notebook.Group = this.Handle;
            notebook.SwitchPage += HandleSwitchPage;
            Notebook.WindowCreationHook = CreateNewWindow;
            activeWindows = new List<Window> ();

            notebook.Page = 0;

            teamtagger = new TeamTagger (new WidgetWrapper (teamsdrawingarea));
            teamtagger.SelectionMode = MultiSelectionMode.Multiple;
            teamtagger.PlayersSelectionChangedEvent += HandlePlayersSelectionChangedEvent;
            teamtagger.PlayersSubstitutionEvent += HandlePlayersSubstitutionEvent;
            teamtagger.Compact = true;
            teamtagger.ShowTeamsButtons = true;

            teamsdrawingarea.HeightRequest = 200;
            teamsdrawingarea.WidthRequest = 300;
            timeline.HeightRequest = 200;
            playspositionviewer1.HeightRequest = 200;

            App.Current.EventsBroker.Subscribe<PlayerTickEvent> (HandleTick);
            App.Current.EventsBroker.Subscribe<CapturerTickEvent> (HandleCapturerTick);
            App.Current.EventsBroker.Subscribe<EventLoadedEvent> (HandlePlayLoaded);
            App.Current.EventsBroker.Subscribe<EventsDeletedEvent> (HandleEventsDeletedEvent);
            App.Current.EventsBroker.Subscribe<TimeNodeStoppedEvent> (HandleTimeNodeStoppedEvent);
            App.Current.EventsBroker.Subscribe<EventEditedEvent> (HandleEventEdited);

            Helpers.Misc.SetFocus (this, false);

            buttonswidget.Mode = DashboardMode.Code;
            buttonswidget.FitMode = FitMode.Fit;
            buttonswidget.ButtonsVisible = true;
            buttonswidget.NewTagEvent += HandleNewTagEvent;

            dashboardhpaned.SizeAllocated += HandleSizeAllocated;
            TagPositions = true;
        }
 public SubstitutionsEditor(Window parent)
 {
     TransientFor = parent;
     this.Build ();
     tagger = new TeamTagger (new WidgetWrapper (drawingarea));
     tagger.PlayersSelectionChangedEvent += HandlePlayersSelectionChangedEvent;
     tagger.PlayersSubstitutionEvent += HandlePlayersSubstitutionEvent;
     incanvas = new SelectionCanvas (new WidgetWrapper (drawingarea2));
     outcanvas = new SelectionCanvas (new WidgetWrapper (drawingarea3));
     inpo = new SportsPlayerObject ();
     outpo = new SportsPlayerObject ();
     inpo.ClickedEvent += HandleClickedEvent;
     outpo.ClickedEvent += HandleClickedEvent;
     inpo.Size = PLAYER_SIZE;
     outpo.Size = PLAYER_SIZE;
     inpo.Center = new Point (PLAYER_SIZE / 2, PLAYER_SIZE / 2);
     outpo.Center = new Point (PLAYER_SIZE / 2, PLAYER_SIZE / 2);
     incanvas.AddObject (inpo);
     outcanvas.AddObject (outpo);
     drawingarea2.WidthRequest = drawingarea2.HeightRequest = PLAYER_SIZE;
     drawingarea3.WidthRequest = drawingarea3.HeightRequest = PLAYER_SIZE;
 }
Example #6
0
        void LoadTeams(Project project)
        {
            List<Team> teams;
            bool hasLocalTeam = false;
            bool hasAwayTeam = false;

            drawingarea.HeightRequest = 200;
            teamtagger = new TeamTagger (new WidgetWrapper (drawingarea));
            teamtagger.ShowMenuEvent += HandleShowMenuEvent;
            teamtagger.SubstitutionMode = true;
            teamtagger.ShowSubstitutionButtons = false;
            teamtagger.PlayersSubstitutionEvent += HandlePlayersSubstitutionEvent;
            teams = Config.TeamTemplatesProvider.Templates;

            // Fill the combobox with project values or the templates ones
            if (project != null) {
                if (project.LocalTeamTemplate != null)
                    hasLocalTeam = true;
                if (project.VisitorTeamTemplate != null)
                    hasAwayTeam = true;
            }

            // Update the combobox
            if (hasAwayTeam) {
                awayteamscombobox.Load (new List<Team> { project.VisitorTeamTemplate });
            } else {
                awayteamscombobox.Load (teams);
                awayteamscombobox.Changed += (sender, e) => {
                    LoadTemplate (awayteamscombobox.ActiveTeam.Clone (), TeamType.VISITOR, false);
                };
            }

            if (hasLocalTeam) {
                hometeamscombobox.Load (new List<Team> { project.LocalTeamTemplate });
            } else {
                hometeamscombobox.Load (teams);
                hometeamscombobox.Changed += (sender, e) => {
                    LoadTemplate (hometeamscombobox.ActiveTeam.Clone (), TeamType.LOCAL, false);
                };

            }

            hometeamscombobox.Active = 0;
            awayteamscombobox.Active = teams.Count == 1 ? 0 : 1;
        }