public CommandResult ClearScreen() { ConnectionTag tag = GEnv.Connections.FindTag(_connection); TerminalDocument doc = tag.Document; lock (doc) { GLine l = doc.TopLine; int top_id = l.ID; int limit = l.ID + _connection.TerminalHeight; while (l != null && l.ID < limit) { l.Clear(); l = l.NextLine; } doc.CurrentLineNumber = top_id; doc.CaretColumn = 0; doc.InvalidateAll(); if (tag.Pane != null) { GEnv.TextSelection.Clear(); tag.Pane.Invalidate(); } } return(CommandResult.Success); }
public ConnectionTag(TerminalConnection c) { _connection = c; _pane = null; _invalidateParam = new InvalidateParam(); _tabButton = null; _document = new TerminalDocument(_connection); _receiver = new TerminalDataReceiver(this); _terminated = false; _timer = null; _windowTitle = ""; //nullのときはデフォルトプロファイルを使う _renderProfile = c.Param.RenderProfile; //VT100指定でもxtermシーケンスを送ってくるアプリケーションが後をたたないので //_terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); if (c.Param.TerminalType == TerminalType.XTerm || c.Param.TerminalType == TerminalType.KTerm) { _terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); } else { _terminal = new VT100Terminal(this, new JapaneseCharDecoder(_connection)); } GEnv.Connections.KeepAlive.SetTimerToConnectionTag(this); }
public void Revive(ITerminalConnection connection) { TerminalDocument doc = _terminal.GetDocument(); _output.Revive(connection, doc.TerminalWidth, doc.TerminalHeight); _output.Connection.Socket.RepeatAsyncRead(_terminal); //ÄŽóM }
internal void AdjustIMEComposition(IntPtr hWnd, TerminalDocument doc) { Monitor.Exit(doc); lock (this) { Win32.SendMessage(hWnd, GConst.WMG_MAINTHREADTASK, new IntPtr(GConst.WPG_ADJUSTIMECOMPOSITION), IntPtr.Zero); } Monitor.Enter(doc); }
internal void IndicateBell(TerminalDocument doc) { Monitor.Exit(doc); lock (this) { SendMessageCore(Service.IndicateBell); } Monitor.Enter(doc); }
internal void ToggleTextSelectionMode(IntPtr hWnd, TerminalDocument doc) { Monitor.Exit(doc); lock (this) { Win32.SendMessage(hWnd, GConst.WMG_MAINTHREADTASK, new IntPtr(GConst.WPG_TOGGLESELECTIONMODE), IntPtr.Zero); } Monitor.Enter(doc); }
public SelectionKeyProcessor(TerminalPane owner, TerminalDocument doc, GLine line, int pos) { _owner = owner; _document = doc; Debug.Assert(line!=null); _currentLine = line; _caretPos = pos; }
public void Revive(ITerminalConnection connection) { TerminalDocument doc = _terminal.GetDocument(); _output.Revive(connection, doc.TerminalWidth, doc.TerminalHeight); this.OwnerWindow.DocumentTabFeature.Update(_terminal.IDocument); _output.Connection.Socket.RepeatAsyncRead(_terminal); //再受信 }
internal void UnsupportedCharSetDetected(TerminalDocument doc, string msg) { Monitor.Exit(doc); lock (this) { _msg = msg; SendMessageCore(Service.UnsupportedCharSetDetected); } Monitor.Enter(doc); }
internal void InvalidCharDetected(TerminalDocument doc, string msg) { Monitor.Exit(doc); lock (this) { _msg = msg; SendMessageCore(Service.InvalidCharDetected); } Monitor.Enter(doc); }
internal void InvalidDocumentOperation(TerminalDocument doc, string msg) { Monitor.Exit(doc); lock (this) { _msg = msg; SendMessageCore(Service.InvalidDocumentOperation); } Monitor.Enter(doc); }
internal void UnsupportedEscapeSequence(TerminalDocument doc, string msg) { Monitor.Exit(doc); lock (this) { _msg = msg; SendMessageCore(Service.UnsupportedEscapeSequence); } Monitor.Enter(doc); }
internal void ReportCriticalError(TerminalDocument doc, Exception ex) { Monitor.Exit(doc); lock (this) { _exception = ex; SendMessageCore(Service.CriticalError); } Monitor.Enter(doc); }
//これらの各メソッドはそれぞれロックしながら実行される internal void Warning(TerminalDocument doc, string msg) { Monitor.Exit(doc); lock (this) { _msg = msg; SendMessageCore(Service.Warning); } Monitor.Enter(doc); }
public void RefreshConnection(ConnectionTag tag) { TerminalDocument doc = tag.Document; Monitor.Exit(doc); lock (this) { _connection = tag.Connection; SendMessageCore(Service.RefreshConnection); } Monitor.Enter(doc); }
/// <summary> /// Benchmark thread /// </summary> private void BenchmarkThread() { Thread.Sleep(2000); try { OnPaintTimeStatistics onPaintStats = new OnPaintTimeStatistics(); _session.TerminalControl.SetOnPaintTimeObserver( delegate(Stopwatch s) { onPaintStats.Update(s); } ); SockWriteLine("Start XTerm Benchmark."); Stopwatch swTotal = Stopwatch.StartNew(); const int DATA_CHUNK_SIZE = 200; for (int i = 0; i < _repeat; i++) { _socket.FeedData(BenchmarkDataGenerator(DATA_CHUNK_SIZE), TIMEOUT); } swTotal.Stop(); SockWriteLine("End XTerm Benchmark."); _session.TerminalControl.SetOnPaintTimeObserver(null); TerminalDocument doc = (TerminalDocument)_session.Terminal.IDocument.GetAdapter(typeof(TerminalDocument)); SockWriteLine("---------------------------------------"); SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo, "Terminal Size : {0} x {1}", doc.TerminalWidth, doc.TerminalHeight)); SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo, "Terminal Buffer Size : {0}", _options.TerminalBufferSize)); SockWriteLine("---------------------------------------"); SockWriteLine(String.Format("OnPaint {0} samples", onPaintStats.GetSampleCount())); SockWriteLine(String.Format(" Max {0} msec", onPaintStats.GetMaxTimeMilliseconds())); SockWriteLine(String.Format(" Min {0} msec", onPaintStats.GetMinTimeMilliseconds())); SockWriteLine(String.Format(" Avg {0} msec", onPaintStats.GetAverageTimeMilliseconds())); SockWriteLine("---------------------------------------"); ReportBenchmark("Total ", swTotal); SockWriteLine("---------------------------------------"); } catch (MockSocketTimeoutException) { } }
public ConnectionTag(TerminalConnection c) { _connection = c; _pane = null; _invalidateParam = new InvalidateParam(); _tabButton = null; _document = new TerminalDocument(_connection); _receiver = new TerminalDataReceiver(this); _terminated = false; _timer = null; _windowTitle = ""; _renderProfile = c.Param.RenderProfile; _terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); GEnv.Connections.KeepAlive.SetTimerToConnectionTag(this); }
public CommandResult ClearBuffer() { ConnectionTag tag = GEnv.Connections.FindTag(_connection); TerminalDocument doc = tag.Document; lock (doc) { doc.Clear(); tag.Receiver.AdjustTransientScrollBar(); if (tag.Pane != null) { GEnv.TextSelection.Clear(); tag.Pane.CommitTransientScrollBar(); tag.Pane.Invalidate(); } } return(CommandResult.Success); }
//デバッグ用に、外部のXML形式ログを読んでエミュレートをする public static void EmulateWithLog(XmlReader reader, ConnectionTag tag) { ITerminal term = tag.Terminal; TerminalDocument doc = tag.Document; StringBuilder buf = new StringBuilder(); reader.ReadStartElement("terminal-log"); try { do { if (reader.NodeType == XmlNodeType.Text || reader.NodeType == XmlNodeType.Whitespace) { buf.Append(reader.Value); } else if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == "ESC") { buf.Append((char)0x1B); buf.Append(reader.GetAttribute("seq")); } else if (reader.Name == "BS") { buf.Append((char)0x8); } else if (reader.Name == "BEL") { buf.Append((char)0x7); } else if (reader.Name == "dump") { buf = Flush(tag, buf); doc.Dump(reader.GetAttribute("title")); } else if (reader.Name == "comment") { buf = Flush(tag, buf); while (reader.NodeType != XmlNodeType.EndElement || reader.Name != "comment") { reader.Read(); if (reader.NodeType == XmlNodeType.Text) { GEnv.InterThreadUIService.Warning(doc, reader.Value); } } } else if (reader.Name == "break") { Debug.WriteLine("BREAK " + reader.GetAttribute("title")); Debugger.Break(); buf = Flush(tag, buf); } else if (reader.Name == "PD") { buf = Flush(tag, buf); } else if (reader.Name == "pause") { buf = Flush(tag, buf); GEnv.InterThreadUIService.Warning(doc, reader.GetAttribute("title")); } else if (reader.Name != "SI" && reader.Name != "SO" && reader.Name != "NUL" && reader.Name != "terminal-size") { Debug.WriteLine("Unsupported element " + reader.Name); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == "terminal-log") { Flush(tag, buf); } } } while(reader.Read()); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } }
/// <summary> /// Benchmark thread /// </summary> private void BenchmarkThread() { Thread.Sleep(2000); try { OnPaintTimeStatistics onPaintStats = new OnPaintTimeStatistics(); _session.TerminalControl.SetOnPaintTimeObserver( delegate(Stopwatch s) { onPaintStats.Update(s); } ); SockWriteLine("Start XTerm Benchmark."); const int DATA_CHUNK_SIZE = 200; const int TRANSMIT_SECONDS = 30; DateTime utcLimit = DateTime.UtcNow.AddSeconds(TRANSMIT_SECONDS); Stopwatch swTotal; switch (_pattern) { case XTermBenchmarkPattern.ASCII: swTotal = BenchmarkAscii(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.KANJI: swTotal = BenchmarkKanji(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.ASCII_KANJI: swTotal = BenchmarkAsciiKanji(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.ASCII_COLOR16: swTotal = BenchmarkAsciiColor16(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.KANJI_COLOR16: swTotal = BenchmarkKanjiColor16(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.ASCII_KANJI_COLOR16: swTotal = BenchmarkAsciiKanjiColor16(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.ASCII_COLOR256: swTotal = BenchmarkAsciiColor256(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.KANJI_COLOR256: swTotal = BenchmarkKanjiColor256(DATA_CHUNK_SIZE, utcLimit); break; case XTermBenchmarkPattern.ASCII_KANJI_COLOR256: swTotal = BenchmarkAsciiKanjiColor256(DATA_CHUNK_SIZE, utcLimit); break; default: swTotal = Stopwatch.StartNew(); swTotal.Stop(); break; } SockWriteLine("\u001b[0m"); SockWriteLine("End XTerm Benchmark."); _session.TerminalControl.SetOnPaintTimeObserver(null); TerminalDocument doc = (TerminalDocument)_session.Terminal.IDocument.GetAdapter(typeof(TerminalDocument)); SockWriteLine("---------------------------------------"); SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo, "Terminal Size : {0} x {1}", doc.TerminalWidth, doc.TerminalHeight)); SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo, "Terminal Buffer Size : {0}", _options.TerminalBufferSize)); SockWriteLine("---------------------------------------"); SockWriteLine(String.Format("OnPaint {0} samples", onPaintStats.GetSampleCount())); SockWriteLine(String.Format(" Max {0} msec", onPaintStats.GetMaxTimeMilliseconds())); SockWriteLine(String.Format(" Min {0} msec", onPaintStats.GetMinTimeMilliseconds())); SockWriteLine(String.Format(" Avg {0} msec", onPaintStats.GetAverageTimeMilliseconds())); SockWriteLine("---------------------------------------"); ReportBenchmark("Total ", swTotal); SockWriteLine("---------------------------------------"); } catch (MockSocketTimeoutException) { } }
public ConnectionTag(TerminalConnection c) { _connection = c; _pane = null; _invalidateParam = new InvalidateParam(); _tabButton = null; _document = new TerminalDocument(_connection); _receiver = new TerminalDataReceiver(this); _terminated = false; _timer = null; _windowTitle = ""; //null�̂Ƃ��̓f�t�H���g�v���t�@�C����g�� _renderProfile = c.Param.RenderProfile; //VT100�w��ł�xterm�V�[�P���X�𑗂��Ă���A�v���P�[�V�������������Ȃ��̂� //_terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); if(c.Param.TerminalType==TerminalType.XTerm || c.Param.TerminalType==TerminalType.KTerm) _terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); else _terminal = new VT100Terminal(this, new JapaneseCharDecoder(_connection)); GEnv.Connections.KeepAlive.SetTimerToConnectionTag(this); }