Posted 15 years ago
by Matt Kerchmar

Hello,
I am working on a fonts and colors dialog at the moment. The Quickstart that shows how to set something like this up is using the AmbientHighlightingStyleRegistry. I was able to get this all set up, and the dialog is functional. But the changes seem to be immediate in the application, so clicking cancel on the dialog doesn't undo the changes.
What would be a good approach to this problem? My initial thought was that I should create a new style registry in the window with the syntax editor. I could then modify the syntax language constructor to take a style registry as an argument, then pass that style registry into the classification type provider constructor from within the syntax language constructor.
What I expected to happen then was that there would be no syntax highlighting at all in the syntax editor (since I had essentially disconnected the ambient registry). This did happen as expected. But when I went into my fonts and colors dialog and made changes (which affect the ambient registry), the changes were reflected in the syntax editor.
I'm curious what remains connected between the ambient registry and my syntax editor control. Further, I'm wondering if there is a more correct way to do this.
One last question, I have multiple types of windows that display syntax highlighted code (an output window and document style input windows). They all use the same syntax language, but I want the user to be able to override their highlighting settings individually. I thought that this also could be solved with multiple registries. Does this sound like a reasonable approach?
Thanks,
Matt Kerchmar
[Modified at 02/03/2010 01:36 PM]
I am working on a fonts and colors dialog at the moment. The Quickstart that shows how to set something like this up is using the AmbientHighlightingStyleRegistry. I was able to get this all set up, and the dialog is functional. But the changes seem to be immediate in the application, so clicking cancel on the dialog doesn't undo the changes.
What would be a good approach to this problem? My initial thought was that I should create a new style registry in the window with the syntax editor. I could then modify the syntax language constructor to take a style registry as an argument, then pass that style registry into the classification type provider constructor from within the syntax language constructor.
What I expected to happen then was that there would be no syntax highlighting at all in the syntax editor (since I had essentially disconnected the ambient registry). This did happen as expected. But when I went into my fonts and colors dialog and made changes (which affect the ambient registry), the changes were reflected in the syntax editor.
I'm curious what remains connected between the ambient registry and my syntax editor control. Further, I'm wondering if there is a more correct way to do this.
One last question, I have multiple types of windows that display syntax highlighted code (an output window and document style input windows). They all use the same syntax language, but I want the user to be able to override their highlighting settings individually. I thought that this also could be solved with multiple registries. Does this sound like a reasonable approach?
Thanks,
Matt Kerchmar
[Modified at 02/03/2010 01:36 PM]