diff options
author | Berk Geveci <berk.geveci@kitware.com> | 2001-11-04 23:05:21 (GMT) |
---|---|---|
committer | Berk Geveci <berk.geveci@kitware.com> | 2001-11-04 23:05:21 (GMT) |
commit | 939d614978ff6772aae619bfbc3ef89e27b69f73 (patch) | |
tree | 0b6d52df9911a29a10d25afc7650cf7a1c5ba2f1 /Source/CursesDialog/ccurses.cxx | |
parent | ef74458b34dcf2d25b3948c535d59273c2307546 (diff) | |
download | CMake-939d614978ff6772aae619bfbc3ef89e27b69f73.zip CMake-939d614978ff6772aae619bfbc3ef89e27b69f73.tar.gz CMake-939d614978ff6772aae619bfbc3ef89e27b69f73.tar.bz2 |
Adding curses support.
Diffstat (limited to 'Source/CursesDialog/ccurses.cxx')
-rw-r--r-- | Source/CursesDialog/ccurses.cxx | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/Source/CursesDialog/ccurses.cxx b/Source/CursesDialog/ccurses.cxx new file mode 100644 index 0000000..21b07e3 --- /dev/null +++ b/Source/CursesDialog/ccurses.cxx @@ -0,0 +1,71 @@ +#include "cmCursesMainForm.h" +#include "cmCacheManager.h" +#include "cmSystemTools.h" + +#include <curses.h> +#include <form.h> +#include <signal.h> +#include <sys/ioctl.h> + +static cmCursesMainForm* myform=0; +//std::ofstream log("log.txt", std::ios::out); + +void onsig(int sig) +{ + if (myform) + { + endwin(); + WINDOW* w= initscr(); /* Initialization */ + noecho(); /* Echo off */ + cbreak(); /* nl- or cr not needed */ + keypad(stdscr,TRUE); /* Use key symbols as + KEY_DOWN*/ + refresh(); + int x,y; + getmaxyx(w, y, x); + myform->SetWindow(w); + myform->Render(1,1,x,y); + std::cerr << "Size change: " << x << " " << y << std::endl; + } + signal(SIGWINCH, onsig); +} + +int main(int argc, char** argv) +{ + + if ( argc != 2 ) + { + std::cerr << "Usage: " << argv[0] << " source_directory" + << std::endl; + return -1; + } + + int newCache = false; + if (!cmCacheManager::GetInstance()->LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str())) + { + newCache = true; + } + + + WINDOW* w=initscr(); /* Initialization */ + noecho(); /* Echo off */ + cbreak(); /* nl- or cr not needed */ + keypad(stdscr,TRUE); /* Use key symbols as + KEY_DOWN*/ + + signal(SIGWINCH, onsig); + + int x,y; + getmaxyx(w, y, x); + + myform = new cmCursesMainForm(argv[1], newCache); + myform->InitializeUI(w); + myform->Render(1, 1, x, y); + myform->HandleInput(); + + // Need to clean-up better + endwin(); + delete myform; + return 0; + +} |