public override void LoadUserDefinedPresets()
        {
            _appearanceMaps.Clear();
            extensionsComboBox.Items.Clear();

            foreach (var extension in _extensionHost.ExtensionManager.LoadedExtensions)
            {
                var provider = extension as IAppearanceMapProvider;

                if (provider != null)
                {
                    var mapCopy = new AppearanceMap();
                    provider.CurrentAppearanceMap.CopyTo(mapCopy);
                    _appearanceMaps.Add(provider, mapCopy);

                    if (extension is LiteDevelopExtension)
                        extensionsComboBox.Items.Add(_globalIdentifier);
                    else
                        extensionsComboBox.Items.Add(extension.Name);
                }
            }

            splitContainer1.Panel2.Enabled = false;
            foreColorPanel.BackColor = backColorPanel.BackColor = Color.Transparent;

            extensionsComboBox.Sorted = true;
            extensionsComboBox.SelectedIndex = 0;
            UpdateListView();
        }
Ejemplo n.º 2
0
        public void CopyTo(AppearanceMap destination)
        {
            destination.Descriptions.Clear();

            for (int i = 0; i < Descriptions.Count; i++)
            {
                var description = new AppearanceDescription();
                this.Descriptions[i].CopyTo(description);
                destination.Descriptions.Add(description);
            }
        }
Ejemplo n.º 3
0
        public StyleMap(AppearanceMap map, AppearanceMap fallBackMap)
        {
            _map = map;
            _fallBackMap = fallBackMap;

            KeywordStyle = new DynamicTextStyle(GetDescription("Keyword"));
            StringStyle = new DynamicTextStyle(GetDescription("String"));
            NumberStyle = new DynamicTextStyle(GetDescription("Number"));
            TypeDefinitionStyle = new DynamicTextStyle(GetDescription("TypeDefinition"));
            CommentStyle = new DynamicTextStyle(GetDescription("Comment"));
            AttributeStyle = new DynamicTextStyle(GetDescription("Attribute"));
            BreakpointStyle = new DynamicTextStyle(GetDescription("Breakpoint"));
            InstructionPointer = new DynamicTextStyle(GetDescription("InstructionPointer"));
        }
Ejemplo n.º 4
0
        public void CopyTo(AppearanceMap destination)
        {
            for (int i = 0; i < Descriptions.Count; i++)
            {
                var source = Descriptions[i];
                var target = destination.GetDescriptionById(source.ID);

                if (target == null)
                {
                    target = new AppearanceDescription();
                    destination.Descriptions.Add(target);
                }

                source.CopyTo(target);
            }
        }
Ejemplo n.º 5
0
        public object Clone()
        {
            var newMap = new AppearanceMap()
            {
                Name = this.Name
            };

            foreach (var description in Descriptions)
            {
                var newDescription = new AppearanceDescription();
                description.CopyTo(newDescription);
                newMap.Descriptions.Add(newDescription);
            }

            return(newMap);
        }
Ejemplo n.º 6
0
        public object Clone()
        {
            var newMap = new AppearanceMap()
            {
                Name = this.Name
            };

            foreach (var description in Descriptions)
            {
                var newDescription = new AppearanceDescription();
                description.CopyTo(newDescription);
                newMap.Descriptions.Add(newDescription);
            }

            return newMap;
        }
        public StyleMap(AppearanceMap map, AppearanceMap fallBackMap)
        {
            _map = map;
            _fallBackMap = fallBackMap;

            DefaultText = new DynamicTextStyle(GetDescription("DefaultText"));
            KeywordStyle = new DynamicTextStyle(GetDescription("Keyword"));
            StringStyle = new DynamicTextStyle(GetDescription("String"));
            NumberStyle = new DynamicTextStyle(GetDescription("Number"));
            TypeDefinitionStyle = new DynamicTextStyle(GetDescription("TypeDefinition"));
            CommentStyle = new DynamicTextStyle(GetDescription("Comment"));
            LineNumbers = new DynamicTextStyle(GetDescription("LineNumbers"));
            AttributeStyle = new DynamicTextStyle(GetDescription("Attribute"));
            BookmarkStyle = new DynamicTextStyle(GetDescription("Bookmark"));
            BreakpointStyle = new DynamicTextStyle(GetDescription("Breakpoint"));
            InstructionPointerStyle = new DynamicTextStyle(GetDescription("InstructionPointer"));
            ShadowInstructionPointerStyle = new DynamicTextStyle(GetDescription("ShadowInstructionPointer"));
            CurrentLineStyle = new DynamicTextStyle(GetDescription("CurrentLine"));
            ChangedLineStyle = new DynamicTextStyle(GetDescription("ChangedLine"));
            SelectionStyle = new DynamicTextStyle(GetDescription("Selection"));
        }
Ejemplo n.º 8
0
        public override void Initialize(InitializationContext context)
        {
            _extensionHost = (LiteExtensionHost)context.Host;

            var generalSettingsEditorControl = new GeneralSettingsEditor(_settings = LiteDevelopSettings.Instance) { Dock = DockStyle.Fill };
            var internationalSettingsEditorControl = new InternationalSettingsEditor(_settings) { Dock = DockStyle.Fill };
            var appearanceEditorControl = new AppearanceEditor() { Dock = DockStyle.Fill };

            var generalSettingsNode = new SettingsNode("General", generalSettingsEditorControl);
            var internationalSettingsNode = new SettingsNode("International", internationalSettingsEditorControl);
            var appearanceNode = new SettingsNode("Appearance", appearanceEditorControl);

            _settingsNode = new SettingsNode("LiteDevelop", generalSettingsEditorControl);
            _settingsNode.Nodes.AddRange(new TreeNode[]
            {
                generalSettingsNode,
                appearanceNode,
                internationalSettingsNode,
            });

            _componentMuiIdentifiers = new Dictionary<object, string>()
            {
                {generalSettingsNode, "LiteDevelopExtension.GeneralSettings"},
                {appearanceNode, "LiteDevelopExtension.Appearance"},
                {internationalSettingsNode, "LiteDevelopExtension.InternationalSettings"},
            };

            _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged;
            extensionHost_UILanguageChanged(null, null);

            _appearanceMapPath = Path.Combine(Constants.AppDataDirectory, "appearance.xml");
            _defaultAppearanceMap  = AppearanceMap.LoadFromFile(Path.Combine(
                    Path.GetDirectoryName(typeof(LiteDevelopExtension).Assembly.Location),
                    "default_appearance.xml"));

            try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); }
            catch { _appearanceMap = _defaultAppearanceMap; }
        }
Ejemplo n.º 9
0
        private void SetupGui()
        {
            ExtensionHost.ControlManager.InvokeOnMainThread(new Action(() =>
            {
                MuiProcessor = new MuiProcessor(ExtensionHost, Path.Combine(Path.GetDirectoryName(typeof(CodeEditorExtension).Assembly.Location), "MUI"));

                AddToMuiIdentifiers(SetupSettingsControls());
                AddToMuiIdentifiers(SetupToolbar());
                AddStatusBarItems();

                ExtensionHost.UILanguageChanged += ExtensionHost_UILanguageChanged;
                ExtensionHost_UILanguageChanged(null, null);
            }));

            _appearanceMapPath = Path.Combine(ExtensionHost.SettingsManager.GetSettingsDirectory(this), "appearance.xml");
            _defaultAppearanceMap = AppearanceMap.LoadFromFile(Path.Combine(
                    Path.GetDirectoryName(typeof(CodeEditorExtension).Assembly.Location),
                    "CodeEditor", "default_appearance.xml"));

            try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); }
            catch
            {
                _appearanceMap = new AppearanceMap();
                _defaultAppearanceMap.CopyTo(_appearanceMap);
            }

            StyleMap = new Gui.Styles.StyleMap(_appearanceMap, _defaultAppearanceMap);
        }
Ejemplo n.º 10
0
 public AppearanceProcessor(AppearanceMap map)
 {
     _appearanceMap = map;
 }
Ejemplo n.º 11
0
        public void CopyTo(AppearanceMap destination)
        {
            destination.Descriptions.Clear();

            for (int i = 0; i < Descriptions.Count; i++)
            {
                var description = new AppearanceDescription();
                this.Descriptions[i].CopyTo(description);
                destination.Descriptions.Add(description);
            }
        }
 public void CopyTo(AppearanceMap destination)
 {            
     for (int i = 0; i < Descriptions.Count; i++)
     {
         var source = Descriptions[i];
         var target = destination.GetDescriptionById(source.ID);
         
         if (target == null)
         {
             target = new AppearanceDescription();
             destination.Descriptions.Add(target);
         }
         
         source.CopyTo(target);
     }
 }