Screen reports (like Secondary DA) are now read directly
This commit is contained in:
parent
adccd6ae3b
commit
e74dccf481
|
@ -1,3 +1,10 @@
|
||||||
|
2020-10-08 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Better keyboard support for urxvt terminals
|
||||||
|
* Screen reports (like Secondary DA) are now read directly
|
||||||
|
* Report Cursor Position (DECXCPR) support
|
||||||
|
* FListView and FListBox now have direct access to the list of client
|
||||||
|
elements via data()
|
||||||
|
|
||||||
2020-10-05 Markus Gans <guru.mail@muenster.de>
|
2020-10-05 Markus Gans <guru.mail@muenster.de>
|
||||||
* Now hides the input cursor when a widget gets hidden
|
* Now hides the input cursor when a widget gets hidden
|
||||||
|
|
||||||
|
|
|
@ -177,18 +177,12 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void CheckList::cb_showList()
|
void CheckList::cb_showList()
|
||||||
{
|
{
|
||||||
auto iter = listview.beginOfList();
|
|
||||||
finalcut::FString shopping_list{};
|
finalcut::FString shopping_list{};
|
||||||
|
|
||||||
while ( iter != listview.endOfList() )
|
for (auto item : listview.getData())
|
||||||
{
|
{
|
||||||
const auto item = static_cast<finalcut::FListViewItem*>(*iter);
|
|
||||||
|
|
||||||
if ( item->isChecked() )
|
if ( item->isChecked() )
|
||||||
shopping_list << fc::Bullet << ' '
|
shopping_list << fc::Bullet << ' ' << item->getText(1) << '\n';
|
||||||
<< item->getText(1) << '\n';
|
|
||||||
|
|
||||||
++iter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shopping_list.isEmpty() )
|
if ( shopping_list.isEmpty() )
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
* <http://www.gnu.org/licenses/>. *
|
* <http://www.gnu.org/licenses/>. *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <string>
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ class RotoZoomer final : public finalcut::FDialog
|
||||||
bool benchmark{false};
|
bool benchmark{false};
|
||||||
int loops{0};
|
int loops{0};
|
||||||
int path{0};
|
int path{0};
|
||||||
wchar_t data[256]{};
|
std::wstring data{std::wstring(256, L'\0')};
|
||||||
finalcut::FString report{};
|
finalcut::FString report{};
|
||||||
time_point<system_clock> start{};
|
time_point<system_clock> start{};
|
||||||
time_point<system_clock> end{};
|
time_point<system_clock> end{};
|
||||||
|
@ -89,29 +90,29 @@ RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l)
|
||||||
{
|
{
|
||||||
FDialog::setText ("Rotozoomer effect");
|
FDialog::setText ("Rotozoomer effect");
|
||||||
|
|
||||||
int h{0};
|
std::size_t h{0};
|
||||||
|
|
||||||
for (int j{0}; j < 8; j++)
|
for (std::size_t j{0}; j < 8; j++)
|
||||||
{
|
{
|
||||||
for (int i{0}; i < 8; i++)
|
for (std::size_t i{0}; i < 8; i++)
|
||||||
{
|
{
|
||||||
data[h++] = L' ';
|
data[h++] = L' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i{0}; i < 8; i++)
|
for (std::size_t i{0}; i < 8; i++)
|
||||||
{
|
{
|
||||||
data[h++] = L'+';
|
data[h++] = L'+';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j{0}; j < 8; j++)
|
for (std::size_t j{0}; j < 8; j++)
|
||||||
{
|
{
|
||||||
for (int i{0}; i < 8; i++)
|
for (std::size_t i{0}; i < 8; i++)
|
||||||
{
|
{
|
||||||
data[h++] = L'x';
|
data[h++] = L'x';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i{0}; i < 8; i++)
|
for (std::size_t i{0}; i < 8; i++)
|
||||||
{
|
{
|
||||||
data[h++] = L' ';
|
data[h++] = L' ';
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,7 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a)
|
||||||
|
|
||||||
for (int x = 0; x < Cols; x++)
|
for (int x = 0; x < Cols; x++)
|
||||||
{
|
{
|
||||||
wchar_t ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];
|
auto ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];
|
||||||
|
|
||||||
if ( ch == '+' )
|
if ( ch == '+' )
|
||||||
print() << finalcut::FColorPair{fc::Black, fc::Red};
|
print() << finalcut::FColorPair{fc::Black, fc::Red};
|
||||||
|
|
|
@ -305,8 +305,7 @@ class MyDialog final : public finalcut::FDialog
|
||||||
, const finalcut::FLineEdit& ) const;
|
, const finalcut::FLineEdit& ) const;
|
||||||
void cb_setTitlebar (const finalcut::FLineEdit&);
|
void cb_setTitlebar (const finalcut::FLineEdit&);
|
||||||
void cb_showProgressBar();
|
void cb_showProgressBar();
|
||||||
void cb_updateNumber ( const finalcut::FListBox&
|
void cb_updateNumber();
|
||||||
, finalcut::FLabel& ) const;
|
|
||||||
void cb_activateButton ( const finalcut::FRadioButton&
|
void cb_activateButton ( const finalcut::FRadioButton&
|
||||||
, finalcut::FButton& ) const;
|
, finalcut::FButton& ) const;
|
||||||
void cb_view (const finalcut::FMenuItem*);
|
void cb_view (const finalcut::FMenuItem*);
|
||||||
|
@ -774,8 +773,7 @@ void MyDialog::initWidgetsCallbacks()
|
||||||
myList.addCallback
|
myList.addCallback
|
||||||
(
|
(
|
||||||
"row-selected",
|
"row-selected",
|
||||||
this, &MyDialog::cb_updateNumber,
|
this, &MyDialog::cb_updateNumber
|
||||||
std::ref(myList), std::ref(tagged_count)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,19 +975,17 @@ void MyDialog::cb_showProgressBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_updateNumber ( const finalcut::FListBox& list
|
void MyDialog::cb_updateNumber()
|
||||||
, finalcut::FLabel& num) const
|
|
||||||
{
|
{
|
||||||
const auto count = list.getCount();
|
|
||||||
int select_num = 0;
|
int select_num = 0;
|
||||||
|
|
||||||
for (std::size_t n{1}; n <= count; n++)
|
for (auto&& item : myList.getData() )
|
||||||
if ( list.isSelected(n) )
|
if ( item.isSelected() )
|
||||||
select_num++;
|
select_num++;
|
||||||
|
|
||||||
num.clear();
|
tagged_count.clear();
|
||||||
num << select_num;
|
tagged_count << select_num;
|
||||||
num.redraw();
|
tagged_count.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -96,9 +96,10 @@ FApplication::FApplication (const int& _argc, char* _argv[])
|
||||||
|
|
||||||
if ( ! (_argc && _argv) )
|
if ( ! (_argc && _argv) )
|
||||||
{
|
{
|
||||||
static char empty_str[1] = "";
|
typedef char* CString;
|
||||||
|
static CString empty[1]{CString("")};
|
||||||
app_argc = 0;
|
app_argc = 0;
|
||||||
app_argv = reinterpret_cast<char**>(&empty_str);
|
app_argv = empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
|
@ -80,7 +80,7 @@ void FBusyIndicator::createIndicatorText()
|
||||||
|
|
||||||
if ( FTerm::getEncoding() == fc::UTF8 )
|
if ( FTerm::getEncoding() == fc::UTF8 )
|
||||||
{
|
{
|
||||||
const wchar_t (&p)[8] = uni_pattern;
|
const auto& p = uni_pattern;
|
||||||
line[0] << " " << p[7] << " " << p[0] << " \n";
|
line[0] << " " << p[7] << " " << p[0] << " \n";
|
||||||
line[1] << " " << p[6] << " " << p[1] << " \n";
|
line[1] << " " << p[6] << " " << p[1] << " \n";
|
||||||
line[2] << " " << p[5] << " " << p[2] << " \n";
|
line[2] << " " << p[5] << " " << p[2] << " \n";
|
||||||
|
@ -88,7 +88,7 @@ void FBusyIndicator::createIndicatorText()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char (&p)[8] = pattern;
|
const auto& p = pattern;
|
||||||
line[0] << " " << p[7] << " " << p[0] << " \n";
|
line[0] << " " << p[7] << " " << p[0] << " \n";
|
||||||
line[1] << " " << p[6] << " " << p[1] << " \n";
|
line[1] << " " << p[6] << " " << p[1] << " \n";
|
||||||
line[2] << " " << p[5] << " " << p[2] << " \n";
|
line[2] << " " << p[5] << " " << p[2] << " \n";
|
||||||
|
|
|
@ -494,7 +494,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
const auto width = int(getWidth());
|
const auto width = int(getWidth());
|
||||||
|
|
||||||
const mouseStates ms =
|
const MouseStates ms =
|
||||||
{
|
{
|
||||||
ev->getX(),
|
ev->getX(),
|
||||||
ev->getY(),
|
ev->getY(),
|
||||||
|
@ -553,7 +553,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseUp (FMouseEvent* ev)
|
void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
const mouseStates ms =
|
const MouseStates ms =
|
||||||
{
|
{
|
||||||
ev->getX(),
|
ev->getX(),
|
||||||
ev->getY(),
|
ev->getY(),
|
||||||
|
@ -602,7 +602,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseMove (FMouseEvent* ev)
|
void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
const mouseStates ms =
|
const MouseStates ms =
|
||||||
{
|
{
|
||||||
ev->getX(),
|
ev->getX(),
|
||||||
ev->getY(),
|
ev->getY(),
|
||||||
|
@ -632,7 +632,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
const mouseStates ms =
|
const MouseStates ms =
|
||||||
{
|
{
|
||||||
ev->getX(),
|
ev->getX(),
|
||||||
ev->getY(),
|
ev->getY(),
|
||||||
|
@ -1317,7 +1317,7 @@ inline void FDialog::deactivateZoomButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::activateZoomButton (const mouseStates& ms)
|
inline void FDialog::activateZoomButton (const MouseStates& ms)
|
||||||
{
|
{
|
||||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||||
|| ms.mouse_y != 1 )
|
|| ms.mouse_y != 1 )
|
||||||
|
@ -1329,7 +1329,7 @@ inline void FDialog::activateZoomButton (const mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::leaveZoomButton (const mouseStates& ms)
|
inline void FDialog::leaveZoomButton (const MouseStates& ms)
|
||||||
{
|
{
|
||||||
bool zoom_button_pressed_before = zoom_button_pressed;
|
bool zoom_button_pressed_before = zoom_button_pressed;
|
||||||
|
|
||||||
|
@ -1346,7 +1346,7 @@ inline void FDialog::leaveZoomButton (const mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::pressZoomButton (const mouseStates& ms)
|
void FDialog::pressZoomButton (const MouseStates& ms)
|
||||||
{
|
{
|
||||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||||
|| ms.mouse_y != 1
|
|| ms.mouse_y != 1
|
||||||
|
@ -1370,7 +1370,7 @@ inline bool FDialog::isMouseOverMenu (const FPoint& termpos) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::passEventToSubMenu ( const mouseStates& ms
|
inline void FDialog::passEventToSubMenu ( const MouseStates& ms
|
||||||
, const FMouseEvent* ev )
|
, const FMouseEvent* ev )
|
||||||
{
|
{
|
||||||
// Mouse event handover to the dialog menu
|
// Mouse event handover to the dialog menu
|
||||||
|
@ -1518,7 +1518,7 @@ bool FDialog::isBottomOutside() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::isLowerRightResizeCorner (const mouseStates& ms) const
|
bool FDialog::isLowerRightResizeCorner (const MouseStates& ms) const
|
||||||
{
|
{
|
||||||
// 3 characters in the lower right corner |
|
// 3 characters in the lower right corner |
|
||||||
// x
|
// x
|
||||||
|
@ -1537,7 +1537,7 @@ bool FDialog::isLowerRightResizeCorner (const mouseStates& ms) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::resizeMouseDown (const mouseStates& ms)
|
void FDialog::resizeMouseDown (const MouseStates& ms)
|
||||||
{
|
{
|
||||||
// Click on the lower right resize corner
|
// Click on the lower right resize corner
|
||||||
|
|
||||||
|
@ -1562,7 +1562,7 @@ void FDialog::resizeMouseDown (const mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
void FDialog::resizeMouseUpMove (const MouseStates& ms, bool mouse_up)
|
||||||
{
|
{
|
||||||
// Resize the dialog
|
// Resize the dialog
|
||||||
if ( isResizeable() && ! resize_click_pos.isOrigin() )
|
if ( isResizeable() && ! resize_click_pos.isOrigin() )
|
||||||
|
|
|
@ -179,7 +179,7 @@ FString FFileDialog::getSelectedFile() const
|
||||||
void FFileDialog::setPath (const FString& dir)
|
void FFileDialog::setPath (const FString& dir)
|
||||||
{
|
{
|
||||||
const char* const dirname = dir.c_str();
|
const char* const dirname = dir.c_str();
|
||||||
char resolved_path[MAXPATHLEN]{};
|
std::array<char, MAXPATHLEN> resolved_path{};
|
||||||
FString r_dir{};
|
FString r_dir{};
|
||||||
struct stat sb{};
|
struct stat sb{};
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ void FFileDialog::setPath (const FString& dir)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fsystem && fsystem->realpath(dir.c_str(), resolved_path) != nullptr )
|
if ( fsystem && fsystem->realpath(dir.c_str(), resolved_path.data()) != nullptr )
|
||||||
r_dir.setString(resolved_path);
|
r_dir.setString(resolved_path.data());
|
||||||
else
|
else
|
||||||
r_dir.setString(dir);
|
r_dir.setString(dir);
|
||||||
|
|
||||||
|
@ -418,20 +418,20 @@ void FFileDialog::initCallbacks()
|
||||||
inline bool FFileDialog::patternMatch ( const char* const pattern
|
inline bool FFileDialog::patternMatch ( const char* const pattern
|
||||||
, const char fname[] ) const
|
, const char fname[] ) const
|
||||||
{
|
{
|
||||||
char search[128]{};
|
std::array<char, 128> search{};
|
||||||
|
|
||||||
if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files
|
if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files
|
||||||
{
|
{
|
||||||
search[0] = '.';
|
search[0] = '.';
|
||||||
search[1] = '\0';
|
search[1] = '\0';
|
||||||
std::strncat(search, pattern, sizeof(search) - std::strlen(search) - 1);
|
std::strncat(search.data(), pattern, search.size() - std::strlen(search.data()) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::strncpy(search, pattern, sizeof(search));
|
std::strncpy(search.data(), pattern, search.size());
|
||||||
|
|
||||||
search[sizeof(search) - 1] = '\0';
|
search[search.size() - 1] = '\0';
|
||||||
|
|
||||||
if ( fnmatch (search, fname, FNM_PERIOD) == 0 )
|
if ( fnmatch (search.data(), fname, FNM_PERIOD) == 0 )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -595,24 +595,24 @@ void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) const
|
||||||
if ( ! entry.symbolic_link )
|
if ( ! entry.symbolic_link )
|
||||||
return; // No symbolic link
|
return; // No symbolic link
|
||||||
|
|
||||||
char resolved_path[MAXPATHLEN]{};
|
std::array<char, MAXPATHLEN> resolved_path{};
|
||||||
char symLink[MAXPATHLEN]{};
|
std::array<char, MAXPATHLEN> symLink{};
|
||||||
struct stat sb{};
|
struct stat sb{};
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
std::strncpy (symLink, dir, sizeof(symLink));
|
std::strncpy (symLink.data(), dir, symLink.size());
|
||||||
symLink[sizeof(symLink) - 1] = '\0';
|
symLink[symLink.size() - 1] = '\0';
|
||||||
std::strncat ( symLink
|
std::strncat ( symLink.data()
|
||||||
, entry.name.c_str()
|
, entry.name.c_str()
|
||||||
, sizeof(symLink) - std::strlen(symLink) - 1);
|
, symLink.size() - std::strlen(symLink.data()) - 1);
|
||||||
symLink[sizeof(symLink) - 1] = '\0';
|
symLink[symLink.size() - 1] = '\0';
|
||||||
|
|
||||||
if ( fsystem->realpath(symLink, resolved_path) == nullptr )
|
if ( fsystem->realpath(symLink.data(), resolved_path.data()) == nullptr )
|
||||||
return; // Cannot follow the symlink
|
return; // Cannot follow the symlink
|
||||||
|
|
||||||
if ( lstat(resolved_path, &sb) == -1 )
|
if ( lstat(resolved_path.data(), &sb) == -1 )
|
||||||
return; // Cannot get file status
|
return; // Cannot get file status
|
||||||
|
|
||||||
if ( S_ISDIR(sb.st_mode) )
|
if ( S_ISDIR(sb.st_mode) )
|
||||||
|
@ -740,14 +740,14 @@ FString FFileDialog::getHomeDir()
|
||||||
{
|
{
|
||||||
struct passwd pwd{};
|
struct passwd pwd{};
|
||||||
struct passwd* pwd_ptr{};
|
struct passwd* pwd_ptr{};
|
||||||
char buf[1024]{};
|
std::array<char, 1024> buf{};
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
const uid_t euid = fsystem->geteuid();
|
const uid_t euid = fsystem->geteuid();
|
||||||
|
|
||||||
if ( fsystem->getpwuid_r(euid, &pwd, buf, sizeof(buf), &pwd_ptr) )
|
if ( fsystem->getpwuid_r(euid, &pwd, buf.data(), buf.size(), &pwd_ptr) )
|
||||||
return FString{""};
|
return FString{""};
|
||||||
else
|
else
|
||||||
return FString{pwd.pw_dir};
|
return FString{pwd.pw_dir};
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fkey_map.h"
|
#include "final/fkey_map.h"
|
||||||
#include "final/ftypes.h"
|
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
{
|
{
|
||||||
|
@ -32,14 +31,13 @@ namespace finalcut
|
||||||
namespace fc
|
namespace fc
|
||||||
{
|
{
|
||||||
|
|
||||||
std::array<FKeyMap, 174> fkey
|
std::array<FKeyMap, 188> fkey
|
||||||
{{
|
{{
|
||||||
{ fc::Fkey_backspace , nullptr, "kb" }, // backspace key
|
{ fc::Fkey_backspace , nullptr, "kb" }, // backspace key
|
||||||
{ fc::Fkey_catab , nullptr, "ka" }, // clear-all-tabs key
|
{ fc::Fkey_catab , nullptr, "ka" }, // clear-all-tabs key
|
||||||
{ fc::Fkey_clear , nullptr, "kC" }, // clear-screen or erase key
|
{ fc::Fkey_clear , nullptr, "kC" }, // clear-screen or erase key
|
||||||
{ fc::Fkey_ctab , nullptr, "kt" }, // clear-tab key
|
{ fc::Fkey_ctab , nullptr, "kt" }, // clear-tab key
|
||||||
{ fc::Fkey_dc , nullptr, "kD" }, // delete-character key
|
{ fc::Fkey_dc , nullptr, "kD" }, // delete-character key
|
||||||
{ fc::Fkey_dc , nullptr, "kDx"}, // keypad delete
|
|
||||||
{ fc::Fkey_dl , nullptr, "kL" }, // delete-line key
|
{ fc::Fkey_dl , nullptr, "kL" }, // delete-line key
|
||||||
{ fc::Fkey_down , nullptr, "kd" }, // down-arrow key
|
{ fc::Fkey_down , nullptr, "kd" }, // down-arrow key
|
||||||
{ fc::Fkey_eic , nullptr, "kM" }, // sent by rmir or smir in insert mode
|
{ fc::Fkey_eic , nullptr, "kM" }, // sent by rmir or smir in insert mode
|
||||||
|
@ -186,36 +184,51 @@ std::array<FKeyMap, 174> fkey
|
||||||
{ fc::Fkey_f63 , nullptr, "Fr" }, // F63 function key
|
{ fc::Fkey_f63 , nullptr, "Fr" }, // F63 function key
|
||||||
// Some terminals (e.g. PuTTY) send vt100 key codes
|
// Some terminals (e.g. PuTTY) send vt100 key codes
|
||||||
// when the arrow and function keys are pressed
|
// when the arrow and function keys are pressed
|
||||||
{ fc::Fkey_down , CSI "B", "kdx"}, // down-arrow key (standard mode)
|
{ fc::Fkey_f1 , ESC "OP", "k1x"}, // PF1 (application mode)
|
||||||
{ fc::Fkey_down , ESC "OB", "kdX"}, // down-arrow key (application mode)
|
{ fc::Fkey_f2 , ESC "OQ", "k2x"}, // PF2 (application mode)
|
||||||
{ fc::Fkey_f1 , ESC "OP", "k1X"}, // PF1 (application mode)
|
{ fc::Fkey_f3 , ESC "OR", "k3x"}, // PF3 (application mode)
|
||||||
{ fc::Fkey_f2 , ESC "OQ", "k2X"}, // PF2 (application mode)
|
{ fc::Fkey_f4 , ESC "OS", "k4x"}, // PF4 (application mode)
|
||||||
{ fc::Fkey_f3 , ESC "OR", "k3X"}, // PF3 (application mode)
|
|
||||||
{ fc::Fkey_f4 , ESC "OS", "k4X"}, // PF4 (application mode)
|
|
||||||
{ fc::Fkey_left , CSI "D", "klx"}, // left-arrow key (standard mode)
|
{ fc::Fkey_left , CSI "D", "klx"}, // left-arrow key (standard mode)
|
||||||
{ fc::Fkey_left , ESC "OD", "klX"}, // left-arrow key (application mode)
|
{ fc::Fkey_left , ESC "OD", "klX"}, // left-arrow key (application mode)
|
||||||
{ fc::Fkey_right , CSI "C", "krx"}, // right-arrow key (standard mode)
|
{ fc::Fkey_right , CSI "C", "krx"}, // right-arrow key (standard mode)
|
||||||
{ fc::Fkey_right , ESC "OC", "krX"}, // right-arrow key (application mode)
|
{ fc::Fkey_right , ESC "OC", "krX"}, // right-arrow key (application mode)
|
||||||
{ fc::Fkey_up , CSI "A", "kux"}, // up-arrow key (standard mode)
|
{ fc::Fkey_up , CSI "A", "kux"}, // up-arrow key (standard mode)
|
||||||
{ fc::Fkey_up , ESC "OA", "kuX"}, // up-arrow key (application mode)
|
{ fc::Fkey_up , ESC "OA", "kuX"}, // up-arrow key (application mode)
|
||||||
|
{ fc::Fkey_down , CSI "B", "kdx"}, // down-arrow key (standard mode)
|
||||||
|
{ fc::Fkey_down , ESC "OB", "kdX"}, // down-arrow key (application mode)
|
||||||
|
{ fc::Fkey_sf , CSI "a", "kFx"}, // scroll-forward key (shift-up)
|
||||||
|
{ fc::Fkey_sr , CSI "b", "kRx"}, // scroll-backward key (shift-down)
|
||||||
// Fallback for rxvt with TERM=xterm
|
// Fallback for rxvt with TERM=xterm
|
||||||
{ fc::Fkey_home , CSI "7~", "khx"}, // home key
|
{ fc::Fkey_home , CSI "7~", "khx"}, // home key
|
||||||
{ fc::Fkey_end , CSI "8~", "@7x"}, // end key
|
{ fc::Fkey_end , CSI "8~", "@7x"}, // end key
|
||||||
{ fc::Fkey_f1 , CSI "11~", "k1x"}, // F1 function key
|
{ fc::Fkey_f1 , CSI "11~", "k1X"}, // F1 function key
|
||||||
{ fc::Fkey_f2 , CSI "12~", "k2x"}, // F2 function key
|
{ fc::Fkey_f2 , CSI "12~", "k2X"}, // F2 function key
|
||||||
{ fc::Fkey_f3 , CSI "13~", "k3x"}, // F3 function key
|
{ fc::Fkey_f3 , CSI "13~", "k3X"}, // F3 function key
|
||||||
{ fc::Fkey_f4 , CSI "14~", "k4x"}, // F4 function key
|
{ fc::Fkey_f4 , CSI "14~", "k4X"}, // F4 function key
|
||||||
// Fallback for TERM=ansi
|
// Fallback for TERM=ansi
|
||||||
{ fc::Fkey_end , CSI "K", "@7X"}, // end key
|
{ fc::Fkey_home , CSI "H", "khX"}, // home key
|
||||||
|
{ fc::Fkey_end , CSI "F", "@7X"}, // end key
|
||||||
|
{ fc::Fkey_end , CSI "K", "@7y"}, // end key (Microsoft HyperTerminal)
|
||||||
// Keypad keys
|
// Keypad keys
|
||||||
{ fc::Fkey_enter , ESC "OM", "@8x"}, // enter key
|
{ fc::Fkey_enter , ESC "OM", "@8x"}, // enter key
|
||||||
{ fc::Fkey_slash , ESC "Oo", "KP1"}, // keypad slash
|
{ fc::Fkey_slash , ESC "Oo", "KP1"}, // keypad slash
|
||||||
{ fc::Fkey_asterisk , ESC "Oj", "KP2"}, // keypad asterisk
|
{ fc::Fkey_asterisk , ESC "Oj", "KP2"}, // keypad asterisk
|
||||||
{ fc::Fkey_minus_sign, ESC "Om", "KP3"}, // keypad minus sign
|
{ fc::Fkey_minus_sign, ESC "Om", "KP3"}, // keypad minus sign
|
||||||
{ fc::Fkey_plus_sign , ESC "Ok", "KP4"} // keypad plus sign
|
{ fc::Fkey_plus_sign , ESC "Ok", "KP4"}, // keypad plus sign
|
||||||
|
{ fc::Fkey_ic , ESC "Op", "kIx"}, // keypad insert
|
||||||
|
{ fc::Fkey_dc , ESC "On", "kDx"}, // keypad delete
|
||||||
|
{ fc::Fkey_left , ESC "Ot", "kly"}, // keypad left-arrow
|
||||||
|
{ fc::Fkey_right , ESC "Ov", "kry"}, // keypad right-arrow
|
||||||
|
{ fc::Fkey_up , ESC "Ox", "kuy"}, // keypad up-arrow
|
||||||
|
{ fc::Fkey_down , ESC "Or", "kdy"}, // keypad down-arrow
|
||||||
|
{ fc::Fkey_a1 , ESC "Ow", "K1x"}, // keypad upper left
|
||||||
|
{ fc::Fkey_a3 , ESC "Oy", "K3x"}, // keypad upper right
|
||||||
|
{ fc::Fkey_b2 , ESC "Ou", "K2x"}, // keypad center
|
||||||
|
{ fc::Fkey_c1 , ESC "Oq", "K4x"}, // keypad lower left
|
||||||
|
{ fc::Fkey_c3 , ESC "Os", "K5x"} // keypad lower right
|
||||||
}};
|
}};
|
||||||
|
|
||||||
constexpr std::array<FMetakeyMap, 228> fmetakey =
|
constexpr std::array<FMetakeyMap, 232> fmetakey =
|
||||||
{{
|
{{
|
||||||
{ fc::Fmkey_ic , "\033[2;3~" }, // M-insert
|
{ fc::Fmkey_ic , "\033[2;3~" }, // M-insert
|
||||||
{ fc::Fmkey_ic , "\033\033[2~" }, // M-insert
|
{ fc::Fmkey_ic , "\033\033[2~" }, // M-insert
|
||||||
|
@ -290,9 +303,13 @@ constexpr std::array<FMetakeyMap, 228> fmetakey =
|
||||||
{ fc::Fckey_ppage , "\033[5;5~" }, // ctrl-prev-page
|
{ fc::Fckey_ppage , "\033[5;5~" }, // ctrl-prev-page
|
||||||
{ fc::Fckey_npage , "\033[6;5~" }, // ctrl-next-page
|
{ fc::Fckey_npage , "\033[6;5~" }, // ctrl-next-page
|
||||||
{ fc::Fckey_up , "\033[1;5A" }, // ctrl-up
|
{ fc::Fckey_up , "\033[1;5A" }, // ctrl-up
|
||||||
|
{ fc::Fckey_up , "\033Oa" }, // ctrl-up
|
||||||
{ fc::Fckey_down , "\033[1;5B" }, // ctrl-down
|
{ fc::Fckey_down , "\033[1;5B" }, // ctrl-down
|
||||||
|
{ fc::Fckey_down , "\033Ob" }, // ctrl-down
|
||||||
{ fc::Fckey_right , "\033[1;5C" }, // ctrl-right
|
{ fc::Fckey_right , "\033[1;5C" }, // ctrl-right
|
||||||
|
{ fc::Fckey_right , "\033Oc" }, // ctrl-right
|
||||||
{ fc::Fckey_left , "\033[1;5D" }, // ctrl-left
|
{ fc::Fckey_left , "\033[1;5D" }, // ctrl-left
|
||||||
|
{ fc::Fckey_left , "\033Od" }, // ctrl-left
|
||||||
{ fc::Fckey_sic , "\033[2;6~" }, // shift-ctrl-M-insert
|
{ fc::Fckey_sic , "\033[2;6~" }, // shift-ctrl-M-insert
|
||||||
{ fc::Fckey_sdc , "\033[3;6~" }, // shift-ctrl-M-delete
|
{ fc::Fckey_sdc , "\033[3;6~" }, // shift-ctrl-M-delete
|
||||||
{ fc::Fckey_shome , "\033[1;6H" }, // shift-ctrl-M-home
|
{ fc::Fckey_shome , "\033[1;6H" }, // shift-ctrl-M-home
|
||||||
|
|
|
@ -108,6 +108,30 @@ FString FKeyboard::getKeyName (const FKey keynum) const
|
||||||
return FString{""};
|
return FString{""};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FKeyboard::setNonBlockingInput (bool enable)
|
||||||
|
{
|
||||||
|
if ( enable == non_blocking_stdin )
|
||||||
|
return non_blocking_stdin;
|
||||||
|
|
||||||
|
if ( enable ) // make stdin non-blocking
|
||||||
|
{
|
||||||
|
stdin_status_flags |= O_NONBLOCK;
|
||||||
|
|
||||||
|
if ( fcntl (FTermios::getStdIn(), F_SETFL, stdin_status_flags) != -1 )
|
||||||
|
non_blocking_stdin = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stdin_status_flags &= ~O_NONBLOCK;
|
||||||
|
|
||||||
|
if ( fcntl (FTermios::getStdIn(), F_SETFL, stdin_status_flags) != -1 )
|
||||||
|
non_blocking_stdin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return non_blocking_stdin;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FKeyboard::init()
|
void FKeyboard::init()
|
||||||
{
|
{
|
||||||
|
@ -303,7 +327,7 @@ inline FKey FKeyboard::getSingleKey()
|
||||||
// Look for a utf-8 character
|
// Look for a utf-8 character
|
||||||
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
||||||
{
|
{
|
||||||
char utf8char[5]{}; // Init array with '\0'
|
std::array<char, 5> utf8char{}; // Init array with '\0'
|
||||||
const std::size_t buf_len = std::strlen(fifo_buf);
|
const std::size_t buf_len = std::strlen(fifo_buf);
|
||||||
|
|
||||||
if ( (firstchar & 0xe0) == 0xc0 )
|
if ( (firstchar & 0xe0) == 0xc0 )
|
||||||
|
@ -319,7 +343,7 @@ inline FKey FKeyboard::getSingleKey()
|
||||||
for (std::size_t i{0}; i < len ; i++)
|
for (std::size_t i{0}; i < len ; i++)
|
||||||
utf8char[i] = char(fifo_buf[i] & 0xff);
|
utf8char[i] = char(fifo_buf[i] & 0xff);
|
||||||
|
|
||||||
keycode = UTF8decode(utf8char);
|
keycode = UTF8decode(utf8char.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
keycode = uChar(fifo_buf[0] & 0xff);
|
keycode = uChar(fifo_buf[0] & 0xff);
|
||||||
|
@ -338,30 +362,6 @@ inline FKey FKeyboard::getSingleKey()
|
||||||
return FKey(keycode == 127 ? fc::Fkey_backspace : keycode);
|
return FKey(keycode == 127 ? fc::Fkey_backspace : keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
bool FKeyboard::setNonBlockingInput (bool enable)
|
|
||||||
{
|
|
||||||
if ( enable == non_blocking_stdin )
|
|
||||||
return non_blocking_stdin;
|
|
||||||
|
|
||||||
if ( enable ) // make stdin non-blocking
|
|
||||||
{
|
|
||||||
stdin_status_flags |= O_NONBLOCK;
|
|
||||||
|
|
||||||
if ( fcntl (FTermios::getStdIn(), F_SETFL, stdin_status_flags) != -1 )
|
|
||||||
non_blocking_stdin = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stdin_status_flags &= ~O_NONBLOCK;
|
|
||||||
|
|
||||||
if ( fcntl (FTermios::getStdIn(), F_SETFL, stdin_status_flags) != -1 )
|
|
||||||
non_blocking_stdin = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return non_blocking_stdin;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FKeyboard::isKeypressTimeout()
|
inline bool FKeyboard::isKeypressTimeout()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1109,9 +1109,9 @@ inline wchar_t FLineEdit::characterFilter (const wchar_t c) const
|
||||||
if ( input_filter.empty() )
|
if ( input_filter.empty() )
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
const wchar_t character[2]{c, L'\0'};
|
std::array<const wchar_t, 2> character{{c, L'\0'}};
|
||||||
|
|
||||||
if ( regex_match(character, std::wregex(input_filter)) )
|
if ( regex_match(character.data(), std::wregex(input_filter)) )
|
||||||
return c;
|
return c;
|
||||||
else
|
else
|
||||||
return L'\0';
|
return L'\0';
|
||||||
|
|
|
@ -120,7 +120,7 @@ void FListBox::setCurrentItem (std::size_t index)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::setCurrentItem (listBoxItems::iterator iter)
|
void FListBox::setCurrentItem (FListBoxItems::iterator iter)
|
||||||
{
|
{
|
||||||
const auto index = std::size_t(std::distance(itemlist.begin(), iter)) + 1;
|
const auto index = std::size_t(std::distance(itemlist.begin(), iter)) + 1;
|
||||||
setCurrentItem(index);
|
setCurrentItem(index);
|
||||||
|
@ -641,7 +641,7 @@ void FListBox::adjustSize()
|
||||||
|
|
||||||
// private methods of FListBox
|
// private methods of FListBox
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString FListBox::getString (listBoxItems::iterator iter)
|
inline FString FListBox::getString (FListBoxItems::iterator iter)
|
||||||
{
|
{
|
||||||
return iter->getText();
|
return iter->getText();
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,7 @@ void FListBox::drawList()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::drawListLine ( int y
|
inline void FListBox::drawListLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, FListBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
const std::size_t inc_len = inc_search.getLength();
|
const std::size_t inc_len = inc_search.getLength();
|
||||||
|
@ -915,7 +915,7 @@ inline void FListBox::printRightBracket (fc::brackets_type bracket_type)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::drawListBracketsLine ( int y
|
inline void FListBox::drawListBracketsLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, FListBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
std::size_t b{0};
|
std::size_t b{0};
|
||||||
|
@ -1726,7 +1726,7 @@ void FListBox::changeOnResize() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::lazyConvert(listBoxItems::iterator iter, std::size_t y)
|
void FListBox::lazyConvert(FListBoxItems::iterator iter, std::size_t y)
|
||||||
{
|
{
|
||||||
if ( conv_type != lazy_convert || ! iter->getText().isNull() )
|
if ( conv_type != lazy_convert || ! iter->getText().isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1662,7 +1662,7 @@ void FListView::drawHeadlines()
|
||||||
|| max_line_width < 1 )
|
|| max_line_width < 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
headerItems::const_iterator iter = header.begin();
|
HeaderItems::const_iterator iter = header.begin();
|
||||||
headerline.clear();
|
headerline.clear();
|
||||||
|
|
||||||
if ( hasCheckableItems() )
|
if ( hasCheckableItems() )
|
||||||
|
@ -1983,7 +1983,7 @@ inline void FListView::drawHeaderBorder (std::size_t length)
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
void FListView::drawHeadlineLabel (const HeaderItems::const_iterator& iter)
|
||||||
{
|
{
|
||||||
// Print label text
|
// Print label text
|
||||||
static constexpr std::size_t leading_space = 1;
|
static constexpr std::size_t leading_space = 1;
|
||||||
|
@ -1992,7 +1992,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||||
const auto width = std::size_t(iter->width);
|
const auto width = std::size_t(iter->width);
|
||||||
std::size_t column_width = getColumnWidth(txt);
|
std::size_t column_width = getColumnWidth(txt);
|
||||||
const std::size_t column_max = leading_space + width;
|
const std::size_t column_max = leading_space + width;
|
||||||
const headerItems::const_iterator first = header.begin();
|
const HeaderItems::const_iterator first = header.begin();
|
||||||
const int column = int(std::distance(first, iter)) + 1;
|
const int column = int(std::distance(first, iter)) + 1;
|
||||||
const bool has_sort_indicator( sort_column == column && ! hide_sort_indicator );
|
const bool has_sort_indicator( sort_column == column && ! hide_sort_indicator );
|
||||||
const auto& wc = getColorTheme();
|
const auto& wc = getColorTheme();
|
||||||
|
@ -2119,7 +2119,7 @@ void FListView::drawBufferedHeadline()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
void FListView::drawColumnEllipsis ( const HeaderItems::const_iterator& iter
|
||||||
, const FString& text )
|
, const FString& text )
|
||||||
{
|
{
|
||||||
// Print label ellipsis
|
// Print label ellipsis
|
||||||
|
|
|
@ -60,14 +60,14 @@ void FLogger::newlineReplace ( std::string& str
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::string FLogger::getTimeString() const
|
std::string FLogger::getTimeString() const
|
||||||
{
|
{
|
||||||
char str[100];
|
std::array<char, 100> str;
|
||||||
const auto& now = std::chrono::system_clock::now();
|
const auto& now = std::chrono::system_clock::now();
|
||||||
const auto& t = std::chrono::system_clock::to_time_t(now);
|
const auto& t = std::chrono::system_clock::to_time_t(now);
|
||||||
// Print RFC 2822 date
|
// Print RFC 2822 date
|
||||||
struct tm time{};
|
struct tm time{};
|
||||||
localtime_r (&t, &time);
|
localtime_r (&t, &time);
|
||||||
std::strftime (str, sizeof(str), "%a, %d %b %Y %T %z", &time);
|
std::strftime (str.data(), str.size(), "%a, %d %b %Y %T %z", &time);
|
||||||
return std::string(str);
|
return std::string(str.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -267,7 +267,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ! mouse_down || getItemList().empty() )
|
if ( ! mouse_down || getItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouseStates ms =
|
MouseStates ms =
|
||||||
{
|
{
|
||||||
false, // focus_changed
|
false, // focus_changed
|
||||||
false, // hide_sub_menu
|
false, // hide_sub_menu
|
||||||
|
@ -819,7 +819,7 @@ bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms)
|
void FMenu::mouseMoveOverList (const FPoint& mouse_pos, MouseStates& ms)
|
||||||
{
|
{
|
||||||
FPoint pos{mouse_pos};
|
FPoint pos{mouse_pos};
|
||||||
pos -= FPoint{getRightPadding(), getTopPadding()};
|
pos -= FPoint{getRightPadding(), getTopPadding()};
|
||||||
|
@ -840,7 +840,7 @@ void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
void FMenu::mouseMoveSelection (FMenuItem* m_item, MouseStates& ms)
|
||||||
{
|
{
|
||||||
if ( ! m_item->isEnabled()
|
if ( ! m_item->isEnabled()
|
||||||
|| m_item->isSelected()
|
|| m_item->isSelected()
|
||||||
|
@ -873,7 +873,7 @@ void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseMoveDeselection (FMenuItem* m_item, mouseStates& ms)
|
void FMenu::mouseMoveDeselection (FMenuItem* m_item, MouseStates& ms)
|
||||||
{
|
{
|
||||||
if ( ! ms.mouse_over_menu
|
if ( ! ms.mouse_over_menu
|
||||||
|| ! m_item->isEnabled()
|
|| ! m_item->isEnabled()
|
||||||
|
@ -902,7 +902,7 @@ void FMenu::mouseUpOverBorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseMoveOverBorder (mouseStates& ms) const
|
void FMenu::mouseMoveOverBorder (MouseStates& ms) const
|
||||||
{
|
{
|
||||||
// Mouse is moved over border or separator line
|
// Mouse is moved over border or separator line
|
||||||
|
|
||||||
|
@ -1271,7 +1271,7 @@ inline void FMenu::drawSeparator (int y)
|
||||||
inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
|
inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
|
||||||
{
|
{
|
||||||
FString txt{m_item->getText()};
|
FString txt{m_item->getText()};
|
||||||
menuText txtdata{};
|
MenuText txtdata{};
|
||||||
std::size_t column_width = getColumnWidth(txt);
|
std::size_t column_width = getColumnWidth(txt);
|
||||||
const FKey accel_key = m_item->accel_key;
|
const FKey accel_key = m_item->accel_key;
|
||||||
const bool is_enabled = m_item->isEnabled();
|
const bool is_enabled = m_item->isEnabled();
|
||||||
|
@ -1361,7 +1361,7 @@ inline void FMenu::drawCheckMarkPrefix (const FMenuItem* m_item)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawMenuText (menuText& data)
|
inline void FMenu::drawMenuText (MenuText& data)
|
||||||
{
|
{
|
||||||
// Print menu text
|
// Print menu text
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,9 @@ bool FMouseGPM::hasData()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseGPM::setRawData (FKeyboard::keybuffer&)
|
void FMouseGPM::setRawData (FKeyboard::keybuffer&)
|
||||||
{ }
|
{
|
||||||
|
// This method need not be implemented for FMouseGPM
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseGPM::processEvent (struct timeval*)
|
void FMouseGPM::processEvent (struct timeval*)
|
||||||
|
|
|
@ -435,6 +435,9 @@ uInt FObject::processTimerEvent()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FObject::performTimerAction (FObject*, FEvent*)
|
void FObject::performTimerAction (FObject*, FEvent*)
|
||||||
{ }
|
{
|
||||||
|
// This method must be reimplemented in a subclass
|
||||||
|
// to process the passed object and timer event
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -53,7 +53,7 @@ FOptiAttr::~FOptiAttr() // destructor
|
||||||
|
|
||||||
// public methods of FOptiAttr
|
// public methods of FOptiAttr
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FOptiAttr::setTermEnvironment (const termEnv& term_env)
|
void FOptiAttr::setTermEnvironment (const TermEnv& term_env)
|
||||||
{
|
{
|
||||||
// Set all required termcap values at once
|
// Set all required termcap values at once
|
||||||
// and initialize the FOptiAttr environment
|
// and initialize the FOptiAttr environment
|
||||||
|
@ -551,7 +551,7 @@ const char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next)
|
||||||
attr_buf[0] = '\0';
|
attr_buf[0] = '\0';
|
||||||
|
|
||||||
if ( ! (term && next) )
|
if ( ! (term && next) )
|
||||||
return attr_buf;
|
return attr_buf.data();
|
||||||
|
|
||||||
prevent_no_color_video_attributes (term, next_has_color);
|
prevent_no_color_video_attributes (term, next_has_color);
|
||||||
prevent_no_color_video_attributes (next);
|
prevent_no_color_video_attributes (next);
|
||||||
|
@ -583,7 +583,7 @@ const char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next)
|
||||||
if ( FStartOptions::getFStartOptions().sgr_optimizer )
|
if ( FStartOptions::getFStartOptions().sgr_optimizer )
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
|
|
||||||
return attr_buf;
|
return attr_buf.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1086,8 +1086,8 @@ bool FOptiAttr::setTermDefaultColor (FChar*& term)
|
||||||
return true;
|
return true;
|
||||||
else if ( ansi_default_color )
|
else if ( ansi_default_color )
|
||||||
{
|
{
|
||||||
char sgr_39_49[] = CSI "39;49m";
|
std::string sgr_39_49{CSI "39;49m"};
|
||||||
append_sequence (sgr_39_49);
|
append_sequence (sgr_39_49.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1453,8 +1453,8 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term
|
||||||
}
|
}
|
||||||
else if ( fg == fc::Default && term->fg_color != fc::Default )
|
else if ( fg == fc::Default && term->fg_color != fc::Default )
|
||||||
{
|
{
|
||||||
char sgr_39[]{ CSI "39m" };
|
std::string sgr_39{CSI "39m"};
|
||||||
append_sequence (sgr_39);
|
append_sequence (sgr_39.c_str());
|
||||||
term->fg_color = fc::Default;
|
term->fg_color = fc::Default;
|
||||||
}
|
}
|
||||||
else if ( bg == fc::Default && term->bg_color != fc::Default )
|
else if ( bg == fc::Default && term->bg_color != fc::Default )
|
||||||
|
@ -1667,8 +1667,9 @@ inline bool FOptiAttr::append_sequence (const char seq[])
|
||||||
if ( ! seq )
|
if ( ! seq )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::strncat (attr_ptr, seq, sizeof(attr_buf) - std::strlen(attr_ptr));
|
char* attr_ptr{attr_buf.data()};
|
||||||
attr_buf[sizeof(attr_buf) - 1] = '\0';
|
std::strncat (attr_ptr, seq, attr_buf.size() - std::strlen(attr_ptr));
|
||||||
|
attr_buf[attr_buf.size() - 1] = '\0';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void FOptiMove::setTermSize (std::size_t w, std::size_t h)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FOptiMove::setTermEnvironment (const termEnv& term_env)
|
void FOptiMove::setTermEnvironment (const TermEnv& term_env)
|
||||||
{
|
{
|
||||||
// Set all required termcap values at once
|
// Set all required termcap values at once
|
||||||
|
|
||||||
|
@ -606,7 +606,7 @@ int FOptiMove::capDurationToLength (int duration) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FOptiMove::repeatedAppend ( const capability& o
|
int FOptiMove::repeatedAppend ( const Capability& o
|
||||||
, volatile int count
|
, volatile int count
|
||||||
, char* dst ) const
|
, char* dst ) const
|
||||||
{
|
{
|
||||||
|
@ -800,7 +800,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
|
|
||||||
if ( F_cursor_right.cap )
|
if ( F_cursor_right.cap )
|
||||||
{
|
{
|
||||||
char str[BUF_SIZE]{};
|
std::array<char, BUF_SIZE> str{};
|
||||||
int htime_r{0};
|
int htime_r{0};
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
|
@ -816,7 +816,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
if ( tab_pos > to_x )
|
if ( tab_pos > to_x )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
htime_r += repeatedAppend (F_tab, 1, str);
|
htime_r += repeatedAppend (F_tab, 1, str.data());
|
||||||
|
|
||||||
if ( htime_r >= LONG_DURATION )
|
if ( htime_r >= LONG_DURATION )
|
||||||
break;
|
break;
|
||||||
|
@ -827,11 +827,11 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
num = to_x - pos;
|
num = to_x - pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
htime_r += repeatedAppend (F_cursor_right, num, str);
|
htime_r += repeatedAppend (F_cursor_right, num, str.data());
|
||||||
|
|
||||||
if ( htime_r < htime )
|
if ( htime_r < htime )
|
||||||
{
|
{
|
||||||
std::strncpy (hmove, str, BUF_SIZE);
|
std::strncpy (hmove, str.data(), BUF_SIZE);
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove[BUF_SIZE - 1] = '\0';
|
||||||
htime = htime_r;
|
htime = htime_r;
|
||||||
}
|
}
|
||||||
|
@ -855,7 +855,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
|
|
||||||
if ( F_cursor_left.cap )
|
if ( F_cursor_left.cap )
|
||||||
{
|
{
|
||||||
char str[BUF_SIZE]{};
|
std::array<char, BUF_SIZE> str{};
|
||||||
int htime_l{0};
|
int htime_l{0};
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
if ( tab_pos < to_x )
|
if ( tab_pos < to_x )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
htime_l += repeatedAppend (F_back_tab, 1, str);
|
htime_l += repeatedAppend (F_back_tab, 1, str.data());
|
||||||
|
|
||||||
if ( htime_l >= LONG_DURATION )
|
if ( htime_l >= LONG_DURATION )
|
||||||
break;
|
break;
|
||||||
|
@ -882,11 +882,11 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
num = pos - to_x;
|
num = pos - to_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
htime_l += repeatedAppend (F_cursor_left, num, str);
|
htime_l += repeatedAppend (F_cursor_left, num, str.data());
|
||||||
|
|
||||||
if ( htime_l < htime )
|
if ( htime_l < htime )
|
||||||
{
|
{
|
||||||
std::strncpy (hmove, str, BUF_SIZE);
|
std::strncpy (hmove, str.data(), BUF_SIZE);
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove[BUF_SIZE - 1] = '\0';
|
||||||
htime = htime_l;
|
htime = htime_l;
|
||||||
}
|
}
|
||||||
|
@ -932,8 +932,8 @@ inline bool FOptiMove::isMethod1Faster ( int& move_time
|
||||||
|
|
||||||
if ( xold >= 0 && yold >= 0 )
|
if ( xold >= 0 && yold >= 0 )
|
||||||
{
|
{
|
||||||
char null_result[BUF_SIZE];
|
std::array<char, BUF_SIZE> null_result{};
|
||||||
const int new_time = relativeMove (null_result, xold, yold, xnew, ynew);
|
const int new_time = relativeMove (null_result.data(), xold, yold, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION && new_time < move_time )
|
if ( new_time < LONG_DURATION && new_time < move_time )
|
||||||
{
|
{
|
||||||
|
@ -954,8 +954,8 @@ inline bool FOptiMove::isMethod2Faster ( int& move_time
|
||||||
|
|
||||||
if ( yold >= 0 && F_carriage_return.cap )
|
if ( yold >= 0 && F_carriage_return.cap )
|
||||||
{
|
{
|
||||||
char null_result[BUF_SIZE];
|
std::array<char, BUF_SIZE> null_result{};
|
||||||
const int new_time = relativeMove (null_result, 0, yold, xnew, ynew);
|
const int new_time = relativeMove (null_result.data(), 0, yold, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_carriage_return.duration + new_time < move_time )
|
&& F_carriage_return.duration + new_time < move_time )
|
||||||
|
@ -976,8 +976,8 @@ inline bool FOptiMove::isMethod3Faster ( int& move_time
|
||||||
|
|
||||||
if ( F_cursor_home.cap )
|
if ( F_cursor_home.cap )
|
||||||
{
|
{
|
||||||
char null_result[BUF_SIZE];
|
std::array<char, BUF_SIZE> null_result{};
|
||||||
const int new_time = relativeMove (null_result, 0, 0, xnew, ynew);
|
const int new_time = relativeMove (null_result.data(), 0, 0, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_cursor_home.duration + new_time < move_time )
|
&& F_cursor_home.duration + new_time < move_time )
|
||||||
|
@ -997,8 +997,8 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
|
||||||
// Test method 4: home-down + local movement
|
// Test method 4: home-down + local movement
|
||||||
if ( F_cursor_to_ll.cap )
|
if ( F_cursor_to_ll.cap )
|
||||||
{
|
{
|
||||||
char null_result[BUF_SIZE];
|
std::array<char, BUF_SIZE> null_result{};
|
||||||
const int new_time = relativeMove ( null_result
|
const int new_time = relativeMove ( null_result.data()
|
||||||
, 0, int(screen_height) - 1
|
, 0, int(screen_height) - 1
|
||||||
, xnew, ynew );
|
, xnew, ynew );
|
||||||
|
|
||||||
|
@ -1024,8 +1024,8 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
|
||||||
&& yold > 0
|
&& yold > 0
|
||||||
&& F_cursor_left.cap )
|
&& F_cursor_left.cap )
|
||||||
{
|
{
|
||||||
char null_result[BUF_SIZE];
|
std::array<char, BUF_SIZE> null_result{};
|
||||||
const int new_time = relativeMove ( null_result
|
const int new_time = relativeMove ( null_result.data()
|
||||||
, int(screen_width) - 1, yold - 1
|
, int(screen_width) - 1, yold - 1
|
||||||
, xnew, ynew );
|
, xnew, ynew );
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ void FStatusBar::drawKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawKey (keyList::const_iterator iter)
|
void FStatusBar::drawKey (FKeyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw not active key
|
// Draw not active key
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
void FStatusBar::drawActiveKey (FKeyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw active key
|
// Draw active key
|
||||||
|
|
||||||
|
|
|
@ -767,7 +767,7 @@ bool FTerm::setNewFont()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTerm::setOldFont()
|
bool FTerm::resetFont()
|
||||||
{
|
{
|
||||||
bool retval{false};
|
bool retval{false};
|
||||||
|
|
||||||
|
@ -1590,7 +1590,7 @@ void FTerm::init_optiMove()
|
||||||
{
|
{
|
||||||
// Duration precalculation of the cursor movement strings
|
// Duration precalculation of the cursor movement strings
|
||||||
|
|
||||||
FOptiMove::termEnv optimove_env =
|
FOptiMove::TermEnv optimove_env =
|
||||||
{
|
{
|
||||||
TCAP(fc::t_cursor_home),
|
TCAP(fc::t_cursor_home),
|
||||||
TCAP(fc::t_carriage_return),
|
TCAP(fc::t_carriage_return),
|
||||||
|
@ -1625,7 +1625,7 @@ void FTerm::init_optiAttr()
|
||||||
{
|
{
|
||||||
// Setting video attribute optimization
|
// Setting video attribute optimization
|
||||||
|
|
||||||
FOptiAttr::termEnv optiattr_env =
|
FOptiAttr::TermEnv optiattr_env =
|
||||||
{
|
{
|
||||||
TCAP(fc::t_enter_bold_mode),
|
TCAP(fc::t_enter_bold_mode),
|
||||||
TCAP(fc::t_exit_bold_mode),
|
TCAP(fc::t_exit_bold_mode),
|
||||||
|
@ -2469,12 +2469,10 @@ void FTerm::initBaudRate() const
|
||||||
void FTerm::finish() const
|
void FTerm::finish() const
|
||||||
{
|
{
|
||||||
// Set default signal handler
|
// Set default signal handler
|
||||||
|
|
||||||
const auto& title = data->getXtermTitle();
|
|
||||||
resetSignalHandler();
|
resetSignalHandler();
|
||||||
|
|
||||||
if ( title && isXTerminal() && ! isRxvtTerminal() )
|
if ( isXTerminal() && ! isRxvtTerminal() )
|
||||||
setTermTitle (title);
|
getFTermXTerminal()->resetTitle();
|
||||||
|
|
||||||
// Restore the saved termios settings
|
// Restore the saved termios settings
|
||||||
FTermios::restoreTTYsettings();
|
FTermios::restoreTTYsettings();
|
||||||
|
@ -2529,7 +2527,7 @@ void FTerm::finish() const
|
||||||
finish_encoding();
|
finish_encoding();
|
||||||
|
|
||||||
if ( data->isNewFont() || data->isVGAFont() )
|
if ( data->isNewFont() || data->isVGAFont() )
|
||||||
setOldFont();
|
resetFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
#include "final/fapplication.h"
|
#include "final/fapplication.h"
|
||||||
#include "final/fcharmap.h"
|
#include "final/fcharmap.h"
|
||||||
#include "final/flog.h"
|
#include "final/flog.h"
|
||||||
|
#include "final/fpoint.h"
|
||||||
#include "final/fterm.h"
|
#include "final/fterm.h"
|
||||||
#include "final/ftermbuffer.h"
|
#include "final/ftermbuffer.h"
|
||||||
|
#include "final/ftermios.h"
|
||||||
|
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
|
@ -531,4 +533,53 @@ std::size_t getColumnWidth (const FTermBuffer& tb)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FPoint readCursorPos()
|
||||||
|
{
|
||||||
|
int x{-1};
|
||||||
|
int y{-1};
|
||||||
|
const int stdin_no{FTermios::getStdIn()};
|
||||||
|
const int stdout_no{FTermios::getStdOut()};
|
||||||
|
fd_set ifds{};
|
||||||
|
struct timeval tv{};
|
||||||
|
constexpr auto& DECXCPR{ESC "[6n"};
|
||||||
|
|
||||||
|
// Report Cursor Position (DECXCPR)
|
||||||
|
const ssize_t ret = write(stdout_no, DECXCPR, std::strlen(DECXCPR));
|
||||||
|
|
||||||
|
if ( ret > 0 )
|
||||||
|
{
|
||||||
|
std::fflush(stdout);
|
||||||
|
FD_ZERO(&ifds);
|
||||||
|
FD_SET(stdin_no, &ifds);
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = 100000; // 100 ms
|
||||||
|
|
||||||
|
// Read the answer
|
||||||
|
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1 )
|
||||||
|
{
|
||||||
|
constexpr auto parse = "\033[%4d;%4dR";
|
||||||
|
std::array<char, 20> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() && std::strchr(temp.data(), 'R') == nullptr );
|
||||||
|
|
||||||
|
if ( pos > 4 )
|
||||||
|
std::sscanf(temp.data(), parse, &x, &y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FPoint{x, y};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -241,7 +241,12 @@ void FTermcap::termcapKeys()
|
||||||
|
|
||||||
// Read termcap key sequences up to the self-defined values
|
// Read termcap key sequences up to the self-defined values
|
||||||
for (auto&& entry : fc::fkey)
|
for (auto&& entry : fc::fkey)
|
||||||
|
{
|
||||||
|
if ( entry.string != nullptr )
|
||||||
|
break;
|
||||||
|
|
||||||
entry.string = getString(entry.tname);
|
entry.string = getString(entry.tname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "final/fapplication.h"
|
#include "final/fapplication.h"
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/flog.h"
|
#include "final/flog.h"
|
||||||
|
#include "final/fkeyboard.h"
|
||||||
#include "final/fsystem.h"
|
#include "final/fsystem.h"
|
||||||
#include "final/fterm.h"
|
#include "final/fterm.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
@ -53,6 +54,7 @@ FTermDetection::colorEnv FTermDetection::color_env{};
|
||||||
FTermDetection::secondaryDA FTermDetection::secondary_da{};
|
FTermDetection::secondaryDA FTermDetection::secondary_da{};
|
||||||
FTermData* FTermDetection::fterm_data{nullptr};
|
FTermData* FTermDetection::fterm_data{nullptr};
|
||||||
FSystem* FTermDetection::fsystem{nullptr};
|
FSystem* FTermDetection::fsystem{nullptr};
|
||||||
|
FKeyboard* FTermDetection::keyboard{nullptr};
|
||||||
char FTermDetection::termtype[256]{};
|
char FTermDetection::termtype[256]{};
|
||||||
char FTermDetection::ttytypename[256]{};
|
char FTermDetection::ttytypename[256]{};
|
||||||
bool FTermDetection::decscusr_support{};
|
bool FTermDetection::decscusr_support{};
|
||||||
|
@ -130,6 +132,7 @@ void FTermDetection::detect()
|
||||||
{
|
{
|
||||||
fterm_data = FTerm::getFTermData();
|
fterm_data = FTerm::getFTermData();
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
keyboard = FTerm::getFKeyboard();
|
||||||
deallocation();
|
deallocation();
|
||||||
|
|
||||||
// Set the variable 'termtype' to the predefined type of the terminal
|
// Set the variable 'termtype' to the predefined type of the terminal
|
||||||
|
@ -320,6 +323,14 @@ void FTermDetection::termtypeAnalysis()
|
||||||
if ( std::strncmp(termtype, "mlterm", 6) == 0 )
|
if ( std::strncmp(termtype, "mlterm", 6) == 0 )
|
||||||
terminal_type.mlterm = true;
|
terminal_type.mlterm = true;
|
||||||
|
|
||||||
|
// rxvt
|
||||||
|
if ( std::strncmp(termtype, "rxvt", 4) == 0 )
|
||||||
|
terminal_type.rxvt = true;
|
||||||
|
|
||||||
|
// urxvt
|
||||||
|
if ( std::strncmp(termtype, "rxvt-unicode", 12) == 0 )
|
||||||
|
terminal_type.urxvt = true;
|
||||||
|
|
||||||
// screen/tmux
|
// screen/tmux
|
||||||
if ( std::strncmp(termtype, "screen", 6) == 0 )
|
if ( std::strncmp(termtype, "screen", 6) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -350,6 +361,7 @@ void FTermDetection::detectTerminal()
|
||||||
if ( terminal_detection )
|
if ( terminal_detection )
|
||||||
{
|
{
|
||||||
FTermios::setCaptureSendCharacters();
|
FTermios::setCaptureSendCharacters();
|
||||||
|
keyboard->setNonBlockingInput();
|
||||||
|
|
||||||
// Initialize 256 colors terminals
|
// Initialize 256 colors terminals
|
||||||
new_termtype = init_256colorTerminal();
|
new_termtype = init_256colorTerminal();
|
||||||
|
@ -363,6 +375,7 @@ void FTermDetection::detectTerminal()
|
||||||
// Determines the maximum number of colors
|
// Determines the maximum number of colors
|
||||||
new_termtype = determineMaxColor(new_termtype);
|
new_termtype = determineMaxColor(new_termtype);
|
||||||
|
|
||||||
|
keyboard->unsetNonBlockingInput();
|
||||||
FTermios::unsetCaptureSendCharacters();
|
FTermios::unsetCaptureSendCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,6 +530,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
|
||||||
// Determine xterm maximum number of colors via OSC 4
|
// Determine xterm maximum number of colors via OSC 4
|
||||||
|
|
||||||
const char* new_termtype = current_termtype;
|
const char* new_termtype = current_termtype;
|
||||||
|
keyboard->setNonBlockingInput();
|
||||||
|
|
||||||
if ( ! color256
|
if ( ! color256
|
||||||
&& ! isCygwinTerminal()
|
&& ! isCygwinTerminal()
|
||||||
|
@ -544,6 +558,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyboard->unsetNonBlockingInput();
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,6 +566,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
|
||||||
FString FTermDetection::getXTermColorName (FColor color)
|
FString FTermDetection::getXTermColorName (FColor color)
|
||||||
{
|
{
|
||||||
FString color_str{""};
|
FString color_str{""};
|
||||||
|
std::array<char, 30> buf{};
|
||||||
fd_set ifds{};
|
fd_set ifds{};
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
const int stdin_no = FTermios::getStdIn();
|
const int stdin_no = FTermios::getStdIn();
|
||||||
|
@ -558,28 +574,45 @@ FString FTermDetection::getXTermColorName (FColor color)
|
||||||
// get color
|
// get color
|
||||||
std::fprintf (stdout, OSC "4;%hu;?" BEL, color);
|
std::fprintf (stdout, OSC "4;%hu;?" BEL, color);
|
||||||
std::fflush (stdout);
|
std::fflush (stdout);
|
||||||
|
|
||||||
char temp[512]{};
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 150000; // 150 ms
|
tv.tv_usec = 150000; // 150 ms
|
||||||
|
|
||||||
// read the terminal answer
|
// read the terminal answer
|
||||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0
|
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||||
&& std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 )
|
|
||||||
{
|
{
|
||||||
std::size_t n = std::strlen(temp);
|
constexpr auto parse = "\033]4;%10hu;%509[^\n]s";
|
||||||
|
std::array<char, 35> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() );
|
||||||
|
|
||||||
|
if ( pos > 4
|
||||||
|
&& std::sscanf(temp.data(), parse, &color, buf.data()) == 2 )
|
||||||
|
{
|
||||||
|
std::size_t n = std::strlen(buf.data());
|
||||||
|
|
||||||
// BEL + '\0' = string terminator
|
// BEL + '\0' = string terminator
|
||||||
if ( n >= 6 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
|
if ( n >= 6 && buf[n - 1] == BEL[0] && buf[n] == '\0' )
|
||||||
temp[n - 1] = '\0';
|
buf[n - 1] = '\0';
|
||||||
|
|
||||||
// Esc + \ = OSC string terminator (mintty)
|
// Esc + \ = OSC string terminator (mintty)
|
||||||
if ( n >= 6 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' )
|
if ( n >= 6 && buf[n - 2] == ESC[0] && buf[n - 1] == '\\' )
|
||||||
temp[n - 2] = '\0';
|
buf[n - 2] = '\0';
|
||||||
|
|
||||||
color_str = temp;
|
color_str = buf.data();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return color_str;
|
return color_str;
|
||||||
|
@ -589,11 +622,14 @@ FString FTermDetection::getXTermColorName (FColor color)
|
||||||
const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
|
const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
|
||||||
{
|
{
|
||||||
const char* new_termtype = current_termtype;
|
const char* new_termtype = current_termtype;
|
||||||
|
keyboard->setNonBlockingInput();
|
||||||
// send ENQ and read the answerback message
|
// send ENQ and read the answerback message
|
||||||
|
const auto& ans = getAnswerbackMsg();
|
||||||
|
keyboard->unsetNonBlockingInput();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
answer_back = new FString(getAnswerbackMsg());
|
answer_back = new FString(ans);
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc&)
|
catch (const std::bad_alloc&)
|
||||||
{
|
{
|
||||||
|
@ -611,9 +647,10 @@ const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
|
||||||
new_termtype = "putty";
|
new_termtype = "putty";
|
||||||
}
|
}
|
||||||
|
|
||||||
// cygwin needs a backspace to delete the '♣' char
|
// Some terminal like cygwin or the windows terminal
|
||||||
if ( isCygwinTerminal() || isWindowsTerminal() )
|
// needs to delete the '♣' char
|
||||||
FTerm::putstring (BS " " BS);
|
std::fprintf (stdout, "\r " BS);
|
||||||
|
std::fflush (stdout);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if ( new_termtype )
|
if ( new_termtype )
|
||||||
|
@ -634,21 +671,36 @@ FString FTermDetection::getAnswerbackMsg()
|
||||||
FString answerback{""};
|
FString answerback{""};
|
||||||
fd_set ifds{};
|
fd_set ifds{};
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
char temp[10]{};
|
|
||||||
const int stdin_no = FTermios::getStdIn();
|
const int stdin_no = FTermios::getStdIn();
|
||||||
|
// Send enquiry character
|
||||||
std::putchar (ENQ[0]); // Send enquiry character
|
std::putchar (ENQ[0]);
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 150000; // 150 ms
|
tv.tv_usec = 150000; // 150 ms
|
||||||
|
|
||||||
// Read the answerback message
|
// Read the answerback message
|
||||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0
|
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||||
&& std::fgets (temp, sizeof(temp) - 1, stdin) != nullptr )
|
{
|
||||||
answerback = temp;
|
std::array<char, 10> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() );
|
||||||
|
|
||||||
|
if ( pos > 0 )
|
||||||
|
answerback = temp.data();
|
||||||
|
}
|
||||||
|
|
||||||
return answerback;
|
return answerback;
|
||||||
}
|
}
|
||||||
|
@ -660,10 +712,13 @@ const char* FTermDetection::parseSecDA (const char current_termtype[])
|
||||||
if ( isLinuxTerm() || isCygwinTerminal() )
|
if ( isLinuxTerm() || isCygwinTerminal() )
|
||||||
return current_termtype;
|
return current_termtype;
|
||||||
|
|
||||||
|
// Secondary device attributes (SEC_DA) <- decTerminalID string
|
||||||
|
const auto& ans = getSecDA();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Secondary device attributes (SEC_DA) <- decTerminalID string
|
// Secondary device attributes (SEC_DA) <- decTerminalID string
|
||||||
sec_da = new FString(getSecDA());
|
sec_da = new FString(ans);
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc&)
|
catch (const std::bad_alloc&)
|
||||||
{
|
{
|
||||||
|
@ -757,6 +812,7 @@ FString FTermDetection::getSecDA()
|
||||||
const int stdout_no{FTermios::getStdOut()};
|
const int stdout_no{FTermios::getStdOut()};
|
||||||
fd_set ifds{};
|
fd_set ifds{};
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
|
constexpr auto& SECDA{ESC "[>c"};
|
||||||
|
|
||||||
// Get the secondary device attributes
|
// Get the secondary device attributes
|
||||||
const ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
|
const ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
|
||||||
|
@ -771,9 +827,28 @@ FString FTermDetection::getSecDA()
|
||||||
tv.tv_usec = 600000; // 600 ms
|
tv.tv_usec = 600000; // 600 ms
|
||||||
|
|
||||||
// Read the answer
|
// Read the answer
|
||||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1
|
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1 )
|
||||||
&& std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 )
|
{
|
||||||
|
constexpr auto parse = "\033[>%10d;%10d;%10dc";
|
||||||
|
std::array<char, 40> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() && std::strchr(temp.data(), 'c') == nullptr );
|
||||||
|
|
||||||
|
if ( pos > 3
|
||||||
|
&& std::sscanf(temp.data(), parse, &a, &b, &c) == 3 )
|
||||||
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
|
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
return sec_da_str;
|
return sec_da_str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ void FTermios::setCaptureSendCharacters()
|
||||||
struct termios t{};
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
t.c_lflag &= uInt(~(ICANON | ECHO));
|
t.c_lflag &= uInt(~(ICANON | ECHO));
|
||||||
t.c_cc[VTIME] = 1; // Timeout in deciseconds
|
t.c_cc[VTIME] = 10; // Timeout in deciseconds
|
||||||
t.c_cc[VMIN] = 0; // Minimum number of characters
|
t.c_cc[VMIN] = 0; // Minimum number of characters
|
||||||
tcsetattr (stdin_no, TCSANOW, &t);
|
tcsetattr (stdin_no, TCSANOW, &t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,7 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
const modifier_key& m = getModifierKey();
|
const ModifierKey& m = getModifierKey();
|
||||||
|
|
||||||
if ( ! (m.shift || m.ctrl || m.alt) )
|
if ( ! (m.shift || m.ctrl || m.alt) )
|
||||||
{
|
{
|
||||||
|
@ -631,7 +631,7 @@ bool FTermLinux::getUnicodeMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermLinux::modifier_key& FTermLinux::getModifierKey()
|
FTermLinux::ModifierKey& FTermLinux::getModifierKey()
|
||||||
{
|
{
|
||||||
// Get Linux console shift state
|
// Get Linux console shift state
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ void FTermLinux::getVGAPalette()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermLinux::setVGADefaultPalette()
|
void FTermLinux::setVGADefaultPalette()
|
||||||
{
|
{
|
||||||
constexpr std::array<rgb, 16> defaultColor =
|
constexpr std::array<RGB, 16> defaultColor =
|
||||||
{{
|
{{
|
||||||
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
||||||
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "final/fapplication.h"
|
#include "final/fapplication.h"
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/flog.h"
|
#include "final/flog.h"
|
||||||
|
#include "final/fkeyboard.h"
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
#include "final/fterm.h"
|
#include "final/fterm.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
@ -51,6 +52,7 @@ namespace finalcut
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FTermXTerminal::mouse_support{false};
|
bool FTermXTerminal::mouse_support{false};
|
||||||
FSystem* FTermXTerminal::fsystem{nullptr};
|
FSystem* FTermXTerminal::fsystem{nullptr};
|
||||||
|
FKeyboard* FTermXTerminal::keyboard{nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -63,6 +65,7 @@ FTermXTerminal::FTermXTerminal()
|
||||||
{
|
{
|
||||||
// Get FSystem object
|
// Get FSystem object
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
keyboard = FTerm::getFKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -290,6 +293,13 @@ void FTermXTerminal::resetDefaults()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermXTerminal::resetTitle()
|
||||||
|
{
|
||||||
|
if ( title_was_changed )
|
||||||
|
setTitle(xterm_title);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermXTerminal::captureFontAndTitle()
|
void FTermXTerminal::captureFontAndTitle()
|
||||||
{
|
{
|
||||||
|
@ -300,8 +310,10 @@ void FTermXTerminal::captureFontAndTitle()
|
||||||
&& ! term_detection->isRxvtTerminal() )
|
&& ! term_detection->isRxvtTerminal() )
|
||||||
{
|
{
|
||||||
FTermios::setCaptureSendCharacters();
|
FTermios::setCaptureSendCharacters();
|
||||||
|
keyboard->setNonBlockingInput();
|
||||||
xterm_font = captureXTermFont();
|
xterm_font = captureXTermFont();
|
||||||
xterm_title = captureXTermTitle();
|
xterm_title = captureXTermTitle();
|
||||||
|
keyboard->unsetNonBlockingInput();
|
||||||
FTermios::unsetCaptureSendCharacters();
|
FTermios::unsetCaptureSendCharacters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,15 +368,21 @@ void FTermXTerminal::setXTermTitle()
|
||||||
|
|
||||||
if ( term_detection->isXTerminal()
|
if ( term_detection->isXTerminal()
|
||||||
|| term_detection->isScreenTerm()
|
|| term_detection->isScreenTerm()
|
||||||
|
|| term_detection->isUrxvtTerminal()
|
||||||
|| term_detection->isCygwinTerminal()
|
|| term_detection->isCygwinTerminal()
|
||||||
|| term_detection->isMinttyTerm()
|
|| term_detection->isMinttyTerm()
|
||||||
|| term_detection->isPuttyTerminal()
|
|| term_detection->isPuttyTerminal()
|
||||||
|| FTermcap::osc_support )
|
|| FTermcap::osc_support )
|
||||||
{
|
{
|
||||||
oscPrefix();
|
oscPrefix();
|
||||||
|
|
||||||
|
if ( xterm_title.isNull() )
|
||||||
|
xterm_title = "";
|
||||||
|
|
||||||
FTerm::putstringf (OSC "0;%s" BEL, xterm_title.c_str());
|
FTerm::putstringf (OSC "0;%s" BEL, xterm_title.c_str());
|
||||||
oscPostfix();
|
oscPostfix();
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
|
title_was_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,11 +773,11 @@ FString FTermXTerminal::captureXTermFont() const
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
const int stdin_no = FTermios::getStdIn();
|
const int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
|
// Querying the terminal font
|
||||||
oscPrefix();
|
oscPrefix();
|
||||||
FTerm::putstring (OSC "50;?" BEL); // get font
|
FTerm::putstring (OSC "50;?" BEL);
|
||||||
oscPostfix();
|
oscPostfix();
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
|
@ -768,17 +786,33 @@ FString FTermXTerminal::captureXTermFont() const
|
||||||
// Read the terminal answer
|
// Read the terminal answer
|
||||||
if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||||
{
|
{
|
||||||
char temp[150]{};
|
std::array<char, 150> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
if ( std::scanf("\033]50;%148[^\n]s", temp) == 1 )
|
do
|
||||||
{
|
{
|
||||||
const std::size_t n = std::strlen(temp);
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() && std::strchr(temp.data(), '\a') == nullptr );
|
||||||
|
|
||||||
|
if ( pos > 5 && temp[0] == ESC[0] && temp[1] == ']'
|
||||||
|
&& temp[2] == '5' && temp[3] == '0' && temp[4] == ';' )
|
||||||
|
{
|
||||||
|
// Skip leading Esc ] 5 0 ;
|
||||||
|
char* str = &temp[5];
|
||||||
|
const std::size_t n = std::strlen(str);
|
||||||
|
|
||||||
// BEL + '\0' = string terminator
|
// BEL + '\0' = string terminator
|
||||||
if ( n >= 5 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
|
if ( n >= 5 && str[n - 1] == BEL[0] && str[n] == '\0' )
|
||||||
temp[n - 1] = '\0';
|
str[n - 1] = '\0';
|
||||||
|
|
||||||
return FString{temp};
|
return FString{str};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -796,11 +830,11 @@ FString FTermXTerminal::captureXTermTitle() const
|
||||||
|
|
||||||
fd_set ifds{};
|
fd_set ifds{};
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
const int stdin_no = FTermios::getStdIn();
|
const int stdin_no{FTermios::getStdIn()};
|
||||||
|
|
||||||
FTerm::putstring (CSI "21t"); // get title
|
// Report window title
|
||||||
|
FTerm::putstring (CSI "21t");
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
|
@ -809,20 +843,35 @@ FString FTermXTerminal::captureXTermTitle() const
|
||||||
// read the terminal answer
|
// read the terminal answer
|
||||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||||
{
|
{
|
||||||
char temp[512]{};
|
std::array<char, 512> temp{};
|
||||||
|
std::size_t pos{0};
|
||||||
|
|
||||||
if ( std::scanf("\033]l%509[^\n]s", temp) == 1 )
|
do
|
||||||
{
|
{
|
||||||
const std::size_t n = std::strlen(temp);
|
std::size_t bytes_free = temp.size() - pos - 1;
|
||||||
|
const ssize_t bytes = read(stdin_no, &temp[pos], bytes_free);
|
||||||
|
|
||||||
|
if ( bytes <= 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos += std::size_t(bytes);
|
||||||
|
}
|
||||||
|
while ( pos < temp.size() && std::strstr(temp.data(), ESC "\\") == nullptr );
|
||||||
|
|
||||||
|
if ( pos > 6 && temp[0] == ESC[0] && temp[1] == ']' && temp[2] == 'l' )
|
||||||
|
{
|
||||||
|
// Skip leading Esc + ] + l = OSC l
|
||||||
|
char* str = &temp[3];
|
||||||
|
const std::size_t n = std::strlen(str);
|
||||||
|
|
||||||
// Esc + \ = OSC string terminator
|
// Esc + \ = OSC string terminator
|
||||||
if ( n >= 2 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' )
|
if ( n >= 2 && str[n - 2] == ESC[0] && str[n - 1] == '\\' )
|
||||||
{
|
{
|
||||||
if ( n < 4 )
|
if ( n < 4 )
|
||||||
return FString{};
|
return FString{};
|
||||||
|
|
||||||
temp[n - 2] = '\0';
|
str[n - 2] = '\0';
|
||||||
return FString{temp};
|
return FString{str};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class FBusyIndicator : public FToolTip
|
||||||
FBusyIndicator (const FBusyIndicator&) = delete;
|
FBusyIndicator (const FBusyIndicator&) = delete;
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FBusyIndicator();
|
~FBusyIndicator() override;
|
||||||
|
|
||||||
// Disable copy assignment operator (=)
|
// Disable copy assignment operator (=)
|
||||||
FBusyIndicator& operator = (const FBusyIndicator&) = delete;
|
FBusyIndicator& operator = (const FBusyIndicator&) = delete;
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#define SO "\016" // Shift out (alternative character set)
|
#define SO "\016" // Shift out (alternative character set)
|
||||||
#define SI "\017" // Shift in (regular character set)
|
#define SI "\017" // Shift in (regular character set)
|
||||||
#define OSC ESC "]" // Operating system command (7-bit)
|
#define OSC ESC "]" // Operating system command (7-bit)
|
||||||
#define SECDA ESC "[>c" // Secondary Device Attributes
|
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,7 +104,7 @@ class default8ColorPalette final : public FColorPalette
|
||||||
explicit default8ColorPalette (const FSetPalette&);
|
explicit default8ColorPalette (const FSetPalette&);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~default8ColorPalette();
|
~default8ColorPalette() override;
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
FString getClassName() const override;
|
FString getClassName() const override;
|
||||||
|
@ -144,7 +144,7 @@ class default16ColorPalette final : public FColorPalette
|
||||||
explicit default16ColorPalette (const FSetPalette&);
|
explicit default16ColorPalette (const FSetPalette&);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~default16ColorPalette();
|
~default16ColorPalette() override;
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
FString getClassName() const override;
|
FString getClassName() const override;
|
||||||
|
@ -183,7 +183,7 @@ class default16DarkColorPalette final : public FColorPalette
|
||||||
explicit default16DarkColorPalette (const FSetPalette&);
|
explicit default16DarkColorPalette (const FSetPalette&);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~default16DarkColorPalette();
|
~default16DarkColorPalette() override;
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
FString getClassName() const override;
|
FString getClassName() const override;
|
||||||
|
|
|
@ -244,7 +244,8 @@ class FData : public FDataAccess
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isInitializedCopy() const
|
bool isInitializedCopy() const
|
||||||
{
|
{
|
||||||
return bool( (void*)&value == (void*)&value_ref.get() );
|
return bool( reinterpret_cast<void*>(&value)
|
||||||
|
== reinterpret_cast<void*>(&value_ref.get()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInitializedReference() const
|
bool isInitializedReference() const
|
||||||
|
|
|
@ -163,7 +163,7 @@ class FDialog : public FWindow
|
||||||
FPoint termPos;
|
FPoint termPos;
|
||||||
std::size_t zoom_btn;
|
std::size_t zoom_btn;
|
||||||
bool mouse_over_menu;
|
bool mouse_over_menu;
|
||||||
} mouseStates;
|
} MouseStates;
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static constexpr std::size_t MENU_BTN = 3;
|
static constexpr std::size_t MENU_BTN = 3;
|
||||||
|
@ -189,12 +189,12 @@ class FDialog : public FWindow
|
||||||
void selectFirstMenuItem();
|
void selectFirstMenuItem();
|
||||||
void setZoomItem();
|
void setZoomItem();
|
||||||
std::size_t getZoomButtonWidth() const;
|
std::size_t getZoomButtonWidth() const;
|
||||||
void activateZoomButton (const mouseStates&);
|
void activateZoomButton (const MouseStates&);
|
||||||
void deactivateZoomButton();
|
void deactivateZoomButton();
|
||||||
void leaveZoomButton (const mouseStates&);
|
void leaveZoomButton (const MouseStates&);
|
||||||
void pressZoomButton (const mouseStates&);
|
void pressZoomButton (const MouseStates&);
|
||||||
bool isMouseOverMenu (const FPoint&) const;
|
bool isMouseOverMenu (const FPoint&) const;
|
||||||
void passEventToSubMenu ( const mouseStates&
|
void passEventToSubMenu ( const MouseStates&
|
||||||
, const FMouseEvent* );
|
, const FMouseEvent* );
|
||||||
void moveSizeKey (FKeyEvent*);
|
void moveSizeKey (FKeyEvent*);
|
||||||
void raiseActivateDialog();
|
void raiseActivateDialog();
|
||||||
|
@ -202,9 +202,9 @@ class FDialog : public FWindow
|
||||||
bool isOutsideTerminal (const FPoint&) const;
|
bool isOutsideTerminal (const FPoint&) const;
|
||||||
bool isLeftOutside() const;
|
bool isLeftOutside() const;
|
||||||
bool isBottomOutside() const;
|
bool isBottomOutside() const;
|
||||||
bool isLowerRightResizeCorner (const mouseStates&) const;
|
bool isLowerRightResizeCorner (const MouseStates&) const;
|
||||||
void resizeMouseDown (const mouseStates&);
|
void resizeMouseDown (const MouseStates&);
|
||||||
void resizeMouseUpMove (const mouseStates&, bool = false);
|
void resizeMouseUpMove (const MouseStates&, bool = false);
|
||||||
void cancelMouseResize();
|
void cancelMouseResize();
|
||||||
void acceptMoveSize();
|
void acceptMoveSize();
|
||||||
void cancelMoveSize();
|
void cancelMoveSize();
|
||||||
|
|
|
@ -186,7 +186,7 @@ class FFileDialog : public FDialog
|
||||||
uChar : 1; // padding bits
|
uChar : 1; // padding bits
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<FDirEntry> dirEntries;
|
typedef std::vector<FDirEntry> DirEntries;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -216,7 +216,7 @@ class FFileDialog : public FDialog
|
||||||
// Data members
|
// Data members
|
||||||
static FSystem* fsystem;
|
static FSystem* fsystem;
|
||||||
DIR* directory_stream{nullptr};
|
DIR* directory_stream{nullptr};
|
||||||
dirEntries dir_entries{};
|
DirEntries dir_entries{};
|
||||||
FString directory{};
|
FString directory{};
|
||||||
FString filter_pattern{};
|
FString filter_pattern{};
|
||||||
FLineEdit filename{this};
|
FLineEdit filename{this};
|
||||||
|
|
|
@ -27,14 +27,16 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace fc
|
namespace fc
|
||||||
{
|
{
|
||||||
|
|
||||||
extern std::array<FKeyMap, 174> fkey;
|
extern std::array<FKeyMap, 188> fkey;
|
||||||
extern const std::array<FMetakeyMap, 228> fmetakey;
|
extern const std::array<FMetakeyMap, 232> fmetakey;
|
||||||
extern const std::array<FKeyName, 388> fkeyname;
|
extern const std::array<FKeyName, 388> fkeyname;
|
||||||
|
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "final/fkey_map.h"
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
@ -116,6 +117,9 @@ class FKeyboard final
|
||||||
void setTermcapMap (const T&);
|
void setTermcapMap (const T&);
|
||||||
static void setKeypressTimeout (const uInt64);
|
static void setKeypressTimeout (const uInt64);
|
||||||
static void setReadBlockingTime (const uInt64);
|
static void setReadBlockingTime (const uInt64);
|
||||||
|
bool setNonBlockingInput (bool);
|
||||||
|
bool setNonBlockingInput();
|
||||||
|
bool unsetNonBlockingInput();
|
||||||
void enableUTF8();
|
void enableUTF8();
|
||||||
void disableUTF8();
|
void disableUTF8();
|
||||||
void enableMouseSequences();
|
void enableMouseSequences();
|
||||||
|
@ -138,7 +142,7 @@ class FKeyboard final
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
using FKeyMapPtr = std::shared_ptr<std::array<fc::FKeyMap, 174>>;
|
using FKeyMapPtr = std::shared_ptr<decltype(fc::fkey)>;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr FKey NOT_SET = static_cast<FKey>(-1);
|
static constexpr FKey NOT_SET = static_cast<FKey>(-1);
|
||||||
|
@ -149,11 +153,6 @@ class FKeyboard final
|
||||||
FKey getMetaKey();
|
FKey getMetaKey();
|
||||||
FKey getSingleKey();
|
FKey getSingleKey();
|
||||||
|
|
||||||
// Mutators
|
|
||||||
bool setNonBlockingInput (bool);
|
|
||||||
bool setNonBlockingInput();
|
|
||||||
bool unsetNonBlockingInput();
|
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
static bool isKeypressTimeout();
|
static bool isKeypressTimeout();
|
||||||
static bool isIntervalTimeout();
|
static bool isIntervalTimeout();
|
||||||
|
@ -235,6 +234,18 @@ inline void FKeyboard::setKeypressTimeout (const uInt64 timeout)
|
||||||
inline void FKeyboard::setReadBlockingTime (const uInt64 blocking_time)
|
inline void FKeyboard::setReadBlockingTime (const uInt64 blocking_time)
|
||||||
{ read_blocking_time = blocking_time; }
|
{ read_blocking_time = blocking_time; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FKeyboard::setNonBlockingInput()
|
||||||
|
{ return setNonBlockingInput(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FKeyboard::unsetNonBlockingInput()
|
||||||
|
{ return setNonBlockingInput(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FKeyboard::isInputDataPending() const
|
||||||
|
{ return input_data_pending; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FKeyboard::enableUTF8()
|
inline void FKeyboard::enableUTF8()
|
||||||
{ utf8_input = true; }
|
{ utf8_input = true; }
|
||||||
|
@ -263,17 +274,6 @@ inline void FKeyboard::setReleaseCommand (const FKeyboardCommand& cmd)
|
||||||
inline void FKeyboard::setEscPressedCommand (const FKeyboardCommand& cmd)
|
inline void FKeyboard::setEscPressedCommand (const FKeyboardCommand& cmd)
|
||||||
{ escape_key_cmd = cmd; }
|
{ escape_key_cmd = cmd; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FKeyboard::isInputDataPending() const
|
|
||||||
{ return input_data_pending; }
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FKeyboard::setNonBlockingInput()
|
|
||||||
{ return setNonBlockingInput(true); }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FKeyboard::unsetNonBlockingInput()
|
|
||||||
{ return setNonBlockingInput(false); }
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FKEYBOARD_H
|
#endif // FKEYBOARD_H
|
||||||
|
|
|
@ -95,6 +95,9 @@ class FListBoxItem
|
||||||
template <typename DT>
|
template <typename DT>
|
||||||
void setData (DT&&);
|
void setData (DT&&);
|
||||||
|
|
||||||
|
// Inquiries
|
||||||
|
bool isSelected() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -148,6 +151,10 @@ inline void FListBoxItem::setData (DT&& data)
|
||||||
data_pointer.reset(data_obj);
|
data_pointer.reset(data_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FListBoxItem::isSelected() const
|
||||||
|
{ return selected; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBoxItem::clear()
|
inline void FListBoxItem::clear()
|
||||||
{ text.clear(); }
|
{ text.clear(); }
|
||||||
|
@ -164,7 +171,7 @@ class FListBox : public FWidget
|
||||||
using FWidget::setGeometry;
|
using FWidget::setGeometry;
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef std::vector<FListBoxItem> listBoxItems;
|
typedef std::vector<FListBoxItem> FListBoxItems;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
explicit FListBox (FWidget* = nullptr);
|
explicit FListBox (FWidget* = nullptr);
|
||||||
|
@ -189,21 +196,23 @@ class FListBox : public FWidget
|
||||||
std::size_t getCount() const;
|
std::size_t getCount() const;
|
||||||
FListBoxItem& getItem (std::size_t);
|
FListBoxItem& getItem (std::size_t);
|
||||||
const FListBoxItem& getItem (std::size_t) const;
|
const FListBoxItem& getItem (std::size_t) const;
|
||||||
FListBoxItem& getItem (listBoxItems::iterator);
|
FListBoxItem& getItem (FListBoxItems::iterator);
|
||||||
const FListBoxItem& getItem (listBoxItems::const_iterator) const;
|
const FListBoxItem& getItem (FListBoxItems::const_iterator) const;
|
||||||
std::size_t currentItem() const;
|
std::size_t currentItem() const;
|
||||||
|
FListBoxItems& getData();
|
||||||
|
const FListBoxItems& getData() const;
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setCurrentItem (std::size_t);
|
void setCurrentItem (std::size_t);
|
||||||
void setCurrentItem (listBoxItems::iterator);
|
void setCurrentItem (FListBoxItems::iterator);
|
||||||
void selectItem (std::size_t);
|
void selectItem (std::size_t);
|
||||||
void selectItem (listBoxItems::iterator) const;
|
void selectItem (FListBoxItems::iterator) const;
|
||||||
void unselectItem (std::size_t);
|
void unselectItem (std::size_t);
|
||||||
void unselectItem (listBoxItems::iterator) const;
|
void unselectItem (FListBoxItems::iterator) const;
|
||||||
void showInsideBrackets (const std::size_t, fc::brackets_type);
|
void showInsideBrackets (const std::size_t, fc::brackets_type);
|
||||||
void showNoBrackets (std::size_t);
|
void showNoBrackets (std::size_t);
|
||||||
void showNoBrackets (listBoxItems::iterator) const;
|
void showNoBrackets (FListBoxItems::iterator) const;
|
||||||
void setSize (const FSize&, bool = true) override;
|
void setSize (const FSize&, bool = true) override;
|
||||||
void setGeometry ( const FPoint&, const FSize&
|
void setGeometry ( const FPoint&, const FSize&
|
||||||
, bool = true ) override;
|
, bool = true ) override;
|
||||||
|
@ -215,10 +224,10 @@ class FListBox : public FWidget
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected (std::size_t) const;
|
bool isSelected (std::size_t) const;
|
||||||
bool isSelected (listBoxItems::iterator) const;
|
bool isSelected (FListBoxItems::iterator) const;
|
||||||
bool isMultiSelection() const;
|
bool isMultiSelection() const;
|
||||||
bool hasBrackets (std::size_t) const;
|
bool hasBrackets (std::size_t) const;
|
||||||
bool hasBrackets (listBoxItems::iterator) const;
|
bool hasBrackets (FListBoxItems::iterator) const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -268,9 +277,9 @@ class FListBox : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
typedef std::unordered_map<int, std::function<void()>> KeyMap;
|
||||||
typedef std::unordered_map<int, std::function<bool()>> keyMapResult;
|
typedef std::unordered_map<int, std::function<bool()>> KeyMapResult;
|
||||||
typedef std::function<void(FListBoxItem&, FDataAccess*, std::size_t)> lazyInsert;
|
typedef std::function<void(FListBoxItem&, FDataAccess*, std::size_t)> LazyInsert;
|
||||||
|
|
||||||
// Enumeration
|
// Enumeration
|
||||||
enum convert_type
|
enum convert_type
|
||||||
|
@ -281,7 +290,7 @@ class FListBox : public FWidget
|
||||||
};
|
};
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
static FString getString (listBoxItems::iterator);
|
static FString getString (FListBoxItems::iterator);
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isHorizontallyScrollable() const;
|
bool isHorizontallyScrollable() const;
|
||||||
|
@ -296,10 +305,10 @@ class FListBox : public FWidget
|
||||||
void drawScrollbars() const;
|
void drawScrollbars() const;
|
||||||
void drawHeadline();
|
void drawHeadline();
|
||||||
void drawList();
|
void drawList();
|
||||||
void drawListLine (int, listBoxItems::iterator, bool);
|
void drawListLine (int, FListBoxItems::iterator, bool);
|
||||||
void printLeftBracket (fc::brackets_type);
|
void printLeftBracket (fc::brackets_type);
|
||||||
void printRightBracket (fc::brackets_type);
|
void printRightBracket (fc::brackets_type);
|
||||||
void drawListBracketsLine (int, listBoxItems::iterator, bool);
|
void drawListBracketsLine (int, FListBoxItems::iterator, bool);
|
||||||
void setLineAttributes (int, bool, bool, bool&);
|
void setLineAttributes (int, bool, bool, bool&);
|
||||||
void unsetAttributes() const;
|
void unsetAttributes() const;
|
||||||
void updateDrawing (bool, bool);
|
void updateDrawing (bool, bool);
|
||||||
|
@ -339,25 +348,25 @@ class FListBox : public FWidget
|
||||||
void processSelect() const;
|
void processSelect() const;
|
||||||
void processChanged() const;
|
void processChanged() const;
|
||||||
void changeOnResize() const;
|
void changeOnResize() const;
|
||||||
void lazyConvert (listBoxItems::iterator, std::size_t);
|
void lazyConvert (FListBoxItems::iterator, std::size_t);
|
||||||
listBoxItems::iterator index2iterator (std::size_t);
|
FListBoxItems::iterator index2iterator (std::size_t);
|
||||||
listBoxItems::const_iterator index2iterator (std::size_t index) const;
|
FListBoxItems::const_iterator index2iterator (std::size_t index) const;
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_vbarChange (const FWidget*);
|
void cb_vbarChange (const FWidget*);
|
||||||
void cb_hbarChange (const FWidget*);
|
void cb_hbarChange (const FWidget*);
|
||||||
|
|
||||||
// Function Pointer
|
// Function Pointer
|
||||||
lazyInsert lazy_inserter{};
|
LazyInsert lazy_inserter{};
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
listBoxItems itemlist{};
|
FListBoxItems itemlist{};
|
||||||
FDataAccess* source_container{nullptr};
|
FDataAccess* source_container{nullptr};
|
||||||
FScrollbarPtr vbar{nullptr};
|
FScrollbarPtr vbar{nullptr};
|
||||||
FScrollbarPtr hbar{nullptr};
|
FScrollbarPtr hbar{nullptr};
|
||||||
FString text{};
|
FString text{};
|
||||||
FString inc_search{};
|
FString inc_search{};
|
||||||
keyMap key_map{};
|
KeyMap key_map{};
|
||||||
keyMapResult key_map_result{};
|
KeyMapResult key_map_result{};
|
||||||
convert_type conv_type{FListBox::no_convert};
|
convert_type conv_type{FListBox::no_convert};
|
||||||
fc::dragScroll drag_scroll{fc::noScroll};
|
fc::dragScroll drag_scroll{fc::noScroll};
|
||||||
int scroll_repeat{100};
|
int scroll_repeat{100};
|
||||||
|
@ -431,29 +440,37 @@ inline std::size_t FListBox::getCount() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBoxItem& FListBox::getItem (std::size_t index)
|
inline FListBoxItem& FListBox::getItem (std::size_t index)
|
||||||
{
|
{
|
||||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
FListBoxItems::iterator iter = index2iterator(index - 1);
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FListBoxItem& FListBox::getItem (std::size_t index) const
|
inline const FListBoxItem& FListBox::getItem (std::size_t index) const
|
||||||
{
|
{
|
||||||
listBoxItems::const_iterator iter = index2iterator(index - 1);
|
FListBoxItems::const_iterator iter = index2iterator(index - 1);
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBoxItem& FListBox::getItem (listBoxItems::iterator iter)
|
inline FListBoxItem& FListBox::getItem (FListBoxItems::iterator iter)
|
||||||
{ return *iter; }
|
{ return *iter; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FListBoxItem& FListBox::getItem (listBoxItems::const_iterator iter) const
|
inline const FListBoxItem& FListBox::getItem (FListBoxItems::const_iterator iter) const
|
||||||
{ return *iter; }
|
{ return *iter; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FListBox::currentItem() const
|
inline std::size_t FListBox::currentItem() const
|
||||||
{ return current; }
|
{ return current; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FListBox::FListBoxItems& FListBox::getData()
|
||||||
|
{ return itemlist; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FListBox::FListBoxItems& FListBox::getData() const
|
||||||
|
{ return itemlist; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString& FListBox::getText()
|
inline FString& FListBox::getText()
|
||||||
{ return text; }
|
{ return text; }
|
||||||
|
@ -463,7 +480,7 @@ inline void FListBox::selectItem (std::size_t index)
|
||||||
{ index2iterator(index - 1)->selected = true; }
|
{ index2iterator(index - 1)->selected = true; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::selectItem (listBoxItems::iterator iter) const
|
inline void FListBox::selectItem (FListBoxItems::iterator iter) const
|
||||||
{ iter->selected = true; }
|
{ iter->selected = true; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -471,7 +488,7 @@ inline void FListBox::unselectItem (std::size_t index)
|
||||||
{ index2iterator(index - 1)->selected = false; }
|
{ index2iterator(index - 1)->selected = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::unselectItem (listBoxItems::iterator iter) const
|
inline void FListBox::unselectItem (FListBoxItems::iterator iter) const
|
||||||
{ iter->selected = false; }
|
{ iter->selected = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -479,7 +496,7 @@ inline void FListBox::showNoBrackets (std::size_t index)
|
||||||
{ index2iterator(index - 1)->brackets = fc::NoBrackets; }
|
{ index2iterator(index - 1)->brackets = fc::NoBrackets; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::showNoBrackets (listBoxItems::iterator iter) const
|
inline void FListBox::showNoBrackets (FListBoxItems::iterator iter) const
|
||||||
{ iter->brackets = fc::NoBrackets; }
|
{ iter->brackets = fc::NoBrackets; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -503,7 +520,7 @@ inline bool FListBox::isSelected (std::size_t index) const
|
||||||
{ return index2iterator(index - 1)->selected; }
|
{ return index2iterator(index - 1)->selected; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isSelected (listBoxItems::iterator iter) const
|
inline bool FListBox::isSelected (FListBoxItems::iterator iter) const
|
||||||
{ return iter->selected; }
|
{ return iter->selected; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -515,7 +532,7 @@ inline bool FListBox::hasBrackets(std::size_t index) const
|
||||||
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::hasBrackets(listBoxItems::iterator iter) const
|
inline bool FListBox::hasBrackets(FListBoxItems::iterator iter) const
|
||||||
{ return bool(iter->brackets > 0); }
|
{ return bool(iter->brackets > 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -602,19 +619,19 @@ inline bool FListBox::isVerticallyScrollable() const
|
||||||
{ return bool( getCount() > getClientHeight() ); }
|
{ return bool( getCount() > getClientHeight() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBox::listBoxItems::iterator \
|
inline FListBox::FListBoxItems::iterator \
|
||||||
FListBox::index2iterator (std::size_t index)
|
FListBox::index2iterator (std::size_t index)
|
||||||
{
|
{
|
||||||
listBoxItems::iterator iter = itemlist.begin();
|
FListBoxItems::iterator iter = itemlist.begin();
|
||||||
std::advance (iter, index);
|
std::advance (iter, index);
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBox::listBoxItems::const_iterator \
|
inline FListBox::FListBoxItems::const_iterator \
|
||||||
FListBox::index2iterator (std::size_t index) const
|
FListBox::index2iterator (std::size_t index) const
|
||||||
{
|
{
|
||||||
listBoxItems::const_iterator iter = itemlist.begin();
|
FListBoxItems::const_iterator iter = itemlist.begin();
|
||||||
std::advance (iter, index);
|
std::advance (iter, index);
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,6 +296,9 @@ class FListView : public FWidget
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
using FWidget::setGeometry;
|
using FWidget::setGeometry;
|
||||||
|
|
||||||
|
// Typedef
|
||||||
|
typedef std::list<FListViewItem*> FListViewItems;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
explicit FListView (FWidget* = nullptr);
|
explicit FListView (FWidget* = nullptr);
|
||||||
|
|
||||||
|
@ -377,8 +380,9 @@ class FListView : public FWidget
|
||||||
, iterator );
|
, iterator );
|
||||||
void remove (FListViewItem*);
|
void remove (FListViewItem*);
|
||||||
void clear();
|
void clear();
|
||||||
iterator beginOfList();
|
FListViewItems& getData();
|
||||||
iterator endOfList();
|
const FListViewItems& getData() const;
|
||||||
|
|
||||||
virtual void sort();
|
virtual void sort();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
@ -400,16 +404,16 @@ class FListView : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
typedef std::unordered_map<int, std::function<void()>> KeyMap;
|
||||||
typedef std::unordered_map<int, std::function<bool()>> keyMapResult;
|
typedef std::unordered_map<int, std::function<bool()>> KeyMapResult;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr std::size_t checkbox_space = 4;
|
static constexpr std::size_t checkbox_space = 4;
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
struct Header; // forward declaration
|
struct Header; // forward declaration
|
||||||
typedef std::vector<Header> headerItems;
|
typedef std::vector<Header> HeaderItems;
|
||||||
typedef std::vector<fc::sorting_type> sortTypes;
|
typedef std::vector<fc::sorting_type> SortTypes;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr int USE_MAX_SIZE = -1;
|
static constexpr int USE_MAX_SIZE = -1;
|
||||||
|
@ -445,10 +449,10 @@ class FListView : public FWidget
|
||||||
FString getCheckBox (const FListViewItem* item) const;
|
FString getCheckBox (const FListViewItem* item) const;
|
||||||
FString getLinePrefix (const FListViewItem*, std::size_t) const;
|
FString getLinePrefix (const FListViewItem*, std::size_t) const;
|
||||||
void drawSortIndicator (std::size_t&, std::size_t);
|
void drawSortIndicator (std::size_t&, std::size_t);
|
||||||
void drawHeadlineLabel (const headerItems::const_iterator&);
|
void drawHeadlineLabel (const HeaderItems::const_iterator&);
|
||||||
void drawHeaderBorder (std::size_t);
|
void drawHeaderBorder (std::size_t);
|
||||||
void drawBufferedHeadline();
|
void drawBufferedHeadline();
|
||||||
void drawColumnEllipsis ( const headerItems::const_iterator&
|
void drawColumnEllipsis ( const HeaderItems::const_iterator&
|
||||||
, const FString& );
|
, const FString& );
|
||||||
void updateDrawing (bool, bool);
|
void updateDrawing (bool, bool);
|
||||||
std::size_t determineLineWidth (FListViewItem*);
|
std::size_t determineLineWidth (FListViewItem*);
|
||||||
|
@ -498,15 +502,15 @@ class FListView : public FWidget
|
||||||
FListViewIterator current_iter{};
|
FListViewIterator current_iter{};
|
||||||
FListViewIterator first_visible_line{};
|
FListViewIterator first_visible_line{};
|
||||||
FListViewIterator last_visible_line{};
|
FListViewIterator last_visible_line{};
|
||||||
headerItems header{};
|
HeaderItems header{};
|
||||||
FTermBuffer headerline{};
|
FTermBuffer headerline{};
|
||||||
FScrollbarPtr vbar{nullptr};
|
FScrollbarPtr vbar{nullptr};
|
||||||
FScrollbarPtr hbar{nullptr};
|
FScrollbarPtr hbar{nullptr};
|
||||||
sortTypes sort_type{};
|
SortTypes sort_type{};
|
||||||
FPoint clicked_expander_pos{-1, -1};
|
FPoint clicked_expander_pos{-1, -1};
|
||||||
FPoint clicked_header_pos{-1, -1};
|
FPoint clicked_header_pos{-1, -1};
|
||||||
keyMap key_map{};
|
KeyMap key_map{};
|
||||||
keyMapResult key_map_result{};
|
KeyMapResult key_map_result{};
|
||||||
const FListViewItem* clicked_checkbox_item{nullptr};
|
const FListViewItem* clicked_checkbox_item{nullptr};
|
||||||
std::size_t nf_offset{0};
|
std::size_t nf_offset{0};
|
||||||
std::size_t max_line_width{1};
|
std::size_t max_line_width{1};
|
||||||
|
@ -712,12 +716,12 @@ FObject::iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::iterator FListView::beginOfList()
|
inline FListView::FListViewItems& FListView::getData()
|
||||||
{ return itemlist.begin(); }
|
{ return reinterpret_cast<FListViewItems&>(itemlist); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::iterator FListView::endOfList()
|
inline const FListView::FListViewItems& FListView::getData() const
|
||||||
{ return itemlist.end(); }
|
{ return reinterpret_cast<const FListViewItems&>(itemlist); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListView::isHorizontallyScrollable() const
|
inline bool FListView::isHorizontallyScrollable() const
|
||||||
|
|
|
@ -146,14 +146,14 @@ class FMenu : public FWindow, public FMenuList
|
||||||
uChar mouse_over_supermenu : 1;
|
uChar mouse_over_supermenu : 1;
|
||||||
uChar mouse_over_menubar : 1;
|
uChar mouse_over_menubar : 1;
|
||||||
uChar : 2; // padding bits
|
uChar : 2; // padding bits
|
||||||
} mouseStates;
|
} MouseStates;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FString text;
|
FString text;
|
||||||
std::size_t hotkeypos;
|
std::size_t hotkeypos;
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} MenuText;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FWidget* getSuperMenu() const;
|
FWidget* getSuperMenu() const;
|
||||||
|
@ -187,11 +187,11 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void mouseDownSubmenu (const FMenuItem*);
|
void mouseDownSubmenu (const FMenuItem*);
|
||||||
void mouseDownSelection (FMenuItem*, bool&);
|
void mouseDownSelection (FMenuItem*, bool&);
|
||||||
bool mouseUpOverList (const FPoint&);
|
bool mouseUpOverList (const FPoint&);
|
||||||
void mouseMoveOverList (const FPoint&, mouseStates&);
|
void mouseMoveOverList (const FPoint&, MouseStates&);
|
||||||
void mouseMoveSelection (FMenuItem*, mouseStates&);
|
void mouseMoveSelection (FMenuItem*, MouseStates&);
|
||||||
void mouseMoveDeselection (FMenuItem*, mouseStates&);
|
void mouseMoveDeselection (FMenuItem*, MouseStates&);
|
||||||
void mouseUpOverBorder();
|
void mouseUpOverBorder();
|
||||||
void mouseMoveOverBorder (mouseStates&) const;
|
void mouseMoveOverBorder (MouseStates&) const;
|
||||||
void passEventToSubMenu (FMouseEvent* const&);
|
void passEventToSubMenu (FMouseEvent* const&);
|
||||||
void passEventToSuperMenu (FMouseEvent* const&);
|
void passEventToSuperMenu (FMouseEvent* const&);
|
||||||
void passEventToMenuBar (FMouseEvent* const&) const;
|
void passEventToMenuBar (FMouseEvent* const&) const;
|
||||||
|
@ -208,7 +208,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void drawSeparator (int);
|
void drawSeparator (int);
|
||||||
void drawMenuLine (FMenuItem*, int);
|
void drawMenuLine (FMenuItem*, int);
|
||||||
void drawCheckMarkPrefix (const FMenuItem*);
|
void drawCheckMarkPrefix (const FMenuItem*);
|
||||||
void drawMenuText (menuText&);
|
void drawMenuText (MenuText&);
|
||||||
void drawSubMenuIndicator (std::size_t&);
|
void drawSubMenuIndicator (std::size_t&);
|
||||||
void drawAcceleratorKey (std::size_t&, FKey);
|
void drawAcceleratorKey (std::size_t&, FKey);
|
||||||
void drawTrailingSpaces (std::size_t);
|
void drawTrailingSpaces (std::size_t);
|
||||||
|
|
|
@ -92,7 +92,7 @@ class FOptiAttr final
|
||||||
int max_color;
|
int max_color;
|
||||||
int attr_without_color;
|
int attr_without_color;
|
||||||
bool ansi_default_color;
|
bool ansi_default_color;
|
||||||
} termEnv;
|
} TermEnv;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FOptiAttr();
|
FOptiAttr();
|
||||||
|
@ -110,7 +110,7 @@ class FOptiAttr final
|
||||||
FString getClassName() const;
|
FString getClassName() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setTermEnvironment (const termEnv&);
|
void setTermEnvironment (const TermEnv&);
|
||||||
void setMaxColor (const int&);
|
void setMaxColor (const int&);
|
||||||
void setNoColorVideo (int);
|
void setNoColorVideo (int);
|
||||||
void setDefaultColorSupport();
|
void setDefaultColorSupport();
|
||||||
|
@ -161,13 +161,13 @@ class FOptiAttr final
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs and Enumerations
|
// Typedefs and Enumerations
|
||||||
typedef char attributebuffer[SGRoptimizer::ATTR_BUF_SIZE];
|
typedef SGRoptimizer::AttributeBuffer AttributeBuffer;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char* cap;
|
const char* cap;
|
||||||
bool caused_reset;
|
bool caused_reset;
|
||||||
} capability;
|
} Capability;
|
||||||
|
|
||||||
enum init_reset_tests
|
enum init_reset_tests
|
||||||
{
|
{
|
||||||
|
@ -263,52 +263,51 @@ class FOptiAttr final
|
||||||
bool append_sequence (const char[]);
|
bool append_sequence (const char[]);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
capability F_enter_bold_mode{};
|
Capability F_enter_bold_mode{};
|
||||||
capability F_exit_bold_mode{};
|
Capability F_exit_bold_mode{};
|
||||||
capability F_enter_dim_mode{};
|
Capability F_enter_dim_mode{};
|
||||||
capability F_exit_dim_mode{};
|
Capability F_exit_dim_mode{};
|
||||||
capability F_enter_italics_mode{};
|
Capability F_enter_italics_mode{};
|
||||||
capability F_exit_italics_mode{};
|
Capability F_exit_italics_mode{};
|
||||||
capability F_enter_underline_mode{};
|
Capability F_enter_underline_mode{};
|
||||||
capability F_exit_underline_mode{};
|
Capability F_exit_underline_mode{};
|
||||||
capability F_enter_blink_mode{};
|
Capability F_enter_blink_mode{};
|
||||||
capability F_exit_blink_mode{};
|
Capability F_exit_blink_mode{};
|
||||||
capability F_enter_reverse_mode{};
|
Capability F_enter_reverse_mode{};
|
||||||
capability F_exit_reverse_mode{};
|
Capability F_exit_reverse_mode{};
|
||||||
capability F_enter_standout_mode{};
|
Capability F_enter_standout_mode{};
|
||||||
capability F_exit_standout_mode{};
|
Capability F_exit_standout_mode{};
|
||||||
capability F_enter_secure_mode{};
|
Capability F_enter_secure_mode{};
|
||||||
capability F_exit_secure_mode{};
|
Capability F_exit_secure_mode{};
|
||||||
capability F_enter_protected_mode{};
|
Capability F_enter_protected_mode{};
|
||||||
capability F_exit_protected_mode{};
|
Capability F_exit_protected_mode{};
|
||||||
capability F_enter_crossed_out_mode{};
|
Capability F_enter_crossed_out_mode{};
|
||||||
capability F_exit_crossed_out_mode{};
|
Capability F_exit_crossed_out_mode{};
|
||||||
capability F_enter_dbl_underline_mode{};
|
Capability F_enter_dbl_underline_mode{};
|
||||||
capability F_exit_dbl_underline_mode{};
|
Capability F_exit_dbl_underline_mode{};
|
||||||
capability F_set_attributes{};
|
Capability F_set_attributes{};
|
||||||
capability F_exit_attribute_mode{};
|
Capability F_exit_attribute_mode{};
|
||||||
capability F_enter_alt_charset_mode{};
|
Capability F_enter_alt_charset_mode{};
|
||||||
capability F_exit_alt_charset_mode{};
|
Capability F_exit_alt_charset_mode{};
|
||||||
capability F_enter_pc_charset_mode{};
|
Capability F_enter_pc_charset_mode{};
|
||||||
capability F_exit_pc_charset_mode{};
|
Capability F_exit_pc_charset_mode{};
|
||||||
capability F_set_a_foreground{};
|
Capability F_set_a_foreground{};
|
||||||
capability F_set_a_background{};
|
Capability F_set_a_background{};
|
||||||
capability F_set_foreground{};
|
Capability F_set_foreground{};
|
||||||
capability F_set_background{};
|
Capability F_set_background{};
|
||||||
capability F_set_color_pair{};
|
Capability F_set_color_pair{};
|
||||||
capability F_orig_pair{};
|
Capability F_orig_pair{};
|
||||||
capability F_orig_colors{};
|
Capability F_orig_colors{};
|
||||||
|
|
||||||
FChar on{};
|
FChar on{};
|
||||||
FChar off{};
|
FChar off{};
|
||||||
FChar reset_byte_mask{};
|
FChar reset_byte_mask{};
|
||||||
|
|
||||||
SGRoptimizer sgr_optimizer{attr_buf};
|
SGRoptimizer sgr_optimizer{attr_buf};
|
||||||
|
AttributeBuffer attr_buf{};
|
||||||
|
|
||||||
int max_color{1};
|
int max_color{1};
|
||||||
int attr_without_color{0};
|
int attr_without_color{0};
|
||||||
char* attr_ptr{attr_buf};
|
|
||||||
char attr_buf[SGRoptimizer::ATTR_BUF_SIZE]{'\0'};
|
|
||||||
bool ansi_default_color{false};
|
bool ansi_default_color{false};
|
||||||
bool alt_equal_pc_charset{false};
|
bool alt_equal_pc_charset{false};
|
||||||
bool monochron{true};
|
bool monochron{true};
|
||||||
|
|
|
@ -83,7 +83,7 @@ class FOptiMove final
|
||||||
int tabstop;
|
int tabstop;
|
||||||
bool automatic_left_margin;
|
bool automatic_left_margin;
|
||||||
bool eat_nl_glitch;
|
bool eat_nl_glitch;
|
||||||
} termEnv;
|
} TermEnv;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
explicit FOptiMove (int = 0);
|
explicit FOptiMove (int = 0);
|
||||||
|
@ -118,7 +118,7 @@ class FOptiMove final
|
||||||
void setBaudRate (int);
|
void setBaudRate (int);
|
||||||
void setTabStop (int);
|
void setTabStop (int);
|
||||||
void setTermSize (std::size_t, std::size_t);
|
void setTermSize (std::size_t, std::size_t);
|
||||||
void setTermEnvironment (const termEnv&);
|
void setTermEnvironment (const TermEnv&);
|
||||||
void set_cursor_home (const char[]);
|
void set_cursor_home (const char[]);
|
||||||
void set_cursor_to_ll (const char[]);
|
void set_cursor_to_ll (const char[]);
|
||||||
void set_carriage_return (const char[]);
|
void set_carriage_return (const char[]);
|
||||||
|
@ -156,7 +156,7 @@ class FOptiMove final
|
||||||
const char* cap;
|
const char* cap;
|
||||||
int duration;
|
int duration;
|
||||||
int length;
|
int length;
|
||||||
} capability;
|
} Capability;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr int LONG_DURATION{INT_MAX};
|
static constexpr int LONG_DURATION{INT_MAX};
|
||||||
|
@ -168,7 +168,7 @@ class FOptiMove final
|
||||||
void calculateCharDuration();
|
void calculateCharDuration();
|
||||||
int capDuration (const char[], int) const;
|
int capDuration (const char[], int) const;
|
||||||
int capDurationToLength (int) const;
|
int capDurationToLength (int) const;
|
||||||
int repeatedAppend (const capability&, volatile int, char*) const;
|
int repeatedAppend (const Capability&, volatile int, char*) const;
|
||||||
int relativeMove (char[], int, int, int, int) const;
|
int relativeMove (char[], int, int, int, int) const;
|
||||||
int verticalMove (char[], int, int) const;
|
int verticalMove (char[], int, int) const;
|
||||||
void downMove (char[], int&, int, int) const;
|
void downMove (char[], int&, int, int) const;
|
||||||
|
@ -187,26 +187,26 @@ class FOptiMove final
|
||||||
void moveByMethod (int, int, int, int, int);
|
void moveByMethod (int, int, int, int, int);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
capability F_cursor_home{};
|
Capability F_cursor_home{};
|
||||||
capability F_carriage_return{};
|
Capability F_carriage_return{};
|
||||||
capability F_cursor_to_ll{};
|
Capability F_cursor_to_ll{};
|
||||||
capability F_tab{};
|
Capability F_tab{};
|
||||||
capability F_back_tab{};
|
Capability F_back_tab{};
|
||||||
capability F_cursor_up{};
|
Capability F_cursor_up{};
|
||||||
capability F_cursor_down{};
|
Capability F_cursor_down{};
|
||||||
capability F_cursor_left{};
|
Capability F_cursor_left{};
|
||||||
capability F_cursor_right{};
|
Capability F_cursor_right{};
|
||||||
capability F_cursor_address{};
|
Capability F_cursor_address{};
|
||||||
capability F_column_address{};
|
Capability F_column_address{};
|
||||||
capability F_row_address{};
|
Capability F_row_address{};
|
||||||
capability F_parm_up_cursor{};
|
Capability F_parm_up_cursor{};
|
||||||
capability F_parm_down_cursor{};
|
Capability F_parm_down_cursor{};
|
||||||
capability F_parm_left_cursor{};
|
Capability F_parm_left_cursor{};
|
||||||
capability F_parm_right_cursor{};
|
Capability F_parm_right_cursor{};
|
||||||
capability F_erase_chars{};
|
Capability F_erase_chars{};
|
||||||
capability F_repeat_char{};
|
Capability F_repeat_char{};
|
||||||
capability F_clr_bol{};
|
Capability F_clr_bol{};
|
||||||
capability F_clr_eol{};
|
Capability F_clr_eol{};
|
||||||
|
|
||||||
std::size_t screen_width{80};
|
std::size_t screen_width{80};
|
||||||
std::size_t screen_height{24};
|
std::size_t screen_height{24};
|
||||||
|
|
|
@ -150,7 +150,7 @@ class FScrollView : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
typedef std::unordered_map<int, std::function<void()>> KeyMap;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr int vertical_border_spacing = 2;
|
static constexpr int vertical_border_spacing = 2;
|
||||||
|
@ -181,7 +181,7 @@ class FScrollView : public FWidget
|
||||||
FTermArea* viewport{nullptr}; // virtual scroll content
|
FTermArea* viewport{nullptr}; // virtual scroll content
|
||||||
FScrollbarPtr vbar{nullptr};
|
FScrollbarPtr vbar{nullptr};
|
||||||
FScrollbarPtr hbar{nullptr};
|
FScrollbarPtr hbar{nullptr};
|
||||||
keyMap key_map{};
|
KeyMap key_map{};
|
||||||
uInt8 nf_offset{0};
|
uInt8 nf_offset{0};
|
||||||
bool use_own_print_area{false};
|
bool use_own_print_area{false};
|
||||||
bool update_scrollbar{true};
|
bool update_scrollbar{true};
|
||||||
|
|
|
@ -231,7 +231,7 @@ class FStatusBar : public FWindow
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef std::vector<FStatusKey*> keyList;
|
typedef std::vector<FStatusKey*> FKeyList;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -239,11 +239,11 @@ class FStatusBar : public FWindow
|
||||||
int getKeyTextWidth (const FStatusKey*) const;
|
int getKeyTextWidth (const FStatusKey*) const;
|
||||||
void draw() override;
|
void draw() override;
|
||||||
void drawKeys();
|
void drawKeys();
|
||||||
void drawKey (keyList::const_iterator);
|
void drawKey (FKeyList::const_iterator);
|
||||||
void drawActiveKey (keyList::const_iterator);
|
void drawActiveKey (FKeyList::const_iterator);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
keyList key_list{};
|
FKeyList key_list{};
|
||||||
FString text{""};
|
FString text{""};
|
||||||
std::size_t screenWidth{80};
|
std::size_t screenWidth{80};
|
||||||
int keyname_len{0};
|
int keyname_len{0};
|
||||||
|
|
|
@ -419,8 +419,7 @@ inline wchar_t FString::back() const
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline FString& FString::sprintf (const FString& format, Args&&... args)
|
inline FString& FString::sprintf (const FString& format, Args&&... args)
|
||||||
{
|
{
|
||||||
static constexpr int BUFSIZE = 4096;
|
std::array<wchar_t, 4096> buf{};
|
||||||
wchar_t buf[BUFSIZE]{};
|
|
||||||
|
|
||||||
if ( format.isEmpty() )
|
if ( format.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -428,9 +427,9 @@ inline FString& FString::sprintf (const FString& format, Args&&... args)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::swprintf ( buf, BUFSIZE, format.wc_str()
|
std::swprintf ( buf.data(), buf.size(), format.wc_str()
|
||||||
, std::forward<Args>(args)... );
|
, std::forward<Args>(args)... );
|
||||||
_assign(buf);
|
_assign(buf.data());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ class FKeyboard;
|
||||||
class FMouseControl;
|
class FMouseControl;
|
||||||
class FOptiAttr;
|
class FOptiAttr;
|
||||||
class FOptiMove;
|
class FOptiMove;
|
||||||
|
class FPoint;
|
||||||
class FStartOptions;
|
class FStartOptions;
|
||||||
class FSize;
|
class FSize;
|
||||||
class FString;
|
class FString;
|
||||||
|
@ -266,7 +267,7 @@ class FTerm final
|
||||||
// Methods
|
// Methods
|
||||||
static bool setVGAFont();
|
static bool setVGAFont();
|
||||||
static bool setNewFont();
|
static bool setNewFont();
|
||||||
static bool setOldFont();
|
static bool resetFont();
|
||||||
static int openConsole();
|
static int openConsole();
|
||||||
static int closeConsole();
|
static int closeConsole();
|
||||||
static const char* moveCursorString (int, int, int, int);
|
static const char* moveCursorString (int, int, int, int);
|
||||||
|
@ -415,7 +416,7 @@ std::size_t getColumnWidth (const FString&);
|
||||||
std::size_t getColumnWidth (const wchar_t);
|
std::size_t getColumnWidth (const wchar_t);
|
||||||
std::size_t getColumnWidth (FChar&);
|
std::size_t getColumnWidth (FChar&);
|
||||||
std::size_t getColumnWidth (const FTermBuffer&);
|
std::size_t getColumnWidth (const FTermBuffer&);
|
||||||
|
FPoint readCursorPos();
|
||||||
|
|
||||||
// FTerm inline functions
|
// FTerm inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -84,11 +84,11 @@ class FTermcap final
|
||||||
const char* string;
|
const char* string;
|
||||||
char tname[alignof(char*)];
|
char tname[alignof(char*)];
|
||||||
}
|
}
|
||||||
tcap_map;
|
TCapMap;
|
||||||
|
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
using fn_putc = int (*)(int);
|
using fn_putc = int (*)(int);
|
||||||
using TCapMapType = std::array<tcap_map, 83>;
|
using TCapMapType = std::array<TCapMap, 83>;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
FTermcap() = default;
|
FTermcap() = default;
|
||||||
|
|
|
@ -54,7 +54,7 @@ class FTermData final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef std::unordered_map<std::string, fc::encoding> encodingMap;
|
typedef std::unordered_map<std::string, fc::encoding> EncodingMap;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
FTermData()
|
FTermData()
|
||||||
|
@ -72,7 +72,7 @@ class FTermData final
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FString getClassName() const;
|
FString getClassName() const;
|
||||||
encodingMap& getEncodingList();
|
EncodingMap& getEncodingList();
|
||||||
charSubstitution& getCharSubstitutionMap();
|
charSubstitution& getCharSubstitutionMap();
|
||||||
fc::encoding getTermEncoding() const;
|
fc::encoding getTermEncoding() const;
|
||||||
FRect& getTermGeometry();
|
FRect& getTermGeometry();
|
||||||
|
@ -132,7 +132,7 @@ class FTermData final
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data members
|
// Data members
|
||||||
encodingMap encoding_list{};
|
EncodingMap encoding_list{};
|
||||||
charSubstitution char_substitution_map{};
|
charSubstitution char_substitution_map{};
|
||||||
FRect term_geometry{}; // current terminal geometry
|
FRect term_geometry{}; // current terminal geometry
|
||||||
FString xterm_font{};
|
FString xterm_font{};
|
||||||
|
@ -170,7 +170,7 @@ inline FString FTermData::getClassName() const
|
||||||
{ return "FTermData"; }
|
{ return "FTermData"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FTermData::encodingMap& FTermData::getEncodingList()
|
inline FTermData::EncodingMap& FTermData::getEncodingList()
|
||||||
{ return encoding_list; }
|
{ return encoding_list; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -210,6 +210,7 @@ class FTermDetection final
|
||||||
static const FString* sec_da;
|
static const FString* sec_da;
|
||||||
static FTermData* fterm_data;
|
static FTermData* fterm_data;
|
||||||
static FSystem* fsystem;
|
static FSystem* fsystem;
|
||||||
|
static FKeyboard* keyboard;
|
||||||
static FTerminalType terminal_type;
|
static FTerminalType terminal_type;
|
||||||
static colorEnv color_env;
|
static colorEnv color_env;
|
||||||
static secondaryDA secondary_da;
|
static secondaryDA secondary_da;
|
||||||
|
|
|
@ -124,7 +124,7 @@ class FTermLinux final
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedef
|
// Typedef
|
||||||
struct modifier_key // bit field
|
struct ModifierKey // bit field
|
||||||
{
|
{
|
||||||
uChar shift : 1; // 0..1
|
uChar shift : 1; // 0..1
|
||||||
uChar alt_gr : 1; // 0..1
|
uChar alt_gr : 1; // 0..1
|
||||||
|
@ -138,18 +138,18 @@ class FTermLinux final
|
||||||
uChar red;
|
uChar red;
|
||||||
uChar green;
|
uChar green;
|
||||||
uChar blue;
|
uChar blue;
|
||||||
} rgb;
|
} RGB;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
rgb color[16];
|
RGB color[16];
|
||||||
} ColorMap;
|
} ColorMap;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
int getFramebuffer_bpp();
|
int getFramebuffer_bpp();
|
||||||
bool getScreenFont();
|
bool getScreenFont();
|
||||||
bool getUnicodeMap ();
|
bool getUnicodeMap ();
|
||||||
modifier_key& getModifierKey();
|
ModifierKey& getModifierKey();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
int setScreenFont ( const uChar[], uInt, uInt, uInt
|
int setScreenFont ( const uChar[], uInt, uInt, uInt
|
||||||
|
@ -197,7 +197,7 @@ class FTermLinux final
|
||||||
ColorMap saved_color_map{};
|
ColorMap saved_color_map{};
|
||||||
ColorMap cmap{};
|
ColorMap cmap{};
|
||||||
int framebuffer_bpp{-1};
|
int framebuffer_bpp{-1};
|
||||||
modifier_key mod_key{};
|
ModifierKey mod_key{};
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace finalcut
|
||||||
// class forward declaration
|
// class forward declaration
|
||||||
class FString;
|
class FString;
|
||||||
class FSystem;
|
class FSystem;
|
||||||
|
class FKeyboard;
|
||||||
class FTermDetection;
|
class FTermDetection;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -106,6 +107,7 @@ class FTermXTerminal final
|
||||||
void resetMouseBackground();
|
void resetMouseBackground();
|
||||||
void resetHighlightBackground();
|
void resetHighlightBackground();
|
||||||
void resetDefaults();
|
void resetDefaults();
|
||||||
|
void resetTitle();
|
||||||
void captureFontAndTitle();
|
void captureFontAndTitle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -147,6 +149,7 @@ class FTermXTerminal final
|
||||||
static bool mouse_support;
|
static bool mouse_support;
|
||||||
bool meta_sends_esc{false};
|
bool meta_sends_esc{false};
|
||||||
bool xterm_default_colors{false};
|
bool xterm_default_colors{false};
|
||||||
|
bool title_was_changed{false};
|
||||||
std::size_t term_width{80};
|
std::size_t term_width{80};
|
||||||
std::size_t term_height{24};
|
std::size_t term_height{24};
|
||||||
FString xterm_font{};
|
FString xterm_font{};
|
||||||
|
@ -158,6 +161,7 @@ class FTermXTerminal final
|
||||||
FString mouse_background_color{};
|
FString mouse_background_color{};
|
||||||
FString highlight_background_color{};
|
FString highlight_background_color{};
|
||||||
static FSystem* fsystem;
|
static FSystem* fsystem;
|
||||||
|
static FKeyboard* keyboard;
|
||||||
FTermDetection* term_detection{nullptr};
|
FTermDetection* term_detection{nullptr};
|
||||||
fc::xtermCursorStyle cursor_style{fc::unknown_cursor_style};
|
fc::xtermCursorStyle cursor_style{fc::unknown_cursor_style};
|
||||||
};
|
};
|
||||||
|
|
|
@ -138,7 +138,7 @@ class FTextView : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef std::unordered_map<int, std::function<void()>> keyMap;
|
typedef std::unordered_map<int, std::function<void()>> KeyMap;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
std::size_t getTextHeight() const;
|
std::size_t getTextHeight() const;
|
||||||
|
@ -168,7 +168,7 @@ class FTextView : public FWidget
|
||||||
FStringList data{};
|
FStringList data{};
|
||||||
FScrollbarPtr vbar{nullptr};
|
FScrollbarPtr vbar{nullptr};
|
||||||
FScrollbarPtr hbar{nullptr};
|
FScrollbarPtr hbar{nullptr};
|
||||||
keyMap key_map{};
|
KeyMap key_map{};
|
||||||
bool update_scrollbar{true};
|
bool update_scrollbar{true};
|
||||||
int xoffset{0};
|
int xoffset{0};
|
||||||
int yoffset{0};
|
int yoffset{0};
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ inline void FWidget::processDestroy() const
|
||||||
|
|
||||||
// Non-member elements for NewFont
|
// Non-member elements for NewFont
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const wchar_t NF_menu_button[4] =
|
constexpr wchar_t NF_menu_button[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_menu_button1,
|
fc::NF_rev_menu_button1,
|
||||||
fc::NF_rev_menu_button2,
|
fc::NF_rev_menu_button2,
|
||||||
|
@ -1066,49 +1066,49 @@ const wchar_t NF_menu_button[4] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_up[3] =
|
constexpr wchar_t NF_button_up[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_up_pointing_triangle1,
|
fc::NF_rev_up_pointing_triangle1,
|
||||||
fc::NF_rev_up_pointing_triangle2,
|
fc::NF_rev_up_pointing_triangle2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_down[3] =
|
constexpr wchar_t NF_button_down[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_down_pointing_triangle1,
|
fc::NF_rev_down_pointing_triangle1,
|
||||||
fc::NF_rev_down_pointing_triangle2,
|
fc::NF_rev_down_pointing_triangle2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_arrow_up[3] =
|
constexpr wchar_t NF_button_arrow_up[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_up_arrow1,
|
fc::NF_rev_up_arrow1,
|
||||||
fc::NF_rev_up_arrow2,
|
fc::NF_rev_up_arrow2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_arrow_down[3] =
|
constexpr wchar_t NF_button_arrow_down[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_down_arrow1,
|
fc::NF_rev_down_arrow1,
|
||||||
fc::NF_rev_down_arrow2,
|
fc::NF_rev_down_arrow2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_arrow_left[3] =
|
constexpr wchar_t NF_button_arrow_left[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_left_arrow1,
|
fc::NF_rev_left_arrow1,
|
||||||
fc::NF_rev_left_arrow2,
|
fc::NF_rev_left_arrow2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_button_arrow_right[3] =
|
constexpr wchar_t NF_button_arrow_right[]
|
||||||
{
|
{
|
||||||
fc::NF_rev_right_arrow1,
|
fc::NF_rev_right_arrow1,
|
||||||
fc::NF_rev_right_arrow2,
|
fc::NF_rev_right_arrow2,
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_Drive[5] =
|
constexpr wchar_t NF_Drive[]
|
||||||
{
|
{
|
||||||
fc::NF_shadow_box_left,
|
fc::NF_shadow_box_left,
|
||||||
fc::NF_shadow_box_middle,
|
fc::NF_shadow_box_middle,
|
||||||
|
@ -1117,7 +1117,7 @@ const wchar_t NF_Drive[5] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_CD_ROM[5] =
|
constexpr wchar_t NF_CD_ROM[]
|
||||||
{
|
{
|
||||||
fc::NF_shadow_box_left,
|
fc::NF_shadow_box_left,
|
||||||
fc::NF_shadow_box_middle,
|
fc::NF_shadow_box_middle,
|
||||||
|
@ -1126,7 +1126,7 @@ const wchar_t NF_CD_ROM[5] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t NF_Net_Drive[5] =
|
constexpr wchar_t NF_Net_Drive[]
|
||||||
{
|
{
|
||||||
fc::NF_shadow_box_left,
|
fc::NF_shadow_box_left,
|
||||||
fc::NF_shadow_box_middle,
|
fc::NF_shadow_box_middle,
|
||||||
|
@ -1135,7 +1135,7 @@ const wchar_t NF_Net_Drive[5] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t CHECKBOX[4] =
|
constexpr wchar_t CHECKBOX[]
|
||||||
{
|
{
|
||||||
fc::NF_shadow_box_left,
|
fc::NF_shadow_box_left,
|
||||||
fc::NF_shadow_box_middle,
|
fc::NF_shadow_box_middle,
|
||||||
|
@ -1143,7 +1143,7 @@ const wchar_t CHECKBOX[4] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t CHECKBOX_ON[4] =
|
constexpr wchar_t CHECKBOX_ON[]
|
||||||
{
|
{
|
||||||
fc::NF_shadow_box_left,
|
fc::NF_shadow_box_left,
|
||||||
fc::NF_shadow_box_checked,
|
fc::NF_shadow_box_checked,
|
||||||
|
@ -1151,7 +1151,7 @@ const wchar_t CHECKBOX_ON[4] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t RADIO_BUTTON[4] =
|
constexpr wchar_t RADIO_BUTTON[]
|
||||||
{
|
{
|
||||||
fc::NF_radio_button1,
|
fc::NF_radio_button1,
|
||||||
fc::NF_radio_button2,
|
fc::NF_radio_button2,
|
||||||
|
@ -1159,7 +1159,7 @@ const wchar_t RADIO_BUTTON[4] =
|
||||||
'\0'
|
'\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t CHECKED_RADIO_BUTTON[4] =
|
constexpr wchar_t CHECKED_RADIO_BUTTON[]
|
||||||
{
|
{
|
||||||
fc::NF_radio_button1,
|
fc::NF_radio_button1,
|
||||||
fc::NF_radio_button2_checked,
|
fc::NF_radio_button2_checked,
|
||||||
|
|
|
@ -51,10 +51,10 @@ class SGRoptimizer final
|
||||||
static constexpr std::size_t ATTR_BUF_SIZE{8192};
|
static constexpr std::size_t ATTR_BUF_SIZE{8192};
|
||||||
|
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef char attributebuffer[ATTR_BUF_SIZE];
|
typedef std::array<char, ATTR_BUF_SIZE> AttributeBuffer;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
explicit SGRoptimizer (attributebuffer&);
|
explicit SGRoptimizer (AttributeBuffer&);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
SGRoptimizer (const SGRoptimizer&) = delete;
|
SGRoptimizer (const SGRoptimizer&) = delete;
|
||||||
|
@ -77,7 +77,7 @@ class SGRoptimizer final
|
||||||
void combineParameter();
|
void combineParameter();
|
||||||
|
|
||||||
// Data member
|
// Data member
|
||||||
attributebuffer& seq;
|
AttributeBuffer& seq;
|
||||||
|
|
||||||
struct parameter
|
struct parameter
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace finalcut
|
||||||
|
|
||||||
// constructors and destructor
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
SGRoptimizer::SGRoptimizer (attributebuffer& sequence)
|
SGRoptimizer::SGRoptimizer (AttributeBuffer& sequence)
|
||||||
: seq{sequence}
|
: seq{sequence}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void SGRoptimizer::findParameter()
|
||||||
{
|
{
|
||||||
// Find ANSI X3.64 terminal SGR (Select Graphic Rendition) strings
|
// Find ANSI X3.64 terminal SGR (Select Graphic Rendition) strings
|
||||||
|
|
||||||
const std::size_t len = std::strlen(seq);
|
const std::size_t len = std::strlen(seq.data());
|
||||||
csi_parameter.clear();
|
csi_parameter.clear();
|
||||||
|
|
||||||
if ( len < 6 )
|
if ( len < 6 )
|
||||||
|
|
|
@ -43,8 +43,8 @@ typedef struct
|
||||||
}
|
}
|
||||||
FKeyMap;
|
FKeyMap;
|
||||||
|
|
||||||
using original_type = std::array<finalcut::fc::FKeyMap, 174>;
|
using original_type = std::array<finalcut::fc::FKeyMap, 188>;
|
||||||
using test_type = std::array<FKeyMap, 174>;
|
using test_type = std::array<FKeyMap, 188>;
|
||||||
|
|
||||||
test_type fkey =
|
test_type fkey =
|
||||||
{{
|
{{
|
||||||
|
@ -53,7 +53,6 @@ test_type fkey =
|
||||||
{ finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key
|
{ finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key
|
||||||
{ finalcut::fc::Fkey_ctab , CSI "3~" , "kt" }, // clear-tab key
|
{ finalcut::fc::Fkey_ctab , CSI "3~" , "kt" }, // clear-tab key
|
||||||
{ finalcut::fc::Fkey_dc , 0 , "kD" }, // delete-character key
|
{ finalcut::fc::Fkey_dc , 0 , "kD" }, // delete-character key
|
||||||
{ finalcut::fc::Fkey_dc , 0 , "kDx" }, // delete-character key
|
|
||||||
{ finalcut::fc::Fkey_dl , 0 , "kL" }, // delete-line key
|
{ finalcut::fc::Fkey_dl , 0 , "kL" }, // delete-line key
|
||||||
{ finalcut::fc::Fkey_down , ESC "OB" , "kd" }, // down-arrow key
|
{ finalcut::fc::Fkey_down , ESC "OB" , "kd" }, // down-arrow key
|
||||||
{ finalcut::fc::Fkey_eic , 0 , "kM" }, // sent by rmir or smir in insert mode
|
{ finalcut::fc::Fkey_eic , 0 , "kM" }, // sent by rmir or smir in insert mode
|
||||||
|
@ -199,33 +198,48 @@ test_type fkey =
|
||||||
{ finalcut::fc::Fkey_f62 , ESC "O1;4Q", "Fq" }, // F62 function key
|
{ finalcut::fc::Fkey_f62 , ESC "O1;4Q", "Fq" }, // F62 function key
|
||||||
{ finalcut::fc::Fkey_f63 , ESC "O1;4R", "Fr" }, // F63 function key
|
{ finalcut::fc::Fkey_f63 , ESC "O1;4R", "Fr" }, // F63 function key
|
||||||
// vt100 key codes for arrow and function keys
|
// vt100 key codes for arrow and function keys
|
||||||
{ finalcut::fc::Fkey_down , CSI "B" , "kdx"}, // down-arrow key (standard mode)
|
{ finalcut::fc::Fkey_f1 , ESC "OP" , "k1x"}, // PF1 (application mode)
|
||||||
{ finalcut::fc::Fkey_down , ESC "OB" , "kdX"}, // down-arrow key (application mode)
|
{ finalcut::fc::Fkey_f2 , ESC "OQ" , "k2x"}, // PF2 (application mode)
|
||||||
{ finalcut::fc::Fkey_f1 , ESC "OP" , "k1X"}, // PF1 (application mode)
|
{ finalcut::fc::Fkey_f3 , ESC "OR" , "k3x"}, // PF3 (application mode)
|
||||||
{ finalcut::fc::Fkey_f2 , CSI "OQ" , "k2X"}, // PF2 (application mode)
|
{ finalcut::fc::Fkey_f4 , ESC "OS" , "k4x"}, // PF4 (application mode)
|
||||||
{ finalcut::fc::Fkey_f3 , ESC "OR" , "k3X"}, // PF3 (application mode)
|
|
||||||
{ finalcut::fc::Fkey_f4 , ESC "OS" , "k4X"}, // PF4 (application mode)
|
|
||||||
{ finalcut::fc::Fkey_left , CSI "D" , "klx"}, // left-arrow key (standard mode)
|
{ finalcut::fc::Fkey_left , CSI "D" , "klx"}, // left-arrow key (standard mode)
|
||||||
{ finalcut::fc::Fkey_left , ESC "OD" , "klX"}, // left-arrow key (application mode)
|
{ finalcut::fc::Fkey_left , ESC "OD" , "klX"}, // left-arrow key (application mode)
|
||||||
{ finalcut::fc::Fkey_right , CSI "C" , "krx"}, // right-arrow key (standard mode)
|
{ finalcut::fc::Fkey_right , CSI "C" , "krx"}, // right-arrow key (standard mode)
|
||||||
{ finalcut::fc::Fkey_right , ESC "OC" , "krX"}, // right-arrow key (application mode)
|
{ finalcut::fc::Fkey_right , ESC "OC" , "krX"}, // right-arrow key (application mode)
|
||||||
{ finalcut::fc::Fkey_up , CSI "A" , "kux"}, // up-arrow key (standard mode)
|
{ finalcut::fc::Fkey_up , CSI "A" , "kux"}, // up-arrow key (standard mode)
|
||||||
{ finalcut::fc::Fkey_up , ESC "OA" , "kuX"}, // up-arrow key (application mode)
|
{ finalcut::fc::Fkey_up , ESC "OA" , "kuX"}, // up-arrow key (application mode)
|
||||||
|
{ finalcut::fc::Fkey_down , CSI "B" , "kdx"}, // down-arrow key (standard mode)
|
||||||
|
{ finalcut::fc::Fkey_down , ESC "OB" , "kdX"}, // down-arrow key (application mode)
|
||||||
|
{ finalcut::fc::Fkey_sf , CSI "a" , "kFx"}, // scroll-forward key (shift-up)
|
||||||
|
{ finalcut::fc::Fkey_sr , CSI "b" , "kRx"}, // scroll-backward key (shift-down)
|
||||||
// Fallback for rxvt with TERM=xterm
|
// Fallback for rxvt with TERM=xterm
|
||||||
{ finalcut::fc::Fkey_home , CSI "7~" , "khx"}, // home key
|
{ finalcut::fc::Fkey_home , CSI "7~" , "khx"}, // home key
|
||||||
{ finalcut::fc::Fkey_end , CSI "8~" , "@7x"}, // end key
|
{ finalcut::fc::Fkey_end , CSI "8~" , "@7x"}, // end key
|
||||||
{ finalcut::fc::Fkey_f1 , CSI "11~" , "k1x"}, // F1 function key
|
{ finalcut::fc::Fkey_f1 , CSI "11~" , "k1X"}, // F1 function key
|
||||||
{ finalcut::fc::Fkey_f2 , CSI "12~" , "k2x"}, // F2 function key
|
{ finalcut::fc::Fkey_f2 , CSI "12~" , "k2X"}, // F2 function key
|
||||||
{ finalcut::fc::Fkey_f3 , CSI "13~" , "k3x"}, // F3 function key
|
{ finalcut::fc::Fkey_f3 , CSI "13~" , "k3X"}, // F3 function key
|
||||||
{ finalcut::fc::Fkey_f4 , CSI "14~" , "k4x"}, // F4 function key
|
{ finalcut::fc::Fkey_f4 , CSI "14~" , "k4X"}, // F4 function key
|
||||||
// Fallback for TERM=ansi
|
// Fallback for TERM=ansi
|
||||||
{ finalcut::fc::Fkey_end , CSI "K" , "@7X"}, // end key
|
{ finalcut::fc::Fkey_home , CSI "H" , "khX"}, // home key
|
||||||
|
{ finalcut::fc::Fkey_end , CSI "F" , "@7X"}, // end key
|
||||||
|
{ finalcut::fc::Fkey_end , CSI "K" , "@7y"}, // end key (Microsoft HyperTerminal)
|
||||||
// Keypad keys
|
// Keypad keys
|
||||||
{ finalcut::fc::Fkey_enter , ESC "OM" , "@8x"}, // enter key
|
{ finalcut::fc::Fkey_enter , ESC "OM" , "@8x"}, // enter key
|
||||||
{ finalcut::fc::Fkey_slash , ESC "Oo" , "KP1"}, // keypad slash
|
{ finalcut::fc::Fkey_slash , ESC "Oo" , "KP1"}, // keypad slash
|
||||||
{ finalcut::fc::Fkey_asterisk , ESC "Oj" , "KP2"}, // keypad asterisk
|
{ finalcut::fc::Fkey_asterisk , ESC "Oj" , "KP2"}, // keypad asterisk
|
||||||
{ finalcut::fc::Fkey_minus_sign, ESC "Om" , "KP3"}, // keypad minus sign
|
{ finalcut::fc::Fkey_minus_sign, ESC "Om" , "KP3"}, // keypad minus sign
|
||||||
{ finalcut::fc::Fkey_plus_sign , ESC "Ok" , "KP4"} // keypad plus sign
|
{ finalcut::fc::Fkey_plus_sign , ESC "Ok" , "KP4"}, // keypad plus sign
|
||||||
|
{ finalcut::fc::Fkey_ic , ESC "Op" , "kIx"}, // keypad insert
|
||||||
|
{ finalcut::fc::Fkey_dc , ESC "On" , "kDx"}, // keypad delete
|
||||||
|
{ finalcut::fc::Fkey_left , ESC "Ot" , "kly"}, // keypad left-arrow
|
||||||
|
{ finalcut::fc::Fkey_right , ESC "Ov" , "kry"}, // keypad right-arrow
|
||||||
|
{ finalcut::fc::Fkey_up , ESC "Ox" , "kuy"}, // keypad up-arrow
|
||||||
|
{ finalcut::fc::Fkey_down , ESC "Or" , "kdy"}, // keypad down-arrow
|
||||||
|
{ finalcut::fc::Fkey_a1 , ESC "Ow" , "K1x"}, // keypad upper left
|
||||||
|
{ finalcut::fc::Fkey_a3 , ESC "Oy" , "K3x"}, // keypad upper right
|
||||||
|
{ finalcut::fc::Fkey_b2 , ESC "Ou" , "K2x"}, // keypad center
|
||||||
|
{ finalcut::fc::Fkey_c1 , ESC "Oq" , "K4x"}, // keypad lower left
|
||||||
|
{ finalcut::fc::Fkey_c3 , ESC "Os" , "K5x"} // keypad lower right
|
||||||
}};
|
}};
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
@ -2539,6 +2553,13 @@ void FKeyboardTest::sequencesTest()
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_home );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_home );
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
// Home key (ANSI terminal)
|
||||||
|
input("\033[H");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_home );
|
||||||
|
clear();
|
||||||
|
|
||||||
// End key in positioning mode
|
// End key in positioning mode
|
||||||
input("\033[8~");
|
input("\033[8~");
|
||||||
processInput();
|
processInput();
|
||||||
|
@ -2554,6 +2575,13 @@ void FKeyboardTest::sequencesTest()
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// End key (ANSI terminal)
|
// End key (ANSI terminal)
|
||||||
|
input("\033[F");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_end );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// End key (Microsoft HyperTerminal)
|
||||||
input("\033[K");
|
input("\033[K");
|
||||||
processInput();
|
processInput();
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
@ -2588,6 +2616,13 @@ void FKeyboardTest::sequencesTest()
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sf );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sf );
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
// Scroll-forward key (shift + up-arrow) in applications mode
|
||||||
|
input("\033[a");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sf );
|
||||||
|
clear();
|
||||||
|
|
||||||
// Scroll-backward key (shift + down-arrow)
|
// Scroll-backward key (shift + down-arrow)
|
||||||
input("\033[1;2A");
|
input("\033[1;2A");
|
||||||
processInput();
|
processInput();
|
||||||
|
@ -2595,6 +2630,13 @@ void FKeyboardTest::sequencesTest()
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sr );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sr );
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
// Scroll-backward key (shift + down-arrow) in applications mode
|
||||||
|
input("\033[b");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_sr );
|
||||||
|
clear();
|
||||||
|
|
||||||
// Center of keypad
|
// Center of keypad
|
||||||
input("\033[E");
|
input("\033[E");
|
||||||
processInput();
|
processInput();
|
||||||
|
@ -2706,6 +2748,84 @@ void FKeyboardTest::sequencesTest()
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_plus_sign );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_plus_sign );
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
// Keypad insert (numlock off)
|
||||||
|
input("\033Op");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_ic );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad delete (numlock off)
|
||||||
|
input("\033On");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_dc );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad left-arrow (numlock off)
|
||||||
|
input("\033Ot");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_left );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad right-arrow (numlock off)
|
||||||
|
input("\033Ov");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_right );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad up-arrow (numlock off)
|
||||||
|
input("\033Ox");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_up );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad down-arrow (numlock off)
|
||||||
|
input("\033Or");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_down );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad upper left (numlock off)
|
||||||
|
input("\033Ow");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_a1 );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad upper right (numlock off)
|
||||||
|
input("\033Oy");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_a3 );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad center (numlock off)
|
||||||
|
input("\033Ou");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_b2 );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad lower left (numlock off)
|
||||||
|
input("\033Oq");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_c1 );
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Keypad lower right (numlock off)
|
||||||
|
input("\033Os");
|
||||||
|
processInput();
|
||||||
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_c3 );
|
||||||
|
clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -224,80 +224,80 @@ void FOptiAttrTest::sgrOptimizerTest()
|
||||||
|
|
||||||
// Test only the optimizer
|
// Test only the optimizer
|
||||||
// -----------------------
|
// -----------------------
|
||||||
char buffer[8192] = { CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" };
|
finalcut::SGRoptimizer::AttributeBuffer buffer = { CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" };
|
||||||
finalcut::SGRoptimizer sgr_optimizer(buffer);
|
finalcut::SGRoptimizer sgr_optimizer(buffer);
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;10;11;36;44m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;10;11;36;44m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "0;1m" CSI "34m");
|
std::strcpy(buffer.data(), CSI "0;1m" CSI "34m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;1;34m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;1;34m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "34m");
|
std::strcpy(buffer.data(), CSI "m" CSI "34m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;34m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;34m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "1m" CSI "m" CSI "45m");
|
std::strcpy(buffer.data(), CSI "1m" CSI "m" CSI "45m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "1;0;45m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "1;0;45m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "47m");
|
std::strcpy(buffer.data(), CSI "47m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "47m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "47m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "47m" CSI "m" CSI "1m");
|
std::strcpy(buffer.data(), CSI "47m" CSI "m" CSI "1m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "47;0;1m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "47;0;1m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "49m" CSI "m" CSI "0m");
|
std::strcpy(buffer.data(), CSI "49m" CSI "m" CSI "0m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "49;0;0m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "49;0;0m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "m" CSI "m");
|
std::strcpy(buffer.data(), CSI "m" CSI "m" CSI "m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;0;0m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;0;0m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m");
|
std::strcpy(buffer.data(), CSI "m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "0;10;1;7m" CSI "3m" CSI "39m" CSI "49m");
|
std::strcpy(buffer.data(), CSI "0;10;1;7m" CSI "3m" CSI "39m" CSI "49m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;10;1;7;3;39;49m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;10;1;7;3;39;49m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" CSI "48;5;229m");
|
std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "48;5;229m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;38;5;20;48;5;229m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20;48;5;229m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" CSI "11;16H");
|
std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "11;16H");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;38;5;20m" CSI "11;16H" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "1;1H" CSI "m" CSI "38;5;35m");
|
std::strcpy(buffer.data(), CSI "1;1H" CSI "m" CSI "38;5;35m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "1;1H" CSI "0;38;5;35m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "1;1H" CSI "0;38;5;35m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" CSI "11;16H" CSI "48;5;229m");
|
std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "11;16H" CSI "48;5;229m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;38;5;20m" CSI "11;16H" CSI "48;5;229m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" CSI "48;5;229m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" "ABC" CSI "48;5;229m");
|
std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" "ABC" CSI "48;5;229m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;38;5;20mABC" CSI "48;5;229m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20mABC" CSI "48;5;229m" );
|
||||||
|
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m"
|
std::strcpy(buffer.data(), CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m"
|
||||||
CSI "5m" CSI "7m" CSI "8m" CSI "9m");
|
CSI "5m" CSI "7m" CSI "8m" CSI "9m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;1;2;3;4;5;7;8;9m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;1;2;3;4;5;7;8;9m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "0m" CSI "46;36;1m");
|
std::strcpy(buffer.data(), CSI "0m" CSI "46;36;1m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;46;36;1m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;46;36;1m" );
|
||||||
|
|
||||||
std::strcpy(buffer, CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m");
|
std::strcpy(buffer.data(), CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m");
|
||||||
sgr_optimizer.optimize();
|
sgr_optimizer.optimize();
|
||||||
CPPUNIT_ASSERT_CSTRING ( buffer, CSI "0;38;2;0;139;139;48;2;240;255;240m" );
|
CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;2;0;139;139;48;2;240;255;240m" );
|
||||||
|
|
||||||
delete to;
|
delete to;
|
||||||
delete from;
|
delete from;
|
||||||
|
@ -4163,7 +4163,7 @@ void FOptiAttrTest::wyse50Test()
|
||||||
|
|
||||||
finalcut::FStartOptions::getFStartOptions().sgr_optimizer = false;
|
finalcut::FStartOptions::getFStartOptions().sgr_optimizer = false;
|
||||||
finalcut::FOptiAttr oa;
|
finalcut::FOptiAttr oa;
|
||||||
finalcut::FOptiAttr::termEnv optiattr_env =
|
finalcut::FOptiAttr::TermEnv optiattr_env =
|
||||||
{
|
{
|
||||||
0, // Enter bold
|
0, // Enter bold
|
||||||
ESC "(" ESC "H\003"
|
ESC "(" ESC "H\003"
|
||||||
|
|
|
@ -612,7 +612,7 @@ void FOptiMoveTest::teratermTest()
|
||||||
om.setTermSize (80, 25);
|
om.setTermSize (80, 25);
|
||||||
om.setBaudRate (38400);
|
om.setBaudRate (38400);
|
||||||
|
|
||||||
finalcut::FOptiMove::termEnv optimove_env =
|
finalcut::FOptiMove::TermEnv optimove_env =
|
||||||
{
|
{
|
||||||
CSI "H", // Cursor home
|
CSI "H", // Cursor home
|
||||||
"\r", // Carriage return
|
"\r", // Carriage return
|
||||||
|
|
|
@ -75,18 +75,18 @@ class FSystemTest : public finalcut::FSystem
|
||||||
uChar ctrl : 1;
|
uChar ctrl : 1;
|
||||||
uChar alt : 1;
|
uChar alt : 1;
|
||||||
uChar : 4; // padding bits
|
uChar : 4; // padding bits
|
||||||
} shiftstate;
|
} ShiftState;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uChar red;
|
uChar red;
|
||||||
uChar green;
|
uChar green;
|
||||||
uChar blue;
|
uChar blue;
|
||||||
} rgb;
|
} RGB;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
rgb color[16];
|
RGB color[16];
|
||||||
} ColorMap;
|
} ColorMap;
|
||||||
|
|
||||||
enum ac_mode
|
enum ac_mode
|
||||||
|
@ -117,9 +117,9 @@ class FSystemTest : public finalcut::FSystem
|
||||||
int getpwuid_r (uid_t, struct passwd*, char*
|
int getpwuid_r (uid_t, struct passwd*, char*
|
||||||
, size_t, struct passwd** ) override;
|
, size_t, struct passwd** ) override;
|
||||||
char* realpath (const char*, char*) override;
|
char* realpath (const char*, char*) override;
|
||||||
rgb& getRGB (std::size_t);
|
RGB& getRGB (std::size_t);
|
||||||
console_font_op& getConsoleFont();
|
console_font_op& getConsoleFont();
|
||||||
shiftstate& getShiftState();
|
ShiftState& getShiftState();
|
||||||
std::string& getCharacters();
|
std::string& getCharacters();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -129,9 +129,9 @@ class FSystemTest : public finalcut::FSystem
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
std::string characters;
|
std::string characters;
|
||||||
static shiftstate shift_state;
|
static ShiftState shift_state;
|
||||||
static rgb terminal_color[16];
|
static RGB terminal_color[16];
|
||||||
static rgb defaultColor[16];
|
static RGB defaultColor[16];
|
||||||
static struct console_font_op terminal_font;
|
static struct console_font_op terminal_font;
|
||||||
static unimapdesc terminal_unicode_map;
|
static unimapdesc terminal_unicode_map;
|
||||||
static struct fb_var_screeninfo fb_terminal_info;
|
static struct fb_var_screeninfo fb_terminal_info;
|
||||||
|
@ -948,9 +948,9 @@ struct unipair FSystemTest::unicode_cp437_pairs[] =
|
||||||
{0x266c, 0x0e}
|
{0x266c, 0x0e}
|
||||||
};
|
};
|
||||||
|
|
||||||
FSystemTest::rgb FSystemTest::terminal_color[16] { };
|
FSystemTest::RGB FSystemTest::terminal_color[16] { };
|
||||||
|
|
||||||
FSystemTest::rgb FSystemTest::defaultColor[16]
|
FSystemTest::RGB FSystemTest::defaultColor[16]
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
||||||
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
||||||
|
@ -965,7 +965,7 @@ FSystemTest::rgb FSystemTest::defaultColor[16]
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FSystemTest::shiftstate FSystemTest::shift_state{};
|
FSystemTest::ShiftState FSystemTest::shift_state{};
|
||||||
struct console_font_op FSystemTest::terminal_font{};
|
struct console_font_op FSystemTest::terminal_font{};
|
||||||
unimapdesc FSystemTest::terminal_unicode_map{};
|
unimapdesc FSystemTest::terminal_unicode_map{};
|
||||||
struct fb_var_screeninfo FSystemTest::fb_terminal_info{};
|
struct fb_var_screeninfo FSystemTest::fb_terminal_info{};
|
||||||
|
@ -1368,7 +1368,7 @@ char* FSystemTest::realpath (const char*, char*)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FSystemTest::rgb& FSystemTest::getRGB (std::size_t i)
|
FSystemTest::RGB& FSystemTest::getRGB (std::size_t i)
|
||||||
{
|
{
|
||||||
if ( i < 16 )
|
if ( i < 16 )
|
||||||
return terminal_color[i];
|
return terminal_color[i];
|
||||||
|
@ -1383,7 +1383,7 @@ console_font_op& FSystemTest::getConsoleFont()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FSystemTest::shiftstate& FSystemTest::getShiftState()
|
FSystemTest::ShiftState& FSystemTest::getShiftState()
|
||||||
{
|
{
|
||||||
return shift_state;
|
return shift_state;
|
||||||
}
|
}
|
||||||
|
@ -1894,7 +1894,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( linux.resetColorMap() == true );
|
CPPUNIT_ASSERT ( linux.resetColorMap() == true );
|
||||||
CPPUNIT_ASSERT ( linux.saveColorMap() == true );
|
CPPUNIT_ASSERT ( linux.saveColorMap() == true );
|
||||||
FColor index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Black);
|
FColor index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Black);
|
||||||
test::FSystemTest::rgb& RGB0 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB0 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB0.red == 0x00 );
|
CPPUNIT_ASSERT ( RGB0.red == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB0.green == 0x00 );
|
CPPUNIT_ASSERT ( RGB0.green == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB0.blue == 0x00 );
|
CPPUNIT_ASSERT ( RGB0.blue == 0x00 );
|
||||||
|
@ -1904,7 +1904,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB0.blue == 0x03 );
|
CPPUNIT_ASSERT ( RGB0.blue == 0x03 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Blue);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Blue);
|
||||||
test::FSystemTest::rgb& RGB1 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB1 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB1.red == 0x00 );
|
CPPUNIT_ASSERT ( RGB1.red == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB1.green == 0x00 );
|
CPPUNIT_ASSERT ( RGB1.green == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB1.blue == 0xaa );
|
CPPUNIT_ASSERT ( RGB1.blue == 0xaa );
|
||||||
|
@ -1914,7 +1914,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB1.blue == 0x06 );
|
CPPUNIT_ASSERT ( RGB1.blue == 0x06 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Green);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Green);
|
||||||
test::FSystemTest::rgb& RGB2 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB2 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB2.red == 0x00 );
|
CPPUNIT_ASSERT ( RGB2.red == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB2.green == 0xaa );
|
CPPUNIT_ASSERT ( RGB2.green == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB2.blue == 0x00 );
|
CPPUNIT_ASSERT ( RGB2.blue == 0x00 );
|
||||||
|
@ -1924,7 +1924,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB2.blue == 0x09 );
|
CPPUNIT_ASSERT ( RGB2.blue == 0x09 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Cyan);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Cyan);
|
||||||
test::FSystemTest::rgb& RGB3 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB3 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB3.red == 0x00 );
|
CPPUNIT_ASSERT ( RGB3.red == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB3.green == 0xaa );
|
CPPUNIT_ASSERT ( RGB3.green == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB3.blue == 0xaa );
|
CPPUNIT_ASSERT ( RGB3.blue == 0xaa );
|
||||||
|
@ -1934,7 +1934,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB3.blue == 0x0c );
|
CPPUNIT_ASSERT ( RGB3.blue == 0x0c );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Red);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Red);
|
||||||
test::FSystemTest::rgb& RGB4 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB4 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB4.red == 0xaa );
|
CPPUNIT_ASSERT ( RGB4.red == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB4.green == 0x00 );
|
CPPUNIT_ASSERT ( RGB4.green == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB4.blue == 0x00 );
|
CPPUNIT_ASSERT ( RGB4.blue == 0x00 );
|
||||||
|
@ -1944,7 +1944,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB4.blue == 0x0f );
|
CPPUNIT_ASSERT ( RGB4.blue == 0x0f );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Magenta);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Magenta);
|
||||||
test::FSystemTest::rgb& RGB5 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB5 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB5.red == 0xaa );
|
CPPUNIT_ASSERT ( RGB5.red == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB5.green == 0x00 );
|
CPPUNIT_ASSERT ( RGB5.green == 0x00 );
|
||||||
CPPUNIT_ASSERT ( RGB5.blue == 0xaa );
|
CPPUNIT_ASSERT ( RGB5.blue == 0xaa );
|
||||||
|
@ -1954,7 +1954,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB5.blue == 0x12 );
|
CPPUNIT_ASSERT ( RGB5.blue == 0x12 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Brown);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Brown);
|
||||||
test::FSystemTest::rgb& RGB6 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB6 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB6.red == 0xaa );
|
CPPUNIT_ASSERT ( RGB6.red == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB6.green == 0x55 );
|
CPPUNIT_ASSERT ( RGB6.green == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB6.blue == 0x00 );
|
CPPUNIT_ASSERT ( RGB6.blue == 0x00 );
|
||||||
|
@ -1964,7 +1964,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB6.blue == 0x15 );
|
CPPUNIT_ASSERT ( RGB6.blue == 0x15 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightGray);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightGray);
|
||||||
test::FSystemTest::rgb& RGB7 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB7 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB7.red == 0xaa );
|
CPPUNIT_ASSERT ( RGB7.red == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB7.green == 0xaa );
|
CPPUNIT_ASSERT ( RGB7.green == 0xaa );
|
||||||
CPPUNIT_ASSERT ( RGB7.blue == 0xaa );
|
CPPUNIT_ASSERT ( RGB7.blue == 0xaa );
|
||||||
|
@ -1974,7 +1974,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB7.blue == 0x18 );
|
CPPUNIT_ASSERT ( RGB7.blue == 0x18 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::DarkGray);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::DarkGray);
|
||||||
test::FSystemTest::rgb& RGB8 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB8 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB8.red == 0x55 );
|
CPPUNIT_ASSERT ( RGB8.red == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB8.green == 0x55 );
|
CPPUNIT_ASSERT ( RGB8.green == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB8.blue == 0x55 );
|
CPPUNIT_ASSERT ( RGB8.blue == 0x55 );
|
||||||
|
@ -1984,7 +1984,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB8.blue == 0x21 );
|
CPPUNIT_ASSERT ( RGB8.blue == 0x21 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightBlue);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightBlue);
|
||||||
test::FSystemTest::rgb& RGB9 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB9 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB9.red == 0x55 );
|
CPPUNIT_ASSERT ( RGB9.red == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB9.green == 0x55 );
|
CPPUNIT_ASSERT ( RGB9.green == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB9.blue == 0xff );
|
CPPUNIT_ASSERT ( RGB9.blue == 0xff );
|
||||||
|
@ -1994,7 +1994,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB9.blue == 0x24 );
|
CPPUNIT_ASSERT ( RGB9.blue == 0x24 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightGreen);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightGreen);
|
||||||
test::FSystemTest::rgb& RGB10 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB10 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB10.red == 0x55 );
|
CPPUNIT_ASSERT ( RGB10.red == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB10.green == 0xff );
|
CPPUNIT_ASSERT ( RGB10.green == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB10.blue == 0x55 );
|
CPPUNIT_ASSERT ( RGB10.blue == 0x55 );
|
||||||
|
@ -2004,7 +2004,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB10.blue == 0x27 );
|
CPPUNIT_ASSERT ( RGB10.blue == 0x27 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightCyan);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightCyan);
|
||||||
test::FSystemTest::rgb& RGB11 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB11 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB11.red == 0x55 );
|
CPPUNIT_ASSERT ( RGB11.red == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB11.green == 0xff );
|
CPPUNIT_ASSERT ( RGB11.green == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB11.blue == 0xff );
|
CPPUNIT_ASSERT ( RGB11.blue == 0xff );
|
||||||
|
@ -2014,7 +2014,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB11.blue == 0x30 );
|
CPPUNIT_ASSERT ( RGB11.blue == 0x30 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightRed);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightRed);
|
||||||
test::FSystemTest::rgb& RGB12 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB12 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB12.red == 0xff );
|
CPPUNIT_ASSERT ( RGB12.red == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB12.green == 0x55 );
|
CPPUNIT_ASSERT ( RGB12.green == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB12.blue == 0x55 );
|
CPPUNIT_ASSERT ( RGB12.blue == 0x55 );
|
||||||
|
@ -2024,7 +2024,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB12.blue == 0x33 );
|
CPPUNIT_ASSERT ( RGB12.blue == 0x33 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightMagenta);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::LightMagenta);
|
||||||
test::FSystemTest::rgb& RGB13 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB13 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB13.red == 0xff );
|
CPPUNIT_ASSERT ( RGB13.red == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB13.green == 0x55 );
|
CPPUNIT_ASSERT ( RGB13.green == 0x55 );
|
||||||
CPPUNIT_ASSERT ( RGB13.blue == 0xff );
|
CPPUNIT_ASSERT ( RGB13.blue == 0xff );
|
||||||
|
@ -2034,7 +2034,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB13.blue == 0x36 );
|
CPPUNIT_ASSERT ( RGB13.blue == 0x36 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Yellow);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::Yellow);
|
||||||
test::FSystemTest::rgb& RGB14 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB14 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB14.red == 0xff );
|
CPPUNIT_ASSERT ( RGB14.red == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB14.green == 0xff );
|
CPPUNIT_ASSERT ( RGB14.green == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB14.blue == 0x55 );
|
CPPUNIT_ASSERT ( RGB14.blue == 0x55 );
|
||||||
|
@ -2044,7 +2044,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
|
||||||
CPPUNIT_ASSERT ( RGB14.blue == 0x39 );
|
CPPUNIT_ASSERT ( RGB14.blue == 0x39 );
|
||||||
|
|
||||||
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::White);
|
index = finalcut::FOptiAttr::vga2ansi(finalcut::fc::White);
|
||||||
test::FSystemTest::rgb& RGB15 = fsystest->getRGB(index);
|
test::FSystemTest::RGB& RGB15 = fsystest->getRGB(index);
|
||||||
CPPUNIT_ASSERT ( RGB15.red == 0xff );
|
CPPUNIT_ASSERT ( RGB15.red == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB15.green == 0xff );
|
CPPUNIT_ASSERT ( RGB15.green == 0xff );
|
||||||
CPPUNIT_ASSERT ( RGB15.blue == 0xff );
|
CPPUNIT_ASSERT ( RGB15.blue == 0xff );
|
||||||
|
@ -2253,7 +2253,7 @@ void FTermLinuxTest::modifierKeyTest()
|
||||||
finalcut::FTermLinux linux{};
|
finalcut::FTermLinux linux{};
|
||||||
finalcut::FSystem* fsys(new test::FSystemTest());
|
finalcut::FSystem* fsys(new test::FSystemTest());
|
||||||
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
test::FSystemTest* fsystest = static_cast<test::FSystemTest*>(fsys);
|
||||||
test::FSystemTest::shiftstate& mod_key = fsystest->getShiftState();
|
test::FSystemTest::ShiftState& mod_key = fsystest->getShiftState();
|
||||||
|
|
||||||
// Up key
|
// Up key
|
||||||
keycode = finalcut::fc::Fkey_up;
|
keycode = finalcut::fc::Fkey_up;
|
||||||
|
|
Loading…
Reference in New Issue