From 5e27499194ab5984149b05e3fbe766a96d109eba Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 2 Apr 2020 19:42:17 -0400 Subject: [PATCH] add notcurses-keyplot #430 --- CMakeLists.txt | 37 +++++++++++++++++++++++++++-------- include/notcurses/notcurses.h | 9 +++++---- src/input/keyplot.cpp | 6 ++++++ src/poc/multiselect.c | 2 +- 4 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 src/input/keyplot.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f0be5c982..55acfc850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,7 +332,7 @@ foreach(f ${POCSRCS}) PRIVATE include "${TERMINFO_INCLUDE_DIRS}" ) target_link_libraries(${fe} - PRIVATE notcurses notcurses++ "${TERMINFO_LIBRARIES}" + PRIVATE notcurses++ "${TERMINFO_LIBRARIES}" ) target_link_directories(${fe} PRIVATE "${TERMINFO_LIBRARY_DIRS}" @@ -406,8 +406,8 @@ if(USE_DOXYGEN) endif() endif() -# notcurses-input -file(GLOB INPUTSRCS CONFIGURE_DEPENDS src/input/*.cpp) +# notcurses-input and notcurses-keyplot +file(GLOB INPUTSRCS CONFIGURE_DEPENDS src/input/input.cpp) add_executable(notcurses-input ${INPUTSRCS}) target_include_directories(notcurses-input PRIVATE @@ -416,7 +416,7 @@ target_include_directories(notcurses-input ) target_link_libraries(notcurses-input PRIVATE - notcurses notcurses++ + notcurses++ ) target_compile_options(notcurses-input PRIVATE @@ -427,9 +427,29 @@ target_compile_definitions(notcurses-input FORTIFY_SOURCE=2 ) +file(GLOB KEYPLOTSRCS CONFIGURE_DEPENDS src/input/keyplot.cpp) +add_executable(notcurses-keyplot ${KEYPLOTSRCS}) +target_include_directories(notcurses-keyplot + PRIVATE + include + "${PROJECT_BINARY_DIR}/include" +) +target_link_libraries(notcurses-keyplot + PRIVATE + notcurses++ +) +target_compile_options(notcurses-keyplot + PRIVATE + -Wall -Wextra -W -Wshadow ${DEBUG_OPTIONS} +) +target_compile_definitions(notcurses-keyplot + PRIVATE + FORTIFY_SOURCE=2 +) + # notcurses-ncreel -file(GLOB ncreelSRCS CONFIGURE_DEPENDS src/ncreel/*.cpp) -add_executable(notcurses-ncreel ${ncreelSRCS}) +file(GLOB NCREELSRCS CONFIGURE_DEPENDS src/ncreel/*.cpp) +add_executable(notcurses-ncreel ${NCREELSRCS}) target_include_directories(notcurses-ncreel PRIVATE include @@ -437,7 +457,7 @@ target_include_directories(notcurses-ncreel ) target_link_libraries(notcurses-ncreel PRIVATE - notcurses notcurses++ + notcurses++ ) target_compile_options(notcurses-ncreel PRIVATE @@ -489,7 +509,7 @@ target_link_directories(notcurses-view ) target_link_libraries(notcurses-view PRIVATE - notcurses notcurses++ + notcurses++ PRIVATE "${AVCODEC_LIBRARIES}" "${AVFORMAT_LIBRARIES}" @@ -701,6 +721,7 @@ install(FILES install(PROGRAMS src/pydemo/notcurses-pydemo DESTINATION bin) install(TARGETS notcurses-demo DESTINATION bin) install(TARGETS notcurses-input DESTINATION bin) +install(TARGETS notcurses-keyplot DESTINATION bin) install(TARGETS notcurses-ncreel DESTINATION bin) install(TARGETS notcurses-tester DESTINATION bin) install(TARGETS notcurses-tetris DESTINATION bin) diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 830413681..fff78a91c 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -2486,8 +2486,8 @@ typedef enum { } ncgridgeom_e; // Plots. Given a rectilinear area, an ncplot can graph samples along some axis. -// There is some underlying independent variable--this could be measurement -// number, or measurement time. Samples are tagged with this variable, which +// There is some underlying independent variable--this could be e.g. measurement +// sequence number, or measurement time. Samples are tagged with this variable, which // should never fall, but may grow non-monotonically. The desired range in terms // of the underlying independent variable is provided at creation time. The // desired domain can be specified, or can be autosolved. Granularity of the @@ -2528,8 +2528,9 @@ typedef struct ncplot_options { // number of "pixels" per row x column ncgridgeom_e gridtype; // independent variable can either be a contiguous range, or a finite set - // of keys. - // FIXME give parameters for variables + // of keys. for a time range, say the previous hour sampled with second + // resolution, the independent variable would be the range [0..3960). + int64_t minx, maxx; } ncplot_options; API struct ncplot* ncplot_create(struct ncplane* n, const ncplot_options* opts); diff --git a/src/input/keyplot.cpp b/src/input/keyplot.cpp new file mode 100644 index 000000000..3dd248c66 --- /dev/null +++ b/src/input/keyplot.cpp @@ -0,0 +1,6 @@ +#include +#include + +int main(void){ + return EXIT_FAILURE; // FIXME +} diff --git a/src/poc/multiselect.c b/src/poc/multiselect.c index 572329cb7..97a2987b9 100644 --- a/src/poc/multiselect.c +++ b/src/poc/multiselect.c @@ -67,7 +67,7 @@ int main(void){ sopts.itemcount = sizeof(items) / sizeof(*items); sopts.title = "this is truly an awfully long example of a MULTISELECTOR title"; sopts.secondary = "pick one (you will die regardless)"; - sopts.footer = "press q to exit (there is sartrev(\"no exit\")"; + sopts.footer = "press q to exit (there is sartrev(\"no exit\"))"; channels_set_fg(&sopts.boxchannels, 0x20e0e0); channels_set_fg(&sopts.opchannels, 0xe08040); channels_set_fg(&sopts.descchannels, 0xe0e040);