diff options
Diffstat (limited to 'ycurses/src')
38 files changed, 0 insertions, 2235 deletions
diff --git a/ycurses/src/Makefile.in b/ycurses/src/Makefile.in deleted file mode 100644 index 7723d45..0000000 --- a/ycurses/src/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -SRCS=WILLBEADDEDBYCONFIGURE -OBJS=$(addprefix ../obj/,$(SRCS:.cpp=.o)) -CC=WILLBEADDEDBYCONFIGURE -LIBADD=`cat libs.add` -LDFLAGS=$(LIBADD) -lstdc++ -LDADD= -INCLUDES=`cat includes.add` -CFLAGS=-fno-inline -fno-default-inline -frepo -all: ycurses -$(SRCS): - $(CC) $(INCLUDES) $(CFLAGS) -c $*.cpp -infotext: - @echo Compiling base -ycurses: infotext $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) - @mv ycurses ../bin - @echo -n "Size of linked executable: " - @du -hc ../bin/ycurses | tail -n 1 -clean: - @echo Cleaning base obj - @if test -d ../obj; then rm -Rf ../obj; fi diff --git a/ycurses/src/configure b/ycurses/src/configure deleted file mode 100755 index cb7c9ff..0000000 --- a/ycurses/src/configure +++ /dev/null @@ -1,330 +0,0 @@ -#!/bin/sh - -# -# The ycurses Project (2003 - 2005) -# - -if ! ../scripts/checkperl.sh -then - exit 1 -fi - -if ! test -f ../g++.version -then - echo You need to run ./configure of the top level source dir first - exit 1 -fi - -perl -e ' - use strict; - $|=1; - - my %libadd; - my %incadd; - my $deepness = 500; - - my @headers = ( - "ncurses.h", - "menu.h", - "panel.h" - ); - - my @libs = ( - "libpanel.so", - "libmenu.so", - "libncurses.so" - ); - - my @headerpaths = ( - $ENV{HOME}."/include", - $ENV{HOME}."/usr/include", - "/include", - "/usr/include", - "/usr/local/include", - "/usr/lib/", - "/usr/pkg/include", - "/opt/include", - "/opt/local/include" - ); - - my @libpaths = ( - $ENV{HOME}."/lib", - $ENV{HOME}."/usr/lib", - "/lib", - "/usr/lib", - "/usr/local/lib", - "/usr/pkg/lib", - "/opt/lib", - "/opt/local/lib" - ); - - open FILE, "glob.h" or die "glob.h: $!\n"; - while(<FILE>) - { - if ( /\/\/#define DATABASE/ ) - { - remove_from_array("mysql/mysql.h",\@headers); - remove_from_array("libmysqlclient.so",\@libs); - } - - elsif ( /\/\/#define NCURSES/ ) - { - remove_from_array("ncurses.h",\@headers); - remove_from_array("libncurses.so",\@libs); - } - } - close FILE; - - if ( defined $ENV{YHTTPDHEADERPATHS} ) - { - map { print "Adding $_...\n"; - unshift @headerpaths, $_ } split /:/, $ENV{YHTTPDHEADERPATHS}; - } - - if ( defined $ENV{YHTTPDLIBPATHS} ) - { - map { print "Adding $_...\n"; - unshift @libpaths, $_ } split /:/, $ENV{YHTTPDLIBPATHS}; - } - - - print "Headers:\n"; - - my $testit = 0; - map { $incadd{&check($deepness, $_, @headerpaths)}++ } - @headers; - - $testit = 0; - print "Libraries:\n"; - map { $libadd{&check($deepness, $_, @libpaths)}++ } - @libs; - - my $incadd = &make_add("-I", \%incadd); - my $libadd = &make_add("-L", \%libadd); - - for ( @libs ) - { - $libadd .= "-l$_ " if s/^lib// and s/\.so$//; - } - - print "Incadd: $incadd\n"; - print "Libadd: $libadd\n"; - - `echo $incadd > includes.add`; - `echo $libadd > libs.add`; - - print "Creating new base Makefile...\n"; - unlink("Makefile") if -f "Makefile"; - unlink("../err") if -f "../err"; - open Fin, "Makefile.in" or die "Makefile.in: $!\n"; - open Fout, ">Makefile" or die "Makefile: $!\n"; - -# my $cpp = `echo *.cpp */*.cpp contrib/*/*.cpp | sort`; - my $cpp = `echo *.cpp */*.cpp | sort`; - my $compiler = `tail -n 1 ../g++.version`; - my $version = `tail -n 2 ../g++.version | head -n 1`; - my $uname = `uname -srm`; - my $compopt = join "; ", split /\n/, `cat ../g++.version`; - - chomp $uname; - chomp $compopt; - - print "Configuring for $uname...\n"; - chomp $cpp; - chomp $version; - - while (<Fin>) - { - s/^(CC=).*\n/$1$compiler/; - s/^(SRCS=).*/$1$cpp/; - s/ -frepo//; # unless $version =~ /3\.4/; - if ( $uname !~ /Linux/i ) { - print "Disabling -ldl flag...\n" if s/ -ldl//; - } - print Fout; - } - close Fin; - - my $args = join(" -",@ARGV); - $args = "-".$args unless $args eq ""; - - for my $cppfile (split / /, $cpp) - { - my $ofile = $cppfile; - $ofile =~ s/\.cpp/\.o/; - print Fout "../obj/$ofile: $cppfile\n"; - print Fout "\t\@if ! test -d `dirname ../obj/$ofile`; then mkdir -p `dirname ../obj/$ofile`; fi\n"; - my $class = $ofile; - $class =~ s/\.o//; - if ( $class =~ /contrib\/.+/ ) - { - my $dirname = `dirname $class`; - print Fout "\t\@echo -n \"Compiling contributed class $class \"\n"; - } - - else - { - print Fout "\t\@echo -n \"Compiling base class $class \"\n"; - } - - print Fout "\t\@\$(CC) \$(CFLAGS) \$(INCLUDES) $args -c -o ../obj/$ofile $cppfile\n"; - print Fout "\t\@du -hc ../obj/$ofile | tail -n 1 | sed s/total// | sed \"s/ //g\"\n"; - } - - close Fout; - - open F, "msgs.h" or die "msgs.h: $!\n"; - my @msgs = <F>; - close F; - unlink("msgs.h"); - open F, ">msgs.h" or die "msgs.h: $!\n"; - - for (@msgs) - { - s/(UNAME)(.+)$/UNAME "$uname"/; - s/(COMPOPT)(.+)$/COMPOPT "$compopt"/; - print F; - } - close F; - - if ( -d "mods" ) - { - chdir("mods"); - my $cflags = "-fno-inline -fno-default-inline"; - - $cflags .= " -nostdlib" if $uname =~ /FreeBSD/i && `uname -r` =~ /^4\./; - - system("echo $cflags > cflags.add"); - system("./configure"); - chdir(".."); - } - - sub remove_from_array - { - my $elem = shift; - my $array = shift; - - for ( my $i = 0; $i <= $#$array; ++$i ) - { - if ( $$array[$i] eq $elem ) - { - splice(@$array,$i,1); - last; - } - } # for - } - - sub check { - my $deep = shift; - - if ($deep == 0) { - print "Looking too deep! ($deepness)\n"; - exit(1); - } - - my $check = shift; - $testit = 1 if $check =~ s/::test:://; - - my $print = 1; - if ( $_[-1] eq "subsearch" ) { - $print = 0; - pop(@_); - } - - if ($print) - { - print "Checking for $check..."; - print "\n" if $testit; - } - - for (@_) - { - if ( -f "$_/$check" ) - { - if ($testit) - { - return $_ if test_include($_, $check); - return ""; - } - - else - { - print "OK\n"; - return "" if $_ eq "/usr/lib" or $_ eq "/usr/include"; - return $_; - } - } - } - - for (@_) - { - next unless -d $_; - opendir D, $_ or warn "$_: $!\n"; - my @dir = readdir(D); - closedir D; - - for my $dir ( @dir ) - { - next if $dir =~ /^\.+$/ or !-d "$_/$dir"; - my $path = &check($deep-1, $check, "$_/$dir", "subsearch"); - return $path if $path ne ""; - } - } - - if ($print) - { - print "NOT OK\n"; - print "Please make sure that you have the needed software installed!\n"; - print "If you have a special path for your includes then edit src/configure!\n"; - print "Or set the environment variables YHTTPDHEADERPATHS and YHTTPDLIBPATHS.\n"; - print " Example: setenv YHTTPDHEADERPATHS \"/your/header/includes:/a/includes\"\n"; - print "(The environment variables have to be seperated by an :)\n"; - print "PS: You may use the locate and/or find command to search for files.\n"; - exit(1); - } - - `touch ../err`; - return ""; - } - - sub make_add { - my $flag = shift; - my $add = shift; - my $ret = ""; - - for (reverse keys %$add) { - next unless /.+/; - $ret .= "$flag$_ "; - } - return $ret; - } - - sub test_include - { - my $shift = shift; - my $check = shift; - my $return = 0; - print "Testing $shift/$check..."; - - `echo "\#include \\"maps/hashmap.h\\"" > __test.cpp`; - `echo "int main(void){return 0;}" >> __test.cpp`; - my $cmd = "`tail -n 1 ../g++.version` -I$shift __test.cpp -o /dev/null 2>/dev/null"; - system $cmd; - - unless ($?) - { - print "OK\n"; - $return = 1; - } - - else - { - print "Not OK\n"; - } - - unlink "__test.cpp" if -f "__test.cpp"; - return $return; - } - - exit(0); -' `echo "$*" | sed "s/-//g"` diff --git a/ycurses/src/curses/attributes.cpp b/ycurses/src/curses/attributes.cpp deleted file mode 100644 index b859da0..0000000 --- a/ycurses/src/curses/attributes.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef ATTRIBUTES_CPP -#define ATTRIBUTES_CPP - -#include "attributes.h" - -attributes::attributes() -{ - init(); -} - -attributes::attributes(int i_attr) -{ - init(); - set(true, i_attr); -} - -attributes::attributes(color& r_color) -{ - init(); - set_color(r_color); -} - -void -attributes::init() -{ - p_color = 0; -} - -void -attributes::use_wattron(WINDOW* p_window) -{ - std::set<int>::iterator iter; - for (iter = set_attr.begin(); iter != set_attr.end(); ++iter) - wattron(p_window, *iter); - - if (p_color) - wattron(p_window, COLOR_PAIR(p_color->get_num())); -} - -void -attributes::use_wattroff(WINDOW* p_window) -{ - std::set<int>::iterator iter; - for (iter = set_attr.begin(); iter != set_attr.end(); ++iter) - wattroff(p_window, *iter); - - if (p_color) - wattroff(p_window, COLOR_PAIR(p_color->get_num())); -} - - -void -attributes::unset_all() -{ - set_attr.clear(); - p_color = 0; -} - -bool -attributes::get(int i_attr) -{ - return set_attr.find(i_attr) != set_attr.end(); -} - -void -attributes::set(bool b, int i_attr) -{ - if ((set_attr.find(i_attr) != set_attr.end() ) == b) - return; - - set_attr.insert(i_attr); -} - -void -attributes::set_color(color& r_color) -{ - this->p_color = &r_color; -} - -#endif diff --git a/ycurses/src/curses/attributes.h b/ycurses/src/curses/attributes.h deleted file mode 100644 index 2bc58d6..0000000 --- a/ycurses/src/curses/attributes.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef ATTRIBUTES_H -#define ATTRIBUTES_H - -#include <set> -#include "incl.h" -#include "color.h" - -using namespace std; - -const int Normal = A_NORMAL; -const int Standout = A_STANDOUT; -const int Underline = A_UNDERLINE; -const int Reverse = A_REVERSE; -const int Blink = A_BLINK; -const int Dim = A_DIM; -const int Bold = A_BOLD; -const int Protect = A_PROTECT; -const int Invis = A_INVIS; -const int AltCharSet = A_ALTCHARSET; -const int CharText = A_CHARTEXT; - -class attributes -{ -private: - void init(); - set<int> set_attr; - bool get(int i_attr); - void set(bool b, int i_attr); - color* p_color; - - friend class window; - void use_wattron(WINDOW* p_window); - void use_wattroff(WINDOW* p_window); - -public: - attributes(); - attributes(int i_attr); - attributes(color& r_color); - - void set(int i_attr) { set(true, i_attr); } - void unset(int i_attr ) { set(false, i_attr); } - void unset_all(); - void set_color(color& r_color); - - void set_normal(bool b) { set(b, Normal); } - void set_standout(bool b) { set(b, Standout); } - void set_underline(bool b) { set(b, Underline); } - void set_reverse(bool b) { set(b, Reverse); } - void set_blink(bool b) { set(b, Blink); } - void set_dim(bool b) { set(b, Dim); } - void set_bold(bool b) { set(b, Bold); } - void set_protect(bool b) { set(b, Protect); } - void set_invisible(bool b) { set(b, Invis); } - void set_altcharset(bool b) { set(b, AltCharSet); } - void set_chartext(bool b) { set(b, CharText); } - - bool get_normal() { return get(Normal); } - bool get_standout() { return get(Standout); } - bool get_underline() { return get(Underline); } - bool get_reverse() { return get(Reverse); } - bool get_blink() { return get(Blink); } - bool get_dim() { return get(Dim); } - bool get_bold() { return get(Bold); } - bool get_protect() { return get(Protect); } - bool get_invisible() { return get(Invis); } - bool get_altcharset() { return get(AltCharSet); } - bool get_chartext() { return get(CharText); } -}; - -#endif diff --git a/ycurses/src/curses/color.cpp b/ycurses/src/curses/color.cpp deleted file mode 100644 index 190d343..0000000 --- a/ycurses/src/curses/color.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef COLOR_CPP -#define COLOR_CPP - -#include "color.h" - -bool color::b_activated = false; -int color::i_pair_count = 0; - -color::color(short i, short j) - : i_foreground(i), i_background(j) -{ - init(); - - i_pair = ++i_pair_count; - - /* - * Simple color assignment. color pair 0 cannot - * be redefined. - */ - init_pair(i_pair, i_foreground, i_background); -} - -color::~color() -{ -} - -void -color::init() -{ - if ( !b_activated ) - { - if (has_colors()) - { - start_color(); - b_activated = true; - } - } -} - -void -color::enable() -{ - attron(COLOR_PAIR(i_pair)); -} - -void -color::disable() -{ - attroff(COLOR_PAIR(i_pair)); -} - - -#endif - diff --git a/ycurses/src/curses/color.h b/ycurses/src/curses/color.h deleted file mode 100644 index a59727c..0000000 --- a/ycurses/src/curses/color.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef COLOR_H -#define COLOR_H - -#include "incl.h" - -using namespace std; - -const short Red = COLOR_RED; -const short Green = COLOR_GREEN; -const short Yellow = COLOR_YELLOW; -const short Blue = COLOR_BLUE; -const short Cyan = COLOR_CYAN; -const short Magenta = COLOR_MAGENTA; -const short White = COLOR_WHITE; -const short Black = COLOR_BLACK; - -class color -{ - private: - void init(); - - static int i_pair_count; - short i_pair; - short i_foreground; - short i_background; - static bool b_activated; - - friend class curses; - - public: - color(short i, short j); - ~color(); - void enable(); - void disable(); - short get_num() { return i_pair; } -}; - -#endif diff --git a/ycurses/src/curses/coordinate.cpp b/ycurses/src/curses/coordinate.cpp deleted file mode 100644 index efdf9e2..0000000 --- a/ycurses/src/curses/coordinate.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef COORDONATE_CPP -#define COORDONATE_CPP - -#include "coordinate.h" - -coordinate::coordinate() -{ - y = x = 0; -} - -coordinate::coordinate(coordinate_type type, dummy_window& r_win) -{ - set(type, r_win); -} - -coordinate::coordinate(coordinate_type type) -{ - set(type); -} - -coordinate::coordinate(int y, int x) -{ - this->y = y; - this->x = x; -} - -coordinate& -coordinate::set(coordinate_type type, dummy_window& r_win) -{ - switch (type) - { - case Absolutecoord: - getyx(r_win.get_WINDOW(), y, x); - break; - - case Relativecoord: - getparyx(r_win.get_WINDOW(), y, x); - break; - - case Beginningcoord: - getbegyx(r_win.get_WINDOW(), y, x); - break; - - case windowSize: - getmaxyx(r_win.get_WINDOW(), y, x); - break; - - default: - set(type); - } - - return *this; -} - -coordinate& -coordinate::set(coordinate_type type) -{ - switch (type) - { - case TerminalSize: - y = COLS; - x = LINES; - break; - - case TerminalCenter: - y = static_cast<int>(COLS / 2); - x = static_cast<int>(LINES / 2); - break; - } - - return *this; -} - -coordinate& -coordinate::left() -{ - return left(1); -} - -coordinate& -coordinate::right() -{ - return right(1); -} - -coordinate& -coordinate::up() -{ - return up(1); -} - -coordinate& -coordinate::down() -{ - return down(1); -} - -coordinate& -coordinate::left(int i) -{ - x -= i; - return *this; -} - -coordinate& -coordinate::right(int i) -{ - x += i; - return *this; -} - -coordinate& -coordinate::up(int i) -{ - y -= i; - return *this; -} - -coordinate& -coordinate::down(int i) -{ - y += i; - return *this; -} - -coordinate& -coordinate::displace(int i_y, int i_x) -{ - y += i_y; - x += i_x; - return *this; -} - -#endif diff --git a/ycurses/src/curses/coordinate.h b/ycurses/src/curses/coordinate.h deleted file mode 100644 index c17b36b..0000000 --- a/ycurses/src/curses/coordinate.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef COORDINATE_H -#define COORDINATE_H - -#include "incl.h" -#include "dummy.h" - -using namespace std; - -enum coordinate_type -{ - Absolutecoord, - Relativecoord, - Beginningcoord, - windowSize, - TerminalSize, - TerminalCenter -}; - - -struct coordinate -{ - int y, x; - - coordinate(); - coordinate(coordinate_type type, dummy_window& r_win); - coordinate(coordinate_type type); - coordinate(int y, int x); - - coordinate& set(coordinate_type type, dummy_window& r_win); - coordinate& set(coordinate_type type); - coordinate& left(); - coordinate& right(); - coordinate& up(); - coordinate& down(); - coordinate& left(int i); - coordinate& right(int i); - coordinate& up(int i); - coordinate& down(int i); - coordinate& displace(int i_y, int i_x); - -}; - -#endif diff --git a/ycurses/src/curses/coordinate.impl b/ycurses/src/curses/coordinate.impl deleted file mode 100644 index 8bdf17c..0000000 --- a/ycurses/src/curses/coordinate.impl +++ /dev/null @@ -1,17 +0,0 @@ -template<class T> -coordinate -create_coordinate(dummy_window& d_window) -{ - coordinate coord; - T(d_window, coord.x, coord.y); - return coord; -} - -template<class T> -coordinate -create_coordinate() -{ - coordinate coord; - T(coord.x, coord.y); - return coord; -} diff --git a/ycurses/src/curses/curses.cpp b/ycurses/src/curses/curses.cpp deleted file mode 100644 index 3605e59..0000000 --- a/ycurses/src/curses/curses.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef CURSES_CPP -#define CURSES_CPP - -#include "curses.h" - -int curses::i_self_counter = 0; - -curses::curses() -{ - if ( ++i_self_counter == 1 ) - { - initscr(); - raw(); - keypad(stdscr, TRUE); - noecho(); - } -} - -curses::~curses() -{ - if ( --i_self_counter == 0 ) - { -/* - Factory<attributes>::destroyAll(); - Factory<color>::destroyAll(); - Factory<window>::destroyAll(); - Factory<menu>::destroyAll(); - Factory<pwindow>::destroyAll(); - */ - clear(); - endwin(); - } -} - -void -curses::finish() -{ -} - -int -curses::get_char() -{ - return getch(); -} - -string -curses::get_string() -{ - char c[1024]; - getstr(c); - return string(c); -} - -void -curses::pause() -{ - getch(); -} - -void -curses::disable() -{ - refresh(); - def_prog_mode(); - endwin(); -} - -void -curses::enable() -{ - reset_prog_mode(); - refresh(); -} - -void -curses::clear() -{ - coordinate coord(LINES, COLS); - for ( int i = 0; i < coord.y; ++i ) - for ( int j = 0; j < coord.x; ++j ) - mvaddch(i, j, ' '); - - refresh(); -} - -#endif diff --git a/ycurses/src/curses/curses.h b/ycurses/src/curses/curses.h deleted file mode 100644 index 04ed707..0000000 --- a/ycurses/src/curses/curses.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef CURSES_H -#define CURSES_H - -#include "attributes.h" -#include "incl.h" -#include "color.h" -#include "cursor.h" -#include "menu.h" -#include "pwindow.h" -#include "tool.h" -#include "window.h" -#include "coordinate.h" - -using namespace std; - -/* This class is representing the base of curses, it has to be instantiated - * in order to use curses. - */ -class curses -{ - private: - static int i_self_counter; - - public: - /* Initializes curses before its first use */ - curses(); - - /* Removes all curses elements, all objects (such as window, color etc) - * be finished as well! - */ - ~curses(); - - /* Waits for user intput and returns the ASCII code being typed */ - static int get_char(); - - /* Returns the string being typed until the first return */ - static string get_string(); - - /* Waits intil the user hits a key */ - static void pause(); - - static void disable(); - static void enable(); - - /* Removes all curses elements, all objects (such as window, color etc) will - * be finished as well! This method will be called by ~curses internally. - * You can also use this method instead of the destructor if you wanna use - * another shutdown routine like catching SIGINT first, deleting your own - * stuff, and then running curses::finish();! - */ - static void finish(); - static void clear(); -}; - -#endif diff --git a/ycurses/src/curses/cursor.cpp b/ycurses/src/curses/cursor.cpp deleted file mode 100644 index eaa10a7..0000000 --- a/ycurses/src/curses/cursor.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef CURSOR_CPP -#define CURSOR_CPP - -#include "cursor.h" - -cursor::cursor() -{ -} - -cursor::cursor(cursorType t) -{ - set(t); -} - -cursor::cursor(coordinate& r_coord) -{ - set(r_coord); -} - -void -cursor::set(cursorType t) -{ - curs_set(t); -} - -void -cursor::set(coordinate& r_coord) -{ - move(r_coord.y, r_coord.x); -} - -#endif diff --git a/ycurses/src/curses/cursor.h b/ycurses/src/curses/cursor.h deleted file mode 100644 index 504a44c..0000000 --- a/ycurses/src/curses/cursor.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CURSOR_H -#define CURSOR_H - -#include "incl.h" -#include "coordinate.h" - -using namespace std; - -enum cursorType -{ - Invisible = 0, - Visible, - VeryVisible -}; - -struct cursor -{ - cursor(); - cursor(cursorType t); - cursor(coordinate& r_coord); - - static void set(cursorType t); - static void set(coordinate& r_coord); - - static void set_invisible() { set(Invisible); } - static void setVisible() { set(Visible); } - static void setVeryVisible() { set(VeryVisible); } -}; - -#endif diff --git a/ycurses/src/curses/dummy.cpp b/ycurses/src/curses/dummy.cpp deleted file mode 100644 index eab2b13..0000000 --- a/ycurses/src/curses/dummy.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DUMMY_CPP -#define DUMMY_CPP - -#include "dummy.h" - -WINDOW* dummy_window::get_WINDOW() -{ - return 0; -} - -#endif diff --git a/ycurses/src/curses/dummy.h b/ycurses/src/curses/dummy.h deleted file mode 100644 index d691e1c..0000000 --- a/ycurses/src/curses/dummy.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DUMMY_H -#define DUMMY_H - -#include "incl.h" - -struct dummy_window -{ - virtual WINDOW* get_WINDOW(); -}; - -#endif diff --git a/ycurses/src/curses/hidden.cpp b/ycurses/src/curses/hidden.cpp deleted file mode 100644 index 9f9b39f..0000000 --- a/ycurses/src/curses/hidden.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef HIDDEN_CPP -#define HIDDEN_CPP - -#include "hidden.h" - -hidden::hidden() -{ - show(); -} - -void -hidden::hide() -{ - b_hidden = true; -} - -void -hidden::show() -{ - b_hidden = false; -} - -bool -hidden::is_hidden() -{ - return b_hidden; -} - -#endif diff --git a/ycurses/src/curses/hidden.h b/ycurses/src/curses/hidden.h deleted file mode 100644 index f0f632a..0000000 --- a/ycurses/src/curses/hidden.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef HIDDEN_H -#define HIDDEN_H - -#include "incl.h" - -using namespace std; - -class hidden -{ - private: - bool b_hidden; - - public: - hidden(); - virtual void hide(); - virtual void show(); - bool is_hidden(); -}; - -#endif - diff --git a/ycurses/src/curses/incl.h b/ycurses/src/curses/incl.h deleted file mode 100644 index b31d1ff..0000000 --- a/ycurses/src/curses/incl.h +++ /dev/null @@ -1,8 +0,0 @@ -#include <iostream> -#include <map> -#include <string> -#include <vector> - -#include <ncurses.h> -#include <menu.h> -#include <panel.h> diff --git a/ycurses/src/curses/menu.cpp b/ycurses/src/curses/menu.cpp deleted file mode 100644 index e240566..0000000 --- a/ycurses/src/curses/menu.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef MENU_CPP -#define MENU_CPP - -#include "menu.h" - -menu::menu(vector<string>& vec_choices) -{ - init(vec_choices); -} - -menu::~menu() -{ - if (p_items) - { - for (int i = 0; i < i_choices; ++i) - free_item(p_items[i]); - - delete [] p_items; - p_items = 0; - } - - if (p_menu) - { - free_menu(p_menu); - p_menu = 0; - } - - if (p_win) - { - delete p_win; - p_win = 0; - } -} - -void -menu::init(vector<string>& vec_choices) -{ - i_choices = vec_choices.size(); - i_current = 0; - - int i_choices = vec_choices.size(); - int iMaxLen = 0; - p_items = new ITEM*[i_choices]; - - for (int i = 0; i < i_choices; ++i) - { - p_items[i] = new_item(vec_choices.at(i).c_str(), ""); - int iLen = vec_choices.at(i).length(); - if (iLen > iMaxLen) - iMaxLen = iLen; - } - - p_menu = new_menu(p_items); - - p_win = new window(i_choices+2, iMaxLen+4, 4, 4); - WINDOW* p_window = p_win->get_WINDOW(); - - set_menu_win(p_menu, p_window); - set_menu_sub(p_menu, derwin(p_window, i_choices, iMaxLen+2, 1, 1)); - - refresh(); - post_menu(p_menu); - wrefresh(p_window); -} - -window& -menu::get_window() -{ - return *p_win; -} - -int -menu::run() -{ - WINDOW* p_window = p_win->get_WINDOW(); - keypad(p_window, 1); - int i_choice; - - while( (i_choice = wgetch(p_window)) ) - { - switch(i_choice) - { - case KEY_DOWN: - case 'j': // Vi mode - if ( i_current < i_choices-1 ) - ++i_current; - menu_driver(p_menu, REQ_DOWN_ITEM); - break; - - case KEY_UP: - case 'k': // Vi mode - if ( i_current > 0 ) - --i_current; - menu_driver(p_menu, REQ_UP_ITEM); - break; - - case 'h': // Vi mode - case 'q': // Vi mode - case 27: // ESC - i_current = i_choices-1; // Select last entry. - - case 'l': // Vi mode - case 10: // Enter - case 32: // Space - keypad(p_window, 0); - return i_current; - } - -// window win_root(root); -// win_root.print(i_choice); - - wrefresh(p_window); - } -} - -#endif - diff --git a/ycurses/src/curses/menu.h b/ycurses/src/curses/menu.h deleted file mode 100644 index 3b672c3..0000000 --- a/ycurses/src/curses/menu.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef MENU_H -#define MENU_H - -#include "incl.h" -#include "window.h" - -using namespace std; - -class menu -{ - private: - void init(vector<string>& vec_choices); - - int i_choices, i_current; - ITEM** p_items; - MENU* p_menu; - window* p_win; - - public: - menu(vector<string>& vec_choices); - menu(string s_name, vector<string>& vec_choices); - ~menu(); - - window& get_window(); - int run(); -}; - -#endif diff --git a/ycurses/src/curses/pwindow.cpp b/ycurses/src/curses/pwindow.cpp deleted file mode 100644 index 9ef2d80..0000000 --- a/ycurses/src/curses/pwindow.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef PANEL_CPP -#define PANEL_CPP - -#include "pwindow.h" - -pwindow::pwindow(window& r_win) -{ - p_window = &r_win; - init(); -} - -void -pwindow::reinit(window& r_win) -{ - p_window = &r_win; - init(); -} - -pwindow::~pwindow() -{ - remove(); -} - -void -pwindow::remove() -{ - if (p_panel) - { - del_panel(p_panel); - p_panel = 0; - } - - update(); -} - -void -pwindow::init() -{ - p_panel = new_panel(p_window->get_WINDOW()); - update(); -} - -void -pwindow::update() -{ - update_panels(); - doupdate(); -} - -void -pwindow::on_bottom() -{ - bottom_panel(p_panel); - update(); -} - -void -pwindow::on_top() -{ - top_panel(p_panel); - update(); -} - -void -pwindow::hide() -{ - hidden::hide(); - hide_panel(p_panel); - update(); -} - -void -pwindow::show() -{ - hidden::show(); - show_panel(p_panel); - update(); -} - -void -pwindow::move(coordinate& r_coord) -{ - move(r_coord.y, r_coord.x); -} - -void -pwindow::move(int y, int x) -{ - move_panel(p_panel, y, x); - update(); -} - -PANEL* -pwindow::get_PANEL() -{ - return p_panel; -} - -#endif diff --git a/ycurses/src/curses/pwindow.h b/ycurses/src/curses/pwindow.h deleted file mode 100644 index 49b1d75..0000000 --- a/ycurses/src/curses/pwindow.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef PWINDOW_H -#define PWINDOW_H - -using namespace std; - -#include "incl.h" -#include "coordinate.h" -#include "hidden.h" -#include "window.h" - -class pwindow : public hidden -{ - - private: - PANEL* p_panel; - window* p_window; - void init(); - - public: - pwindow(window& r_win); - ~pwindow(); - void init(window& r_win); - void reinit(window& r_win); - - void remove(); - void on_bottom(); - void on_top(); - void hide(); - void show(); - void move(int y, int x); - void move(coordinate& r_coord); - - static void update(); - PANEL* get_PANEL(); -}; - -#endif diff --git a/ycurses/src/curses/tool.cpp b/ycurses/src/curses/tool.cpp deleted file mode 100644 index 1bce76f..0000000 --- a/ycurses/src/curses/tool.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef TOOL_CPP -#define TOOL_CPP - -#include "tool.h" - -string -tool::int2string(int i_int) -{ - char buf[64]; - sprintf(buf, "%d", i_int); - return buf; -} - -int -tool::string2int(string s) -{ - const char *p = s.c_str(); - int i_res = 0; - - // Convert each digit char and add into result. - while (*p >= '0' && *p <='9') - { - i_res = (i_res * 10) + (*p - '0'); - p++; - } - - // Check that there were no non-digits at end. - if (*p != 0) - { - return -1; - } - - return i_res; -} - -#endif - diff --git a/ycurses/src/curses/tool.h b/ycurses/src/curses/tool.h deleted file mode 100644 index 130bd09..0000000 --- a/ycurses/src/curses/tool.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef TOOL_H -#define TOOL_H - -#include "incl.h" - -using namespace std; - -class tool -{ -public: - static string int2string( int i_int ); - static int string2int( string s ); -}; - -#endif diff --git a/ycurses/src/curses/window.cpp b/ycurses/src/curses/window.cpp deleted file mode 100644 index d5ce37c..0000000 --- a/ycurses/src/curses/window.cpp +++ /dev/null @@ -1,367 +0,0 @@ -#ifndef WINDOW_CPP -#define WINDOW_CPP - -#include "window.h" - -bool window::b_is_rootoot = false; - -window::window(window_type t) -{ - b_is_rootoot = true; - init(); - p_window = stdscr; -} - -window::window(int i_height, int i_width) -{ - init(); - - this->i_height = i_height; - this->i_width = i_width; - this->i_start_y = (LINES - i_height) / 2; - this->i_start_x = (COLS - i_width) / 2; - - p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); -} - -window::window(int i_height, int i_width, coordinate& r_coord) -{ - init(); - - this->i_height = i_height; - this->i_width = i_width; - this->i_start_y = r_coord.y; - this->i_start_x = r_coord.x; - - p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); -} - -window::window(int i_height, int i_width, int i_start_y, int i_start_x) -{ - init(); - - this->i_height = i_height; - this->i_width = i_width; - this->i_start_y = i_start_y; - this->i_start_x = i_start_x; - - p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); -} - -window::~window() -{ - if (p_window) - { - if(!is_root_win()) - destroy_win(p_window); - - p_window = 0; - } -} - -bool -window::is_root_win() -{ - return b_is_rootoot; -} - -void -window::init() -{ -} - -WINDOW* -window::create_new_win(int i_height, int i_width, int i_start_y, int i_start_x) -{ - WINDOW *p_local_win = newwin(i_height, i_width, i_start_y, i_start_x); - box(p_local_win, 0 , 0); /* 0, 0 gives default characters - * for the vertical and horizontal - * lines */ - wrefresh(p_local_win); /* Show that box */ - - return p_local_win; -} - -void -window::destroy_win(WINDOW *p_local_win) -{ - /* box(local_win, ' ', ' '); : This won't produce the desired - * result of erasing the window. It will leave it's four corners - * and so an ugly remnant of window. - */ - - wborder(p_local_win, ' ', ' ', ' ',' ',' ',' ',' ',' '); - /* The parameters taken are - * 1. win: the window on which to operate - * 2. ls: character to be used for the left side of the window - * 3. rs: character to be used for the right side of the window - * 4. ts: character to be used for the top side of the window - * 5. bs: character to be used for the bottom side of the window - * 6. tl: character to be used for the top left corner of the window - * 7. tr: character to be used for the top right corner of the window - * 8. bl: character to be used for the bottom left corner of the window - * 9. br: character to be used for the bottom right corner of the window - */ - - wrefresh(p_local_win); - delwin(p_local_win); -} - -void -window::hide() -{ - hidden::hide(); - - if (p_window) - destroy_win(p_window); -} - -void -window::show() -{ - if (!is_hidden()) - return; - - hidden::show(); - - p_window = create_new_win(i_height, i_width, i_start_y, i_start_x); - - refresh(); -} - -void -window::refresh() -{ - wrefresh(p_window); -} - -void -window::set_attributes(attributes& r_attr) -{ - r_attr.use_wattron(p_window); -} - -void -window::unset_attributes(attributes& r_attr) -{ - r_attr.use_wattroff(p_window); -} - -int -window::save_attributes() -{ - return attr_get(&sr_attributes, &sr_pair, sr_options); -} - -int -window::restore_attributes() -{ - return attr_set(sr_attributes, sr_pair, sr_options); -} - -void -window::print(int i) -{ - print(tool::int2string(i)); -} - -void -window::print(coordinate &r_coord, string s) -{ - print(r_coord.y, r_coord.x, s); -} - -void -window::print(int i_y, int i_x, int i) -{ - print(i_y, i_x, tool::int2string(i)); -} - -void -window::print(coordinate &r_coord, int i) -{ - print(r_coord, tool::int2string(i)); -} - -void -window::println(int i) -{ - println(tool::int2string(i)); -} - -void -window::println(coordinate &r_coord, string s) -{ - println(r_coord.y, r_coord.x, s); -} - -void -window::println(int i_y, int i_x, int i) -{ - println(i_y, i_x, tool::int2string(i)); -} - -void -window::println(coordinate &r_coord, int i) -{ - println(r_coord, tool::int2string(i)); -} - -void -window::print(string s) -{ - wprintw(p_window, const_cast<char*>(s.c_str())); - refresh(); -} - -void -window::print(int i_y, int i_x, string s) -{ - mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str())); - refresh(); -} - -void -window::println(string s) -{ - wprintw(p_window, const_cast<char*>((s+"\n").c_str())); - refresh(); -} - -void -window::println(int i_y, int i_x, string s) -{ - mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str())); - refresh(); -} - -void -window::print(int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - print(tool::int2string(i)); - restore_attributes(); -} - -void -window::print(coordinate &r_coord, string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - print(r_coord.y, r_coord.x, s); - restore_attributes(); -} - -void -window::print(int i_y, int i_x, int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - print(i_y, i_x, tool::int2string(i)); - restore_attributes(); -} - -void -window::print(coordinate &r_coord, int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - print(r_coord, tool::int2string(i)); - restore_attributes(); -} - -void -window::println(int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - println(tool::int2string(i)); - restore_attributes(); -} - -void -window::println(coordinate &r_coord, string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - println(r_coord.y, r_coord.x, s); - restore_attributes(); -} - -void -window::println(int i_y, int i_x, int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - println(i_y, i_x, tool::int2string(i)); - restore_attributes(); -} - -void -window::println(coordinate &r_coord, int i, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - println(r_coord, tool::int2string(i)); - restore_attributes(); -} - -void -window::print(string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - wprintw(p_window, const_cast<char*>(s.c_str())); - refresh(); - restore_attributes(); -} - -void -window::print(int i_y, int i_x, string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str())); - refresh(); - restore_attributes(); -} - -void -window::println(string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - wprintw(p_window, const_cast<char*>((s+"\n").c_str())); - refresh(); - restore_attributes(); -} - -void -window::println(int i_y, int i_x, string s, attributes& r_attr) -{ - save_attributes(); - set_attributes(r_attr); - mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str())); - refresh(); - restore_attributes(); -} - -void -window::move_cursor(coordinate& r_coord) -{ - move_cursor(r_coord.y, r_coord.x); -} - -void -window::move_cursor(int i_y, int i_x) -{ - if (!p_window) - return; - - wmove(p_window, i_y, i_x); - refresh(); -} - - -#endif diff --git a/ycurses/src/curses/window.h b/ycurses/src/curses/window.h deleted file mode 100644 index d194e2f..0000000 --- a/ycurses/src/curses/window.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef WINDOW_H -#define WINDOW_H - -#include "attributes.h" -#include "color.h" -#include "coordinate.h" -#include "dummy.h" -#include "hidden.h" -#include "incl.h" -#include "tool.h" - -using namespace std; - -enum window_type -{ - root -}; - -class window : public dummy_window, hidden -{ - private: - WINDOW* p_window; - int i_height, i_width, i_start_y, i_start_x; - static bool b_is_rootoot; - - /* For save_attributes and restore_attributes */ - attr_t sr_attributes; short sr_pair; void *sr_options; - - WINDOW *create_new_win(int i_height, int i_width, int i_start_y, int i_start_x); - void destroy_win(WINDOW *p_local_win); - - /* Called by the constructors */ - void init(); - - public: - window(window_type t); - window(int i_height, int i_width, coordinate& r_coord); - window(int i_height, int i_width, int i_start_y, int i_start_x); - window(int i_height, int i_width); - ~window(); - - void hide(); - void show(); - void refresh(); - void set_attributes(attributes& r_attr); - void unset_attributes(attributes& r_attr); - bool is_root_win(); - - WINDOW* get_WINDOW() { return p_window; } - - int save_attributes(); - int restore_attributes(); - - void move_cursor(coordinate& r_coord); - void move_cursor(int i_y, int i_x); - - void print(string s); - void print(int i_y, int i_x, string s); - void println(string s); - void println(int i_y, int i_x, string s); - void print(int i); - void print(coordinate &r_coord, string s); - void print(int i_y, int i_x, int i); - void print(coordinate &r_coord, int i); - void println(int i); - void println(coordinate &r_coord, string s); - void println(int i_y, int i_x, int i); - void println(coordinate &r_coord, int i); - - void print(string s, attributes& r_attr); - void print(int i_y, int i_x, string s, attributes& r_attr); - void println(string s, attributes& r_attr); - void println(int i_y, int i_x, string s, attributes& r_attr); - void print(int i, attributes& r_attr); - void print(coordinate &r_coord, string s, attributes& r_attr); - void print(int i_y, int i_x, int i, attributes& r_attr); - void print(coordinate &r_coord, int i, attributes& r_attr); - void println(int i, attributes& r_attr); - void println(coordinate &r_coord, string s, attributes& r_attr); - void println(int i_y, int i_x, int i, attributes& r_attr); - void println(coordinate &r_coord, int i, attributes& r_attr); -}; - -#endif - diff --git a/ycurses/src/curses/ycurses.h b/ycurses/src/curses/ycurses.h deleted file mode 100644 index 1699e96..0000000 --- a/ycurses/src/curses/ycurses.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef YCURSES_H -#define YCURSES_H - -#include "curses.h" - -#endif diff --git a/ycurses/src/examples/example1.cpp b/ycurses/src/examples/example1.cpp deleted file mode 100644 index 239e476..0000000 --- a/ycurses/src/examples/example1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "example1.h" - -int example1() -{ - /* Initialize the ycurses object at first! You MUST also delete this as the last! */ - curses cur; - - /* Make the cursor invisible. - * All available options are: - * Invisible - * Visible - * VeryVisible - */ - cursor::set_invisible(); - - /* Get the root-window */ - window win_root(root); - - /* - * There are standard colors defined which can be mixed together to - * get foreground/background color pairs: - * Red, Green, Yellow, Blue, Cyan, Magenta and White - */ - color col1(Cyan, Blue); // 1. With implicit Name. - // color col1("col1", Cyan, Blue); // 2. With explicit Name. - - /* Now we define attributes, and pass them the color */ - attributes attr1(col1); - win_root.set_attributes(attr1); - - /* Print out some text on the cursor location, with line break */ - win_root.println(0, 0, "Hello, welcome to ncurses in cyan-blue"); - - win_root.unset_attributes(attr1); - - /* Create a new centeralized window with the specified height and width */ - window win1(20, 78); - - color col2(Yellow, Black); - attributes attr2(col2); - attr1.set_bold(true); - - win1.set_attributes(attr2); - win1.print(2, 2, "Print into window at pos 2-2 w/out newline in yellow-black-bold!"); - - /* Create yet another window */ - window win2(10, 20); - - /* Print out the y and the x component of the absolute coordinates of win1 */ - coordinate coord_win(Absolutecoord,win1); - coordinate coord_text(10,11); - - /* Other available coordinates - * - * coordinate(Absolutecoord,win1); // Gets window's absolute position. - * coordinate(Relativecoord,win1); // Gets window's relative position. - * coordinate(Beginningcoord,win1); // Gets window's beginning coords. - * coordinate(windowSize,win1); // Gets window's size. - * coordinate(TerminalSize); // Gets the total terminal size. - * coordinate(TerminalCenter); // Gets the center of the terminal - */ - - attributes attr_bold(Bold); - // Hint: you can use Normal instead of Bold to set all attributes to default. - - win_root.print(coord_text, "Demonstration output", attr_bold); - win_root.print(coord_text.down(), "coordinate y:"); - win_root.print(coord_text.displace(1,1), coord_win.y, attr_bold); - win_root.print(coord_text.displace(1,-1), "coordinate x:"); - win_root.print(coord_text.displace(1,1), coord_win.x, attr_bold); - - /* Wait for user key stroke */ - cur.pause(); - - /* Deletes all curses elements from memory, also all pointers - Because the ycurses Objekt will get out of scope now. - */ - return 0; -} - diff --git a/ycurses/src/examples/example1.h b/ycurses/src/examples/example1.h deleted file mode 100644 index dc5e753..0000000 --- a/ycurses/src/examples/example1.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef EXAMPLE1_H -#define EXAMPLE1_H - -#include "../curses/ycurses.h" - -int example1(); - -#endif diff --git a/ycurses/src/examples/example2.cpp b/ycurses/src/examples/example2.cpp deleted file mode 100644 index c93d79c..0000000 --- a/ycurses/src/examples/example2.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "example2.h" - -int example2() -{ - curses cur; - cursor::set_invisible(); - - window win_root(root); - win_root.print(1, 1, "Press any key to continue..."); - - coordinate coord(2, 0);; - - window win1(10, 40, coord); - window win2(10, 40, coord.displace(3, 6)); - window win3(10, 40, coord.displace(3, 6)); - - win1.print(1, 1, "window 1"); - win2.print(1, 1, "window 2"); - win3.print(1, 1, "window 3"); - - /* Initialize pwindows. */ - pwindow pwindow1(win1); - pwindow pwindow2(win2); - pwindow pwindow3(win3); - - - /* Remove pwindow3, pwindow3 doesnt contain a valid pwindow any more! - * DONT USE THIS OBJECT AGAIN until re-init!!! - */ - pwindow3.remove(); - - /* Re-init a new pwindow, using the old variable. Now the object - * can be used again. - */ - pwindow3.reinit(win3); - cur.pause(); - - /* Remove the center pwindow. */ - pwindow2.remove(); - win3.print(2, 1, "pwindow 2 removed!"); - cur.pause(); - - win1.print(2, 1, "Some text!"); - cur.pause(); - - pwindow3.remove(); - win1.print(3, 1, "pwindow 3 removed!"); - cur.pause(); - - return 0; -} - diff --git a/ycurses/src/examples/example2.h b/ycurses/src/examples/example2.h deleted file mode 100644 index fbdc6c7..0000000 --- a/ycurses/src/examples/example2.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef EXAMPLE2_H -#define EXAMPLE2_H - -#include "../curses/ycurses.h" - -int example2(); - -#endif diff --git a/ycurses/src/examples/example3.cpp b/ycurses/src/examples/example3.cpp deleted file mode 100644 index 5fee1f8..0000000 --- a/ycurses/src/examples/example3.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "example3.h" - -int example3() -{ - curses cur; - cursor::set_invisible(); - - window win_root(root); - win_root.print(1, 1, "Press any key to continue..."); - - coordinate coord(2, 0);; - window win1(10, 30, coord); - window win2(10, 30, coord.displace(3, 6)); - - win1.print(1, 1, "pwindow 1"); - win2.print(1, 1, "pwindow 2"); - - pwindow pwindow1(win1); - pwindow pwindow2(win2); - - cur.pause(); - - pwindow1.hide(); - win2.print(2, 1, "pwindow 1 hidden"); - cur.pause(); - - pwindow1.show(); - pwindow1.on_bottom(); - win2.print(3, 1, "pwindow 1 back"); - cur.pause(); - - win1.print(2, 1, "Some pwindow 1 text"); - cur.pause(); - - pwindow1.on_top(); - win1.print(3, 1, "pwindow 2 is on bottom"); - cur.pause(); - - win1.print(4, 1, "Moved pwindow 2 to 10-10"); - pwindow2.move(10,10); - cur.pause(); - - return 0; -} - diff --git a/ycurses/src/examples/example3.h b/ycurses/src/examples/example3.h deleted file mode 100644 index 80f1575..0000000 --- a/ycurses/src/examples/example3.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef EXAMPLE3_H -#define EXAMPLE3_H - -#include "../curses/ycurses.h" - -int example3(); - -#endif diff --git a/ycurses/src/examples/example4.cpp b/ycurses/src/examples/example4.cpp deleted file mode 100644 index 7e0e317..0000000 --- a/ycurses/src/examples/example4.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "example4.h" - -int example4() -{ - curses cur; - cursor::set_invisible(); - - window win_root(root); - win_root.print(1, 1, "Class menu example..."); - - vector<string> vec_choices; - vec_choices.push_back("Hallo das ist asd asdas d asd asda sd asd asd a"); - vec_choices.push_back("Bdsfsdsa das d asd asd asd as das djf"); - vec_choices.push_back("s das d asd saa sdCsdfsdf"); - menu menu1(vec_choices); - - menu1.run(); - - return 0; -} - - diff --git a/ycurses/src/examples/example4.h b/ycurses/src/examples/example4.h deleted file mode 100644 index 1bf0cbb..0000000 --- a/ycurses/src/examples/example4.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef EXAMPLE4_H -#define EXAMPLE4_H - -#include "../curses/ycurses.h" - -int example4(); - -#endif diff --git a/ycurses/src/glob.h b/ycurses/src/glob.h deleted file mode 100644 index d37ae37..0000000 --- a/ycurses/src/glob.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Notice: - - All #defines which start with an CONFIG can be edited through - gmake config in the main directory! -*/ - -// global variables. -#ifndef GLOB_H -#define GLOB_H - -// Definition of boolean values. -#define true 1 -#define false 0 - -/* - DISABLED - - Enable debugging options. -*/ -//#define DEBUG - -#endif diff --git a/ycurses/src/main.cpp b/ycurses/src/main.cpp deleted file mode 100644 index 1ede8da..0000000 --- a/ycurses/src/main.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include <iostream> -#include <signal.h> - -#include "curses/ycurses.h" -#include "examples/example1.h" -#include "examples/example2.h" -#include "examples/example3.h" -#include "examples/example4.h" - -using namespace std; - -static void finish_demo(int i_signal); - -int main(int argc, char* argv[]) -{ - /* Catch SIGINT for proper shutdown */ - signal(SIGINT, finish_demo); - - curses cur; - - color col(Red,Black); - attributes attr(col); - attr.set_bold(true); - - coordinate coord(5,5); - - for (;;) - { - cursor::set_invisible(); - - window win_root(root); - win_root.print(1, 2, "Examples of ycurses", attr); - win_root.print(2, 2, "See src/examples/* for the sample code!"); - - vector<string> vec_choices; - vec_choices.push_back("1. Example with mixed stuff"); - vec_choices.push_back("2. Class pwindow basic usage"); - vec_choices.push_back("3. Class pwindow usage #2"); - vec_choices.push_back("4. Class menu usage"); - vec_choices.push_back("5. Move menu left"); - vec_choices.push_back("6. Move menu right"); - vec_choices.push_back("7. Move menu up"); - vec_choices.push_back("8. Move menu down"); - vec_choices.push_back("9. Exit"); - - menu menu(vec_choices); - window& menu_window = menu.get_window(); - pwindow pan(menu_window); - pan.move(coord); - - switch ( menu.run() ) - { - case 0: - cur.clear(); - pan.hide(); - example1(); - break; - - case 1: - pan.hide(); - cur.clear(); - example2(); - break; - - case 2: - pan.hide(); - cur.clear(); - example3(); - break; - - case 3: - pan.hide(); - cur.clear(); - example4(); - break; - - case 4: - pan.move(coord.left()); - break; - - case 5: - pan.move(coord.right()); - break; - - case 6: - pan.move(coord.up()); - break; - - case 7: - pan.move(coord.down()); - break; - - case 8: - return 0; - } - - cur.clear(); - pan.show(); - } - - return 0; -} - -static void finish_demo(int i_signal) -{ - curses::finish(); - - cout << "Process received SIGINT" << endl; - exit(0); -} diff --git a/ycurses/src/msgs.h b/ycurses/src/msgs.h deleted file mode 100644 index 355aa45..0000000 --- a/ycurses/src/msgs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef MSGS_H -#define MSGS_H - -#define APPNAME "curses" -#define VERSION "0.1" -#define BRANCH "CURRENT" -#define BUILDNR 1661 -#define UNAME "FreeBSD 5.3-RELEASE-p15 i386" -#define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4.2 [FreeBSD] 20040728; 3.4; g++" - -#endif |
