private IClassificationTypeRegistryService ClassificationRegistry = null; //MEF

        public WpfTextViewResources()
        {
            if (renderingManager == null)
            {
                lock (textViews)
                {
                    if (renderingManager == null)
                    {
                        renderingManager = new RenderingManager(new HtmlRenderer());
                    }
                }
            }
        }
Пример #2
0
        public TeXCommentAdornmentTagger(
            IWpfTextView textView,
            IRenderingManager renderingManager,
            ITagAggregator <TeXCommentTag> texCommentTagger)
            : base(textView, texCommentTagger, IntraTextAdornmentTaggerDisplayMode.DoNotHideOriginalText_BeforeLastLineBreak)
        {
            this.renderingManager        = renderingManager;
            textView.TextBuffer.Changed += TextBuffer_Changed;

            vsSettings = VsSettings.GetOrCreate(textView);
            vsSettings.CommentsColorChanged += ColorsChanged;
            vsSettings.ZoomChanged          += ZoomChanged;
            ExtensionSettings.Instance.CustomZoomChanged += CustomZoomChanged;
        }
        public TeXCommentAdornment(
            IWpfTextView textView,
            TeXCommentTag tag,
            LineSpan lineSpan,
            double lastLineWidthWithoutStartWhiteSpaces,
            TeXCommentAdornmentState initialState,
            Action <Span> refreshTags,
            Action <bool> setIsInEditModeForAllAdornmentsInDocument,
            Action <TeXCommentTag, string> addAttribute,
            IRenderingManager renderingManager,
            IVsSettings vsSettings)
        {
            ExtensionSettings.Instance.CustomZoomChanged += CustomZoomChanged;
            textView.Caret.PositionChanged += Caret_PositionChanged;

            this.DataTag     = tag;
            this.refreshTags = refreshTags;
            this.setIsInEditModeForAllAdornmentsInDocument = setIsInEditModeForAllAdornmentsInDocument;
            this.addAttribute = addAttribute;
            this.textView     = textView;
            this.lastLineWidthWithoutStartWhiteSpaces = lastLineWidthWithoutStartWhiteSpaces;
            this.renderingManager = renderingManager;
            VsSettings            = vsSettings;
            ResourcesManager      = ResourcesManager.GetOrCreate(textView);
            LineSpan = lineSpan;

            InitializeComponent();

            previewAdorner = new PreviewAdorner(this, ResourcesManager, vsSettings);
            Loaded        += (s, e) =>
            {
                if (previewAdorner.Parent == null)
                {
                    previewAdorner.OffsetX = -this.lastLineWidthWithoutStartWhiteSpaces; //'this' is important because of lambda closure
                    System.Windows.Documents.AdornerLayer.GetAdornerLayer(this).Add(previewAdorner);
                }
            };

            //for correctly working binding
            NameScope.SetNameScope(btnShow.ContextMenu, NameScope.GetNameScope(this));
            NameScope.SetNameScope(btnEdit.ContextMenu, NameScope.GetNameScope(this));
            NameScope.SetNameScope((ToolTip)imgError.ToolTip, NameScope.GetNameScope(this));

            CurrentState = initialState;
        }
        public unsafe RendererWindow(int WindowX, int WindowY, String Name, RendererType Flags, uint Width, uint Height)// int X, int Y, int Width, int Height, SDL2.SDL_WINDOW_FLAGS Flags = SDL2.SDL_WINDOW_FLAGS.SDL_WINDOW_VULKAN)
        {
            switch (Flags)
            {
            case RendererType.OPENGL:
                SDL2.SDL.SDL_InitSubSystem((uint)SDL_INIT_FLAGS.SDL_INIT_VIDEO);
                SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_ES);
                SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 2);
                SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 1);
                WindowHandle = SDL2.SDL.SDL_CreateWindow(Name, WindowX, WindowY, (int)Width, (int)Height, SDL2.SDL_WINDOW_FLAGS.SDL_WINDOW_OPENGL);
                if (WindowHandle == IntPtr.Zero)     // Failed to Create Window
                {
                    throw new RENDER_WINDOW_CREATION_FAILED("Failed to create window that is compatible with OpenGL.");
                }
                int Index = SDL2.SDL.SDL_GetWindowDisplayIndex(WindowHandle);
                WindowID = SDL2.SDL.SDL_GetWindowID(WindowHandle);
                var Res = SDL2.SDL.SDL_GL_GetCurrentWindow();

                SDL_GLcontext context = (SDL_GLcontext)SDL2.SDL.SDL_GL_CreateContext(WindowHandle);
                int           Result  = SDL2.SDL.SDL_GL_MakeCurrent(WindowHandle, (IntPtr)context);
                SDL_CreateRenderer(WindowHandle, -1, SDL_RendererFlags.SDL_RENDERER_ACCELERATED);


                Gl.Initialize();

                if (Result != 0)
                {
                    throw new RENDER_WINDOW_CREATION_FAILED("Failed to properly initialize OpenGL");
                }

                // Gl.BindAPI();
                myEngineToUse = new OpenGLRenderer();
                break;

            case RendererType.VULKAN:
                SDL2.SDL.SDL_InitSubSystem((uint)SDL_INIT_FLAGS.SDL_INIT_VIDEO);
                WindowHandle = SDL2.SDL.SDL_CreateWindow(Name, WindowX, WindowY, (int)Width, (int)Height, SDL2.SDL_WINDOW_FLAGS.SDL_WINDOW_VULKAN);
                if (WindowHandle == IntPtr.Zero)     // Failed to Create Window
                {
                    throw new RENDER_WINDOW_CREATION_FAILED("Failed to create window that is compatible with Vulkan.");
                }
                break;
            }
        }
Пример #5
0
 public void Initialize(IRenderingManager myRenderer)
 {
     myRenderEngine = myRenderer;
 }