public DrawingSubsystem( LayoutViewControl viewCards, LayoutViewControl viewDeck, CardSearchSubsystem cardSearchSubsystem, CardDocumentAdapter adapter, DeckEditorModel deckEditorModel, CountInputSubsystem countInputSubsystem, QuickFilterFacade quickFilterFacade, LegalitySubsystem legalitySubsystem, IconRecognizer iconRecognizer) { _viewCards = viewCards; _viewDeck = viewDeck; _deckEditorModel = deckEditorModel; _countInputSubsystem = countInputSubsystem; _quickFilterFacade = quickFilterFacade; _legalitySubsystem = legalitySubsystem; _viewCards.RowDataLoaded += setHighlightMatches; _viewCards.IconRecognizer = iconRecognizer; _highlightSubsystem = new SearchResultHighlighter( cardSearchSubsystem, adapter, new KeywordHighlighter()); }
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 DrawingSubsystem( MtgLayoutView layoutViewCards, MtgLayoutView layoutViewDeck, DraggingSubsystem draggingSubsystem, CardSearchSubsystem cardSearchSubsystem, CardDocumentAdapter adapter, DeckEditorModel deckEditorModel, QuickFilterFacade quickFilterFacade, LegalitySubsystem legalitySubsystem, ImageLoader imageLoader, IconRecognizer iconRecognizer) { _layoutViewCards = layoutViewCards; _layoutViewDeck = layoutViewDeck; _draggingSubsystem = draggingSubsystem; _deckEditorModel = deckEditorModel; _quickFilterFacade = quickFilterFacade; _legalitySubsystem = legalitySubsystem; _imageLoader = imageLoader; _layoutViewCards.RowDataLoaded += setHighlightMatches; _layoutViewCards.SetIconRecognizer(iconRecognizer); _highlightSubsystem = new SearchResultHighlighter( cardSearchSubsystem, adapter, new KeywordHighlighter()); }
public DraggingSubsystem( LayoutViewControl viewDeck, LayoutViewControl viewCards, DeckEditorModel deckEditorModel, FormMain parent, ImageLoader imageLoader, App app) { _viewDeck = viewDeck; _viewCards = viewCards; _deckEditorModel = deckEditorModel; _parent = parent; _imageLoader = imageLoader; _app = app; }
public void ShowPrintingDialog(DeckEditorModel deckEditorModel, string fileName) { var dlg = new SaveFileDialog { Filter = @"|*.png", AddExtension = true, DefaultExt = @".png", FileName = fileName.NullIfEmpty() ?? "deck" }; if (dlg.ShowDialog() == DialogResult.OK) { TaskEx.Run(() => print(deckEditorModel, dlg.FileName)); } }
public void ShowPrintingDialog(DeckEditorModel deckEditorModel, string fileName) { var dlg = new SaveFileDialog { Filter = @"|*.png", AddExtension = true, DefaultExt = @".png", FileName = fileName.NullIfEmpty() ?? "deck" }; if (dlg.ShowDialog() == DialogResult.OK) { ThreadPool.QueueUserWorkItem(_ => { print(deckEditorModel, dlg.FileName); }); } }
public DraggingSubsystem( MtgLayoutView layoutViewDeck, MtgLayoutView layoutViewCards, DeckEditorModel deckEditorModel, FormMain parent, ImageLoader imageLoader, Application application) { _layoutViewDeck = layoutViewDeck; _layoutViewCards = layoutViewCards; _deckEditorModel = deckEditorModel; _parent = parent; _imageLoader = imageLoader; _application = application; }
public DraggingSubsystem( MtgLayoutView layoutViewDeck, MtgLayoutView layoutViewCards, DeckEditorModel deckEditorModel, FormMain parent, ImageLoader imageLoader, FormManager formManager) { _layoutViewDeck = layoutViewDeck; _layoutViewCards = layoutViewCards; _deckEditorModel = deckEditorModel; _parent = parent; _imageLoader = imageLoader; _formManager = formManager; }
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 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(); }
private void print(DeckEditorModel deckEditorModel, string fileName) { var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName); var dir = Path.GetDirectoryName(fileName); if (dir == null) { return; } var ext = Path.GetExtension(fileName); createPage(out var page, out var gr); int x = 0, y = 0; int pageNum = 0; bool pageSaved = true; var decks = new[] { deckEditorModel.MainDeck, deckEditorModel.SideDeck }; foreach (var deck in decks) { foreach (string cardsId in deck.CardsIds) { var card = _cardRepository.CardsById[cardsId]; if (!card.HasImage(Ui)) { continue; } var model = _imageRepository.GetImagePrint(card, _cardRepository.GetReleaseDateSimilarity); var image = Image.FromFile(model.ImageFile.FullPath); int count = deck.GetCount(card.Id); for (int c = 0; c < count; c++) { gr.DrawImage( image, new Rectangle( x * (_cardSizePx.Width + _border), y * (_cardSizePx.Height + _border), _cardSizePx.Width, _cardSizePx.Height)); pageSaved = false; x++; if (x == CardsPerRow) { x = 0; y++; } if (y == CardsPerColumn) { x = 0; y = 0; pageNum++; page.Save(Path.Combine(dir, $"{fileNameWithoutExt}.{pageNum}{ext}"), ImageFormat.Png); createPage(out page, out gr); pageSaved = true; } } } } if (!pageSaved) { pageNum++; page.Save(Path.Combine(dir, $"{fileNameWithoutExt}.{pageNum}{ext}"), ImageFormat.Png); } }
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; }