Internal redesign of the callback call
This commit is contained in:
parent
298755a0fe
commit
a279a0981a
|
@ -1,3 +1,8 @@
|
|||
2019-10-05 Markus Gans <guru.mail@muenster.de>
|
||||
* Internal redesign of the callback call
|
||||
* Mapping of key functions in an associative container to simplify
|
||||
onKeyPress() in FListBox, FListView, FTextView and FScrollView
|
||||
|
||||
2019-10-01 Markus Gans <guru.mail@muenster.de>
|
||||
* Replacing null-terminated wide strings with FString objects
|
||||
* Fix for getColumnWidth() with newfont character
|
||||
|
|
24
README.md
24
README.md
|
@ -1,5 +1,4 @@
|
|||
![FINAL CUT](logo/svg/finalcut-logo.svg)
|
||||
============================================
|
||||
|
||||
# Library for creating terminal applications with text-based widgets
|
||||
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.
|
||||
|
@ -7,18 +6,15 @@ The FINAL CUT is a C++ class library and widget toolkit with full mouse support
|
|||
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.
|
||||
|
||||
## Building and code analysis
|
||||
*Latest release:*<br />
|
||||
     [![Latest Release](https://img.shields.io/github/release/gansm/finalcut.svg)](https://github.com/gansm/finalcut/releases) <br />
|
||||
*License:*<br />
|
||||
     [![license](https://img.shields.io/github/license/gansm/finalcut.svg?colorA=#333)](COPYING) <br />
|
||||
*Travis CI:*<br />
|
||||
     [![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut) <br />
|
||||
*Coverity Scan:*<br />
|
||||
     [![Coverity Scan Status](https://img.shields.io/coverity/scan/6508.svg)](https://scan.coverity.com/projects/6508) <br />
|
||||
*LGTM:*<br />
|
||||
     [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/gansm/finalcut.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/gansm/finalcut/context:cpp) <br />
|
||||
*Class Reference:*<br />
|
||||
     [![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html)
|
||||
| | Badge |
|
||||
|-------------------:|:------|
|
||||
| *Latest release* | [![Latest Release](https://img.shields.io/github/release/gansm/finalcut.svg)](https://github.com/gansm/finalcut/releases) |
|
||||
| *License* | [![license](https://img.shields.io/github/license/gansm/finalcut.svg?colorA=#333)](COPYING) |
|
||||
| *Class Reference* | [![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html) |
|
||||
| *Travis CI* | [![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut)
|
||||
|*Coverity Scan* | [![Coverity Scan Status](https://img.shields.io/coverity/scan/6508.svg)](https://scan.coverity.com/projects/6508 )|
|
||||
| *LGTM* | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/gansm/finalcut.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/gansm/finalcut/context:cpp) |
|
||||
| *CodeFactor* | [![CodeFactor](https://www.codefactor.io/repository/github/gansm/finalcut/badge)](https://www.codefactor.io/repository/github/gansm/finalcut) |
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
|
@ -40,7 +36,7 @@ The structure of the Qt framework was originally the inspiration for the C++ cla
|
|||
* Solaris
|
||||
|
||||
## First steps
|
||||
Read here [how to use the library](doc/first-steps.md#first-steps-with-the-final-cut-widget-toolkit)
|
||||
See the [first steps](doc/first-steps.md#first-steps-with-the-final-cut-widget-toolkit) documentation for information on how to use the library.
|
||||
|
||||
## Some screenshots
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<selectfont>
|
||||
<acceptfont>
|
||||
<pattern>
|
||||
<patelt name="family"><string>8x16graph</string></patelt>
|
||||
</pattern>
|
||||
</acceptfont>
|
||||
</selectfont>
|
||||
</fontconfig>
|
|
@ -19,7 +19,8 @@ Architecture: any
|
|||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
${shlibs:Depends}
|
||||
xfonts-utils
|
||||
, ${shlibs:Depends}
|
||||
, ${misc:Depends}
|
||||
Suggests:
|
||||
coreutils
|
||||
|
|
|
@ -30,3 +30,4 @@ doc/vt100_line_drawing_graphics.png
|
|||
doc/virtual-terminal.txt
|
||||
doc/xterm.txt
|
||||
doc/xgraphics
|
||||
fonts/newfont.txt
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
usr/lib/*/lib*.so
|
||||
usr/lib/*/lib*.so.*
|
||||
fonts/8x16graph.pcf.gz /usr/share/fonts/X11/misc/finalcut/
|
||||
fonts/fonts.alias /usr/share/fonts/X11/misc/finalcut/
|
||||
fonts/fonts.dir /usr/share/fonts/X11/misc/finalcut/
|
||||
fonts/newfont.txt /usr/share/fonts/X11/misc/finalcut/
|
||||
fonts/8x16graph.pcf.gz /usr/share/fonts/X11/misc/
|
||||
fonts/xfonts-finalcut-newfont.alias /etc/X11/fonts/misc/
|
||||
debian/40-finalcut-newfont.conf etc/fonts/conf.avail
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
etc/fonts/conf.avail/40-finalcut-newfont.conf etc/fonts/conf.d/40-finalcut-newfont.conf
|
|
@ -20,6 +20,7 @@ include /usr/share/dpkg/default.mk
|
|||
# main packaging script based on dh7 syntax
|
||||
%:
|
||||
sed -i 's/doc\///g' README.md
|
||||
test -f fonts/fonts.alias && mv fonts/fonts.alias fonts/xfonts-finalcut-newfont.alias || true
|
||||
dh $@ --with autotools-dev
|
||||
|
||||
# debmake generated override targets
|
||||
|
|
|
@ -116,7 +116,6 @@ class FClassName
|
|||
// Data members
|
||||
|
||||
// Friend class
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ int main (int argc, char* argv[])
|
|||
ok.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_FUNCTION_CALLBACK (&cb_quit),
|
||||
&cb_quit,
|
||||
&dgl
|
||||
);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ int main (int argc, char* argv[])
|
|||
btn.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_FUNCTION_CALLBACK (&cb_quit),
|
||||
&cb_quit,
|
||||
&app
|
||||
);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ int main (int argc, char* argv[])
|
|||
btn.addCallback ("clicked", cb_exit, &app);
|
||||
Exit.addCallback ("clicked", cb_exit, &app);
|
||||
Quit.addCallback ("clicked", cb_exit, &app);
|
||||
key_F1.addCallback ("activate",cb_tooltip, &app);
|
||||
key_F1.addCallback ("activate", cb_tooltip, &app);
|
||||
|
||||
// Set dialog object as main widget
|
||||
app.setMainWidget(&dgl);
|
||||
|
|
|
@ -120,7 +120,7 @@ int main (int argc, char* argv[])
|
|||
check1.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_FUNCTION_CALLBACK (&cb_publish),
|
||||
&cb_publish,
|
||||
&check2
|
||||
);
|
||||
|
||||
|
@ -128,7 +128,7 @@ int main (int argc, char* argv[])
|
|||
btn.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_FUNCTION_CALLBACK (&cb_quit),
|
||||
&cb_quit,
|
||||
&app
|
||||
);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ FString& mapToString ( std::map<FString
|
|||
, FString>::const_iterator iter );
|
||||
|
||||
|
||||
// Lazy conversion import function
|
||||
// Lazy conversion insert function
|
||||
void doubleToItem ( FListBoxItem& item
|
||||
, FDataPtr container, int index)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ void doubleToItem ( FListBoxItem& item
|
|||
item.setData (FDataPtr(&(*iter)));
|
||||
}
|
||||
|
||||
// Import converter functions
|
||||
// Insert converter functions
|
||||
FString& doubleToString (std::list<double>::const_iterator iter)
|
||||
{
|
||||
auto temp = temp_str.lock();
|
||||
|
@ -127,12 +127,12 @@ Listbox::Listbox (FWidget* parent)
|
|||
list2.setText ("double");
|
||||
|
||||
//
|
||||
// Import via lazy conversion on print
|
||||
// Insert via lazy conversion on print
|
||||
//
|
||||
list2.insert (&double_list, doubleToItem);
|
||||
|
||||
//
|
||||
// Direct import of the complete list
|
||||
// Direct insert of the complete list
|
||||
//
|
||||
//list2.insert (double_list.begin(), double_list.end(), doubleToString);
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ void Scrollview::draw()
|
|||
|
||||
for (int x{0}; x < int(getScrollWidth()); x++)
|
||||
print (32 + ((x + y) % 0x5f));
|
||||
|
||||
}
|
||||
|
||||
if ( isMonochron() )
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -95,6 +96,7 @@ ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
|||
progressBar.setGeometry(FPoint(2, 3), FSize(34, 1), false);
|
||||
//progressBar.setPercentage(78);
|
||||
|
||||
using namespace std::placeholders;
|
||||
reset.addCallback
|
||||
(
|
||||
"clicked",
|
||||
|
|
|
@ -377,7 +377,7 @@ void Window::addClickedCallback ( finalcut::FWidget* widget
|
|||
, WindowCallback call )
|
||||
{
|
||||
FMemberCallback callback
|
||||
= reinterpret_cast<finalcut::FWidget::FMemberCallback>(call);
|
||||
= reinterpret_cast<FMemberCallback>(call);
|
||||
|
||||
widget->addCallback
|
||||
(
|
||||
|
@ -391,7 +391,7 @@ void Window::addClickedCallback ( finalcut::FWidget* widget
|
|||
, FAppCallback call )
|
||||
{
|
||||
FMemberCallback callback
|
||||
= reinterpret_cast<finalcut::FWidget::FMemberCallback>(call);
|
||||
= reinterpret_cast<FMemberCallback>(call);
|
||||
|
||||
widget->addCallback
|
||||
(
|
||||
|
|
|
@ -9,7 +9,7 @@ else
|
|||
fi
|
||||
|
||||
# Is the file executable?
|
||||
test ! -x "$PROG" && echo "No executable file not found" && exit -1
|
||||
test ! -x "$PROG" && echo "No executable file not found" && exit 1
|
||||
|
||||
|
||||
LD_LIBRARY_PATH=../src/.libs/ valgrind --tool=callgrind -v "$PROG" 2>/dev/null
|
||||
|
|
|
@ -11,12 +11,12 @@ else
|
|||
fi
|
||||
|
||||
# Is the file executable?
|
||||
test ! -x "$PROG" && echo "No executable file not found" && exit -1
|
||||
test ! -x "$PROG" && echo "No executable file not found" && exit 1
|
||||
|
||||
# ELF executable file?
|
||||
ELFMAGIC="$(echo -e "\\x7fELF")"
|
||||
MAGIC="$(dd bs=1 count=4 if="$PROG" 2>/dev/null)"
|
||||
test "$MAGIC" != "$ELFMAGIC" && echo "No ELF executable file" && exit -2
|
||||
test "$MAGIC" != "$ELFMAGIC" && echo "No ELF executable file" && exit 2
|
||||
|
||||
LD_LIBRARY_PATH=../src/.libs/ valgrind --tool=memcheck --suppressions=../doc/ncurses.supp --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --log-file=./valgrind.txt "$PROG" "$@"
|
||||
|
||||
|
|
|
@ -370,9 +370,12 @@ void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
|
|||
// Set the keyboard keypress timeout
|
||||
if ( keyboard )
|
||||
{
|
||||
FKeyboardCommand key_cmd1 (this, &FApplication::keyPressed);
|
||||
FKeyboardCommand key_cmd2 (this, &FApplication::keyReleased);
|
||||
FKeyboardCommand key_cmd3 (this, &FApplication::escapeKeyPressed);
|
||||
auto cmd1 = std::bind(&FApplication::keyPressed, this);
|
||||
auto cmd2 = std::bind(&FApplication::keyReleased, this);
|
||||
auto cmd3 = std::bind(&FApplication::escapeKeyPressed, this);
|
||||
FKeyboardCommand key_cmd1 (cmd1);
|
||||
FKeyboardCommand key_cmd2 (cmd2);
|
||||
FKeyboardCommand key_cmd3 (cmd3);
|
||||
keyboard->setPressCommand (key_cmd1);
|
||||
keyboard->setReleaseCommand (key_cmd2);
|
||||
keyboard->setEscPressedCommand (key_cmd3);
|
||||
|
|
|
@ -165,7 +165,6 @@ int FDialog::exec()
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::setPos (const FPoint& pos, bool)
|
||||
{
|
||||
|
||||
setPos_error = false;
|
||||
|
||||
// Avoid to move widget completely outside the terminal
|
||||
|
|
|
@ -453,33 +453,33 @@ void FFileDialog::clear()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
long FFileDialog::numOfDirs()
|
||||
sInt64 FFileDialog::numOfDirs()
|
||||
{
|
||||
if ( dir_entries.empty() )
|
||||
return 0;
|
||||
|
||||
long n = std::count_if ( std::begin(dir_entries)
|
||||
, std::end(dir_entries)
|
||||
, [] (dir_entry& entry)
|
||||
{
|
||||
return entry.directory
|
||||
&& std::strcmp(entry.name, ".") != 0;
|
||||
}
|
||||
);
|
||||
sInt64 n = std::count_if ( std::begin(dir_entries)
|
||||
, std::end(dir_entries)
|
||||
, [] (dir_entry& entry)
|
||||
{
|
||||
return entry.directory
|
||||
&& std::strcmp(entry.name, ".") != 0;
|
||||
}
|
||||
);
|
||||
return n;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::sortDir()
|
||||
{
|
||||
long start{};
|
||||
sInt64 start{};
|
||||
|
||||
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
||||
start = 1;
|
||||
else
|
||||
start = 0;
|
||||
|
||||
long dir_num = numOfDirs();
|
||||
sInt64 dir_num = numOfDirs();
|
||||
// directories first
|
||||
std::sort ( dir_entries.begin() + start
|
||||
, dir_entries.end()
|
||||
|
|
|
@ -49,25 +49,6 @@ struct timeval FKeyboard::time_keypressed{};
|
|||
FTermLinux* FKeyboard::linux{nullptr};
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FKeyboardCommand
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FKeyboardCommand::FKeyboardCommand ( FApplication* object
|
||||
, void(FApplication::*method)() )
|
||||
: instance(object)
|
||||
, handler(method)
|
||||
{ }
|
||||
|
||||
// public methods of FKeyboardCommand
|
||||
//----------------------------------------------------------------------
|
||||
void FKeyboardCommand::execute()
|
||||
{
|
||||
(instance->*handler)();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FKeyboard
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/fcolorpair.h"
|
||||
|
|
130
src/flistbox.cpp
130
src/flistbox.cpp
|
@ -322,82 +322,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
|||
std::size_t current_before = current;
|
||||
int xoffset_before = xoffset;
|
||||
int yoffset_before = yoffset;
|
||||
FKey key = ev->key();
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
case fc::Fkey_return:
|
||||
case fc::Fkey_enter:
|
||||
acceptSelection();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_up:
|
||||
onePosUp();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_down:
|
||||
onePosDown();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_left:
|
||||
scrollLeft();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_right:
|
||||
scrollRight();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
onePageUp();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
onePageDown();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_home:
|
||||
firstPos();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_end:
|
||||
lastPos();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_ic: // insert key
|
||||
if ( changeSelectionAndPosition() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_space:
|
||||
if ( spacebarProcessing() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_erase:
|
||||
case fc::Fkey_backspace:
|
||||
if ( deletePreviousCharacter() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_escape:
|
||||
case fc::Fkey_escape_mintty:
|
||||
if ( skipIncrementalSearch() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( keyIncSearchInput(key) )
|
||||
ev->accept();
|
||||
}
|
||||
processKeyAction(ev); // Process the keystrokes
|
||||
|
||||
if ( current_before != current )
|
||||
{
|
||||
|
@ -759,6 +684,57 @@ void FListBox::init()
|
|||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
setRightPadding(1 + int(nf_offset));
|
||||
mapKeyFunctions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::mapKeyFunctions()
|
||||
{
|
||||
key_map[fc::Fkey_return] = std::bind(&FListBox::acceptSelection, this);
|
||||
key_map[fc::Fkey_enter] = std::bind(&FListBox::acceptSelection, this);
|
||||
key_map[fc::Fkey_up] = std::bind(&FListBox::onePosUp, this);
|
||||
key_map[fc::Fkey_down] = std::bind(&FListBox::onePosDown, this);
|
||||
auto left = static_cast<void(FListBox::*)()>(&FListBox::scrollLeft);
|
||||
key_map[fc::Fkey_left] = std::bind(left, this);
|
||||
auto right = static_cast<void(FListBox::*)()>(&FListBox::scrollRight);
|
||||
key_map[fc::Fkey_right] = std::bind(right, this);
|
||||
key_map[fc::Fkey_ppage] = std::bind(&FListBox::onePageUp, this);
|
||||
key_map[fc::Fkey_npage] = std::bind(&FListBox::onePageDown, this);
|
||||
key_map[fc::Fkey_home] = std::bind(&FListBox::firstPos, this);
|
||||
key_map[fc::Fkey_end] = std::bind(&FListBox::lastPos, this);
|
||||
key_map_result[fc::Fkey_ic] = \
|
||||
std::bind(&FListBox::changeSelectionAndPosition, this);
|
||||
key_map_result[fc::Fkey_space] = \
|
||||
std::bind(&FListBox::spacebarProcessing, this);
|
||||
key_map_result[fc::Fkey_erase] = \
|
||||
std::bind(&FListBox::deletePreviousCharacter, this);
|
||||
key_map_result[fc::Fkey_backspace] = \
|
||||
std::bind(&FListBox::deletePreviousCharacter, this);
|
||||
key_map_result[fc::Fkey_escape] = \
|
||||
std::bind(&FListBox::skipIncrementalSearch, this);
|
||||
key_map_result[fc::Fkey_escape_mintty] = \
|
||||
std::bind(&FListBox::skipIncrementalSearch, this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::processKeyAction (FKeyEvent* ev)
|
||||
{
|
||||
int idx = int(ev->key());
|
||||
|
||||
if ( key_map.find(idx) != key_map.end() )
|
||||
{
|
||||
key_map[idx]();
|
||||
ev->accept();
|
||||
}
|
||||
else if ( key_map_result.find(idx) != key_map_result.end() )
|
||||
{
|
||||
if ( key_map_result[idx]() )
|
||||
ev->accept();
|
||||
}
|
||||
else if ( keyIncSearchInput(ev->key()) )
|
||||
{
|
||||
ev->accept();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1770,7 +1746,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
|||
if ( conv_type != lazy_convert || ! iter->getText().isNull() )
|
||||
return;
|
||||
|
||||
convertToItem (*iter, source_container, y + yoffset);
|
||||
lazy_inserter (*iter, source_container, y + yoffset);
|
||||
std::size_t column_width = getColumnWidth(iter->text);
|
||||
recalculateHorizontalBar (column_width, hasBrackets(iter));
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "final/emptyfstring.h"
|
||||
|
@ -875,79 +876,11 @@ void FListView::sort()
|
|||
//----------------------------------------------------------------------
|
||||
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;
|
||||
FKey key = ev->key();
|
||||
int position_before = current_iter.getPosition();
|
||||
int xoffset_before = xoffset;
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
clicked_expander_pos.setPoint(-1, -1);
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
case fc::Fkey_return:
|
||||
case fc::Fkey_enter:
|
||||
processClick();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_space:
|
||||
toggleCheckbox();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_up:
|
||||
stepBackward();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_down:
|
||||
stepForward();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_left:
|
||||
collapseAndScrollLeft (first_line_position_before);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_right:
|
||||
expandAndScrollRight (first_line_position_before);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
stepBackward(pagesize);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
stepForward(pagesize);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_home:
|
||||
firstPos();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_end:
|
||||
lastPos();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case int('+'):
|
||||
if ( expandSubtree() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case int('-'):
|
||||
if ( collapseSubtree() )
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
ev->ignore();
|
||||
}
|
||||
processKeyAction(ev); // Process the keystrokes
|
||||
|
||||
if ( position_before != current_iter.getPosition() )
|
||||
processChanged();
|
||||
|
@ -982,9 +915,9 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
|||
getStatusBar()->drawMessage();
|
||||
}
|
||||
|
||||
int first_line_position_before = first_visible_line.getPosition()
|
||||
, mouse_x = ev->getX()
|
||||
, mouse_y = ev->getY();
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth()) )
|
||||
{
|
||||
|
@ -1119,9 +1052,9 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
int first_line_position_before = first_visible_line.getPosition()
|
||||
, mouse_x = ev->getX()
|
||||
, mouse_y = ev->getY();
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
|
@ -1194,8 +1127,8 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::onTimer (FTimerEvent*)
|
||||
{
|
||||
int position_before = current_iter.getPosition()
|
||||
, first_line_position_before = first_visible_line.getPosition();
|
||||
int position_before = current_iter.getPosition();
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
|
||||
switch ( int(drag_scroll) )
|
||||
{
|
||||
|
@ -1233,9 +1166,9 @@ void FListView::onTimer (FTimerEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::onWheel (FWheelEvent* ev)
|
||||
{
|
||||
int position_before = current_iter.getPosition()
|
||||
, first_line_position_before = first_visible_line.getPosition()
|
||||
, pagesize{4};
|
||||
int position_before = current_iter.getPosition();
|
||||
int pagesize{4};
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
|
||||
if ( drag_scroll != fc::noScroll )
|
||||
stopDragScroll();
|
||||
|
@ -1391,6 +1324,46 @@ void FListView::init()
|
|||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
setRightPadding(1 + int(nf_offset));
|
||||
mapKeyFunctions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListView::mapKeyFunctions()
|
||||
{
|
||||
key_map[fc::Fkey_return] = std::bind(&FListView::processClick, this);
|
||||
key_map[fc::Fkey_enter] = std::bind(&FListView::processClick, this);
|
||||
key_map[fc::Fkey_space] = std::bind(&FListView::toggleCheckbox, this);
|
||||
key_map[fc::Fkey_up] = [&] { stepBackward(); };
|
||||
key_map[fc::Fkey_down] = [&] { stepForward(); };
|
||||
key_map[fc::Fkey_left] = std::bind(&FListView::collapseAndScrollLeft, this);
|
||||
key_map[fc::Fkey_right] = std::bind(&FListView::expandAndScrollRight, this);
|
||||
key_map[fc::Fkey_ppage] = [&] { stepBackward(int(getClientHeight()) - 1); };
|
||||
key_map[fc::Fkey_npage] = [&] { stepForward(int(getClientHeight()) - 1); };
|
||||
key_map[fc::Fkey_home] = std::bind(&FListView::firstPos, this);
|
||||
key_map[fc::Fkey_end] = std::bind(&FListView::lastPos, this);
|
||||
key_map_result[FKey('+')] = std::bind(&FListView::expandSubtree, this);
|
||||
key_map_result[FKey('-')] = std::bind(&FListView::collapseSubtree, this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::processKeyAction (FKeyEvent* ev)
|
||||
{
|
||||
int idx = int(ev->key());
|
||||
|
||||
if ( key_map.find(idx) != key_map.end() )
|
||||
{
|
||||
key_map[idx]();
|
||||
ev->accept();
|
||||
}
|
||||
else if ( key_map_result.find(idx) != key_map_result.end() )
|
||||
{
|
||||
if ( key_map_result[idx]() )
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
ev->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2291,7 +2264,7 @@ inline void FListView::toggleCheckbox()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListView::collapseAndScrollLeft (int& first_line_position_before)
|
||||
inline void FListView::collapseAndScrollLeft()
|
||||
{
|
||||
if ( itemlist.empty() )
|
||||
return;
|
||||
|
@ -2348,7 +2321,7 @@ inline void FListView::collapseAndScrollLeft (int& first_line_position_before)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListView::expandAndScrollRight (int& first_line_position_before)
|
||||
inline void FListView::expandAndScrollRight()
|
||||
{
|
||||
if ( itemlist.empty() )
|
||||
return;
|
||||
|
@ -2618,9 +2591,9 @@ void FListView::scrollBy (int dx, int dy)
|
|||
void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
int distance{1}
|
||||
, pagesize{4}
|
||||
, first_line_position_before = first_visible_line.getPosition();
|
||||
int distance{1};
|
||||
int pagesize{4};
|
||||
first_line_position_before = first_visible_line.getPosition();
|
||||
|
||||
switch ( scrollType )
|
||||
{
|
||||
|
|
|
@ -567,7 +567,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
addCallback // for this element
|
||||
(
|
||||
"deactivate",
|
||||
F_METHOD_CALLBACK (parent, &FMenuBar::cb_item_deactivated)
|
||||
F_METHOD_CALLBACK (menubar_ptr, &FMenuBar::cb_item_deactivated)
|
||||
);
|
||||
}
|
||||
else if ( isMenu(parent) ) // Parent is menu
|
||||
|
|
|
@ -53,7 +53,7 @@ FMouse::FMouse()
|
|||
|
||||
// public methods of FMouse
|
||||
//----------------------------------------------------------------------
|
||||
const char* FMouse::getClassName() const
|
||||
const FString FMouse::getClassName() const
|
||||
{
|
||||
return "FMouse";
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ FMouseGPM::~FMouseGPM() // destructor
|
|||
|
||||
// public methods of FMouseX11
|
||||
//----------------------------------------------------------------------
|
||||
const char* FMouseGPM::getClassName() const
|
||||
const FString FMouseGPM::getClassName() const
|
||||
{
|
||||
return "FMouseGPM";
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ int FMouseGPM::gpmEvent (bool clear)
|
|||
|
||||
// public methods of FMouseX11
|
||||
//----------------------------------------------------------------------
|
||||
const char* FMouseX11::getClassName() const
|
||||
const FString FMouseX11::getClassName() const
|
||||
{
|
||||
return "FMouseX11";
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
|||
|
||||
// public methods of FMouseSGR
|
||||
//----------------------------------------------------------------------
|
||||
const char* FMouseSGR::getClassName() const
|
||||
const FString FMouseSGR::getClassName() const
|
||||
{
|
||||
return "FMouseSGR";
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ void FMouseSGR::setReleasedButtonState (int btn)
|
|||
|
||||
// public methods of FMouseUrxvt
|
||||
//----------------------------------------------------------------------
|
||||
const char* FMouseUrxvt::getClassName() const
|
||||
const FString FMouseUrxvt::getClassName() const
|
||||
{
|
||||
return "FMouseUrxvt";
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ void FRadioMenuItem::init (FWidget* parent)
|
|||
addCallback // for this element
|
||||
(
|
||||
"toggled",
|
||||
F_METHOD_CALLBACK (parent, &FMenu::cb_menuitem_toggled)
|
||||
F_METHOD_CALLBACK (menu_ptr, &FMenu::cb_menuitem_toggled)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -464,52 +464,12 @@ void FScrollView::drawBorder()
|
|||
//----------------------------------------------------------------------
|
||||
void FScrollView::onKeyPress (FKeyEvent* ev)
|
||||
{
|
||||
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||
int idx = int(ev->key());
|
||||
|
||||
switch ( ev->key() )
|
||||
if ( key_map.find(idx) != key_map.end() )
|
||||
{
|
||||
case fc::Fkey_up:
|
||||
scrollBy (0, -1);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_down:
|
||||
scrollBy (0, 1);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_left:
|
||||
scrollBy (-1, 0);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_right:
|
||||
scrollBy (1, 0);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
scrollBy (0, int(-getViewportHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
scrollBy (0, int(getViewportHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_home:
|
||||
scrollToY (1);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_end:
|
||||
scrollToY (1 + yoffset_end);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
key_map[idx]();
|
||||
ev->accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,6 +724,7 @@ void FScrollView::init (FWidget* parent)
|
|||
|
||||
initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange);
|
||||
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_HBarChange);
|
||||
mapKeyFunctions();
|
||||
const auto& wc = getFWidgetColors();
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
|
@ -797,6 +758,24 @@ void FScrollView::init (FWidget* parent)
|
|||
setChildPrintArea (viewport);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FScrollView::mapKeyFunctions()
|
||||
{
|
||||
key_map[fc::Fkey_up] = [&] { scrollBy (0, -1); };
|
||||
key_map[fc::Fkey_down] = [&] { scrollBy (0, 1); };
|
||||
key_map[fc::Fkey_left] = [&] { scrollBy (-1, 0); };
|
||||
key_map[fc::Fkey_right] = [&] { scrollBy (1, 0); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, int(-getViewportHeight())); };
|
||||
key_map[fc::Fkey_npage] = [&] { scrollBy (0, int(getViewportHeight())); };
|
||||
key_map[fc::Fkey_home] = [&] { scrollToY (1); };
|
||||
key_map[fc::Fkey_end] = \
|
||||
[&] ()
|
||||
{
|
||||
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||
scrollToY (1 + yoffset_end);
|
||||
};
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::calculateScrollbarPos()
|
||||
{
|
||||
|
|
|
@ -35,27 +35,24 @@ FStartOptions* FStartOptions::start_options{};
|
|||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FStartOptions::FStartOptions()
|
||||
: cursor_optimisation{true}
|
||||
, mouse_support{true}
|
||||
, terminal_detection{true}
|
||||
, color_change{true}
|
||||
, vgafont{false}
|
||||
, newfont{false}
|
||||
, encoding{fc::UNKNOWN}
|
||||
: cursor_optimisation{true}
|
||||
, mouse_support{true}
|
||||
, terminal_detection{true}
|
||||
, color_change{true}
|
||||
, vgafont{false}
|
||||
, newfont{false}
|
||||
, encoding{fc::UNKNOWN}
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||
, meta_sends_escape{true}
|
||||
, change_cursorstyle{true}
|
||||
, meta_sends_escape{true}
|
||||
, change_cursorstyle{true}
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
, meta_sends_escape{true}
|
||||
, meta_sends_escape{true}
|
||||
#endif
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FStartOptions::~FStartOptions() // destructor
|
||||
{
|
||||
if ( start_options )
|
||||
delete start_options;
|
||||
}
|
||||
{ }
|
||||
|
||||
// public methods of FStartOptions
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -77,6 +74,13 @@ FStartOptions& FStartOptions::getFStartOptions()
|
|||
return *start_options;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FStartOptions::destroyObject()
|
||||
{
|
||||
if ( start_options )
|
||||
delete start_options;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FStartOptions::setDefault()
|
||||
{
|
||||
|
|
|
@ -67,9 +67,6 @@ static FTerm* init_term_object{nullptr};
|
|||
// global init state
|
||||
static bool term_initialized{false};
|
||||
|
||||
// function pointer
|
||||
int (*FTerm::Fputchar)(int);
|
||||
|
||||
// static class attributes
|
||||
FTermData* FTerm::data {nullptr};
|
||||
FSystem* FTerm::fsys {nullptr};
|
||||
|
@ -674,16 +671,16 @@ bool FTerm::setVGAFont()
|
|||
data->setTermEncoding (fc::PC);
|
||||
|
||||
if ( isXTerminal() && data->hasUTF8Console() )
|
||||
Fputchar = &FTerm::putchar_UTF8;
|
||||
putchar() = &FTerm::putchar_UTF8;
|
||||
else
|
||||
Fputchar = &FTerm::putchar_ASCII;
|
||||
putchar() = &FTerm::putchar_ASCII;
|
||||
}
|
||||
#if defined(__linux__)
|
||||
else if ( isLinuxTerm() )
|
||||
{
|
||||
data->setVGAFont(linux->loadVGAFont());
|
||||
data->setTermEncoding (fc::PC);
|
||||
Fputchar = &FTerm::putchar_ASCII;
|
||||
putchar() = &FTerm::putchar_ASCII;
|
||||
}
|
||||
#endif // defined(__linux__)
|
||||
else
|
||||
|
@ -716,16 +713,16 @@ bool FTerm::setNewFont()
|
|||
data->setTermEncoding (fc::PC);
|
||||
|
||||
if ( isXTerminal() && data->hasUTF8Console() )
|
||||
Fputchar = &FTerm::putchar_UTF8;
|
||||
putchar() = &FTerm::putchar_UTF8;
|
||||
else
|
||||
Fputchar = &FTerm::putchar_ASCII;
|
||||
putchar() = &FTerm::putchar_ASCII;
|
||||
}
|
||||
#if defined(__linux__)
|
||||
else if ( isLinuxTerm() )
|
||||
{
|
||||
data->setNewFont(linux->loadNewFont());
|
||||
data->setTermEncoding (fc::PC);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
}
|
||||
#endif // defined(__linux__)
|
||||
else
|
||||
|
@ -1086,25 +1083,25 @@ void FTerm::setEncoding (fc::encoding enc)
|
|||
|| enc == fc::PC // CP-437
|
||||
|| enc == fc::ASCII );
|
||||
|
||||
// Set the new Fputchar function pointer
|
||||
// Set the new putchar() function pointer
|
||||
switch ( enc )
|
||||
{
|
||||
case fc::UTF8:
|
||||
Fputchar = &FTerm::putchar_UTF8;
|
||||
putchar() = &FTerm::putchar_UTF8;
|
||||
break;
|
||||
|
||||
case fc::VT100:
|
||||
case fc::PC:
|
||||
if ( isXTerminal() && data->hasUTF8Console() )
|
||||
Fputchar = &FTerm::putchar_UTF8;
|
||||
putchar() = &FTerm::putchar_UTF8;
|
||||
else
|
||||
Fputchar = &FTerm::putchar_ASCII;
|
||||
putchar() = &FTerm::putchar_ASCII;
|
||||
break;
|
||||
|
||||
case fc::ASCII:
|
||||
case fc::UNKNOWN:
|
||||
case fc::NUM_OF_ENCODINGS:
|
||||
Fputchar = &FTerm::putchar_ASCII;
|
||||
putchar() = &FTerm::putchar_ASCII;
|
||||
}
|
||||
|
||||
if ( isLinuxTerm() )
|
||||
|
@ -1198,6 +1195,13 @@ bool FTerm::scrollTermReverse()
|
|||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FTerm::defaultPutChar& FTerm::putchar()
|
||||
{
|
||||
static defaultPutChar* fputchar = new defaultPutChar();
|
||||
return *fputchar;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::putstring (const char str[], int affcnt)
|
||||
{
|
||||
|
@ -1719,7 +1723,7 @@ void FTerm::init_locale()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_encoding()
|
||||
{
|
||||
// detect encoding and set the Fputchar function pointer
|
||||
// detect encoding and set the putchar() function pointer
|
||||
|
||||
bool force_vt100{false}; // VT100 line drawing (G1 character set)
|
||||
init_encoding_set();
|
||||
|
@ -1771,7 +1775,7 @@ void FTerm::init_term_encoding()
|
|||
{
|
||||
data->setUTF8Console(true);
|
||||
data->setTermEncoding (fc::UTF8);
|
||||
Fputchar = &FTerm::putchar_UTF8; // function pointer
|
||||
putchar() = &FTerm::putchar_UTF8; // function pointer
|
||||
data->setUTF8(true);
|
||||
setUTF8(true);
|
||||
keyboard->enableUTF8();
|
||||
|
@ -1782,13 +1786,13 @@ void FTerm::init_term_encoding()
|
|||
{
|
||||
data->setVT100Console (true);
|
||||
data->setTermEncoding (fc::VT100);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
}
|
||||
else
|
||||
{
|
||||
data->setASCIIConsole (true);
|
||||
data->setTermEncoding (fc::ASCII);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1800,12 +1804,12 @@ void FTerm::init_individual_term_encoding()
|
|||
|| (isTeraTerm() && ! data->isUTF8()) )
|
||||
{
|
||||
data->setTermEncoding (fc::PC);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
|
||||
if ( hasUTF8() && getStartOptions().encoding == fc::UNKNOWN )
|
||||
{
|
||||
if ( isXTerminal() )
|
||||
Fputchar = &FTerm::putchar_UTF8; // function pointer
|
||||
putchar() = &FTerm::putchar_UTF8; // function pointer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1815,7 +1819,7 @@ void FTerm::init_force_vt100_encoding()
|
|||
{
|
||||
data->setVT100Console(true);
|
||||
data->setTermEncoding (fc::VT100);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1829,7 +1833,7 @@ void FTerm::init_utf8_without_alt_charset()
|
|||
{
|
||||
data->setASCIIConsole(true);
|
||||
data->setTermEncoding (fc::ASCII);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
putchar() = &FTerm::putchar_ASCII; // function pointer
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2160,7 +2164,6 @@ inline void FTerm::allocationValues()
|
|||
#if DEBUG
|
||||
getFTermDebugData();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2205,6 +2208,10 @@ inline void FTerm::deallocationValues()
|
|||
|
||||
if ( data )
|
||||
delete data;
|
||||
|
||||
defaultPutChar* putchar_ptr = &(putchar());
|
||||
delete putchar_ptr;
|
||||
FStartOptions::destroyObject();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2597,11 +2604,12 @@ FString getFullWidth (const FString& str)
|
|||
{
|
||||
c += 0xfee0;
|
||||
}
|
||||
else for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
|
||||
else
|
||||
{
|
||||
if ( fc::halfWidth_fullWidth[i][HALF] == c ) // found
|
||||
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
|
||||
{
|
||||
c = fc::halfWidth_fullWidth[i][FULL];
|
||||
if ( fc::halfWidth_fullWidth[i][HALF] == c ) // found
|
||||
c = fc::halfWidth_fullWidth[i][FULL];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2624,11 +2632,12 @@ FString getHalfWidth (const FString& str)
|
|||
{
|
||||
c -= 0xfee0;
|
||||
}
|
||||
else for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
|
||||
else
|
||||
{
|
||||
if ( fc::halfWidth_fullWidth[i][FULL] == c ) // found
|
||||
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
|
||||
{
|
||||
c = fc::halfWidth_fullWidth[i][HALF];
|
||||
if ( fc::halfWidth_fullWidth[i][FULL] == c ) // found
|
||||
c = fc::halfWidth_fullWidth[i][HALF];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "final/emptyfstring.h"
|
||||
#include "final/fc.h"
|
||||
#include "final/fconfig.h"
|
||||
#include "final/fsystem.h"
|
||||
#include "final/fterm.h"
|
||||
#include "final/ftermdata.h"
|
||||
|
|
|
@ -41,26 +41,6 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// static class attributes
|
||||
#if defined(__linux__)
|
||||
FTermLinux::modifier_key FTermLinux::mod_key{};
|
||||
console_font_op FTermLinux::screen_font{};
|
||||
unimapdesc FTermLinux::screen_unicode_map{};
|
||||
|
||||
bool FTermLinux::new_font{false};
|
||||
bool FTermLinux::vga_font{false};
|
||||
bool FTermLinux::has_saved_palette{false};
|
||||
|
||||
FTermData* FTermLinux::fterm_data{nullptr};
|
||||
FSystem* FTermLinux::fsystem{nullptr};
|
||||
FTermDetection* FTermLinux::term_detection{nullptr};
|
||||
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style{};
|
||||
FTermLinux::ColorMap FTermLinux::saved_color_map{};
|
||||
FTermLinux::ColorMap FTermLinux::cmap{};
|
||||
int FTermLinux::framebuffer_bpp{-1};
|
||||
#endif // defined(__linux__)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTermLinux
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -830,8 +810,8 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
|||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||
|
||||
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
||||
fsystem->outPortByte (data, attrib_cntlr_write); // write to data register
|
||||
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
||||
fsystem->outPortByte (data, attrib_cntlr_write); // write to data register
|
||||
|
||||
// Disable access to the palette and unblank the display
|
||||
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||
|
|
|
@ -38,22 +38,8 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// static class attributes
|
||||
bool FTermXTerminal::mouse_support{false};
|
||||
bool FTermXTerminal::meta_sends_esc{false};
|
||||
bool FTermXTerminal::xterm_default_colors{false};
|
||||
std::size_t FTermXTerminal::term_width{80};
|
||||
std::size_t FTermXTerminal::term_height{24};
|
||||
FString FTermXTerminal::xterm_font{};
|
||||
FString FTermXTerminal::xterm_title{};
|
||||
FString FTermXTerminal::foreground_color{};
|
||||
FString FTermXTerminal::background_color{};
|
||||
FString FTermXTerminal::cursor_color{};
|
||||
FString FTermXTerminal::mouse_foreground_color{};
|
||||
FString FTermXTerminal::mouse_background_color{};
|
||||
FString FTermXTerminal::highlight_background_color{};
|
||||
FSystem* FTermXTerminal::fsystem{nullptr};
|
||||
FTermDetection* FTermXTerminal::term_detection{nullptr};
|
||||
fc::xtermCursorStyle FTermXTerminal::cursor_style{fc::unknown_cursor_style};
|
||||
bool FTermXTerminal::mouse_support{false};
|
||||
FSystem* FTermXTerminal::fsystem{nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -786,7 +772,7 @@ void FTermXTerminal::enableXTermMouse()
|
|||
// Activate the xterm mouse support
|
||||
|
||||
if ( mouse_support )
|
||||
return;
|
||||
return; // The mouse is already activated
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
@ -806,7 +792,7 @@ void FTermXTerminal::disableXTermMouse()
|
|||
// Deactivate the xterm mouse support
|
||||
|
||||
if ( ! mouse_support )
|
||||
return;
|
||||
return; // The mouse was already deactivated
|
||||
|
||||
FTerm::putstring (CSI "?1006l" // disable SGR mouse mode
|
||||
CSI "?1015l" // disable urxvt mouse mode
|
||||
|
|
|
@ -300,7 +300,9 @@ void FTextView::clear()
|
|||
if ( useFDialogBorder() )
|
||||
{
|
||||
auto parent = getParentWidget();
|
||||
static_cast<FDialog*>(parent)->redraw();
|
||||
|
||||
if ( parent )
|
||||
static_cast<FDialog*>(parent)->redraw();
|
||||
}
|
||||
else
|
||||
drawBorder();
|
||||
|
@ -323,50 +325,12 @@ void FTextView::clear()
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::onKeyPress (FKeyEvent* ev)
|
||||
{
|
||||
switch ( ev->key() )
|
||||
int idx = int(ev->key());
|
||||
|
||||
if ( key_map.find(idx) != key_map.end() )
|
||||
{
|
||||
case fc::Fkey_up:
|
||||
scrollBy (0, -1);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_down:
|
||||
scrollBy (0, 1);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_left:
|
||||
scrollBy (-1, 0);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_right:
|
||||
scrollBy (1, 0);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
scrollBy (0, int(-getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
scrollBy (0, int(getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_home:
|
||||
scrollToY (0);
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_end:
|
||||
scrollToY (int(getRows() - getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
key_map[idx]();
|
||||
ev->accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,6 +576,20 @@ void FTextView::init()
|
|||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
setRightPadding(1 + nf_offset);
|
||||
mapKeyFunctions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTextView::mapKeyFunctions()
|
||||
{
|
||||
key_map[fc::Fkey_up] = [&] { scrollBy (0, -1); };
|
||||
key_map[fc::Fkey_down] = [&] { scrollBy (0, 1); };
|
||||
key_map[fc::Fkey_left] = [&] { scrollBy (-1, 0); };
|
||||
key_map[fc::Fkey_right] = [&] { scrollBy (1, 0); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, int(-getTextHeight())); };
|
||||
key_map[fc::Fkey_npage] = [&] { scrollBy (0, int(getTextHeight())); };
|
||||
key_map[fc::Fkey_home] = [&] { scrollToY (0); };
|
||||
key_map[fc::Fkey_end] = [&] { scrollToY (int(getRows() - getTextHeight())); };
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/fbuttongroup.h"
|
||||
#include "final/fevent.h"
|
||||
|
|
|
@ -290,14 +290,14 @@ void FVTerm::updateTerminal()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::addPreprocessingHandler ( FVTerm* instance
|
||||
, FPreprocessingHandler handler )
|
||||
, FVTermPreprocessing function )
|
||||
{
|
||||
if ( ! print_area )
|
||||
FVTerm::getPrintArea();
|
||||
|
||||
if ( print_area )
|
||||
{
|
||||
vterm_preprocessing obj{ instance, handler };
|
||||
vterm_preprocessing obj{ instance, function };
|
||||
delPreprocessingHandler (instance);
|
||||
print_area->preprocessing_call.push_back(obj);
|
||||
}
|
||||
|
@ -1104,9 +1104,9 @@ void FVTerm::callPreprocessingHandler (term_area* area)
|
|||
|
||||
while ( iter != end )
|
||||
{
|
||||
FPreprocessingHandler handler = iter->handler;
|
||||
// call the preprocessing handler
|
||||
(iter->instance->*handler)();
|
||||
auto preprocessingHandler = iter->function;
|
||||
preprocessingHandler();
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
@ -1838,7 +1838,8 @@ void FVTerm::flush_out()
|
|||
{
|
||||
while ( ! output_buffer->empty() )
|
||||
{
|
||||
FTerm::Fputchar(output_buffer->front());
|
||||
static FTerm::defaultPutChar& FTermPutchar = FTerm::putchar();
|
||||
FTermPutchar (output_buffer->front());
|
||||
output_buffer->pop();
|
||||
}
|
||||
|
||||
|
@ -2525,7 +2526,6 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
|||
whitespace++;
|
||||
else
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ( whitespace == 1 )
|
||||
|
|
106
src/fwidget.cpp
106
src/fwidget.cpp
|
@ -821,6 +821,8 @@ int FWidget::numOfFocusableChildren()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::close()
|
||||
{
|
||||
// Sends a close event and quits the application on acceptance
|
||||
|
||||
FCloseEvent ev(fc::Close_Event);
|
||||
FApplication::sendEvent(this, &ev);
|
||||
|
||||
|
@ -844,29 +846,31 @@ bool FWidget::close()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FCallback cb_handler
|
||||
, FCallback cb_function
|
||||
, FDataPtr data )
|
||||
{
|
||||
// add a (normal) function pointer as callback
|
||||
callback_data obj{ cb_signal, cb_handler, data };
|
||||
// Add a (normal) function pointer as callback
|
||||
|
||||
callback_data obj{ cb_signal, nullptr, cb_function, data };
|
||||
callback_objects.push_back(obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FWidget* cb_instance
|
||||
, FMemberCallback cb_handler
|
||||
, FWidget* cb_instance
|
||||
, FCallback cb_function
|
||||
, FDataPtr data )
|
||||
{
|
||||
// add a member function pointer as callback
|
||||
member_callback_data obj{ cb_signal, cb_instance, cb_handler, data };
|
||||
member_callback_objects.push_back(obj);
|
||||
// Add a member function pointer as callback
|
||||
|
||||
callback_data obj{ cb_signal, cb_instance, cb_function, data };
|
||||
callback_objects.push_back(obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::delCallback (FCallback cb_handler)
|
||||
void FWidget::delCallback (FCallback cb_function)
|
||||
{
|
||||
// delete a cb_handler function pointer
|
||||
// Delete cb_function form callback list
|
||||
|
||||
if ( callback_objects.empty() )
|
||||
return;
|
||||
|
@ -875,7 +879,7 @@ void FWidget::delCallback (FCallback cb_handler)
|
|||
|
||||
while ( iter != callback_objects.end() )
|
||||
{
|
||||
if ( iter->cb_handler == cb_handler )
|
||||
if ( getCallbackPtr(iter->cb_function) == getCallbackPtr(cb_function) )
|
||||
iter = callback_objects.erase(iter);
|
||||
else
|
||||
++iter;
|
||||
|
@ -885,17 +889,17 @@ void FWidget::delCallback (FCallback cb_handler)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::delCallback (FWidget* cb_instance)
|
||||
{
|
||||
// delete all member function pointer from cb_instance
|
||||
// Delete all member function pointer from cb_instance
|
||||
|
||||
if ( member_callback_objects.empty() )
|
||||
if ( callback_objects.empty() )
|
||||
return;
|
||||
|
||||
auto iter = member_callback_objects.begin();
|
||||
auto iter = callback_objects.begin();
|
||||
|
||||
while ( iter != member_callback_objects.end() )
|
||||
while ( iter != callback_objects.end() )
|
||||
{
|
||||
if ( iter->cb_instance == cb_instance )
|
||||
iter = member_callback_objects.erase(iter);
|
||||
iter = callback_objects.erase(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
@ -904,58 +908,40 @@ void FWidget::delCallback (FWidget* cb_instance)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::delCallbacks()
|
||||
{
|
||||
// delete all callbacks from this widget
|
||||
// Delete all callbacks from this widget
|
||||
|
||||
member_callback_objects.clear(); // member function pointer
|
||||
callback_objects.clear(); // function pointer
|
||||
callback_objects.clear(); // function pointer
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::emitCallback (const FString& emit_signal)
|
||||
{
|
||||
// member function pointer
|
||||
// Initiate callback for the given signal
|
||||
|
||||
if ( ! member_callback_objects.empty() )
|
||||
if ( callback_objects.empty() )
|
||||
return;
|
||||
|
||||
auto iter = callback_objects.begin();
|
||||
auto last = callback_objects.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
auto m_iter = member_callback_objects.begin();
|
||||
auto m_end = member_callback_objects.end();
|
||||
|
||||
while ( m_iter != m_end )
|
||||
if ( iter->cb_signal == emit_signal )
|
||||
{
|
||||
if ( m_iter->cb_signal == emit_signal )
|
||||
{
|
||||
auto callback = m_iter->cb_handler;
|
||||
// call the member function pointer
|
||||
(m_iter->cb_instance->*callback) (this, m_iter->data);
|
||||
}
|
||||
|
||||
++m_iter;
|
||||
// Calling the stored function pointer
|
||||
auto callback = iter->cb_function;
|
||||
callback (this, iter->data);
|
||||
}
|
||||
}
|
||||
|
||||
// function pointer
|
||||
if ( ! callback_objects.empty() )
|
||||
{
|
||||
auto iter = callback_objects.begin();
|
||||
auto last = callback_objects.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( iter->cb_signal == emit_signal )
|
||||
{
|
||||
auto callback = iter->cb_handler;
|
||||
// call the function pointer
|
||||
callback (this, iter->data);
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::addAccelerator (FKey key, FWidget* obj)
|
||||
{
|
||||
// Adding a keyboard accelerator for the given widget
|
||||
|
||||
auto widget = static_cast<FWidget*>(FWindow::getWindowWidget(obj));
|
||||
accelerator accel = { key, obj };
|
||||
|
||||
|
@ -969,6 +955,8 @@ void FWidget::addAccelerator (FKey key, FWidget* obj)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::delAccelerator (FWidget* obj)
|
||||
{
|
||||
// Deletes all accelerators of the given widget
|
||||
|
||||
auto widget = static_cast<FWidget*>(FWindow::getWindowWidget(this));
|
||||
|
||||
if ( ! widget || widget == statusbar || widget == menubar )
|
||||
|
@ -993,6 +981,8 @@ void FWidget::delAccelerator (FWidget* obj)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::redraw()
|
||||
{
|
||||
// Redraw the widget immediately unless it is hidden.
|
||||
|
||||
if ( ! redraw_root_widget )
|
||||
redraw_root_widget = this;
|
||||
|
||||
|
@ -1054,6 +1044,8 @@ void FWidget::resize()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::show()
|
||||
{
|
||||
// Make the widget visible and draw it
|
||||
|
||||
if ( ! isVisible() )
|
||||
return;
|
||||
|
||||
|
@ -1113,6 +1105,8 @@ void FWidget::show()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::hide()
|
||||
{
|
||||
// Hide the widget
|
||||
|
||||
flags.hidden = true;
|
||||
|
||||
if ( isVisible() )
|
||||
|
@ -1477,12 +1471,12 @@ FVTerm::term_area* FWidget::getPrintArea()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::addPreprocessingHandler ( FVTerm* instance
|
||||
, FPreprocessingHandler handler )
|
||||
, FVTermPreprocessing function )
|
||||
{
|
||||
if ( ! getCurrentPrintArea() )
|
||||
FWidget::getPrintArea();
|
||||
|
||||
FVTerm::addPreprocessingHandler (instance, handler);
|
||||
FVTerm::addPreprocessingHandler (instance, function);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2116,6 +2110,12 @@ void FWidget::KeyDownEvent (FKeyEvent* kev)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidget::FCallbackPtr FWidget::getCallbackPtr (FCallback cb_function)
|
||||
{
|
||||
return *cb_function.template target<FCallbackPtr>();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::changeFocus ( FWidget* follower, FWidget* parent
|
||||
, fc::FocusTypes ft )
|
||||
|
|
|
@ -107,7 +107,7 @@ class FApplication : public FWidget
|
|||
FApplication& operator = (const FApplication&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
int getArgc() const;
|
||||
char** getArgv() const;
|
||||
static FApplication* getApplicationObject();
|
||||
|
@ -203,7 +203,7 @@ class FApplication : public FWidget
|
|||
|
||||
// FApplication inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FApplication::getClassName() const
|
||||
inline const FString FApplication::getClassName() const
|
||||
{ return "FApplication"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -82,7 +82,7 @@ class FButton : public FWidget
|
|||
FButton& operator = (const FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
|
@ -178,7 +178,7 @@ class FButton : public FWidget
|
|||
|
||||
// FButton inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FButton::getClassName() const
|
||||
inline const FString FButton::getClassName() const
|
||||
{ return "FButton"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -83,7 +83,7 @@ class FButtonGroup : public FScrollView
|
|||
FButtonGroup& operator = (const FButtonGroup&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FToggleButton* getFirstButton();
|
||||
FToggleButton* getLastButton();
|
||||
FToggleButton* getButton (int) const;
|
||||
|
@ -144,7 +144,7 @@ class FButtonGroup : public FScrollView
|
|||
|
||||
// FButtonGroup inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FButtonGroup::getClassName() const
|
||||
inline const FString FButtonGroup::getClassName() const
|
||||
{ return "FButtonGroup"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -83,20 +83,20 @@ class FCheckBox : public FToggleButton
|
|||
FCheckBox& operator = (const FCheckBox&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init();
|
||||
void draw() override;
|
||||
void drawCheckButton();
|
||||
void drawChecked();
|
||||
void drawUnchecked();
|
||||
void init();
|
||||
void draw() override;
|
||||
void drawCheckButton();
|
||||
void drawChecked();
|
||||
void drawUnchecked();
|
||||
};
|
||||
|
||||
// FCheckBox inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FCheckBox::getClassName() const
|
||||
inline const FString FCheckBox::getClassName() const
|
||||
{ return "FCheckBox"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -83,7 +83,7 @@ class FCheckMenuItem : public FMenuItem
|
|||
FCheckMenuItem& operator = (const FCheckMenuItem&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
|
@ -94,7 +94,7 @@ class FCheckMenuItem : public FMenuItem
|
|||
|
||||
// FCheckMenuItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FCheckMenuItem::getClassName() const
|
||||
inline const FString FCheckMenuItem::getClassName() const
|
||||
{ return "FCheckMenuItem"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#endif
|
||||
|
||||
#include "final/fc.h"
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -72,7 +73,7 @@ class FColorPair
|
|||
}
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const
|
||||
const FString getClassName() const
|
||||
{ return "FColorPair"; }
|
||||
|
||||
FColor getForegroundColor() const
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
|
@ -55,7 +57,7 @@ class FColorPalette final
|
|||
typedef void (*funcp)(FColor, int, int, int);
|
||||
|
||||
// Accessor
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
|
||||
// Methods
|
||||
static void set8ColorPalette (funcp);
|
||||
|
@ -66,7 +68,7 @@ class FColorPalette final
|
|||
|
||||
// FColorPalette inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FColorPalette::getClassName() const
|
||||
inline const FString FColorPalette::getClassName() const
|
||||
{ return "FColorPalette"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -96,7 +96,7 @@ class FDialog : public FWindow
|
|||
FDialog& operator = (const FDialog&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FString getText() const;
|
||||
|
||||
// Mutators
|
||||
|
@ -238,7 +238,7 @@ class FDialog : public FWindow
|
|||
|
||||
// FDialog inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FDialog::getClassName() const
|
||||
inline const FString FDialog::getClassName() const
|
||||
{ return "FDialog"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -89,7 +89,7 @@ class FDialogListMenu : public FMenu
|
|||
FDialogListMenu& operator = (const FDialogListMenu&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
@ -99,7 +99,7 @@ class FDialogListMenu : public FMenu
|
|||
|
||||
// FDialogListMenu inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FDialogListMenu::getClassName() const
|
||||
inline const FString FDialogListMenu::getClassName() const
|
||||
{ return "FDialogListMenu"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -117,7 +117,7 @@ class FFileDialog : public FDialog
|
|||
FFileDialog& operator = (const FFileDialog&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
const FString getPath() const;
|
||||
const FString getFilter() const;
|
||||
const FString getSelectedFile() const;
|
||||
|
@ -174,7 +174,7 @@ class FFileDialog : public FDialog
|
|||
void initCallbacks();
|
||||
bool pattern_match (const char* const, char[]);
|
||||
void clear();
|
||||
long numOfDirs();
|
||||
sInt64 numOfDirs();
|
||||
void sortDir();
|
||||
int readDir();
|
||||
void getEntry (const char* const, struct dirent*);
|
||||
|
@ -216,7 +216,7 @@ class FFileDialog : public FDialog
|
|||
|
||||
// FMessageBox inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FFileDialog::getClassName() const
|
||||
inline const FString FFileDialog::getClassName() const
|
||||
{ return "FFileDialog"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <functional>
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -53,17 +55,21 @@ class FTermLinux;
|
|||
class FKeyboardCommand final
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit FKeyboardCommand ( FApplication* = nullptr
|
||||
, void(FApplication::*)() = nullptr);
|
||||
// Constructors
|
||||
FKeyboardCommand () = default;
|
||||
explicit FKeyboardCommand (std::function<void()> fn)
|
||||
: handler(fn)
|
||||
{ }
|
||||
|
||||
// Method
|
||||
void execute();
|
||||
void execute()
|
||||
{
|
||||
handler();
|
||||
}
|
||||
|
||||
private:
|
||||
// Data members
|
||||
FApplication* instance{nullptr};
|
||||
void (FApplication::*handler)(){nullptr};
|
||||
std::function<void()> handler{};
|
||||
};
|
||||
|
||||
|
||||
|
@ -93,34 +99,34 @@ class FKeyboard final
|
|||
FKeyboard& operator = (const FKeyboard&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
FKey getKey();
|
||||
const FString getKeyName (FKey);
|
||||
keybuffer& getKeyBuffer();
|
||||
timeval* getKeyPressedTime();
|
||||
virtual const FString getClassName() const;
|
||||
FKey getKey();
|
||||
const FString getKeyName (FKey);
|
||||
keybuffer& getKeyBuffer();
|
||||
timeval* getKeyPressedTime();
|
||||
|
||||
// Mutators
|
||||
void setTermcapMap (fc::fkeymap*);
|
||||
void setKeypressTimeout (const uInt64);
|
||||
void enableUTF8();
|
||||
void disableUTF8();
|
||||
void enableMouseSequences();
|
||||
void disableMouseSequences();
|
||||
void setPressCommand (FKeyboardCommand);
|
||||
void setReleaseCommand (FKeyboardCommand);
|
||||
void setEscPressedCommand (FKeyboardCommand);
|
||||
void setTermcapMap (fc::fkeymap*);
|
||||
void setKeypressTimeout (const uInt64);
|
||||
void enableUTF8();
|
||||
void disableUTF8();
|
||||
void enableMouseSequences();
|
||||
void disableMouseSequences();
|
||||
void setPressCommand (FKeyboardCommand);
|
||||
void setReleaseCommand (FKeyboardCommand);
|
||||
void setEscPressedCommand (FKeyboardCommand);
|
||||
|
||||
// Inquiry
|
||||
bool isInputDataPending();
|
||||
bool isInputDataPending();
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
bool& unprocessedInput();
|
||||
bool isKeyPressed();
|
||||
void clearKeyBuffer();
|
||||
void clearKeyBufferOnTimeout();
|
||||
void fetchKeyCode();
|
||||
void escapeKeyHandling();
|
||||
static void init();
|
||||
bool& unprocessedInput();
|
||||
bool isKeyPressed();
|
||||
void clearKeyBuffer();
|
||||
void clearKeyBufferOnTimeout();
|
||||
void fetchKeyCode();
|
||||
void escapeKeyHandling();
|
||||
|
||||
private:
|
||||
// Constants
|
||||
|
@ -128,58 +134,58 @@ class FKeyboard final
|
|||
static constexpr FKey NOT_SET = static_cast<FKey>(-1);
|
||||
|
||||
// Accessors
|
||||
FKey getMouseProtocolKey();
|
||||
FKey getTermcapKey();
|
||||
FKey getMetaKey();
|
||||
FKey getSingleKey();
|
||||
FKey getMouseProtocolKey();
|
||||
FKey getTermcapKey();
|
||||
FKey getMetaKey();
|
||||
FKey getSingleKey();
|
||||
|
||||
// Mutators
|
||||
bool setNonBlockingInput (bool);
|
||||
bool setNonBlockingInput();
|
||||
bool unsetNonBlockingInput();
|
||||
bool setNonBlockingInput (bool);
|
||||
bool setNonBlockingInput();
|
||||
bool unsetNonBlockingInput();
|
||||
|
||||
// Inquiry
|
||||
static bool isKeypressTimeout();
|
||||
static bool isKeypressTimeout();
|
||||
|
||||
// Methods
|
||||
FKey UTF8decode (const char[]);
|
||||
ssize_t readKey();
|
||||
void parseKeyBuffer();
|
||||
FKey parseKeyString();
|
||||
FKey keyCorrection (const FKey&);
|
||||
void substringKeyHandling();
|
||||
void keyPressed();
|
||||
void keyReleased();
|
||||
void escapeKeyPressed();
|
||||
FKey UTF8decode (const char[]);
|
||||
ssize_t readKey();
|
||||
void parseKeyBuffer();
|
||||
FKey parseKeyString();
|
||||
FKey keyCorrection (const FKey&);
|
||||
void substringKeyHandling();
|
||||
void keyPressed();
|
||||
void keyReleased();
|
||||
void escapeKeyPressed();
|
||||
|
||||
// Data members
|
||||
FKeyboardCommand keypressed_cmd{};
|
||||
FKeyboardCommand keyreleased_cmd{};
|
||||
FKeyboardCommand escape_key_cmd{};
|
||||
FKeyboardCommand keypressed_cmd{};
|
||||
FKeyboardCommand keyreleased_cmd{};
|
||||
FKeyboardCommand escape_key_cmd{};
|
||||
|
||||
#if defined(__linux__)
|
||||
#undef linux
|
||||
static FTermLinux* linux;
|
||||
static FTermLinux* linux;
|
||||
#endif
|
||||
|
||||
static timeval time_keypressed;
|
||||
static uInt64 key_timeout;
|
||||
fc::fkeymap* key_map{nullptr};
|
||||
FKey key{0};
|
||||
char read_buf[READ_BUF_SIZE]{'\0'};
|
||||
char fifo_buf[FIFO_BUF_SIZE]{'\0'};
|
||||
int fifo_offset{0};
|
||||
int stdin_status_flags{0};
|
||||
bool fifo_in_use{false};
|
||||
bool input_data_pending{false};
|
||||
bool utf8_input{false};
|
||||
bool mouse_support{true};
|
||||
bool non_blocking_stdin{false};
|
||||
static timeval time_keypressed;
|
||||
static uInt64 key_timeout;
|
||||
fc::fkeymap* key_map{nullptr};
|
||||
FKey key{0};
|
||||
char read_buf[READ_BUF_SIZE]{'\0'};
|
||||
char fifo_buf[FIFO_BUF_SIZE]{'\0'};
|
||||
int fifo_offset{0};
|
||||
int stdin_status_flags{0};
|
||||
bool fifo_in_use{false};
|
||||
bool input_data_pending{false};
|
||||
bool utf8_input{false};
|
||||
bool mouse_support{true};
|
||||
bool non_blocking_stdin{false};
|
||||
};
|
||||
|
||||
// FKeyboard inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FKeyboard::getClassName() const
|
||||
inline const FString FKeyboard::getClassName() const
|
||||
{ return "FKeyboard"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -98,7 +98,7 @@ class FLabel : public FWidget
|
|||
const FLabel& operator >> (FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FWidget* getAccelWidget();
|
||||
fc::text_alignment getAlignment();
|
||||
FString& getText();
|
||||
|
@ -165,7 +165,7 @@ class FLabel : public FWidget
|
|||
|
||||
// FLabel inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FLabel::getClassName() const
|
||||
inline const FString FLabel::getClassName() const
|
||||
{ return "FLabel"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#endif
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "final/fwidget.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -106,7 +108,7 @@ class FLineEdit : public FWidget
|
|||
const FLineEdit& operator >> (FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FString getText() const;
|
||||
std::size_t getMaxLength() const;
|
||||
std::size_t getCursorPosition() const;
|
||||
|
@ -210,7 +212,7 @@ class FLineEdit : public FWidget
|
|||
|
||||
// FLineEdit inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FLineEdit::getClassName() const
|
||||
inline const FString FLineEdit::getClassName() const
|
||||
{ return "FLineEdit"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -53,7 +53,7 @@ e Copyright 2014-2019 Markus Gans *
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fscrollbar.h"
|
||||
|
@ -86,32 +86,32 @@ class FListBoxItem
|
|||
FListBoxItem& operator = (const FListBoxItem&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual FString& getText();
|
||||
virtual FDataPtr getData() const;
|
||||
virtual const FString getClassName() const;
|
||||
virtual FString& getText();
|
||||
virtual FDataPtr getData() const;
|
||||
|
||||
// Mutators
|
||||
void setText (const FString&);
|
||||
void setData (FDataPtr);
|
||||
void setText (const FString&);
|
||||
void setData (FDataPtr);
|
||||
|
||||
// Methods
|
||||
void clear();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
// Data members
|
||||
FString text{};
|
||||
FDataPtr data_pointer{nullptr};
|
||||
fc::brackets_type brackets{fc::NoBrackets};
|
||||
bool selected{false};
|
||||
|
||||
// Friend classes
|
||||
friend class FListBox;
|
||||
|
||||
// Data members
|
||||
FString text{};
|
||||
FDataPtr data_pointer{nullptr};
|
||||
fc::brackets_type brackets{fc::NoBrackets};
|
||||
bool selected{false};
|
||||
};
|
||||
|
||||
|
||||
// FListBoxItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListBoxItem::getClassName() const
|
||||
inline const FString FListBoxItem::getClassName() const
|
||||
{ return "FListBoxItem"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -165,7 +165,7 @@ class FListBox : public FWidget
|
|||
FListBox& operator = (const FListBox&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
std::size_t getCount() const;
|
||||
FListBoxItem getItem (std::size_t);
|
||||
FListBoxItem getItem (listBoxItems::iterator) const;
|
||||
|
@ -238,6 +238,11 @@ class FListBox : public FWidget
|
|||
void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
||||
typedef std::unordered_map<int, std::function<bool()>> keyMapResult;
|
||||
typedef std::function<void(FListBoxItem&, FDataPtr, int)> lazyInsert;
|
||||
|
||||
// Enumeration
|
||||
enum convert_type
|
||||
{
|
||||
|
@ -255,6 +260,8 @@ class FListBox : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void mapKeyFunctions();
|
||||
void processKeyAction (FKeyEvent*);
|
||||
void draw() override;
|
||||
void drawBorder() override;
|
||||
void drawScrollbars();
|
||||
|
@ -310,9 +317,7 @@ class FListBox : public FWidget
|
|||
void cb_HBarChange (FWidget*, FDataPtr);
|
||||
|
||||
// Function Pointer
|
||||
void (*convertToItem) ( FListBoxItem&
|
||||
, FDataPtr
|
||||
, int index ){nullptr};
|
||||
lazyInsert lazy_inserter{};
|
||||
|
||||
// Data members
|
||||
listBoxItems itemlist{};
|
||||
|
@ -321,6 +326,8 @@ class FListBox : public FWidget
|
|||
FScrollbarPtr hbar{nullptr};
|
||||
FString text{};
|
||||
FString inc_search{};
|
||||
keyMap key_map{};
|
||||
keyMapResult key_map_result{};
|
||||
convert_type conv_type{FListBox::no_convert};
|
||||
fc::dragScroll drag_scroll{fc::noScroll};
|
||||
int scroll_repeat{100};
|
||||
|
@ -369,7 +376,7 @@ inline FListBox::FListBox ( Container container
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListBox::getClassName() const
|
||||
inline const FString FListBox::getClassName() const
|
||||
{ return "FListBox"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -488,7 +495,7 @@ void FListBox::insert (Container container, LazyConverter convert)
|
|||
{
|
||||
conv_type = lazy_convert;
|
||||
source_container = container;
|
||||
convertToItem = convert;
|
||||
lazy_inserter = convert;
|
||||
std::size_t size = container->size();
|
||||
|
||||
if ( size > 0 )
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
|
@ -90,7 +89,7 @@ class FListViewItem : public FObject
|
|||
FListViewItem& operator = (const FListViewItem&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
uInt getColumnCount() const;
|
||||
int getSortColumn() const;
|
||||
FString getText (int) const;
|
||||
|
@ -144,7 +143,7 @@ class FListViewItem : public FObject
|
|||
|
||||
// FListViewItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListViewItem::getClassName() const
|
||||
inline const FString FListViewItem::getClassName() const
|
||||
{ return "FListViewItem"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -209,7 +208,7 @@ class FListViewIterator
|
|||
bool operator != (const FListViewIterator&) const;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
int getPosition() const;
|
||||
|
||||
// Methods
|
||||
|
@ -245,7 +244,7 @@ inline bool FListViewIterator::operator != (const FListViewIterator& rhs) const
|
|||
{ return node != rhs.node; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListViewIterator::getClassName() const
|
||||
inline const FString FListViewIterator::getClassName() const
|
||||
{ return "FListViewIterator"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -276,7 +275,7 @@ class FListView : public FWidget
|
|||
FListView& operator = (const FListView&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
std::size_t getCount();
|
||||
fc::text_alignment getColumnAlignment (int) const;
|
||||
FString getColumnText (int) const;
|
||||
|
@ -360,6 +359,10 @@ class FListView : public FWidget
|
|||
void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
||||
typedef std::unordered_map<int, std::function<bool()>> keyMapResult;
|
||||
|
||||
// Constants
|
||||
static constexpr std::size_t checkbox_space = 4;
|
||||
|
||||
|
@ -377,6 +380,8 @@ class FListView : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void mapKeyFunctions();
|
||||
void processKeyAction (FKeyEvent*);
|
||||
template <typename Compare>
|
||||
void sort (Compare);
|
||||
std::size_t getAlignOffset ( fc::text_alignment
|
||||
|
@ -415,8 +420,8 @@ class FListView : public FWidget
|
|||
void processClick();
|
||||
void processChanged();
|
||||
void toggleCheckbox();
|
||||
void collapseAndScrollLeft (int&);
|
||||
void expandAndScrollRight (int&);
|
||||
void collapseAndScrollLeft();
|
||||
void expandAndScrollRight();
|
||||
void firstPos();
|
||||
void lastPos();
|
||||
bool expandSubtree();
|
||||
|
@ -451,10 +456,13 @@ class FListView : public FWidget
|
|||
sortTypes sort_type{};
|
||||
FPoint clicked_expander_pos{-1, -1};
|
||||
FPoint clicked_header_pos{-1, -1};
|
||||
keyMap key_map{};
|
||||
keyMapResult key_map_result{};
|
||||
const FListViewItem* clicked_checkbox_item{nullptr};
|
||||
std::size_t nf_offset{0};
|
||||
std::size_t max_line_width{1};
|
||||
fc::dragScroll drag_scroll{fc::noScroll};
|
||||
int first_line_position_before{-1};
|
||||
int scroll_repeat{100};
|
||||
int scroll_distance{1};
|
||||
int xoffset{0};
|
||||
|
@ -492,7 +500,7 @@ struct FListView::Header
|
|||
|
||||
// FListView inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListView::getClassName() const
|
||||
inline const FString FListView::getClassName() const
|
||||
{ return "FListView"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
FMenu& operator = (const FMenu&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FString getText() const;
|
||||
FMenuItem* getItem();
|
||||
|
||||
|
@ -237,7 +237,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
|
||||
// FMenu inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMenu::getClassName() const
|
||||
inline const FString FMenu::getClassName() const
|
||||
{ return "FMenu"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -88,22 +88,22 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
FMenuBar& operator = (const FMenuBar&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Methods
|
||||
void resetMenu();
|
||||
void hide() override;
|
||||
void adjustSize() override;
|
||||
void resetMenu();
|
||||
void hide() override;
|
||||
void adjustSize() override;
|
||||
|
||||
// Event handlers
|
||||
void onKeyPress (FKeyEvent*) override;
|
||||
void onMouseDown (FMouseEvent*) override;
|
||||
void onMouseUp (FMouseEvent*) override;
|
||||
void onMouseMove (FMouseEvent*) override;
|
||||
void onAccel (FAccelEvent*) override;
|
||||
void onKeyPress (FKeyEvent*) override;
|
||||
void onMouseDown (FMouseEvent*) override;
|
||||
void onMouseUp (FMouseEvent*) override;
|
||||
void onMouseMove (FMouseEvent*) override;
|
||||
void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_item_deactivated (FWidget*, FDataPtr);
|
||||
void cb_item_deactivated (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
|
@ -119,49 +119,49 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
} menuText;
|
||||
|
||||
// Inquiry
|
||||
bool isMenu (const FMenuItem*) const;
|
||||
bool isMenu (const FMenuItem*) const;
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
void calculateDimensions();
|
||||
bool selectNextItem();
|
||||
bool selectPrevItem();
|
||||
bool hotkeyMenu (FKeyEvent*&);
|
||||
void draw() override;
|
||||
void drawItems();
|
||||
void drawItem (FMenuItem*, std::size_t&);
|
||||
void setLineAttributes (FMenuItem*);
|
||||
void setCursorToHotkeyPosition (FMenuItem*, std::size_t);
|
||||
void drawMenuText (menuText&);
|
||||
void drawEllipsis (const menuText&, std::size_t);
|
||||
void drawLeadingSpace (std::size_t&);
|
||||
void drawTrailingSpace (std::size_t&);
|
||||
void adjustItems();
|
||||
bool activateMenu (FMenuItem*);
|
||||
bool clickItem (FMenuItem*);
|
||||
void unselectMenuItem (FMenuItem*);
|
||||
void selectMenuItem (FMenuItem*);
|
||||
void mouseDownOverList (const FMouseEvent*);
|
||||
void mouseUpOverList (const FMouseEvent*);
|
||||
void mouseMoveOverList (const FMouseEvent*);
|
||||
void passEventToMenu (const FMouseEvent*&);
|
||||
void leaveMenuBar();
|
||||
void init();
|
||||
void calculateDimensions();
|
||||
bool selectNextItem();
|
||||
bool selectPrevItem();
|
||||
bool hotkeyMenu (FKeyEvent*&);
|
||||
void draw() override;
|
||||
void drawItems();
|
||||
void drawItem (FMenuItem*, std::size_t&);
|
||||
void setLineAttributes (FMenuItem*);
|
||||
void setCursorToHotkeyPosition (FMenuItem*, std::size_t);
|
||||
void drawMenuText (menuText&);
|
||||
void drawEllipsis (const menuText&, std::size_t);
|
||||
void drawLeadingSpace (std::size_t&);
|
||||
void drawTrailingSpace (std::size_t&);
|
||||
void adjustItems();
|
||||
bool activateMenu (FMenuItem*);
|
||||
bool clickItem (FMenuItem*);
|
||||
void unselectMenuItem (FMenuItem*);
|
||||
void selectMenuItem (FMenuItem*);
|
||||
void mouseDownOverList (const FMouseEvent*);
|
||||
void mouseUpOverList (const FMouseEvent*);
|
||||
void mouseMoveOverList (const FMouseEvent*);
|
||||
void passEventToMenu (const FMouseEvent*&);
|
||||
void leaveMenuBar();
|
||||
|
||||
// Friend classes
|
||||
friend class FMenu;
|
||||
friend class FMenuItem;
|
||||
|
||||
// Data members
|
||||
std::size_t screenWidth{80};
|
||||
bool mouse_down{false};
|
||||
bool drop_down{false};
|
||||
bool focus_changed{false};
|
||||
std::size_t screenWidth{80};
|
||||
bool mouse_down{false};
|
||||
bool drop_down{false};
|
||||
bool focus_changed{false};
|
||||
};
|
||||
|
||||
|
||||
// FMenuBar inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMenuBar::getClassName() const
|
||||
inline const FString FMenuBar::getClassName() const
|
||||
{ return "FMenuBar"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -93,7 +93,7 @@ class FMenuItem : public FWidget
|
|||
FMenuItem& operator = (const FMenuItem&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FKey getHotkey() const;
|
||||
FMenu* getMenu() const;
|
||||
std::size_t getTextLength() const;
|
||||
|
@ -199,7 +199,7 @@ class FMenuItem : public FWidget
|
|||
|
||||
// FMenuItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMenuItem::getClassName() const
|
||||
inline const FString FMenuItem::getClassName() const
|
||||
{ return "FMenuItem"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -71,7 +71,7 @@ class FMenuList
|
|||
FMenuList& operator = (const FMenuList&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
std::size_t getCount() const;
|
||||
FMenuItem* getItem (int) const;
|
||||
FMenuItem* getSelectedItem() const;
|
||||
|
@ -104,7 +104,7 @@ class FMenuList
|
|||
|
||||
// FMenuList inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMenuList::getClassName() const
|
||||
inline const FString FMenuList::getClassName() const
|
||||
{ return "FMenuList"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -106,7 +106,7 @@ class FMessageBox : public FDialog
|
|||
FMessageBox& operator = (const FMessageBox&);
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
const FString getTitlebarText() const;
|
||||
const FString getHeadline() const;
|
||||
const FString getText() const;
|
||||
|
@ -168,7 +168,7 @@ class FMessageBox : public FDialog
|
|||
|
||||
// FMessageBox inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMessageBox::getClassName() const
|
||||
inline const FString FMessageBox::getClassName() const
|
||||
{ return "FMessageBox"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -102,38 +102,38 @@ class FMouse
|
|||
{ }
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
FPoint& getPos();
|
||||
void clearEvent();
|
||||
virtual const FString getClassName() const;
|
||||
FPoint& getPos();
|
||||
void clearEvent();
|
||||
|
||||
// Mutators
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
|
||||
// Inquiries
|
||||
virtual bool hasData() = 0;
|
||||
bool hasEvent();
|
||||
bool isLeftButtonPressed();
|
||||
bool isLeftButtonReleased();
|
||||
bool isLeftButtonDoubleClick();
|
||||
bool isRightButtonPressed();
|
||||
bool isRightButtonReleased();
|
||||
bool isMiddleButtonPressed();
|
||||
bool isMiddleButtonReleased();
|
||||
bool isShiftKeyPressed();
|
||||
bool isControlKeyPressed();
|
||||
bool isMetaKeyPressed();
|
||||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending();
|
||||
virtual bool hasData() = 0;
|
||||
bool hasEvent();
|
||||
bool isLeftButtonPressed();
|
||||
bool isLeftButtonReleased();
|
||||
bool isLeftButtonDoubleClick();
|
||||
bool isRightButtonPressed();
|
||||
bool isRightButtonReleased();
|
||||
bool isMiddleButtonPressed();
|
||||
bool isMiddleButtonReleased();
|
||||
bool isShiftKeyPressed();
|
||||
bool isControlKeyPressed();
|
||||
bool isMetaKeyPressed();
|
||||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending();
|
||||
|
||||
// Methods
|
||||
static FMouse* createMouseObject (mouse_type);
|
||||
void clearButtonState();
|
||||
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
||||
virtual void processEvent (struct timeval*) = 0;
|
||||
static FMouse* createMouseObject (mouse_type);
|
||||
void clearButtonState();
|
||||
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
||||
virtual void processEvent (struct timeval*) = 0;
|
||||
|
||||
protected:
|
||||
// Typedef and Enumerations
|
||||
|
@ -207,7 +207,7 @@ class FMouseGPM final : public FMouse
|
|||
virtual ~FMouseGPM();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Mutators
|
||||
void setStdinNo(int);
|
||||
|
@ -275,7 +275,7 @@ class FMouseX11 final : public FMouse
|
|||
virtual ~FMouseX11() = default;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
bool hasData() override;
|
||||
|
@ -334,14 +334,14 @@ class FMouseSGR final : public FMouse
|
|||
virtual ~FMouseSGR() = default;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
bool hasData() override;
|
||||
bool hasData() override;
|
||||
|
||||
// Methods
|
||||
void setRawData (FKeyboard::keybuffer&) override;
|
||||
void processEvent (struct timeval*) override;
|
||||
void setRawData (FKeyboard::keybuffer&) override;
|
||||
void processEvent (struct timeval*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -368,10 +368,10 @@ class FMouseSGR final : public FMouse
|
|||
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||
|
||||
// Methods
|
||||
void setKeyState (int);
|
||||
void setMoveState (const FPoint&, int);
|
||||
void setPressedButtonState (int, struct timeval*);
|
||||
void setReleasedButtonState (int);
|
||||
void setKeyState (int);
|
||||
void setMoveState (const FPoint&, int);
|
||||
void setPressedButtonState (int, struct timeval*);
|
||||
void setReleasedButtonState (int);
|
||||
|
||||
// Data members
|
||||
char sgr_mouse[MOUSE_BUF_SIZE]{'\0'};
|
||||
|
@ -393,14 +393,14 @@ class FMouseUrxvt final : public FMouse
|
|||
virtual ~FMouseUrxvt() = default;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
bool hasData() override;
|
||||
bool hasData() override;
|
||||
|
||||
// Methods
|
||||
void setRawData (FKeyboard::keybuffer&) override;
|
||||
void processEvent (struct timeval*) override;
|
||||
void setRawData (FKeyboard::keybuffer&) override;
|
||||
void processEvent (struct timeval*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -428,9 +428,9 @@ class FMouseUrxvt final : public FMouse
|
|||
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||
|
||||
// Methods
|
||||
void setKeyState (int);
|
||||
void setMoveState (const FPoint&, int);
|
||||
void setButtonState (int, struct timeval*);
|
||||
void setKeyState (int);
|
||||
void setMoveState (const FPoint&, int);
|
||||
void setButtonState (int, struct timeval*);
|
||||
|
||||
// Data members
|
||||
char urxvt_mouse[MOUSE_BUF_SIZE]{'\0'};
|
||||
|
@ -452,67 +452,67 @@ class FMouseControl
|
|||
virtual ~FMouseControl();
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
FPoint& getPos();
|
||||
void clearEvent();
|
||||
virtual const FString getClassName() const;
|
||||
FPoint& getPos();
|
||||
void clearEvent();
|
||||
|
||||
// Mutators
|
||||
void setStdinNo (int);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
void useGpmMouse (bool = true);
|
||||
void useXtermMouse (bool = true);
|
||||
void setStdinNo (int);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
void useGpmMouse (bool = true);
|
||||
void useXtermMouse (bool = true);
|
||||
|
||||
// Inquiries
|
||||
bool hasData();
|
||||
bool hasEvent();
|
||||
bool isLeftButtonPressed();
|
||||
bool isLeftButtonReleased();
|
||||
bool isLeftButtonDoubleClick();
|
||||
bool isRightButtonPressed();
|
||||
bool isRightButtonReleased();
|
||||
bool isMiddleButtonPressed();
|
||||
bool isMiddleButtonReleased();
|
||||
bool isShiftKeyPressed();
|
||||
bool isControlKeyPressed();
|
||||
bool isMetaKeyPressed();
|
||||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending();
|
||||
bool isGpmMouseEnabled();
|
||||
bool hasData();
|
||||
bool hasEvent();
|
||||
bool isLeftButtonPressed();
|
||||
bool isLeftButtonReleased();
|
||||
bool isLeftButtonDoubleClick();
|
||||
bool isRightButtonPressed();
|
||||
bool isRightButtonReleased();
|
||||
bool isMiddleButtonPressed();
|
||||
bool isMiddleButtonReleased();
|
||||
bool isShiftKeyPressed();
|
||||
bool isControlKeyPressed();
|
||||
bool isMetaKeyPressed();
|
||||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending();
|
||||
bool isGpmMouseEnabled();
|
||||
|
||||
// Methods
|
||||
void enable();
|
||||
void disable();
|
||||
virtual void setRawData ( FMouse::mouse_type
|
||||
, FKeyboard::keybuffer& );
|
||||
virtual void processEvent (struct timeval* time);
|
||||
bool getGpmKeyPressed (bool);
|
||||
void drawGpmPointer();
|
||||
void enable();
|
||||
void disable();
|
||||
virtual void setRawData ( FMouse::mouse_type
|
||||
, FKeyboard::keybuffer& );
|
||||
virtual void processEvent (struct timeval* time);
|
||||
bool getGpmKeyPressed (bool);
|
||||
void drawGpmPointer();
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::map<FMouse::mouse_type, FMouse*> FMouseProtocol;
|
||||
|
||||
// Accessor
|
||||
FMouse* getMouseWithData();
|
||||
FMouse* getMouseWithEvent();
|
||||
void xtermMouse (bool);
|
||||
void enableXTermMouse();
|
||||
void disableXTermMouse();
|
||||
FMouse* getMouseWithData();
|
||||
FMouse* getMouseWithEvent();
|
||||
void xtermMouse (bool);
|
||||
void enableXTermMouse();
|
||||
void disableXTermMouse();
|
||||
|
||||
// Data member
|
||||
FMouseProtocol mouse_protocol{};
|
||||
FPoint zero_point{0, 0};
|
||||
bool use_gpm_mouse{false};
|
||||
bool use_xterm_mouse{false};
|
||||
FMouseProtocol mouse_protocol{};
|
||||
FPoint zero_point{0, 0};
|
||||
bool use_gpm_mouse{false};
|
||||
bool use_xterm_mouse{false};
|
||||
};
|
||||
|
||||
// FMouseControl inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FMouseControl::getClassName() const
|
||||
inline const FString FMouseControl::getClassName() const
|
||||
{ return "FMouseControl"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -89,41 +89,41 @@ class FObject
|
|||
FObject& operator = (const FObject&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
FObject* getParent() const;
|
||||
FObject* getChild (int) const;
|
||||
FObjectList& getChildren();
|
||||
const FObjectList& getChildren() const;
|
||||
int numOfChildren() const;
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
virtual const FString getClassName() const;
|
||||
FObject* getParent() const;
|
||||
FObject* getChild (int) const;
|
||||
FObjectList& getChildren();
|
||||
const FObjectList& getChildren() const;
|
||||
int numOfChildren() const;
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
// Inquiries
|
||||
bool hasParent() const;
|
||||
bool hasChildren() const;
|
||||
bool isChild (const FObject*) const;
|
||||
bool isDirectChild (const FObject*) const;
|
||||
bool isWidget() const;
|
||||
bool isInstanceOf (const char[]) const;
|
||||
bool isTimerInUpdating() const;
|
||||
bool hasParent() const;
|
||||
bool hasChildren() const;
|
||||
bool isChild (const FObject*) const;
|
||||
bool isDirectChild (const FObject*) const;
|
||||
bool isWidget() const;
|
||||
bool isInstanceOf (const FString&) const;
|
||||
bool isTimerInUpdating() const;
|
||||
|
||||
// Methods
|
||||
void removeParent();
|
||||
void addChild (FObject*);
|
||||
void delChild (FObject*);
|
||||
void removeParent();
|
||||
void addChild (FObject*);
|
||||
void delChild (FObject*);
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
virtual bool event (FEvent*);
|
||||
|
||||
// Timer methods
|
||||
static void getCurrentTime (timeval*);
|
||||
static bool isTimeout (timeval*, uInt64);
|
||||
int addTimer (int);
|
||||
bool delTimer (int);
|
||||
bool delOwnTimer();
|
||||
bool delAllTimer();
|
||||
static void getCurrentTime (timeval*);
|
||||
static bool isTimeout (timeval*, uInt64);
|
||||
int addTimer (int);
|
||||
bool delTimer (int);
|
||||
bool delOwnTimer();
|
||||
bool delAllTimer();
|
||||
|
||||
protected:
|
||||
struct timer_data
|
||||
|
@ -138,34 +138,35 @@ class FObject
|
|||
typedef std::vector<timer_data> TimerList;
|
||||
|
||||
// Accessor
|
||||
TimerList* getTimerList() const;
|
||||
TimerList* getTimerList() const;
|
||||
|
||||
// Mutator
|
||||
void setWidgetProperty (bool);
|
||||
void setWidgetProperty (bool);
|
||||
|
||||
// Method
|
||||
uInt processTimerEvent();
|
||||
uInt processTimerEvent();
|
||||
|
||||
// Event handler
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onUserEvent (FUserEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onUserEvent (FUserEvent*);
|
||||
|
||||
private:
|
||||
// Method
|
||||
virtual void performTimerAction (const FObject*, const FEvent*);
|
||||
virtual void performTimerAction ( const FObject*
|
||||
, const FEvent* );
|
||||
|
||||
// Data members
|
||||
FObject* parent_obj{nullptr};
|
||||
FObjectList children_list{}; // no children yet
|
||||
bool has_parent{false};
|
||||
bool widget_object{false};
|
||||
static bool timer_modify_lock;
|
||||
static TimerList* timer_list;
|
||||
FObject* parent_obj{nullptr};
|
||||
FObjectList children_list{}; // no children yet
|
||||
bool has_parent{false};
|
||||
bool widget_object{false};
|
||||
static bool timer_modify_lock;
|
||||
static TimerList* timer_list;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FObject::getClassName() const
|
||||
inline const FString FObject::getClassName() const
|
||||
{ return "FObject"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -217,8 +218,8 @@ inline bool FObject::isWidget() const
|
|||
{ return widget_object; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FObject::isInstanceOf (const char classname[]) const
|
||||
{ return ( classname ) ? bool(strcmp(classname, getClassName()) == 0) : false; }
|
||||
inline bool FObject::isInstanceOf (const FString& classname) const
|
||||
{ return bool( classname == getClassName() ); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FObject::isTimerInUpdating() const
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
|
||||
#include <algorithm> // need for std::swap
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
|
@ -128,7 +130,7 @@ class FOptiAttr final
|
|||
friend bool operator != (const charData&, const charData&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
|
||||
// Mutators
|
||||
void setTermEnvironment (termEnv&);
|
||||
|
@ -353,7 +355,7 @@ inline bool operator != ( const charData& lhs,
|
|||
{ return ! ( lhs == rhs ); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FOptiAttr::getClassName() const
|
||||
inline const FString FOptiAttr::getClassName() const
|
||||
{ return "FOptiAttr"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
|
@ -107,59 +109,59 @@ class FOptiMove final
|
|||
virtual ~FOptiMove();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
uInt getCursorHomeLength() const;
|
||||
uInt getCarriageReturnLength() const;
|
||||
uInt getCursorToLLLength() const;
|
||||
uInt getTabLength() const;
|
||||
uInt getBackTabLength() const;
|
||||
uInt getCursorUpLength() const;
|
||||
uInt getCursorDownLength() const;
|
||||
uInt getCursorLeftLength() const;
|
||||
uInt getCursorRightLength() const;
|
||||
uInt getCursorAddressLength() const;
|
||||
uInt getColumnAddressLength() const;
|
||||
uInt getRowAddressLength() const;
|
||||
uInt getParmUpCursorLength() const;
|
||||
uInt getParmDownCursorLength() const;
|
||||
uInt getParmLeftCursorLength() const;
|
||||
uInt getParmRightCursorLength() const;
|
||||
uInt getEraseCharsLength() const;
|
||||
uInt getRepeatCharLength() const;
|
||||
uInt getClrBolLength() const;
|
||||
uInt getClrEolLength() const;
|
||||
const FString getClassName() const;
|
||||
uInt getCursorHomeLength() const;
|
||||
uInt getCarriageReturnLength() const;
|
||||
uInt getCursorToLLLength() const;
|
||||
uInt getTabLength() const;
|
||||
uInt getBackTabLength() const;
|
||||
uInt getCursorUpLength() const;
|
||||
uInt getCursorDownLength() const;
|
||||
uInt getCursorLeftLength() const;
|
||||
uInt getCursorRightLength() const;
|
||||
uInt getCursorAddressLength() const;
|
||||
uInt getColumnAddressLength() const;
|
||||
uInt getRowAddressLength() const;
|
||||
uInt getParmUpCursorLength() const;
|
||||
uInt getParmDownCursorLength() const;
|
||||
uInt getParmLeftCursorLength() const;
|
||||
uInt getParmRightCursorLength() const;
|
||||
uInt getEraseCharsLength() const;
|
||||
uInt getRepeatCharLength() const;
|
||||
uInt getClrBolLength() const;
|
||||
uInt getClrEolLength() const;
|
||||
|
||||
// Mutators
|
||||
void setBaudRate (int);
|
||||
void setTabStop (int);
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
void setTermEnvironment (termEnv&);
|
||||
void set_cursor_home (char[]);
|
||||
void set_cursor_to_ll (char[]);
|
||||
void set_carriage_return (char[]);
|
||||
void set_tabular (char[]);
|
||||
void set_back_tab (char[]);
|
||||
void set_cursor_up (char[]);
|
||||
void set_cursor_down (char[]);
|
||||
void set_cursor_left (char[]);
|
||||
void set_cursor_right (char[]);
|
||||
void set_cursor_address (char[]);
|
||||
void set_column_address (char[]);
|
||||
void set_row_address (char[]);
|
||||
void set_parm_up_cursor (char[]);
|
||||
void set_parm_down_cursor (char[]);
|
||||
void set_parm_left_cursor (char[]);
|
||||
void set_parm_right_cursor (char[]);
|
||||
void set_erase_chars (char[]);
|
||||
void set_repeat_char (char[]);
|
||||
void set_clr_bol (char[]);
|
||||
void set_clr_eol (char[]);
|
||||
void set_auto_left_margin (bool);
|
||||
void set_eat_newline_glitch (bool);
|
||||
void setBaudRate (int);
|
||||
void setTabStop (int);
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
void setTermEnvironment (termEnv&);
|
||||
void set_cursor_home (char[]);
|
||||
void set_cursor_to_ll (char[]);
|
||||
void set_carriage_return (char[]);
|
||||
void set_tabular (char[]);
|
||||
void set_back_tab (char[]);
|
||||
void set_cursor_up (char[]);
|
||||
void set_cursor_down (char[]);
|
||||
void set_cursor_left (char[]);
|
||||
void set_cursor_right (char[]);
|
||||
void set_cursor_address (char[]);
|
||||
void set_column_address (char[]);
|
||||
void set_row_address (char[]);
|
||||
void set_parm_up_cursor (char[]);
|
||||
void set_parm_down_cursor (char[]);
|
||||
void set_parm_left_cursor (char[]);
|
||||
void set_parm_right_cursor (char[]);
|
||||
void set_erase_chars (char[]);
|
||||
void set_repeat_char (char[]);
|
||||
void set_clr_bol (char[]);
|
||||
void set_clr_eol (char[]);
|
||||
void set_auto_left_margin (bool);
|
||||
void set_eat_newline_glitch (bool);
|
||||
|
||||
// Methods
|
||||
void check_boundaries (int&, int&, int&, int&);
|
||||
char* moveCursor (int, int, int, int);
|
||||
void check_boundaries (int&, int&, int&, int&);
|
||||
char* moveCursor (int, int, int, int);
|
||||
|
||||
private:
|
||||
// Constant
|
||||
|
@ -180,66 +182,66 @@ class FOptiMove final
|
|||
// maximum character distance to avoid direct cursor addressing
|
||||
|
||||
// Methods
|
||||
void calculateCharDuration();
|
||||
int capDuration (char[], int);
|
||||
int capDurationToLength (int);
|
||||
int repeatedAppend (const capability&, volatile int, char*);
|
||||
int relativeMove (char[], int, int, int, int);
|
||||
int verticalMove (char[], int, int);
|
||||
void downMove (char[], int&, int, int);
|
||||
void upMove (char[], int&, int, int);
|
||||
int horizontalMove (char[], int, int);
|
||||
void rightMove (char[], int&, int, int);
|
||||
void leftMove (char[], int&, int, int);
|
||||
void calculateCharDuration();
|
||||
int capDuration (char[], int);
|
||||
int capDurationToLength (int);
|
||||
int repeatedAppend (const capability&, volatile int, char*);
|
||||
int relativeMove (char[], int, int, int, int);
|
||||
int verticalMove (char[], int, int);
|
||||
void downMove (char[], int&, int, int);
|
||||
void upMove (char[], int&, int, int);
|
||||
int horizontalMove (char[], int, int);
|
||||
void rightMove (char[], int&, int, int);
|
||||
void leftMove (char[], int&, int, int);
|
||||
|
||||
bool isWideMove (int, int, int, int);
|
||||
bool isMethod0Faster (int&, int, int);
|
||||
bool isMethod1Faster (int&, int, int, int, int);
|
||||
bool isMethod2Faster (int&, int, int, int);
|
||||
bool isMethod3Faster (int&, int, int);
|
||||
bool isMethod4Faster (int&, int, int);
|
||||
bool isMethod5Faster (int&, int, int, int);
|
||||
void moveByMethod (int, int, int, int, int);
|
||||
bool isWideMove (int, int, int, int);
|
||||
bool isMethod0Faster (int&, int, int);
|
||||
bool isMethod1Faster (int&, int, int, int, int);
|
||||
bool isMethod2Faster (int&, int, int, int);
|
||||
bool isMethod3Faster (int&, int, int);
|
||||
bool isMethod4Faster (int&, int, int);
|
||||
bool isMethod5Faster (int&, int, int, int);
|
||||
void moveByMethod (int, int, int, int, int);
|
||||
|
||||
// Friend function
|
||||
friend void printDurations (const FOptiMove&);
|
||||
friend void printDurations (const FOptiMove&);
|
||||
|
||||
// Data members
|
||||
capability F_cursor_home{};
|
||||
capability F_carriage_return{};
|
||||
capability F_cursor_to_ll{};
|
||||
capability F_tab{};
|
||||
capability F_back_tab{};
|
||||
capability F_cursor_up{};
|
||||
capability F_cursor_down{};
|
||||
capability F_cursor_left{};
|
||||
capability F_cursor_right{};
|
||||
capability F_cursor_address{};
|
||||
capability F_column_address{};
|
||||
capability F_row_address{};
|
||||
capability F_parm_up_cursor{};
|
||||
capability F_parm_down_cursor{};
|
||||
capability F_parm_left_cursor{};
|
||||
capability F_parm_right_cursor{};
|
||||
capability F_erase_chars{};
|
||||
capability F_repeat_char{};
|
||||
capability F_clr_bol{};
|
||||
capability F_clr_eol{};
|
||||
capability F_cursor_home{};
|
||||
capability F_carriage_return{};
|
||||
capability F_cursor_to_ll{};
|
||||
capability F_tab{};
|
||||
capability F_back_tab{};
|
||||
capability F_cursor_up{};
|
||||
capability F_cursor_down{};
|
||||
capability F_cursor_left{};
|
||||
capability F_cursor_right{};
|
||||
capability F_cursor_address{};
|
||||
capability F_column_address{};
|
||||
capability F_row_address{};
|
||||
capability F_parm_up_cursor{};
|
||||
capability F_parm_down_cursor{};
|
||||
capability F_parm_left_cursor{};
|
||||
capability F_parm_right_cursor{};
|
||||
capability F_erase_chars{};
|
||||
capability F_repeat_char{};
|
||||
capability F_clr_bol{};
|
||||
capability F_clr_eol{};
|
||||
|
||||
std::size_t screen_width{80};
|
||||
std::size_t screen_height{24};
|
||||
int char_duration{1};
|
||||
int baudrate{9600};
|
||||
int tabstop{0};
|
||||
char move_buf[BUF_SIZE]{'\0'};
|
||||
bool automatic_left_margin{false};
|
||||
bool eat_nl_glitch{false};
|
||||
std::size_t screen_width{80};
|
||||
std::size_t screen_height{24};
|
||||
int char_duration{1};
|
||||
int baudrate{9600};
|
||||
int tabstop{0};
|
||||
char move_buf[BUF_SIZE]{'\0'};
|
||||
bool automatic_left_margin{false};
|
||||
bool eat_nl_glitch{false};
|
||||
};
|
||||
|
||||
|
||||
// FOptiMove inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FOptiMove::getClassName() const
|
||||
inline const FString FOptiMove::getClassName() const
|
||||
{ return "FOptiMove"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
|
@ -71,20 +73,20 @@ class FPoint
|
|||
friend std::istream& operator >> (std::istream&, FPoint&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName();
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
void setX (int);
|
||||
void setY (int);
|
||||
void setPoint (const FPoint&);
|
||||
void setPoint (int, int);
|
||||
virtual const FString getClassName();
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
void setX (int);
|
||||
void setY (int);
|
||||
void setPoint (const FPoint&);
|
||||
void setPoint (int, int);
|
||||
|
||||
// Inquiry
|
||||
bool isOrigin() const;
|
||||
bool isOrigin() const;
|
||||
|
||||
// Point references
|
||||
int& x_ref();
|
||||
int& y_ref();
|
||||
int& x_ref();
|
||||
int& y_ref();
|
||||
|
||||
private:
|
||||
// Data members
|
||||
|
@ -133,7 +135,7 @@ inline FPoint operator - (const FPoint& p)
|
|||
{ return FPoint(-p.xpos, -p.ypos); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FPoint::getClassName()
|
||||
inline const FString FPoint::getClassName()
|
||||
{ return "FPoint"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -74,7 +74,7 @@ class FProgressbar : public FWidget
|
|||
virtual ~FProgressbar();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
std::size_t getPercentage();
|
||||
|
||||
// Mutators
|
||||
|
@ -111,7 +111,7 @@ class FProgressbar : public FWidget
|
|||
|
||||
// FProgressbar inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FProgressbar::getClassName() const
|
||||
inline const FString FProgressbar::getClassName() const
|
||||
{ return "FProgressbar"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -83,21 +83,21 @@ class FRadioButton : public FToggleButton
|
|||
FRadioButton& operator = (const FRadioButton&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init();
|
||||
void draw() override;
|
||||
void drawRadioButton();
|
||||
void drawChecked();
|
||||
void drawUnchecked();
|
||||
void init();
|
||||
void draw() override;
|
||||
void drawRadioButton();
|
||||
void drawChecked();
|
||||
void drawUnchecked();
|
||||
};
|
||||
|
||||
|
||||
// FRadioButton inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FRadioButton::getClassName() const
|
||||
inline const FString FRadioButton::getClassName() const
|
||||
{ return "FRadioButton"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -83,18 +83,18 @@ class FRadioMenuItem : public FMenuItem
|
|||
FRadioMenuItem& operator = (const FRadioMenuItem&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked() override;
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked() override;
|
||||
};
|
||||
|
||||
// FRadioMenuItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FRadioMenuItem::getClassName() const
|
||||
inline const FString FRadioMenuItem::getClassName() const
|
||||
{ return "FRadioMenuItem"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
|
@ -78,61 +80,61 @@ class FRect
|
|||
friend std::istream& operator >> (std::istream&, FRect&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName();
|
||||
int getX1() const;
|
||||
int getY1() const;
|
||||
int getX2() const;
|
||||
int getY2() const;
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
FPoint getPos() const;
|
||||
FPoint getUpperLeftPos() const;
|
||||
FPoint getUpperRightPos() const;
|
||||
FPoint getLowerLeftPos() const;
|
||||
FPoint getLowerRightPos() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
FSize getSize() const;
|
||||
virtual const FString getClassName();
|
||||
int getX1() const;
|
||||
int getY1() const;
|
||||
int getX2() const;
|
||||
int getY2() const;
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
FPoint getPos() const;
|
||||
FPoint getUpperLeftPos() const;
|
||||
FPoint getUpperRightPos() const;
|
||||
FPoint getLowerLeftPos() const;
|
||||
FPoint getLowerRightPos() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
FSize getSize() const;
|
||||
|
||||
// Mutators
|
||||
void setX1 (int);
|
||||
void setY1 (int);
|
||||
void setX2 (int);
|
||||
void setY2 (int);
|
||||
void setX (int);
|
||||
void setY (int);
|
||||
void setPos (int, int);
|
||||
void setPos (const FPoint&);
|
||||
void setWidth (std::size_t);
|
||||
void setHeight (std::size_t);
|
||||
void setSize (std::size_t, std::size_t);
|
||||
void setSize (const FSize&);
|
||||
void setRect (const FRect&);
|
||||
void setRect (const FPoint&, const FSize&);
|
||||
void setRect (int, int, std::size_t, std::size_t);
|
||||
void setCoordinates (const FPoint&, const FPoint&);
|
||||
void setCoordinates (int, int, int, int);
|
||||
void setX1 (int);
|
||||
void setY1 (int);
|
||||
void setX2 (int);
|
||||
void setY2 (int);
|
||||
void setX (int);
|
||||
void setY (int);
|
||||
void setPos (int, int);
|
||||
void setPos (const FPoint&);
|
||||
void setWidth (std::size_t);
|
||||
void setHeight (std::size_t);
|
||||
void setSize (std::size_t, std::size_t);
|
||||
void setSize (const FSize&);
|
||||
void setRect (const FRect&);
|
||||
void setRect (const FPoint&, const FSize&);
|
||||
void setRect (int, int, std::size_t, std::size_t);
|
||||
void setCoordinates (const FPoint&, const FPoint&);
|
||||
void setCoordinates (int, int, int, int);
|
||||
|
||||
// Inquiry
|
||||
bool isEmpty() const;
|
||||
bool isEmpty() const;
|
||||
|
||||
// Coordinate references
|
||||
int& x1_ref();
|
||||
int& y1_ref();
|
||||
int& x2_ref();
|
||||
int& y2_ref();
|
||||
int& x1_ref();
|
||||
int& y1_ref();
|
||||
int& x2_ref();
|
||||
int& y2_ref();
|
||||
|
||||
// Methods
|
||||
void move (int, int);
|
||||
void move (const FPoint&);
|
||||
void scaleBy (int, int);
|
||||
void scaleBy (const FPoint&);
|
||||
bool contains (int, int) const;
|
||||
bool contains (const FPoint&) const;
|
||||
bool contains (const FRect&) const;
|
||||
bool overlap (const FRect&) const;
|
||||
FRect intersect (const FRect&) const;
|
||||
FRect combined (const FRect&) const;
|
||||
void move (int, int);
|
||||
void move (const FPoint&);
|
||||
void scaleBy (int, int);
|
||||
void scaleBy (const FPoint&);
|
||||
bool contains (int, int) const;
|
||||
bool contains (const FPoint&) const;
|
||||
bool contains (const FRect&) const;
|
||||
bool overlap (const FRect&) const;
|
||||
FRect intersect (const FRect&) const;
|
||||
FRect combined (const FRect&) const;
|
||||
|
||||
private:
|
||||
// Data members
|
||||
|
@ -171,7 +173,7 @@ inline FRect::FRect (int x, int y, std::size_t width, std::size_t height)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FRect::getClassName()
|
||||
inline const FString FRect::getClassName()
|
||||
{ return "FRect"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "final/fwidget.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -100,7 +103,7 @@ class FScrollbar : public FWidget
|
|||
FScrollbar& operator = (const FScrollbar&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
int getValue() const;
|
||||
sType getScrollType() const;
|
||||
|
||||
|
@ -170,11 +173,11 @@ class FScrollbar : public FWidget
|
|||
|
||||
// non-member function forward declarations
|
||||
//----------------------------------------------------------------------
|
||||
template<typename Callback>
|
||||
template<typename Instance, typename Callback>
|
||||
void initScrollbar ( FScrollbarPtr& bar
|
||||
, fc::orientation o
|
||||
, FWidget* cb_instance
|
||||
, Callback cb_handler )
|
||||
, Instance cb_instance
|
||||
, const Callback& cb_handler )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -186,6 +189,7 @@ void initScrollbar ( FScrollbarPtr& bar
|
|||
return;
|
||||
}
|
||||
|
||||
using namespace std::placeholders;
|
||||
bar->setMinimum(0);
|
||||
bar->setValue(0);
|
||||
bar->hide();
|
||||
|
@ -193,14 +197,14 @@ void initScrollbar ( FScrollbarPtr& bar
|
|||
bar->addCallback
|
||||
(
|
||||
"change-value",
|
||||
F_METHOD_CALLBACK (cb_instance, cb_handler)
|
||||
std::bind(cb_handler, cb_instance, _1, _2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// FScrollbar inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FScrollbar::getClassName() const
|
||||
inline const FString FScrollbar::getClassName() const
|
||||
{ return "FScrollbar"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "final/fscrollbar.h"
|
||||
#include "final/fwidget.h"
|
||||
|
@ -85,7 +85,7 @@ class FScrollView : public FWidget
|
|||
FScrollView& operator = (const FScrollView&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
std::size_t getViewportWidth() const;
|
||||
std::size_t getViewportHeight() const;
|
||||
const FSize getViewportSize();
|
||||
|
@ -153,6 +153,9 @@ class FScrollView : public FWidget
|
|||
void copy2area();
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
||||
|
||||
// Constants
|
||||
static constexpr int vertical_border_spacing = 2;
|
||||
static constexpr int horizontal_border_spacing = 2;
|
||||
|
@ -162,11 +165,12 @@ class FScrollView : public FWidget
|
|||
|
||||
// Methods
|
||||
void init (FWidget*);
|
||||
void mapKeyFunctions();
|
||||
void calculateScrollbarPos();
|
||||
template<typename Callback>
|
||||
void initScrollbar ( FScrollbarPtr&
|
||||
, fc::orientation
|
||||
, Callback );
|
||||
void calculateScrollbarPos();
|
||||
void setHorizontalScrollBarVisibility();
|
||||
void setVerticalScrollBarVisibility();
|
||||
void setViewportCursor();
|
||||
|
@ -176,22 +180,23 @@ class FScrollView : public FWidget
|
|||
void cb_HBarChange (FWidget*, FDataPtr);
|
||||
|
||||
// Data members
|
||||
FRect scroll_geometry{1, 1, 1, 1};
|
||||
FRect viewport_geometry{};
|
||||
term_area* viewport{nullptr}; // virtual scroll content
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
uInt8 nf_offset{0};
|
||||
bool border{true};
|
||||
bool use_own_print_area{false};
|
||||
bool update_scrollbar{true};
|
||||
fc::scrollBarMode vMode{fc::Auto}; // fc:Auto, fc::Hidden or fc::Scroll
|
||||
fc::scrollBarMode hMode{fc::Auto};
|
||||
FRect scroll_geometry{1, 1, 1, 1};
|
||||
FRect viewport_geometry{};
|
||||
term_area* viewport{nullptr}; // virtual scroll content
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
keyMap key_map{};
|
||||
uInt8 nf_offset{0};
|
||||
bool border{true};
|
||||
bool use_own_print_area{false};
|
||||
bool update_scrollbar{true};
|
||||
fc::scrollBarMode vMode{fc::Auto}; // fc:Auto, fc::Hidden or fc::Scroll
|
||||
fc::scrollBarMode hMode{fc::Auto};
|
||||
};
|
||||
|
||||
// FScrollView inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FScrollView::getClassName() const
|
||||
inline const FString FScrollView::getClassName() const
|
||||
{ return "FScrollView"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -78,21 +79,21 @@ class FSize
|
|||
friend std::istream& operator >> (std::istream&, FSize&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName();
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
std::size_t getArea() const;
|
||||
void setWidth (std::size_t);
|
||||
void setHeight (std::size_t);
|
||||
void setSize (FSize);
|
||||
void setSize (std::size_t, std::size_t);
|
||||
virtual const FString getClassName();
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
std::size_t getArea() const;
|
||||
void setWidth (std::size_t);
|
||||
void setHeight (std::size_t);
|
||||
void setSize (FSize);
|
||||
void setSize (std::size_t, std::size_t);
|
||||
|
||||
// Inquiry
|
||||
bool isEmpty() const;
|
||||
bool isEmpty() const;
|
||||
|
||||
// Side references
|
||||
std::size_t& width_ref();
|
||||
std::size_t& height_ref();
|
||||
std::size_t& width_ref();
|
||||
std::size_t& height_ref();
|
||||
|
||||
private:
|
||||
// Data members
|
||||
|
@ -161,7 +162,7 @@ inline FSize operator - (const FSize& s1, const FSize& s2)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FSize::getClassName()
|
||||
inline const FString FSize::getClassName()
|
||||
{ return "FSize"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "final/fc.h"
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -63,11 +64,15 @@ class FStartOptions final
|
|||
FStartOptions& operator = (const FStartOptions&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const FString getClassName();
|
||||
static FStartOptions& getFStartOptions();
|
||||
|
||||
// Mutator
|
||||
void setDefault();
|
||||
|
||||
// Method
|
||||
static void destroyObject();
|
||||
|
||||
// Data members
|
||||
uInt8 cursor_optimisation : 1;
|
||||
uInt8 mouse_support : 1;
|
||||
|
@ -90,6 +95,10 @@ class FStartOptions final
|
|||
static FStartOptions* start_options;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FString FStartOptions::getClassName()
|
||||
{ return "FStartOptions"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FSTARTOPTIONS_H
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fwidget.h"
|
||||
|
@ -91,7 +92,7 @@ class FStatusKey : public FWidget
|
|||
FStatusKey& operator = (const FStatusKey&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
virtual FKey getKey() const;
|
||||
virtual FString getText() const;
|
||||
|
||||
|
@ -132,7 +133,7 @@ class FStatusKey : public FWidget
|
|||
|
||||
// FStatusKey inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FStatusKey::getClassName() const
|
||||
inline const FString FStatusKey::getClassName() const
|
||||
{ return "FStatusKey"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -200,7 +201,7 @@ class FStatusBar : public FWindow
|
|||
FStatusBar& operator = (const FStatusBar&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FStatusKey* getStatusKey (int) const;
|
||||
FString getMessage() const;
|
||||
std::size_t getCount() const;
|
||||
|
@ -258,7 +259,7 @@ class FStatusBar : public FWindow
|
|||
|
||||
// FStatusBar inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FStatusBar::getClassName() const
|
||||
inline const FString FStatusBar::getClassName() const
|
||||
{ return "FStatusBar"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fc.h"
|
||||
|
@ -181,7 +182,7 @@ class FString
|
|||
friend std::wistream& operator >> (std::wistream&, FString&);
|
||||
|
||||
// Accessor
|
||||
virtual const char* getClassName();
|
||||
virtual const FString getClassName();
|
||||
|
||||
// inquiries
|
||||
bool isNull() const;
|
||||
|
@ -287,7 +288,7 @@ class FString
|
|||
|
||||
// FString inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FString::getClassName()
|
||||
inline const FString FString::getClassName()
|
||||
{ return "FString"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -83,7 +83,7 @@ class FSwitch : public FToggleButton
|
|||
FSwitch& operator = (const FSwitch&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
|
||||
// Mutator
|
||||
void setText (const FString&) override;
|
||||
|
@ -107,7 +107,7 @@ class FSwitch : public FToggleButton
|
|||
|
||||
// FSwitch inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FSwitch::getClassName() const
|
||||
inline const FString FSwitch::getClassName() const
|
||||
{ return "FSwitch"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -180,7 +180,8 @@ class FSystemImpl : public FSystem
|
|||
int tputs (const char* str, int affcnt, int (*putc)(int)) override
|
||||
{
|
||||
#if defined(__sun) && defined(__SVR4)
|
||||
return ::tputs (C_STR(str), affcnt, reinterpret_cast<int (*)(char)>(putc));
|
||||
return ::tputs ( C_STR(str)
|
||||
, affcnt, reinterpret_cast<int (*)(char)>(putc) );
|
||||
#else
|
||||
return ::tputs (str, affcnt, putc);
|
||||
#endif
|
||||
|
|
|
@ -110,9 +110,12 @@
|
|||
#include <clocale>
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fc.h"
|
||||
#include "final/fstring.h"
|
||||
|
@ -154,7 +157,8 @@ class FTermXTerminal;
|
|||
class FTerm final
|
||||
{
|
||||
public:
|
||||
struct initializationValues; // forward declaration
|
||||
// Typedef
|
||||
typedef std::function<int(int)> defaultPutChar;
|
||||
|
||||
// Constructor
|
||||
explicit FTerm (bool = false);
|
||||
|
@ -169,7 +173,7 @@ class FTerm final
|
|||
FTerm& operator = (const FTerm&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
static std::size_t getLineNumber();
|
||||
static std::size_t getColumnNumber();
|
||||
static const FString getKeyName (FKey);
|
||||
|
@ -278,9 +282,7 @@ class FTerm final
|
|||
static bool scrollTermForward();
|
||||
static bool scrollTermReverse();
|
||||
|
||||
// function pointer -> static function
|
||||
static int (*Fputchar)(int);
|
||||
|
||||
static defaultPutChar& putchar(); // function pointer
|
||||
template<typename... Args>
|
||||
static void putstringf (const char[], Args&&...);
|
||||
static void putstring (const char[], int = 1);
|
||||
|
@ -399,7 +401,7 @@ std::size_t getColumnWidth (const FTermBuffer&);
|
|||
|
||||
// FTerm inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTerm::getClassName() const
|
||||
inline const FString FTerm::getClassName() const
|
||||
{ return "FTerm"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -427,8 +429,9 @@ inline void FTerm::putstringf (const char format[], Args&&... args)
|
|||
if ( ! fsys )
|
||||
getFSystem();
|
||||
|
||||
std::vector<char> buf(size);
|
||||
std::snprintf (&buf[0], size, format, std::forward<Args>(args)...);
|
||||
std::size_t count = std::size_t(size);
|
||||
std::vector<char> buf(count);
|
||||
std::snprintf (&buf[0], count, format, std::forward<Args>(args)...);
|
||||
fsys->tputs (&buf[0], 1, FTerm::putchar_ASCII);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include <sstream> // std::stringstream
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace finalcut
|
||||
|
@ -78,7 +79,7 @@ class FTermBuffer
|
|||
, const FTermBuffer& );
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
std::size_t getLength() const;
|
||||
const charDataVector& getBuffer() const;
|
||||
|
||||
|
@ -158,7 +159,7 @@ inline FTermBuffer& FTermBuffer::operator << (const FColorPair& pair)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermBuffer::getClassName() const
|
||||
inline const FString FTermBuffer::getClassName() const
|
||||
{ return "FTermBuffer"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ class FTermcap final
|
|||
~FTermcap() = default;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
|
@ -128,7 +128,7 @@ class FTermcap final
|
|||
|
||||
// FTermcap inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermcap::getClassName() const
|
||||
inline const FString FTermcap::getClassName() const
|
||||
{ return "FTermcap"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -56,7 +56,7 @@ class FTermcapQuirks final
|
|||
virtual ~FTermcapQuirks();
|
||||
|
||||
// Accessor
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
|
||||
// Methods
|
||||
static void terminalFixup();
|
||||
|
@ -85,7 +85,7 @@ class FTermcapQuirks final
|
|||
|
||||
// FTermcapQuirks inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermcapQuirks::getClassName() const
|
||||
inline const FString FTermcapQuirks::getClassName() const
|
||||
{ return "FTermcapQuirks"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -69,7 +69,7 @@ class FTermData final
|
|||
FTermData& operator = (const FTermData&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
encodingMap& getEncodingList();
|
||||
charSubstitution& getCharSubstitutionMap();
|
||||
fc::encoding getTermEncoding() const;
|
||||
|
@ -132,8 +132,8 @@ class FTermData final
|
|||
FString xterm_font{};
|
||||
FString xterm_title{};
|
||||
fc::encoding term_encoding{fc::UNKNOWN};
|
||||
int fd_tty{-1}; // Teletype (tty) file descriptor is still undefined
|
||||
|
||||
int fd_tty{-1}; // Teletype (tty) file descriptor
|
||||
// is still undefined
|
||||
#if DEBUG
|
||||
int framebuffer_bpp{-1};
|
||||
#endif
|
||||
|
@ -158,7 +158,7 @@ class FTermData final
|
|||
|
||||
// FTermData inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermData::getClassName() const
|
||||
inline const FString FTermData::getClassName() const
|
||||
{ return "FTermData"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -86,7 +86,7 @@ class FTermDetection final
|
|||
virtual ~FTermDetection();
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
static char* getTermType();
|
||||
static int getGnomeTerminalID();
|
||||
terminalType& getTermTypeStruct();
|
||||
|
@ -222,7 +222,7 @@ class FTermDetection final
|
|||
|
||||
// FTermDetection inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermDetection::getClassName() const
|
||||
inline const FString FTermDetection::getClassName() const
|
||||
{ return "FTermDetection"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -95,7 +95,7 @@ class FTermFreeBSD final
|
|||
FTermFreeBSD& operator = (const FTermFreeBSD&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
static CursorStyle getCursorStyle();
|
||||
|
||||
// Inquiry
|
||||
|
@ -135,7 +135,7 @@ class FTermFreeBSD final
|
|||
|
||||
// FTermFreeBSD inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermFreeBSD::getClassName() const
|
||||
inline const FString FTermFreeBSD::getClassName() const
|
||||
{ return "FTermFreeBSD"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -57,43 +58,43 @@ class FTermios final
|
|||
virtual ~FTermios();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
static termios getTTY();
|
||||
static int getStdIn();
|
||||
static int getStdOut();
|
||||
static int getStdErr();
|
||||
const FString getClassName() const;
|
||||
static termios getTTY();
|
||||
static int getStdIn();
|
||||
static int getStdOut();
|
||||
static int getStdErr();
|
||||
|
||||
// Inquiries
|
||||
static bool isRaw();
|
||||
static bool isRaw();
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
static void setTTY (const termios&);
|
||||
static void storeTTYsettings();
|
||||
static void restoreTTYsettings();
|
||||
static void setHardwareEcho();
|
||||
static void unsetHardwareEcho();
|
||||
static void setCaptureSendCharacters();
|
||||
static void unsetCaptureSendCharacters();
|
||||
static bool setRawMode (bool);
|
||||
static bool setRawMode();
|
||||
static bool unsetRawMode();
|
||||
static bool setCookedMode();
|
||||
static uInt getBaudRate();
|
||||
static void init();
|
||||
static void setTTY (const termios&);
|
||||
static void storeTTYsettings();
|
||||
static void restoreTTYsettings();
|
||||
static void setHardwareEcho();
|
||||
static void unsetHardwareEcho();
|
||||
static void setCaptureSendCharacters();
|
||||
static void unsetCaptureSendCharacters();
|
||||
static bool setRawMode (bool);
|
||||
static bool setRawMode();
|
||||
static bool unsetRawMode();
|
||||
static bool setCookedMode();
|
||||
static uInt getBaudRate();
|
||||
|
||||
private:
|
||||
// Data members
|
||||
static int stdin_no;
|
||||
static int stdout_no;
|
||||
static int stderr_no;
|
||||
static bool raw_mode;
|
||||
static struct termios term_init;
|
||||
static int stdin_no;
|
||||
static int stdout_no;
|
||||
static int stderr_no;
|
||||
static bool raw_mode;
|
||||
static struct termios term_init;
|
||||
};
|
||||
|
||||
|
||||
// FTermios inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermios::getClassName() const
|
||||
inline const FString FTermios::getClassName() const
|
||||
{ return "FTermios"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -85,45 +85,45 @@ class FTermLinux final
|
|||
FTermLinux& operator = (const FTermLinux&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
static fc::linuxConsoleCursorStyle getCursorStyle();
|
||||
static char* getCursorStyleString();
|
||||
static int getFramebufferBpp();
|
||||
const FString getClassName() const;
|
||||
fc::linuxConsoleCursorStyle getCursorStyle();
|
||||
char* getCursorStyleString();
|
||||
int getFramebufferBpp();
|
||||
|
||||
// Mutators
|
||||
static bool setCursorStyle (CursorStyle);
|
||||
static bool setPalette (FColor, int, int, int);
|
||||
static void setUTF8 (bool);
|
||||
bool setCursorStyle (CursorStyle);
|
||||
bool setPalette (FColor, int, int, int);
|
||||
void setUTF8 (bool);
|
||||
|
||||
// Inquiries
|
||||
static bool isLinuxConsole();
|
||||
static bool isVGAFontUsed();
|
||||
static bool isNewFontUsed();
|
||||
bool isLinuxConsole();
|
||||
bool isVGAFontUsed();
|
||||
bool isNewFontUsed();
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
static void initCharMap();
|
||||
static void finish();
|
||||
static bool loadVGAFont();
|
||||
static bool loadNewFont();
|
||||
static bool loadOldFont();
|
||||
static bool saveColorMap();
|
||||
static bool resetColorMap();
|
||||
static void setBeep (int, int);
|
||||
static void resetBeep();
|
||||
void init();
|
||||
void initCharMap();
|
||||
void finish();
|
||||
bool loadVGAFont();
|
||||
bool loadNewFont();
|
||||
bool loadOldFont();
|
||||
bool saveColorMap();
|
||||
bool resetColorMap();
|
||||
void setBeep (int, int);
|
||||
void resetBeep();
|
||||
|
||||
static FKey modifierKeyCorrection (const FKey&);
|
||||
FKey modifierKeyCorrection (const FKey&);
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
static struct modifier_key // bit field
|
||||
struct modifier_key // bit field
|
||||
{
|
||||
uChar shift : 1; // 0..1
|
||||
uChar alt_gr : 1; // 0..1
|
||||
uChar ctrl : 1; // 0..1
|
||||
uChar alt : 1; // 0..1
|
||||
uChar : 4; // padding bits
|
||||
} mod_key;
|
||||
} mod_key{};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -138,63 +138,63 @@ class FTermLinux final
|
|||
} ColorMap;
|
||||
|
||||
// Accessors
|
||||
static int getFramebuffer_bpp();
|
||||
static bool getScreenFont();
|
||||
static bool getUnicodeMap ();
|
||||
static modifier_key& getModifierKey();
|
||||
int getFramebuffer_bpp();
|
||||
bool getScreenFont();
|
||||
bool getUnicodeMap ();
|
||||
modifier_key& getModifierKey();
|
||||
|
||||
// Mutators
|
||||
static int setScreenFont ( uChar[], uInt, uInt, uInt
|
||||
int setScreenFont ( uChar[], uInt, uInt, uInt
|
||||
, bool = false );
|
||||
static int setUnicodeMap (struct unimapdesc*);
|
||||
static void setLinuxCursorStyle (fc::linuxConsoleCursorStyle);
|
||||
int setUnicodeMap (struct unimapdesc*);
|
||||
void setLinuxCursorStyle (fc::linuxConsoleCursorStyle);
|
||||
|
||||
// Methods
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
|
||||
static uInt16 getInputStatusRegisterOne();
|
||||
static uChar readAttributeController (uChar);
|
||||
static void writeAttributeController (uChar, uChar);
|
||||
static uChar getAttributeMode();
|
||||
static void setAttributeMode (uChar);
|
||||
static int setBlinkAsIntensity (bool);
|
||||
static void getVGAPalette();
|
||||
static void setVGADefaultPalette();
|
||||
static bool setVGAPalette (FColor, int, int, int);
|
||||
static bool saveVGAPalette();
|
||||
static bool resetVGAPalette();
|
||||
uInt16 getInputStatusRegisterOne();
|
||||
uChar readAttributeController (uChar);
|
||||
void writeAttributeController (uChar, uChar);
|
||||
uChar getAttributeMode();
|
||||
void setAttributeMode (uChar);
|
||||
int setBlinkAsIntensity (bool);
|
||||
void getVGAPalette();
|
||||
void setVGADefaultPalette();
|
||||
bool setVGAPalette (FColor, int, int, int);
|
||||
bool saveVGAPalette();
|
||||
bool resetVGAPalette();
|
||||
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
|
||||
static FKey shiftKeyCorrection (const FKey&);
|
||||
static FKey ctrlKeyCorrection (const FKey&);
|
||||
static FKey altKeyCorrection (const FKey&);
|
||||
static FKey shiftCtrlKeyCorrection (const FKey&);
|
||||
static FKey shiftAltKeyCorrection (const FKey&);
|
||||
static FKey ctrlAltKeyCorrection (const FKey&);
|
||||
static FKey shiftCtrlAltKeyCorrection (const FKey&);
|
||||
static sInt16 getFontPos (wchar_t ucs);
|
||||
static void initSpecialCharacter();
|
||||
static void characterFallback (wchar_t, std::vector<wchar_t>);
|
||||
FKey shiftKeyCorrection (const FKey&);
|
||||
FKey ctrlKeyCorrection (const FKey&);
|
||||
FKey altKeyCorrection (const FKey&);
|
||||
FKey shiftCtrlKeyCorrection (const FKey&);
|
||||
FKey shiftAltKeyCorrection (const FKey&);
|
||||
FKey ctrlAltKeyCorrection (const FKey&);
|
||||
FKey shiftCtrlAltKeyCorrection (const FKey&);
|
||||
sInt16 getFontPos (wchar_t ucs);
|
||||
void initSpecialCharacter();
|
||||
void characterFallback (wchar_t, std::vector<wchar_t>);
|
||||
|
||||
// Data members
|
||||
#if defined(__linux__)
|
||||
static bool vga_font;
|
||||
static bool new_font;
|
||||
static bool has_saved_palette;
|
||||
static FTermData* fterm_data;
|
||||
static FSystem* fsystem;
|
||||
static FTermDetection* term_detection;
|
||||
static CursorStyle linux_console_cursor_style;
|
||||
static console_font_op screen_font;
|
||||
static unimapdesc screen_unicode_map;
|
||||
static ColorMap saved_color_map;
|
||||
static ColorMap cmap;
|
||||
static int framebuffer_bpp;
|
||||
bool vga_font{};
|
||||
bool new_font{};
|
||||
bool has_saved_palette{};
|
||||
FTermData* fterm_data{nullptr};
|
||||
FSystem* fsystem{nullptr};
|
||||
FTermDetection* term_detection{nullptr};
|
||||
CursorStyle linux_console_cursor_style{};
|
||||
console_font_op screen_font{};
|
||||
unimapdesc screen_unicode_map{};
|
||||
ColorMap saved_color_map{};
|
||||
ColorMap cmap{};
|
||||
int framebuffer_bpp{-1};
|
||||
#endif // defined(__linux__)
|
||||
};
|
||||
|
||||
|
||||
// FTermLinux inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermLinux::getClassName() const
|
||||
inline const FString FTermLinux::getClassName() const
|
||||
{ return "FTermLinux"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define WSKBD_BELL_DOPITCH 0x1 // get/set pitch
|
||||
#define WSKBD_BELL_DOPERIOD 0x2 // get/set period
|
||||
#define WSKBD_BELL_DOVOLUME 0x4 // get/set volume
|
||||
#define WSKBD_BELL_DOALL 0x7 // all of the above
|
||||
#define WSKBD_BELL_DOALL 0x7 // all of the above
|
||||
|
||||
typedef uInt32 kbd_t;
|
||||
|
||||
|
@ -87,7 +87,7 @@ class FTermOpenBSD final
|
|||
FTermOpenBSD& operator = (const FTermOpenBSD&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
const FString getClassName() const;
|
||||
|
||||
// Inquiries
|
||||
static bool isBSDConsole();
|
||||
|
@ -120,7 +120,7 @@ class FTermOpenBSD final
|
|||
|
||||
// FTermOpenBSD inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermOpenBSD::getClassName() const
|
||||
inline const FString FTermOpenBSD::getClassName() const
|
||||
{ return "FTermOpenBSD"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -57,107 +57,107 @@ class FTermXTerminal final
|
|||
virtual ~FTermXTerminal();
|
||||
|
||||
// Mutators
|
||||
static void redefineDefaultColors (bool);
|
||||
static void setCursorStyle (fc::xtermCursorStyle);
|
||||
static void setFont (const FString&);
|
||||
static void setTitle (const FString&);
|
||||
static void setTermSize (const FSize&);
|
||||
static void setForeground (const FString&);
|
||||
static void setBackground (const FString&);
|
||||
static void setCursorColor (const FString&);
|
||||
static void setMouseForeground (const FString&);
|
||||
static void setMouseBackground (const FString&);
|
||||
static void setHighlightBackground (const FString&);
|
||||
void redefineDefaultColors (bool);
|
||||
void setCursorStyle (fc::xtermCursorStyle);
|
||||
void setFont (const FString&);
|
||||
void setTitle (const FString&);
|
||||
void setTermSize (const FSize&);
|
||||
void setForeground (const FString&);
|
||||
void setBackground (const FString&);
|
||||
void setCursorColor (const FString&);
|
||||
void setMouseForeground (const FString&);
|
||||
void setMouseBackground (const FString&);
|
||||
void setHighlightBackground (const FString&);
|
||||
static void setMouseSupport (bool);
|
||||
static void setMouseSupport();
|
||||
static void unsetMouseSupport();
|
||||
static void metaSendsESC (bool);
|
||||
void metaSendsESC (bool);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
static fc::xtermCursorStyle getCursorStyle();
|
||||
static const FString getFont();
|
||||
static const FString getTitle();
|
||||
static const FString getForeground();
|
||||
static const FString getBackground();
|
||||
static const FString getCursorColor();
|
||||
static const FString getMouseForeground();
|
||||
static const FString getMouseBackground();
|
||||
static const FString getHighlightBackground();
|
||||
const FString getClassName() const;
|
||||
fc::xtermCursorStyle getCursorStyle();
|
||||
const FString getFont();
|
||||
const FString getTitle();
|
||||
const FString getForeground();
|
||||
const FString getBackground();
|
||||
const FString getCursorColor();
|
||||
const FString getMouseForeground();
|
||||
const FString getMouseBackground();
|
||||
const FString getHighlightBackground();
|
||||
|
||||
// Inquiries
|
||||
static bool hasFont();
|
||||
static bool hasTitle();
|
||||
bool hasFont();
|
||||
bool hasTitle();
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
static void setDefaults();
|
||||
static void resetColorMap();
|
||||
static void resetForeground();
|
||||
static void resetBackground();
|
||||
static void resetCursorColor();
|
||||
static void resetMouseForeground();
|
||||
static void resetMouseBackground();
|
||||
static void resetHighlightBackground();
|
||||
static void resetDefaults();
|
||||
static void captureFontAndTitle();
|
||||
void init();
|
||||
void setDefaults();
|
||||
void resetColorMap();
|
||||
void resetForeground();
|
||||
void resetBackground();
|
||||
void resetCursorColor();
|
||||
void resetMouseForeground();
|
||||
void resetMouseBackground();
|
||||
void resetHighlightBackground();
|
||||
void resetDefaults();
|
||||
void captureFontAndTitle();
|
||||
|
||||
private:
|
||||
// Methods
|
||||
static void setXTermCursorStyle();
|
||||
static void setXTermFont();
|
||||
static void setXTermTitle();
|
||||
static void setXTermSize();
|
||||
static void setXTermForeground();
|
||||
static void setXTermBackground();
|
||||
static void setXTermCursorColor();
|
||||
static void setXTermMouseForeground();
|
||||
static void setXTermMouseBackground();
|
||||
static void setXTermHighlightBackground();
|
||||
static void setXTerm8ColorDefaults();
|
||||
static void setXTerm16ColorDefaults();
|
||||
static void setXTermDefaultsMouseCursor();
|
||||
static bool canSetXTermBackground();
|
||||
static void resetXTermColorMap();
|
||||
static void resetXTermForeground();
|
||||
static void resetXTermBackground();
|
||||
static void resetXTermCursorColor();
|
||||
static void resetXTermMouseForeground();
|
||||
static void resetXTermMouseBackground();
|
||||
static void resetXTermHighlightBackground();
|
||||
static bool canResetColor();
|
||||
static void oscPrefix();
|
||||
static void oscPostfix();
|
||||
static const FString captureXTermFont();
|
||||
static const FString captureXTermTitle();
|
||||
void setXTermCursorStyle();
|
||||
void setXTermFont();
|
||||
void setXTermTitle();
|
||||
void setXTermSize();
|
||||
void setXTermForeground();
|
||||
void setXTermBackground();
|
||||
void setXTermCursorColor();
|
||||
void setXTermMouseForeground();
|
||||
void setXTermMouseBackground();
|
||||
void setXTermHighlightBackground();
|
||||
void setXTerm8ColorDefaults();
|
||||
void setXTerm16ColorDefaults();
|
||||
void setXTermDefaultsMouseCursor();
|
||||
bool canSetXTermBackground();
|
||||
void resetXTermColorMap();
|
||||
void resetXTermForeground();
|
||||
void resetXTermBackground();
|
||||
void resetXTermCursorColor();
|
||||
void resetXTermMouseForeground();
|
||||
void resetXTermMouseBackground();
|
||||
void resetXTermHighlightBackground();
|
||||
bool canResetColor();
|
||||
void oscPrefix();
|
||||
void oscPostfix();
|
||||
const FString captureXTermFont();
|
||||
const FString captureXTermTitle();
|
||||
static void enableXTermMouse();
|
||||
static void disableXTermMouse();
|
||||
static void enableXTermMetaSendsESC();
|
||||
static void disableXTermMetaSendsESC();
|
||||
void enableXTermMetaSendsESC();
|
||||
void disableXTermMetaSendsESC();
|
||||
|
||||
// Data members
|
||||
static bool mouse_support;
|
||||
static bool meta_sends_esc;
|
||||
static bool xterm_default_colors;
|
||||
static std::size_t term_width;
|
||||
static std::size_t term_height;
|
||||
static FString xterm_font;
|
||||
static FString xterm_title;
|
||||
static FString foreground_color;
|
||||
static FString background_color;
|
||||
static FString cursor_color;
|
||||
static FString mouse_foreground_color;
|
||||
static FString mouse_background_color;
|
||||
static FString highlight_background_color;
|
||||
static FSystem* fsystem;
|
||||
static FTermDetection* term_detection;
|
||||
static fc::xtermCursorStyle cursor_style;
|
||||
static bool mouse_support;
|
||||
bool meta_sends_esc{false};
|
||||
bool xterm_default_colors{false};
|
||||
std::size_t term_width{80};
|
||||
std::size_t term_height{24};
|
||||
FString xterm_font{};
|
||||
FString xterm_title{};
|
||||
FString foreground_color{};
|
||||
FString background_color{};
|
||||
FString cursor_color{};
|
||||
FString mouse_foreground_color{};
|
||||
FString mouse_background_color{};
|
||||
FString highlight_background_color{};
|
||||
static FSystem* fsystem;
|
||||
FTermDetection* term_detection{nullptr};
|
||||
fc::xtermCursorStyle cursor_style{fc::unknown_cursor_style};
|
||||
};
|
||||
|
||||
|
||||
// FTermXTerminal inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermXTerminal::getClassName() const
|
||||
inline const FString FTermXTerminal::getClassName() const
|
||||
{ return "FTermXTerminal"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fwidget.h"
|
||||
|
@ -93,7 +94,7 @@ class FTextView : public FWidget
|
|||
FTextView& operator << (const std::string&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
std::size_t getColumns() const;
|
||||
std::size_t getRows() const;
|
||||
const FString getText() const;
|
||||
|
@ -136,6 +137,9 @@ class FTextView : public FWidget
|
|||
void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
||||
|
||||
// Accessors
|
||||
std::size_t getTextHeight();
|
||||
std::size_t getTextWidth();
|
||||
|
@ -146,6 +150,7 @@ class FTextView : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void mapKeyFunctions();
|
||||
void draw() override;
|
||||
void drawBorder() override;
|
||||
void drawScrollbars();
|
||||
|
@ -162,6 +167,7 @@ class FTextView : public FWidget
|
|||
FStringList data{};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
keyMap key_map{};
|
||||
bool update_scrollbar{true};
|
||||
int xoffset{0};
|
||||
int yoffset{0};
|
||||
|
@ -205,7 +211,7 @@ inline FTextView& FTextView::operator << (const std::string& string)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTextView::getClassName() const
|
||||
inline const FString FTextView::getClassName() const
|
||||
{ return "FTextView"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -84,7 +84,7 @@ class FToggleButton : public FWidget
|
|||
FToggleButton& operator = (const FToggleButton&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
|
@ -167,7 +167,7 @@ class FToggleButton : public FWidget
|
|||
|
||||
// FRadioButton inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FToggleButton::getClassName() const
|
||||
inline const FString FToggleButton::getClassName() const
|
||||
{ return "FToggleButton"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -85,7 +85,7 @@ class FToolTip : public FWindow
|
|||
FToolTip& operator = (const FToolTip&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
const FString getText() const;
|
||||
|
||||
// Mutators
|
||||
|
@ -115,7 +115,7 @@ class FToolTip : public FWindow
|
|||
|
||||
// FToolTip inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FToolTip::getClassName() const
|
||||
inline const FString FToolTip::getClassName() const
|
||||
{ return "FToolTip"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -51,15 +51,20 @@
|
|||
#include <queue>
|
||||
#include <sstream> // std::stringstream
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fc.h"
|
||||
#include "final/fterm.h"
|
||||
|
||||
// Preprocessing handler macro
|
||||
//#define F_PREPROC_HANDLER(i,h)
|
||||
// static_cast<FVTerm*>((i))
|
||||
// , reinterpret_cast<FVTerm::FPreprocessingHandler>((h))
|
||||
#define F_PREPROC_HANDLER(i,h) \
|
||||
static_cast<FVTerm*>((i)) \
|
||||
, reinterpret_cast<FVTerm::FPreprocessingHandler>((h))
|
||||
reinterpret_cast<FVTerm*>((i)), \
|
||||
std::bind ( reinterpret_cast<FVTerm::FPreprocessingHandler>((h)) \
|
||||
, reinterpret_cast<FVTerm*>((i)) )
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
@ -94,13 +99,14 @@ class FVTerm
|
|||
} line_changes;
|
||||
|
||||
typedef void (FVTerm::*FPreprocessingHandler)();
|
||||
typedef std::function<void()> FVTermPreprocessing;
|
||||
|
||||
struct term_area; // forward declaration
|
||||
|
||||
struct vterm_preprocessing
|
||||
{
|
||||
FVTerm* instance;
|
||||
FPreprocessingHandler handler;
|
||||
FVTerm* instance;
|
||||
FVTermPreprocessing function;
|
||||
};
|
||||
|
||||
typedef std::vector<vterm_preprocessing> FPreprocessing;
|
||||
|
@ -142,7 +148,7 @@ class FVTerm
|
|||
FVTerm& operator << (const FColorPair&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const FString getClassName() const;
|
||||
static FColor getTermForegroundColor();
|
||||
static FColor getTermBackgroundColor();
|
||||
term_area*& getVWin();
|
||||
|
@ -288,7 +294,7 @@ class FVTerm
|
|||
void updateTerminal (terminal_update);
|
||||
void updateTerminal();
|
||||
virtual void addPreprocessingHandler ( FVTerm*
|
||||
, FPreprocessingHandler );
|
||||
, FVTermPreprocessing );
|
||||
virtual void delPreprocessingHandler (FVTerm*);
|
||||
|
||||
template<typename... Args>
|
||||
|
@ -497,7 +503,6 @@ class FVTerm
|
|||
static uInt clr_bol_length;
|
||||
static uInt clr_eol_length;
|
||||
static uInt cursor_address_length;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -589,7 +594,7 @@ inline FVTerm& FVTerm::operator << (const FColorPair& pair)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FVTerm::getClassName() const
|
||||
inline const FString FVTerm::getClassName() const
|
||||
{ return "FVTerm"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
@ -107,11 +108,14 @@
|
|||
|
||||
// Callback macros
|
||||
#define F_FUNCTION_CALLBACK(h) \
|
||||
reinterpret_cast<finalcut::FWidget::FCallback>((h))
|
||||
reinterpret_cast<finalcut::FWidget::FCallbackPtr>((h))
|
||||
|
||||
#define F_METHOD_CALLBACK(i,h) \
|
||||
reinterpret_cast<finalcut::FWidget*>((i)) \
|
||||
, reinterpret_cast<finalcut::FWidget::FMemberCallback>((h))
|
||||
reinterpret_cast<finalcut::FWidget*>((i)), \
|
||||
std::bind ( reinterpret_cast<finalcut::FWidget::FMemberCallback>((h)) \
|
||||
, reinterpret_cast<finalcut::FWidget*>((i)) \
|
||||
, std::placeholders::_1 \
|
||||
, std::placeholders::_2 )
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
@ -144,8 +148,9 @@ class FWidget : public FVTerm, public FObject
|
|||
// Typedefs
|
||||
typedef std::vector<FWidget*> widgetList;
|
||||
typedef std::vector<accelerator> Accelerators;
|
||||
typedef void (*FCallback)(FWidget*, FDataPtr);
|
||||
typedef void (*FCallbackPtr)(FWidget*, FDataPtr);
|
||||
typedef void (FWidget::*FMemberCallback)(FWidget*, FDataPtr);
|
||||
typedef std::function<void(FWidget*, FDataPtr)> FCallback;
|
||||
|
||||
struct widget_flags // Properties of a widget ⚑
|
||||
{
|
||||
|
@ -183,7 +188,7 @@ class FWidget : public FVTerm, public FObject
|
|||
FWidget& operator = (const FWidget&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
FWidget* getRootWidget() const;
|
||||
FWidget* getParentWidget() const;
|
||||
static FWidget*& getMainWidget();
|
||||
|
@ -315,7 +320,7 @@ class FWidget : public FVTerm, public FObject
|
|||
, FDataPtr = nullptr );
|
||||
void addCallback ( const FString&
|
||||
, FWidget*
|
||||
, FMemberCallback
|
||||
, FCallback
|
||||
, FDataPtr = nullptr );
|
||||
void delCallback (FCallback);
|
||||
void delCallback (FWidget*);
|
||||
|
@ -346,21 +351,13 @@ class FWidget : public FVTerm, public FObject
|
|||
struct callback_data
|
||||
{
|
||||
FString cb_signal;
|
||||
FCallback cb_handler;
|
||||
FWidget* cb_instance;
|
||||
FCallback cb_function;
|
||||
FDataPtr data;
|
||||
};
|
||||
|
||||
struct member_callback_data
|
||||
{
|
||||
FString cb_signal;
|
||||
FWidget* cb_instance;
|
||||
FMemberCallback cb_handler;
|
||||
FDataPtr data;
|
||||
};
|
||||
|
||||
// Typedefs
|
||||
typedef std::vector<callback_data> CallbackObjects;
|
||||
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
||||
|
||||
// Accessor
|
||||
term_area* getPrintArea() override;
|
||||
|
@ -370,7 +367,7 @@ class FWidget : public FVTerm, public FObject
|
|||
static widgetList*& getAlwaysOnTopList();
|
||||
static widgetList*& getWidgetCloseList();
|
||||
void addPreprocessingHandler ( FVTerm*
|
||||
, FPreprocessingHandler ) override;
|
||||
, FVTermPreprocessing ) override;
|
||||
void delPreprocessingHandler (FVTerm*) override;
|
||||
|
||||
// Inquiry
|
||||
|
@ -417,6 +414,7 @@ class FWidget : public FVTerm, public FObject
|
|||
void insufficientSpaceAdjust();
|
||||
void KeyPressEvent (FKeyEvent*);
|
||||
void KeyDownEvent (FKeyEvent*);
|
||||
FCallbackPtr getCallbackPtr (FCallback);
|
||||
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
|
||||
void processDestroy();
|
||||
virtual void draw();
|
||||
|
@ -495,7 +493,6 @@ class FWidget : public FVTerm, public FObject
|
|||
FColor background_color{fc::Default};
|
||||
FString statusbar_message{};
|
||||
Accelerators* accelerator_list{nullptr};
|
||||
MemberCallbackObjects member_callback_objects{};
|
||||
CallbackObjects callback_objects{};
|
||||
|
||||
static FStatusBar* statusbar;
|
||||
|
@ -532,7 +529,7 @@ void drawBorder (FWidget*, FRect);
|
|||
|
||||
// FWidget inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FWidget::getClassName() const
|
||||
inline const FString FWidget::getClassName() const
|
||||
{ return "FWidget"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -88,7 +88,7 @@ class FWindow : public FWidget
|
|||
FWindow& operator = (const FWindow&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const override;
|
||||
const FString getClassName() const override;
|
||||
static FWindow* getWindowWidget (const FWidget*);
|
||||
static int getWindowLayer (const FWidget*);
|
||||
FWidget* getWindowFocusWidget() const;
|
||||
|
@ -182,7 +182,7 @@ class FWindow : public FWidget
|
|||
|
||||
// FWindow inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FWindow::getClassName() const
|
||||
inline const FString FWindow::getClassName() const
|
||||
{ return "FWindow"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -71,8 +71,8 @@ class FColorPairTest : public CPPUNIT_NS::TestFixture
|
|||
void FColorPairTest::classNameTest()
|
||||
{
|
||||
const finalcut::FColorPair p;
|
||||
const char* const classname = p.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname, "FColorPair") == 0 );
|
||||
const finalcut::FString& classname = p.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FColorPair" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -293,8 +293,8 @@ FKeyboardTest::~FKeyboardTest()
|
|||
void FKeyboardTest::classNameTest()
|
||||
{
|
||||
finalcut::FKeyboard k;
|
||||
const char* const classname = k.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname, "FKeyboard") == 0 );
|
||||
const finalcut::FString& classname = k.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FKeyboard" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2779,17 +2779,12 @@ void FKeyboardTest::unknownKeyTest()
|
|||
void FKeyboardTest::init()
|
||||
{
|
||||
keyboard = new finalcut::FKeyboard();
|
||||
finalcut::FApplication* object = \
|
||||
reinterpret_cast<finalcut::FApplication*>(this);
|
||||
void (finalcut::FApplication::*method1)()
|
||||
= reinterpret_cast<void(finalcut::FApplication::*)()>(&FKeyboardTest::keyPressed);
|
||||
void (finalcut::FApplication::*method2)()
|
||||
= reinterpret_cast<void(finalcut::FApplication::*)()>(&FKeyboardTest::keyReleased);
|
||||
void (finalcut::FApplication::*method3)()
|
||||
= reinterpret_cast<void(finalcut::FApplication::*)()>(&FKeyboardTest::escapeKeyPressed);
|
||||
finalcut::FKeyboardCommand key_cmd1 (object, method1);
|
||||
finalcut::FKeyboardCommand key_cmd2 (object, method2);
|
||||
finalcut::FKeyboardCommand key_cmd3 (object, method3);
|
||||
auto cmd1 = std::bind(&FKeyboardTest::keyPressed, this);
|
||||
auto cmd2 = std::bind(&FKeyboardTest::keyReleased, this);
|
||||
auto cmd3 = std::bind(&FKeyboardTest::escapeKeyPressed, this);
|
||||
finalcut::FKeyboardCommand key_cmd1 (cmd1);
|
||||
finalcut::FKeyboardCommand key_cmd2 (cmd2);
|
||||
finalcut::FKeyboardCommand key_cmd3 (cmd3);
|
||||
keyboard->setPressCommand (key_cmd1);
|
||||
keyboard->setReleaseCommand (key_cmd2);
|
||||
keyboard->setEscPressedCommand (key_cmd3);
|
||||
|
|
|
@ -126,30 +126,30 @@ class FMouseTest : public CPPUNIT_NS::TestFixture
|
|||
void FMouseTest::classNameTest()
|
||||
{
|
||||
test::FMouse_protected m;
|
||||
const char* const classname1 = m.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname1, "FMouse") == 0 );
|
||||
const finalcut::FString& classname1 = m.getClassName();
|
||||
CPPUNIT_ASSERT ( classname1 == "FMouse" );
|
||||
|
||||
#ifdef F_HAVE_LIBGPM
|
||||
finalcut::FMouseGPM gpm_mouse;
|
||||
const char* const classname2 = gpm_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname2, "FMouseGPM") == 0 );
|
||||
const finalcut::FString& classname2 = gpm_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( classname2 == "FMouseGPM" );
|
||||
#endif
|
||||
|
||||
finalcut::FMouseX11 x11_mouse;
|
||||
const char* const classname3 = x11_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname3, "FMouseX11") == 0 );
|
||||
const finalcut::FString& classname3 = x11_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( classname3 == "FMouseX11" );
|
||||
|
||||
finalcut::FMouseSGR sgr_mouse;
|
||||
const char* const classname4 = sgr_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname4, "FMouseSGR") == 0 );
|
||||
const finalcut::FString& classname4 = sgr_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( classname4 == "FMouseSGR" );
|
||||
|
||||
finalcut::FMouseUrxvt urxvt_mouse;
|
||||
const char* const classname5 = urxvt_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname5, "FMouseUrxvt") == 0 );
|
||||
const finalcut::FString& classname5 = urxvt_mouse.getClassName();
|
||||
CPPUNIT_ASSERT ( classname5 == "FMouseUrxvt" );
|
||||
|
||||
finalcut::FMouseControl mouse_control;
|
||||
const char* const classname6 = mouse_control.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname6, "FMouseControl") == 0 );
|
||||
const finalcut::FString& classname6 = mouse_control.getClassName();
|
||||
CPPUNIT_ASSERT ( classname6 == "FMouseControl" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -183,8 +183,8 @@ class FObjectTest : public CPPUNIT_NS::TestFixture
|
|||
void FObjectTest::classNameTest()
|
||||
{
|
||||
finalcut::FObject o;
|
||||
const char* const classname = o.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname, "FObject") == 0 );
|
||||
const finalcut::FString& classname = o.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FObject" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -224,12 +224,12 @@ void FObjectTest::noArgumentTest()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::childObjectTest()
|
||||
{/*
|
||||
* obj -> c1 -> c5 -> c6
|
||||
* -> c2
|
||||
* -> c3
|
||||
* -> c4
|
||||
*/
|
||||
{
|
||||
// obj -> c1 -> c5 -> c6
|
||||
// -> c2
|
||||
// -> c3
|
||||
// -> c4
|
||||
|
||||
finalcut::FObject obj;
|
||||
auto c1 = new finalcut::FObject(&obj);
|
||||
auto c2 = new finalcut::FObject(&obj);
|
||||
|
@ -294,9 +294,9 @@ void FObjectTest::widgetObjectTest()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::removeParentTest()
|
||||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
{
|
||||
// obj -> child
|
||||
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject(obj);
|
||||
|
||||
|
@ -321,9 +321,9 @@ void FObjectTest::removeParentTest()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::addTest()
|
||||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
{
|
||||
// obj -> child
|
||||
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject();
|
||||
|
||||
|
@ -347,9 +347,9 @@ void FObjectTest::addTest()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::delTest()
|
||||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
{
|
||||
// obj -> child
|
||||
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject(obj);
|
||||
|
||||
|
@ -374,11 +374,11 @@ void FObjectTest::delTest()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FObjectTest::iteratorTest()
|
||||
{/*
|
||||
* obj -> child1
|
||||
* -> child2
|
||||
* -> child3
|
||||
*/
|
||||
{
|
||||
// obj -> child1
|
||||
// -> child2
|
||||
// -> child3
|
||||
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child1 = new finalcut::FObject(obj);
|
||||
auto child2 = new finalcut::FObject(obj);
|
||||
|
|
|
@ -111,8 +111,8 @@ class FOptiAttrTest : public CPPUNIT_NS::TestFixture
|
|||
void FOptiAttrTest::classNameTest()
|
||||
{
|
||||
finalcut::FOptiAttr opti_attr;
|
||||
const char* const classname = opti_attr.getClassName();
|
||||
CPPUNIT_ASSERT_CSTRING ( classname, "FOptiAttr");
|
||||
const finalcut::FString& classname = opti_attr.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FOptiAttr");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -109,8 +109,8 @@ class FOptiMoveTest : public CPPUNIT_NS::TestFixture
|
|||
void FOptiMoveTest::classNameTest()
|
||||
{
|
||||
finalcut::FOptiMove opti_move;
|
||||
const char* const classname = opti_move.getClassName();
|
||||
CPPUNIT_ASSERT_CSTRING ( classname, "FOptiMove");
|
||||
const finalcut::FString& classname = opti_move.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FOptiMove");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -698,7 +698,7 @@ void FOptiMoveTest::wyse50Test()
|
|||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(ESC "=%%"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR("\036"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n"));om.set_auto_left_margin (true);
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR("\f"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b"));
|
||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR("\f\f"));
|
||||
|
|
|
@ -88,8 +88,8 @@ class FPointTest : public CPPUNIT_NS::TestFixture
|
|||
void FPointTest::classNameTest()
|
||||
{
|
||||
finalcut::FPoint p;
|
||||
const char* const classname = p.getClassName();
|
||||
CPPUNIT_ASSERT ( std::strcmp(classname, "FPoint") == 0 );
|
||||
const finalcut::FString& classname = p.getClassName();
|
||||
CPPUNIT_ASSERT ( classname == "FPoint" );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue