public void RemoveIdleHandler(IdleHandler handler) { lock (this) { mIdleHandlers.Remove(handler); } }
public static bool Remove(IdleHandler hndlr) { bool result = false; List <uint> keys = new List <uint> (); lock (Source.source_handlers) { foreach (uint code in Source.source_handlers.Keys) { IdleProxy p = Source.source_handlers [code] as IdleProxy; if (p != null && p.real_handler == hndlr) { keys.Add(code); result = g_source_remove(code); } } foreach (object key in keys) { Source.source_handlers.Remove(key); } } return(result); }
public static bool Remove(IdleHandler hndlr) { bool result = false; ArrayList keys = new ArrayList(); lock (Source.source_handlers) { foreach (uint code in Source.source_handlers.Keys) { IdleProxy p = Source.source_handlers [code] as IdleProxy; if (p != null && p.real_handler == hndlr) { keys.Add(code); result = g_source_remove_by_funcs_user_data(p.proxy_handler, IntPtr.Zero); } } foreach (object key in keys) { Source.source_handlers.Remove(key); } } return(result); }
static public void WaitUntilIdle(IdleHandler idle) { WaitUntilIdleClosure closure; closure = new WaitUntilIdleClosure(idle); closure.Start(); }
void initializeHandlerIfNecessary() { if (handler != null) { return; } handler = () => { if (dispatcherQueue.Count == 0) { return(true); } var item = dispatcherQueue [0]; dispatcherQueue.RemoveAt(0); item(); if (dispatcherQueue.Count == 0) { handler = null; return(false); } return(true); }; Idle.Add(handler); }
public ImageRenderer(MedicalController controller, SceneViewController sceneViewController, IdleHandler idleHandler) { this.controller = controller; this.sceneViewController = sceneViewController; this.idleHandler = idleHandler; TransparencyController.createTransparencyState(TransparencyStateName); OgreResourceGroupManager.getInstance().createResourceGroup(RenderTextureResourceGroup); }
public static uint Add (IdleHandler hndlr) { IdleProxy p = new IdleProxy (hndlr); p.ID = g_idle_add ((IdleHandlerInternal) p.proxy_handler, IntPtr.Zero); Source.AddSourceHandler (p.ID, p); return p.ID; }
public static uint Add (IdleHandler hndlr, Priority priority) { IdleProxy p = new IdleProxy (hndlr); p.ID = g_idle_add_full ((int)priority, (IdleHandlerInternal)p.proxy_handler, IntPtr.Zero, null); Source.AddSourceHandler (p.ID, p); return p.ID; }
public void Dispose() { if (handler != null) { Idle.Remove(handler); handler = null; } }
public static uint Add(IdleHandler hndlr) { IdleProxy p = new IdleProxy (hndlr); p.ID = g_idle_add ((IdleHandlerInternal) p.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) Source.source_handlers [p.ID] = p; return p.ID; }
public StandaloneController(App app) { medicalConfig = new MedicalConfig(); this.app = app; guiManager = new GUIManager(); guiManager.MainGUIShown += guiManager_MainGUIShown; guiManager.MainGUIHidden += guiManager_MainGUIHidden; MyGUIInterface.OSTheme = PlatformConfig.ThemeFile; String title; if (MedicalConfig.BuildName != null) { title = String.Format("{0} {1}", app.Title, MedicalConfig.BuildName); } else { title = app.Title; } mainWindow = new MainWindow(title); mainWindow.Closed += mainWindow_Closed; //Setup DPI float pixelScale = mainWindow.WindowScaling; if (MedicalConfig.PixelScaleOverride > 0.5f) { pixelScale = MedicalConfig.PixelScaleOverride; } float scaleFactor = pixelScale; pixelScale += MedicalConfig.PlatformExtraScaling * scaleFactor; switch (MedicalConfig.ExtraScaling) { case UIExtraScale.Smaller: pixelScale -= .15f * scaleFactor; break; case UIExtraScale.Larger: pixelScale += .25f * scaleFactor; break; } ScaleHelper._setScaleFactor(pixelScale); //Initialize engine medicalController = new MedicalController(mainWindow); idleHandler = new IdleHandler(medicalController.MainTimer.OnIdle); PointerManager.Instance.Visible = false; ((RenderWindow)OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget).DeactivateOnFocusChange = false; }
public static uint Add(IdleHandler hndlr) { IdleProxy p = new IdleProxy(hndlr); p.ID = g_idle_add(p.Handler, IntPtr.Zero); Source.Add(p); return(p.ID); }
public static uint RunIdle(IdleHandler handler) { if (idle_handler == null) { throw new NotImplementedException("The application client must provide an IdleImplementationHandler"); } return(idle_handler(handler)); }
public static uint Add(IdleHandler hndlr, Priority priority) { IdleProxy p = new IdleProxy (hndlr); p.ID = g_idle_add_full ((int)priority, (IdleHandlerInternal)p.proxy_handler, IntPtr.Zero, null); lock (Source.source_handlers) Source.source_handlers [p.ID] = p; return p.ID; }
public static uint Add(IdleHandler hndlr, Priority priority) { IdleProxy p = new IdleProxy(hndlr); p.ID = g_idle_add_full((int)priority, (IdleHandlerInternal)p.proxy_handler, IntPtr.Zero, null); Source.AddSourceHandler(p.ID, p); return(p.ID); }
public static uint Add(IdleHandler hndlr) { IdleProxy p = new IdleProxy(hndlr); p.ID = g_idle_add((IdleHandlerInternal)p.proxy_handler, IntPtr.Zero); Source.AddSourceHandler(p.ID, p); return(p.ID); }
public static uint Add(IdleHandler hndlr) { IdleProxy p = new IdleProxy(hndlr); p.ID = g_idle_add((IdleHandlerInternal)p.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) Source.source_handlers [p.ID] = p; return(p.ID); }
public static uint Add(IdleHandler hndlr, Priority priority) { IdleProxy p = new IdleProxy(hndlr); p.ID = g_idle_add_full((int)priority, (IdleHandlerInternal)p.proxy_handler, IntPtr.Zero, null); lock (Source.source_handlers) Source.source_handlers [p.ID] = p; return(p.ID); }
public void AddIdleHandler(IdleHandler handler) { if (handler == null) { return; } lock (this) { mIdleHandlers.Add(handler); } }
public static uint Add(IdleHandler handler) { var proxy = new IdleProxy (handler); uint code = clutter_threads_add_idle ((IdleHandlerInternal)proxy.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) { Source.source_handlers[code] = proxy; } return code; }
public static uint Add(IdleHandler handler) { var proxy = new IdleProxy(handler); uint code = clutter_threads_add_idle((IdleHandlerInternal)proxy.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) { Source.source_handlers[code] = proxy; } return(code); }
public override void Update() { if (scrollableArea == null) { return; } #if ARCADE IdleHandler.Check(10000); #endif scrollableArea.Update(); if (onlineRankingButton != null) { if (scrollableArea.ScrollPosition.Y > 20) { onlineRankingButton.Hide(); } else { onlineRankingButton.Show(); } } int currentTime = GameBase.Time - startTime; int digitsVisible = currentTime / 500; if (s_score1 != null) { string built = string.Empty; for (int i = 0; i < stringTotalScore.Length; i++) { if (i >= digitsVisible) { built += RNG.Next(0, 9).ToString()[0]; } else { built += stringTotalScore[i]; } } s_score1.Text = built; } if (currentTime > 4400 && !ReplayMode) { PopupRecord(); } base.Update(); }
public static uint Add(IdleHandler hndlr) { IdleProxy p = new IdleProxy(hndlr); lock (p) { var gch = GCHandle.Alloc(p); var userData = GCHandle.ToIntPtr(gch); p.ID = g_idle_add_full(0, (IdleHandlerInternal)p.proxy_handler, userData, DestroyHelper.NotifyHandler); } return(p.ID); }
public bool Handler() { try { IdleHandler idle_handler = (IdleHandler)real_handler; bool cont = idle_handler(); if (!cont) { Remove(); } return(cont); } catch (Exception e) { ExceptionManager.RaiseUnhandledException(e, false); } return(false); }
public static bool Remove(IdleHandler hndlr) { bool result = false; lock (Source.source_handlers) { foreach (KeyValuePair <uint, SourceProxy> kvp in Source.source_handlers) { uint code = kvp.Key; IdleProxy p = kvp.Value as IdleProxy; if (p != null && p.real_handler == hndlr) { result = g_source_remove(code); p.Remove(); } } } return(result); }
public static bool Remove(IdleHandler hndlr) { bool result = false; List<uint> keys = new List<uint> (); lock (Source.source_handlers) { foreach (uint code in Source.source_handlers.Keys) { IdleProxy p = Source.source_handlers [code] as IdleProxy; if (p != null && p.real_handler == hndlr) { keys.Add (code); result = g_source_remove (code); } } foreach (object key in keys) Source.source_handlers.Remove (key); } return result; }
public static bool Remove(IdleHandler hndlr) { bool result = false; ArrayList keys = new ArrayList (); lock (Source.source_handlers) { foreach (uint code in Source.source_handlers.Keys) { IdleProxy p = Source.source_handlers [code] as IdleProxy; if (p != null && p.real_handler == hndlr) { keys.Add (code); result = g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero); } } foreach (object key in keys) Source.source_handlers.Remove (key); } return result; }
public WaitUntilIdleClosure (IdleHandler idle) { this.idle = idle; }
public MainWindow() { // Glade settings gui = new Glade.XML ("monognomeart.glade", "mainWindow", ""); gui.Autoconnect (this); guiTypes = new Hashtable (); _idleHandlerFetchGuiArt = new IdleHandler (OnIdleFetchGuiArt); _currentTheme = new Theme (); // Add elements into statusbar statusLabel = new Label ("MonoGnomeArt"); statusLabel.Xalign = 0F; loadArtProgressBar = new Gtk.ProgressBar (); mainStatusbar.Add (statusLabel); Gtk.Box.BoxChild bc0 = ((Gtk.Box.BoxChild)(mainStatusbar[statusLabel])); bc0.Position = 0; mainStatusbar.Add (loadArtProgressBar); Gtk.Box.BoxChild bc3 = ((Gtk.Box.BoxChild)(mainStatusbar[loadArtProgressBar])); bc3.Position = 3; // ThemeType Treeview definition themeTypeTreeview.Selection.Changed += new EventHandler (ThemeTypeSelectionChanged); // Store Model _themeTypeStore = new TreeStore (typeof (string)); themeTypeTreeview.Model = _themeTypeStore; // Add all Type and associate to ArtType TreeIter allTypeIter = AddThemeTypeElement ("<b>All</b>"); guiTypes.Add (allTypeIter, ArtType.All); guiTypes.Add (AddThemeTypeElement ("Background All"), ArtType.BackgroundAll); guiTypes.Add (AddThemeTypeElement ("Background Gnome"), ArtType.BackgroundGnome); guiTypes.Add (AddThemeTypeElement ("Background Other"), ArtType.BackgroundOther); guiTypes.Add (AddThemeTypeElement ("Icons"), ArtType.ThemesIcons); guiTypes.Add (AddThemeTypeElement ("Thème Applications"), ArtType.ThemesApplications); guiTypes.Add (AddThemeTypeElement ("Window Border"), ArtType.ThemesWindowsBorders); guiTypes.Add (AddThemeTypeElement ("Login Manager"), ArtType.ThemesGDM); guiTypes.Add (AddThemeTypeElement ("Splash Screen"), ArtType.ThemesSplashs); guiTypes.Add (AddThemeTypeElement ("Gtk+ Engine"), ArtType.ThemesGTKEngines); // Column instantiation TreeViewColumn themeTypeColumn = new TreeViewColumn (); // ThemeType Column definition CellRendererText typecr = new CellRendererText (); themeTypeColumn.Sizing = TreeViewColumnSizing.Fixed; themeTypeColumn.FixedWidth = 20; themeTypeColumn.Resizable = false; themeTypeColumn.PackStart (typecr, true); themeTypeColumn.AddAttribute (typecr, "markup", 0); themeTypeTreeview.AppendColumn (themeTypeColumn); themeTypeTreeview.Selection.SelectIter (allTypeIter); // Preview TreeView definition // Store Model _previewStore = new TreeStore (typeof (Gdk.Pixbuf), typeof (string)); previewTreeview.Model = _previewStore; // Columns instantiation TreeViewColumn imageColumnPreview = new TreeViewColumn (); TreeViewColumn descColumnPreview = new TreeViewColumn (); // Image Column definition CellRendererPixbuf imagecr = new CellRendererPixbuf (); imageColumnPreview.Title = "Image"; imageColumnPreview.MinWidth = 200; imageColumnPreview.Sizing = TreeViewColumnSizing.Autosize; imageColumnPreview.PackStart (imagecr, true); imageColumnPreview.AddAttribute (imagecr, "pixbuf", 0); previewTreeview.AppendColumn (imageColumnPreview); // Description Column definition CellRendererText desccr = new CellRendererText (); descColumnPreview.Title = "Description"; descColumnPreview.MinWidth = 300; descColumnPreview.Sizing = TreeViewColumnSizing.Autosize; descColumnPreview.PackStart (desccr, true); descColumnPreview.AddAttribute (desccr, "markup", 1); previewTreeview.AppendColumn (descColumnPreview); gui["mainWindow"].ShowAll(); }
public IdleProxy(IdleHandler real) { real_handler = real; proxy_handler = new IdleHandlerInternal(Handler); }
public IdleProxy(IdleHandler real) { real_handler = real; proxy_handler = new IdleHandlerInternal (Handler); }
private void RenderFullVisual() { this.WriteToLog("*** Visually Hinted Image Computation Beginning ***"); this.WriteToLog(this._RenderingEngine.Name + " " + this._RenderingEngine.ParameterSerialization); TimeSpanMetric tmpRenderTimer = new TimeSpanMetric(); int tmpScreenXCounter, tmpScreenYCounter; double tmpChaosXCounter, tmpChaosYCounter; double tmpChaosXIncrement, tmpChaosYIncrement; int tmpTotalPixelCount, tmpCurrentPixelCount; //A thread-safe container for the display refresh event IdleHandler tmpIdleMessageRefreshContainer = new IdleHandler(this.RefreshDisplaySafe); this._RenderingEngine.RenderBegin(); //Compute the Pixel to Chaos space ratio tmpChaosXIncrement = (double)((this._RenderingEngine.ChaosMaxX - this._RenderingEngine.ChaosMinX) / (double)_OutputPort.Width); //Chaos_Y_Incriment = (double)((this.Rendering_Engine.Chaos_Max_Y - this.Rendering_Engine.Chaos_Min_Y) / (double)Output_Port.Height ); tmpChaosYIncrement = tmpChaosXIncrement; //Compute the pixel counter for the progress bar. tmpTotalPixelCount = _OutputPort.Width * _OutputPort.Height; tmpCurrentPixelCount = 0; _OutputPort.LastXOrigin = this._RenderingEngine.ChaosMinX; _OutputPort.LastYOrigin = this._RenderingEngine.ChaosMinY; _OutputPort.LastXRatio = tmpChaosXIncrement; _OutputPort.LastYRatio = tmpChaosYIncrement; this._RenderingEngine.CurrentRenderRatio = tmpChaosXIncrement; //Clear the render port for (tmpScreenXCounter = 0; tmpScreenXCounter < _OutputPort.Width; tmpScreenXCounter++) { for (tmpScreenYCounter = 0; tmpScreenYCounter < _OutputPort.Height; tmpScreenYCounter++) { _OutputPort.MarkPixel(tmpScreenXCounter, tmpScreenYCounter, -1); } } this.WriteToLog(" --> Viewport Cleared"); //Refresh the display Gdk.Threads.Enter(); GLib.Idle.Add(tmpIdleMessageRefreshContainer); Gdk.Threads.Leave(); //Now render a quad fractal preview tmpChaosXCounter = this._RenderingEngine.ChaosMinX; for (tmpScreenXCounter = 0; tmpScreenXCounter < _OutputPort.Width; tmpScreenXCounter++) { tmpChaosYCounter = this._RenderingEngine.ChaosMinY; for (tmpScreenYCounter = 0; tmpScreenYCounter < _OutputPort.Height; tmpScreenYCounter++) { if ((tmpScreenXCounter % 2 == 0) && (tmpScreenYCounter % 2 == 0)) { _OutputPort.MarkPixelQuad(tmpScreenXCounter, tmpScreenYCounter, this._RenderingEngine.RenderPixel(tmpChaosXCounter, tmpChaosYCounter)); tmpCurrentPixelCount++; } //if ( Current_Pixel_Counter % (this.Output_Port.Width*4) == 1 ) //{ this._RenderProgressAmount = ((double)tmpCurrentPixelCount / (double)tmpTotalPixelCount); //} tmpChaosYCounter += tmpChaosXIncrement; } tmpChaosXCounter += tmpChaosYIncrement; } this.WriteToLog(" --> Quad 0,0 Done [" + tmpCurrentPixelCount.ToString() + "/" + tmpTotalPixelCount.ToString() + "]"); //Refresh the display Gdk.Threads.Enter(); GLib.Idle.Add(tmpIdleMessageRefreshContainer); Gdk.Threads.Leave(); //Now render the 1,1 fractal set tmpChaosXCounter = this._RenderingEngine.ChaosMinX; for (tmpScreenXCounter = 0; tmpScreenXCounter < _OutputPort.Width; tmpScreenXCounter++) { tmpChaosYCounter = this._RenderingEngine.ChaosMinY; for (tmpScreenYCounter = 0; tmpScreenYCounter < _OutputPort.Height; tmpScreenYCounter++) { if ((tmpScreenXCounter % 2 == 1) && (tmpScreenYCounter % 2 == 1)) { _OutputPort.MarkPixel(tmpScreenXCounter, tmpScreenYCounter, this._RenderingEngine.RenderPixel(tmpChaosXCounter, tmpChaosYCounter)); tmpCurrentPixelCount++; } this._RenderProgressAmount = ((double)tmpCurrentPixelCount / (double)tmpTotalPixelCount); tmpChaosYCounter += tmpChaosXIncrement; } tmpChaosXCounter += tmpChaosYIncrement; } this.WriteToLog(" --> Subquad 1,1 Done [" + tmpCurrentPixelCount.ToString() + "/" + tmpTotalPixelCount.ToString() + "]"); //Refresh the display Gdk.Threads.Enter(); GLib.Idle.Add(tmpIdleMessageRefreshContainer); Gdk.Threads.Leave(); //Now render the 1,0 fractal set tmpChaosXCounter = this._RenderingEngine.ChaosMinX; for (tmpScreenXCounter = 0; tmpScreenXCounter < _OutputPort.Width; tmpScreenXCounter++) { tmpChaosYCounter = this._RenderingEngine.ChaosMinY; for (tmpScreenYCounter = 0; tmpScreenYCounter < _OutputPort.Height; tmpScreenYCounter++) { if ((tmpScreenXCounter % 2 == 1) && (tmpScreenYCounter % 2 == 0)) { _OutputPort.MarkPixel(tmpScreenXCounter, tmpScreenYCounter, this._RenderingEngine.RenderPixel(tmpChaosXCounter, tmpChaosYCounter)); tmpCurrentPixelCount++; } this._RenderProgressAmount = ((double)tmpCurrentPixelCount / (double)tmpTotalPixelCount); tmpChaosYCounter += tmpChaosXIncrement; } tmpChaosXCounter += tmpChaosYIncrement; } this.WriteToLog(" --> Subquad 1,0 Done [" + tmpCurrentPixelCount.ToString() + "/" + tmpTotalPixelCount.ToString() + "]"); //Refresh the display Gdk.Threads.Enter(); GLib.Idle.Add(tmpIdleMessageRefreshContainer); Gdk.Threads.Leave(); //Now render the 0,1 fractal set tmpChaosXCounter = this._RenderingEngine.ChaosMinX; for (tmpScreenXCounter = 0; tmpScreenXCounter < _OutputPort.Width; tmpScreenXCounter++) { tmpChaosYCounter = this._RenderingEngine.ChaosMinY; for (tmpScreenYCounter = 0; tmpScreenYCounter < _OutputPort.Height; tmpScreenYCounter++) { if ((tmpScreenXCounter % 2 == 0) && (tmpScreenYCounter % 2 == 1)) { _OutputPort.MarkPixel(tmpScreenXCounter, tmpScreenYCounter, this._RenderingEngine.RenderPixel(tmpChaosXCounter, tmpChaosYCounter)); tmpCurrentPixelCount++; } //if ( Current_Pixel_Counter % (this.Output_Port.Width*4) == 1 ) //{ this._RenderProgressAmount = ((double)tmpCurrentPixelCount / (double)tmpTotalPixelCount); //} tmpChaosYCounter += tmpChaosXIncrement; } tmpChaosXCounter += tmpChaosYIncrement; } this.WriteToLog(" --> Subquad 0,1 Done [" + tmpCurrentPixelCount.ToString() + "/" + tmpTotalPixelCount.ToString() + "]"); //Refresh the display Gdk.Threads.Enter(); GLib.Idle.Add(tmpIdleMessageRefreshContainer); Gdk.Threads.Leave(); this._RenderingEngine.Render_End(); //Update the progress at 100% this._RenderProgressAmount = 1; tmpRenderTimer.Time_Stamp(); this.WriteToLog("*** Image Computation Complete (" + tmpRenderTimer.TimeDifference.ToString() + "ms) ***"); this._CurrentlyRendering = false; }
public IdleProxy(IdleHandler real) { real_handler = real; }
public static uint RunIdle (IdleHandler handler) { if (idle_handler == null) { throw new NotImplementedException ("The application client must provide an IdleImplementationHandler"); } return idle_handler (handler); }
public AnonymousFunctions() { CurrentStateHandler = new IdleHandler(this); }
protected uint RunIdle (IdleHandler handler) { return GLib.Idle.Add (delegate { return handler (); }); }
public Message Next() { int pendingIdleHandlerCount = -1; // -1 only during first iteration int nextPollTimeoutMillis = 0; for (; ;) { queueEvent.WaitOne(nextPollTimeoutMillis); lock (this) { int now = DllImport.GetTickCount(); Message msg = mMessages; if (msg != null) { long when = msg.when; if (now >= when) { mBlocked = false; mMessages = msg.next; msg.next = null; //Log.Debug(this + " Returning : " + msg); return(msg); } else { nextPollTimeoutMillis = (int)Math.Min(when - now, int.MaxValue); } } else { nextPollTimeoutMillis = -1; //mBlocked = true; } // If first time, then get the number of idlers to run. if (pendingIdleHandlerCount < 0) { pendingIdleHandlerCount = mIdleHandlers.Count; } if (pendingIdleHandlerCount == 0) { // No idle handlers to run. Loop and wait some more. mBlocked = true; continue; } if (mPendingIdleHandlers == null) { mPendingIdleHandlers = new IdleHandler[pendingIdleHandlerCount]; } mPendingIdleHandlers = mIdleHandlers.ToArray(); } // Run the idle handlers. // We only ever reach this code block during the first iteration. for (int i = 0; i < pendingIdleHandlerCount; i++) { IdleHandler idler = mPendingIdleHandlers[i]; mPendingIdleHandlers[i] = null; // release the reference to the handler bool keep = false; try { keep = idler.QueueIdle(); } catch (Exception t) { Log.Error("MessageQueue IdleHandler threw exception", t); } if (!keep) { lock (this) { mIdleHandlers.Remove(idler); } } } // Reset the idle handler count to 0 so we do not run them again. pendingIdleHandlerCount = 0; // While calling an idle handler, a new message could have been delivered // so go back and look again for a pending message without waiting. nextPollTimeoutMillis = 0; } }
public static bool Remove(IdleHandler hndlr) { return Source.RemoveSourceHandler (hndlr); }
public MainWindow() { // Glade settings gui = new Glade.XML("monognomeart.glade", "mainWindow", ""); gui.Autoconnect(this); guiTypes = new Hashtable(); _idleHandlerFetchGuiArt = new IdleHandler(OnIdleFetchGuiArt); _currentTheme = new Theme(); // Add elements into statusbar statusLabel = new Label("MonoGnomeArt"); statusLabel.Xalign = 0F; loadArtProgressBar = new Gtk.ProgressBar(); mainStatusbar.Add(statusLabel); Gtk.Box.BoxChild bc0 = ((Gtk.Box.BoxChild)(mainStatusbar[statusLabel])); bc0.Position = 0; mainStatusbar.Add(loadArtProgressBar); Gtk.Box.BoxChild bc3 = ((Gtk.Box.BoxChild)(mainStatusbar[loadArtProgressBar])); bc3.Position = 3; // ThemeType Treeview definition themeTypeTreeview.Selection.Changed += new EventHandler(ThemeTypeSelectionChanged); // Store Model _themeTypeStore = new TreeStore(typeof(string)); themeTypeTreeview.Model = _themeTypeStore; // Add all Type and associate to ArtType TreeIter allTypeIter = AddThemeTypeElement("<b>All</b>"); guiTypes.Add(allTypeIter, ArtType.All); guiTypes.Add(AddThemeTypeElement("Background All"), ArtType.BackgroundAll); guiTypes.Add(AddThemeTypeElement("Background Gnome"), ArtType.BackgroundGnome); guiTypes.Add(AddThemeTypeElement("Background Other"), ArtType.BackgroundOther); guiTypes.Add(AddThemeTypeElement("Icons"), ArtType.ThemesIcons); guiTypes.Add(AddThemeTypeElement("Thème Applications"), ArtType.ThemesApplications); guiTypes.Add(AddThemeTypeElement("Window Border"), ArtType.ThemesWindowsBorders); guiTypes.Add(AddThemeTypeElement("Login Manager"), ArtType.ThemesGDM); guiTypes.Add(AddThemeTypeElement("Splash Screen"), ArtType.ThemesSplashs); guiTypes.Add(AddThemeTypeElement("Gtk+ Engine"), ArtType.ThemesGTKEngines); // Column instantiation TreeViewColumn themeTypeColumn = new TreeViewColumn(); // ThemeType Column definition CellRendererText typecr = new CellRendererText(); themeTypeColumn.Sizing = TreeViewColumnSizing.Fixed; themeTypeColumn.FixedWidth = 20; themeTypeColumn.Resizable = false; themeTypeColumn.PackStart(typecr, true); themeTypeColumn.AddAttribute(typecr, "markup", 0); themeTypeTreeview.AppendColumn(themeTypeColumn); themeTypeTreeview.Selection.SelectIter(allTypeIter); // Preview TreeView definition // Store Model _previewStore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string)); previewTreeview.Model = _previewStore; // Columns instantiation TreeViewColumn imageColumnPreview = new TreeViewColumn(); TreeViewColumn descColumnPreview = new TreeViewColumn(); // Image Column definition CellRendererPixbuf imagecr = new CellRendererPixbuf(); imageColumnPreview.Title = "Image"; imageColumnPreview.MinWidth = 200; imageColumnPreview.Sizing = TreeViewColumnSizing.Autosize; imageColumnPreview.PackStart(imagecr, true); imageColumnPreview.AddAttribute(imagecr, "pixbuf", 0); previewTreeview.AppendColumn(imageColumnPreview); // Description Column definition CellRendererText desccr = new CellRendererText(); descColumnPreview.Title = "Description"; descColumnPreview.MinWidth = 300; descColumnPreview.Sizing = TreeViewColumnSizing.Autosize; descColumnPreview.PackStart(desccr, true); descColumnPreview.AddAttribute(desccr, "markup", 1); previewTreeview.AppendColumn(descColumnPreview); gui["mainWindow"].ShowAll(); }
public OgreModelEditorController(App app, String defaultModel) { this.app = app; //Create the log. logListener = new LogFileListener(); logListener.openLogFile(OgreModelEditorConfig.DocRoot + "/log.log"); Log.Default.addLogListener(logListener); //Main window mainWindow = new NativeOSWindow("Ogre Model Editor", new IntVector2(-1, -1), new IntSize2(OgreModelEditorConfig.EngineConfig.HorizontalRes, OgreModelEditorConfig.EngineConfig.VerticalRes)); mainWindow.Closed += mainWindow_Closed; //Setup DPI ScaleHelper._setScaleFactor(mainWindow.WindowScaling); //Initailize plugins MyGUIInterface.EventLayerKey = EventLayers.Main; GuiFrameworkCamerasInterface.MoveCameraEventLayer = EventLayers.Cameras; GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterMain; GuiFrameworkCamerasInterface.ShortcutEventLayer = EventLayers.Main; GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools; //Setup microcode cache load OgreInterface.MicrocodeCachePath = Path.Combine(OgreModelEditorConfig.DocRoot, "ShaderCache.mcc"); OgreInterface.AllowMicrocodeCacheLoad = OgreModelEditorConfig.LastShaderVersion == UnifiedMaterialBuilder.Version; OgreModelEditorConfig.LastShaderVersion = UnifiedMaterialBuilder.Version; OgreInterface.TrackMemoryLeaks = true; OgreInterface.CompressedTextureSupport = OgreModelEditorConfig.CompressedTextureSupport; RuntimePlatformInfo.addPath(OgreModelEditorConfig.OpenGLESEmulatorPath); pluginManager = new PluginManager(OgreModelEditorConfig.ConfigFile, new ServiceCollection()); pluginManager.OnConfigureDefaultWindow = createWindow; pluginManager.addPluginAssembly(typeof(OgreInterface).Assembly); pluginManager.addPluginAssembly(typeof(NativePlatformPlugin).Assembly); pluginManager.addPluginAssembly(typeof(MyGUIInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkCamerasInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkEditorInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkDebuggingInterface).Assembly); pluginManager.initializePlugins(); frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget, new Color(0.2f, 0.2f, 0.2f)); lightManager = pluginManager.RendererPlugin.createSceneViewLightManager(); //Core resources MyGUIInterface.Instance.CommonResourceGroup.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", true); OgreResourceGroupManager.getInstance().addResourceLocation(GetType().AssemblyQualifiedName, "EmbeddedResource", "DebugShaders", true); OgreResourceGroupManager.getInstance().initializeAllResourceGroups(); //Intialize the platform systemTimer = new NativeSystemTimer(); mainTimer = new NativeUpdateTimer(systemTimer); mainTimer.FramerateCap = OgreModelEditorConfig.EngineConfig.MaxFPS; idleHandler = new IdleHandler(mainTimer.OnIdle); inputHandler = new NativeInputHandler(mainWindow, false); eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers))); eventUpdate = new EventUpdateListener(eventManager); mainTimer.addUpdateListener(eventUpdate); mainTimer.addUpdateListener(updateEventListener); pluginManager.setPlatformInfo(mainTimer, eventManager); GuiFrameworkInterface.Instance.handleCursors(mainWindow); //Layout Chain mdiLayout = new MDILayoutManager(); //Scene views sceneViewController = new SceneViewController(mdiLayout, eventManager, mainTimer, pluginManager.RendererPlugin.PrimaryWindow, MyGUIInterface.Instance.OgrePlatform.RenderManager, null); sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget); sceneStatsDisplayManager.StatsVisible = true; sceneViewController.createWindow("Camera 1", OgreModelEditorConfig.CameraConfig.MainCameraPosition, OgreModelEditorConfig.CameraConfig.MainCameraLookAt, Vector3.Min, Vector3.Max, 0.0f, float.MaxValue, 100); virtualTextureLink = new VirtualTextureSceneViewLink(this); materialController = new MaterialController(this); //Tools objectMover = new SimObjectMover("ModelMover", PluginManager.Instance.RendererPlugin, eventManager, sceneViewController); mainForm = new OgreModelEditorMain(this); LayoutChain layoutChain = new LayoutChain(); layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, mainForm.LayoutContainer), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true); layoutChain.SuppressLayout = true; layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true); layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true); layoutChain.SuppressLayout = false; guiManager = new GUIManager(mdiLayout, mainWindow); guiManager.createGUILayout(layoutChain); layoutChain.layout(); splashScreen = new SplashScreen(mainWindow, 100, "OgreModelEditor.GUI.SplashScreen.SplashScreen.layout", "OgreModelEditor.GUI.SplashScreen.SplashScreen.xml"); splashScreen.Hidden += splashScreen_Hidden; splashScreen.StatusUpdated += splashScreen_StatusUpdated; splashScreen.updateStatus(0, "Loading..."); idleHandler.runTemporaryIdle(finishInitialization(defaultModel)); }
static public void WaitUntilIdle (IdleHandler idle) { WaitUntilIdleClosure closure; closure = new WaitUntilIdleClosure (idle); closure.Start (); }
/// <summary> /// Constructor. /// </summary> public AnomalyController(App app, Solution solution, IAnomalyImplementation implementation) { this.app = app; this.solution = solution; this.implementation = implementation; //Create the log. logListener = new LogFileListener(); logListener.openLogFile(AnomalyConfig.DocRoot + "/log.log"); Log.Default.addLogListener(logListener); mainWindow = new NativeOSWindow(String.Format("{0} - Anomaly", solution.Name), new IntVector2(-1, -1), new IntSize2(AnomalyConfig.EngineConfig.HorizontalRes, AnomalyConfig.EngineConfig.VerticalRes)); mainWindow.Closed += mainWindow_Closed; //Setup DPI float pixelScale = mainWindow.WindowScaling; ScaleHelper._setScaleFactor(pixelScale); var builder = new ServiceCollection(); //Initialize the plugins pluginManager = new PluginManager(AnomalyConfig.ConfigFile, builder); sceneController = new SceneController(pluginManager); //Hardcoded assemblies MyGUIInterface.EventLayerKey = EventLayers.Main; GuiFrameworkCamerasInterface.MoveCameraEventLayer = EventLayers.Cameras; GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterMain; GuiFrameworkCamerasInterface.ShortcutEventLayer = EventLayers.Main; GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools; //Setup microcode cache load OgreInterface.MicrocodeCachePath = Path.Combine(AnomalyConfig.DocRoot, "ShaderCache.mcc"); OgreInterface.AllowMicrocodeCacheLoad = AnomalyConfig.LastShaderVersion == UnifiedMaterialBuilder.Version; AnomalyConfig.LastShaderVersion = UnifiedMaterialBuilder.Version; implementation.AddPlugins(pluginManager); pluginManager.OnConfigureDefaultWindow = createWindow; //Create core classes systemTimer = new NativeSystemTimer(); mainTimer = new NativeUpdateTimer(systemTimer); mainTimer.FramerateCap = AnomalyConfig.EngineConfig.MaxFPS; idleHandler = new IdleHandler(mainTimer.OnIdle); inputHandler = new NativeInputHandler(mainWindow, false); eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers))); eventUpdate = new EventUpdateListener(eventManager); builder.TryAddSingleton <EventManager>(eventManager); //This is externally owned pluginManager.initializePlugins(); frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget, new Color(0.2f, 0.2f, 0.2f)); lightManager = pluginManager.RendererPlugin.createSceneViewLightManager(); //Core resources MyGUIInterface.Instance.CommonResourceGroup.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", true); OgreResourceGroupManager.getInstance().initializeAllResourceGroups(); //Intialize the platform mainTimer.addUpdateListener(eventUpdate); mainTimer.addUpdateListener(updateEventListener); pluginManager.setPlatformInfo(mainTimer, eventManager); GuiFrameworkInterface.Instance.handleCursors(mainWindow); //Layout Chain mdiLayout = new MDILayoutManager(); //Scene views sceneViewController = new SceneViewController(mdiLayout, eventManager, mainTimer, pluginManager.RendererPlugin.PrimaryWindow, MyGUIInterface.Instance.OgrePlatform.RenderManager, null); sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget); sceneStatsDisplayManager.StatsVisible = true; sceneViewController.createWindow("Camera 1", AnomalyConfig.CameraConfig.MainCameraPosition, AnomalyConfig.CameraConfig.MainCameraLookAt, Vector3.Min, Vector3.Max, 0.0f, float.MaxValue, 100); virtualTextureLink = new VirtualTextureSceneViewLink(this); //Tools selectionMovementTools = new SimObjectMover("SelectionMover", PluginManager.Instance.RendererPlugin, eventManager, sceneViewController); selectionMovementTools.Visible = true; selectionMovementTools.addMovableObject("Selection", new SelectionMovableObject(selectionController)); mainForm = new AnomalyMain(this); LayoutChain layoutChain = new LayoutChain(); layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, mainForm.LayoutContainer), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true); layoutChain.SuppressLayout = true; layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true); layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true); layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true); layoutChain.SuppressLayout = false; guiManager = new GUIManager(); guiManager.createGUI(mdiLayout, layoutChain, mainWindow); layoutChain.layout(); splashScreen = new SplashScreen(mainWindow, 100, "Anomaly.GUI.SplashScreen.SplashScreen.layout", "Anomaly.GUI.SplashScreen.SplashScreen.xml"); splashScreen.Hidden += splashScreen_Hidden; splashScreen.StatusUpdated += splashScreen_StatusUpdated; splashScreen.updateStatus(0, "Loading..."); idleHandler.runTemporaryIdle(finishInitialization()); }
protected uint RunIdle(IdleHandler handler) { return(GLib.Idle.Add(delegate { return handler(); })); }
public static bool Remove(IdleHandler hndlr) { return(Source.RemoveSourceHandler(hndlr)); }