Exemple #1
0
 public GimpDialog(string title, VariableSet variables) :
     this(title, title, IntPtr.Zero, 0, Gimp.StandardHelpFunc, title,
          GimpStock.Reset, (ResponseType)1,
          Stock.Cancel, ResponseType.Cancel,
          Stock.Ok, ResponseType.Ok)
 {
     Variables = variables;
 }
        public void GetData(VariableSet variables)
        {
            var data = ProceduralDb.GetData(_name);

            if (data != null)
            {
                var stream = new MemoryStream(data);
                variables.ForEach(v => v.Deserialize(_formatter, stream));
            }
        }
        public void SetData(VariableSet variables)
        {
            var stream = new MemoryStream();

            variables.ForEach(v => v.Serialize(_formatter, stream));
            if (stream.Length != 0)
            {
                ProceduralDb.SetData(_name, stream.GetBuffer());
            }
        }
Exemple #4
0
        public GimpDialogWithPreview(string title, Drawable drawable,
                                     VariableSet variables,
                                     Func <GimpPreview> factory) :
            base(title, variables)
        {
            Drawable = drawable;

            Vbox = new VBox(false, 0)
            {
                BorderWidth = 12
            };
            VBox.PackStart(Vbox, true, true, 0);

            Preview = factory();

            Preview.Invalidated += delegate { UpdatePreview(Preview); };

            Vbox.PackStart(Preview, true, true, 0);

            variables.ValueChanged += delegate { InvalidatePreview(); };
        }
Exemple #5
0
        protected static void GimpMain <T>(string[] args,
                                           VariableSet variables = null)
            where T : Plugin, new()
        {
            var plugin = new T()
            {
                Variables = variables
            };

            Catalog.Init(typeof(T).Name, Gimp.LocaleDirectory);

            _info.Init  = plugin.HasMethod("Init") ? new InitProc(plugin.Init) : null;
            _info.Quit  = plugin.HasMethod("Quit") ? new QuitProc(plugin.Quit) : null;
            _info.Query = new QueryProc(plugin.Query);
            _info.Run   = new RunProc(plugin.Run);

            var progargs = new string[args.Length + 1];

            progargs[0] = "gimp-sharp";
            args.CopyTo(progargs, 1);

            gimp_main(ref _info, progargs.Length, progargs);
        }
Exemple #6
0
 protected BaseRenderer(VariableSet variables)
 {
     Variables = variables;
 }
Exemple #7
0
 public ParamDefList(VariableSet variables) : this()
 {
     variables.ForEach(v => Add(new ParamDef(v.Identifier, v.Type, v.Description)));
 }
Exemple #8
0
 public void Register(VariableSet variables)
 {
     ValueChanged += delegate { variables.Changed(); };
 }