protected void DrawMainImage(swig.Vec2 contentSize, float frameHeight, float padding) { // Menu contentSize.X = System.Math.Max(1, contentSize.X); contentSize.Y = System.Math.Max(1, contentSize.Y - frameHeight - padding); Manager.Viewer.ViewPointController.SetScreenSize((int)contentSize.X, (int)contentSize.Y); Manager.Viewer.ViewPointController.Update(); var ray = Manager.Viewer.ViewPointController.GetCameraRay(); var renderParam = Manager.Viewer.EffectRenderer.GetParameter(); renderParam.CameraMatrix = Manager.Viewer.ViewPointController.GetCameraMatrix(); renderParam.ProjectionMatrix = Manager.Viewer.ViewPointController.GetProjectionMatrix(); renderParam.CameraPosition = ray.Origin; renderParam.CameraFrontDirection = ray.Direction; Manager.Viewer.EffectRenderer.SetParameter(renderParam); Manager.Viewer.EffectRenderer.ResizeScreen(Manager.Viewer.ViewPointController.GetScreenSize()); Manager.MainViewImage.Resize((int)contentSize.X, (int)contentSize.Y); Manager.Viewer.EffectRenderer.Render(Manager.MainViewImage); if (deviceType == swig.DeviceType.OpenGL) { Manager.NativeManager.ImageData(Manager.MainViewImage, (int)contentSize.X, (int)contentSize.Y, 0, 1, 1, 0); } else { Manager.NativeManager.ImageData(Manager.MainViewImage, (int)contentSize.X, (int)contentSize.Y); } }
public Network() { Label = Resources.GetString("Network") + "###Network"; Icon = Images.GetIcon("PanelNetwork"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Network"); }
void UpdateAddressBar(float dpiScale, swig.Vec2 regionSize, swig.Vec2 spacing) { float buttonWidth = Manager.NativeManager.GetTextLineHeight() + Manager.NativeManager.GetStyleVar2(swig.ImGuiStyleVarFlags.FramePadding).X * 2; // Back directory if (Manager.NativeManager.Button("↑", buttonWidth) && !String.IsNullOrEmpty(CurrentPath)) { UpdateFileListWithProjectPath(CurrentPath); } Manager.NativeManager.SameLine(); // Display current directory if (addressActivated || addressEditing) { Manager.NativeManager.PushItemWidth(regionSize.X - buttonWidth * 2 - spacing.X * 2); if (addressActivated) { Manager.NativeManager.SetKeyboardFocusHere(); addressEditing = true; addressActivated = false; } if (Manager.NativeManager.InputText("###AddressText", addressText)) { addressText = Manager.NativeManager.GetInputTextResult(); UpdateFileList(addressText); } if (Manager.NativeManager.IsItemDeactivated()) { addressEditing = false; addressText = CurrentPath; } Manager.NativeManager.PopItemWidth(); } else { string label = Path.GetFileName(CurrentPath) + "###AddressButton"; if (Manager.NativeManager.Button(label, regionSize.X - buttonWidth * 2 - spacing.X * 2)) { addressActivated = true; } } Manager.NativeManager.SameLine(); if (Manager.NativeManager.Button(Icons.NavMenu, buttonWidth)) { Manager.NativeManager.OpenPopup(OptionMenuPopupId); } UpdateOptionMenu(); }
public FileViewer() { Label = Resources.GetString("FileViewer") + "###FileVeiwer"; Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; UpdateFileListWithProjectPath(Core.FullPath); Icon = Images.GetIcon("PanelFileViewer"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("FileViewer"); }
public Option() { Label = Resources.GetString("Options") + "###Options"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.OptionValues)); Core.OnAfterLoad += OnAfter; Core.OnAfterNew += OnAfter; Icon = Images.GetIcon("PanelOption"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Options"); }
private void UpdateFileList(swig.Vec2 size) { var textImportSourceFile = MultiLanguageTextProvider.GetText("ImportSourceFile"); var textImportDestinationFile = MultiLanguageTextProvider.GetText("ImportDestinationFile"); Manager.NativeManager.BeginChildFrame(1, size); Manager.NativeManager.Columns(2); // display file table header Manager.NativeManager.Text(textImportSourceFile); Manager.NativeManager.NextColumn(); Manager.NativeManager.Text(textImportDestinationFile); Manager.NativeManager.NextColumn(); Manager.NativeManager.Separator(); // display file table body foreach (var import in importer.ImportedFiles) { var file = import.FileInfo; bool[] doesImport = new bool[] { import.DoesImport }; // source file if (Manager.NativeManager.Checkbox(file.RelativePath, doesImport)) { importer.SetFileImportSettings(file, doesImport[0]); } Manager.NativeManager.NextColumn(); // destination file if (import.DoesImport) { Manager.NativeManager.PushItemWidth(-Manager.NativeManager.GetFrameHeight()); if (Manager.NativeManager.InputText(GetStateIcon(import.State) + "###" + file.HashName, import.DestinationRelativePath)) { import.DestinationRelativePath = Manager.NativeManager.GetInputTextResult(); importer.RenewIOStatus(); } Manager.NativeManager.PopItemWidth(); } Manager.NativeManager.NextColumn(); } Manager.NativeManager.Columns(1); Manager.NativeManager.EndChildFrame(); }
// Display file list private void UpdateFileList(swig.Vec2 size) { var textImportSourceFile = MultiLanguageTextProvider.GetText("ImportSourceFile"); var textImportDestinationFile = MultiLanguageTextProvider.GetText("ImportDestinationFile"); Manager.NativeManager.BeginChildFrame(1, size); Manager.NativeManager.Columns(2); // display file table header Manager.NativeManager.Text(textImportSourceFile); Manager.NativeManager.NextColumn(); Manager.NativeManager.Text(textImportDestinationFile); Manager.NativeManager.NextColumn(); Manager.NativeManager.Separator(); // display file table body foreach (var file in EfkPkg.AllFiles) { var import = importFiles[file]; bool[] doesImport = new bool[] { import.DoesImport }; // source file if (Manager.NativeManager.Checkbox(file.Name, doesImport)) { SetFileImportSettings(file, doesImport[0]); } Manager.NativeManager.NextColumn(); // destination file if (import.DoesImport) { Manager.NativeManager.PushItemWidth(-Manager.NativeManager.GetTextLineHeight()); if (Manager.NativeManager.InputText(import.GetStateIcon() + "###" + file.HashName, import.DestinationName)) { import.DestinationName = Manager.NativeManager.GetInputTextResult(); import.ValidationPath(targetDirPath); } Manager.NativeManager.PopItemWidth(); } Manager.NativeManager.NextColumn(); } Manager.NativeManager.Columns(1); Manager.NativeManager.EndChildFrame(); }
public static Dock.DockPanel SelectOrShowWindow(Type t, swig.Vec2 defaultSize = null, bool resetSize = false, bool requireClose = true) { for (int i = 0; i < dockTypes.Length; i++) { if (dockTypes[i] != t) { continue; } if (panels[i] != null) { if (panels[i].Visibled && requireClose) { panels[i].Close(); } else { panels[i].SetFocus(); } return(panels[i]); } else { if (defaultSize == null) { defaultSize = new swig.Vec2(); } panels[i] = (Dock.DockPanel)t.GetConstructor(Type.EmptyTypes).Invoke(null); panels[i].InitialDockSize = defaultSize; panels[i].IsInitialized = -1; panels[i].ResetSize = resetSize; if (dockManager != null) { dockManager.Controls.Add(panels[i]); } else { AddControl(panels[i]); } return(panels[i]); } } return(null); }
public FileViewer() { Label = Resources.GetString("FileViewer") + "###FileVeiwer"; Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; if (!String.IsNullOrEmpty(Core.FullPath)) { UpdateFileList(Path.GetDirectoryName(Core.FullPath)); } Icon = Images.GetIcon("PanelFileViewer"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("FileViewer"); }
public ViewPoint() { Label = Resources.GetString("CameraSettings") + "###CameraSettings"; id_f = "###" + Manager.GetUniqueID().ToString(); id_rx = "###" + Manager.GetUniqueID().ToString(); id_ry = "###" + Manager.GetUniqueID().ToString(); id_d = "###" + Manager.GetUniqueID().ToString(); id_s = "###" + Manager.GetUniqueID().ToString(); id_t = "###" + Manager.GetUniqueID().ToString(); Icon = Images.GetIcon("PanelViewPoint"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("CameraSettings"); }
public void Update() { float dpiScale = Manager.DpiScale; swig.Vec2 size = new swig.Vec2(18 * dpiScale, 18 * dpiScale); if (!Images.Icons.ContainsKey("Copy")) { ErrorUtils.ThrowFileNotfound(); } if (Manager.NativeManager.ImageButton(Images.Icons["Copy"], size.X, size.Y)) { var o = getter(); if (o != null) { Manager.NativeManager.SetClipboardText(Core.Copy(elementName, o)); } } if (Functions.CanShowTip()) { Manager.NativeManager.SetTooltip(Resources.GetString("Panel_Copy_Desc")); } Manager.NativeManager.SameLine(); if (Manager.NativeManager.ImageButton(Images.Icons["Paste"], size.X, size.Y)) { var str = Manager.NativeManager.GetClipboardText(); if (!string.IsNullOrEmpty(str)) { var o = getter(); if (o != null) { Core.Paste(elementName, o, str); valueChanged?.Invoke(); } } } if (Functions.CanShowTip()) { Manager.NativeManager.SetTooltip(Resources.GetString("Panel_Paste_Desc")); } }
protected void DrawMainImage(swig.Vec2 contentSize, float frameHeight, float padding) { // Menu contentSize.X = System.Math.Max(1, contentSize.X); contentSize.Y = System.Math.Max(1, contentSize.Y - frameHeight - padding); Manager.Native.RenderView((int)contentSize.X, (int)contentSize.Y, Manager.Viewer.ViewPointController, Manager.MainViewImage); if (deviceType == swig.DeviceType.OpenGL) { Manager.NativeManager.ImageData(Manager.MainViewImage, (int)contentSize.X, (int)contentSize.Y, 0, 1, 1, 0); } else { Manager.NativeManager.ImageData(Manager.MainViewImage, (int)contentSize.X, (int)contentSize.Y); } }
public DepthValues() { Label = Resources.GetString("Depth") + "###Depth"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.ScaleValues)); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("Depth"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Depth"); }
public LocationValues() { Label = Resources.GetString("Position") + "###Position"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.LocationValues)); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelLocation"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Position"); }
public Recorder() { selectedExportTypes[0] = Resources.GetString("ExportAsSingleImage"); selectedExportTypes[1] = Resources.GetString("ExportAsImages"); selectedExportTypes[2] = Resources.GetString("ExportAsGifAnimation"); selectedExportTypes[3] = Resources.GetString("ExportAsAvi"); selectedAlphaTypes[0] = Resources.GetString("None"); selectedAlphaTypes[1] = Resources.GetString("UseOriginalImage"); selectedAlphaTypes[2] = Resources.GetString("GenerateAlpha"); Label = Resources.GetString("Recorder") + "###Recorder"; Icon = Images.GetIcon("PanelRecorder"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Recorder"); }
public Culling() { Label = Resources.GetString("Culling") + "###Culling"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.EffectCullingValues)); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelCulling"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Culling"); }
public LocationAbsValues() { Label = Resources.GetString("AttractionForces") + "###AttractionForces"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.LocationAbsValues)); candp = new Component.CopyAndPaste("AttractionForces", GetTargetObject); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelLocationAbs"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("AttractionForces"); }
public NodeTreeView() { Label = Resources.GetString("NodeTree") + "###NodeTree"; Core.OnAfterNew += OnRenew; Core.OnAfterLoad += OnRenew; Core.OnAfterSelectNode += OnAfterSelect; Func <Func <bool>, Menu.MenuItem> create_menu_item_from_commands = (a) => { var item = new Menu.MenuItem(); var attributes = a.Method.GetCustomAttributes(false); var uniquename = UniqueNameAttribute.GetUniqueName(attributes); item.Label = NameAttribute.GetName(attributes); item.Shortcut = Shortcuts.GetShortcutText(uniquename); item.Clicked += () => { a(); }; return(item); }; menuItems.Add(create_menu_item_from_commands(Commands.AddNode)); menuItems.Add(create_menu_item_from_commands(Commands.InsertNode)); menuItems.Add(create_menu_item_from_commands(Commands.RemoveNode)); menuItems.Add(new Menu.MenuSeparator()); menuItems.Add(create_menu_item_from_commands(Commands.Copy)); menuItems.Add(create_menu_item_from_commands(Commands.Paste)); menuItems.Add(create_menu_item_from_commands(Commands.PasteInfo)); menuItems.Add(new Menu.MenuSeparator()); menuItems.Add(create_menu_item_from_commands(Commands.Undo)); menuItems.Add(create_menu_item_from_commands(Commands.Redo)); Renew(); Icon = Images.GetIcon("PanelNodeTree"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("NodeTree"); }
public GenerationLocationValues() { Label = Resources.GetString("SpawningMethod") + "###SpawningMethod"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.GenerationLocationValues)); candp = new Component.CopyAndPaste("SpawningMethod", GetTargetObject); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelGenerationLocation"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("SpawningMethod"); }
public CommonValues() { Label = Resources.GetString("BasicSettings") + "###BasicSettings"; paramerterList_Node = new Component.ParameterList(); paramerterList_Node.SetType(typeof(Data.NodeBase)); paramerterList_Common = new Component.ParameterList(); paramerterList_Common.SetType(typeof(Data.CommonValues)); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelCommon"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("BasicSettings"); }
public BehaviorValues() { Label = Resources.GetString("Behavior") + "###Behavior"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.EffectBehaviorValues)); candp = new Component.CopyAndPaste("Behavior", GetTargetObject); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Read(); Icon = Images.GetIcon("PanelBehavior"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Behavior"); }
public RendererCommonValues() { Label = Resources.GetString("BasicRenderSettings") + "###BasicRenderSettings"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.RendererCommonValues)); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Controls.Add(paramerterList); Read(); Icon = Images.GetIcon("PanelRendererCommon"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("BasicRenderSettings"); }
internal static Dock.DockPanel SelectOrShowWindow(Type t, swig.Vec2 defaultSize = null, swig.DockSlot slot = swig.DockSlot.None, float dockRate = 0.5f, bool isResetParent = false) { for (int i = 0; i < dockTypes.Length; i++) { if (dockTypes[i] != t) { continue; } if (panels[i] != null) { return(panels[i]); } else { if (defaultSize == null) { defaultSize = new swig.Vec2(); } panels[i] = (Dock.DockPanel)t.GetConstructor(Type.EmptyTypes).Invoke(null); panels[i].InitialDockSlot = slot; panels[i].InitialDockSize = defaultSize; panels[i].InitialDockReset = isResetParent; panels[i].InitialDockRate = dockRate; panels[i].IsInitialized = -1; if (dockManager != null) { dockManager.Controls.Add(panels[i]); } else { AddControl(panels[i]); } return(panels[i]); } } return(null); }
public SoundValues() { Label = Resources.GetString("Sound") + "###Sound"; paramerterList = new Component.ParameterList(); paramerterList.SetType(typeof(Data.SoundValues)); candp = new Component.CopyAndPaste("Sound", GetTargetObject); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSelectNode += OnAfterSelectNode; Controls.Add(candp); Controls.Add(paramerterList); Read(); Icon = Images.GetIcon("PanelSound"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Sound"); }
public Environement() { Label = Resources.GetString("PostEffect") + "###PostEffect"; paramerterListBackground = new Component.ParameterList(); paramerterListBackground.SetType(typeof(Data.EnvironmentBackgroundValues)); paramerterListLighting = new Component.ParameterList(); paramerterListLighting.SetType(typeof(Data.EnvironmentLightingValues)); paramerterListPostEffect = new Component.ParameterList(); paramerterListPostEffect.SetType(typeof(Data.EnvironmentPostEffectValues)); candp = new Component.CopyAndPaste("Environment", GetTargetObject); Core.OnAfterLoad += OnAfter; Core.OnAfterNew += OnAfter; Icon = Images.GetIcon("PanelPostEffect"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Options"); }
public Dynamic() { Label = Resources.GetString("DynamicParameter_Name") + "###DynamicParameter"; paramerterListInput = new Component.ParameterList(); paramerterList = new Component.ParameterList(); Core.OnBeforeLoad += Core_OnBeforeLoad; Core.OnBeforeNew += Core_OnBeforeNew; Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.Dynamic.Equations.OnChanged += Vectors_OnChanged; Core.Dynamic.Inputs.Values[0].Input.OnChanged += Input_OnChanged; Core.Dynamic.Inputs.Values[1].Input.OnChanged += Input_OnChanged; Core.Dynamic.Inputs.Values[2].Input.OnChanged += Input_OnChanged; Core.Dynamic.Inputs.Values[3].Input.OnChanged += Input_OnChanged; Read(); Icon = Images.GetIcon("PanelCulling"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("Culling"); }
public FCurves() { Label = Resources.GetString("FCurves") + "###FCurves"; Command.CommandManager.Changed += OnChanged; Core.OnAfterNew += OnChanged; Core.OnBeforeLoad += OnBeforeLoad; Core.OnAfterLoad += OnAfterLoad; startCurve.Initialize(typeof(Data.Value.FCurveEdge)); startCurve.Label = start_text + "##Start"; endCurve.Initialize(typeof(Data.Value.FCurveEdge)); endCurve.Label = end_text + "##End"; type.Initialize(typeof(Data.Value.FCurveInterpolation)); type.Label = type_text + "##Type"; OnChanged(); Icon = Images.GetIcon("PanelFCurve"); IconSize = new swig.Vec2(24, 24); TabToolTip = Resources.GetString("FCurves"); }
public static void Update() { if (isFontSizeDirtied) { NativeManager.InvalidateFont(); var appDirectory = Manager.GetEntryDirectory(); var type = Core.Option.Font.Value; NativeManager.ClearAllFonts(); var characterTable = System.IO.Path.Combine(appDirectory, "resources/languages/characterTable.txt"); if (type == Data.FontType.Normal) { NativeManager.AddFontFromFileTTF(System.IO.Path.Combine(appDirectory, MultiLanguageTextProvider.GetText("Font_Normal")), characterTable, MultiLanguageTextProvider.GetText("CharacterTable"), Core.Option.FontSize.Value); } else if (type == Data.FontType.Bold) { NativeManager.AddFontFromFileTTF(System.IO.Path.Combine(appDirectory, MultiLanguageTextProvider.GetText("Font_Bold")), characterTable, MultiLanguageTextProvider.GetText("CharacterTable"), Core.Option.FontSize.Value); } NativeManager.AddFontFromAtlasImage(System.IO.Path.Combine(appDirectory, "resources/icons/MenuIcons.png"), 0xec00, 24, 24, 16, 16); isFontSizeDirtied = false; } // Reset IO.Update(); Shortcuts.Update(); Network.Update(); var handle = false; if (!handle) { if (!NativeManager.IsAnyItemActive()) { Shortcuts.ProcessCmdKey(ref handle); } } var mousePos = NativeManager.GetMousePosition(); if (isFirstUpdate) { mousePos_pre = mousePos; } if ((effectViewer == null && !NativeManager.IsAnyWindowHovered()) || (effectViewer != null && effectViewer.IsHovered)) { var result = ControllViewport(); if (result.Slide) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; if (Core.Option.ViewerMode.Value == Data.OptionValues.ViewMode._3D) { Viewer.Slide(dx / 30.0f, dy / 30.0f); } else if (Core.Option.ViewerMode.Value == Data.OptionValues.ViewMode._2D) { Viewer.Slide(dx / 16.0f, dy / 16.0f); } } else if (NativeManager.GetMouseWheel() != 0) { Viewer.Zoom(NativeManager.GetMouseWheel()); } else if (result.Zoom) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; Viewer.Zoom(-dy * 0.25f); } else if (result.Rotate) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; if (Core.Option.ViewerMode.Value == Data.OptionValues.ViewMode._3D) { Viewer.Rotate(dx, dy); } else if (Core.Option.ViewerMode.Value == Data.OptionValues.ViewMode._2D) { Viewer.Slide(dx / 16.0f, dy / 16.0f); } } } mousePos_pre = mousePos; Viewer.UpdateViewer(); Native.UpdateWindow(); Native.ClearWindow(50, 50, 50, 0); //if(effectViewer == null) //{ // Native.RenderWindow(); //} NativeManager.ResetGUI(); if (resetCount < 0) { resetCount++; if (resetCount == 0) { Application.Current.OnResetWindowActually(); } } if (resizedCount > 0) { resizedCount--; } Controls.Lock(); foreach (var c in Controls.Internal) { c.Update(); } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } var dp = _ as Dock.DockPanel; if (dp != null) { dp.DispatchDisposed(); } } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } Controls.Remove(_); } Controls.Unlock(); for (int i = 0; i < dockTypes.Length; i++) { if (panels[i] != null && panels[i].ShouldBeRemoved) { panels[i] = null; } } NativeManager.RenderGUI(resizedCount == 0); Native.Present(); NativeManager.Present(); isFirstUpdate = false; // TODO more smart // When minimized, suppress CPU activity if (actualWidth == 0) { System.Threading.Thread.Sleep(16); } }
public static void Update() { // Reset NativeManager.SetNextDockRate(0.5f); NativeManager.SetNextDock(swig.DockSlot.Tab); NativeManager.ResetNextParentDock(); Shortcuts.Update(); var handle = false; if (!handle) { var cursor = Manager.NativeManager.GetMouseCursor(); if (cursor == swig.MouseCursor.None || cursor == swig.MouseCursor.Arrow) { Shortcuts.ProcessCmdKey(ref handle); } } var mousePos = NativeManager.GetMousePosition(); if (isFirstUpdate) { mousePos_pre = mousePos; } if ((effectViewer == null && !NativeManager.IsAnyWindowHovered()) || (effectViewer != null && effectViewer.IsHovered)) { if (NativeManager.GetMouseButton(2) > 0) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; Viewer.Slide(dx / 30.0f, dy / 30.0f); } if (NativeManager.GetMouseButton(1) > 0) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; Viewer.Rotate(dx, dy); } if (NativeManager.GetMouseWheel() != 0) { Viewer.Zoom(NativeManager.GetMouseWheel()); } } mousePos_pre = mousePos; Viewer.UpdateViewer(); Native.UpdateWindow(); Native.ClearWindow(50, 50, 50, 0); if (effectViewer == null) { Native.RenderWindow(); } NativeManager.ResetGUI(); if (resetCount < 0) { resetCount++; if (resetCount == 0) { ResetWindowActually(); } } if (resizedCount > 0) { resizedCount--; } Controls.Lock(); foreach (var c in Controls.Internal) { c.Update(); } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } var dp = _ as Dock.DockPanel; if (dp != null) { dp.DispatchDisposed(); } } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } Controls.Remove(_); } Controls.Unlock(); for (int i = 0; i < dockTypes.Length; i++) { if (panels[i] != null && panels[i].ShouldBeRemoved) { panels[i] = null; } } NativeManager.RenderGUI(resizedCount == 0); Native.Present(); NativeManager.Present(); isFirstUpdate = false; // TODO more smart // When minimized, suppress CPU activity if (actualWidth == 0) { System.Threading.Thread.Sleep(16); } }
public static void Update() { Shortcuts.Update(); var handle = false; if (!handle) { Shortcuts.ProcessCmdKey(ref handle); } var mousePos = NativeManager.GetMousePosition(); if (isFirstUpdate) { mousePos_pre = mousePos; } if ((effectViewer == null && !NativeManager.IsAnyWindowHovered()) || (effectViewer != null && effectViewer.IsHovered)) { if (NativeManager.GetMouseButton(2) > 0) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; Viewer.Slide(dx / 30.0f, dy / 30.0f); } if (NativeManager.GetMouseButton(1) > 0) { var dx = mousePos.X - mousePos_pre.X; var dy = mousePos.Y - mousePos_pre.Y; Viewer.Rotate(dx, dy); } if (NativeManager.GetMouseWheel() != 0) { Viewer.Zoom(NativeManager.GetMouseWheel()); } } mousePos_pre = mousePos; Viewer.UpdateViewer(); Native.UpdateWindow(); Native.ClearWindow(50, 50, 50, 0); if (effectViewer == null) { Native.RenderWindow(); } NativeManager.ResetGUI(); if (resetCount < 0) { resetCount++; if (resetCount == 0) { ResetWindowActually(); } } Controls.Lock(); foreach (var c in Controls.Internal) { c.Update(); } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } var dp = _ as Dock.DockPanel; if (dp != null) { dp.DispatchDisposed(); } } foreach (var _ in Controls.Internal) { if (!_.ShouldBeRemoved) { continue; } Controls.Remove(_); } Controls.Unlock(); for (int i = 0; i < dockTypes.Length; i++) { if (panels[i] != null && panels[i].ShouldBeRemoved) { panels[i] = null; } } NativeManager.RenderGUI(); Native.Present(); NativeManager.Present(); isFirstUpdate = false; }