From 7d4115a542abd938aa7fce607b062c6e393e5d67 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Sun, 8 Mar 2015 06:57:55 -0400 Subject: [PATCH] Initial build stubs --- Makefile | 69 +++++++++++++++++++++++ README.md | 107 +++++++++++++++++++++++++++++++++++- build.xml | 77 ++++++++++++++++++++++++++ demos/Demo1.java | 55 ++++++++++++++++++ src/jexer/TApplication.java | 91 ++++++++++++++++++++++++++++++ 5 files changed, 397 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 build.xml create mode 100644 demos/Demo1.java create mode 100644 src/jexer/TApplication.java diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0dff1e8 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +# Jexer - Java Text User Interface - Makefile +# +# $Id$ +# +# This program is licensed under the GNU Lesser General Public License +# Version 3. Please see the file "COPYING" in this directory for more +# information about the GNU Lesser General Public License Version 3. +# +# Copyright (C) 2015 Kevin Lamonte +# +# This library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, see +# http://www.gnu.org/licenses/, or write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +# This Makefile is a quick-and-dirty build that is useful to execute +# the Demo1 application that uses stdin/stdout. Use 'make run'. +# +# Generally it would be better to use the ant build. + +default: all + +.SUFFIXES: .class .java + +SRC_DIR = src +ANT_TARGET_DIR = build +TARGET_DIR = classes + +JEXER_SRC = $(SRC_DIR)/jexer/TApplication.java + +JEXER_BIN = $(TARGET_DIR)/jexer/TApplication.class + +JAVAC = javac +JAVAFLAGS = -g -deprecation + +all: jexer demos + +run: jexer run-demo1 + +all-demos: jexer demos/Demo1.class + +demos/Demo1.class: demos/Demo1.java + $(JAVAC) $(JAVAFLAGS) -cp $(TARGET_DIR) -d demos demos/Demo1.java + +run-demo1: demos/Demo1.class + java -cp $(TARGET_DIR):demos Demo1 + +clean: clean-demos + -rm -r $(ANT_TARGET_DIR) + -rm -r $(TARGET_DIR) + -mkdir $(TARGET_DIR) + +clean-demos: + -rm demos/Demo1.class + +jexer: $(JEXER_SRC) + $(JAVAC) $(JAVAFLAGS) -sourcepath $(SRC_DIR) -d $(TARGET_DIR) $(JEXER_SRC) diff --git a/README.md b/README.md index c4c827a..cbd76f7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,105 @@ -# jexer -Java Text User Interface +Jexer - Java Text User Interface library +======================================== + +This library is currently in design, but when finished it is intended +to implement a text-based windowing system loosely reminiscient of +Borland's [Turbo Vision](http://en.wikipedia.org/wiki/Turbo_Vision) +library. For those wishing to use the actual C++ Turbo Vision +library, see [Sergio Sigala's updated +version](http://tvision.sourceforge.net/) that runs on many more +platforms. + + +License +------- + +This library is licensed LGPL ("GNU Lesser General Public License") +version 3 or greater. See the file LICENSE for the full license text, +which includes both the GPL v3 and the LGPL supplemental terms. + + +Usage +----- + +The library is currently under initial development, usage patterns are +still being worked on. Generally the goal will be to build +applications somewhat as follows: + +```Java +import jexer.*; + +public class MyApplication extends TApplication { + + public MyApplication() { + super(); + + // Create an editor window that has support for + // copy/paste, search text, arrow keys, horizontal + // and vertical scrollbar, etc. + addEditor(); + + // Create standard menus for File and Window + addFileMenu(); + addWindowMenu(); + } + + public static void main(String [] args) { + MyApplication app = new MyApplication(); + app.run(); + } +} +``` + + +Roadmap +------- + +This is a work in progress. Many tasks remain before calling this +version 1.0: + +0.0.1: + +- Base classes: + - Events + - Codepage + - TApplication loop + +0.0.2: + +- Get modal messagebox running without fibers +- Port remaining d-tui functionality over + - All widgets + +0.0.3: + +- ECMATerminal + - Mouse 1006 mode parsing + - Win32 support (used for reading/writing sockets) +- Bugs + - TDirectoryList cannot be navigated only with keyboard + - TTreeView cannot be navigated only with keyboard + - RangeViolation after dragging scrollbar up/down + +Wishlist features (2.0): + +- TTerminal + - Handle resize events (pass to child process) + - xterm mouse handling +- TWindow + - "Smart placement" for new windows +- Screen + - Allow complex characters in putCharXY() and detect them in putStrXY(). +- TComboBox +- TListBox +- TSpinner +- TCalendar widget +- TColorPicker widget +- Drag and drop + - TEditor + - TField + - TText + - TTerminal + - TComboBox +- AWTBackend +- ECMABackend + - libgpm support diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..fd9b882 --- /dev/null +++ b/build.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demos/Demo1.java b/demos/Demo1.java new file mode 100644 index 0000000..94f0e9f --- /dev/null +++ b/demos/Demo1.java @@ -0,0 +1,55 @@ +/** + * Jexer - Java Text User Interface - demonstration program + * + * Version: $Id$ + * + * Author: Kevin Lamonte, kevin.lamonte@gmail.com + * + * License: LGPLv3 or later + * + * Copyright: This module is licensed under the GNU Lesser General + * Public License Version 3. Please see the file "COPYING" in this + * directory for more information about the GNU Lesser General Public + * License Version 3. + * + * Copyright (C) 2015 Kevin Lamonte + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see + * http://www.gnu.org/licenses/, or write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +import jexer.TApplication; + +/** + * The demo application itself. + */ +class DemoApplication extends TApplication { +} + +/** + * This class provides a simple demonstration of Jexer's capabilities. + */ +public class Demo1 { + /** + * Main entry point. + * + * @param args Command line arguments + */ + public static void main(String [] args) { + DemoApplication app = new DemoApplication(); + app.run(); + } + +} diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java new file mode 100644 index 0000000..3f74803 --- /dev/null +++ b/src/jexer/TApplication.java @@ -0,0 +1,91 @@ +/** + * Jexer - Java Text User Interface - demonstration program + * + * Version: $Id$ + * + * Author: Kevin Lamonte, kevin.lamonte@gmail.com + * + * License: LGPLv3 or later + * + * Copyright: This module is licensed under the GNU Lesser General + * Public License Version 3. Please see the file "COPYING" in this + * directory for more information about the GNU Lesser General Public + * License Version 3. + * + * Copyright (C) 2015 Kevin Lamonte + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see + * http://www.gnu.org/licenses/, or write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +package jexer; + +/** + * TApplication sets up a full Text User Interface application. + */ +public class TApplication { + + /** + * Run this application until it exits, using stdin and stdout + */ + final public void run() { + + /* + while (quit == false) { + + // Timeout is in milliseconds, so default timeout after 1 + // second of inactivity. + uint timeout = getSleepTime(1000); + // std.stdio.stderr.writefln("poll() timeout: %d", timeout); + + if (eventQueue.length > 0) { + // Do not wait if there are definitely events waiting to be + // processed or a screen redraw to do. + timeout = 0; + } + + // Pull any pending input events + TInputEvent [] events = backend.getEvents(timeout); + metaHandleEvents(events); + + // Process timers and call doIdle()'s + doIdle(); + + // Update the screen + drawAll(); + } + + // Shutdown the fibers + eventQueue.length = 0; + if (secondaryEventFiber !is null) { + assert(secondaryEventReceiver !is null); + secondaryEventReceiver = null; + if (secondaryEventFiber.state == Fiber.State.HOLD) { + // Wake up the secondary handler so that it can exit. + secondaryEventFiber.call(); + } + } + + if (primaryEventFiber.state == Fiber.State.HOLD) { + // Wake up the primary handler so that it can exit. + primaryEventFiber.call(); + } + + backend.shutdown(); + */ + + System.out.println("Hello"); + } +} -- 2.27.0