void CreateTitleLabels()
        {
            nfloat labelWidth = _sheetFrame.Width - 2 * _xMargin;

            // Create the window title label.
            _yCurr -= _labelHeight;
            var titleLabelRect = new CGRect(_xMargin, _yCurr, labelWidth, _labelHeight);
            var titleLabel     = ControlsFactory.NewStandardLabel(titleLabelRect);

            titleLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
            titleLabel.StringValue = "Uncombine film";
            View.AddSubview(titleLabel);

            // Create the instruction label.
            _yCurr -= _labelHeight + _yLabelsDistance;
            var instructionLabelRect = new CGRect(_xMargin, _yCurr, labelWidth, _labelHeight);
            var instructionLabel     = ControlsFactory.NewStandardLabel(instructionLabelRect);

            instructionLabel.Font        = NSFont.LabelFontOfSize(NSFont.LabelFontSize);
            instructionLabel.StringValue = "Create multiple films, one per distinct screening title";
            View.AddSubview(instructionLabel);

            // Set sample view used to disable resizing.
            _sampleView = titleLabel;
        }
Ejemplo n.º 2
0
        private void CreateActionButtons()
        {
            var xCurr = View.Frame.Width;

            // Create the Plan button.
            xCurr                    -= _xMargin + _controlsWidth;
            _planButton               = ControlsFactory.NewStandardButton(new CGRect(xCurr, _yXcodeControlsMargin, _controlsWidth, _controlsHeight));
            _planButton.Title         = "Plan";
            _planButton.Enabled       = true;
            _planButton.KeyEquivalent = ControlsFactory.EnterKey;
            _planButton.Action        = new ObjCRuntime.Selector("PlanScreenings:");
            View.AddSubview(_planButton);

            // Create the Undo Planning button.
            xCurr                -= _xDistance + _controlsWidth;
            _unplanButton         = ControlsFactory.NewStandardButton(new CGRect(xCurr, _yXcodeControlsMargin, _controlsWidth, _controlsHeight));
            _unplanButton.Title   = "Unplan";
            _unplanButton.Enabled = ScreeningsPlan.Screenings.Count(s => s.AutomaticallyPlanned) >= 1;
            _unplanButton.Action  = new ObjCRuntime.Selector("UnplanScreenings:");
            View.AddSubview(_unplanButton);

            // Create the Close button.
            xCurr -= _xDistance + _controlsWidth;
            var doneButton = ControlsFactory.NewCancelButton(new CGRect(xCurr, _yXcodeControlsMargin, _controlsWidth, _controlsHeight));

            doneButton.Title  = "Close";
            doneButton.Action = new ObjCRuntime.Selector("ClosePlanView:");
            View.AddSubview(doneButton);
        }
Ejemplo n.º 3
0
        private void CreateFilmFanCheckboxes(NSView view, CGPoint boxAnchor, List <DateTime> days, bool usePerDayDict = true)
        {
            // Initialize the model rectangle.
            var boxRect = new CGRect(boxAnchor.X, boxAnchor.Y, _controlWidth, _labelHeight);

            foreach (var fan in ScreeningInfo.FilmFans)
            {
                // Populate the checkbox.
                var box = ControlsFactory.NewCheckbox(boxRect);
                box.Title            = string.Empty;
                box.Activated       += (s, e) => SetAvailability(s, fan, days);
                box.AllowsMixedState = true;
                view.AddSubview(box);

                // Update the indicated controls dictionary.
                if (usePerDayDict)
                {
                    UpdateControlByFanByDayDictionary(box, fan, days);
                }
                else
                {
                    _checkboxByFan.Add(fan, box);
                }

                // Update the horizontal position.
                boxRect.X += _controlWidth + _xBetweenControls;
            }
        }
        void CreateCancelButton()
        {
            CGRect   cancelButtonRect = new CGRect(_xMargin, _yMargin, _cancelButtonWidth, _buttonHeight);
            NSButton cancelButton     = ControlsFactory.NewCancelButton(cancelButtonRect);

            cancelButton.Action = new ObjCRuntime.Selector("CancelUncombine:");
            View.AddSubview(cancelButton);
        }
        void CreateScrollView()
        {
            _yCurr -= _scrollerFrame.Height + _separateHeight;

            _screeningsView = new NSView(_screeningsFrame);

            var scrollView = ControlsFactory.NewStandardScrollView(_scrollerFrame, _screeningsView);

            View.AddSubview(scrollView);
        }
Ejemplo n.º 6
0
        private void CreateActionButtons()
        {
            var xCurr = View.Frame.Width;

            // Create the Close button.
            xCurr -= _xBetweenControls + _controlWidth;
            var rect = new CGRect(xCurr, _yControlsMargin, _controlWidth, _controlHeight);

            _doneButton        = ControlsFactory.NewCancelButton(rect);
            _doneButton.Action = new ObjCRuntime.Selector("CloseAvailabilityDialog:");
            View.AddSubview(_doneButton);
        }
Ejemplo n.º 7
0
        private void CreateInstructionsLabel()
        {
            var labelHeight = 2 * _labelHeight + 2;

            _yCurr -= labelHeight;
            var rect             = new CGRect(_xMargin, _yCurr, _contentWidth, labelHeight);
            var instructionLabel = ControlsFactory.NewStandardLabel(rect, true);

            instructionLabel.StringValue   = $"Check the boxes to indicate availability for the {AppDelegate.Festival} {AppDelegate.FestivalYear} festival days";
            instructionLabel.LineBreakMode = NSLineBreakMode.ByWordWrapping;
            View.AddSubview(instructionLabel);
        }
        private void CreateFilmTitleLabel()
        {
            _yCurr -= _labelHeight;
            var rect           = new CGRect(_xMargin, _yCurr, _contentWidth, _labelHeight);
            var filmTitleLabel = ControlsFactory.NewStandardLabel(rect, UseTitleBackground);

            filmTitleLabel.StringValue = _film.Title;
            filmTitleLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
            View.AddSubview(filmTitleLabel);

            // Set sample view used to disable resizing.
            _sampleView = filmTitleLabel;
        }
Ejemplo n.º 9
0
        private void CreateFilmFanLabels()
        {
            _yCurr -= _labelHeight;
            var xCurr = _xMargin + _labelWidth + _xBetweenControls;
            var rect  = new CGRect(xCurr, _yCurr, _labelWidth, _labelHeight);

            foreach (var fan in ScreeningInfo.FilmFans)
            {
                var fanLabel = ControlsFactory.NewStandardLabel(rect, true);
                fanLabel.StringValue = fan;
                fanLabel.Font        = NSFont.BoldSystemFontOfSize(NSFont.SystemFontSize);
                View.AddSubview(fanLabel);
                xCurr += _controlWidth + _xBetweenControls;
                rect.X = xCurr;
            }
        }
        private void CreateTitlesScrollView()
        {
            // Create the scroll view to display the title radio buttons.
            nfloat yScrollView      = 2 * _yXcodeControlsMargin + _bottomControlsHeight;
            nfloat scrollViewHeight = View.Frame.Height - _yXcodeControlsMargin - 2 * (_topLabelsHeigh + _yToplabelsDistance) - yScrollView;
            CGRect scrollViewFrame  = new CGRect(_xMargin, yScrollView, _scrollViewWidth, scrollViewHeight);
            var    titlesScrollView = ControlsFactory.NewStandardScrollView(scrollViewFrame, _titlesDocumentView);

            View.AddSubview(titlesScrollView);

            // Create labels with the film titles.
            PopulateTitlesDocumentView();

            // Set sample view used to disable resizing.
            _sampleView = titlesScrollView;
        }
        void CreateUncombineButton()
        {
            nfloat   splitButtonX     = _xMargin + _cancelButtonWidth + _xControlsDistance;
            nfloat   splitButtonWidth = _sheetFrame.Width - splitButtonX - _xMargin;
            CGRect   splitButtonRect  = new CGRect(splitButtonX, _yMargin, splitButtonWidth, _buttonHeight);
            NSButton splitButton      = ControlsFactory.NewStandardButton(splitButtonRect);

            splitButton.Action = new ObjCRuntime.Selector("UncombineFilms:");
            int  filmCount = _distinctTitles.Count();
            bool enable    = filmCount > 1;

            splitButton.Enabled       = enable;
            splitButton.Title         = string.Format(_enabledToLabelTitle[enable], filmCount);
            splitButton.KeyEquivalent = ControlsFactory.EnterKey;
            View.AddSubview(splitButton);
        }
Ejemplo n.º 12
0
        public static void DisplayScreeningControls(
            List <Screening> screenings,
            NSView screeningsView,
            GoToScreeningDelegate goToScreening,
            ref FilmScreeningControl currentScreeningControl)
        {
            // Initialize the dictionary to find labels by screening.
            _labelByfilmScreening = new Dictionary <Screening, NSTextField> {
            };

            // Initialize dimensions.
            var xLabel       = _buttonWidth + _xBetweenLabels;
            var yScreening   = screeningsView.Frame.Height;
            var contentWidth = screeningsView.Frame.Width;
            var buttonRect   = new CGRect(0, yScreening, _buttonWidth, _labelHeight);
            var labelRect    = new CGRect(xLabel, yScreening, contentWidth - xLabel, _labelHeight);

            foreach (var screening in screenings)
            {
                // Update the vertical position.
                yScreening -= _labelHeight;

                // Create the screening info button.
                buttonRect.Y = yScreening;
                var infoButton = new FilmScreeningControl(buttonRect, screening);
                infoButton.ReDraw();
                infoButton.ScreeningInfoAsked += (sender, e) => goToScreening(screening);
                if (screening == _app.Controller.CurrentScreening)
                {
                    currentScreeningControl          = infoButton;
                    currentScreeningControl.Selected = true;
                }
                screeningsView.AddSubview(infoButton);

                // Create the screening label.
                labelRect.Y = yScreening;
                var screeningLabel = ControlsFactory.NewStandardLabel(labelRect);
                screeningLabel.StringValue = screening.ToFilmScreeningLabelString();
                ColorView.SetScreeningColor(screening, screeningLabel);
                screeningsView.AddSubview(screeningLabel);

                // Link the label to the screening.
                _labelByfilmScreening.Add(screening, screeningLabel);

                yScreening -= _yBetweenLabels;
            }
        }
Ejemplo n.º 13
0
        private void CreateAllDaysCheckboxes()
        {
            _yCurr -= _labelHeight;

            // Create a label indicating that the checkboxes in this row apply
            // to all festival days.
            var labelRect = new CGRect(_xMargin, _yCurr, _labelWidth, _labelHeight);
            var label     = ControlsFactory.NewStandardLabel(labelRect, true);

            label.StringValue = $"All {FestivalDays.Count} days";
            View.AddSubview(label);

            // Create a checkbox for each film fan.
            var xBox      = _xMargin + _labelWidth + _xBetweenControls;
            var boxAnchor = new CGPoint(xBox, _yCurr);

            CreateFilmFanCheckboxes(View, boxAnchor, FestivalDays, false);
        }
Ejemplo n.º 14
0
        private void CreatePerDayCheckboxes()
        {
            // Create the document view.
            var n              = FestivalDays.Count;
            var documentWidth  = View.Frame.Width - 2 * _xMargin;
            var documentHeight = n * _labelHeight + (n - 1) * _yBetweenLabels;
            var documentFrame  = new CGRect(0, 0, documentWidth, documentHeight);
            var documentView   = new NSView(documentFrame);

            // Create the scroll view.
            var scrollerHeight = _yCurr - _yControlsMargin - _controlHeight - _yBetweenControls;

            _yCurr -= scrollerHeight;
            var scrollerFrame = new CGRect(_xMargin, _yCurr, documentWidth, scrollerHeight);
            var scrollerView  = ControlsFactory.NewStandardScrollView(scrollerFrame, documentView, true);

            View.AddSubview(scrollerView);

            // Populate the document view.
            var yCurr     = documentView.Frame.Height - _labelHeight;
            var labelRect = new CGRect(0, yCurr, _labelWidth, _labelHeight);

            foreach (var day in FestivalDays)
            {
                // Create the day label.
                var label = ControlsFactory.NewStandardLabel(labelRect, true);
                label.StringValue = Screening.LongDayString(day);
                documentView.AddSubview(label);

                // Create the film fan checkboxes.
                var xCurr        = _labelWidth + _xBetweenControls;
                var daySingleton = new List <DateTime> {
                    day
                };
                CreateFilmFanCheckboxes(documentView, new CGPoint(xCurr, yCurr), daySingleton);

                // Update the vertical position.
                yCurr      -= _labelHeight + _yBetweenLabels;
                labelRect.Y = yCurr;
            }

            // Set sample view used to disable resizing.
            _sampleView = scrollerView;
        }
Ejemplo n.º 15
0
        private void CreateScrollView()
        {
            // Create the document view displaying information on unplanned films.
            var docRect = new CGRect(0, 0, _scrollViewWidth, _scrollViewHeight);

            _filmsDocumentView             = ControlsFactory.NewStandardLabel(docRect, true);
            _filmsDocumentView.StringValue = InstructionsString();

            // Create the scroll view.
            var scrollViewFrame = new CGRect(_xMargin, _yScrollView, _scrollViewWidth, _scrollViewHeight);

            _filmsScrollView = ControlsFactory.NewStandardScrollView(scrollViewFrame, _filmsDocumentView, true);
            View.AddSubview(_filmsScrollView);

            // Scroll to the instruction text.
            var yScroll = _filmsDocumentView.Frame.Height - _filmsScrollView.Frame.Height;

            _filmsScrollView.ContentView.ScrollToPoint(new CGPoint(0, yScroll));
        }
        private void CreateFilmSummaryBox(float boxHeight)
        {
            // Create a text box to contain the film info.
            var docRect = new CGRect(0, 0, _contentWidth, _summaryBoxHeight);

            _summaryField = new NSTextField(docRect);
            InitiateSummaryFieldText();
            var fit = _summaryField.SizeThatFits(_summaryField.Frame.Size);

            _summaryField.SetFrameSize(fit);

            // Create a scroll view to display the film info.
            _yCurr -= boxHeight;
            var rect = new CGRect(_xMargin, _yCurr, _contentWidth, boxHeight);

            _summaryScrollView = ControlsFactory.NewStandardScrollView(rect, _summaryField);
            _summaryScrollView.ContentView.ScrollToPoint(new CGPoint(0, 0));
            View.AddSubview(_summaryScrollView);
        }
        private void CreateBottomButtons()
        {
            var xCurr = _xMargin + _contentWidth;

            // Create the close button.
            xCurr -= _buttonWidth;
            var cancelButtonRect = new CGRect(xCurr, _yMargin, _buttonWidth, _buttonHeight);

            _cancelButton        = ControlsFactory.NewCancelButton(cancelButtonRect);
            _cancelButton.Title  = "Close";
            _cancelButton.Action = new ObjCRuntime.Selector("CancelGotoScreening:");
            View.AddSubview(_cancelButton);

            // Create the website button.
            xCurr -= _imageButtonWidth;
            NSButton websiteButton = ControlsFactory.NewVisitWebsiteButton(xCurr, _yMargin, _film);

            websiteButton.Enabled = true;
            View.AddSubview(websiteButton);
        }
        private void PopulateTitlesDocumentView()
        {
            // Define dimensions.
            nfloat radioButtonWidth = _titlesDocumentView.Frame.Width - 2 * _xMargin - _xDistance - _labelWidth;
            nfloat xLabel           = _titlesDocumentView.Frame.Width - _xMargin - _labelWidth;

            // Create a vertical list of radiobuttons.
            nfloat yCurr = _titlesDocumentView.Frame.Height;

            foreach (var filmIndex in _filmIndexes)
            {
                // Add an item to the film id list.
                Film film = Presentor.GetFilmByIndex(filmIndex);
                _filmIds.Add(film.FilmId);

                // Adjust the vertical position with control height.
                yCurr -= _controlsHeight;

                // Create a radio button for the film title.
                CGRect   radioButtonRect  = new CGRect(_xMargin, yCurr, radioButtonWidth, _controlsHeight);
                NSButton titleRadioButton = new NSButton(radioButtonRect);
                titleRadioButton.SetButtonType(NSButtonType.Radio);
                titleRadioButton.Action = new ObjCRuntime.Selector("MainTitleChanged:");
                titleRadioButton.State  = film.FilmId == _mainFilmId ? NSCellStateValue.On : NSCellStateValue.Off;
                titleRadioButton.Tag    = film.FilmId;
                titleRadioButton.Title  = film.Title;
                _titlesDocumentView.AddSubview(titleRadioButton);

                // Create a label for the rating.
                CGRect      labelRect   = new CGRect(xLabel, yCurr, _labelWidth, _controlsHeight);
                NSTextField ratingLabel = ControlsFactory.NewStandardLabel(labelRect);
                ratingLabel.Alignment   = NSTextAlignment.Right;
                ratingLabel.StringValue = Presentor.GetFilmByIndex(filmIndex).Rating.ToString();
                _titlesDocumentView.AddSubview(ratingLabel);

                // Ajust the vertical position with the distance between two controls.
                yCurr -= _yControlsDistance;
            }
        }
        private void CreateScreeningsScrollView()
        {
            // Get the screenings of the selected film.
            var screenings = _film.FilmScreenings;

            // Create the screenings view.
            var yScreenings         = screenings.Count * (_labelHeight + _yBetweenLabels);
            var screeningsViewFrame = new CGRect(0, 0, _contentWidth, yScreenings);
            var screeningsView      = new NSView(screeningsViewFrame);

            // Create the scroll view.
            _yCurr -= _scrollViewHeight;
            var scrollViewFrame = new CGRect(_xMargin, _yCurr, _contentWidth, _scrollViewHeight);
            var scrollView      = ControlsFactory.NewStandardScrollView(scrollViewFrame, screeningsView);

            View.AddSubview(scrollView);

            // Display the screenings.
            GoToScreeningDialog.DisplayScreeningControls(screenings, screeningsView, GoToScreening, ref _currentScreeningControl);

            // Scroll to the selected screening.
            GoToScreeningDialog.ScrollScreeningToVisible(App.Controller.CurrentScreening, scrollView);
        }