Library for creating terminal applications with text-based widgets

Overview

FINAL CUT

Library for creating terminal applications with text-based widgets

FINAL CUT is a C++ class library and widget toolkit with full mouse support for creating a text-based user interface. The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.

The structure of the Qt framework was originally the inspiration for the C++ class design of FINAL CUT. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.

Building and code analysis

Badge
Latest release Latest Release
License license
Class Reference documented
ARM build ARM build
FreeBSD build FreeBSD build
NetBSD build NetBSD build
OpenBSD build OpenBSD build
macOS build macOS build
Cygwin build Cygwin build
Solaris build Solaris build
CodeQL analysis CodeQL analysis
LGTM Language grade: C/C++
Coverity Scan Coverity Scan Status
SonarCloud Quality gate
CodeFactor CodeFactor

Installation

> git clone git://github.com/gansm/finalcut.git
> cd finalcut
> autoreconf --install --force
> ./configure --prefix=/usr
> make
> su -c "make install"

Supported platforms

  • Linux
  • FreeBSD
  • NetBSD
  • OpenBSD
  • macOS
  • Cygwin
  • GNU Hurd
  • Solaris

Documentation

See the first steps documentation for information on how to use the library.

Frequently Asked Questions

For general questions about FINAL CUT, likely the answer is already included in the FAQ.

Screenshots

The FFileDialog widget with incremental file name search:

FFileDialog

The FINAL CUT FProgressbar widget:

FProgressbar

Scrollable text in the FTextView widget:

FTextView

The Mandelbrot set example:

Mandelbrot set

FINAL CUT newfont

A graphical text font for X11 and the Linux console.

ui example in newfont mode

Newfont drive symbols:

drive symbols

The calculator example in newfont mode:

calculator

Benchmark

Here you can find a test for measuring the character speed in the terminal.

Virtual terminal

FINAL CUT uses a virtual terminal to print character via an update method on the screen. It provides (as an overlying layer) virtual windows for the realization of window movements. The update methods only transfer differences to the virtual terminal or physical screen.

 print(...)
printf(...)
  │
  │          ╔════════════════════════[ vterm ]════════════════════════╗
  │          ║createVTerm()                                            ║
  │          ║                               ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ║
  │          ║                                                         ║
  │          ║                               │ restoreVTerm(x,y,w,h) │ ║
  │  ┌───────╨────[ vwin ]────────────┐                                ║
  │  │createArea(area)                │      └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ║
  │  │                                │                                ║
  │  │                                │                                ║
  └──┼────────►                  putArea(area) ────►                   ║
     │                                │                                ║
     │                         putArea(x,y,area) ────►                 ║
     │                                │                                ║
     │                   ◄──── getArea(x,y,area)                       ║
     │                                │                                ║
     │                                │                                ║
     │                                │                                ║
     │                resizeArea(area)│                                ║
     └───────╥────────────────────────┘                                ║
             ║                                                         ║
             ║       │                                    resizeVTerm()║
             ╚═══════▼═════════════════════════════════════════════════╝
                     │
                     │   putVTerm()
                     └──────────────────► updateTerminalLine(y)
                       updateTerminal()            │
                                                   ▼
                                           ┌───────────────┐
                                           │ output_buffer │
                                           └───────────────┘
                                                   │
                                                   │ flushOutputBuffer()
                                                   │ and putchar(char)
                                                   ▼
                                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                                           ▌               ▐
                                           ▌    screen     ▐
                                           ▌ ───────────── ▐
                                           ▌ real terminal ▐
                                           ▌               ▐
                                           ▀▀▀▀▀▀▀███▀▀▀▀▀▀▀
                                                  ███
                                               ▀▀▀▀▀▀▀▀▀

Class digramm

    ┌────────────┐1
    │ FTermLinux ├------┐
    └────────────┘      :
  ┌──────────────┐1     :
  │ FTermFreeBSD ├------┐
  └──────────────┘      :
  ┌──────────────┐1     :
  │ FTermOpenBSD ├------┐
  └──────────────┘      :
┌────────────────┐1     :
│ FTermDetection ├------┐
└────────────────┘      :
┌────────────────┐1     :
│ FTermcapQuirks ├------┐
└────────────────┘      :            ┌───────────┐
┌────────────────┐1     :       ┌────┤ FKeyEvent │
│ FTermXTerminal ├------┐       │    └───────────┘
└────────────────┘      :       │    ┌─────────────┐
      ┌──────────┐1     :       ├────┤ FMouseEvent │
      │ FTermcap ├------┐       │    └─────────────┘
      └──────────┘      :       │    ┌─────────────┐
      ┌──────────┐1     :       ├────┤ FWheelEvent │
      │ FTermios ├------┐       │    └─────────────┘
      └──────────┘      :       │    ┌─────────────┐
 ┌───────────────┐1     :       ├────┤ FFocusEvent │
 │ FColorPalette ├------┐       │    └─────────────┘
 └───────────────┘      :       │    ┌─────────────┐
     ┌───────────┐1     :       ├────┤ FAccelEvent │
     │ FOptiMove ├------┐       │    └─────────────┘
     └───────────┘      :       │    ┌──────────────┐
     ┌───────────┐1     :       ├────┤ FResizeEvent │
     │ FOptiAttr ├------┐       │    └──────────────┘
     └───────────┘      :       │    ┌────────────┐
     ┌───────────┐1     :       ├────┤ FShowEvent │
     │ FKeyboard ├------┐       │    └────────────┘
     └───────────┘      :       │    ┌────────────┐
 ┌───────────────┐1     :       ├────┤ FHideEvent │
 │ FMouseControl ├------┐       │    └────────────┘
 └───────────────┘      :       │    ┌─────────────┐
       ┌─────────┐1     :       ├────┤ FCloseEvent │
       │ FSystem ├------┐       │    └─────────────┘
       └─────────┘      :       │    ┌─────────────┐
       ┌─────────┐*     :       ├────┤ FTimerEvent │
       │ FString ├---┐  :       │    └─────────────┘
       └─────────┘   :  :       │    ┌────────────┐1    1┌───────┐
 ┌───────────────┐*  :  :       ├────┤ FUserEvent ├------┤ FData │
 │ FStringStream ├---┐  :       │    └────────────┘      └───────┘
 └───────────────┘   :  :       │        ┌──────┐   ┌─────────┐
        ┌────────┐*  :  :       │        │ FLog │◄──┤ FLogger │
        │ FPoint ├---┐  :       │        └──┬───┘   └─────────┘
        └────────┘   :  :       │           :1
         ┌───────┐*  :  :       │        ┌──┴───────────┐
         │ FRect ├---┐  :       │   ┌────┤ FApplication │
         └───────┘   :  :       │   │    └──────────────┘
         ┌───────┐*  :  :       │   │    ┌────────┐
         │ FSize ├---┐  :       │   ├────┤ FLabel │
         └───────┘   :  :       │   │    └────────┘
                     :1 :1      │   │    ┌───────────┐
                 ┌───┴──┴┐      │   ├────┤ FLineEdit │
                 │ FTerm │      │   │    └───────────┘
                 └───┬───┘      │   │    ┌──────────┐
                     :1         │   ├────┤ FSpinBox │
┌─────────┐   ┌──────┴──────┐   │   │    └──────────┘
│ FOutput │◄──┤ FTermOutput │   │   │    ┌─────────┐
└────┬────┘   └─────────────┘   │   ├────┤ FButton │
     :             ┌────────┐   │   │    └─────────┘
     :1            │ FEvent │◄──┘   │    ┌──────────────┐      ┌──────────────┐
 ┌───┴────┐        └────┬───┘       ├────┤ FButtonGroup │   ┌──┤ FRadioButton │
 │ FVTerm │◄──┐         :1          │    └──────────────┘   │  └──────────────┘
 └────────┘   │    ┌────┴────┐      │    ┌───────────────┐  │  ┌───────────┐
              ├────┤ FWidget │◄─────┼────┤ FToggleButton │◄─┼──┤ FCheckBox │
┌─────────┐   │    └────┬────┘      │    └───────────────┘  │  └───────────┘
│ FObject │◄──┘         :1          │    ┌──────────────┐   │  ┌─────────┐
└─────────┘      ┌──────┴────────┐  ├────┤ FProgressbar │   └──┤ FSwitch │
                 │ FWidgetColors │  │    └──────────────┘      └─────────┘
                 └───────────────┘  │    ┌────────────┐
                                    ├────┤ FScrollbar │
                                    │    └────────────┘
                                    │    ┌───────────┐
                                    ├────┤ FTextView │
                                    │    └───────────┘
                                    │    ┌───────────┐1    1┌──────────────────┐
                                    ├────┤ FComboBox ├------┤ FDropDownListBox │
                                    │    └───────────┘      └──────────────────┘
 ┌──────────────┐1                  │    ┌──────────┐1     *┌──────────────┐1
 │ FVTermBuffer ├-------------------├────┤ FListBox ├-------┤ FListBoxItem ├--┐
 └──────────────┘                   │    └──────────┘       └──────────────┘  :
                                    │   1┌───────────┐1    *┌───────────────┐ :
                                    ├────┤ FListView ├------┤ FListViewItem │ :
                                    │    └───────────┘      └────────┬──────┘ :
                                    │    ┌─────────────┐             :1       :
                                    ├────┤ FScrollView │         ┌───┴───┐1   :
                                    │    └─────────────┘         │ FData ├----┘
                                    │                            └───────┘
                                    │    ┌────────────┐1   *┌────────────┐
                                    │ ┌──┤ FStatusBar ├-----┤ FStatusKey │
                                    │ │  └────────────┘     └────────────┘
                                    │ │
                                    │ ▼                       ┌─────────────┐
                                ┌───┴─┴───┐  ┌─────────┐   ┌──┤ FFileDialog │
                                │ FWindow │◄─┤ FDialog │◄──┤  └─────────────┘
                                └──┬──┬───┘  └─────────┘   │  ┌─────────────┐
                                   ▲  ▲                    └──┤ FMessageBox │
                                   │  │                       └─────────────┘
                                   │  │      ┌──────────┐  ┌────────────────┐
                                   │  └──────┤ FToolTip │◄─┤ FBusyIndicator │
                                   │         └──────────┘  └────────────────┘
                                   └───────────────┐          ┌──────────┐
                                                   │      ┌───┤ FMenuBar │
                                  ┌───────────┐    └──────┤   └──────────┘
                                  │ FMenuList │◄──────────┤   ┌───────┐
                                  └────┬──────┘           └───┤ FMenu │◄──┐
                                       :1                     └───────┘   │
                                       :            ┌─────────────────┐   │
                                       :            │ FDialogListMenu ├───┘
                                       :            └─────────────────┘
                                       └--------------------------------┐
                                       :*          ┌────────────────┐*  :
                                  ┌────┴─────┐  ┌──┤ FCheckMenuItem ├---┘
                                  │FMenuItem │◄─┤  └────────────────┘   :
                                  └──────────┘  │  ┌────────────────┐*  :
                                                └──┤ FRadioMenuItem ├---┘
                                                   └────────────────┘

Please send bug reports to

https://github.com/gansm/finalcut/issues

License

GNU Lesser General Public License Version 3 LGPLv3

Issues
  • Cygwin conflicts with ACLOCAL_AMFLAGS

    Cygwin conflicts with ACLOCAL_AMFLAGS

    Hi! trying to generate Makefiles with Cywing, after use "autoreconf --install --force" I get the error:

    error: AC_CONFIG_MACRO_DIRS([m4]) conflicts with ACLOCAL_AMFLAGS=-. m4

    help wanted 
    opened by abreu20011 16
  • make returns with error

    make returns with error

    Trying to do make (as told by README). @@Ubuntu 20.04 Fails with this:

    make[2]: Entering directory '/home/user/Desktop/finalcut/examples'
    g++ -DHAVE_CONFIG_H -I. -I..  -I../src/include -Wall -Werror -std=c++11   -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.cpp
    mv -f .deps/hello.Tpo .deps/hello.Po
    /bin/bash ../libtool  --tag=CXX   --mode=link g++  -g -O2 -L../src/.libs -lfinal  -o hello hello.o  
    libtool: link: g++ -g -O2 -o .libs/hello hello.o  -L../src/.libs /home/user/Desktop/finalcut/src/.libs/libfinal.so
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tgetnum'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tparm'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tgetent'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tgetstr'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tgoto'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tputs'
    /usr/bin/ld: /home/user/Desktop/finalcut/src/.libs/libfinal.so: undefined reference to `tgetflag'
    collect2: error: ld returned 1 exit status
    make[2]: *** [Makefile:584: hello] Error 1
    make[2]: Leaving directory '/home/user/Desktop/finalcut/examples'
    make[1]: *** [Makefile:494: all-recursive] Error 1
    make[1]: Leaving directory '/home/user/Desktop/finalcut'
    make: *** [Makefile:380: all] Error 2
    
    help wanted 
    opened by amochkin 14
  • conflict between finalcut and other libearies (deal.II, trilinos, boost,etc.)

    conflict between finalcut and other libearies (deal.II, trilinos, boost,etc.)

    Hello, Dear Markus, I plan to build a text UI project to read parameter file of deal.II applications The separate UI works, but it failed the compilation when I include headers of both Deal.II and finalcut in a single source file by, #include <deal.II/base/parameter_handler.h> using namespace dealii; #include <final/final.h> using namespace finalcut; Note deal.II also include some headers of trilinos and boost library, It seems some objects in finalcut headers conflict with the version in trilinos and boost. Please see the following information Many thanks for your nice final cut and any possible help! Zhenyu

    In file included from /home/zhenyu/deps/finalcut/include/final/ftermcap.h:51:0,
                     from /home/zhenyu/deps/finalcut/include/final/final.h:80,
                     from /home/zhenyu/work/icarusii/paradox/finalcut/paradox.cpp:28:
    /home/zhenyu/deps/trilinos_12.12.1/include/Kokkos_Concepts.hpp:141:49: error: expected ‘)’ before ‘*’ token
       typedef Device<execution_space,memory_space>  device_type;
    /home/zhenyu/deps/trilinos_12.12.1/include/impl/Kokkos_TaskQueue.hpp:138:20: error: ‘memory_pool’ does not name a type; did you mean ‘MemoryPool’?
       TaskQueue( const memory_pool & arg_memory_pool );
                        ^~~~~~~~~~~
                        MemoryPool
    /home/zhenyu/deps/trilinos_12.12.1/include/Teuchos_FancyOStream.hpp:1135:13:   required from ‘std::streamsize Teuchos::basic_FancyOStream_buf<CharT, Traits>::xsputn(const char_type*, std::streamsize) [with CharT = char; Traits = std::char_traits<char>; std::streamsize = long int; Teuchos::basic_FancyOStream_buf<CharT, Traits>::char_type = char]’
    /home/zhenyu/work/icarusii/paradox/paradox_main.cpp:323:1:   required from here
    /home/zhenyu/deps/trilinos_12.12.1/include/Teuchos_FancyOStream.hpp:1180:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
           if(s[p] == newline) {
    
    help wanted question 
    opened by euroboros 13
  • Iconizable windows?

    Iconizable windows?

    Hi, I just noticed this, apologies for the flurry of tickets.

    Anyway, I was wondering if it was possible to change(?) the default UI style to be more in-line with VBDOS?

    Thanks!

    e.g. image

    question feature request 
    opened by lighth7015 12
  • #include cpp file

    #include cpp file

    I want to compile this with my application... how do I do that? I can't include the CPP files, nor can I act like final.h (define USE_FINAL_H, symlink src/include/final to src/final and include the C++ files in the same order)...

    question 
    opened by LoganDark 10
  • Example applications freeze when you press enter instead of using mouse

    Example applications freeze when you press enter instead of using mouse

    Describe the bug

    Example applications freeze when you press enter instead of using mouse

    How to reproduce the bug?

    Run any of the included example applications, and activate the exit button/dialog with the enter key instead of the mouse, and the application will stop responding.

    What behavior did you expect?

    The application exits as expected.

    In which environment did the bug occur?

    • Which operating system do you use? Linux

    • Which distribution do you use? Manjaro Linux

    • On which CPU architecture did you test? x86_64, AMD Ryzen 7 1700

    • Which compiler/version did you use? both clang++ 12.0.1 and GCC 11.1.0

    • Which terminal do you use? konsole

    • What does the environment variable $TERM contain? xterm-256color

    bug 
    opened by lighth7015 7
  • 0.5.0 tumbleweed build failure

    0.5.0 tumbleweed build failure

    I get the following build failure for finalcut on openSUSE Tumbleweed:

    [   61s] libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -Iinclude -Wall -Werror -DCOMPILE_FINAL_CUT -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -f
    unwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -Wall -Wextra -Wpedantic -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-prot
    ector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -c fwidgetcolors.cpp  -fPIC -DPIC -o .libs/fwidgetco
    lors.o
    [   61s] In file included from /usr/include/string.h:494,
    [   61s]                  from /usr/include/c++/9/cstring:42,
    [   61s]                  from foptimove.cpp:23:
    [   61s] In function 'char* strncpy(char*, const char*, size_t)',
    [   61s]     inlined from 'void finalcut::FOptiMove::rightMove(char*, int&, int, int)' at foptimove.cpp:819:18,
    [   61s]     inlined from 'int finalcut::FOptiMove::horizontalMove(char*, int, int)' at foptimove.cpp:804:15,
    [   61s]     inlined from 'int finalcut::FOptiMove::relativeMove(char*, int, int, int, int)' at foptimove.cpp:687:28:
    [   61s] /usr/include/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 512 equals destination size [-Werror=stringop-truncation]
    [   61s]   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
    [   61s]       |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [   61s] /bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -Iinclude -Wall -Werror -DCOMPILE_FINAL_CUT -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -Wall -Wextra -Wpedantic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -c -o fwidget.lo fwidget.cpp
    [   61s] In function 'char* strncpy(char*, const char*, size_t)',
    [   61s]     inlined from 'bool finalcut::FOptiMove::isMethod0Faster(int&, int, int)' at foptimove.cpp:941:18,
    [   61s]     inlined from 'char* finalcut::FOptiMove::moveCursor(int, int, int, int)' at foptimove.cpp:524:23:
    [   61s] /usr/include/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 512 equals destination size [-Werror=stringop-truncation]
    [   61s]   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
    [   61s]       |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [   61s] cc1plus: all warnings being treated as errors
    

    I assume some library/compiler/toolchain was updated on oS TW.

    opened by jubalh 7
  • How to hide or disable icon in the left corner in FDialog. How to make an exit button in my own FDialog.

    How to hide or disable icon in the left corner in FDialog. How to make an exit button in my own FDialog.

    Hello, i've two issues.

    1. I will use my project with your library in tty, so i dont need to use this left-corner icon. How can i remove it? And how to resize this top-label. image All I need is to use labels and active buttons. Adding back or next buttons i will navigate throw these windows, overlapping or closing old ones. See the example below. It is very easy to make and configure them by using FDialog.

    2. I need to make my own exit-confirmation dialog, cause i need to translate it on different languages. The best idea i have is to create main widget and make an access to it using my exit-button. Am i right? Can you give a short example, if it isn't so hard. image

    P.S. Your library is awesome! Thx for creating it! P.P.S Sorry for my bad English, I haven't practiced for so long.

    help wanted feature request 
    opened by 9PashaE6ashu 6
  • -fsanitize=undefined produces a bonanza of errors

    -fsanitize=undefined produces a bonanza of errors

    Better yet, try -fsanitize=address,undefined I'd paste them here, but my terminal window freezes when executing my app.

    EDIT: I now remember the reason why I didn't want to use tvision anymore was, that the sanitizer went ballistic with it too. It had memory leaks and undefined behavior.

    opened by user1095108 6
  • compilation problem

    compilation problem

    Hi

    I cannot to compile master

    /bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I../include -Wall -Werror -DCOMPILE_FINAL_CUT   -g -O2 -MT fscrollbar.lo -MD -MP -MF .deps/fscrollbar.Tpo -c -o fscrollbar.lo fscrollbar.cpp
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I../include -Wall -Werror -DCOMPILE_FINAL_CUT -g -O2 -MT fscrollbar.lo -MD -MP -MF .deps/fscrollbar.Tpo -c fscrollbar.cpp  -fPIC -DPIC -o .libs/fscrollbar.o
    In file included from ../include/final/fkeyboard.h:42,
                     from ../include/final/fterm.h:140,
                     from ../include/final/fvterm.h:57,
                     from ../include/final/fwidget.h:100,
                     from ../include/final/fscrollbar.h:55,
                     from fscrollbar.cpp:25:
    ../include/final/ftermlinux.h: In static member function 'static int FTermLinux::getFramebufferBpp()':
    ../include/final/ftermlinux.h:197:10: error: 'framebuffer_bpp' was not declared in this scope
     { return framebuffer_bpp; }
              ^~~~~~~~~~~~~~~
    ../include/final/ftermlinux.h:197:10: note: suggested alternative: 'getFramebuffer_bpp'
     { return framebuffer_bpp; }
              ^~~~~~~~~~~~~~~
              getFramebuffer_bpp
    
    bug 
    opened by okbob 6
  • App without a

    App without a "main" window.

    Hello,

    In all finalcut examples there is a "main" window (usually a dialog), which should stay open while the app is running. (And also it keeps e.g. menubar of the entire app, which doesn't look very logical).

    What would be the best way to have an app which starts with an empty desktop instead (with menubar and status bar), similarly to what a typical turbovision app would do?

    Thanks!

    btw, is there a chat/forum to ask questions like that? It doesn't feel appropriate to use github issues for usage questions.

    question 
    opened by mooskagh 5
  • resizable dialog with scrollview

    resizable dialog with scrollview

    Dear Markus,

    after discovering just recently your amazing library I started to play around with your examples.

    I am trying to write a dialog (similar to examples/scrollview.cpp) that can display some text file. Of course this can be done with FTextView. But I thought implementing some simplified, self-made variant might be a good way to learn how some of the concepts of finalcut. So my problem is mainly academic and out of curiosity :D

    In a first step my plan was to write just a dialog that shows a fixed number of lines, e.g line = 1, ..., line = 42. This worked fine until I tried to make the dialog resizeable. My idea was that once a file is completely read into some buffer I will know the number of lines and number of columns that are needed to display it. Hence, the size of the scrollable area should at least have these "text dimensions".

    If I understand FScrollView::setGeometry correctly then it also changes the size of the scroll area. So after making the dialog smaller the scrollbars were gone ... My idea was that the overloaded setGeometry of my scrollview adjusts the scroll dimensions to the maximum of the current widget size and the "text dimensions". But this seems to be the wrong idea ...

    Maybe you can point me to some example or give me a hint how to manage this.

    Best regards, Michael

    Here the (working) variant using an instance of FTextView

    #include <final/final.h>
    
    using namespace finalcut;
    
    class PrgView final : public FDialog
    {
      public:
        PrgView(FWidget *parent)
          : FDialog{ parent }
          , lineView{ this } // show 42 lines
        {
            FString line;
            for (auto i{ 0 }; i < 42; ++i) {
                line.sprintf("line = %d\n", i);
                lineView.append(line.c_str());
            }
        }
    
        void
        initLayout() override
        {
            FDialog::setGeometry(FPoint{ 16, 3 }, FSize{ 50, 19 });
    
            setText("Program");
            setBorder(false);
            setResizeable();
            lineView.setGeometry(FPoint{ 1, 1 },
                                 FSize{ getWidth() - 1, getHeight() - 1 });
            FDialog::initLayout();
        }
    
        void
        adjustSize() override
        {
            FDialog::adjustSize();
            lineView.setGeometry(FPoint{ 1, 1 },
                                 FSize{ getWidth() - 1, getHeight() - 1 });
        }
    
        FTextView lineView;
    };
    
    int
    main(int argc, char *argv[])
    {
        FApplication app{ argc, argv };
    
        PrgView prgView{ &app };
        FWidget::setMainWidget(&prgView);
        app.show();
        return app.exec();
    }
    

    Here my attempt to achieve the same with a class derived from FScrollView:

    #include <final/final.h>
    
    using namespace finalcut;
    
    class LineView : public FScrollView
    {
      public:
        LineView(FWidget *parent)
          : FScrollView{ parent }
        {
        }
    
        void
        draw() override
        {
            clearArea();
            for (auto y{ 1 }; y <= int(numLines); ++y) {
                setPrintPos(FPoint{ 1, y });
                print() << "Line = " << y;
            }
            FScrollView::draw();
        }
    
        void
        setGeometry(const FPoint &pos, const FSize &size,
                    bool adjust = true) override
        {
            FScrollView::setGeometry(pos, size, adjust);
            auto w = std::max(numCols, getWidth());
            auto h = std::max(numLines, getHeight());
    
            setScrollSize(FSize{ w, h });
        }
    
      private:
        std::size_t numCols{ 10 };
        std::size_t numLines{ 42 };
    };
    
    class PrgView final : public FDialog
    {
      public:
        PrgView(FWidget *parent)
          : FDialog{ parent }
          , lineView{ this } // show 42 lines
        {
        }
    
        void
        initLayout() override
        {
            FDialog::setGeometry(FPoint{ 16, 3 }, FSize{ 50, 19 });
    
            setText("Program");
            setBorder(false);
            setResizeable();
            lineView.setGeometry(FPoint{ 1, 1 },
                                 FSize{ getWidth() - 1, getHeight() - 1 });
            FDialog::initLayout();
        }
    
        void
        setGeometry(const FPoint &p, const FSize &s, bool adj = true) override
        {
            FDialog::setGeometry(p, s, adj);
        }
    
        void
        adjustSize() override
        {
            FDialog::adjustSize();
            lineView.setGeometry(FPoint{ 1, 1 },
                                 FSize{ getWidth() - 1, getHeight() - 1 });
        }
    
        LineView lineView;
    };
    
    int
    main(int argc, char *argv[])
    {
        FApplication app{ argc, argv };
    
        PrgView prgView{ &app };
    
        FWidget::setMainWidget(&prgView);
        app.show();
        return app.exec();
    }
    
    question 
    opened by michael-lehn 19
  • build error on cygwin

    build error on cygwin

    Describe the bug

    got the following error during autorefonf --install --force

    .ibtoolize: error: AC_CONFIG_MACRO_DIRS([m4]) conflicts with ACLOCAL_AMFLAGS=-I m4 autoreconf-2.69: libtoolize failed with exit status: 1

    How to reproduce the bug?

    install following cygwin packages: - clang - automake - autoconf - autoconf-archive - pkg-config - ncurses - glib2-dev - terminfo - terminfo-extra

    What behavior did you expect?

    In which environment did the bug occur?

    Cygwin-64

    • Which distribution do you use?

    Windows 10

    • On which CPU architecture did you test? ryzen 7 4800h

    • Which compiler in which version did you use? clang-8

    • Which terminal do you use? cygwin terminal

    help wanted 
    opened by lmascelli 3
  • Support of expanding text widget (+ / - syntax)

    Support of expanding text widget (+ / - syntax)

    I'm printing very simple pre-formatted text in a tabular format; I am tabulating myself using snprintf(..) etc. In below example I have a (X, *) that is the summation of (X, x1) and (X, x2). I am wondering if there's a way to support a expand section / contract section type syntax with some minor effort or reasonably achieve the same thing by placing buttons to the left of each expanding section and clicking on them.

    My widget architecture is FDialog -> FScrollView -> FLabel and I just call FLabel::setText(..) to update the text.

        Current Layout
        -------------------------
        | id | mode | A | B | C |
        | X  | *    | 2 | 2 | 2 |
        | X  | x1   | 1 | 1 | 1 |
        | X  | x2   | 1 | 1 | 1 |
        | Y  | *    | 3 | 3 | 3 |
        | Y  | y1   | 1 | 1 | 1 |
        | Y  | y2   | 2 | 2 | 2 |
        -------------------------
        Desired unexpanded layout
        -------------------------
        | id | mode | A | B | C |
        + X  | *    | 2 | 2 | 2 |
        + Y  | *    | 3 | 3 | 3 |
        -------------------------
        Desired expanded layout when both expanded
        -------------------------
        | id | mode | A | B | C |
        - X  | *    | 2 | 2 | 2 |
        | X  | x1   | 1 | 1 | 1 |
        | X  | x2   | 1 | 1 | 1 |
        - Y  | *    | 3 | 3 | 3 |
        | Y  | y1   | 1 | 1 | 1 |
        | Y  | y2   | 2 | 2 | 2 |
        -------------------------
    

    Thanks in advance!

    help wanted 
    opened by siddharth99 2
  • official debian package

    official debian package

    Would you mind moving/dropping debian/ so it'd be easier to create an official debian package?

    I wasn't able to find an RFP/ITP bug yet, is it possible none was filed yet?

    I guess I'll create one, if there's no objections, WIP: http://sid.ethz.ch/debian/finalcut/

    opened by alexmyczko 30
  • not creared makefile

    not creared makefile

    Describe the bug

    When I attempt install FinalCut library was not creared makefile. But was created files Makefile.am and Makefile.in after execute command "./configure --prefix=/usr"

    I use Linux Debian 10

    Installing to /usr/include

    What can I to fix this problem?

    Thank you!

    help wanted 
    opened by gasovich 3
  • CMake integration

    CMake integration

    Hello dear team, I am trying to integrate this project into an existing CMake based project. Before I spend more time on this, is there an existing migration that someone did?

    Many thanks.

    question 
    opened by ghost 1
Releases(0.8.0)
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

jhomas tefferson 0 Nov 18, 2021
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

null 42 Feb 28, 2022
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Jupyter Xeus 198 May 14, 2022
Library for writing text-based user interfaces

IMPORTANT This library is no longer maintained. It's pretty small if you have a big project that relies on it, just maintain it yourself. Or look for

null 1.8k May 5, 2022
ImTui: Immediate Mode Text-based User Interface

imtui ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input. Live demo in the browser Eventh

Georgi Gerganov 1.8k May 10, 2022
Command-Based Text Editor written in cpp using Linked Lists and Stack

Command Based Text Editor Our goal in this project is to write a command-based text editor in cpp using linked lists and stack. This text editor will

bedirhanbardakci 3 Jun 9, 2021
A C, C++ and Rust library to draw graphics with pixels in the terminal

A library to draw graphics with pixels in the terminal Who needs a GUI when you have a terminal ? Building To generate libpluto.a, run: $ make To ins

null 67 Apr 9, 2022
Creating CLI's just got a whole lot better

Staq Creating CLI's just got a whole lot better. Don't worry about CLI colouring, networking, Size of Executables, Speed ever again Have any doubts? R

null 9 Jun 1, 2021
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Arthur Sonzogni 3k May 12, 2022
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Cacahuète Sans Sel 18 Apr 27, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

romes 164 May 8, 2022
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

Tom Szilagyi 207 May 12, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Microsoft 83.1k May 16, 2022
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Mischievous Meerkat 14.1k May 17, 2022
Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph Monitor for Chia Harvesting Introduction The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 2

Bram Stolk 219 May 2, 2022
a simple to use linux terminal

a simple to use linux terminal

notaweeb 7 Feb 17, 2022
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Arthur Sonzogni 60 May 5, 2022
Simple benchmark for terminal output

TermBench This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can b

Casey Muratori 169 May 9, 2022
tinytetris - 80x23 terminal tetris

tinytetris - 80x23 terminal tetris

Conor Taylor 1.6k May 9, 2022