From 4afa9882326274649f6506c82dbc27d5ea902a88 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Thu, 1 Nov 2018 00:49:13 +0100 Subject: [PATCH] Add the file faq.md --- README.md | 3 +- debian/control | 1 + doc/faq.md | 101 ++++++++++++++++++++++++++++++++++ doc/first-steps.md | 21 ++++--- src/foptimove.cpp | 41 -------------- src/fterm.cpp | 2 +- src/include/final/foptimove.h | 47 +++++++++++++++- 7 files changed, 161 insertions(+), 55 deletions(-) create mode 100644 doc/faq.md diff --git a/README.md b/README.md index 35c47772..d8857374 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ *Class Reference:*
     [![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html) -The Final Cut is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen. +The FINAL CUT is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen. The C++ class design was inspired by the Qt framework. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on. ### Installation @@ -141,6 +141,7 @@ printf(...) Class digramm ------------- +
               1┌──────────────┐
    ┌-----------┤ FTermFreeBSD │
diff --git a/debian/control b/debian/control
index 09f656d2..2f5f266a 100644
--- a/debian/control
+++ b/debian/control
@@ -23,6 +23,7 @@ Depends:
   , ${misc:Depends}
 Suggests:
     coreutils
+  , ncurses-term
   , grep
   , sed
   , vim-common
diff --git a/doc/faq.md b/doc/faq.md
new file mode 100644
index 00000000..9ebc3626
--- /dev/null
+++ b/doc/faq.md
@@ -0,0 +1,101 @@
+
+Frequently Asked Questions
+==========================
+
+
+What is FINAL CUT?
+------------------
+
+The Final Cut is a C++ class library and a widget toolkit with full mouse 
+support for creating a text-based user interface. It's based on the Termcap
+library and has its own cursor optimization and window management.
+
+
+Are Windows and DOS supported by FINAL CUT?
+-------------------------------------------
+
+You need an operating system environment that implements a POSIX system 
+call API. This can be realized in Windows with the Cygwin project.
+
+
+Is my platform supported?
+-------------------------
+
+The supported platforms are Linux, FreeBSD, NetBSD, OpenBSD, macOS, 
+Cygwin on Microsoft Windows and Oracle Solaris
+
+
+What do I need to write my own programs with FINAL CUT?
+-------------------------------------------------------
+
+You need a C++ compiler like GCC (g++) or Clang (clang++).
+
+
+What do I need to build this library?
+-------------------------------------
+
+You need three things:
+
+1. C++ compiler like GCC (g++) or Clang (clang++).
+
+2. The GNU building tools
+
+    *For example, in a Debian-based distribution it would be 
+    the following packages:*
+
+    * autotools-dev
+    * automake
+    * autoconf
+    * autoconf-archive
+    * libtool
+
+3. Development packages for following libraries:
+
+    * C standard library
+    * C++ standard library
+    * Termcap library *(mostly part of the curses library)*
+    * General Purpose Mouse library *(optional, only if you need 
+      mouse support on the Linux console)*
+
+    *For example, in a Debian-based distribution it would be the following 
+    packages:*
+
+    * libglib2.0-dev
+    * libstdc++-6-dev
+    * libtinfo-dev
+    * libncurses5-dev
+    * libgpm-dev
+
+
+How to compile FINAL CUT without gpm support?
+---------------------------------------------
+
+```bash
+  ./configure --without-gpm
+```
+
+
+What do I need to compile the unit tests?
+-----------------------------------------
+
+You need the unit testing framework CppUnit.
+
+
+How can I fix display problems?
+-------------------------------
+
+* Make sure that the environment variable TERM has the right 
+  terminal name.
+
+* With the command "`msgcat --color=test`" you can test whether 
+  the colors are displayed correctly in the terminal
+
+* If characters are not displayed in the right place on the screen, 
+  it may help to disable cursor optimization for your program with 
+  the parameter *--no-optimized-cursor*.
+
+* If terminal detection did not work, it is useful to turn off the terminal 
+  detection with the parameter *--no-terminal-detection*.
+
+* If the color palette redefinition causes problems, you can switch off 
+  the color mapping with the parameter *--no-color-change*.
diff --git a/doc/first-steps.md b/doc/first-steps.md
index 27f8b0a8..e3870ba7 100644
--- a/doc/first-steps.md
+++ b/doc/first-steps.md
@@ -9,7 +9,7 @@ How to use the library
 At the beginning of this introduction to the Final Cut
 we will start with a small example.
 
-It creates an empty 30×10 character dialog.
+The following example creates an empty 30×10 character dialog.
 
 **File:** *dialog.cpp*
 ```cpp
@@ -49,12 +49,11 @@ All final cut programs must include the *final.h* header.
 ```cpp
 finalcut::FApplication app(argc, argv);
 ```
-In this line creates the `finalcut::FApplication` object `app` with
+This line creates the `finalcut::FApplication` object `app` with
 the command line arguments `argc` and `argv`. This object manages
 the application main event loop. It receives keyboard and mouse events
-and sends them to the target widgets. Before widgets can be created,
-an application object must be created! Only one `finalcut::FApplication`
-object should be created.
+and sends them to the target widgets. You must create an application
+object before you can create a widgets object.
 
 The next line
 ```cpp
@@ -72,16 +71,16 @@ The title bar of the dialog box gets the text "A dialog".
 ```cpp
 dialog.setGeometry (25, 5, 30, 10);
 ```
-The dialog window geometry is set to a width of 30 characters and
-a height of 10 characters. The window in the terminal is positioned
-at the positions x=25 and y=5 (note: x=1 and y=1 represents the upper
-left corner).
+The dialog window gets a width of 30 and a height of 10 characters.
+The window in the terminal is located at the positions x=25 and
+y=5 (note: x=1 and y=1 represents the upper left corner).
 
 ```cpp
 app.setMainWidget(&dialog);
 ```
-The `dialog` object is selected as the main widget for the application.
-When the user closes a main widget, the application will be closed.
+The `dialog` object was now selected as the main widget for the application.
+When you close the main widget, the entire application quits.
+
 
 ```cpp
 dialog.show();
diff --git a/src/foptimove.cpp b/src/foptimove.cpp
index d20ff575..b190797c 100644
--- a/src/foptimove.cpp
+++ b/src/foptimove.cpp
@@ -560,47 +560,6 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
     return 0;
 }
 
-//----------------------------------------------------------------------
-void FOptiMove::printDurations()
-{
-  std::cout << "            speed: "
-            << baudrate << " baud\r\n";
-  std::cout << "    char_duration: "
-            << char_duration << " ms\r\n";
-  std::cout << "      cursor_home: "
-            << F_cursor_home.duration << " ms\r\n";
-  std::cout << "     cursor_to_ll: "
-            << F_cursor_to_ll.duration << " ms\r\n";
-  std::cout << "  carriage_return: "
-            << F_carriage_return.duration << " ms\r\n";
-  std::cout << "              tab: "
-            << F_tab.duration << " ms\r\n";
-  std::cout << "         back_tab: "
-            << F_back_tab.duration << " ms\r\n";
-  std::cout << "        cursor_up: "
-            << F_cursor_up.duration << " ms\r\n";
-  std::cout << "      cursor_down: "
-            << F_cursor_down.duration << " ms\r\n";
-  std::cout << "      cursor_left: "
-            << F_cursor_left.duration << " ms\r\n";
-  std::cout << "     cursor_right: "
-            << F_cursor_right.duration << " ms\r\n";
-  std::cout << "   cursor_address: "
-            << F_cursor_address.duration << " ms\r\n";
-  std::cout << "   column_address: "
-            << F_column_address.duration << " ms\r\n";
-  std::cout << "      row_address: "
-            << F_row_address.duration << " ms\r\n";
-  std::cout << "   parm_up_cursor: "
-            << F_parm_up_cursor.duration << " ms\r\n";
-  std::cout << " parm_down_cursor: "
-            << F_parm_down_cursor.duration << " ms\r\n";
-  std::cout << " parm_left_cursor: "
-            << F_parm_left_cursor.duration << " ms\r\n";
-  std::cout << "parm_right_cursor: "
-            << F_parm_right_cursor.duration << " ms\r\n";
-}
-
 
 // private methods of FApplication
 //----------------------------------------------------------------------
diff --git a/src/fterm.cpp b/src/fterm.cpp
index 8d534759..e00a4ac1 100644
--- a/src/fterm.cpp
+++ b/src/fterm.cpp
@@ -403,7 +403,7 @@ char* FTerm::cursorsVisibility (bool on)
 //----------------------------------------------------------------------
 void FTerm::printMoveDurations()
 {
-  opti_move->printDurations();
+  finalcut::printDurations(*opti_move);
 }
 
 //----------------------------------------------------------------------
diff --git a/src/include/final/foptimove.h b/src/include/final/foptimove.h
index 8681f509..70f38c74 100644
--- a/src/include/final/foptimove.h
+++ b/src/include/final/foptimove.h
@@ -166,7 +166,6 @@ class FOptiMove
     // Methods
     void  check_boundaries (int&, int&, int&, int&);
     char* moveCursor (int, int, int, int);
-    void  printDurations();
 
   private:
     // Constant
@@ -208,6 +207,9 @@ class FOptiMove
     bool isMethod5Faster (int&, int, int, int);
     void moveByMethod (int, int, int, int, int);
 
+    // Friend function
+    friend void printDurations (const FOptiMove&);
+
     // Data Members
     capability  F_cursor_home;
     capability  F_carriage_return;
@@ -336,6 +338,49 @@ inline void FOptiMove::set_auto_left_margin (const bool& bcap)
 inline void FOptiMove::set_eat_newline_glitch (const bool& bcap)
 { eat_nl_glitch = bcap; }
 
+
+// FOptiMove non-member function
+//----------------------------------------------------------------------
+inline void printDurations (const FOptiMove& om)
+{
+  std::cout << "            speed: "
+            << om.baudrate << " baud\r\n";
+  std::cout << "    char_duration: "
+            << om.char_duration << " ms\r\n";
+  std::cout << "      cursor_home: "
+            << om.F_cursor_home.duration << " ms\r\n";
+  std::cout << "     cursor_to_ll: "
+            << om.F_cursor_to_ll.duration << " ms\r\n";
+  std::cout << "  carriage_return: "
+            << om.F_carriage_return.duration << " ms\r\n";
+  std::cout << "              tab: "
+            << om.F_tab.duration << " ms\r\n";
+  std::cout << "         back_tab: "
+            << om.F_back_tab.duration << " ms\r\n";
+  std::cout << "        cursor_up: "
+            << om.F_cursor_up.duration << " ms\r\n";
+  std::cout << "      cursor_down: "
+            << om.F_cursor_down.duration << " ms\r\n";
+  std::cout << "      cursor_left: "
+            << om.F_cursor_left.duration << " ms\r\n";
+  std::cout << "     cursor_right: "
+            << om.F_cursor_right.duration << " ms\r\n";
+  std::cout << "   cursor_address: "
+            << om.F_cursor_address.duration << " ms\r\n";
+  std::cout << "   column_address: "
+            << om.F_column_address.duration << " ms\r\n";
+  std::cout << "      row_address: "
+            << om.F_row_address.duration << " ms\r\n";
+  std::cout << "   parm_up_cursor: "
+            << om.F_parm_up_cursor.duration << " ms\r\n";
+  std::cout << " parm_down_cursor: "
+            << om.F_parm_down_cursor.duration << " ms\r\n";
+  std::cout << " parm_left_cursor: "
+            << om.F_parm_left_cursor.duration << " ms\r\n";
+  std::cout << "parm_right_cursor: "
+            << om.F_parm_right_cursor.duration << " ms\r\n";
+}
+
 }  // namespace finalcut
 
 #endif  // FOPTIMOVE_H