Пример #1
0
        public static GlareSetAttributes GetGlareSetAttributes(string name, InitGlareSetAttributes init_attributes)
        {
            GlareSetAttributes gsd = null;

            if (core_common.glaresets != null)
            {
                foreach (GlareSetAttributes d in core_common.glare_attribs)
                {
                    if (String.Compare(d.Name, name, true) == 0)
                    {
                        gsd = d;
                    }
                }
            }
            if (gsd == null)
            {
                gsd = new GlareSetAttributes(name);
                core_common.glare_attribs.Add(gsd);
                if (init_attributes != null)
                {
                    init_attributes(gsd);
                }
            }
            return(gsd);
        }
Пример #2
0
 public GlareSet(GlareSet original)
 {
     // maybe just use the same attribute reference...
     attrib = original.attrib;            // new GlareSetAttributes( original.attrib );
     images = original.images;
     state  = GlareState.Normal;
 }
Пример #3
0
 public GlareSetAttributes(GlareSetAttributes original)
 {
     this.Primary          = original.Primary;
     this.Secondary        = original.Secondary;
     this.Tertiary         = original.Tertiary;
     this.TextColor        = original.TextColor;
     this.PrimaryHighlight = original.PrimaryHighlight;
     this.secondary        = original.SecondaryHighlight;
 }
Пример #4
0
        public Bitmap composite;         // temp image which represents the composite glare?

        public GlareSet()
        {
            attrib = new GlareSetAttributes();
            images = core_common.GetGlareSetData("default");
            attrib = core_common.GetGlareSetAttributes("default");

            if (images.mask != null)
            {
                composite = new Bitmap(images.mask.Width, images.mask.Height);
            }
            state = GlareState.Normal;
        }
Пример #5
0
        public static bool Load(XPathNavigator r)
        {
            if (r.NodeType == XPathNodeType.Element)
            {
                if (String.Compare(r.Name, "glare_set_attributes", true) == 0)
                {
                    bool everokay = false;
                    bool okay;
                    GlareSetAttributes gsa = null;
                    for (okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNextAttribute())
                    {
                        everokay = true;
                        switch (r.Name)
                        {
                        case "name":
                            gsa = core_common.GetGlareSetAttributes(r.Value);
                            break;

                        case "primary":
                            gsa.Primary = Color.FromArgb(Convert.ToInt32(r.Value, 10));
                            break;

                        case "secondary":
                            gsa.Secondary = Color.FromArgb(Convert.ToInt32(r.Value));
                            break;

                        case "highlight_primary":
                            gsa.PrimaryHighlight = Color.FromArgb(Convert.ToInt32(r.Value));
                            break;

                        case "text_color":
                            gsa.TextColor = Color.FromArgb(Convert.ToInt32(r.Value));
                            break;

                        case "highlight_secondary":
                            gsa.SecondaryHighlight = Color.FromArgb(Convert.ToInt32(r.Value));
                            break;
                            //case "decal":
                            //	gsa.SetDecalName( r.Value );
                            //	break;
                        }
                    }
                    if (everokay)
                    {
                        r.MoveToParent();
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #6
0
        public void ColorMask(Bitmap src, Graphics d, Bitmap dest, GlareSetAttributes imageAtt, bool highlight)
        {
            // Create an ImageAttributes object and set its color matrix.
            d.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
            d.Clear(Color.Transparent);
            //d.FillRectangle(Brushes.Transparent, 0, 0, dest.Width, dest.Height);
            d.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
            switch (glare_type)
            {
            case GlareType.noshade:
                d.DrawImage(src
                            , new Rectangle(0, 0, dest.Width, dest.Height) // destination rectangle
                            , 0.0f                                         // source rectangle x
                            , 0.0f                                         // source rectangle y
                            , src.Width                                    // source rectangle width
                            , src.Height                                   // source rectangle height
                            , GraphicsUnit.Pixel
                            );                                             // no attribute matrix.
                break;

            case GlareType.monoshade:
                d.DrawImage(src
                            , new Rectangle(0, 0, dest.Width, dest.Height) // destination rectangle
                            , 0.0f                                         // source rectangle x
                            , 0.0f                                         // source rectangle y
                            , src.Width                                    // source rectangle width
                            , src.Height                                   // source rectangle height
                            , GraphicsUnit.Pixel
                            , imageAtt.imageAttMono
                            );
                break;

            case GlareType.multishade:
                d.DrawImage(src
                            , new Rectangle(0, 0, dest.Width, dest.Height) // destination rectangle
                            , 0.0f                                         // source rectangle x
                            , 0.0f                                         // source rectangle y
                            , src.Width                                    // source rectangle width
                            , src.Height                                   // source rectangle height
                            , GraphicsUnit.Pixel
                            , highlight ? imageAtt.imageAttHighlight : imageAtt.imageAtt
                            );
                break;
            }
        }
Пример #7
0
 internal static bool Load(XPathNavigator r)
 {
     if (font_tracker.Load(r))
     {
         return(true);
     }
     if (GlareSetAttributes.Load(r))
     {
         return(true);
     }
     if (GlareSetData.Load(r))
     {
         return(true);
     }
     switch (r.Name.ToLower())
     {
     case "systemname":
         systems.Add(r.Value);
         break;
     }
     return(false);
 }
Пример #8
0
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            GlareSetAttributes gsd = listBox2.SelectedItem as GlareSetAttributes;

            if (attrib_last_selection != null)
            {
                if (!attrib_last_selection.Equals(gsd))
                {
                    attrib_last_selection.Primary            = this.colorWellPrimary.color;
                    attrib_last_selection.PrimaryHighlight   = this.colorWellPrimaryHighlight.color;
                    attrib_last_selection.Secondary          = this.colorWellSecondary.color;
                    attrib_last_selection.SecondaryHighlight = this.colorWellSecondaryHighlight.color;
                    attrib_last_selection.Tertiary           = this.colorWellTertiary.color;
                    attrib_last_selection.TertiaryHighlight  = this.colorWellTertiaryHighlight.color;
                }
            }

            psI_Button2.gs.attrib = gsd;
            if (gsd != null)
            {
                psI_Button2.Refresh();
            }
            psI_Button1.gs.attrib = gsd;
            if (gsd != null)
            {
                psI_Button1.Refresh();
            }

            if (gsd != null)
            {
                this.colorWellPrimary.color            = gsd.Primary;
                this.colorWellPrimaryHighlight.color   = gsd.PrimaryHighlight;
                this.colorWellSecondary.color          = gsd.Secondary;
                this.colorWellSecondaryHighlight.color = gsd.SecondaryHighlight;
                this.colorWellTertiary.color           = gsd.Tertiary;
                this.colorWellTertiaryHighlight.color  = gsd.TertiaryHighlight;
                attrib_last_selection = gsd;
            }
        }
Пример #9
0
        public bool Load(XPathNavigator r)
        {
            if (r.NodeType == XPathNodeType.Element)
            {
                bool okay = false;
retry:
                if (String.Compare(r.Name, "glareset", true) == 0)
                {
                    images = core_common.GetGlareSetData(r.Value);
                    r.MoveToNext();
                    okay = true;
                    goto retry;
                }
                else if (String.Compare(r.Name, "glareset_attributes", true) == 0)
                {
                    attrib = core_common.GetGlareSetAttributes(r.Value);
                    r.MoveToNext();
                    okay = true;
                    goto retry;
                }
                return(okay);
            }
            return(false);
        }
Пример #10
0
 void DefaultAttributes(GlareSetAttributes attrib)
 {
     attrib.SetColor(Color.Red);
     attrib.SetColor2(Color.Black);
     attrib.TextColor = Color.White;
 }
Пример #11
0
 public GlareSet(string name, string attribs)
 {
     attrib = core_common.GetGlareSetAttributes(attribs);
     images = core_common.GetGlareSetData(name);
     state  = GlareState.Normal;
 }
Пример #12
0
 public GlareSet(string name)
 {
     attrib = core_common.GetGlareSetAttributes("default");
     images = core_common.GetGlareSetData(name);
     state  = GlareState.Normal;
 }
Пример #13
0
        public static List <Type> buttons;        // just controls that implement IReflectorButton (for macros)
        static core_common()
        {
            try
            {
                buttons                 = new List <Type>();
                systems                 = new List <string>();
                drop_acceptors          = new List <IReflectorPluginDropFileTarget>();
                directors               = new List <IReflectorDirectionShow>();
                security_modules        = new List <TypeName>();
                plugin_module_acceptors = new List <IReflectorPluginModule>();
                persistant_plugins      = new List <object>();
                assemblies              = new List <osalot.AssemblyTracker>();
                flags     = new _flags();
                glaresets = new List <GlareSetData>();
                mouse_b   = new buttons_class();

                //fonts = new List<font_tracker>();
                layouts = new List <TextLayout>();
                //controls = new List<Control>();

                glare_attribs = new List <GlareSetAttributes>();
                GlareSetAttributes DefaultAttrib = core_common.GetGlareSetAttributes("default");
                DefaultAttrib.Primary   = Color.FromArgb(64, Color.Red);
                DefaultAttrib.Secondary = Color.LightCoral;
                DefaultAttrib.TextColor = Color.White;


                core_common.other_drop          = new ToolStripMenuItem("More Properties");
                core_common.other_drop.DropDown = new ToolStripDropDown();
                // items is expected to be a single toolstrip dropdown type widget
                // it then points at a dropdown of more layers...
                core_common.plugin_drop          = new ToolStripMenuItem("Create Other");
                core_common.plugin_drop.DropDown = new ToolStripDropDown();

                {
                    string workpath = Environment.CurrentDirectory;
                    string s        = Application.ExecutablePath;
                    int    end1     = s.LastIndexOf('/');
                    int    end2     = s.LastIndexOf('\\');
                    string program;
                    if (end1 > end2)
                    {
                        program = s.Substring(end1 + 1);
                    }
                    else
                    {
                        program = s.Substring(end2 + 1);
                    }
                    end1    = program.LastIndexOf('.');
                    program = program.Substring(0, end1);

                    ConfigName = workpath + "/" + program + ".config.xml";

                    if (Environment.OSVersion.Platform == PlatformID.Unix)
                    {
                        if (ConfigName[0] != '/')
                        {
                            ConfigName = "/" + ConfigName;
                        }
                    }
                    xperdex.classes.Log.log("Config name is " + ConfigName);
                }


                core_common.LoadAssembly(Application.ExecutablePath); // load me, myself and I
                core_common.LoadAssembly("xperdex.core.dll");
                core_common.LoadAssembly(null);                       // load me, myself and I : xperdex.core.common.dll

                foreach (osalot.AssemblyTracker tracker in core_common.assemblies)
                {
                    tracker.default_load = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Local failed init: " + e.Message);
            }
            //local.LoadAssembly( Application.ExecutablePath ); // load me, myself and I
        }