feat: Complete row height implementation

Now all parts of spreadsheet respond to the -F <fontsize> command
  line argument in fteapot, and row heights are computed in terms of
  the resulting character size.

  There is a new menu option for setting row heights in fteapot.

  Documentation is updated, and keybindings are made more uniform between
  teapot and fteapot and more fully documented.

  Resolves #57.
This commit is contained in:
Glen Whitney 2023-04-09 01:35:05 -04:00
parent c9966d47c7
commit e945a98c54
8 changed files with 307 additions and 79 deletions

6
NEWS
View File

@ -11,19 +11,20 @@ o Comparison operators return bool rather than int (Note this can be a breaking
change; you may need to wrap comparisons in int() if you are using the result change; you may need to wrap comparisons in int() if you are using the result
in a numerical computation.) in a numerical computation.)
o Foreground and background color style attributes for cells. o Foreground and background color style attributes for cells.
o Variable row height for cells.
o Addition of a find() macro to search for a cell satisfying a condition. o Addition of a find() macro to search for a cell satisfying a condition.
o Addition of an is(VALUE, TYPE, TYPE,...) predicate o Addition of an is(VALUE, TYPE, TYPE,...) predicate
o Addition of functions for unit displacements in the six cardinal directions o Addition of functions for unit displacements in the six cardinal directions
(left, right, up, down, above, below) (left, right, up, down, above, below)
o TPA is now the default file format o TPA is now the default file format
o Addition of hexact float format, which allow for exact round trips to ASCII o Addition of hexact float format, which allows for exact round trips to ASCII
o New token type: funcall (which basically amounts to an expression). This o New token type: funcall (which basically amounts to an expression). This
allows parsed rather than unparsed expressions to be stored in cells, and allows parsed rather than unparsed expressions to be stored in cells, and
allows macros which receive their arguments unevaluated. allows macros which receive their arguments unevaluated.
o sum(), min(), and max() can now operate over their list of arguments as well o sum(), min(), and max() can now operate over their list of arguments as well
as over a block. as over a block.
o Added floor(), ceil(), trunc(), and round() functions for finding integers o Added floor(), ceil(), trunc(), and round() functions for finding integers
associated with doubles, eiminating (note possible breaking change) the associated with doubles, eliminating (note possible breaking change) the
int conversion with two rounding directions. int conversion with two rounding directions.
o Precedence of unary "-" made lower than exponentiation "^" to match Python; o Precedence of unary "-" made lower than exponentiation "^" to match Python;
note possible breaking change. note possible breaking change.
@ -34,6 +35,7 @@ o Fill With operation for quickly filling the selected block with a single cell.
o Additional arithmetic operations on locations. o Additional arithmetic operations on locations.
o Documentation better aligned with current behavior. o Documentation better aligned with current behavior.
o Additional key commands for clocking/resetting the sheet. o Additional key commands for clocking/resetting the sheet.
o New -F command line argument to set the overall font size for fteapot.
Bug fixes: Bug fixes:
o Occasional early coredumps of teapot have been eliminated. o Occasional early coredumps of teapot have been eliminated.

View File

@ -1144,7 +1144,7 @@ Up
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[+] +
\end_layout \end_layout
\end_inset \end_inset
@ -1264,7 +1264,7 @@ To last column
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[<] <
\end_layout \end_layout
\end_inset \end_inset
@ -1293,7 +1293,7 @@ To row 0
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[>] >
\end_layout \end_layout
\end_inset \end_inset
@ -1322,7 +1322,7 @@ To last row
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[_ (Underscore)] _ (Underscore)
\end_layout \end_layout
\end_inset \end_inset
@ -1351,7 +1351,7 @@ To Layer 0
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[*] *
\end_layout \end_layout
\end_inset \end_inset
@ -1371,7 +1371,7 @@ To last layer
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Ctrl-Right}
\end_layout \end_layout
\end_inset \end_inset
@ -1400,7 +1400,7 @@ Jump one page right
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Ctrl-Left}
\end_layout \end_layout
\end_inset \end_inset
@ -1550,7 +1550,7 @@ status open
\begin_layout Plain Layout \begin_layout Plain Layout
\begin_inset Tabular \begin_inset Tabular
<lyxtabular version="3" rows="14" columns="3"> <lyxtabular version="3" rows="15" columns="3">
<features tabularvalignment="middle"> <features tabularvalignment="middle">
<column alignment="left" valignment="top" width="5cm"> <column alignment="left" valignment="top" width="5cm">
<column alignment="left" valignment="top"> <column alignment="left" valignment="top">
@ -1620,7 +1620,7 @@ Operation
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
F10 [F10] {Menu bar always shown}
\end_layout \end_layout
\end_inset \end_inset
@ -1802,6 +1802,35 @@ Activate File menu
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout
{Meta-B}
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Activate Block menu
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Meta-V} {Meta-V}
\end_layout \end_layout
@ -1848,11 +1877,11 @@ Activate fOrmat menu
</cell> </cell>
</row> </row>
<row> <row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
F1
\end_layout \end_layout
\end_inset \end_inset
@ -1861,7 +1890,7 @@ Activate fOrmat menu
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Meta-H}
\end_layout \end_layout
\end_inset \end_inset
@ -1870,7 +1899,7 @@ Activate fOrmat menu
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
Activate Help menu Show help
\end_layout \end_layout
\end_inset \end_inset
@ -1910,7 +1939,7 @@ Redraw screen
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Esc}
\end_layout \end_layout
\end_inset \end_inset
@ -1919,7 +1948,7 @@ Redraw screen
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
[Ctrl-C] [Ctrl-G] {Esc} [Ctrl-C] [Ctrl-G]
\end_layout \end_layout
\end_inset \end_inset
@ -2002,7 +2031,7 @@ status open
\begin_layout Plain Layout \begin_layout Plain Layout
\begin_inset Tabular \begin_inset Tabular
<lyxtabular version="3" rows="26" columns="3"> <lyxtabular version="3" rows="29" columns="3">
<features tabularvalignment="middle"> <features tabularvalignment="middle">
<column alignment="left" valignment="top" width="5cm"> <column alignment="left" valignment="top" width="5cm">
<column alignment="left" valignment="top"> <column alignment="left" valignment="top">
@ -2430,7 +2459,7 @@ Set cell label
</cell> </cell>
</row> </row>
<row> <row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
@ -2443,7 +2472,7 @@ Set cell label
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Meta-B} {Ctrl-D}
\end_layout \end_layout
\end_inset \end_inset
@ -2452,7 +2481,7 @@ Set cell label
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
Toggle cell/block bold Toggle cell/block dim
\end_layout \end_layout
\end_inset \end_inset
@ -2472,7 +2501,65 @@ Toggle cell/block bold
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
{Meta-U} {Ctrl-B}
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Toggle cell/block bold
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
{Ctrl-I}
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Toggle cell/block italic
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
{Ctrl-U}
\end_layout \end_layout
\end_inset \end_inset
@ -2629,6 +2716,35 @@ Set cell/block precision
Set column width Set column width
\end_layout \end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
{Meta-H}
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
Set row height
\end_layout
\end_inset \end_inset
</cell> </cell>
</row> </row>
@ -2753,7 +2869,7 @@ Reset sheet
\begin_inset Text \begin_inset Text
\begin_layout Plain Layout \begin_layout Plain Layout
F9, {Shift-Tab} F8, F9, {Shift-Tab}
\end_layout \end_layout
\end_inset \end_inset
@ -3452,7 +3568,7 @@ ignored.
\end_layout \end_layout
\begin_layout Standard \begin_layout Standard
In addition, each column has a width. In addition, each column has a width and each row has a height.
\end_layout \end_layout
\begin_layout Subsubsection \begin_layout Subsubsection
@ -3503,6 +3619,39 @@ The column width only affects the screen display, not the formatting of
It is intended to let you make better usage of the screen for more overview. It is intended to let you make better usage of the screen for more overview.
If the width is too small to display the cell value, a placeholder will If the width is too small to display the cell value, a placeholder will
be displayed. be displayed.
The column width is measured in
\begin_inset Quotes eld
\end_inset
characters,
\begin_inset Quotes erd
\end_inset
which are exact in the console and correspond to an arbitrary notional
character width in the graphical version, where the actual number of characters
that fit in a cell of a given width will depend on the font and size.
\end_layout
\begin_layout Subsubsection
Row Height
\end_layout
\begin_layout Standard
Similar comments apply to the row height as to the column width.
An important difference is that row heights are expressed in
\begin_inset Quotes eld
\end_inset
twelfths of a character.
\begin_inset Quotes erd
\end_inset
This means that in the console version, all row heights upt to 23 are displayed
as a single-character-high row; heights 24 to 35 are shown as two characters
high; and so on.
In the graphical version, of course, the actual row height is proportional
to the specified value, with a height of 12 able to display one full-height
character.
\end_layout \end_layout

View File

@ -39,9 +39,15 @@ endif ()
find_package(FLTK) find_package(FLTK)
if (FLTK_FOUND) if (FLTK_FOUND)
find_program(PYTHON python3 python)
fltk_wrap_ui(fteapot fteapot.fl) fltk_wrap_ui(fteapot fteapot.fl)
include_directories(${FLTK_INCLUDE_DIR}) include_directories(${FLTK_INCLUDE_DIR})
add_executable(fteapot WIN32 tpt_choose.cxx ${fteapot_FLTK_UI_SRCS}) add_executable(fteapot WIN32 tpt_choose.cxx ${CMAKE_CURRENT_BINARY_DIR}/fteapot.h ${CMAKE_CURRENT_BINARY_DIR}/fteapot_interpolated.cxx)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fteapot_interpolated.cxx
COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/tools/interpolate.py ${CMAKE_CURRENT_SOURCE_DIR}/fteapot.fl ${CMAKE_CURRENT_BINARY_DIR}/fteapot.cxx
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fteapot.cxx ${CMAKE_CURRENT_SOURCE_DIR}/tools/interpolate.py
)
target_compile_options(fteapot PRIVATE -Wno-shadow -Wno-conversion -Wno-sign-conversion) target_compile_options(fteapot PRIVATE -Wno-shadow -Wno-conversion -Wno-sign-conversion)
set(fteapot_DEB_DEPENDS ", libstdc++6 (>= 4.1.1), libfltk1.3") set(fteapot_DEB_DEPENDS ", libstdc++6 (>= 4.1.1), libfltk1.3")
if (ENABLE_HELP) if (ENABLE_HELP)

View File

@ -1548,13 +1548,13 @@ int do_sheetcmd(Sheet *cursheet, Key c, bool moveonly)
"\n" "\n"
"<p>Original Version: Michael Haardt<br>\n" "<p>Original Version: Michael Haardt<br>\n"
"Current Maintainer: Joerg Walter<br>\n" "Current Maintainer: Joerg Walter<br>\n"
"Contibutions by: Glen Whitney<br>\b" "Contributions by: Glen Whitney<br>\b"
"Home Page: <a href='http://www.syntax-k.de/projekte/teapot/'>http://www.syntax-k.de/projekte/teapot/</a></p>\n" "Home Page: <a href='http://www.syntax-k.de/projekte/teapot/'>http://www.syntax-k.de/projekte/teapot/</a></p>\n"
"This distribution: <a href='https://code.studioinfinity.org/glen/teapot-spreadsheet/'>https://code.studioinfinity.org/glen/teapot-spreadsheet/</a></p>\n" "This distribution: <a href='https://code.studioinfinity.org/glen/teapot-spreadsheet/'>https://code.studioinfinity.org/glen/teapot-spreadsheet/</a></p>\n"
"\n" "\n"
"<p>Copyright 1995-2006 Michael Haardt,<br>\n" "<p>Copyright 1995-2006 Michael Haardt,<br>\n"
"Copyright 2009-2010 Joerg Walter (<a href='mailto:info@syntax-k.de'>info@syntax-k.de</a>)<br>" "Copyright 2009-2010 Joerg Walter (<a href='mailto:info@syntax-k.de'>info@syntax-k.de</a>)<br>"
"Copyright 2019 Glen Whitney</p></center>\n" "Copyright 2019,2023 Glen Whitney</p></center>\n"
"\f" "\f"
"<p>This program is free software: you can redistribute it and/or modify\n" "<p>This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n" "it under the terms of the GNU General Public License as published by\n"

View File

@ -1123,7 +1123,9 @@ static Key wgetc(void)
/* Control R, recalculate sheet */ /* Control R, recalculate sheet */
case '\022': return K_RECALC; case '\022': return K_RECALC;
/* Control S, clock sheet */ /* F8, F9 or Control S, clock sheet */
case KEY_F(8):
case KEY_F(9):
case '\023': return K_CLOCK; case '\023': return K_CLOCK;
/* Control X, get one more key */ /* Control X, get one more key */

View File

@ -1,4 +1,12 @@
# data file for the Fltk User Interface Designer (fluid) # data file for the Fltk User Interface Designer (fluid)
# Code replacements for dummy numerical constants:
# 9999100/*fontsize*/
# 9999112/*fontsize + 12*/
# 9999114/*fontsize + 14*/
# 9999110/*fontsize + 10*/
# 9999224/*2*fontsize + 24*/
# 99990336/*600 - 3*fontsize - 36*/
# 99990112/*600 - fontsize - 12*/
version 1.0300 version 1.0300
header_name {.h} header_name {.h}
code_name {.cxx} code_name {.cxx}
@ -320,6 +328,8 @@ class TeapotTable {open : {public Fl_Table}}
case FL_Escape: k = K_INVALID; break; case FL_Escape: k = K_INVALID; break;
case FL_BackSpace: k = K_BACKSPACE; break; case FL_BackSpace: k = K_BACKSPACE; break;
case FL_F+1: k = ctrl?K_ABOUT:K_HELP; break; case FL_F+1: k = ctrl?K_ABOUT:K_HELP; break;
case FL_F+2: k = K_LOADMENU; break;
case FL_F+3: k = K_SAVE; break;
case FL_F+8: k = ctrl?K_RECALC:K_CLOCK; break; case FL_F+8: k = ctrl?K_RECALC:K_CLOCK; break;
case FL_F+9: k = ctrl?K_RECALC:K_CLOCK; break; case FL_F+9: k = ctrl?K_RECALC:K_CLOCK; break;
case FL_F+10: k = (Key)'/'; break; case FL_F+10: k = (Key)'/'; break;
@ -389,14 +399,14 @@ class TeapotTable {open : {public Fl_Table}}
case FL_Page_Up: case FL_Page_Up:
k = shift ? K_PSHEET : ctrl ? K_FIRSTL : K_PPAGE; k = shift ? K_PSHEET : ctrl ? K_FIRSTL : K_PPAGE;
break; break;
default:
/* Handle shifted keys */
if (Fl::event_length() == 1) k = (Key)(Fl::event_text()[0]);
} }
/* This short circuit perhaps needs an explanation: */
if (k > 0 && (ctrl || alt)) return 0; if (k > 0 && (ctrl || alt)) return 0;
// Quick and dirty upper-case fix, fails for international chars on keyboards...
if (shift && !alt && !ctrl && k >= 'a' && k <= 'z')
k = (Key)(k - 'a' + 'A');
do_sheetcmd(cursheet, k, cursheet->moveonly); do_sheetcmd(cursheet, k, cursheet->moveonly);
do_callback(ACTION, 0, 0); do_callback(ACTION, 0, 0);
redraw(); redraw();
@ -440,6 +450,8 @@ class TeapotTable {open : {public Fl_Table}}
//printf(" : t: %i, w: %i, p: %i, r: %i\\n", tow, w, xpos, x2+1); //printf(" : t: %i, w: %i, p: %i, r: %i\\n", tow, w, xpos, x2+1);
cols(x2+1); cols(x2+1);
} }
visible_cells(y1, y2, x1, x2);
cursheet->width = x2 - x1 + 1;
if (y2+2 < rows() && (size_t)rows() > cursheet->dim[Y]) if (y2+2 < rows() && (size_t)rows() > cursheet->dim[Y])
rows((size_t)y2+2 < cursheet->dim[Y] ? cursheet->dim[Y] : y2+2); rows((size_t)y2+2 < cursheet->dim[Y] ? cursheet->dim[Y] : y2+2);
@ -492,218 +504,229 @@ class MainWindow {open}
table->update_table(); table->update_table();
table->redraw(); table->redraw();
} }
open xywh {0 0 800 25} class Fl_Sys_Menu_Bar open xywh {0 0 800 9999112} class Fl_Sys_Menu_Bar
code0 {
menu->textsize(fontsize);
}
} }
{ {
Submenu {} {label {&File} xywh {25 25 67 24} } { Submenu {} {label {&File} xywh {25 25 67 24} labelsize 0 } {
MenuItem {} { MenuItem {} {
label {&Open...} label {&Open...}
user_data K_LOADMENU user_data K_LOADMENU
xywh {5 5 30 20} shortcut 0x4006f xywh {5 5 30 20} labelsize 0 shortcut 0x4006f
} }
MenuItem {} { MenuItem {} {
label {&Save} label {&Save}
user_data K_SAVE user_data K_SAVE
xywh {0 0 30 20} shortcut 0x40073 xywh {0 0 30 20} labelsize 0 shortcut 0x40073
} }
MenuItem {} { MenuItem {} {
label {Save &As...} label {Save &As...}
user_data K_NAME user_data K_NAME
xywh {0 0 30 20} shortcut 0x50053 divider xywh {0 0 30 20} labelsize 0 shortcut 0x50053 divider
} }
MenuItem {} { MenuItem {} {
label {&Quit} label {&Quit}
user_data K_QUIT user_data K_QUIT
xywh {0 0 30 20} shortcut 0x40071 xywh {0 0 30 20} labelsize 0 shortcut 0x40071
} }
} }
Submenu {} {label {&Block} xywh {25 25 67 24} } { Submenu {} {label {&Block} xywh {25 25 67 24} labelsize 0 } {
MenuItem {} { MenuItem {} {
label {&Insert} label {&Insert}
user_data BLOCK_INSERT user_data BLOCK_INSERT
xywh {0 0 30 20} shortcut 0x90069 xywh {0 0 30 20} labelsize 0 shortcut 0x90069
} }
MenuItem {} { MenuItem {} {
label {&Delete} label {&Delete}
user_data BLOCK_DELETE user_data BLOCK_DELETE
xywh {0 0 30 20} shortcut 0x90064 divider xywh {0 0 30 20} labelsize 0 shortcut 0x90064 divider
} }
MenuItem {} { MenuItem {} {
label {&Move} label {&Move}
user_data BLOCK_MOVE user_data BLOCK_MOVE
xywh {0 0 30 20} shortcut 0x9006d xywh {0 0 30 20} labelsize 0 shortcut 0x9006d
} }
MenuItem {} { MenuItem {} {
label {&Copy} label {&Copy}
user_data BLOCK_COPY user_data BLOCK_COPY
xywh {0 0 36 21} shortcut 0x90063 divider xywh {0 0 36 21} labelsize 0 shortcut 0x90063 divider
} }
MenuItem {} { MenuItem {} {
label {&Fill} label {&Fill}
user_data BLOCK_FILL user_data BLOCK_FILL
xywh {0 0 36 21} shortcut 0x90066 xywh {0 0 36 21} labelsize 0 shortcut 0x90066
} }
MenuItem {} { MenuItem {} {
label {FillWith} label {FillWith}
user_data FILL_BLOCK user_data FILL_BLOCK
xywh {0 0 36 30} xywh {0 0 36 30} labelsize 0 }
}
MenuItem {} { MenuItem {} {
label {C&lear} label {C&lear}
user_data BLOCK_CLEAR user_data BLOCK_CLEAR
xywh {0 0 36 21} shortcut 0x9006c divider xywh {0 0 36 21} labelsize 0 shortcut 0x9006c divider
} }
MenuItem {} { MenuItem {} {
label {&Sort} label {&Sort}
user_data BLOCK_SORT user_data BLOCK_SORT
xywh {0 0 36 21} shortcut 0x90073 xywh {0 0 36 21} labelsize 0 shortcut 0x90073
} }
MenuItem {} { MenuItem {} {
label {Mi&rror} label {Mi&rror}
user_data BLOCK_MIRROR user_data BLOCK_MIRROR
xywh {0 0 36 21} shortcut 0x90072 xywh {0 0 36 21} labelsize 0 shortcut 0x90072
} }
} }
Submenu {} {label {&View} xywh {0 0 70 21}} { Submenu {} {label {&View} xywh {0 0 70 21} labelsize 0 } {
MenuItem {} { MenuItem {} {
label {Column &Width...} label {Column &Width...}
user_data K_COLWIDTH user_data K_COLWIDTH
xywh {0 0 36 21} shortcut 0x80077 xywh {0 0 36 21} labelsize 0 shortcut 0x80077
}
MenuItem {} {
label {Row &Height...}
user_data K_ROWHEIGHT
xywh {0 0 36 21} labelsize 0 shortcut 0x80068
} }
MenuItem {} { MenuItem {} {
label {&Goto} label {&Goto}
user_data K_GOTO user_data K_GOTO
xywh {0 0 36 21} shortcut 0x40067 xywh {0 0 36 21} labelsize 0 shortcut 0x40067
} }
} }
Submenu {} {label {F&ormat} open xywh {5 5 70 21}} { Submenu {} {label {F&ormat} open xywh {5 5 70 21} labelsize 0 } {
MenuItem {} { MenuItem {} {
label {L&abel...} label {L&abel...}
user_data ADJUST_LABEL user_data ADJUST_LABEL
xywh {0 0 36 21} shortcut 0x80061 divider xywh {0 0 36 21} labelsize 0 shortcut 0x80061 divider
} }
MenuItem dim { MenuItem dim {
label {&Dim} label {&Dim}
user_data ADJUST_DIM user_data ADJUST_DIM
protected xywh {0 0 34 21} protected xywh {0 0 34 21} labelsize 0 shortcut 0x40064
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem bold { MenuItem bold {
label {&Bold} label {&Bold}
user_data ADJUST_BOLD user_data ADJUST_BOLD
protected xywh {0 0 34 21} shortcut 0x80062 protected xywh {0 0 34 21} labelsize 0 shortcut 0x40062
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem italic { MenuItem italic {
label {&Italic} label {&Italic}
user_data ADJUST_ITALIC user_data ADJUST_ITALIC
protected xywh {0 0 34 21} protected xywh {0 0 34 21} labelsize 0 shortcut 0x40069
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem underline { MenuItem underline {
label {&Underline} label {&Underline}
user_data ADJUST_UNDERLINE user_data ADJUST_UNDERLINE
protected xywh {0 0 34 21} shortcut 0x80075 divider protected xywh {0 0 34 21} labelsize 0 shortcut 0x40075
divider
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem left { MenuItem left {
label {&Left} label {&Left}
user_data ADJUST_LEFT user_data ADJUST_LEFT
protected xywh {0 0 36 21} shortcut 0x8006c protected xywh {0 0 36 21} labelsize 0 shortcut 0x8006c
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem right { MenuItem right {
label {&Right} label {&Right}
user_data ADJUST_RIGHT user_data ADJUST_RIGHT
protected xywh {0 0 36 21} shortcut 0x80072 protected xywh {0 0 36 21} labelsize 0 shortcut 0x80072
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem center { MenuItem center {
label {&Center} label {&Center}
user_data ADJUST_CENTER user_data ADJUST_CENTER
protected xywh {0 0 36 21} shortcut 0x80063 divider protected xywh {0 0 36 21} labelsize 0 shortcut 0x80063
divider
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem {} { MenuItem {} {
label {&Precision...} label {&Precision...}
user_data ADJUST_PRECISION user_data ADJUST_PRECISION
xywh {0 0 36 21} shortcut 0x80070 xywh {0 0 36 21} labelsize 0 shortcut 0x80070
} }
MenuItem {} { MenuItem {} {
label {&Foreground...} label {&Foreground...}
user_data ADJUST_FOREGROUND user_data ADJUST_FOREGROUND
xywh {0 0 36 21} xywh {0 0 36 21} labelsize 0
} }
MenuItem {} { MenuItem {} {
label {&Background...} label {&Background...}
user_data ADJUST_BACKGROUND user_data ADJUST_BACKGROUND
xywh {0 0 36 21} divider xywh {0 0 36 21} labelsize 0 divider
} }
menuitem dec { menuitem dec {
label {&Decimal} label {&Decimal}
user_data ADJUST_DECIMAL user_data ADJUST_DECIMAL
protected xywh {0 0 36 21} protected xywh {0 0 36 21} labelsize 0
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem sci { MenuItem sci {
label {&Scientific} label {&Scientific}
user_data ADJUST_SCIENTIFIC user_data ADJUST_SCIENTIFIC
protected xywh {0 0 36 21} shortcut 0x80073 protected xywh {0 0 36 21} labelsize 0 shortcut 0x80073
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem cpt { MenuItem cpt {
label {Co&mpact} label {Co&mpact}
user_data ADJUST_COMPACT user_data ADJUST_COMPACT
protected xywh {0 0 36 21} protected xywh {0 0 36 21} labelsize 0
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem hex { MenuItem hex {
label {He&xact} label {He&xact}
user_data ADJUST_COMPACT user_data ADJUST_COMPACT
protected xywh {0 0 36 21} divider protected xywh {0 0 36 21} labelsize 0 divider
code0 {o->flags |= FL_MENU_RADIO;} code0 {o->flags |= FL_MENU_RADIO;}
} }
MenuItem shadow { MenuItem shadow {
label {Shadow&ed} label {Shadow&ed}
user_data ADJUST_SHADOW user_data ADJUST_SHADOW
protected xywh {0 0 36 21} shortcut 0x80065 protected xywh {0 0 36 21} labelsize 0 shortcut 0x80065
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem transparent { MenuItem transparent {
label {&Transparent} label {&Transparent}
user_data ADJUST_TRANSPARENT user_data ADJUST_TRANSPARENT
protected xywh {0 0 36 21} shortcut 0x80074 divider protected xywh {0 0 36 21} labelsize 0 shortcut 0x80074
divider
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem lock { MenuItem lock {
label {Lo&ck} label {Lo&ck}
user_data ADJUST_LOCK user_data ADJUST_LOCK
protected xywh {0 0 36 21} shortcut 0x80063 protected xywh {0 0 36 21} labelsize 0 shortcut 0x80063
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
MenuItem ignore { MenuItem ignore {
label {&Ignore} label {&Ignore}
user_data ADJUST_IGNORE user_data ADJUST_IGNORE
protected xywh {0 0 36 21} shortcut 0x80069 protected xywh {0 0 36 21} labelsize 0 shortcut 0x80069
code0 {o->flags |= FL_MENU_TOGGLE;} code0 {o->flags |= FL_MENU_TOGGLE;}
} }
} }
Submenu {} {label {&Help} open xywh {25 25 67 24}} { Submenu {} {label {Help} open xywh {25 25 67 24} labelsize 0 } {
MenuItem {} { MenuItem {} {
label {&Manual} label {&Manual}
user_data K_HELP user_data K_HELP
xywh {0 0 30 20} shortcut 0xffbe xywh {0 0 30 20} labelsize 0 shortcut 0xffbe
} }
MenuItem {} { MenuItem {} {
label {&About} label {&About}
user_data K_ABOUT user_data K_ABOUT
xywh {0 0 30 20} xywh {0 0 30 20} labelsize 0
} }
} }
} }
Fl_Group line_label { Fl_Group line_label {
label { Input:} open label { Input:} open
protected xywh {0 25 800 25} box ROUND_UP_BOX align 20 deactivate protected xywh {0 9999112 800 9999112} labelsize 9999100
box ROUND_UP_BOX align 20 deactivate
} }
{ {
Fl_Input line_input { Fl_Input line_input {
@ -717,8 +740,12 @@ class MainWindow {open}
line_label->deactivate(); line_label->deactivate();
} }
} }
protected xywh {75 27 723 21} box ROUND_DOWN_BOX protected xywh {75 9999114 723 9999110} box PLASTIC_DOWN_BOX
labelsize 9999100
labeltype NO_LABEL align 20 when 6 deactivate labeltype NO_LABEL align 20 when 6 deactivate
code0 {
line_input->textsize(fontsize);
}
} }
} }
Fl_Box table { Fl_Box table {
@ -802,14 +829,15 @@ class MainWindow {open}
case FLT_NO_FORMAT: ; case FLT_NO_FORMAT: ;
} }
} }
protected xywh {0 50 800 525} box DOWN_FRAME protected xywh {0 9999224 800 99990336} box DOWN_FRAME
labeltype NO_LABEL resizable labeltype NO_LABEL resizable
code0 { table->sheet(sheet); } code0 { table->sheet(sheet); }
class TeapotTable class TeapotTable
} }
Fl_Box status { Fl_Box status {
label {teapot ready.} label {teapot ready.}
protected xywh {0 575 800 25} box GTK_ROUND_DOWN_BOX align 20 protected xywh {0 99990112 800 9999112}
box GTK_ROUND_DOWN_BOX align 20
} }
} code { } code {
current = this; current = this;

39
src/tools/interpolate.py Normal file
View File

@ -0,0 +1,39 @@
# To get around the fact that fluid only allows numerical constants
# in some places that expressions would be preferred, this
# file takes a fluid file which may contain numerical constants of the form
#
# 9999NNN/*REPLACEMENT*/
#
# where the NNN are distinct digit sequences (of any length)
# and the corresponding fluid output and replaces any 9999NNN in the output
# with REPLACEMENT (which can of course be any text). Note that the
# entire numerical constant with its replacement comment must occur within
# a single line of the fluid file. The result is written
# to a new output file with the literal string `_interpolated` interpolated
# before its extension.
from pathlib import Path
import re
import sys
fluidin = sys.argv[1]
genfile = Path(sys.argv[2])
outfile = genfile.with_stem(genfile.stem + '_interpolated')
# First collect all of the replacements from the fluidfile
replacerPattern = re.compile(r"(9999\d*)/[*](.*)[*]/")
replacement = {}
with open(fluidin) as fluidf:
for line in fluidf:
foundpat = replacerPattern.search(line)
if foundpat:
replacement[foundpat[1]] = foundpat[2]
# Now make all replacements in the generated file
with open(outfile, 'w') as outf:
with open(genfile) as genf:
for line in genf:
line = line[:-1]
for key in replacement:
line = line.replace(key, replacement[key])
print(line, file=outf)

View File

@ -62,6 +62,8 @@ Display strings definitely NOT quoted or definitely quoted, respectively.
Redraw the terminal window more often. Redraw the terminal window more often.
.It Fl p Ar digits .It Fl p Ar digits
Set default precision of displayed numbers. Set default precision of displayed numbers.
.It Fl F Ar digits
Set the general font size on pixels (fteapot only).
.El .El
.\" .\"
.\" .\"