Пример #1
1
 public MainTab(int page, TabItem newTab, Image newVerso, Image newRecto, Grid canvas, Grid vGrid, Grid rGrid, Button delBtn, ScatterView SV, ScatterViewItem si, Grid vSwipeGrid, Grid rSwipeGrid, Grid vTranslationGrid, Grid rTranslationGrid, Grid vBoxesGrid, Grid rBoxesGrid, TextBlock headerText, SurfaceWindow1.language language)
 {
     _page = page;
     _tab = newTab;
     _verso = newVerso;
     _recto = newRecto;
     _canvas = canvas;
     _vGrid = vGrid;
     _rGrid = rGrid;
     _SVI = si;
     _delButton = delBtn;
     numFingersRecto = 0;
     numFingersVerso = 0;
     fingerPos = new List<Point>();
     avgTouchPoint = new Point(-1, 0);
     _vSwipeGrid = vSwipeGrid;
     _rSwipeGrid = rSwipeGrid;
     _vTranslationGrid = vTranslationGrid;
     _rTranslationGrid = rTranslationGrid;
     _vBoxesGrid = vBoxesGrid;
     _rBoxesGrid = rBoxesGrid;
     _twoPage = true;
     _SV = SV;
     _headerTB = headerText;
     _currentLanguage = language;
     _previousLanguage = _currentLanguage;
     _worker = new Workers(this);
 }
Пример #2
0
        // This constructor defines the look of the "new tab", which displays all apps for a user to choose from.
        public SideBar(SurfaceWindow1 surfaceWindow, TabControl tabBar)
        {
            savedPages = new List<SavedPage>();

            this.surfaceWindow = surfaceWindow;
            this.tabBar = tabBar;
            tabItems = new List<SideBarTab>();

            tabAdd = new SideBarTab(this);
            tabAdd.Header = "+";
            tabAdd.Width = 50;
            tabAdd.FontSize = 25;
            tabAdd.FontFamily = new FontFamily("Cambria");

            Canvas newTabCanvas = new Canvas();
            newTabCanvas.Height = 900;
            newTabCanvas.Width = 550;
            tabAdd.Content = newTabCanvas;

            newTabCanvas.Children.Add(addApplication("Search", "search.png", SearchButton_Selected, 100, 290, true));
            newTabCanvas.Children.Add(addApplication("Annotate", "pencil.png", AnnotateButton_Selected, 100, 480, false));
            newTabCanvas.Children.Add(addApplication("Saved Pages", "save.png", SavedPagesButton_Selected, 320, 480, false));
            newTabCanvas.Children.Add(addApplication("Music", "music.png", StudyButton_Selected, 320, 290, true));

            tabItems.Add(tabAdd);
            tabBar.DataContext = tabItems;
            tabBar.SelectedIndex = 0;
        }
Пример #3
0
        public SavedPage(int p, double w, Point c, SurfaceWindow1.language l, SurfaceWindow1 SurfaceWindow)
        {
            center = c;
            width = w;
            pageNum = p;
            language = l;
            this.SurfaceWindow = SurfaceWindow;

            button = new Button();
            button.Width = 170;
            button.Height = 119;
            button.Content = image;
            button.Click += new RoutedEventHandler(buttonPress);

            button.Content = pageNum.ToString();
        }
Пример #4
0
        private Pieces _pieces; //music objects on the current opening

        #endregion Fields

        #region Constructors

        public StudyTab(SideBar mySideBar, SurfaceWindow1 surfaceWindow, Pieces pieces)
            : base(mySideBar)
        {
            this.mySideBar = mySideBar;

            // Opening page.
            studyPrompt = new TextBlock();
            studyTabHeader = new TextBlock();

            _pieces = pieces;

            headerImage.Source = new BitmapImage(new Uri(@"..\..\icons\music.png", UriKind.Relative));
            studyTabHeader.HorizontalAlignment = HorizontalAlignment.Center;
            studyTabHeader.VerticalAlignment = VerticalAlignment.Center;
            studyTabHeader.FontSize = 21;
            headerGrid.Children.Add(studyTabHeader);

            studyPrompt.FontSize = 30;
            studyPrompt.Text = "Please select a piece of music.";
            Canvas.SetLeft(studyPrompt, 32);
            Canvas.SetTop(studyPrompt, 45);
            studyPrompt.Visibility = System.Windows.Visibility.Visible;
            canvas.Children.Add(studyPrompt);

            TranslationBox = new Canvas();

            int offsetY = 200;
            int offsetX = 100;
            foreach (Piece p in pieces.Values)
            {
                Button button = new Button();
                //button.Click += delegate(object sender, RoutedEventArgs e) { DisplayMusicItem(sender, e, p); };
                button.Click += new RoutedEventHandler(DisplayMusicItem);
                button.Name = '_' + p.ID;
                button.Height = ButtonHeight;
                button.Width = ButtonWidth;
                button.Content = p.Title;
                button.FontSize = ButtonFontSize;
                Canvas.SetLeft(button, offsetX);
                Canvas.SetTop(button, offsetY);
                offsetY += 100;
                canvas.Children.Add(button);
            }
        }
Пример #5
0
 /**
  * Saves a page from the main UI.
  * Can be reopened from the SavedPages Tab.
  * */
 public void savePage(int pageNum, double width, Point center, SurfaceWindow1.language lang)
 {
     savedPages.Add(new SavedPage(pageNum, width, center, lang, surfaceWindow));
 }
Пример #6
0
 private void setTranslateTextVerso(SurfaceWindow1.language language)
 {
     if (tab._textBlocksV != null)
     {
         int leftCount = tab._textBlocksV.Count;
         for (int i = 0; i < leftCount; i++)
         {
             tab._textBlocksV[i].Visibility = System.Windows.Visibility.Visible;
             if (language == SurfaceWindow1.language.None)
                 tab._textBlocksV[i].Visibility = System.Windows.Visibility.Hidden;
             if (language == SurfaceWindow1.language.OldFrench)
                 tab._textBlocksV[i].Text = tab._translationBoxesV[i].getOldFr();
             if (language == SurfaceWindow1.language.French)
             tab._textBlocksV[i].Text = tab._translationBoxesV[i].getModFr();
             if (language == SurfaceWindow1.language.English)
                 tab._textBlocksV[i].Text = tab._translationBoxesV[i].getEng();
         }
     }
 }
Пример #7
0
 public void setTranslateText(SurfaceWindow1.language language)
 {
     setTranslateTextVerso(language);
     setTranslateTextRecto(language);
 }
Пример #8
0
        public SearchTab(SideBar mySideBar, SurfaceWindow1 surfaceWindow)
            : base(mySideBar)
        {
            unreturnedResults = 0;
            sideBar = mySideBar;
            this.surfaceWindow = surfaceWindow;
            searchPrompt = new TextBlock();
            searchTabHeader = new TextBlock();
            searchQueryBox = new TextBox();
            goSearch = new Button();
            moreOptions = new Button();
            topLine = new Line();

            closeLanguageList = new Button();
            fewerOptions = new Button();
            upArrow = new Image();
            caseSensitive = new CheckBox();
            wholeWordOnly = new CheckBox();
            exactPhraseOnly = new CheckBox();
            st = new ScaleTransform();
            bottomLine = new Line();

            selectLanguage = new SurfaceListBox();
            pickLanguage = new SurfaceListBoxItem();
            oldFrench = new SurfaceListBoxItem();
            modernFrench = new SurfaceListBoxItem();
            English = new SurfaceListBoxItem();
            selectLanguageButton = new Button();

            searchResults = new TabControl();
            poetryTab = new TabItem();
            lyricsTab = new TabItem();
            imagesTab = new TabItem();
            poetryCanvas = new Canvas();
            poetryScroll = new SurfaceScrollViewer();
            poetryPanel = new StackPanel();
            lyricsCanvas = new Canvas();
            lyricsScroll = new SurfaceScrollViewer();
            lyricsPanel = new StackPanel();
            imagesCanvas = new Canvas();
            imagesScroll = new SurfaceScrollViewer();
            imagesPanel = new StackPanel();

            loadImage = new Image();
            loadImage.Source = new BitmapImage(new Uri(@"..\..\icons\magnifyingglass.png", UriKind.Relative));
            canvas.Children.Add(loadImage);

            headerImage.Source = new BitmapImage(new Uri(@"..\..\icons\search.png", UriKind.Relative));

            searchTabHeader.HorizontalAlignment = HorizontalAlignment.Center;
            searchTabHeader.VerticalAlignment = VerticalAlignment.Center;
            searchTabHeader.FontSize = 21;

            searchPrompt.FontSize = 30;
            searchPrompt.Text = "Search:";
            Canvas.SetLeft(searchPrompt, 32);
            Canvas.SetTop(searchPrompt, 26);

            searchQueryBox.Height = 40;
            searchQueryBox.Width = 380; //315
            searchQueryBox.Foreground = Brushes.Gray;
            searchQueryBox.FontSize = 21;
            searchQueryBox.Text = "Enter text";
            Canvas.SetLeft(searchQueryBox, 40);
            Canvas.SetTop(searchQueryBox, 90);

            goSearch.Height = 40;
            goSearch.Width = 95;
            goSearch.FontSize = 21;
            goSearch.Content = "Go!";
            goSearch.IsEnabled = false;
            Canvas.SetLeft(goSearch, 450); // 378
            Canvas.SetTop(goSearch, 90);

            downArrow = new Image();
            downArrow.Source = new BitmapImage(new Uri(@"/downArrow.png", UriKind.Relative));
            downArrow.Opacity = 0.3;
            downArrow.HorizontalAlignment = HorizontalAlignment.Center;
            moreOptText = new TextBlock();
            moreOptText.Text = "More Options";
            moreOptText.FontSize = 18; /// Might need to adjust height
            optionsGrid = new Grid();
            moreOptions.Content = optionsGrid;
            moreOptions.Width = 135; // 100
            moreOptions.Height = 28; // 20
            moreOptions.HorizontalContentAlignment = HorizontalAlignment.Center;
            optionsGrid.Children.Add(downArrow);
            optionsGrid.Children.Add(moreOptText);
            Canvas.SetLeft(moreOptions, 230); //210
            Canvas.SetTop(moreOptions, 145);

            topLine.X1 = 40;
            topLine.Y1 = 160;
            topLine.X2 = 540; // 500
            topLine.Y2 = 160;
            topLine.Stroke = Brushes.Black;
            topLine.StrokeThickness = 2;

            closeLanguageList.Width = 600; // 550
            closeLanguageList.Height = 1000; //900
            closeLanguageList.Style = sideBar.tabBar.FindResource("InvisibleButton") as Style;

            /// The objects for extended search options
            st.ScaleX = 2;
            st.ScaleY = 2;

            caseSensitive.FontSize = 10;
            caseSensitive.LayoutTransform = st;
            caseSensitive.Content = (string)"Case sensitive";
            Canvas.SetLeft(caseSensitive, 55); //40
            Canvas.SetTop(caseSensitive, 170);

            wholeWordOnly.FontSize = 10;
            wholeWordOnly.LayoutTransform = st;
            wholeWordOnly.Content = (string)"Match whole word only";
            Canvas.SetLeft(wholeWordOnly, 300); //243
            Canvas.SetTop(wholeWordOnly, 170);

            exactPhraseOnly.FontSize = 10;
            exactPhraseOnly.LayoutTransform = st;
            exactPhraseOnly.Content = (string)"Match exact phrase only";
            Canvas.SetLeft(exactPhraseOnly, 300); // 243
            Canvas.SetTop(exactPhraseOnly, 227);

            selectLanguage.Background = Brushes.LightGray;
            selectLanguage.Visibility = Visibility.Collapsed;
            selectLanguage.Width = 175;
            selectLanguage.FontSize = 21;
            selectLanguage.HorizontalContentAlignment = HorizontalAlignment.Center;
            selectLanguage.SelectedIndex = 0;

            Canvas.SetLeft(selectLanguage, 50); //34
            Canvas.SetTop(selectLanguage, 220);
            Canvas.SetLeft(selectLanguageButton, 50); //34
            Canvas.SetTop(selectLanguageButton, 220);
            selectLanguageButton.Width = 175;
            selectLanguageButton.Height = 40;
            selectLanguageButton.Visibility = Visibility.Hidden;
            selectLanguageButton.Content = (string)"Old French";
            selectLanguageButton.FontSize = 21;

            pickLanguage.Content = (string)"Pick a language:";
            oldFrench.Content = (string)"Old French";
            modernFrench.Content = (string)"Modern French";
            English.Content = (string)"English";

            selectLanguage.Items.Add(pickLanguage);
            selectLanguage.Items.Add(oldFrench);
            selectLanguage.Items.Add(modernFrench);
            selectLanguage.Items.Add(English);

            foreach (SurfaceListBoxItem s in selectLanguage.Items)
            {
                s.FontFamily = new FontFamily("Cambria");
                s.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
                s.FontSize = 21;
                s.Height = 40;
            }

            bottomLine.X1 = 40;
            bottomLine.Y1 = 183;
            bottomLine.X2 = 540; //500
            bottomLine.Y2 = 183;
            bottomLine.Stroke = Brushes.Black;
            bottomLine.StrokeThickness = 2;
            Canvas.SetTop(bottomLine, 113);

            upArrow.Source = new BitmapImage(new Uri(@"/upArrow.png", UriKind.Relative));
            upArrow.Opacity = 0.3;
            upArrow.HorizontalAlignment = HorizontalAlignment.Center;
            fewerOptText = new TextBlock();
            fewerOptText.Text = "Fewer Options";
            fewerOptText.FontSize = 18; /// Might need to adjust height
            fewerOptGrid = new Grid();
            fewerOptions.Content = fewerOptGrid;
            fewerOptions.Width = 135;
            fewerOptions.Height = 28;
            fewerOptions.HorizontalContentAlignment = HorizontalAlignment.Center;
            fewerOptGrid.Children.Add(upArrow);
            fewerOptGrid.Children.Add(fewerOptText);
            Canvas.SetLeft(fewerOptions, 230); // 210
            Canvas.SetTop(fewerOptions, 280); // 285

            /// The objects on the search results section
            searchResults.Visibility = Visibility.Hidden;
            searchResults.Height = 800; //677
            searchResults.Width = 525; //482
            searchResults.FontSize = 21;
            Canvas.SetLeft(searchResults, 35); //30
            Canvas.SetTop(searchResults, 180);
            searchResults.Items.Add(poetryTab);
            searchResults.Items.Add(lyricsTab);
            searchResults.Items.Add(imagesTab);

            poetryBorder = new Border();
            poetryBorder.Child = poetryPanel;
            poetryBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            poetryTab.Header = "Poetry";
            poetryTab.Height = 40;
            poetryTab.Width = 170;
            poetryTab.Content = poetryCanvas;

            poetryCanvas.Height = 750;
            poetryCanvas.Children.Add(poetryScroll);
            poetryCanvas.Children.Add(poetryBorder);

            poetryScroll.Height = 410;
            poetryScroll.Width = 513;
            poetryScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            poetryScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            poetryScroll.PanningMode = PanningMode.VerticalOnly;
            poetryPanel.Orientation = Orientation.Horizontal;

            lyricsBorder = new Border();
            lyricsBorder.Child = lyricsPanel;
            lyricsBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            lyricsTab.Header = "Lyrics";
            lyricsTab.Height = 40;
            lyricsTab.Width = 170;
            lyricsTab.Content = lyricsCanvas;
            lyricsCanvas.Height = 750;
            lyricsCanvas.Children.Add(lyricsScroll);
            lyricsCanvas.Children.Add(lyricsBorder);
            lyricsScroll.Height = 410;
            lyricsScroll.Width = 513;
            lyricsScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            lyricsScroll.PanningMode = PanningMode.VerticalOnly;
            lyricsPanel.Orientation = Orientation.Horizontal;

            imagesBorder = new Border();
            imagesBorder.Child = imagesPanel;
            imagesBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            imagesTab.Header = "Images";
            imagesTab.Height = 40;
            imagesTab.Width = 170;
            imagesTab.Content = imagesCanvas;
            imagesCanvas.Height = 750;
            imagesCanvas.Children.Add(imagesScroll);
            imagesCanvas.Children.Add(imagesBorder);
            imagesScroll.Height = 410;
            imagesScroll.Width = 513;

            imagesScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            imagesScroll.PanningMode = PanningMode.VerticalOnly;
            imagesPanel.Orientation = Orientation.Horizontal;

            /// Adding everything

            headerGrid.Children.Add(searchTabHeader);

            canvas.Children.Add(closeLanguageList); // Should add to the very back...
            canvas.Children.Add(searchPrompt);
            canvas.Children.Add(searchQueryBox);
            canvas.Children.Add(goSearch);
            canvas.Children.Add(topLine);
            canvas.Children.Add(moreOptions);

            canvas.Children.Add(searchResults);
            canvas.Children.Add(caseSensitive);
            canvas.Children.Add(bottomLine);
            canvas.Children.Add(selectLanguage);
            canvas.Children.Add(selectLanguageButton);
            canvas.Children.Add(fewerOptions);
            canvas.Children.Add(wholeWordOnly);
            canvas.Children.Add(exactPhraseOnly);
            caseSensitive.Visibility = Visibility.Hidden;
            selectLanguage.Visibility = Visibility.Hidden;
            bottomLine.Visibility = Visibility.Hidden;
            fewerOptions.Visibility = Visibility.Hidden;
            wholeWordOnly.Visibility = Visibility.Hidden;
            exactPhraseOnly.Visibility = Visibility.Hidden;

            closeLanguageList.TouchEnter += new EventHandler<TouchEventArgs>(closeLanguageList_TouchEnter);
            closeLanguageList.MouseLeave += new MouseEventHandler(closeLanguageList_MouseLeave);
            closeLanguageList.Click += new RoutedEventHandler(closeLanguageList_Click);
            moreOptions.Click += new RoutedEventHandler(Show_Options);
            moreOptions.TouchDown += new EventHandler<TouchEventArgs>(Show_Options);
            fewerOptions.Click += new RoutedEventHandler(Hide_Options);
            fewerOptions.TouchDown += new EventHandler<TouchEventArgs>(Hide_Options);
            searchQueryBox.GotFocus += new RoutedEventHandler(Focus_SearchBox);
            searchQueryBox.TouchDown += new EventHandler<TouchEventArgs>(Focus_SearchBox);
            goSearch.Click += new RoutedEventHandler(newSearch);
            goSearch.TouchDown += new EventHandler<TouchEventArgs>(newSearch);
            searchQueryBox.PreviewKeyDown += new KeyEventHandler(Enter_Clicked);
            caseSensitive.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);
            exactPhraseOnly.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);
            wholeWordOnly.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);

            //selectLanguage.TouchDown += new EventHandler<TouchEventArgs>(displaySearchLanguages);
            //selectLanguage.SelectionChanged += new SelectionChangedEventHandler(searchLanguageChanged);
            selectLanguage.Visibility = Visibility.Collapsed;
            selectLanguageButton.TouchDown += new EventHandler<TouchEventArgs>(displaySearchLanguages);
            selectLanguageButton.Click += new RoutedEventHandler(displaySearchLanguages);
            pickLanguage.Selected += new RoutedEventHandler(searchLanguageChanged);
            oldFrench.Selected += new RoutedEventHandler(searchLanguageChanged);
            modernFrench.Selected += new RoutedEventHandler(searchLanguageChanged);
            English.Selected += new RoutedEventHandler(searchLanguageChanged);
        }