public void OnNewItem(IPoderosaLogItem item)
        {
            //カテゴリ分けなどあるかもしれないが...
            String text  = String.Format("[{0}] {1}", item.Category.Name, item.Text);
            int    width = PoderosaLogDocument.DefaultWidth;

            //width文字ごとに切り取り。日本語文字があるケースは未サポート
            int offset = 0;

            while (offset < text.Length)
            {
                int   next = RuntimeUtil.AdjustIntRange(offset + width, 0, text.Length);
                GLine line = new GLine(text.Substring(offset, next - offset).ToCharArray(), new GWord(TextDecoration.ClonedDefault(), 0, CharGroup.Hankaku));
                line.EOLType = next < text.Length? EOLType.Continue : EOLType.CRLF;
                Append(line);
                offset = next;
            }

            PoderosaLogViewControl vc = _session.CurrentView;

            if (vc != null)
            {
                if (vc.InvokeRequired)
                {
                    vc.Invoke(vc.UpdateDocumentDelegate);
                }
                else
                {
                    vc.UpdateDocument();
                }
            }
        }
Ejemplo n.º 2
0
        public void OnNewItem(IPoderosaLogItem item)
        {
            //�J�e�S�������Ȃǂ��邩�����Ȃ���...
            String text = String.Format("[{0}] {1}", item.Category.Name, item.Text);
            int width = PoderosaLogDocument.DefaultWidth;

            //width�������Ƃɐ؂���B���{�ꕶ��������P�[�X�͖��T�|�[�g
            int offset = 0;
            while (offset < text.Length) {
                int next = RuntimeUtil.AdjustIntRange(offset + width, 0, text.Length);
                GLine line = GLine.CreateSimpleGLine(text.Substring(offset, next - offset), TextDecoration.Default);
                line.EOLType = next < text.Length ? EOLType.Continue : EOLType.CRLF;
                Append(line);
                offset = next;
            }

            PoderosaLogViewControl vc = _session.CurrentView;
            if (vc != null) {
                if (vc.InvokeRequired)
                    vc.Invoke(vc.UpdateDocumentDelegate);
                else
                    vc.UpdateDocument();
            }
        }
        public void OnNewItem(IPoderosaLogItem item) {
            //カテゴリ分けなどあるかもしれないが...
            String text = String.Format("[{0}] {1}", item.Category.Name, item.Text);
            int width = PoderosaLogDocument.DefaultWidth;

            //width文字ごとに切り取り。日本語文字があるケースは未サポート
            int offset = 0;
            while (offset < text.Length) {
                int next = RuntimeUtil.AdjustIntRange(offset + width, 0, text.Length);
                GLine line = GLine.CreateSimpleGLine(text.Substring(offset, next - offset), TextDecoration.Default);
                line.EOLType = next < text.Length ? EOLType.Continue : EOLType.CRLF;
                Append(line);
                offset = next;
            }

            PoderosaLogViewControl vc = _session.CurrentView;
            if (vc != null) {
                if (vc.InvokeRequired)
                    vc.Invoke(vc.UpdateDocumentDelegate);
                else
                    vc.UpdateDocument();
            }
        }