コード例 #1
0
        private void InitializeView()
        {
            _designerSocket = new Gtk.Socket();
            _designerSocket.Show();
            _surfaceFrame.Add(_designerSocket);
            _surfaceFrame.ShowAll();

            _propGridSocket = new Gtk.Socket();
            _propGridSocket.Show();
            _propertyGridFrame.Add(_propGridSocket);

            _editorProcess = (EditorProcess)Runtime.ProcessService.CreateExternalProcessObject(typeof(EditorProcess), false);

            if (_designerSocket.IsRealized)
            {
                _editorProcess.AttachDesigner(_designerSocket.Id);
            }
            if (_propGridSocket.IsRealized)
            {
                _editorProcess.AttachPropertyGrid(_propGridSocket.Id);
            }
            _designerSocket.Realized += delegate { _editorProcess.AttachDesigner(_designerSocket.Id); };
            _propGridSocket.Realized += delegate { _editorProcess.AttachPropertyGrid(_propGridSocket.Id); };

            _editorProcess.Initialize(_designerFile);
        }
コード例 #2
0
        public void InitIE(Gtk.Box w)
        {
            HoldingWidget = w;
            Browser       = new System.Windows.Forms.WebBrowser();
            w.SetSizeRequest(500, 500);
            Browser.Height = 500; // w.GdkWindow.FrameExtents.Height;
            Browser.Width  = 500; // w.GdkWindow.FrameExtents.Width;
            Browser.Navigate("about:blank");
            Browser.Document.Write(String.Empty);

            WebSocket = new Gtk.Socket();
            WebSocket.SetSizeRequest(Browser.Width, Browser.Height);
            w.Add(WebSocket);
            WebSocket.Realize();
            WebSocket.Show();
            WebSocket.UnmapEvent += Socket_UnmapEvent;
            IntPtr browser_handle = Browser.Handle;
            IntPtr window_handle  = (IntPtr)WebSocket.Id;

            NativeMethods.SetParent(browser_handle, window_handle);

            /// Another interesting issue is that on Windows, the WebBrowser control by default is
            /// effectively an IE7 browser, and I don't think you can easily change that without
            /// changing registry settings. The lack of JSON parsing in IE7 triggers errors in google maps.
            /// See https://code.google.com/p/gmaps-api-issues/issues/detail?id=9004 for the details.
            /// Including the meta tag of <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            /// fixes the problem, but we can't do that in the HTML that we set as InnerHtml in the
            /// LoadHTML function, as the meta tag triggers a restart of the browser, so it
            /// just reloads "about:blank", without the new innerHTML, and we get a blank browser.
            /// Hence we set the browser type here.
            /// Another way to get around this problem is to add JSON.Parse support available from
            /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
            /// into the HTML Script added when loading Google Maps
            /// I am taking the belts-and-braces approach of doing both, primarily because the
            /// meta tag, while probably the technically better" solution, sometimes doesn't work.
            /// 10/8/17 - I've added yet another "fix" for this problem: the installer now writes a
            /// registry key requesting that IE 11 be used for ApsimNG.exe (and for ApsimNG.vshost.exe,
            /// so it also works when run from Visual Studio).

            Browser.DocumentText = @"<!DOCTYPE html>
                   <html>
                   <head>
                   <meta http-equiv=""X-UA-Compatible"" content=""IE=edge,10""/>
                   </head>
                   </html>";
        }
コード例 #3
0
ファイル: HTMLView.cs プロジェクト: pre078/ApsimX
        public void InitIE(Gtk.Box w)
        {
            wb = new System.Windows.Forms.WebBrowser();
            w.SetSizeRequest(500, 500);
            wb.Height = 500; // w.GdkWindow.FrameExtents.Height;
            wb.Width  = 500; // w.GdkWindow.FrameExtents.Width;

            socket.SetSizeRequest(wb.Width, wb.Height);
            w.Add(socket);
            socket.Realize();
            socket.Show();

            IntPtr browser_handle = wb.Handle;
            IntPtr window_handle  = (IntPtr)socket.Id;

            SetParent(browser_handle, window_handle);
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: GNOME/gnome-subtitles
	/* Private members */

	private void InitializeSocket () {
		socket = new Socket();
		socket.ModifyBg(StateType.Normal, socket.Style.Black);

		frame.Child = socket;

		socket.Realize();
		socket.Show();
	}
コード例 #5
0
ファイル: HTMLView.cs プロジェクト: hol353/ApsimX
        public void InitIE(Gtk.Box w)
        {
            wb = new System.Windows.Forms.WebBrowser();
            w.SetSizeRequest(500, 500);
            wb.Height = 500; // w.GdkWindow.FrameExtents.Height;
            wb.Width = 500; // w.GdkWindow.FrameExtents.Width;
            wb.Navigate("about:blank");
            wb.Document.Write(String.Empty);

            socket = new Gtk.Socket();
            socket.SetSizeRequest(wb.Width, wb.Height);
            w.Add(socket);
            socket.Realize();
            socket.Show();
            socket.UnmapEvent += Socket_UnmapEvent;
            IntPtr browser_handle = wb.Handle;
            IntPtr window_handle = (IntPtr)socket.Id;
            SetParent(browser_handle, window_handle);

            /// Another interesting issue is that on Windows, the WebBrowser control by default is
            /// effectively an IE7 browser, and I don't think you can easily change that without
            /// changing registry settings. The lack of JSON parsing in IE7 triggers errors in google maps.
            /// See https://code.google.com/p/gmaps-api-issues/issues/detail?id=9004 for the details.
            /// Including the meta tag of <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            /// fixes the problem, but we can't do that in the HTML that we set as InnerHtml in the
            /// LoadHTML function, as the meta tag triggers a restart of the browser, so it
            /// just reloads "about:blank", without the new innerHTML, and we get a blank browser.
            /// Hence we set the browser type here.
            /// Another way to get around this problem is to add JSON.Parse support available from
            /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
            /// into the HTML Script added when loading Google Maps
            /// I am taking the belts-and-braces approach of doing both, primarily because the
            /// meta tag, while probably the technically better" solution, sometimes doesn't work.

            wb.DocumentText = @"<!DOCTYPE html>
                   <html>
                   <head>
                   <meta http-equiv=""X-UA-Compatible"" content=""IE=edge,10""/>
                   </head>
                   </html>";
        }
コード例 #6
0
        public override void Selected()
        {
            //check that the Mozilla extension is installed correctly, and if not, display an error
            if (extensionError != null)
            {
                return;
            }
            else if (!CheckExtension(ref extensionError))
            {
                LoggingService.LogError(extensionError);
                Label errorlabel = new Label(extensionError);
                errorlabel.Wrap = true;

                HBox  box        = new HBox(false, 10);
                Image errorImage = new Image(Gtk.Stock.DialogError, Gtk.IconSize.Dialog);

                box.PackStart(new Label(), true, true, 0);
                box.PackStart(errorImage, false, false, 10);
                box.PackStart(errorlabel, true, false, 10);
                box.PackStart(new Label(), true, true, 0);

                designerFrame.Add(box);
                designerFrame.ShowAll();
                return;
            }
            else
            {
                extensionError = null;
            }

            if (editorProcess != null)
            {
                throw new Exception("Editor should be null when document is selected");
            }

            designerSocket = new Gtk.Socket();
            designerSocket.Show();
            designerFrame.Add(designerSocket);

            propGridSocket = new Gtk.Socket();
            propGridSocket.Show();
            propertyFrame.Add(propGridSocket);

            editorProcess = (EditorProcess)Runtime.ProcessService.CreateExternalProcessObject(typeof(EditorProcess), false);

            if (designerSocket.IsRealized)
            {
                editorProcess.AttachDesigner(designerSocket.Id);
            }
            if (propGridSocket.IsRealized)
            {
                editorProcess.AttachPropertyGrid(propGridSocket.Id);
            }

            designerSocket.Realized += delegate { editorProcess.AttachDesigner(designerSocket.Id); };
            propGridSocket.Realized += delegate { editorProcess.AttachPropertyGrid(propGridSocket.Id); };

            //designerSocket.FocusOutEvent += delegate {
            //	MonoDevelop.DesignerSupport.DesignerSupport.Service.PropertyPad.BlankPad (); };

            //hook up proxy for event binding
            string codeBehind = null;

            if (viewContent.Project != null)
            {
                string mimeType = DesktopService.GetMimeTypeForUri(viewContent.ContentName);

                var cu = MonoDevelop.Projects.Dom.Parser.ProjectDomService.Parse(viewContent.Project, viewContent.ContentName)
                         as MonoDevelop.AspNet.Parser.AspNetParsedDocument;

                if (cu != null && cu.PageInfo != null && !string.IsNullOrEmpty(cu.PageInfo.InheritedClass))
                {
                    codeBehind = cu.PageInfo.InheritedClass;
                }
            }
            proxy = new MonoDevelopProxy(viewContent.Project, codeBehind);

            ITextBuffer textBuf = (ITextBuffer)viewContent.GetContent(typeof(ITextBuffer));

            editorProcess.Initialise(proxy, textBuf.Text, viewContent.ContentName);

            activated = true;

            //FIXME: track 'dirtiness' properly
            viewContent.IsDirty = true;
        }
コード例 #7
0
		public override void Selected ()
		{
			//check that the Mozilla extension is installed correctly, and if not, display an error
			if (extensionError != null) {
				return;
			} else if (!CheckExtension (ref extensionError)) {
				LoggingService.LogError (extensionError);
				Label errorlabel = new Label (extensionError);
				errorlabel.Wrap = true;
				
				HBox box = new HBox (false, 10);
				Image errorImage = new Image (Gtk.Stock.DialogError, Gtk.IconSize.Dialog);
				
				box.PackStart (new Label (), true, true, 0);
				box.PackStart (errorImage, false, false, 10);
				box.PackStart (errorlabel, true, false, 10);
				box.PackStart (new Label (), true, true, 0);
				
				designerFrame.Add (box);
				designerFrame.ShowAll ();
				return;
			} else {
				extensionError = null;
			}
			
			if (editorProcess != null)
				throw new Exception ("Editor should be null when document is selected");
			
			designerSocket = new Gtk.Socket ();
			designerSocket.Show ();
			designerFrame.Add (designerSocket);
			
			propGridSocket = new Gtk.Socket ();
			propGridSocket.Show ();
			propertyFrame.Add (propGridSocket);
			
			editorProcess = (EditorProcess) Runtime.ProcessService.CreateExternalProcessObject (typeof (EditorProcess), false);
			
			if (designerSocket.IsRealized)
				editorProcess.AttachDesigner (designerSocket.Id);
			if (propGridSocket.IsRealized)
				editorProcess.AttachPropertyGrid (propGridSocket.Id);
			
			designerSocket.Realized += delegate { editorProcess.AttachDesigner (designerSocket.Id); };
			propGridSocket.Realized += delegate { editorProcess.AttachPropertyGrid (propGridSocket.Id); };
			
			//designerSocket.FocusOutEvent += delegate {
			//	MonoDevelop.DesignerSupport.DesignerSupport.Service.PropertyPad.BlankPad (); };
			
			//hook up proxy for event binding
			string codeBehind = null;
			if (viewContent.Project != null) {
				string mimeType =
					DesktopService.GetMimeTypeForUri (viewContent.ContentName);
				
				MonoDevelop.AspNet.Parser.AspNetParsedDocument cu = 
					MonoDevelop.Projects.Dom.Parser.ProjectDomService.Parse (
						null, viewContent.ContentName, mimeType)
					as MonoDevelop.AspNet.Parser.AspNetParsedDocument;
					
				if (cu != null && cu.PageInfo != null && !string.IsNullOrEmpty (cu.PageInfo.InheritedClass))
					codeBehind = cu.PageInfo.InheritedClass;
			}
			proxy = new MonoDevelopProxy (viewContent.Project, codeBehind);
			
			ITextBuffer textBuf = (ITextBuffer) viewContent.GetContent (typeof(ITextBuffer));			
			editorProcess.Initialise (proxy, textBuf.Text, viewContent.ContentName);
			
			activated = true;
			
			//FIXME: track 'dirtiness' properly
			viewContent.IsDirty = true;
		}
コード例 #8
0
		private void InitializeView ()
		{
			_designerSocket = new Gtk.Socket ();
			_designerSocket.Show ();
			_surfaceFrame.Add (_designerSocket);
			_surfaceFrame.ShowAll ();
			
			_propGridSocket = new Gtk.Socket ();
			_propGridSocket.Show ();
			_propertyGridFrame.Add (_propGridSocket);
			
			_editorProcess = (EditorProcess) Runtime.ProcessService.CreateExternalProcessObject (typeof (EditorProcess), false);

			if (_designerSocket.IsRealized)
				_editorProcess.AttachDesigner (_designerSocket.Id);
			if (_propGridSocket.IsRealized)
				_editorProcess.AttachPropertyGrid (_propGridSocket.Id);
			_designerSocket.Realized += delegate { _editorProcess.AttachDesigner (_designerSocket.Id); };
			_propGridSocket.Realized += delegate { _editorProcess.AttachPropertyGrid (_propGridSocket.Id); };

			_editorProcess.Initialize (_designerFile);
		}