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);
        }
Beispiel #2
0
        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();
        }
        public override void Initialize(InitializationContext context)
        {
            _extensionHost = (LiteExtensionHost)context.Host;
            _extensionHost.TemplateService.AddFileSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "File"));
            _extensionHost.TemplateService.AddProjectSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Project"));
            _extensionHost.TemplateService.AddIconSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Icons"));

            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; }
        }
Beispiel #4
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"));
        }
Beispiel #5
0
        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"));
        }