Beispiel #1
0
		public void Copy (PrettyPrinterOptions options)
		{
			ViewPosition = options.ViewPosition;
			ViewTag = options.ViewTag;
			ViewLength = options.ViewLength;
			DottedIndentation = options.DottedIndentation;
			ShowTagClass = options.ShowTagClass;
			IncludeEncapsulated = options.IncludeEncapsulated;
			OidFormat = options.OidFormat;
			OidSource = options.OidSource;
			FontName = options.FontName;
		}
 public void Copy(PrettyPrinterOptions options)
 {
     ViewPosition        = options.ViewPosition;
     ViewTag             = options.ViewTag;
     ViewLength          = options.ViewLength;
     DottedIndentation   = options.DottedIndentation;
     ShowTagClass        = options.ShowTagClass;
     IncludeEncapsulated = options.IncludeEncapsulated;
     OidFormat           = options.OidFormat;
     OidSource           = options.OidSource;
     FontName            = options.FontName;
 }
Beispiel #3
0
		static public PrettyPrinterOptions GetDefaults ()
		{
			PrettyPrinterOptions ppo = new PrettyPrinterOptions ();
			ppo.ViewPosition = true;
			ppo.ViewTag = true;
			ppo.ViewLength = true;
			ppo.DottedIndentation = false;
			ppo.OidFormat = OidFormat.IETF;
			ppo.OidSource = OidSource.None;
			ppo.ShowTagClass = false;
			ppo.IncludeEncapsulated = false;
			ppo.FontName = null;
			return ppo;
		}
        static public PrettyPrinterOptions GetDefaults()
        {
            PrettyPrinterOptions ppo = new PrettyPrinterOptions();

            ppo.ViewPosition        = true;
            ppo.ViewTag             = true;
            ppo.ViewLength          = true;
            ppo.DottedIndentation   = false;
            ppo.OidFormat           = OidFormat.IETF;
            ppo.OidSource           = OidSource.None;
            ppo.ShowTagClass        = false;
            ppo.IncludeEncapsulated = false;
            ppo.FontName            = null;
            return(ppo);
        }
 static PrettyPrinter()
 {
     _defaults = PrettyPrinterOptions.GetDefaults();
     _cache    = new OidCache();
 }
Beispiel #6
0
		static PrettyPrinter ()
		{
			_defaults = PrettyPrinterOptions.GetDefaults ();
			_cache = new OidCache ();
		}
Beispiel #7
0
	public void SaveConfig (string filename, PrettyPrinterOptions options)
	{
		try {
			if (!File.Exists(filename)) {
				string path = Path.GetDirectoryName (filename);
				if (!Directory.Exists (path)) {
					Directory.CreateDirectory (path);
				}
			}
			using (StreamWriter sw = new StreamWriter (filename)) {
				XmlSerializer xs = new XmlSerializer (typeof (PrettyPrinterOptions));
				xs.Serialize (sw, options);
				sw.Close();
			}
		}
		catch (Exception e) {
			Console.Error.WriteLine ("Couldn't save configuration file {0}.\nCause: {1}",
				filename, e);
		}
	}
Beispiel #8
0
	public PrettyPrinterOptions LoadConfig (string filename)
	{
		try {
			if (File.Exists(filename)) {
				using (StreamReader sr = new StreamReader(filename)) {
					PrettyPrinterOptions options;
					XmlSerializer xs = new XmlSerializer (typeof (PrettyPrinterOptions));
					options = (PrettyPrinterOptions) xs.Deserialize (sr);
					sr.Close ();
					return options;
				}
			}
		}
		catch (Exception exception1) {
			Console.Error.WriteLine ("Couldn't load configuration file {0}.\nCause: {1}", filename, exception1);
		}

		return PrettyPrinterOptions.GetDefaults ();
	}
Beispiel #9
0
	public GASNViewerApp (string[] args)
	{
		Application.Init ();
		Glade.XML xml = new Glade.XML (null, "gui.glade", "gasnview", null);
		xml.Autoconnect (this);
		
		options = LoadConfig (config);
		UpdateOptions ();
		
		// load cache
		PrettyPrinter.Cache.Load (cache);
		
		// UI preparation
		fileexportimage.Pixbuf = new Pixbuf (null, "export.png");
		file_export.Image = new Gtk.Image (new Pixbuf (null, "export-16.png"));
		textview1.Editable = false;
		textview1.GrabFocus ();
		Font = options.FontName;
		findfwd = textview1.Buffer.StartIter;
		findbck = textview1.Buffer.EndIter;
		findstart = -1;
		findend = -1;
		highlight_on = new Pixbuf (null, "text_hilight-16.png");
		highlight_off = new Pixbuf (null, "text_lolight-16.png");
		findhighlight = false;
		findnormalbasecolor = findentry.Style.Base (StateType.Normal);
		try {
			// GTK# bug - entry point was missing in early 1.0.x versions
			findnormaltextcolor = findentry.Style.Text (StateType.Normal);
		}
		catch (EntryPointNotFoundException) {
			findnormaltextcolor = new Gdk.Color (0x00, 0x00, 0x00);
		}
		finderrorbasecolor = new Gdk.Color (0xff, 0x00, 0x00);
		finderrortextcolor = new Gdk.Color (0xff, 0xff, 0xff);

		highlight = new TextTag ("highlight");
		highlight.BackgroundGdk = new Gdk.Color (0xff, 0xff, 0x00);
		textview1.Buffer.TagTable.Add (highlight);
		encapsulated = new TextTag ("encapsulated");
		encapsulated.ForegroundGdk = new Gdk.Color (0x00, 0x00, 0xff);
		textview1.Buffer.TagTable.Add (encapsulated);
		Highlight (false);

		// load any specified file and execute application
		if (args.Length > 0) {
			FileLoad (args[0]);
		}
		Application.Run ();
	}