Merge pull request #22 from gansm/master

merge
This commit is contained in:
Markus Gans 2018-11-22 00:19:50 +01:00 committed by GitHub
commit f30b8f9431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
141 changed files with 5052 additions and 3349 deletions

View File

@ -1,4 +1,4 @@
PROJECT_NAME = "The Final Cut"
EXCLUDE = debian, icon, logo, m4, scripts, examples
EXCLUDE = debian, doc, icon, logo, m4, scripts, examples
EXCLUDE_PATTERNS = */test/*

1
.gitignore vendored
View File

@ -52,6 +52,7 @@ examples/input-dialog
examples/choice
examples/listbox
examples/listview
examples/checklist
examples/treeview
examples/mandelbrot
examples/keyboard

View File

@ -62,6 +62,7 @@ matrix:
- ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
- make V=1 -j10
- make check
- cat test/*.log
#
# Coveralls

View File

@ -1,3 +1,43 @@
2018-11-21 Markus Gans <guru.mail@muenster.de>
* New type FKey for key inputs
* The integer type of FPoint and FRect changed from short to int
2018-11-18 Markus Gans <guru.mail@muenster.de>
* The FListViewItem class now provides checkable list view items
* Adding the checklist example to demonstrate the checkable FListViewItems
* A checkable FListViewItem now shows the input cursor
2018-11-12 Markus Gans <guru.mail@muenster.de>
* Clicking on the column header in FListView now changes the sort order
2018-11-10 Markus Gans <guru.mail@muenster.de>
* FListView now has a sort indicator to display the sort order
2018-11-07 Markus Gans <guru.mail@muenster.de>
* Use new type FColor for color values
2018-11-05 Markus Gans <guru.mail@muenster.de>
* FButton now uses the widget flags directly
2018-11-04 Markus Gans <guru.mail@muenster.de>
* Widget flags are now stored in a bit field
2018-11-03 Markus Gans <guru.mail@muenster.de>
* New method rgb2ColorIndex() to converts a 24-bit RGB color
to a 256-color compatible approximation
2018-11-01 Markus Gans <guru.mail@muenster.de>
* Moved FTerm debug access methods to FTermDebugData
2018-10-29 Markus Gans <guru.mail@muenster.de>
* FTerm is now a data member of FVTerm
* Fix FListBox prevListItem()
* Setting the value can_change_color_palette in FTermcapQuirks
2018-10-26 Markus Gans <guru.mail@muenster.de>
* Building Fix for a negative value check (gcc < 4.8)
* Adding the capacity() method to the FString class
2018-10-21 Markus Gans <guru.mail@muenster.de>
* Moving static attributes from FApplication to FWidget
@ -104,7 +144,7 @@
2018-07-01 Markus Gans <guru.mail@muenster.de>
* All in FOptiMove required termcap values can now be passed
with a single struct
with a single struct
2018-06-25 Markus Gans <guru.mail@muenster.de>
* All termcap values required in FOptiAttr can now be passed
@ -257,7 +297,7 @@
2018-01-02 Markus Gans <guru.mail@muenster.de>
* Refactoring of secondary device attributes parsing
* Small menu improvements
* Small menu improvements
2017-12-31 Markus Gans <guru.mail@muenster.de>
* Refactoring of the FListBox mouse event handler
@ -479,7 +519,7 @@
2017-07-18 Markus Gans <guru.mail@muenster.de>
* New Widget class FListView (filled with FListViewItem)
to allow a multi-column data view
* Add the listview example to demonstrate FListView
* Add the listview example to demonstrate FListView
2017-07-11 Markus Gans <guru.mail@muenster.de>
* New class FTermBuffer to buffer terminal outputs

206
README.md
View File

@ -11,8 +11,9 @@
*Class Reference:*<br />
&#160;&#160;&#160;&#160;&#160;[![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 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.
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 structure of the Qt framework was originally the inspiration for the C++ class design of FINAL CUT. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.
### Installation
```bash
@ -141,111 +142,118 @@ printf(...)
Class digramm
-------------
<pre style="line-height: 1 !important;">
1┌──────────────┐
┌-----------┤ FTermFreeBSD │
: └──────────────┘
: 1┌──────────────┐ ┌───────────┐
┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │
: └──────────────┘ │ └───────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │
: └──────────┘ │ FEvent │◄─┤ └─────────────┘
: 1┌──────────┐ └───┬────┘ │ ┌──────────────┐
┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │
: └──────────┘ : │ └──────────────┘
: 1┌───────────────┐ : │ ┌────────────┐
┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │
: └───────────────┘ : │ └────────────┘
: 1┌───────────┐ : │ ┌────────────┐
┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │
: └───────────┘ : │ └────────────┘
: 1┌───────────┐ : │ ┌─────────────┐
┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │
: └───────────┘ : │ └─────────────┘
: 1┌───────────┐ : │ ┌─────────────┐
┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │
: └───────────┘ : └─────────────┘
: 1┌───────────────┐ :
┌-----------┤ FMouseControl │ : ┌──────────────┐
: └───────────────┘ : ┌────┤ FApplication │
: *┌─────────┐ : │ └──────────────┘
: ┌--------┤ FString │ : │ ┌─────────┐
: : └─────────┘ : ├────┤ FButton │
: : *┌────────┐ : │ └─────────┘
: ┌--------┤ FPoint │ : │ ┌────────┐
: : └────────┘ : ├────┤ FLabel │
: : *┌───────┐ : │ └────────┘
: ┌--------┤ FRect │ : │ ┌───────────┐
: : └───────┘ : ├────┤ FLineEdit │
:1 :1 : │ └───────────┘
┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐
│ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘
├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐
┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FObject │◄──┘ │ └───────────────┘ │ └───────────┘
└─────────┘ │ ┌──────────────┐ │ ┌─────────┐
────┤ FProgressbar │ └──┤ FSwitch │
│ └──────────────┘ └─────────┘
│ ┌────────────┐
├────┤ FScrollbar │
│ └────────────┘
│ ┌───────────┐
├────┤ FTextView │
│ └───────────┘
│ ┌──────────┐1 *┌──────────────┐
├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐
├────┤ FScrollView │
│ └─────────────┘
│ ┌────────────┐1 *┌────────────┐
│ ┌──┤ FStatusBar ├-----┤ FStatusKey │
│ │ └────────────┘ └────────────┘
│ │
│ ▼ ┌─────────────┐
┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │
│ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
▲ ▲ └──┤ FMessageBox │
│ │ └─────────────┘
│ │ ┌──────────┐
│ └──────┤ FToolTip │
│ └──────────┘
└───────────────┐ ┌──────────┐
│ ┌───┤ FMenuBar │
┌───────────┐ └──────┤ └──────────┘
│ FMenuList │◄──────────┤ ┌───────┐
└────┬──────┘ └───┤ FMenu │◄──┐
1: └───────┘ │
: ┌─────────────────┐ │
: │ FDialogListMenu ├───┘
: └─────────────────┘
└--------------------------------┐
:* ┌────────────────┐* :
────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
FMenuItem │◄─┤ └────────────────┘ :
──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘
└────────────────┘
: 1┌──────────────┐ ┌───────────┐
┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │
: └──────────────┘ │ └───────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ├────┤ FAccelEvent │
: └──────────┘ └─────────────┘
: 1┌──────────┐ │ ┌──────────────┐
┌-----------┤ FTermios │ ├────┤ FResizeEvent │
: └──────────┘ │ └──────────────┘
: 1┌───────────────┐ │ ┌────────────┐
┌-----------┤ FColorPalette │ ├────┤ FShowEvent │
: └───────────────┘ │ └────────────┘
: 1┌───────────┐ │ ┌────────────┐
┌-----------┤ FOptiMove │ ├────┤ FHideEvent │
: └───────────┘ │ └────────────┘
: 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │
: └───────────┘ │ └─────────────┘
: 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FKeyboard │ ────┤ FTimerEvent │
: └───────────┘ └─────────────┘
: 1┌───────────────┐
┌-----------┤ FMouseControl │ ┌──────────────┐
: └───────────────┘ ┌────┤ FApplication │
: *┌─────────┐ │ └──────────────┘
: ┌--------┤ FString │ │ ┌─────────┐
: : └─────────┘ ├────┤ FButton │
: : *┌────────┐ │ └─────────┘
: ┌--------┤ FPoint │ │ ┌────────┐
: : └────────┘ ├────┤ FLabel │
: : *┌───────┐ │ └────────┘
: ┌--------┤ FRect │ │ ┌───────────┐
: : └───────┘ ├────┤ FLineEdit │
:1 :1 │ └───────────┘
┌─┴──┴──┐ │ ┌──────────────┐ ┌──────────────┐
│ FTerm │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
:1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
└────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
│ FObject │◄──┘ │ ┌────────────┐
└─────────┘ ├────┤ FScrollbar │
│ └────────────┘
│ ┌───────────┐
├────┤ FTextView │
│ └───────────┘
│ ┌──────────┐1 *┌──────────────┐
├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐
├────┤ FScrollView │
│ └─────────────┘
│ ┌────────────┐1 *┌────────────┐
│ ┌──┤ FStatusBar ├-----┤ FStatusKey │
│ │ └────────────┘ └────────────┘
│ │
│ ▼ ┌─────────────┐
┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │
│ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
▲ ▲ └──┤ FMessageBox │
│ │ └─────────────┘
│ │ ┌──────────┐
│ └──────┤ FToolTip │
│ └──────────┘
└───────────────┐ ┌──────────┐
│ ┌───┤ FMenuBar │
┌───────────┐ └──────┤ └──────────┘
│ FMenuList │◄──────────┤ ┌───────┐
└────┬──────┘ └───┤ FMenu │◄──┐
:1 └───────┘ │
: ┌─────────────────┐ │
: │ FDialogListMenu ├───┘
: └─────────────────┘
└--------------------------------┐
:* ┌────────────────┐* :
┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
│FMenuItem │◄─┤ └────────────────┘ :
└──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘
└────────────────┘
</pre>
License
-------
GNU Lesser General Public License Version 3
GNU Lesser General Public License Version 3
Frequently Asked Questions
--------------------------
If you have any problems, please read the
[FAQ](doc/faq.md#frequently-asked-questions)
before you give up.
Please send bug reports to
--------------------------

View File

@ -3,7 +3,7 @@
if test "$1" = "update"
then
# Update generated configuration files
if which autoreconf >/dev/null
if command -v autoreconf >/dev/null
then
autoreconf --force --install --verbose --warnings=all
else

View File

@ -20,7 +20,7 @@ if [ "$CPU_COUNT" -eq 0 ]
then
if command -v nproc >/dev/null 2>&1
then
CPU_COUNT="$(nproc 2>/dev/null)" || CPU_COUNT="0"
CPU_COUNT="$(nproc 2>/dev/null)" || CPU_COUNT="0"
fi
fi
@ -30,7 +30,7 @@ if [ -n "$1" ]
then
if [ ! -f ./configure ]
then
if which autoreconf >/dev/null
if command -v autoreconf >/dev/null
then
autoreconf --install --force
else

1
debian/control vendored
View File

@ -23,6 +23,7 @@ Depends:
, ${misc:Depends}
Suggests:
coreutils
, ncurses-term
, grep
, sed
, vim-common

2
debian/watch vendored
View File

@ -1,2 +1,2 @@
version=3
opts=passive https://github.com/gansm/finalcut/archive/([\d.]+)\.tar.gz
opts=passive https://github.com/gansm/finalcut/archive/([\d.]+)\.tar.gz

View File

@ -4,100 +4,100 @@
1┌──────────────┐
┌-----------┤ FTermFreeBSD │
: └──────────────┘
: 1┌──────────────┐ ┌───────────┐
┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │
: └──────────────┘ │ └───────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │
: └──────────┘ │ FEvent │◄─┤ └─────────────┘
: 1┌──────────┐ └───┬────┘ │ ┌──────────────┐
┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │
: └──────────┘ : │ └──────────────┘
: 1┌───────────────┐ : │ ┌────────────┐
┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │
: └───────────────┘ : │ └────────────┘
: 1┌───────────┐ : │ ┌────────────┐
┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │
: └───────────┘ : │ └────────────┘
: 1┌───────────┐ : │ ┌─────────────┐
┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │
: └───────────┘ : │ └─────────────┘
: 1┌───────────┐ : │ ┌─────────────┐
┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │
: └───────────┘ : └─────────────┘
: 1┌───────────────┐ :
┌-----------┤ FMouseControl │ : ┌──────────────┐
: └───────────────┘ : ┌────┤ FApplication │
: *┌─────────┐ : │ └──────────────┘
: ┌--------┤ FString │ : │ ┌─────────┐
: : └─────────┘ : ├────┤ FButton │
: : *┌────────┐ : │ └─────────┘
: ┌--------┤ FPoint │ : │ ┌────────┐
: : └────────┘ : ├────┤ FLabel │
: : *┌───────┐ : │ └────────┘
: ┌--------┤ FRect │ : │ ┌───────────┐
: : └───────┘ : ├────┤ FLineEdit │
:1 :1 : │ └───────────┘
┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐
│ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘
├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐
┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FObject │◄──┘ │ └───────────────┘ │ └───────────┘
└─────────┘ │ ┌──────────────┐ │ ┌─────────┐
────┤ FProgressbar │ └──┤ FSwitch │
│ └──────────────┘ └─────────┘
│ ┌────────────┐
├────┤ FScrollbar │
│ └────────────┘
│ ┌───────────┐
├────┤ FTextView │
│ └───────────┘
│ ┌──────────┐1 *┌──────────────┐
├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐
├────┤ FScrollView │
│ └─────────────┘
│ ┌────────────┐1 *┌────────────┐
│ ┌──┤ FStatusBar ├-----┤ FStatusKey │
│ │ └────────────┘ └────────────┘
│ │
│ ▼ ┌─────────────┐
┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │
│ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
▲ ▲ └──┤ FMessageBox │
│ │ └─────────────┘
│ │ ┌──────────┐
│ └──────┤ FToolTip │
│ └──────────┘
└───────────────┐ ┌──────────┐
│ ┌───┤ FMenuBar │
┌───────────┐ └──────┤ └──────────┘
│ FMenuList │◄──────────┤ ┌───────┐
└────┬──────┘ └───┤ FMenu │◄──┐
:1 └───────┘ │
: ┌─────────────────┐ │
: │ FDialogListMenu ├───┘
: └─────────────────┘
└--------------------------------┐
:* ┌────────────────┐* :
────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
FMenuItem │◄─┤ └────────────────┘ :
──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘
└────────────────┘
: 1┌──────────────┐ ┌───────────┐
┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │
: └──────────────┘ │ └───────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │
: └────────────────┘ │ └─────────────┘
: 1┌────────────────┐ │ ┌─────────────┐
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ├────┤ FAccelEvent │
: └──────────┘ └─────────────┘
: 1┌──────────┐ │ ┌──────────────┐
┌-----------┤ FTermios │ ├────┤ FResizeEvent │
: └──────────┘ │ └──────────────┘
: 1┌───────────────┐ │ ┌────────────┐
┌-----------┤ FColorPalette │ ├────┤ FShowEvent │
: └───────────────┘ │ └────────────┘
: 1┌───────────┐ │ ┌────────────┐
┌-----------┤ FOptiMove │ ├────┤ FHideEvent │
: └───────────┘ │ └────────────┘
: 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │
: └───────────┘ │ └─────────────┘
: 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FKeyboard │ ────┤ FTimerEvent │
: └───────────┘ └─────────────┘
: 1┌───────────────┐
┌-----------┤ FMouseControl │ ┌──────────────┐
: └───────────────┘ ┌────┤ FApplication │
: *┌─────────┐ │ └──────────────┘
: ┌--------┤ FString │ │ ┌─────────┐
: : └─────────┘ ├────┤ FButton │
: : *┌────────┐ │ └─────────┘
: ┌--------┤ FPoint │ │ ┌────────┐
: : └────────┘ ├────┤ FLabel │
: : *┌───────┐ │ └────────┘
: ┌--------┤ FRect │ │ ┌───────────┐
: : └───────┘ ├────┤ FLineEdit │
:1 :1 │ └───────────┘
┌─┴──┴──┐ │ ┌──────────────┐ ┌──────────────┐
│ FTerm │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
:1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
└────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
│ FObject │◄──┘ │ ┌────────────┐
└─────────┘ ├────┤ FScrollbar │
│ └────────────┘
│ ┌───────────┐
├────┤ FTextView │
│ └───────────┘
│ ┌──────────┐1 *┌──────────────┐
├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐
├────┤ FScrollView │
│ └─────────────┘
│ ┌────────────┐1 *┌────────────┐
│ ┌──┤ FStatusBar ├-----┤ FStatusKey │
│ │ └────────────┘ └────────────┘
│ │
│ ▼ ┌─────────────┐
┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │
│ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘
└──┬──┬───┘ └─────────┘ │ ┌─────────────┐
▲ ▲ └──┤ FMessageBox │
│ │ └─────────────┘
│ │ ┌──────────┐
│ └──────┤ FToolTip │
│ └──────────┘
└───────────────┐ ┌──────────┐
│ ┌───┤ FMenuBar │
┌───────────┐ └──────┤ └──────────┘
│ FMenuList │◄──────────┤ ┌───────┐
└────┬──────┘ └───┤ FMenu │◄──┐
:1 └───────┘ │
: ┌─────────────────┐ │
: │ FDialogListMenu ├───┘
: └─────────────────┘
└--------------------------------┐
:* ┌────────────────┐* :
┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
│FMenuItem │◄─┤ └────────────────┘ :
└──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘
└────────────────┘

View File

@ -2,6 +2,6 @@
# set the xterm window title
TERMTITLE="man 4 console_codes"
echo -ne "\033]0;${TERMTITLE}\007"
echo -ne "\\033]0;${TERMTITLE}\\007"
man 4 console_codes

View File

@ -2,6 +2,6 @@
# set the xterm window title
TERMTITLE="man 4 console_ioctl"
echo -ne "\033]0;${TERMTITLE}\007"
echo -ne "\\033]0;${TERMTITLE}\\007"
man 4 console_ioctl

138
doc/faq.md Normal file
View File

@ -0,0 +1,138 @@
Frequently Asked Questions
==========================
What is FINAL CUT?
------------------
The Final Cut is a [C++](https://en.wikipedia.org/wiki/C%2B%2B) 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.
Why did you develop FINAL CUT?
------------------------------
Most Unix [TUIs](https://en.wikipedia.org/wiki/Text-based_user_interface)
are difficult to use or limited in their functionality. I developed
FINAL CUT to fix these problems. The main goals in FINAL CUT design were
to create a library that is easy to use, powerful, visually appealing and
easily expandable.
Where does the name FINAL CUT come from?
----------------------------------------
From 1991 to 1996 I developed with
[Borland Pascal](https://en.wikipedia.org/wiki/Turbo_Pascal)
under [DOS](https://en.wikipedia.org/wiki/DOS) a text-based file manager
called “The Final Cut”, with the intention to be more visually appealing
than all other products. The calculator example is, among other things an
extract from this program.
As I got to learn
[object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) (OOP)
with [C++](https://en.wikipedia.org/wiki/C%2B%2B) at the end of
the 90s, I noticed significant design weaknesses in my program code.
I decided to re-implement the code cleanly in C++. This time I wanted to
avoid old mistakes and do everything right and open source. In the meanwhile,
I switched from [DOS](https://en.wikipedia.org/wiki/DOS) to
[Linux](https://en.wikipedia.org/wiki/Linux), so I started the implementing
of the first widgets (FDialog, FButton, FLineEdit, FScrollbar) and the
string class FString for the
[Linux console](https://en.wikipedia.org/wiki/Linux_console).
Unfortunately, the project lost my attention in 2000.
In 2012, I needed an attractive terminal presentation for a textual data
structure. So I have started to develop FINAL CUT to a widget library.
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.
* Use the command "`msgcat --color=test`" to test whether the terminal
displays colors 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*.

View File

@ -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
@ -26,8 +26,8 @@ int main (int argc, char* argv[])
return app.exec();
}
```
*(Note: Use mouse or <kbd>Shift</kbd>+<kbd>F10</kbd> or
<kbd>Ctrl</kbd>+<kbd>^</kbd> to close the dialog)*
*(Note: You can close the dialog with the mouse,
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>.)*
After entering the source code in *dialog.cpp* you can compile
@ -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 position of the window in the terminal is at 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();
@ -94,7 +93,7 @@ if available) visible.
return app.exec();
```
The last line calls `exec()` to start the application and return
the result to the operating system. When the application starts,
it enters the main event loop. This loop doesn't end until the
window/application is closed.
the result to the operating system. The started application enters
the main event loop. This loop does not end until the window is
not closed.

View File

@ -3,7 +3,7 @@ Framebuffer
The Final Cut determines the used number of bits per pixel (bpp)
for Linux framebuffer console to determine whether 16 (or more)
different background colors can be displayed. Therefor your user
different background colors can be displayed. Therefore your user
needs read-access to the framebuffer device (/dev/fb0 or /dev/fb/0).
You can check this with the following command:
@ -14,7 +14,7 @@ the group "video". To do this, please enter the following command:
> sudo usermod -a -G video USERNAME
You can check the group membership with the id command:
You can check the group members with the id command:
> id

View File

@ -7,7 +7,8 @@ support for creating a 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.
The structure of the Qt framework was originally the inspiration for
the C++ class design of FINAL CUT. It provides common controls like
dialog boxes, push buttons, check boxes, radio buttons, input lines,
list boxes, status bars and so on.

View File

@ -2,6 +2,6 @@
# set the xterm window title
TERMTITLE="infocmp: $TERM"
echo -ne "\033]0;${TERMTITLE}\007"
echo -ne "\\033]0;${TERMTITLE}\\007"
infocmp -x | less

View File

@ -2,7 +2,7 @@
# set the xterm window title
TERMTITLE="man 5 terminfo"
echo -ne "\033]0;${TERMTITLE}\007"
echo -ne "\\033]0;${TERMTITLE}\\007"
man 5 terminfo

View File

@ -14,6 +14,7 @@ noinst_PROGRAMS = \
choice \
listbox \
listview \
checklist \
treeview \
opti-move \
termcap \
@ -37,6 +38,7 @@ input_dialog_SOURCES = input-dialog.cpp
choice_SOURCES = choice.cpp
listbox_SOURCES = listbox.cpp
listview_SOURCES = listview.cpp
checklist_SOURCES = checklist.cpp
treeview_SOURCES = treeview.cpp
opti_move_SOURCES = opti-move.cpp
string_operations_SOURCES = string-operations.cpp

View File

@ -34,7 +34,7 @@ debug:
profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg"
.PHONY: clean
.PHONY: clean
clean:
$(RM) $(SRCS:%.cpp=%) *.gcno *.gcda *~

View File

@ -90,7 +90,7 @@ void Button::setChecked (bool on)
//----------------------------------------------------------------------
void Button::onKeyPress (finalcut::FKeyEvent* ev)
{
int key = ev->key();
FKey key = ev->key();
// catch the enter key
if ( key == finalcut::fc::Fkey_return
@ -316,8 +316,7 @@ Calc::Calc (FWidget* parent)
//----------------------------------------------------------------------
Calc::~Calc()
{
}
{ }
//----------------------------------------------------------------------
void Calc::drawDispay()
@ -382,9 +381,9 @@ void Calc::drawDispay()
}
else
{
wchar_t vertical_and_right = wchar_t(finalcut::fc::BoxDrawingsVerticalAndRight);
wchar_t horizontal = wchar_t(finalcut::fc::BoxDrawingsHorizontal);
wchar_t vertical_and_left = wchar_t(finalcut::fc::BoxDrawingsVerticalAndLeft);
wchar_t vertical_and_right = wchar_t(finalcut::fc::BoxDrawingsVerticalAndRight);
wchar_t horizontal = wchar_t(finalcut::fc::BoxDrawingsHorizontal);
wchar_t vertical_and_left = wchar_t(finalcut::fc::BoxDrawingsVerticalAndLeft);
finalcut::FString separator = finalcut::FString(vertical_and_right)
+ finalcut::FString(35, horizontal)
+ finalcut::FString(vertical_and_left);
@ -417,7 +416,6 @@ void Calc::zero (lDouble&)
input += '0';
else
input = '0';
}
//----------------------------------------------------------------------
@ -551,8 +549,8 @@ void Calc::subtract (lDouble&)
//----------------------------------------------------------------------
void Calc::multiply (lDouble&)
{
if ( ! isOperatorKey(last_key) )
calcInfixOperator();
if ( ! isOperatorKey(last_key) )
calcInfixOperator();
setDisplay(a);
setInfixOperator('*');
@ -735,7 +733,7 @@ void Calc::arcus (lDouble& x)
//----------------------------------------------------------------------
void Calc::sine (lDouble& x)
{
if ( hyperbolic_mode )
if ( hyperbolic_mode )
{
if ( arcus_mode )
{
@ -831,6 +829,7 @@ void Calc::tangent (lDouble& x)
if ( arcus_mode )
x = std::atan(x) * 180.0L / PI;
else
{
// Test if (x / 180) != 0 and x / 90 == 0
if ( std::fabs(std::fmod(x, 180.0L)) > LDBL_EPSILON
&& std::fabs(std::fmod(x, 90.0L)) < LDBL_EPSILON )
@ -839,6 +838,7 @@ void Calc::tangent (lDouble& x)
x = 0.0L;
else
x = std::tan(x * PI / 180.0L);
}
}
if ( errno == EDOM )
@ -1007,8 +1007,8 @@ void Calc::calcInfixOperator()
//----------------------------------------------------------------------
void Calc::onKeyPress (finalcut::FKeyEvent* ev)
{
int len = int(input.getLength());
int key = ev->key();
std::size_t len = input.getLength();
FKey key = ev->key();
switch ( key )
{

210
examples/checklist.cpp Normal file
View File

@ -0,0 +1,210 @@
/***********************************************************************
* checklist.cpp - Example for FListView widget with checkboxes *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2017-2018 Markus Gans *
* *
* The Final Cut 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. *
* *
* The Final Cut 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 Lesser 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/>. *
***********************************************************************/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <final/final.h>
//----------------------------------------------------------------------
// class CheckList
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class CheckList : public finalcut::FDialog
{
public:
// Constructor
explicit CheckList (finalcut::FWidget* = 0);
// Destructor
~CheckList();
private:
// Disable copy constructor
CheckList (const CheckList&);
// Disable assignment operator (=)
CheckList& operator = (const CheckList&);
// Method
void populate();
// Event handlers
virtual void onKeyPress (finalcut::FKeyEvent*);
virtual void onClose (finalcut::FCloseEvent*);
// Callback method
void cb_showList (finalcut::FWidget*, data_ptr);
// Data Members
finalcut::FListView listView;
finalcut::FStatusBar status_bar;
};
#pragma pack(pop)
//----------------------------------------------------------------------
CheckList::CheckList (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, listView(this)
, status_bar(this)
{
setText (L"Shopping list");
setShadow();
setGeometry (int(1 + (parent->getWidth() - 30) / 2), 5, 30, 13);
listView.ignorePadding();
listView.setGeometry (1, 2, getWidth(), getHeight() - 1);
// Add columns to the view
listView.addColumn ("Item");
listView.addColumn ("Priority", 12);
// Set the type of sorting
listView.setColumnSortType (1, finalcut::fc::by_name);
listView.setColumnSortType (2, finalcut::fc::by_name);
// Statusbar at the bottom
finalcut::FString separator;
separator << ' ' << wchar_t(finalcut::fc::BoxDrawingsVertical) << ' ';
listView.setStatusbarMessage ( finalcut::FString()
<< "<Q> exit" << separator
<< "<Space> select an item" << separator
<< "<Enter> see your pick list");
// Populate FListView with a list of items
populate();
// Add callback method
listView.addCallback
(
"clicked",
F_METHOD_CALLBACK (this, &CheckList::cb_showList)
);
}
//----------------------------------------------------------------------
CheckList::~CheckList() // destructor
{ }
//----------------------------------------------------------------------
void CheckList::populate()
{
std::string list[][2] =
{
{ "Milk", "Highest" },
{ "Cheese", "High" },
{ "Yoghurt", "Medium" },
{ "Bread", "Low" },
{ "Eggs", "High" },
{ "Toothpaste", "Medium" },
{ "Apples", "Lowest" },
{ "Bananas", "Medium" },
{ "Fish", "Medium" },
{ "Lemons", "Low" }
};
const int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
for (int i = 0; i <= lastItem; i++)
{
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
finalcut::FObject::FObjectIterator iter = listView.insert (line);
finalcut::FListViewItem* item = \
static_cast<finalcut::FListViewItem*>(*iter);
item->setCheckable(true);
}
}
//----------------------------------------------------------------------
void CheckList::onKeyPress (finalcut::FKeyEvent* ev)
{
if ( ! ev )
return;
if ( ev->key() == 'q'
|| ev->key() == finalcut::fc::Fkey_escape
|| ev->key() == finalcut::fc::Fkey_escape_mintty )
{
close();
ev->accept();
}
else
finalcut::FDialog::onKeyPress(ev);
}
//----------------------------------------------------------------------
void CheckList::onClose (finalcut::FCloseEvent* ev)
{
finalcut::FApplication::closeConfirmationDialog (this, ev);
}
//----------------------------------------------------------------------
void CheckList::cb_showList (finalcut::FWidget*, data_ptr)
{
finalcut::FListViewIterator iter = listView.beginOfList();
finalcut::FString shopping_list;
while ( iter != listView.endOfList() )
{
const finalcut::FListViewItem* item = \
static_cast<finalcut::FListViewItem*>(*iter);
if ( item->isChecked() )
shopping_list << wchar_t(finalcut::fc::Bullet) << ' '
<< item->getText(1) << '\n';
++iter;
}
if ( shopping_list.isEmpty() )
return;
// Create and show tooltip for two seconds
finalcut::FToolTip picklist(this);
picklist.setText (shopping_list);
picklist.show();
sleep(2);
}
//----------------------------------------------------------------------
// main part
//----------------------------------------------------------------------
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
// Create main dialog object
CheckList d(&app);
// Set dialog d as main widget
app.setMainWidget(&d);
// Show and start the application
d.show();
return app.exec();
}

View File

@ -20,6 +20,7 @@
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include <vector>
#include <final/final.h>

View File

@ -53,7 +53,7 @@ Keyboard::Keyboard (finalcut::FWidget* parent)
//----------------------------------------------------------------------
void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
{
int key_id = ev->key();
FKey key_id = ev->key();
bool is_last_line = false;
if ( getPrintPos().getY() == int(getDesktopHeight()) )

View File

@ -35,7 +35,7 @@ static finalcut::FString* temp_str = 0;
// Function prototypes
void doubleToItem ( finalcut::FListBoxItem&
, finalcut::FWidget::data_ptr container
, int index) ;
, int index);
finalcut::FString& doubleToString (std::list<double>::const_iterator iter);
finalcut::FString& mapToString ( std::map<finalcut::FString
, finalcut::FString>::const_iterator iter );

View File

@ -70,7 +70,7 @@ Listview::Listview (finalcut::FWidget* parent)
, listView(this)
, Quit(this)
{
// Create FListView object
// Set FListView geometry
listView.setGeometry(2, 1, 33, 14);
// Add columns to the view
@ -94,9 +94,12 @@ Listview::Listview (finalcut::FWidget* parent)
// Sort in ascending order by the 1st column
listView.setColumnSort (1, finalcut::fc::ascending);
// The sorting occurs later automatically at insert().
// Sorting follows later automatically on insert().
// Otherwise you could start the sorting directly with sort()
// Allways show the sort indicator (▼/▲)
listView.hideSortIndicator(false);
// Populate FListView with a list of items
populate();

View File

@ -40,8 +40,8 @@ class ColorChooser : public finalcut::FWidget
~ColorChooser();
// Accessors
short getForeground();
short getBackground();
FColor getForeground();
FColor getBackground();
private:
// Disable copy constructor
@ -56,8 +56,8 @@ class ColorChooser : public finalcut::FWidget
virtual void onMouseDown (finalcut::FMouseEvent*);
// Data Members
short fg_color;
short bg_color;
FColor fg_color;
FColor bg_color;
finalcut::FLabel headline;
};
#pragma pack(pop)
@ -75,8 +75,8 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
if ( parent )
{
short fg = parent->getForegroundColor();
short bg = parent->getBackgroundColor();
FColor fg = parent->getForegroundColor();
FColor bg = parent->getBackgroundColor();
setForegroundColor(fg);
setBackgroundColor(bg);
headline.setForegroundColor(fg);
@ -112,9 +112,9 @@ void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev)
if ( mouse_x >= xmin && mouse_x <= xmax && mouse_y == y )
{
if ( ev->getButton() == finalcut::fc::LeftButton )
bg_color = short(c);
bg_color = FColor(c);
else if ( ev->getButton() == finalcut::fc::RightButton )
fg_color = short(c);
fg_color = FColor(c);
redraw();
emitCallback("clicked");
@ -128,7 +128,7 @@ void ColorChooser::draw()
setColor();
finalcut::FWidget::drawBorder (1, 2, 8, 11);
for (short c = 0; c < 16; c++)
for (FColor c = 0; c < 16; c++)
{
setPrintPos (2 + (c / 8) * 3, 3 + c % 8);
@ -151,13 +151,13 @@ void ColorChooser::draw()
}
//----------------------------------------------------------------------
inline short ColorChooser::getForeground()
inline FColor ColorChooser::getForeground()
{
return fg_color;
}
//----------------------------------------------------------------------
inline short ColorChooser::getBackground()
inline FColor ColorChooser::getBackground()
{
return bg_color;
}
@ -183,8 +183,8 @@ class Brushes : public finalcut::FWidget
wchar_t getBrush();
// Mutators
void setForeground (short);
void setBackground (short);
void setForeground (FColor);
void setBackground (FColor);
private:
// Disable copy constructor
@ -200,8 +200,8 @@ class Brushes : public finalcut::FWidget
// Data Members
wchar_t brush;
short fg_color;
short bg_color;
FColor fg_color;
FColor bg_color;
finalcut::FLabel headline;
};
#pragma pack(pop)
@ -220,8 +220,8 @@ Brushes::Brushes (finalcut::FWidget* parent)
if ( parent )
{
short fg = parent->getForegroundColor();
short bg = parent->getBackgroundColor();
FColor fg = parent->getForegroundColor();
FColor bg = parent->getBackgroundColor();
setForegroundColor(fg);
setBackgroundColor(bg);
headline.setForegroundColor(fg);
@ -291,13 +291,13 @@ inline wchar_t Brushes::getBrush()
}
//----------------------------------------------------------------------
inline void Brushes::setForeground (short color)
inline void Brushes::setForeground (FColor color)
{
fg_color = color;
}
//----------------------------------------------------------------------
inline void Brushes::setBackground (short color)
inline void Brushes::setBackground (FColor color)
{
bg_color = color;
}
@ -372,7 +372,7 @@ MouseDraw::MouseDraw (finalcut::FWidget* parent)
brush.setPos (1, 12);
finalcut::FPoint no_shadow(0,0);
finalcut::FPoint no_shadow(0, 0);
finalcut::FRect scroll_geometry(0, 0, 1, 1);
createArea (scroll_geometry, no_shadow, canvas);
}
@ -382,12 +382,13 @@ MouseDraw::~MouseDraw()
{ }
//----------------------------------------------------------------------
void MouseDraw::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void MouseDraw::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
int old_w, old_h;
finalcut::FDialog::setGeometry (x, y, w, h, adjust);
finalcut::FPoint no_shadow(0,0);
finalcut::FPoint no_shadow(0, 0);
finalcut::FRect scroll_geometry (0, 0, w - 11, h - 3);
old_w = canvas->width;
old_h = canvas->height;

View File

@ -75,7 +75,7 @@ void term_boundaries (int& x, int& y)
if ( y < 0 )
y = 0;
if ( x >= term_width )
if ( x >= term_width && term_width > 0 )
{
y += x / term_width;
x %= term_width;
@ -157,7 +157,7 @@ int main (int argc, char* argv[])
finalcut::FString line(std::size_t(xmax) + 1, '-');
// Place the cursor in the upper left corner
TermApp.setTermXY(0,0);
TermApp.setTermXY(0, 0);
// Reset all terminal attributes
TermApp.setNormal();
// Clear the screen

View File

@ -84,7 +84,8 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
// Sets the navigation button geometry
go_east.setGeometry (1, 1, 5, 1);
go_south.setGeometry (int(getScrollWidth()) - 5, 1, 5, 1);
go_west.setGeometry (int(getScrollWidth()) - 5, int(getScrollHeight()) - 2, 5, 1);
go_west.setGeometry ( int(getScrollWidth()) - 5
, int(getScrollHeight()) - 2, 5, 1);
go_north.setGeometry (1, int(getScrollHeight()) - 2, 5, 1);
// Add scroll function callbacks to the buttons

View File

@ -512,7 +512,8 @@ void convertToNumberExample()
try
{
const double double_num = finalcut::FString("2.7182818284590452353").toDouble();
const double double_num = \
finalcut::FString("2.7182818284590452353").toDouble();
std::ios_base::fmtflags save_flags = std::cout.flags();
std::cout << " toDouble: " << std::setprecision(11)
<< double_num << std::endl;

View File

@ -49,7 +49,7 @@ class AttribDlg : public finalcut::FDialog
void cb_back (finalcut::FWidget* = 0, data_ptr = 0);
// Data Members
short bgcolor;
FColor bgcolor;
private:
// Disable copy constructor
@ -130,10 +130,12 @@ void AttribDlg::cb_next (finalcut::FWidget*, data_ptr)
if ( isMonochron() )
return;
bgcolor++;
if ( bgcolor >= getMaxColor() )
if ( bgcolor == FColor(getMaxColor() - 1) )
bgcolor = finalcut::fc::Default;
else if ( bgcolor == finalcut::fc::Default )
bgcolor = 0;
else
bgcolor++;
redraw();
}
@ -144,10 +146,12 @@ void AttribDlg::cb_back (finalcut::FWidget*, data_ptr)
if ( isMonochron() )
return;
bgcolor--;
if ( bgcolor < finalcut::fc::Default )
bgcolor = short(getMaxColor() - 1);
if ( bgcolor == 0 )
bgcolor = finalcut::fc::Default;
else if ( bgcolor == finalcut::fc::Default )
bgcolor = FColor(getMaxColor() - 1);
else
bgcolor--;
redraw();
}
@ -165,8 +169,10 @@ void AttribDlg::adjustSize()
y = 1;
setGeometry(x, y, 69, 21, false);
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1, false);
back_button.setGeometry(int(getWidth()) - 25, int(getHeight()) - 4, 10, 1, false);
next_button.setGeometry ( int(getWidth()) - 13, int(getHeight()) - 4
, 10, 1, false );
back_button.setGeometry ( int(getWidth()) - 25, int(getHeight()) - 4
, 10, 1, false );
finalcut::FDialog::adjustSize();
}
@ -239,7 +245,7 @@ void AttribDemo::printColorLine()
{
AttribDlg* parent = static_cast<AttribDlg*>(getParent());
for (short color = 0; color < colors; color++)
for (FColor color = 0; color < colors; color++)
{
setColor (color, parent->bgcolor);
print (" # ");
@ -254,7 +260,7 @@ void AttribDemo::printAltCharset()
if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg);
setPrintPos (1,1);
setPrintPos (1, 1);
print("alternate charset: ");
if ( parent->bgcolor == finalcut::fc::Default )
@ -466,7 +472,7 @@ void AttribDemo::draw()
setColor(wc.label_fg, wc.label_bg);
setPrintPos (1, 15);
short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
FColor bg = static_cast<AttribDlg*>(getParent())->bgcolor;
print (" Background color:");
if ( bg == finalcut::fc::Default )

View File

@ -225,20 +225,22 @@ void tcapString (const std::string& name, const char cap_str[])
#if DEBUG
void debug (finalcut::FApplication& TermApp)
{
const finalcut::FString& ab_s = TermApp.getAnswerbackString();
const finalcut::FString& sec_da = TermApp.getSecDAString();
finalcut::FTermDebugData& debug_data = TermApp.getFTermDebugData();
const finalcut::FString& ab_s = debug_data.getAnswerbackString();
const finalcut::FString& sec_da = debug_data.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n";
#if defined(__linux__)
std::cout << "| Framebuffer bpp: "
<< TermApp.getFramebufferBpp() << "\r\n";
<< debug_data.getFramebufferBpp() << "\r\n";
#endif
std::cout << "| after init_256colorTerminal(): "
<< TermApp.getTermType_256color() << "\r\n";
<< debug_data.getTermType_256color() << "\r\n";
std::cout << "| after parseAnswerbackMsg(): "
<< TermApp.getTermType_Answerback() << "\r\n";
<< debug_data.getTermType_Answerback() << "\r\n";
std::cout << "| after parseSecDA(): "
<< TermApp.getTermType_SecDA() << "\r\n";
<< debug_data.getTermType_SecDA() << "\r\n";
if ( ! ab_s.isEmpty() )
tcapString ("| The answerback String", ab_s);
@ -247,7 +249,6 @@ void debug (finalcut::FApplication& TermApp)
tcapString ("| The SecDA String", sec_da);
std::cout << "`------------------- debug -------------------\r\n";
}
#else
void debug (finalcut::FApplication&)
@ -260,6 +261,8 @@ void booleans()
std::cout << "\r\n[Booleans]\r\n";
tcapBoolean ( "background_color_erase"
, finalcut::FTermcap::background_color_erase );
tcapBoolean ( "can_change_color_palette"
, finalcut::FTermcap::can_change_color_palette );
tcapBoolean ( "automatic_left_margin"
, finalcut::FTermcap::automatic_left_margin );
tcapBoolean ( "automatic_right_margin"

View File

@ -59,7 +59,7 @@ Timer::Timer (finalcut::FWidget* parent)
//----------------------------------------------------------------------
void Timer::draw()
{
setPrintPos (1,1);
setPrintPos (1, 1);
print() << "---------------\n"
<< "Press Q to quit\n"
<< "---------------\n";
@ -75,7 +75,7 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
if ( getPrintPos().getY() == int(getDesktopHeight()) )
is_last_line = true;
setColor (short(1 + timer_id), finalcut::fc::Default);
setColor (FColor(1 + timer_id), finalcut::fc::Default);
print() << "Timer event, id " << timer_id << '\n';
if ( is_last_line )

View File

@ -28,6 +28,81 @@
#include <final/final.h>
// Function prototypes
long StringToLong (const finalcut::FString&);
bool sortAscending (const finalcut::FObject*, const finalcut::FObject*);
bool sortDescending (const finalcut::FObject*, const finalcut::FObject*);
// non-member functions
//----------------------------------------------------------------------
long StringToLong (const finalcut::FString& str)
{
finalcut::FString NumString = str;
NumString = NumString.replace(",", "");
NumString = NumString.replace('.', "");
long number = NumString.toLong();
return number;
}
//----------------------------------------------------------------------
bool sortAscending ( const finalcut::FObject* lhs
, const finalcut::FObject* rhs )
{
const finalcut::FListViewItem* l_item = static_cast<const finalcut::FListViewItem*>(lhs);
const finalcut::FListViewItem* r_item = static_cast<const finalcut::FListViewItem*>(rhs);
const int column = l_item->getSortColumn();
switch ( column )
{
case 2:
{
const long l_number = StringToLong(l_item->getText(column));
const long r_number = StringToLong(r_item->getText(column));
return bool( l_number < r_number ); // lhs < rhs
}
case 3:
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = l_item->getText(column).toDouble();
const double r_number = r_item->getText(column).toDouble();
return bool( l_number < r_number ); // lhs < rhs
}
}
return false;
}
//----------------------------------------------------------------------
bool sortDescending ( const finalcut::FObject* lhs
, const finalcut::FObject* rhs )
{
const finalcut::FListViewItem* l_item = static_cast<const finalcut::FListViewItem*>(lhs);
const finalcut::FListViewItem* r_item = static_cast<const finalcut::FListViewItem*>(rhs);
const int column = l_item->getSortColumn();
switch ( column )
{
case 2:
{
const long l_number = StringToLong(l_item->getText(column));
const long r_number = StringToLong(r_item->getText(column));
return bool( l_number > r_number ); // lhs > rhs
}
case 3:
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = l_item->getText(column).toDouble();
const double r_number = r_item->getText(column).toDouble();
return bool( l_number > r_number ); // lhs > rhs
}
}
return false;
}
//----------------------------------------------------------------------
// class Treeview
//----------------------------------------------------------------------
@ -55,7 +130,7 @@ class Treeview : public finalcut::FDialog
// Methods
virtual void adjustSize();
// Event handlers
// Event handler
void onClose (finalcut::FCloseEvent*);
// Data Members
@ -227,7 +302,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
, listView(this)
, Quit(this)
{
// Create FListView object
// Set FListView geometry
listView.setGeometry(2, 1, 53, 14);
// Add columns to the view
@ -239,6 +314,13 @@ Treeview::Treeview (finalcut::FWidget* parent)
listView.setColumnAlignment (2, finalcut::fc::alignRight);
listView.setColumnAlignment (3, finalcut::fc::alignRight);
// Set the type of sorting
listView.setColumnSortType (1, finalcut::fc::by_name);
listView.setColumnSortType (2, finalcut::fc::user_defined);
listView.setColumnSortType (3, finalcut::fc::user_defined);
listView.setUserAscendingCompare(sortAscending);
listView.setUserDescendingCompare(sortDescending);
// Activate tree view
listView.setTreeView();

View File

@ -1052,7 +1052,7 @@ int main (int argc, char* argv[])
app.setTermTitle (title);
// Force vt100 encoding
//app.setEncoding("VT100");
//app.setEncoding(finalcut::fc::VT100);
// Sets the terminal size to 94×30
//app.setTermSize(94,30);

View File

@ -285,7 +285,7 @@ Window::Window (finalcut::FWidget* parent)
for (int n = 1; n <= 6; n++)
{
win_data* win_dat = new win_data;
win_dat->title.sprintf("Window %d", n);
win_dat->title.sprintf("Window %1d", n);
windows.push_back(win_dat);
}
}

View File

@ -11,7 +11,7 @@ Name: @PACKAGE@
Version: @VERSION@
Release: %{buildno}
License: LGPL-3.0
Summary: The Final Cut
Summary: The Final Cut
Url: https://github.com/gansm/finalcut/
Group: System/Libraries
Source: finalcut-%{version}.tar.gz
@ -111,7 +111,7 @@ make %{?_smp_mflags} V=1
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \
bindir=${RPM_BUILD_ROOT}%{_bindir} \
docdir=${RPM_BUILD_ROOT}/%{_docdir}/finalcut/
docdir=${RPM_BUILD_ROOT}/%{_docdir}/finalcut/
rm -f ${RPM_BUILD_ROOT}%{_libdir}/libfinal.la
%post -n %{libsoname} -p /sbin/ldconfig

2522
m4/libtool.m4 vendored

File diff suppressed because it is too large Load Diff

127
m4/ltoptions.m4 vendored
View File

@ -1,14 +1,14 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 7 ltoptions.m4
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
IFS=$lt_save_ifs
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:

7
m4/ltsugar.m4 vendored
View File

@ -1,6 +1,7 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
@ -33,7 +34,7 @@ m4_define([_lt_join],
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
# Autoconf-2.59, which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different

12
m4/ltversion.m4 vendored
View File

@ -1,6 +1,6 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
@ -9,15 +9,15 @@
# @configure_input@
# serial 3337 ltversion.m4
# serial 4179 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])
m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

7
m4/lt~obsolete.m4 vendored
View File

@ -1,6 +1,7 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
@ -11,7 +12,7 @@
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
@ -25,7 +26,7 @@
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until

View File

@ -115,9 +115,11 @@ finalcutinclude_HEADERS = \
include/final/ftermfreebsd.h \
include/final/ftermopenbsd.h \
include/final/ftermlinux.h \
include/final/ftermdebugdata.h \
include/final/ftermdetection.h \
include/final/ftermios.h \
include/final/fterm.h \
include/final/ftermdata.h \
include/final/fvterm.h \
include/final/ftextview.h \
include/final/ftogglebutton.h \

View File

@ -45,6 +45,7 @@ INCLUDE_HEADERS = \
fkeyboard.h \
ftermcap.h \
fterm.h \
ftermdata.h \
ftermios.h \
ftermdetection.h \
ftermcapquirks.h \
@ -140,7 +141,7 @@ endif
.cpp.o:
$(CXX) -c $(CCXFLAGS) $(INCLUDES) -fpic -o $@ $<
all: dep $(OBJS)
all: dep $(OBJS)
$(CXX) $(CCXFLAGS) $(INCLUDES) $(LDFLAGS) -shared -Wl,-soname,$(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJS)
ln -s -f $(LIB).$(VERSION) libfinal.so.$(MAJOR)
ln -s -f $(LIB).$(MAJOR) libfinal.so

View File

@ -45,6 +45,7 @@ INCLUDE_HEADERS = \
fkeyboard.h \
ftermcap.h \
fterm.h \
ftermdata.h \
ftermios.h \
ftermdetection.h \
ftermcapquirks.h \

View File

@ -63,7 +63,7 @@ FApplication::eventQueue* FApplication::event_queue = 0;
FApplication::FApplication ( const int& _argc
, char* _argv[]
, bool disable_alt_screen )
: FWidget(processParameters(_argc,_argv), disable_alt_screen)
: FWidget(processParameters(_argc, _argv), disable_alt_screen)
, app_argc(_argc)
, app_argv(_argv)
, key_timeout(100000) // 100 ms
@ -188,7 +188,7 @@ bool FApplication::sendEvent ( const FObject* receiver
// block events for widgets in non modal windows
if ( window
&& (window->getFlags() & fc::modal) == 0
&& ! window->getFlags().modal
&& ! window->isMenuWidget() )
{
switch ( event->type() )
@ -302,7 +302,7 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[])
showParameterUsage();
}
init_values.setDefault();
getInitValues().setDefault();
cmd_options (argc, argv);
return 0;
}
@ -449,13 +449,13 @@ void FApplication::cmd_options (const int& argc, char* argv[])
encoding = encoding.toLower();
if ( encoding.includes("utf8") )
init_values.encoding = fc::UTF8;
getInitValues().encoding = fc::UTF8;
else if ( encoding.includes("vt100") )
init_values.encoding = fc::VT100;
getInitValues().encoding = fc::VT100;
else if ( encoding.includes("pc") )
init_values.encoding = fc::PC;
getInitValues().encoding = fc::PC;
else if ( encoding.includes("ascii") )
init_values.encoding = fc::ASCII;
getInitValues().encoding = fc::ASCII;
else if ( encoding.includes("help") )
showParameterUsage();
else
@ -464,32 +464,32 @@ void FApplication::cmd_options (const int& argc, char* argv[])
}
if ( std::strcmp(long_options[idx].name, "no-mouse") == 0 )
init_values.mouse_support = false;
getInitValues().mouse_support = false;
if ( std::strcmp(long_options[idx].name, "no-optimized-cursor") == 0 )
init_values.cursor_optimisation = false;
getInitValues().cursor_optimisation = false;
if ( std::strcmp(long_options[idx].name, "no-terminal-detection") == 0 )
init_values.terminal_detection = false;
getInitValues().terminal_detection = false;
if ( std::strcmp(long_options[idx].name, "no-color-change") == 0 )
init_values.color_change = false;
getInitValues().color_change = false;
if ( std::strcmp(long_options[idx].name, "vgafont") == 0 )
init_values.vgafont = true;
getInitValues().vgafont = true;
if ( std::strcmp(long_options[idx].name, "newfont") == 0 )
init_values.newfont = true;
getInitValues().newfont = true;
#if defined(__FreeBSD__) || defined(__DragonFly__)
if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 )
init_values.meta_sends_escape = false;
getInitValues().meta_sends_escape = false;
if ( std::strcmp(long_options[idx].name, "no-cursorstyle-change") == 0 )
init_values.change_cursorstyle = false;
getInitValues().change_cursorstyle = false;
#elif defined(__NetBSD__) || defined(__OpenBSD__)
if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 )
init_values.meta_sends_escape = false;
getInitValues().meta_sends_escape = false;
#endif
}
}
@ -685,9 +685,9 @@ bool FApplication::processDialogSwitchAccelerator()
if ( keyboard->getKey() >= fc::Fmkey_1
&& keyboard->getKey() <= fc::Fmkey_9 )
{
int key = keyboard->getKey();
uLong n = uLong(key - fc::Fmkey_0);
uLong s = dialog_list->size();
FKey key = keyboard->getKey();
std::size_t n = key - fc::Fmkey_0;
std::size_t s = dialog_list->size();
if ( s > 0 && s >= n )
{
@ -853,7 +853,7 @@ void FApplication::closeOpenMenu()
// No widget was been clicked and the menu is no dialog menu
if ( ! (getClickedWidget() || is_window_menu) )
FWindow::switchToPrevWindow();
FWindow::switchToPrevWindow(this);
if ( getStatusBar() )
getStatusBar()->drawMessage();
@ -894,7 +894,7 @@ void FApplication::unselectMenubarItems()
// No widget was been clicked
if ( ! getClickedWidget() )
FWindow::switchToPrevWindow();
FWindow::switchToPrevWindow(this);
if ( getStatusBar() )
getStatusBar()->drawMessage();

View File

@ -37,6 +37,7 @@ FButton::FButton(FWidget* parent)
: FWidget(parent)
, text()
, button_down(false)
, active_focus(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
@ -52,7 +53,6 @@ FButton::FButton(FWidget* parent)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
, is()
{
init();
}
@ -62,6 +62,7 @@ FButton::FButton (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, button_down(false)
, active_focus(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
@ -77,7 +78,6 @@ FButton::FButton (const FString& txt, FWidget* parent)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
, is()
{
init();
detectHotkey();
@ -93,21 +93,21 @@ FButton::~FButton() // destructor
// public methods of FButton
//----------------------------------------------------------------------
void FButton::setForegroundColor (short color)
void FButton::setForegroundColor (FColor color)
{
FWidget::setForegroundColor(color);
updateButtonColor();
}
//----------------------------------------------------------------------
void FButton::setBackgroundColor (short color)
void FButton::setBackgroundColor (FColor color)
{
FWidget::setBackgroundColor(color);
updateButtonColor();
}
//----------------------------------------------------------------------
void FButton::setHotkeyForegroundColor (short color)
void FButton::setHotkeyForegroundColor (FColor color)
{
// valid colors -1..254
if ( color == fc::Default || color >> 8 == 0 )
@ -115,7 +115,7 @@ void FButton::setHotkeyForegroundColor (short color)
}
//----------------------------------------------------------------------
void FButton::setFocusForegroundColor (short color)
void FButton::setFocusForegroundColor (FColor color)
{
// valid colors -1..254
if ( color == fc::Default || color >> 8 == 0 )
@ -125,7 +125,7 @@ void FButton::setFocusForegroundColor (short color)
}
//----------------------------------------------------------------------
void FButton::setFocusBackgroundColor (short color)
void FButton::setFocusBackgroundColor (FColor color)
{
// valid colors -1..254
if ( color == fc::Default || color >> 8 == 0 )
@ -135,7 +135,7 @@ void FButton::setFocusBackgroundColor (short color)
}
//----------------------------------------------------------------------
void FButton::setInactiveForegroundColor (short color)
void FButton::setInactiveForegroundColor (FColor color)
{
// valid colors -1..254
if ( color == fc::Default || color >> 8 == 0 )
@ -145,7 +145,7 @@ void FButton::setInactiveForegroundColor (short color)
}
//----------------------------------------------------------------------
void FButton::setInactiveBackgroundColor (short color)
void FButton::setInactiveBackgroundColor (FColor color)
{
// valid colors -1..254
if ( color == fc::Default || color >> 8 == 0 )
@ -157,12 +157,7 @@ void FButton::setInactiveBackgroundColor (short color)
//----------------------------------------------------------------------
bool FButton::setNoUnderline (bool on)
{
if ( on )
flags |= fc::no_underline;
else
flags &= ~fc::no_underline;
return on;
return (flags.no_underline = on);
}
//----------------------------------------------------------------------
@ -211,11 +206,7 @@ bool FButton::setFocus (bool on)
//----------------------------------------------------------------------
bool FButton::setFlat (bool on)
{
if ( on )
flags |= fc::flat;
else
flags &= ~fc::flat;
return on;
return (flags.flat = on);
}
//----------------------------------------------------------------------
@ -225,16 +216,16 @@ bool FButton::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
setShadowSize(1,1);
flags.shadow = true;
setShadowSize(1, 1);
}
else
{
flags &= ~fc::shadow;
setShadowSize(0,0);
flags.shadow = false;
setShadowSize(0, 0);
}
return on;
return flags.shadow;
}
//----------------------------------------------------------------------
@ -264,7 +255,7 @@ void FButton::setText (const FString& txt)
void FButton::hide()
{
std::size_t s, f, size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -301,12 +292,10 @@ void FButton::hide()
//----------------------------------------------------------------------
void FButton::onKeyPress (FKeyEvent* ev)
{
int key;
if ( ! isEnabled() )
return;
key = ev->key();
FKey key = ev->key();
switch ( key )
{
@ -462,18 +451,6 @@ void FButton::init()
setShadow();
}
//----------------------------------------------------------------------
void FButton::getButtonState()
{
int active_focus = fc::active + fc::focus;
is.active_focus = ((flags & active_focus) == active_focus);
is.active = ((flags & fc::active) != 0);
is.focus = ((flags & fc::focus) != 0);
is.flat = isFlat();
is.non_flat_shadow = ((flags & (fc::shadow + fc::flat)) == fc::shadow);
is.no_underline = ((flags & fc::no_underline) != 0);
}
//----------------------------------------------------------------------
uChar FButton::getHotkey()
{
@ -501,16 +478,16 @@ uChar FButton::getHotkey()
//----------------------------------------------------------------------
void FButton::setHotkeyAccelerator()
{
int hotkey = getHotkey();
uChar hotkey = getHotkey();
if ( hotkey )
{
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{
addAccelerator (std::tolower(hotkey));
addAccelerator (std::toupper(hotkey));
addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
}
else
addAccelerator (getHotkey());
@ -561,7 +538,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
return 0;
// noshadow + indent one character to the right
if ( is.flat )
if ( flags.flat )
clearFlatBorder();
else if ( hasShadow() )
clearShadow();
@ -598,7 +575,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
setPrintPos (1 + int(getWidth()), y);
print (' '); // clear right
if ( is.active && isMonochron() )
if ( flags.active && isMonochron() )
setReverse(false); // Dark background
}
}
@ -614,7 +591,7 @@ inline void FButton::drawMarginLeft()
{
setPrintPos (1 + int(indent), 1 + int(y));
if ( isMonochron() && is.active_focus && y == vcenter_offset )
if ( isMonochron() && active_focus && y == vcenter_offset )
print (fc::BlackRightPointingPointer); // ►
else
print (space_char); // full block █
@ -630,7 +607,7 @@ inline void FButton::drawMarginRight()
{
setPrintPos (int(getWidth() + indent), 1 + int(y));
if ( isMonochron() && is.active_focus && y == vcenter_offset )
if ( isMonochron() && active_focus && y == vcenter_offset )
print (fc::BlackLeftPointingPointer); // ◄
else
print (space_char); // full block █
@ -666,10 +643,14 @@ inline void FButton::drawTopBottomBackground()
inline void FButton::drawButtonTextLine (wchar_t button_text[])
{
std::size_t pos;
center_offset = (getWidth() - txtlength - 1) / 2;
setPrintPos (2 + int(indent), 1 + int(vcenter_offset));
setColor (button_fg, button_bg);
if ( getWidth() < txtlength + 1 )
center_offset = 0;
else
center_offset = (getWidth() - txtlength - 1) / 2;
// Print button text line --------
for (pos = 0; pos < center_offset; pos++)
print (space_char); // █
@ -681,32 +662,32 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
setCursorPos ( 2 + int(center_offset + hotkeypos)
, 1 + int(vcenter_offset) ); // hotkey
if ( ! is.active && isMonochron() )
setReverse(true); // Light background
if ( ! flags.active && isMonochron() )
setReverse(true); // Light background
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
setBold();
for ( std::size_t z = 0
; pos < center_offset + txtlength && z < getWidth() - 2
; z++, pos++)
{
if ( z == hotkeypos && is.active )
if ( z == hotkeypos && flags.active )
{
setColor (button_hotkey_fg, button_bg);
if ( ! is.active_focus && getMaxColor() < 16 )
if ( ! active_focus && getMaxColor() < 16 )
setBold();
if ( ! is.no_underline )
if ( ! flags.no_underline )
setUnderline();
print (button_text[z]);
if ( ! is.active_focus && getMaxColor() < 16 )
if ( ! active_focus && getMaxColor() < 16 )
unsetBold();
if ( ! is.no_underline )
if ( ! flags.no_underline )
unsetUnderline();
setColor (button_fg, button_bg);
@ -724,7 +705,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
print (L"..");
}
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
unsetBold();
for (pos = center_offset + txtlength; pos < getWidth() - 2; pos++)
@ -738,7 +719,7 @@ void FButton::draw()
FWidget* parent_widget = getParentWidget();
txtlength = text.getLength();
space_char = int(' ');
getButtonState();
active_focus = flags.active && flags.focus;
try
{
@ -759,13 +740,13 @@ void FButton::draw()
// Clear right margin after animation
clearRightMargin (parent_widget);
if ( ! is.active && isMonochron() )
if ( ! flags.active && isMonochron() )
space_char = fc::MediumShade; // ▒ simulates greyed out at Monochron
if ( isMonochron() && (is.active || is.focus) )
if ( isMonochron() && (flags.active || flags.focus) )
setReverse(false); // Dark background
if ( is.flat && ! button_down )
if ( flags.flat && ! button_down )
drawFlatBorder();
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
@ -791,7 +772,7 @@ void FButton::draw()
drawTopBottomBackground();
// Draw button shadow
if ( is.non_flat_shadow && ! button_down )
if ( ! flags.flat && flags.shadow && ! button_down )
drawShadow();
if ( isMonochron() )
@ -804,7 +785,7 @@ void FButton::draw()
//----------------------------------------------------------------------
void FButton::updateStatusBar()
{
if ( ! is.focus || ! getStatusBar() )
if ( ! flags.focus || ! getStatusBar() )
return;
const FString& msg = getStatusbarMessage();

View File

@ -190,7 +190,7 @@ bool FButtonGroup::hasCheckedButton() const
void FButtonGroup::hide()
{
std::size_t size;
short fg, bg;
FColor fg, bg;
FWidget::hide();
FWidget* parent_widget = getParentWidget();
@ -454,16 +454,16 @@ uChar FButtonGroup::getHotkey()
//----------------------------------------------------------------------
void FButtonGroup::setHotkeyAccelerator()
{
int hotkey = getHotkey();
uChar hotkey = getHotkey();
if ( hotkey )
{
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{
addAccelerator (std::tolower(hotkey));
addAccelerator (std::toupper(hotkey));
addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
}
else
addAccelerator (getHotkey());
@ -543,9 +543,6 @@ bool FButtonGroup::isRadioButton (FToggleButton* button) const
//----------------------------------------------------------------------
void FButtonGroup::init()
{
if ( isEnabled() )
flags |= fc::active;
setForegroundColor (wc.label_fg);
setBackgroundColor (wc.label_bg);
setMinimumSize (7, 4);
@ -582,9 +579,6 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
bool isNoUnderline = ((flags & fc::no_underline) != 0);
if ( isMonochron() )
setReverse(true);
@ -595,16 +589,16 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
if ( (z == hotkeypos) && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print (LabelText[z]);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
setColor (wc.label_emphasis_fg, wc.label_bg);

View File

@ -72,7 +72,7 @@ void FCheckBox::drawCheckButton()
if ( ! isVisible() )
return;
setPrintPos (1,1);
setPrintPos (1, 1);
setColor();
if ( isMonochron() )

View File

@ -75,7 +75,7 @@ void FCheckMenuItem::processToggle()
//----------------------------------------------------------------------
void FCheckMenuItem::processClicked()
{
checked = not checked;
checked = ! checked;
processToggle();
emitCallback("clicked");
}

View File

@ -87,7 +87,7 @@ FDialog::~FDialog() // destructor
accelerator_list = 0;
if ( ! is_quit )
switchToPrevWindow();
switchToPrevWindow(this);
delDialog(this);
@ -103,16 +103,12 @@ bool FDialog::setDialogWidget (bool on)
if ( isDialogWidget() == on )
return true;
flags.dialog_widget = on;
if ( on )
{
flags |= fc::dialog_widget;
setTermOffsetWithPadding();
}
else
{
flags &= ~fc::dialog_widget;
setParentOffset();
}
return on;
}
@ -123,16 +119,12 @@ bool FDialog::setModal (bool on)
if ( isModal() == on )
return true;
flags.modal = on;
if ( on )
{
flags |= fc::modal;
modal_dialogs++;
}
else
{
flags &= ~fc::modal;
modal_dialogs--;
}
return on;
}
@ -141,12 +133,7 @@ bool FDialog::setModal (bool on)
//----------------------------------------------------------------------
bool FDialog::setScrollable (bool on)
{
if ( on )
flags |= fc::scrollable;
else
flags &= ~fc::scrollable;
return on;
return (flags.scrollable = on);
}
//----------------------------------------------------------------------
@ -541,7 +528,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
&& ms.mouse_y == 1 )
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
else
titlebar_click_pos.setPoint (0,0);
titlebar_click_pos.setPoint (0, 0);
// Click on titlebar menu button
if ( ms.mouse_x < 4 && ms.mouse_y == 1 )
@ -835,7 +822,7 @@ void FDialog::draw()
drawTitleBar();
setCursorPos(2, int(getHeight()) - 1);
if ( (flags & fc::shadow) != 0 )
if ( flags.shadow )
drawDialogShadow();
if ( isMonochron() )
@ -845,7 +832,7 @@ void FDialog::draw()
//----------------------------------------------------------------------
void FDialog::drawDialogShadow()
{
if ( isMonochron() && (flags & fc::trans_shadow) == 0 )
if ( isMonochron() && ! flags.trans_shadow )
return;
drawShadow();
@ -1591,7 +1578,7 @@ void FDialog::resizeMouseDown (mouseStates& ms)
drawBorder();
}
else
resize_click_pos.setPoint (0,0);
resize_click_pos.setPoint (0, 0);
}
//----------------------------------------------------------------------
@ -1628,13 +1615,14 @@ void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
else
h = int(getMaxHeight()) - getTermY() + y2_offset + 1;
setSize (std::size_t(w), std::size_t(h));
setSize ( ( w >= 0) ? std::size_t(w) : 0
, ( h >= 0) ? std::size_t(h) : 0 );
}
if ( mouse_up )
{
// Reset the border color
resize_click_pos.setPoint (0,0);
resize_click_pos.setPoint (0, 0);
// redraw() is required to draw the standard (black) border
// and client objects with ignorePadding() option.
@ -1651,7 +1639,7 @@ void FDialog::cancelMouseResize()
if ( resize_click_pos.isNull() )
return;
resize_click_pos.setPoint (0,0);
resize_click_pos.setPoint (0, 0);
drawBorder();
updateTerminal();
}

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2014-2017 Markus Gans *
* Copyright 2014-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -48,7 +48,7 @@ int FEvent::type() const
// class FKeyEvent
//----------------------------------------------------------------------
FKeyEvent::FKeyEvent (int ev_type, int key_num) // constructor
FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
: FEvent(ev_type)
, k(key_num)
, accpt(false)
@ -59,7 +59,7 @@ FKeyEvent::~FKeyEvent() // destructor
{ }
//----------------------------------------------------------------------
int FKeyEvent::key() const
FKey FKeyEvent::key() const
{ return k; }
//----------------------------------------------------------------------

View File

@ -231,7 +231,7 @@ void FFileDialog::onKeyPress (FKeyEvent* ev)
if ( ! filebrowser.hasFocus() )
return;
int key = ev->key();
FKey key = ev->key();
switch ( key )
{
@ -912,7 +912,7 @@ void FFileDialog::cb_processOpen (FWidget*, data_ptr)
//----------------------------------------------------------------------
void FFileDialog::cb_processShowHidden (FWidget*, data_ptr)
{
setShowHiddenFiles(not show_hidden);
setShowHiddenFiles(! show_hidden);
}
} // namespace finalcut

View File

@ -107,7 +107,7 @@ void FKeyboard::fetchKeyCode()
}
//----------------------------------------------------------------------
const FString FKeyboard::getKeyName (int keynum)
const FString FKeyboard::getKeyName (FKey keynum)
{
for (int i = 0; fc::FkeyName[i].string[0] != 0; i++)
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
@ -197,12 +197,12 @@ void FKeyboard::escapeKeyHandling()
// private methods of FKeyboard
//----------------------------------------------------------------------
inline int FKeyboard::getMouseProtocolKey()
inline FKey FKeyboard::getMouseProtocolKey()
{
// Looking for mouse string in the key buffer
if ( ! mouse_support )
return -1;
return NOT_SET;
std::size_t buf_len = std::strlen(fifo_buf);
@ -221,23 +221,22 @@ inline int FKeyboard::getMouseProtocolKey()
&& fifo_buf[buf_len - 1] == 'M' )
return fc::Fkey_urxvt_mouse;
return -1;
return NOT_SET;
}
//----------------------------------------------------------------------
inline int FKeyboard::getTermcapKey()
inline FKey FKeyboard::getTermcapKey()
{
// Looking for termcap key strings in the buffer
assert ( FIFO_BUF_SIZE > 0 );
if ( ! key_map )
return -1;
return NOT_SET;
fc::fkeymap* keymap = reinterpret_cast<fc::fkeymap*>(key_map);
for (int i = 0; keymap[i].tname[0] != 0; i++)
for (int i = 0; key_map[i].tname[0] != 0; i++)
{
char* k = keymap[i].string;
char* k = key_map[i].string;
std::size_t len = ( k ) ? std::strlen(k) : 0;
if ( k && std::strncmp(k, fifo_buf, len) == 0 ) // found
@ -255,11 +254,11 @@ inline int FKeyboard::getTermcapKey()
}
}
return -1;
return NOT_SET;
}
//----------------------------------------------------------------------
inline int FKeyboard::getMetaKey()
inline FKey FKeyboard::getMetaKey()
{
// Looking for meta key strings in the buffer
@ -279,7 +278,7 @@ inline int FKeyboard::getMetaKey()
|| fifo_buf[1] == ']' ) )
{
if ( ! isKeypressTimeout() )
return NEED_MORE_DATA;
return fc::need_more_data;
}
for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry
@ -293,18 +292,18 @@ inline int FKeyboard::getMetaKey()
}
}
return -1;
return NOT_SET;
}
//----------------------------------------------------------------------
inline int FKeyboard::getSingleKey()
inline FKey FKeyboard::getSingleKey()
{
// Looking for single key code in the buffer
uChar firstchar = uChar(fifo_buf[0]);
std::size_t n;
std::size_t len = 1;
int keycode;
FKey keycode;
// Look for a utf-8 character
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
@ -337,7 +336,7 @@ inline int FKeyboard::getSingleKey()
if ( keycode == 0 ) // Ctrl+Space or Ctrl+@
keycode = fc::Fckey_space;
return int(keycode == 127 ? fc::Fkey_backspace : keycode);
return FKey(keycode == 127 ? fc::Fkey_backspace : keycode);
}
//----------------------------------------------------------------------
@ -371,16 +370,16 @@ bool FKeyboard::isKeypressTimeout()
}
//----------------------------------------------------------------------
int FKeyboard::UTF8decode (const char utf8[])
FKey FKeyboard::UTF8decode (const char utf8[])
{
int ucs = 0;
FKey ucs = 0; // Universal coded character
const int max = 4;
int len = int(std::strlen(utf8));
std::size_t len = std::strlen(utf8);
if ( len > max )
len = max;
for (int i = 0; i < len; ++i)
for (std::size_t i = 0; i < len; ++i)
{
uChar ch = uChar(utf8[i]);
@ -412,7 +411,7 @@ int FKeyboard::UTF8decode (const char utf8[])
else
{
// error
ucs = EOF;
ucs = NOT_SET;
}
}
@ -451,12 +450,12 @@ void FKeyboard::parseKeyBuffer()
// Read the rest from the fifo buffer
while ( ! isKeypressTimeout()
&& fifo_offset > 0
&& key != NEED_MORE_DATA )
&& key != fc::need_more_data )
{
key = parseKeyString();
key = keyCorrection(key);
if ( key != NEED_MORE_DATA )
if ( key != fc::need_more_data )
keyPressed();
fifo_offset = int(std::strlen(fifo_buf));
@ -478,38 +477,38 @@ void FKeyboard::parseKeyBuffer()
}
//----------------------------------------------------------------------
int FKeyboard::parseKeyString()
FKey FKeyboard::parseKeyString()
{
uChar firstchar = uChar(fifo_buf[0]);
if ( firstchar == ESC[0] )
{
int keycode = getMouseProtocolKey();
FKey keycode = getMouseProtocolKey();
if ( keycode > 0 )
if ( keycode != NOT_SET )
return keycode;
keycode = getTermcapKey();
if ( keycode > 0 )
if ( keycode != NOT_SET )
return keycode;
keycode = getMetaKey();
if ( keycode > 0 )
if ( keycode != NOT_SET )
return keycode;
if ( ! isKeypressTimeout() )
return NEED_MORE_DATA;
return fc::need_more_data;
}
return getSingleKey();
}
//----------------------------------------------------------------------
int FKeyboard::keyCorrection (const int& keycode)
FKey FKeyboard::keyCorrection (const FKey& keycode)
{
int key_correction;
FKey key_correction;
#if defined(__linux__)
if ( linux )

View File

@ -241,7 +241,7 @@ void FLabel::setText (const FString& txt)
//----------------------------------------------------------------------
void FLabel::hide()
{
short fg, bg;
FColor fg, bg;
std::size_t size;
FWidget* parent_widget = getParentWidget();
@ -440,10 +440,10 @@ void FLabel::setHotkeyAccelerator()
{
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{
addAccelerator (std::tolower(hotkey));
addAccelerator (std::toupper(hotkey));
addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
}
else
addAccelerator (getHotkey());
@ -597,9 +597,6 @@ void FLabel::printLine ( wchar_t line[]
{
std::size_t to_char;
std::size_t width = std::size_t(getWidth());
bool isActive, isNoUnderline;
isActive = ((flags & fc::active) != 0);
isNoUnderline = ((flags & fc::no_underline) != 0);
if ( align_offset > 0 )
print (FString(align_offset, ' ')); // leading spaces
@ -623,16 +620,16 @@ void FLabel::printLine ( wchar_t line[]
}
}
if ( z == hotkeypos && isActive )
if ( z == hotkeypos && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print (line[z]);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
if ( hasEmphasis() )

View File

@ -239,16 +239,16 @@ bool FLineEdit::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
setShadowSize(1,1);
flags.shadow = true;
setShadowSize(1, 1);
}
else
{
flags &= ~fc::shadow;
setShadowSize(0,0);
flags.shadow = false;
setShadowSize(0, 0);
}
return on;
return flags.shadow;
}
//----------------------------------------------------------------------
@ -282,7 +282,7 @@ void FLineEdit::setLabelOrientation(const label_o o)
void FLineEdit::hide()
{
std::size_t s, size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -330,7 +330,7 @@ void FLineEdit::clear()
//----------------------------------------------------------------------
void FLineEdit::onKeyPress (FKeyEvent* ev)
{
int key = ev->key();
FKey key = ev->key();
switch ( key )
{
@ -645,7 +645,8 @@ void FLineEdit::adjustLabel()
break;
case label_left:
label->setGeometry(getX() - int(label_length) - 1, getY(), label_length, 1);
label->setGeometry(getX() - int(label_length) - 1, getY()
, label_length, 1);
break;
}
}
@ -698,11 +699,9 @@ bool FLineEdit::hasHotkey()
//----------------------------------------------------------------------
void FLineEdit::draw()
{
bool isFocus;
drawInputField();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -718,12 +717,9 @@ void FLineEdit::draw()
//----------------------------------------------------------------------
void FLineEdit::drawInputField()
{
bool isActiveFocus, isShadow;
std::size_t x;
FString show_text;
int active_focus = fc::active + fc::focus;
isActiveFocus = ((flags & active_focus) == active_focus);
isShadow = ((flags & fc::shadow) != 0 );
bool isActiveFocus = flags.active && flags.focus;
setPrintPos (1, 1);
if ( isMonochron() )
@ -776,7 +772,7 @@ void FLineEdit::drawInputField()
setUnderline(false);
}
if ( isShadow )
if ( flags.shadow )
drawShadow ();
// set the cursor to the first pos.
@ -858,7 +854,7 @@ inline void FLineEdit::keyBackspace()
//----------------------------------------------------------------------
inline void FLineEdit::keyInsert()
{
insert_mode = not insert_mode;
insert_mode = ! insert_mode;
if ( insert_mode )
setInsertCursor();
@ -873,7 +869,7 @@ inline void FLineEdit::keyEnter()
}
//----------------------------------------------------------------------
inline bool FLineEdit::keyInput (int key)
inline bool FLineEdit::keyInput (FKey key)
{
if ( key >= 0x20 && key <= 0x10fff )
{

View File

@ -241,7 +241,7 @@ void FListBox::setText (const FString& txt)
void FListBox::hide()
{
std::size_t n, size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -402,9 +402,9 @@ void FListBox::clear()
void FListBox::onKeyPress (FKeyEvent* ev)
{
std::size_t current_before = current;
int xoffset_before = xoffset
, yoffset_before = yoffset
, key = ev->key();
int xoffset_before = xoffset;
int yoffset_before = yoffset;
FKey key = ev->key();
switch ( key )
{
@ -872,8 +872,6 @@ void FListBox::init()
//----------------------------------------------------------------------
void FListBox::draw()
{
bool isFocus;
if ( current < 1 )
current = 1;
@ -898,7 +896,7 @@ void FListBox::draw()
}
}
drawLabel();
drawHeadline();
if ( isMonochron() )
setReverse(false);
@ -910,9 +908,8 @@ void FListBox::draw()
hbar->redraw();
drawList();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -926,7 +923,7 @@ void FListBox::draw()
}
//----------------------------------------------------------------------
void FListBox::drawLabel()
void FListBox::drawHeadline()
{
if ( text.isNull() || text.isEmpty() )
return;
@ -1017,14 +1014,13 @@ inline void FListBox::drawListLine ( int y
std::size_t i, len;
std::size_t inc_len = inc_search.getLength();
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isFocus = ((flags & fc::focus) != 0);
FString element;
element = getString(iter).mid ( std::size_t(1 + xoffset)
, getWidth() - nf_offset - 4 );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -1035,14 +1031,14 @@ inline void FListBox::drawListLine ( int y
for (i = 0; i < len; i++)
{
if ( serach_mark && i == inc_len && isFocus )
if ( serach_mark && i == inc_len && flags.focus )
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1116,9 +1112,8 @@ inline void FListBox::drawListBracketsLine ( int y
, i = 0
, b = 0;
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isFocus = ((flags & fc::focus) != 0);
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -1164,7 +1159,7 @@ inline void FListBox::drawListBracketsLine ( int y
i++;
}
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1180,10 +1175,8 @@ inline void FListBox::setLineAttributes ( int y
, bool lineHasBrackets
, bool& serach_mark )
{
bool isFocus = ((flags & fc::focus) != 0)
, isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
std::size_t inc_len = inc_search.getLength();
setPrintPos (2, 2 + int(y));
if ( isLineSelected )
@ -1203,14 +1196,14 @@ inline void FListBox::setLineAttributes ( int y
if ( isCurrentLine )
{
if ( isFocus && getMaxColor() < 16 )
if ( flags.focus && getMaxColor() < 16 )
setBold();
if ( isLineSelected )
{
if ( isMonochron() )
setBold();
else if ( isFocus )
else if ( flags.focus )
setColor ( wc.selected_current_element_focus_fg
, wc.selected_current_element_focus_bg );
else
@ -1224,7 +1217,7 @@ inline void FListBox::setLineAttributes ( int y
if ( isMonochron() )
unsetBold();
if ( isFocus )
if ( flags.focus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
@ -1251,7 +1244,7 @@ inline void FListBox::setLineAttributes ( int y
{
if ( isMonochron() )
setReverse(true);
else if ( isFocus && getMaxColor() < 16 )
else if ( flags.focus && getMaxColor() < 16 )
unsetBold();
}
}
@ -1532,17 +1525,17 @@ void FListBox::prevListItem (int distance)
if ( current == 1 )
return;
current -= std::size_t(distance);
if ( current < 1 )
if ( current <= std::size_t(distance) )
current = 1;
else
current -= std::size_t(distance);
if ( current <= std::size_t(yoffset) )
{
yoffset -= distance;
if ( yoffset < 0 )
if ( yoffset < distance )
yoffset = 0;
else
yoffset -= distance;
}
}
@ -1555,23 +1548,23 @@ void FListBox::nextListItem (int distance)
if ( current == element_count )
return;
current += std::size_t(distance);
if ( current > element_count )
if ( current + std::size_t(distance) > element_count )
current = element_count;
else
current += std::size_t(distance);
if ( current - std::size_t(yoffset) > getClientHeight() )
{
yoffset += distance;
if ( yoffset > yoffset_end )
if ( yoffset > yoffset_end - distance )
yoffset = yoffset_end;
else
yoffset += distance;
}
}
//----------------------------------------------------------------------
void FListBox::scrollToX (int val)
{
static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
if ( xoffset == val )
@ -1628,7 +1621,7 @@ void FListBox::scrollLeft (int distance)
//----------------------------------------------------------------------
void FListBox::scrollRight (int distance)
{
static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
xoffset += distance;
@ -1832,7 +1825,7 @@ inline bool FListBox::keyBackspace()
}
//----------------------------------------------------------------------
inline bool FListBox::keyIncSearchInput (int key)
inline bool FListBox::keyIncSearchInput (FKey key)
{
if ( key <= 0x20 || key > 0x10fff )
return false;

View File

@ -167,6 +167,8 @@ FListViewItem::FListViewItem (const FListViewItem& item)
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
FObject* parent = getParent();
@ -192,6 +194,8 @@ FListViewItem::FListViewItem (FObjectIterator parent_iter)
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
insert (this, parent_iter);
}
@ -207,6 +211,8 @@ FListViewItem::FListViewItem ( const FStringList& cols
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
if ( cols.empty() )
return;
@ -325,7 +331,7 @@ FObject::FObjectIterator FListViewItem::insert ( FListViewItem* child
//----------------------------------------------------------------------
void FListViewItem::expand()
{
if ( is_expand || ! hasChildren() )
if ( isExpand() || ! hasChildren() )
return;
is_expand = true;
@ -334,7 +340,7 @@ void FListViewItem::expand()
//----------------------------------------------------------------------
void FListViewItem::collapse()
{
if ( ! is_expand )
if ( ! isExpand() )
return;
is_expand = false;
@ -346,7 +352,7 @@ void FListViewItem::collapse()
template <typename Compare>
void FListViewItem::sort (Compare cmp)
{
if ( ! expandable )
if ( ! isExpandable() )
return;
// Sort the top level
@ -418,6 +424,20 @@ std::size_t FListViewItem::getVisibleLines()
return visible_lines;
}
//----------------------------------------------------------------------
void FListViewItem::setCheckable (bool on)
{
checkable = on;
if ( *root )
{
FListView* root_obj = static_cast<FListView*>(*root);
if ( ! root_obj->hasCheckableItems() && isCheckable() )
root_obj->has_checkable_items = true;
}
}
//----------------------------------------------------------------------
void FListViewItem::resetVisibleLineCounter()
{
@ -610,7 +630,11 @@ FListView::FListView (FWidget* parent)
, scroll_distance(1)
, scroll_timer(false)
, tree_view(false)
, hide_sort_indicator(false)
, has_checkable_items(false)
, clicked_expander_pos(-1, -1)
, clicked_header_pos(-1, -1)
, clicked_checkbox_item(0)
, xoffset(0)
, nf_offset(0)
, max_line_width(1)
@ -693,7 +717,9 @@ fc::sorting_type FListView::getColumnSortType (int column) const
}
//----------------------------------------------------------------------
void FListView::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FListView::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the widget geometry
@ -798,14 +824,11 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
, FObjectIterator parent_iter )
{
FObjectIterator item_iter;
int line_width;
int element_count;
if ( parent_iter == FListView::null_iter )
return FListView::null_iter;
line_width = determineLineWidth (item);
recalculateHorizontalBar (line_width);
beforeInsertion(item); // preprocessing
if ( parent_iter == root )
{
@ -831,19 +854,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
else
item_iter = FListView::null_iter;
if ( itemlist.size() == 1 )
{
// Select first item on insert
current_iter = itemlist.begin();
// The visible area of the list begins with the first element
first_visible_line = itemlist.begin();
}
// Sort list by a column (only if activated)
sort();
element_count = int(getCount());
recalculateVerticalBar (element_count);
afterInsertion(); // post-processing
return item_iter;
}
@ -948,8 +959,8 @@ void FListView::onKeyPress (FKeyEvent* ev)
int position_before = current_iter.getPosition()
, xoffset_before = xoffset
, first_line_position_before = first_visible_line.getPosition()
, pagesize = int(getClientHeight()) - 1
, key = ev->key();
, pagesize = int(getClientHeight()) - 1;
FKey key = ev->key();
clicked_expander_pos.setPoint(-1, -1);
switch ( key )
@ -960,6 +971,11 @@ void FListView::onKeyPress (FKeyEvent* ev)
ev->accept();
break;
case fc::Fkey_space:
keySpace();
ev->accept();
break;
case fc::Fkey_up:
stepBackward();
ev->accept();
@ -1053,34 +1069,55 @@ void FListView::onMouseDown (FMouseEvent* ev)
, mouse_x = ev->getX()
, mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < int(getWidth())
&& mouse_y > 1 && mouse_y < int(getHeight()) )
if ( mouse_x > 1 && mouse_x < int(getWidth()) )
{
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
if ( new_pos < int(getCount()) )
setRelativePosition (mouse_y - 2);
if ( tree_view )
if ( mouse_y == 1 ) // Header
{
const FListViewItem* item = getCurrentItem();
int indent = int(item->getDepth() << 1); // indent = 2 * depth
if ( item->isExpandable() && mouse_x - 2 == indent - xoffset )
clicked_expander_pos = ev->getPos();
clicked_header_pos = ev->getPos();
}
else if ( mouse_y > 1 && mouse_y < int(getHeight()) ) // List
{
int indent = 0;
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
if ( isVisible() )
drawList();
if ( new_pos < int(getCount()) )
setRelativePosition (mouse_y - 2);
vbar->setValue (first_visible_line.getPosition());
const FListViewItem* item = getCurrentItem();
if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar();
if ( tree_view )
{
indent = int(item->getDepth() << 1); // indent = 2 * depth
updateTerminal();
flush_out();
if ( item->isExpandable() && mouse_x - 2 == indent - xoffset )
clicked_expander_pos = ev->getPos();
}
if ( hasCheckableItems() )
{
if ( tree_view )
indent++; // Plus one space
if ( mouse_x >= 3 + indent - xoffset
&& mouse_x <= 5 + indent - xoffset
&& item->isCheckable() )
{
clicked_checkbox_item = item;
}
}
if ( isVisible() )
drawList();
vbar->setValue (first_visible_line.getPosition());
if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar();
updateTerminal();
flush_out();
}
}
}
@ -1095,32 +1132,60 @@ void FListView::onMouseUp (FMouseEvent* ev)
int mouse_x = ev->getX();
int mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < int(getWidth())
&& mouse_y > 1 && mouse_y < int(getHeight()) )
if ( mouse_x > 1 && mouse_x < int(getWidth()) )
{
if ( tree_view )
if ( mouse_y == 1 && clicked_header_pos == ev->getPos() ) // Header
{
mouseHeaderClicked();
}
else if ( mouse_y > 1 && mouse_y < int(getHeight()) ) // List
{
int indent = 0;
FListViewItem* item = getCurrentItem();
if ( item->isExpandable() && clicked_expander_pos == ev->getPos() )
if ( tree_view )
{
if ( item->isExpand() )
item->collapse();
else
item->expand();
indent = int(item->getDepth() << 1); // indent = 2 * depth
adjustSize();
if ( item->isExpandable()
&& clicked_expander_pos == ev->getPos() )
{
if ( item->isExpand() )
item->collapse();
else
item->expand();
if ( isVisible() )
draw();
adjustSize();
if ( isVisible() )
draw();
}
}
}
processChanged();
if ( hasCheckableItems() )
{
if ( tree_view )
indent++; // Plus one space
if ( mouse_x >= 3 + indent - xoffset
&& mouse_x <= 5 + indent - xoffset
&& clicked_checkbox_item == item )
{
item->setChecked(! item->isChecked());
if ( isVisible() )
draw();
}
}
processChanged();
}
}
}
clicked_expander_pos.setPoint(-1, -1);
clicked_header_pos.setPoint(-1, -1);
clicked_checkbox_item = 0;
}
//----------------------------------------------------------------------
@ -1479,8 +1544,6 @@ std::size_t FListView::getAlignOffset ( fc::text_alignment align
//----------------------------------------------------------------------
void FListView::draw()
{
bool isFocus;
if ( current_iter.getPosition() < 1 )
current_iter = itemlist.begin();
@ -1505,7 +1568,7 @@ void FListView::draw()
}
}
drawColumnLabels();
drawHeadlines();
if ( isMonochron() )
setReverse(false);
@ -1517,9 +1580,8 @@ void FListView::draw()
hbar->redraw();
drawList();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -1533,7 +1595,7 @@ void FListView::draw()
}
//----------------------------------------------------------------------
void FListView::drawColumnLabels()
void FListView::drawHeadlines()
{
std::vector<charData>::const_iterator first, last;
headerItems::const_iterator iter;
@ -1547,6 +1609,9 @@ void FListView::drawColumnLabels()
iter = header.begin();
headerline.clear();
if ( hasCheckableItems() )
drawHeaderBorder(4);
while ( iter != header.end() )
{
const FString& text = iter->name;
@ -1557,7 +1622,7 @@ void FListView::drawColumnLabels()
continue;
}
drawColumnText(iter);
drawHeadlineLabel(iter);
++iter;
}
@ -1585,28 +1650,32 @@ void FListView::drawColumnLabels()
void FListView::drawList()
{
uInt page_height, y;
bool is_focus;
FListViewIterator iter;
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
return;
y = 0;
y = 0;
page_height = uInt(getHeight() - 2);
is_focus = ((flags & fc::focus) != 0);
iter = first_visible_line;
iter = first_visible_line;
while ( iter != itemlist.end() && y < page_height )
{
bool is_current_line = bool( iter == current_iter );
const FListViewItem* item = static_cast<FListViewItem*>(*iter);
int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
setPrintPos (2, 2 + int(y));
// Draw one FListViewItem
drawListLine (item, is_focus, is_current_line);
drawListLine (item, flags.focus, is_current_line);
if ( is_focus && is_current_line )
setCursorPos (3, 2 + int(y)); // first character
if ( flags.focus && is_current_line )
{
setVisibleCursor (item->isCheckable());
setCursorPos ( 3 + tree_offset + checkbox_offset - xoffset
, 2 + int(y)); // first character
}
last_visible_line = iter;
y++;
@ -1616,6 +1685,9 @@ void FListView::drawList()
// Reset color
setColor();
if ( isMonochron() )
setReverse(true);
// Clean empty space after last element
while ( y < uInt(getClientHeight()) )
{
@ -1630,35 +1702,37 @@ void FListView::drawListLine ( const FListViewItem* item
, bool is_focus
, bool is_current )
{
std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
// Set line color and attributes
setLineAttributes (is_current, is_focus);
// Print the entry
std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
FString line = getLinePrefix (item, indent);
// Print columns
if ( ! item->column_list.empty() )
{
for (std::size_t i = 0; i < item->column_list.size(); )
for (std::size_t col = 0; col < item->column_list.size(); )
{
static const std::size_t leading_space = 1;
static const std::size_t checkbox_space = 4;
static const std::size_t ellipsis_length = 2;
const FString& text = item->column_list[i];
std::size_t width = std::size_t(header[i].width);
const FString& text = item->column_list[col];
std::size_t width = std::size_t(header[col].width);
std::size_t txt_length = text.getLength();
// Increment the value of i for the column position
// and the next iteration
i++;
fc::text_alignment align = getColumnAlignment(int(i));
col++;
fc::text_alignment align = getColumnAlignment(int(col));
std::size_t align_offset = getAlignOffset (align, txt_length, width);
if ( tree_view && i == 1 )
if ( tree_view && col == 1 )
{
width -= indent;
width--;
width -= (indent + 1);
if ( item->isCheckable() )
width -= checkbox_space;
}
// Insert alignment spaces
@ -1736,20 +1810,41 @@ inline void FListView::setLineAttributes ( bool is_current
}
}
//----------------------------------------------------------------------
inline FString FListView::getCheckBox (const FListViewItem* item)
{
FString checkbox;
if ( isNewFont() )
{
checkbox = ( item->isChecked() ) ? CHECKBOX_ON : CHECKBOX;
checkbox += L' ';
}
else
{
checkbox = L"[ ] ";
if ( item->isChecked() )
checkbox[1] = wchar_t(fc::Times); // Times ×
}
return checkbox;
}
//----------------------------------------------------------------------
inline FString FListView::getLinePrefix ( const FListViewItem* item
, std::size_t indent )
{
FString line = "";
FString line;
if ( tree_view )
{
if ( indent > 0 )
line = FString(indent, L' ');
if ( item->expandable )
if ( item->isExpandable() )
{
if ( item->is_expand )
if ( item->isExpand() )
{
line += wchar_t(fc::BlackDownPointingTriangle); // ▼
line += L' ';
@ -1766,40 +1861,84 @@ inline FString FListView::getLinePrefix ( const FListViewItem* item
else
line = L" ";
if ( item->isCheckable() )
line += getCheckBox(item);
return line;
}
//----------------------------------------------------------------------
void FListView::drawColumnText (headerItems::const_iterator& iter)
inline void FListView::drawSortIndicator ( std::size_t& length
, std::size_t column_width )
{
if ( length >= column_width )
return;
setColor();
length++;
if ( sort_order == fc::ascending )
headerline << wchar_t(fc::BlackUpPointingTriangle); // ▲
else if ( sort_order == fc::descending )
headerline << wchar_t(fc::BlackDownPointingTriangle); // ▼
if ( length < column_width )
{
length++;
headerline << ' ';
}
}
//----------------------------------------------------------------------
inline void FListView::drawHeaderBorder (std::size_t length)
{
setColor();
const FString line (length, wchar_t(fc::BoxDrawingsHorizontal));
headerline << line; // horizontal line
}
//----------------------------------------------------------------------
void FListView::drawHeadlineLabel (headerItems::const_iterator& iter)
{
// Print lable text
static const std::size_t leading_space = 1;
static const std::size_t trailing_space = 1;
const FString& text = iter->name;
std::size_t width = std::size_t(iter->width);
FString txt = " " + text;
std::size_t width = std::size_t(iter->width);
std::size_t txt_length = txt.getLength();
std::size_t column_width = leading_space + width;
headerItems::const_iterator first = header.begin();
int column = int(std::distance(first, iter)) + 1;
bool has_sort_indicator = bool ( sort_column == column
&& ! hide_sort_indicator );
if ( isEnabled() )
setColor (wc.label_emphasis_fg, wc.label_bg);
else
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
if ( has_sort_indicator && txt_length >= column_width - 1 && txt_length > 1 )
{
txt_length = column_width - 2;
txt = txt.left(txt_length);
}
if ( txt_length <= column_width )
{
std::size_t length = txt_length;
headerline << txt;
if ( txt_length < column_width )
headerline << ' '; // trailing space
if ( txt_length + trailing_space < column_width )
if ( length < column_width )
{
setColor();
const FString line ( column_width - trailing_space - txt_length
, wchar_t(fc::BoxDrawingsHorizontal) );
headerline << line; // horizontal line
length++;
headerline << ' '; // trailing space
}
if ( has_sort_indicator )
drawSortIndicator (length, column_width );
if ( length < column_width )
drawHeaderBorder (column_width - length);
}
else
drawColumnEllipsis (iter, text); // Print ellipsis
@ -1878,6 +2017,31 @@ int FListView::determineLineWidth (FListViewItem* item)
return line_width;
}
//----------------------------------------------------------------------
inline void FListView::beforeInsertion (FListViewItem* item)
{
int line_width = determineLineWidth (item);
recalculateHorizontalBar (line_width);
}
//----------------------------------------------------------------------
inline void FListView::afterInsertion()
{
if ( itemlist.size() == 1 )
{
// Select first item on insert
current_iter = itemlist.begin();
// The visible area of the list begins with the first element
first_visible_line = itemlist.begin();
}
// Sort list by a column (only if activated)
sort();
int element_count = int(getCount());
recalculateVerticalBar (element_count);
}
//----------------------------------------------------------------------
void FListView::recalculateHorizontalBar (int len)
{
@ -1908,6 +2072,54 @@ void FListView::recalculateVerticalBar (int element_count)
vbar->setVisible();
}
//----------------------------------------------------------------------
void FListView::mouseHeaderClicked()
{
int column = 1;
int checkbox_offset = ( hasCheckableItems() ) ? 4 : 0;
int header_start = 2 + checkbox_offset;
int header_pos = clicked_header_pos.getX() + xoffset;
headerItems::const_iterator iter;
iter = header.begin();
while ( iter != header.end() )
{
static const int leading_space = 1;
bool has_sort_indicator = bool( column == sort_column );
int click_width = int(iter->name.getLength());
if ( has_sort_indicator )
click_width += 2;
if ( click_width > iter->width )
click_width = iter->width;
if ( header_pos > header_start
&& header_pos <= header_start + click_width )
{
if ( has_sort_indicator && sort_order == fc::ascending )
setColumnSort (column, fc::descending);
else
setColumnSort (column, fc::ascending);
sort();
if ( isVisible() )
{
drawHeadlines();
drawList();
updateTerminal();
flush_out();
}
break;
}
header_start += leading_space + iter->width;
column++;
++iter;
}
}
//----------------------------------------------------------------------
void FListView::wheelUp (int pagesize)
{
@ -2066,6 +2278,15 @@ void FListView::processChanged()
emitCallback("row-changed");
}
//----------------------------------------------------------------------
inline void FListView::keySpace()
{
FListViewItem* item = getCurrentItem();
if ( item->isCheckable() )
item->setChecked(! item->isChecked());
}
//----------------------------------------------------------------------
inline void FListView::keyLeft (int& first_line_position_before)
{
@ -2271,7 +2492,7 @@ void FListView::stepForward (int distance)
void FListView::stepBackward (int distance)
{
if ( current_iter.getPosition() == 0 )
return;
return;
if ( current_iter.getPosition() - distance >= 0 )
{
@ -2468,7 +2689,7 @@ void FListView::cb_HBarChange (FWidget*, data_ptr)
if ( isVisible() )
{
drawColumnLabels();
drawHeadlines();
drawList();
updateTerminal();
flush_out();

View File

@ -71,7 +71,7 @@ FMenu::~FMenu() // destructor
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
if ( ! fapp->isQuit() )
switchToPrevWindow(); // Switch to previous window
switchToPrevWindow(this); // Switch to previous window
}
@ -82,12 +82,7 @@ bool FMenu::setMenuWidget (bool on)
if ( isMenuWidget() == on )
return true;
if ( on )
flags |= fc::menu_widget;
else
flags &= ~fc::menu_widget;
return on;
return (flags.menu_widget = on);
}
//----------------------------------------------------------------------
@ -496,7 +491,7 @@ void FMenu::calculateDimensions()
while ( iter != last )
{
std::size_t item_width = (*iter)->getTextLength() + 2;
int accel_key = (*iter)->accel_key;
FKey accel_key = (*iter)->accel_key;
bool has_menu = (*iter)->hasMenu();
if ( has_menu )
@ -1176,12 +1171,13 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
if ( (*iter)->hasHotkey() )
{
bool found = false;
int hotkey = (*iter)->getHotkey();
int key = ev->key();
uChar hotkey = (*iter)->getHotkey();
FKey key = ev->key();
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{
if ( std::tolower(hotkey) == key || std::toupper(hotkey) == key )
if ( FKey(std::tolower(hotkey)) == key
|| FKey(std::toupper(hotkey)) == key )
found = true;
}
else if ( hotkey == key )
@ -1321,7 +1317,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
menuText txtdata;
std::size_t txt_length = txt.getLength();
std::size_t to_char = txt_length;
int accel_key = menuitem->accel_key;
FKey accel_key = menuitem->accel_key;
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
@ -1350,7 +1346,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
to_char--;
txtdata.length = to_char;
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
txtdata.no_underline = menuitem->getFlags().no_underline;
setCursorToHotkeyPosition (menuitem);
if ( ! is_enabled || is_selected )
@ -1474,7 +1470,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
}
//----------------------------------------------------------------------
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, int accel_key)
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
{
FString accel_name (getKeyName(accel_key));
std::size_t c = ( has_checkable_items ) ? 1 : 0;
@ -1664,7 +1660,7 @@ inline void FMenu::keyEscape()
getStatusBar()->clearMessage();
if ( ! (super && isWindowsMenu(super)) )
switchToPrevWindow();
switchToPrevWindow(this);
}
if ( getStatusBar() )

View File

@ -63,7 +63,7 @@ void FMenuBar::resetMenu()
//----------------------------------------------------------------------
void FMenuBar::hide()
{
short fg, bg;
FColor fg, bg;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
@ -426,10 +426,10 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
{
if ( (*iter)->isEnabled() )
{
int hotkey = (*iter)->getHotkey();
int key = ev->key();
uChar hotkey = (*iter)->getHotkey();
FKey key = ev->key();
if ( fc::Fmkey_meta + std::tolower(hotkey) == key )
if ( fc::Fmkey_meta + FKey(std::tolower(hotkey)) == key )
{
FMenuItem* sel_item = getSelectedItem();
@ -519,7 +519,7 @@ void FMenuBar::drawItems()
if ( item_list.empty() )
return;
setPrintPos (1,1);
setPrintPos (1, 1);
if ( isMonochron() )
setReverse(true);
@ -554,7 +554,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
bool is_selected = menuitem->isSelected();
txtdata.startpos = x + 1;
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
txtdata.no_underline = menuitem->getFlags().no_underline;
// Set screen attributes
setLineAttributes (menuitem);
@ -1042,7 +1042,7 @@ void FMenuBar::leaveMenuBar()
if ( getStatusBar() )
getStatusBar()->clearMessage();
switchToPrevWindow();
switchToPrevWindow(this);
if ( getStatusBar() )
getStatusBar()->drawMessage();

View File

@ -77,7 +77,7 @@ FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (int k, const FString& txt, FWidget* parent)
FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
@ -127,7 +127,8 @@ bool FMenuItem::setEnable (bool on)
if ( super && isMenuBar(super) )
{
// Meta + hotkey
super->addAccelerator (fc::Fmkey_meta + std::tolower(hotkey), this);
super->addAccelerator ( fc::Fmkey_meta + FKey(std::tolower(hotkey))
, this );
}
}
else
@ -231,8 +232,7 @@ void FMenuItem::setText (const FString& txt)
}
//----------------------------------------------------------------------
void FMenuItem::addAccelerator (int key, FWidget* obj)
void FMenuItem::addAccelerator (FKey key, FWidget* obj)
{
FWidget* root = getRootWidget();
accelerator accel = { key, obj };
@ -596,7 +596,7 @@ void FMenuItem::init (FWidget* parent)
setSuperMenu (parent);
if ( accel_key )
if ( accel_key )
addAccelerator (accel_key);
FMenuList* menu_list = getFMenuList(*parent);
@ -610,7 +610,7 @@ void FMenuItem::init (FWidget* parent)
menubar_ptr->calculateDimensions();
if ( hotkey ) // Meta + hotkey
menubar_ptr->addAccelerator ( fc::Fmkey_meta + std::tolower(hotkey)
menubar_ptr->addAccelerator ( fc::Fmkey_meta + FKey(std::tolower(hotkey))
, this );
addCallback // for this element
@ -681,7 +681,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
if ( win )
{
FMenuItem* win_item;
int n = int(std::distance(first, iter));
uInt32 n = uInt32(std::distance(first, iter));
// get the dialog title
const FString& name = win->getText();

View File

@ -47,8 +47,8 @@ FMouse::FMouse()
, max_width(80)
, max_height(25)
, time_mousepressed()
, zero_point(0,0) // zero point (x=0, y=0)
, mouse(0,0) // mouse click position
, zero_point(0, 0) // zero point (x=0, y=0)
, mouse(0, 0) // mouse click position
, new_mouse_position()
{
time_mousepressed.tv_sec = 0;
@ -1200,7 +1200,7 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
FMouseControl::FMouseControl()
: mouse_protocol()
, iter()
, zero_point(0,0)
, zero_point(0, 0)
, use_gpm_mouse(false)
, use_xterm_mouse(false)
{
@ -1575,7 +1575,7 @@ bool FMouseControl::getGpmKeyPressed (bool)
if ( gpm_mouse )
return gpm_mouse->getGpmKeyPressed(pending);
#endif // F_HAVE_LIBGPM
#endif // F_HAVE_LIBGPM
return false;
}

View File

@ -552,7 +552,7 @@ void FOptiAttr::initialize()
}
//----------------------------------------------------------------------
short FOptiAttr::vga2ansi (short color)
FColor FOptiAttr::vga2ansi (FColor color)
{
// VGA | ANSI
// i R G B | i B G R
@ -574,9 +574,11 @@ short FOptiAttr::vga2ansi (short color)
// 1 1 1 0 | 1 0 1 1
// 1 1 1 1 | 1 1 1 1
if ( color >= 0 && color < 16 )
if ( color == fc::Default )
color = 0;
else if ( color < 16 )
{
static const short lookup_table[] =
static const FColor lookup_table[] =
{
0, 4, 2, 6, 1, 5, 3, 7,
8, 12, 10, 14, 9, 13, 11, 15
@ -584,8 +586,6 @@ short FOptiAttr::vga2ansi (short color)
color = lookup_table[color];
}
else if ( color < 0 )
color = 0;
return color;
}
@ -610,7 +610,7 @@ char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
next->code = ' ';
// Look for no changes
if ( ! (switchOn() || switchOff() || colorChange(term, next)) )
if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) )
return 0;
if ( hasNoAttribute(next) )
@ -794,7 +794,7 @@ inline bool FOptiAttr::unsetTermBlink (charData*& term)
if ( F_exit_blink_mode.caused_reset )
reset(term);
else
term->attr.bit.blink = false;
term->attr.bit.blink = false;
if ( append_sequence(F_exit_blink_mode.cap) )
return true;
@ -1227,7 +1227,9 @@ void FOptiAttr::setAttributesOff (charData*& term)
//----------------------------------------------------------------------
bool FOptiAttr::hasColor (charData*& attr)
{
if ( attr && attr->fg_color < 0 && attr->bg_color < 0 )
if ( attr
&& attr->fg_color == fc::Default
&& attr->bg_color == fc::Default )
return false;
else
return true;
@ -1263,7 +1265,7 @@ bool FOptiAttr::hasNoAttribute (charData*& attr)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::colorChange (charData*& term, charData*& next)
inline bool FOptiAttr::hasColorChanged (charData*& term, charData*& next)
{
if ( term && next )
{
@ -1370,7 +1372,7 @@ inline void FOptiAttr::deactivateAttributes ( charData*& term
setAttributesOff(term);
}
if ( colorChange(term, next) )
if ( hasColorChanged(term, next) )
change_color (term, next);
}
@ -1420,7 +1422,7 @@ inline void FOptiAttr::changeAttributeSGR ( charData*& term
&& pc_charset_usable )
setTermPCcharset(term);
if ( colorChange(term, next) )
if ( hasColorChanged(term, next) )
change_color(term, next);
}
@ -1430,7 +1432,7 @@ inline void FOptiAttr::changeAttributeSeparately ( charData*& term
{
setAttributesOff(term);
if ( colorChange(term, next) )
if ( hasColorChanged(term, next) )
change_color (term, next);
detectSwitchOn (term, next); // After reset all attributes
@ -1440,7 +1442,7 @@ inline void FOptiAttr::changeAttributeSeparately ( charData*& term
//----------------------------------------------------------------------
void FOptiAttr::change_color (charData*& term, charData*& next)
{
short fg, bg;
FColor fg, bg;
if ( ! (term && next) )
return;
@ -1452,15 +1454,19 @@ void FOptiAttr::change_color (charData*& term, charData*& next)
return;
}
next->fg_color %= max_color;
next->bg_color %= max_color;
if ( next->fg_color != fc::Default )
next->fg_color %= max_color;
if ( next->bg_color != fc::Default )
next->bg_color %= max_color;
fg = next->fg_color;
bg = next->bg_color;
if ( fg == fc::Default || bg == fc::Default )
change_to_default_color (term, next, fg, bg);
if ( fake_reverse && fg < 0 && bg < 0 )
if ( fake_reverse && fg == fc::Default && bg == fc::Default )
return;
if ( fake_reverse
@ -1481,7 +1487,7 @@ void FOptiAttr::change_color (charData*& term, charData*& next)
//----------------------------------------------------------------------
inline void FOptiAttr::change_to_default_color ( charData*& term
, charData*& next
, short& fg, short& bg )
, FColor& fg, FColor& bg )
{
if ( ansi_default_color )
{
@ -1520,7 +1526,7 @@ inline void FOptiAttr::change_to_default_color ( charData*& term
//----------------------------------------------------------------------
inline void FOptiAttr::change_current_color ( charData*& term
, short fg, short bg )
, FColor fg, FColor bg )
{
char* color_str;
char* AF = F_set_a_foreground.cap;
@ -1535,8 +1541,8 @@ inline void FOptiAttr::change_current_color ( charData*& term
if ( AF && AB )
{
short ansi_fg = vga2ansi(fg);
short ansi_bg = vga2ansi(bg);
FColor ansi_fg = vga2ansi(fg);
FColor ansi_bg = vga2ansi(bg);
if ( (term->fg_color != fg || frev)
&& (color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0)) )

View File

@ -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
//----------------------------------------------------------------------
@ -857,7 +816,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
{
std::strncpy ( hmove
, tparm(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE - 1);
, BUF_SIZE );
hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_right_cursor.duration;
}
@ -977,7 +936,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
if ( move_xy )
{
char* move_ptr = move_buf;
std::strncpy (move_ptr, move_xy, BUF_SIZE - 1);
std::strncpy (move_ptr, move_xy, BUF_SIZE);
move_ptr[BUF_SIZE - 1] = '\0';
move_time = F_cursor_address.duration;
return true;

View File

@ -44,36 +44,36 @@ FPoint& FPoint::operator = (const FPoint& p)
//----------------------------------------------------------------------
FPoint& FPoint::operator += (const FPoint& p)
{
xpos = short(xpos + p.xpos);
ypos = short(ypos + p.ypos);
xpos = xpos + p.xpos;
ypos = ypos + p.ypos;
return *this;
}
//----------------------------------------------------------------------
FPoint& FPoint::operator -= (const FPoint& p)
{
xpos = short(xpos - p.xpos);
ypos = short(ypos - p.ypos);
xpos = xpos - p.xpos;
ypos = ypos - p.ypos;
return *this;
}
//----------------------------------------------------------------------
void FPoint::setX (int x)
{
xpos = short(x);
xpos = x;
}
//----------------------------------------------------------------------
void FPoint::setY (int y)
{
ypos = short(y);
ypos = y;
}
//----------------------------------------------------------------------
void FPoint::setPoint (int x, int y)
{
xpos = short(x);
ypos = short(y);
xpos = x;
ypos = y;
}
//----------------------------------------------------------------------
@ -92,7 +92,7 @@ std::ostream& operator << (std::ostream& outstr, const FPoint& p)
//----------------------------------------------------------------------
std::istream& operator >> (std::istream& instr, FPoint& p)
{
short x, y;
int x, y;
instr >> x;
instr >> y;
p.setPoint (x, y);

View File

@ -68,7 +68,9 @@ void FProgressbar::setPercentage (std::size_t percentage_value)
}
//----------------------------------------------------------------------
void FProgressbar::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FProgressbar::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the progress bar geometry
@ -83,13 +85,13 @@ bool FProgressbar::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
setShadowSize(1,1);
flags.shadow = true;
setShadowSize(1, 1);
}
else
{
flags &= ~fc::shadow;
setShadowSize(0,0);
flags.shadow = false;
setShadowSize(0, 0);
}
return on;
@ -99,7 +101,7 @@ bool FProgressbar::setShadow (bool on)
void FProgressbar::hide()
{
std::size_t s, size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -157,7 +159,7 @@ void FProgressbar::draw()
drawPercentage();
drawBar();
if ( (flags & fc::shadow) != 0 )
if ( flags.shadow )
drawShadow ();
flush_out();
@ -193,7 +195,7 @@ void FProgressbar::drawBar()
{
std::size_t i = 0;
double length;
setPrintPos (1,1);
setPrintPos (1, 1);
setColor ( wc.progressbar_bg
, wc.progressbar_fg );

View File

@ -73,7 +73,7 @@ void FRadioButton::drawRadioButton()
if ( ! isVisible() )
return;
setPrintPos (1,1);
setPrintPos (1, 1);
setColor();
if ( isMonochron() )

View File

@ -34,10 +34,10 @@ namespace finalcut
// constructor and destructor
//----------------------------------------------------------------------
FRect::FRect (const FPoint& p1, const FPoint& p2)
: X1(short(p1.getX()))
, Y1(short(p1.getY()))
, X2(short(p2.getX()))
, Y2(short(p2.getY()))
: X1(p1.getX())
, Y1(p1.getY())
, X2(p2.getX())
, Y2(p2.getY())
{ }
//----------------------------------------------------------------------
@ -55,82 +55,82 @@ bool FRect::isNull() const
//----------------------------------------------------------------------
void FRect::setX1 (int n)
{
X1 = short(n);
X1 = n;
}
//----------------------------------------------------------------------
void FRect::setY1 (int n)
{
Y1 = short(n);
Y1 = n;
}
//----------------------------------------------------------------------
void FRect::setX2 (int n)
{
X2 = short(n);
X2 = n;
}
//----------------------------------------------------------------------
void FRect::setY2 (int n)
{
Y2 = short(n);
Y2 = n;
}
//----------------------------------------------------------------------
void FRect::setX (int n)
{
short dX = short(X2 - X1);
X1 = short(n);
X2 = short(X1 + dX);
int dX = X2 - X1;
X1 = n;
X2 = X1 + dX;
}
//----------------------------------------------------------------------
void FRect::setY (int n)
{
short dY = short(Y2 - Y1);
Y1 = short(n);
Y2 = short(Y1 + dY);
int dY = Y2 - Y1;
Y1 = n;
Y2 = Y1 + dY;
}
//----------------------------------------------------------------------
void FRect::setPos (int x, int y)
{
short dX = short(X2 - X1);
short dY = short(Y2 - Y1);
X1 = short(x);
Y1 = short(y);
X2 = short(X1 + dX);
Y2 = short(Y1 + dY);
int dX = X2 - X1;
int dY = Y2 - Y1;
X1 = x;
Y1 = y;
X2 = X1 + dX;
Y2 = Y1 + dY;
}
//----------------------------------------------------------------------
void FRect::setPos (const FPoint& p)
{
short dX = short(X2 - X1);
short dY = short(Y2 - Y1);
X1 = short(p.getX());
Y1 = short(p.getY());
X2 = short(X1 + dX);
Y2 = short(Y1 + dY);
int dX = X2 - X1;
int dY = Y2 - Y1;
X1 = p.getX();
Y1 = p.getY();
X2 = X1 + dX;
Y2 = Y1 + dY;
}
//----------------------------------------------------------------------
void FRect::setWidth (std::size_t w)
{
X2 = short(X1 + short(w) - 1);
X2 = X1 + int(w) - 1;
}
//----------------------------------------------------------------------
void FRect::setHeight (std::size_t h)
{
Y2 = short(Y1 + short(h) - 1);
Y2 = Y1 + int(h) - 1;
}
//----------------------------------------------------------------------
void FRect::setSize (std::size_t w, std::size_t h)
{
X2 = short(X1 + short(w) - 1);
Y2 = short(Y1 + short(h) - 1);
X2 = X1 + int(w) - 1;
Y2 = Y1 + int(h) - 1;
}
//----------------------------------------------------------------------
@ -145,10 +145,10 @@ void FRect::setRect (const FRect& r)
//----------------------------------------------------------------------
void FRect::setRect (int x, int y, std::size_t width, std::size_t height)
{
X1 = short(x);
Y1 = short(y);
X2 = short(x + int(width) - 1);
Y2 = short(y + int(height) - 1);
X1 = x;
Y1 = y;
X2 = x + int(width) - 1;
Y2 = y + int(height) - 1;
}
//----------------------------------------------------------------------
@ -160,28 +160,28 @@ void FRect::setCoordinates (const FPoint& p1, const FPoint& p2)
//----------------------------------------------------------------------
void FRect::setCoordinates (int x1, int y1, int x2, int y2)
{
X1 = short(x1);
Y1 = short(y1);
X2 = short(x2);
Y2 = short(y2);
X1 = x1;
Y1 = y1;
X2 = x2;
Y2 = y2;
}
//----------------------------------------------------------------------
void FRect::move (int dx, int dy)
{
X1 = short(X1 + dx);
Y1 = short(Y1 + dy);
X2 = short(X2 + dx);
Y2 = short(Y2 + dy);
X1 = X1 + dx;
Y1 = Y1 + dy;
X2 = X2 + dx;
Y2 = Y2 + dy;
}
//----------------------------------------------------------------------
void FRect::move (const FPoint& d)
void FRect::move (const FPoint& d)
{
X1 = short(X1 + d.getX());
Y1 = short(Y1 + d.getY());
X2 = short(X2 + d.getX());
Y2 = short(Y2 + d.getY());
X1 = X1 + d.getX();
Y1 = Y1 + d.getY();
X2 = X2 + d.getX();
Y2 = Y2 + d.getY();
}
//----------------------------------------------------------------------
@ -239,10 +239,10 @@ FRect FRect::combined (const FRect& r) const
//----------------------------------------------------------------------
FRect& FRect::operator = (const FRect& r)
{
X1 = short(r.getX1());
Y1 = short(r.getY1());
X2 = short(r.getX2());
Y2 = short(r.getY2());
X1 = r.getX1();
Y1 = r.getY1();
X2 = r.getX2();
Y2 = r.getY2();
return *this;
}
@ -295,7 +295,7 @@ std::ostream& operator << (std::ostream& outstr, const FRect& r)
//----------------------------------------------------------------------
std::istream& operator >> (std::istream& instr, FRect& r)
{
short x1, y1, x2, y2;
int x1, y1, x2, y2;
instr >> x1;
instr >> y1;
instr >> x2;

View File

@ -174,7 +174,9 @@ void FScrollbar::setOrientation (int o)
}
//----------------------------------------------------------------------
void FScrollbar::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FScrollbar::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the scrollbar geometry
@ -419,10 +421,12 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
if ( bar_orientation == fc::vertical )
slider_click_stop_pos = mouse_y - 2;
else
{
if ( isNewFont() )
slider_click_stop_pos = mouse_x - 3;
else
slider_click_stop_pos = mouse_x - 2;
}
}
else
slider_click_stop_pos = -1;
@ -605,7 +609,7 @@ void FScrollbar::drawButtons()
if ( isNewFont() )
{
setPrintPos (1,1);
setPrintPos (1, 1);
if ( bar_orientation == fc::vertical )
{
@ -626,7 +630,7 @@ void FScrollbar::drawButtons()
}
else
{
setPrintPos (1,1);
setPrintPos (1, 1);
if ( isMonochron() )
setReverse(true);

View File

@ -72,7 +72,7 @@ void FScrollView::setScrollWidth (std::size_t width)
if ( viewport )
{
FPoint no_shadow(0,0);
FPoint no_shadow(0, 0);
scroll_geometry.setWidth (width);
resizeArea (scroll_geometry, no_shadow, viewport);
@ -100,7 +100,7 @@ void FScrollView::setScrollHeight (std::size_t height)
if ( viewport )
{
FPoint no_shadow(0,0);
FPoint no_shadow(0, 0);
scroll_geometry.setHeight (height);
resizeArea (scroll_geometry, no_shadow, viewport);
addPreprocessingHandler
@ -133,7 +133,7 @@ void FScrollView::setScrollSize (std::size_t width, std::size_t height)
if ( viewport )
{
FPoint no_shadow(0,0);
FPoint no_shadow(0, 0);
scroll_geometry.setSize (width, height);
resizeArea (scroll_geometry, no_shadow, viewport);
addPreprocessingHandler
@ -288,13 +288,13 @@ void FScrollView::setPrintPos (int x, int y)
//----------------------------------------------------------------------
bool FScrollView::setViewportPrint (bool on)
{
return use_own_print_area = ! on;
return (use_own_print_area = ! on);
}
//----------------------------------------------------------------------
bool FScrollView::setBorder (bool on)
{
return border = on;
return (border = on);
}
//----------------------------------------------------------------------
@ -333,12 +333,12 @@ void FScrollView::scrollToY (int y)
//----------------------------------------------------------------------
void FScrollView::scrollTo (int x, int y)
{
short& xoffset = viewport_geometry.x1_ref();
short& yoffset = viewport_geometry.y1_ref();
short xoffset_before = xoffset;
short yoffset_before = yoffset;
short xoffset_end = short(getScrollWidth() - getViewportWidth());
short yoffset_end = short(getScrollHeight() - getViewportHeight());
int& xoffset = viewport_geometry.x1_ref();
int& yoffset = viewport_geometry.y1_ref();
int xoffset_before = xoffset;
int yoffset_before = yoffset;
int xoffset_end = int(getScrollWidth() - getViewportWidth());
int yoffset_end = int(getScrollHeight() - getViewportHeight());
std::size_t save_width = viewport_geometry.getWidth();
std::size_t save_height = viewport_geometry.getHeight();
bool changeX = false;
@ -346,11 +346,11 @@ void FScrollView::scrollTo (int x, int y)
x--;
y--;
if ( xoffset == short(x) && yoffset == short(y) )
if ( xoffset == x && yoffset == y )
return;
xoffset = short(x);
yoffset = short(y);
xoffset = x;
yoffset = y;
if ( yoffset < 0 )
yoffset = 0;
@ -374,7 +374,7 @@ void FScrollView::scrollTo (int x, int y)
{
viewport_geometry.setWidth(save_width);
setLeftPadding (1 - xoffset);
setRightPadding (1 - (xoffset_end - xoffset) + short(nf_offset));
setRightPadding (1 - (xoffset_end - xoffset) + int(nf_offset));
if ( update_scrollbar )
{
@ -440,7 +440,7 @@ void FScrollView::draw()
//----------------------------------------------------------------------
void FScrollView::onKeyPress (FKeyEvent* ev)
{
short yoffset_end = short(getScrollHeight() - getViewportHeight());
int yoffset_end = int(getScrollHeight() - getViewportHeight());
switch ( ev->key() )
{
@ -492,7 +492,7 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
//----------------------------------------------------------------------
void FScrollView::onWheel (FWheelEvent* ev)
{
short distance = 4;
int distance = 4;
switch ( ev->getWheel() )
{
@ -548,7 +548,7 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
widget_geometry = focus_widget->getGeometryWithShadow();
vp_geometry = viewport_geometry;
vp_geometry.move(1,1);
vp_geometry.move(1, 1);
if ( ! vp_geometry.contains(widget_geometry) )
{
@ -694,10 +694,10 @@ void FScrollView::copy2area()
ac = &print_area->text[(ay + y) * a_line_len + ax];
std::memcpy (ac, vc, sizeof(charData) * unsigned(x_end));
if ( short(print_area->changes[ay + y].xmin) > ax )
if ( int(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);
if ( short(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
}
@ -749,7 +749,7 @@ void FScrollView::init (FWidget* parent)
setBottomPadding (1 - (yoffset_end - getScrollY()));
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
FPoint no_shadow(0,0);
FPoint no_shadow(0, 0);
std::size_t w = getViewportWidth();
std::size_t h = getViewportHeight();
@ -892,8 +892,8 @@ void FScrollView::setViewportCursor()
void FScrollView::cb_VBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType = vbar->getScrollType();
short distance = 1;
short wheel_distance = 4;
int distance = 1;
int wheel_distance = 4;
if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown )
@ -911,21 +911,21 @@ void FScrollView::cb_VBarChange (FWidget*, data_ptr)
break;
case FScrollbar::scrollPageBackward:
distance = short(getViewportHeight());
distance = int(getViewportHeight());
// fall through
case FScrollbar::scrollStepBackward:
scrollBy (0, -distance);
break;
case FScrollbar::scrollPageForward:
distance = short(getViewportHeight());
distance = int(getViewportHeight());
// fall through
case FScrollbar::scrollStepForward:
scrollBy (0, distance);
break;
case FScrollbar::scrollJump:
scrollToY (1 + short(vbar->getValue()));
scrollToY (1 + int(vbar->getValue()));
break;
case FScrollbar::scrollWheelUp:
@ -944,8 +944,8 @@ void FScrollView::cb_VBarChange (FWidget*, data_ptr)
void FScrollView::cb_HBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType = hbar->getScrollType();
short distance = 1;
short wheel_distance = 4;
int distance = 1;
int wheel_distance = 4;
if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown )
@ -963,21 +963,21 @@ void FScrollView::cb_HBarChange (FWidget*, data_ptr)
break;
case FScrollbar::scrollPageBackward:
distance = short(getViewportWidth());
distance = int(getViewportWidth());
// fall through
case FScrollbar::scrollStepBackward:
scrollBy (-distance, 0);
break;
case FScrollbar::scrollPageForward:
distance = short(getViewportWidth());
distance = int(getViewportWidth());
// fall through
case FScrollbar::scrollStepForward:
scrollBy (distance, 0);
break;
case FScrollbar::scrollJump:
scrollToX (1 + short(hbar->getValue()));
scrollToX (1 + int(hbar->getValue()));
break;
case FScrollbar::scrollWheelUp:

View File

@ -45,7 +45,7 @@ FStatusKey::FStatusKey(FWidget* parent)
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, const FString& txt, FWidget* parent)
FStatusKey::FStatusKey (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool on)
if ( on == mouse_focus )
return true;
return mouse_focus = on;
return (mouse_focus = on);
}
@ -196,7 +196,7 @@ bool FStatusBar::hasActivatedKey()
//----------------------------------------------------------------------
void FStatusBar::hide()
{
short fg, bg;
FColor fg, bg;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;

View File

@ -1192,7 +1192,7 @@ bool FString::operator > (const FString& s) const
//----------------------------------------------------------------------
const FString& FString::insert (const FString& s, int pos)
{
if ( pos < 0 || uInt(pos) > length )
if ( isNegative(pos) || uInt(pos) > length )
throw std::out_of_range("");
_insert (uInt(pos), s.length, s.string);
@ -1474,7 +1474,7 @@ inline void FString::_assign (const wchar_t s[])
uInt new_length = uInt(std::wcslen(s));
if ( ! string || new_length > bufsize - 1 )
if ( ! string || new_length > capacity() )
{
if ( string )
delete[](string);
@ -1493,8 +1493,8 @@ inline void FString::_assign (const wchar_t s[])
}
std::wcsncpy (string, s, bufsize);
string[bufsize - 1] = L'\0';
length = new_length;
string[capacity()] = L'\0';
}
//----------------------------------------------------------------------
@ -1520,7 +1520,7 @@ inline void FString::_insert (std::size_t len, const wchar_t s[])
}
std::wcsncpy (string, s, bufsize);
string[bufsize - 1] = L'\0';
string[capacity()] = L'\0';
}
//----------------------------------------------------------------------
@ -1539,7 +1539,7 @@ inline void FString::_insert ( std::size_t pos
{
std::size_t x;
if ( (length + len + 1) <= bufsize )
if ( length + len <= capacity() )
{
// output string <= bufsize
for (x = length; x + 1 > pos; x--) // shifting right side + '\0'
@ -1587,7 +1587,7 @@ inline void FString::_insert ( std::size_t pos
//----------------------------------------------------------------------
inline void FString::_remove (std::size_t pos, std::size_t len)
{
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
if ( capacity() - length + len <= FWDBUFFER )
{
// shifting left side to pos
for (std::size_t i = pos; i + len < length + 1; i++)

View File

@ -59,6 +59,10 @@ FMouseControl* FTerm::mouse = 0;
FTermOpenBSD* FTerm::openbsd = 0;
#endif
#if DEBUG
FTermDebugData* FTerm::debug_data = 0;
#endif
//----------------------------------------------------------------------
// class FTerm
@ -104,7 +108,7 @@ std::size_t FTerm::getColumnNumber()
}
//----------------------------------------------------------------------
const FString FTerm::getKeyName (int keynum)
const FString FTerm::getKeyName (FKey keynum)
{
return keyboard->getKeyName (keynum);
}
@ -115,6 +119,17 @@ bool FTerm::isNormal (charData*& ch)
return opti_attr->isNormal(ch);
}
//----------------------------------------------------------------------
bool FTerm::isCursorHideable()
{
char* cursor_off_str = disableCursor();
if ( cursor_off_str && std::strlen(cursor_off_str) > 0 )
return true;
return false;
}
//----------------------------------------------------------------------
void FTerm::setTermType (const char term_name[])
{
@ -392,7 +407,7 @@ char* FTerm::cursorsVisibility (bool on)
//----------------------------------------------------------------------
void FTerm::printMoveDurations()
{
opti_move->printDurations();
finalcut::printDurations(*opti_move);
}
//----------------------------------------------------------------------
@ -470,14 +485,13 @@ void FTerm::detectTermSize()
if ( ret != 0 || win_size.ws_col == 0 || win_size.ws_row == 0 )
{
char* str;
term_geometry.setPos(1,1);
term_geometry.setPos (1, 1);
// Use COLUMNS or fallback to the xterm default width of 80 characters
str = std::getenv("COLUMNS");
term_geometry.setWidth(str ? std::size_t(std::atoi(str)) : 80);
char* Columns = std::getenv("COLUMNS");
term_geometry.setWidth(Columns ? std::size_t(std::atoi(Columns)) : 80);
// Use LINES or fallback to the xterm default height of 24 characters
str = std::getenv("LINES");
term_geometry.setHeight(str ? std::size_t(std::atoi(str)) : 24);
char* Lines = std::getenv("LINES");
term_geometry.setHeight(Lines ? std::size_t(std::atoi(Lines)) : 24);
}
else
{
@ -550,7 +564,7 @@ void FTerm::resetColorMap()
}
//----------------------------------------------------------------------
void FTerm::setPalette (short index, int r, int g, int b)
void FTerm::setPalette (FColor index, int r, int g, int b)
{
// Redefine RGB color value for a palette entry
@ -877,6 +891,11 @@ void FTerm::init_global_values (bool disable_alt_screen)
if ( ! init_values.terminal_detection )
term_detection->setTerminalDetection (false);
#if DEBUG
debug_data->setFTermDetection(term_detection);
debug_data->setFTermData(data);
#endif
}
//----------------------------------------------------------------------
@ -1079,7 +1098,7 @@ void FTerm::init_termcap()
// Initialize the terminal capabilities
FTermcap termcap;
termcap.setTermData(data);
termcap.setFTermData(data);
termcap.setFTermDetection(term_detection);
termcap.init();
@ -1093,7 +1112,7 @@ void FTerm::init_quirks()
// Initialize terminal quirks
FTermcapQuirks quirks;
quirks.setTermData (data);
quirks.setFTermData (data);
quirks.setFTermDetection (term_detection);
quirks.terminalFixup(); // Fix terminal quirks
}
@ -1670,6 +1689,10 @@ inline void FTerm::allocationValues()
#elif defined(__NetBSD__) || defined(__OpenBSD__)
openbsd = new FTermOpenBSD();
#endif
#if DEBUG
debug_data = new FTermDebugData();
#endif
}
catch (const std::bad_alloc& ex)
{
@ -1681,6 +1704,10 @@ inline void FTerm::allocationValues()
//----------------------------------------------------------------------
inline void FTerm::deallocationValues()
{
#if DEBUG
if ( debug_data )
delete debug_data;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
if ( openbsd )
@ -1740,7 +1767,7 @@ void FTerm::init (bool disable_alt_screen)
initBaudRate();
// Terminal detection
term_detection->setTermData(data);
term_detection->setFTermData(data);
term_detection->detect();
setTermType (term_detection->getTermType());

View File

@ -20,6 +20,9 @@
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include <algorithm>
#include <vector>
#include "final/ftermcap.h"
namespace finalcut
@ -65,7 +68,7 @@ FTermcap::~FTermcap() // destructor
// public methods of FTermcap
//----------------------------------------------------------------------
void FTermcap::setTermData (FTermData* data)
void FTermcap::setFTermData (FTermData* data)
{
fterm_data = data;
}
@ -336,10 +339,10 @@ void FTermcap::termcapKeysVt100 (char*& buffer)
//----------------------------------------------------------------------
FTermcap::tcap_map FTermcap::tcap[] =
{
// .------------- term string
// | .-------- Tcap-code
// | | // variable name -> description
//-----------------------------------------------------------------------------
// .------------- term string
// | .-------- Tcap-code
// | | // variable name -> description
//------------------------------------------------------------------------------
{ 0, "bl" }, // bell -> audible signal (bell) (P)
{ 0, "ec" }, // erase_chars -> erase #1 characters (P)
{ 0, "cl" }, // clear_screen -> clear screen and home cursor (P*)

View File

@ -49,7 +49,7 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
// public methods of FTermcapQuirks
//----------------------------------------------------------------------
void FTermcapQuirks::setTermData (FTermData* data)
void FTermcapQuirks::setFTermData (FTermData* data)
{
fterm_data = data;
}
@ -228,6 +228,7 @@ void FTermcapQuirks::xterm()
// Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) )
{
FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \
C_STR(OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/"
@ -397,6 +398,8 @@ void FTermcapQuirks::screen()
// Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) )
{
FTermcap::can_change_color_palette = true;
if ( term_detection->isTmuxTerm() )
{
TCAP(fc::t_initialize_color) = \
@ -440,6 +443,7 @@ void FTermcapQuirks::general()
// Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) )
{
FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \
C_STR(OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x"

View File

@ -89,7 +89,7 @@ FTermDetection::~FTermDetection() // destructor
// public methods of FTermDetection
//----------------------------------------------------------------------
void FTermDetection::setTermData (FTermData* data)
void FTermDetection::setFTermData (FTermData* data)
{
fterm_data = data;
}
@ -145,7 +145,8 @@ void FTermDetection::getSystemTermType()
}
// 2nd fallback: use vt100 if not found
std::strncpy (termtype, C_STR("vt100"), 6);
std::strncpy (termtype, C_STR("vt100"), sizeof(termtype));
termtype[sizeof(termtype) - 1] = '\0';
}
//----------------------------------------------------------------------
@ -453,8 +454,9 @@ char* FTermDetection::termtype_256color_quirks()
if ( color_env.string3 && std::strlen(color_env.string3) > 0 )
decscusr_support = true;
if ( (color_env.string1 && std::strncmp(color_env.string1, "gnome-terminal", 14) == 0)
|| color_env.string2 )
if ( color_env.string2
|| (color_env.string1
&& std::strncmp(color_env.string1, "gnome-terminal", 14) == 0) )
{
terminal_type.gnome_terminal = true;
// Each gnome-terminal should be able to use 256 colors
@ -513,7 +515,7 @@ const FString FTermDetection::getXTermColorName (int color)
int stdin_no = FTermios::getStdIn();
char temp[512] = { };
std::fprintf (stdout, OSC "4;%d;?" BEL, color); // get color
std::fprintf (stdout, OSC "4;%3d;?" BEL, color); // get color
std::fflush(stdout);
FD_ZERO(&ifds);
@ -578,7 +580,7 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[])
{
std::strncpy ( termtype_Answerback
, new_termtype
, sizeof(termtype_Answerback) );
, sizeof(termtype_Answerback) - 1);
termtype_Answerback[sizeof(termtype_Answerback) - 1] = '\0';
}
#endif // DEBUG

View File

@ -20,6 +20,8 @@
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include <map>
#include "final/ftermios.h"
#include "final/fterm.h"

View File

@ -118,7 +118,7 @@ void FTermLinux::setUTF8 (bool on)
}
//----------------------------------------------------------------------
bool FTermLinux::setPalette (short index, int r, int g, int b)
bool FTermLinux::setPalette (FColor index, int r, int g, int b)
{
if ( ! FTerm::isLinuxTerm() )
return false;
@ -436,7 +436,7 @@ char* FTermLinux::restoreCursorStyle()
}
//----------------------------------------------------------------------
int FTermLinux::modifierKeyCorrection (const int& key_id)
FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
{
// Get the current modifier key state
modifier_key& m = getModifierKey();
@ -838,7 +838,7 @@ int FTermLinux::setBlinkAsIntensity (bool on)
}
//----------------------------------------------------------------------
bool FTermLinux::setVGAPalette (short index, int r, int g, int b)
bool FTermLinux::setVGAPalette (FColor index, int r, int g, int b)
{
// Set the vga color map
@ -910,7 +910,7 @@ bool FTermLinux::resetVGAPalette()
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
//----------------------------------------------------------------------
int FTermLinux::shiftKeyCorrection (const int& key_id)
FKey FTermLinux::shiftKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -950,7 +950,7 @@ int FTermLinux::shiftKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::ctrlKeyCorrection (const int& key_id)
FKey FTermLinux::ctrlKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -990,7 +990,7 @@ int FTermLinux::ctrlKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::altKeyCorrection (const int& key_id)
FKey FTermLinux::altKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -1030,7 +1030,7 @@ int FTermLinux::altKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::shiftCtrlKeyCorrection (const int& key_id)
FKey FTermLinux::shiftCtrlKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -1070,7 +1070,7 @@ int FTermLinux::shiftCtrlKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::shiftAltKeyCorrection (const int& key_id)
FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -1110,7 +1110,7 @@ int FTermLinux::shiftAltKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::ctrlAltKeyCorrection (const int& key_id)
FKey FTermLinux::ctrlAltKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{
@ -1150,7 +1150,7 @@ int FTermLinux::ctrlAltKeyCorrection (const int& key_id)
}
//----------------------------------------------------------------------
int FTermLinux::shiftCtrlAltKeyCorrection (const int& key_id)
FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id)
{
switch ( key_id )
{

View File

@ -93,7 +93,9 @@ const FString FTextView::getText() const
}
//----------------------------------------------------------------------
void FTextView::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FTextView::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the text view geometry
@ -194,7 +196,7 @@ void FTextView::scrollTo (int x, int y)
void FTextView::hide()
{
std::size_t n, size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();

View File

@ -88,7 +88,9 @@ FToggleButton::~FToggleButton() // destructor
// public methods of FToggleButton
//----------------------------------------------------------------------
void FToggleButton::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FToggleButton::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the toggle button geometry
@ -109,12 +111,7 @@ void FToggleButton::setGeometry (int x, int y, std::size_t w, std::size_t h, boo
//----------------------------------------------------------------------
bool FToggleButton::setNoUnderline (bool on)
{
if ( on )
flags |= fc::no_underline;
else
flags &= ~fc::no_underline;
return on;
return (flags.no_underline = on);
}
//----------------------------------------------------------------------
@ -218,7 +215,7 @@ void FToggleButton::setText (const FString& txt)
void FToggleButton::hide()
{
std::size_t size;
short fg, bg;
FColor fg, bg;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -291,7 +288,7 @@ void FToggleButton::onMouseUp (FMouseEvent* ev)
}
else
{
checked = not checked;
checked = ! checked;
processToggle();
}
@ -337,7 +334,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
}
else
{
checked = not checked;
checked = ! checked;
processToggle();
}
@ -431,16 +428,16 @@ uChar FToggleButton::getHotkey()
//----------------------------------------------------------------------
void FToggleButton::setHotkeyAccelerator()
{
int hotkey = getHotkey();
uChar hotkey = getHotkey();
if ( hotkey )
{
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{
addAccelerator (std::tolower(hotkey));
addAccelerator (std::toupper(hotkey));
addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
}
else
addAccelerator (getHotkey());
@ -464,9 +461,7 @@ bool FToggleButton::isCheckboxButton() const
//----------------------------------------------------------------------
void FToggleButton::draw()
{
bool isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -535,12 +530,10 @@ void FToggleButton::processToggle()
//----------------------------------------------------------------------
void FToggleButton::onKeyPress (FKeyEvent* ev)
{
int key;
if ( ! isEnabled() )
return;
key = ev->key();
FKey key = ev->key();
switch ( key )
{
@ -557,7 +550,7 @@ void FToggleButton::onKeyPress (FKeyEvent* ev)
}
else
{
checked = not checked;
checked = ! checked;
processToggle();
}
processClick();
@ -624,8 +617,8 @@ void FToggleButton::init()
//----------------------------------------------------------------------
std::size_t FToggleButton::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
, wchar_t dest[]
, std::size_t length )
{
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -649,12 +642,9 @@ std::size_t FToggleButton::getHotkeyPos ( wchar_t src[]
//----------------------------------------------------------------------
void FToggleButton::drawText ( wchar_t LabelText[]
, std::size_t hotkeypos
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
bool isNoUnderline = ((flags & fc::no_underline) != 0);
if ( isMonochron() )
setReverse(true);
@ -665,16 +655,16 @@ void FToggleButton::drawText ( wchar_t LabelText[]
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
if ( (z == hotkeypos) && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print ( LabelText[z] );
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
setColor (wc.label_fg, wc.label_bg);
@ -684,7 +674,7 @@ void FToggleButton::drawText ( wchar_t LabelText[]
}
if ( isMonochron() )
setReverse(false);;
setReverse(false);
}
} // namespace finalcut

View File

@ -71,7 +71,7 @@ FToolTip::~FToolTip() // destructor
if ( parent_win )
setActiveWindow (parent_win);
else
switchToPrevWindow();
switchToPrevWindow(this);
}

View File

@ -25,6 +25,7 @@
#include <vector>
#include "final/fapplication.h"
#include "final/fterm.h"
#include "final/fvterm.h"
#include "final/fwidget.h"
#include "final/fwindow.h"
@ -48,6 +49,7 @@ uInt FVTerm::clr_eol_length;
uInt FVTerm::cursor_address_length;
std::queue<int>* FVTerm::output_buffer = 0;
FPoint* FVTerm::term_pos = 0;
FTerm* FVTerm::fterm = 0;
FVTerm::term_area* FVTerm::vterm = 0;
FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::active_area = 0;
@ -66,15 +68,14 @@ FVTerm::charData FVTerm::i_ch;
// constructors and destructor
//----------------------------------------------------------------------
FVTerm::FVTerm (bool initialize, bool disable_alt_screen)
: FTerm(disable_alt_screen)
, print_area(0)
: print_area(0)
, child_print_area(0)
, vwin(0)
{
terminal_update_complete = false;
if ( initialize )
init();
init (disable_alt_screen);
}
//----------------------------------------------------------------------
@ -97,7 +98,7 @@ FPoint FVTerm::getPrintCursor()
return FPoint ( win->offset_left + win->cursor_x
, win->offset_top + win->cursor_y );
return FPoint(0,0);
return FPoint(0, 0);
}
//----------------------------------------------------------------------
@ -113,7 +114,7 @@ void FVTerm::setTermXY (int x, int y)
term_width = int(getColumnNumber());
term_height = int(getLineNumber());
if ( x >= term_width )
if ( x >= term_width && term_width > 0 )
{
y += x / term_width;
x %= term_width;
@ -128,7 +129,7 @@ void FVTerm::setTermXY (int x, int y)
term_x = term_pos->getX();
term_y = term_pos->getY();
move_str = moveCursor (term_x, term_y, x, y);
move_str = FTerm::moveCursor (term_x, term_y, x, y);
if ( move_str )
appendOutputBuffer(move_str);
@ -142,7 +143,7 @@ void FVTerm::hideCursor (bool on)
{
// Hides or shows the input cursor on the terminal
char* visibility_str = cursorsVisibility (on);
char* visibility_str = FTerm::cursorsVisibility (on);
if ( visibility_str )
appendOutputBuffer(visibility_str);
@ -162,6 +163,17 @@ void FVTerm::setPrintCursor (int x, int y)
}
}
//----------------------------------------------------------------------
FColor FVTerm::rgb2ColorIndex (uInt8 r, uInt8 g, uInt8 b)
{
// Converts a 24-bit RGB color to a 256-color compatible approximation
FColor ri = (((r * 5) + 127) / 255) * 36;
FColor gi = (((g * 5) + 127) / 255) * 6;
FColor bi = (((b * 5) + 127) / 255);
return 16 + ri + gi + bi;
}
//----------------------------------------------------------------------
void FVTerm::clearArea (int fillchar)
{
@ -172,7 +184,7 @@ void FVTerm::clearArea (int fillchar)
void FVTerm::createVTerm (const FRect& r)
{
// initialize virtual terminal
const FPoint shadow(0,0);
const FPoint shadow(0, 0);
createArea (r, shadow, vterm);
}
@ -186,7 +198,7 @@ void FVTerm::createVTerm (int width, int height)
//----------------------------------------------------------------------
void FVTerm::resizeVTerm (const FRect& r)
{
const FPoint shadow(0,0);
const FPoint shadow(0, 0);
resizeArea (r, shadow, vterm);
}
@ -535,7 +547,7 @@ int FVTerm::print (term_area* area, charData& term_char)
}
// copy character to area
std::memcpy (ac, &nc, sizeof(nc));
std::memcpy (ac, &nc, sizeof(*ac));
if ( ax < short(area->changes[ay].xmin) )
area->changes[ay].xmin = uInt(ax);
@ -843,7 +855,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
int xpos = x + tx;
tc = &vterm->text[ypos * vterm->width + xpos];
sc = generateCharacter(xpos, ypos);
std::memcpy (tc, &sc, sizeof(charData));
std::memcpy (tc, &sc, sizeof(*tc));
}
if ( short(vterm->changes[ypos].xmin) > x )
@ -944,7 +956,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
charData* tc = &vterm->text[ty * vterm->width + tx];
// New character
charData nc;
std::memcpy (&nc, ac, sizeof(charData));
std::memcpy (&nc, ac, sizeof(nc));
// Overlapped character
charData oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
nc.fg_color = oc.fg_color;
@ -961,7 +973,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
nc.code = ' ';
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
std::memcpy (tc, &nc, sizeof(charData));
std::memcpy (tc, &nc, sizeof(*tc));
}
//----------------------------------------------------------------------
@ -974,7 +986,7 @@ void FVTerm::updateOverlappedCharacter (term_area* area, int tx, int ty)
// Overlapped character
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
std::memcpy (tc, &oc, sizeof(charData));
std::memcpy (tc, &oc, sizeof(*tc));
}
//----------------------------------------------------------------------
@ -1006,7 +1018,7 @@ void FVTerm::updateShadedCharacter ( term_area* area
oc.code = ' ';
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
std::memcpy (tc, &oc, sizeof(charData));
std::memcpy (tc, &oc, sizeof(*tc));
}
//----------------------------------------------------------------------
@ -1024,12 +1036,12 @@ void FVTerm::updateInheritBackground ( term_area* area
charData* tc = &vterm->text[ty * vterm->width + tx];
// New character
charData nc;
std::memcpy (&nc, ac, sizeof(charData));
std::memcpy (&nc, ac, sizeof(nc));
// Covered character
charData cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
nc.bg_color = cc.bg_color;
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
std::memcpy (tc, &nc, sizeof(charData));
std::memcpy (tc, &nc, sizeof(*tc));
}
//----------------------------------------------------------------------
@ -1045,7 +1057,7 @@ void FVTerm::updateCharacter ( term_area* area
charData* ac = &area->text[y * line_len + x];
// Terminal character
charData* tc = &vterm->text[ty * vterm->width + tx];
std::memcpy (tc, ac, sizeof(charData));
std::memcpy (tc, ac, sizeof(*tc));
if ( tc->attr.bit.printed && *tc == *ac )
tc->attr.bit.no_changes = true;
@ -1373,7 +1385,7 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
charData* ac; // area character
tc = &vterm->text[(ay + y) * vterm->width + ax];
ac = &area->text[y * area->width];
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
if ( short(area->changes[y].xmin) > 0 )
area->changes[y].xmin = 0;
@ -1429,7 +1441,7 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
int line_len = area->width + area->right_shadow;
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
ac = &area->text[(dy + _y) * line_len + dx];
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
if ( short(area->changes[dy + _y].xmin) > dx )
area->changes[dy + _y].xmin = uInt(dx);
@ -1557,14 +1569,14 @@ void FVTerm::scrollAreaForward (term_area* area)
int pos2 = (y + 1) * total_width;
sc = &area->text[pos2];
dc = &area->text[pos1];
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
std::memcpy (dc, sc, sizeof(*dc) * unsigned(length));
area->changes[y].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1);
}
// insert a new line below
lc = &area->text[(y_max * total_width) - area->right_shadow - 1];
std::memcpy (&nc, lc, sizeof(charData));
std::memcpy (&nc, lc, sizeof(nc));
nc.code = ' ';
dc = &area->text[y_max * total_width];
std::fill_n (dc, area->width, nc);
@ -1577,7 +1589,7 @@ void FVTerm::scrollAreaForward (term_area* area)
if ( TCAP(fc::t_scroll_forward) )
{
setTermXY (0, vdesktop->height);
scrollTermForward();
FTerm::scrollTermForward();
putArea (1, 1, vdesktop);
// avoid update lines from 0 to (y_max - 1)
@ -1618,14 +1630,14 @@ void FVTerm::scrollAreaReverse (term_area* area)
int pos2 = y * total_width;
sc = &area->text[pos1];
dc = &area->text[pos2];
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
std::memcpy (dc, sc, sizeof(*dc) * unsigned(length));
area->changes[y].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1);
}
// insert a new line above
lc = &area->text[total_width];
std::memcpy (&nc, lc, sizeof(charData));
std::memcpy (&nc, lc, sizeof(nc));
nc.code = ' ';
dc = &area->text[0];
std::fill_n (dc, area->width, nc);
@ -1638,7 +1650,7 @@ void FVTerm::scrollAreaReverse (term_area* area)
if ( TCAP(fc::t_scroll_reverse) )
{
setTermXY (0, 0);
scrollTermReverse();
FTerm::scrollTermReverse();
putArea (1, 1, vdesktop);
// avoid update lines from 1 to y_max
@ -1660,7 +1672,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
uInt w;
// Current attributes with a space character
std::memcpy (&nc, &next_attribute, sizeof(charData));
std::memcpy (&nc, &next_attribute, sizeof(nc));
nc.code = fillchar;
if ( ! (area && area->text) )
@ -1755,7 +1767,7 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
if ( tmp->attr.bit.trans_shadow ) // Transparent shadow
{
// Keep the current vterm character
std::memcpy (&s_ch, sc, sizeof(charData));
std::memcpy (&s_ch, sc, sizeof(s_ch));
s_ch.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false;
@ -1774,7 +1786,7 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
else if ( tmp->attr.bit.inherit_bg )
{
// Add the covered background to this character
std::memcpy (&i_ch, tmp, sizeof(charData));
std::memcpy (&i_ch, tmp, sizeof(i_ch));
i_ch.bg_color = sc->bg_color; // Last background color
sc = &i_ch;
}
@ -1950,7 +1962,7 @@ void FVTerm::flush_out()
{
while ( ! output_buffer->empty() )
{
Fputchar (output_buffer->front());
FTerm::Fputchar(output_buffer->front());
output_buffer->pop();
}
@ -1960,7 +1972,7 @@ void FVTerm::flush_out()
// private methods of FVTerm
//----------------------------------------------------------------------
void FVTerm::init()
void FVTerm::init (bool disable_alt_screen)
{
init_object = this;
vterm = 0;
@ -1968,6 +1980,7 @@ void FVTerm::init()
try
{
fterm = new FTerm (disable_alt_screen);
term_pos = new FPoint(-1, -1);
output_buffer = new std::queue<int>;
}
@ -1991,7 +2004,7 @@ void FVTerm::init()
term_attribute.attr.byte[0] = 0;
// next_attribute contains the state of the next printed character
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute));
// Receive the terminal capabilities
tcap = FTermcap::getTermcapMap();
@ -2001,19 +2014,19 @@ void FVTerm::init()
createVTerm (term_geometry);
// Create virtual desktop area
FPoint shadow_size(0,0);
FPoint shadow_size(0, 0);
createArea (term_geometry, shadow_size, vdesktop);
vdesktop->visible = true;
active_area = vdesktop;
// Initialize keyboard
keyboard = getKeyboard();
keyboard = FTerm::getKeyboard();
// Hide the input cursor
hideCursor();
// Initialize character lengths
init_characterLengths (getFOptiMove());
init_characterLengths (FTerm::getFOptiMove());
}
//----------------------------------------------------------------------
@ -2046,7 +2059,7 @@ void FVTerm::finish()
// Clear the terminal
setNormal();
if ( hasAlternateScreen() )
if ( FTerm::hasAlternateScreen() )
clearTerm();
flush_out();
@ -2060,6 +2073,9 @@ void FVTerm::finish()
if ( term_pos )
delete term_pos;
if ( fterm )
delete fterm;
}
//----------------------------------------------------------------------
@ -2067,7 +2083,7 @@ void FVTerm::putAreaLine (charData* ac, charData* tc, int length)
{
// copy "length" characters from area to terminal
std::memcpy (tc, ac, sizeof(charData) * unsigned(length));
std::memcpy (tc, ac, sizeof(*tc) * unsigned(length));
}
//----------------------------------------------------------------------
@ -2080,7 +2096,7 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
// Restore one character on vterm
charData ch;
ch = getCoveredCharacter (x, y, obj);
std::memcpy (tc, &ch, sizeof(charData));
std::memcpy (tc, &ch, sizeof(*tc));
}
else // Mot transparent
{
@ -2102,19 +2118,19 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|| ch.code == fc::FullBlock )
ch.code = ' ';
std::memcpy (tc, &ch, sizeof(charData));
std::memcpy (tc, &ch, sizeof(*tc));
}
else if ( ac->attr.bit.inherit_bg )
{
// Add the covered background to this character
charData ch, cc;
std::memcpy (&ch, ac, sizeof(charData));
std::memcpy (&ch, ac, sizeof(ch));
cc = getCoveredCharacter (x, y, obj);
ch.bg_color = cc.bg_color;
std::memcpy (tc, &ch, sizeof(charData));
std::memcpy (tc, &ch, sizeof(*tc));
}
else // Default
std::memcpy (tc, ac, sizeof(charData));
std::memcpy (tc, ac, sizeof(*tc));
}
}
@ -2134,7 +2150,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
if ( tmp->attr.bit.trans_shadow ) // transparent shadow
{
// Keep the current vterm character
std::memcpy (&s_ch, cc, sizeof(charData));
std::memcpy (&s_ch, cc, sizeof(s_ch));
s_ch.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false;
@ -2144,7 +2160,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
else if ( tmp->attr.bit.inherit_bg )
{
// Add the covered background to this character
std::memcpy (&i_ch, tmp, sizeof(charData));
std::memcpy (&i_ch, tmp, sizeof(i_ch));
i_ch.bg_color = cc->bg_color; // last background color
cc = &i_ch;
}
@ -2163,7 +2179,7 @@ bool FVTerm::clearTerm (int fillchar)
char*& cb = TCAP(fc::t_clr_eol);
bool ut = FTermcap::background_color_erase;
charData* next = &next_attribute;
bool normal = isNormal(next);
bool normal = FTerm::isNormal(next);
appendAttributes(next);
if ( ! ( (cl || cd || cb) && (normal || ut) )
@ -2175,7 +2191,7 @@ bool FVTerm::clearTerm (int fillchar)
if ( cl ) // Clear screen
{
appendOutputBuffer (cl);
term_pos->setPoint(0,0);
term_pos->setPoint(0, 0);
}
else if ( cd ) // Clear to end of screen
{
@ -2193,7 +2209,7 @@ bool FVTerm::clearTerm (int fillchar)
appendOutputBuffer (cb);
}
setTermXY (0,0);
setTermXY (0, 0);
}
flush_out();
@ -2268,7 +2284,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
if ( ce && min_char->code == ' ' )
{
uInt beginning_whitespace = 1;
bool normal = isNormal(min_char);
bool normal = FTerm::isNormal(min_char);
bool& ut = FTermcap::background_color_erase;
for (uInt x = xmin + 1; x < uInt(vt->width); x++)
@ -2303,7 +2319,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
if ( cb && first_char->code == ' ' )
{
uInt leading_whitespace = 1;
bool normal = isNormal(first_char);
bool normal = FTerm::isNormal(first_char);
bool& ut = FTermcap::background_color_erase;
for (uInt x = 1; x < uInt(vt->width); x++)
@ -2341,7 +2357,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
if ( ce && last_char->code == ' ' )
{
uInt trailing_whitespace = 1;
bool normal = isNormal(last_char);
bool normal = FTerm::isNormal(last_char);
bool& ut = FTermcap::background_color_erase;
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--)
@ -2452,7 +2468,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
return not_used;
uInt whitespace = 1;
bool normal = isNormal(print_char);
bool normal = FTerm::isNormal(print_char);
for (uInt i = x + 1; i <= xmax; i++)
{
@ -2776,14 +2792,14 @@ inline void FVTerm::charsetChanges (charData*& next_char)
return;
uInt code = uInt(next_char->code);
uInt ch_enc = charEncode(code);
uInt ch_enc = FTerm::charEncode(code);
if ( ch_enc == code )
return;
if ( ch_enc == 0 )
{
next_char->code = int(charEncode(code, fc::ASCII));
next_char->code = int(FTerm::charEncode(code, fc::ASCII));
return;
}
@ -2801,7 +2817,7 @@ inline void FVTerm::charsetChanges (charData*& next_char)
if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f
{
if ( hasUTF8() )
next_char->code = int(charEncode(code, fc::ASCII));
next_char->code = int(FTerm::charEncode(code, fc::ASCII));
else
{
next_char->code += 0x5f;
@ -2843,7 +2859,7 @@ inline void FVTerm::appendAttributes (charData*& next_attr)
charData* term_attr = &term_attribute;
// generate attribute string for the next character
attr_str = changeAttribute (term_attr, next_attr);
attr_str = FTerm::changeAttribute (term_attr, next_attr);
if ( attr_str )
appendOutputBuffer (attr_str);

View File

@ -58,15 +58,9 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
: FVTerm(bool(! parent), disable_alt_screen)
, FObject(parent)
, accelerator_list(0)
, flags(0)
, flags()
, callback_objects()
, member_callback_objects()
, enable(true)
, visible(true)
, shown(false)
, focus(false)
, focusable(true)
, visible_cursor(true)
, widget_cursor_position(-1, -1)
, size_hints()
, double_flatline_mask()
@ -84,10 +78,14 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
, background_color(fc::Default)
, statusbar_message()
{
if ( isEnabled() )
flags |= fc::active;
// init bit field with 0
memset (&flags, 0, sizeof(flags));
widget_object = true;
flags.active = true; // Enable widget by default
flags.visible = true; // A widget is visible by default
flags.focusable = true; // A widget is focusable by default
flags.visible_cursor = true; // A widget has a visible cursor by default
widget_object = true; // This FObject is a widget
if ( ! parent )
{
@ -103,7 +101,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
}
else
{
visible_cursor = ! hideable;
flags.visible_cursor = ! hideable;
offset = parent->client_offset;
double_flatline_mask.top.resize (getWidth(), false);
double_flatline_mask.right.resize (getHeight(), false);
@ -124,7 +122,7 @@ FWidget::~FWidget() // destructor
setClickedWidget(0);
// unset the local window widget focus
if ( focus )
if ( flags.focus )
{
if ( FWindow* window = FWindow::getWindowWidget(this) )
window->setWindowFocusWidget(0);
@ -276,12 +274,7 @@ void FWidget::setMainWidget (FWidget* obj)
//----------------------------------------------------------------------
bool FWidget::setEnable (bool on)
{
if ( on )
flags |= fc::active;
else
flags &= ~fc::active;
return enable = on;
return (flags.active = on);
}
//----------------------------------------------------------------------
@ -290,21 +283,16 @@ bool FWidget::setFocus (bool on)
FWindow* window;
FWidget* last_focus;
if ( ! enable )
if ( ! isEnabled() )
return false;
if ( on )
flags |= fc::focus;
else
flags &= ~fc::focus;
if ( on == focus )
if ( flags.focus == on )
return true;
last_focus = FWidget::getFocusWidget();
// set widget focus
if ( on && ! focus )
if ( on && ! flags.focus )
{
int focusable_children = numOfFocusableChildren();
@ -334,7 +322,7 @@ bool FWidget::setFocus (bool on)
window->setWindowFocusWidget(this);
}
return focus = on;
return (flags.focus = on);
}
//----------------------------------------------------------------------
@ -604,7 +592,9 @@ void FWidget::setTermSize (std::size_t w, std::size_t h)
}
//----------------------------------------------------------------------
void FWidget::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FWidget::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Sets the geometry of the widget relative to its parent
@ -657,7 +647,7 @@ bool FWidget::setCursorPos (int x, int y)
widget_cursor_position.setPoint(x, y);
if ( (flags & fc::focus) == 0 || isWindowWidget() )
if ( ! flags.focus || isWindowWidget() )
return false;
if ( ! FWindow::getWindowWidget(this) )
@ -678,7 +668,7 @@ bool FWidget::setCursorPos (int x, int y)
setAreaCursor ( widget_offsetX + x
, widget_offsetY + y
, visible_cursor
, flags.visible_cursor
, area );
return true;
}
@ -854,7 +844,7 @@ bool FWidget::close()
{
hide();
if ( (flags & fc::modal) == 0 )
if ( ! flags.modal )
close_widget->push_back(this);
}
return true;
@ -980,7 +970,7 @@ void FWidget::emitCallback (const FString& emit_signal)
}
//----------------------------------------------------------------------
void FWidget::addAccelerator (int key, FWidget* obj)
void FWidget::addAccelerator (FKey key, FWidget* obj)
{
FWidget* widget = FWindow::getWindowWidget(obj);
accelerator accel = { key, obj };
@ -1030,7 +1020,7 @@ void FWidget::redraw()
setColor (wc.term_fg, wc.term_bg);
clearArea (vdesktop);
}
else if ( ! visible )
else if ( ! isVisible() )
return;
draw();
@ -1077,7 +1067,7 @@ void FWidget::resize()
//----------------------------------------------------------------------
void FWidget::show()
{
if ( ! visible )
if ( ! isVisible() )
return;
if ( ! init_desktop )
@ -1099,7 +1089,7 @@ void FWidget::show()
}
draw();
shown = true;
flags.shown = true;
if ( hasChildren() )
{
@ -1134,10 +1124,10 @@ void FWidget::show()
//----------------------------------------------------------------------
void FWidget::hide()
{
if ( visible )
if ( isVisible() )
{
visible = false;
shown = false;
flags.visible = false;
flags.shown = false;
if ( ! isDialogWidget()
&& FWidget::getFocusWidget() == this
@ -1264,13 +1254,11 @@ void FWidget::move (int dx, int dy)
//----------------------------------------------------------------------
void FWidget::drawShadow()
{
bool trans_shadow = ((flags & fc::trans_shadow) != 0);
if ( isMonochron() && ! trans_shadow )
if ( isMonochron() && ! flags.trans_shadow )
return;
if ( (getEncoding() == fc::VT100 && ! trans_shadow)
|| (getEncoding() == fc::ASCII && ! trans_shadow) )
if ( (getEncoding() == fc::VT100 && ! flags.trans_shadow)
|| (getEncoding() == fc::ASCII && ! flags.trans_shadow) )
{
clearShadow();
return;
@ -1281,7 +1269,7 @@ void FWidget::drawShadow()
, y1 = 1
, y2 = int(getHeight());
if ( trans_shadow )
if ( flags.trans_shadow )
{
// transparent shadow
drawTransparentShadow (x1, y1, x2, y2);
@ -1974,14 +1962,8 @@ void FWidget::init()
return;
}
char* cursor_off_str = disableCursor();
if ( cursor_off_str && std::strlen(cursor_off_str) > 0 )
hideable = true;
else
hideable = false;
visible_cursor = ! hideable;
hideable = isCursorHideable();
flags.visible_cursor = ! hideable;
// Determine width and height of the terminal
detectTermSize();

View File

@ -93,16 +93,12 @@ bool FWindow::setWindowWidget (bool on)
if ( isWindowWidget() == on )
return true;
flags.window_widget = on;
if ( on )
{
flags |= fc::window_widget;
setTermOffset();
}
else
{
flags &= ~fc::window_widget;
setParentOffset();
}
return on;
}
@ -166,7 +162,7 @@ bool FWindow::activateWindow (bool on)
active_area = getVWin();
}
return window_active = on;
return (window_active = on);
}
//----------------------------------------------------------------------
@ -179,29 +175,18 @@ void FWindow::unsetActiveWindow()
//----------------------------------------------------------------------
bool FWindow::setResizeable (bool on)
{
if ( on )
flags |= fc::resizeable;
else
flags &= ~fc::resizeable;
return on;
return (flags.resizeable = on);
}
//----------------------------------------------------------------------
bool FWindow::setTransparentShadow (bool on)
{
flags.shadow = flags.trans_shadow = on;
if ( on )
{
flags |= fc::shadow;
flags |= fc::trans_shadow;
setShadowSize (2,1);
}
setShadowSize (2, 1);
else
{
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
setShadowSize (0,0);
}
setShadowSize (0, 0);
return on;
}
@ -214,15 +199,15 @@ bool FWindow::setShadow (bool on)
if ( on )
{
flags |= fc::shadow;
flags &= ~fc::trans_shadow;
setShadowSize (1,1);
flags.shadow = true;
flags.trans_shadow = false;
setShadowSize (1, 1);
}
else
{
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
setShadowSize (0,0);
flags.shadow = false;
flags.trans_shadow = false;
setShadowSize (0, 0);
}
return on;
@ -234,10 +219,10 @@ bool FWindow::setAlwaysOnTop (bool on)
if ( isAlwaysOnTop() == on )
return true;
flags.always_on_top = on;
if ( on )
{
flags |= fc::always_on_top;
if ( always_on_top_list )
{
deleteFromAlwaysOnTopList (this);
@ -245,10 +230,7 @@ bool FWindow::setAlwaysOnTop (bool on)
}
}
else
{
flags &= ~fc::always_on_top;
deleteFromAlwaysOnTopList (this);
}
return on;
}
@ -408,7 +390,9 @@ void FWindow::setSize (std::size_t w, std::size_t h, bool adjust)
}
//----------------------------------------------------------------------
void FWindow::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FWindow::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Sets the geometry of the widget
@ -578,10 +562,10 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
if ( window_list->empty() )
return;
if ( (obj1->getFlags() & fc::modal) != 0 )
if ( obj1->getFlags().modal )
return;
if ( (obj2->getFlags() & fc::modal) != 0 )
if ( obj2->getFlags().modal )
return;
iter = window_list->begin();
@ -621,7 +605,7 @@ bool FWindow::raiseWindow (FWidget* obj)
if ( window_list->back() == obj )
return false;
if ( (window_list->back()->getFlags() & fc::modal) != 0
if ( window_list->back()->getFlags().modal
&& ! obj->isMenuWidget() )
return false;
@ -663,7 +647,7 @@ bool FWindow::lowerWindow (FWidget* obj)
if ( window_list->front() == obj )
return false;
if ( (obj->getFlags() & fc::modal) != 0 )
if ( obj->getFlags().modal )
return false;
iter = window_list->begin();
@ -711,13 +695,14 @@ bool FWindow::zoomWindow()
}
//----------------------------------------------------------------------
void FWindow::switchToPrevWindow()
void FWindow::switchToPrevWindow (FWidget* widget_object)
{
// switch to previous window
// Disable terminal updates to avoid flickering
// when redrawing the focused widget
updateTerminal (FVTerm::stop_refresh);
if ( widget_object )
widget_object->updateTerminal (FVTerm::stop_refresh);
bool is_activated = activatePrevWindow();
FWindow* active_window = static_cast<FWindow*>(getActiveWindow());
@ -767,7 +752,8 @@ void FWindow::switchToPrevWindow()
}
// Enable terminal updates again
updateTerminal (FVTerm::continue_refresh);
if ( widget_object )
widget_object->updateTerminal (FVTerm::continue_refresh);
}
//----------------------------------------------------------------------

View File

@ -108,7 +108,7 @@ class FApplication : public FWidget
static void sendQueuedEvents ();
static bool eventInQueue();
static bool removeQueuedEvent (const FObject*);
static FWidget* processParameters (const int&, char*[]);
FWidget* processParameters (const int&, char*[]);
static void showParameterUsage ()
#if defined(__clang__) || defined(__GNUC__)
__attribute__((noreturn))
@ -135,7 +135,7 @@ class FApplication : public FWidget
// Methods
void init (long, long);
static void cmd_options (const int&, char*[]);
void cmd_options (const int&, char*[]);
void findKeyboardWidget();
bool isKeyPressed();
void keyPressed();

View File

@ -69,7 +69,7 @@ class FButton : public FWidget
public:
// Constructors
explicit FButton (FWidget* = 0);
FButton (const FString&, FWidget* = 0);
explicit FButton (const FString&, FWidget* = 0);
// Destructor
virtual ~FButton();
@ -79,13 +79,13 @@ class FButton : public FWidget
FString& getText();
// Mutators
void setForegroundColor (short);
void setBackgroundColor (short);
void setHotkeyForegroundColor (short);
void setFocusForegroundColor (short);
void setFocusBackgroundColor (short);
void setInactiveForegroundColor (short);
void setInactiveBackgroundColor (short);
void setForegroundColor (FColor);
void setBackgroundColor (FColor);
void setHotkeyForegroundColor (FColor);
void setFocusForegroundColor (FColor);
void setFocusBackgroundColor (FColor);
void setInactiveForegroundColor (FColor);
void setInactiveBackgroundColor (FColor);
bool setNoUnderline(bool);
bool setNoUnderline();
bool unsetNoUnderline();
@ -141,7 +141,6 @@ class FButton : public FWidget
// Methods
void init();
void getButtonState();
uChar getHotkey();
void setHotkeyAccelerator();
void detectHotkey();
@ -160,6 +159,7 @@ class FButton : public FWidget
// Data Members
FString text;
bool button_down;
bool active_focus;
bool click_animation;
int click_time;
int space_char;
@ -168,24 +168,13 @@ class FButton : public FWidget
std::size_t center_offset;
std::size_t vcenter_offset;
std::size_t txtlength;
short button_fg;
short button_bg;
short button_hotkey_fg;
short button_focus_fg;
short button_focus_bg;
short button_inactive_fg;
short button_inactive_bg;
struct state
{
uChar focus : 1;
uChar active_focus : 1;
uChar active : 1;
uChar flat : 1;
uChar non_flat_shadow : 1;
uChar no_underline : 1;
uChar : 2; // padding bits
} is;
FColor button_fg;
FColor button_bg;
FColor button_hotkey_fg;
FColor button_focus_fg;
FColor button_focus_bg;
FColor button_inactive_fg;
FColor button_inactive_bg;
};
#pragma pack(pop)
@ -253,7 +242,7 @@ inline bool FButton::setUp()
//----------------------------------------------------------------------
inline bool FButton::setClickAnimation(bool on)
{ return click_animation = on; }
{ return (click_animation = on); }
//----------------------------------------------------------------------
inline bool FButton::setClickAnimation()
@ -265,7 +254,7 @@ inline bool FButton::unsetClickAnimation()
//----------------------------------------------------------------------
inline bool FButton::isFlat() const
{ return ((flags & fc::flat) != 0); }
{ return flags.flat; }
//----------------------------------------------------------------------
inline bool FButton::isDown() const
@ -273,7 +262,7 @@ inline bool FButton::isDown() const
//----------------------------------------------------------------------
inline bool FButton::hasShadow() const
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
//----------------------------------------------------------------------
inline bool FButton::hasClickAnimation()

View File

@ -73,7 +73,7 @@ class FButtonGroup : public FScrollView
public:
// Constructors
explicit FButtonGroup (FWidget* = 0);
FButtonGroup (const FString&, FWidget* = 0);
explicit FButtonGroup (const FString&, FWidget* = 0);
// Destructor
virtual ~FButtonGroup();

View File

@ -27,6 +27,8 @@
#error "Only <final/final.h> can be included directly."
#endif
#include <final/ftypes.h>
// Typecast to c-string
#define C_STR const_cast<char*>
@ -79,24 +81,6 @@ enum events
Timer_Event // timer event occur
};
// Properties of a widget ⚑
enum widget_flags
{
shadow = 0x00000001,
trans_shadow = 0x00000002,
active = 0x00000004,
focus = 0x00000008,
scrollable = 0x00000010,
resizeable = 0x00000020,
modal = 0x00000040,
window_widget = 0x00000080,
dialog_widget = 0x00000100,
menu_widget = 0x00000200,
always_on_top = 0x00000400,
flat = 0x00000800,
no_underline = 0x00001000
};
// Internal character encoding
enum encoding
{
@ -255,420 +239,420 @@ enum SpecialCharacter
// keyboard - single keys
enum keys
{
Fckey_a = 0x0000001, // control-a
Fckey_b = 0x0000002, // control-b
Fckey_c = 0x0000003, // control-c
Fckey_d = 0x0000004, // control-d
Fckey_e = 0x0000005, // control-e
Fckey_f = 0x0000006, // control-f
Fckey_g = 0x0000007, // control-g
Fkey_erase = 0x0000008, // control-h
Fkey_tab = 0x0000009, // control-i
Fckey_j = 0x000000a, // control-j
Fckey_h = 0x000000b, // control-k
Fckey_l = 0x000000c, // control-l
Fkey_return = 0x000000d, // control-m
Fckey_n = 0x000000e, // control-n
Fckey_o = 0x000000f, // control-o
Fckey_p = 0x0000010, // control-p
Fckey_q = 0x0000011, // control-q
Fckey_r = 0x0000012, // control-r
Fckey_s = 0x0000013, // control-s
Fckey_t = 0x0000014, // control-t
Fckey_u = 0x0000015, // control-u
Fckey_v = 0x0000016, // control-v
Fckey_w = 0x0000017, // control-w
Fckey_x = 0x0000018, // control-x
Fckey_y = 0x0000019, // control-y
Fckey_z = 0x000001a, // control-t
Fkey_escape = 0x000001b, // control-[
Fckey_backslash = 0x000001c, // control-'\'
Fckey_right_square_bracket = 0x000001d, // control-]
Fckey_caret = 0x000001e, // control-^
Fckey_underscore = 0x000001f, // control-_
Fkey_space = 0x0000020, // space
Fkey_exclamation_mark = 0x0000021, // !
Fkey_quotation_mark = 0x0000022, // "
Fkey_number_sign = 0x0000023, // #
Fkey_dollar_sign = 0x0000024, // $
Fkey_percent_sign = 0x0000025, // %
Fkey_ampersand = 0x0000026, // &
Fkey_apostrophe = 0x0000027, // '
Fkey_left_parentheses = 0x0000028, // (
Fkey_right_parentheses = 0x0000029, // )
Fkey_asterisk = 0x000002a, // *
Fkey_plus_sign = 0x000002b, // +
Fkey_comma = 0x000002c, // ,
Fkey_minus_sign = 0x000002d, // -
Fkey_full_stop = 0x000002e, // .
Fkey_slash = 0x000002f, // /
Fckey_space = 0x1000020, // control-space
Fkey_backspace = 0x1000100,
Fkey_catab = 0x1000101,
Fkey_clear = 0x1000102,
Fkey_ctab = 0x1000103,
Fkey_dc = 0x1000104,
Fkey_dl = 0x1000105,
Fkey_down = 0x1000106,
Fkey_eic = 0x1000107,
Fkey_eol = 0x1000108,
Fkey_eos = 0x1000109,
Fkey_f0 = 0x100010a,
Fkey_f1 = 0x100010b,
Fkey_f2 = 0x100010c,
Fkey_f3 = 0x100010d,
Fkey_f4 = 0x100010e,
Fkey_f5 = 0x100010f,
Fkey_f6 = 0x1000110,
Fkey_f7 = 0x1000111,
Fkey_f8 = 0x1000112,
Fkey_f9 = 0x1000113,
Fkey_f10 = 0x1000114,
Fkey_home = 0x1000115,
Fkey_ic = 0x1000116, // insert key
Fkey_il = 0x1000117,
Fkey_left = 0x1000118,
Fkey_ll = 0x1000119,
Fkey_npage = 0x100011a,
Fkey_ppage = 0x100011b,
Fkey_right = 0x100011c,
Fkey_sf = 0x100011d,
Fkey_sr = 0x100011e,
Fkey_stab = 0x100011f,
Fkey_up = 0x1000120,
Fkey_a1 = 0x1000121,
Fkey_a3 = 0x1000122,
Fkey_b2 = 0x1000123,
Fkey_c1 = 0x1000124,
Fkey_c3 = 0x1000125,
Fkey_btab = 0x1000126,
Fkey_beg = 0x1000127,
Fkey_cancel = 0x1000128,
Fkey_close = 0x1000129,
Fkey_command = 0x100012a,
Fkey_copy = 0x100012b,
Fkey_create = 0x100012c,
Fkey_end = 0x100012d,
Fkey_enter = 0x100012e,
Fkey_exit = 0x100012f,
Fkey_find = 0x1000130,
Fkey_help = 0x1000131,
Fkey_mark = 0x1000132,
Fkey_message = 0x1000133,
Fkey_move = 0x1000134,
Fkey_next = 0x1000135,
Fkey_open = 0x1000136,
Fkey_options = 0x1000137,
Fkey_previous = 0x1000138,
Fkey_print = 0x1000139,
Fkey_redo = 0x100013a,
Fkey_reference = 0x100013b,
Fkey_refresh = 0x100013c,
Fkey_replace = 0x100013d,
Fkey_restart = 0x100013e,
Fkey_resume = 0x100013f,
Fkey_save = 0x1000140,
Fkey_suspend = 0x1000141,
Fkey_undo = 0x1000142,
Fkey_sbeg = 0x1000143,
Fkey_scancel = 0x1000144,
Fkey_scommand = 0x1000145,
Fkey_scopy = 0x1000146,
Fkey_screate = 0x1000147,
Fkey_sdc = 0x1000148,
Fkey_sdl = 0x1000149,
Fkey_select = 0x100014a,
Fkey_send = 0x100014b,
Fkey_seol = 0x100014c,
Fkey_sexit = 0x100014d,
Fkey_sfind = 0x100014e,
Fkey_shelp = 0x100014f,
Fkey_shome = 0x1000150,
Fkey_sic = 0x1000151,
Fkey_sleft = 0x1000152,
Fkey_smessage = 0x1000153,
Fkey_smove = 0x1000154,
Fkey_snext = 0x1000155,
Fkey_soptions = 0x1000156,
Fkey_sprevious = 0x1000157,
Fkey_sprint = 0x1000158,
Fkey_sredo = 0x1000159,
Fkey_sreplace = 0x100015a,
Fkey_sright = 0x100015b,
Fkey_srsume = 0x100015c,
Fkey_ssave = 0x100015d,
Fkey_ssuspend = 0x100015e,
Fkey_sundo = 0x100015f,
Fkey_f11 = 0x1000160,
Fkey_f12 = 0x1000161,
Fkey_f13 = 0x1000162,
Fkey_f14 = 0x1000163,
Fkey_f15 = 0x1000164,
Fkey_f16 = 0x1000165,
Fkey_f17 = 0x1000166,
Fkey_f18 = 0x1000167,
Fkey_f19 = 0x1000168,
Fkey_f20 = 0x1000169,
Fkey_f21 = 0x100016a,
Fkey_f22 = 0x100016b,
Fkey_f23 = 0x100016c,
Fkey_f24 = 0x100016d,
Fkey_f25 = 0x100016e,
Fkey_f26 = 0x100016f,
Fkey_f27 = 0x1000170,
Fkey_f28 = 0x1000171,
Fkey_f29 = 0x1000172,
Fkey_f30 = 0x1000173,
Fkey_f31 = 0x1000174,
Fkey_f32 = 0x1000175,
Fkey_f33 = 0x1000176,
Fkey_f34 = 0x1000177,
Fkey_f35 = 0x1000178,
Fkey_f36 = 0x1000179,
Fkey_f37 = 0x100017a,
Fkey_f38 = 0x100017b,
Fkey_f39 = 0x100017c,
Fkey_f40 = 0x100017d,
Fkey_f41 = 0x100017e,
Fkey_f42 = 0x100017f,
Fkey_f43 = 0x1000180,
Fkey_f44 = 0x1000181,
Fkey_f45 = 0x1000182,
Fkey_f46 = 0x1000183,
Fkey_f47 = 0x1000184,
Fkey_f48 = 0x1000185,
Fkey_f49 = 0x1000186,
Fkey_f50 = 0x1000187,
Fkey_f51 = 0x1000188,
Fkey_f52 = 0x1000189,
Fkey_f53 = 0x100018a,
Fkey_f54 = 0x100018b,
Fkey_f55 = 0x100018c,
Fkey_f56 = 0x100018d,
Fkey_f57 = 0x100018e,
Fkey_f58 = 0x100018f,
Fkey_f59 = 0x1000190,
Fkey_f60 = 0x1000191,
Fkey_f61 = 0x1000192,
Fkey_f62 = 0x1000193,
Fkey_f63 = 0x1000194
Fckey_a = 0x00000001, // control-a
Fckey_b = 0x00000002, // control-b
Fckey_c = 0x00000003, // control-c
Fckey_d = 0x00000004, // control-d
Fckey_e = 0x00000005, // control-e
Fckey_f = 0x00000006, // control-f
Fckey_g = 0x00000007, // control-g
Fkey_erase = 0x00000008, // control-h
Fkey_tab = 0x00000009, // control-i
Fckey_j = 0x0000000a, // control-j
Fckey_h = 0x0000000b, // control-k
Fckey_l = 0x0000000c, // control-l
Fkey_return = 0x0000000d, // control-m
Fckey_n = 0x0000000e, // control-n
Fckey_o = 0x0000000f, // control-o
Fckey_p = 0x00000010, // control-p
Fckey_q = 0x00000011, // control-q
Fckey_r = 0x00000012, // control-r
Fckey_s = 0x00000013, // control-s
Fckey_t = 0x00000014, // control-t
Fckey_u = 0x00000015, // control-u
Fckey_v = 0x00000016, // control-v
Fckey_w = 0x00000017, // control-w
Fckey_x = 0x00000018, // control-x
Fckey_y = 0x00000019, // control-y
Fckey_z = 0x0000001a, // control-t
Fkey_escape = 0x0000001b, // control-[
Fckey_backslash = 0x0000001c, // control-'\'
Fckey_right_square_bracket = 0x0000001d, // control-]
Fckey_caret = 0x0000001e, // control-^
Fckey_underscore = 0x0000001f, // control-_
Fkey_space = 0x00000020, // space
Fkey_exclamation_mark = 0x00000021, // !
Fkey_quotation_mark = 0x00000022, // "
Fkey_number_sign = 0x00000023, // #
Fkey_dollar_sign = 0x00000024, // $
Fkey_percent_sign = 0x00000025, // %
Fkey_ampersand = 0x00000026, // &
Fkey_apostrophe = 0x00000027, // '
Fkey_left_parentheses = 0x00000028, // (
Fkey_right_parentheses = 0x00000029, // )
Fkey_asterisk = 0x0000002a, // *
Fkey_plus_sign = 0x0000002b, // +
Fkey_comma = 0x0000002c, // ,
Fkey_minus_sign = 0x0000002d, // -
Fkey_full_stop = 0x0000002e, // .
Fkey_slash = 0x0000002f, // /
Fckey_space = 0x01000020, // control-space
Fkey_backspace = 0x01000100,
Fkey_catab = 0x01000101,
Fkey_clear = 0x01000102,
Fkey_ctab = 0x01000103,
Fkey_dc = 0x01000104,
Fkey_dl = 0x01000105,
Fkey_down = 0x01000106,
Fkey_eic = 0x01000107,
Fkey_eol = 0x01000108,
Fkey_eos = 0x01000109,
Fkey_f0 = 0x0100010a,
Fkey_f1 = 0x0100010b,
Fkey_f2 = 0x0100010c,
Fkey_f3 = 0x0100010d,
Fkey_f4 = 0x0100010e,
Fkey_f5 = 0x0100010f,
Fkey_f6 = 0x01000110,
Fkey_f7 = 0x01000111,
Fkey_f8 = 0x01000112,
Fkey_f9 = 0x01000113,
Fkey_f10 = 0x01000114,
Fkey_home = 0x01000115,
Fkey_ic = 0x01000116, // insert key
Fkey_il = 0x01000117,
Fkey_left = 0x01000118,
Fkey_ll = 0x01000119,
Fkey_npage = 0x0100011a,
Fkey_ppage = 0x0100011b,
Fkey_right = 0x0100011c,
Fkey_sf = 0x0100011d,
Fkey_sr = 0x0100011e,
Fkey_stab = 0x0100011f,
Fkey_up = 0x01000120,
Fkey_a1 = 0x01000121,
Fkey_a3 = 0x01000122,
Fkey_b2 = 0x01000123,
Fkey_c1 = 0x01000124,
Fkey_c3 = 0x01000125,
Fkey_btab = 0x01000126,
Fkey_beg = 0x01000127,
Fkey_cancel = 0x01000128,
Fkey_close = 0x01000129,
Fkey_command = 0x0100012a,
Fkey_copy = 0x0100012b,
Fkey_create = 0x0100012c,
Fkey_end = 0x0100012d,
Fkey_enter = 0x0100012e,
Fkey_exit = 0x0100012f,
Fkey_find = 0x01000130,
Fkey_help = 0x01000131,
Fkey_mark = 0x01000132,
Fkey_message = 0x01000133,
Fkey_move = 0x01000134,
Fkey_next = 0x01000135,
Fkey_open = 0x01000136,
Fkey_options = 0x01000137,
Fkey_previous = 0x01000138,
Fkey_print = 0x01000139,
Fkey_redo = 0x0100013a,
Fkey_reference = 0x0100013b,
Fkey_refresh = 0x0100013c,
Fkey_replace = 0x0100013d,
Fkey_restart = 0x0100013e,
Fkey_resume = 0x0100013f,
Fkey_save = 0x01000140,
Fkey_suspend = 0x01000141,
Fkey_undo = 0x01000142,
Fkey_sbeg = 0x01000143,
Fkey_scancel = 0x01000144,
Fkey_scommand = 0x01000145,
Fkey_scopy = 0x01000146,
Fkey_screate = 0x01000147,
Fkey_sdc = 0x01000148,
Fkey_sdl = 0x01000149,
Fkey_select = 0x0100014a,
Fkey_send = 0x0100014b,
Fkey_seol = 0x0100014c,
Fkey_sexit = 0x0100014d,
Fkey_sfind = 0x0100014e,
Fkey_shelp = 0x0100014f,
Fkey_shome = 0x01000150,
Fkey_sic = 0x01000151,
Fkey_sleft = 0x01000152,
Fkey_smessage = 0x01000153,
Fkey_smove = 0x01000154,
Fkey_snext = 0x01000155,
Fkey_soptions = 0x01000156,
Fkey_sprevious = 0x01000157,
Fkey_sprint = 0x01000158,
Fkey_sredo = 0x01000159,
Fkey_sreplace = 0x0100015a,
Fkey_sright = 0x0100015b,
Fkey_srsume = 0x0100015c,
Fkey_ssave = 0x0100015d,
Fkey_ssuspend = 0x0100015e,
Fkey_sundo = 0x0100015f,
Fkey_f11 = 0x01000160,
Fkey_f12 = 0x01000161,
Fkey_f13 = 0x01000162,
Fkey_f14 = 0x01000163,
Fkey_f15 = 0x01000164,
Fkey_f16 = 0x01000165,
Fkey_f17 = 0x01000166,
Fkey_f18 = 0x01000167,
Fkey_f19 = 0x01000168,
Fkey_f20 = 0x01000169,
Fkey_f21 = 0x0100016a,
Fkey_f22 = 0x0100016b,
Fkey_f23 = 0x0100016c,
Fkey_f24 = 0x0100016d,
Fkey_f25 = 0x0100016e,
Fkey_f26 = 0x0100016f,
Fkey_f27 = 0x01000170,
Fkey_f28 = 0x01000171,
Fkey_f29 = 0x01000172,
Fkey_f30 = 0x01000173,
Fkey_f31 = 0x01000174,
Fkey_f32 = 0x01000175,
Fkey_f33 = 0x01000176,
Fkey_f34 = 0x01000177,
Fkey_f35 = 0x01000178,
Fkey_f36 = 0x01000179,
Fkey_f37 = 0x0100017a,
Fkey_f38 = 0x0100017b,
Fkey_f39 = 0x0100017c,
Fkey_f40 = 0x0100017d,
Fkey_f41 = 0x0100017e,
Fkey_f42 = 0x0100017f,
Fkey_f43 = 0x01000180,
Fkey_f44 = 0x01000181,
Fkey_f45 = 0x01000182,
Fkey_f46 = 0x01000183,
Fkey_f47 = 0x01000184,
Fkey_f48 = 0x01000185,
Fkey_f49 = 0x01000186,
Fkey_f50 = 0x01000187,
Fkey_f51 = 0x01000188,
Fkey_f52 = 0x01000189,
Fkey_f53 = 0x0100018a,
Fkey_f54 = 0x0100018b,
Fkey_f55 = 0x0100018c,
Fkey_f56 = 0x0100018d,
Fkey_f57 = 0x0100018e,
Fkey_f58 = 0x0100018f,
Fkey_f59 = 0x01000190,
Fkey_f60 = 0x01000191,
Fkey_f61 = 0x01000192,
Fkey_f62 = 0x01000193,
Fkey_f63 = 0x01000194,
need_more_data = 0x80000000
};
// Keyboard - modifier key combinations
enum metakeys
{
Fmkey_ic = 0x1500100, // M-insert
Fmkey_dc = 0x1500101, // M-delete
Fmkey_home = 0x1500102, // M-home
Fmkey_end = 0x1500103, // M-end
Fmkey_ppage = 0x1500104, // M-prev-page
Fmkey_npage = 0x1500105, // M-next-page
Fmkey_f1 = 0x1500106, // M-f1
Fmkey_f2 = 0x1500107, // M-f2
Fmkey_f3 = 0x1500108, // M-f3
Fmkey_f4 = 0x1500109, // M-f4
Fmkey_f5 = 0x150010a, // M-f5
Fmkey_f6 = 0x150010b, // M-F6
Fmkey_f7 = 0x150010c, // M-f7
Fmkey_f8 = 0x150010d, // M-f8
Fmkey_f9 = 0x150010e, // M-f9
Fmkey_f10 = 0x150010f, // M-f10
Fmkey_f11 = 0x1500110, // M-f11
Fmkey_f12 = 0x1500111, // M-f12
Fmkey_up = 0x1500112, // M-up
Fmkey_down = 0x1500113, // M-down
Fmkey_right = 0x1500114, // M-right
Fmkey_left = 0x1500115, // M-left
Fmkey_sic = 0x1500116, // shifted M-Insert
Fmkey_sdc = 0x1500117, // shifted M-Delete
Fmkey_shome = 0x1500118, // shifted M-Home
Fmkey_send = 0x1500119, // shifted M-End
Fmkey_sppage = 0x150011a, // shifted M-Page_Up
Fmkey_snpage = 0x150011b, // shifted M-Page_Down
Fmkey_sf1 = 0x150011c, // shifted M-F1
Fmkey_sf2 = 0x150011d, // shifted M-F2
Fmkey_sf3 = 0x150011e, // shifted M-F3
Fmkey_sf4 = 0x150011f, // shifted M-F4
Fmkey_sf5 = 0x1500120, // shifted M-F5
Fmkey_sf6 = 0x1500121, // shifted M-F6
Fmkey_sf7 = 0x1500122, // shifted M-F7
Fmkey_sf8 = 0x1500123, // shifted M-F8
Fmkey_sf9 = 0x1500124, // shifted M-F9
Fmkey_sf10 = 0x1500125, // shifted M-F10
Fmkey_sf11 = 0x1500126, // shifted M-F11
Fmkey_sf12 = 0x1500127, // shifted M-F12
Fmkey_sup = 0x1500128, // shifted M-Up
Fmkey_sdown = 0x1500129, // shifted M-Down
Fmkey_sright = 0x150012a, // shifted M-Right
Fmkey_sleft = 0x150012b, // shifted M-Left
Fckey_ic = 0x150012c, // control-Insert
Fckey_dc = 0x150012d, // control-Delete
Fckey_home = 0x150012e, // control-Home
Fckey_end = 0x150012f, // control-End
Fckey_ppage = 0x1500130, // control-Page_Up
Fckey_npage = 0x1500131, // control-Page_Down
Fckey_up = 0x1500132, // control-Up
Fckey_down = 0x1500133, // control-Down
Fckey_right = 0x1500134, // control-Right
Fckey_left = 0x1500135, // control-Left
Fckey_sic = 0x1500136, // shifted control-M-Insert
Fckey_sdc = 0x1500137, // shifted control-M-Delete
Fckey_shome = 0x1500138, // shifted control-M-Home
Fckey_send = 0x1500139, // shifted control-M-End
Fckey_sppage = 0x150013a, // shifted control-M-Page_Up
Fckey_snpage = 0x150013b, // shifted control-M-Page_Down
Fckey_sup = 0x150013c, // shifted control-M-Up
Fckey_sdown = 0x150013d, // shifted control-M-Down
Fckey_sright = 0x150013e, // shifted control-M-Right
Fckey_sleft = 0x150013f, // shifted control-M-Left
Fcmkey_ic = 0x1500140, // control-M-Insert
Fcmkey_dc = 0x1500141, // control-M-Delete
Fcmkey_home = 0x1500142, // control-M-Home
Fcmkey_end = 0x1500143, // control-M-End
Fcmkey_ppage = 0x1500144, // control-M-Page_Up
Fcmkey_npage = 0x1500145, // control-M-Page_Down
Fcmkey_up = 0x1500146, // control-M-Up
Fcmkey_down = 0x1500147, // control-M-Down
Fcmkey_right = 0x1500148, // control-M-Right
Fcmkey_left = 0x1500149, // control-M-Left
Fcmkey_sic = 0x150014a, // shifted control-M-Insert
Fcmkey_sdc = 0x150014b, // shifted control-M-Delete
Fcmkey_shome = 0x150014c, // shifted control-M-Home
Fcmkey_send = 0x150014d, // shifted control-M-End
Fcmkey_sppage = 0x150014e, // shifted control-M-Page_Up
Fcmkey_snpage = 0x150014f, // shifted control-M-Page_Down
Fcmkey_sf1 = 0x1500150, // shifted control-M-F1
Fcmkey_sf2 = 0x1500151, // shifted control-M-F2
Fcmkey_sf3 = 0x1500152, // shifted control-M-F3
Fcmkey_sf4 = 0x1500153, // shifted control-M-F4
Fcmkey_sf5 = 0x1500154, // shifted control-M-F5
Fcmkey_sf6 = 0x1500155, // shifted control-M-F6
Fcmkey_sf7 = 0x1500156, // shifted control-M-F7
Fcmkey_sf8 = 0x1500157, // shifted control-M-F8
Fcmkey_sf9 = 0x1500158, // shifted control-M-F9
Fcmkey_sf10 = 0x1500159, // shifted control-M-F10
Fcmkey_sf11 = 0x150015a, // shifted control-M-F11
Fcmkey_sf12 = 0x150015b, // shifted control-M-F12
Fcmkey_sup = 0x150015c, // shifted control-M-Up
Fcmkey_sdown = 0x150015d, // shifted control-M-Down
Fcmkey_sright = 0x150015e, // shifted control-M-Right
Fcmkey_sleft = 0x150015f, // shifted control-M-Left
Fkey_menu = 0x1600000, // menu
Fkey_smenu = 0x1600001, // shifted menu
Fckey_menu = 0x1600002, // control-menu
Fckey_smenu = 0x1600003, // shifted control-menu
Fmkey_menu = 0x1600004, // M-menu
Fmkey_smenu = 0x1600005, // shifted M-menu
Fcmkey_menu = 0x1600006, // control-M-menu
Fcmkey_smenu = 0x1600007, // shifted control-M-menu
Fkey_escape_mintty = 0x200001b, // mintty Esc
Fkey_mouse = 0x2000020, // xterm mouse
Fkey_extended_mouse = 0x2000021, // SGR extended mouse
Fkey_urxvt_mouse = 0x2000022, // urxvt mouse extension
Fmkey_meta = 0x20000e0, // meta key offset
Fmkey_tab = 0x20000e9, // M-tab
Fmkey_enter = 0x20000ea, // M-enter
Fmkey_space = 0x2000100, // M-' '
Fmkey_bang = 0x2000101, // M-!
Fmkey_quotes = 0x2000102, // M-"
Fmkey_hash = 0x2000103, // M-#
Fmkey_dollar = 0x2000104, // M-$
Fmkey_percent = 0x2000105, // M-%
Fmkey_ampersand = 0x2000106, // M-&
Fmkey_apostrophe = 0x2000107, // M-'
Fmkey_left_parenthesis = 0x2000108, // M-(
Fmkey_right_parenthesis = 0x2000109, // M-)
Fmkey_asterisk = 0x200010a, // M-*
Fmkey_plus = 0x200010b, // M-+
Fmkey_comma = 0x200010c, // M-,
Fmkey_minus = 0x200010d, // M-'-'
Fmkey_full_stop = 0x200010e, // M-.
Fmkey_slash = 0x200010f, // M-/
Fmkey_0 = 0x2000110, // M-0
Fmkey_1 = 0x2000111, // M-1
Fmkey_2 = 0x2000112, // M-2
Fmkey_3 = 0x2000113, // M-3
Fmkey_4 = 0x2000114, // M-4
Fmkey_5 = 0x2000115, // M-5
Fmkey_6 = 0x2000116, // M-6
Fmkey_7 = 0x2000117, // M-7
Fmkey_8 = 0x2000118, // M-8
Fmkey_9 = 0x2000119, // M-9
Fmkey_colon = 0x200011a, // M-:
Fmkey_semicolon = 0x200011b, // M-;
Fmkey_less_than = 0x200011c, // M-<
Fmkey_equals = 0x200011d, // M-=
Fmkey_greater_than = 0x200011e, // M->
Fmkey_question_mark = 0x200011f, // M-?
Fmkey_at = 0x2000120, // M-@
Fmkey_A = 0x2000121, // M-A
Fmkey_B = 0x2000122, // M-B
Fmkey_C = 0x2000123, // M-C
Fmkey_D = 0x2000124, // M-D
Fmkey_E = 0x2000125, // M-E
Fmkey_F = 0x2000126, // M-F
Fmkey_G = 0x2000127, // M-G
Fmkey_H = 0x2000128, // M-H
Fmkey_I = 0x2000129, // M-I
Fmkey_J = 0x200012a, // M-J
Fmkey_K = 0x200012b, // M-K
Fmkey_L = 0x200012c, // M-L
Fmkey_M = 0x200012d, // M-M
Fmkey_N = 0x200012e, // M-N
Fmkey_O = 0x200012f, // M-O
Fmkey_P = 0x2000130, // M-P
Fmkey_Q = 0x2000131, // M-Q
Fmkey_R = 0x2000132, // M-R
Fmkey_S = 0x2000133, // M-S
Fmkey_T = 0x2000134, // M-T
Fmkey_U = 0x2000135, // M-U
Fmkey_V = 0x2000136, // M-V
Fmkey_W = 0x2000137, // M-W
Fmkey_X = 0x2000138, // M-X
Fmkey_Y = 0x2000139, // M-Y
Fmkey_Z = 0x200013a, // M-Z
Fmkey_left_square_bracket = 0x200013b, // M-[
Fmkey_backslash = 0x200013c, // M-'\'
Fmkey_right_square_bracket = 0x200013d, // M-]
Fmkey_caret = 0x200013e, // M-^
Fmkey_underscore = 0x200013f, // M-_
Fmkey_grave_accent = 0x2000140, // M-`
Fmkey_a = 0x2000141, // M-a
Fmkey_b = 0x2000142, // M-b
Fmkey_c = 0x2000143, // M-c
Fmkey_d = 0x2000144, // M-d
Fmkey_e = 0x2000145, // M-e
Fmkey_f = 0x2000146, // M-f
Fmkey_g = 0x2000147, // M-g
Fmkey_h = 0x2000148, // M-h
Fmkey_i = 0x2000149, // M-i
Fmkey_j = 0x200014a, // M-j
Fmkey_k = 0x200014b, // M-k
Fmkey_l = 0x200014c, // M-l
Fmkey_m = 0x200014d, // M-m
Fmkey_n = 0x200014e, // M-n
Fmkey_o = 0x200014f, // M-o
Fmkey_p = 0x2000150, // M-p
Fmkey_q = 0x2000151, // M-q
Fmkey_r = 0x2000152, // M-r
Fmkey_s = 0x2000153, // M-s
Fmkey_t = 0x2000154, // M-t
Fmkey_u = 0x2000155, // M-u
Fmkey_v = 0x2000156, // M-v
Fmkey_w = 0x2000157, // M-w
Fmkey_x = 0x2000158, // M-x
Fmkey_y = 0x2000159, // M-y
Fmkey_z = 0x200015a, // M-z
Fmkey_left_curly_bracket = 0x200015b, // M-{
Fmkey_vertical_bar = 0x200015c, // M-|
Fmkey_right_curly_bracket = 0x200015d, // M-}
Fmkey_tilde = 0x200015e // M-~
Fmkey_ic = 0x01500100, // M-insert
Fmkey_dc = 0x01500101, // M-delete
Fmkey_home = 0x01500102, // M-home
Fmkey_end = 0x01500103, // M-end
Fmkey_ppage = 0x01500104, // M-prev-page
Fmkey_npage = 0x01500105, // M-next-page
Fmkey_f1 = 0x01500106, // M-f1
Fmkey_f2 = 0x01500107, // M-f2
Fmkey_f3 = 0x01500108, // M-f3
Fmkey_f4 = 0x01500109, // M-f4
Fmkey_f5 = 0x0150010a, // M-f5
Fmkey_f6 = 0x0150010b, // M-F6
Fmkey_f7 = 0x0150010c, // M-f7
Fmkey_f8 = 0x0150010d, // M-f8
Fmkey_f9 = 0x0150010e, // M-f9
Fmkey_f10 = 0x0150010f, // M-f10
Fmkey_f11 = 0x01500110, // M-f11
Fmkey_f12 = 0x01500111, // M-f12
Fmkey_up = 0x01500112, // M-up
Fmkey_down = 0x01500113, // M-down
Fmkey_right = 0x01500114, // M-right
Fmkey_left = 0x01500115, // M-left
Fmkey_sic = 0x01500116, // shifted M-Insert
Fmkey_sdc = 0x01500117, // shifted M-Delete
Fmkey_shome = 0x01500118, // shifted M-Home
Fmkey_send = 0x01500119, // shifted M-End
Fmkey_sppage = 0x0150011a, // shifted M-Page_Up
Fmkey_snpage = 0x0150011b, // shifted M-Page_Down
Fmkey_sf1 = 0x0150011c, // shifted M-F1
Fmkey_sf2 = 0x0150011d, // shifted M-F2
Fmkey_sf3 = 0x0150011e, // shifted M-F3
Fmkey_sf4 = 0x0150011f, // shifted M-F4
Fmkey_sf5 = 0x01500120, // shifted M-F5
Fmkey_sf6 = 0x01500121, // shifted M-F6
Fmkey_sf7 = 0x01500122, // shifted M-F7
Fmkey_sf8 = 0x01500123, // shifted M-F8
Fmkey_sf9 = 0x01500124, // shifted M-F9
Fmkey_sf10 = 0x01500125, // shifted M-F10
Fmkey_sf11 = 0x01500126, // shifted M-F11
Fmkey_sf12 = 0x01500127, // shifted M-F12
Fmkey_sup = 0x01500128, // shifted M-Up
Fmkey_sdown = 0x01500129, // shifted M-Down
Fmkey_sright = 0x0150012a, // shifted M-Right
Fmkey_sleft = 0x0150012b, // shifted M-Left
Fckey_ic = 0x0150012c, // control-Insert
Fckey_dc = 0x0150012d, // control-Delete
Fckey_home = 0x0150012e, // control-Home
Fckey_end = 0x0150012f, // control-End
Fckey_ppage = 0x01500130, // control-Page_Up
Fckey_npage = 0x01500131, // control-Page_Down
Fckey_up = 0x01500132, // control-Up
Fckey_down = 0x01500133, // control-Down
Fckey_right = 0x01500134, // control-Right
Fckey_left = 0x01500135, // control-Left
Fckey_sic = 0x01500136, // shifted control-M-Insert
Fckey_sdc = 0x01500137, // shifted control-M-Delete
Fckey_shome = 0x01500138, // shifted control-M-Home
Fckey_send = 0x01500139, // shifted control-M-End
Fckey_sppage = 0x0150013a, // shifted control-M-Page_Up
Fckey_snpage = 0x0150013b, // shifted control-M-Page_Down
Fckey_sup = 0x0150013c, // shifted control-M-Up
Fckey_sdown = 0x0150013d, // shifted control-M-Down
Fckey_sright = 0x0150013e, // shifted control-M-Right
Fckey_sleft = 0x0150013f, // shifted control-M-Left
Fcmkey_ic = 0x01500140, // control-M-Insert
Fcmkey_dc = 0x01500141, // control-M-Delete
Fcmkey_home = 0x01500142, // control-M-Home
Fcmkey_end = 0x01500143, // control-M-End
Fcmkey_ppage = 0x01500144, // control-M-Page_Up
Fcmkey_npage = 0x01500145, // control-M-Page_Down
Fcmkey_up = 0x01500146, // control-M-Up
Fcmkey_down = 0x01500147, // control-M-Down
Fcmkey_right = 0x01500148, // control-M-Right
Fcmkey_left = 0x01500149, // control-M-Left
Fcmkey_sic = 0x0150014a, // shifted control-M-Insert
Fcmkey_sdc = 0x0150014b, // shifted control-M-Delete
Fcmkey_shome = 0x0150014c, // shifted control-M-Home
Fcmkey_send = 0x0150014d, // shifted control-M-End
Fcmkey_sppage = 0x0150014e, // shifted control-M-Page_Up
Fcmkey_snpage = 0x0150014f, // shifted control-M-Page_Down
Fcmkey_sf1 = 0x01500150, // shifted control-M-F1
Fcmkey_sf2 = 0x01500151, // shifted control-M-F2
Fcmkey_sf3 = 0x01500152, // shifted control-M-F3
Fcmkey_sf4 = 0x01500153, // shifted control-M-F4
Fcmkey_sf5 = 0x01500154, // shifted control-M-F5
Fcmkey_sf6 = 0x01500155, // shifted control-M-F6
Fcmkey_sf7 = 0x01500156, // shifted control-M-F7
Fcmkey_sf8 = 0x01500157, // shifted control-M-F8
Fcmkey_sf9 = 0x01500158, // shifted control-M-F9
Fcmkey_sf10 = 0x01500159, // shifted control-M-F10
Fcmkey_sf11 = 0x0150015a, // shifted control-M-F11
Fcmkey_sf12 = 0x0150015b, // shifted control-M-F12
Fcmkey_sup = 0x0150015c, // shifted control-M-Up
Fcmkey_sdown = 0x0150015d, // shifted control-M-Down
Fcmkey_sright = 0x0150015e, // shifted control-M-Right
Fcmkey_sleft = 0x0150015f, // shifted control-M-Left
Fkey_menu = 0x01600000, // menu
Fkey_smenu = 0x01600001, // shifted menu
Fckey_menu = 0x01600002, // control-menu
Fckey_smenu = 0x01600003, // shifted control-menu
Fmkey_menu = 0x01600004, // M-menu
Fmkey_smenu = 0x01600005, // shifted M-menu
Fcmkey_menu = 0x01600006, // control-M-menu
Fcmkey_smenu = 0x01600007, // shifted control-M-menu
Fkey_escape_mintty = 0x0200001b, // mintty Esc
Fkey_mouse = 0x02000020, // xterm mouse
Fkey_extended_mouse = 0x02000021, // SGR extended mouse
Fkey_urxvt_mouse = 0x02000022, // urxvt mouse extension
Fmkey_meta = 0x020000e0, // meta key offset
Fmkey_tab = 0x020000e9, // M-tab
Fmkey_enter = 0x020000ea, // M-enter
Fmkey_space = 0x02000100, // M-' '
Fmkey_bang = 0x02000101, // M-!
Fmkey_quotes = 0x02000102, // M-"
Fmkey_hash = 0x02000103, // M-#
Fmkey_dollar = 0x02000104, // M-$
Fmkey_percent = 0x02000105, // M-%
Fmkey_ampersand = 0x02000106, // M-&
Fmkey_apostrophe = 0x02000107, // M-'
Fmkey_left_parenthesis = 0x02000108, // M-(
Fmkey_right_parenthesis = 0x02000109, // M-)
Fmkey_asterisk = 0x0200010a, // M-*
Fmkey_plus = 0x0200010b, // M-+
Fmkey_comma = 0x0200010c, // M-,
Fmkey_minus = 0x0200010d, // M-'-'
Fmkey_full_stop = 0x0200010e, // M-.
Fmkey_slash = 0x0200010f, // M-/
Fmkey_0 = 0x02000110, // M-0
Fmkey_1 = 0x02000111, // M-1
Fmkey_2 = 0x02000112, // M-2
Fmkey_3 = 0x02000113, // M-3
Fmkey_4 = 0x02000114, // M-4
Fmkey_5 = 0x02000115, // M-5
Fmkey_6 = 0x02000116, // M-6
Fmkey_7 = 0x02000117, // M-7
Fmkey_8 = 0x02000118, // M-8
Fmkey_9 = 0x02000119, // M-9
Fmkey_colon = 0x0200011a, // M-:
Fmkey_semicolon = 0x0200011b, // M-;
Fmkey_less_than = 0x0200011c, // M-<
Fmkey_equals = 0x0200011d, // M-=
Fmkey_greater_than = 0x0200011e, // M->
Fmkey_question_mark = 0x0200011f, // M-?
Fmkey_at = 0x02000120, // M-@
Fmkey_A = 0x02000121, // M-A
Fmkey_B = 0x02000122, // M-B
Fmkey_C = 0x02000123, // M-C
Fmkey_D = 0x02000124, // M-D
Fmkey_E = 0x02000125, // M-E
Fmkey_F = 0x02000126, // M-F
Fmkey_G = 0x02000127, // M-G
Fmkey_H = 0x02000128, // M-H
Fmkey_I = 0x02000129, // M-I
Fmkey_J = 0x0200012a, // M-J
Fmkey_K = 0x0200012b, // M-K
Fmkey_L = 0x0200012c, // M-L
Fmkey_M = 0x0200012d, // M-M
Fmkey_N = 0x0200012e, // M-N
Fmkey_O = 0x0200012f, // M-O
Fmkey_P = 0x02000130, // M-P
Fmkey_Q = 0x02000131, // M-Q
Fmkey_R = 0x02000132, // M-R
Fmkey_S = 0x02000133, // M-S
Fmkey_T = 0x02000134, // M-T
Fmkey_U = 0x02000135, // M-U
Fmkey_V = 0x02000136, // M-V
Fmkey_W = 0x02000137, // M-W
Fmkey_X = 0x02000138, // M-X
Fmkey_Y = 0x02000139, // M-Y
Fmkey_Z = 0x0200013a, // M-Z
Fmkey_left_square_bracket = 0x0200013b, // M-[
Fmkey_backslash = 0x0200013c, // M-'\'
Fmkey_right_square_bracket = 0x0200013d, // M-]
Fmkey_caret = 0x0200013e, // M-^
Fmkey_underscore = 0x0200013f, // M-_
Fmkey_grave_accent = 0x02000140, // M-`
Fmkey_a = 0x02000141, // M-a
Fmkey_b = 0x02000142, // M-b
Fmkey_c = 0x02000143, // M-c
Fmkey_d = 0x02000144, // M-d
Fmkey_e = 0x02000145, // M-e
Fmkey_f = 0x02000146, // M-f
Fmkey_g = 0x02000147, // M-g
Fmkey_h = 0x02000148, // M-h
Fmkey_i = 0x02000149, // M-i
Fmkey_j = 0x0200014a, // M-j
Fmkey_k = 0x0200014b, // M-k
Fmkey_l = 0x0200014c, // M-l
Fmkey_m = 0x0200014d, // M-m
Fmkey_n = 0x0200014e, // M-n
Fmkey_o = 0x0200014f, // M-o
Fmkey_p = 0x02000150, // M-p
Fmkey_q = 0x02000151, // M-q
Fmkey_r = 0x02000152, // M-r
Fmkey_s = 0x02000153, // M-s
Fmkey_t = 0x02000154, // M-t
Fmkey_u = 0x02000155, // M-u
Fmkey_v = 0x02000156, // M-v
Fmkey_w = 0x02000157, // M-w
Fmkey_x = 0x02000158, // M-x
Fmkey_y = 0x02000159, // M-y
Fmkey_z = 0x0200015a, // M-z
Fmkey_left_curly_bracket = 0x0200015b, // M-{
Fmkey_vertical_bar = 0x0200015c, // M-|
Fmkey_right_curly_bracket = 0x0200015d, // M-}
Fmkey_tilde = 0x0200015e // M-~
};
// Console color names
enum colornames
{
Default = -1,
Black = 0,
Blue = 1,
Green = 2,
@ -925,7 +909,8 @@ enum colornames
Grey82 = 252, // #d0d0d0
Grey85 = 253, // #dadada
Grey89 = 254, // #e4e4e4
Grey93 = 255 // #eeeeee
Grey93 = 255, // #eeeeee
Default = static_cast<FColor>(-1)
};
// Mouse/keyboard state values

View File

@ -74,7 +74,7 @@ class FCheckBox : public FToggleButton
public:
// Constructors
explicit FCheckBox (FWidget* = 0);
FCheckBox (const FString&, FWidget* = 0);
explicit FCheckBox (const FString&, FWidget* = 0);
// Destructor
virtual ~FCheckBox();

View File

@ -74,7 +74,7 @@ class FCheckMenuItem : public FMenuItem
public:
// Constructors
explicit FCheckMenuItem (FWidget* = 0);
FCheckMenuItem (const FString&, FWidget* = 0);
explicit FCheckMenuItem (const FString&, FWidget* = 0);
// Destructor
virtual ~FCheckMenuItem();

View File

@ -51,13 +51,13 @@ class FColorPalette
{
public:
// Constructor
explicit FColorPalette();
FColorPalette();
// Destructor
virtual ~FColorPalette();
// Typedefs
typedef void (*funcp)(short, int, int, int);
typedef void (*funcp)(FColor, int, int, int);
// Accessor
virtual const char* getClassName() const;

View File

@ -161,8 +161,7 @@
#define F_HAVE_VSNPRINTF 1
#endif
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#ifndef F_LT_OBJDIR
#define F_LT_OBJDIR ".libs/"
#endif

View File

@ -88,7 +88,7 @@ class FDialog : public FWindow
// Constructors
explicit FDialog (FWidget* = 0);
FDialog (const FString&, FWidget* = 0);
explicit FDialog (const FString&, FWidget* = 0);
// Destructor
virtual ~FDialog();
@ -282,11 +282,11 @@ inline void FDialog::setText (const FString& txt)
//----------------------------------------------------------------------
inline bool FDialog::isModal()
{ return ((flags & fc::modal) != 0); }
{ return flags.modal; }
//----------------------------------------------------------------------
inline bool FDialog::isScrollable()
{ return ((flags & fc::scrollable) != 0); }
{ return flags.scrollable; }
} // namespace finalcut

View File

@ -80,7 +80,7 @@ class FDialogListMenu : public FMenu
public:
// Constructors
explicit FDialogListMenu (FWidget* = 0);
FDialogListMenu (const FString&, FWidget* = 0);
explicit FDialogListMenu (const FString&, FWidget* = 0);
// Destructor
virtual ~FDialogListMenu();

View File

@ -113,16 +113,16 @@ class FEvent // event base class
class FKeyEvent : public FEvent // keyboard event
{
public:
FKeyEvent (int, int);
FKeyEvent (int, FKey);
~FKeyEvent();
int key() const;
FKey key() const;
bool isAccepted() const;
void accept();
void ignore();
protected:
int k;
FKey k;
bool accpt;
};

View File

@ -60,7 +60,7 @@ class FKeyboardCommand
{
public:
// Constructor
FKeyboardCommand (FApplication* = 0, void(FApplication::*)() = 0);
explicit FKeyboardCommand (FApplication* = 0, void(FApplication::*)() = 0);
// Method
void execute();
@ -97,8 +97,8 @@ class FKeyboard
// Accessors
virtual const char* getClassName() const;
int getKey();
const FString getKeyName (int);
FKey getKey();
const FString getKeyName (FKey);
keybuffer& getKeyBuffer();
timeval* getKeyPressedTime();
@ -131,8 +131,8 @@ class FKeyboard
private:
// Constants
static const int NEED_MORE_DATA = -1;
static const std::size_t READ_BUF_SIZE = 1024;
static const FKey NOT_SET = static_cast<FKey>(-1);
// Disable copy constructor
FKeyboard (const FKeyboard&);
@ -141,10 +141,10 @@ class FKeyboard
FKeyboard& operator = (const FKeyboard&);
// Accessors
int getMouseProtocolKey();
int getTermcapKey();
int getMetaKey();
int getSingleKey();
FKey getMouseProtocolKey();
FKey getTermcapKey();
FKey getMetaKey();
FKey getSingleKey();
// Mutators
bool setNonBlockingInput (bool);
@ -155,18 +155,18 @@ class FKeyboard
static bool isKeypressTimeout();
// Methods
int UTF8decode (const char[]);
FKey UTF8decode (const char[]);
ssize_t readKey();
void parseKeyBuffer();
int parseKeyString();
int keyCorrection (const int&);
FKey parseKeyString();
FKey keyCorrection (const FKey&);
void substringKeyHandling();
void keyPressed();
void keyReleased();
void escapeKeyPressed();
// Data Members
int key;
FKey key;
char read_buf[READ_BUF_SIZE];
char fifo_buf[FIFO_BUF_SIZE];
int fifo_offset;
@ -197,7 +197,7 @@ inline const char* FKeyboard::getClassName() const
{ return "FKeyboard"; }
//----------------------------------------------------------------------
inline int FKeyboard::getKey()
inline FKey FKeyboard::getKey()
{ return key; }
//----------------------------------------------------------------------

View File

@ -74,7 +74,7 @@ class FLabel : public FWidget
// Constructor
explicit FLabel (FWidget* = 0);
FLabel (const FString&, FWidget* = 0);
explicit FLabel (const FString&, FWidget* = 0);
// Destructor
virtual ~FLabel();
@ -94,7 +94,7 @@ class FLabel : public FWidget
// Accessors
const char* getClassName() const;
FTerm* getAccelWidget();
FWidget* getAccelWidget();
fc::text_alignment getAlignment();
FString& getText();
@ -157,8 +157,8 @@ class FLabel : public FWidget
bool multiline;
FString text;
fc::text_alignment alignment;
short emphasis_color;
short ellipsis_color;
FColor emphasis_color;
FColor ellipsis_color;
bool emphasis;
bool reverse_mode;
FWidget* accel_widget;
@ -172,7 +172,7 @@ inline const char* FLabel::getClassName() const
{ return "FLabel"; }
//----------------------------------------------------------------------
inline FTerm* FLabel::getAccelWidget ()
inline FWidget* FLabel::getAccelWidget ()
{ return accel_widget; }
//----------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ class FLineEdit : public FWidget
// Constructor
explicit FLineEdit (FWidget* = 0);
FLineEdit (const FString&, FWidget* = 0);
explicit FLineEdit (const FString&, FWidget* = 0);
// Destructor
virtual ~FLineEdit();
@ -165,7 +165,7 @@ class FLineEdit : public FWidget
void keyBackspace();
void keyInsert();
void keyEnter();
bool keyInput (int);
bool keyInput (FKey);
void processActivate();
void processChanged();
@ -227,7 +227,7 @@ inline bool FLineEdit::unsetShadow()
//----------------------------------------------------------------------
inline bool FLineEdit::hasShadow()
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
} // namespace finalcut

View File

@ -245,7 +245,7 @@ class FListBox : public FWidget
// Methods
void init();
virtual void draw();
void drawLabel();
void drawHeadline();
void drawList();
void drawListLine (int, listBoxItems::iterator, bool);
void printLeftBracket (fc::brackets_type);
@ -285,7 +285,7 @@ class FListBox : public FWidget
bool keySpace();
bool keyInsert();
bool keyBackspace();
bool keyIncSearchInput (int);
bool keyIncSearchInput (FKey);
void processClick();
void processSelect();
void processChanged();
@ -526,7 +526,8 @@ void FListBox::insert (Container container, LazyConverter convert)
}
//----------------------------------------------------------------------
inline FListBox::listBoxItems::iterator FListBox::index2iterator (std::size_t index)
inline FListBox::listBoxItems::iterator \
FListBox::index2iterator (std::size_t index)
{
listBoxItems::iterator iter = itemlist.begin();
std::advance (iter, index);

View File

@ -52,9 +52,10 @@
#error "Only <final/final.h> can be included directly."
#endif
#include <list>
#include <stack>
#include <vector>
#include "final/fmessagebox.h"
#include "final/fscrollbar.h"
#include "final/fstring.h"
#include "final/ftermbuffer.h"
@ -97,11 +98,14 @@ class FListViewItem : public FObject
FWidget::data_ptr getData() const;
uInt getDepth() const;
// Mutator
// Mutators
void setText (int, const FString&);
void setData (FWidget::data_ptr);
void setCheckable (bool);
void setChecked (bool);
// Inquiry
bool isChecked() const;
bool isExpand() const;
// Methods
@ -113,6 +117,7 @@ class FListViewItem : public FObject
private:
// Inquiry
bool isExpandable() const;
bool isCheckable() const;
// Methods
template <typename Compare>
@ -129,6 +134,8 @@ class FListViewItem : public FObject
std::size_t visible_lines;
bool expandable;
bool is_expand;
bool checkable;
bool is_checked;
// Friend class
friend class FListView;
@ -154,6 +161,14 @@ inline FWidget::data_ptr FListViewItem::getData() const
inline void FListViewItem::setData (FWidget::data_ptr data)
{ data_pointer = data; }
//----------------------------------------------------------------------
inline void FListViewItem::setChecked (bool checked)
{ is_checked = checked; }
//----------------------------------------------------------------------
inline bool FListViewItem::isChecked() const
{ return is_checked; }
//----------------------------------------------------------------------
inline bool FListViewItem::isExpand() const
{ return is_expand; }
@ -162,6 +177,10 @@ inline bool FListViewItem::isExpand() const
inline bool FListViewItem::isExpandable() const
{ return expandable; }
//----------------------------------------------------------------------
inline bool FListViewItem::isCheckable() const
{ return checkable; }
//----------------------------------------------------------------------
// class FListViewIterator
@ -179,7 +198,7 @@ class FListViewIterator
typedef std::stack<FObjectIterator> FObjectIteratorStack;
// Constructor
explicit FListViewIterator ();
FListViewIterator ();
FListViewIterator (FObjectIterator);
// Overloaded operators
@ -269,17 +288,20 @@ class FListView : public FWidget
FListViewItem* getCurrentItem();
// Mutators
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
virtual void setGeometry ( int, int
, std::size_t, std::size_t
, bool = true );
void setColumnAlignment (int, fc::text_alignment);
void setColumnText (int, const FString&);
void setColumnSortType (int,fc::sorting_type \
= fc::by_name);
void setColumnSortType (int, fc::sorting_type \
= fc::by_name);
void setColumnSort (int, fc::sorting_order \
= fc::ascending);
template <typename Compare>
void setUserAscendingCompare (Compare);
template <typename Compare>
void setUserDescendingCompare (Compare);
void hideSortIndicator (bool);
bool setTreeView (bool);
bool setTreeView();
bool unsetTreeView();
@ -348,18 +370,24 @@ class FListView : public FWidget
, std::size_t
, std::size_t );
virtual void draw();
void drawColumnLabels();
void drawHeadlines();
void drawList();
void drawListLine (const FListViewItem*, bool, bool);
void setLineAttributes (bool, bool);
FString getCheckBox (const FListViewItem* item);
FString getLinePrefix (const FListViewItem*, std::size_t);
void drawColumnText (headerItems::const_iterator&);
void drawSortIndicator (std::size_t&, std::size_t);
void drawHeadlineLabel (headerItems::const_iterator&);
void drawHeaderBorder (std::size_t);
void drawColumnEllipsis ( headerItems::const_iterator&
, const FString& );
void updateDrawing (bool, bool);
int determineLineWidth (FListViewItem* item);
int determineLineWidth (FListViewItem*);
void beforeInsertion (FListViewItem*);
void afterInsertion();
void recalculateHorizontalBar (int);
void recalculateVerticalBar (int);
void mouseHeaderClicked();
void wheelUp (int);
void wheelDown (int);
bool dragScrollUp (int);
@ -370,6 +398,7 @@ class FListView : public FWidget
FObjectIterator appendItem (FListViewItem*);
void processClick();
void processChanged();
void keySpace();
void keyLeft (int&);
void keyRight (int&);
void keyHome();
@ -386,6 +415,7 @@ class FListView : public FWidget
void scrollTo (const FPoint &);
void scrollTo (int, int);
void scrollBy (int, int);
bool hasCheckableItems() const;
// Callback methods
void cb_VBarChange (FWidget*, data_ptr);
@ -407,7 +437,11 @@ class FListView : public FWidget
int scroll_distance;
bool scroll_timer;
bool tree_view;
bool hide_sort_indicator;
bool has_checkable_items;
FPoint clicked_expander_pos;
FPoint clicked_header_pos;
const FListViewItem* clicked_checkbox_item;
int xoffset;
int nf_offset;
int max_line_width;
@ -432,7 +466,7 @@ class FListView : public FWidget
struct FListView::Header
{
public:
explicit Header()
Header()
: name()
, width (0)
, fixed_width (false)
@ -474,9 +508,13 @@ template <typename Compare>
inline void FListView::setUserDescendingCompare (Compare cmp)
{ user_defined_descending = cmp; }
//----------------------------------------------------------------------
inline void FListView::hideSortIndicator (bool hide)
{ hide_sort_indicator = hide; }
//----------------------------------------------------------------------
inline bool FListView::setTreeView (bool on)
{ return tree_view = on; }
{ return (tree_view = on); }
//----------------------------------------------------------------------
inline bool FListView::setTreeView()
@ -524,6 +562,10 @@ inline FObject::FObjectIterator FListView::endOfList()
inline void FListView::scrollTo (const FPoint& pos)
{ scrollTo(pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline bool FListView::hasCheckableItems() const
{ return has_checkable_items; }
} // namespace finalcut
#endif // FLISTVIEW_H

Some files were not shown because too many files have changed in this diff Show More