📄 uifltk-log.cpp
字号:
/*************************************************************************** DSemu - The Next Generation ** Fltk user interface: Log file viewer [uifltk-log.cpp] ** Copyright Imran Nazar, 2005; released under the BSD public licence. ** Fltk used under the terms of the LGPL. ***************************************************************************/#include <FL/Fl.h>#include "uifltk.h"#include "log.h"u32 UIFltk::UI::LogWindow::sizeOld, UIFltk::UI::LogWindow::sizeNew;Fl_Text_Buffer *UIFltk::UI::LogWindow::buf;Fl_Text_Display *UIFltk::UI::LogWindow::text;Fl_Window *UIFltk::UI::LogWindow::mainWnd;// Initialise windowUIFltk::UI::LogWindow::LogWindow(int w, int h, void *t) : Fl_Double_Window(w,h,"Event Log"){ mainWnd = (Fl_Window*)t; // Add controls (there's only one visible) begin(); buf = new Fl_Text_Buffer(); text = new Fl_Text_Display(0,0, w,h); text->box(FL_NO_BOX); text->buffer(buf); text->hide_cursor(); text->textsize(10); text->textcolor(FL_WHITE); text->textfont(FL_HELVETICA); text->color(FL_BLACK); end(); resizable(text); show(); // Initialise the buffer cb(this);}// Shut down window: remove log refresh timeoutUIFltk::UI::LogWindow::~LogWindow(){ Fl::remove_timeout(cb); hide();}// Refresh windowvoid UIFltk::UI::LogWindow::cb(void *in){ // Load the log file, and scroll to the bottom buf->loadfile(Logger::getFilename().c_str()); text->scroll(buf->count_lines(0,buf->length()),0); // Do it again in 2.5 seconds Fl::repeat_timeout(2.5, cb);}// Handle window events. In this case, there's only one we need to know// about: if the window gets hidden, tell the main UI.int UIFltk::UI::LogWindow::handle(int e){ int ret = Fl_Window::handle(e); switch(e) { case FL_HIDE: Fl::handle(0xBEEF0001, mainWnd); break; } return ret;}/*** EOF: uifltk-log.cpp *************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -