コード例 #1
0
        public SettingsWindowViewmodel(MainWindow main, AppSettings data)
        {
            mainWindow = main;
            Settings   = data;

            ShortcutList = ShortcutManager.ListObservableShortcuts(data);

            AvailableThemes   = App.Themes.GetAllAvailableThemes();
            AvailableModifier = App.Themes.GetAllAvailableModifier().Select(m => new CheckableAlephTheme {
                Theme = m, Owner = this, Checked = data.ThemeModifier.Contains(m.SourceFilename)
            }).ToList();

            _selectedTheme = App.Themes.GetThemeByFilename(Settings.Theme, out _)
                             ?? App.Themes.GetDefault()
                             ?? AvailableThemes.FirstOrDefault()
                             ?? App.Themes.GetFallback();

            _oldTheme     = ThemeManager.Inst.CurrentBaseTheme;
            _oldModifiers = ThemeManager.Inst.CurrentModifers.ToList();

            SnippetList = new ObservableCollectionNoReset <EditableSnippet>(data.Snippets.Data.Select(p => new EditableSnippet {
                PreviewFunc = SnippetPrev, ID = p.Key, Name = p.Value.DisplayName, Value = p.Value.Value
            }));
            NewSnippetID = GetNextSnippetID();
        }
コード例 #2
0
        private static void CreateBrushes(AlephTheme t)
        {
            StandardBrush = BrushRefToBrush.Convert(t.Get <BrushRef>("window.tageditor.tag:bordercolor_default"));

            HighlightBrush = new DrawingBrush
            {
                Viewport      = new System.Windows.Rect(0, 0, 8, 8),
                ViewportUnits = BrushMappingMode.Absolute,
                TileMode      = TileMode.Tile,
                Drawing       = new GeometryDrawing
                {
                    Brush    = BrushRefToBrush.Convert(t.Get <BrushRef>("window.tageditor.tag:bordercolor_highlighted")),
                    Geometry = new GeometryGroup
                    {
                        Children = new GeometryCollection(new Geometry[]
                        {
                            new RectangleGeometry {
                                Rect = new System.Windows.Rect(0, 0, 50, 50)
                            },
                            new RectangleGeometry {
                                Rect = new System.Windows.Rect(50, 50, 50, 50)
                            },
                        })
                    }
                }
            };

            StandardBrush.Freeze();
            HighlightBrush.Freeze();

            _currTheme = t;
        }
コード例 #3
0
        public void ChangeTheme(AlephTheme t)
        {
            CurrentTheme = t;

            _listener.RemoveAll(l => !l.IsTargetAlive);
            foreach (var s in _listener.Where(l => l.IsTargetAlive))
            {
                s.OnThemeChanged();
            }
        }
コード例 #4
0
        public void ChangeTheme(AlephTheme t, IEnumerable <AlephTheme> m)
        {
            CurrentBaseTheme = t;
            CurrentModifers  = m.ToList();

            CurrentThemeSet = new AlephThemeSet(Cache.GetDefaultOrFallback(), CurrentBaseTheme, CurrentModifers);

            _listener.RemoveAll(l => !l.IsTargetAlive);
            foreach (var s in _listener.Where(l => l.IsTargetAlive))
            {
                s.OnThemeChanged();
            }
        }
コード例 #5
0
        public SettingsWindowViewmodel(MainWindow main, AppSettings data)
        {
            mainWindow = main;
            Settings   = data;

            ShortcutList    = ShortcutManager.ListObservableShortcuts(data);
            AvailableThemes = App.Themes.GetAllAvailable();

            _selectedTheme = App.Themes.GetByFilename(Settings.Theme, out _)
                             ?? App.Themes.GetByFilename("default.xml", out _)
                             ?? AvailableThemes.FirstOrDefault()
                             ?? App.Themes.GetFallback();
        }
コード例 #6
0
        private void UpdateThemePreview()
        {
            if (SelectedTheme == null || SelectedTheme.IsFallback)
            {
                return;
            }

            _isThemePreview = true;

            if (_oldTheme == null)
            {
                _oldTheme = ThemeManager.Inst.CurrentTheme;
            }
            ThemeManager.Inst.ChangeTheme(SelectedTheme);
        }
コード例 #7
0
        private void UpdateThemePreview()
        {
            if (SelectedTheme == null || SelectedTheme.ThemeType == AlephThemeType.Fallback)
            {
                return;
            }

            _isThemePreview = true;

            if (_oldTheme == null)
            {
                _oldTheme = ThemeManager.Inst.CurrentBaseTheme;
            }
            if (_oldModifiers == null)
            {
                _oldModifiers = ThemeManager.Inst.CurrentModifers.ToList();
            }
            ThemeManager.Inst.ChangeTheme(SelectedTheme, GetCheckedModifier());
        }
コード例 #8
0
 public static System.Drawing.Bitmap GetDBitmapResource(this AlephThemeSet set, string name)
 {
     return(set.GetResource(name, BitmapFromByteArray, () => BitmapFromResource(AlephTheme.GetDefaultResourceUri(name))));
 }
コード例 #9
0
 public static System.Drawing.Icon GetIconResource(this AlephThemeSet set, string name)
 {
     return(set.GetResource(name, IconFromByteArray, () => IconFromResource(AlephTheme.GetDefaultResourceUri(name))));
 }
コード例 #10
0
 public static BitmapImage GetBitmapImageResource(this AlephThemeSet set, string name)
 {
     return(set.GetResource(name, BitmapImageFromByteArray, () => new BitmapImage(AlephTheme.GetDefaultResourceUri(name))));
 }
コード例 #11
0
 private ThemeManager(ThemeCache c)
 {
     Cache        = c;
     CurrentTheme = c.GetFallback();
 }