Beispiel #1
0
        private void LibraryCatalogOverviewControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            // Make the button semi-transparent if our new document is not actually on the harddrive
            PanelSearchScore.Visibility   = Visibility.Collapsed;
            ListSearchDetails.DataContext = null;
            ObjLookInsidePanel.Visibility = Visibility.Collapsed;
            ButtonThemeSwatch.Visibility  = Visibility.Collapsed;
            ObjFavouriteImage.Visibility  = Visibility.Collapsed;
            ButtonOpen.Background         = Brushes.Transparent;
            TextTitle.Foreground          = Brushes.Black;
            TextTitle.FontSize            = TextAuthors.FontSize;

            // No more work if our context is null
            if (null == PDFDocumentBindable)
            {
                return;
            }

            // The wizard
            if ("The Qiqqa Manual" == PDFDocumentBindable.Underlying.TitleCombined)
            {
                WizardDPs.SetPointOfInterest(TextTitle, "GuestLibraryQiqqaManualTitle");
                WizardDPs.SetPointOfInterest(ButtonOpen, "GuestLibraryQiqqaManualOpenButton");
            }
            else
            {
                WizardDPs.ClearPointOfInterest(TextTitle);
                WizardDPs.ClearPointOfInterest(ButtonOpen);
            }

            // Choose the icon depending on the reference type
            if (PDFDocumentBindable.Underlying.IsVanillaReference)
            {
                ButtonOpen.Icon    = Icons.GetAppIcon(Icons.LibraryCatalogOpenVanillaReference);
                ButtonOpen.Opacity = 1.0;
            }
            else
            {
                ButtonOpen.Icon    = Icons.GetAppIcon(Icons.LibraryCatalogOpen);
                ButtonOpen.Opacity = PDFDocumentBindable.Underlying.DocumentExists ? 1.0 : 0.5;
            }

            // Favourite?
            if (PDFDocumentBindable.Underlying.IsFavourite ?? false)
            {
                ObjFavouriteImage.Visibility = Visibility.Visible;
            }

            // Colour
            if (Colors.Transparent != PDFDocumentBindable.Underlying.Color)
            {
                ButtonOpen.Background = new SolidColorBrush(ColorTools.MakeTransparentColor(PDFDocumentBindable.Underlying.Color, 64));
            }

            // Rating
            if (!String.IsNullOrEmpty(PDFDocumentBindable.Underlying.Rating))
            {
                double rating;
                if (Double.TryParse(PDFDocumentBindable.Underlying.Rating, out rating))
                {
                    TextTitle.FontSize = TextAuthors.FontSize + rating;
                }
            }

            // Reading stage
            switch (PDFDocumentBindable.Underlying.ReadingStage)
            {
            case Choices.ReadingStages_TOP_PRIORITY:
                TextTitle.Foreground = Brushes.DarkRed;
                break;

            case Choices.ReadingStages_READ_AGAIN:
            case Choices.ReadingStages_INTERRUPTED:
            case Choices.ReadingStages_STARTED_READING:
                TextTitle.Foreground = Brushes.DarkGreen;
                break;

            case Choices.ReadingStages_SKIM_READ:
            case Choices.ReadingStages_BROWSED:
            case Choices.ReadingStages_INTEREST_ONLY:
                TextTitle.Foreground = Brushes.DarkBlue;
                break;

            case Choices.ReadingStages_FINISHED_READING:
            case Choices.ReadingStages_DUPLICATE:
                TextTitle.Foreground = Brushes.DarkGray;
                break;

            case Choices.ReadingStages_UNREAD:
                TextTitle.Foreground = Brushes.Black;
                break;

            default:
                TextTitle.Foreground = Brushes.Black;
                break;
            }

            // Populate the score if we have them
            if (null != LibraryCatalogControl)
            {
                Dictionary <string, double> search_scores = LibraryCatalogControl.SearchScores;
                if (null != search_scores)
                {
                    PanelSearchScore.Visibility = Visibility.Visible;

                    double score;
                    search_scores.TryGetValue(PDFDocumentBindable.Underlying.Fingerprint, out score);

                    string score_string = String.Format("{0:0}%", score * 100);
                    ButtonSearchInside.Caption  = "" + score_string + "";
                    ButtonSearchInside.ToolTip  = String.Format("Search score is {0}. Click here to see why...", score_string);
                    ButtonSearchInside.Cursor   = Cursors.Hand;
                    ButtonSearchInside.MinWidth = 0;
                    Color color = Color.FromRgb(255, (byte)(255 - 150 * score), 100);
                    ButtonSearchInside.Background = new SolidColorBrush(color);
                }
            }

            // Populate the theme swatch
            ButtonThemeSwatch.Visibility = Visibility.Visible;
            ButtonThemeSwatch.Background = ThemeBrushes.GetBrushForDocument(PDFDocumentBindable.Underlying);

            // Populate the linked documents
            CitationsUserControl.PopulatePanelWithCitations(DocsPanel_Linked, PDFDocumentBindable.Underlying.Library, PDFDocumentBindable.Underlying, PDFDocumentBindable.Underlying.PDFDocumentCitationManager.GetLinkedDocuments(), Features.LinkedDocument_Library_OpenDoc, " » ", false);
        }
Beispiel #2
0
        protected virtual void OnInit()
        {
            DefaultButtonAlpha = 245;
            ButtonStyle        = ButtonStyles.Glossy;

            if (Colors == null)
            {
                this.LogError("Please initialize Theme.Colors before calling Theme.OnInit().");
                return;
            }

            Pens = new ThemePens {
                Base03 = new Pen(Colors.Base03),
                Base02 = new Pen(Colors.Base02),
                Base01 = new Pen(Colors.Base01),
                Base00 = new Pen(Colors.Base00),

                Base0 = new Pen(Colors.Base0),
                Base1 = new Pen(Colors.Base1),
                Base2 = new Pen(Colors.Base2),
                Base3 = new Pen(Colors.Base3),

                Yellow  = new Pen(Colors.Yellow),
                Orange  = new Pen(Colors.Orange),
                Red     = new Pen(Colors.Red),
                Magenta = new Pen(Colors.Magenta),
                Violet  = new Pen(Colors.Violet),
                Blue    = new Pen(Colors.Blue),
                Cyan    = new Pen(Colors.Cyan),
                Green   = new Pen(Colors.Green),

                White           = new Pen(Colors.White),
                Silver          = new Pen(Colors.Silver),
                HighLightYellow = new Pen(Colors.HighLightYellow),
                //HighLightBlue = new Pen(Colors.HighLightBlue)
                //HighLightBlue = new Pen(Colors.Blue)
                //HighLightBlue = new Pen(Color.FromArgb (245, 38, 139, 210))
                HighLightBlue = new Pen(Color.FromArgb(38, 139, 210))
            };

            Brushes = new ThemeBrushes {
                Base03 = new SolidBrush(Colors.Base03),
                Base02 = new SolidBrush(Colors.Base02),
                Base01 = new SolidBrush(Colors.Base01),
                Base00 = new SolidBrush(Colors.Base00),

                Base0 = new SolidBrush(Colors.Base0),
                Base1 = new SolidBrush(Colors.Base1),
                Base2 = new SolidBrush(Colors.Base2),
                Base3 = new SolidBrush(Colors.Base3),

                Yellow  = new SolidBrush(Colors.Yellow),
                Orange  = new SolidBrush(Colors.Orange),
                Red     = new SolidBrush(Colors.Red),
                Magenta = new SolidBrush(Colors.Magenta),
                Violet  = new SolidBrush(Colors.Violet),
                Blue    = new SolidBrush(Colors.Blue),
                Cyan    = new SolidBrush(Colors.Cyan),
                Green   = new SolidBrush(Colors.Green),

                White           = new SolidBrush(Colors.White),
                Silver          = new SolidBrush(Colors.Silver),
                HighLightYellow = new SolidBrush(Colors.HighLightYellow),
                //HighLightBlue = new SolidBrush(Colors.HighLightBlue)
                //HighLightBlue = new SolidBrush(Color.FromArgb (245, 38, 139, 210))
                HighLightBlue = new SolidBrush(Color.FromArgb(38, 139, 210))
            };

            ScrollBar = new ThemeScrollBar {
                BackColor       = Color.FromArgb(241, 241, 241),
                GripColor       = Color.FromArgb(188, 188, 188),
                GripBorderColor = Color.FromArgb(168, 168, 168),

                GripColorHover       = Color.FromArgb(168, 168, 168),
                GripBorderColorHover = Color.FromArgb(154, 154, 154),

                GripColorDrag       = Color.FromArgb(141, 141, 141),
                GripBorderColorDrag = Color.FromArgb(120, 120, 120),

                ButtonForeColor         = Color.FromArgb(80, 80, 80),
                ButtonForeColorDisabled = Color.FromArgb(164, 164, 164),

                ButtonColorHover       = Color.FromArgb(210, 210, 210),
                ButtonColorPressed     = Color.FromArgb(120, 120, 120),
                ButtonForeColorPressed = Color.FromArgb(255, 255, 255)
            };

            DarkScrollBar = new ThemeScrollBar {
                BackColor       = Colors.Base03,
                GripColor       = Colors.Base00,
                GripBorderColor = Colors.Base02,

                GripColorHover       = Colors.Base0,
                GripBorderColorHover = Colors.Base01,

                GripColorDrag       = Colors.Base1,
                GripBorderColorDrag = Colors.Base00,

                ButtonForeColor         = Colors.Base1,
                ButtonForeColorDisabled = Color.DimGray,

                ButtonColorHover       = Colors.Base02,
                ButtonColorPressed     = Colors.Base00,
                ButtonForeColorPressed = Colors.Base3
            };

            ToolBar = new ThemeToolBar {
                BackColor1         = Colors.Base1,
                BackColor2         = Colors.Base0,
                ForeColor          = Colors.Base2,
                TooltipBackColor   = Color.FromArgb(245, 255, 250, 180),
                TooltipForeColor   = Color.FromArgb(255, 20, 10, 0),
                TooltipBorderColor = Color.FromArgb(128, 30, 20, 10),
            };

            StatusBar = new ThemeStatusBar {
                BackColor = Colors.Base03,
                ForeColor = Colors.Base2,
                LineColor = Color.Empty
            };

            ProgressBar = new ThemeProgressBar {
                ProgressBackColor    = Colors.Base00,
                ProgressForeColor    = Colors.White,
                DefaultProgressColor = Colors.Orange
            };
        }