Example #1
0
        protected override void CreateMask(MaskDef Def)
        {
            RectangleGeometry RectG = new RectangleGeometry(Def.Rect);

            RectG.SetValue(TagProperty, Def);
            Masks.Children.Add(RectG);

            if (EditMode.Visibility == Visibility.Visible)
            {
                ClippingMode.EditModeSetup.CreateSelectionRect(EditMode, RectG, R => RectG.Rect = R);
            }
        }
Example #2
0
        protected override void SaveSettings()
        {
            Point P = this.GetDpiScale();

            AppConfig.Current.Masks = Application.Current.Windows.CastOnly <Mask>().Select(x => {
                MaskDef Def = x.AsDef();
                StoreProfileOffset(Def.ProfileId, Def.Rect, P);
                return(Def);
            });

            base.SaveSettings();

            AppConfig.Current.GadgetPos = new Point(Top, Left);
            AppConfig.Current.Save();
        }
Example #3
0
        public Mask(MaskDef Def)
        {
            InitializeComponent();

            Top       = Def.Rect.Top;
            Left      = Def.Rect.Left;
            Width     = Def.Rect.Width;
            Height    = Def.Rect.Height;
            Topmost   = Def.AlwaysOnTop;
            ProfileId = Def.ProfileId;

            Background = new SolidColorBrush(Color.FromArgb(Def.BgColor[0], Def.BgColor[1], Def.BgColor[2], Def.BgColor[3]));

            (( ContextMenu )Resources["MainMenu"]).Items
            .CastOnly <MenuItem>()
            .First(x => x.Name == "AlwaysOnTop")
            .IsChecked = Topmost;
        }
Example #4
0
        protected override void SaveSettings()
        {
            Point P = this.GetDpiScale();

            AppConfig.Current.Masks = Masks.Children
                                      .CastOnly <RectangleGeometry>().Skip(1)
                                      .Select(x =>
            {
                MaskDef Def = (x.GetValue(TagProperty) as MaskDef) ?? new MaskDef();
                Def.Rect    = x.Rect;

                StoreProfileOffset(Def.ProfileId, Def.Rect, P);
                return(Def);
            });

            base.SaveSettings();

            AppConfig.Current.AlwaysOnTop = Topmost;
            AppConfig.Current.Save();
        }
Example #5
0
        protected override void CreateMask(MaskDef Def)
        {
            Mask SMask = new Mask(Def);

            SMask.Show();
        }
Example #6
0
 protected abstract void CreateMask(MaskDef Def);
 public static MaskDef Disable(this MaskDef mask, MaskDef flag)
 {
     mask &= ~flag;
     return(mask);
 }
 public static MaskDef Enable(this MaskDef mask, MaskDef flag)
 {
     mask |= flag;
     return(mask);
 }
 public static bool IsEnabled(this MaskDef mask, MaskDef flag)
 {
     return((mask & flag) != 0);
 }