public DeckEditorUi( MtgLayoutView layoutViewCards, MtgLayoutView layoutViewDeck, DeckEditorModel deckEditorModel, CollectionEditorModel collectionModel, DraggingSubsystem draggingSubsystem, Cursor cursor, FormZoom formZoom, Control parent) { _layoutViewCards = layoutViewCards; _layoutViewDeck = layoutViewDeck; _cursor = cursor; _deckEditorModel = deckEditorModel; _collectionModel = collectionModel; _draggingSubsystem = draggingSubsystem; _draggingSubsystem.DraggedLikeClick += draggedLikeClick; _draggingSubsystem.DragRemoved += dragRemoved; _draggingSubsystem.DragAdded += dragAdded; _layoutViewCards.SelectionStarted += selectionStarted; _formZoom = formZoom; _parent = parent; var hotSpot = Size.Empty.ByDpi(); _zoomCursor = CursorHelper.CreateCursor(Resources.zoom_48.HalfResizeDpi(), hotSpot); var iBeamIcon = Resources.text_selection_24.ResizeDpi(); var iBeamHotSpot = new Size(iBeamIcon.Width / 2, iBeamIcon.Height / 2); _textSelectionCursor = CursorHelper.CreateCursor(iBeamIcon, iBeamHotSpot); }
public void Init( DeckListModel decks, IconRecognizer recognizer, DeckSearcher searcher, DeckDocumentAdapter adapter, CollectionEditorModel collection, UiConfigRepository uiConfigRepository, Control tooltipOwner, IApplication app) { _searcher = searcher; _uiConfigRepository = uiConfigRepository; _panelRename.Visible = false; _viewDeck.IconRecognizer = recognizer; _viewDeck.DataSource = _filteredModels; _menuFilterByDeckMode.SetMenuValues( "Ignored", "Cards in currently open deck", "Cards in saved decks matching filter"); _menuFilterByDeckMode.SelectedIndex = 0; _listModel = decks; _collection = collection; _tooltipOwner = tooltipOwner; _app = app; _searchSubsystem = new DeckSearchSubsystem( this, _searchBar, uiConfigRepository, _searcher, adapter, _viewDeck); _deckSort = new DeckSortSubsystem(_viewDeck, new DeckFields(), _searchSubsystem, _listModel); _layoutViewTooltip = new ViewDeckListTooltips(_tooltipOwner, _viewDeck); _model = _listModel.CreateModel(Deck.Create()); _model.IsCurrent = true; subscribeToEvents(); updateSortLabel(); if (components == null) { components = new Container(); } components.Add(new SearchResultHighlightSubsystem(_viewDeck, _searchSubsystem, adapter)); _searchSubsystem.Apply(); }
public DeckListModel( CardRepository repo, CollectedCardsDeckTransformation transformation, CollectionEditorModel collection) { _repo = repo; _transformation = transformation; _collectionEditor = collection; _collectionEditor.CollectionChanged += collectionChanged; _state.Collection = _collectionEditor.Snapshot(); _repo.PriceLoadingComplete += priceLoadingComplete; }
public CopyPasteSubsystem( CardRepository cardRepo, DeckSerializationSubsystem serialization, CollectionEditorModel collection, DeckEditorModel deckEditor, FormMain targetForm, DeckListControl deckListControl, params Control[] targetControls) { _cardRepo = cardRepo; _serialization = serialization; _collection = collection; _deckEditor = deckEditor; _targetForm = targetForm; _deckListControl = deckListControl; _targetControls = targetControls; }
public DeckListModel( CardRepository repo, CollectedCardsDeckTransformation transformation, CollectionEditorModel collection) { _repo = repo; _transformation = transformation; _collectionEditor = collection; _collectionEditor.CollectionChanged += collectionChanged; _state.Collection = _collectionEditor.Snapshot(); _repo.PriceLoadingComplete += priceLoadingComplete; Serializer = new JsonSerializer(); Serializer.Converters.Add( new UnformattedJsonConverter(type => typeof(IEnumerable <int>).IsAssignableFrom(type))); }
public DeckListModel( CardRepository repo, PriceRepository priceRepo, CollectedCardsDeckTransformation transformation, CollectionEditorModel collection, IApplication app) { _app = app; _repo = repo; _priceRepo = priceRepo; _transformation = transformation; _collectionEditor = collection; _state.Collection = _collectionEditor.Snapshot(); _serializer = new JsonSerializer(); _serializer.Converters.Add( new UnformattedJsonConverter(type => typeof(IEnumerable <int>).IsAssignableFrom(type))); }
public DeckEditorSubsystem( MtgLayoutView layoutViewCards, MtgLayoutView layoutViewDeck, DeckEditorModel deckEditorModel, CollectionEditorModel collectionModel, DraggingSubsystem draggingSubsystem, Cursor cursor, FormZoom formZoom, Control parent) { _layoutViewCards = layoutViewCards; _layoutViewDeck = layoutViewDeck; _cursor = cursor; _deckEditorModel = deckEditorModel; _collectionModel = collectionModel; _draggingSubsystem = draggingSubsystem; _draggingSubsystem.DraggedLikeClick += draggedLikeClick; _draggingSubsystem.DragRemoved += dragRemoved; _draggingSubsystem.DragAdded += dragAdded; _layoutViewCards.SelectionStarted += selectionStarted; _formZoom = formZoom; _parent = parent; }
public DeckEditorSubsystem( LayoutViewControl viewCards, LayoutViewControl viewDeck, DeckEditorModel deckEditorModel, CollectionEditorModel collectionModel, DraggingSubsystem draggingSubsystem, CountInputSubsystem countInputSubsystem, Cursor cursor, FormZoom formZoom, FormMain parent) { _viewCards = viewCards; _viewDeck = viewDeck; _cursor = cursor; _deckEditorModel = deckEditorModel; _collectionModel = collectionModel; _draggingSubsystem = draggingSubsystem; _countInputSubsystem = countInputSubsystem; _formZoom = formZoom; _parent = parent; _ctsLifetime = new CancellationTokenSource(); _textSelectionCursor = Cursors.IBeam; }
public FormMain( UndoConfig undoConfig, CardRepository cardRepo, ImageRepository imageRepo, ImageCacheConfig imageCacheConfig, ImageLoader imageLoader, CollectionEditorModel collectionEditor, CardSearcher cardSearcher, CardDocumentAdapter cardAdapter, DeckDocumentAdapter deckAdapter, KeywordSearcher keywordSearcher, ForgeSetRepository forgeSetRepo, DeckListModel deckListModel, DeckSearcher deckSearcher, IconRecognizer iconRecognizer, FormManager formManager) : this() { DoubleBuffered = true; KeyPreview = true; _viewCards = new MtgLayoutView(_layoutViewCards); _viewDeck = new MtgLayoutView(_layoutViewDeck); _cardSearcher = cardSearcher; _keywordSearcher = keywordSearcher; _quickFilterControls = QuickFilterSetup.GetQuickFilterControls(this); _cardRepo = cardRepo; _imageLoader = imageLoader; _collectionEditor = collectionEditor; _serialization = new DeckSerializationSubsystem(_cardRepo, forgeSetRepo); beginRestoreSettings(); _fields = new Fields(); QuickFilterSetup.SetQuickFilterProperties(this); QuickFilterImages.SetImages(this); _quickFilterFacade = new QuickFilterFacade( KeywordDefinitions.Patterns, KeywordDefinitions.Values.ToKeywordDisplayTexts(), KeywordDefinitions.PropertyNames, KeywordDefinitions.PropertyNamesDisplay, keywordSearcher); _buttons = new ButtonSubsystem(); _cardSearch = new CardSearchSubsystem( this, _searchEditor, _panelIconSearch, _listBoxSuggest, cardSearcher, cardAdapter, _viewCards, _viewDeck); _panelSearchExamples.Setup(_cardSearch, _buttons, _buttonSearchExamplesDropDown); _sort = new SortSubsystem(_viewCards, _cardRepo, _fields, _cardSearch); endRestoreSettings(); _tooltipViewCards = new LayoutViewTooltip(this, _viewCards, _cardSearch); _tooltipViewDeck = new LayoutViewTooltip(this, _viewDeck, _cardSearch); var formZoomCard = new FormZoom(_cardRepo, imageRepo, _imageLoader); _scroll = new ScrollSubsystem(_viewDeck, _viewCards); _imagePreloading = new ImagePreloadingSubsystem( _viewCards, _viewDeck, _scroll, imageCacheConfig); _deckEditor = new DeckEditorModel(); _dragging = new DraggingSubsystem( _viewDeck, _viewCards, _deckEditor, this, _imageLoader, formManager); _deckEditorUi = new DeckEditorUi( _viewCards, _viewDeck, _deckEditor, _collectionEditor, _dragging, Cursor, formZoomCard); _viewDeck.SetDataSource(_deckEditor.DataSource); _viewCards.SetDataSource(_searchResultCards); _legality = new LegalitySubsystem( _menuLegalityFormat, _buttonLegalityAllowLegal, _buttonLegalityAllowRestricted, _buttonLegalityAllowBanned); _drawing = new DrawingSubsystem( _viewCards, _viewDeck, _dragging, _cardSearch, cardAdapter, _deckEditor, _quickFilterFacade, _legality, _imageLoader, iconRecognizer); _printing = new PrintingSubsystem(imageRepo, _cardRepo); DeckZone = Zone.Main; scale(); setRightPanelsWidth(); _keywordsIndexUpToDate = _keywordSearcher.IsUpToDate; _luceneSearchIndexUpToDate = _cardSearcher.IsUpToDate; _spellcheckerIndexUpToDate = _cardSearcher.Spellchecker.IsUpToDate; _searchTextSelection = new RichTextBoxSelectionSubsystem(_searchEditor); _history = new HistorySubsystem(undoConfig); _evaluators = new Evaluators { { 2, _legality.IsAllowedInFormat }, { 3, evalFilterByCollection }, { 4, evalFilterByDeck }, { 0, _quickFilterFacade.Evaluate }, { 1, evalFilterBySearchText } }; _deckListControl.Init( deckListModel, iconRecognizer, deckSearcher, deckAdapter, this); _copyPaste = new CopyPasteSubsystem( _cardRepo, _serialization, _collectionEditor, _deckEditor, _formRoot, this, _layoutViewDeck, _tabHeadersDeck, _layoutViewCards, _deckListControl.DeckListView); setupCheckButtonImages(); updateExcludeManaAbility(); updateExcludeManaCost(); updateShowProhibited(); updateShowSampleHandButtons(); updateDeckVisibility(); subscribeToEvents(); }
public void Setup() { _deckEditor = new DeckEditorModel(); _collectionEditor = new CollectionEditorModel(); }
public FormMain( CardRepository cardRepo, PriceRepository priceRepo, ImageRepository imageRepo, ImageLoader imageLoader, UiConfigRepository uiConfigRepository, CollectionEditorModel collectionEditor, CardSearcher cardSearcher, CardDocumentAdapter cardAdapter, DeckDocumentAdapter deckAdapter, KeywordSearcher keywordSearcher, DeckListModel deckListModel, DeckSearcher deckSearcher, IconRecognizer iconRecognizer, DeckSerializationSubsystem serialization, MtgArenaIntegration mtgArenaIntegration, App app) : this() { DoubleBuffered = true; _app = app; _cardSearcher = cardSearcher; _keywordSearcher = keywordSearcher; _quickFilterControls = QuickFilterSetup.GetQuickFilterControls(this); _cardRepo = cardRepo; _priceRepo = priceRepo; _imageLoader = imageLoader; _uiConfigRepository = uiConfigRepository; _collectionEditor = collectionEditor; _serialization = serialization; _mtgArenaIntegration = mtgArenaIntegration; beginRestoreSettings(); _fields = new CardFields(); QuickFilterSetup.SetQuickFilterProperties(this); QuickFilterImages.SetImages(this); _quickFilterFacade = new QuickFilterFacade( KeywordDefinitions.Patterns, KeywordDefinitions.Values.ToKeywordDisplayTexts(), KeywordDefinitions.PropertyNames, KeywordDefinitions.PropertyNamesDisplay, keywordSearcher); _searchSubsystem = new CardSearchSubsystem( this, _searchBar, uiConfigRepository, cardSearcher, cardAdapter, _viewCards, _viewDeck); _cardSort = new CardSortSubsystem(_viewCards, _cardRepo, _fields, _searchSubsystem); endRestoreSettings(); _countInputSubsystem = new CountInputSubsystem(); _tooltipViewCards = new LayoutViewTooltip(this, _viewCards, _searchSubsystem, _countInputSubsystem); _tooltipViewDeck = new LayoutViewTooltip(this, _viewDeck, _searchSubsystem, _countInputSubsystem); _formZoom = new FormZoom(_cardRepo, imageRepo, _imageLoader); _imagePreloading = new ImagePreloadingSubsystem( _viewCards, _viewDeck, uiConfigRepository); _deckEditor = new DeckEditorModel(); _dragging = new DraggingSubsystem( _viewDeck, _viewCards, _deckEditor, this, _imageLoader, _app); _deckEditorSubsystem = new DeckEditorSubsystem( _viewCards, _viewDeck, _deckEditor, _collectionEditor, _dragging, _countInputSubsystem, Cursor, _formZoom, this); _viewDeck.DataSource = _deckEditor.DataSource; _viewCards.DataSource = _searchResultCards; _legality = new LegalitySubsystem( _dropdownLegality, _buttonLegalityAllowLegal, _buttonLegalityAllowRestricted, _buttonLegalityAllowBanned, _buttonLegalityAllowFuture); _drawing = new DrawingSubsystem( _viewCards, _viewDeck, _searchSubsystem, cardAdapter, _deckEditor, _countInputSubsystem, _quickFilterFacade, _legality, iconRecognizer); _printing = new PrintingSubsystem(imageRepo, _cardRepo); _deckZones = new DeckZoneSubsystem( _tabHeadersDeck, _dragging, _viewDeck) { DeckZone = Zone.Main }; scale(); setRightPanelsWidth(); _keywordsIndexUpToDate = _keywordSearcher.IsUpToDate; _luceneSearchIndexUpToDate = _cardSearcher.IsUpToDate; _spellcheckerIndexUpToDate = _cardSearcher.Spellchecker.IsUpToDate; _history = new HistorySubsystem(uiConfigRepository); _evaluators = new Evaluators { { 2, _legality.MatchesLegalityFilter }, { 3, evalFilterByCollection }, { 4, evalFilterByDeck }, { 0, _quickFilterFacade.Evaluate }, { 1, evalFilterBySearchText } }; _deckSearcher = deckSearcher; _deckListControl.Init( deckListModel, iconRecognizer, _deckSearcher, deckAdapter, collectionEditor, uiConfigRepository, this, _app); _copyPaste = new CopyPasteSubsystem( _cardRepo, _serialization, _collectionEditor, _deckEditor, this, _deckListControl, _viewDeck, _tabHeadersDeck, _viewCards, _deckListControl.DeckListView); updateExcludeManaAbility(); updateExcludeManaCost(); updateShowProhibited(); updateShowSampleHandButtons(); updateDeckVisibility(); subscribeToEvents(); if (components == null) { components = new Container(); } components.Add(_deckEditorSubsystem); components.Add(_countInputSubsystem); components.Add(_formZoom); components.Add(_copyPaste); _popupSearchExamples.MenuControl = _menuSearchExamples; _popupSearchExamples.MenuAlignment = HorizontalAlignment.Right; }
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(); }