I’d like to share that I’ve open-sourced my previously commercial app Tablecruncher, a lightweight CSV editor built using the FLTK GUI toolkit.
One main concern when using FLTK was mimicking the native look and feel — especially important for macOS users. If you dig into the code, you’ll see I even wrote a custom routine to draw the buttons in dialogs to make them look a bit more macOS-like, including rounded borders and a somewhat fitting blue tone.
if you spot anything odd or have suggestions for improvement, I’d love to hear them.
I'll take a look and let you know if I find anything, either here or as GitHub issue.
$ git diff diff --git a/CMakeLists.txt b/CMakeLists.txt index d61f6a8..ac04415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,17 +144,9 @@ elseif(WIN32) target_link_options(${PROJECT_NAME} PRIVATE ${LINKER_FLAGS}) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) elseif(LINUX) - target_link_libraries(${PROJECT_NAME} PRIVATE - ${FLTKLIBDIR}/lib/libfltk.a - ${FLTKLIBDIR}/lib/libfltk_images.a - ${FLTKLIBDIR}/lib/libfltk_z.a - Xft - fontconfig - Xrender - X11 - pthread - dl - ) + set(FLTK_DIR ${FLTKDIR}) + find_package(FLTK 1.4 CONFIG REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE fltk::images) endif()```
$ cmake -G Ninja .. -D FLTKDIR=/home/albrecht/fltk/{1.4|1.5}/debug/share/fltk; time ninja
if(WIN32) add_executable(${PROJECT_NAME} WIN32 ${SOURCES}) else() add_executable(${PROJECT_NAME} ${SOURCES}) endif()```
add_executable(${PROJECT_NAME} WIN32 [MACOSX_BUNDLE] ${SOURCES})The line
$ git diff --stat CMakeLists.txt | 54 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-)I hope this helps. I worked on this (longer than I had planned) because I always want to test FLTK builds with different apps, and yours was a good example (and I might use it myself from time to time ;-) ). Note that even my simplified version can probably be improved, but this is enough for today. Enjoy trying my version and improving it. Feedback would be welcome, and please feel free to use my simplification in your repo (no attribution necessary, just us it if you like).
@Albrecht Wow, thanks — that's incredibly helpful feedback!
I'm completely new to CMake and just tried to convert my macOS-only Make solution. And my Makefile was already a mess. ;-)
I'll definitely try to use your suggestions in future builds. Building and testing for three (or rather four — macOS ARM and Intel) platforms is a heavier task than I expected.
@Others Thanks as well for your kind words — much appreciated!Albrecht-S schrieb am Dienstag, 20. Mai 2025 um 19:32:35 UTC+2:
Am 5/20/25 13:40 schrieb 'Albrecht Schlosser':
if you spot anything odd or have suggestions for improvement, I’d love to hear them.
I'll take a look and let you know if I find anything, either here or as GitHub issue.
OK, you asked for it, and here it is ;-)
This is from my personal build on my notebook (12th Gen Intel Core i7-1260P) using Debian 12 (Bookworm).
First of all, I built your app with both FLTK 1.4.3++ (current git branch-1.4) and 1.5 (branch master), and both worked after tweaking your CMakeLists.txt a bit:
On 5/19/25 10:03, fischer...@gmail.com wrote:
You can find the code here: https://github.com/Tablecruncher/tablecruncher
[..] Of course, if you spot anything odd or have suggestions for improvement, I’d love to hear them.
On 6/4/25 01:58, fischer...@gmail.com wrote:
Oh, yes, the code really lacks documentation. My goal was to document the code before open sourcing it, but I learned that this would have meant to never open source it. ;-)I hope to find some time to compile some basic developer documentation.
GUI CLASS HIERARCHY
rushtop : Fl_Double_Window
|
|__ HtmlHelp -- hidden dialog
|__ HostBrowser -- hidden dialog
|
|
|__ MyHorizPack -- manages column headers
| |__ Fl_Box[] -- manages column header names
|
|__ Fl_Scroll -- manages all the hosts in a scroller
|__ HostGraph[] -- manages groups of GraphBox and HostBox
|__ MyHorizPack
| |__ HostBox[] -- manages hostname column for one row
|
|__ MyHorizPack -- manages columns for one row
|__ GraphBox[] -- manages data for one column of info (cpu, ram, swap..)
|__ BarData[] -- manages individual data for a single column..
> for cpus, one of each for: usr, sys
> for ram, one for: "ram used"
> for swap, one for: "swap used"
> for net, one of each for: input, output
MEMBER HIERARCHY
class RushTop : Fl_Double_Window
|
|-- String hostgroups -- unexpanded list of hostgroups
|-- String hosts -- list of hosts to show
|-- PipeCommand *pcmd -- runs 'rush -status..'
|-- popup -- (Fl_Menu_Button) popup menu
|-- helpwin -- (HtmlHelp) help dialog
|-- hostbrow -- (HostBrowser) host browser dialog
|-- (user preferences)
|-- (RC file management)
|
|-- heading (MyHorizPack) header for the cpu bars
| |
| |-- hostheading (Fl_Box) -- the heading box for the hostname
| |-- cpusheading (Fl_Box) -- the heading box for the cpus
| |-- ramheading (Fl_Box) -- the heading box for the ram
| |-- swapheading (Fl_Box) -- the heading box for the swap
|
|-- scroll (Fl_Scroll) -- the scroll widget
|
|-- hostgraphs[] (HostGraph:FlHorizPack) -- array of 'graph' rows
|
|-- hostbox (HostBox:Fl_Box) -- the lefthand hostname 'box'
|-- cpugroup (Fl_Group) -- parent for all the cpu bar graphs (can hide())
| |
| |-- cpus[0] (GraphBox) -- array of cpus
| |
| |-- bars[0] (BarData) -- usr use of cpu 0
| |-- bars[1] (BarData) -- sys use of cpu 0
| : :
|
|-- mem (GraphBox) -- the mem bar
| |
| |-- bars[0] (BarData) -- mem used
|
|-- swap (GraphBox) -- the swap bar
| |
| |-- bars[0] (BarData) -- swap used
| |-- bars[1] (BarData) -- 'bad swap'
|
|-- net (GraphBox) -- the network i/o bar
|
|-- bars[0] (BarData) -- input i/o
|-- bars[1] (BarData) -- output i/o