public void Later_Styles_Should_Override_Earlier() { Styles styles = new Styles { new Style(x => x.OfType<Class1>().Class("foo")) { Setters = new[] { new Setter(Class1.FooProperty, "Foo"), }, }, new Style(x => x.OfType<Class1>().Class("foo")) { Setters = new[] { new Setter(Class1.FooProperty, "Bar"), }, } }; var target = new Class1(); List<string> values = new List<string>(); target.GetObservable(Class1.FooProperty).Subscribe(x => values.Add(x)); styles.Attach(target); target.Classes.Add("foo"); target.Classes.Remove("foo"); Assert.Equal(new[] { "foodefault", "Foo", "Bar", "foodefault" }, values); }
/// <summary> /// Renders a label to the map. /// </summary> /// <param name="graphics">Graphics reference</param> /// <param name="labelPoint">Label placement</param> /// <param name="offset">Offset of label in screen coordinates</param> /// <param name="font">Font used for rendering</param> /// <param name="forecolor">Font forecolor</param> /// <param name="backcolor">Background color</param> /// <param name="halo">Color of halo</param> /// <param name="rotation">Text rotation in degrees</param> /// <param name="text">Text to render</param> /// <param name="viewport"></param> public static void DrawLabel(Graphics graphics, Point labelPoint, Offset offset, Styles.Font font, Styles.Color forecolor, Styles.Brush backcolor, Styles.Pen halo, double rotation, string text, IViewport viewport, StyleContext context) { SizeF fontSize = graphics.MeasureString(text, font.ToGdi(context)); //Calculate the size of the text labelPoint.X += offset.X; labelPoint.Y += offset.Y; //add label offset if (Math.Abs(rotation) > Constants.Epsilon && !double.IsNaN(rotation)) { graphics.TranslateTransform((float)labelPoint.X, (float)labelPoint.Y); graphics.RotateTransform((float)rotation); graphics.TranslateTransform(-fontSize.Width / 2, -fontSize.Height / 2); if (backcolor != null && backcolor.ToGdi(context) != Brushes.Transparent) graphics.FillRectangle(backcolor.ToGdi(context), 0, 0, fontSize.Width * 0.74f + 1f, fontSize.Height * 0.74f); var path = new GraphicsPath(); path.AddString(text, new FontFamily(font.FontFamily), (int)font.ToGdi(context).Style, font.ToGdi(context).Size, new System.Drawing.Point(0, 0), null); if (halo != null) graphics.DrawPath(halo.ToGdi(context), path); graphics.FillPath(new SolidBrush(forecolor.ToGdi()), path); //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), 0, 0); } else { if (backcolor != null && backcolor.ToGdi(context) != Brushes.Transparent) graphics.FillRectangle(backcolor.ToGdi(context), (float)labelPoint.X, (float)labelPoint.Y, fontSize.Width * 0.74f + 1, fontSize.Height * 0.74f); var path = new GraphicsPath(); //Arial hack path.AddString(text, new FontFamily("Arial"), (int)font.ToGdi(context).Style, (float)font.Size, new System.Drawing.Point((int)labelPoint.X, (int)labelPoint.Y), null); if (halo != null) graphics.DrawPath(halo.ToGdi(context), path); graphics.FillPath(new SolidBrush(forecolor.ToGdi()), path); //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), LabelPoint.X, LabelPoint.Y); } }
public void Maps() { if (s_Styles == null) { s_Styles = new Styles(); } GUI.changed = false; if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand) { SerializedObject obj2 = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); EditorGUILayout.PropertyField(obj2.FindProperty("m_LightingDataAsset"), s_Styles.LightingDataAsset, new GUILayoutOption[0]); obj2.ApplyModifiedProperties(); } GUILayout.Space(10f); LightmapData[] lightmaps = LightmapSettings.lightmaps; this.m_ScrollPositionMaps = GUILayout.BeginScrollView(this.m_ScrollPositionMaps, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(true)) { for (int i = 0; i < lightmaps.Length; i++) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(i.ToString(), new GUILayoutOption[0]); GUILayout.Space(5f); lightmaps[i].lightmapLight = this.LightmapField(lightmaps[i].lightmapLight, i); GUILayout.Space(10f); lightmaps[i].lightmapDir = this.LightmapField(lightmaps[i].lightmapDir, i); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { if (s_Styles == null) { s_Styles = new Styles(); } Rect position = pos; position.height = EditorGUIUtility.singleLineHeight; SerializedProperty navigation = prop.FindPropertyRelative("m_Mode"); Navigation.Mode navigationMode = GetNavigationMode(navigation); EditorGUI.PropertyField(position, navigation, s_Styles.navigationContent); EditorGUI.indentLevel++; position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (navigationMode == Navigation.Mode.Explicit) { SerializedProperty property = prop.FindPropertyRelative("m_SelectOnUp"); SerializedProperty property3 = prop.FindPropertyRelative("m_SelectOnDown"); SerializedProperty property4 = prop.FindPropertyRelative("m_SelectOnLeft"); SerializedProperty property5 = prop.FindPropertyRelative("m_SelectOnRight"); EditorGUI.PropertyField(position, property); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, property3); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, property4); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, property5); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } EditorGUI.indentLevel--; }
public static XamlBrush MapsuiBrushToXaml(Styles.Brush brush, BrushCache brushCache = null) { if (brush == null) return null; switch (brush.FillStyle) { case FillStyle.Cross: return CreateHatchBrush(brush, 12, 10, new List<Geometry> { Geometry.Parse("M 0 0 l 10 10"), Geometry.Parse("M 0 10 l 10 -10") }); case FillStyle.BackwardDiagonal: return CreateHatchBrush(brush, 10, 10, new List<Geometry> { Geometry.Parse("M 0 10 l 10 -10"), Geometry.Parse("M -0.5 0.5 l 10 -10"), Geometry.Parse("M 8 12 l 10 -10") }); case FillStyle.Bitmap: return CreateImageBrush(brush, brushCache); case FillStyle.Dotted: return DottedBrush(brush); case FillStyle.DiagonalCross: return CreateHatchBrush(brush, 10, 10, new List<Geometry> { Geometry.Parse("M 0 0 l 10 10"), Geometry.Parse("M 0 10 l 10 -10") }); case FillStyle.ForwardDiagonal: return CreateHatchBrush(brush, 10, 10, new List<Geometry> { Geometry.Parse("M -1 9 l 10 10"), Geometry.Parse("M 0 0 l 10 10"), Geometry.Parse("M 9 -1 l 10 10") }); case FillStyle.Hollow: return new SolidColorBrush(Colors.Transparent); case FillStyle.Horizontal: return CreateHatchBrush(brush, 10, 10, new List<Geometry> { Geometry.Parse("M 0 5 h 10") }); case FillStyle.Solid: return new SolidColorBrush(brush.Color != null ? brush.Color.ToXaml() : brush.Background != null ? brush.Color.ToXaml() : Colors.Transparent); case FillStyle.Vertical: return CreateHatchBrush(brush, 10, 10, new List<Geometry> { Geometry.Parse("M 5 0 l 0 10") }); default: return (brush.Color != null) ? new SolidColorBrush(brush.Color.ToXaml()) : null; } }
private void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); base.minSize = new Vector2(450f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } GUILayout.Space(10f); GUILayout.Label("#pragma implicit and #pragma downcast need to be added to following files\nfor backwards compatibility", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, s_Styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement) enumerator.Current; if ((current.row == this.m_LV.row) && (Event.current.type == EventType.Repaint)) { s_Styles.selected.Draw(current.position, false, false, false, false); } GUILayout.Label(this.m_Paths[current.row], new GUILayoutOption[0]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", s_Styles.button, new GUILayoutOption[0])) { base.Close(); PragmaFixing30.FixFiles(this.m_Paths); GUIUtility.ExitGUI(); } if (GUILayout.Button("Ignore", s_Styles.button, new GUILayoutOption[0])) { base.Close(); GUIUtility.ExitGUI(); } if (GUILayout.Button("Quit", s_Styles.button, new GUILayoutOption[0])) { EditorApplication.Exit(0); GUIUtility.ExitGUI(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
void InitIfNeeded() { if (s_Styles == null) s_Styles = new Styles(); if (_navigateToItemProvider == null) _navigateToItemProvider = UnityEditorCompositionContainer.GetExportedValue<INavigateToItemProviderAggregator>(); }
public VideoSettings() { WindowStyle = Styles.Default; // Titlebar + Resize + Close WindowSettings = VideoMode.DesktopMode; OpenGLSettings = new ContextSettings(); RefreshRate = 30; }
private static void DrawRectangle(Canvas canvas, RectF destination, Styles.Color outlineColor) { var paint = new Paint(); paint.SetStyle(Paint.Style.Stroke); paint.Color = new AndroidColor(outlineColor.R, outlineColor.G, outlineColor.B, outlineColor.A); paint.StrokeWidth = 4; canvas.DrawRect(destination, paint); }
private void Init() { if (styles == null) { styles = new Styles(); } this.InitShowOptions(); }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (Event.current.type != EventType.Repaint) return; if (m_Styles == null) m_Styles = new Styles(); GameObject go = target as GameObject; RectTransform rect = go.transform as RectTransform; if (rect == null) return; // Apply padding RectOffset previewPadding = new RectOffset(-5, -5, -5, -5); r = previewPadding.Add(r); // Prepare rects for columns r.height = EditorGUIUtility.singleLineHeight; Rect labelRect = r; Rect valueRect = r; Rect sourceRect = r; labelRect.width = kLabelWidth; valueRect.xMin += kLabelWidth; valueRect.width = kValueWidth; sourceRect.xMin += kLabelWidth + kValueWidth; // Headers GUI.Label(labelRect, "Property", m_Styles.headerStyle); GUI.Label(valueRect, "Value", m_Styles.headerStyle); GUI.Label(sourceRect, "Source", m_Styles.headerStyle); labelRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; valueRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; sourceRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; // Prepare reusable variable for out argument ILayoutElement source = null; // Show properties ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Width", LayoutUtility.GetLayoutProperty(rect, e => e.minWidth, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Height", LayoutUtility.GetLayoutProperty(rect, e => e.minHeight, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Width", LayoutUtility.GetLayoutProperty(rect, e => e.preferredWidth, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Height", LayoutUtility.GetLayoutProperty(rect, e => e.preferredHeight, 0, out source).ToString(), source); float flexible = 0; flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleWidth, 0, out source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Width", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source); flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleHeight, 0, out source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Height", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source); if (!rect.GetComponent<LayoutElement>()) { Rect noteRect = new Rect(labelRect.x, labelRect.y + 10, r.width, EditorGUIUtility.singleLineHeight); GUI.Label(noteRect, "Add a LayoutElement to override values.", m_Styles.labelStyle); } }
public Style(Styles style) { switch (style) { case Styles.MonoBlack: CreateMonoBlack(); break; } }
/// <summary> /// Gets the GDI pen. /// </summary> /// <param name="pen">The GDI pen.</param> /// <returns></returns> public System.Drawing.Pen GetPen(Styles.Pen pen) { System.Drawing.Pen gdiPen; if (!pens.TryGetValue(pen, out gdiPen)) { gdiPen = new System.Drawing.Pen(pen.Color.ToGdi(), (float)pen.Width); } return gdiPen; }
/// <summary> /// Gets the GDI brush. /// </summary> /// <param name="brush">The GDI brush.</param> /// <returns></returns> public System.Drawing.Brush GetBrush(Styles.Brush brush) { System.Drawing.Brush gdiBrush; if (!brushes.TryGetValue(brush, out gdiBrush)) { gdiBrush = new System.Drawing.SolidBrush(brush.Color.ToGdi()); } return gdiBrush; }
public System.Drawing.Font GetFont(Styles.Font font) { System.Drawing.Font gdiFont; if (!fonts.TryGetValue(font, out gdiFont)) { gdiFont = new System.Drawing.Font(font.FontFamily, (float)font.Size); } return gdiFont; }
public Game() { videoMode = new VideoMode(960, 540); title = "SFML Game Window"; style = Styles.Close; context = new ContextSettings(); ScreenManager = new ScreenManager(); }
private static void LoadLogos() { if (styles == null) { s_ShowAtStartup = EditorPrefs.GetInt("ShowWelcomeAtStartup4", 1) != 0; s_ShowCount = EditorPrefs.GetInt("WelcomeScreenShowCount", 0); styles = new Styles(); } }
private static Rectangle CreateBackground(Styles.Color color, int size) { return new Rectangle { Fill = color == null ? new SolidColorBrush(Colors.Transparent) : new SolidColorBrush(GetColor(color)), Width = size, Height = size }; }
public E3Font(string name = "GOST type A", double height=3, Alignment alignment = Alignment.Centered, Mode mode = Mode.Normal, Styles style = Styles.Italic, int colorIndex= -1 ) { this.name = name; this.height = height; this.alignment = alignment; this.mode = mode; this.style = style; ColorIndex = colorIndex; }
private static void Fill_In_Out_Yield_CT(DateTime mtdDate, DateTime wtdDate, DateTime dtdDate, DateTime endDate, string operationName, int startRow, int startCol, Cells cls, Styles styles) { int dtdStartRow = startRow + 1; int wtdStartRow = startRow + 2; int mtdStartRow = startRow + 3; cmdIn_Out_Yield_CT.Parameters["END_DATE"].Value = endDate; cmdIn_Out_Yield_CT.Parameters["OPERATION_NAME"].Value = operationName; cmdIn_Out_Yield_CT.Parameters["START_DATE"].Value = dtdDate; using (OracleDataReader rd = cmdIn_Out_Yield_CT.ExecuteReader()) { while (rd.Read()) { CellValueStyle(cls[dtdStartRow, 0], rd["productname"], styles["ColumnHeader"]); CellValueStyle(cls[dtdStartRow, 1], "DTD", styles["ColumnHeader"]); CellValueStyle(cls[dtdStartRow, startCol + 0], rd["InQty"], styles["Data"]); CellValueStyle(cls[dtdStartRow, startCol + 1], rd["OutQty"], styles["Data"]); cls[dtdStartRow, startCol + 3].R1C1Formula = "=1-" + rd["RejectQty"] + "/R[0]C[-3]"; cls[dtdStartRow, startCol + 3].Style = styles["Percent"]; CellValueStyle(cls[dtdStartRow, startCol + 4], rd["CycleTime"], styles["Data"]); dtdStartRow += 3; } } cmdIn_Out_Yield_CT.Parameters["START_DATE"].Value = wtdDate; using (OracleDataReader rd = cmdIn_Out_Yield_CT.ExecuteReader()) { while (rd.Read()) { CellValueStyle(cls[wtdStartRow, 0], rd["productname"], styles["ColumnHeader"]); CellValueStyle(cls[wtdStartRow, 1], "WTD", styles["ColumnHeader"]); CellValueStyle(cls[wtdStartRow, startCol + 0], rd["InQty"], styles["Data"]); CellValueStyle(cls[wtdStartRow, startCol + 1], rd["OutQty"], styles["Data"]); cls[wtdStartRow, startCol + 3].R1C1Formula = "=1-" + rd["RejectQty"] + "/R[0]C[-3]"; cls[wtdStartRow, startCol + 3].Style = styles["Percent"]; CellValueStyle(cls[wtdStartRow, startCol + 4], rd["CycleTime"], styles["Data"]); wtdStartRow += 3; } } cmdIn_Out_Yield_CT.Parameters["START_DATE"].Value = mtdDate; using (OracleDataReader rd = cmdIn_Out_Yield_CT.ExecuteReader()) { while (rd.Read()) { CellValueStyle(cls[mtdStartRow, 0], rd["productname"], styles["ColumnHeader"]); CellValueStyle(cls[mtdStartRow, 1], "MTD", styles["ColumnHeader"]); CellValueStyle(cls[mtdStartRow, startCol + 0], rd["InQty"], styles["Data"]); CellValueStyle(cls[mtdStartRow, startCol + 1], rd["OutQty"], styles["Data"]); cls[mtdStartRow, startCol + 3].R1C1Formula = "=1-" + rd["RejectQty"] + "/R[0]C[-3]"; cls[mtdStartRow, startCol + 3].Style = styles["Percent"]; CellValueStyle(cls[mtdStartRow, startCol + 4], rd["CycleTime"], styles["Data"]); mtdStartRow += 3; } } }
protected bool HandleAnchor(ref Vector3 position, bool isConnectedAnchor) { if (s_Styles == null) { s_Styles = new Styles(); } if (isConnectedAnchor) { } if (<>f__mg$cache1 == null) {
/// <summary> /// Initializes a new instance of the <see cref="Application"/> class. /// </summary> /// <param name="theme">The theme to use.</param> public Application(Styles theme) { if (Current != null) { throw new InvalidOperationException("Cannot create more than one Application instance."); } Current = this; this.Styles = theme; this.RegisterServices(); }
protected bool HandleAnchor(ref Vector3 position, bool isConnectedAnchor) { if (s_Styles == null) { s_Styles = new Styles(); } Handles.DrawCapFunction drawFunc = !isConnectedAnchor ? new Handles.DrawCapFunction(Joint2DEditorBase.AnchorCap) : new Handles.DrawCapFunction(Joint2DEditorBase.ConnectedAnchorCap); int id = this.target.GetInstanceID() + (!isConnectedAnchor ? 0 : 1); EditorGUI.BeginChangeCheck(); position = Handles.Slider2D(id, position, Vector3.back, Vector3.right, Vector3.up, 0f, drawFunc, Vector2.zero); return EditorGUI.EndChangeCheck(); }
private void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); base.minSize = new Vector2(400f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } GUILayout.Space(5f); GUILayout.Label(s_Styles.overviewText, new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, s_Styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement) enumerator.Current; if ((current.row == this.m_LV.row) && (Event.current.type == EventType.Repaint)) { s_Styles.selected.Draw(current.position, false, false, false, false); } GUILayout.Label(this.m_Paths[current.row], new GUILayoutOption[0]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(1); base.Close(); } if (GUILayout.Button("Ignore", s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(0); base.Close(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
public static void RenderGeometryOutline(Graphics graphics, IViewport viewport, IGeometry geometry, Styles.VectorStyle style) { //Draw background of all line-outlines first if (geometry is LineString) { DrawLineString(graphics, geometry as LineString, style.Outline.Convert(), viewport); } else if (geometry is MultiLineString) { DrawMultiLineString(graphics, geometry as MultiLineString, style.Outline.Convert(), viewport); } }
/// <summary> /// Activates or deactivates fullscreen /// </summary> /// <param name="active"> true for fullscreen, false for no fullscreen</param> public void SetFullscreen(bool active) { if (active) { if (WindowSettings.IsValid()) WindowStyle = Styles.Fullscreen; else WindowStyle = Styles.Default; } else WindowStyle = Styles.Default; // Logmanager Windowsettings are invalid }
//////////////////////////////////////////////////////////// /// <summary> /// Create the window /// </summary> /// <param name="mode">Video mode to use</param> /// <param name="title">Title of the window</param> /// <param name="style">Window style (Resize | Close by default)</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public Window(VideoMode mode, string title, Styles style, ContextSettings settings) : base(IntPtr.Zero) { // Copy the title to a null-terminated UTF-32 byte array byte[] titleAsUtf32 = System.Text.Encoding.UTF32.GetBytes(title + '\0'); unsafe { fixed (byte* titlePtr = titleAsUtf32) { SetThis(sfWindow_createUnicode(mode, (IntPtr)titlePtr, style, ref settings)); } } }
// Methods public FontBrowser() { this.m_SampleText = "AaBbCc123"; this.m_ShowName = true; this.m_ShowSample = true; this.m_Style = Styles.ListBox; this.components = null; this.InitializeComponent(); this.m_SelectedFont = ""; this.iSelectedIndex = -1; this.CreateListBox(); this.FillListBox(); }
//////////////////////////////////////////////////////////// /// <summary> /// Create the window /// </summary> /// <param name="mode">Video mode to use</param> /// <param name="title">Title of the window</param> /// <param name="style">Window style (Resize | Close by default)</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public RenderWindow(VideoMode mode, string title, Styles style, ContextSettings settings) : base(IntPtr.Zero, 0) { // Copy the string to a null-terminated UTF-32 byte array byte[] titleAsUtf32 = Encoding.UTF32.GetBytes(title + '\0'); unsafe { fixed (byte* titlePtr = titleAsUtf32) { CPointer = sfRenderWindow_createUnicode(mode, (IntPtr)titlePtr, style, ref settings); } } Initialize(); }
public void OnGUI() { if (s_Styles == null) s_Styles = new Styles(); Event evt = Event.current; var itemList = _input.m_ItemProvider.GetList(); KeyboardHandling(itemList); ResizeHandling(); DoList(itemList); // Background with 1 pixel border for Win that does not have a dropshadow if (evt.type == EventType.Repaint && Application.platform == RuntimePlatform.WindowsEditor) s_Styles.background.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false); }
void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); } var panels = DebugManager.instance.panels; int itemCount = panels.Count(x => !x.isRuntimeOnly && x.children.Count(w => !w.isRuntimeOnly) > 0); if (itemCount == 0) { EditorGUILayout.HelpBox("No debug item found.", MessageType.Info); return; } // Background color var wrect = position; wrect.x = 0; wrect.y = 0; var oldColor = GUI.color; GUI.color = s_Styles.skinBackgroundColor; GUI.DrawTexture(wrect, EditorGUIUtility.whiteTexture); GUI.color = oldColor; using (new EditorGUILayout.HorizontalScope()) { // Side bar using (var scrollScope = new EditorGUILayout.ScrollViewScope(m_PanelScroll, s_Styles.sectionScrollView, GUILayout.Width(150f))) { GUILayout.Space(40f); if (m_Settings.selectedPanel >= panels.Count) { m_Settings.selectedPanel = 0; } // Validate container id while (panels[m_Settings.selectedPanel].isRuntimeOnly || panels[m_Settings.selectedPanel].children.Count(x => !x.isRuntimeOnly) == 0) { m_Settings.selectedPanel++; if (m_Settings.selectedPanel >= panels.Count) { m_Settings.selectedPanel = 0; } } // Root children are containers for (int i = 0; i < panels.Count; i++) { var panel = panels[i]; if (panel.isRuntimeOnly) { continue; } if (panel.children.Count(x => !x.isRuntimeOnly) == 0) { continue; } var elementRect = GUILayoutUtility.GetRect(CoreEditorUtils.GetContent(panel.displayName), s_Styles.sectionElement, GUILayout.ExpandWidth(true)); if (m_Settings.selectedPanel == i && Event.current.type == EventType.Repaint) { s_Styles.selected.Draw(elementRect, false, false, false, false); } EditorGUI.BeginChangeCheck(); GUI.Toggle(elementRect, m_Settings.selectedPanel == i, panel.displayName, s_Styles.sectionElement); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(m_Settings, "Debug Panel Selection"); m_Settings.selectedPanel = i; } } m_PanelScroll = scrollScope.scrollPosition; } GUILayout.Space(10f); // Main section - traverse current container using (var changedScope = new EditorGUI.ChangeCheckScope()) { using (new EditorGUILayout.VerticalScope()) { var selectedPanel = panels[m_Settings.selectedPanel]; GUILayout.Label(selectedPanel.displayName, s_Styles.sectionHeader); GUILayout.Space(10f); using (var scrollScope = new EditorGUILayout.ScrollViewScope(m_ContentScroll)) { TraverseContainerGUI(selectedPanel); m_ContentScroll = scrollScope.scrollPosition; } } if (changedScope.changed) { m_Settings.currentStateHash = ComputeStateHash(); } } } }
public void ClearStyle(Styles style) { this.style &= (byte)~style; }
public void SwichStyle(Styles style) { this.style ^= (byte)style; }
//-------------------------------------------------------------------------------------------------- public Marker(WorkspaceController workspaceController, Styles styles, string imageName) : base(workspaceController, null) { _Styles = styles; _Image = _GetMarkerImage(imageName); }
private void DrawProgressors() { DGUI.Doozy.DrawTitleWithIcon(Styles.GetStyle(Styles.StyleName.IconProgressor), UILabels.Progressors, Size.L, DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(3), ComponentColorName); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginVertical(); { float alpha = GUI.color.a; float backgroundHeight = DGUI.Properties.Space() + DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(); if (m_progressors.arraySize > 0) { for (int i = 0; i < m_progressors.arraySize; i++) { backgroundHeight += EditorGUI.GetPropertyHeight(m_progressors.GetArrayElementAtIndex(i)); backgroundHeight += DGUI.Properties.Space(); } } DGUI.Background.Draw(DGUI.Colors.GetBackgroundColorName(m_progressors.arraySize > 0, ComponentColorName), backgroundHeight); GUILayout.Space(-backgroundHeight + DGUI.Properties.Space()); if (m_progressors.arraySize == 0) { GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight)); { GUILayout.Space(DGUI.Properties.Space(2)); GUI.color = GUI.color.WithAlpha(DGUI.Properties.TextIconAlphaValue(false)); DGUI.Label.Draw("Empty...", Size.S, DGUI.Colors.DisabledTextColorName, DGUI.Properties.SingleLineHeight); GUI.color = GUI.color.WithAlpha(alpha); GUILayout.FlexibleSpace(); if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight)) { m_progressors.InsertArrayElementAtIndex(m_progressors.arraySize); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); return; } for (int i = 0; i < m_progressors.arraySize; i++) { SerializedProperty childProperty = m_progressors.GetArrayElementAtIndex(i); float propertyHeight = EditorGUI.GetPropertyHeight(childProperty); GUILayout.BeginHorizontal(GUILayout.Height(propertyHeight)); { GUILayout.Space(DGUI.Properties.Space(2)); GUI.color = GUI.color.WithAlpha(DGUI.Properties.TextIconAlphaValue(false)); DGUI.Label.Draw(i.ToString(), Size.S, DGUI.Colors.DisabledTextColorName, propertyHeight); GUI.color = GUI.color.WithAlpha(alpha); GUILayout.Space(DGUI.Properties.Space(2)); if (Target.Progressors[i] != null) { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(Mathf.Round(Target.Progressors[i].Progress * 100) + "%", Size.S, ComponentColorName, propertyHeight); } DGUI.Property.Draw(childProperty); if (DGUI.Button.IconButton.Minus(propertyHeight)) { m_progressors.DeleteArrayElementAtIndex(i); } } GUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space()); } GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight)); { GUILayout.FlexibleSpace(); if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight)) { m_progressors.InsertArrayElementAtIndex(m_progressors.arraySize); //Reset the newly created serialized property to its default value SerializedProperty p = m_progressors.GetArrayElementAtIndex(m_progressors.arraySize - 1); p.objectReferenceValue = default(Object); } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
static extern IntPtr sfRenderWindow_createUnicode(VideoMode Mode, IntPtr Title, Styles Style, ref ContextSettings Params);
//////////////////////////////////////////////////////////// /// <summary> /// Create the window with default creation settings /// </summary> /// <param name="mode">Video mode to use</param> /// <param name="title">Title of the window</param> /// <param name="style">Window style (Resize | Close by default)</param> //////////////////////////////////////////////////////////// public RenderWindow(VideoMode mode, string title, Styles style) : this(mode, title, style, new ContextSettings(0, 0)) { }
private void DrawViewSoundySoundDatabases(AnimBool searchEnabled) { bool foundNullReference = false; foreach (SoundDatabase soundDatabase in SoundyDatabase.SoundDatabases) { if (soundDatabase == null) { foundNullReference = true; break; } AnimBool soundDatabaseAnimBool = GetSoundDatabaseAnimBool(soundDatabase); AnimBool renameSoundDatabaseAnimBool = GetAnimBool(RENAME_SOUND_DATABASE); bool isGeneralSoundDatabase = soundDatabase.DatabaseName.Equals(SoundyManager.GENERAL); bool soundDatabaseContainsSearchedSound = false; bool renamingThisDatabase = !searchEnabled.target && m_soundDatabaseBeingRenamed == soundDatabase; bool databaseHasIssues = soundDatabase.HasSoundsWithMissingAudioClips; //database issues check ColorName viewColorName = CurrentViewColorName; ColorName mixerColorName = soundDatabase.OutputAudioMixerGroup != null ? viewColorName : DGUI.Colors.DisabledTextColorName; GUILayout.BeginHorizontal(); { DrawViewHorizontalPadding(); GUILayout.BeginVertical(); { GUILayout.BeginHorizontal(); { bool enabledState = GUI.enabled; GUI.enabled = !(renameSoundDatabaseAnimBool.target && renamingThisDatabase) && !searchEnabled.target; //do not allow the dev to use this button if THIS database is being renamed or a search is happening { GUILayout.BeginVertical(GUILayout.Height(BarHeight)); { if (DGUI.Bar.Draw(soundDatabase.DatabaseName, BAR_SIZE, DGUI.Bar.Caret.CaretType.Caret, viewColorName, soundDatabaseAnimBool)) //database BAR { if (Selection.activeObject != null && Selection.activeObject is SoundGroupData) { Selection.activeObject = null; } } GUILayout.Space(-BarHeight - DGUI.Properties.Space()); if (soundDatabase.OutputAudioMixerGroup == null) { DGUI.Colors.SetDisabledGUIColorAlpha(); } float barIconSize = BarHeight * 0.6f; SoundDatabase database = soundDatabase; DGUI.Line.Draw(false, () => { GUILayout.FlexibleSpace(); DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), barIconSize, BarHeight, mixerColorName); //mixer icon if (database.OutputAudioMixerGroup != null) { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(database.OutputAudioMixerGroup.name + " (" + database.OutputAudioMixerGroup.audioMixer.name + ")", Size.S, mixerColorName, BarHeight); //mixer label } if (databaseHasIssues) { GUILayout.Space(DGUI.Properties.Space(4)); DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconError), barIconSize, BarHeight, Color.red); } GUILayout.Space(DGUI.Properties.Space(2)); }); GUI.color = InitialGUIColor; } GUILayout.EndVertical(); } GUI.enabled = enabledState; if (!isGeneralSoundDatabase) { if (!searchEnabled.target && soundDatabaseAnimBool.faded > 0.05f && renameSoundDatabaseAnimBool.faded < 0.5f) { DGUI.AlphaGroup.Begin(soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded)); GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded)); if (DGUI.Button.Draw(DGUI.Properties.Labels.Rename, Size.S, TextAlign.Center, viewColorName, true, BarHeight, 80 * soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded)) || renamingThisDatabase && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp) //rename database button { if (!renamingThisDatabase && EditorUtility.DisplayDialog(UILabels.RenameSoundDatabase + " '" + soundDatabase.DatabaseName + "'", UILabels.RenameSoundDatabaseDialogMessage + "\n\n" + UILabels.YouAreResponsibleToUpdateYourCode, UILabels.Continue, UILabels.Cancel)) { StartRenameSoundDatabase(soundDatabase); Instance.Focus(); } else { ResetRenameSoundDatabase(); } } if (DGUI.Button.IconButton.Cancel(BarHeight)) //delete database button { SoundyDatabase.DeleteDatabase(soundDatabase); break; } DGUI.AlphaGroup.End(); } } } GUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space()); if (DGUI.FadeOut.Begin(searchEnabled.target ? 1 : soundDatabaseAnimBool.faded)) { GUILayout.BeginVertical(); //RENAME DATABASE if (renamingThisDatabase) { if (DGUI.FadeOut.Begin(renameSoundDatabaseAnimBool.faded, false)) { GUILayout.BeginVertical(); { GUILayout.Space(DGUI.Properties.Space() * renameSoundDatabaseAnimBool.faded); GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2))); { DrawDefaultViewHorizontalSpacing(); GUI.color = DGUI.Colors.BackgroundColor(RENAME_COLOR_NAME); DGUI.Label.Draw(UILabels.RenameTo, Size.S, DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2)); //rename to label GUI.SetNextControlName(RENAME); m_newSoundDatabaseName = EditorGUILayout.TextField(GUIContent.none, m_newSoundDatabaseName); //rename to field GUI.color = InitialGUIColor; if (DGUI.Button.IconButton.Ok() || Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp) //rename OK button { Instance.Focus(); if (SoundyDatabase.RenameSoundDatabase(soundDatabase, m_newSoundDatabaseName)) { GetSoundDatabaseAnimBool(m_newSoundDatabaseName).value = true; ResetRenameSoundDatabase(); break; } } if (DGUI.Button.IconButton.Cancel() || Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp) //rename CANCEL button { ResetRenameSoundDatabase(); } EditorGUI.FocusTextInControl(RENAME); DrawDefaultViewHorizontalSpacing(); } GUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space(4) * renameSoundDatabaseAnimBool.faded); } GUILayout.EndVertical(); GUI.color = InitialGUIColor; } DGUI.FadeOut.End(renameSoundDatabaseAnimBool, false); } GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded); if (!searchEnabled.target) { float barIconSize = DGUI.Properties.SingleLineHeight * 0.8f; float barIconRowHeight = DGUI.Properties.SingleLineHeight - 1; GUILayout.BeginHorizontal(); { SoundDatabase database = soundDatabase; DGUI.Line.Draw(true, mixerColorName, () => { if (database.OutputAudioMixerGroup == null) { DGUI.Colors.SetDisabledGUIColorAlpha(); } DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), barIconSize, barIconRowHeight, mixerColorName); //mixer icon GUILayout.Space(DGUI.Properties.Space()); DGUI.Label.Draw(UILabels.OutputMixerGroup, Size.S, mixerColorName, DGUI.Properties.SingleLineHeight); //mixer label GUI.color = InitialGUIColor; AudioMixerGroup outputAudioMixerGroup = database.OutputAudioMixerGroup; GUI.color = DGUI.Colors.GetDColor(mixerColorName).Light.WithAlpha(GUI.color.a); GUILayout.BeginVertical(GUILayout.Height(DGUI.Properties.SingleLineHeight)); { GUILayout.Space(0f); EditorGUI.BeginChangeCheck(); outputAudioMixerGroup = (AudioMixerGroup)EditorGUILayout.ObjectField(GUIContent.none, outputAudioMixerGroup, typeof(AudioMixerGroup), false); //mixer field if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(database, "Update AudioMixerGroup"); database.OutputAudioMixerGroup = outputAudioMixerGroup; database.SetDirty(true); } } GUILayout.EndVertical(); GUI.color = InitialGUIColor; }); GUILayout.Space(DGUI.Button.IconButton.Width + DGUI.Properties.Space(4)); } GUILayout.EndHorizontal(); } GUILayout.Space(DGUI.Properties.Space(2) * soundDatabaseAnimBool.faded); float lineHeight = DGUI.Properties.SingleLineHeight; float iconSize = lineHeight * 0.8f; GUILayout.Label(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(0)); Rect rect = GUILayoutUtility.GetLastRect(); float x; float y = rect.y; float totalWidth = rect.width; float buttonAndPlayerWidth = rect.width - DGUI.Properties.Space(6) - iconSize - DGUI.Button.IconButton.Width; float buttonWidth = buttonAndPlayerWidth * 0.4f; float playerWidth = buttonAndPlayerWidth - buttonWidth; foreach (SoundGroupData soundGroupData in soundDatabase.Database) { if (searchEnabled.target) { if (!Regex.IsMatch(soundGroupData.SoundName, m_soundySearchPattern, RegexOptions.IgnoreCase)) //regex search check { if (!m_soundySearchAudioClipNames) { continue; } if (soundGroupData.Sounds == null || soundGroupData.Sounds.Count == 0) { continue; } bool foundAudioClipMatch = false; foreach (AudioData audioData in soundGroupData.Sounds) { if (audioData == null || audioData.AudioClip == null) { continue; } if (!Regex.IsMatch(audioData.AudioClip.name, m_soundySearchPattern, RegexOptions.IgnoreCase)) { continue; } foundAudioClipMatch = true; break; } if (!foundAudioClipMatch) { continue; } } soundDatabaseContainsSearchedSound = true; } //draw check - if the item was scrolled out of view (up or down) -> do not draw it bool drawItem = y > m_viewScrollPosition.y + 16 || y < m_viewScrollPosition.y + FullViewRect.height - 16; if (!drawItem) { continue; } bool removedEntry = false; GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded); GUILayout.Label(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(lineHeight)); x = rect.x; y += DGUI.Properties.Space() * soundDatabaseAnimBool.faded; bool noSound = soundGroupData.SoundName.Equals(SoundyManager.NO_SOUND); //is no sound check bool isSelected = Selection.activeObject == soundGroupData; //selected check bool hasIssues = !noSound && soundGroupData.HasMissingAudioClips; //has issues check bool enabledState = GUI.enabled; GUI.enabled = !noSound; { SoundyAudioPlayer.Player player = SoundyAudioPlayer.GetPlayer(soundGroupData, soundDatabase.OutputAudioMixerGroup); //player reference ColorName buttonColorName = isSelected ? hasIssues ? ColorName.Red : CurrentViewColorName : DGUI.Colors.DisabledBackgroundColorName; ColorName buttonTextColorName = hasIssues ? ColorName.Red : CurrentViewColorName; // if (i % 2 == 0) if (player.IsPlaying) { var backgroundRect = new Rect(x - DGUI.Properties.Space(2), y - DGUI.Properties.Space(), totalWidth + DGUI.Properties.Space(4), lineHeight + DGUI.Properties.Space(2)); GUI.color = DGUI.Colors.BackgroundColor(buttonColorName).WithAlpha(0.6f); GUI.Label(backgroundRect, GUIContent.none, Styles.GetStyle(Styles.StyleName.BackgroundRound)); GUI.color = InitialGUIColor; } var iconRect = new Rect(x, y + (lineHeight - iconSize) / 2, iconSize, iconSize); if (!player.IsPlaying) { GUI.color = GUI.color.WithAlpha(DGUI.Utility.IsProSkin ? 0.4f : 0.6f); } DGUI.Icon.Draw(iconRect, Styles.GetStyle(noSound || hasIssues ? Styles.StyleName.IconMuteSound : Styles.StyleName.IconSound), DGUI.Colors.TextColor(hasIssues ? ColorName.Red : buttonTextColorName)); //speaker icon GUI.color = InitialGUIColor; x += iconSize; x += DGUI.Properties.Space(2); var buttonRect = new Rect(x, y - DGUI.Properties.Space(), buttonWidth, lineHeight + DGUI.Properties.Space(2)); if (DGUI.Button.Draw(buttonRect, soundGroupData.SoundName, Size.S, TextAlign.Left, buttonColorName, buttonTextColorName, isSelected)) //select button { Selection.activeObject = soundGroupData; } if (hasIssues) { var errorIconRect = new Rect(buttonRect.xMax - iconSize - DGUI.Properties.Space(2), buttonRect.y + (buttonRect.height - iconSize) / 2, iconSize, iconSize); DGUI.Icon.Draw(errorIconRect, Styles.GetStyle(Styles.StyleName.IconError), Color.red); //issues icon } x += buttonWidth; x += DGUI.Properties.Space(2); var playerRect = new Rect(x, y, playerWidth, lineHeight); player.DrawPlayer(playerRect, buttonTextColorName); x += playerWidth; x += DGUI.Properties.Space(2); var deleteButtonRect = new Rect(x, y, DGUI.Button.IconButton.Width, DGUI.Button.IconButton.Height); if (DGUI.Button.IconButton.Minus(deleteButtonRect)) { bool wasSelected = Selection.activeObject == soundGroupData; if (soundDatabase.Remove(soundGroupData, true)) { if (wasSelected) { Selection.activeObject = null; } soundDatabase.SetDirty(true); if (player.IsPlaying) { player.Stop(); } removedEntry = true; } } y += lineHeight; y += DGUI.Properties.Space(2) * soundDatabaseAnimBool.faded; } GUI.enabled = enabledState; GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded); if (removedEntry) { break; } } GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded); if (!searchEnabled.target) { GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); DrawSoundDatabaseDropZone(soundDatabase); GUILayout.Space(DGUI.Properties.Space()); if (DGUI.Button.IconButton.Plus()) { Selection.activeObject = soundDatabase.Add(SoundyManager.NEW_SOUND_GROUP, true, true); } } GUILayout.EndHorizontal(); } GUI.enabled = !(GetAnimBool(RENAME_SOUND_DATABASE).target&& renamingThisDatabase); GUILayout.EndVertical(); } DGUI.FadeOut.End(searchEnabled.target ? 1 : soundDatabaseAnimBool.faded); if (searchEnabled.target) { if (soundDatabaseContainsSearchedSound && !m_soundDatabasesWithSearchedSoundNames.Contains(soundDatabase)) { m_soundDatabasesWithSearchedSoundNames.Add(soundDatabase); soundDatabaseAnimBool.target = true; } else if (!soundDatabaseContainsSearchedSound && m_soundDatabasesWithSearchedSoundNames.Contains(soundDatabase)) { m_soundDatabasesWithSearchedSoundNames.Remove(soundDatabase); soundDatabaseAnimBool.target = false; } } } GUILayout.EndVertical(); DrawViewHorizontalPadding(); } GUILayout.EndHorizontal(); } if (foundNullReference) { SoundyDatabase.RefreshDatabase(false); } }
///<summary> Planner panel UI width </summary> internal static float Width() { return(Styles.ScaleWidthFloat(280.0f)); }
///<summary> Render planner UI panel </summary> internal static void Render() { // if there is something in the editor if (EditorLogic.RootPart != null) { // start header GUILayout.BeginHorizontal(Styles.title_container); // body selector GUILayout.Label(new GUIContent(FlightGlobals.Bodies[body_index].name, "Target body"), leftmenu_style); if (Lib.IsClicked()) { body_index = (body_index + 1) % FlightGlobals.Bodies.Count; if (body_index == 0) { ++body_index; } update = true; } else if (Lib.IsClicked(1)) { body_index = (body_index - 1) % FlightGlobals.Bodies.Count; if (body_index == 0) { body_index = FlightGlobals.Bodies.Count - 1; } update = true; } // sunlight selector GUILayout.Label(new GUIContent(sunlight ? Icons.sun_white : Icons.sun_black, "In sunlight/shadow"), icon_style); if (Lib.IsClicked()) { sunlight = !sunlight; update = true; } // situation selector GUILayout.Label(new GUIContent(situations[situation_index], "Target situation"), rightmenu_style); if (Lib.IsClicked()) { situation_index = (situation_index + 1) % situations.Length; update = true; } else if (Lib.IsClicked(1)) { situation_index = (situation_index == 0 ? situations.Length : situation_index) - 1; update = true; } // end header GUILayout.EndHorizontal(); // render panel panel.Render(); } // if there is nothing in the editor else { // render quote GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.Label("<i>In preparing for space, I have always found that\nplans are useless but planning is indispensable.\nWernher von Kerman</i>", quote_style); GUILayout.EndHorizontal(); GUILayout.Space(Styles.ScaleFloat(10.0f)); } }
private void AddStyle(OXmlStyleElement element) { Styles styles = CreateStyles(); Style style = new Style(); style.StyleId = element.Id; style.StyleName = new StyleName() { Val = element.Name }; style.Type = element.StyleType; if (element.Aliases != null) { style.Aliases = new Aliases { Val = element.Aliases } } ; style.CustomStyle = element.CustomStyle; style.Default = element.DefaultStyle; if (element.Locked != null) { style.Locked = new Locked { Val = GetOnOffValue((bool)element.Locked) } } ; if (element.SemiHidden != null) { style.SemiHidden = new SemiHidden { Val = GetOnOffValue((bool)element.SemiHidden) } } ; if (element.StyleHidden != null) { style.StyleHidden = new StyleHidden { Val = GetOnOffValue((bool)element.StyleHidden) } } ; if (element.UnhideWhenUsed != null) { style.UnhideWhenUsed = new UnhideWhenUsed { Val = GetOnOffValue((bool)element.UnhideWhenUsed) } } ; if (element.UIPriority != null) { style.UIPriority = new UIPriority { Val = element.UIPriority } } ; if (element.LinkedStyle != null) { style.LinkedStyle = new LinkedStyle { Val = element.LinkedStyle } } ; if (element.BasedOn != null) { style.BasedOn = new BasedOn { Val = element.BasedOn } } ; if (element.NextParagraphStyle != null) { style.NextParagraphStyle = new NextParagraphStyle { Val = element.NextParagraphStyle } } ; if (element.StyleParagraphProperties != null) { style.StyleParagraphProperties = element.StyleParagraphProperties.ToStyleParagraphProperties(); } if (element.StyleRunProperties != null) { style.StyleRunProperties = element.StyleRunProperties.ToStyleRunProperties(); } styles.Append(style); }
public Graphic(GameEngine.Data.System system, uint width, uint height, string title, double fps, Styles style = Styles.Default) : base(system) { Fps = fps; FpsMs = 1000.0 / Fps; Width = width; Height = height; Title = title; Style = style; Layers = new Dictionary <EnumLayer, Layer>(); }
// Create a new character style with the specified style id, style name and aliases and // add it to the specified style definitions part. /// <summary> /// Creates a character style and adds it to the document. /// </summary> /// <param name="styleid">The style Id of the new style. This usually should be the same as the style name, but without spaces.</param> /// <param name="stylename">The style name of the new character style.</param> /// <param name="aliases">The aliases.</param> /// <returns>The style Id of the newly created character style.</returns> public string CreateAndAddCharacterStyle( string styleid, string stylename, string aliases = "") { // Get access to the root element of the styles part. Styles styles = _mainDocumentPart.StyleDefinitionsPart.Styles; // Create a new character style and specify some of the attributes. var style = new Style() { Type = StyleValues.Character, StyleId = styleid, CustomStyle = true }; // Create and add the child elements (properties of the style). var aliases1 = new Aliases() { Val = aliases }; var styleName1 = new StyleName() { Val = stylename }; if (aliases != "") { style.Append(aliases1); } style.Append(styleName1); //LinkedStyle linkedStyle1 = new LinkedStyle() { Val = "OverdueAmountPara" }; //style.Append(linkedStyle1); // Create the StyleRunProperties object and specify some of the run properties. var styleRunProperties1 = new StyleRunProperties(); switch (styleid) { case "CodeInline": SetCodeInlineProperties(styleRunProperties1); break; } /* // Here are some more possibilities how to style * Bold bold1 = new Bold(); * Color color1 = new Color() { ThemeColor = ThemeColorValues.Accent2 }; * RunFonts font1 = new RunFonts() { Ascii = "Tahoma" }; * Italic italic1 = new Italic(); * // Specify a 24 point size. * FontSize fontSize1 = new FontSize() { Val = "48" }; * styleRunProperties1.Append(font1); * styleRunProperties1.Append(fontSize1); * styleRunProperties1.Append(color1); * styleRunProperties1.Append(bold1); * styleRunProperties1.Append(italic1); */ // Add the run properties to the style. style.Append(styleRunProperties1); // Add the style to the styles part. styles.Append(style); return(style.StyleId); }
public override void Execute() { #line 3 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" var ActionNameUrl = "Index"; if (HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString().ToUpper() == "FSEARCH") { ActionNameUrl = "FSearch"; } #line default #line hidden WriteLiteral("\r\n"); #line 10 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Scripts.Render("~/bundles/select2js")); #line default #line hidden WriteLiteral("\r\n"); #line 11 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Styles.Render("~/Content/select2css")); #line default #line hidden WriteLiteral(@" <script> $("".js-example-basic-multiple"").select2({ placeholder: ""Select/Search"", allowClear: true }); function SetSingle(source, id, DisplayValue) { var dropdown = ($('#PopupBulkOperationLabel').attr('class')); if ($('#' + dropdown + ' option[value=""' + id + '""]').length == 0) { $('#' + dropdown).append($('<option selected=\'selected\'></option>').val(id).html(DisplayValue)); $(""#"" + dropdown).trigger('chosen:updated'); } $(""#"" + dropdown).val(id); $(""#"" + dropdown).trigger('chosen:updated'); $(""#"" + dropdown).change(); $(""#closePopupBulkOperation"").click(); } function Update(source, id, DisplayValue) { val1 = $(""#idvalues"").val(); if (source.checked) { $(""#idvalues"").val(val1 + "","" + id); } else { $(""#idvalues"").val(val1.replace("","" + id, """")); } } function UpdateRecords() { var selectedvalues = $(""#idvalues"").val().substr(1).split("",""); var url1 = '"); #line 36 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Url.Action("BulkAssociate")); #line default #line hidden WriteLiteral("\';\r\n\t\t var entity = \'T_AllFacilities\';\r\n var host = \'"); #line 38 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(ViewData["AssociatedType"]); #line default #line hidden WriteLiteral("\';\r\n $.ajax({\r\n type: \"POST\",\r\n data: { ids: selecte" + "dvalues, AssociatedType: \'"); #line 41 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(ViewData["AssociatedType"]); #line default #line hidden WriteLiteral("\', HostingEntity: \'"); #line 41 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(ViewData["HostingEntity"]); #line default #line hidden WriteLiteral("\', HostingEntityID: \'"); #line 41 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(ViewData["HostingEntityID"]); #line default #line hidden WriteLiteral(@"' }, url: url1, complete : function (msg) { $(""#closePopupBulkOperation"").click(); }, success: function (msg) { if (host != undefined && host.length > 0 && $('#' + host).length > 0) { $('#' + entity + 'SearchCancel', $('#' + host)).click(); $('#dvcnt_' + host).load(location.href + "" #dvcnt_"" + host); } } }); } </script> "); #line 55 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (ViewData["BulkAssociate"] != null) { #line default #line hidden #line 57 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.Hidden("idvalues")); #line default #line hidden #line 57 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral("<div"); WriteLiteral(" id=\"T_AllFacilities\""); WriteLiteral(" class=\"T_AllFacilities\""); WriteLiteral(">\r\n"); #line 60 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 60 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (ViewBag.ColumnMapping == null && ViewBag.ImportError == null && ViewBag.ConfirmImportData == null) { #line default #line hidden WriteLiteral(@" <style> .table-responsive > .fixed-column { position: absolute; display: block; width: auto; border: 0px solid transparent; border-top: 1px solid #c3ddec; } .fixed-column th { background: #fff; } .fixed-column td { background: #fff; } </style> "); #line 77 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden WriteLiteral("\t\t <script"); WriteLiteral(" type=\"text/javascript\""); WriteLiteral(@"> $(document).ready(function () { $("".pagination a"").click(function (e) { PaginationClick(e, 'T_AllFacilities'); }) $(""#dvPopupBulkOperation input[name=SearchStringT_AllFacilities]"").keypress(function (e) { if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { $('#dvPopupBulkOperation').find(""a.bulk"").bind(""click"", (function () { })); $('#dvPopupBulkOperation').find(""a.bulk"").trigger(""click""); return false; } }) }); </script> "); #line 96 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 142 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden WriteLiteral(" <div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"col-md-12 col-sm-12 col-sx-12\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"panel panel-default\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"panel-heading clearfix\""); WriteLiteral(" style=\"margin:0px; padding:8px;\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"pull-right\""); WriteLiteral(" style=\"width:200px;\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"input-group\""); WriteLiteral(">\r\n"); WriteLiteral(" "); #line 149 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.TextBox("SearchStringT_AllFacilities", ViewBag.CurrentFilter as string, null, new { @class = "form-control fixsearchbox", @placeholder = "Search" })); #line default #line hidden WriteLiteral("\r\n <div"); WriteLiteral(" class=\"input-group-btn\""); WriteLiteral(">\r\n <a"); WriteLiteral(" id=\"T_AllFacilitiesSearch\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 6744), Tuple.Create("\"", 7275) , Tuple.Create(Tuple.Create("", 6754), Tuple.Create("SearchClick(event,", 6754), true) , Tuple.Create(Tuple.Create(" ", 6772), Tuple.Create("\'T_AllFacilities\',", 6773), true) , Tuple.Create(Tuple.Create(" ", 6791), Tuple.Create("\'", 6792), true) #line 151 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 6793), Tuple.Create <System.Object, System.Int32>(Html.Raw(Url.Action("Index", "T_AllFacilities", new { BulkAssociate = ViewData["BulkAssociate"], caller = ViewData["caller"], IsFilter = ViewData["IsFilter"], IsDeepSearch = false, searchString = "_SearchString", HostingEntity = Convert.ToString(ViewData["HostingEntity"]), BulkOperation = ViewData["BulkOperation"], HostingEntityID = Convert.ToString(ViewData["HostingEntityID"]), AssociatedType = Convert.ToString(ViewData["AssociatedType"]), SearchTimeStamp = DateTime.Now })) #line default #line hidden , 6793), false) , Tuple.Create(Tuple.Create("", 7272), Tuple.Create("\');", 7272), true) ); WriteLiteral(" data-original-title=\"Grid Search\""); WriteLiteral(" class=\"btn btn-default btn-default tip-top bulk\""); WriteLiteral(" style=\"padding:3px 5px;\""); WriteLiteral("><span"); WriteLiteral(" class=\"fam-zoom\""); WriteLiteral("></span></a>\r\n <button"); WriteLiteral(" id=\"T_AllFacilitiesCancel\""); WriteLiteral(" type=\"button\""); WriteLiteral(" class=\"btn btn-default btn-default collapse-data-btn tip-top\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 7567), Tuple.Create("\"", 8000) , Tuple.Create(Tuple.Create("", 7577), Tuple.Create("CancelSearchBulk(\'T_AllFacilities\',\'", 7577), true) #line 152 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 7613), Tuple.Create <System.Object, System.Int32>(Html.Raw(Url.Action("Index", "T_AllFacilities", new { caller = ViewData["caller"], BulkOperation = ViewData["BulkOperation"], IsFilter = ViewData["IsFilter"], HostingEntity = Convert.ToString(ViewData["HostingEntity"]), HostingEntityID = Convert.ToString(ViewData["HostingEntityID"]), AssociatedType = Convert.ToString(ViewData["AssociatedType"]), ClearSearchTimeStamp = DateTime.Now })) #line default #line hidden , 7613), false) , Tuple.Create(Tuple.Create("", 7998), Tuple.Create("\')", 7998), true) ); WriteLiteral(" data-original-title=\"Clear Search\""); WriteLiteral(" data-placement=\"top\""); WriteLiteral(" style=\"padding:3px 5px;\""); WriteLiteral(">\r\n <span"); WriteLiteral(" class=\"fam-delete\""); WriteLiteral("></span>\r\n </button>\r\n " + " <button"); WriteLiteral(" id=\"T_AllFacilitiesSearchCancel\""); WriteLiteral(" type=\"button\""); WriteLiteral(" class=\"btn btn-default btn-default collapse-data-btn tip-top\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 8358), Tuple.Create("\"", 8835) , Tuple.Create(Tuple.Create("", 8368), Tuple.Create("CancelSearchBulk(\'T_AllFacilities\',\'", 8368), true) #line 155 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 8404), Tuple.Create <System.Object, System.Int32>(Html.Raw(Url.Action("Index", "T_AllFacilities", new { BulkAssociate = ViewData["BulkAssociate"], caller = ViewData["caller"], IsFilter = ViewData["IsFilter"], HostingEntity = Convert.ToString(ViewData["HostingEntity"]), BulkOperation = ViewData["BulkOperation"], HostingEntityID = Convert.ToString(ViewData["HostingEntityID"]), AssociatedType = Convert.ToString(ViewData["AssociatedType"]), ClearSearchTimeStamp = DateTime.Now })) #line default #line hidden , 8404), false) , Tuple.Create(Tuple.Create("", 8833), Tuple.Create("\')", 8833), true) ); WriteLiteral(" data-original-title=\"Refresh Grid\""); WriteLiteral(" data-placement=\"top\""); WriteLiteral(" style=\"padding:3px 5px;\""); WriteLiteral(">\r\n <span"); WriteLiteral(" class=\"fam-arrow-refresh\""); WriteLiteral("></span>\r\n </button>\r\n " + " </div>\r\n </div>\r\n </di" + "v>\r\n </div>\r\n <div"); WriteLiteral(" class=\"panel-body\""); WriteLiteral(" style=\"margin:0px; padding:8px;\""); WriteLiteral(">\r\n <div"); WriteLiteral(" id=\"Des_Table\""); WriteLiteral(" class=\"table-responsive\""); WriteLiteral(" style=\"overflow-x:auto;\""); WriteLiteral(">\r\n <table"); WriteLiteral(" class=\"table table-striped table-bordered table-hover table-condensed\""); WriteLiteral(">\r\n <thead>\r\n <" + "tr>\r\n <th"); WriteLiteral(" class=\"col2\""); WriteLiteral(">\r\n Select\r\n " + " </th>\r\n"); #line 170 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 170 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (User.CanView("T_AllFacilities")) { #line default #line hidden WriteLiteral(" <th"); WriteLiteral(" class=\"col2\""); WriteLiteral(">\r\n"); WriteLiteral(" "); #line 173 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.ActionLink("Display Value", ActionNameUrl, "T_AllFacilities", getSortHtmlAttributes("DisplayValue", false, null, false), new { @onclick = "SortLinkClick(event,'T_AllFacilities');" })); #line default #line hidden WriteLiteral("\r\n"); #line 174 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 174 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (ViewBag.IsAsc == "DESC" && ViewBag.CurrentSort == "DisplayValue") { #line default #line hidden WriteLiteral("<i"); WriteLiteral(" class=\"fa fa-sort-desc\""); WriteLiteral("></i>"); #line 175 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" "); #line 176 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (ViewBag.IsAsc == "ASC" && ViewBag.CurrentSort == "DisplayValue") { #line default #line hidden WriteLiteral("<i"); WriteLiteral(" class=\"fa fa-sort-asc\""); WriteLiteral("></i>"); #line 177 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </th>\r\n"); #line 179 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </tr>\r\n"); #line 181 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 181 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" foreach (var item in Model) { #line default #line hidden WriteLiteral(" <tr>\r\n"); #line 184 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 184 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (Convert.ToString(ViewData["BulkOperation"]) == "multiple") { if (ViewData["BulkAssociate"] != null) { #line default #line hidden WriteLiteral(" <td>\r\n " + " <input"); WriteLiteral(" type=\"checkbox\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 11217), Tuple.Create("\"", 11272) , Tuple.Create(Tuple.Create("", 11227), Tuple.Create("Update(this,\'", 11227), true) #line 189 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 11240), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 11240), false) , Tuple.Create(Tuple.Create("", 11248), Tuple.Create("\',\'", 11248), true) #line 189 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 11251), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 11251), false) , Tuple.Create(Tuple.Create("", 11269), Tuple.Create("\');", 11269), true) ); WriteLiteral(" />\r\n </td>\r\n"); #line 191 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } else { #line default #line hidden WriteLiteral(" <td>\r\n " + " <input"); WriteLiteral(" type=\"checkbox\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 11629), Tuple.Create("\"", 11681) , Tuple.Create(Tuple.Create("", 11639), Tuple.Create("Set(this,\'", 11639), true) #line 195 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 11649), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 11649), false) , Tuple.Create(Tuple.Create("", 11657), Tuple.Create("\',\'", 11657), true) #line 195 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 11660), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 11660), false) , Tuple.Create(Tuple.Create("", 11678), Tuple.Create("\');", 11678), true) ); WriteLiteral(" />\r\n </td>\r\n"); #line 197 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } } else { #line default #line hidden WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input"); WriteLiteral(" type=\"button\""); WriteLiteral(" value=\"Select\""); WriteLiteral(" class=\"btn btn-primary btn-xs\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 12038), Tuple.Create("\"", 12096) , Tuple.Create(Tuple.Create("", 12048), Tuple.Create("SetSingle(this,\'", 12048), true) #line 202 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 12064), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 12064), false) , Tuple.Create(Tuple.Create("", 12072), Tuple.Create("\',\'", 12072), true) #line 202 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 12075), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 12075), false) , Tuple.Create(Tuple.Create("", 12093), Tuple.Create("\');", 12093), true) ); WriteLiteral(" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</td> \r\n"); #line 204 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" "); #line 205 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (User.CanView("T_AllFacilities")) { #line default #line hidden WriteLiteral(" <td>\r\n"); WriteLiteral(" "); #line 208 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.DisplayFor(modelItem => item.DisplayValue)); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); #line 210 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </tr>\r\n"); #line 212 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </table>\r\n </div>\r\n " + " <ul"); WriteLiteral(" id=\"Mob_List\""); WriteLiteral(" class=\"list-group\""); WriteLiteral(">\r\n"); #line 216 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 216 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" foreach (var item in Model) { #line default #line hidden WriteLiteral(" <li"); WriteLiteral(" class=\"list-group-item\""); WriteLiteral(">\r\n"); #line 219 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 219 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (User.CanView("T_AllFacilities")) { #line default #line hidden WriteLiteral("\t\t\t\t\t\t\t\t\t\t<p>\r\n <span"); WriteLiteral(" class=\"text-primary\""); WriteLiteral("> Select </span> : <span>\r\n"); #line 223 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 223 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (Convert.ToString(ViewData["BulkOperation"]) == "multiple") { if (ViewData["BulkAssociate"] != null) { #line default #line hidden WriteLiteral(" <input"); WriteLiteral(" type=\"checkbox\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 13489), Tuple.Create("\"", 13544) , Tuple.Create(Tuple.Create("", 13499), Tuple.Create("Update(this,\'", 13499), true) #line 227 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 13512), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 13512), false) , Tuple.Create(Tuple.Create("", 13520), Tuple.Create("\',\'", 13520), true) #line 227 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 13523), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 13523), false) , Tuple.Create(Tuple.Create("", 13541), Tuple.Create("\');", 13541), true) ); WriteLiteral(" />\r\n"); #line 228 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } else { #line default #line hidden WriteLiteral(" <input"); WriteLiteral(" type=\"checkbox\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 13784), Tuple.Create("\"", 13836) , Tuple.Create(Tuple.Create("", 13794), Tuple.Create("Set(this,\'", 13794), true) #line 231 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 13804), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 13804), false) , Tuple.Create(Tuple.Create("", 13812), Tuple.Create("\',\'", 13812), true) #line 231 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 13815), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 13815), false) , Tuple.Create(Tuple.Create("", 13833), Tuple.Create("\');", 13833), true) ); WriteLiteral(" />\r\n"); #line 232 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } } else { #line default #line hidden WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<input"); WriteLiteral(" type=\"button\""); WriteLiteral(" value=\"Select\""); WriteLiteral(" class=\"btn btn-primary btn-xs\""); WriteAttribute("onclick", Tuple.Create(" onclick=\"", 14115), Tuple.Create("\"", 14173) , Tuple.Create(Tuple.Create("", 14125), Tuple.Create("SetSingle(this,\'", 14125), true) #line 236 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 14141), Tuple.Create <System.Object, System.Int32>(item.Id #line default #line hidden , 14141), false) , Tuple.Create(Tuple.Create("", 14149), Tuple.Create("\',\'", 14149), true) #line 236 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create("", 14152), Tuple.Create <System.Object, System.Int32>(item.DisplayValue #line default #line hidden , 14152), false) , Tuple.Create(Tuple.Create("", 14170), Tuple.Create("\');", 14170), true) ); WriteLiteral(" />\r\n"); #line 237 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </span>\r\n " + " </p>\r\n"); WriteLiteral(" <p>\r\n " + " <span"); WriteLiteral(" class=\"text-primary\""); WriteLiteral("> Display Value </span> : <span>\r\n"); WriteLiteral(" "); #line 242 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.DisplayFor(modelItem => item.DisplayValue)); #line default #line hidden WriteLiteral("\r\n </span>\r\n " + " </p>\r\n"); #line 245 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </li>\r\n"); #line 247 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </ul>\r\n"); #line 249 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" #line default #line hidden #line 249 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (Model.Count > 0) { #line default #line hidden WriteLiteral(" <div"); WriteLiteral(" id=\"pagination\""); WriteLiteral(">\r\n"); WriteLiteral(" "); #line 252 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.PagedListPager(Model, page => Url.Action(ActionNameUrl, "T_AllFacilities", getSortHtmlAttributes(null, true, page, false)))); #line default #line hidden WriteLiteral("\r\n <div"); WriteLiteral(" class=\"fixPageSize\""); WriteLiteral(">\r\n Page Size :\r\n"); WriteLiteral(" "); #line 255 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Html.DropDownList("PageSize", new SelectList(new Dictionary <string, int> { { "10", 10 }, { "20", 20 }, { "50", 50 }, { "100", 100 } }, "Key", "Value"), new { @id = "pagesizelistT_AllFacilities", @onchange = "pagesizelistChange(event,'T_AllFacilities')", @Url = Html.Raw(@Url.Action(ActionNameUrl, "T_AllFacilities", getSortHtmlAttributes(ViewBag.CurrentSort, ViewBag.Pages == 1 ? false : true, null, false), null)) })); #line default #line hidden WriteLiteral("\r\n <span"); WriteLiteral(" style=\"text-align:right;\""); WriteLiteral("> Total Count: "); #line 260 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" Write(Model.TotalItemCount); #line default #line hidden WriteLiteral("</span>\r\n </div>\r\n </di" + "v>\r\n"); #line 263 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n </div>\r\n </div>\r\n <" + "/div>\r\n"); #line 268 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" if (ViewData["BulkAssociate"] != null) { #line default #line hidden WriteLiteral(" <input"); WriteLiteral(" type=\"button\""); WriteLiteral(" class=\"btn btn-primary btn-sm fixbulkbutton\""); WriteAttribute("value", Tuple.Create(" value=\"", 16141), Tuple.Create("\"", 16266) , Tuple.Create(Tuple.Create("", 16149), Tuple.Create("Associate", 16149), true) , Tuple.Create(Tuple.Create(" ", 16158), Tuple.Create("with", 16159), true) #line 270 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" , Tuple.Create(Tuple.Create(" ", 16163), Tuple.Create <System.Object, System.Int32>(GeneratorBase.MVC.Models.ModelConversion.GetDisplayNameOfEntity(ViewData["HostingEntity"].ToString()) #line default #line hidden , 16164), false) ); WriteLiteral(" onclick=\"UpdateRecords();\""); WriteLiteral(" />\r\n"); #line 271 "..\..\Views\T_AllFacilities\BulkOperation.cshtml" } } #line default #line hidden WriteLiteral("</div>\r\n \r\n"); }
private void AddMissingStyles(HashSet <string> existingStyles, IEnumerable <string> stylesToAdd) { AddMissingTableItems <DxfStyle>(existingStyles, stylesToAdd, s => Styles.Add(s)); }
static void UpdateStyles() { styles = new Styles(); styles.emptyItem = new GUIStyle(EditorStyles.foldout); styles.emptyItem.active.background = null; styles.emptyItem.hover.background = null; styles.emptyItem.normal.background = null; styles.emptyItem.focused.background = null; styles.emptyItem.onActive.background = null; styles.emptyItem.onHover.background = null; styles.emptyItem.onNormal.background = null; styles.emptyItem.onFocused.background = null; styles.emptySelected = new GUIStyle(styles.emptyItem); styles.emptySelected.normal = styles.emptySelected.active; styles.emptySelected.onNormal = styles.emptySelected.onActive; styles.emptyLabelItem = new GUIStyle(EditorStyles.label); styles.emptyLabelSelected = new GUIStyle(styles.emptyLabelItem); styles.emptyLabelSelected.normal = styles.emptyLabelSelected.active; styles.emptyLabelSelected.onNormal = styles.emptyLabelSelected.onActive; styles.foldOut = new GUIStyle(EditorStyles.foldout); styles.foldOut.focused = styles.foldOut.normal; styles.foldOut.active = styles.foldOut.normal; styles.foldOut.onNormal = styles.foldOut.normal; styles.foldOut.onActive = styles.foldOut.normal; styles.foldOutSelected = new GUIStyle(EditorStyles.foldout); styles.foldOutSelected.normal = styles.foldOutSelected.active; styles.foldOutSelected.onNormal = styles.foldOutSelected.onActive; styles.foldOutLabel = new GUIStyle(EditorStyles.label); styles.foldOutLabel.active = styles.foldOutLabel.normal; styles.foldOutLabel.onActive = styles.foldOutLabel.onNormal; styles.foldOutLabelSelected = new GUIStyle(EditorStyles.label); styles.foldOutLabelSelected.normal = styles.foldOutLabelSelected.active; styles.foldOutLabelSelected.onNormal = styles.foldOutLabelSelected.onActive; styles.backGroundColor = styles.foldOutLabelSelected.onNormal.textColor; styles.backGroundColor.a = 0.5f; GUIStyleState selected = styles.foldOutLabelSelected.normal; selected.textColor = Color.white; styles.foldOutSelected.normal = selected; styles.foldOutSelected.onNormal = selected; styles.foldOutSelected.active = selected; styles.foldOutSelected.onActive = selected; styles.foldOutSelected.focused = selected; styles.foldOutSelected.onFocused = selected; styles.foldOutLabelSelected.normal = selected; styles.foldOutLabelSelected.onNormal = selected; styles.foldOutLabelSelected.active = selected; styles.foldOutLabelSelected.onActive = selected; styles.foldOutLabelSelected.focused = selected; styles.foldOutLabelSelected.onFocused = selected; styles.emptyLabelSelected.normal = selected; styles.emptyLabelSelected.onNormal = selected; styles.emptyLabelSelected.active = selected; styles.emptyLabelSelected.onActive = selected; styles.emptyLabelSelected.focused = selected; styles.emptyLabelSelected.onFocused = selected; styles.emptyItem.active = styles.emptyItem.normal; styles.emptyItem.onActive = styles.emptyItem.onNormal; }
//-------------------------------------------------------------------------------------------------- public Marker(WorkspaceController workspaceController, Styles styles, Image image) : base(workspaceController, null) { _Styles = styles; _Image = image; }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (Event.current.type != EventType.Repaint) { return; } if (m_Styles == null) { m_Styles = new Styles(); } GameObject go = target as GameObject; RectTransform rect = go.transform as RectTransform; if (rect == null) { return; } // Apply padding RectOffset previewPadding = new RectOffset(-5, -5, -5, -5); r = previewPadding.Add(r); // Prepare rects for columns r.height = EditorGUIUtility.singleLineHeight; Rect labelRect = r; Rect valueRect = r; Rect sourceRect = r; labelRect.width = kLabelWidth; valueRect.xMin += kLabelWidth; valueRect.width = kValueWidth; sourceRect.xMin += kLabelWidth + kValueWidth; // Headers GUI.Label(labelRect, "Property", m_Styles.headerStyle); GUI.Label(valueRect, "Value", m_Styles.headerStyle); GUI.Label(sourceRect, "Source", m_Styles.headerStyle); labelRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; valueRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; sourceRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; // Prepare reusable variable for out argument ILayoutElement source = null; // Show properties ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Width", LayoutUtility.GetLayoutProperty(rect, e => e.minWidth, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Height", LayoutUtility.GetLayoutProperty(rect, e => e.minHeight, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Width", LayoutUtility.GetLayoutProperty(rect, e => e.preferredWidth, 0, out source).ToString(), source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Height", LayoutUtility.GetLayoutProperty(rect, e => e.preferredHeight, 0, out source).ToString(), source); float flexible = 0; flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleWidth, 0, out source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Width", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source); flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleHeight, 0, out source); ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Height", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source); if (!rect.GetComponent <LayoutElement>()) { Rect noteRect = new Rect(labelRect.x, labelRect.y + 10, r.width, EditorGUIUtility.singleLineHeight); GUI.Label(noteRect, "Add a LayoutElement to override values.", m_Styles.labelStyle); } }
public bool CheckStyle(Styles style) { return((this.style & (byte)style) != 0); }
static RFX1_EditorGUIHelper() { s_Styles = new Styles(); }
public void SetStyle(Styles style) { this.style |= (byte)style; }
/// <summary> /// Draws inspector for a Slide Deck. /// </summary> /// <param name="deck">Slide Deck to draw.</param> /// <param name="scroll">Current vertical scroll value.</param> /// <param name="shouldSelect">A function which returns if the current slide should be selected.</param> /// <param name="onPlayPress">A function called when "Play" button of a slide is pressed.</param> /// <returns>Current vertical scroll value.</returns> public static float DrawInspector(SlideDeck deck, float scroll, Func <SlideDeck, int, bool> shouldSelect = null, Action <SlideDeck, int> onPlayPress = null) { if (styles == null) { styles = new Styles(); } ReorderableList list; var key = deck.GetInstanceID() + "#" + (shouldSelect != null) + "#" + (onPlayPress != null); if (!lists.TryGetValue(key, out list)) { // Init a ReorderableList for the deck and cache it. list = new ReorderableList(deck.Slides, typeof(PresentationSlide), true, true, true, true); lists.Add(key, list); list.onChangedCallback += (l) => { // deck.Save(); }; list.drawHeaderCallback += (Rect rect) => GUI.Label(rect, deck.IsSavedOnDisk ? deck.Name + ".asset" : "<not saved>"); list.elementHeightCallback += (int index) => styles.ELEMENT_HEIGHT; list.drawElementBackgroundCallback += (Rect rect, int index, bool isActive, bool isFocused) => { if (Event.current.type == EventType.Repaint) { if (index < 0) { return; } var bgcolor = GUI.backgroundColor; var slide = deck.Slides[index]; if (shouldSelect != null && shouldSelect(deck, index)) { GUI.backgroundColor = styles.SELECTED_COLOR; rect.height += 3; styles.BG_SELECTED.Draw(rect, false, isActive, isActive, isFocused); } else if (slide.Visible || isFocused) { styles.BG.Draw(rect, false, isActive, isActive, isFocused); } else { GUI.backgroundColor = styles.INVISIBLE_COLOR; rect.height += 3; styles.BG_INVISIBLE.Draw(rect, false, isActive, isActive, isFocused); } GUI.backgroundColor = bgcolor; } }; list.drawElementCallback += (Rect rect, int index, bool isActive, bool isFocused) => { var changed = false; var color = GUI.color; var slide = deck.Slides[index]; // visible EditorGUI.BeginChangeCheck(); if (!slide.Visible) { GUI.color = styles.INACTIVE_COLOR; } var newVisible = GUI.Toggle( new Rect(rect.x, rect.y, styles.ICON.fixedWidth, rect.height), slide.Visible, styles.VISIBLE_ICON, styles.ICON); if (EditorGUI.EndChangeCheck()) { slide.Visible = newVisible; changed = true; } GUI.color = color; rect.x += styles.ICON.fixedWidth; // play mode EditorGUI.BeginChangeCheck(); if (!slide.StartInPlayMode) { GUI.color = styles.INACTIVE_COLOR; } var newPlaymode = GUI.Toggle( new Rect(rect.x, rect.y, styles.ICON.fixedWidth, rect.height), slide.StartInPlayMode, styles.PLAYMODE_ICON, styles.ICON); if (EditorGUI.EndChangeCheck()) { slide.StartInPlayMode = newPlaymode; changed = true; } GUI.color = color; rect.x += styles.ICON.fixedWidth; // scene var w = rect.width - styles.ICON.fixedWidth * 2; if (onPlayPress != null) { w -= styles.PLAY_BUTTON.fixedWidth + 6; } var scene = AssetDatabase.LoadAssetAtPath <SceneAsset>(slide.ScenePath); EditorGUI.BeginChangeCheck(); var newScene = EditorGUI.ObjectField(new Rect(rect.x, rect.y + 2, w, rect.height - 4), scene, typeof(SceneAsset), false) as SceneAsset; if (EditorGUI.EndChangeCheck()) { slide.Scene = newScene; changed = true; } rect.x += w + 6; if (onPlayPress != null) { rect.y += 2; if (GUI.Button(rect, styles.PLAY_ICON, styles.PLAY_BUTTON)) { onPlayPress(deck, index); } } if (changed) { deck.Save(); } }; } scroll = EditorGUILayout.BeginScrollView(new Vector2(0, scroll), false, false, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)).y; var r = GUILayoutUtility.GetRect(0, list.GetHeight() + 20); list.DoList(r); var propsName = "presentation_" + deck.name + "_options"; var showOptions = EditorPrefs.GetBool(propsName, false); showOptions = GUIElements.Header(styles.TEXT_OPTIONS, showOptions); if (showOptions) { EditorGUI.indentLevel++; deck.BackgroundColor = EditorGUILayout.ColorField(styles.TEXT_BG_COLOR, deck.BackgroundColor, true, false, false, new ColorPickerHDRConfig(0, 1, 0, 1), GUILayout.ExpandWidth(true)); EditorGUI.indentLevel--; } EditorPrefs.SetBool(propsName, showOptions); EditorGUILayout.EndScrollView(); return(scroll); }
public static int CycleButton(int selected, GUIContent[] options) { Styles.Init(); return(EditorGUILayout.CycleButton(selected, options, Styles.preButton)); }
/// <summary>Draw a header toggle like in Volumes</summary> /// <param name="title"> The title of the header </param> /// <param name="group"> The group of the header </param> /// <param name="activeField">The active field</param> /// <param name="contextAction">The context action</param> /// <param name="hasMoreOptions">Delegate saying if we have MoreOptions</param> /// <param name="toggleMoreOptions">Callback called when the MoreOptions is toggled</param> /// <param name="documentationURL">Documentation URL</param> /// <returns>return the state of the foldout header</returns> public static bool DrawHeaderToggle(GUIContent title, SerializedProperty group, SerializedProperty activeField, Action <Vector2> contextAction, Func <bool> hasMoreOptions, Action toggleMoreOptions, string documentationURL) { var backgroundRect = GUILayoutUtility.GetRect(1f, 17f); var labelRect = backgroundRect; labelRect.xMin += 32f; labelRect.xMax -= 20f + 16 + 5; var foldoutRect = backgroundRect; foldoutRect.y += 1f; foldoutRect.width = 13f; foldoutRect.height = 13f; var toggleRect = backgroundRect; toggleRect.x += 16f; toggleRect.y += 2f; toggleRect.width = 13f; toggleRect.height = 13f; // More options 1/2 var moreOptionsRect = new Rect(); if (hasMoreOptions != null) { moreOptionsRect = backgroundRect; moreOptionsRect.x += moreOptionsRect.width - 16 - 1 - 16 - 5; if (!string.IsNullOrEmpty(documentationURL)) { moreOptionsRect.x -= 16 + 7; } moreOptionsRect.height = 15; moreOptionsRect.width = 16; } // Background rect should be full-width backgroundRect.xMin = 0f; backgroundRect.width += 4f; // Background float backgroundTint = EditorGUIUtility.isProSkin ? 0.1f : 1f; EditorGUI.DrawRect(backgroundRect, new Color(backgroundTint, backgroundTint, backgroundTint, 0.2f)); // Title using (new EditorGUI.DisabledScope(!activeField.boolValue)) EditorGUI.LabelField(labelRect, title, EditorStyles.boldLabel); // Foldout group.serializedObject.Update(); group.isExpanded = GUI.Toggle(foldoutRect, group.isExpanded, GUIContent.none, EditorStyles.foldout); group.serializedObject.ApplyModifiedProperties(); // Active checkbox activeField.serializedObject.Update(); activeField.boolValue = GUI.Toggle(toggleRect, activeField.boolValue, GUIContent.none, CoreEditorStyles.smallTickbox); activeField.serializedObject.ApplyModifiedProperties(); // More options 2/2 if (hasMoreOptions != null) { bool moreOptions = hasMoreOptions(); bool newMoreOptions = Styles.DrawMoreOptions(moreOptionsRect, moreOptions); if (moreOptions ^ newMoreOptions) { toggleMoreOptions?.Invoke(); } } // Context menu var menuIcon = CoreEditorStyles.paneOptionsIcon; var menuRect = new Rect(labelRect.xMax + 3f + 16 + 5, labelRect.y + 1f, menuIcon.width, menuIcon.height); if (contextAction != null) { GUI.DrawTexture(menuRect, menuIcon); } // Documentation button if (!String.IsNullOrEmpty(documentationURL)) { var documentationRect = menuRect; documentationRect.x -= 16 + 5; documentationRect.y -= 1; var documentationTooltip = $"Open Reference for {title.text}."; var documentationIcon = new GUIContent(EditorGUIUtility.TrIconContent("_Help").image, documentationTooltip); var documentationStyle = new GUIStyle("IconButton"); if (GUI.Button(documentationRect, documentationIcon, documentationStyle)) { System.Diagnostics.Process.Start(documentationURL); } } // Handle events var e = Event.current; if (e.type == EventType.MouseDown) { if (contextAction != null && menuRect.Contains(e.mousePosition)) { contextAction(new Vector2(menuRect.x, menuRect.yMax)); e.Use(); } else if (labelRect.Contains(e.mousePosition)) { if (e.button == 0) { group.isExpanded = !group.isExpanded; } else if (contextAction != null) { contextAction(e.mousePosition); } e.Use(); } } return(group.isExpanded); }
public static IHtmlString RenderStylesIe(string ie, params string[] paths) { var tag = string.Format("<!--[if {0}]>{1}<![endif]-->", ie, Styles.Render(paths)); return(new MvcHtmlString(tag)); }
/// <summary> Draw a foldout header </summary> /// <param name="title"> The title of the header </param> /// <param name="state"> The state of the header </param> /// <param name="isBoxed"> [optional] is the eader contained in a box style ? </param> /// <param name="hasMoreOptions"> [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. </param> /// <param name="toggleMoreOptions"> [optional] Callback call when advanced button clicked. Should be used to toggle its state. </param> /// <returns>return the state of the foldout header</returns> public static bool DrawSubHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func <bool> hasMoreOptions = null, Action toggleMoreOptions = null) { const float height = 17f; var backgroundRect = GUILayoutUtility.GetRect(1f, height); var labelRect = backgroundRect; labelRect.xMin += 16f; labelRect.xMax -= 20f; var foldoutRect = backgroundRect; foldoutRect.y += 1f; foldoutRect.x += 15 * EditorGUI.indentLevel; //GUI do not handle indent. Handle it here foldoutRect.width = 13f; foldoutRect.height = 13f; // More options var advancedRect = new Rect(); if (hasMoreOptions != null) { advancedRect = backgroundRect; advancedRect.x += advancedRect.width - 16 - 1; advancedRect.height = 16; advancedRect.width = 16; bool moreOptions = hasMoreOptions(); bool newMoreOptions = Styles.DrawMoreOptions(advancedRect, moreOptions); if (moreOptions ^ newMoreOptions) { toggleMoreOptions?.Invoke(); } } // Background rect should be full-width backgroundRect.xMin = 0f; backgroundRect.width += 4f; if (isBoxed) { labelRect.xMin += 5; foldoutRect.xMin += 5; backgroundRect.xMin = EditorGUIUtility.singleLineHeight; backgroundRect.width -= 3; } // Title EditorGUI.LabelField(labelRect, title, EditorStyles.boldLabel); // Active checkbox state = GUI.Toggle(foldoutRect, state, GUIContent.none, EditorStyles.foldout); var e = Event.current; if (e.type == EventType.MouseDown && backgroundRect.Contains(e.mousePosition) && !advancedRect.Contains(e.mousePosition) && e.button == 0) { state = !state; e.Use(); } return(state); }
private void DrawToolbar() { GUILayout.BeginVertical(GUILayout.Height(position.height)); { DGUI.AnimatedTexture.Draw(ToolbarAnimBool, NodyToolbarHeader, DoozyWindowSettings.Instance.ToolbarExpandedWidth, DoozyWindowSettings.Instance.ToolbarHeaderHeight); //Nody Toolbar Header DrawToolbarExpandCollapseButton(); GUILayout.Space(DGUI.Properties.Space(4)); DrawToolbarButton(UILabels.Graph, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewGraph), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewGraphSelected), false, DGUI.Colors.DisabledTextColorName, () => { CreateAndOpenGraphWidthDialog(false); }); DrawToolbarButton(UILabels.SubGraph, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewSubGraph), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewSubGraphSelected), false, DGUI.Colors.DisabledTextColorName, () => { CreateAndOpenGraphWidthDialog(true); }); GUILayout.Space(DGUI.Properties.Space(4)); DrawToolbarButton(UILabels.Load, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonLoad), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonLoadSelected), false, DGUI.Colors.DisabledTextColorName, LoadGraphWidthDialog); if (CurrentGraph != null) { GUILayout.Space(DGUI.Properties.Space(4)); DrawToolbarButton(UILabels.Save, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSave), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveSelected), false, DGUI.Colors.DisabledTextColorName, SaveGraph); DrawToolbarButton(UILabels.SaveAs, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveAs), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveAsSelected), false, DGUI.Colors.DisabledTextColorName, SaveGraphAs); GUILayout.Space(DGUI.Properties.Space(4)); DrawToolbarButton(UILabels.Close, Styles.GetStyle(Styles.StyleName.WindowToolbarButtonClose), Styles.GetStyle(Styles.StyleName.WindowToolbarButtonCloseSelected), false, DGUI.Colors.DisabledTextColorName, () => { CloseCurrentGraph(); }); } GUILayout.FlexibleSpace(); } GUILayout.EndVertical(); }
/// <summary> Draw a foldout header </summary> /// <param name="title"> The title of the header </param> /// <param name="state"> The state of the header </param> /// <param name="isBoxed"> [optional] is the eader contained in a box style ? </param> /// <param name="hasMoreOptions"> [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. </param> /// <param name="toggleMoreOptions"> [optional] Callback call when advanced button clicked. Should be used to toggle its state. </param> /// <returns>return the state of the foldout header</returns> public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func <bool> hasMoreOptions = null, Action toggleMoreOptions = null) { const float height = 17f; var backgroundRect = GUILayoutUtility.GetRect(1f, height); float xMin = backgroundRect.xMin; var labelRect = backgroundRect; labelRect.xMin += 16f; labelRect.xMax -= 20f; var foldoutRect = backgroundRect; foldoutRect.y += 1f; foldoutRect.width = 13f; foldoutRect.height = 13f; foldoutRect.x = labelRect.xMin + 15 * (EditorGUI.indentLevel - 1); //fix for presset // More options 1/2 var moreOptionsRect = new Rect(); if (hasMoreOptions != null) { moreOptionsRect = backgroundRect; moreOptionsRect.x += moreOptionsRect.width - 16 - 1; moreOptionsRect.height = 15; moreOptionsRect.width = 16; } // Background rect should be full-width backgroundRect.xMin = 0f; backgroundRect.width += 4f; if (isBoxed) { labelRect.xMin += 5; foldoutRect.xMin += 5; backgroundRect.xMin = xMin == 7.0 ? 4.0f : EditorGUIUtility.singleLineHeight; backgroundRect.width -= 1; } // Background float backgroundTint = EditorGUIUtility.isProSkin ? 0.1f : 1f; EditorGUI.DrawRect(backgroundRect, new Color(backgroundTint, backgroundTint, backgroundTint, 0.2f)); // More options 2/2 if (hasMoreOptions != null) { EditorGUI.BeginChangeCheck(); Styles.DrawMoreOptions(moreOptionsRect, hasMoreOptions()); if (EditorGUI.EndChangeCheck() && toggleMoreOptions != null) { toggleMoreOptions(); } } // Title EditorGUI.LabelField(labelRect, title, EditorStyles.boldLabel); // Active checkbox state = GUI.Toggle(foldoutRect, state, GUIContent.none, EditorStyles.foldout); var e = Event.current; if (e.type == EventType.MouseDown && backgroundRect.Contains(e.mousePosition) && !moreOptionsRect.Contains(e.mousePosition) && e.button == 0) { state = !state; e.Use(); } return(state); }
private void Intellua_SelectionChanged(object sender, EventArgs e) { if (!Parse) { return; } ShowCalltip(); const string lbracket = "([{"; const string rbracket = ")]}"; int pos = CurrentPos; int style = Styles.GetStyleAt(pos - 1); int start, end; start = end = -1; Byte[] str = RawText; Stack <char> stk = new Stack <char>(); for (int p = pos - 1; p >= 0; p--) { // if (Styles.GetStyleAt(p) != style) continue; if (p >= str.Length) { continue; } if (str[p] > 127) { continue; } char c = Convert.ToChar(str[p]); if (rbracket.Contains(c)) { stk.Push(c); } if (lbracket.Contains(c)) { if (stk.Count == 0) { start = p; break; } char pc = stk.Pop(); if ((pc == ')' && c != '(') || (pc == ']' && c != '[') || (pc == '}' && c != '{')) { break; } } } stk.Clear(); for (int p = pos; p < str.Length; p++) { // if (Styles.GetStyleAt(p) != style) continue; if (str[p] > 127) { continue; } char c = Convert.ToChar(str[p]); if (lbracket.Contains(c)) { stk.Push(c); } if (rbracket.Contains(c)) { if (stk.Count == 0) { end = p; break; } char pc = stk.Pop(); if ((pc != ')' && c == '(') || (pc != ']' && c == '[') || (pc != '}' && c == '{')) { break; } } } if (start >= 0 && end >= 0) { char c = Convert.ToChar(str[start]); char pc = Convert.ToChar(str[end]); if ((pc != ')' && c == '(') || (pc != ']' && c == '[') || (pc != '}' && c == '{')) { start = -1; } } if (start != -1) { //start = Encoding.GetByteCount(Text.ToCharArray(), 0, start+1)-1; } if (end != -1) { //end = Encoding.GetByteCount(Text.ToCharArray(), 0, end + 1) - 1; } if (start == -1) { if (end != -1) { NativeInterface.BraceBadLight(end); } else { NativeInterface.BraceHighlight(-1, -1); } } else if (end == -1) { if (start != -1) { NativeInterface.BraceBadLight(start); } else { NativeInterface.BraceHighlight(-1, -1); } } else { NativeInterface.BraceHighlight(start, end); } }
public override void OnPreviewSettings() { if (s_Styles == null) { s_Styles = new Styles(); } InitPreview(); if (m_PreviewUtility == null) { if (GUILayout.Button(s_Styles.reload, s_Styles.preButton)) { m_Loaded = false; } return; } EditorGUI.BeginChangeCheck(); m_ShowReference = GUILayout.Toggle(m_ShowReference, s_Styles.pivot, s_Styles.preButton); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("AvatarpreviewShowReference", m_ShowReference); } //EditorGUI.BeginChangeCheck(); //m_LockParticleSystem = GUILayout.Toggle(m_LockParticleSystem, s_Styles.lockParticleSystem, s_Styles.preButton); //if (EditorGUI.EndChangeCheck()) //{ // SetSimulateMode(); //} bool flag = CycleButton(!m_Playing ? 0 : 1, s_Styles.play, s_Styles.preButton) != 0; if (flag != m_Playing) { if (flag) { SimulateEnable(); } else { SimulateDisable(); } } GUILayout.Box(s_Styles.speedScale, s_Styles.preLabel); EditorGUI.BeginChangeCheck(); m_PlaybackSpeed = PreviewSlider(m_PlaybackSpeed, 0.03f); if (EditorGUI.EndChangeCheck() && m_PreviewInstance) { ParticleSystem[] particleSystems = m_PreviewInstance.GetComponentsInChildren <ParticleSystem>(true); foreach (var particleSystem in particleSystems) { #if UNITY_5_5_OR_NEWER ParticleSystem.MainModule main = particleSystem.main; main.simulationSpeed = m_PlaybackSpeed; #else particleSystem.playbackSpeed = m_PlaybackSpeed; #endif } } GUILayout.Label(m_PlaybackSpeed.ToString("f2"), s_Styles.preLabel); }