Several small code improvements
This commit is contained in:
parent
ac1ebfefad
commit
3bb001677f
|
@ -1,3 +1,6 @@
|
|||
2020-04-13 Markus Gans <guru.mail@muenster.de>
|
||||
* Several small code improvements
|
||||
|
||||
2020-04-09 Markus Gans <guru.mail@muenster.de>
|
||||
* A dialog can now be displayed without a framing border.
|
||||
Many thanks to basedtho for this tip
|
||||
|
|
|
@ -72,7 +72,7 @@ int main (int argc, char* argv[])
|
|||
const finalcut::FPoint position(25, 5);
|
||||
const finalcut::FSize size(30, 10);
|
||||
dialog.setGeometry (position, size);
|
||||
app.setMainWidget(&dialog);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ The position of the window in the terminal is at x=25 and
|
|||
y=5 (note: x=1 and y=1 represents the upper left corner).
|
||||
|
||||
```cpp
|
||||
app.setMainWidget(&dialog);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
```
|
||||
The `dialog` object was now selected as the main widget for the application.
|
||||
When you close the main widget, the entire application quits.
|
||||
|
@ -219,7 +219,7 @@ int main (int argc, char* argv[])
|
|||
"incididunt ut labore et dolore magna aliqua."
|
||||
, dialog );
|
||||
label->setGeometry (FPoint(2, 4), FSize(36, 1));
|
||||
app.setMainWidget(dialog);
|
||||
FWidget::setMainWidget(dialog);
|
||||
dialog->show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ int main (int argc, char* argv[])
|
|||
&label
|
||||
);
|
||||
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ int main (int argc, char* argv[])
|
|||
&dialog
|
||||
);
|
||||
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -1188,7 +1188,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
|
|||
Input.addCallback
|
||||
(
|
||||
"changed",
|
||||
[] (finalcut::FWidget*, FDataPtr data)
|
||||
[] (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto dialog = static_cast<SegmentView*>(data);
|
||||
dialog->redraw();
|
||||
|
@ -177,7 +177,7 @@ void SegmentView::get7Segment (const wchar_t c)
|
|||
// Hexadecimal digit from 0 up to f
|
||||
if ( code.find(c) != code.end() )
|
||||
{
|
||||
sevenSegment& s = code[c];
|
||||
const sevenSegment& s = code[c];
|
||||
constexpr char h[2]{' ', '_'};
|
||||
constexpr char v[2]{' ', '|'};
|
||||
|
||||
|
@ -227,7 +227,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
finalcut::FApplication app(argc, argv);
|
||||
SegmentView dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ class Background : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Callback method
|
||||
void cb_changed (finalcut::FWidget*, FDataPtr);
|
||||
void cb_choice (finalcut::FWidget*, FDataPtr);
|
||||
void cb_changed (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_choice (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FComboBox color_choice{this};
|
||||
|
@ -169,7 +169,7 @@ Background::~Background() // destructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Background::cb_changed (finalcut::FWidget*, FDataPtr)
|
||||
void Background::cb_changed (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( ! finalcut::FTerm::canChangeColorPalette() )
|
||||
return;
|
||||
|
@ -183,12 +183,14 @@ void Background::cb_changed (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Background::cb_choice (finalcut::FWidget*, FDataPtr)
|
||||
void Background::cb_choice (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( ! finalcut::FTerm::canChangeColorPalette() )
|
||||
return;
|
||||
|
||||
uChar r{}, g{}, b{};
|
||||
uChar r{};
|
||||
uChar g{};
|
||||
uChar b{};
|
||||
const FDataPtr data_ptr = color_choice.getItemData();
|
||||
const RGB* rgb = reinterpret_cast<RGB*>(data_ptr);
|
||||
std::tie(r, g, b) = *rgb;
|
||||
|
@ -216,7 +218,7 @@ int main (int argc, char* argv[])
|
|||
app.setBackgroundColor(finalcut::fc::LightMagenta);
|
||||
|
||||
Background dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class Calc : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_buttonClicked (finalcut::FWidget*, FDataPtr);
|
||||
void cb_buttonClicked (const finalcut::FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Typedef and Enumeration
|
||||
|
@ -1037,10 +1037,10 @@ void Calc::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Calc::cb_buttonClicked (finalcut::FWidget*, FDataPtr data)
|
||||
void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
lDouble& x = getValue();
|
||||
const Calc::button key = *(static_cast<Calc::button*>(data));
|
||||
const Calc::button& key = *(static_cast<Calc::button*>(data));
|
||||
|
||||
// Call the key function
|
||||
(this->*key_map[key])(x);
|
||||
|
@ -1174,7 +1174,7 @@ int main (int argc, char* argv[])
|
|||
Calc calculator(&app);
|
||||
|
||||
// Set calculator object as main widget
|
||||
app.setMainWidget(&calculator);
|
||||
finalcut::FWidget::setMainWidget(&calculator);
|
||||
|
||||
// Show and start the application
|
||||
calculator.show();
|
||||
|
|
|
@ -60,7 +60,7 @@ class CheckList : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_showList (finalcut::FWidget*, FDataPtr);
|
||||
void cb_showList (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FListView listView{this};
|
||||
|
@ -161,7 +161,7 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void CheckList::cb_showList (finalcut::FWidget*, FDataPtr)
|
||||
void CheckList::cb_showList (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
auto iter = listView.beginOfList();
|
||||
finalcut::FString shopping_list;
|
||||
|
@ -201,7 +201,7 @@ int main (int argc, char* argv[])
|
|||
CheckList d(&app);
|
||||
|
||||
// Set dialog d as main widget
|
||||
app.setMainWidget(&d);
|
||||
finalcut::FWidget::setMainWidget(&d);
|
||||
|
||||
// Show and start the application
|
||||
d.show();
|
||||
|
|
|
@ -31,14 +31,14 @@ using finalcut::FSize;
|
|||
typedef std::shared_ptr<finalcut::FRadioButton> FRadioButtonPtr;
|
||||
|
||||
// Function prototypes
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr);
|
||||
void populateChoice (std::vector<FRadioButtonPtr>&, finalcut::FButtonGroup&);
|
||||
void preset (std::vector<FRadioButtonPtr>&);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Callback functions
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto dlg = static_cast<finalcut::FDialog*>(data);
|
||||
dlg->close();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -26,13 +26,13 @@ using finalcut::FPoint;
|
|||
using finalcut::FSize;
|
||||
|
||||
// function prototype
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback function
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto& app = *(static_cast<finalcut::FApplication*>(data));
|
||||
app.quit();
|
||||
|
@ -81,7 +81,7 @@ int main (int argc, char* argv[])
|
|||
);
|
||||
|
||||
// Set dialog object as main widget
|
||||
app.setMainWidget(&dgl);
|
||||
finalcut::FWidget::setMainWidget(&dgl);
|
||||
|
||||
// Show and start the application
|
||||
dgl.show();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2019 Markus Gans *
|
||||
* Copyright 2019-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -105,14 +105,14 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Callback lambda expressions
|
||||
auto cb_exit = \
|
||||
[] (finalcut::FWidget*, FDataPtr data)
|
||||
[] (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto a = static_cast<finalcut::FApplication*>(data);
|
||||
a->quit();
|
||||
};
|
||||
|
||||
auto cb_tooltip = \
|
||||
[] (finalcut::FWidget*, FDataPtr data)
|
||||
[] (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto a = static_cast<finalcut::FApplication*>(data);
|
||||
finalcut::FToolTip tooltip(a);
|
||||
|
@ -129,7 +129,7 @@ int main (int argc, char* argv[])
|
|||
key_F1.addCallback ("activate", cb_tooltip, &app);
|
||||
|
||||
// Set dialog object as main widget
|
||||
app.setMainWidget(&dgl);
|
||||
finalcut::FWidget::setMainWidget(&dgl);
|
||||
|
||||
// Show and start the application
|
||||
dgl.show();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -26,14 +26,14 @@ using finalcut::FPoint;
|
|||
using finalcut::FSize;
|
||||
|
||||
// function prototypes
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr);
|
||||
void cb_publish (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback functions
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
void cb_quit (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto app = static_cast<finalcut::FApplication*>(data);
|
||||
app->quit();
|
||||
|
@ -136,7 +136,7 @@ int main (int argc, char* argv[])
|
|||
);
|
||||
|
||||
// Set dialog object as main widget
|
||||
app.setMainWidget(&dgl);
|
||||
finalcut::FWidget::setMainWidget(&dgl);
|
||||
|
||||
// Show and start the application
|
||||
dgl.show();
|
||||
|
|
|
@ -104,7 +104,7 @@ int main (int argc, char* argv[])
|
|||
key.addAccelerator('q');
|
||||
|
||||
// Set the keyboard object as main widget
|
||||
app.setMainWidget(&key);
|
||||
finalcut::FWidget::setMainWidget(&key);
|
||||
|
||||
// Show and start the application
|
||||
key.show();
|
||||
|
|
|
@ -120,8 +120,8 @@ Listbox::Listbox (FWidget* parent)
|
|||
|
||||
// listbox 2
|
||||
//----------
|
||||
for (double i{1.0}; i <= 15.0; i++)
|
||||
double_list.push_back(2 * i + (i / 100));
|
||||
for (int i{1}; i <= 15; i++)
|
||||
double_list.push_back(2 * double(i) + (double(i) / 100));
|
||||
|
||||
list2.setGeometry(FPoint(21, 1), FSize(10, 10));
|
||||
list2.setText ("double");
|
||||
|
@ -189,7 +189,7 @@ int main (int argc, char* argv[])
|
|||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
app.setMainWidget(&d);
|
||||
finalcut::FWidget::setMainWidget(&d);
|
||||
|
||||
// Show and start the application
|
||||
d.show();
|
||||
|
|
|
@ -59,7 +59,7 @@ class Listview : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_showInMessagebox (finalcut::FWidget*, FDataPtr);
|
||||
void cb_showInMessagebox (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FListView listView{this};
|
||||
|
@ -187,7 +187,7 @@ void Listview::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Listview::cb_showInMessagebox (finalcut::FWidget*, FDataPtr)
|
||||
void Listview::cb_showInMessagebox (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
const auto& item = listView.getCurrentItem();
|
||||
finalcut::FMessageBox info ( "Weather in " + item->getText(1)
|
||||
|
@ -217,7 +217,7 @@ int main (int argc, char* argv[])
|
|||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
app.setMainWidget(&d);
|
||||
finalcut::FWidget::setMainWidget(&d);
|
||||
|
||||
// Show and start the application
|
||||
d.show();
|
||||
|
|
|
@ -84,13 +84,15 @@ void Mandelbrot::draw()
|
|||
|
||||
const double dX = (x_max - x_min) / (Cols - 1);
|
||||
const double dY = (y_max - y_min) / Lines;
|
||||
double y0 = y_min;
|
||||
|
||||
for (double y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
|
||||
while ( y0 < y_max && current_line < Lines )
|
||||
{
|
||||
current_line++;
|
||||
print() << FPoint(xoffset, yoffset + current_line);
|
||||
double x0 = x_min;
|
||||
|
||||
for (double x0 = x_min; x0 < x_max; x0 += dX)
|
||||
while ( x0 < x_max )
|
||||
{
|
||||
double x{0.0};
|
||||
double y{0.0};
|
||||
|
@ -110,7 +112,10 @@ void Mandelbrot::draw()
|
|||
setColor(fc::Black, 0);
|
||||
|
||||
print(' ');
|
||||
x0 += dX;
|
||||
}
|
||||
|
||||
y0 += dY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +170,7 @@ int main (int argc, char* argv[])
|
|||
mb.setShadow();
|
||||
|
||||
// Set the mandelbrot object as main widget
|
||||
app.setMainWidget(&mb);
|
||||
finalcut::FWidget::setMainWidget(&mb);
|
||||
|
||||
// Show and start the application
|
||||
mb.show();
|
||||
|
|
|
@ -54,14 +54,14 @@ class Menu : public finalcut::FDialog
|
|||
void configureColorMenuItems();
|
||||
void configureStyleMenuItems();
|
||||
void configureBorderMenuItems();
|
||||
void defaultCallback (finalcut::FMenuList*);
|
||||
void defaultCallback (const finalcut::FMenuList*);
|
||||
void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_message (finalcut::FWidget*, FDataPtr);
|
||||
void cb_message (finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FString line{13, fc::BoxDrawingsHorizontal};
|
||||
|
@ -258,7 +258,7 @@ void Menu::configureBorderMenuItems()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Menu::defaultCallback (finalcut::FMenuList* mb)
|
||||
void Menu::defaultCallback (const finalcut::FMenuList* mb)
|
||||
{
|
||||
for (uInt i{1}; i <= mb->getCount(); i++)
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ void Menu::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Menu::cb_message (finalcut::FWidget* widget, FDataPtr)
|
||||
void Menu::cb_message (finalcut::FWidget* widget, const FDataPtr)
|
||||
{
|
||||
const auto& menuitem = static_cast<finalcut::FMenuItem*>(widget);
|
||||
auto text = menuitem->getText();
|
||||
|
@ -330,7 +330,7 @@ int main (int argc, char* argv[])
|
|||
main_dlg.setShadow();
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget (&main_dlg);
|
||||
finalcut::FWidget::setMainWidget (&main_dlg);
|
||||
|
||||
// Show and start the application
|
||||
main_dlg.show();
|
||||
|
|
|
@ -345,7 +345,7 @@ class MouseDraw : public finalcut::FDialog
|
|||
void onMouseMove (finalcut::FMouseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_colorChanged (finalcut::FWidget*, FDataPtr);
|
||||
void cb_colorChanged (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FTermArea* canvas{nullptr};
|
||||
|
@ -493,7 +493,7 @@ void MouseDraw::drawCanvas()
|
|||
|
||||
for (int y{0}; y < y_end; y++) // line loop
|
||||
{
|
||||
finalcut::FChar* canvaschar{}; // canvas character
|
||||
const finalcut::FChar* canvaschar{}; // canvas character
|
||||
finalcut::FChar* winchar{}; // window character
|
||||
canvaschar = &canvas->data[y * x_end];
|
||||
winchar = &printarea->data[(ay + y) * w_line_len + ax];
|
||||
|
@ -514,7 +514,8 @@ void MouseDraw::drawCanvas()
|
|||
//----------------------------------------------------------------------
|
||||
void MouseDraw::adjustSize()
|
||||
{
|
||||
const std::size_t w{60}, h{18};
|
||||
const std::size_t w{60};
|
||||
const std::size_t h{18};
|
||||
const int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||
const int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||
setGeometry (FPoint(x, y), FSize(w, h), false);
|
||||
|
@ -550,7 +551,7 @@ void MouseDraw::onMouseMove (finalcut::FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MouseDraw::cb_colorChanged (finalcut::FWidget*, FDataPtr)
|
||||
void MouseDraw::cb_colorChanged (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
brush.setForeground (c_chooser.getForeground());
|
||||
brush.setBackground (c_chooser.getBackground());
|
||||
|
@ -571,7 +572,7 @@ int main (int argc, char* argv[])
|
|||
mouse_draw.setGeometry (FPoint(12, 4), FSize(60, 18));
|
||||
|
||||
// Set dialog object mouse_draw as main widget
|
||||
app.setMainWidget(&mouse_draw);
|
||||
finalcut::FWidget::setMainWidget(&mouse_draw);
|
||||
|
||||
// Show and start the application
|
||||
mouse_draw.show();
|
||||
|
|
|
@ -87,7 +87,11 @@ void term_boundaries (int& x, int& y)
|
|||
void move (int xold, int yold, int xnew, int ynew)
|
||||
{
|
||||
// Prints the cursor move escape sequence
|
||||
finalcut::FString buffer{}, sequence{}, from{}, to{}, byte{};
|
||||
finalcut::FString buffer{};
|
||||
finalcut::FString sequence{};
|
||||
finalcut::FString from{};
|
||||
finalcut::FString to{};
|
||||
finalcut::FString byte{};
|
||||
const std::string ctrl_character[] =
|
||||
{
|
||||
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
||||
|
@ -186,7 +190,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Show terminal speed and milliseconds for all cursor movement sequence
|
||||
std::cout << "\r" << line;
|
||||
const finalcut::FOptiMove& opti_move = *TermApp.getFTerm().getFOptiMove();
|
||||
const finalcut::FOptiMove& opti_move = *finalcut::FTerm::getFOptiMove();
|
||||
finalcut::printDurations(opti_move);
|
||||
|
||||
// Waiting for keypress
|
||||
|
|
|
@ -305,8 +305,7 @@ int main (int argc, char* argv[])
|
|||
benchmark = true;
|
||||
}
|
||||
|
||||
{
|
||||
// Create the application object
|
||||
{ // Create the application object in this scope
|
||||
finalcut::FApplication app(argc, argv);
|
||||
app.setNonBlockingRead();
|
||||
|
||||
|
@ -321,7 +320,7 @@ int main (int argc, char* argv[])
|
|||
roto.setShadow();
|
||||
|
||||
// Set the RotoZoomer object as main widget
|
||||
app.setMainWidget(&roto);
|
||||
finalcut::FWidget::setMainWidget(&roto);
|
||||
|
||||
// Show and start the application
|
||||
roto.show();
|
||||
|
@ -329,7 +328,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
if ( benchmark )
|
||||
report = roto.getReport();
|
||||
}
|
||||
} // Hide and destroy the application object
|
||||
|
||||
if ( benchmark )
|
||||
{
|
||||
|
|
|
@ -54,10 +54,10 @@ class Scrollview : public finalcut::FScrollView
|
|||
void draw() override;
|
||||
|
||||
// Callback methods
|
||||
void cb_goEast (finalcut::FWidget*, FDataPtr);
|
||||
void cb_goSouth (finalcut::FWidget*, FDataPtr);
|
||||
void cb_goWest (finalcut::FWidget*, FDataPtr);
|
||||
void cb_goNorth (finalcut::FWidget*, FDataPtr);
|
||||
void cb_goEast (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_goSouth (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_goWest (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_goNorth (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
wchar_t pointer_right{fc::BlackRightPointingPointer};
|
||||
|
@ -150,7 +150,7 @@ void Scrollview::draw()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_goEast (finalcut::FWidget*, FDataPtr)
|
||||
void Scrollview::cb_goEast (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
scrollToX (int(getScrollWidth() - getViewportWidth()) + 1);
|
||||
go_south.setFocus();
|
||||
|
@ -159,7 +159,7 @@ void Scrollview::cb_goEast (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_goSouth (finalcut::FWidget*, FDataPtr)
|
||||
void Scrollview::cb_goSouth (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
scrollToY (int(getScrollHeight() - getViewportHeight()) + 1);
|
||||
go_west.setFocus();
|
||||
|
@ -168,7 +168,7 @@ void Scrollview::cb_goSouth (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_goWest (finalcut::FWidget*, FDataPtr)
|
||||
void Scrollview::cb_goWest (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
scrollToX (1);
|
||||
go_north.setFocus();
|
||||
|
@ -177,7 +177,7 @@ void Scrollview::cb_goWest (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_goNorth (finalcut::FWidget*, FDataPtr)
|
||||
void Scrollview::cb_goNorth (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
scrollToY (1);
|
||||
go_east.setFocus();
|
||||
|
@ -203,7 +203,7 @@ class Scrollviewdemo : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_quit (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
void cb_quit (const finalcut::FWidget* = nullptr, const FDataPtr = nullptr);
|
||||
|
||||
// Data members
|
||||
Scrollview sview{this};
|
||||
|
@ -244,7 +244,7 @@ Scrollviewdemo::~Scrollviewdemo()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollviewdemo::cb_quit (finalcut::FWidget*, FDataPtr)
|
||||
void Scrollviewdemo::cb_quit (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ int main (int argc, char* argv[])
|
|||
Scrollviewdemo svdemo(&app);
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget(&svdemo);
|
||||
finalcut::FWidget::setMainWidget(&svdemo);
|
||||
|
||||
// Show and start the application
|
||||
svdemo.show();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* Copyright 2012-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -455,7 +455,8 @@ void stringSplittingExample()
|
|||
std::cout << " split: \""
|
||||
<< split_str << "\" into substrings ->";
|
||||
finalcut::FStringList parts{ split_str.split(",") };
|
||||
finalcut::FStringList::iterator it, end;
|
||||
finalcut::FStringList::iterator it;
|
||||
finalcut::FStringList::iterator end;
|
||||
end = parts.end();
|
||||
|
||||
for (it = parts.begin(); it != end; ++it)
|
||||
|
@ -533,8 +534,10 @@ void convertToNumberExample()
|
|||
void convertNumberToStringExample()
|
||||
{
|
||||
// Test: convert integer and double value to a string
|
||||
finalcut::FString num1{}, num2{}, num3{};
|
||||
num1.setNumber(137u);
|
||||
finalcut::FString num1{};
|
||||
finalcut::FString num2{};
|
||||
finalcut::FString num3{};
|
||||
num1.setNumber(137U);
|
||||
num2.setNumber(-512);
|
||||
num3.setNumber(3.141592653589793238L, 12);
|
||||
std::cout << " setNumber: "
|
||||
|
@ -550,14 +553,15 @@ void formatedNumberExample()
|
|||
{
|
||||
// Test: convert and format a integer number with thousand separator
|
||||
std::setlocale (LC_NUMERIC, "");
|
||||
finalcut::FString fnum1{}, fnum2{};
|
||||
finalcut::FString fnum1{};
|
||||
finalcut::FString fnum2{};
|
||||
#if defined(__LP64__) || defined(_LP64)
|
||||
// 64-bit architecture
|
||||
fnum1.setFormatedNumber(0xffffffffffffffffu, '\'');
|
||||
fnum1.setFormatedNumber(0xffffffffffffffffU, '\'');
|
||||
fnum2.setFormatedNumber(-9223372036854775807);
|
||||
#else
|
||||
// 32-bit architecture
|
||||
fnum1.setFormatedNumber(0xffffffffu, '\'');
|
||||
fnum1.setFormatedNumber(0xffffffffU, '\'');
|
||||
fnum2.setFormatedNumber(-2147483647);
|
||||
#endif
|
||||
std::cout << "setFormatedNumber: "
|
||||
|
|
|
@ -49,23 +49,24 @@ class AttribDlg : public finalcut::FDialog
|
|||
// Disable assignment operator (=)
|
||||
AttribDlg& operator = (const AttribDlg&) = delete;
|
||||
|
||||
// Methods
|
||||
FColor getBGColor();
|
||||
|
||||
// Event handlers
|
||||
void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
void onWheel (finalcut::FWheelEvent*) override;
|
||||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_next (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
void cb_back (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
|
||||
// Data members
|
||||
FColor bgcolor;
|
||||
void cb_next (const finalcut::FWidget* = nullptr, const FDataPtr = nullptr);
|
||||
void cb_back (const finalcut::FWidget* = nullptr, const FDataPtr = nullptr);
|
||||
|
||||
private:
|
||||
// Method
|
||||
void adjustSize() override;
|
||||
|
||||
// Data members
|
||||
FColor bgcolor;
|
||||
finalcut::FButton next_button{"&Next >", this};
|
||||
finalcut::FButton back_button{"< &Back", this};
|
||||
};
|
||||
|
@ -104,6 +105,12 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
|||
AttribDlg::~AttribDlg()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FColor AttribDlg::getBGColor()
|
||||
{
|
||||
return bgcolor;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::onKeyPress (finalcut::FKeyEvent* ev)
|
||||
{
|
||||
|
@ -137,7 +144,7 @@ void AttribDlg::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::cb_next (finalcut::FWidget*, FDataPtr)
|
||||
void AttribDlg::cb_next (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return;
|
||||
|
@ -153,7 +160,7 @@ void AttribDlg::cb_next (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::cb_back (finalcut::FWidget*, FDataPtr)
|
||||
void AttribDlg::cb_back (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return;
|
||||
|
@ -255,7 +262,7 @@ void AttribDemo::printColorLine()
|
|||
|
||||
for (FColor color{0}; color < last_color; color++)
|
||||
{
|
||||
print() << FColorPair(color, parent->bgcolor) << " # ";
|
||||
print() << FColorPair(color, parent->getBGColor()) << " # ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,19 +277,19 @@ void AttribDemo::printAltCharset()
|
|||
|
||||
print() << FPoint(1, 1) << "alternate charset: ";
|
||||
|
||||
if ( parent->bgcolor == fc::Default )
|
||||
if ( parent->getBGColor() == fc::Default )
|
||||
{
|
||||
setColor (fc::Default, fc::Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (parent->bgcolor <= 8)
|
||||
|| (parent->bgcolor >= 16 && parent->bgcolor <= 231
|
||||
&& (parent->bgcolor - 16) % 36 <= 17)
|
||||
|| (parent->bgcolor >= 232 && parent->bgcolor <= 243) )
|
||||
setColor (fc::White, parent->bgcolor);
|
||||
if ( (parent->getBGColor() <= 8)
|
||||
|| (parent->getBGColor() >= 16 && parent->getBGColor() <= 231
|
||||
&& (parent->getBGColor() - 16) % 36 <= 17)
|
||||
|| (parent->getBGColor() >= 232 && parent->getBGColor() <= 243) )
|
||||
setColor (fc::White, parent->getBGColor());
|
||||
else
|
||||
setColor (fc::Black, parent->bgcolor);
|
||||
setColor (fc::Black, parent->getBGColor());
|
||||
}
|
||||
|
||||
setAltCharset();
|
||||
|
@ -448,7 +455,7 @@ void AttribDemo::draw()
|
|||
setColor(wc.label_fg, wc.label_bg);
|
||||
|
||||
print() << FPoint(1, 15);
|
||||
const FColor bg = static_cast<AttribDlg*>(getParent())->bgcolor;
|
||||
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
|
||||
print (" Background color:");
|
||||
|
||||
if ( bg == fc::Default )
|
||||
|
@ -481,7 +488,7 @@ int main (int argc, char* argv[])
|
|||
demo.setGeometry (FPoint(1, 1), FSize(67, 19));
|
||||
|
||||
// Set the dialog object as main widget
|
||||
app.setMainWidget(&dialog);
|
||||
finalcut::FWidget::setMainWidget(&dialog);
|
||||
|
||||
// Show and start the application
|
||||
dialog.show();
|
||||
|
|
|
@ -110,7 +110,7 @@ int main (int argc, char* argv[])
|
|||
t.addAccelerator('q');
|
||||
|
||||
// Set the timer object t as main widget
|
||||
app.setMainWidget(&t);
|
||||
finalcut::FWidget::setMainWidget(&t);
|
||||
|
||||
// Show and start the application
|
||||
t.show();
|
||||
|
|
|
@ -282,7 +282,7 @@ int main (int argc, char* argv[])
|
|||
main_dlg.setGeometry (FPoint(8, 16), FSize(26, 7));
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget (&main_dlg);
|
||||
finalcut::FWidget::setMainWidget (&main_dlg);
|
||||
|
||||
// Show and start the application
|
||||
main_dlg.show();
|
||||
|
|
|
@ -335,7 +335,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
|
||||
for (const auto& continent : continent_list)
|
||||
{
|
||||
TreeItem* country_list = continent.child_element;
|
||||
const TreeItem* country_list = continent.child_element;
|
||||
finalcut::FStringList continent_line ( continent.begin()
|
||||
, continent.end() );
|
||||
auto iter = listView.insert (continent_line);
|
||||
|
@ -412,7 +412,7 @@ int main (int argc, char* argv[])
|
|||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
app.setMainWidget(&d);
|
||||
finalcut::FWidget::setMainWidget(&d);
|
||||
|
||||
// Show and start the application
|
||||
d.show();
|
||||
|
|
|
@ -59,9 +59,9 @@ class ProgressDialog : public finalcut::FDialog
|
|||
void onTimer (finalcut::FTimerEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_reset_bar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_more_bar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_exit_bar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_reset_bar (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_more_bar (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_exit_bar (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FProgressbar progressBar{this};
|
||||
|
@ -158,20 +158,20 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_reset_bar (finalcut::FWidget*, FDataPtr)
|
||||
void ProgressDialog::cb_reset_bar (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
progressBar.reset();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, FDataPtr)
|
||||
void ProgressDialog::cb_more_bar (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
auto p = progressBar.getPercentage();
|
||||
progressBar.setPercentage(++p);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_exit_bar (finalcut::FWidget*, FDataPtr)
|
||||
void ProgressDialog::cb_exit_bar (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
@ -283,20 +283,20 @@ class MyDialog : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_noFunctionMsg (finalcut::FWidget*, FDataPtr);
|
||||
void cb_about (finalcut::FWidget*, FDataPtr);
|
||||
void cb_terminfo (finalcut::FWidget*, FDataPtr);
|
||||
void cb_drives (finalcut::FWidget*, FDataPtr);
|
||||
void cb_cutClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_copyClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_pasteClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_clearInput (finalcut::FWidget*, FDataPtr);
|
||||
void cb_noFunctionMsg (finalcut::FWidget*, const FDataPtr);
|
||||
void cb_about (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_terminfo (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_drives (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_cutClipboard (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_copyClipboard (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_pasteClipboard (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_clearInput (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_input2buttonText (finalcut::FWidget*, FDataPtr);
|
||||
void cb_setTitlebar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_showProgressBar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_setTitlebar (finalcut::FWidget*, const FDataPtr);
|
||||
void cb_showProgressBar (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_updateNumber (finalcut::FWidget*, FDataPtr);
|
||||
void cb_activateButton (finalcut::FWidget*, FDataPtr);
|
||||
void cb_view (finalcut::FWidget*, FDataPtr);
|
||||
void cb_view (const finalcut::FWidget*, FDataPtr);
|
||||
void cb_setInput (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data members
|
||||
|
@ -760,7 +760,7 @@ void MyDialog::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, FDataPtr)
|
||||
void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, const FDataPtr)
|
||||
{
|
||||
auto& button = *(static_cast<finalcut::FButton*>(widget));
|
||||
auto text = button.getText();
|
||||
|
@ -771,14 +771,14 @@ void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_about (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_about (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
constexpr char libver[] = F_VERSION;
|
||||
const finalcut::FString line(2, fc::BoxDrawingsHorizontal);
|
||||
|
||||
finalcut::FMessageBox info ( "About"
|
||||
, line + L" The Final Cut " + line + "\n\n"
|
||||
L"Version " + libver + "\n\n"
|
||||
, line + L" The Final Cut " + line + L"\n\n"
|
||||
L"Version " + libver + L"\n\n"
|
||||
L"(c) 2020 by Markus Gans"
|
||||
, finalcut::FMessageBox::Ok, 0, 0, this );
|
||||
info.setCenterText();
|
||||
|
@ -786,7 +786,7 @@ void MyDialog::cb_about (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_terminfo (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_terminfo (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
const auto x = getDesktopWidth();
|
||||
const auto y = getDesktopHeight();
|
||||
|
@ -807,7 +807,7 @@ void MyDialog::cb_terminfo (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_drives (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_drives (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
finalcut::FMessageBox info2 \
|
||||
(
|
||||
|
@ -858,7 +858,7 @@ void MyDialog::cb_drives (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_cutClipboard (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_cutClipboard (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
clipboard = myLineEdit.getText();
|
||||
myLineEdit.clear();
|
||||
|
@ -866,20 +866,20 @@ void MyDialog::cb_cutClipboard (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_copyClipboard (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_copyClipboard (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
clipboard = myLineEdit.getText();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_pasteClipboard (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_pasteClipboard (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
myLineEdit = clipboard;
|
||||
myLineEdit.redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_clearInput (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_clearInput (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
clipboard.clear();
|
||||
myLineEdit.clear();
|
||||
|
@ -896,7 +896,7 @@ void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, FDataPtr)
|
||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, const FDataPtr)
|
||||
{
|
||||
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(widget));
|
||||
finalcut::FString title;
|
||||
|
@ -907,7 +907,7 @@ void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_showProgressBar (finalcut::FWidget*, FDataPtr)
|
||||
void MyDialog::cb_showProgressBar (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
auto p_dgl = new ProgressDialog(this);
|
||||
p_dgl->show();
|
||||
|
@ -945,7 +945,7 @@ void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_view (finalcut::FWidget*, FDataPtr data)
|
||||
void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
finalcut::FString file;
|
||||
const auto& item = static_cast<finalcut::FMenuItem*>(data);
|
||||
|
@ -1026,7 +1026,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Set the dialog object d as the main widget of the application.
|
||||
// When you close the main widget, the application will be closed.
|
||||
app.setMainWidget(&d);
|
||||
finalcut::FWidget::setMainWidget(&d);
|
||||
|
||||
// Show the dialog d
|
||||
d.show();
|
||||
|
|
|
@ -54,8 +54,8 @@ class Watch : public finalcut::FDialog
|
|||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_clock (finalcut::FWidget*, FDataPtr);
|
||||
void cb_seconds (finalcut::FWidget*, FDataPtr);
|
||||
void cb_clock (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_seconds (const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
protected:
|
||||
// Method
|
||||
|
@ -77,7 +77,7 @@ Watch::Watch (FWidget* parent)
|
|||
{
|
||||
setText ("Watch");
|
||||
const int pw = int(getParentWidget()->getWidth());
|
||||
setGeometry (FPoint(1 + (pw - 22) / 2, 3), FSize(22, 13));
|
||||
FDialog::setGeometry (FPoint(1 + (pw - 22) / 2, 3), FSize(22, 13));
|
||||
|
||||
// Labels
|
||||
time_label.setGeometry(FPoint(5, 2), FSize(5, 1));
|
||||
|
@ -116,9 +116,7 @@ Watch::Watch (FWidget* parent)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
Watch::~Watch()
|
||||
{
|
||||
delOwnTimer();
|
||||
}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Watch::printTime()
|
||||
|
@ -151,7 +149,7 @@ void Watch::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Watch::cb_clock (finalcut::FWidget*, FDataPtr)
|
||||
void Watch::cb_clock (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( clock_sw.isChecked() )
|
||||
{
|
||||
|
@ -167,7 +165,7 @@ void Watch::cb_clock (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Watch::cb_seconds (finalcut::FWidget*, FDataPtr)
|
||||
void Watch::cb_seconds (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( seconds_sw.isChecked() )
|
||||
sec = true;
|
||||
|
@ -207,7 +205,7 @@ int main (int argc, char* argv[])
|
|||
Watch w(&app);
|
||||
|
||||
// Set dialog w as main widget
|
||||
app.setMainWidget(&w);
|
||||
finalcut::FWidget::setMainWidget(&w);
|
||||
|
||||
// Show and start the application
|
||||
w.show();
|
||||
|
|
|
@ -107,10 +107,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
SmallWindow::~SmallWindow()
|
||||
{
|
||||
// Remove own timer
|
||||
delOwnTimer();
|
||||
}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void SmallWindow::adjustSize()
|
||||
|
@ -180,8 +177,8 @@ class Window : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef void (Window::*WindowCallback)(finalcut::FWidget*, FDataPtr);
|
||||
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, FDataPtr);
|
||||
typedef void (Window::*WindowCallback)(const finalcut::FWidget*, const FDataPtr);
|
||||
typedef void (finalcut::FApplication::*FAppCallback)(const finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
struct win_data
|
||||
{
|
||||
|
@ -206,16 +203,20 @@ class Window : public finalcut::FDialog
|
|||
void adjustSize() override;
|
||||
void addClickedCallback (finalcut::FWidget*, WindowCallback);
|
||||
void addClickedCallback (finalcut::FWidget*, FAppCallback);
|
||||
template <typename IteratorT>
|
||||
finalcut::FDialog* getNext (IteratorT);
|
||||
template <typename IteratorT>
|
||||
finalcut::FDialog* getPrevious (IteratorT iter);
|
||||
|
||||
// Event handlers
|
||||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_createWindows (finalcut::FWidget*, FDataPtr);
|
||||
void cb_closeWindows (finalcut::FWidget*, FDataPtr);
|
||||
void cb_next (finalcut::FWidget*, FDataPtr);
|
||||
void cb_previous (finalcut::FWidget*, FDataPtr);
|
||||
void cb_destroyWindow (finalcut::FWidget*, FDataPtr);
|
||||
void cb_createWindows (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_closeWindows (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_next (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_previous (const finalcut::FWidget*, const FDataPtr);
|
||||
void cb_destroyWindow (const finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data members
|
||||
std::vector<win_data*> windows{};
|
||||
|
@ -399,6 +400,51 @@ void Window::addClickedCallback ( finalcut::FWidget* widget
|
|||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename IteratorT>
|
||||
finalcut::FDialog* Window::getNext (IteratorT iter)
|
||||
{
|
||||
auto next_element = iter;
|
||||
finalcut::FDialog* next{nullptr};
|
||||
|
||||
do
|
||||
{
|
||||
++next_element;
|
||||
|
||||
if ( next_element == getDialogList()->end() )
|
||||
next_element = getDialogList()->begin();
|
||||
|
||||
next = static_cast<finalcut::FDialog*>(*next_element);
|
||||
} while ( ! next->isEnabled()
|
||||
|| ! next->acceptFocus()
|
||||
|| ! next->isVisible()
|
||||
|| ! next->isWindowWidget() );
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename IteratorT>
|
||||
finalcut::FDialog* Window::getPrevious (IteratorT iter)
|
||||
{
|
||||
auto prev_element = iter;
|
||||
finalcut::FDialog* prev;
|
||||
|
||||
do
|
||||
{
|
||||
if ( prev_element == getDialogList()->begin() )
|
||||
prev_element = getDialogList()->end();
|
||||
|
||||
--prev_element;
|
||||
prev = static_cast<finalcut::FDialog*>(*prev_element);
|
||||
} while ( ! prev->isEnabled()
|
||||
|| ! prev->acceptFocus()
|
||||
|| ! prev->isVisible()
|
||||
|| ! prev->isWindowWidget() );
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::onClose (finalcut::FCloseEvent* ev)
|
||||
{
|
||||
|
@ -406,7 +452,7 @@ void Window::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
|
||||
void Window::cb_createWindows (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
const auto& first = windows.begin();
|
||||
auto iter = first;
|
||||
|
@ -447,7 +493,7 @@ void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
||||
void Window::cb_closeWindows (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( ! getDialogList() || getDialogList()->empty() )
|
||||
return;
|
||||
|
@ -467,7 +513,7 @@ void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
||||
void Window::cb_next (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( ! getDialogList() || getDialogList()->empty() )
|
||||
return;
|
||||
|
@ -478,23 +524,7 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
|||
{
|
||||
if ( static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
||||
{
|
||||
finalcut::FDialog* next;
|
||||
auto next_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
++next_element;
|
||||
|
||||
if ( next_element == getDialogList()->end() )
|
||||
next_element = getDialogList()->begin();
|
||||
|
||||
next = static_cast<finalcut::FDialog*>(*next_element);
|
||||
} while ( ! next->isEnabled()
|
||||
|| ! next->acceptFocus()
|
||||
|| ! next->isVisible()
|
||||
|| ! next->isWindowWidget() );
|
||||
|
||||
activateWindow(next);
|
||||
activateWindow(getNext(iter));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -503,7 +533,7 @@ void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
||||
void Window::cb_previous (const finalcut::FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( ! getDialogList() || getDialogList()->empty() )
|
||||
return;
|
||||
|
@ -517,22 +547,7 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
|||
if ( (*iter)->isDialogWidget()
|
||||
&& static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
||||
{
|
||||
finalcut::FDialog* prev;
|
||||
auto prev_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
if ( prev_element == getDialogList()->begin() )
|
||||
prev_element = getDialogList()->end();
|
||||
|
||||
--prev_element;
|
||||
prev = static_cast<finalcut::FDialog*>(*prev_element);
|
||||
} while ( ! prev->isEnabled()
|
||||
|| ! prev->acceptFocus()
|
||||
|| ! prev->isVisible()
|
||||
|| ! prev->isWindowWidget() );
|
||||
|
||||
activateWindow(prev);
|
||||
activateWindow(getPrevious(iter));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +555,7 @@ void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_destroyWindow (finalcut::FWidget*, FDataPtr data)
|
||||
void Window::cb_destroyWindow (const finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto win_dat = static_cast<win_data*>(data);
|
||||
|
||||
|
@ -568,7 +583,7 @@ int main (int argc, char* argv[])
|
|||
, FSize(40, 6) );
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget (&main_dlg);
|
||||
finalcut::FWidget::setMainWidget (&main_dlg);
|
||||
|
||||
// Show and start the application
|
||||
main_dlg.show();
|
||||
|
|
|
@ -77,7 +77,7 @@ FApplication::FApplication ( const int& _argc
|
|||
{
|
||||
if ( app_object )
|
||||
{
|
||||
auto ftermdata = getFTerm().getFTermData();
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage("FApplication: There should be "
|
||||
"only one application object");
|
||||
FApplication::exit(EXIT_FAILURE);
|
||||
|
@ -625,7 +625,7 @@ inline void FApplication::sendEscapeKeyPressEvent()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FApplication::sendKeyDownEvent (FWidget* widget)
|
||||
inline bool FApplication::sendKeyDownEvent (const FWidget* widget)
|
||||
{
|
||||
// Send key down event
|
||||
FKeyEvent k_down_ev (fc::KeyDown_Event, keyboard->getKey());
|
||||
|
@ -634,7 +634,7 @@ inline bool FApplication::sendKeyDownEvent (FWidget* widget)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FApplication::sendKeyPressEvent (FWidget* widget)
|
||||
inline bool FApplication::sendKeyPressEvent (const FWidget* widget)
|
||||
{
|
||||
// Send key press event
|
||||
FKeyEvent k_press_ev (fc::KeyPress_Event, keyboard->getKey());
|
||||
|
@ -643,7 +643,7 @@ inline bool FApplication::sendKeyPressEvent (FWidget* widget)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FApplication::sendKeyUpEvent (FWidget* widget)
|
||||
inline bool FApplication::sendKeyUpEvent (const FWidget* widget)
|
||||
{
|
||||
// Send key up event
|
||||
FKeyEvent k_up_ev (fc::KeyUp_Event, keyboard->getKey());
|
||||
|
|
|
@ -206,7 +206,8 @@ void FButton::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::hide()
|
||||
{
|
||||
FColor fg{}, bg{};
|
||||
FColor fg{};
|
||||
FColor bg{};
|
||||
auto parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
|
||||
|
@ -412,7 +413,7 @@ inline void FButton::detectHotkey()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
||||
inline std::size_t FButton::clickAnimationIndent (const FWidget* parent_widget)
|
||||
{
|
||||
if ( ! button_down || ! click_animation )
|
||||
return 0;
|
||||
|
@ -436,7 +437,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FButton::clearRightMargin (FWidget* parent_widget)
|
||||
inline void FButton::clearRightMargin (const FWidget* parent_widget)
|
||||
{
|
||||
if ( button_down || isNewFont() )
|
||||
return;
|
||||
|
@ -547,8 +548,7 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
|||
setBold();
|
||||
|
||||
for ( std::size_t z{0}, columns{0}
|
||||
; pos < center_offset + column_width && columns + 2 < getWidth()
|
||||
; z++)
|
||||
; pos < center_offset + column_width && columns + 2 < getWidth(); )
|
||||
{
|
||||
if ( z == hotkeypos && getFlags().active )
|
||||
{
|
||||
|
@ -575,9 +575,10 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
|||
print (button_text[z]);
|
||||
}
|
||||
|
||||
const auto char_width = getColumnWidth (button_text[z]);
|
||||
const auto char_width = getColumnWidth(button_text[z]);
|
||||
columns += char_width;
|
||||
pos += char_width;
|
||||
z++;
|
||||
}
|
||||
|
||||
if ( column_width + 1 >= getWidth() )
|
||||
|
|
|
@ -174,7 +174,8 @@ bool FButtonGroup::hasCheckedButton() const
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::hide()
|
||||
{
|
||||
FColor fg{}, bg{};
|
||||
FColor fg{};
|
||||
FColor bg{};
|
||||
FWidget::hide();
|
||||
const auto& parent_widget = getParentWidget();
|
||||
|
||||
|
@ -268,7 +269,7 @@ void FButtonGroup::remove (FToggleButton* button)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::checkScrollSize (FToggleButton* button)
|
||||
void FButtonGroup::checkScrollSize (const FToggleButton* button)
|
||||
{
|
||||
// Check and adjust the scroll size
|
||||
|
||||
|
@ -544,7 +545,7 @@ void FButtonGroup::directFocus()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, FDataPtr)
|
||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, const FDataPtr)
|
||||
{
|
||||
const auto& button = static_cast<FToggleButton*>(widget);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* Copyright 2018-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -34,7 +34,7 @@ FColorPalette::~FColorPalette() // destructor
|
|||
|
||||
// public methods of FColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::set8ColorPalette (funcp setPalette)
|
||||
void FColorPalette::set8ColorPalette (func setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
|
||||
|
@ -56,7 +56,7 @@ void FColorPalette::set8ColorPalette (funcp setPalette)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::set16ColorPalette (funcp setPalette)
|
||||
void FColorPalette::set16ColorPalette (func setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
|
||||
|
@ -77,13 +77,13 @@ void FColorPalette::set16ColorPalette (funcp setPalette)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::reset8ColorPalette (funcp setPalette)
|
||||
void FColorPalette::reset8ColorPalette (func setPalette)
|
||||
{
|
||||
reset16ColorPalette(setPalette);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::reset16ColorPalette (funcp setPalette)
|
||||
void FColorPalette::reset16ColorPalette (func setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x00, 0x00, 0xaa);
|
||||
|
|
|
@ -51,9 +51,7 @@ FDropDownListBox::FDropDownListBox (FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FDropDownListBox::~FDropDownListBox() // destructor
|
||||
{
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( fapp->isQuit() )
|
||||
if ( FApplication::isQuit() )
|
||||
return;
|
||||
|
||||
FWindow* parent_win{nullptr};
|
||||
|
@ -540,7 +538,7 @@ void FComboBox::draw()
|
|||
{
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
const FColorPair button_color = [&] () -> FColorPair
|
||||
const FColorPair button_color = [&] ()
|
||||
{
|
||||
if ( list_window.isEmpty() )
|
||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
||||
|
@ -630,7 +628,7 @@ void FComboBox::processChanged()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FComboBox::cb_setInputField (FWidget*, FDataPtr)
|
||||
void FComboBox::cb_setInputField (const FWidget*, const FDataPtr)
|
||||
{
|
||||
auto& list = list_window.list;
|
||||
const std::size_t index = list.currentItem();
|
||||
|
@ -640,14 +638,14 @@ void FComboBox::cb_setInputField (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FComboBox::cb_closeComboBox (FWidget*, FDataPtr)
|
||||
void FComboBox::cb_closeComboBox (const FWidget*, const FDataPtr)
|
||||
{
|
||||
hideDropDown();
|
||||
processClick();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FComboBox::cb_inputFieldSwitch (FWidget*, FDataPtr)
|
||||
void FComboBox::cb_inputFieldSwitch (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const auto& mouse = getFMouseControl();
|
||||
|
||||
|
@ -679,7 +677,7 @@ void FComboBox::cb_inputFieldSwitch (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FComboBox::cb_inputFieldHandOver (FWidget*, FDataPtr)
|
||||
void FComboBox::cb_inputFieldHandOver (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const auto& mouse = getFMouseControl();
|
||||
|
||||
|
|
|
@ -58,12 +58,10 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FDialog::~FDialog() // destructor
|
||||
{
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
const bool is_quit = fapp->isQuit();
|
||||
delete dialog_menu;
|
||||
dgl_menuitem = nullptr;
|
||||
|
||||
if ( ! is_quit )
|
||||
if ( ! FApplication::isQuit() )
|
||||
switchToPrevWindow(this);
|
||||
|
||||
delDialog(this);
|
||||
|
@ -1349,7 +1347,7 @@ inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::passEventToSubMenu ( const mouseStates& ms
|
||||
, FMouseEvent* ev )
|
||||
, const FMouseEvent* ev )
|
||||
{
|
||||
// Mouse event handover to the dialog menu
|
||||
if ( ! ms.mouse_over_menu
|
||||
|
@ -1532,7 +1530,8 @@ void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
|||
|
||||
if ( ms.termPos != getTermGeometry().getLowerRightPos() )
|
||||
{
|
||||
int w{}, h{};
|
||||
int w{};
|
||||
int h{};
|
||||
const FPoint deltaPos(ms.termPos - resize_click_pos);
|
||||
|
||||
if ( x2 - x2_offset <= int(getMaxWidth()) )
|
||||
|
@ -1613,7 +1612,7 @@ void FDialog::addDialog (FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::delDialog (FWidget* obj)
|
||||
void FDialog::delDialog (const FWidget* obj)
|
||||
{
|
||||
// Delete the dialog object obj from the dialog list
|
||||
if ( ! getDialogList() || getDialogList()->empty() )
|
||||
|
@ -1634,7 +1633,7 @@ void FDialog::delDialog (FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_move (FWidget*, FDataPtr)
|
||||
void FDialog::cb_move (const FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( isZoomed() )
|
||||
return;
|
||||
|
@ -1685,7 +1684,7 @@ void FDialog::cb_move (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_zoom (FWidget*, FDataPtr)
|
||||
void FDialog::cb_zoom (const FWidget*, const FDataPtr)
|
||||
{
|
||||
dialog_menu->unselectItem();
|
||||
dialog_menu->hide();
|
||||
|
@ -1696,7 +1695,7 @@ void FDialog::cb_zoom (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_close (FWidget*, FDataPtr)
|
||||
void FDialog::cb_close (const FWidget*, const FDataPtr)
|
||||
{
|
||||
dialog_menu->unselectItem();
|
||||
dialog_menu->hide();
|
||||
|
|
|
@ -280,7 +280,8 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::adjustSize()
|
||||
{
|
||||
std::size_t max_width{}, max_height{};
|
||||
std::size_t max_width{};
|
||||
std::size_t max_height{};
|
||||
const auto& root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
|
@ -322,7 +323,8 @@ void FFileDialog::init()
|
|||
{
|
||||
static constexpr std::size_t w = 42;
|
||||
static constexpr std::size_t h = 15;
|
||||
int x{}, y{};
|
||||
int x{};
|
||||
int y{};
|
||||
|
||||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
@ -417,7 +419,7 @@ void FFileDialog::initCallbacks()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FFileDialog::pattern_match ( const char* const pattern
|
||||
, char fname[] )
|
||||
, const char fname[] )
|
||||
{
|
||||
char search[128]{};
|
||||
|
||||
|
@ -557,7 +559,7 @@ int FFileDialog::readDir()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::getEntry (const char* const dir, struct dirent* d_entry)
|
||||
void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry)
|
||||
{
|
||||
const char* const filter = filter_pattern.c_str();
|
||||
dir_entry entry{};
|
||||
|
@ -759,7 +761,7 @@ const FString FFileDialog::getHomeDir()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processActivate (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processActivate (const FWidget*, const FDataPtr)
|
||||
{
|
||||
if ( filename.getText().includes('*')
|
||||
|| filename.getText().includes('?') )
|
||||
|
@ -808,7 +810,7 @@ void FFileDialog::cb_processActivate (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processRowChanged (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processRowChanged (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const std::size_t n = filebrowser.currentItem();
|
||||
|
||||
|
@ -826,7 +828,7 @@ void FFileDialog::cb_processRowChanged (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processClicked (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processClicked (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const uLong n = uLong(filebrowser.currentItem() - 1);
|
||||
|
||||
|
@ -837,19 +839,19 @@ void FFileDialog::cb_processClicked (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processCancel (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processCancel (const FWidget*, const FDataPtr)
|
||||
{
|
||||
done (FDialog::Reject);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processOpen (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processOpen (const FWidget*, const FDataPtr)
|
||||
{
|
||||
done (FDialog::Accept);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processShowHidden (FWidget*, FDataPtr)
|
||||
void FFileDialog::cb_processShowHidden (const FWidget*, const FDataPtr)
|
||||
{
|
||||
setShowHiddenFiles(! show_hidden);
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ void FLabel::onAccel (FAccelEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FLabel::cb_accelWidgetDestroyed (FWidget*, FDataPtr)
|
||||
void FLabel::cb_accelWidgetDestroyed (const FWidget*, const FDataPtr)
|
||||
{
|
||||
accel_widget = nullptr;
|
||||
delAccelerator();
|
||||
|
|
|
@ -1181,7 +1181,8 @@ void FListBox::multiSelection (std::size_t pos)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::multiSelectionUpTo (std::size_t pos)
|
||||
{
|
||||
std::size_t from{}, to{};
|
||||
std::size_t from{};
|
||||
std::size_t to{};
|
||||
|
||||
if ( ! isMultiSelection() )
|
||||
return;
|
||||
|
@ -1745,7 +1746,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::cb_vbarChange (FWidget*, FDataPtr)
|
||||
void FListBox::cb_vbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType;
|
||||
const std::size_t current_before = current;
|
||||
|
@ -1808,7 +1809,7 @@ void FListBox::cb_vbarChange (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::cb_hbarChange (FWidget*, FDataPtr)
|
||||
void FListBox::cb_hbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
|
|
@ -482,6 +482,10 @@ void FListViewItem::resetVisibleLineCounter()
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
// constructor and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FListViewIterator::FListViewIterator()
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListViewIterator::FListViewIterator (iterator iter)
|
||||
: node(iter)
|
||||
|
@ -1456,7 +1460,7 @@ FObject::iterator& FListView::getNullIterator()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::setNullIterator (iterator& null_iter)
|
||||
void FListView::setNullIterator (const iterator& null_iter)
|
||||
{
|
||||
getNullIterator() = null_iter;
|
||||
}
|
||||
|
@ -1559,7 +1563,7 @@ std::size_t FListView::getAlignOffset ( const fc::text_alignment align
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FObject::iterator FListView::getListEnd (FListViewItem* item)
|
||||
FObject::iterator FListView::getListEnd (const FListViewItem* item)
|
||||
{
|
||||
auto parent = item->getParent();
|
||||
|
||||
|
@ -2028,7 +2032,8 @@ void FListView::drawBufferedHeadline()
|
|||
std::size_t offset{0};
|
||||
bool left_truncated_fullwidth{false};
|
||||
bool right_truncated_fullwidth{false};
|
||||
std::vector<FChar>::const_iterator first{}, last{};
|
||||
std::vector<FChar>::const_iterator first{};
|
||||
std::vector<FChar>::const_iterator last{};
|
||||
last = headerline.end();
|
||||
|
||||
// Search for the start position
|
||||
|
@ -2800,7 +2805,7 @@ void FListView::scrollBy (int dx, int dy)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::cb_vbarChange (FWidget*, FDataPtr)
|
||||
void FListView::cb_vbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
@ -2859,7 +2864,7 @@ void FListView::cb_vbarChange (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::cb_hbarChange (FWidget*, FDataPtr)
|
||||
void FListView::cb_hbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
|
|
@ -60,9 +60,7 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FMenu::~FMenu() // destructor
|
||||
{
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( ! fapp->isQuit() )
|
||||
if ( ! FApplication::isQuit() )
|
||||
switchToPrevWindow(this); // Switch to previous window
|
||||
}
|
||||
|
||||
|
@ -319,7 +317,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::cb_menuitemToggled (FWidget* widget, FDataPtr)
|
||||
void FMenu::cb_menuitemToggled (FWidget* widget, const FDataPtr)
|
||||
{
|
||||
const auto& m_item = static_cast<FMenuItem*>(widget);
|
||||
|
||||
|
@ -678,7 +676,7 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::mouseDownSubmenu (FMenuItem* m_item)
|
||||
void FMenu::mouseDownSubmenu (const FMenuItem* m_item)
|
||||
{
|
||||
if ( ! hasSelectedItem() )
|
||||
return;
|
||||
|
@ -1288,7 +1286,7 @@ inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawCheckMarkPrefix (FMenuItem* m_item)
|
||||
inline void FMenu::drawCheckMarkPrefix (const FMenuItem* m_item)
|
||||
{
|
||||
const bool is_checked = m_item->isChecked();
|
||||
const bool is_checkable = m_item->checkable;
|
||||
|
@ -1415,7 +1413,7 @@ inline void FMenu::drawTrailingSpaces (std::size_t startpos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenu::setLineAttributes (FMenuItem* m_item, int y)
|
||||
inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y)
|
||||
{
|
||||
const bool is_enabled = m_item->isEnabled();
|
||||
const bool is_selected = m_item->isSelected();
|
||||
|
|
|
@ -218,7 +218,7 @@ void FMenuBar::onAccel (FAccelEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::cb_itemDeactivated (FWidget* widget, FDataPtr)
|
||||
void FMenuBar::cb_itemDeactivated (FWidget* widget, const FDataPtr)
|
||||
{
|
||||
auto menuitem = static_cast<FMenuItem*>(widget);
|
||||
|
||||
|
@ -536,7 +536,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenuBar::setLineAttributes (FMenuItem* menuitem)
|
||||
inline void FMenuBar::setLineAttributes (const FMenuItem* menuitem)
|
||||
{
|
||||
bool is_enabled = menuitem->isEnabled();
|
||||
bool is_selected = menuitem->isSelected();
|
||||
|
@ -726,7 +726,7 @@ void FMenuBar::selectMenuItem (FMenuItem* item)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuBar::activateMenu (FMenuItem* item)
|
||||
bool FMenuBar::activateMenu (const FMenuItem* item)
|
||||
{
|
||||
if ( ! item->hasMenu() )
|
||||
return false;
|
||||
|
|
|
@ -458,19 +458,19 @@ void FMenuItem::onFocusOut (FFocusEvent*)
|
|||
|
||||
// protected methods of FMenuItem
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::isDialog (FWidget* w) const
|
||||
bool FMenuItem::isDialog (const FWidget* w) const
|
||||
{
|
||||
return ( w ) ? w->isDialogWidget() : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::isMenuBar (FWidget* w) const
|
||||
bool FMenuItem::isMenuBar (const FWidget* w) const
|
||||
{
|
||||
return ( w ) ? w->isInstanceOf("FMenuBar") : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::isMenu (FWidget* w) const
|
||||
bool FMenuItem::isMenu (const FWidget* w) const
|
||||
{
|
||||
if ( ! w )
|
||||
return false;
|
||||
|
@ -636,7 +636,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
||||
void FMenuItem::passMouseEvent ( T widget, const FMouseEvent* ev
|
||||
, fc::events ev_type )
|
||||
{
|
||||
if ( ! widget )
|
||||
|
@ -678,7 +678,7 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_switchToDialog (FWidget*, FDataPtr data)
|
||||
void FMenuItem::cb_switchToDialog (const FWidget*, FDataPtr data)
|
||||
{
|
||||
auto win = static_cast<FDialog*>(data);
|
||||
|
||||
|
@ -691,7 +691,7 @@ void FMenuItem::cb_switchToDialog (FWidget*, FDataPtr data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_destroyDialog (FWidget* widget, FDataPtr)
|
||||
void FMenuItem::cb_destroyDialog (FWidget* widget, const FDataPtr)
|
||||
{
|
||||
auto win = static_cast<FDialog*>(widget);
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -101,7 +101,8 @@ void FMenuList::clear()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuList::selectFirstItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, end;
|
||||
std::vector<FMenuItem*>::const_iterator iter;
|
||||
std::vector<FMenuItem*>::const_iterator end;
|
||||
iter = item_list.begin();
|
||||
end = item_list.end();
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ void FMessageBox::adjustSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMessageBox::cb_processClick (FWidget*, FDataPtr data)
|
||||
void FMessageBox::cb_processClick (const FWidget*, FDataPtr data)
|
||||
{
|
||||
const int reply = *(static_cast<int*>(data));
|
||||
done (reply);
|
||||
|
@ -383,7 +383,8 @@ void FMessageBox::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::resizeButtons()
|
||||
{
|
||||
std::size_t len[3]{}, max_size{};
|
||||
std::size_t len[3]{};
|
||||
std::size_t max_size{};
|
||||
|
||||
for (std::size_t n{0}; n < num_buttons; n++)
|
||||
{
|
||||
|
|
|
@ -269,7 +269,7 @@ void FMouse::setPending (bool is_pending)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouse::setMousePressedTime (timeval* time)
|
||||
void FMouse::setMousePressedTime (const timeval* time)
|
||||
{
|
||||
time_mousepressed = *time;
|
||||
}
|
||||
|
@ -400,6 +400,9 @@ bool FMouseGPM::gpmMouse (bool enable)
|
|||
{
|
||||
// activate/deactivate the gpm mouse support
|
||||
|
||||
static constexpr int gpm_error = -1;
|
||||
static constexpr int gpm_xterm_is_in_use = -2;
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
Gpm_Connect conn;
|
||||
|
@ -409,17 +412,8 @@ bool FMouseGPM::gpmMouse (bool enable)
|
|||
conn.minMod = 0;
|
||||
Gpm_Open(&conn, 0);
|
||||
|
||||
switch ( gpm_fd )
|
||||
{
|
||||
case -1: // error
|
||||
return false;
|
||||
|
||||
case -2: // xterm is in use
|
||||
return false;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( gpm_fd == gpm_error || gpm_fd == gpm_xterm_is_in_use )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -120,11 +120,9 @@ bool FObject::isChild (const FObject* obj) const
|
|||
{
|
||||
// Find out if obj is a child object of mine
|
||||
|
||||
FObject* p_obj{nullptr};
|
||||
|
||||
while ( obj && (p_obj = obj->getParent()) )
|
||||
while ( obj )
|
||||
{
|
||||
obj = p_obj;
|
||||
obj = obj->getParent();
|
||||
|
||||
if ( obj == this )
|
||||
return true;
|
||||
|
@ -238,7 +236,7 @@ void FObject::getCurrentTime (timeval* time)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::isTimeout (timeval* time, uInt64 timeout)
|
||||
bool FObject::isTimeout (const timeval* time, uInt64 timeout)
|
||||
{
|
||||
// Checks whether the specified time span (timeout in µs) has elapse
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ FOptiAttr::~FOptiAttr() // destructor
|
|||
|
||||
// public methods of FOptiAttr
|
||||
//----------------------------------------------------------------------
|
||||
void FOptiAttr::setTermEnvironment (termEnv& term_env)
|
||||
void FOptiAttr::setTermEnvironment (const termEnv& term_env)
|
||||
{
|
||||
// Set all required termcap values at once
|
||||
// and initialize the FOptiAttr environment
|
||||
|
@ -1498,31 +1498,38 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term
|
|||
const auto ansi_fg = vga2ansi(fg);
|
||||
const auto ansi_bg = vga2ansi(bg);
|
||||
|
||||
if ( (term->fg_color != fg || frev)
|
||||
&& (color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
if ( term->fg_color != fg || frev )
|
||||
{
|
||||
color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
append_sequence (color_str);
|
||||
}
|
||||
|
||||
if ( (term->bg_color != bg || frev)
|
||||
&& (color_str = tparm(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
if ( term->bg_color != bg || frev )
|
||||
{
|
||||
color_str = tparm(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
append_sequence (color_str);
|
||||
}
|
||||
}
|
||||
else if ( Sf && Sb )
|
||||
{
|
||||
if ( (term->fg_color != fg || frev)
|
||||
&& (color_str = tparm(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
if ( term->fg_color != fg || frev )
|
||||
{
|
||||
color_str = tparm(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
append_sequence (color_str);
|
||||
}
|
||||
|
||||
if ( (term->bg_color != bg || frev)
|
||||
&& (color_str = tparm(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
if ( term->bg_color != bg || frev )
|
||||
{
|
||||
color_str = tparm(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
append_sequence (color_str);
|
||||
}
|
||||
}
|
||||
else if ( sp )
|
||||
{
|
||||
fg = vga2ansi(fg);
|
||||
bg = vga2ansi(bg);
|
||||
|
||||
if ( (color_str = tparm(sp, fg, bg, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
append_sequence (color_str);
|
||||
color_str = tparm(sp, fg, bg, 0, 0, 0, 0, 0, 0, 0);
|
||||
append_sequence (color_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1547,7 +1554,7 @@ inline void FOptiAttr::reset (FChar*& attr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FOptiAttr::caused_reset_attributes (char cap[], uChar test)
|
||||
bool FOptiAttr::caused_reset_attributes (const char cap[], uChar test)
|
||||
{
|
||||
// test if "cap" reset all attributes
|
||||
|
||||
|
@ -1654,7 +1661,7 @@ inline bool FOptiAttr::switchOff()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FOptiAttr::append_sequence (char seq[])
|
||||
inline bool FOptiAttr::append_sequence (const char seq[])
|
||||
{
|
||||
if ( ! seq )
|
||||
return false;
|
||||
|
|
|
@ -80,7 +80,7 @@ void FOptiMove::setTermSize (std::size_t w, std::size_t h)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FOptiMove::setTermEnvironment (termEnv& term_env)
|
||||
void FOptiMove::setTermEnvironment (const termEnv& term_env)
|
||||
{
|
||||
// Set all required termcap values at once
|
||||
|
||||
|
@ -548,7 +548,7 @@ void FOptiMove::calculateCharDuration()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FOptiMove::capDuration (char cap[], int affcnt)
|
||||
int FOptiMove::capDuration (const char cap[], int affcnt)
|
||||
{
|
||||
// calculate the duration in milliseconds of a given operation
|
||||
// cap - the term capability
|
||||
|
@ -558,8 +558,9 @@ int FOptiMove::capDuration (char cap[], int affcnt)
|
|||
return LONG_DURATION;
|
||||
|
||||
float ms{0};
|
||||
const char* p = cap;
|
||||
|
||||
for (const char* p = cap; *p; p++)
|
||||
while ( *p )
|
||||
{
|
||||
// check for delay with padding character
|
||||
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
|
||||
|
@ -572,14 +573,21 @@ int FOptiMove::capDuration (char cap[], int affcnt)
|
|||
num = num * 10 + float(*p - '0');
|
||||
else if ( *p == '*' )
|
||||
num *= float(affcnt);
|
||||
else if ( *p == '.' && *++p != '>' && std::isdigit(uChar(*p)) )
|
||||
num += float((*p - '0') / 10.0);
|
||||
else if ( *p == '.' )
|
||||
{
|
||||
++p;
|
||||
|
||||
if ( *p != '>' && std::isdigit(uChar(*p)) )
|
||||
num += float((*p - '0') / 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
ms += num * 10;
|
||||
}
|
||||
else
|
||||
ms += float(char_duration);
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
return int(ms);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* Copyright 2014-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -42,7 +42,7 @@ FPoint& FPoint::operator = (const FPoint& p)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FPoint& FPoint::operator = (FPoint&& p)
|
||||
FPoint& FPoint::operator = (FPoint&& p) noexcept
|
||||
{
|
||||
xpos = p.xpos;
|
||||
ypos = p.ypos;
|
||||
|
@ -115,7 +115,8 @@ std::ostream& operator << (std::ostream& outstr, const FPoint& p)
|
|||
//----------------------------------------------------------------------
|
||||
std::istream& operator >> (std::istream& instr, FPoint& p)
|
||||
{
|
||||
int x{}, y{};
|
||||
int x{};
|
||||
int y{};
|
||||
instr >> x;
|
||||
instr >> y;
|
||||
p.setPoint (x, y);
|
||||
|
|
|
@ -321,7 +321,7 @@ FRect& FRect::operator = (const FRect& r)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FRect& FRect::operator = (FRect&& r)
|
||||
FRect& FRect::operator = (FRect&& r) noexcept
|
||||
{
|
||||
X1 = r.X1;
|
||||
Y1 = r.Y1;
|
||||
|
@ -382,7 +382,10 @@ std::ostream& operator << (std::ostream& outstr, const FRect& r)
|
|||
//----------------------------------------------------------------------
|
||||
std::istream& operator >> (std::istream& instr, FRect& r)
|
||||
{
|
||||
int x1{}, y1{}, x2{}, y2{};
|
||||
int x1{};
|
||||
int y1{};
|
||||
int x2{};
|
||||
int y2{};
|
||||
instr >> x1;
|
||||
instr >> y1;
|
||||
instr >> x2;
|
||||
|
|
|
@ -665,7 +665,7 @@ void FScrollView::copy2area()
|
|||
|
||||
for (int y{0}; y < y_end; y++) // line loop
|
||||
{
|
||||
FChar* vc{}; // viewport character
|
||||
const FChar* vc{}; // viewport character
|
||||
FChar* ac{}; // area character
|
||||
const int v_line_len = viewport->width;
|
||||
const int a_line_len = printarea->width + printarea->right_shadow;
|
||||
|
@ -707,7 +707,7 @@ inline FPoint FScrollView::getViewportCursorPos()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::init (FWidget* parent)
|
||||
void FScrollView::init (const FWidget* parent)
|
||||
{
|
||||
assert ( parent != nullptr );
|
||||
assert ( ! parent->isInstanceOf("FScrollView") );
|
||||
|
@ -755,7 +755,7 @@ inline void FScrollView::mapKeyFunctions()
|
|||
key_map[fc::Fkey_down] = [&] { scrollBy (0, 1); };
|
||||
key_map[fc::Fkey_left] = [&] { scrollBy (-1, 0); };
|
||||
key_map[fc::Fkey_right] = [&] { scrollBy (1, 0); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, int(-getViewportHeight())); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, -int(getViewportHeight())); };
|
||||
key_map[fc::Fkey_npage] = [&] { scrollBy (0, int(getViewportHeight())); };
|
||||
key_map[fc::Fkey_home] = [&] { scrollToY (1); };
|
||||
key_map[fc::Fkey_end] = \
|
||||
|
@ -852,7 +852,7 @@ void FScrollView::setViewportCursor()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::cb_vbarChange (FWidget*, FDataPtr)
|
||||
void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
@ -903,7 +903,7 @@ void FScrollView::cb_vbarChange (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::cb_hbarChange (FWidget*, FDataPtr)
|
||||
void FScrollView::cb_hbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
|
|
@ -45,7 +45,7 @@ FSize& FSize::operator = (const FSize& s)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FSize& FSize::operator = (FSize&& s)
|
||||
FSize& FSize::operator = (FSize&& s) noexcept
|
||||
{
|
||||
width = s.width;
|
||||
height = s.height;
|
||||
|
@ -143,7 +143,8 @@ std::ostream& operator << (std::ostream& outstr, const FSize& s)
|
|||
//----------------------------------------------------------------------
|
||||
std::istream& operator >> (std::istream& instr, FSize& s)
|
||||
{
|
||||
std::size_t w, h;
|
||||
std::size_t w;
|
||||
std::size_t h;
|
||||
instr >> w;
|
||||
instr >> h;
|
||||
s.setSize (w, h);
|
||||
|
|
|
@ -324,7 +324,7 @@ void FSpinBox::draw()
|
|||
{
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
const FColorPair inc_button_color = [&] () -> FColorPair
|
||||
const FColorPair inc_button_color = [&] ()
|
||||
{
|
||||
if ( value == max )
|
||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
||||
|
@ -334,7 +334,7 @@ void FSpinBox::draw()
|
|||
, wc.scrollbar_button_bg );
|
||||
}();
|
||||
|
||||
const FColorPair dec_button_color = [&] () -> FColorPair
|
||||
const FColorPair dec_button_color = [&] ()
|
||||
{
|
||||
if ( value == min )
|
||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
||||
|
@ -413,7 +413,7 @@ void FSpinBox::forceFocus()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::cb_inputFieldChange (finalcut::FWidget* w, FDataPtr)
|
||||
void FSpinBox::cb_inputFieldChange (finalcut::FWidget* w, const FDataPtr)
|
||||
{
|
||||
const auto& lineedit = static_cast<FLineEdit*>(w);
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FStatusBar::cb_statuskey_activated (FWidget* widget, FDataPtr)
|
||||
void FStatusBar::cb_statuskey_activated (FWidget* widget, const FDataPtr)
|
||||
{
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ FString::FString (const FString& s) // copy constructor
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (FString&& s) // move constructor
|
||||
FString::FString (FString&& s) noexcept // move constructor
|
||||
{
|
||||
if ( ! s.isNull() )
|
||||
_assign (std::move(s.string));
|
||||
|
@ -171,7 +171,7 @@ FString& FString::operator = (const FString& s)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::operator = (FString&& s)
|
||||
FString& FString::operator = (FString&& s) noexcept
|
||||
{
|
||||
_assign (std::move(s.string));
|
||||
return *this;
|
||||
|
@ -775,7 +775,7 @@ FString& FString::setString (const FString& s)
|
|||
FString& FString::setNumber (sInt64 num)
|
||||
{
|
||||
wchar_t buf[30]{};
|
||||
wchar_t* s = &buf[29];
|
||||
wchar_t* s = &buf[29]; // Pointer to the last character
|
||||
uInt64 abs_num = static_cast<uInt64>(num);
|
||||
|
||||
if ( num < 0 )
|
||||
|
@ -801,7 +801,7 @@ FString& FString::setNumber (sInt64 num)
|
|||
FString& FString::setNumber (uInt64 num)
|
||||
{
|
||||
wchar_t buf[30]{};
|
||||
wchar_t* s = &buf[29];
|
||||
wchar_t* s = &buf[29]; // Pointer to the last character
|
||||
*s = '\0';
|
||||
|
||||
do
|
||||
|
@ -851,7 +851,7 @@ FString& FString::setFormatedNumber (sInt64 num, char separator)
|
|||
{
|
||||
int n{0};
|
||||
wchar_t buf[30]{};
|
||||
wchar_t* s = &buf[29];
|
||||
wchar_t* s = &buf[29]; // Pointer to the last character
|
||||
uInt64 abs_num = static_cast<uInt64>(num);
|
||||
|
||||
if ( separator == 0 )
|
||||
|
@ -866,8 +866,9 @@ FString& FString::setFormatedNumber (sInt64 num, char separator)
|
|||
{
|
||||
*--s = L"0123456789"[abs_num % 10];
|
||||
abs_num /= 10;
|
||||
n++;
|
||||
|
||||
if ( abs_num && ++n % 3 == 0 )
|
||||
if ( abs_num && n % 3 == 0 )
|
||||
*--s = separator;
|
||||
}
|
||||
while ( abs_num );
|
||||
|
@ -884,7 +885,7 @@ FString& FString::setFormatedNumber (uInt64 num, char separator)
|
|||
{
|
||||
int n{0};
|
||||
wchar_t buf[30]{};
|
||||
wchar_t* s = &buf[29];
|
||||
wchar_t* s = &buf[29]; // Pointer to the last character
|
||||
*s = L'\0';
|
||||
|
||||
if ( separator == 0 )
|
||||
|
@ -894,8 +895,9 @@ FString& FString::setFormatedNumber (uInt64 num, char separator)
|
|||
{
|
||||
*--s = L"0123456789"[num % 10];
|
||||
num /= 10;
|
||||
n++;
|
||||
|
||||
if ( num && ++n % 3 == 0 )
|
||||
if ( num && n % 3 == 0 )
|
||||
*--s = separator;
|
||||
}
|
||||
while ( num );
|
||||
|
@ -1380,7 +1382,8 @@ void FString::_remove (std::size_t pos, std::size_t len)
|
|||
return;
|
||||
}
|
||||
|
||||
std::size_t x{}, y{};
|
||||
std::size_t x{};
|
||||
std::size_t y{};
|
||||
|
||||
for (x = 0; x < pos; x++) // left side
|
||||
sptr[y++] = string[x];
|
||||
|
|
|
@ -417,7 +417,7 @@ FTermDebugData& FTerm::getFTermDebugData()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTerm::isNormal (const FChar* const& ch)
|
||||
{
|
||||
return opti_attr->isNormal(ch);
|
||||
return FOptiAttr::isNormal(ch);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1543,7 +1543,7 @@ void FTerm::init_teraterm_charmap()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_keyboard()
|
||||
{
|
||||
keyboard->init();
|
||||
FKeyboard::init();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1559,8 +1559,7 @@ void FTerm::init_quirks()
|
|||
{
|
||||
// Initialize terminal quirks
|
||||
|
||||
FTermcapQuirks quirks;
|
||||
quirks.terminalFixup(); // Fix terminal quirks
|
||||
FTermcapQuirks::terminalFixup(); // Fix terminal quirks
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2201,7 +2200,7 @@ inline void FTerm::deallocationValues()
|
|||
if ( data )
|
||||
delete data;
|
||||
|
||||
defaultPutChar* putchar_ptr = &(putchar());
|
||||
const defaultPutChar* putchar_ptr = &(putchar());
|
||||
delete putchar_ptr;
|
||||
FStartOptions::destroyObject();
|
||||
}
|
||||
|
@ -2338,9 +2337,8 @@ bool FTerm::init_terminal()
|
|||
initBaudRate();
|
||||
|
||||
// Terminal detection
|
||||
term_detection->detect();
|
||||
FTermDetection::detect();
|
||||
setTermType (term_detection->getTermType());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -352,7 +352,10 @@ FString getColumnSubString ( const FString& str
|
|||
, std::size_t col_pos, std::size_t col_len )
|
||||
{
|
||||
FString s(str);
|
||||
std::size_t col_first{1}, col_num{0}, first{1}, num{0};
|
||||
std::size_t col_first{1};
|
||||
std::size_t col_num{0};
|
||||
std::size_t first{1};
|
||||
std::size_t num{0};
|
||||
|
||||
if ( col_len == 0 || s.isEmpty() )
|
||||
return FString(L"");
|
||||
|
@ -404,7 +407,8 @@ FString getColumnSubString ( const FString& str
|
|||
std::size_t getLengthFromColumnWidth ( const FString& str
|
||||
, std::size_t col_len )
|
||||
{
|
||||
std::size_t column_width{0}, length{0};
|
||||
std::size_t column_width{0};
|
||||
std::size_t length{0};
|
||||
|
||||
for (auto&& ch : str)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ const FString& FTermDetection::getSecDAString()
|
|||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
|
||||
void FTermDetection::setTtyTypeFileName (const char ttytype_filename[])
|
||||
{
|
||||
if ( ! ttytype_filename )
|
||||
return;
|
||||
|
@ -205,40 +205,42 @@ bool FTermDetection::getTTYtype()
|
|||
std::FILE* fp{};
|
||||
char str[BUFSIZ]{};
|
||||
|
||||
if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != nullptr )
|
||||
if ( ! fsystem )
|
||||
return false;
|
||||
|
||||
if ( (fp = fsystem->fopen(ttytypename, "r")) == nullptr )
|
||||
return false;
|
||||
|
||||
// Read and parse the file
|
||||
while ( fgets(str, sizeof(str) - 1, fp) != nullptr )
|
||||
{
|
||||
// Read and parse the file
|
||||
while ( fgets(str, sizeof(str) - 1, fp) != nullptr )
|
||||
const char* type{nullptr}; // nullptr == not found
|
||||
const char* name{nullptr};
|
||||
char* p = str;
|
||||
|
||||
while ( *p )
|
||||
{
|
||||
const char* type{nullptr}; // nullptr == not found
|
||||
const char* name{nullptr};
|
||||
char* p = str;
|
||||
if ( std::isspace(uChar(*p)) )
|
||||
*p = '\0';
|
||||
else if ( type == nullptr )
|
||||
type = p;
|
||||
else if ( name == nullptr && p != str && p[-1] == '\0' )
|
||||
name = p;
|
||||
|
||||
while ( *p )
|
||||
{
|
||||
if ( std::isspace(uChar(*p)) )
|
||||
*p = '\0';
|
||||
else if ( type == nullptr )
|
||||
type = p;
|
||||
else if ( name == nullptr && p != str && p[-1] == '\0' )
|
||||
name = p;
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
if ( type != nullptr && name != nullptr && ! std::strcmp(name, term_basename) )
|
||||
{
|
||||
// Save name in termtype
|
||||
std::strncpy (termtype, type, sizeof(termtype));
|
||||
termtype[sizeof(termtype) - 1] = '\0';
|
||||
fsystem->fclose(fp);
|
||||
return true;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
fsystem->fclose(fp);
|
||||
if ( type != nullptr && name != nullptr && ! std::strcmp(name, term_basename) )
|
||||
{
|
||||
// Save name in termtype
|
||||
std::strncpy (termtype, type, sizeof(termtype));
|
||||
termtype[sizeof(termtype) - 1] = '\0';
|
||||
fsystem->fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
fsystem->fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -257,7 +259,7 @@ bool FTermDetection::getTTYSFileEntry()
|
|||
else
|
||||
term_basename++;
|
||||
|
||||
struct ttyent* ttys_entryt;
|
||||
const struct ttyent* ttys_entryt;
|
||||
ttys_entryt = getttynam(term_basename);
|
||||
|
||||
if ( ttys_entryt )
|
||||
|
@ -890,7 +892,7 @@ inline char* FTermDetection::secDA_Analysis_24 (char current_termtype[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTermDetection::secDA_Analysis_32 (char[])
|
||||
inline char* FTermDetection::secDA_Analysis_32 (const char[])
|
||||
{
|
||||
// Terminal ID 32 - Tera Term
|
||||
|
||||
|
@ -910,7 +912,7 @@ inline char* FTermDetection::secDA_Analysis_65 (char current_termtype[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTermDetection::secDA_Analysis_67 (char[])
|
||||
inline char* FTermDetection::secDA_Analysis_67 (const char[])
|
||||
{
|
||||
// Terminal ID 67 - cygwin
|
||||
|
||||
|
@ -921,7 +923,7 @@ inline char* FTermDetection::secDA_Analysis_67 (char[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTermDetection::secDA_Analysis_77 (char[])
|
||||
inline char* FTermDetection::secDA_Analysis_77 (const char[])
|
||||
{
|
||||
// Terminal ID 77 - mintty
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ char* FTermLinux::getCursorStyleString()
|
|||
|
||||
static char buf[16]{};
|
||||
std::fill (std::begin(buf), std::end(buf), '\0');
|
||||
std::sprintf (buf, CSI "?%dc", getCursorStyle());
|
||||
std::snprintf (buf, sizeof(buf), CSI "?%dc", getCursorStyle());
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
|
|||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
modifier_key& m = getModifierKey();
|
||||
const modifier_key& m = getModifierKey();
|
||||
|
||||
if ( ! (m.shift || m.ctrl || m.alt) )
|
||||
{
|
||||
|
|
|
@ -575,7 +575,7 @@ inline void FTextView::mapKeyFunctions()
|
|||
key_map[fc::Fkey_down] = [&] { scrollBy (0, 1); };
|
||||
key_map[fc::Fkey_left] = [&] { scrollBy (-1, 0); };
|
||||
key_map[fc::Fkey_right] = [&] { scrollBy (1, 0); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, int(-getTextHeight())); };
|
||||
key_map[fc::Fkey_ppage] = [&] { scrollBy (0, -int(getTextHeight())); };
|
||||
key_map[fc::Fkey_npage] = [&] { scrollBy (0, int(getTextHeight())); };
|
||||
key_map[fc::Fkey_home] = [&] { scrollToY (0); };
|
||||
key_map[fc::Fkey_end] = [&] { scrollToY (int(getRows() - getTextHeight())); };
|
||||
|
@ -744,7 +744,7 @@ void FTextView::changeOnResize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::cb_vbarChange (FWidget*, FDataPtr)
|
||||
void FTextView::cb_vbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
@ -795,7 +795,7 @@ void FTextView::cb_vbarChange (FWidget*, FDataPtr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::cb_hbarChange (FWidget*, FDataPtr)
|
||||
void FTextView::cb_hbarChange (const FWidget*, const FDataPtr)
|
||||
{
|
||||
const FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
static constexpr int wheel_distance = 4;
|
||||
|
|
|
@ -50,9 +50,7 @@ FToolTip::FToolTip (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FToolTip::~FToolTip() // destructor
|
||||
{
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( fapp->isQuit() )
|
||||
if ( FApplication::isQuit() )
|
||||
return;
|
||||
|
||||
FWindow* parent_win{nullptr};
|
||||
|
@ -158,7 +156,8 @@ void FToolTip::calculateDimensions()
|
|||
max_line_width = column_width;
|
||||
}
|
||||
|
||||
int x{}, y{};
|
||||
int x{};
|
||||
int y{};
|
||||
const std::size_t h = ( hasBorder() ) ? text_num_lines + 2 : text_num_lines;
|
||||
const std::size_t w = ( hasBorder() ) ? max_line_width + 4 : max_line_width + 2;
|
||||
const auto& r = getRootWidget();
|
||||
|
|
100
src/fvterm.cpp
100
src/fvterm.cpp
|
@ -250,8 +250,7 @@ void FVTerm::updateTerminal()
|
|||
{
|
||||
// Updates pending changes to the terminal
|
||||
|
||||
if ( no_terminal_updates
|
||||
|| FApplication::getApplicationObject()->isQuit() )
|
||||
if ( no_terminal_updates || FApplication::isQuit() )
|
||||
return;
|
||||
|
||||
if ( ! force_terminal_update )
|
||||
|
@ -266,7 +265,7 @@ void FVTerm::updateTerminal()
|
|||
}
|
||||
}
|
||||
|
||||
const auto& data = getFTerm().getFTermData();
|
||||
const auto& data = FTerm::getFTermData();
|
||||
|
||||
// Checks if the resizing of the terminal is not finished
|
||||
if ( data && data->hasTermResized() )
|
||||
|
@ -296,8 +295,8 @@ void FVTerm::updateTerminal()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::addPreprocessingHandler ( FVTerm* instance
|
||||
, FPreprocessingFunction function )
|
||||
void FVTerm::addPreprocessingHandler ( const FVTerm* instance
|
||||
, const FPreprocessingFunction& function )
|
||||
{
|
||||
if ( ! print_area )
|
||||
FVTerm::getPrintArea();
|
||||
|
@ -311,7 +310,7 @@ void FVTerm::addPreprocessingHandler ( FVTerm* instance
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
||||
void FVTerm::delPreprocessingHandler (const FVTerm* instance)
|
||||
{
|
||||
if ( ! print_area )
|
||||
FVTerm::getPrintArea();
|
||||
|
@ -364,6 +363,7 @@ int FVTerm::print (FTermArea* area, const FString& s)
|
|||
nc.attr.byte[0] = next_attribute.attr.byte[0];
|
||||
nc.attr.byte[1] = next_attribute.attr.byte[1];
|
||||
nc.attr.byte[2] = 0;
|
||||
nc.attr.byte[3] = 0;
|
||||
term_string.push_back(nc);
|
||||
p++;
|
||||
} // end of while
|
||||
|
@ -451,11 +451,8 @@ int FVTerm::print (FTermArea* area, const std::vector<FChar>& term_string)
|
|||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
auto nc = fchar; // next character
|
||||
print (area, nc);
|
||||
print (area, fchar); // print next character
|
||||
printable_character = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! printable_character && printWrap(area) )
|
||||
|
@ -492,6 +489,7 @@ int FVTerm::print (FTermArea* area, wchar_t c)
|
|||
nc.attr.byte[0] = next_attribute.attr.byte[0];
|
||||
nc.attr.byte[1] = next_attribute.attr.byte[1];
|
||||
nc.attr.byte[2] = 0;
|
||||
nc.attr.byte[3] = 0;
|
||||
|
||||
return print (area, nc);
|
||||
}
|
||||
|
@ -507,6 +505,13 @@ int FVTerm::print (FChar& term_char)
|
|||
return print (area, term_char);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FVTerm::print (FTermArea* area, const FChar& term_char)
|
||||
{
|
||||
auto fchar = term_char;
|
||||
return print (area, fchar);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FVTerm::print (FTermArea* area, FChar& term_char)
|
||||
{
|
||||
|
@ -641,7 +646,7 @@ void FVTerm::flush()
|
|||
|
||||
while ( ! output_buffer->empty() )
|
||||
{
|
||||
static FTerm::defaultPutChar& FTermPutchar = FTerm::putchar();
|
||||
const static FTerm::defaultPutChar& FTermPutchar = FTerm::putchar();
|
||||
FTermPutchar (output_buffer->front());
|
||||
output_buffer->pop();
|
||||
}
|
||||
|
@ -892,7 +897,7 @@ void FVTerm::setAreaCursor ( const FPoint& pos
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (const FPoint& pos, FTermArea* area)
|
||||
void FVTerm::getArea (const FPoint& pos, const FTermArea* area)
|
||||
{
|
||||
// Copies a block from the virtual terminal position to the given area
|
||||
|
||||
|
@ -901,7 +906,8 @@ void FVTerm::getArea (const FPoint& pos, FTermArea* area)
|
|||
|
||||
const int ax = pos.getX() - 1;
|
||||
const int ay = pos.getY() - 1;
|
||||
int y_end{}, length{};
|
||||
int y_end{};
|
||||
int length{};
|
||||
|
||||
if ( area->height + ay > vterm->height )
|
||||
y_end = area->height - ay;
|
||||
|
@ -928,7 +934,7 @@ void FVTerm::getArea (const FPoint& pos, FTermArea* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (const FRect& box, FTermArea* area)
|
||||
void FVTerm::getArea (const FRect& box, const FTermArea* area)
|
||||
{
|
||||
// Copies a block from the virtual terminal rectangle to the given area
|
||||
|
||||
|
@ -941,7 +947,8 @@ void FVTerm::getArea (const FRect& box, FTermArea* area)
|
|||
const int h = int(box.getHeight());
|
||||
const int dx = x - area->offset_left + 1;
|
||||
const int dy = y - area->offset_top + 1;
|
||||
int y_end{}, length{};
|
||||
int y_end{};
|
||||
int length{};
|
||||
|
||||
if ( x < 0 || y < 0 )
|
||||
return;
|
||||
|
@ -1060,7 +1067,7 @@ void FVTerm::putArea (FTermArea* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::putArea (const FPoint& pos, FTermArea* area)
|
||||
void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
|
||||
{
|
||||
// Copies the given area block to the virtual terminal position
|
||||
|
||||
|
@ -1075,7 +1082,8 @@ void FVTerm::putArea (const FPoint& pos, FTermArea* area)
|
|||
const int width = area->width + area->right_shadow;
|
||||
const int height = area->height + area->bottom_shadow;
|
||||
int ol{0}; // outside left
|
||||
int y_end{}, length{};
|
||||
int y_end{};
|
||||
int length{};
|
||||
|
||||
if ( ax < 0 )
|
||||
{
|
||||
|
@ -1132,9 +1140,9 @@ void FVTerm::putArea (const FPoint& pos, FTermArea* area)
|
|||
void FVTerm::scrollAreaForward (FTermArea* area)
|
||||
{
|
||||
// Scrolls the entire area up line down
|
||||
FChar nc{}; // next character
|
||||
FChar* lc{}; // last character
|
||||
FChar* dc{}; // destination character
|
||||
FChar nc{}; // next character
|
||||
const FChar* lc{}; // last character
|
||||
FChar* dc{}; // destination character
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -1190,9 +1198,9 @@ void FVTerm::scrollAreaReverse (FTermArea* area)
|
|||
{
|
||||
// Scrolls the entire area one line down
|
||||
|
||||
FChar nc{}; // next character
|
||||
FChar* lc{}; // last character
|
||||
FChar* dc{}; // destination character
|
||||
FChar nc{}; // next character
|
||||
const FChar* lc{}; // last character
|
||||
FChar* dc{}; // destination character
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -1340,7 +1348,7 @@ void FVTerm::finishTerminalUpdate()
|
|||
|
||||
// private methods of FVTerm
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::setTextToDefault ( FTermArea* area
|
||||
inline void FVTerm::setTextToDefault ( const FTermArea* area
|
||||
, const FSize& size )
|
||||
{
|
||||
FChar default_char;
|
||||
|
@ -1352,6 +1360,7 @@ inline void FVTerm::setTextToDefault ( FTermArea* area
|
|||
default_char.attr.byte[0] = 0;
|
||||
default_char.attr.byte[1] = 0;
|
||||
default_char.attr.byte[2] = 0;
|
||||
default_char.attr.byte[3] = 0;
|
||||
|
||||
std::fill_n (area->data, size.getArea(), default_char);
|
||||
|
||||
|
@ -1413,7 +1422,7 @@ inline bool FVTerm::reallocateTextArea (FTermArea* area, std::size_t size)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
||||
, FTermArea* area )
|
||||
, const FTermArea* area )
|
||||
{
|
||||
// Determines the covered state for the given position
|
||||
|
||||
|
@ -1469,7 +1478,7 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedColor ( FTermArea* area
|
||||
void FVTerm::updateOverlappedColor ( const FTermArea* area
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
|
@ -1507,7 +1516,7 @@ void FVTerm::updateOverlappedColor ( FTermArea* area
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedCharacter ( FTermArea* area
|
||||
void FVTerm::updateOverlappedCharacter ( const FTermArea* area
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Restore one character on vterm
|
||||
|
@ -1523,7 +1532,7 @@ void FVTerm::updateOverlappedCharacter ( FTermArea* area
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateShadedCharacter ( FTermArea* area
|
||||
void FVTerm::updateShadedCharacter ( const FTermArea* area
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
|
@ -1558,7 +1567,7 @@ void FVTerm::updateShadedCharacter ( FTermArea* area
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateInheritBackground ( FTermArea* area
|
||||
void FVTerm::updateInheritBackground ( const FTermArea* area
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
|
@ -1688,7 +1697,7 @@ void FVTerm::updateVTerm()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::callPreprocessingHandler (FTermArea* area)
|
||||
void FVTerm::callPreprocessingHandler (const FTermArea* area)
|
||||
{
|
||||
// Call preprocessing handler
|
||||
|
||||
|
@ -1721,7 +1730,7 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::clearChildAreaChanges (FTermArea* area)
|
||||
void FVTerm::clearChildAreaChanges (const FTermArea* area)
|
||||
{
|
||||
if ( ! area )
|
||||
return;
|
||||
|
@ -1735,7 +1744,7 @@ void FVTerm::clearChildAreaChanges (FTermArea* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FVTerm::isInsideArea (const FPoint& pos, FTermArea* area)
|
||||
bool FVTerm::isInsideArea (const FPoint& pos, const FTermArea* area)
|
||||
{
|
||||
// Check whether the coordinates are within the area
|
||||
|
||||
|
@ -1918,8 +1927,9 @@ void FVTerm::init (bool disable_alt_screen)
|
|||
term_attribute.fg_color = fc::Default;
|
||||
term_attribute.bg_color = fc::Default;
|
||||
term_attribute.attr.byte[0] = 0;
|
||||
term_attribute.attr.byte[0] = 0;
|
||||
term_attribute.attr.byte[0] = 0;
|
||||
term_attribute.attr.byte[1] = 0;
|
||||
term_attribute.attr.byte[2] = 0;
|
||||
term_attribute.attr.byte[3] = 0;
|
||||
|
||||
// next_attribute contains the state of the next printed character
|
||||
std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute));
|
||||
|
@ -1945,7 +1955,7 @@ void FVTerm::init (bool disable_alt_screen)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::init_characterLengths (FOptiMove* optimove)
|
||||
void FVTerm::init_characterLengths (const FOptiMove* optimove)
|
||||
{
|
||||
if ( optimove )
|
||||
{
|
||||
|
@ -1994,7 +2004,7 @@ void FVTerm::finish()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::putAreaLine (FChar* ac, FChar* tc, int length)
|
||||
void FVTerm::putAreaLine (const FChar* ac, FChar* tc, int length)
|
||||
{
|
||||
// copy "length" characters from area to terminal
|
||||
|
||||
|
@ -2048,7 +2058,7 @@ void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getAreaCharacter ( const FPoint& pos, FTermArea* area
|
||||
void FVTerm::getAreaCharacter ( const FPoint& pos, const FTermArea* area
|
||||
, FChar*& cc )
|
||||
{
|
||||
const int area_x = area->offset_left;
|
||||
|
@ -2131,7 +2141,7 @@ bool FVTerm::clearTerm (int fillchar)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FVTerm::clearFullArea (FTermArea* area, FChar& nc)
|
||||
bool FVTerm::clearFullArea (const FTermArea* area, FChar& nc)
|
||||
{
|
||||
// Clear area
|
||||
const int area_size = area->width * area->height;
|
||||
|
@ -2162,7 +2172,7 @@ bool FVTerm::clearFullArea (FTermArea* area, FChar& nc)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::clearAreaWithShadow (FTermArea* area, const FChar& nc)
|
||||
void FVTerm::clearAreaWithShadow (const FTermArea* area, const FChar& nc)
|
||||
{
|
||||
FChar t_char = nc;
|
||||
const int total_width = area->width + area->right_shadow;
|
||||
|
@ -2600,8 +2610,11 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
|||
{
|
||||
x--;
|
||||
|
||||
for (uInt i{0}; i < whitespace; i++, x++)
|
||||
for (uInt i{0}; i < whitespace; i++)
|
||||
{
|
||||
appendCharacter (print_char);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
markAsPrinted (start_pos, x, y);
|
||||
|
@ -2657,8 +2670,11 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
|||
{
|
||||
x--;
|
||||
|
||||
for (uInt i{0}; i < repetitions; i++, x++)
|
||||
for (uInt i{0}; i < repetitions; i++)
|
||||
{
|
||||
appendCharacter (print_char);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
markAsPrinted (start_pos, x, y);
|
||||
|
@ -2864,7 +2880,7 @@ bool FVTerm::isInsideTerminal (const FPoint& pos)
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::isTermSizeChanged()
|
||||
{
|
||||
const auto& data = getFTerm().getFTermData();
|
||||
const auto& data = FTerm::getFTermData();
|
||||
|
||||
if ( ! data )
|
||||
return false;
|
||||
|
|
|
@ -75,7 +75,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
{
|
||||
if ( root_widget )
|
||||
{
|
||||
auto ftermdata = getFTerm().getFTermData();
|
||||
auto ftermdata = FTerm::getFTermData();
|
||||
ftermdata->setExitMessage("FWidget: No parent defined! "
|
||||
"There should be only one root object");
|
||||
FApplication::exit(EXIT_FAILURE);
|
||||
|
@ -835,7 +835,7 @@ void FWidget::delCallback (FCallback cb_function)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::delCallback (FWidget* cb_instance)
|
||||
void FWidget::delCallback (const FWidget* cb_instance)
|
||||
{
|
||||
// Delete all member function pointer from cb_instance
|
||||
|
||||
|
@ -1156,8 +1156,7 @@ void FWidget::move (const FPoint& pos)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::quit()
|
||||
{
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->exit(0);
|
||||
FApplication::exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1197,8 +1196,8 @@ FVTerm::FTermArea* FWidget::getPrintArea()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::addPreprocessingHandler ( FVTerm* instance
|
||||
, FPreprocessingFunction function )
|
||||
void FWidget::addPreprocessingHandler ( const FVTerm* instance
|
||||
, const FPreprocessingFunction& function )
|
||||
{
|
||||
if ( ! getCurrentPrintArea() )
|
||||
FWidget::getPrintArea();
|
||||
|
@ -1207,7 +1206,7 @@ void FWidget::addPreprocessingHandler ( FVTerm* instance
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::delPreprocessingHandler (FVTerm* instance)
|
||||
void FWidget::delPreprocessingHandler (const FVTerm* instance)
|
||||
{
|
||||
if ( ! getCurrentPrintArea() )
|
||||
FWidget::getPrintArea();
|
||||
|
@ -1356,7 +1355,8 @@ void FWidget::hideArea (const FSize& size)
|
|||
if ( size.isEmpty() )
|
||||
return;
|
||||
|
||||
FColor fg{}, bg{};
|
||||
FColor fg{};
|
||||
FColor bg{};
|
||||
const auto& parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -1806,7 +1806,7 @@ void FWidget::KeyPressEvent (FKeyEvent* kev)
|
|||
{
|
||||
const FKey key = kev->key();
|
||||
|
||||
if ( [&] () -> bool
|
||||
if ( [&] ()
|
||||
{
|
||||
if ( isFocusNextKey(key) )
|
||||
return focusNextChild();
|
||||
|
@ -1846,7 +1846,7 @@ void FWidget::KeyDownEvent (FKeyEvent* kev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::emitWheelCallback (FWheelEvent* ev)
|
||||
void FWidget::emitWheelCallback (const FWheelEvent* ev)
|
||||
{
|
||||
const int wheel = ev->getWheel();
|
||||
|
||||
|
@ -1888,7 +1888,7 @@ FWidget::FCallbackPtr FWidget::getCallbackPtr (FCallback cb_function)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::changeFocus ( FWidget* follower, FWidget* parent
|
||||
bool FWidget::changeFocus ( FWidget* follower, const FWidget* parent
|
||||
, fc::FocusTypes ft )
|
||||
{
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
|
|
|
@ -35,7 +35,7 @@ bool isFocusNextKey (const FKey key)
|
|||
if ( key == fc::Fkey_tab
|
||||
|| key == fc::Fkey_right
|
||||
|| key == fc::Fkey_down )
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ bool isFocusPrevKey (const FKey key)
|
|||
if ( key == fc::Fkey_btab
|
||||
|| key == fc::Fkey_left
|
||||
|| key == fc::Fkey_up )
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -67,7 +67,10 @@ FKey getHotkey (const FString& text)
|
|||
try
|
||||
{
|
||||
if ( i + 1 < length && text[i] == '&' )
|
||||
return FKey(text[++i]);
|
||||
{
|
||||
i++;
|
||||
return FKey(text[i]);
|
||||
}
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
|
@ -154,11 +157,12 @@ void drawTransparentShadow (FWidget* w)
|
|||
|
||||
const std::size_t width = w->getWidth();
|
||||
const std::size_t height = w->getHeight();
|
||||
const auto& wcolors = FWidget::wcolors;
|
||||
w->print() << FStyle (fc::Transparent)
|
||||
<< FPoint (int(width) + 1, 1)
|
||||
<< " "
|
||||
<< FStyle (fc::Reset)
|
||||
<< FColorPair (w->wcolors.shadow_bg, w->wcolors.shadow_fg)
|
||||
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
|
||||
<< FStyle (fc::ColorOverlay);
|
||||
|
||||
for (std::size_t y{1}; y < height; y++)
|
||||
|
@ -170,7 +174,7 @@ void drawTransparentShadow (FWidget* w)
|
|||
<< FPoint (1, int(height) + 1)
|
||||
<< " "
|
||||
<< FStyle (fc::Reset)
|
||||
<< FColorPair (w->wcolors.shadow_bg, w->wcolors.shadow_fg)
|
||||
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
|
||||
<< FStyle (fc::ColorOverlay)
|
||||
<< FString (width, L' ')
|
||||
<< FStyle (fc::Reset);
|
||||
|
@ -189,15 +193,16 @@ void drawBlockShadow (FWidget* w)
|
|||
|
||||
const std::size_t width = w->getWidth();
|
||||
const std::size_t height = w->getHeight();
|
||||
const auto& wcolors = FWidget::wcolors;
|
||||
w->print() << FPoint(int(width) + 1, 1);
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
{
|
||||
w->print() << FColorPair (w->wcolors.shadow_fg, w->wcolors.shadow_bg)
|
||||
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
|
||||
<< FStyle (fc::InheritBackground); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = w->getParentWidget() )
|
||||
w->print() << FColorPair (w->wcolors.shadow_fg, p->getBackgroundColor());
|
||||
w->print() << FColorPair (wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
w->print (fc::LowerHalfBlock); // ▄
|
||||
|
||||
|
@ -229,14 +234,15 @@ void clearShadow (FWidget* w)
|
|||
|
||||
const std::size_t width = w->getWidth();
|
||||
const std::size_t height = w->getHeight();
|
||||
const auto& wcolors = FWidget::wcolors;
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
{
|
||||
w->print() << FColorPair (w->wcolors.shadow_fg, w->wcolors.shadow_bg)
|
||||
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
|
||||
<< FStyle (fc::InheritBackground); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = w->getParentWidget() )
|
||||
w->print() << FColorPair (w->wcolors.shadow_fg, p->getBackgroundColor());
|
||||
w->print() << FColorPair (wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
if ( int(width) <= w->woffset.getX2() )
|
||||
{
|
||||
|
@ -263,13 +269,14 @@ void drawFlatBorder (FWidget* w)
|
|||
if ( ! w->isNewFont() )
|
||||
return;
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
|
||||
|
||||
const std::size_t width = w->getWidth();
|
||||
const std::size_t height = w->getHeight();
|
||||
const auto& wcolors = FWidget::wcolors;
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||
|
||||
for (std::size_t y{0}; y < height; y++)
|
||||
{
|
||||
|
@ -323,13 +330,14 @@ void clearFlatBorder (FWidget* w)
|
|||
if ( ! w->isNewFont() )
|
||||
return;
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
|
||||
|
||||
const std::size_t width = w->getWidth();
|
||||
const std::size_t height = w->getHeight();
|
||||
const auto& wcolors = FWidget::wcolors;
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||
|
||||
for (std::size_t y{0}; y < height; y++)
|
||||
{
|
||||
|
@ -374,7 +382,7 @@ void clearFlatBorder (FWidget* w)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void checkBorder (FWidget* w, FRect& r)
|
||||
inline void checkBorder (const FWidget* w, FRect& r)
|
||||
{
|
||||
if ( r.x1_ref() > r.x2_ref() )
|
||||
std::swap (r.x1_ref(), r.x2_ref());
|
||||
|
@ -396,25 +404,27 @@ inline void checkBorder (FWidget* w, FRect& r)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawBorder (FWidget* w, FRect r)
|
||||
void drawBorder (FWidget* w, const FRect& r)
|
||||
{
|
||||
checkBorder (w, r);
|
||||
FRect rect = r;
|
||||
checkBorder (w, rect);
|
||||
|
||||
if ( w->isNewFont() )
|
||||
drawNewFontBox (w, r);
|
||||
drawNewFontBox (w, rect);
|
||||
else
|
||||
drawBox (w, r);
|
||||
drawBox (w, rect);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawListBorder (FWidget* w, FRect r)
|
||||
void drawListBorder (FWidget* w, const FRect& r)
|
||||
{
|
||||
checkBorder (w, r);
|
||||
FRect rect = r;
|
||||
checkBorder (w, rect);
|
||||
|
||||
if ( w->isNewFont() )
|
||||
drawNewFontListBox (w, r);
|
||||
drawNewFontListBox (w, rect);
|
||||
else
|
||||
drawBox (w, r);
|
||||
drawBox (w, rect);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -56,8 +56,6 @@ FWindow::FWindow(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FWindow::~FWindow() // destructor
|
||||
{
|
||||
const auto& fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( previous_window == this )
|
||||
previous_window = nullptr;
|
||||
|
||||
|
@ -70,7 +68,7 @@ FWindow::~FWindow() // destructor
|
|||
|
||||
delWindow (this);
|
||||
|
||||
if ( ! fapp->isQuit() )
|
||||
if ( ! FApplication::isQuit() )
|
||||
{
|
||||
const auto& t_geometry = getTermGeometryWithShadow();
|
||||
restoreVTerm (t_geometry);
|
||||
|
@ -454,7 +452,7 @@ void FWindow::addWindow (FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::delWindow (FWidget* obj)
|
||||
void FWindow::delWindow (const FWidget* obj)
|
||||
{
|
||||
// delete the window object obj from the window list
|
||||
if ( ! getWindowList() || getWindowList()->empty() )
|
||||
|
@ -528,7 +526,7 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
||||
void FWindow::swapWindow (const FWidget* obj1, const FWidget* obj2)
|
||||
{
|
||||
// swaps the window layer between obj1 and obj2
|
||||
|
||||
|
@ -681,31 +679,30 @@ void FWindow::switchToPrevWindow (FWidget* widget)
|
|||
const bool is_activated = activatePrevWindow();
|
||||
auto active_win = static_cast<FWindow*>(getActiveWindow());
|
||||
|
||||
if ( ! is_activated )
|
||||
|
||||
if ( ! is_activated
|
||||
&& getWindowList() && getWindowList()->size() > 1 )
|
||||
{
|
||||
// no previous window -> looking for another window
|
||||
if ( getWindowList() && getWindowList()->size() > 1 )
|
||||
auto iter = getWindowList()->end();
|
||||
const auto begin = getWindowList()->begin();
|
||||
|
||||
do
|
||||
{
|
||||
auto iter = getWindowList()->end();
|
||||
const auto begin = getWindowList()->begin();
|
||||
--iter;
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
|
||||
do
|
||||
if ( w
|
||||
&& w != active_win
|
||||
&& ! (w->isWindowHidden() || w->isWindowActive())
|
||||
&& w != static_cast<FWindow*>(getStatusBar())
|
||||
&& w != static_cast<FWindow*>(getMenuBar()) )
|
||||
{
|
||||
--iter;
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
|
||||
if ( w
|
||||
&& w != active_win
|
||||
&& ! (w->isWindowHidden() || w->isWindowActive())
|
||||
&& w != static_cast<FWindow*>(getStatusBar())
|
||||
&& w != static_cast<FWindow*>(getMenuBar()) )
|
||||
{
|
||||
setActiveWindow(w);
|
||||
break;
|
||||
}
|
||||
setActiveWindow(w);
|
||||
break;
|
||||
}
|
||||
while ( iter != begin );
|
||||
}
|
||||
while ( iter != begin );
|
||||
}
|
||||
|
||||
if ( active_win )
|
||||
|
@ -833,7 +830,7 @@ void FWindow::onWindowLowered (FEvent*)
|
|||
|
||||
// private methods of FWindow
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
||||
void FWindow::deleteFromAlwaysOnTopList (const FWidget* obj)
|
||||
{
|
||||
// delete the window object obj from the always-on-top list
|
||||
if ( ! getAlwaysOnTopList() || getAlwaysOnTopList()->empty() )
|
||||
|
|
|
@ -130,7 +130,7 @@ class FApplication : public FWidget
|
|||
static void closeConfirmationDialog (FWidget*, FCloseEvent*);
|
||||
|
||||
// Callback method
|
||||
void cb_exitApp (FWidget*, FDataPtr);
|
||||
void cb_exitApp (const FWidget*, const FDataPtr);
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
|
@ -148,9 +148,9 @@ class FApplication : public FWidget
|
|||
void escapeKeyPressed();
|
||||
void performKeyboardAction();
|
||||
void sendEscapeKeyPressEvent();
|
||||
bool sendKeyDownEvent (FWidget*);
|
||||
bool sendKeyPressEvent (FWidget*);
|
||||
bool sendKeyUpEvent (FWidget*);
|
||||
bool sendKeyDownEvent (const FWidget*);
|
||||
bool sendKeyPressEvent (const FWidget*);
|
||||
bool sendKeyUpEvent (const FWidget*);
|
||||
void sendKeyboardAccelerator();
|
||||
void processKeyboardEvent();
|
||||
bool processDialogSwitchAccelerator();
|
||||
|
@ -210,7 +210,7 @@ inline char** FApplication::getArgv() const
|
|||
{ return app_argv; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FApplication::cb_exitApp (FWidget*, FDataPtr)
|
||||
inline void FApplication::cb_exitApp (const FWidget*, const FDataPtr)
|
||||
{ close(); }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -139,8 +139,8 @@ class FButton : public FWidget
|
|||
void init();
|
||||
void setHotkeyAccelerator();
|
||||
void detectHotkey();
|
||||
std::size_t clickAnimationIndent (FWidget*);
|
||||
void clearRightMargin (FWidget*);
|
||||
std::size_t clickAnimationIndent (const FWidget*);
|
||||
void clearRightMargin (const FWidget*);
|
||||
void drawMarginLeft();
|
||||
void drawMarginRight();
|
||||
void drawTopBottomBackground();
|
||||
|
|
|
@ -101,7 +101,7 @@ class FButtonGroup : public FScrollView
|
|||
void hide() override;
|
||||
void insert (FToggleButton*);
|
||||
void remove (FToggleButton*);
|
||||
void checkScrollSize (FToggleButton*);
|
||||
void checkScrollSize (const FToggleButton*);
|
||||
void checkScrollSize (const FRect&);
|
||||
|
||||
// Event handlers
|
||||
|
@ -130,7 +130,7 @@ class FButtonGroup : public FScrollView
|
|||
void directFocus();
|
||||
|
||||
// Callback method
|
||||
void cb_buttonToggled (FWidget*, FDataPtr);
|
||||
void cb_buttonToggled (FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FString text{};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* Copyright 2018-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -35,6 +35,8 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "final/fstring.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -47,23 +49,23 @@ namespace finalcut
|
|||
class FColorPalette final
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
using func = std::function<void(FColor, int, int, int)>;
|
||||
|
||||
// Constructor
|
||||
FColorPalette() = default;
|
||||
|
||||
// Destructor
|
||||
~FColorPalette();
|
||||
|
||||
// Typedefs
|
||||
typedef void (*funcp)(FColor, int, int, int);
|
||||
|
||||
// Accessor
|
||||
const FString getClassName() const;
|
||||
|
||||
// Methods
|
||||
static void set8ColorPalette (funcp);
|
||||
static void set16ColorPalette (funcp);
|
||||
static void reset8ColorPalette (funcp);
|
||||
static void reset16ColorPalette (funcp);
|
||||
static void set8ColorPalette (func);
|
||||
static void set16ColorPalette (func);
|
||||
static void reset8ColorPalette (func);
|
||||
static void reset16ColorPalette (func);
|
||||
};
|
||||
|
||||
// FColorPalette inline functions
|
||||
|
|
|
@ -216,10 +216,10 @@ class FComboBox : public FWidget
|
|||
void processChanged();
|
||||
|
||||
// Callback methods
|
||||
void cb_setInputField (FWidget*, FDataPtr);
|
||||
void cb_closeComboBox (FWidget*, FDataPtr);
|
||||
void cb_inputFieldSwitch (FWidget*, FDataPtr);
|
||||
void cb_inputFieldHandOver (FWidget*, FDataPtr);
|
||||
void cb_setInputField (const FWidget*, const FDataPtr);
|
||||
void cb_closeComboBox (const FWidget*, const FDataPtr);
|
||||
void cb_inputFieldSwitch (const FWidget*, const FDataPtr);
|
||||
void cb_inputFieldHandOver (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FLineEdit input_field{this};
|
||||
|
|
|
@ -50,9 +50,7 @@
|
|||
#endif
|
||||
|
||||
/* Define to 1 if GPM mouse is enabled */
|
||||
#ifndef F_HAVE_LIBGPM
|
||||
#define F_HAVE_LIBGPM 1
|
||||
#endif
|
||||
/* #undef HAVE_LIBGPM */
|
||||
|
||||
/* Define to 1 if you have the <linux/fb.h> header file. */
|
||||
#ifndef F_HAVE_LINUX_FB_H
|
||||
|
|
|
@ -195,7 +195,7 @@ class FDialog : public FWindow
|
|||
void leaveZoomButton (const mouseStates&);
|
||||
void pressZoomButton (const mouseStates&);
|
||||
bool isMouseOverMenu (const FPoint&);
|
||||
void passEventToSubMenu (const mouseStates&, FMouseEvent*);
|
||||
void passEventToSubMenu (const mouseStates&, const FMouseEvent*);
|
||||
void moveSizeKey (FKeyEvent*);
|
||||
void raiseActivateDialog();
|
||||
void lowerActivateDialog();
|
||||
|
@ -207,12 +207,12 @@ class FDialog : public FWindow
|
|||
void acceptMoveSize();
|
||||
void cancelMoveSize();
|
||||
static void addDialog (FWidget*);
|
||||
static void delDialog (FWidget*);
|
||||
static void delDialog (const FWidget*);
|
||||
|
||||
// Callback methods
|
||||
void cb_move (FWidget*, FDataPtr);
|
||||
void cb_zoom (FWidget*, FDataPtr);
|
||||
void cb_close (FWidget*, FDataPtr);
|
||||
void cb_move (const FWidget*, const FDataPtr);
|
||||
void cb_zoom (const FWidget*, const FDataPtr);
|
||||
void cb_close (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FString tb_text{}; // title bar text
|
||||
|
|
|
@ -162,12 +162,12 @@ class FFileDialog : public FDialog
|
|||
void init();
|
||||
void widgetSettings (const FPoint&);
|
||||
void initCallbacks();
|
||||
bool pattern_match (const char* const, char[]);
|
||||
bool pattern_match (const char* const, const char[]);
|
||||
void clear();
|
||||
sInt64 numOfDirs();
|
||||
void sortDir();
|
||||
int readDir();
|
||||
void getEntry (const char* const, struct dirent*);
|
||||
void getEntry (const char* const, const struct dirent*);
|
||||
void followSymLink (const char* const, dir_entry&);
|
||||
void dirEntriesToList();
|
||||
void selectDirectoryEntry (const char* const);
|
||||
|
@ -176,12 +176,12 @@ class FFileDialog : public FDialog
|
|||
static const FString getHomeDir();
|
||||
|
||||
// Callback methods
|
||||
void cb_processActivate (FWidget*, FDataPtr);
|
||||
void cb_processRowChanged (FWidget*, FDataPtr);
|
||||
void cb_processClicked (FWidget*, FDataPtr);
|
||||
void cb_processCancel (FWidget*, FDataPtr);
|
||||
void cb_processOpen (FWidget*, FDataPtr);
|
||||
void cb_processShowHidden (FWidget*, FDataPtr);
|
||||
void cb_processActivate (const FWidget*, const FDataPtr);
|
||||
void cb_processRowChanged (const FWidget*, const FDataPtr);
|
||||
void cb_processClicked (const FWidget*, const FDataPtr);
|
||||
void cb_processCancel (const FWidget*, const FDataPtr);
|
||||
void cb_processOpen (const FWidget*, const FDataPtr);
|
||||
void cb_processShowHidden (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
static FSystem* fsystem;
|
||||
|
|
|
@ -122,7 +122,7 @@ class FLabel : public FWidget
|
|||
void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_accelWidgetDestroyed (FWidget*, FDataPtr);
|
||||
void cb_accelWidgetDestroyed (const FWidget*, const FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
|
|
|
@ -309,8 +309,8 @@ class FListBox : public FWidget
|
|||
listBoxItems::iterator index2iterator (std::size_t);
|
||||
listBoxItems::const_iterator index2iterator (std::size_t index) const;
|
||||
// Callback methods
|
||||
void cb_vbarChange (FWidget*, FDataPtr);
|
||||
void cb_hbarChange (FWidget*, FDataPtr);
|
||||
void cb_vbarChange (const FWidget*, const FDataPtr);
|
||||
void cb_hbarChange (const FWidget*, const FDataPtr);
|
||||
|
||||
// Function Pointer
|
||||
lazyInsert lazy_inserter{};
|
||||
|
|
|
@ -188,7 +188,7 @@ class FListViewIterator
|
|||
typedef std::stack<iterator> iterator_stack;
|
||||
|
||||
// Constructor
|
||||
FListViewIterator () = default;
|
||||
FListViewIterator ();
|
||||
FListViewIterator (iterator);
|
||||
|
||||
// Overloaded operators
|
||||
|
@ -374,7 +374,7 @@ class FListView : public FWidget
|
|||
static iterator& getNullIterator();
|
||||
|
||||
// Mutators
|
||||
static void setNullIterator (iterator&);
|
||||
static void setNullIterator (const iterator&);
|
||||
|
||||
// Inquiry
|
||||
bool isHorizontallyScrollable();
|
||||
|
@ -389,7 +389,7 @@ class FListView : public FWidget
|
|||
std::size_t getAlignOffset ( const fc::text_alignment
|
||||
, const std::size_t
|
||||
, const std::size_t );
|
||||
iterator getListEnd (FListViewItem*);
|
||||
iterator getListEnd (const FListViewItem*);
|
||||
void draw() override;
|
||||
void drawBorder() override;
|
||||
void drawScrollbars();
|
||||
|
@ -444,8 +444,8 @@ class FListView : public FWidget
|
|||
bool hasCheckableItems() const;
|
||||
|
||||
// Callback methods
|
||||
void cb_vbarChange (FWidget*, FDataPtr);
|
||||
void cb_hbarChange (FWidget*, FDataPtr);
|
||||
void cb_vbarChange (const FWidget*, const FDataPtr);
|
||||
void cb_hbarChange (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
iterator root{};
|
||||
|
@ -494,7 +494,8 @@ class FListView : public FWidget
|
|||
struct FListView::Header
|
||||
{
|
||||
public:
|
||||
Header() = default;
|
||||
Header()
|
||||
{ }
|
||||
|
||||
FString name{};
|
||||
fc::text_alignment alignment{fc::alignLeft};
|
||||
|
@ -586,7 +587,7 @@ FObject::iterator
|
|||
std::transform ( std::begin(list)
|
||||
, std::end(list)
|
||||
, std::back_inserter(str_cols)
|
||||
, [] (const T& col) -> const FString
|
||||
, [] (const T& col)
|
||||
{
|
||||
const FString s(FString() << col);
|
||||
return s;
|
||||
|
@ -622,7 +623,7 @@ FObject::iterator
|
|||
std::transform ( std::begin(cols)
|
||||
, std::end(cols)
|
||||
, std::back_inserter(str_cols)
|
||||
, [] (const ColT& col) -> const FString
|
||||
, [] (const ColT& col)
|
||||
{
|
||||
const FString s(FString() << col);
|
||||
return s;
|
||||
|
|
|
@ -121,7 +121,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_menuitemToggled (FWidget*, FDataPtr);
|
||||
void cb_menuitemToggled (FWidget*, const FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
|
@ -175,7 +175,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
void hideSubMenus();
|
||||
void hideSuperMenus();
|
||||
bool mouseDownOverList (FPoint);
|
||||
void mouseDownSubmenu (FMenuItem*);
|
||||
void mouseDownSubmenu (const FMenuItem*);
|
||||
void mouseDownSelection (FMenuItem*, bool&);
|
||||
bool mouseUpOverList (FPoint);
|
||||
void mouseMoveOverList (FPoint, mouseStates&);
|
||||
|
@ -198,12 +198,12 @@ class FMenu : public FWindow, public FMenuList
|
|||
void drawItems();
|
||||
void drawSeparator (int);
|
||||
void drawMenuLine (FMenuItem*, int);
|
||||
void drawCheckMarkPrefix (FMenuItem*);
|
||||
void drawCheckMarkPrefix (const FMenuItem*);
|
||||
void drawMenuText (menuText&);
|
||||
void drawSubMenuIndicator (std::size_t&);
|
||||
void drawAcceleratorKey (std::size_t&, FKey);
|
||||
void drawTrailingSpaces (std::size_t);
|
||||
void setLineAttributes (FMenuItem*, int);
|
||||
void setLineAttributes (const FMenuItem*, int);
|
||||
void setCursorToHotkeyPosition (FMenuItem*);
|
||||
void selectPrevMenu (FKeyEvent*);
|
||||
void selectNextMenu (FKeyEvent*);
|
||||
|
|
|
@ -98,7 +98,7 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_itemDeactivated (FWidget*, FDataPtr);
|
||||
void cb_itemDeactivated (FWidget*, const FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
|
@ -125,14 +125,14 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
void draw() override;
|
||||
void drawItems();
|
||||
void drawItem (FMenuItem*, std::size_t&);
|
||||
void setLineAttributes (FMenuItem*);
|
||||
void setLineAttributes (const FMenuItem*);
|
||||
void setCursorToHotkeyPosition (FMenuItem*, std::size_t);
|
||||
void drawMenuText (menuText&);
|
||||
void drawEllipsis (const menuText&, std::size_t);
|
||||
void drawLeadingSpace (std::size_t&);
|
||||
void drawTrailingSpace (std::size_t&);
|
||||
void adjustItems();
|
||||
bool activateMenu (FMenuItem*);
|
||||
bool activateMenu (const FMenuItem*);
|
||||
bool clickItem (FMenuItem*);
|
||||
void unselectMenuItem (FMenuItem*);
|
||||
void selectMenuItem (FMenuItem*);
|
||||
|
|
|
@ -145,9 +145,9 @@ class FMenuItem : public FWidget
|
|||
void setSuperMenu (FWidget*);
|
||||
|
||||
// Inquiries
|
||||
bool isDialog (FWidget*) const;
|
||||
bool isMenuBar (FWidget*) const;
|
||||
bool isMenu (FWidget*) const;
|
||||
bool isDialog (const FWidget*) const;
|
||||
bool isMenuBar (const FWidget*) const;
|
||||
bool isMenu (const FWidget*) const;
|
||||
|
||||
private:
|
||||
// Accessor
|
||||
|
@ -160,11 +160,11 @@ class FMenuItem : public FWidget
|
|||
void processDeactivate();
|
||||
void createDialogList (FMenu*);
|
||||
template <typename T>
|
||||
void passMouseEvent (T, FMouseEvent*, fc::events);
|
||||
void passMouseEvent (T, const FMouseEvent*, fc::events);
|
||||
|
||||
// Callback methods
|
||||
void cb_switchToDialog (FWidget*, FDataPtr);
|
||||
void cb_destroyDialog (FWidget*, FDataPtr);
|
||||
void cb_switchToDialog (const FWidget*, FDataPtr);
|
||||
void cb_destroyDialog (FWidget*, const FDataPtr);
|
||||
|
||||
virtual void processClicked();
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class FMessageBox : public FDialog
|
|||
void adjustSize() override;
|
||||
|
||||
// Callback method
|
||||
void cb_processClick (FWidget*, FDataPtr);
|
||||
void cb_processClick (const FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Methods
|
||||
|
|
|
@ -172,7 +172,7 @@ class FMouse
|
|||
void setNewPos (int, int);
|
||||
void setPending (bool);
|
||||
void setEvent();
|
||||
void setMousePressedTime (timeval*);
|
||||
void setMousePressedTime (const timeval*);
|
||||
void resetMousePressedTime();
|
||||
|
||||
// Inquiry
|
||||
|
@ -448,9 +448,15 @@ class FMouseControl
|
|||
// Constructor
|
||||
FMouseControl();
|
||||
|
||||
// Disable copy constructor
|
||||
FMouseControl (const FMouseControl&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMouseControl();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FMouseControl& operator = (const FMouseControl&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const FString getClassName() const;
|
||||
FPoint& getPos();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -120,7 +120,7 @@ class FObject
|
|||
|
||||
// Timer methods
|
||||
static void getCurrentTime (timeval*);
|
||||
static bool isTimeout (timeval*, uInt64);
|
||||
static bool isTimeout (const timeval*, uInt64);
|
||||
int addTimer (int);
|
||||
bool delTimer (int);
|
||||
bool delOwnTimer();
|
||||
|
|
|
@ -130,7 +130,7 @@ class FOptiAttr final
|
|||
const FString getClassName() const;
|
||||
|
||||
// Mutators
|
||||
void setTermEnvironment (termEnv&);
|
||||
void setTermEnvironment (const termEnv&);
|
||||
void setMaxColor (const int&);
|
||||
void setNoColorVideo (int);
|
||||
void setDefaultColorSupport();
|
||||
|
@ -274,13 +274,13 @@ class FOptiAttr final
|
|||
void change_current_color (const FChar* const&, FColor, FColor);
|
||||
void resetAttribute (FChar*&);
|
||||
void reset (FChar*&);
|
||||
bool caused_reset_attributes (char[], uChar = all_tests);
|
||||
bool caused_reset_attributes (const char[], uChar = all_tests);
|
||||
bool hasCharsetEquivalence();
|
||||
void detectSwitchOn (const FChar* const&, const FChar* const&);
|
||||
void detectSwitchOff (const FChar* const&, const FChar* const&);
|
||||
bool switchOn();
|
||||
bool switchOff();
|
||||
bool append_sequence (char[]);
|
||||
bool append_sequence (const char[]);
|
||||
|
||||
// Data members
|
||||
capability F_enter_bold_mode{};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -135,7 +135,7 @@ class FOptiMove final
|
|||
void setBaudRate (int);
|
||||
void setTabStop (int);
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
void setTermEnvironment (termEnv&);
|
||||
void setTermEnvironment (const termEnv&);
|
||||
void set_cursor_home (char[]);
|
||||
void set_cursor_to_ll (char[]);
|
||||
void set_carriage_return (char[]);
|
||||
|
@ -183,7 +183,7 @@ class FOptiMove final
|
|||
|
||||
// Methods
|
||||
void calculateCharDuration();
|
||||
int capDuration (char[], int);
|
||||
int capDuration (const char[], int);
|
||||
int capDurationToLength (int);
|
||||
int repeatedAppend (const capability&, volatile int, char*);
|
||||
int relativeMove (char[], int, int, int, int);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* Copyright 2014-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -51,8 +51,8 @@ class FPoint
|
|||
public:
|
||||
// Constructors
|
||||
FPoint () = default;
|
||||
FPoint (const FPoint&); // copy constructor
|
||||
FPoint (FPoint&&); // move constructor
|
||||
FPoint (const FPoint&); // copy constructor
|
||||
FPoint (FPoint&&) noexcept; // move constructor
|
||||
FPoint (int, int);
|
||||
|
||||
// Destructor
|
||||
|
@ -60,7 +60,7 @@ class FPoint
|
|||
|
||||
// Overloaded operators
|
||||
FPoint& operator = (const FPoint&);
|
||||
FPoint& operator = (FPoint&&);
|
||||
FPoint& operator = (FPoint&&) noexcept;
|
||||
FPoint& operator += (const FPoint&);
|
||||
FPoint& operator -= (const FPoint&);
|
||||
|
||||
|
@ -108,7 +108,7 @@ inline FPoint::FPoint (const FPoint& p) // copy constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FPoint::FPoint (FPoint&& p) // move constructor
|
||||
inline FPoint::FPoint (FPoint&& p) noexcept // move constructor
|
||||
: xpos(p.xpos)
|
||||
, ypos(p.ypos)
|
||||
{ p.xpos = p.ypos = 0; }
|
||||
|
|
|
@ -59,8 +59,8 @@ class FRect
|
|||
public:
|
||||
// Constructors
|
||||
FRect () = default;
|
||||
FRect (const FRect&); // copy constructor
|
||||
FRect (FRect&&); // move constructor
|
||||
FRect (const FRect&); // copy constructor
|
||||
FRect (FRect&&) noexcept; // move constructor
|
||||
FRect (int, int, std::size_t, std::size_t);
|
||||
FRect (const FPoint&, const FSize&);
|
||||
FRect (const FPoint&, const FPoint&);
|
||||
|
@ -70,7 +70,7 @@ class FRect
|
|||
|
||||
// Overloaded operators
|
||||
FRect& operator = (const FRect&);
|
||||
FRect& operator = (FRect&&);
|
||||
FRect& operator = (FRect&&) noexcept;
|
||||
|
||||
// Accessors
|
||||
virtual const FString getClassName();
|
||||
|
@ -155,7 +155,7 @@ inline FRect::FRect (const FRect& r) // copy constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FRect::FRect (FRect&& r) // move constructor
|
||||
inline FRect::FRect (FRect&& r) noexcept // move constructor
|
||||
: X1(r.X1)
|
||||
, Y1(r.Y1)
|
||||
, X2(r.X2)
|
||||
|
|
|
@ -159,7 +159,7 @@ class FScrollView : public FWidget
|
|||
FPoint getViewportCursorPos();
|
||||
|
||||
// Methods
|
||||
void init (FWidget*);
|
||||
void init (const FWidget*);
|
||||
void mapKeyFunctions();
|
||||
void calculateScrollbarPos();
|
||||
template<typename Callback>
|
||||
|
@ -171,8 +171,8 @@ class FScrollView : public FWidget
|
|||
void setViewportCursor();
|
||||
|
||||
// Callback methods
|
||||
void cb_vbarChange (FWidget*, FDataPtr);
|
||||
void cb_hbarChange (FWidget*, FDataPtr);
|
||||
void cb_vbarChange (const FWidget*, const FDataPtr);
|
||||
void cb_hbarChange (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FRect scroll_geometry{1, 1, 1, 1};
|
||||
|
|
|
@ -56,8 +56,8 @@ class FSize
|
|||
public:
|
||||
// Constructors
|
||||
FSize () = default;
|
||||
FSize (const FSize&); // copy constructor
|
||||
FSize (FSize&&); // move constructor
|
||||
FSize (const FSize&); // copy constructor
|
||||
FSize (FSize&&) noexcept; // move constructor
|
||||
FSize (std::size_t, std::size_t);
|
||||
|
||||
// Destructor
|
||||
|
@ -65,7 +65,7 @@ class FSize
|
|||
|
||||
// Overloaded operators
|
||||
FSize& operator = (const FSize&);
|
||||
FSize& operator = (FSize&&);
|
||||
FSize& operator = (FSize&&) noexcept;
|
||||
FSize& operator += (const FSize&);
|
||||
FSize& operator -= (const FSize&);
|
||||
|
||||
|
@ -117,7 +117,7 @@ inline FSize::FSize (const FSize& s) // copy constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FSize::FSize (FSize&& s) // move constructor
|
||||
inline FSize::FSize (FSize&& s) noexcept // move constructor
|
||||
: width(s.width)
|
||||
, height(s.height)
|
||||
{ s.width = s.height = 0; }
|
||||
|
|
|
@ -139,7 +139,7 @@ class FSpinBox : public FWidget
|
|||
void forceFocus();
|
||||
|
||||
// Callback methods
|
||||
void cb_inputFieldChange (finalcut::FWidget*, FDataPtr);
|
||||
void cb_inputFieldChange (finalcut::FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FLineEdit input_field{this};
|
||||
|
|
|
@ -226,7 +226,7 @@ class FStatusBar : public FWindow
|
|||
void onMouseMove (FMouseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_statuskey_activated (FWidget*, FDataPtr);
|
||||
void cb_statuskey_activated (FWidget*, const FDataPtr);
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
|
|
|
@ -88,7 +88,7 @@ class FString
|
|||
explicit FString (std::size_t);
|
||||
FString (std::size_t, wchar_t);
|
||||
FString (const FString&); // implicit conversion copy constructor
|
||||
FString (FString&&); // implicit conversion move constructor
|
||||
FString (FString&&) noexcept; // implicit conversion move constructor
|
||||
FString (const std::wstring&); // implicit conversion constructor
|
||||
FString (const wchar_t[]); // implicit conversion constructor
|
||||
FString (const std::string&); // implicit conversion constructor
|
||||
|
@ -102,7 +102,7 @@ class FString
|
|||
|
||||
// Overloaded operators
|
||||
FString& operator = (const FString&);
|
||||
FString& operator = (FString&&);
|
||||
FString& operator = (FString&&) noexcept;
|
||||
|
||||
const FString& operator += (const FString&);
|
||||
|
||||
|
|
|
@ -430,12 +430,14 @@ inline void FTerm::putstringf (const char format[], Args&&... args)
|
|||
return;
|
||||
|
||||
if ( ! fsys )
|
||||
getFSystem();
|
||||
getFSystem(); // Trying to set fsys
|
||||
|
||||
const std::size_t count = std::size_t(size);
|
||||
std::vector<char> buf(count);
|
||||
std::snprintf (&buf[0], count, format, std::forward<Args>(args)...);
|
||||
fsys->tputs (&buf[0], 1, FTerm::putchar_ASCII);
|
||||
|
||||
if ( fsys )
|
||||
fsys->tputs (&buf[0], 1, FTerm::putchar_ASCII);
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -81,9 +81,15 @@ class FTermDetection final
|
|||
// Constructors
|
||||
FTermDetection();
|
||||
|
||||
// Disable copy constructor
|
||||
FTermDetection (const FTermDetection&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FTermDetection();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FTermDetection& operator = (const FTermDetection&) = delete;
|
||||
|
||||
// Accessor
|
||||
const FString getClassName() const;
|
||||
static char* getTermType();
|
||||
|
@ -143,7 +149,7 @@ class FTermDetection final
|
|||
static void setScreenTerm (bool);
|
||||
static void setTmuxTerm (bool);
|
||||
static void setTerminalDetection (bool);
|
||||
static void setTtyTypeFileName (char[]);
|
||||
static void setTtyTypeFileName (const char[]);
|
||||
|
||||
// Methods
|
||||
static void detect();
|
||||
|
@ -172,10 +178,10 @@ class FTermDetection final
|
|||
static char* secDA_Analysis_0 (char[]);
|
||||
static char* secDA_Analysis_1 (char[]);
|
||||
static char* secDA_Analysis_24 (char[]);
|
||||
static char* secDA_Analysis_32 (char[]);
|
||||
static char* secDA_Analysis_32 (const char[]);
|
||||
static char* secDA_Analysis_65 (char[]);
|
||||
static char* secDA_Analysis_67 (char[]);
|
||||
static char* secDA_Analysis_77 (char[]);
|
||||
static char* secDA_Analysis_67 (const char[]);
|
||||
static char* secDA_Analysis_77 (const char[]);
|
||||
static char* secDA_Analysis_82 ();
|
||||
static char* secDA_Analysis_83 (char[]);
|
||||
static char* secDA_Analysis_84 (char[]);
|
||||
|
|
|
@ -157,8 +157,8 @@ class FTextView : public FWidget
|
|||
void changeOnResize();
|
||||
|
||||
// Callback methods
|
||||
void cb_vbarChange (FWidget*, FDataPtr);
|
||||
void cb_hbarChange (FWidget*, FDataPtr);
|
||||
void cb_vbarChange (const FWidget*, const FDataPtr);
|
||||
void cb_hbarChange (const FWidget*, const FDataPtr);
|
||||
|
||||
// Data members
|
||||
FStringList data{};
|
||||
|
|
|
@ -102,7 +102,17 @@ class FVTerm
|
|||
|
||||
struct FVTermPreprocessing
|
||||
{
|
||||
FVTerm* instance;
|
||||
FVTermPreprocessing()
|
||||
: instance(nullptr)
|
||||
, function(nullptr)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f)
|
||||
: instance(i)
|
||||
, function(f)
|
||||
{ }
|
||||
|
||||
const FVTerm* instance;
|
||||
FPreprocessingFunction function;
|
||||
};
|
||||
|
||||
|
@ -296,9 +306,9 @@ class FVTerm
|
|||
void resizeVTerm (const FSize&);
|
||||
void putVTerm();
|
||||
void updateTerminal();
|
||||
virtual void addPreprocessingHandler ( FVTerm*
|
||||
, FPreprocessingFunction );
|
||||
virtual void delPreprocessingHandler (FVTerm*);
|
||||
virtual void addPreprocessingHandler ( const FVTerm*
|
||||
, const FPreprocessingFunction& );
|
||||
virtual void delPreprocessingHandler (const FVTerm*);
|
||||
template<typename... Args>
|
||||
int printf (const FString&, Args&&...);
|
||||
int print (const FString&);
|
||||
|
@ -310,6 +320,7 @@ class FVTerm
|
|||
int print (wchar_t);
|
||||
int print (FTermArea*, wchar_t);
|
||||
int print (FChar&);
|
||||
int print (FTermArea*, const FChar&);
|
||||
int print (FTermArea*, FChar&);
|
||||
virtual void print (const FPoint&);
|
||||
virtual void print (const FStyle&);
|
||||
|
@ -360,10 +371,10 @@ class FVTerm
|
|||
bool updateVTermCursor (FTermArea*);
|
||||
static void setAreaCursor ( const FPoint&
|
||||
, bool, FTermArea* );
|
||||
static void getArea (const FPoint&, FTermArea*);
|
||||
static void getArea (const FRect&, FTermArea*);
|
||||
static void getArea (const FPoint&, const FTermArea*);
|
||||
static void getArea (const FRect&, const FTermArea*);
|
||||
void putArea (FTermArea*);
|
||||
static void putArea (const FPoint&, FTermArea*);
|
||||
static void putArea (const FPoint&, const FTermArea*);
|
||||
void scrollAreaForward (FTermArea*);
|
||||
void scrollAreaReverse (FTermArea*);
|
||||
void clearArea (FTermArea*, int = ' ');
|
||||
|
@ -397,22 +408,22 @@ class FVTerm
|
|||
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
||||
|
||||
// Methods
|
||||
void setTextToDefault (FTermArea*, const FSize&);
|
||||
void setTextToDefault (const FTermArea*, const FSize&);
|
||||
static bool reallocateTextArea ( FTermArea*
|
||||
, std::size_t
|
||||
, std::size_t );
|
||||
static bool reallocateTextArea ( FTermArea*
|
||||
, std::size_t );
|
||||
static covered_state isCovered (const FPoint&, FTermArea*);
|
||||
static void updateOverlappedColor ( FTermArea*
|
||||
static covered_state isCovered (const FPoint&, const FTermArea*);
|
||||
static void updateOverlappedColor ( const FTermArea*
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateOverlappedCharacter ( FTermArea*
|
||||
static void updateOverlappedCharacter ( const FTermArea*
|
||||
, const FPoint& );
|
||||
static void updateShadedCharacter ( FTermArea*
|
||||
static void updateShadedCharacter ( const FTermArea*
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateInheritBackground ( FTermArea*
|
||||
static void updateInheritBackground ( const FTermArea*
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateCharacter ( FTermArea*
|
||||
|
@ -422,10 +433,10 @@ class FVTerm
|
|||
, const FPoint&
|
||||
, const FPoint& );
|
||||
void updateVTerm();
|
||||
static void callPreprocessingHandler (FTermArea*);
|
||||
static void callPreprocessingHandler (const FTermArea*);
|
||||
bool hasChildAreaChanges (FTermArea*);
|
||||
void clearChildAreaChanges (FTermArea*);
|
||||
static bool isInsideArea (const FPoint&, FTermArea*);
|
||||
void clearChildAreaChanges (const FTermArea*);
|
||||
static bool isInsideArea (const FPoint&, const FTermArea*);
|
||||
static FChar generateCharacter (const FPoint&);
|
||||
static FChar getCharacter ( character_type
|
||||
, const FPoint&
|
||||
|
@ -433,16 +444,16 @@ class FVTerm
|
|||
static FChar getCoveredCharacter (const FPoint&, FVTerm*);
|
||||
static FChar getOverlappedCharacter (const FPoint&, FVTerm*);
|
||||
void init (bool);
|
||||
static void init_characterLengths (FOptiMove*);
|
||||
static void init_characterLengths (const FOptiMove*);
|
||||
void finish();
|
||||
static void putAreaLine (FChar*, FChar*, int);
|
||||
static void putAreaLine (const FChar*, FChar*, int);
|
||||
static void putAreaCharacter ( const FPoint&, FVTerm*
|
||||
, FChar*, FChar* );
|
||||
static void getAreaCharacter ( const FPoint&, FTermArea*
|
||||
static void getAreaCharacter ( const FPoint&, const FTermArea*
|
||||
, FChar*& );
|
||||
bool clearTerm (int = ' ');
|
||||
bool clearFullArea (FTermArea*, FChar&);
|
||||
static void clearAreaWithShadow (FTermArea*, const FChar&);
|
||||
bool clearFullArea (const FTermArea*, FChar&);
|
||||
static void clearAreaWithShadow (const FTermArea*, const FChar&);
|
||||
static bool canClearToEOL (uInt, uInt);
|
||||
static bool canClearLeadingWS (uInt&, uInt);
|
||||
static bool canClearTrailingWS (uInt&, uInt);
|
||||
|
|
|
@ -130,7 +130,7 @@ class FWidgetColors;
|
|||
class FWidget : public FVTerm, public FObject
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
// Using-declaration
|
||||
using FVTerm::setColor;
|
||||
using FVTerm::print;
|
||||
|
||||
|
@ -320,7 +320,7 @@ class FWidget : public FVTerm, public FObject
|
|||
, FCallback
|
||||
, FDataPtr = nullptr );
|
||||
void delCallback (FCallback);
|
||||
void delCallback (FWidget*);
|
||||
void delCallback (const FWidget*);
|
||||
void delCallbacks();
|
||||
void emitCallback (const FString&);
|
||||
void addAccelerator (FKey);
|
||||
|
@ -342,6 +342,20 @@ class FWidget : public FVTerm, public FObject
|
|||
protected:
|
||||
struct FCallbackData
|
||||
{
|
||||
FCallbackData()
|
||||
: cb_signal()
|
||||
, cb_instance(nullptr)
|
||||
, cb_function()
|
||||
, data(nullptr)
|
||||
{ }
|
||||
|
||||
FCallbackData (FString s, FWidget* i, FCallback c, FDataPtr d)
|
||||
: cb_signal(s)
|
||||
, cb_instance(i)
|
||||
, cb_function(c)
|
||||
, data(d)
|
||||
{ }
|
||||
|
||||
FString cb_signal;
|
||||
FWidget* cb_instance;
|
||||
FCallback cb_function;
|
||||
|
@ -358,8 +372,9 @@ class FWidget : public FVTerm, public FObject
|
|||
static FWidgetList*& getDialogList();
|
||||
static FWidgetList*& getAlwaysOnTopList();
|
||||
static FWidgetList*& getWidgetCloseList();
|
||||
void addPreprocessingHandler (FVTerm*, FPreprocessingFunction) override;
|
||||
void delPreprocessingHandler (FVTerm*) override;
|
||||
void addPreprocessingHandler ( const FVTerm*
|
||||
, const FPreprocessingFunction& ) override;
|
||||
void delPreprocessingHandler (const FVTerm*) override;
|
||||
|
||||
// Inquiry
|
||||
bool isChildPrintArea() const;
|
||||
|
@ -407,10 +422,10 @@ class FWidget : public FVTerm, public FObject
|
|||
void insufficientSpaceAdjust();
|
||||
void KeyPressEvent (FKeyEvent*);
|
||||
void KeyDownEvent (FKeyEvent*);
|
||||
void emitWheelCallback (FWheelEvent*);
|
||||
void emitWheelCallback (const FWheelEvent*);
|
||||
void setWindowFocus (bool);
|
||||
FCallbackPtr getCallbackPtr (FCallback);
|
||||
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
|
||||
bool changeFocus (FWidget*, const FWidget*, fc::FocusTypes);
|
||||
void processDestroy();
|
||||
virtual void draw();
|
||||
void drawWindows();
|
||||
|
@ -538,9 +553,9 @@ void drawBlockShadow (FWidget*);
|
|||
void clearShadow (FWidget*);
|
||||
void drawFlatBorder (FWidget*);
|
||||
void clearFlatBorder (FWidget*);
|
||||
void checkBorder (FWidget*, FRect&);
|
||||
void drawBorder (FWidget*, FRect);
|
||||
void drawListBorder (FWidget*, FRect);
|
||||
void checkBorder (const FWidget*, FRect&);
|
||||
void drawBorder (FWidget*, const FRect&);
|
||||
void drawListBorder (FWidget*, const FRect&);
|
||||
void drawBox (FWidget*, const FRect&);
|
||||
void drawNewFontBox (FWidget*, const FRect&);
|
||||
void drawNewFontListBox (FWidget*, const FRect&);
|
||||
|
|
|
@ -136,8 +136,8 @@ class FWindow : public FWidget
|
|||
static FWindow* getWindowWidgetAt (const FPoint&);
|
||||
static FWindow* getWindowWidgetAt (int, int);
|
||||
static void addWindow (FWidget*);
|
||||
static void delWindow (FWidget*);
|
||||
static void swapWindow (FWidget*, FWidget*);
|
||||
static void delWindow (const FWidget*);
|
||||
static void swapWindow (const FWidget*, const FWidget*);
|
||||
static bool raiseWindow (FWidget*);
|
||||
bool raiseWindow ();
|
||||
static bool lowerWindow (FWidget*);
|
||||
|
@ -163,7 +163,7 @@ class FWindow : public FWidget
|
|||
|
||||
private:
|
||||
// Methods
|
||||
static void deleteFromAlwaysOnTopList (FWidget*);
|
||||
static void deleteFromAlwaysOnTopList (const FWidget*);
|
||||
static void processAlwaysOnTop();
|
||||
|
||||
// Data members
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* Copyright 2018-2020 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -1174,13 +1174,13 @@ void FStringTest::convertToNumberTest()
|
|||
CPPUNIT_ASSERT ( str.toShort() == -127 );
|
||||
|
||||
str = "255";
|
||||
CPPUNIT_ASSERT ( str.toUShort() == 255u );
|
||||
CPPUNIT_ASSERT ( str.toUShort() == 255U );
|
||||
|
||||
str = "-32768";
|
||||
CPPUNIT_ASSERT ( str.toInt() == -32768 );
|
||||
|
||||
str = "65535";
|
||||
CPPUNIT_ASSERT ( str.toUInt() == 65535u );
|
||||
CPPUNIT_ASSERT ( str.toUInt() == 65535U );
|
||||
|
||||
str = "-2147483647";
|
||||
CPPUNIT_ASSERT ( str.toLong() == -2147483647 );
|
||||
|
@ -1189,16 +1189,16 @@ void FStringTest::convertToNumberTest()
|
|||
CPPUNIT_ASSERT ( str.toLong() == 987654321 );
|
||||
|
||||
str = "4294967295";
|
||||
CPPUNIT_ASSERT ( str.toULong() == 4294967295u );
|
||||
CPPUNIT_ASSERT ( str.toULong() == 4294967295U );
|
||||
|
||||
str = "+1234567890";
|
||||
CPPUNIT_ASSERT ( str.toULong() == 1234567890u );
|
||||
CPPUNIT_ASSERT ( str.toULong() == 1234567890U );
|
||||
|
||||
str = "3.14159";
|
||||
CPPUNIT_ASSERT ( str.toFloat() == 3.14159f );
|
||||
CPPUNIT_ASSERT ( str.toFloat() == 3.14159F );
|
||||
|
||||
str = "-3.14159";
|
||||
CPPUNIT_ASSERT ( str.toFloat() == -3.14159f );
|
||||
CPPUNIT_ASSERT ( str.toFloat() == -3.14159F );
|
||||
|
||||
str = "3.141592653589793238";
|
||||
CPPUNIT_ASSERT ( str.toDouble() == 3.141592653589793238 );
|
||||
|
@ -1211,20 +1211,20 @@ void FStringTest::convertToNumberTest()
|
|||
void FStringTest::convertFromNumberTest()
|
||||
{
|
||||
constexpr sInt8 n1 = -12;
|
||||
constexpr uInt8 n2 = 12u;
|
||||
constexpr uInt8 n2 = 12U;
|
||||
constexpr sInt16 n3 = -1234;
|
||||
constexpr uInt16 n4 = 1234u;
|
||||
constexpr uInt16 n4 = 1234U;
|
||||
constexpr int n5 = -12345;
|
||||
constexpr uInt n6 = 12345u;
|
||||
constexpr uInt n6 = 12345U;
|
||||
constexpr sInt32 n7 = -12345;
|
||||
constexpr uInt32 n8 = 12345u;
|
||||
constexpr uInt32 n8 = 12345U;
|
||||
constexpr long n9 = -12345678;
|
||||
constexpr uLong n10 = 12345678u;
|
||||
constexpr uLong n10 = 12345678U;
|
||||
constexpr sInt64 n11 = -12345678;
|
||||
constexpr uInt64 n12 = 12345678u;
|
||||
constexpr uInt64 n12 = 12345678U;
|
||||
constexpr std::wint_t n13 = 12345678;
|
||||
constexpr std::size_t n14 = 12345678;
|
||||
constexpr float n15 = 1234.56f;
|
||||
constexpr float n15 = 1234.56F;
|
||||
constexpr double n16 = 1234.5678;
|
||||
constexpr lDouble n17 = 12345.67890L;
|
||||
|
||||
|
|
Loading…
Reference in New Issue