Ejemplo n.º 1
0
 public static void ShowWindow(EditorGUILayoutEx in_layout, Google2uLocalization in_localization)
 {
     //Show existing window instance. If one doesn't exist, make one.
     var Google2uDocsWindow = GetWindow<Google2uDocs>("Google2u Docs");
     Google2uDocsWindow.MyGUILayout = in_layout;
     Google2uDocsWindow.LocalizationInfo = in_localization;
 }
Ejemplo n.º 2
0
        public static void ShowWindow(EditorGUILayoutEx in_layout, Google2uLocalization in_localization)
        {
            //Show existing window instance. If one doesn't exist, make one.
            var Google2uDocsWindow = GetWindow <Google2uDocs>("Google2u Docs");

            Google2uDocsWindow.MyGUILayout      = in_layout;
            Google2uDocsWindow.LocalizationInfo = in_localization;
        }
Ejemplo n.º 3
0
        public bool DrawGUIList(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized        = true;
                UseTypeRow          = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            var old = GUI.enabled;

            if (WorksheetQueryStatus != QueryStatus.Idle && RowsDisplay.Length == 0)
            {
                GUI.enabled = false;
            }


            var newExportType = WorksheetExportType;

            if (IsDataValid)
            {
                newExportType = (ExportType)EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
            }
            else if (WorksheetQueryStatus != QueryStatus.Idle)
            {
                EditorGUILayout.LabelField(WorksheetName,
                                           Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                                           Google2u.Ellipses);
            }
            else
            {
                var oldColor = GUI.color;
                if (GUI.GetNameOfFocusedControl() != WorksheetName + "Invalid")
                {
                    GUI.color = Color.red;
                }
                GUI.SetNextControlName(WorksheetName + "Invalid");
                newExportType = (ExportType)EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
                GUI.color     = oldColor;
            }

            if (newExportType != WorksheetExportType)
            {
                WorksheetExportType = Google2uGUIUtil.SetEnum(Prefix + "ExportType", newExportType);
            }

            GUI.enabled = old;

            return(WorksheetExportType != ExportType.DoNotExport);
        }
Ejemplo n.º 4
0
        public bool DrawCellValue(EditorGUILayoutEx in_layout)
        {
            var ret = false;

            EditorGUILayout.BeginHorizontal();

            if (!_MyCell.ReadOnly)
            {
                var oldVal = _MyCell.InputValue;
                if (NewValue == null)
                {
                    NewValue = oldVal;
                }
                NewValue = EditorGUILayout.TextField(NewValue);

                var content = new GUIContent(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_UPDATE),
                                             Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_SYNC));
                if (GUILayout.Button(content, GUILayout.Width(100)))
                {
                    if (oldVal != NewValue)
                    {
                        _MyCell.InputValue = NewValue;
                        try
                        {
                            _MyCell.Update();
                        }
                        catch (Exception ex)
                        {
                            Debug.Log("Something went wrong. Try logging out and back in again: " + ex);
                        }

                        ret = true;
                    }
                }
            }
            else
            {
                var old = GUI.enabled;
                GUI.enabled = false;
                EditorGUILayout.LabelField(_MyCell.Value);
                GUI.enabled = old;
            }
            EditorGUILayout.EndHorizontal();
            return(ret);
        }
Ejemplo n.º 5
0
        public void OnGUI()
        {
            if (LocalizationInfo == null)
            {
                return;
            }

            DocsScroll = GUILayout.BeginScrollView(DocsScroll);

            DrawGettingStarted();
            DrawUsingGoogle2u();

            GUILayout.FlexibleSpace();
            GUILayout.EndScrollView();
            EditorGUILayout.Separator();
            Google2u.ShowDocsAtStartup =
                EditorGUILayoutEx.ToggleInput(LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_SHOWONSTARTUP),
                                              Google2u.ShowDocsAtStartup, "ShowDocsAtStartup");
        }
Ejemplo n.º 6
0
        public bool DrawCellValue(EditorGUILayoutEx in_layout)
        {
            var ret = false;
            EditorGUILayout.BeginHorizontal();

            if (!_MyCell.ReadOnly)
            {
                var oldVal = _MyCell.InputValue;
                if (NewValue == null)
                    NewValue = oldVal;
                NewValue = EditorGUILayout.TextField(NewValue);

                var content = new GUIContent(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_UPDATE), Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_SYNC));
                if (GUILayout.Button(content, GUILayout.Width(100)))
                {
                    if (oldVal != NewValue)
                    {
                        _MyCell.InputValue = NewValue;
                        try
                        {
                            _MyCell.Update();
                        }
                        catch (Exception ex)
                        {
                            Debug.Log("Something went wrong. Try logging out and back in again: " + ex);
                        }
                        
                        ret = true;
                    }

                }
            }
            else
            {
                var old = GUI.enabled;
                GUI.enabled = false;
                EditorGUILayout.LabelField(_MyCell.Value);
                GUI.enabled = old;
            }
            EditorGUILayout.EndHorizontal();
            return ret;
        }
Ejemplo n.º 7
0
 public Google2uCell DrawGUI(EditorGUILayoutEx in_layout, Rect in_rect, Google2uCell in_activeEntry)
 {
     if (in_activeEntry == this)
     {
         GUI.Label(in_rect, _MyCell.Value, in_layout.CellButtonActive);
     }
     else if (!SkipValidation && !string.IsNullOrEmpty(Tooltip))
     {
         var content = new GUIContent(_MyCell.Value, Tooltip);
         if (GUI.Button(in_rect, content, in_layout.CellInvalidButton))
         {
             return(this);
         }
     }
     else
     {
         if (GUI.Button(in_rect, _MyCell.Value, in_layout.CellButton))
         {
             return(this);
         }
     }
     return(null);
 }
Ejemplo n.º 8
0
 public Google2uCell DrawGUI(EditorGUILayoutEx in_layout, Rect in_rect, Google2uCell in_activeEntry)
 {
     if (in_activeEntry == this)
     {
         GUI.Label(in_rect, _MyCell.Value, in_layout.CellButtonActive);
     }
     else if (!SkipValidation && !string.IsNullOrEmpty(Tooltip))
     {
         var content = new GUIContent(_MyCell.Value, Tooltip);
         if (GUI.Button(in_rect, content, in_layout.CellInvalidButton))
         {
             return this;
         }
     }
     else
     {
         if (GUI.Button(in_rect, _MyCell.Value, in_layout.CellButton))
         {
             return this;
         }
     }
     return null;
 }
        protected void DrawSpreadsheetOptions(EditorGUILayoutEx in_layout, ExportType in_exportType,
            Google2uWorksheet in_activeWorksheet)
        {
            ShowSpreadsheetOptions =
                Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsOpen",
                    ShowSpreadsheetOptions);
            var showWorkbookOptions = in_layout.BeginFadeArea(ShowSpreadsheetOptions,
                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT_OPTIONS),
                "workbook" + WorkbookName.Replace(' ', '_') + "_Options", in_layout.InnerBox, in_layout.InnerBoxHeader);
            ShowSpreadsheetOptions = showWorkbookOptions.Open;
            Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsOpen", ShowSpreadsheetOptions);
            if (showWorkbookOptions.Show())
            {
                var prefix = "workbook" + WorkbookName.Replace(' ', '_') + "_Option_";

                ShowSpreadsheetOptionsLegacy =
                    Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacyOpen",
                        ShowSpreadsheetOptionsLegacy);
                var showWorkbookOptionsLegacy = in_layout.BeginFadeArea(ShowSpreadsheetOptionsLegacy,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_LEGACY_OPTIONS),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacy", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsLegacy = showWorkbookOptionsLegacy.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacyOpen",
                    ShowSpreadsheetOptionsLegacy);
                if (showWorkbookOptionsLegacy.Show())
                {
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_LOWERCASE_HEADER),
                        ref ExportOptions.LowercaseHeader, prefix + "LowercaseHeader");
                }
                in_layout.EndFadeArea();

                ShowSpreadsheetOptionsWhitespace =
                    Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespaceOpen",
                        ShowSpreadsheetOptionsWhitespace);
                var showWorkbookOptionsWhitespace = in_layout.BeginFadeArea(ShowSpreadsheetOptionsWhitespace,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_WHITESPACE),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespace", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsWhitespace = showWorkbookOptionsWhitespace.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespaceOpen",
                    ShowSpreadsheetOptionsWhitespace);
                if (showWorkbookOptionsWhitespace.Show())
                {
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TRIM_STRINGS),
                        ref ExportOptions.TrimStrings, prefix + "TrimStrings");
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TRIM_STRING_ARRAYS),
                        ref ExportOptions.TrimStringArrays, prefix + "TrimStringArrays");
                }
                in_layout.EndFadeArea();

                ShowSpreadsheetOptionsArrayDelimiters =
                    Google2uGUIUtil.GetBool(
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimitersOpen",
                        ShowSpreadsheetOptionsArrayDelimiters);
                var showWorkbookOptionsArrayDelimiters = in_layout.BeginFadeArea(ShowSpreadsheetOptionsArrayDelimiters,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ARRAY_DELIMITERS),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimiters", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsArrayDelimiters = showWorkbookOptionsArrayDelimiters.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimitersOpen",
                    ShowSpreadsheetOptionsArrayDelimiters);
                if (showWorkbookOptionsArrayDelimiters.Show())
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NON_STRING));
                    var newArrayDelimiters = EditorGUILayout.Popup(ExportOptions.ArrayDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newArrayDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example Int Array - 1,2,3,4");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example Int Array - 1|2|3|4");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example Int Array - 1 2 3 4");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newArrayDelimiters != ExportOptions.ArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ArrayDelimiters", newArrayDelimiters);
                        ExportOptions.ArrayDelimiters = newArrayDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_STRINGS));
                    var newStringArrayDelimiters = EditorGUILayout.Popup(ExportOptions.StringArrayDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newStringArrayDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example String Array - Hello,Hola,Bonjour");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example String Array - Hello|Hola|Bonjour");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example String Array - Hello Hola Bonjour");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newStringArrayDelimiters != ExportOptions.StringArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "StringArrayDelimiters", newStringArrayDelimiters);
                        ExportOptions.StringArrayDelimiters = newStringArrayDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_COMPLEX_TYPES));
                    var newComplexTypeDelimiters = EditorGUILayout.Popup(ExportOptions.ComplexTypeDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newComplexTypeDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example Vector - 1,2,3");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example Vector - 1|2|3");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example Vector - 1 2 3");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newComplexTypeDelimiters != ExportOptions.ComplexTypeDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ComplexTypeDelimiters", newComplexTypeDelimiters);
                        ExportOptions.ComplexTypeDelimiters = newComplexTypeDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    var tmpDelimStrings = new List<string>();
                    var tmpDelimInts = new List<int>();
                    var curDelim = 0;
                    for (var i = 0; i < ExportOptions.DelimiterOptionStrings.Length; ++i)
                    {
                        if (i == ExportOptions.ComplexTypeDelimiters)
                            continue;
                        tmpDelimStrings.Add(ExportOptions.DelimiterOptionStrings[i]);
                        if (ExportOptions.ComplexArrayDelimiters == i)
                            curDelim = tmpDelimInts.Count;
                        tmpDelimInts.Add(i);
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_COMPLEX_ARRAYS));
                    var newComplexArrayDelimiters = EditorGUILayout.Popup(curDelim,
                        tmpDelimStrings.ToArray(), GUILayout.Width(100));
                    newComplexArrayDelimiters = tmpDelimInts[newComplexArrayDelimiters];
                    GUILayout.FlexibleSpace();

                    switch (newComplexArrayDelimiters)
                    {
                        case 0: // , - Comma
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Cannot use Comma as both Complex Type and Complex Array delimiters");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Example Vector Array - 1,2,3|4,5,6|7,8,9");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Example Vector Array - 1,2,3 4,5,6 7,8,9");
                                    break;
                            }
                        }
                            break;
                        case 1: // | - Pipe
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Example Vector Array - 1|2|3,4|5|6,7|8|9");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Cannot use Pipe as both Complex Type and Complex Array delimiters");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Example Vector Array - 1|2|3 4|5|6 7|8|9");
                                    break;
                            }
                        }
                            break;
                        case 2: //   - Space
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Example Vector Array - 1 2 3,4 5 6,7 8 9");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Example Vector Array - 1 2 3|4 5 6|7 8 9");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Cannot use Space as both Complex Type and Complex Array delimiters");
                                    break;
                            }
                        }
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newComplexArrayDelimiters != ExportOptions.ComplexArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ComplexArrayDelimiters", newComplexArrayDelimiters);
                        ExportOptions.ComplexArrayDelimiters = newComplexArrayDelimiters;
                    }
                }
                in_layout.EndFadeArea();

                if (in_exportType == ExportType.ObjectDatabase)
                {
                    ShowSpreadsheetOptionsObjectDB =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDBOpen",
                            ShowSpreadsheetOptionsObjectDB);
                    var showWorkbookOptionsObjectDB = in_layout.BeginFadeArea(ShowSpreadsheetOptionsObjectDB,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) + " " +
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CREATION_OPTIONS),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDB", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);
                    ShowSpreadsheetOptionsObjectDB = showWorkbookOptionsObjectDB.Open;
                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDBOpen",
                        ShowSpreadsheetOptionsObjectDB);
                    if (showWorkbookOptionsObjectDB.Show())
                    {
                        EditorGUILayout.LabelField("Global Options");
                        EditorGUILayout.Separator();

                        ExportOptions.ExportDatabaseGameObject =
                            EditorGUILayout.ObjectField(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) +
                                ": ", ExportOptions.ExportDatabaseGameObject, typeof (GameObject), true) as GameObject;

                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PLAYMAKER),
                            ref ExportOptions.GeneratePlaymakerActions, prefix + "GeneratePlaymakerActions");
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_PERSIST_SCENE_LOADING),
                            ref ExportOptions.UseDoNotDestroy, prefix + "UseDoNotDestroy");

                        var oldObjectDBCullColumns = ExportOptions.ObjectDBCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.ObjectDBCullColumns, prefix + "ObjectDBCullColumns");

                        if (oldObjectDBCullColumns != ExportOptions.ObjectDBCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldObjectDBCullRows = ExportOptions.ObjectDBCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.ObjectDBCullRows, prefix + "ObjectDBCullRows");

                        if (oldObjectDBCullRows != ExportOptions.ObjectDBCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("Local Options - " + in_activeWorksheet.WorksheetName);
                        EditorGUILayout.Separator();

                        var overrideObject =
                            EditorGUILayout.ObjectField(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) +
                                ": ",
                                ExportOptions.GetOverrideObjectDatabaseGameObject(in_activeWorksheet.WorksheetName),
                                typeof (GameObject), true) as GameObject;
                        if (overrideObject != null)
                            ExportOptions.SetOverrideObjectDatabaseGameObject(in_activeWorksheet.WorksheetName,
                                overrideObject);
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.StaticDatabase)
                {
                    ShowSpreadsheetOptionsStaticDB =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDBOpen",
                            ShowSpreadsheetOptionsObjectDB);

                    var showWorkbookOptionsStaticDB = in_layout.BeginFadeArea(ShowSpreadsheetOptionsStaticDB,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_STATIC_DATABASE) + " " +
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CREATION_OPTIONS),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDB", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsStaticDB = showWorkbookOptionsStaticDB.Open;
                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDBOpen",
                        ShowSpreadsheetOptionsStaticDB);
                    if (showWorkbookOptionsStaticDB.Show())
                    {
                        var oldStaticDBCullColumns = ExportOptions.StaticDBCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.StaticDBCullColumns, prefix + "StaticDBCullColumns");
                        if (oldStaticDBCullColumns != ExportOptions.StaticDBCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldStaticDBCullRows = ExportOptions.StaticDBCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.StaticDBCullRows, prefix + "StaticDBCullRows");
                        if (oldStaticDBCullRows != ExportOptions.StaticDBCullRows)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.JSON)
                {
                    ShowSpreadsheetOptionsJSON =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONOpen",
                            ShowSpreadsheetOptionsJSON);

                    var showWorkbookOptionsJSON = in_layout.BeginFadeArea(ShowSpreadsheetOptionsJSON,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSON", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsJSON = showWorkbookOptionsJSON.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONOpen",
                        ShowSpreadsheetOptionsJSON);

                    if (showWorkbookOptionsJSON.Show())
                    {
                        var oldEscapeUnicode = ExportOptions.EscapeUnicode;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_UNICODE),
                            ref ExportOptions.EscapeUnicode, prefix + "EscapeUnicode");
                        if (oldEscapeUnicode != ExportOptions.EscapeUnicode)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONCellArrayToString = ExportOptions.JSONCellArrayToString;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CONVERT_CELL_ARRAYS),
                            ref ExportOptions.JSONCellArrayToString, prefix + "JSONCellArrayToString");
                        if (oldJSONCellArrayToString != ExportOptions.JSONCellArrayToString)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONExportClass = ExportOptions.JSONExportClass;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_EXPORT_CLASS),
                            ref ExportOptions.JSONExportClass, prefix + "JSONExportClass");
                        if (oldJSONExportClass != ExportOptions.JSONExportClass)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldExportType = ExportOptions.JSONExportType;
                        ExportOptions.JSONExportType =
                            (Google2uExportOptions.ExportType) EditorGUILayout.EnumPopup(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_EXPORT_TYPE) + ":",
                                ExportOptions.JSONExportType);
                        if (oldExportType != ExportOptions.JSONExportType)
                        {
                            Google2uGUIUtil.SetEnum(prefix + "JSONExportType", ExportOptions.JSONExportType);
                            in_activeWorksheet.UpdateValidation = true;
                        }

                        var oldJSONCullColumns = ExportOptions.JSONCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.JSONCullColumns, prefix + "JSONCullColumns");
                        if (oldJSONCullColumns != ExportOptions.JSONCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONCullRows = ExportOptions.JSONCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.JSONCullRows, prefix + "JSONCullRows");
                        if (oldJSONCullRows != ExportOptions.JSONCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONIgnoreIDColumn = ExportOptions.JSONIgnoreIDColumn;
                        EditorGUILayoutEx.ToggleInput(
                            "Ignore ID Column",
                            ref ExportOptions.JSONIgnoreIDColumn, prefix + "JSONIgnoreIDColumn");
                        if (oldJSONIgnoreIDColumn != ExportOptions.JSONIgnoreIDColumn)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewJSON =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen",
                            ShowSpreadsheetPreviewJSON);

                    var showWorkbookPreviewJSON = in_layout.BeginFadeArea(ShowSpreadsheetPreviewJSON,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_OBJECT_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewJSON = showWorkbookPreviewJSON.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen",
                        ShowSpreadsheetPreviewJSON);

                    if (showWorkbookPreviewJSON.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("JSONPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _JSONPreviewString = Google2u.ExportJsonObjectString(in_activeWorksheet, ExportOptions, true);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_JSONPreviewString));
                        _JSONPreviewScrollPos = EditorGUILayout.BeginScrollView(_JSONPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_JSONPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _JSONPreviewString)
                            GUI.FocusControl("JSONPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewJSONClass =
                        Google2uGUIUtil.GetBool(
                            "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen",
                            ShowSpreadsheetPreviewJSONClass);

                    var showWorkbookPreviewJSONClass = in_layout.BeginFadeArea(ShowSpreadsheetPreviewJSONClass,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_CLASS_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewJSONClass = showWorkbookPreviewJSONClass.Open;

                    Google2uGUIUtil.SetBool(
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen",
                        ShowSpreadsheetPreviewJSONClass);

                    if (showWorkbookPreviewJSONClass.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("JSONPREVIEWCLASS");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_CLASS)))
                        {
                            _JSONPreviewClassString = Google2u.ExportJsonObjectClassString(in_activeWorksheet,
                                ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_JSONPreviewClassString));
                        _JSONPreviewClassScrollPos = EditorGUILayout.BeginScrollView(_JSONPreviewClassScrollPos, false,
                            false, GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_JSONPreviewClassString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _JSONPreviewClassString)
                            GUI.FocusControl("JSONPREVIEWCLASS");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.CSV)
                {
                    ShowSpreadsheetOptionsCSV =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVOpen",
                            ShowSpreadsheetOptionsCSV);

                    var showWorkbookOptionsCSV = in_layout.BeginFadeArea(ShowSpreadsheetOptionsCSV,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CSV_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSV", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsCSV = showWorkbookOptionsCSV.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVOpen",
                        ShowSpreadsheetOptionsCSV);

                    if (showWorkbookOptionsCSV.Show())
                    {
                        var oldEscapeCSVStrings = ExportOptions.EscapeCSVStrings;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_STRINGS),
                            ref ExportOptions.EscapeCSVStrings, prefix + "EscapeCSVStrings");
                        if (oldEscapeCSVStrings != ExportOptions.EscapeCSVStrings)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVCullColumns = ExportOptions.CSVCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.CSVCullColumns, prefix + "CSVCullColumns");
                        if (oldCSVCullColumns != ExportOptions.CSVCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVCullRows = ExportOptions.CSVCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.CSVCullRows, prefix + "CSVCullRows");
                        if (oldCSVCullRows != ExportOptions.CSVCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVConvertLineBreaks = ExportOptions.CSVConvertLineBreaks;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_LINE_BREAKS),
                            ref ExportOptions.CSVConvertLineBreaks, prefix + "CSVConvertLineBreaks");
                        if (oldCSVConvertLineBreaks != ExportOptions.CSVConvertLineBreaks)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewCSV =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen",
                            ShowSpreadsheetPreviewCSV);

                    var showWorkbookPreviewCSV = in_layout.BeginFadeArea(ShowSpreadsheetPreviewCSV,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CSV_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewCSV = showWorkbookPreviewCSV.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen",
                        ShowSpreadsheetPreviewCSV);

                    if (showWorkbookPreviewCSV.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("CSVPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _CSVPreviewString = Google2u.ExportCsvString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_CSVPreviewString));
                        _CSVPreviewScrollPos = EditorGUILayout.BeginScrollView(_CSVPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_CSVPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _CSVPreviewString)
                            GUI.FocusControl("CSVPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.NGUI)
                {
                    ShowSpreadsheetOptionsNGUI =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIOpen",
                            ShowSpreadsheetOptionsNGUI);

                    var showWorkbookOptionsNGUI = in_layout.BeginFadeArea(ShowSpreadsheetOptionsNGUI,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NGUI_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUI", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsNGUI = showWorkbookOptionsNGUI.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIOpen",
                        ShowSpreadsheetOptionsNGUI);

                    if (showWorkbookOptionsNGUI.Show())
                    {
                        var oldEscapeNGUIStrings = ExportOptions.EscapeNGUIStrings;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_STRINGS),
                            ref ExportOptions.EscapeNGUIStrings, prefix + "EscapeNGUIStrings");
                        if (oldEscapeNGUIStrings != ExportOptions.EscapeNGUIStrings)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUICullColumns = ExportOptions.NGUICullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.NGUICullColumns, prefix + "NGUICullColumns");
                        if (oldNGUICullColumns != ExportOptions.NGUICullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUICullRows = ExportOptions.NGUICullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.NGUICullRows, prefix + "NGUICullRows");
                        if (oldNGUICullRows != ExportOptions.NGUICullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUIConvertLineBreaks = ExportOptions.NGUIConvertLineBreaks;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_LINE_BREAKS),
                            ref ExportOptions.NGUIConvertLineBreaks, prefix + "NGUIConvertLineBreaks");
                        if (oldNGUIConvertLineBreaks != ExportOptions.NGUIConvertLineBreaks)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUILegacyExport = ExportOptions.NGUILegacyExport;
                        // TODO: Localize
                        EditorGUILayoutEx.ToggleInput(
                            "Use NGUI Legacy Export",
                            ref ExportOptions.NGUILegacyExport, prefix + "NGUILegacyExport");
                        if (oldNGUILegacyExport != ExportOptions.NGUILegacyExport)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewNGUI =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen",
                            ShowSpreadsheetPreviewNGUI);

                    var showWorkbookPreviewNGUI = in_layout.BeginFadeArea(ShowSpreadsheetPreviewNGUI,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NGUI_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewNGUI = showWorkbookPreviewNGUI.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen",
                        ShowSpreadsheetPreviewNGUI);

                    if (showWorkbookPreviewNGUI.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("NGUIPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            if (ExportOptions.NGUILegacyExport)
                                _NGUIPreviewString = Google2u.ExportNGUILegacyString(in_activeWorksheet, ExportOptions);
                            else
                                _NGUIPreviewString = Google2u.ExportNGUIString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_NGUIPreviewString));
                        _NGUIPreviewScrollPos = EditorGUILayout.BeginScrollView(_NGUIPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_NGUIPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _NGUIPreviewString)
                            GUI.FocusControl("NGUIPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.XML)
                {
                    ShowSpreadsheetOptionsXML =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLOpen",
                            ShowSpreadsheetOptionsXML);

                    var showWorkbookOptionsXML = in_layout.BeginFadeArea(ShowSpreadsheetOptionsXML,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_XML_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXML", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsXML = showWorkbookOptionsXML.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLOpen",
                        ShowSpreadsheetOptionsXML);

                    if (showWorkbookOptionsXML.Show())
                    {
                        var oldXMLCellArrayToString = ExportOptions.XMLCellArrayToString;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CONVERT_CELL_ARRAYS),
                            ref ExportOptions.XMLCellArrayToString, prefix + "XMLCellArrayToString");
                        if (oldXMLCellArrayToString != ExportOptions.XMLCellArrayToString)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldXMLCullColumns = ExportOptions.XMLCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.XMLCullColumns, prefix + "XMLCullColumns");
                        if (oldXMLCullColumns != ExportOptions.XMLCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldXMLCullRows = ExportOptions.XMLCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.XMLCullRows, prefix + "XMLCullRows");
                        if (oldXMLCullRows != ExportOptions.XMLCullRows)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewXML =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen",
                            ShowSpreadsheetPreviewXML);

                    var showWorkbookPreviewXML = in_layout.BeginFadeArea(ShowSpreadsheetPreviewXML,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_XML_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewXML = showWorkbookPreviewXML.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen",
                        ShowSpreadsheetPreviewXML);

                    if (showWorkbookPreviewXML.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("XMLPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _XMLPreviewString = Google2u.ExportXMLString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_XMLPreviewString));
                        _XMLPreviewScrollPos = EditorGUILayout.BeginScrollView(_XMLPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_XMLPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _XMLPreviewString)
                            GUI.FocusControl("XMLPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }
            }
            in_layout.EndFadeArea();
        }
 public abstract bool DrawGUIList(EditorGUILayoutEx in_layout, bool in_showAll);
 public abstract void DrawGUIFull(EditorGUILayoutEx in_layout);
Ejemplo n.º 12
0
        public override void DrawGUIFull(EditorGUILayoutEx in_layout)
        {
            switch (WorksheetQueryStatus)
            {
            case QueryStatus.Idle:
            {
                WorksheetQueryStatus = QueryStatus.Uninitialized;
            }
            break;

            case QueryStatus.Querying:
                EditorGUILayout.LabelField(
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) +
                    Google2u.Ellipses);
                break;

            case QueryStatus.QueryComplete:
                if (WorksheetsDisplay.Length > 0)
                {
                    EditorGUILayout.BeginHorizontal();


                    var worksheetNames = new string[WorksheetsDisplay.Length];
                    for (var i = 0; i < WorksheetsDisplay.Length; ++i)
                    {
                        worksheetNames[i] = WorksheetsDisplay[i].WorksheetName;
                    }

                    var activeWorksheet = WorksheetsDisplay[ActiveWorksheetIndex];
                    if (activeWorksheet == null)
                    {
                        throw new ArgumentNullException("ActiveWorksheet");
                    }

                    var content = new GUIContent(in_layout.RefreshButton,
                                                 Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                    if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                         GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                    {
                        Worksheets.Clear();
                        WorksheetQueryStatus = QueryStatus.Uninitialized;
                    }

                    {
                        var guiEnabled = GUI.enabled;
                        if (activeWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                        {
                            GUI.enabled = false;
                        }
                        content = activeWorksheet.IsDataValid
                                ? new GUIContent(in_layout.ValidateButtonGreen,
                                                 Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKSHEET))
                                : new GUIContent(in_layout.ValidateButtonRed,
                                                 Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKSHEET));

                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                             GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            // Do Validation for the active worksheet
                            activeWorksheet.UpdateValidation = true;
                            _OpenInvalidSheet = true;
                        }
                        GUI.enabled = guiEnabled;
                    }

                    content = new GUIContent(in_layout.GoogleButton,
                                             Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_OPEN_IN_GOOGLE));
                    if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                         GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                    {
                        Application.OpenURL(WorkbookUrl);
                    }

                    GUILayout.FlexibleSpace();

                    var oldEnabled = GUI.enabled;
                    if ((activeWorksheet.WorksheetExportType == ExportType.DoNotExport) ||
                        activeWorksheet.IsDataValid == false)
                    {
                        GUI.enabled = false;
                    }
                    content = new GUIContent(in_layout.SaveButton,
                                             Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                    if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                         GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                    {
                        DoExport(new List <Google2uWorksheet> {
                            activeWorksheet
                        });
                    }

                    GUI.enabled = oldEnabled;

                    EditorGUILayout.EndHorizontal();

                    var newActiveWorksheetIndex =
                        EditorGUILayout.Popup(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ACTIVE_WORKSHEET) + ": ",
                            ActiveWorksheetIndex,
                            worksheetNames);

                    if (newActiveWorksheetIndex != ActiveWorksheetIndex)
                    {
                        WorksheetsDisplay[ActiveWorksheetIndex].ActiveCell = null;
                        ActiveWorksheetIndex = newActiveWorksheetIndex;
                    }

                    var newExportType =
                        (ExportType)
                        EditorGUILayout.EnumPopup(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT_AS) + ": ",
                            activeWorksheet.WorksheetExportType);
                    if (newExportType != activeWorksheet.WorksheetExportType)
                    {
                        activeWorksheet.WorksheetExportType =
                            Google2uGUIUtil.SetEnum(activeWorksheet.Prefix + "ExportType", newExportType);
                    }

                    DrawSpreadsheetOptions(in_layout, activeWorksheet.WorksheetExportType, activeWorksheet);

                    EditorGUILayout.Separator();

                    activeWorksheet.DrawGUIFull(in_layout);
                }
                else
                {
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                }
                break;
            }
        }
Ejemplo n.º 13
0
        public override bool DrawGUIList(EditorGUILayoutEx in_layout, bool in_showAll)
        {
            var ret = true;

            var spreadsheetVisibleString = "workbook" + WorkbookName.Replace(' ', '_') + "_Visible";

            SpreadsheetVisible = Google2uGUIUtil.GetBool(spreadsheetVisibleString, SpreadsheetVisible);
            if ((SpreadsheetVisible == false) && !in_showAll)
            {
                return(true);
            }

            ShowSpreadsheet = Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open",
                                                      ShowSpreadsheet);
            var mainFadeArea = in_layout.BeginFadeArea(ShowSpreadsheet, WorkbookName,
                                                       "workbook" + WorkbookName.Replace(' ', '_'), in_layout.OuterBox, in_layout.OuterBoxHeader,
                                                       spreadsheetVisibleString);

            ShowSpreadsheet = mainFadeArea.Open;
            Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open", ShowSpreadsheet);

            // We have to do this here. Otherwise there is a threading issue (Can't initialize from EditorPreferences outside the main thread)
            if (ExportOptions == null)
            {
                ExportOptions = new Google2uExportOptions("workbook" + WorkbookName.Replace(' ', '_') + "_Option_");
            }

            if (mainFadeArea.Show())
            {
                var showExport   = false;
                var exportsheets = new List <Google2uWorksheet>();

                switch (WorksheetQueryStatus)
                {
                case QueryStatus.Idle:
                {
                    WorksheetQueryStatus = QueryStatus.Uninitialized;
                }
                break;

                case QueryStatus.Querying:
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) +
                        Google2u.Ellipses);
                    break;

                case QueryStatus.QueryComplete:
                    if (WorksheetsDisplay.Length > 0)
                    {
                        foreach (var google2UWorksheet in WorksheetsDisplay)
                        {
                            if (google2UWorksheet.DrawGUIList(in_layout))
                            {
                                exportsheets.Add(google2UWorksheet);
                                showExport = true;
                            }
                        }

                        if (_OpenInvalidSheet)
                        {
                            var stillQuerying = false;
                            for (var i = 0; i < Worksheets.Count; ++i)
                            {
                                if (!exportsheets.Contains(Worksheets[i]))
                                {
                                    continue;
                                }

                                if (Worksheets[i].UpdateValidation || Worksheets[i].Validating)
                                {
                                    stillQuerying = true;
                                }


                                if (Worksheets[i].IsDataValid == false)
                                {
                                    var ed = EditorWindow.GetWindow <Google2uEditor>();
                                    Google2u.ActiveWorkbookWindow = ed;
                                    ed.Workbook = this;
                                    ed.Layout   = in_layout;


#if (UNITY_4)
                                    ed.title = WorkbookName;
#elif (UNITY_5_0)
                                    ed.title = WorkbookName;
#else
                                    ed.titleContent.text = WorkbookName;
#endif

                                    ed.wantsMouseMove    = true;
                                    ActiveWorksheetIndex = i;
                                    Worksheets[i].HighlightFirstInvalidCell();
                                    _OpenInvalidSheet = false;
                                    break;
                                }
                            }
                            if (!stillQuerying)
                            {
                                _OpenInvalidSheet = false;
                            }
                        }

                        EditorGUILayout.BeginHorizontal();
                        var content = new GUIContent(in_layout.RefreshButton,
                                                     Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                             GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            Worksheets.Clear();
                            WorksheetQueryStatus = QueryStatus.Uninitialized;
                        }


                        var querying            = false;
                        var bAllWorksheetsValid = true;
                        foreach (var google2UWorksheet in exportsheets)
                        {
                            if (google2UWorksheet.IsDataValid == false)
                            {
                                bAllWorksheetsValid = false;
                            }
                            if (google2UWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                            {
                                querying = true;
                            }
                        }
                        {
                            var guiEnabled = GUI.enabled;
                            if (querying)
                            {
                                GUI.enabled = false;
                            }

                            content = bAllWorksheetsValid
                                    ? new GUIContent(in_layout.ValidateButtonGreen,
                                                     Google2u.LocalizationInfo.Localize(
                                                         Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK))
                                    : new GUIContent(in_layout.ValidateButtonRed,
                                                     Google2u.LocalizationInfo.Localize(
                                                         Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK));

                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                                 GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                // Do Validation for the worksheets we will be exporting
                                foreach (var google2UWorksheet in exportsheets)
                                {
                                    google2UWorksheet.UpdateValidation = true;
                                    google2UWorksheet.Validating       = true;
                                }
                                _OpenInvalidSheet = true;
                            }
                            GUI.enabled = guiEnabled;
                        }

                        content = new GUIContent(in_layout.EditButton,
                                                 Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EDIT_WORKBOOK));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                             GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            var ed = EditorWindow.GetWindow <Google2uEditor>();
                            Google2u.ActiveWorkbookWindow = ed;
                            ed.Workbook = this;
                            ed.Layout   = in_layout;
#if (UNITY_4)
                            ed.title = WorkbookName;
#elif (UNITY_5_0)
                            ed.title = WorkbookName;
#else
                            ed.titleContent.text = WorkbookName;
#endif
                            ed.wantsMouseMove = true;
                        }

                        GUILayout.FlexibleSpace();

                        if (showExport)
                        {
                            var oldEnabled = GUI.enabled;
                            if (bAllWorksheetsValid == false)
                            {
                                GUI.enabled = false;
                            }
                            content = new GUIContent(in_layout.SaveButton,
                                                     Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                                 GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                DoExport(exportsheets);
                            }
                            GUI.enabled = oldEnabled;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.LabelField(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                    }
                    break;
                }
            }
            in_layout.EndFadeArea();
            return(ret);
        }
Ejemplo n.º 14
0
        public override bool DrawGUIList(EditorGUILayoutEx in_layout, bool in_showAll)
        {
            var ret = true;
            ShowSpreadsheet = Google2uGUIUtil.GetBool("mworkbook" + WorkbookName.Replace(' ', '_') + "_Open",
                ShowSpreadsheet);
            var mainFadeArea = in_layout.BeginFadeArea(ShowSpreadsheet, WorkbookName,
                "mworkbook" + WorkbookName.Replace(' ', '_'), in_layout.OuterBox, in_layout.OuterBoxHeader);
            ShowSpreadsheet = mainFadeArea.Open;
            Google2uGUIUtil.SetBool("mworkbook" + WorkbookName.Replace(' ', '_') + "_Open", ShowSpreadsheet);

            if (mainFadeArea.Show())
            {
                // We have to do this here. Otherwise there is a threading issue (Can't initialize from EditorPreferences outside the main thread)
                if (ExportOptions == null)
                {
                    ExportOptions = new Google2uExportOptions("mworkbook" + WorkbookName.Replace(' ', '_') + "_Option_");
                }

                var showExport = false;
                var exportsheets = new List<Google2uWorksheet>();

                switch (WorksheetQueryStatus)
                {
                    case QueryStatus.Idle:
                    {
                        WorksheetQueryStatus = QueryStatus.Uninitialized;
                    }
                        break;

                    case QueryStatus.Querying:
                        EditorGUILayout.LabelField(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) +
                            Google2u.Ellipses);
                        break;

                    case QueryStatus.QueryComplete:
                        if (Worksheets.Count > 0)
                        {
                            foreach (var google2UWorksheet in Worksheets)
                            {
                                if (google2UWorksheet.DrawGUIList(in_layout))
                                {
                                    exportsheets.Add(google2UWorksheet);
                                    showExport = true;
                                }
                            }

                            EditorGUILayout.BeginHorizontal();
                            var content = new GUIContent(in_layout.RefreshButton,
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                Worksheets.Clear();
                                WorksheetQueryStatus = QueryStatus.Uninitialized;
                            }

                            var querying = false;
                            var bAllWorksheetsValid = true;
                            foreach (var google2UWorksheet in exportsheets)
                            {
                                if (google2UWorksheet.IsDataValid == false)
                                    bAllWorksheetsValid = false;
                                if (google2UWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                                    querying = true;
                            }

                            {
                                var guiEnabled = GUI.enabled;
                                if (querying)
                                    GUI.enabled = false;
                                content = bAllWorksheetsValid
                                    ? new GUIContent(in_layout.ValidateButtonGreen,
                                        Google2u.LocalizationInfo.Localize(
                                            Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK))
                                    : new GUIContent(in_layout.ValidateButtonRed,
                                        Google2u.LocalizationInfo.Localize(
                                            Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK));

                                if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                    GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                                {
                                    // Do Validation for the worksheets we will be exporting
                                    foreach (var google2UWorksheet in exportsheets)
                                    {
                                        google2UWorksheet.UpdateValidation = true;
                                    }
                                }
                                GUI.enabled = guiEnabled;
                            }

                            content = new GUIContent(in_layout.EditButton,
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VIEW_WORKBOOK));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                var ed = EditorWindow.GetWindow<Google2uEditor>();
                                ed.Workbook = this;
                                ed.Layout = in_layout;
#if(UNITY_4)
                                ed.title = WorkbookName;
#elif(UNITY_5_0)
                                ed.title = WorkbookName;
#else
                                ed.titleContent.text = WorkbookName;
#endif
                                ed.wantsMouseMove = true;
                            }

                            content = new GUIContent(in_layout.DeleteButton,
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REMOVE_WORKBOOK));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                if (
                                    EditorUtility.DisplayDialog(
                                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REMOVE_WORKBOOK),
                                        Google2u.LocalizationInfo.Localize(
                                            Localization.rowIds.ID_MESSAGE_REMOVE_WORKBOOK),
                                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_DELETE),
                                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CANCEL)))
                                    ret = false;
                            }

                            GUILayout.FlexibleSpace();

                            if (showExport)
                            {
                                var oldEnabled = GUI.enabled;
                                if (bAllWorksheetsValid == false)
                                    GUI.enabled = false;
                                content = new GUIContent(in_layout.SaveButton,
                                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                                if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                    GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                                {
                                    DoExport(exportsheets);
                                }
                                GUI.enabled = oldEnabled;
                            }


                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.LabelField(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                        }
                        break;
                }
            }
            in_layout.EndFadeArea();
            return ret;
        }
Ejemplo n.º 15
0
        public void OnEnable()
        {
            EditorApplication.update += Update;
            MyGUILayout = new EditorGUILayoutEx();
            EditorGUILayoutEx.GuiEditor = this;

            LoadStyles();
            LoadVisibilitySettings();
            LoadLanguageSettings();
            LoadPathSettings();

            LoadManualWorkbooks();
        }
        public override bool DrawGUIList(EditorGUILayoutEx in_layout, bool in_showAll)
        {
            var ret = true;

            var SpreadsheetVisibleString = "workbook" + WorkbookName.Replace(' ', '_') + "_Visible";
            SpreadsheetVisible = Google2uGUIUtil.GetBool(SpreadsheetVisibleString, SpreadsheetVisible);
            if ((SpreadsheetVisible == false) && !in_showAll)
                return true;

            ShowSpreadsheet = Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open", ShowSpreadsheet);
            var mainFadeArea = in_layout.BeginFadeArea(ShowSpreadsheet, WorkbookName, "workbook" + WorkbookName.Replace(' ', '_'), in_layout.OuterBox, in_layout.OuterBoxHeader, SpreadsheetVisibleString);
            ShowSpreadsheet = mainFadeArea.Open;
            Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_Open", ShowSpreadsheet);

            // We have to do this here. Otherwise there is a threading issue (Can't initialize from EditorPreferences outside the main thread)
            if (ExportOptions == null)
            {
                ExportOptions = new Google2uExportOptions("workbook" + WorkbookName.Replace(' ', '_') + "_Option_");
            }

            if (mainFadeArea.Show())
            {
                var showExport = false;
                var exportsheets = new List<Google2uWorksheet>();

                switch (WorksheetQueryStatus)
                {
                    case QueryStatus.Idle:
                        {
                            WorksheetQueryStatus = QueryStatus.Uninitialized;
                        }
                        break;

                    case QueryStatus.Querying:
                        EditorGUILayout.LabelField(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) + Google2u.Ellipses);
                        break;

                    case QueryStatus.QueryComplete:
                        if (WorksheetsDisplay.Length > 0)
                        {

                            foreach (var Google2uWorksheet in WorksheetsDisplay)
                            {
                                if (Google2uWorksheet.DrawGUIList(in_layout))
                                {
                                    exportsheets.Add(Google2uWorksheet);
                                    showExport = true;
                                }
                            }

                            if (_OpenInvalidSheet)
                            {
                                var stillQuerying = false;
                                for (var i = 0; i < Worksheets.Count; ++i)
                                {
                                    if (!exportsheets.Contains(Worksheets[i]))
                                        continue;

                                    if (Worksheets[i].UpdateValidation || Worksheets[i].Validating)
                                        stillQuerying = true;


                                    if (Worksheets[i].IsDataValid == false)
                                    {
                                        var ed = EditorWindow.GetWindow<Google2uEditor>();
                                        Google2u.ActiveWorkbookWindow = ed;
                                        ed.Workbook = this;
                                        ed.Layout = in_layout;
                                        ed.title = WorkbookName;
                                        ed.wantsMouseMove = true;
                                        ActiveWorksheetIndex = i;
                                        Worksheets[i].HighlightFirstInvalidCell();
                                        _OpenInvalidSheet = false;
                                        break;
                                    }
                                }
                                if(!stillQuerying)
                                    _OpenInvalidSheet = false;
                            }

                            EditorGUILayout.BeginHorizontal();
                            var content = new GUIContent(in_layout.RefreshButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                Worksheets.Clear();
                                WorksheetQueryStatus = QueryStatus.Uninitialized;
                            }


                            var querying = false;
                            var bAllWorksheetsValid = true;
                            foreach (var Google2uWorksheet in exportsheets)
                            {
                                if (Google2uWorksheet.IsDataValid == false)
                                    bAllWorksheetsValid = false;
                                if (Google2uWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                                    querying = true;
                            }
                            {
                                var guiEnabled = GUI.enabled;
                                if (querying)
                                    GUI.enabled = false;

                                content = bAllWorksheetsValid ? 
                                    new GUIContent(in_layout.ValidateButtonGreen, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK))
                                    : new GUIContent(in_layout.ValidateButtonRed, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKBOOK));

                                if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                    GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                                {
                                    // Do Validation for the worksheets we will be exporting
                                    foreach (var Google2uWorksheet in exportsheets)
                                    {
                                        Google2uWorksheet.UpdateValidation = true;
                                        Google2uWorksheet.Validating = true;
                                    }
                                    _OpenInvalidSheet = true;

                                }
                                GUI.enabled = guiEnabled;
                            }

                            content = new GUIContent(in_layout.EditButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EDIT_WORKBOOK));
                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                var ed = EditorWindow.GetWindow<Google2uEditor>();
                                Google2u.ActiveWorkbookWindow = ed;
                                ed.Workbook = this;
                                ed.Layout = in_layout;
                                ed.title = WorkbookName;
                                ed.wantsMouseMove = true;
                            }

                            GUILayout.FlexibleSpace();

                            if (showExport)
                            {
                                var oldEnabled = GUI.enabled;
                                if (bAllWorksheetsValid == false)
                                    GUI.enabled = false;
                                content = new GUIContent(in_layout.SaveButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                                if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                                {
                                    DoExport(exportsheets);
                                }
                                GUI.enabled = oldEnabled;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.LabelField(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                        }
                        break;
                }


                
            }
            in_layout.EndFadeArea();
            return ret;
        }
        public override void DrawGUIFull(EditorGUILayoutEx in_layout)
        {
            switch (WorksheetQueryStatus)
            {
                case QueryStatus.Idle:
                    {
                        WorksheetQueryStatus = QueryStatus.Uninitialized;
                    }
                    break;

                case QueryStatus.Querying:
                    EditorGUILayout.LabelField(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_WORKSHEETS) + Google2u.Ellipses);
                    break;

                case QueryStatus.QueryComplete:
                    if (WorksheetsDisplay.Length > 0)
                    {
                        EditorGUILayout.BeginHorizontal();


                        var worksheetNames = new string[WorksheetsDisplay.Length];
                        for (var i = 0; i < WorksheetsDisplay.Length; ++i)
                            worksheetNames[i] = WorksheetsDisplay[i].WorksheetName;

                        var activeWorksheet = WorksheetsDisplay[ActiveWorksheetIndex];
                        if (activeWorksheet == null) throw new ArgumentNullException("ActiveWorksheet");

                        var content = new GUIContent(in_layout.RefreshButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_REFRESH_WORKBOOK));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            Worksheets.Clear();
                            WorksheetQueryStatus = QueryStatus.Uninitialized;
                        }

                        {
                            var guiEnabled = GUI.enabled;
                            if (activeWorksheet.WorksheetQueryStatus != QueryStatus.Idle)
                                GUI.enabled = false;
                            content = activeWorksheet.IsDataValid
                                ? new GUIContent(in_layout.ValidateButtonGreen, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKSHEET))
                                : new GUIContent(in_layout.ValidateButtonRed, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_VALIDATE_WORKSHEET));

                            if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight),
                                GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                            {
                                // Do Validation for the active worksheet
                                activeWorksheet.UpdateValidation = true;
                                _OpenInvalidSheet = true;
                            }
                            GUI.enabled = guiEnabled;
                        }

                        content = new GUIContent(in_layout.GoogleButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_OPEN_IN_GOOGLE));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            Application.OpenURL(WorkbookUrl);
                        }

                        GUILayout.FlexibleSpace();

                        var oldEnabled = GUI.enabled;
                        if ((activeWorksheet.WorksheetExportType == ExportType.DoNotExport) || activeWorksheet.IsDataValid == false)
                        {
                            GUI.enabled = false;
                        }
                        content = new GUIContent(in_layout.SaveButton, Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT));
                        if (GUILayout.Button(content, GUILayout.Height(EditorGUILayoutEx.ButtonHeight), GUILayout.Width(EditorGUILayoutEx.ButtonWidth)))
                        {
                            DoExport(new List<Google2uWorksheet>() { activeWorksheet });
                        }

                        GUI.enabled = oldEnabled;

                        EditorGUILayout.EndHorizontal();

                        var newActiveWorksheetIndex = EditorGUILayout.Popup(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ACTIVE_WORKSHEET) + ": ", ActiveWorksheetIndex,
                            worksheetNames);

                        if (newActiveWorksheetIndex != ActiveWorksheetIndex)
                        {
                            WorksheetsDisplay[ActiveWorksheetIndex].ActiveCell = null;
                            ActiveWorksheetIndex = newActiveWorksheetIndex;
                        }

                        var newExportType = (ExportType)EditorGUILayout.EnumPopup(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT_AS) + ": ", activeWorksheet.WorksheetExportType);
                        if (newExportType != activeWorksheet.WorksheetExportType)
                        {
                            activeWorksheet.WorksheetExportType = Google2uGUIUtil.SetEnum(activeWorksheet.Prefix + "ExportType", newExportType);
                        }

                        DrawSpreadsheetOptions(in_layout, activeWorksheet.WorksheetExportType, activeWorksheet);

                        EditorGUILayout.Separator();

                        activeWorksheet.DrawGUIFull(in_layout);
                    }
                    else
                    {
                        EditorGUILayout.LabelField(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_NO_WORKSHEETS));
                    }
                    break;
            }

        }
Ejemplo n.º 18
0
        public bool DrawGUIList(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized = true;
                UseTypeRow = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            var old = GUI.enabled;
            if (WorksheetQueryStatus != QueryStatus.Idle && RowsDisplay.Length == 0)
                GUI.enabled = false;


            var newExportType = WorksheetExportType;

            if (IsDataValid)
                newExportType = (ExportType) EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
            else if (WorksheetQueryStatus != QueryStatus.Idle)
                EditorGUILayout.LabelField(WorksheetName,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                    Google2u.Ellipses);
            else
            {
                var oldColor = GUI.color;
                if (GUI.GetNameOfFocusedControl() != WorksheetName + "Invalid")
                    GUI.color = Color.red;
                GUI.SetNextControlName(WorksheetName + "Invalid");
                newExportType = (ExportType) EditorGUILayout.EnumPopup(WorksheetName, WorksheetExportType);
                GUI.color = oldColor;
            }

            if (newExportType != WorksheetExportType)
            {
                WorksheetExportType = Google2uGUIUtil.SetEnum(Prefix + "ExportType", newExportType);
            }

            GUI.enabled = old;

            return WorksheetExportType != ExportType.DoNotExport;
        }
Ejemplo n.º 19
0
        public void DrawGUIFull(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized        = true;
                UseTypeRow          = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            if (WorksheetQueryStatus != QueryStatus.QueryComplete && WorksheetQueryStatus != QueryStatus.Idle &&
                RowsDisplay.Length == 0)
            {
                EditorGUILayout.LabelField(
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                    Google2u.Ellipses);
            }
            else if (RowsDisplay.Length == 0)
            {
                if (WorksheetQueryStatus == QueryStatus.QueryComplete || WorksheetQueryStatus == QueryStatus.Idle)
                {
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_EMPTY_WORKSHEET));
                }
            }
            else
            {
                if (DoInitialSizeCheck)
                {
                    DoInitialSizeCheck = false;
                    for (var i = 0; i < ColOptions.Count; ++i)
                    {
                        CalculateColumnWidth(i, this);
                    }
                }

                if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15)
                {
                    DoUpdateQuery = true;
                }

                if (ActiveCell != null)
                {
                    if (!ActiveCell.SkipValidation && !string.IsNullOrEmpty(ActiveCell.Tooltip))
                    {
                        EditorGUILayoutEx.SetColor(Color.red);
                        GUILayout.Label(ActiveCell.Tooltip);
                        EditorGUILayoutEx.ResetColor();
                    }
                    if (ActiveCell.DrawCellValue(in_layout))
                    {
                        WorksheetQueryStatus = QueryStatus.Idle;
                        LastUpdateTime       = DateTime.MinValue;
                        DoUpdateQuery        = true;
                        UpdateValidation     = true;
                    }
                }
                else
                {
                    var old = GUI.enabled;
                    GUI.enabled = false;
                    EditorGUILayout.TextField(string.Empty);
                    GUI.enabled = old;
                }

                // Calculate the total width and height of the scroll area
                var totalHeight = Math.Max(120, 22 + (24 * RowsDisplay.Length));
                var totalWidth  = 40 + ColOptions.Sum(in_colOption => in_colOption.Width);

                EditorGUILayout.Separator();
                if (Event.current.type == EventType.Repaint)
                {
                    _LastRect = GUILayoutUtility.GetLastRect();
                }
                var scrollHeight = Screen.height - _LastRect.y - 30;
                var screenRect   = new Rect(0f, _LastRect.y, Screen.width, scrollHeight);
                var viewRect     = new Rect(0f, 0f, totalWidth, totalHeight);

                _MyScrollPos = GUI.BeginScrollView(screenRect, _MyScrollPos, viewRect);

                var curRect = new Rect(0.0f, 0.0f, 40.0f, 22.0f);

                // Blank
                GUI.Label(curRect, string.Empty, in_layout.CellHeader);

                // Column Letters (Resizable Columns)
                for (var i = 0; i < RowsDisplay[0].Count; i++)
                {
                    var label = GetColumnName(i + 1);
                    curRect.x    += curRect.width;
                    curRect.width = ColOptions[i].Width;
                    GUI.Label(curRect, label, in_layout.CellHeader);

                    ColOptions[i].ColumnRect       = curRect;
                    ColOptions[i].ColumnRect.width = ColOptions[i].Width;

                    if (ColOptions[i].ColumnRect.Contains(Event.current.mousePosition))
                    {
                        ColOptions[i].HasMouse = true;
                    }

                    if (!ColOptions[i].HasMouse)
                    {
                        continue;
                    }

                    if ((Event.current.type == EventType.MouseDown) && (Event.current.clickCount >= 2))
                    {
                        // Doubleclick
                        CalculateColumnWidth(i, this);
                    }
                    if (Event.current.type == EventType.MouseDrag)
                    {
                        ColOptions[i].CurPos = Event.current.mousePosition;

                        if (!ColOptions[i].Dragging)
                        {
                            ColOptions[i].Dragging = true;
                            ColOptions[i].StartPos = ColOptions[i].CurPos;
                        }
                    }

                    if (Event.current.type == EventType.MouseUp)
                    {
                        ColOptions[i].Dragging = false;
                        ColOptions[i].HasMouse = false;
                    }

                    if (!ColOptions[i].Dragging)
                    {
                        continue;
                    }

                    if (Event.current.isMouse)
                    {
                        Event.current.Use();
                    }

                    ColOptions[i].Width +=
                        Convert.ToInt32((ColOptions[i].CurPos.x - ColOptions[i].StartPos.x));
                    ColOptions[i].StartPos = ColOptions[i].CurPos;
                    ColOptions[i].Width    = Math.Max(26, ColOptions[i].Width);
                }


                curRect = new Rect(0.0f, 22.0f, 40.0f, 24.0f);

                // The rest of the rows
                for (var i = 0; i < RowsDisplay.Length; i++)
                {
                    if (i == 1)
                    {
                        // Could be type row
                        if (GUI.Button(curRect, UseTypeRow ? "Type" : "2", in_layout.CellTypeButton))
                        {
                            if (UseTypeRow == false)
                            {
                                if (EditorUtility.DisplayDialog(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_HEADER),
                                                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_MESSAGE), "OK", "Cancel"))
                                {
                                    UseTypeRow      = !UseTypeRow;
                                    UpdateCellTypes = true;
                                }
                            }
                            else
                            {
                                UseTypeRow      = !UseTypeRow;
                                UpdateCellTypes = true;
                            }
                        }
                    }
                    else
                    {
                        // Row Number
                        GUI.Label(curRect, Convert.ToString(i + 1), in_layout.CellHeader);
                    }

                    // Cell Values

                    if (i == 1 && UseTypeRow)
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x    += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            var myCell = RowsDisplay[i][j];

                            if (myCell.MyType == SupportedType.Unrecognized)
                            {
                                myCell.SetTypeFromValue();
                            }

                            var cellType    = myCell.MyType;
                            var curSelected = 0;
                            foreach (var guiContent in _ComboBoxList)
                            {
                                if (guiContent.text.Equals(Convert.ToString(cellType)))
                                {
                                    break;
                                }
                                curSelected++;
                            }
                            if (curSelected >= _ComboBoxList.Length)
                            {
                                curSelected = 0;
                            }

                            Google2uGUIUtil.ComboBox comboBoxControl;
                            if (!_ComboBoxes.ContainsKey(j))
                            {
                                comboBoxControl = new Google2uGUIUtil.ComboBox(curRect, _ComboBoxList[curSelected],
                                                                               _ComboBoxList, in_layout.CellTypeButton, in_layout.OuterBox, in_layout.CellHeader);
                                _ComboBoxes.Add(j, comboBoxControl);
                            }
                            else
                            {
                                comboBoxControl = _ComboBoxes[j];
                            }
                            comboBoxControl.width  = curRect.width;
                            comboBoxControl.height = curRect.height;
                            comboBoxControl.x      = curRect.x;
                            comboBoxControl.y      = curRect.y;
                            var newSelected = comboBoxControl.Show();
                            if (newSelected != curSelected)
                            {
                                var newType =
                                    (SupportedType)
                                    Enum.Parse(typeof(SupportedType), _ComboBoxList[newSelected].text, true);
                                myCell.MyType = newType;
                                myCell.SetValueFromType();
                                UpdateCellTypes  = true;
                                UpdateValidation = true;
                            }
                        }
                    }
                    else
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x    += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            if (curRect.x + curRect.width > _MyScrollPos.x && curRect.x < _MyScrollPos.x + Screen.width &&
                                curRect.y + curRect.height > _MyScrollPos.y && curRect.y < _MyScrollPos.y + scrollHeight)
                            {
                                if (i < 2 || i > 5 || !_ComboBoxes.ContainsKey(j) || _ComboBoxes[j].IsShown == false)
                                {
                                    var newCell = RowsDisplay[i][j].DrawGUI(in_layout, curRect, ActiveCell);
                                    if (newCell != null)
                                    {
                                        GUI.FocusControl("Blank");
                                        ActiveCell = newCell;
                                    }
                                }
                            }
                        }
                    }


                    curRect.x     = 0.0f;
                    curRect.width = 40.0f;
                    curRect.y    += curRect.height;
                }

                GUI.EndScrollView();
            }
        }
Ejemplo n.º 20
0
        public void DrawGUIFull(EditorGUILayoutEx in_layout)
        {
            if (!_Initialized)
            {
                _Initialized = true;
                UseTypeRow = Google2uGUIUtil.GetBool(Prefix + "UseTypeRow", UseTypeRow);
                WorksheetExportType = Google2uGUIUtil.GetEnum(Prefix + "ExportType", WorksheetExportType);
            }

            if (WorksheetQueryStatus != QueryStatus.QueryComplete && WorksheetQueryStatus != QueryStatus.Idle &&
                RowsDisplay.Length == 0)
            {
                EditorGUILayout.LabelField(
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_QUERYING_CELLS) +
                    Google2u.Ellipses);
            }
            else if (RowsDisplay.Length == 0)
            {
                if (WorksheetQueryStatus == QueryStatus.QueryComplete || WorksheetQueryStatus == QueryStatus.Idle)
                    EditorGUILayout.LabelField(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_MESSAGE_EMPTY_WORKSHEET));
            }
            else
            {
                if (DoInitialSizeCheck)
                {
                    DoInitialSizeCheck = false;
                    for (var i = 0; i < ColOptions.Count; ++i)
                    {
                        CalculateColumnWidth(i, this);
                    }
                }

                if ((DateTime.Now - LastUpdateTime).TotalSeconds > 15)
                {
                    DoUpdateQuery = true;
                }

                if (ActiveCell != null)
                {
                    if (!ActiveCell.SkipValidation && !string.IsNullOrEmpty(ActiveCell.Tooltip))
                    {
                        EditorGUILayoutEx.SetColor(Color.red);
                        GUILayout.Label(ActiveCell.Tooltip);
                        EditorGUILayoutEx.ResetColor();
                    }
                    if (ActiveCell.DrawCellValue(in_layout))
                    {
                        WorksheetQueryStatus = QueryStatus.Idle;
                        LastUpdateTime = DateTime.MinValue;
                        DoUpdateQuery = true;
                        UpdateValidation = true;
                    }
                }
                else
                {
                    var old = GUI.enabled;
                    GUI.enabled = false;
                    EditorGUILayout.TextField(string.Empty);
                    GUI.enabled = old;
                }

                // Calculate the total width and height of the scroll area
                var totalHeight = Math.Max(120, 22 + (24*RowsDisplay.Length));
                var totalWidth = 40 + ColOptions.Sum(in_colOption => in_colOption.Width);

                EditorGUILayout.Separator();
                if (Event.current.type == EventType.Repaint)
                    _LastRect = GUILayoutUtility.GetLastRect();
                var scrollHeight = Screen.height - _LastRect.y - 30;
                var screenRect = new Rect(0f, _LastRect.y, Screen.width, scrollHeight);
                var viewRect = new Rect(0f, 0f, totalWidth, totalHeight);

                _MyScrollPos = GUI.BeginScrollView(screenRect, _MyScrollPos, viewRect);

                var curRect = new Rect(0.0f, 0.0f, 40.0f, 22.0f);

                // Blank
                GUI.Label(curRect, string.Empty, in_layout.CellHeader);

                // Column Letters (Resizable Columns)
                for (var i = 0; i < RowsDisplay[0].Count; i++)
                {
                    var label = GetColumnName(i + 1);
                    curRect.x += curRect.width;
                    curRect.width = ColOptions[i].Width;
                    GUI.Label(curRect, label, in_layout.CellHeader);

                    ColOptions[i].ColumnRect = curRect;
                    ColOptions[i].ColumnRect.width = ColOptions[i].Width;

                    if (ColOptions[i].ColumnRect.Contains(Event.current.mousePosition))
                        ColOptions[i].HasMouse = true;

                    if (!ColOptions[i].HasMouse)
                        continue;

                    if ((Event.current.type == EventType.mouseDown) && (Event.current.clickCount >= 2))
                    {
                        // Doubleclick
                        CalculateColumnWidth(i, this);
                    }
                    if (Event.current.type == EventType.mouseDrag)
                    {
                        ColOptions[i].CurPos = Event.current.mousePosition;

                        if (!ColOptions[i].Dragging)
                        {
                            ColOptions[i].Dragging = true;
                            ColOptions[i].StartPos = ColOptions[i].CurPos;
                        }
                    }

                    if (Event.current.type == EventType.mouseUp)
                    {
                        ColOptions[i].Dragging = false;
                        ColOptions[i].HasMouse = false;
                    }

                    if (!ColOptions[i].Dragging)
                        continue;

                    if (Event.current.isMouse)
                        Event.current.Use();

                    ColOptions[i].Width +=
                        Convert.ToInt32((ColOptions[i].CurPos.x - ColOptions[i].StartPos.x));
                    ColOptions[i].StartPos = ColOptions[i].CurPos;
                    ColOptions[i].Width = Math.Max(26, ColOptions[i].Width);
                }


                curRect = new Rect(0.0f, 22.0f, 40.0f, 24.0f);

                // The rest of the rows
                for (var i = 0; i < RowsDisplay.Length; i++)
                {
                    if (i == 1)
                    {
                        // Could be type row
                        if (GUI.Button(curRect, UseTypeRow ? "Type" : "2", in_layout.CellTypeButton))
                        {
                            if (UseTypeRow == false)
                            {
                                if (EditorUtility.DisplayDialog(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_HEADER),
                                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TYPEROWBOX_MESSAGE), "OK", "Cancel"))
                                {
                                    UseTypeRow = !UseTypeRow;
                                    UpdateCellTypes = true;
                                }
                            }
                            else
                            {
                                UseTypeRow = !UseTypeRow;
                                UpdateCellTypes = true;
                            }
                            
                        }
                        
                    }
                    else
                    {
                        // Row Number
                        GUI.Label(curRect, Convert.ToString(i + 1), in_layout.CellHeader);
                    }

                    // Cell Values

                    if (i == 1 && UseTypeRow)
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            var myCell = RowsDisplay[i][j];

                            if (myCell.MyType == SupportedType.Unrecognized)
                            {
                                myCell.SetTypeFromValue();
                            }

                            var cellType = myCell.MyType;
                            var curSelected = 0;
                            foreach (var guiContent in _ComboBoxList)
                            {
                                if (guiContent.text.Equals(Convert.ToString(cellType)))
                                    break;
                                curSelected++;
                            }
                            if (curSelected >= _ComboBoxList.Length)
                                curSelected = 0;

                            Google2uGUIUtil.ComboBox comboBoxControl;
                            if (!_ComboBoxes.ContainsKey(j))
                            {
                                comboBoxControl = new Google2uGUIUtil.ComboBox(curRect, _ComboBoxList[curSelected],
                                    _ComboBoxList, in_layout.CellTypeButton, in_layout.OuterBox, in_layout.CellHeader);
                                _ComboBoxes.Add(j, comboBoxControl);
                            }
                            else
                            {
                                comboBoxControl = _ComboBoxes[j];
                            }
                            comboBoxControl.width = curRect.width;
                            comboBoxControl.height = curRect.height;
                            comboBoxControl.x = curRect.x;
                            comboBoxControl.y = curRect.y;
                            var newSelected = comboBoxControl.Show();
                            if (newSelected != curSelected)
                            {
                                var newType =
                                    (SupportedType)
                                        Enum.Parse(typeof (SupportedType), _ComboBoxList[newSelected].text, true);
                                myCell.MyType = newType;
                                myCell.SetValueFromType();
                                UpdateCellTypes = true;
                                UpdateValidation = true;
                            }
                        }
                    }
                    else
                    {
                        for (var j = 0; j < RowsDisplay[i].Count; j++)
                        {
                            curRect.x += curRect.width;
                            curRect.width = ColOptions[j].Width;

                            if (curRect.x + curRect.width > _MyScrollPos.x && curRect.x < _MyScrollPos.x + Screen.width &&
                                curRect.y + curRect.height > _MyScrollPos.y && curRect.y < _MyScrollPos.y + scrollHeight)
                            {
                                if (i < 2 || i > 5 || !_ComboBoxes.ContainsKey(j) || _ComboBoxes[j].IsShown == false)
                                {
                                    var newCell = RowsDisplay[i][j].DrawGUI(in_layout, curRect, ActiveCell);
                                    if (newCell != null)
                                    {
                                        GUI.FocusControl("Blank");
                                        ActiveCell = newCell;
                                    }
                                }
                            }
                        }
                    }


                    curRect.x = 0.0f;
                    curRect.width = 40.0f;
                    curRect.y += curRect.height;
                }

                GUI.EndScrollView();
            }
        }