private void DrawUpperPanel()
        {
            m_upperPanel = new Rect(0, MENU_BAR_HEIGHT, this.position.width, (this.position.height - MENU_BAR_HEIGHT) * m_upperSizeRatio);
            GUILayout.BeginArea(m_upperPanel, m_panelStyle);
            // re-adjust scroller position
            if (m_prevCount < m_currentShowCount)
            {
                if (m_isAutoScroll)
                {
                    m_upperPanelScroll.y = (m_currentShowCount * m_boxItemStyle.fixedHeight) - m_upperPanel.height;
                    m_isAutoScroll       = false;
                }
                else
                {
                    float tempGap = (m_prevCount * m_boxItemStyle.fixedHeight) - m_upperPanel.height;
                    if (tempGap > 0)
                    {
                        if (tempGap - m_upperPanelScroll.y <= m_boxItemStyle.fixedHeight || m_isAutoScroll)
                        {
                            m_upperPanelScroll.y = (m_currentShowCount * m_boxItemStyle.fixedHeight) - m_upperPanel.height;
                        }
                    }
                }
            }
            else if (m_currentShowCount * m_boxItemStyle.fixedHeight < m_upperPanel.height)
            {
                m_isAutoScroll = true;
            }

            m_prevCount        = m_currentShowCount;
            m_upperPanelScroll = GUILayout.BeginScrollView(m_upperPanelScroll);

            // draw items
            for (int i = 0; i < m_currentShowingItems.Count; i++)
            {
                if (DrawLogBox(m_currentShowingItems[i], i % 2 == 0, m_currentShowingItems[i].IsSelected))
                {
                    if (null != m_selectedLogItem)
                    {
                        if (m_currentShowingItems[i] == m_selectedLogItem)
                        {
                            // click a some one, open code
                            JumpToStackTop();
                        }
                        else
                        {
                            m_selectedLogItem.IsSelected = false;
                            m_selectedLogItem            = m_currentShowingItems[i];
                            TempLogManagerForUnityEditor.SetSelectedItem(m_selectedLogItem);
                            m_selectedLogItem.IsSelected = true;
                        }
                    }
                    else
                    {
                        m_selectedLogItem = m_currentShowingItems[i];
                        TempLogManagerForUnityEditor.SetSelectedItem(m_selectedLogItem);
                        m_selectedLogItem.IsSelected = true;
                    }
                    GUI.changed = true;
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
 public void ClearLogs()
 {
     m_selectedLogItem = null;
     TempLogManagerForUnityEditor.ClearLogs();
 }
        private void DrawMenuUpperBar()
        {
            m_menuUpperBar = new Rect(0.0f, 0.0f, this.position.width, MENU_BAR_HEIGHT);

            // draw upper bar, for default console stuff
            GUILayout.BeginArea(m_menuUpperBar, EditorStyles.toolbar);
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(new GUIContent("Clear"), EditorStyles.toolbarButton, GUILayout.Width(40.0f)))
            {
                ClearLogs();
            }
            GUILayout.Space(5.0f);

            m_isClearOnPlay = GUILayout.Toggle(TempLogManagerForUnityEditor.IsClearOnPlay, new GUIContent("Clear On Play"), EditorStyles.toolbarButton, GUILayout.Width(80.0f));
            TempLogManagerForUnityEditor.IsClearOnPlay = m_isClearOnPlay;
            // m_isErrorPause = GUILayout.Toggle(LogManagerForUnityEditor.IsErrorPause, new GUIContent("Error Pause"), EditorStyles.toolbarButton, GUILayout.Width(70.0f));
            // LogManagerForUnityEditor.IsErrorPause = m_isErrorPause;

            m_writeFileInEditorMode = GUILayout.Toggle(m_writeFileInEditorMode, new GUIContent("Write Log File"), EditorStyles.toolbarButton, GUILayout.Width(120.0f));
            TempLogManagerForUnityEditor.SetWriteFileFlag(m_writeFileInEditorMode);

            GUILayout.Space(30.0f);
            if (GUILayout.Button(new GUIContent("Clear Log File"), EditorStyles.toolbarButton, GUILayout.Width(120.0f)))
            {
                TempLogManager.ClearLogFiles();
            }

            GUILayout.FlexibleSpace();

            m_normalLogCount  = Mathf.Clamp(TempLogManagerForUnityEditor.InfoLogCount, 0, 100);
            m_warningLogCount = Mathf.Clamp(TempLogManagerForUnityEditor.WarningLogCount, 0, 100);
            m_errorLogCount   = Mathf.Clamp(TempLogManagerForUnityEditor.ErrorLogCount, 0, 100);

            m_isShowLog     = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowLog, new GUIContent(TempLogManagerHelper.GetNumberStr(m_normalLogCount), m_infoIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE));
            m_isShowWarning = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowWarning, new GUIContent(TempLogManagerHelper.GetNumberStr(m_warningLogCount), m_warningIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE));
            m_isShowError   = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowError, new GUIContent(TempLogManagerHelper.GetNumberStr(m_errorLogCount), m_errorIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE));
            TempLogManagerForUnityEditor.IsShowLog     = m_isShowLog;
            TempLogManagerForUnityEditor.IsShowWarning = m_isShowWarning;
            TempLogManagerForUnityEditor.IsShowError   = m_isShowError;

            int prevCount = m_logTypeForUnshow.Count;

            m_logTypeForUnshow.Clear();
            if (!m_isShowLog)
            {
                m_logTypeForUnshow.Add(LogType.Log);
            }

            if (!m_isShowWarning)
            {
                m_logTypeForUnshow.Add(LogType.Warning);
            }

            if (!m_isShowError)
            {
                m_logTypeForUnshow.Add(LogType.Error);
                m_logTypeForUnshow.Add(LogType.Assert);
                m_logTypeForUnshow.Add(LogType.Exception);
            }

            m_needRefresh = m_needRefresh || (prevCount != m_logTypeForUnshow.Count);

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }