コード例 #1
0
ファイル: STTool.cs プロジェクト: xclouder/STTool
    }//ShowS...()_end
    
    //Draw the window.
    private void OnGUI()
    {
        EditorGUILayout.BeginVertical();

		isEnabled = EditorGUILayout.Toggle("Enable", isEnabled, GUILayout.Width(160));

        editTarget = (EditTarget)EditorGUILayout.EnumPopup("EditTarget", editTarget);

		author = EditorGUILayout.TextField("Author(#Author#):", author, GUILayout.Width(200));
		company = EditorGUILayout.TextField("Company(#Company#):", company, GUILayout.Width(200));

		if (GUILayout.Button("Save Params", GUILayout.Width(160)))
			SaveSettings();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("ScriptTemplate");
        EditorGUILayout.Space();
        if (GUILayout.Button("Current", GUILayout.Width(60)))
            GetScriptTemplateText();
        if (GUILayout.Button("Save", GUILayout.Width(60)))
            SaveScriptTemplate();
        EditorGUILayout.EndHorizontal();

		scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
		sTText = EditorGUILayout.TextArea(sTText, GUILayout.ExpandHeight(true));
		EditorGUILayout.EndScrollView();

        EditorGUILayout.EndVertical();
    }//OnGUI()_end
コード例 #2
0
		private void HandleApply (object sender, EventArgs args)
		{
			BrowsablePointer item = view.Item;
			EditTarget target = new EditTarget (item);
			try { 
				using (ImageFile img = ImageFile.Create (item.Current.DefaultVersionUri)) {

					Cairo.Format format = view.CompletePixbuf ().HasAlpha ? Cairo.Format.Argb32 : Cairo.Format.Rgb24;

					MemorySurface dest = new MemorySurface (format,
										info.Bounds.Width,
										info.Bounds.Height);

					Context ctx = new Context (dest);
					effect.OnExpose (ctx, info.Bounds);
					((IDisposable)ctx).Dispose ();

					string tmp = ImageFile.TempPath (item.Current.DefaultVersionUri.LocalPath);
					using (Gdk.Pixbuf output = Widgets.CairoUtils.CreatePixbuf (dest)) {
						using (System.IO.Stream stream = System.IO.File.OpenWrite (tmp)) {
							img.Save (output, stream);
						
						}
					}

					dest.Destroy ();

					// FIXME Not this again. I need to imlplement a real version of the transfer
					// function that shows progress in the main window and allows for all the
					// goodies we'll need.
					Gnome.Vfs.Result result = Gnome.Vfs.Result.Ok;
					result = Gnome.Vfs.Xfer.XferUri (new Gnome.Vfs.Uri (UriList.PathToFileUri (tmp).ToString ()),
									 new Gnome.Vfs.Uri (target.Uri.ToString ()),
									 Gnome.Vfs.XferOptions.Default,
									 Gnome.Vfs.XferErrorMode.Abort, 
									 Gnome.Vfs.XferOverwriteMode.Replace, 
									 delegate {
										 System.Console.Write (".");
										 return 1;
									 });

					target.Commit ();
				}
			} catch (System.Exception e) {
				System.Console.WriteLine (e);
				target.Delete ();
				Dialog d = new EditExceptionDialog ((Gtk.Window) view.Toplevel, e, view.Item.Current);
				d.Show ();
				d.Run ();
				d.Destroy ();
			}
			Destroy ();
		}
コード例 #3
0
        private void HandleApply(object sender, EventArgs args)
        {
            BrowsablePointer item   = view.Item;
            EditTarget       target = new EditTarget(item);

            try {
                using (ImageFile img = ImageFile.Create(item.Current.DefaultVersionUri)) {
                    Cairo.Format format = view.CompletePixbuf().HasAlpha ? Cairo.Format.Argb32 : Cairo.Format.Rgb24;

                    MemorySurface dest = new MemorySurface(format,
                                                           info.Bounds.Width,
                                                           info.Bounds.Height);

                    Context ctx = new Context(dest);
                    effect.OnExpose(ctx, info.Bounds);
                    ((IDisposable)ctx).Dispose();

                    string tmp = ImageFile.TempPath(item.Current.DefaultVersionUri.LocalPath);
                    using (Gdk.Pixbuf output = Widgets.CairoUtils.CreatePixbuf(dest)) {
                        using (System.IO.Stream stream = System.IO.File.OpenWrite(tmp)) {
                            img.Save(output, stream);
                        }
                    }

                    dest.Destroy();

                    // FIXME Not this again. I need to imlplement a real version of the transfer
                    // function that shows progress in the main window and allows for all the
                    // goodies we'll need.
                    Gnome.Vfs.Result result = Gnome.Vfs.Result.Ok;
                    result = Gnome.Vfs.Xfer.XferUri(new Gnome.Vfs.Uri(UriList.PathToFileUri(tmp).ToString()),
                                                    new Gnome.Vfs.Uri(target.Uri.ToString()),
                                                    Gnome.Vfs.XferOptions.Default,
                                                    Gnome.Vfs.XferErrorMode.Abort,
                                                    Gnome.Vfs.XferOverwriteMode.Replace,
                                                    delegate {
                        System.Console.Write(".");
                        return(1);
                    });

                    target.Commit();
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                target.Delete();
                Dialog d = new EditExceptionDialog((Gtk.Window)view.Toplevel, e, view.Item.Current);
                d.Show();
                d.Run();
                d.Destroy();
            }
            Destroy();
        }
コード例 #4
0
 public EditMetadataImportSettingViewModel()
 {
     OpenBrowserCommand
     .Subscribe(() => Process.Start(new ProcessStartInfo(Resources.EditMetadataImportSettingDialog_PatternUri)));
     OkCommand = EditTarget
                 .Where(x => x != null)
                 .Select(_ => true)
                 .ToReactiveCommand();
     OkCommand
     .Subscribe(_ =>
     {
         EditTarget.Value.Commit();
         FinishInteraction();
     });
     CancelCommand
     .Subscribe(_ =>
     {
         FinishInteraction();
     });
 }
コード例 #5
0
        }//ShowS...()_end

        //Draw the window.
        private void OnGUI()
        {
            EditorGUILayout.BeginVertical();
            editTarget = (EditTarget)EditorGUILayout.EnumPopup("EditTarget", editTarget);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("ScriptTemplate");
            EditorGUILayout.Space();
            if (GUILayout.Button("Current", GUILayout.Width(60)))
                GetScriptTemplateText();
            if (GUILayout.Button("Save", GUILayout.Width(60)))
                SaveScriptTemplate();
            EditorGUILayout.EndHorizontal();

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            sTText = EditorGUILayout.TextArea(sTText, GUILayout.ExpandHeight(true));
            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();
        }//OnGUI()_end