Use constexpr for fixed values
This commit is contained in:
parent
8e618812ac
commit
2a06915f1c
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
const lDouble PI = 3.141592653589793238L;
|
constexpr lDouble PI = 3.141592653589793238L;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -125,7 +125,7 @@ void CheckList::populate()
|
||||||
{ "Lemons", "Low" }
|
{ "Lemons", "Low" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
||||||
|
|
||||||
for (int i = 0; i <= lastItem; i++)
|
for (int i = 0; i <= lastItem; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,40 +27,41 @@
|
||||||
|
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
|
using namespace finalcut;
|
||||||
|
|
||||||
// Global application object
|
// Global application object
|
||||||
static std::shared_ptr<finalcut::FString> temp_str { nullptr };
|
static std::shared_ptr<FString> temp_str { nullptr };
|
||||||
|
|
||||||
|
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
void doubleToItem ( finalcut::FListBoxItem&
|
void doubleToItem ( FListBoxItem&
|
||||||
, finalcut::FWidget::data_ptr container
|
, FWidget::data_ptr container
|
||||||
, int index);
|
, int index);
|
||||||
finalcut::FString& doubleToString (std::list<double>::const_iterator iter);
|
FString& doubleToString (std::list<double>::const_iterator iter);
|
||||||
finalcut::FString& mapToString ( std::map<finalcut::FString
|
FString& mapToString ( std::map<FString
|
||||||
, finalcut::FString>::const_iterator iter );
|
, FString>::const_iterator iter );
|
||||||
|
|
||||||
|
|
||||||
// Lazy conversion import function
|
// Lazy conversion import function
|
||||||
void doubleToItem ( finalcut::FListBoxItem& item
|
void doubleToItem ( FListBoxItem& item
|
||||||
, finalcut::FWidget::data_ptr container, int index)
|
, FWidget::data_ptr container, int index)
|
||||||
{
|
{
|
||||||
typedef std::list<double>* double_list_ptr;
|
typedef std::list<double>* double_list_ptr;
|
||||||
double_list_ptr dbllist = static_cast<double_list_ptr>(container);
|
double_list_ptr dbllist = static_cast<double_list_ptr>(container);
|
||||||
std::list<double>::iterator iter = dbllist->begin();
|
std::list<double>::iterator iter = dbllist->begin();
|
||||||
std::advance (iter, index);
|
std::advance (iter, index);
|
||||||
item.setText (finalcut::FString() << *iter);
|
item.setText (FString() << *iter);
|
||||||
item.setData (finalcut::FWidget::data_ptr(&(*iter)));
|
item.setData (FWidget::data_ptr(&(*iter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import converter functions
|
// Import converter functions
|
||||||
finalcut::FString& doubleToString (std::list<double>::const_iterator iter)
|
FString& doubleToString (std::list<double>::const_iterator iter)
|
||||||
{
|
{
|
||||||
return temp_str->setNumber(*iter);
|
return temp_str->setNumber(*iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FString& mapToString ( std::map<finalcut::FString
|
FString& mapToString ( std::map<FString
|
||||||
, finalcut::FString>::const_iterator iter )
|
, FString>::const_iterator iter )
|
||||||
{
|
{
|
||||||
return *temp_str = iter->first + ": " + iter->second;
|
return *temp_str = iter->first + ": " + iter->second;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +74,7 @@ finalcut::FString& mapToString ( std::map<finalcut::FString
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
class Listbox : public finalcut::FDialog
|
class Listbox : public FDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -90,22 +91,22 @@ class Listbox : public finalcut::FDialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Event handlers
|
// Event handlers
|
||||||
virtual void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (FCloseEvent*);
|
||||||
|
|
||||||
// Data Member
|
// Data Member
|
||||||
std::list<double> double_list{};
|
std::list<double> double_list{};
|
||||||
finalcut::FListBox list1{this};
|
FListBox list1{this};
|
||||||
finalcut::FListBox list2{this};
|
FListBox list2{this};
|
||||||
finalcut::FListBox list3{this};
|
FListBox list3{this};
|
||||||
finalcut::FButton Quit{this};
|
FButton Quit{this};
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Listbox::Listbox (finalcut::FWidget* parent)
|
Listbox::Listbox (FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: FDialog(parent)
|
||||||
{
|
{
|
||||||
temp_str = std::make_shared<finalcut::FString>();
|
temp_str = std::make_shared<FString>();
|
||||||
|
|
||||||
// listbox 1
|
// listbox 1
|
||||||
//----------
|
//----------
|
||||||
|
@ -113,7 +114,7 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
list1.setText ("FListBoxItem");
|
list1.setText ("FListBoxItem");
|
||||||
|
|
||||||
for (int i = 1; i < 30; i++)
|
for (int i = 1; i < 30; i++)
|
||||||
list1.insert (L"----- " + (finalcut::FString() << i) + L" -----");
|
list1.insert (L"----- " + (FString() << i) + L" -----");
|
||||||
|
|
||||||
// listbox 2
|
// listbox 2
|
||||||
//----------
|
//----------
|
||||||
|
@ -135,7 +136,7 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
|
|
||||||
// listbox 3
|
// listbox 3
|
||||||
//----------
|
//----------
|
||||||
std::map<finalcut::FString, finalcut::FString> TLD;
|
std::map<FString, FString> TLD;
|
||||||
TLD["com"] = "Commercial";
|
TLD["com"] = "Commercial";
|
||||||
TLD["org"] = "Organization";
|
TLD["org"] = "Organization";
|
||||||
TLD["net"] = "Network";
|
TLD["net"] = "Network";
|
||||||
|
@ -154,7 +155,7 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
Quit.addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,9 +164,9 @@ Listbox::~Listbox() // destructor
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listbox::onClose (finalcut::FCloseEvent* ev)
|
void Listbox::onClose (FCloseEvent* ev)
|
||||||
{
|
{
|
||||||
finalcut::FApplication::closeConfirmationDialog (this, ev);
|
FApplication::closeConfirmationDialog (this, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ void Listbox::onClose (finalcut::FCloseEvent* ev)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
FApplication app(argc, argv);
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Listbox d(&app);
|
Listbox d(&app);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void Listview::populate()
|
||||||
{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }
|
{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
||||||
|
|
||||||
for (int i = 0; i <= lastItem; i++)
|
for (int i = 0; i <= lastItem; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -774,8 +774,8 @@ void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
|
void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
const char libver[] = F_VERSION;
|
constexpr char libver[] = F_VERSION;
|
||||||
finalcut::FString line(2, finalcut::fc::BoxDrawingsHorizontal);
|
const finalcut::FString line(2, finalcut::fc::BoxDrawingsHorizontal);
|
||||||
|
|
||||||
finalcut::FMessageBox info ( "About"
|
finalcut::FMessageBox info ( "About"
|
||||||
, line + L" The Final Cut " + line + "\n\n"
|
, line + L" The Final Cut " + line + "\n\n"
|
||||||
|
@ -999,8 +999,8 @@ void MyDialog::cb_setInput (finalcut::FWidget* widget, data_ptr data)
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
finalcut::FString ver = F_VERSION; // Library version
|
const finalcut::FString ver = F_VERSION; // Library version
|
||||||
finalcut::FString title = "The FINAL CUT "
|
const finalcut::FString title = "The FINAL CUT "
|
||||||
+ ver
|
+ ver
|
||||||
+ " (C) 2018 by Markus Gans";
|
+ " (C) 2018 by Markus Gans";
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,10 @@ FApplication::FApplication ( const int& _argc
|
||||||
, app_argc{_argc}
|
, app_argc{_argc}
|
||||||
, app_argv{_argv}
|
, app_argv{_argv}
|
||||||
{
|
{
|
||||||
assert ( ! app_object
|
if ( app_object )
|
||||||
&& "FApplication: There should be only one application object" );
|
throw std::runtime_error( "FApplication: There should be "
|
||||||
|
"only one application object" );
|
||||||
|
|
||||||
app_object = this;
|
app_object = this;
|
||||||
|
|
||||||
if ( ! (_argc && _argv) )
|
if ( ! (_argc && _argv) )
|
||||||
|
@ -773,7 +775,7 @@ FWidget*& FApplication::determineClickedWidget()
|
||||||
&& ! mouse->isWheelDown() )
|
&& ! mouse->isWheelDown() )
|
||||||
return clicked;
|
return clicked;
|
||||||
|
|
||||||
const FPoint& mouse_position = mouse->getPos();
|
const auto& mouse_position = mouse->getPos();
|
||||||
|
|
||||||
// Determine the window object on the current click position
|
// Determine the window object on the current click position
|
||||||
auto window = FWindow::getWindowWidgetAt (mouse_position);
|
auto window = FWindow::getWindowWidgetAt (mouse_position);
|
||||||
|
@ -817,7 +819,7 @@ void FApplication::closeOpenMenu()
|
||||||
|
|
||||||
if ( mouse )
|
if ( mouse )
|
||||||
{
|
{
|
||||||
const FPoint& mouse_position = mouse->getPos();
|
const auto& mouse_position = mouse->getPos();
|
||||||
|
|
||||||
if ( menu->containsMenuStructure(mouse_position) )
|
if ( menu->containsMenuStructure(mouse_position) )
|
||||||
return;
|
return;
|
||||||
|
@ -867,7 +869,7 @@ void FApplication::unselectMenubarItems()
|
||||||
if ( ! mouse )
|
if ( ! mouse )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FPoint& mouse_position = mouse->getPos();
|
const auto& mouse_position = mouse->getPos();
|
||||||
|
|
||||||
if ( ! menu_bar->getTermGeometry().contains(mouse_position) )
|
if ( ! menu_bar->getTermGeometry().contains(mouse_position) )
|
||||||
{
|
{
|
||||||
|
@ -900,8 +902,7 @@ void FApplication::sendMouseEvent()
|
||||||
if ( ! mouse )
|
if ( ! mouse )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FPoint widgetMousePos;
|
const auto& mouse_position = mouse->getPos();
|
||||||
const FPoint& mouse_position = mouse->getPos();
|
|
||||||
int key_state = 0;
|
int key_state = 0;
|
||||||
|
|
||||||
if ( mouse->isShiftKeyPressed() )
|
if ( mouse->isShiftKeyPressed() )
|
||||||
|
@ -913,7 +914,7 @@ void FApplication::sendMouseEvent()
|
||||||
if ( mouse->isMetaKeyPressed() )
|
if ( mouse->isMetaKeyPressed() )
|
||||||
key_state |= fc::MetaButton;
|
key_state |= fc::MetaButton;
|
||||||
|
|
||||||
widgetMousePos = clicked->termToWidgetPos(mouse_position);
|
auto widgetMousePos = clicked->termToWidgetPos(mouse_position);
|
||||||
|
|
||||||
if ( mouse->isMoved() )
|
if ( mouse->isMoved() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,8 +149,8 @@ bool FButton::setFocus (bool enable)
|
||||||
{
|
{
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
getStatusBar()->setMessage(msg);
|
getStatusBar()->setMessage(msg);
|
||||||
|
@ -747,8 +747,8 @@ void FButton::updateStatusBar()
|
||||||
if ( ! flags.focus || ! getStatusBar() )
|
if ( ! flags.focus || ! getStatusBar() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,7 +194,7 @@ void FDialog::setPos (int x, int y, bool)
|
||||||
, dy = getY() - y
|
, dy = getY() - y
|
||||||
, old_x = getTermX()
|
, old_x = getTermX()
|
||||||
, old_y = getTermY();
|
, old_y = getTermY();
|
||||||
const FPoint& shadow = getShadow();
|
const auto& shadow = getShadow();
|
||||||
rsw = shadow.getX(); // right shadow width;
|
rsw = shadow.getX(); // right shadow width;
|
||||||
bsh = shadow.getY(); // bottom shadow height
|
bsh = shadow.getY(); // bottom shadow height
|
||||||
old_geometry = getTermGeometryWithShadow();
|
old_geometry = getTermGeometryWithShadow();
|
||||||
|
@ -304,7 +304,7 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||||
, old_height = int(getHeight())
|
, old_height = int(getHeight())
|
||||||
, dw = old_width - int(w)
|
, dw = old_width - int(w)
|
||||||
, dh = old_height - int(h);
|
, dh = old_height - int(h);
|
||||||
const FPoint& shadow = getShadow();
|
const auto& shadow = getShadow();
|
||||||
int rsw = shadow.getX(); // right shadow width;
|
int rsw = shadow.getX(); // right shadow width;
|
||||||
int bsh = shadow.getY(); // bottom shadow height
|
int bsh = shadow.getY(); // bottom shadow height
|
||||||
|
|
||||||
|
@ -1357,7 +1357,7 @@ void FDialog::pressZoomButton (mouseStates& ms)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
||||||
{
|
{
|
||||||
const FRect& menu_geometry = dialog_menu->getTermGeometry();
|
const auto& menu_geometry = dialog_menu->getTermGeometry();
|
||||||
|
|
||||||
if ( dialog_menu->getCount() > 0 && menu_geometry.contains(termpos) )
|
if ( dialog_menu->getCount() > 0 && menu_geometry.contains(termpos) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -1375,8 +1375,8 @@ inline void FDialog::passEventToSubMenu ( mouseStates& ms
|
||||||
|| ! dialog_menu->isShown() )
|
|| ! dialog_menu->isShown() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FPoint& g = ms.termPos;
|
const auto& g = ms.termPos;
|
||||||
const FPoint& p = dialog_menu->termToWidgetPos(g);
|
const auto& p = dialog_menu->termToWidgetPos(g);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -330,8 +330,8 @@ void FFileDialog::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::init()
|
void FFileDialog::init()
|
||||||
{
|
{
|
||||||
static const std::size_t w = 42;
|
static constexpr std::size_t w = 42;
|
||||||
static const std::size_t h = 15;
|
static constexpr std::size_t h = 15;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
setGeometry(1, 1, w, h, false);
|
setGeometry(1, 1, w, h, false);
|
||||||
|
@ -725,7 +725,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::printPath (const FString& txt)
|
void FFileDialog::printPath (const FString& txt)
|
||||||
{
|
{
|
||||||
const FString& path = txt;
|
const auto& path = txt;
|
||||||
const uInt max_width = uInt(filebrowser.getWidth()) - 4;
|
const uInt max_width = uInt(filebrowser.getWidth()) - 4;
|
||||||
|
|
||||||
if ( path.getLength() > max_width )
|
if ( path.getLength() > max_width )
|
||||||
|
@ -775,7 +775,7 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
|
|
||||||
if ( ! dir_entries.empty() )
|
if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
const FString& input = filename.getText().trim();
|
const auto& input = filename.getText().trim();
|
||||||
|
|
||||||
for (auto&& entry : dir_entries)
|
for (auto&& entry : dir_entries)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +803,7 @@ void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||||
if ( n == 0 )
|
if ( n == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FString& name = dir_entries[n - 1].name;
|
const auto& name = dir_entries[n - 1].name;
|
||||||
|
|
||||||
if ( dir_entries[n - 1].directory )
|
if ( dir_entries[n - 1].directory )
|
||||||
filename.setText( name + '/' );
|
filename.setText( name + '/' );
|
||||||
|
|
|
@ -354,7 +354,7 @@ bool FKeyboard::isKeypressTimeout()
|
||||||
FKey FKeyboard::UTF8decode (const char utf8[])
|
FKey FKeyboard::UTF8decode (const char utf8[])
|
||||||
{
|
{
|
||||||
FKey ucs = 0; // Universal coded character
|
FKey ucs = 0; // Universal coded character
|
||||||
const std::size_t max = 4;
|
constexpr std::size_t max = 4;
|
||||||
std::size_t len = std::strlen(utf8);
|
std::size_t len = std::strlen(utf8);
|
||||||
|
|
||||||
if ( len > max )
|
if ( len > max )
|
||||||
|
|
|
@ -272,8 +272,8 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
||||||
if ( auto parent = getParentWidget() )
|
if ( auto parent = getParentWidget() )
|
||||||
{
|
{
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
const FPoint& tp = ev->getTermPos();
|
const auto& tp = ev->getTermPos();
|
||||||
const FPoint& p = parent->termToWidgetPos(tp);
|
const auto& p = parent->termToWidgetPos(tp);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,8 +199,8 @@ bool FLineEdit::setFocus (bool enable)
|
||||||
|
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
getStatusBar()->setMessage(msg);
|
getStatusBar()->setMessage(msg);
|
||||||
|
@ -690,8 +690,8 @@ void FLineEdit::draw()
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,8 +188,8 @@ bool FListBox::setFocus (bool enable)
|
||||||
{
|
{
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
getStatusBar()->setMessage(msg);
|
getStatusBar()->setMessage(msg);
|
||||||
|
@ -894,8 +894,8 @@ void FListBox::draw()
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
@ -1510,7 +1510,7 @@ void FListBox::nextListItem (int distance)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::scrollToX (int val)
|
void FListBox::scrollToX (int val)
|
||||||
{
|
{
|
||||||
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
static constexpr std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||||
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||||
|
|
||||||
if ( xoffset == val )
|
if ( xoffset == val )
|
||||||
|
@ -1567,7 +1567,7 @@ void FListBox::scrollLeft (int distance)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::scrollRight (int distance)
|
void FListBox::scrollRight (int distance)
|
||||||
{
|
{
|
||||||
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
static constexpr std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||||
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||||
xoffset += distance;
|
xoffset += distance;
|
||||||
|
|
||||||
|
@ -1915,7 +1915,7 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::cb_HBarChange (FWidget*, data_ptr)
|
void FListBox::cb_HBarChange (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
|
||||||
FScrollbar::sType scrollType;
|
FScrollbar::sType scrollType;
|
||||||
int distance = 1
|
int distance = 1
|
||||||
, pagesize = 4
|
, pagesize = 4
|
||||||
|
|
|
@ -1505,8 +1505,8 @@ void FListView::draw()
|
||||||
|
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
@ -1535,7 +1535,7 @@ void FListView::drawHeadlines()
|
||||||
|
|
||||||
while ( iter != header.end() )
|
while ( iter != header.end() )
|
||||||
{
|
{
|
||||||
const FString& text = iter->name;
|
const auto& text = iter->name;
|
||||||
|
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -1632,11 +1632,11 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
{
|
{
|
||||||
for (std::size_t col = 0; col < item->column_list.size(); )
|
for (std::size_t col = 0; col < item->column_list.size(); )
|
||||||
{
|
{
|
||||||
static const std::size_t leading_space = 1;
|
static constexpr std::size_t leading_space = 1;
|
||||||
static const std::size_t checkbox_space = 4;
|
static constexpr std::size_t checkbox_space = 4;
|
||||||
static const std::size_t ellipsis_length = 2;
|
static constexpr std::size_t ellipsis_length = 2;
|
||||||
|
|
||||||
const FString& text = item->column_list[col];
|
const auto& text = item->column_list[col];
|
||||||
std::size_t width = std::size_t(header[col].width);
|
std::size_t width = std::size_t(header[col].width);
|
||||||
std::size_t txt_length = text.getLength();
|
std::size_t txt_length = text.getLength();
|
||||||
// Increment the value of i for the column position
|
// Increment the value of i for the column position
|
||||||
|
@ -1819,8 +1819,8 @@ inline void FListView::drawHeaderBorder (std::size_t length)
|
||||||
void FListView::drawHeadlineLabel (headerItems::const_iterator& iter)
|
void FListView::drawHeadlineLabel (headerItems::const_iterator& iter)
|
||||||
{
|
{
|
||||||
// Print lable text
|
// Print lable text
|
||||||
static const std::size_t leading_space = 1;
|
static constexpr std::size_t leading_space = 1;
|
||||||
const FString& text = iter->name;
|
const auto& text = iter->name;
|
||||||
FString txt = " " + text;
|
FString txt = " " + text;
|
||||||
std::size_t width = std::size_t(iter->width);
|
std::size_t width = std::size_t(iter->width);
|
||||||
std::size_t txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
|
@ -1867,7 +1867,7 @@ void FListView::drawColumnEllipsis ( headerItems::const_iterator& iter
|
||||||
, const FString& text )
|
, const FString& text )
|
||||||
{
|
{
|
||||||
// Print lable ellipsis
|
// Print lable ellipsis
|
||||||
static const int ellipsis_length = 2;
|
static constexpr int ellipsis_length = 2;
|
||||||
int width = iter->width;
|
int width = iter->width;
|
||||||
|
|
||||||
headerline << ' ';
|
headerline << ' ';
|
||||||
|
@ -1902,7 +1902,7 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::size_t FListView::determineLineWidth (FListViewItem* item)
|
std::size_t FListView::determineLineWidth (FListViewItem* item)
|
||||||
{
|
{
|
||||||
static const std::size_t padding_space = 1;
|
static constexpr std::size_t padding_space = 1;
|
||||||
std::size_t line_width = padding_space; // leading space
|
std::size_t line_width = padding_space; // leading space
|
||||||
uInt column_idx = 0;
|
uInt column_idx = 0;
|
||||||
uInt entries = uInt(item->column_list.size());
|
uInt entries = uInt(item->column_list.size());
|
||||||
|
@ -2007,7 +2007,7 @@ void FListView::mouseHeaderClicked()
|
||||||
|
|
||||||
while ( iter != header.end() )
|
while ( iter != header.end() )
|
||||||
{
|
{
|
||||||
static const int leading_space = 1;
|
static constexpr int leading_space = 1;
|
||||||
bool has_sort_indicator = bool( column == sort_column );
|
bool has_sort_indicator = bool( column == sort_column );
|
||||||
int click_width = int(iter->name.getLength());
|
int click_width = int(iter->name.getLength());
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void FMenu::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
const FRect& t_geometry = getTermGeometryWithShadow();
|
const auto& t_geometry = getTermGeometryWithShadow();
|
||||||
restoreVTerm (t_geometry);
|
restoreVTerm (t_geometry);
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
|
@ -392,7 +392,7 @@ bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
|
||||||
{
|
{
|
||||||
if ( opened_sub_menu )
|
if ( opened_sub_menu )
|
||||||
{
|
{
|
||||||
const FRect& submenu_geometry = opened_sub_menu->getTermGeometry();
|
const auto& submenu_geometry = opened_sub_menu->getTermGeometry();
|
||||||
|
|
||||||
if ( submenu_geometry.contains(termpos) )
|
if ( submenu_geometry.contains(termpos) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -404,7 +404,7 @@ bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::isMouseOverSuperMenu (const FPoint& termpos)
|
bool FMenu::isMouseOverSuperMenu (const FPoint& termpos)
|
||||||
{
|
{
|
||||||
auto smenu = superMenuAt (termpos);
|
const auto smenu = superMenuAt (termpos);
|
||||||
|
|
||||||
if ( smenu )
|
if ( smenu )
|
||||||
return true;
|
return true;
|
||||||
|
@ -893,8 +893,8 @@ void FMenu::mouseMoveOverBorder (mouseStates& ms)
|
||||||
|
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
@ -912,8 +912,8 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev)
|
||||||
{
|
{
|
||||||
// Mouse event handover to sub-menu
|
// Mouse event handover to sub-menu
|
||||||
|
|
||||||
const FPoint& t = ev->getTermPos();
|
const auto& t = ev->getTermPos();
|
||||||
const FPoint& p = opened_sub_menu->termToWidgetPos(t);
|
const auto& p = opened_sub_menu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -936,8 +936,8 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev)
|
||||||
// Mouse event handover to super-menu
|
// Mouse event handover to super-menu
|
||||||
|
|
||||||
const auto& smenu = superMenuAt (ev->getTermPos());
|
const auto& smenu = superMenuAt (ev->getTermPos());
|
||||||
const FPoint& t = ev->getTermPos();
|
const auto& t = ev->getTermPos();
|
||||||
const FPoint& p = smenu->termToWidgetPos(t);
|
const auto& p = smenu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -960,8 +960,8 @@ void FMenu::passEventToMenuBar (FMouseEvent*& ev)
|
||||||
// Mouse event handover to the menu bar
|
// Mouse event handover to the menu bar
|
||||||
|
|
||||||
const auto& menu_bar = getMenuBar();
|
const auto& menu_bar = getMenuBar();
|
||||||
const FPoint& t = ev->getTermPos();
|
const auto& t = ev->getTermPos();
|
||||||
const FPoint& p = menu_bar->termToWidgetPos(t);
|
const auto& p = menu_bar->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -982,8 +982,8 @@ void FMenuBar::passEventToMenu (FMouseEvent*& ev)
|
||||||
if ( menu->getCount() > 0
|
if ( menu->getCount() > 0
|
||||||
&& menu_geometry.contains(ev->getTermPos()) )
|
&& menu_geometry.contains(ev->getTermPos()) )
|
||||||
{
|
{
|
||||||
const FPoint& t = ev->getTermPos();
|
const auto& t = ev->getTermPos();
|
||||||
const FPoint& p = menu->termToWidgetPos(t);
|
const auto& p = menu->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -147,8 +147,8 @@ bool FMenuItem::setFocus (bool enable)
|
||||||
|
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
getStatusBar()->setMessage(msg);
|
getStatusBar()->setMessage(msg);
|
||||||
|
@ -633,7 +633,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
FMenuItem* win_item;
|
FMenuItem* win_item;
|
||||||
uInt32 n = uInt32(std::distance(first, iter));
|
uInt32 n = uInt32(std::distance(first, iter));
|
||||||
// get the dialog title
|
// get the dialog title
|
||||||
const FString& name = win->getText();
|
const auto& name = win->getText();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -680,8 +680,8 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
||||||
if ( ! widget )
|
if ( ! widget )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FPoint& t = ev->getTermPos();
|
const auto& t = ev->getTermPos();
|
||||||
const FPoint& p2 = widget->termToWidgetPos(t);
|
const auto& p2 = widget->termToWidgetPos(t);
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
std::shared_ptr<FMouseEvent> _ev;
|
std::shared_ptr<FMouseEvent> _ev;
|
||||||
|
|
||||||
|
|
|
@ -160,61 +160,6 @@ void FMessageBox::setText (const FString& txt)
|
||||||
adjustButtons();
|
adjustButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
int FMessageBox::info ( FWidget* parent
|
|
||||||
, const FString& caption
|
|
||||||
, const FString& message
|
|
||||||
, int button0
|
|
||||||
, int button1
|
|
||||||
, int button2 )
|
|
||||||
{
|
|
||||||
int reply;
|
|
||||||
FMessageBox mbox ( caption, message
|
|
||||||
, button0, button1, button2
|
|
||||||
, parent );
|
|
||||||
reply = mbox.exec();
|
|
||||||
return reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
int FMessageBox::info ( FWidget* parent
|
|
||||||
, const FString& caption
|
|
||||||
, int num
|
|
||||||
, int button0
|
|
||||||
, int button1
|
|
||||||
, int button2 )
|
|
||||||
{
|
|
||||||
int reply;
|
|
||||||
FMessageBox mbox ( caption
|
|
||||||
, FString() << num
|
|
||||||
, button0, button1, button2
|
|
||||||
, parent );
|
|
||||||
reply = mbox.exec();
|
|
||||||
return reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
int FMessageBox::error ( FWidget* parent
|
|
||||||
, const FString& message
|
|
||||||
, int button0
|
|
||||||
, int button1
|
|
||||||
, int button2 )
|
|
||||||
{
|
|
||||||
int reply;
|
|
||||||
const FString& caption = "Error message";
|
|
||||||
FMessageBox mbox ( caption, message
|
|
||||||
, button0, button1, button2
|
|
||||||
, parent );
|
|
||||||
mbox.beep();
|
|
||||||
mbox.setHeadline("Warning:");
|
|
||||||
mbox.setCenterText();
|
|
||||||
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
|
||||||
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
|
||||||
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
|
||||||
reply = mbox.exec();
|
|
||||||
return reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// protected methods of FMessageBox
|
// protected methods of FMessageBox
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -471,7 +416,7 @@ void FMessageBox::resizeButtons()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::adjustButtons()
|
void FMessageBox::adjustButtons()
|
||||||
{
|
{
|
||||||
static const std::size_t gap = 4;
|
static constexpr std::size_t gap = 4;
|
||||||
std::size_t btn_width = 0;
|
std::size_t btn_width = 0;
|
||||||
|
|
||||||
for (std::size_t n = 0; n < num_buttons; n++)
|
for (std::size_t n = 0; n < num_buttons; n++)
|
||||||
|
|
|
@ -497,7 +497,7 @@ void FMouseX11::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
{
|
{
|
||||||
// Import the X11 xterm mouse protocol (SGR-Mode) raw mouse data
|
// Import the X11 xterm mouse protocol (SGR-Mode) raw mouse data
|
||||||
|
|
||||||
static const std::size_t len = 6;
|
static constexpr std::size_t len = 6;
|
||||||
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
||||||
std::size_t n;
|
std::size_t n;
|
||||||
x11_mouse[0] = fifo_buf[3];
|
x11_mouse[0] = fifo_buf[3];
|
||||||
|
@ -523,7 +523,7 @@ void FMouseX11::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
// Parse and interpret the X11 xterm mouse string
|
// Parse and interpret the X11 xterm mouse string
|
||||||
|
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
uChar x, y;
|
uChar x, y;
|
||||||
int btn;
|
int btn;
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
// Get the x11 mouse button state
|
// Get the x11 mouse button state
|
||||||
|
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
|
|
||||||
switch ( btn )
|
switch ( btn )
|
||||||
{
|
{
|
||||||
|
@ -713,7 +713,7 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseSGR::processEvent (struct timeval* time)
|
void FMouseSGR::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
char* p;
|
char* p;
|
||||||
int btn;
|
int btn;
|
||||||
short x, y;
|
short x, y;
|
||||||
|
@ -821,7 +821,7 @@ void FMouseSGR::setPressedButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
// Gets the extended x11 mouse mode (SGR) status for pressed buttons
|
// Gets the extended x11 mouse mode (SGR) status for pressed buttons
|
||||||
|
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
|
|
||||||
switch ( btn )
|
switch ( btn )
|
||||||
{
|
{
|
||||||
|
@ -954,7 +954,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
// Parse and interpret the X11 xterm mouse string (Urxvt-Mode)
|
// Parse and interpret the X11 xterm mouse string (Urxvt-Mode)
|
||||||
|
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
char* p;
|
char* p;
|
||||||
bool x_neg;
|
bool x_neg;
|
||||||
bool y_neg;
|
bool y_neg;
|
||||||
|
@ -1088,7 +1088,7 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
|
||||||
{
|
{
|
||||||
// Get the urxvt mouse button state
|
// Get the urxvt mouse button state
|
||||||
|
|
||||||
const FPoint& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
|
|
||||||
switch ( btn )
|
switch ( btn )
|
||||||
{
|
{
|
||||||
|
|
|
@ -537,7 +537,7 @@ void FOptiMove::calculateCharDuration()
|
||||||
{
|
{
|
||||||
if ( baudrate != 0 )
|
if ( baudrate != 0 )
|
||||||
{
|
{
|
||||||
static const int baudbyte = 9; // = 7 bit + 1 parity + 1 stop
|
static constexpr int baudbyte = 9; // = 7 bit + 1 parity + 1 stop
|
||||||
char_duration = (baudbyte * 1000 * 10)
|
char_duration = (baudbyte * 1000 * 10)
|
||||||
/ (baudrate > 0 ? baudrate : 9600); // milliseconds
|
/ (baudrate > 0 ? baudrate : 9600); // milliseconds
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,7 @@ std::size_t FString::getUTF8length() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::sprintf (const FString format, ...)
|
FString& FString::sprintf (const FString format, ...)
|
||||||
{
|
{
|
||||||
static const int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE];
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ bool FTerm::setOldFont()
|
||||||
if ( isXTerminal() || isScreenTerm()
|
if ( isXTerminal() || isScreenTerm()
|
||||||
|| isUrxvtTerminal() || FTermcap::osc_support )
|
|| isUrxvtTerminal() || FTermcap::osc_support )
|
||||||
{
|
{
|
||||||
const FString& font = data->getXtermFont();
|
const auto& font = data->getXtermFont();
|
||||||
|
|
||||||
if ( font.getLength() > 2 )
|
if ( font.getLength() > 2 )
|
||||||
{
|
{
|
||||||
|
@ -418,7 +418,7 @@ char* FTerm::enableCursor()
|
||||||
{
|
{
|
||||||
// Returns the cursor enable string
|
// Returns the cursor enable string
|
||||||
|
|
||||||
static const std::size_t SIZE = 32;
|
static constexpr std::size_t SIZE = 32;
|
||||||
static char enable_str[SIZE] = { };
|
static char enable_str[SIZE] = { };
|
||||||
const auto& vs = TCAP(fc::t_cursor_visible);
|
const auto& vs = TCAP(fc::t_cursor_visible);
|
||||||
const auto& ve = TCAP(fc::t_cursor_normal);
|
const auto& ve = TCAP(fc::t_cursor_normal);
|
||||||
|
@ -1405,8 +1405,8 @@ void FTerm::init_captureFontAndTitle()
|
||||||
// Save the used xterm font and window title
|
// Save the used xterm font and window title
|
||||||
|
|
||||||
xterm->captureFontAndTitle();
|
xterm->captureFontAndTitle();
|
||||||
const FString* font = xterm->getFont();
|
const auto font = xterm->getFont();
|
||||||
const FString* title = xterm->getTitle();
|
const auto title = xterm->getTitle();
|
||||||
|
|
||||||
if ( font )
|
if ( font )
|
||||||
data->setXtermFont(*font);
|
data->setXtermFont(*font);
|
||||||
|
@ -1904,7 +1904,7 @@ void FTerm::finish()
|
||||||
{
|
{
|
||||||
// Set default signal handler
|
// Set default signal handler
|
||||||
|
|
||||||
const FString& title = data->getXtermTitle();
|
const auto& title = data->getXtermTitle();
|
||||||
resetSignalHandler();
|
resetSignalHandler();
|
||||||
|
|
||||||
if ( title && isXTerminal() && ! isRxvtTerminal() )
|
if ( title && isXTerminal() && ! isRxvtTerminal() )
|
||||||
|
|
|
@ -38,7 +38,7 @@ FTermBuffer::~FTermBuffer() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FTermBuffer::writef (const FString format, ...)
|
int FTermBuffer::writef (const FString format, ...)
|
||||||
{
|
{
|
||||||
static const int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE];
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ void FTermcap::init()
|
||||||
void FTermcap::termcap()
|
void FTermcap::termcap()
|
||||||
{
|
{
|
||||||
std::vector<std::string> terminals;
|
std::vector<std::string> terminals;
|
||||||
static const int success = 1;
|
static constexpr int success = 1;
|
||||||
static const int uninitialized = -2;
|
static constexpr int uninitialized = -2;
|
||||||
static char term_buffer[2048];
|
static char term_buffer[2048];
|
||||||
static char string_buf[2048];
|
static char string_buf[2048];
|
||||||
char* buffer = string_buf;
|
char* buffer = string_buf;
|
||||||
|
@ -128,9 +128,9 @@ void FTermcap::termcap()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcap::termcapError (int status)
|
void FTermcap::termcapError (int status)
|
||||||
{
|
{
|
||||||
static const int no_entry = 0;
|
static constexpr int no_entry = 0;
|
||||||
static const int db_not_found = -1;
|
static constexpr int db_not_found = -1;
|
||||||
static const int uninitialized = -2;
|
static constexpr int uninitialized = -2;
|
||||||
|
|
||||||
if ( status == no_entry || status == uninitialized )
|
if ( status == no_entry || status == uninitialized )
|
||||||
{
|
{
|
||||||
|
|
|
@ -503,7 +503,7 @@ void FTermcapQuirks::screen()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirks::general()
|
void FTermcapQuirks::general()
|
||||||
{
|
{
|
||||||
static const int not_available = -1;
|
static constexpr int not_available = -1;
|
||||||
|
|
||||||
if ( FTermcap::tabstop == not_available )
|
if ( FTermcap::tabstop == not_available )
|
||||||
FTermcap::tabstop = 8;
|
FTermcap::tabstop = 8;
|
||||||
|
|
|
@ -144,7 +144,7 @@ bool FTermFreeBSD::saveFreeBSDAltKey()
|
||||||
{
|
{
|
||||||
// Saving the current mapping for the alt key
|
// Saving the current mapping for the alt key
|
||||||
|
|
||||||
static const int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret;
|
int ret;
|
||||||
keymap_t keymap;
|
keymap_t keymap;
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
||||||
{
|
{
|
||||||
// Remapping the alt key
|
// Remapping the alt key
|
||||||
|
|
||||||
static const int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret;
|
int ret;
|
||||||
keymap_t keymap;
|
keymap_t keymap;
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,7 @@ int FTermLinux::getFramebuffer_bpp()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::getScreenFont()
|
bool FTermLinux::getScreenFont()
|
||||||
{
|
{
|
||||||
static const std::size_t data_size = 4 * 32 * 512;
|
static constexpr std::size_t data_size = 4 * 32 * 512;
|
||||||
struct console_font_op font;
|
struct console_font_op font;
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ inline uInt16 FTermLinux::getInputStatusRegisterOne()
|
||||||
// Gets the VGA input-status-register-1
|
// Gets the VGA input-status-register-1
|
||||||
|
|
||||||
// Miscellaneous output (read port)
|
// Miscellaneous output (read port)
|
||||||
static const uInt16 misc_read = 0x3cc;
|
static constexpr uInt16 misc_read = 0x3cc;
|
||||||
const uInt16 io_base = ( inb(misc_read) & 0x01 ) ? 0x3d0 : 0x3b0;
|
const uInt16 io_base = ( inb(misc_read) & 0x01 ) ? 0x3d0 : 0x3b0;
|
||||||
// 0x3ba : Input status 1 MDA (read port)
|
// 0x3ba : Input status 1 MDA (read port)
|
||||||
// 0x3da : Input status 1 CGA (read port)
|
// 0x3da : Input status 1 CGA (read port)
|
||||||
|
@ -751,9 +751,9 @@ uChar FTermLinux::readAttributeController (uChar index)
|
||||||
|
|
||||||
uChar res;
|
uChar res;
|
||||||
// Attribute controller (write port)
|
// Attribute controller (write port)
|
||||||
static const uInt16 attrib_cntlr_write = 0x3c0;
|
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||||
// Attribute controller (read port)
|
// Attribute controller (read port)
|
||||||
static const uInt16 attrib_cntlr_read = 0x3c1;
|
static constexpr uInt16 attrib_cntlr_read = 0x3c1;
|
||||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||||
|
|
||||||
inb (input_status_1); // switch to index mode
|
inb (input_status_1); // switch to index mode
|
||||||
|
@ -773,7 +773,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
||||||
// Writes a byte from the attribute controller from a given index
|
// Writes a byte from the attribute controller from a given index
|
||||||
|
|
||||||
// Attribute controller (write port)
|
// Attribute controller (write port)
|
||||||
static const uInt16 attrib_cntlr_write = 0x3c0;
|
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||||
|
|
||||||
inb (input_status_1); // switch to index mode
|
inb (input_status_1); // switch to index mode
|
||||||
|
@ -790,7 +790,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
||||||
inline uChar FTermLinux::getAttributeMode()
|
inline uChar FTermLinux::getAttributeMode()
|
||||||
{
|
{
|
||||||
// Gets the attribute mode value from the vga attribute controller
|
// Gets the attribute mode value from the vga attribute controller
|
||||||
static const uChar attrib_mode = 0x10;
|
static constexpr uChar attrib_mode = 0x10;
|
||||||
return readAttributeController(attrib_mode);
|
return readAttributeController(attrib_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ inline uChar FTermLinux::getAttributeMode()
|
||||||
inline void FTermLinux::setAttributeMode (uChar data)
|
inline void FTermLinux::setAttributeMode (uChar data)
|
||||||
{
|
{
|
||||||
// Sets the attribute mode value from the vga attribute controller
|
// Sets the attribute mode value from the vga attribute controller
|
||||||
static const uChar attrib_mode = 0x10;
|
static constexpr uChar attrib_mode = 0x10;
|
||||||
writeAttributeController (attrib_mode, data);
|
writeAttributeController (attrib_mode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermOpenBSD::setBSDConsoleMetaEsc()
|
bool FTermOpenBSD::setBSDConsoleMetaEsc()
|
||||||
{
|
{
|
||||||
static const kbd_t meta_esc = 0x20; // generate ESC prefix on ALT-key
|
static constexpr kbd_t meta_esc = 0x20; // generate ESC prefix on ALT-key
|
||||||
|
|
||||||
return setBSDConsoleEncoding (bsd_keyboard_encoding | meta_esc);
|
return setBSDConsoleEncoding (bsd_keyboard_encoding | meta_esc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,8 +414,8 @@ void FTextView::onMouseDown (FMouseEvent* ev)
|
||||||
&& ! dialog->isZoomed() )
|
&& ! dialog->isZoomed() )
|
||||||
{
|
{
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
const FPoint& tp = ev->getTermPos();
|
const auto& tp = ev->getTermPos();
|
||||||
const FPoint& p = parent->termToWidgetPos(tp);
|
const auto& p = parent->termToWidgetPos(tp);
|
||||||
parent->setFocus();
|
parent->setFocus();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -443,8 +443,8 @@ void FTextView::onMouseUp (FMouseEvent* ev)
|
||||||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||||
{
|
{
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
const FPoint& tp = ev->getTermPos();
|
const auto& tp = ev->getTermPos();
|
||||||
const FPoint& p = parent->termToWidgetPos(tp);
|
const auto& p = parent->termToWidgetPos(tp);
|
||||||
parent->setFocus();
|
parent->setFocus();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -479,8 +479,8 @@ void FTextView::onMouseMove (FMouseEvent* ev)
|
||||||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||||
{
|
{
|
||||||
int b = ev->getButton();
|
int b = ev->getButton();
|
||||||
const FPoint& tp = ev->getTermPos();
|
const auto& tp = ev->getTermPos();
|
||||||
const FPoint& p = parent->termToWidgetPos(tp);
|
const auto& p = parent->termToWidgetPos(tp);
|
||||||
parent->setFocus();
|
parent->setFocus();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -695,8 +695,8 @@ void FTextView::draw()
|
||||||
|
|
||||||
if ( hasFocus() && getStatusBar() )
|
if ( hasFocus() && getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,8 +149,8 @@ bool FToggleButton::setFocus (bool enable)
|
||||||
|
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
getStatusBar()->setMessage(msg);
|
getStatusBar()->setMessage(msg);
|
||||||
|
@ -447,8 +447,8 @@ void FToggleButton::draw()
|
||||||
{
|
{
|
||||||
if ( flags.focus && getStatusBar() )
|
if ( flags.focus && getStatusBar() )
|
||||||
{
|
{
|
||||||
const FString& msg = getStatusbarMessage();
|
const auto& msg = getStatusbarMessage();
|
||||||
const FString& curMsg = getStatusBar()->getMessage();
|
const auto& curMsg = getStatusBar()->getMessage();
|
||||||
|
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,7 +303,7 @@ void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FVTerm::printf (const FString format, ...)
|
int FVTerm::printf (const FString format, ...)
|
||||||
{
|
{
|
||||||
static const int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE];
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
@ -1872,7 +1872,7 @@ FVTerm::charData FVTerm::getOverlappedCharacter ( int x
|
||||||
void FVTerm::processTerminalUpdate()
|
void FVTerm::processTerminalUpdate()
|
||||||
{
|
{
|
||||||
// Retains terminal updates if there are unprocessed inputs
|
// Retains terminal updates if there are unprocessed inputs
|
||||||
static const int max_skip = 8;
|
static constexpr int max_skip = 8;
|
||||||
|
|
||||||
if ( ! terminal_update_pending )
|
if ( ! terminal_update_pending )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -69,9 +69,9 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
{
|
{
|
||||||
assert ( ! rootObject
|
if ( rootObject )
|
||||||
&& "FTerm: There should be only one root object" );
|
throw std::runtime_error( "FWidget: No parent defined! "
|
||||||
|
"There should be only one root object" );
|
||||||
rootObject = this;
|
rootObject = this;
|
||||||
show_root_widget = nullptr;
|
show_root_widget = nullptr;
|
||||||
redraw_root_widget = nullptr;
|
redraw_root_widget = nullptr;
|
||||||
|
|
|
@ -67,7 +67,7 @@ FWindow::~FWindow() // destructor
|
||||||
|
|
||||||
if ( ! fapp->isQuit() )
|
if ( ! fapp->isQuit() )
|
||||||
{
|
{
|
||||||
const FRect& t_geometry = getTermGeometryWithShadow();
|
const auto& t_geometry = getTermGeometryWithShadow();
|
||||||
restoreVTerm (t_geometry);
|
restoreVTerm (t_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,9 +132,6 @@ class FApplication : public FWidget
|
||||||
typedef std::deque<eventPair> eventQueue;
|
typedef std::deque<eventPair> eventQueue;
|
||||||
typedef std::shared_ptr<eventQueue> eventQueuePtr;
|
typedef std::shared_ptr<eventQueue> eventQueuePtr;
|
||||||
|
|
||||||
// Constants
|
|
||||||
static const int NEED_MORE_DATA = -1; // parseKeyString return value
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init (long, long);
|
void init (long, long);
|
||||||
void cmd_options (const int&, char*[]);
|
void cmd_options (const int&, char*[]);
|
||||||
|
|
|
@ -137,7 +137,7 @@ class FButton : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -132,7 +132,7 @@ class FButtonGroup : public FScrollView
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isRadioButton (FToggleButton*) const;
|
bool isRadioButton (FToggleButton*) const;
|
||||||
|
|
|
@ -326,7 +326,7 @@ static uInt cp437_to_ucs[][2] =
|
||||||
{0xff, 0x00a0} // no-break space
|
{0xff, 0x00a0} // no-break space
|
||||||
};
|
};
|
||||||
|
|
||||||
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
|
constexpr uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
|
||||||
/ sizeof(cp437_to_ucs[0]) ) - 1;
|
/ sizeof(cp437_to_ucs[0]) ) - 1;
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
|
|
|
@ -172,8 +172,8 @@ class FDialog : public FWindow
|
||||||
} mouseStates;
|
} mouseStates;
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static const std::size_t MENU_BTN = 3;
|
static constexpr std::size_t MENU_BTN = 3;
|
||||||
static const bool PRINT_WIN_NUMBER = false; // Only for debug
|
static constexpr bool PRINT_WIN_NUMBER = false; // Only for debug
|
||||||
|
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
using FWidget::drawBorder;
|
using FWidget::drawBorder;
|
||||||
|
|
|
@ -85,7 +85,7 @@ class FKeyboard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t FIFO_BUF_SIZE{512};
|
static constexpr std::size_t FIFO_BUF_SIZE{512};
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef char keybuffer[FIFO_BUF_SIZE];
|
typedef char keybuffer[FIFO_BUF_SIZE];
|
||||||
|
@ -138,8 +138,8 @@ class FKeyboard
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t READ_BUF_SIZE{1024};
|
static constexpr std::size_t READ_BUF_SIZE{1024};
|
||||||
static const FKey NOT_SET = static_cast<FKey>(-1);
|
static constexpr FKey NOT_SET = static_cast<FKey>(-1);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FKey getMouseProtocolKey();
|
FKey getMouseProtocolKey();
|
||||||
|
|
|
@ -139,7 +139,7 @@ class FLabel : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -361,7 +361,7 @@ class FListView : public FWidget
|
||||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const int USE_MAX_SIZE = -1;
|
static constexpr int USE_MAX_SIZE = -1;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -131,7 +131,8 @@ class FMenu : public FWindow, public FMenuList
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
static constexpr bool SELECT_ITEM = true;
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -153,9 +154,6 @@ class FMenu : public FWindow, public FMenuList
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} menuText;
|
||||||
|
|
||||||
// Constants
|
|
||||||
static const bool SELECT_ITEM = true;
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FWidget* getSuperMenu() const;
|
FWidget* getSuperMenu() const;
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -121,22 +121,17 @@ class FMessageBox : public FDialog
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
template <typename messageType>
|
||||||
static int info ( FWidget*
|
static int info ( FWidget*
|
||||||
, const FString&
|
, const FString&
|
||||||
, const FString&
|
, const messageType&
|
||||||
, int = FMessageBox::Ok
|
|
||||||
, int = 0
|
|
||||||
, int = 0 );
|
|
||||||
|
|
||||||
static int info ( FWidget*
|
|
||||||
, const FString&
|
|
||||||
, int
|
|
||||||
, int = FMessageBox::Ok
|
, int = FMessageBox::Ok
|
||||||
, int = 0
|
, int = 0
|
||||||
, int = 0 );
|
, int = 0 );
|
||||||
|
|
||||||
|
template <typename messageType>
|
||||||
static int error ( FWidget*
|
static int error ( FWidget*
|
||||||
, const FString&
|
, const messageType&
|
||||||
, int = FMessageBox::Ok
|
, int = FMessageBox::Ok
|
||||||
, int = 0
|
, int = 0
|
||||||
, int = 0 );
|
, int = 0 );
|
||||||
|
@ -207,6 +202,48 @@ inline bool FMessageBox::setCenterText()
|
||||||
inline bool FMessageBox::unsetCenterText()
|
inline bool FMessageBox::unsetCenterText()
|
||||||
{ return setCenterText(false); }
|
{ return setCenterText(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template <typename messageType>
|
||||||
|
int FMessageBox::info ( FWidget* parent
|
||||||
|
, const FString& caption
|
||||||
|
, const messageType& message
|
||||||
|
, int button0
|
||||||
|
, int button1
|
||||||
|
, int button2 )
|
||||||
|
{
|
||||||
|
int reply;
|
||||||
|
FMessageBox mbox ( caption
|
||||||
|
, FString() << message
|
||||||
|
, button0, button1, button2
|
||||||
|
, parent );
|
||||||
|
reply = mbox.exec();
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template <typename messageType>
|
||||||
|
int FMessageBox::error ( FWidget* parent
|
||||||
|
, const messageType& message
|
||||||
|
, int button0
|
||||||
|
, int button1
|
||||||
|
, int button2 )
|
||||||
|
{
|
||||||
|
int reply;
|
||||||
|
const FString& caption = "Error message";
|
||||||
|
FMessageBox mbox ( caption
|
||||||
|
, FString() << message
|
||||||
|
, button0, button1, button2
|
||||||
|
, parent );
|
||||||
|
mbox.beep();
|
||||||
|
mbox.setHeadline("Warning:");
|
||||||
|
mbox.setCenterText();
|
||||||
|
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
||||||
|
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
||||||
|
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
||||||
|
reply = mbox.exec();
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FMESSAGEBOX_H
|
#endif // FMESSAGEBOX_H
|
||||||
|
|
|
@ -306,7 +306,7 @@ class FMouseX11 : public FMouse
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static const std::size_t MOUSE_BUF_SIZE = 4;
|
static constexpr std::size_t MOUSE_BUF_SIZE = 4;
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void setKeyState (int);
|
void setKeyState (int);
|
||||||
|
@ -368,7 +368,7 @@ class FMouseSGR : public FMouse
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static const std::size_t MOUSE_BUF_SIZE = 13;
|
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void setKeyState (int);
|
void setKeyState (int);
|
||||||
|
@ -432,7 +432,7 @@ class FMouseUrxvt : public FMouse
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static const std::size_t MOUSE_BUF_SIZE = 13;
|
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void setKeyState (int);
|
void setKeyState (int);
|
||||||
|
|
|
@ -169,7 +169,7 @@ class FOptiMove
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constant
|
// Constant
|
||||||
static const std::size_t BUF_SIZE{512};
|
static constexpr std::size_t BUF_SIZE{512};
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -180,9 +180,9 @@ class FOptiMove
|
||||||
} capability;
|
} capability;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const int LONG_DURATION{INT_MAX};
|
static constexpr int LONG_DURATION{INT_MAX};
|
||||||
// value for a long capability waiting time
|
// value for a long capability waiting time
|
||||||
static const int MOVE_LIMIT{7};
|
static constexpr int MOVE_LIMIT{7};
|
||||||
// maximum character distance to avoid direct cursor addressing
|
// maximum character distance to avoid direct cursor addressing
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
|
|
@ -96,7 +96,7 @@ class FProgressbar : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
|
|
|
@ -156,8 +156,8 @@ class FScrollView : public FWidget
|
||||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const int vertical_border_spacing = 2;
|
static constexpr int vertical_border_spacing = 2;
|
||||||
static const int horizontal_border_spacing = 2;
|
static constexpr int horizontal_border_spacing = 2;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FPoint getViewportCursorPos();
|
FPoint getViewportCursorPos();
|
||||||
|
|
|
@ -263,9 +263,9 @@ class FString
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const uInt FWDBUFFER = 15;
|
static constexpr uInt FWDBUFFER = 15;
|
||||||
static const uInt INPBUFFER = 200;
|
static constexpr uInt INPBUFFER = 200;
|
||||||
static const uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
|
static constexpr uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void initLength (std::size_t);
|
void initLength (std::size_t);
|
||||||
|
|
|
@ -150,7 +150,7 @@ class FToggleButton : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setGroup (FButtonGroup*);
|
void setGroup (FButtonGroup*);
|
||||||
|
|
|
@ -448,7 +448,7 @@ class FVTerm
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
||||||
// Buffer size for character output on the terminal
|
// Buffer size for character output on the terminal
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
|
|
@ -51,7 +51,6 @@ class FStringTest : public CPPUNIT_NS::TestFixture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FStringTest()
|
FStringTest()
|
||||||
: s(0)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
|
@ -91,7 +90,7 @@ class FStringTest : public CPPUNIT_NS::TestFixture
|
||||||
void controlCodesTest();
|
void controlCodesTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
finalcut::FString* s;
|
finalcut::FString* s{0};
|
||||||
|
|
||||||
// Adds code needed to register the test suite
|
// Adds code needed to register the test suite
|
||||||
CPPUNIT_TEST_SUITE (FStringTest);
|
CPPUNIT_TEST_SUITE (FStringTest);
|
||||||
|
@ -223,8 +222,8 @@ void FStringTest::initLengthTest()
|
||||||
CPPUNIT_ASSERT ( s1.isNull() );
|
CPPUNIT_ASSERT ( s1.isNull() );
|
||||||
CPPUNIT_ASSERT ( s1.isEmpty() );
|
CPPUNIT_ASSERT ( s1.isEmpty() );
|
||||||
|
|
||||||
const int x1 = 10;
|
constexpr int x1 = 10;
|
||||||
const std::size_t x2 = 10;
|
constexpr std::size_t x2 = 10;
|
||||||
const finalcut::FString s2(x1);
|
const finalcut::FString s2(x1);
|
||||||
CPPUNIT_ASSERT ( s2.getLength() == 10 );
|
CPPUNIT_ASSERT ( s2.getLength() == 10 );
|
||||||
CPPUNIT_ASSERT ( s2.capacity() == 25 );
|
CPPUNIT_ASSERT ( s2.capacity() == 25 );
|
||||||
|
@ -355,28 +354,28 @@ void FStringTest::assignmentTest()
|
||||||
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
||||||
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
||||||
|
|
||||||
const wchar_t s5[] = L"abc";
|
constexpr wchar_t s5[] = L"abc";
|
||||||
s1 = s5;
|
s1 = s5;
|
||||||
CPPUNIT_ASSERT ( s1 );
|
CPPUNIT_ASSERT ( s1 );
|
||||||
CPPUNIT_ASSERT ( s1 == L"abc" );
|
CPPUNIT_ASSERT ( s1 == L"abc" );
|
||||||
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
||||||
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
||||||
|
|
||||||
const char s6[] = "def";
|
constexpr char s6[] = "def";
|
||||||
s1 = s6;
|
s1 = s6;
|
||||||
CPPUNIT_ASSERT ( s1 );
|
CPPUNIT_ASSERT ( s1 );
|
||||||
CPPUNIT_ASSERT ( s1 == L"def" );
|
CPPUNIT_ASSERT ( s1 == L"def" );
|
||||||
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
||||||
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
||||||
|
|
||||||
const wchar_t s7 = L'#';
|
constexpr wchar_t s7 = L'#';
|
||||||
s1 = s7;
|
s1 = s7;
|
||||||
CPPUNIT_ASSERT ( s1 );
|
CPPUNIT_ASSERT ( s1 );
|
||||||
CPPUNIT_ASSERT ( s1 == L"#" );
|
CPPUNIT_ASSERT ( s1 == L"#" );
|
||||||
CPPUNIT_ASSERT ( s1.getLength() == 1 );
|
CPPUNIT_ASSERT ( s1.getLength() == 1 );
|
||||||
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
CPPUNIT_ASSERT ( s1.capacity() == 18 );
|
||||||
|
|
||||||
const char s8 = '%';
|
constexpr char s8 = '%';
|
||||||
s1 = s8;
|
s1 = s8;
|
||||||
CPPUNIT_ASSERT ( s1 );
|
CPPUNIT_ASSERT ( s1 );
|
||||||
CPPUNIT_ASSERT ( s1 == L"%" );
|
CPPUNIT_ASSERT ( s1 == L"%" );
|
||||||
|
@ -418,13 +417,13 @@ void FStringTest::assignmentTest()
|
||||||
s1.setString(L"");
|
s1.setString(L"");
|
||||||
CPPUNIT_ASSERT ( ! s1.isNull() );
|
CPPUNIT_ASSERT ( ! s1.isNull() );
|
||||||
|
|
||||||
const wchar_t* wc = 0;
|
constexpr wchar_t* wc = 0;
|
||||||
s1.setString(wc);
|
s1.setString(wc);
|
||||||
CPPUNIT_ASSERT ( s1.isEmpty() );
|
CPPUNIT_ASSERT ( s1.isEmpty() );
|
||||||
CPPUNIT_ASSERT ( s1.isNull() );
|
CPPUNIT_ASSERT ( s1.isNull() );
|
||||||
CPPUNIT_ASSERT ( ! s1 );
|
CPPUNIT_ASSERT ( ! s1 );
|
||||||
|
|
||||||
const char* c = 0;
|
constexpr char* c = 0;
|
||||||
s1.setString(c);
|
s1.setString(c);
|
||||||
CPPUNIT_ASSERT ( s1.isEmpty() );
|
CPPUNIT_ASSERT ( s1.isEmpty() );
|
||||||
CPPUNIT_ASSERT ( s1.isNull() );
|
CPPUNIT_ASSERT ( s1.isNull() );
|
||||||
|
@ -509,20 +508,20 @@ void FStringTest::additionTest()
|
||||||
const std::wstring& s3 = L"abc";
|
const std::wstring& s3 = L"abc";
|
||||||
CPPUNIT_ASSERT ( s3 + finalcut::FString("def") == L"abcdef" );
|
CPPUNIT_ASSERT ( s3 + finalcut::FString("def") == L"abcdef" );
|
||||||
|
|
||||||
const wchar_t s4[] = L"abc";
|
constexpr wchar_t s4[] = L"abc";
|
||||||
CPPUNIT_ASSERT ( s4 + finalcut::FString("def") == L"abcdef" );
|
CPPUNIT_ASSERT ( s4 + finalcut::FString("def") == L"abcdef" );
|
||||||
|
|
||||||
const std::string& s5 = "abc";
|
const std::string& s5 = "abc";
|
||||||
CPPUNIT_ASSERT ( s5 + finalcut::FString("def") == L"abcdef" );
|
CPPUNIT_ASSERT ( s5 + finalcut::FString("def") == L"abcdef" );
|
||||||
|
|
||||||
const char s6[] = "abc";
|
constexpr char s6[] = "abc";
|
||||||
CPPUNIT_ASSERT ( s6 + finalcut::FString("def") == L"abcdef" );
|
CPPUNIT_ASSERT ( s6 + finalcut::FString("def") == L"abcdef" );
|
||||||
|
|
||||||
const wchar_t c1 = L'a';
|
constexpr wchar_t c1 = L'a';
|
||||||
CPPUNIT_ASSERT ( c1 + s3 == L"aabc" );
|
CPPUNIT_ASSERT ( c1 + s3 == L"aabc" );
|
||||||
CPPUNIT_ASSERT ( c1 + finalcut::FString("def") == L"adef" );
|
CPPUNIT_ASSERT ( c1 + finalcut::FString("def") == L"adef" );
|
||||||
|
|
||||||
const char c2 = 'a';
|
constexpr char c2 = 'a';
|
||||||
CPPUNIT_ASSERT ( c2 + s5 == "aabc" );
|
CPPUNIT_ASSERT ( c2 + s5 == "aabc" );
|
||||||
CPPUNIT_ASSERT ( c2 + finalcut::FString("def") == L"adef" );
|
CPPUNIT_ASSERT ( c2 + finalcut::FString("def") == L"adef" );
|
||||||
}
|
}
|
||||||
|
@ -553,13 +552,13 @@ void FStringTest::equalTest()
|
||||||
CPPUNIT_ASSERT ( ws1 == ws2 );
|
CPPUNIT_ASSERT ( ws1 == ws2 );
|
||||||
|
|
||||||
const finalcut::FString one_char('a');
|
const finalcut::FString one_char('a');
|
||||||
const char ch = 'a';
|
constexpr char ch = 'a';
|
||||||
CPPUNIT_ASSERT ( one_char == ch );
|
CPPUNIT_ASSERT ( one_char == ch );
|
||||||
CPPUNIT_ASSERT ( ch == one_char.c_str()[0] );
|
CPPUNIT_ASSERT ( ch == one_char.c_str()[0] );
|
||||||
CPPUNIT_ASSERT ( one_char.getLength() == 1 );
|
CPPUNIT_ASSERT ( one_char.getLength() == 1 );
|
||||||
CPPUNIT_ASSERT ( one_char.capacity() == 16 );
|
CPPUNIT_ASSERT ( one_char.capacity() == 16 );
|
||||||
|
|
||||||
const wchar_t wch = L'a';
|
constexpr wchar_t wch = L'a';
|
||||||
CPPUNIT_ASSERT ( one_char == wch );
|
CPPUNIT_ASSERT ( one_char == wch );
|
||||||
CPPUNIT_ASSERT ( wch == one_char.wc_str()[0] );
|
CPPUNIT_ASSERT ( wch == one_char.wc_str()[0] );
|
||||||
|
|
||||||
|
@ -567,14 +566,14 @@ void FStringTest::equalTest()
|
||||||
const finalcut::FString str2(L"abc");
|
const finalcut::FString str2(L"abc");
|
||||||
CPPUNIT_ASSERT ( str == str2 );
|
CPPUNIT_ASSERT ( str == str2 );
|
||||||
|
|
||||||
const char cstr[] = "abc";
|
constexpr char cstr[] = "abc";
|
||||||
CPPUNIT_ASSERT ( str == cstr );
|
CPPUNIT_ASSERT ( str == cstr );
|
||||||
CPPUNIT_ASSERT ( str.getLength() == 3 );
|
CPPUNIT_ASSERT ( str.getLength() == 3 );
|
||||||
CPPUNIT_ASSERT ( str.getUTF8length() == 3 );
|
CPPUNIT_ASSERT ( str.getUTF8length() == 3 );
|
||||||
CPPUNIT_ASSERT ( str.capacity() == 18 );
|
CPPUNIT_ASSERT ( str.capacity() == 18 );
|
||||||
CPPUNIT_ASSERT ( strncmp(cstr, str.c_str(), 3) == 0 );
|
CPPUNIT_ASSERT ( strncmp(cstr, str.c_str(), 3) == 0 );
|
||||||
|
|
||||||
const wchar_t wcstr[] = L"abc";
|
constexpr wchar_t wcstr[] = L"abc";
|
||||||
CPPUNIT_ASSERT ( str == wcstr );
|
CPPUNIT_ASSERT ( str == wcstr );
|
||||||
CPPUNIT_ASSERT ( wcsncmp(wcstr, str.wc_str(), 3) == 0 );
|
CPPUNIT_ASSERT ( wcsncmp(wcstr, str.wc_str(), 3) == 0 );
|
||||||
|
|
||||||
|
@ -599,13 +598,13 @@ void FStringTest::equalTest()
|
||||||
void FStringTest::notEqualTest()
|
void FStringTest::notEqualTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString one_char('@');
|
const finalcut::FString one_char('@');
|
||||||
const char ch = '!';
|
constexpr char ch = '!';
|
||||||
CPPUNIT_ASSERT ( one_char != ch );
|
CPPUNIT_ASSERT ( one_char != ch );
|
||||||
CPPUNIT_ASSERT ( ch != one_char.c_str()[0] );
|
CPPUNIT_ASSERT ( ch != one_char.c_str()[0] );
|
||||||
CPPUNIT_ASSERT ( one_char.getLength() == 1 );
|
CPPUNIT_ASSERT ( one_char.getLength() == 1 );
|
||||||
CPPUNIT_ASSERT ( one_char.capacity() == 16 );
|
CPPUNIT_ASSERT ( one_char.capacity() == 16 );
|
||||||
|
|
||||||
const wchar_t wch = L'_';
|
constexpr wchar_t wch = L'_';
|
||||||
CPPUNIT_ASSERT ( one_char != wch );
|
CPPUNIT_ASSERT ( one_char != wch );
|
||||||
CPPUNIT_ASSERT ( wch != one_char.wc_str()[0] );
|
CPPUNIT_ASSERT ( wch != one_char.wc_str()[0] );
|
||||||
|
|
||||||
|
@ -613,7 +612,7 @@ void FStringTest::notEqualTest()
|
||||||
const finalcut::FString s2 = L"АВС"; // cyrillic letters
|
const finalcut::FString s2 = L"АВС"; // cyrillic letters
|
||||||
CPPUNIT_ASSERT ( s1 != s2 );
|
CPPUNIT_ASSERT ( s1 != s2 );
|
||||||
|
|
||||||
const char cstr[] = "abc";
|
constexpr char cstr[] = "abc";
|
||||||
CPPUNIT_ASSERT ( s1 != cstr );
|
CPPUNIT_ASSERT ( s1 != cstr );
|
||||||
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
CPPUNIT_ASSERT ( s1.getLength() == 3 );
|
||||||
CPPUNIT_ASSERT ( strlen(s1.c_str()) == 3 );
|
CPPUNIT_ASSERT ( strlen(s1.c_str()) == 3 );
|
||||||
|
@ -625,7 +624,7 @@ void FStringTest::notEqualTest()
|
||||||
CPPUNIT_ASSERT ( s2.capacity() == 18 );
|
CPPUNIT_ASSERT ( s2.capacity() == 18 );
|
||||||
CPPUNIT_ASSERT ( strncmp(cstr, s1.c_str(), 3) != 0 );
|
CPPUNIT_ASSERT ( strncmp(cstr, s1.c_str(), 3) != 0 );
|
||||||
|
|
||||||
const wchar_t wcstr[] = L"abc";
|
constexpr wchar_t wcstr[] = L"abc";
|
||||||
CPPUNIT_ASSERT ( s1 != wcstr );
|
CPPUNIT_ASSERT ( s1 != wcstr );
|
||||||
CPPUNIT_ASSERT ( wcsncmp(wcstr, s1.wc_str(), 3) != 0 );
|
CPPUNIT_ASSERT ( wcsncmp(wcstr, s1.wc_str(), 3) != 0 );
|
||||||
|
|
||||||
|
@ -648,10 +647,10 @@ void FStringTest::notEqualTest()
|
||||||
void FStringTest::lessEqualTest()
|
void FStringTest::lessEqualTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString one_char('x');
|
const finalcut::FString one_char('x');
|
||||||
const char ch = 'z';
|
constexpr char ch = 'z';
|
||||||
CPPUNIT_ASSERT ( one_char <= ch );
|
CPPUNIT_ASSERT ( one_char <= ch );
|
||||||
|
|
||||||
const wchar_t wch = L'z';
|
constexpr wchar_t wch = L'z';
|
||||||
CPPUNIT_ASSERT ( one_char <= wch );
|
CPPUNIT_ASSERT ( one_char <= wch );
|
||||||
|
|
||||||
const finalcut::FString s1 = L"xyz";
|
const finalcut::FString s1 = L"xyz";
|
||||||
|
@ -660,13 +659,13 @@ void FStringTest::lessEqualTest()
|
||||||
CPPUNIT_ASSERT ( s1 <= s2 && s1 == s2 );
|
CPPUNIT_ASSERT ( s1 <= s2 && s1 == s2 );
|
||||||
CPPUNIT_ASSERT ( s1 <= s3 && s1 != s3 );
|
CPPUNIT_ASSERT ( s1 <= s3 && s1 != s3 );
|
||||||
|
|
||||||
const char cstr1[] = "xyz";
|
constexpr char cstr1[] = "xyz";
|
||||||
const char cstr2[] = "xzz";
|
constexpr char cstr2[] = "xzz";
|
||||||
CPPUNIT_ASSERT ( s1 <= cstr1 && s1 == cstr1 );
|
CPPUNIT_ASSERT ( s1 <= cstr1 && s1 == cstr1 );
|
||||||
CPPUNIT_ASSERT ( s1 <= cstr2 && s1 != cstr2 );
|
CPPUNIT_ASSERT ( s1 <= cstr2 && s1 != cstr2 );
|
||||||
|
|
||||||
const wchar_t wcstr1[] = L"xyz";
|
constexpr wchar_t wcstr1[] = L"xyz";
|
||||||
const wchar_t wcstr2[] = L"xzz";
|
constexpr wchar_t wcstr2[] = L"xzz";
|
||||||
CPPUNIT_ASSERT ( s1 <= wcstr1 && s1 == wcstr1 );
|
CPPUNIT_ASSERT ( s1 <= wcstr1 && s1 == wcstr1 );
|
||||||
CPPUNIT_ASSERT ( s1 <= wcstr2 && s1 != wcstr2 );
|
CPPUNIT_ASSERT ( s1 <= wcstr2 && s1 != wcstr2 );
|
||||||
|
|
||||||
|
@ -693,20 +692,20 @@ void FStringTest::lessEqualTest()
|
||||||
void FStringTest::lessTest()
|
void FStringTest::lessTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString one_char('x');
|
const finalcut::FString one_char('x');
|
||||||
const char ch = 'z';
|
constexpr char ch = 'z';
|
||||||
CPPUNIT_ASSERT ( one_char < ch );
|
CPPUNIT_ASSERT ( one_char < ch );
|
||||||
|
|
||||||
const wchar_t wch = L'z';
|
constexpr wchar_t wch = L'z';
|
||||||
CPPUNIT_ASSERT ( one_char < wch );
|
CPPUNIT_ASSERT ( one_char < wch );
|
||||||
|
|
||||||
const finalcut::FString s1 = L"xyz";
|
const finalcut::FString s1 = L"xyz";
|
||||||
const finalcut::FString s2 = L"xzz";
|
const finalcut::FString s2 = L"xzz";
|
||||||
CPPUNIT_ASSERT ( s1 < s2 );
|
CPPUNIT_ASSERT ( s1 < s2 );
|
||||||
|
|
||||||
const char cstr[] = "xzz";
|
constexpr char cstr[] = "xzz";
|
||||||
CPPUNIT_ASSERT ( s1 < cstr );
|
CPPUNIT_ASSERT ( s1 < cstr );
|
||||||
|
|
||||||
const wchar_t wcstr[] = L"xzz";
|
constexpr wchar_t wcstr[] = L"xzz";
|
||||||
CPPUNIT_ASSERT ( s1 < wcstr );
|
CPPUNIT_ASSERT ( s1 < wcstr );
|
||||||
|
|
||||||
const std::string st = "xzz";
|
const std::string st = "xzz";
|
||||||
|
@ -726,10 +725,10 @@ void FStringTest::lessTest()
|
||||||
void FStringTest::greaterEqualTest()
|
void FStringTest::greaterEqualTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString one_char('x');
|
const finalcut::FString one_char('x');
|
||||||
const char ch = 'x';
|
constexpr char ch = 'x';
|
||||||
CPPUNIT_ASSERT ( one_char >= ch );
|
CPPUNIT_ASSERT ( one_char >= ch );
|
||||||
|
|
||||||
const wchar_t wch = L'x';
|
constexpr wchar_t wch = L'x';
|
||||||
CPPUNIT_ASSERT ( one_char >= wch );
|
CPPUNIT_ASSERT ( one_char >= wch );
|
||||||
|
|
||||||
const finalcut::FString s1 = L"xyz";
|
const finalcut::FString s1 = L"xyz";
|
||||||
|
@ -738,13 +737,13 @@ void FStringTest::greaterEqualTest()
|
||||||
CPPUNIT_ASSERT ( s1 >= s2 && s1 == s2 );
|
CPPUNIT_ASSERT ( s1 >= s2 && s1 == s2 );
|
||||||
CPPUNIT_ASSERT ( s1 >= s3 && s1 != s3 );
|
CPPUNIT_ASSERT ( s1 >= s3 && s1 != s3 );
|
||||||
|
|
||||||
const char cstr1[] = "xyz";
|
constexpr char cstr1[] = "xyz";
|
||||||
const char cstr2[] = "xxz";
|
constexpr char cstr2[] = "xxz";
|
||||||
CPPUNIT_ASSERT ( s1 >= cstr1 && s1 == cstr1 );
|
CPPUNIT_ASSERT ( s1 >= cstr1 && s1 == cstr1 );
|
||||||
CPPUNIT_ASSERT ( s1 >= cstr2 && s1 != cstr2 );
|
CPPUNIT_ASSERT ( s1 >= cstr2 && s1 != cstr2 );
|
||||||
|
|
||||||
const wchar_t wcstr1[] = L"xyz";
|
constexpr wchar_t wcstr1[] = L"xyz";
|
||||||
const wchar_t wcstr2[] = L"xxz";
|
constexpr wchar_t wcstr2[] = L"xxz";
|
||||||
CPPUNIT_ASSERT ( s1 >= wcstr1 && s1 == wcstr1 );
|
CPPUNIT_ASSERT ( s1 >= wcstr1 && s1 == wcstr1 );
|
||||||
CPPUNIT_ASSERT ( s1 >= wcstr2 && s1 != wcstr2 );
|
CPPUNIT_ASSERT ( s1 >= wcstr2 && s1 != wcstr2 );
|
||||||
|
|
||||||
|
@ -771,20 +770,20 @@ void FStringTest::greaterEqualTest()
|
||||||
void FStringTest::greaterTest()
|
void FStringTest::greaterTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString one_char('x');
|
const finalcut::FString one_char('x');
|
||||||
const char ch = 'w';
|
constexpr char ch = 'w';
|
||||||
CPPUNIT_ASSERT ( one_char > ch );
|
CPPUNIT_ASSERT ( one_char > ch );
|
||||||
|
|
||||||
const wchar_t wch = L'w';
|
constexpr wchar_t wch = L'w';
|
||||||
CPPUNIT_ASSERT ( one_char > wch );
|
CPPUNIT_ASSERT ( one_char > wch );
|
||||||
|
|
||||||
const finalcut::FString s1 = L"xyz";
|
const finalcut::FString s1 = L"xyz";
|
||||||
const finalcut::FString s2 = L"xww";
|
const finalcut::FString s2 = L"xww";
|
||||||
CPPUNIT_ASSERT ( s1 > s2 );
|
CPPUNIT_ASSERT ( s1 > s2 );
|
||||||
|
|
||||||
const char cstr[] = "xww";
|
constexpr char cstr[] = "xww";
|
||||||
CPPUNIT_ASSERT ( s1 > cstr );
|
CPPUNIT_ASSERT ( s1 > cstr );
|
||||||
|
|
||||||
const wchar_t wcstr[] = L"xww";
|
constexpr wchar_t wcstr[] = L"xww";
|
||||||
CPPUNIT_ASSERT ( s1 > wcstr );
|
CPPUNIT_ASSERT ( s1 > wcstr );
|
||||||
|
|
||||||
const std::string st = "xww";
|
const std::string st = "xww";
|
||||||
|
@ -1036,11 +1035,11 @@ void FStringTest::formatTest()
|
||||||
str2.sprintf (null_fstring, 0);
|
str2.sprintf (null_fstring, 0);
|
||||||
CPPUNIT_ASSERT ( str2.isNull() );
|
CPPUNIT_ASSERT ( str2.isNull() );
|
||||||
|
|
||||||
const wchar_t* null_wstring = 0;
|
constexpr wchar_t* null_wstring = 0;
|
||||||
str2.sprintf (null_wstring, 0);
|
str2.sprintf (null_wstring, 0);
|
||||||
CPPUNIT_ASSERT ( str2.isNull() );
|
CPPUNIT_ASSERT ( str2.isNull() );
|
||||||
|
|
||||||
const char* null_string = 0;
|
constexpr char* null_string = 0;
|
||||||
str2.sprintf (null_string, 0);
|
str2.sprintf (null_string, 0);
|
||||||
CPPUNIT_ASSERT ( str2.isNull() );
|
CPPUNIT_ASSERT ( str2.isNull() );
|
||||||
|
|
||||||
|
@ -1119,15 +1118,15 @@ void FStringTest::convertToNumberTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStringTest::convertFromNumberTest()
|
void FStringTest::convertFromNumberTest()
|
||||||
{
|
{
|
||||||
const sInt16 n1 = -1234;
|
constexpr sInt16 n1 = -1234;
|
||||||
const uInt16 n2 = 1234;
|
constexpr uInt16 n2 = 1234;
|
||||||
const int n3 = -12345;
|
constexpr int n3 = -12345;
|
||||||
const uInt n4 = 12345;
|
constexpr uInt n4 = 12345;
|
||||||
const long n5 = -12345678;
|
constexpr long n5 = -12345678;
|
||||||
const uLong n6 = 12345678;
|
constexpr uLong n6 = 12345678;
|
||||||
const float n7 = 1234.56f;
|
constexpr float n7 = 1234.56f;
|
||||||
const double n8 = 1234.5678;
|
constexpr double n8 = 1234.5678;
|
||||||
const lDouble n9 = 12345.67890L;
|
constexpr lDouble n9 = 12345.67890L;
|
||||||
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n1) == "-1234" );
|
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n1) == "-1234" );
|
||||||
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n2) == "1234" );
|
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n2) == "1234" );
|
||||||
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n3) == "-12345" );
|
CPPUNIT_ASSERT ( finalcut::FString().setNumber(n3) == "-12345" );
|
||||||
|
@ -1371,7 +1370,7 @@ void FStringTest::insertTest()
|
||||||
CPPUNIT_ASSERT ( str1.insert(str2, 3) == "ABCxyz" );
|
CPPUNIT_ASSERT ( str1.insert(str2, 3) == "ABCxyz" );
|
||||||
|
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
const wchar_t str3[] = L"xyz";
|
constexpr wchar_t str3[] = L"xyz";
|
||||||
CPPUNIT_ASSERT ( str1.insert(str3, 0) == "xyzABC" );
|
CPPUNIT_ASSERT ( str1.insert(str3, 0) == "xyzABC" );
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
CPPUNIT_ASSERT ( str1.insert(str3, 1) == "AxyzBC" );
|
CPPUNIT_ASSERT ( str1.insert(str3, 1) == "AxyzBC" );
|
||||||
|
@ -1381,7 +1380,7 @@ void FStringTest::insertTest()
|
||||||
CPPUNIT_ASSERT ( str1.insert(str3, 3) == "ABCxyz" );
|
CPPUNIT_ASSERT ( str1.insert(str3, 3) == "ABCxyz" );
|
||||||
|
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
const char str4[] = "xyz";
|
constexpr char str4[] = "xyz";
|
||||||
CPPUNIT_ASSERT ( str1.insert(str4, 0) == "xyzABC" );
|
CPPUNIT_ASSERT ( str1.insert(str4, 0) == "xyzABC" );
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
CPPUNIT_ASSERT ( str1.insert(str4, 1) == "AxyzBC" );
|
CPPUNIT_ASSERT ( str1.insert(str4, 1) == "AxyzBC" );
|
||||||
|
@ -1391,7 +1390,7 @@ void FStringTest::insertTest()
|
||||||
CPPUNIT_ASSERT ( str1.insert(str4, 3) == "ABCxyz" );
|
CPPUNIT_ASSERT ( str1.insert(str4, 3) == "ABCxyz" );
|
||||||
|
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
const wchar_t wc = L'*';
|
constexpr wchar_t wc = L'*';
|
||||||
CPPUNIT_ASSERT ( str1.insert(wc, 0) == "*ABC" );
|
CPPUNIT_ASSERT ( str1.insert(wc, 0) == "*ABC" );
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
CPPUNIT_ASSERT ( str1.insert(wc, 1) == "A*BC" );
|
CPPUNIT_ASSERT ( str1.insert(wc, 1) == "A*BC" );
|
||||||
|
@ -1401,7 +1400,7 @@ void FStringTest::insertTest()
|
||||||
CPPUNIT_ASSERT ( str1.insert(wc, 3) == "ABC*" );
|
CPPUNIT_ASSERT ( str1.insert(wc, 3) == "ABC*" );
|
||||||
|
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
const char c = '*';
|
constexpr char c = '*';
|
||||||
CPPUNIT_ASSERT ( str1.insert(c, 0) == "*ABC" );
|
CPPUNIT_ASSERT ( str1.insert(c, 0) == "*ABC" );
|
||||||
str1 = "ABC";
|
str1 = "ABC";
|
||||||
CPPUNIT_ASSERT ( str1.insert(c, 1) == "A*BC" );
|
CPPUNIT_ASSERT ( str1.insert(c, 1) == "A*BC" );
|
||||||
|
@ -1418,18 +1417,18 @@ void FStringTest::replaceTest()
|
||||||
finalcut::FString s1 = str;
|
finalcut::FString s1 = str;
|
||||||
const finalcut::FString from1 = "three";
|
const finalcut::FString from1 = "three";
|
||||||
const std::wstring from2 = L"three";
|
const std::wstring from2 = L"three";
|
||||||
const wchar_t from3[] = L"three";
|
constexpr wchar_t from3[] = L"three";
|
||||||
const std::string from4 = "three";
|
const std::string from4 = "three";
|
||||||
const char from5[] = "three";
|
constexpr char from5[] = "three";
|
||||||
const wchar_t from6 = L',';
|
constexpr wchar_t from6 = L',';
|
||||||
const char from7 = ',';
|
constexpr char from7 = ',';
|
||||||
const finalcut::FString to1 = L'3';
|
const finalcut::FString to1 = L'3';
|
||||||
const std::wstring to2 = L"3";
|
const std::wstring to2 = L"3";
|
||||||
const wchar_t to3[] = L"3";
|
constexpr wchar_t to3[] = L"3";
|
||||||
const std::string to4 = "3";
|
const std::string to4 = "3";
|
||||||
const char to5[] = "3";
|
constexpr char to5[] = "3";
|
||||||
const wchar_t to6 = '3';
|
constexpr wchar_t to6 = '3';
|
||||||
const char to7 = '3';
|
constexpr char to7 = '3';
|
||||||
|
|
||||||
CPPUNIT_ASSERT ( s1.replace(from1, to1)
|
CPPUNIT_ASSERT ( s1.replace(from1, to1)
|
||||||
== "Look behind you, a 3-headed monkey!" );
|
== "Look behind you, a 3-headed monkey!" );
|
||||||
|
@ -1664,18 +1663,18 @@ void FStringTest::includesTest()
|
||||||
{
|
{
|
||||||
const finalcut::FString str = "Look behind you, a three-headed monkey!";
|
const finalcut::FString str = "Look behind you, a three-headed monkey!";
|
||||||
const finalcut::FString empty1{};
|
const finalcut::FString empty1{};
|
||||||
const wchar_t* empty2 = 0;
|
constexpr wchar_t* empty2 = 0;
|
||||||
const char* empty3 = 0;
|
constexpr char* empty3 = 0;
|
||||||
const finalcut::FString search1 = "you";
|
const finalcut::FString search1 = "you";
|
||||||
const finalcut::FString search2 = "me";
|
const finalcut::FString search2 = "me";
|
||||||
const wchar_t search3[] = L"you";
|
constexpr wchar_t search3[] = L"you";
|
||||||
const wchar_t search4[] = L"me";
|
constexpr wchar_t search4[] = L"me";
|
||||||
const char search5[] = "you";
|
constexpr char search5[] = "you";
|
||||||
const char search6[] = "me";
|
constexpr char search6[] = "me";
|
||||||
const wchar_t search7 = L'y';
|
constexpr wchar_t search7 = L'y';
|
||||||
const wchar_t search8 = L'&';
|
constexpr wchar_t search8 = L'&';
|
||||||
const char search9 = 'y';
|
constexpr char search9 = 'y';
|
||||||
const char search10 = '&';
|
constexpr char search10 = '&';
|
||||||
|
|
||||||
CPPUNIT_ASSERT ( ! str.includes(static_cast<finalcut::FString>(0)) );
|
CPPUNIT_ASSERT ( ! str.includes(static_cast<finalcut::FString>(0)) );
|
||||||
CPPUNIT_ASSERT ( ! str.includes(empty1) );
|
CPPUNIT_ASSERT ( ! str.includes(empty1) );
|
||||||
|
|
|
@ -228,7 +228,7 @@ void FTermcapQuirksTest::classNameTest()
|
||||||
void FTermcapQuirksTest::generalTest()
|
void FTermcapQuirksTest::generalTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -295,7 +295,7 @@ void FTermcapQuirksTest::generalTest()
|
||||||
void FTermcapQuirksTest::xtermTest()
|
void FTermcapQuirksTest::xtermTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -328,7 +328,7 @@ void FTermcapQuirksTest::xtermTest()
|
||||||
void FTermcapQuirksTest::freebsdTest()
|
void FTermcapQuirksTest::freebsdTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -367,7 +367,7 @@ void FTermcapQuirksTest::freebsdTest()
|
||||||
void FTermcapQuirksTest::cygwinTest()
|
void FTermcapQuirksTest::cygwinTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -394,7 +394,7 @@ void FTermcapQuirksTest::cygwinTest()
|
||||||
void FTermcapQuirksTest::linuxTest()
|
void FTermcapQuirksTest::linuxTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -468,7 +468,7 @@ void FTermcapQuirksTest::linuxTest()
|
||||||
void FTermcapQuirksTest::rxvtTest()
|
void FTermcapQuirksTest::rxvtTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -511,7 +511,7 @@ void FTermcapQuirksTest::rxvtTest()
|
||||||
void FTermcapQuirksTest::vteTest()
|
void FTermcapQuirksTest::vteTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -537,7 +537,7 @@ void FTermcapQuirksTest::vteTest()
|
||||||
void FTermcapQuirksTest::puttyTest()
|
void FTermcapQuirksTest::puttyTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -629,7 +629,7 @@ void FTermcapQuirksTest::puttyTest()
|
||||||
void FTermcapQuirksTest::teratermTest()
|
void FTermcapQuirksTest::teratermTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -661,7 +661,7 @@ void FTermcapQuirksTest::teratermTest()
|
||||||
void FTermcapQuirksTest::sunTest()
|
void FTermcapQuirksTest::sunTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
@ -781,7 +781,7 @@ void FTermcapQuirksTest::sunTest()
|
||||||
void FTermcapQuirksTest::screenTest()
|
void FTermcapQuirksTest::screenTest()
|
||||||
{
|
{
|
||||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last_item; i++)
|
for (std::size_t i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
|
@ -679,7 +679,6 @@ void FTermDetectionTest::urxvtTest()
|
||||||
setenv ("TERM", "rxvt-unicode-256color", 1);
|
setenv ("TERM", "rxvt-unicode-256color", 1);
|
||||||
setenv ("COLORTERM", "rxvt-xpm", 1);
|
setenv ("COLORTERM", "rxvt-xpm", 1);
|
||||||
setenv ("COLORFGBG", "default;default;0", 1);
|
setenv ("COLORFGBG", "default;default;0", 1);
|
||||||
//unsetenv("COLORFGBG");
|
|
||||||
unsetenv("TERMCAP");
|
unsetenv("TERMCAP");
|
||||||
unsetenv("VTE_VERSION");
|
unsetenv("VTE_VERSION");
|
||||||
unsetenv("XTERM_VERSION");
|
unsetenv("XTERM_VERSION");
|
||||||
|
@ -2100,7 +2099,7 @@ void FTermDetectionTest::debugOutput()
|
||||||
std::cout << std::endl << line << std::endl;
|
std::cout << std::endl << line << std::endl;
|
||||||
|
|
||||||
// Command line
|
// Command line
|
||||||
const char debug_command[] = "/bin/bash -c ' \
|
constexpr char debug_command[] = "/bin/bash -c ' \
|
||||||
for i in DSR CURSOR_POS DECID DA DA1 SEC_DA ANSWERBACK \
|
for i in DSR CURSOR_POS DECID DA DA1 SEC_DA ANSWERBACK \
|
||||||
TITLE COLOR16 COLOR88 COLOR256; \
|
TITLE COLOR16 COLOR88 COLOR256; \
|
||||||
do \
|
do \
|
||||||
|
@ -2258,7 +2257,7 @@ pid_t FTermDetectionTest::forkProcess()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int timeout = 150; // 1.5 seconds
|
constexpr int timeout = 150; // 1.5 seconds
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// Wait until the child process is ready for input
|
// Wait until the child process is ready for input
|
||||||
|
|
Loading…
Reference in New Issue