コード例 #1
0
ファイル: SideBarTab.cs プロジェクト: straboulsi/fauvel
        public SideBarTab(SideBar mySideBar)
            : base()
        {
            this.mySideBar = mySideBar;
            canvas = new Canvas();
            headerGrid = new Grid();
            Content = canvas;
            Header = headerGrid;

            deleteTabButton = new Button();

            headerGrid.Width = 100;
            headerGrid.Height = 40;
            headerImage = new Image();
            headerImage.Opacity = 0.2;
            headerGrid.Children.Add(headerImage);

            Image ex = new Image();
            ex.Source = new BitmapImage(new Uri(@"..\..\icons\exLarge.png", UriKind.Relative));

            deleteTabButton.Content = ex;
            deleteTabButton.Width = 40;
            deleteTabButton.Height = 40;
            deleteTabButton.Opacity = 0.7;
            Canvas.SetLeft(deleteTabButton, 560);
            Canvas.SetTop(deleteTabButton, 3);
            canvas.Children.Add(deleteTabButton);
            deleteTabButton.Click += new RoutedEventHandler(mySideBar.deleteTab);
            deleteTabButton.TouchDown += new EventHandler<TouchEventArgs>(mySideBar.deleteTab);
        }
コード例 #2
0
ファイル: StudyTab.cs プロジェクト: straboulsi/fauvel
        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);
            }
        }
コード例 #3
0
ファイル: SavedPagesTab.cs プロジェクト: straboulsi/fauvel
        public SavedPagesTab(SideBar mySideBar)
            : base(mySideBar)
        {
            int x = 0;
            int y = 50;
            foreach (SavedPage s in mySideBar.savedPages)
            {
                canvas.Children.Add(s.button);
                Canvas.SetLeft(s.button, x);
                Canvas.SetTop(s.button, y);

                x += 180;
                if (x >= 500)
                {
                    x = 0;
                    y += 129;
                }
            }
        }
コード例 #4
0
        /**
         * Called when the program starts. Initialization occurs.
         **/
        public SurfaceWindow1()
        {
            InitializeComponent();

            double scale = 0.8;
            mother.LayoutTransform = new ScaleTransform(scale, scale);

            sideBar = new SideBar(this, tabDynamic);

            try
            {
                // Loads the Xml documents
                xmlOldFr = new XmlDocument();
                xmlOldFr.Load(@"..\..\XML\OriginalTextXML.xml");
                engXml = new XmlDocument();
                engXml.Load(@"..\..\XML\EnglishXML.xml");
                layoutXml = new XmlDocument();
                layoutXml.Load(@"..\..\XML\LayoutXML.xml");
                modFrXml = new XmlDocument();
                modFrXml.Load(@"..\..\XML\ModernFrenchXML.xml");

                xOldFr = XDocument.Load(@"..\..\XML\OriginalTextXML.xml"); // = XDocument.Load(@"..\..\XML\OriginalTextXML.xml");
            }
            catch (Exception e)
            {
                Console.Write(e.StackTrace);
            }

            Console.Read();

            // slider actions
            pageSlider.AddHandler(UIElement.ManipulationDeltaEvent, new EventHandler<ManipulationDeltaEventArgs>(slider_ManipulationDelta), true);
            pageSlider.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(slider_ManipulationCompleted), true);
            slideImage1 = SliderImage1;
            slideImage2 = SliderImage2;

            //other initialization
            TabItem newTabButton = new TabItem();
            newTabButton.Header = "+";
            newTabButton.Width = 50;
            newTabButton.Height = 40;
            newTabButton.FontSize = 25;
            newTabButton.FontFamily = new FontFamily("Cambria");
            tabBar.Items.Add(newTabButton);

            Counterpart.makeCounterpartList();
            createTab(2);
            sideBar.TabList = tabArray;
            sideBar.TabNumber = tabNumber;
        }
コード例 #5
0
ファイル: SearchTab.cs プロジェクト: straboulsi/fauvel
        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);
        }