public SledLuaLanguagePlugin(MainForm mainForm)
        {
            RegisterImages();

            var embeddedTypeInfo = new SledDocumentEmbeddedTypeInfo(typeof(SledLuaFunctionToolbar), SledDocumentEmbeddedTypePosition.Top);

            m_luaDocumentClient =
                new SledDocumentClient(
                    "Lua",
                    Resources.Resource.LuaExtension,
                    Shared.Utilities.SledIcon.FileNewLua,
                    new SledLuaDocumentSyntaxHighlighter(),
                    embeddedTypeInfo);
        }
示例#2
0
        public SledDocumentService(
            MainForm mainForm,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IFileDialogService fileDialogService,
            IControlHostService controlHostService)
            : base(commandService, documentRegistry, fileDialogService)
        {
            m_mainForm           = mainForm;
            m_commandService     = commandService;
            m_contextRegistry    = contextRegistry;
            m_documentRegistry   = documentRegistry;
            m_fileDialogService  = fileDialogService;
            m_controlHostService = controlHostService;

            m_mainForm.Shown    += MainFormShown;
            m_mainForm.DragOver += MainFormDragOver;
            m_mainForm.DragDrop += MainFormDragDrop;

            // Relay this event
            m_documentRegistry.ActiveDocumentChanged += DocumentRegistryActiveDocumentChanged;

            // Everything but the copious new & open
            RegisterCommands =
                CommandRegister.FileClose |
                CommandRegister.FileSave |
                CommandRegister.FileSaveAll |
                CommandRegister.FileSaveAs;

            //
            // Register default document types
            //

            m_txtDocumentClient =
                new SledDocumentClient(
                    "Text",
                    ".txt",
                    Atf.Resources.DocumentImage,
                    true,
                    new SledDocumentLanguageSyntaxHighlighter(Languages.Text));

            m_xmlDocumentClient =
                new SledDocumentClient(
                    "Xml",
                    ".xml",
                    Atf.Resources.DocumentImage,
                    new SledDocumentLanguageSyntaxHighlighter(Languages.Xml));

            m_csDocumentClient =
                new SledDocumentClient(
                    "C#",
                    ".cs",
                    Atf.Resources.DocumentImage,
                    new SledDocumentLanguageSyntaxHighlighter(Languages.Csharp));

            m_pyDocumentClient =
                new SledDocumentClient(
                    "Python",
                    ".py",
                    Atf.Resources.DocumentImage,
                    new SledDocumentLanguageSyntaxHighlighter(Languages.Python));

            // One time setup
            SledDocument.ControlHostClient = this;

            // Do not use the system clipboard until further
            // safety measures can be added. Ron Little, 5/26/2011
            StandardEditCommands.UseSystemClipboard = false;

            // Check if any command line args
            var bFirst = true;

            foreach (var arg in Environment.GetCommandLineArgs())
            {
                // First one is application .exe
                if (bFirst)
                {
                    bFirst = false;
                    continue;
                }

                // Skip non-files
                if (!File.Exists(arg))
                {
                    continue;
                }

                // Skip project files
                if (SledUtil.FileEndsWithExtension(arg, SledProjectService.ProjectExtensions))
                {
                    continue;
                }

                m_lstStartupFiles.Add(arg);
            }
        }