public void Scale()
        {
            new DpiScaler <DeckListControl>(c => c._textSelectionCursor = createTextSelectionCursor())
            .Setup(this);

            _labelSortStatus.ScaleDpiAuto();
            _searchBar.ScaleDpi();
            _menuFilterByDeckMode.ScaleDpi();

            scaleLayoutView(_viewDeck);

            _labelFilterByDeckMode.ScaleDpiFont();
            _textboxRename.ScaleDpiFont();

            Cursor createTextSelectionCursor()
            {
                var iBeamIcon           = Resources.text_selection_24.ResizeDpi();
                var iBeamHotSpot        = new Size(iBeamIcon.Width / 2, iBeamIcon.Height / 2);
                var textSelectionCursor = CursorHelper.CreateCursor(iBeamIcon, iBeamHotSpot);

                return(textSelectionCursor);
            }
        }
Exemple #2
0
        public void Init(
            DeckListModel decks,
            IconRecognizer recognizer,
            DeckSearcher searcher,
            DeckDocumentAdapter adapter,
            CollectionEditorModel collection,
            Control tooltipOwner)
        {
            _listModel       = decks;
            _tooltipOwner    = tooltipOwner;
            _collection      = collection;
            searcher.Loaded += indexLoaded;

            _viewDeck.IconRecognizer    = recognizer;
            _viewDeck.LayoutControlType = typeof(DeckListLayout);
            _viewDeck.DataSource        = _filteredModels;

            var iBeamIcon    = Resources.text_selection_24.ResizeDpi();
            var iBeamHotSpot = new Size(iBeamIcon.Width / 2, iBeamIcon.Height / 2);

            _textSelectionCursor = CursorHelper.CreateCursor(iBeamIcon, iBeamHotSpot);

            _textBoxName.Visible = false;

            _layoutViewTooltip = new ViewDeckListTooltips(_tooltipOwner, _viewDeck);

            _searchSubsystem = new DeckSearchSubsystem(
                this,
                _textBoxSearch,
                _panelSearchIcon,
                _listBoxSuggest,
                searcher,
                adapter,
                _viewDeck);

            _searchSubsystem.TextApplied += searchTextApplied;
            _searchSubsystem.SubscribeToEvents();

            _menuFilterByDeckMode.SelectedIndex = 0;

            _viewDeck.MouseClicked     += viewDeckClicked;
            _viewDeck.RowDataLoaded    += viewDeckRowDataLoaded;
            _viewDeck.CardIndexChanged += viewScrolled;

            _textBoxName.LostFocus += nameLostFocus;
            _textBoxName.KeyDown   += nameKeyDown;

            _menuFilterByDeckMode.SelectedIndexChanged += filterByDeckModeChanged;

            _layoutViewTooltip.SubscribeToEvents();

            _highlightSubsystem = new SearchResultHighlightSubsystem(_viewDeck, _searchSubsystem, adapter);
            _highlightSubsystem.SubscribeToEvents();

            _viewDeck.MouseMove += deckMouseMove;

            _deckSort              = new DeckSortSubsystem(_viewDeck, new DeckFields(), _searchSubsystem, _listModel);
            _deckSort.SortChanged += sortChanged;
            _deckSort.SubscribeToEvents();

            _model           = _listModel.CreateModel(Deck.Create());
            _model.IsCurrent = true;

            if (_listModel.IsLoaded)
            {
                listModelLoaded();
            }
            else
            {
                _listModel.Loaded += listModelLoaded;
            }

            searcher.Loaded += searcherLoaded;

            if (searcher.IsLoaded)
            {
                _searchSubsystem.Apply();
            }

            updateSortLabel();
        }