Exemple #1
0
        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

            ExposeEvent += delegate { sliceData.Draw(Renderer); };
            Realized    += delegate
            {
                var gc = new Gdk.GC(GdkWindow);
                Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
                Draw(drawable);
            };
            SizeAllocated += delegate { Draw(drawable); };

            Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
                     EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
                     EventMask.LeaveNotifyMask;

            ButtonPressEvent += (o, args) =>
            {
                var c = new IntCoordinate((int)args.Event.X, (int)args.Event.Y);
                Func.GetActualFunc(c).OnButtonPress(o, args);
            };

            MotionNotifyEvent += (o, args) =>
            {
                GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

            Func = new SelectFunc(sliceData, this);
        }
Exemple #2
0
        public static MouseFunc GetActualFunc(IntCoordinate c, MouseFunc func)
        {
            var slice = func.SliceData.FindSlice(c);

            return(func.SliceIsSelectable(slice)
        ? new MoveSliceFunc(func.SliceData, func.Preview, slice) : func);
        }
Exemple #3
0
        RadioToolButton AddToggle(RadioToolButton group, string icon, 
			      string tooltipText, MouseFunc func)
        {
            var list = (group == null) ? null : group.Group;

              var toggle = new RadioToolButton(list, icon) {TooltipText = tooltipText};
              toggle.Clicked += delegate
            {
              if (toggle.Active)
              {
            _preview.Func = func;
              }
            };

              Insert(toggle, -1);
              return toggle;
        }
Exemple #4
0
        RadioToolButton AddToggle(RadioToolButton group, string icon,
                                  string tooltipText, MouseFunc func)
        {
            var list = group?.Group;

            var toggle = new RadioToolButton(list, icon)
            {
                TooltipText = tooltipText
            };

            toggle.Clicked += delegate
            {
                if (toggle.Active)
                {
                    _preview.Func = func;
                }
            };

            Insert(toggle, -1);
            return(toggle);
        }
Exemple #5
0
 public static MouseFunc GetActualFunc(IntCoordinate c, MouseFunc func)
 {
     var slice = func.SliceData.FindSlice(c);
       return (func.SliceIsSelectable(slice))
     ? new MoveSliceFunc(func.SliceData, func.Preview, slice) : func;
 }