Read layout color scheme via Vegas API

Gary James wrote on 9/14/2009, 11:12 AM
I'm writing a dockable Vegas application extension and I would like to make the window color of my Vegas extension match the color of the current Vegas Layout Color scheme.

I've looked through the Vegas Pro Scripting API, and I can't find a property that returns the current Vegas color scheme color.

I've even tried using the Vegas MainWindow property that returns a Win32 HWND value, combined with Win32 API calls to get the Window color, but that always returns White as the window color.

Is there a way to get the current Vegas color scheme so I can set my application extension background color to match?

Comments

altarvic wrote on 9/14/2009, 9:05 PM
Sony.MediaSoftware.Skins.dll
Gary James wrote on 9/16/2009, 6:58 AM
Are the colors reported via this API the current selected Vegas color scheme ?
JohnnyRoy wrote on 9/16/2009, 5:59 PM
> Are the colors reported via this API the current selected Vegas color scheme ?

No, the API does not have any of this information. It would be nice if it did.

~jr
Gary James wrote on 9/17/2009, 5:02 AM
>> Are the colors reported via this API the current selected Vegas color scheme ?
>
>No, the API does not have any of this information. It would be nice if it did.
>
>~jr

Thanks for the info. I agree, this seems like a basic API function that's missing; especially when Sony gives you the ability to create dockable extensions.

I guess I can stop looking for a solution.
ForumAdmin wrote on 9/17/2009, 9:40 AM
If you need more than the controls that are provided in the Sony.MediaSoftware.Skins namespace, there are a some static properties of the Skins class that should help you create your own skinned controls.

The following property will tell you whether Vegas is using custom a custom color scheme:


static public bool UsingCustomColors


The following property contains various color values used for the custom color scheme:



static public SkinColors Colors



The SkinColors class contains the following members:


public class SkinColors
{
public Color ButtonFace;
public Color ButtonText;
public Color ButtonShadow;
public Color ButtonHighlight;
public Color ControlLight;
public Color ControlLightLight;
public Color ControlDarkDark;
public Color ControlDark;
public Color GrayText;
public Color Highlight;
public Color HighlightText;
public Color MenuBackground;
public Color MenuText;
public Color WindowBackground;
public Color WindowText;
}


So, for example, your code may look like this:


using Sony.MediaSoftware.Skins;
...

if (Skins.UsingCustomColors)
{
myCustomControl.BackColor = Skins.Colors.ButtonFace;
myCustomControl.ForeColor = Skins.Colors.ButtonText;
}


Please keep in mind that these objects were designed for internal use and are highly subject to change in a future release.
Peter_P wrote on 12/16/2022, 4:17 AM

Yes this is an old thread but can anyone please help me to use the ScriptPortal.MediaSoftware.Skins  from the ScriptPortal.MediaSoftware.Skins.dll  in the MS Visual Studio designer ? It would be great when I could even use existing forms with these derived classes.

jetdv wrote on 12/16/2022, 8:59 AM

Just add that as a reference and then you can use the pieces inside there. I started to do that one time with Excalibur but there were some other issues involved so I decided not to. Not all controls have a corresponding control in that DLL but you can certainly pull color information from that DLL. I'm doing that with the Import from VEGAS Stream script included with VEGAS Stream. For example:

this.BackColor = ScriptPortal.MediaSoftware.Skins.Skins.Colors.WindowBackground;
chkGroupTracks.BackColor = ScriptPortal.MediaSoftware.Skins.Skins.Colors.WindowBackground;
chkGroupTracks.ForeColor = ScriptPortal.MediaSoftware.Skins.Skins.Colors.WindowText;
chkTakes.BackColor = ScriptPortal.MediaSoftware.Skins.Skins.Colors.WindowBackground;
chkTakes.ForeColor = ScriptPortal.MediaSoftware.Skins.Skins.Colors.WindowText;

For the buttons, I just used the button controls in the Skins DLL file.

Peter_P wrote on 12/16/2022, 9:22 AM

Thanks, but how can I use it within the MS Visual Studio forms designer ?

jetdv wrote on 12/16/2022, 10:06 AM

To get the button on the screen, I added the regular button. And then, in the code where it sets up the button, you'll find something like:

private System.Windows.Forms.Button btnStory;

and you change it to:

private ScriptPortal.MediaSoftware.Skins.Button btnStory;

I don't have the "ScriptPortal" tools where I can drag them to the form. I just add the normal one and then swap them if there is one in ScriptPortal to swap to. In the other code I listed above, that's a checkbox. There isn't a checkbox in ScriptPortal which is why I was manually changing the colors using that code. And then the first line above changes the back color for the main window.

Peter_P wrote on 12/16/2022, 10:36 AM

There isn't a checkbox in ScriptPortal which is why I was manually changing the colors using that code. And then the first line above changes the back color for the main window.

@jetdv

But in a sample I got it says :

#region Windows Form Designer generated code            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.myInputBox = new ScriptPortal.MediaSoftware.Skins.TextBox();

There must be a way to use the VS graphical desiner to edit these forms. If the code is manualy editied it may be reversed using the designer again .

jetdv wrote on 12/16/2022, 10:45 AM

I'm not going to say they can't be added to the list on the left. I've really only used it a couple times to grab colors and, if it had the control I wanted, I'd go ahead and swap to use their control instead by modifying the code to reference "ScriptPortal.MediaSoftware.Skins" instead of "System.Windows.Forms" but I've just been doing everything else using the default tools for design work.

Once the control in changed, they will work in the designer just fine to move, copy, whatever...

I'm also still using Visual Studio 15 - mainly because it simply works to do what I want it to do but, secondly, because I have the full installer downloaded so I can install it without needing to download a few Gig of information off the internet for each machine. I've used some newer versions and they work fine but finding the correct starting point in the newer versions is more difficult than with 15.

Peter_P wrote on 12/16/2022, 10:59 AM

I also use the old VS 15 but manly use one of my existing projects to be altered for new ones.

jetdv wrote on 12/16/2022, 11:09 AM

Peter_P wrote on 12/16/2022, 11:22 AM

Thanks. I'll give it a try tomorrow.
The checkbox seems to be missing in the skins dll.

jetdv wrote on 12/16/2022, 8:22 PM

@Peter_P that's why you see in my first response that I manually set the forecolor and the backcolor on the standard checkbox to those specific colors from the skins.

Peter_P wrote on 12/17/2022, 2:13 AM

@jetdv

Yes, I think this is teh best way to get it done.