Fl_Terminal widget (#800)

Pull Fl_Terminal widget from Greg's fork
This commit is contained in:
erco77
2023-11-14 07:01:52 -08:00
committed by GitHub
parent 83f6336f3b
commit 6842a43a31
35 changed files with 7818 additions and 217 deletions
+1013
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -789,6 +789,7 @@ INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/index.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/coordinates.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/resize.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/editor.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/Fl_Terminal.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/drawing.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/events.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/subclassing.dox \
+2 -1
View File
@@ -48,7 +48,8 @@ HTMLFILES = \
$(SRC_DOCDIR)/development.dox \
$(SRC_DOCDIR)/license.dox \
$(SRC_DOCDIR)/examples.dox \
$(SRC_DOCDIR)/faq.dox
$(SRC_DOCDIR)/faq.dox \
$(SRC_DOCDIR)/Fl_Terminal.dox
MANPAGES = $(SRC_DOCDIR)/fltk.$(CAT3EXT) $(SRC_DOCDIR)/fltk-config.$(CAT1EXT) \
$(SRC_DOCDIR)/fluid.$(CAT1EXT) $(SRC_DOCDIR)/blocks.$(CAT6EXT) \
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,5 +1,5 @@
//
// Simple Example app using Fl_Simple_Terminal. - erco 10/12/2017
// Simple Example app using Fl_Terminal. - erco 10/12/2017
//
// Copyright 2017 Greg Ercolano.
// Copyright 1998-2016 by Bill Spitzak and others.
@@ -15,17 +15,17 @@
// https://www.fltk.org/bugs.php
//
#include <time.h> //START
#include <time.h>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#define TERMINAL_HEIGHT 120
// Globals
Fl_Double_Window *G_win = 0;
Fl_Box *G_box = 0;
Fl_Simple_Terminal *G_tty = 0;
Fl_Terminal *G_tty = 0;
// Append a date/time message to the terminal every 2 seconds
void tick_cb(void *data) {
@@ -43,7 +43,7 @@ int main(int argc, char **argv) {
"Your app's debugging output in tty below");
// Add simple terminal to bottom of app window for scrolling history of status messages.
G_tty = new Fl_Simple_Terminal(0,200,G_win->w(),TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,200,G_win->w(),TERMINAL_HEIGHT);
G_tty->ansi(true); // enable use of "\033[32m"
G_win->end();
@@ -51,4 +51,4 @@ int main(int argc, char **argv) {
G_win->show();
Fl::add_timeout(0.5, tick_cb);
return Fl::run();
} //END
}
+1
View File
@@ -90,6 +90,7 @@ set (CPPFILES
Fl_Table.cxx
Fl_Table_Row.cxx
Fl_Tabs.cxx
Fl_Terminal.cxx
Fl_Text_Buffer.cxx
Fl_Text_Display.cxx
Fl_Text_Editor.cxx
+3508
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -94,6 +94,7 @@ CPPFILES = \
Fl_Table.cxx \
Fl_Table_Row.cxx \
Fl_Tabs.cxx \
Fl_Terminal.cxx \
Fl_Text_Buffer.cxx \
Fl_Text_Display.cxx \
Fl_Text_Editor.cxx \
File diff suppressed because it is too large Load Diff
+22
View File
@@ -3878,6 +3878,28 @@ Fl_Tabs.o: ../FL/fl_utf8.h
Fl_Tabs.o: ../FL/Fl_Widget.H
Fl_Tabs.o: ../FL/Fl_Window.H
Fl_Tabs.o: ../FL/platform_types.h
Fl_Terminal.o: ../FL/Enumerations.H
Fl_Terminal.o: ../FL/Fl.H
Fl_Terminal.o: ../FL/fl_attr.h
Fl_Terminal.o: ../FL/Fl_Bitmap.H
Fl_Terminal.o: ../FL/Fl_Cairo.H
Fl_Terminal.o: ../FL/fl_casts.H
Fl_Terminal.o: ../FL/fl_config.h
Fl_Terminal.o: ../FL/fl_draw.H
Fl_Terminal.o: ../FL/Fl_Export.H
Fl_Terminal.o: ../FL/Fl_Group.H
Fl_Terminal.o: ../FL/Fl_Image.H
Fl_Terminal.o: ../FL/Fl_Rect.H
Fl_Terminal.o: ../FL/Fl_Scrollbar.H
Fl_Terminal.o: ../FL/Fl_Slider.H
Fl_Terminal.o: ../FL/fl_string_functions.h
Fl_Terminal.o: ../FL/Fl_Terminal.H
Fl_Terminal.o: ../FL/fl_types.h
Fl_Terminal.o: ../FL/fl_utf8.h
Fl_Terminal.o: ../FL/Fl_Valuator.H
Fl_Terminal.o: ../FL/Fl_Widget.H
Fl_Terminal.o: ../FL/Fl_Window.H
Fl_Terminal.o: ../FL/platform_types.h
Fl_Text_Buffer.o: ../config.h
Fl_Text_Buffer.o: ../FL/Enumerations.H
Fl_Text_Buffer.o: ../FL/Fl.H
+3
View File
@@ -103,6 +103,7 @@ sudoku
symbols
table
tabs
terminal
threads
tile
tiled_image
@@ -141,6 +142,8 @@ resize.cxx
resize.h
tabs.cxx
tabs.h
terminal.cxx
terminal.h
tree.cxx
tree.h
valuators.cxx
+2 -1
View File
@@ -157,6 +157,7 @@ CREATE_EXAMPLE (sudoku "sudoku.cxx;sudoku.plist;sudoku.icns;sudoku.rc" "fltk_ima
CREATE_EXAMPLE (symbols symbols.cxx fltk)
CREATE_EXAMPLE (tabs tabs.fl fltk)
CREATE_EXAMPLE (table table.cxx fltk)
CREATE_EXAMPLE (terminal terminal.fl fltk)
CREATE_EXAMPLE (threads threads.cxx fltk)
CREATE_EXAMPLE (tile tile.cxx fltk)
CREATE_EXAMPLE (tiled_image tiled_image.cxx fltk)
@@ -185,7 +186,7 @@ SET (UNITTEST_SRCS
unittest_viewport.cxx
unittest_scrollbarsize.cxx
unittest_schemes.cxx
unittest_simple_terminal.cxx
unittest_terminal.cxx
)
CREATE_EXAMPLE (unittests "${UNITTEST_SRCS}" "${GLDEMO_LIBS}")
+7 -1
View File
@@ -30,7 +30,7 @@ CPPUNITTEST = \
unittest_viewport.cxx \
unittest_scrollbarsize.cxx \
unittest_schemes.cxx \
unittest_simple_terminal.cxx \
unittest_terminal.cxx \
unittest_core.cxx
OBJUNITTEST = \
@@ -125,6 +125,7 @@ CPPFILES =\
symbols.cxx \
table.cxx \
tabs.cxx \
terminal.cxx \
threads.cxx \
tile.cxx \
tiled_image.cxx \
@@ -206,6 +207,7 @@ ALL = \
sudoku$(EXEEXT) \
symbols$(EXEEXT) \
table$(EXEEXT) \
terminal$(EXEEXT) \
$(THREADS) \
tile$(EXEEXT) \
tiled_image$(EXEEXT) \
@@ -268,6 +270,7 @@ clean:
$(RM) radio.cxx radio.h
$(RM) resize.cxx resize.h
$(RM) tabs.cxx tabs.h
$(RM) terminal.cxx terminal.h
$(RM) tree.cxx tree.h
$(RM) valuators.cxx valuators.h
@@ -618,6 +621,9 @@ table$(EXEEXT): table.o
tabs$(EXEEXT): tabs.o
tabs.cxx: tabs.fl ../fluid/fluid$(EXEEXT)
terminal$(EXEEXT): terminal.o
terminal.cxx: terminal.fl ../fluid/fluid$(EXEEXT)
threads$(EXEEXT): threads.o
# This ensures that we have this dependency even if threads are not
# enabled in the current tree...
+3 -3
View File
@@ -64,7 +64,7 @@ That was a blank line above this.
#include <FL/Fl_Button.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <FL/fl_ask.H>
#include <stdio.h>
#include <string.h>
@@ -81,7 +81,7 @@ Fl_Button *top,
Fl_Choice *btype;
Fl_Choice *wtype;
Fl_Int_Input *field;
Fl_Simple_Terminal *tty = 0;
Fl_Terminal *tty = 0;
typedef struct {
const char *name;
@@ -219,7 +219,7 @@ int main(int argc, char **argv) {
wtype->value(4); // FL_WHEN_RELEASE_ALWAYS is Fl_Browser's default
// Small terminal window for callback messages
tty = new Fl_Simple_Terminal(0,400,720,120);
tty = new Fl_Terminal(0,400,720,120);
tty->history_lines(50);
tty->ansi(true);
+4 -4
View File
@@ -26,7 +26,7 @@
#include <FL/Fl_Color_Chooser.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Hor_Value_Slider.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <FL/fl_draw.H>
#include <math.h>
@@ -93,7 +93,7 @@ public:
// global variables
Fl_Simple_Terminal *term = 0;
Fl_Terminal *term = 0;
double g_lfg; // perceived lightness of foreground color
double g_lbg; // perceived lightness of background color
@@ -428,9 +428,9 @@ int main(int argc, char **argv) {
int ttw = window.w() - 20;
int tth = window.h() - tty - 10;
term = new Fl_Simple_Terminal(ttx, tty, ttw, tth);
term = new Fl_Terminal(ttx, tty, ttw, tth);
term->color(FL_WHITE);
term->textcolor(FL_BLACK);
term->textfgcolor(FL_BLACK);
term->textsize(13);
term->printf("FLTK fl_contrast() test program with different contrast algorithms, version %s\n", version);
+8 -4
View File
@@ -75,7 +75,7 @@
#include <FL/Fl_Button.H>
#include <FL/Fl_Menu_Button.H> // right click popup menu
#include <FL/Fl_Scheme_Choice.H>
#include <FL/Fl_Simple_Terminal.H> // tty
#include <FL/Fl_Terminal.H> // tty
#include <FL/filename.H>
#include <FL/platform.H>
#include <FL/fl_ask.H> // fl_alert()
@@ -102,7 +102,7 @@ void dobut(Fl_Widget *, long);
Fl_Double_Window *form = 0;
Fl_Group *demogrp = 0;
Fl_Simple_Terminal *tty = 0;
Fl_Terminal *tty = 0;
Fl_Scheme_Choice *scheme_choice = 0;
Fl_Button *but[9];
Fl_Button *exit_button;
@@ -231,11 +231,15 @@ void create_the_forms() {
demogrp->end();
// Small debug terminal window parented to window, not demogrp
tty = new Fl_Simple_Terminal(10, FORM_H - 1, FORM_W - 20, 1);
// To show/hide debug terminal, use demo's right-click menu
//
tty = new Fl_Terminal(10, FORM_H - 1, FORM_W - 20, 1);
tty->history_lines(50);
tty->display_rows(2); // make display at least 2 rows high, even if not seen
tty->display_columns(100); // make display at least 100 cols wide, even if not seen
tty->ansi(true);
tty->hide();
tty->textsize(10);
tty->textsize(12);
// End window
form->end();
+4 -3
View File
@@ -36,7 +36,7 @@
#include <FL/Fl_PNM_Image.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <stdio.h>
#include <string.h>
@@ -55,7 +55,7 @@ Fl_Input *filter;
Fl_File_Browser *files;
Fl_File_Chooser *fc;
Fl_Shared_Image *image = 0;
Fl_Simple_Terminal *tty = 0;
Fl_Terminal *tty = 0;
// for choosing extra groups
Fl_Choice *ch_extra;
@@ -109,8 +109,9 @@ main(int argc, // I - Number of command-line arguments
// Make the main window...
window = new Fl_Double_Window(400, 215+TERMINAL_HEIGHT, "File Chooser Test");
tty = new Fl_Simple_Terminal(0,215,window->w(),TERMINAL_HEIGHT);
tty = new Fl_Terminal(0,215,window->w(),TERMINAL_HEIGHT);
tty->ansi(true);
tty->display_columns(100); // at least 100 cols wide, even tho actual window smaller
// Group: limit resizing to filter input (not browse button)
grp = new Fl_Group(0,10,400,25);
+3 -3
View File
@@ -26,12 +26,12 @@
#include <FL/Fl_Toggle_Button.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Color_Chooser.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#define TERMINAL_HEIGHT 120
// Globals
Fl_Simple_Terminal *G_tty = 0;
Fl_Terminal *G_tty = 0;
void cb(Fl_Widget *ob) {
G_tty->printf("Callback for %s '%s'\n",ob->label(),((Fl_Input*)ob)->value());
@@ -91,7 +91,7 @@ int main(int argc, char **argv) {
Fl::args(argc, argv);
Fl::get_system_colors();
Fl_Window *window = new Fl_Window(400,420+TERMINAL_HEIGHT);
G_tty = new Fl_Simple_Terminal(0,420,window->w(),TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,420,window->w(),TERMINAL_HEIGHT);
int y = 10;
input[0] = new Fl_Input(70,y,300,30,"Normal:"); y += 35;
+3 -3
View File
@@ -18,12 +18,12 @@
#include <FL/Fl_Button.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Input_Choice.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#define TERMINAL_HEIGHT 120
// Globals
Fl_Simple_Terminal *G_tty = 0;
Fl_Terminal *G_tty = 0;
void buttcb(Fl_Widget*,void*data) {
Fl_Input_Choice *in=(Fl_Input_Choice *)data;
@@ -44,7 +44,7 @@ void input_choice_cb(Fl_Widget*,void*data) {
int main(int argc, char **argv) {
Fl_Double_Window win(300, 200+TERMINAL_HEIGHT);
G_tty = new Fl_Simple_Terminal(0,200,win.w(),TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,200,win.w(),TERMINAL_HEIGHT);
Fl_Input_Choice in(40,40,100,28,"Test");
in.callback(input_choice_cb, (void*)&in);
+33 -44
View File
@@ -222,7 +222,7 @@ browser.o: ../FL/Fl_Rect.H
browser.o: ../FL/Fl_RGB_Image.H
browser.o: ../FL/Fl_Scrollbar.H
browser.o: ../FL/Fl_Select_Browser.H
browser.o: ../FL/Fl_Simple_Terminal.H
browser.o: ../FL/Fl_Terminal.H
browser.o: ../FL/Fl_Slider.H
browser.o: ../FL/Fl_Text_Buffer.H
browser.o: ../FL/Fl_Text_Display.H
@@ -507,7 +507,7 @@ contrast.o: ../FL/Fl_Return_Button.H
contrast.o: ../FL/Fl_RGB_Image.H
contrast.o: ../FL/Fl_Round_Button.H
contrast.o: ../FL/Fl_Scrollbar.H
contrast.o: ../FL/Fl_Simple_Terminal.H
contrast.o: ../FL/Fl_Terminal.H
contrast.o: ../FL/Fl_Slider.H
contrast.o: ../FL/Fl_Text_Buffer.H
contrast.o: ../FL/Fl_Text_Display.H
@@ -693,7 +693,7 @@ demo.o: ../FL/Fl_RGB_Image.H
demo.o: ../FL/Fl_Scheme.H
demo.o: ../FL/Fl_Scheme_Choice.H
demo.o: ../FL/Fl_Scrollbar.H
demo.o: ../FL/Fl_Simple_Terminal.H
demo.o: ../FL/Fl_Terminal.H
demo.o: ../FL/Fl_Slider.H
demo.o: ../FL/Fl_Text_Buffer.H
demo.o: ../FL/Fl_Text_Display.H
@@ -911,7 +911,7 @@ file_chooser.o: ../FL/Fl_Return_Button.H
file_chooser.o: ../FL/Fl_RGB_Image.H
file_chooser.o: ../FL/Fl_Scrollbar.H
file_chooser.o: ../FL/Fl_Shared_Image.H
file_chooser.o: ../FL/Fl_Simple_Terminal.H
file_chooser.o: ../FL/Fl_Terminal.H
file_chooser.o: ../FL/Fl_Slider.H
file_chooser.o: ../FL/Fl_Text_Buffer.H
file_chooser.o: ../FL/Fl_Text_Display.H
@@ -1409,7 +1409,7 @@ input.o: ../FL/Fl_Return_Button.H
input.o: ../FL/Fl_RGB_Image.H
input.o: ../FL/Fl_Scrollbar.H
input.o: ../FL/Fl_Secret_Input.H
input.o: ../FL/Fl_Simple_Terminal.H
input.o: ../FL/Fl_Terminal.H
input.o: ../FL/Fl_Slider.H
input.o: ../FL/Fl_Text_Buffer.H
input.o: ../FL/Fl_Text_Display.H
@@ -1448,7 +1448,7 @@ input_choice.o: ../FL/Fl_Preferences.H
input_choice.o: ../FL/Fl_Rect.H
input_choice.o: ../FL/Fl_RGB_Image.H
input_choice.o: ../FL/Fl_Scrollbar.H
input_choice.o: ../FL/Fl_Simple_Terminal.H
input_choice.o: ../FL/Fl_Terminal.H
input_choice.o: ../FL/Fl_Slider.H
input_choice.o: ../FL/Fl_Text_Buffer.H
input_choice.o: ../FL/Fl_Text_Display.H
@@ -1626,7 +1626,7 @@ menubar.o: ../FL/Fl_RGB_Image.H
menubar.o: ../FL/Fl_Scheme.H
menubar.o: ../FL/Fl_Scheme_Choice.H
menubar.o: ../FL/Fl_Scrollbar.H
menubar.o: ../FL/Fl_Simple_Terminal.H
menubar.o: ../FL/Fl_Terminal.H
menubar.o: ../FL/Fl_Slider.H
menubar.o: ../FL/fl_string_functions.h
menubar.o: ../FL/Fl_Sys_Menu_Bar.H
@@ -1719,7 +1719,7 @@ native-filechooser.o: ../FL/Fl_Rect.H
native-filechooser.o: ../FL/Fl_Return_Button.H
native-filechooser.o: ../FL/Fl_RGB_Image.H
native-filechooser.o: ../FL/Fl_Scrollbar.H
native-filechooser.o: ../FL/Fl_Simple_Terminal.H
native-filechooser.o: ../FL/Fl_Terminal.H
native-filechooser.o: ../FL/Fl_Slider.H
native-filechooser.o: ../FL/Fl_Text_Buffer.H
native-filechooser.o: ../FL/Fl_Text_Display.H
@@ -2446,7 +2446,7 @@ table.o: ../FL/Fl_Rect.H
table.o: ../FL/Fl_RGB_Image.H
table.o: ../FL/Fl_Scroll.H
table.o: ../FL/Fl_Scrollbar.H
table.o: ../FL/Fl_Simple_Terminal.H
table.o: ../FL/Fl_Terminal.H
table.o: ../FL/Fl_Slider.H
table.o: ../FL/Fl_Table.H
table.o: ../FL/Fl_Table_Row.H
@@ -2595,7 +2595,7 @@ tree.o: ../FL/Fl_Rect.H
tree.o: ../FL/Fl_Return_Button.H
tree.o: ../FL/Fl_RGB_Image.H
tree.o: ../FL/Fl_Scrollbar.H
tree.o: ../FL/Fl_Simple_Terminal.H
tree.o: ../FL/Fl_Terminal.H
tree.o: ../FL/Fl_Slider.H
tree.o: ../FL/Fl_Text_Buffer.H
tree.o: ../FL/Fl_Text_Display.H
@@ -2660,7 +2660,7 @@ unittests.o: ../FL/Fl_Preferences.H
unittests.o: ../FL/Fl_Rect.H
unittests.o: ../FL/Fl_RGB_Image.H
unittests.o: ../FL/Fl_Scrollbar.H
unittests.o: ../FL/Fl_Simple_Terminal.H
unittests.o: ../FL/Fl_Terminal.H
unittests.o: ../FL/Fl_Slider.H
unittests.o: ../FL/fl_string_functions.h
unittests.o: ../FL/Fl_Text_Buffer.H
@@ -2788,7 +2788,7 @@ unittest_core.o: ../FL/Fl_Preferences.H
unittest_core.o: ../FL/Fl_Rect.H
unittest_core.o: ../FL/Fl_RGB_Image.H
unittest_core.o: ../FL/Fl_Scrollbar.H
unittest_core.o: ../FL/Fl_Simple_Terminal.H
unittest_core.o: ../FL/Fl_Terminal.H
unittest_core.o: ../FL/Fl_Slider.H
unittest_core.o: ../FL/Fl_Text_Buffer.H
unittest_core.o: ../FL/Fl_Text_Display.H
@@ -2980,37 +2980,26 @@ unittest_scrollbarsize.o: ../FL/Fl_Widget.H
unittest_scrollbarsize.o: ../FL/Fl_Window.H
unittest_scrollbarsize.o: ../FL/platform_types.h
unittest_scrollbarsize.o: unittests.h
unittest_simple_terminal.o: ../FL/Enumerations.H
unittest_simple_terminal.o: ../FL/Fl.H
unittest_simple_terminal.o: ../FL/fl_attr.h
unittest_simple_terminal.o: ../FL/Fl_Bitmap.H
unittest_simple_terminal.o: ../FL/Fl_Cairo.H
unittest_simple_terminal.o: ../FL/fl_casts.H
unittest_simple_terminal.o: ../FL/fl_config.h
unittest_simple_terminal.o: ../FL/Fl_Device.H
unittest_simple_terminal.o: ../FL/Fl_Double_Window.H
unittest_simple_terminal.o: ../FL/fl_draw.H
unittest_simple_terminal.o: ../FL/Fl_Export.H
unittest_simple_terminal.o: ../FL/Fl_Graphics_Driver.H
unittest_simple_terminal.o: ../FL/Fl_Group.H
unittest_simple_terminal.o: ../FL/Fl_Image.H
unittest_simple_terminal.o: ../FL/Fl_Pixmap.H
unittest_simple_terminal.o: ../FL/Fl_Plugin.H
unittest_simple_terminal.o: ../FL/Fl_Preferences.H
unittest_simple_terminal.o: ../FL/Fl_Rect.H
unittest_simple_terminal.o: ../FL/Fl_RGB_Image.H
unittest_simple_terminal.o: ../FL/Fl_Scrollbar.H
unittest_simple_terminal.o: ../FL/Fl_Simple_Terminal.H
unittest_simple_terminal.o: ../FL/Fl_Slider.H
unittest_simple_terminal.o: ../FL/Fl_Text_Buffer.H
unittest_simple_terminal.o: ../FL/Fl_Text_Display.H
unittest_simple_terminal.o: ../FL/fl_types.h
unittest_simple_terminal.o: ../FL/fl_utf8.h
unittest_simple_terminal.o: ../FL/Fl_Valuator.H
unittest_simple_terminal.o: ../FL/Fl_Widget.H
unittest_simple_terminal.o: ../FL/Fl_Window.H
unittest_simple_terminal.o: ../FL/platform_types.h
unittest_simple_terminal.o: unittests.h
unittest_terminal.o: ../FL/Enumerations.H
unittest_terminal.o: ../FL/Fl.H
unittest_terminal.o: ../FL/fl_attr.h
unittest_terminal.o: ../FL/Fl_Bitmap.H
unittest_terminal.o: ../FL/Fl_Cairo.H
unittest_terminal.o: ../FL/fl_casts.H
unittest_terminal.o: ../FL/fl_config.h
unittest_terminal.o: ../FL/Fl_Double_Window.H
unittest_terminal.o: ../FL/Fl_Export.H
unittest_terminal.o: ../FL/Fl_Group.H
unittest_terminal.o: ../FL/Fl_Image.H
unittest_terminal.o: ../FL/Fl_Rect.H
unittest_terminal.o: ../FL/Fl_Scrollbar.H
unittest_terminal.o: ../FL/Fl_Terminal.H
unittest_terminal.o: ../FL/fl_types.h
unittest_terminal.o: ../FL/fl_utf8.h
unittest_terminal.o: ../FL/Fl_Widget.H
unittest_terminal.o: ../FL/Fl_Window.H
unittest_terminal.o: ../FL/platform_types.h
unittest_terminal.o: unittests.h
unittest_symbol.o: ../FL/Enumerations.H
unittest_symbol.o: ../FL/Fl.H
unittest_symbol.o: ../FL/fl_attr.h
@@ -3203,7 +3192,7 @@ valuators.o: ../FL/Fl_Repeat_Button.H
valuators.o: ../FL/Fl_RGB_Image.H
valuators.o: ../FL/Fl_Roller.H
valuators.o: ../FL/Fl_Scrollbar.H
valuators.o: ../FL/Fl_Simple_Terminal.H
valuators.o: ../FL/Fl_Terminal.H
valuators.o: ../FL/Fl_Slider.H
valuators.o: ../FL/Fl_Spinner.H
valuators.o: ../FL/Fl_Text_Buffer.H
+3 -3
View File
@@ -31,14 +31,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <FL/fl_draw.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <FL/fl_ask.H>
#include <FL/fl_string_functions.h>
#define TERMINAL_HEIGHT 120
// Globals
Fl_Simple_Terminal *G_tty = 0;
Fl_Terminal *G_tty = 0;
void window_cb(Fl_Widget* w, void*) {
puts("window callback called"); // end of program, so stdout instead of G_tty
@@ -235,7 +235,7 @@ int main(int argc, char **argv) {
Fl_Scheme_Choice scheme_choice(300, 50, 100, 25, "&scheme");
G_tty = new Fl_Simple_Terminal(0,400,WIDTH,TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,400,WIDTH,TERMINAL_HEIGHT);
window.callback(window_cb);
Fl_Menu_Bar menubar(0,0,WIDTH,30); menubar.menu(menutable);
+3 -3
View File
@@ -25,14 +25,14 @@
#include <FL/Fl_Box.H>
#include <FL/Fl_Native_File_Chooser.H>
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#define TERMINAL_HEIGHT 120
// GLOBALS
Fl_Input *G_filename = NULL;
Fl_Multiline_Input *G_filter = NULL;
Fl_Simple_Terminal *G_tty = NULL;
Fl_Terminal *G_tty = NULL;
void PickFile_CB(Fl_Widget*, void*) {
// Create native chooser
@@ -106,7 +106,7 @@ int main(int argc, char **argv) {
win->size_range(win->w(), win->h(), 0, 0);
win->begin();
{
G_tty = new Fl_Simple_Terminal(0,400,win->w(),TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,400,win->w(),TERMINAL_HEIGHT);
int x = 80, y = 10;
G_filename = new Fl_Input(x, y, win->w()-80-10, 25, "Filename");
+3 -3
View File
@@ -10,7 +10,7 @@
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include <FL/Fl_Table_Row.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <stdio.h>
#include <string.h>
@@ -19,7 +19,7 @@
#define TERMINAL_HEIGHT 120
// Globals
Fl_Simple_Terminal *G_tty = 0;
Fl_Terminal *G_tty = 0;
// Simple demonstration class to derive from Fl_Table_Row
class DemoTable : public Fl_Table_Row
@@ -349,7 +349,7 @@ int main(int argc, char **argv)
{
Fl_Window win(900, 730+TERMINAL_HEIGHT);
G_tty = new Fl_Simple_Terminal(0,730,win.w(),TERMINAL_HEIGHT);
G_tty = new Fl_Terminal(0,730,win.w(),TERMINAL_HEIGHT);
G_table = new DemoTable(20, 20, 860, 460, "Demo");
G_table->selection_color(FL_YELLOW);
+1972
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -38,7 +38,7 @@ decl {\#include <FL/Fl_Color_Chooser.H>} {public global
decl {\#include <FL/Fl_Text_Display.H>} {public global
}
decl {\#include <FL/Fl_Simple_Terminal.H>} {public global
decl {\#include <FL/Fl_Terminal.H>} {public global
}
decl {int G_cb_counter = 0;} {
@@ -1749,7 +1749,7 @@ helpwin->show();}
Fl_Box tty {
label label
xywh {16 571 1014 149} box DOWN_BOX color 0
class Fl_Simple_Terminal
class Fl_Terminal
}
}
code {// Initialize Tree
+4 -3
View File
@@ -18,8 +18,9 @@
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include "../src/Fl_String.H"
#include <FL/Fl_Preferences.H>
#include <FL/fl_callback_macros.H>
#include <FL/filename.H>
#include <FL/fl_utf8.h>
@@ -374,7 +375,7 @@ TEST(Fl_Callback_Macros, FL_INLINE_CALLBACK) {
*/
class Ut_Core_Test : public Fl_Group {
Fl_Simple_Terminal *tty;
Fl_Terminal *tty;
bool suite_ran_;
public:
@@ -390,7 +391,7 @@ public:
tty(NULL),
suite_ran_(false)
{
tty = new Fl_Simple_Terminal(x+4, y+4, w-8, h-8, "Unittest Log");
tty = new Fl_Terminal(x+4, y+4, w-8, h-8, "Unittest Log");
tty->ansi(true);
end();
Ut_Suite::tty = tty;
-121
View File
@@ -1,121 +0,0 @@
//
// Unit tests for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#include "unittests.h"
#include <time.h>
#include <FL/Fl_Group.H>
#include <FL/Fl_Simple_Terminal.H>
//
//------- test the Fl_Simple_Terminal drawing capabilities ----------
//
class Ut_Simple_Terminal_Test : public Fl_Group {
Fl_Simple_Terminal *tty1;
Fl_Simple_Terminal *tty2;
Fl_Simple_Terminal *tty3;
void ansi_test_pattern(Fl_Simple_Terminal *tty) {
tty->append("\033[30mBlack Courier 14\033[0m Normal text\n"
"\033[31mRed Courier 14\033[0m Normal text\n"
"\033[32mGreen Courier 14\033[0m Normal text\n"
"\033[33mYellow Courier 14\033[0m Normal text\n"
"\033[34mBlue Courier 14\033[0m Normal text\n"
"\033[35mMagenta Courier 14\033[0m Normal text\n"
"\033[36mCyan Courier 14\033[0m Normal text\n"
"\033[37mWhite Courier 14\033[0m Normal text\n"
"\033[40mBright Black Courier 14\033[0m Normal text\n"
"\033[41mBright Red Courier 14\033[0m Normal text\n"
"\033[42mBright Green Courier 14\033[0m Normal text\n"
"\033[43mBright Yellow Courier 14\033[0m Normal text\n"
"\033[44mBright Blue Courier 14\033[0m Normal text\n"
"\033[45mBright Magenta Courier 14\033[0m Normal text\n"
"\033[46mBright Cyan Courier 14\033[0m Normal text\n"
"\033[47mBright White Courier 14\033[0m Normal text\n"
"\n"
"\033[31mRed\033[32mGreen\033[33mYellow\033[34mBlue\033[35mMagenta\033[36mCyan\033[37mWhite\033[0m - "
"\033[31mX\033[32mX\033[33mX\033[34mX\033[35mX\033[36mX\033[37mX\033[0m\n"
"\033[41mRed\033[42mGreen\033[43mYellow\033[44mBlue\033[45mMagenta\033[46mCyan\033[47mWhite\033[0m - "
"\033[41mX\033[42mX\033[43mX\033[44mX\033[45mX\033[46mX\033[47mX\033[0m\n");
}
void gray_test_pattern(Fl_Simple_Terminal *tty) {
tty->append("Grayscale Test Pattern\n"
"--------------------------\n"
"\033[0m 100% white Courier 14\n"
"\033[1m 90% white Courier 14\n"
"\033[2m 80% white Courier 14\n"
"\033[3m 70% white Courier 14\n"
"\033[4m 60% white Courier 14\n"
"\033[5m 50% white Courier 14\n"
"\033[6m 40% white Courier 14\n"
"\033[7m 30% white Courier 14\n"
"\033[8m 20% white Courier 14\n"
"\033[9m 10% white Courier 14\n"
"\033[0m");
}
static void date_timer_cb(void *data) {
Fl_Simple_Terminal *tty = (Fl_Simple_Terminal*)data;
time_t lt = time(NULL);
tty->printf("The time and date is now: %s", ctime(&lt));
Fl::repeat_timeout(3.0, date_timer_cb, data);
}
public:
static Fl_Widget *create() {
return new Ut_Simple_Terminal_Test(UT_TESTAREA_X, UT_TESTAREA_Y, UT_TESTAREA_W, UT_TESTAREA_H);
}
Ut_Simple_Terminal_Test(int x, int y, int w, int h)
: Fl_Group(x, y, w, h) {
static Fl_Text_Display::Style_Table_Entry my_stable[] = { // 10 entry grayscale
// Font Color Font Face Font Size ANSI Sequence
// ---------- ---------------- --------- -------------
{ 0xffffff00, FL_COURIER_BOLD, 14 }, // "\033[0m" 0 white 100%
{ 0xe6e6e600, FL_COURIER_BOLD, 14 }, // "\033[1m" 1 white 90%
{ 0xcccccc00, FL_COURIER_BOLD, 14 }, // "\033[2m" 2 white 80%
{ 0xb3b3b300, FL_COURIER_BOLD, 14 }, // "\033[3m" 3 white 70%
{ 0x99999900, FL_COURIER_BOLD, 14 }, // "\033[4m" 4 white 60%
{ 0x80808000, FL_COURIER_BOLD, 14 }, // "\033[5m" 5 white 50% "\033[0m"
{ 0x66666600, FL_COURIER_BOLD, 14 }, // "\033[6m" 6 white 40%
{ 0x4d4d4d00, FL_COURIER_BOLD, 14 }, // "\033[7m" 7 white 30%
{ 0x33333300, FL_COURIER_BOLD, 14 }, // "\033[8m" 8 white 20%
{ 0x1a1a1a00, FL_COURIER_BOLD, 14 }, // "\033[9m" 9 white 10%
};
int tty_h = (int)(h/3.5);
int tty_y1 = y+(tty_h*0)+20;
int tty_y2 = y+(tty_h*1)+40;
int tty_y3 = y+(tty_h*2)+60;
// TTY1
tty1 = new Fl_Simple_Terminal(x, tty_y1, w, tty_h,"Tty 1: ANSI off");
tty1->ansi(false);
Fl::add_timeout(0.5, date_timer_cb, (void*)tty1);
// TTY2
tty2 = new Fl_Simple_Terminal(x, tty_y2, w, tty_h,"Tty 2: ANSI on");
tty2->ansi(true);
ansi_test_pattern(tty2);
Fl::add_timeout(0.5, date_timer_cb, (void*)tty2);
// TTY3
tty3 = new Fl_Simple_Terminal(x, tty_y3, w, tty_h, "Tty 3: Grayscale Style Table");
tty3->style_table(my_stable, sizeof(my_stable), 0);
tty3->ansi(true);
gray_test_pattern(tty3);
Fl::add_timeout(0.5, date_timer_cb, (void*)tty3);
end();
}
};
UnitTest simple_terminal(UT_TEST_SIMPLE_TERMINAL, "Simple Terminal", Ut_Simple_Terminal_Test::create);
+98
View File
@@ -0,0 +1,98 @@
//
// Unit tests for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#include "unittests.h"
#include <time.h>
#include <FL/Fl_Group.H>
#include <FL/Fl_Terminal.H>
//
//------- test the Fl_Terminal drawing capabilities ----------
//
class Ut_Terminal_Test : public Fl_Group {
Fl_Terminal *tty1;
Fl_Terminal *tty2;
void ansi_test_pattern(Fl_Terminal *tty) {
tty->append("\033[30mBlack Courier 14\033[0m Normal text\n"
"\033[31mRed Courier 14\033[0m Normal text\n"
"\033[32mGreen Courier 14\033[0m Normal text\n"
"\033[33mYellow Courier 14\033[0m Normal text\n"
"\033[34mBlue Courier 14\033[0m Normal text\n"
"\033[35mMagenta Courier 14\033[0m Normal text\n"
"\033[36mCyan Courier 14\033[0m Normal text\n"
"\033[37mWhite Courier 14\033[0m Normal text\n"
"\033[1;30mBright Black Courier 14\033[0m Normal text\n"
"\033[1;31mBright Red Courier 14\033[0m Normal text\n"
"\033[1;32mBright Green Courier 14\033[0m Normal text\n"
"\033[1;33mBright Yellow Courier 14\033[0m Normal text\n"
"\033[1;34mBright Blue Courier 14\033[0m Normal text\n"
"\033[1;35mBright Magenta Courier 14\033[0m Normal text\n"
"\033[1;36mBright Cyan Courier 14\033[0m Normal text\n"
"\033[1;37mBright White Courier 14\033[0m Normal text\n"
"\n"
"\033[31mRed\033[32mGreen\033[33mYellow\033[34mBlue\033[35mMagenta\033[36mCyan\033[37mWhite\033[0m - "
"\033[31mX\033[32mX\033[33mX\033[34mX\033[35mX\033[36mX\033[37mX\033[0m\n"
"\033[1;31mRed\033[1;32mGreen\033[1;33mYellow\033[34mBlue\033[35mMagenta\033[36mCyan\033[1;37mWhite\033[1;0m - "
"\033[1;31mX\033[1;32mX\033[1;33mX\033[1;34mX\033[1;35mX\033[1;36mX\033[1;37mX\033[0m\n");
}
void gray_test_pattern(Fl_Terminal *tty) {
tty->append("Grayscale Test Pattern\n"
"--------------------------\n"
"\033[38;2;255;255;255m 100% white Courier 14\n" // ESC xterm codes for setting r;g;b colors
"\033[38;2;230;230;230m 90% white Courier 14\n"
"\033[38;2;205;205;205m 80% white Courier 14\n"
"\033[38;2;179;179;179m 70% white Courier 14\n"
"\033[38;2;154;154;154m 60% white Courier 14\n"
"\033[38;2;128;128;128m 50% white Courier 14\n"
"\033[38;2;102;102;102m 40% white Courier 14\n"
"\033[38;2;77;77;77m" " 30% white Courier 14\n"
"\033[38;2;51;51;51m" " 20% white Courier 14\n"
"\033[38;2;26;26;26m" " 10% white Courier 14\n"
"\033[38;2;0;0;0m" " 0% white Courier 14\n"
"\033[0m");
}
static void date_timer_cb(void *data) {
Fl_Terminal *tty = (Fl_Terminal*)data;
time_t lt = time(NULL);
tty->printf("The time and date is now: %s", ctime(&lt));
Fl::repeat_timeout(3.0, date_timer_cb, data);
}
public:
static Fl_Widget *create() {
return new Ut_Terminal_Test(UT_TESTAREA_X, UT_TESTAREA_Y, UT_TESTAREA_W, UT_TESTAREA_H);
}
Ut_Terminal_Test(int x, int y, int w, int h)
: Fl_Group(x, y, w, h) {
int tty_h = (int)(h/2.25+.5);
int tty_y1 = y+(tty_h*0)+20;
int tty_y2 = y+(tty_h*1)+40;
// TTY1
tty1 = new Fl_Terminal(x, tty_y1, w, tty_h,"Tty 1: Colors");
ansi_test_pattern(tty1);
Fl::add_timeout(0.5, date_timer_cb, (void*)tty1);
// TTY2
tty2 = new Fl_Terminal(x, tty_y2, w, tty_h,"Tty 2: Grayscale");
gray_test_pattern(tty2);
Fl::add_timeout(0.5, date_timer_cb, (void*)tty2);
end();
}
};
UnitTest simple_terminal(UT_TEST_SIMPLE_TERMINAL, "Terminal", Ut_Terminal_Test::create);
+2 -2
View File
@@ -29,7 +29,7 @@
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <FL/fl_draw.H> // fl_text_extents()
@@ -181,7 +181,7 @@ int Ut_Suite::num_failed_ = 0;
const char *Ut_Suite::red = "\033[31m";
const char *Ut_Suite::green = "\033[32m";
const char *Ut_Suite::normal = "\033[0m";
Fl_Simple_Terminal *Ut_Suite::tty = NULL;
Fl_Terminal *Ut_Suite::tty = NULL;
/** Switch the user of color escape sequnces in the log text. */
void Ut_Suite::color(int v) {
+2 -2
View File
@@ -22,7 +22,7 @@
#include <stdarg.h>
class Fl_Simple_Terminal;
class Fl_Terminal;
// WINDOW/WIDGET SIZES
const int UT_MAINWIN_W = 700; // main window w()
@@ -153,7 +153,7 @@ public:
static const char *red;
static const char *green;
static const char *normal;
static Fl_Simple_Terminal *tty;
static Fl_Terminal *tty;
};
#define UT_CONCAT_(prefix, suffix) prefix##suffix
+5 -5
View File
@@ -2,7 +2,7 @@
version 1.0400
header_name {.h}
code_name {.cxx}
decl {\#include <FL/Fl_Simple_Terminal.H>} {public global
decl {\#include <FL/Fl_Terminal.H>} {public global
}
Function {} {open
@@ -232,9 +232,9 @@ Function {} {open
xywh {460 385 110 115} box BORDER_FRAME color 0 selection_color 0 labelsize 11 align 128
}
Fl_Box tty {selected
xywh {10 513 560 117} color 0
xywh {10 513 560 117} box DOWN_BOX color 0
code0 {o->ansi(true);}
class Fl_Simple_Terminal
class Fl_Terminal
}
}
}
@@ -242,7 +242,7 @@ Function {} {open
Function {callback(Fl_Widget* o, void*)} {open return_type void
} {
code {const char *name = (const char*)(o->user_data() ? o->user_data() : "???");
tty->printf("callback(): %s value() = \\033[2m%g\\033[0m\\n",
tty->printf("callback(): %s value() = \\033[1m%g\\033[0m\\n",
name, ((Fl_Valuator*)o)->value());} {}
}
@@ -250,6 +250,6 @@ Function {callback_spinner(Fl_Widget* o, void*)} {
comment {Spinner doesn't derive from Fl_Valuator..} open return_type void
} {
code {const char *name = (const char*)(o->user_data() ? o->user_data() : "???");
tty->printf("callback(): %s value() = \\033[2m%g\\033[0m\\n",
tty->printf("callback(): %s value() = \\033[1m%g\\033[0m\\n",
name, ((Fl_Spinner*)o)->value());} {}
}