Exemplo n.º 1
0
        private void UpdateTabControls(bool beginPreviewLoadTimer)
        {
            if (listViewLibrary.SelectedItems.Count > 0)
            {
                var pathCol = listViewLibrary.SelectedItem.SubItems[olvColLocation.Index];

                if (pathCol != null)
                {
                    if (pathCol.Text != null)
                    {
                        var openedExternally = TablatureViewForm.GetInstance(this).IsFileOpen(GetSelectedLibraryItem().FileInfo);

                        deleteTabToolStripMenuItem.Enabled = librarycontextdelete.Enabled = !openedExternally;
                        detailsToolStripMenuItem.Enabled   = librarycontextdetails.Enabled = !openedExternally;
                    }
                }
            }

            else
            {
                deleteTabToolStripMenuItem.Enabled = false;
                detailsToolStripMenuItem.Enabled   = false;
            }

            menuItem3.Enabled = GetSelectedLibraryItem() != null;

            if (beginPreviewLoadTimer)
            {
                PreviewDisplayDelay.Stop();
                PreviewDisplayDelay.Start();
            }
        }
Exemplo n.º 2
0
        private void OpenRecentFile(MenuItem item)
        {
            var recentMenuItem = (RecentMenuItem)item;

            var tab = _libraryManager.GetTablatureFileProcessor().Load(recentMenuItem.FileInfo.FullName);

            if (tab != null)
            {
                TablatureViewForm.GetInstance(this).LoadTablature(tab, new FileInfo(recentMenuItem.FileInfo.FullName));
            }
        }
Exemplo n.º 3
0
        public MainForm()
        {
            var tablatureDirectory = TabsterEnvironment.CreateEnvironmentDirectoryPath(TabsterEnvironmentDirectory.UserData, "Library");

            var databasePath = Path.Combine(TabsterEnvironment.GetEnvironmentDirectoryPath(TabsterEnvironmentDirectory.ApplicatonData), "library.db");

            var fileProcessor = new TabsterFileProcessor <TablatureFile>(Constants.TablatureFileVersion);

            Logging.GetLogger().Info(string.Format("Initializing database: {0}", databasePath));
            _databaseHelper = new TabsterDatabaseHelper(databasePath);

            _libraryManager     = new LibraryManager(_databaseHelper, fileProcessor, tablatureDirectory);
            _playlistManager    = new PlaylistManager(_databaseHelper, fileProcessor);
            _recentFilesManager = new RecentFilesManager(_databaseHelper, fileProcessor, Settings.Default.MaxRecentItems);

            InitializeComponent();

            Text = string.Format("{0} v{1}", Application.ProductName,
                                 TabsterEnvironment.GetVersion().ToString(TabsterVersionFormatFlags.BuildString | TabsterVersionFormatFlags.Truncated));
#if PORTABLE
            Text = Text.Replace("Build", "Portable Build");
#endif
            InitAspectGetters();

            UpdateSortColumnMenu(true);

            //tabviewermanager events
            TablatureViewForm.GetInstance(this).TabClosed += TabHandler_OnTabClosed;

            recentlyViewedMenuItem.MaxDisplayItems   = Settings.Default.MaxRecentItems;
            recentlyViewedMenuItem.ClearItemClicked += recentlyViewedMenuItem_OnClearItemClicked;

            previewToolStrip.Renderer = new ToolStripRenderer();

            if (Settings.Default.ClientState == FormWindowState.Maximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                Size = Settings.Default.ClientSize;
            }

            ToggleEmptyLibraryOverlay(listViewLibrary, true);
            ToggleEmptyLibraryOverlay(listViewSearch, true);

            PreviewEditor.Font       = TablatureFontManager.GetFont();
            searchPreviewEditor.Font = TablatureFontManager.GetFont();
        }
Exemplo n.º 4
0
        private void LoadTabPreview(bool startViewCountTimer = true)
        {
            PreviewDisplayTimer.Stop();

            if (GetSelectedLibraryItem() != null)
            {
                lblpreviewtitle.Text = GetSelectedLibraryItem().File.ToFriendlyString();

                var openedExternally = TablatureViewForm.GetInstance(this).IsFileOpen(GetSelectedLibraryItem().FileInfo);

                PreviewEditor.Visible = !openedExternally;

                if (openedExternally)
                {
                    lblLibraryPreview.Visible = true;
                }

                else
                {
                    lblLibraryPreview.Visible = false;

                    PreviewEditor.LoadTablature(GetSelectedLibraryItem().File);

                    if (startViewCountTimer)
                    {
                        PreviewDisplayTimer.Start();
                    }
                }

                librarySplitContainer.Panel2.Enabled = !openedExternally;
                previewToolStrip.Enabled             = true;
            }

            else
            {
                ClearTabPreview();
            }
        }
Exemplo n.º 5
0
        private void PopoutTab(TablatureFile file, FileInfo fileInfo, bool updateRecentFiles = true)
        {
            TablatureViewForm.GetInstance(this).LoadTablature(file, fileInfo);

            if (updateRecentFiles)
            {
                _recentFilesManager.Add(new RecentFile(file, fileInfo));
                recentlyViewedMenuItem.Add(new RecentMenuItem(fileInfo)
                {
                    DisplayText = file.ToFriendlyString()
                });
            }

            var libraryItem = _libraryManager.FindTablatureItemByFile(file);

            if (libraryItem != null)
            {
                libraryItem.Views     += 1;
                libraryItem.LastViewed = DateTime.UtcNow;
            }

            LoadTabPreview();
        }