Merge pull request #28 from gansm/master

merge
This commit is contained in:
Markus Gans 2018-12-10 01:54:40 +01:00 committed by GitHub
commit a881b471f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
146 changed files with 6817 additions and 7750 deletions

13
.lgtm.yml Normal file
View File

@ -0,0 +1,13 @@
extraction:
cpp:
prepare:
packages:
- autoconf-archive
configure:
command:
- autoreconf -v --install --force
- ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
index:
build_command:
- make V=1 -j10

View File

@ -18,6 +18,9 @@ addons:
- libgpm-dev
- gperf
- libcppunit-dev
homebrew:
packages:
- autoconf-archive
env:
global:
@ -56,7 +59,7 @@ matrix:
- lsb_release -a
- uname -a
- whoami
- sudo apt-get install gpm libgpm-dev libcppunit-dev
- sudo apt-get install gpm libgpm-dev libcppunit-dev autoconf-archive
script:
- autoreconf -v --install --force
- ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
@ -85,9 +88,8 @@ matrix:
- os: osx
env:
- TEST="macOS"
before_install:
- uname -a
script:
- uname -a
- autoreconf -v --install --force
- ./configure --prefix=/usr
- make -j10

View File

@ -1,3 +1,22 @@
2018-12-09 Markus Gans <guru.mail@muenster.de>
* Better handling of the scrollbar maximum
* Deactivate copy constructor and assignment operator with "= delete"
* Use nullptr instead of 0 to initialize a pointer values
2018-12-06 Markus Gans <guru.mail@muenster.de>
* Easier handling of fc::SpecialCharacter
2018-12-01 Markus Gans <guru.mail@muenster.de>
* Switched to the language standard C++11
* Use delegated constructors and in-class default member initializers
2018-12-01 Markus Gans <guru.mail@muenster.de>
* Improved gpm wheel mouse support
* Fix compile in optimization level 2 for newer gcc
2018-11-27 Markus Gans <guru.mail@muenster.de>
* Correct vertical scrollbar position after sorting in FListView
2018-11-25 Markus Gans <guru.mail@muenster.de>
* Version 0.5.0
* Namespace fix in FTermFreeBSD and FTermOpenBSD

View File

@ -4,7 +4,7 @@
# Process this file with autoconf to produce a configure script.
AC_INIT([finalcut], [0.5.0])
AC_INIT([finalcut], [0.5.1])
AC_CONFIG_HEADER([config.h])
AX_PREFIX_CONFIG_H([src/include/final/fconfig.h], [F])
AC_CONFIG_SRCDIR([src/fobject.cpp])
@ -53,6 +53,7 @@ AC_SEARCH_LIBS([tparm], [termcap tinfo curses ncurses])
# Checks for libtool
AC_ENABLE_SHARED
AC_ENABLE_STATIC
AC_LANG([C++])
LT_INIT([dlopen])
LT_LANG([C++])
LT_OUTPUT
@ -60,7 +61,7 @@ LT_OUTPUT
### This defines the version number of the installed .so files
### Update this value for every release! (A:B:C will map to foo.so.(A-C).C.B)
### using libtool's versioning system.
AC_SUBST(SO_VERSION, ["5:0:5"])
AC_SUBST(SO_VERSION, ["5:1:5"])
AC_SUBST([LIBTOOL_DEPS])
@ -75,6 +76,10 @@ AC_CONFIG_FILES([Makefile
finalcut.spec
finalcut.pc])
# Check for C++11 support
AX_CHECK_COMPILE_FLAG([[-std=c++11]],,
[AC_MSG_ERROR([compiler did not accept -std=c++11])])
# use GPM (General Purpose Mouse)
AC_ARG_WITH([gpm],
[AS_HELP_STRING([--without-gpm], [Disable GPM mouse support])],

View File

@ -1,4 +1,4 @@
examples/.libs/* usr/lib/finalcut/examples
examples/*.cpp usr/lib/finalcut/examples
examples/Makefile.clang usr/lib/finalcut/examples
examples/Makefile.gcc usr/lib/finalcut/examples
examples/.libs/* usr/share/doc/libfinal-examples/examples
examples/*.cpp usr/share/doc/libfinal-examples/examples
examples/Makefile.clang usr/share/doc/libfinal-examples/examples
examples/Makefile.gcc usr/share/doc/libfinal-examples/examples

View File

@ -1,2 +1 @@
usr/lib/finalcut/examples/Makefile.gcc usr/lib/finalcut/examples/Makefile
usr/lib/finalcut/examples usr/share/doc/libfinal-examples/examples
usr/share/doc/libfinal-examples/examples/Makefile.gcc usr/share/doc/libfinal-examples/examples/Makefile

View File

@ -1 +1 @@
libfinal 0 libfinal0 (>= 0.5.0)
libfinal 0 libfinal0 (>= 0.5.1)

9320
debian/libfinal0.symbols vendored

File diff suppressed because it is too large Load Diff

View File

@ -59,9 +59,15 @@ class FClassName
// Constructors
FClassName();
// Disable copy constructor
FClassName (const FClassName&) = delete;
// Destructor
~FClassName();
// Disable assignment operator (=)
FClassName& operator = (const FClassName&) = delete;
// Overloaded operators
// Accessors
@ -100,12 +106,6 @@ class FClassName
// Constants
// Disable copy constructor
FClassName (const FClassName&);
// Disable assignment operator (=)
FClassName& operator = (const FClassName&);
// Accessors
// Inquiries

View File

@ -104,7 +104,7 @@ You need three things:
* libgpm-dev
How to compile FINAL CUT without gpm support?
How to compile FINAL CUT without GPM support?
---------------------------------------------
```bash
@ -112,6 +112,14 @@ How to compile FINAL CUT without gpm support?
```
Which mouse types are supported?
--------------------------------
* Normal xterm mouse tracking (limited to 223 rows/columns)
* Xterm SGR mouse tracking
* URXVT mouse tracking
* General Purpose Mouse (gpm) on a linux console
What do I need to compile the unit tests?
-----------------------------------------
@ -136,3 +144,12 @@ How can I fix display problems?
* If the color palette redefinition causes problems, you can switch off
the color mapping with the parameter *--no-color-change*.
How can I redraw the terminal?
------------------------------
With Ctrl-L you can clear and redraw all information on the terminal screen.
This may be necessary if a background program overwrites the displayed
widgets with other characters.

View File

@ -27,7 +27,7 @@ int main (int argc, char* argv[])
}
```
*(Note: You can close the dialog with the mouse,
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>.)*
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
After entering the source code in *dialog.cpp* you can compile

View File

@ -5,7 +5,7 @@
if ! CPPUNIT_TEST
AM_LDFLAGS = -L$(top_builddir)/src/.libs -lfinal
AM_CPPFLAGS = -I$(top_srcdir)/src/include -Wall -Werror
AM_CPPFLAGS = -I$(top_srcdir)/src/include -Wall -Werror -std=c++11
noinst_PROGRAMS = \
hello \

View File

@ -9,7 +9,7 @@ BINDIR = /usr/local/bin
CXX = clang++
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG) -std=c++11
MAKEFILE = -f Makefile.clang
LDFLAGS = -L../src -lfinal
INCLUDES = -I../src/include -I/usr/include/final
@ -29,7 +29,7 @@ endif
all: $(OBJS)
debug:
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-reserved-id-macro"
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-implicit-fallthrough -Wno-reserved-id-macro"
profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg"

View File

@ -9,7 +9,7 @@ BINDIR = /usr/local/bin
CXX = g++
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG) -std=c++11
MAKEFILE = -f Makefile.gcc
LDFLAGS = -L../src -lfinal
INCLUDES = -I../src/include -I/usr/include/final

View File

@ -43,7 +43,7 @@ class Button : public finalcut::FButton
{
public:
// Constructor
explicit Button (FWidget* = 0);
explicit Button (FWidget* = nullptr);
// Method
void setChecked(bool);
@ -53,14 +53,13 @@ class Button : public finalcut::FButton
private:
// Data Member
bool checked;
bool checked{false};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Button::Button (finalcut::FWidget* parent)
: finalcut::FButton(parent)
, checked(false)
{ }
//----------------------------------------------------------------------
@ -112,7 +111,7 @@ class Calc : public finalcut::FDialog
{
public:
// Constructor
explicit Calc (finalcut::FWidget* parent = 0);
explicit Calc (finalcut::FWidget* parent = nullptr);
// Destructor
~Calc();
@ -217,17 +216,18 @@ class Calc : public finalcut::FDialog
void mapKeyFunctions();
// Data Members
bool error;
bool arcus_mode;
bool hyperbolic_mode;
lDouble a, b;
lDouble infinity;
uInt max_char;
int last_key;
char infix_operator;
char last_infix_operator;
finalcut::FString input;
int button_no[Calc::NUM_OF_BUTTONS];
bool error{false};
bool arcus_mode{false};
bool hyperbolic_mode{false};
lDouble a{0.0L};
lDouble b{0.0L};
lDouble infinity{std::numeric_limits<lDouble>::infinity()};
uInt max_char{33};
int last_key{-1};
char infix_operator{'\0'};
char last_infix_operator{'\0'};
finalcut::FString input{""};
int button_no[Calc::NUM_OF_BUTTONS]{};
struct stack_data
{
@ -235,29 +235,15 @@ class Calc : public finalcut::FDialog
char infix_operator;
};
std::stack<stack_data> bracket_stack;
std::map<Calc::button, Button*> calculator_buttons;
std::map<Calc::button, keyFunction> key_map;
std::stack<stack_data> bracket_stack{};
std::map<Calc::button, Button*> calculator_buttons{};
std::map<Calc::button, keyFunction> key_map{};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Calc::Calc (FWidget* parent)
: finalcut::FDialog(parent)
, error(false)
, arcus_mode(false)
, hyperbolic_mode(false)
, a(0.0L)
, b(0.0L)
, infinity(std::numeric_limits<lDouble>::infinity())
, max_char(33)
, last_key(-1)
, infix_operator('\0')
, last_infix_operator('\0')
, input("")
, bracket_stack()
, calculator_buttons()
, key_map()
{
mapKeyFunctions();
clearInfixOperator();
@ -359,11 +345,11 @@ void Calc::drawDispay()
if ( isNewFont() )
{
wchar_t bottom_line = wchar_t(finalcut::fc::NF_border_line_bottom);
wchar_t top_bottom_line = wchar_t(finalcut::fc::NF_border_line_up_and_down);
wchar_t top_line = wchar_t(finalcut::fc::NF_border_line_upper);
wchar_t right_line = wchar_t(finalcut::fc::NF_rev_border_line_right);
wchar_t left_line = wchar_t(finalcut::fc::NF_border_line_left);
wchar_t bottom_line = finalcut::fc::NF_border_line_bottom;
wchar_t top_bottom_line = finalcut::fc::NF_border_line_up_and_down;
wchar_t top_line = finalcut::fc::NF_border_line_upper;
wchar_t right_line = finalcut::fc::NF_rev_border_line_right;
wchar_t left_line = finalcut::fc::NF_border_line_left;
setPrintPos (3, 2);
print (finalcut::FString(33, bottom_line));
setPrintPos (2, 3);
@ -381,9 +367,9 @@ void Calc::drawDispay()
}
else
{
wchar_t vertical_and_right = wchar_t(finalcut::fc::BoxDrawingsVerticalAndRight);
wchar_t horizontal = wchar_t(finalcut::fc::BoxDrawingsHorizontal);
wchar_t vertical_and_left = wchar_t(finalcut::fc::BoxDrawingsVerticalAndLeft);
wchar_t vertical_and_right = finalcut::fc::BoxDrawingsVerticalAndRight;
wchar_t horizontal = finalcut::fc::BoxDrawingsHorizontal;
wchar_t vertical_and_left = finalcut::fc::BoxDrawingsVerticalAndLeft;
finalcut::FString separator = finalcut::FString(vertical_and_right)
+ finalcut::FString(35, horizontal)
+ finalcut::FString(vertical_and_left);

View File

@ -39,16 +39,16 @@ class CheckList : public finalcut::FDialog
{
public:
// Constructor
explicit CheckList (finalcut::FWidget* = 0);
explicit CheckList (finalcut::FWidget* = nullptr);
// Disable copy constructor
CheckList (const CheckList&) = delete;
// Destructor
~CheckList();
private:
// Disable copy constructor
CheckList (const CheckList&);
// Disable assignment operator (=)
CheckList& operator = (const CheckList&);
CheckList& operator = (const CheckList&) = delete;
private:
// Method
void populate();
@ -60,16 +60,14 @@ class CheckList : public finalcut::FDialog
void cb_showList (finalcut::FWidget*, data_ptr);
// Data Members
finalcut::FListView listView;
finalcut::FStatusBar status_bar;
finalcut::FListView listView{this};
finalcut::FStatusBar status_bar{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
CheckList::CheckList (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, listView(this)
, status_bar(this)
{
setText (L"Shopping list");
setShadow();
@ -87,7 +85,7 @@ CheckList::CheckList (finalcut::FWidget* parent)
// Statusbar at the bottom
finalcut::FString separator;
separator << ' ' << wchar_t(finalcut::fc::BoxDrawingsVertical) << ' ';
separator << ' ' << finalcut::fc::BoxDrawingsVertical << ' ';
listView.setStatusbarMessage ( finalcut::FString()
<< "<Q> exit" << separator
<< "<Space> select an item" << separator
@ -172,7 +170,7 @@ void CheckList::cb_showList (finalcut::FWidget*, data_ptr)
static_cast<finalcut::FListViewItem*>(*iter);
if ( item->isChecked() )
shopping_list << wchar_t(finalcut::fc::Bullet) << ' '
shopping_list << finalcut::fc::Bullet << ' '
<< item->getText(1) << '\n';
++iter;

View File

@ -53,10 +53,10 @@ int main (int argc, char* argv[])
finalcut::FLabel label_1(&dgl);
finalcut::FLabel label_2(&dgl);
label_1 << wchar_t(finalcut::fc::BlackUpPointingTriangle)
label_1 << finalcut::fc::BlackUpPointingTriangle
<< std::wstring(L"\n")
<< wchar_t(finalcut::fc::BoxDrawingsUpAndRight)
<< finalcut::FString(2, wchar_t(finalcut::fc::BoxDrawingsHorizontal))
<< finalcut::fc::BoxDrawingsUpAndRight
<< finalcut::FString(2, finalcut::fc::BoxDrawingsHorizontal)
<< " Double click the title bar button,";
label_2 << "press Q on the keyboard,\n"
<< "or push the button below to exit\n"

View File

@ -30,7 +30,7 @@ class Keyboard : public finalcut::FWidget
{
public:
// Constructor
explicit Keyboard (finalcut::FWidget* = 0);
explicit Keyboard (finalcut::FWidget* = nullptr);
protected:
// Event handlers

View File

@ -29,7 +29,7 @@
// Global application object
static finalcut::FString* temp_str = 0;
static finalcut::FString* temp_str = nullptr;
// Function prototypes
@ -77,36 +77,31 @@ class Listbox : public finalcut::FDialog
{
public:
// Constructor
explicit Listbox (FWidget* = 0);
explicit Listbox (FWidget* = nullptr);
// Disable copy constructor
Listbox (const Listbox&) = delete;
// Destructor
~Listbox();
private:
// Disable copy constructor
Listbox (const Listbox&);
// Disable assignment operator (=)
Listbox& operator = (const Listbox&);
Listbox& operator = (const Listbox&) = delete;
private:
// Event handlers
virtual void onClose (finalcut::FCloseEvent*);
// Data Member
std::list<double> double_list;
finalcut::FListBox list1;
finalcut::FListBox list2;
finalcut::FListBox list3;
finalcut::FButton Quit;
std::list<double> double_list{};
finalcut::FListBox list1{this};
finalcut::FListBox list2{this};
finalcut::FListBox list3{this};
finalcut::FButton Quit{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Listbox::Listbox (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, double_list()
, list1(this)
, list2(this)
, list3(this)
, Quit(this)
{
temp_str = new finalcut::FString;

View File

@ -39,16 +39,16 @@ class Listview : public finalcut::FDialog
{
public:
// Constructor
explicit Listview (finalcut::FWidget* = 0);
explicit Listview (finalcut::FWidget* = nullptr);
// Disable copy constructor
Listview (const Listview&) = delete;
// Destructor
~Listview();
private:
// Disable copy constructor
Listview (const Listview&);
// Disable assignment operator (=)
Listview& operator = (const Listview&);
Listview& operator = (const Listview&) = delete;
private:
// Method
void populate();
@ -59,16 +59,14 @@ class Listview : public finalcut::FDialog
void cb_showInMessagebox (finalcut::FWidget*, data_ptr);
// Data Members
finalcut::FListView listView;
finalcut::FButton Quit;
finalcut::FListView listView{this};
finalcut::FButton Quit{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Listview::Listview (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, listView(this)
, Quit(this)
{
// Set FListView geometry
listView.setGeometry(2, 1, 33, 14);

View File

@ -34,7 +34,7 @@ class Mandelbrot : public finalcut::FDialog
{
public:
// Constructor
explicit Mandelbrot (finalcut::FWidget* = 0);
explicit Mandelbrot (finalcut::FWidget* = nullptr);
// Destructor
~Mandelbrot();

View File

@ -34,18 +34,16 @@ class Menu : public finalcut::FDialog
{
public:
// Constructor
explicit Menu (finalcut::FWidget* = 0);
explicit Menu (finalcut::FWidget* = nullptr);
// Disable copy constructor
Menu (const Menu&) = delete;
// Destructor
~Menu();
private:
// Disable copy constructor
Menu (const Menu&);
// Disable assignment operator (=)
Menu& operator = (const Menu&);
Menu& operator = (const Menu&) = delete;
private:
// Methods
void configureFileMenuItems();
void configureEditMenuItems();
@ -63,110 +61,61 @@ class Menu : public finalcut::FDialog
void cb_message (finalcut::FWidget*, data_ptr);
// Data Members
finalcut::FString line;
finalcut::FMenuBar Menubar;
finalcut::FMenu File;
finalcut::FMenu Edit;
finalcut::FMenu Choice;
finalcut::FMenuItem Window;
finalcut::FMenuItem Help;
finalcut::FMenuItem New;
finalcut::FMenuItem Open;
finalcut::FMenuItem Save;
finalcut::FMenuItem SaveAs;
finalcut::FMenuItem Close;
finalcut::FMenuItem Line1;
finalcut::FMenuItem Print;
finalcut::FMenuItem Line2;
finalcut::FMenuItem Quit;
finalcut::FMenuItem Undo;
finalcut::FMenuItem Redo;
finalcut::FMenuItem Line3;
finalcut::FMenuItem Cut;
finalcut::FMenuItem Copy;
finalcut::FMenuItem Paste;
finalcut::FMenuItem Line4;
finalcut::FMenuItem Search;
finalcut::FMenuItem Next;
finalcut::FMenuItem Line5;
finalcut::FMenuItem SelectAll;
finalcut::FMenu Color;
finalcut::FMenu Style;
finalcut::FMenu Border;
finalcut::FRadioMenuItem Color1;
finalcut::FRadioMenuItem Color2;
finalcut::FRadioMenuItem Color3;
finalcut::FRadioMenuItem Color4;
finalcut::FRadioMenuItem Color5;
finalcut::FCheckMenuItem Bold;
finalcut::FCheckMenuItem Italic;
finalcut::FMenu BColor;
finalcut::FMenu BStyle;
finalcut::FRadioMenuItem BColor1;
finalcut::FRadioMenuItem BColor2;
finalcut::FRadioMenuItem BStyle1;
finalcut::FRadioMenuItem BStyle2;
finalcut::FRadioMenuItem BStyle3;
finalcut::FRadioMenuItem BStyle4;
finalcut::FStatusBar Statusbar;
finalcut::FLabel Headline1;
finalcut::FLabel Headline2;
finalcut::FLabel Info;
finalcut::FString line{13, finalcut::fc::BoxDrawingsHorizontal};
finalcut::FMenuBar Menubar{this};
finalcut::FMenu File{"&File", &Menubar};
finalcut::FMenu Edit{"&Edit", &Menubar};
finalcut::FMenu Choice{"&Choice", &Menubar};
finalcut::FMenuItem Window{"&Window", &Menubar};
finalcut::FMenuItem Help{"&Help", &Menubar};
finalcut::FMenuItem New{"&New", &File};
finalcut::FMenuItem Open{"&Open...", &File};
finalcut::FMenuItem Save{"&Save", &File};
finalcut::FMenuItem SaveAs{"&Save as...", &File};
finalcut::FMenuItem Close{"&Close", &File};
finalcut::FMenuItem Line1{&File};
finalcut::FMenuItem Print{"&Print", &File};
finalcut::FMenuItem Line2{&File};
finalcut::FMenuItem Quit{"&Quit", &File};
finalcut::FMenuItem Undo{finalcut::fc::Fckey_z, "&Undo", &Edit};
finalcut::FMenuItem Redo{finalcut::fc::Fckey_y, "&Redo", &Edit};
finalcut::FMenuItem Line3{&Edit};
finalcut::FMenuItem Cut{finalcut::fc::Fckey_x, "Cu&t", &Edit};
finalcut::FMenuItem Copy{finalcut::fc::Fckey_c, "&Copy", &Edit};
finalcut::FMenuItem Paste{finalcut::fc::Fckey_v, "&Paste", &Edit};
finalcut::FMenuItem Line4{&Edit};
finalcut::FMenuItem Search{finalcut::fc::Fckey_f, "&Search", &Edit};
finalcut::FMenuItem Next{finalcut::fc::Fkey_f3, "Search &next", &Edit};
finalcut::FMenuItem Line5{&Edit};
finalcut::FMenuItem SelectAll{finalcut::fc::Fckey_a, "Select &all", &Edit};
finalcut::FMenu Color{"&Color", &Choice};
finalcut::FMenu Style{"&Style", &Choice};
finalcut::FMenu Border{"&Border", &Choice};
finalcut::FRadioMenuItem Color1{"Red", &Color};
finalcut::FRadioMenuItem Color2{"Green", &Color};
finalcut::FRadioMenuItem Color3{"Yellow", &Color};
finalcut::FRadioMenuItem Color4{"Brue", &Color};
finalcut::FRadioMenuItem Color5{"Black", &Color};
finalcut::FCheckMenuItem Bold{"Bold", &Style};
finalcut::FCheckMenuItem Italic{"Italic", &Style};
finalcut::FMenu BColor{"&Color", &Border};
finalcut::FMenu BStyle{"&Style", &Border};
finalcut::FRadioMenuItem BColor1{"Red", &BColor};
finalcut::FRadioMenuItem BColor2{"Blue", &BColor};
finalcut::FRadioMenuItem BStyle1{line, &BStyle};
finalcut::FRadioMenuItem BStyle2{"-------------", &BStyle};
finalcut::FRadioMenuItem BStyle3{"- - - - - - -", &BStyle};
finalcut::FRadioMenuItem BStyle4{"- - - - -", &BStyle};
finalcut::FStatusBar Statusbar{this};
finalcut::FLabel Headline1{this};
finalcut::FLabel Headline2{this};
finalcut::FLabel Info{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Menu::Menu (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, line(13, wchar_t(finalcut::fc::BoxDrawingsHorizontal))
, Menubar(this)
, File("&File", &Menubar)
, Edit("&Edit", &Menubar)
, Choice("&Choice", &Menubar)
, Window("&Window", &Menubar)
, Help("&Help", &Menubar)
, New("&New", &File)
, Open("&Open...", &File)
, Save("&Save", &File)
, SaveAs("&Save as...", &File)
, Close("&Close", &File)
, Line1(&File)
, Print("&Print", &File)
, Line2(&File)
, Quit("&Quit", &File)
, Undo(finalcut::fc::Fckey_z, "&Undo", &Edit)
, Redo(finalcut::fc::Fckey_y, "&Redo", &Edit)
, Line3(&Edit)
, Cut(finalcut::fc::Fckey_x, "Cu&t", &Edit)
, Copy(finalcut::fc::Fckey_c, "&Copy", &Edit)
, Paste(finalcut::fc::Fckey_v, "&Paste", &Edit)
, Line4(&Edit)
, Search(finalcut::fc::Fckey_f, "&Search", &Edit)
, Next(finalcut::fc::Fkey_f3, "Search &next", &Edit)
, Line5(&Edit)
, SelectAll(finalcut::fc::Fckey_a, "Select &all", &Edit)
, Color("&Color", &Choice)
, Style("&Style", &Choice)
, Border("&Border", &Choice)
, Color1("Red", &Color)
, Color2("Green", &Color)
, Color3("Yellow", &Color)
, Color4("Brue", &Color)
, Color5("Black", &Color)
, Bold("Bold", &Style)
, Italic("Italic", &Style)
, BColor("&Color", &Border)
, BStyle("&Style", &Border)
, BColor1("Red", &BColor)
, BColor2("Blue", &BColor)
, BStyle1(line, &BStyle)
, BStyle2("-------------", &BStyle)
, BStyle3("- - - - - - -", &BStyle)
, BStyle4("- - - - -", &BStyle)
, Statusbar(this)
, Headline1(this)
, Headline2(this)
, Info(this)
{
// Menu bar itms
File.setStatusbarMessage ("File management commands");

View File

@ -34,21 +34,20 @@ class ColorChooser : public finalcut::FWidget
{
public:
// Constructor
explicit ColorChooser (finalcut::FWidget* = 0);
explicit ColorChooser (finalcut::FWidget* = nullptr);
// Disable copy constructor
ColorChooser (const ColorChooser&) = delete;
// Destructor
~ColorChooser();
// Disable assignment operator (=)
ColorChooser& operator = (const ColorChooser&) = delete;
// Accessors
FColor getForeground();
FColor getBackground();
private:
// Disable copy constructor
ColorChooser (const ColorChooser&);
// Disable assignment operator (=)
ColorChooser& operator = (const ColorChooser&);
// Method
virtual void draw();
@ -56,18 +55,15 @@ class ColorChooser : public finalcut::FWidget
virtual void onMouseDown (finalcut::FMouseEvent*);
// Data Members
FColor fg_color;
FColor bg_color;
finalcut::FLabel headline;
FColor fg_color{finalcut::fc::White};
FColor bg_color{finalcut::fc::Black};
finalcut::FLabel headline{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
ColorChooser::ColorChooser (finalcut::FWidget* parent)
: FWidget(parent)
, fg_color(finalcut::fc::White)
, bg_color(finalcut::fc::Black)
, headline(this)
{
setSize (8, 12);
setFixedSize (8, 12);
@ -174,11 +170,15 @@ class Brushes : public finalcut::FWidget
{
public:
// Constructor
explicit Brushes (finalcut::FWidget* = 0);
explicit Brushes (finalcut::FWidget* = nullptr);
// Disable copy constructor
Brushes (const Brushes&) = delete;
// Destructor
~Brushes();
// Disable assignment operator (=)
Brushes& operator = (const Brushes&) = delete;
// Accessor
wchar_t getBrush();
@ -187,11 +187,6 @@ class Brushes : public finalcut::FWidget
void setBackground (FColor);
private:
// Disable copy constructor
Brushes (const Brushes&);
// Disable assignment operator (=)
Brushes& operator = (const Brushes&);
// Method
virtual void draw();
@ -199,20 +194,16 @@ class Brushes : public finalcut::FWidget
virtual void onMouseDown (finalcut::FMouseEvent*);
// Data Members
wchar_t brush;
FColor fg_color;
FColor bg_color;
finalcut::FLabel headline;
wchar_t brush{L' '};
FColor fg_color{finalcut::fc::White};
FColor bg_color{finalcut::fc::Black};
finalcut::FLabel headline{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Brushes::Brushes (finalcut::FWidget* parent)
: FWidget(parent)
, brush(L' ')
, fg_color(finalcut::fc::White)
, bg_color(finalcut::fc::Black)
, headline(this)
{
setSize (8, 4);
setFixedSize (8, 4);
@ -249,7 +240,7 @@ void Brushes::draw()
setColor (fg_color, bg_color);
setPrintPos (2, 3);
print(" ");
print(finalcut::FString(3, wchar_t(finalcut::fc::MediumShade)));
print(finalcut::FString(3, finalcut::fc::MediumShade));
if ( brush == L' ' )
pos = 0;
@ -258,9 +249,9 @@ void Brushes::draw()
setColor();
setPrintPos (3 + pos, 2);
print(wchar_t(finalcut::fc::BlackDownPointingTriangle));
print(finalcut::fc::BlackDownPointingTriangle);
setPrintPos (3 + pos, 4);
print(wchar_t(finalcut::fc::BlackUpPointingTriangle));
print(finalcut::fc::BlackUpPointingTriangle);
}
//----------------------------------------------------------------------
@ -279,7 +270,7 @@ void Brushes::onMouseDown (finalcut::FMouseEvent* ev)
}
else if ( mouse_x >= 5 && mouse_x <= 7 && mouse_y == 3 )
{
brush = wchar_t(finalcut::fc::MediumShade);
brush = finalcut::fc::MediumShade;
redraw();
}
}
@ -317,11 +308,15 @@ class MouseDraw : public finalcut::FDialog
using FWidget::setGeometry;
// Constructor
explicit MouseDraw (finalcut::FWidget* = 0);
explicit MouseDraw (finalcut::FWidget* = nullptr);
// Disable copy constructor
MouseDraw (const MouseDraw&) = delete;
// Destructor
~MouseDraw();
// Disable assignment operator (=)
MouseDraw& operator = (const MouseDraw&) = delete;
// Methods
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
@ -330,11 +325,6 @@ class MouseDraw : public finalcut::FDialog
virtual void onClose (finalcut::FCloseEvent*);
private:
// Disable copy constructor
MouseDraw (const MouseDraw&);
// Disable assignment operator (=)
MouseDraw& operator = (const MouseDraw&);
// Methods
virtual void draw();
void drawBrush (int, int, bool = false);
@ -349,18 +339,15 @@ class MouseDraw : public finalcut::FDialog
void cb_colorChanged (finalcut::FWidget*, data_ptr);
// Data Members
term_area* canvas;
ColorChooser c_chooser;
Brushes brush;
term_area* canvas{nullptr};
ColorChooser c_chooser{this};
Brushes brush{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
MouseDraw::MouseDraw (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, canvas(0)
, c_chooser(this)
, brush(this)
{
setText ("Drawing with the mouse");
c_chooser.setPos (1, 1);
@ -426,25 +413,25 @@ void MouseDraw::draw()
for (int y = 2; y < y_max; y++)
{
setPrintPos (10, y);
print (wchar_t(finalcut::fc::NF_rev_border_line_right));
print (finalcut::fc::NF_rev_border_line_right);
}
setPrintPos (10, y_max);
print (wchar_t(finalcut::fc::NF_rev_border_corner_lower_right));
print (finalcut::fc::NF_rev_border_corner_lower_right);
}
else
{
setPrintPos (10, 2);
print (wchar_t(finalcut::fc::BoxDrawingsDownAndHorizontal));
print (finalcut::fc::BoxDrawingsDownAndHorizontal);
for (int y = 3; y < y_max; y++)
{
setPrintPos (10, y);
print (wchar_t(finalcut::fc::BoxDrawingsVertical));
print (finalcut::fc::BoxDrawingsVertical);
}
setPrintPos (10, y_max);
print (wchar_t(finalcut::fc::BoxDrawingsUpAndHorizontal));
print (finalcut::fc::BoxDrawingsUpAndHorizontal);
}
drawCanvas();

View File

@ -30,7 +30,7 @@
static finalcut::FVTerm* terminal;
// Global FApplication object
static finalcut::FApplication* app;
static finalcut::FApplication* app = nullptr;
// function prototype
bool keyPressed();
@ -201,5 +201,5 @@ int main (int argc, char* argv[])
// Waiting for keypress
keyPressed();
app = 0; // End of TermApp object scope
app = nullptr; // End of TermApp object scope
}

View File

@ -34,20 +34,19 @@ class Scrollview : public finalcut::FScrollView
{
public:
// Constructor
explicit Scrollview (finalcut::FWidget* = 0);
explicit Scrollview (finalcut::FWidget* = nullptr);
// Disable copy constructor
Scrollview (const Scrollview&) = delete;
// Destructor
~Scrollview ();
// Disable assignment operator (=)
Scrollview& operator = (const Scrollview&) = delete;
// Mutator
void setScrollSize (std::size_t, std::size_t);
private:
// Disable copy constructor
Scrollview (const Scrollview&);
// Disable assignment operator (=)
Scrollview& operator = (const Scrollview&);
// Method
virtual void draw();
@ -58,28 +57,20 @@ class Scrollview : public finalcut::FScrollView
void cb_go_north (finalcut::FWidget*, data_ptr);
// Data Members
wchar_t pointer_right;
wchar_t pointer_down;
wchar_t pointer_left;
wchar_t pointer_up;
finalcut::FButton go_east;
finalcut::FButton go_south;
finalcut::FButton go_west;
finalcut::FButton go_north;
wchar_t pointer_right{finalcut::fc::BlackRightPointingPointer};
wchar_t pointer_down{finalcut::fc::BlackDownPointingTriangle};
wchar_t pointer_left{finalcut::fc::BlackLeftPointingPointer};
wchar_t pointer_up{finalcut::fc::BlackUpPointingTriangle};
finalcut::FButton go_east{pointer_right, this};
finalcut::FButton go_south{pointer_down, this};
finalcut::FButton go_west{pointer_left, this};
finalcut::FButton go_north{pointer_up, this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Scrollview::Scrollview (finalcut::FWidget* parent)
: finalcut::FScrollView(parent)
, pointer_right(wchar_t(finalcut::fc::BlackRightPointingPointer))
, pointer_down(wchar_t(finalcut::fc::BlackDownPointingTriangle))
, pointer_left(wchar_t(finalcut::fc::BlackLeftPointingPointer))
, pointer_up(wchar_t(finalcut::fc::BlackUpPointingTriangle))
, go_east(pointer_right, this)
, go_south(pointer_down, this)
, go_west(pointer_left, this)
, go_north(pointer_up, this)
{
// Sets the navigation button geometry
go_east.setGeometry (1, 1, 5, 1);
@ -198,7 +189,7 @@ class Scrollviewdemo : public finalcut::FDialog
{
public:
// Constructor
explicit Scrollviewdemo (finalcut::FWidget* = 0);
explicit Scrollviewdemo (finalcut::FWidget* = nullptr);
// Destructor
~Scrollviewdemo();
@ -207,12 +198,12 @@ class Scrollviewdemo : public finalcut::FDialog
virtual void onClose (finalcut::FCloseEvent*);
// Callback method
void cb_quit (finalcut::FWidget* = 0, data_ptr = 0);
void cb_quit (finalcut::FWidget* = nullptr, data_ptr = nullptr);
// Data Members
Scrollview sview;
finalcut::FButton quit_btn;
finalcut::FLabel label;
Scrollview sview{this};
finalcut::FButton quit_btn{"&Quit", this};
finalcut::FLabel label{this};
};
#pragma pack(pop)
@ -220,9 +211,6 @@ class Scrollviewdemo : public finalcut::FDialog
//----------------------------------------------------------------------
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, sview(this)
, quit_btn("&Quit", this)
, label(this)
{
setGeometry (16, 3, 50, 19);
setText ("Scrolling viewport example");

View File

@ -187,7 +187,7 @@ void streamingFromFStringExample()
std::wcout << "stream out: " << stream_wstring << std::endl;
// ...to wide character
wchar_t stream_wchar_t = 0;
wchar_t stream_wchar_t = L'\0';
finalcut::FString("w") >> stream_wchar_t;
std::wcout << "stream out: " << stream_wchar_t << std::endl;

View File

@ -34,35 +34,34 @@ class AttribDlg : public finalcut::FDialog
{
public:
// Constructor
explicit AttribDlg (finalcut::FWidget* = 0);
explicit AttribDlg (finalcut::FWidget* = nullptr);
// Disable copy constructor
AttribDlg (const AttribDlg&) = delete;
// Destructor
~AttribDlg();
// Disable assignment operator (=)
AttribDlg& operator = (const AttribDlg&) = delete;
// Event handlers
virtual void onAccel (finalcut::FAccelEvent*);
virtual void onWheel (finalcut::FWheelEvent*);
virtual void onClose (finalcut::FCloseEvent*);
// Callback methods
void cb_next (finalcut::FWidget* = 0, data_ptr = 0);
void cb_back (finalcut::FWidget* = 0, data_ptr = 0);
void cb_next (finalcut::FWidget* = nullptr, data_ptr = nullptr);
void cb_back (finalcut::FWidget* = nullptr, data_ptr = nullptr);
// Data Members
FColor bgcolor;
private:
// Disable copy constructor
AttribDlg (const AttribDlg&);
// Disable assignment operator (=)
AttribDlg& operator = (const AttribDlg&);
// Method
virtual void adjustSize();
// Data Members
finalcut::FButton next_button;
finalcut::FButton back_button;
finalcut::FButton next_button{"&Next >", this};
finalcut::FButton back_button{"< &Back", this};
};
#pragma pack(pop)
@ -70,8 +69,6 @@ class AttribDlg : public finalcut::FDialog
AttribDlg::AttribDlg (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, bgcolor(wc.label_bg)
, next_button("&Next >", this)
, back_button("< &Back", this)
{
setText ( "A terminal attributes test ("
+ finalcut::FString(getTermType())
@ -188,7 +185,7 @@ class AttribDemo : public finalcut::FWidget
{
public:
// Constructor
explicit AttribDemo (FWidget* = 0);
explicit AttribDemo (FWidget* = nullptr);
// Destructor
~AttribDemo()

View File

@ -313,7 +313,7 @@ int main (int argc, char* argv[])
// Pointer to the global virtual terminal object
terminal = static_cast<finalcut::FVTerm*>(&TermApp);
finalcut::FTermcap::tcap_map* tcap = 0;
finalcut::FTermcap::tcap_map* tcap = nullptr;
tcap = finalcut::FTermcap::getTermcapMap();
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";

View File

@ -31,7 +31,7 @@ class Timer : public finalcut::FWidget
{
public:
// Constructor
explicit Timer (finalcut::FWidget* = 0);
explicit Timer (finalcut::FWidget* = nullptr);
protected:
// Method

View File

@ -42,18 +42,17 @@ class Transparent : public finalcut::FDialog
} trans_type;
// Constructor
explicit Transparent (finalcut::FWidget* = 0, trans_type = transparent);
explicit Transparent ( finalcut::FWidget* = nullptr
, trans_type = transparent );
// Disable copy constructor
Transparent (const Transparent&) = delete;
// Destructor
~Transparent();
private:
// Disable copy constructor
Transparent (const Transparent&);
// Disable assignment operator (=)
Transparent& operator = (const Transparent&);
Transparent& operator = (const Transparent&) = delete;
private:
// Method
virtual void draw();
@ -103,7 +102,7 @@ void Transparent::draw()
else
setTransparent();
finalcut::FString line(getClientWidth(), wchar_t('.'));
finalcut::FString line(getClientWidth(), '.');
for (int n = 1; n <= int(getClientHeight()); n++)
{
@ -151,16 +150,17 @@ class MainWindow : public finalcut::FDialog
{
public:
// Constructor
explicit MainWindow (finalcut::FWidget* = 0);
explicit MainWindow (finalcut::FWidget* = nullptr);
// Disable copy constructor
MainWindow (const MainWindow&) = delete;
// Destructor
~MainWindow();
private:
// Disable copy constructor
MainWindow (const MainWindow&);
// Disable assignment operator (=)
MainWindow& operator = (const MainWindow&);
MainWindow& operator = (const MainWindow&) = delete;
private:
// Method
virtual void draw();
// Event handlers
@ -182,24 +182,18 @@ class MainWindow : public finalcut::FDialog
}
// Data Members
finalcut::FString line1;
finalcut::FString line2;
Transparent* transpwin;
Transparent* shadowwin;
Transparent* ibg;
finalcut::FStatusBar status_bar;
finalcut::FString line1{};
finalcut::FString line2{};
Transparent* transpwin{nullptr};
Transparent* shadowwin{nullptr};
Transparent* ibg{nullptr};
finalcut::FStatusBar status_bar{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
MainWindow::MainWindow (finalcut::FWidget* parent)
: FDialog(parent)
, line1()
, line2()
, transpwin(0)
, shadowwin(0)
, ibg(0)
, status_bar(this)
{
line1 = " .-. .-. .-.";
line2 = "`._.' `._.' `._.' ";

View File

@ -114,19 +114,19 @@ class Treeview : public finalcut::FDialog
{
public:
// Constructor
explicit Treeview (finalcut::FWidget* = 0);
explicit Treeview (finalcut::FWidget* = nullptr);
// Disable copy constructor
Treeview (const Treeview&) = delete;
// Destructor
~Treeview();
// Disable assignment operator (=)
Treeview& operator = (const Treeview&) = delete;
private:
// Typedefs
struct TreeItem; // forward declaration
// Disable copy constructor
Treeview (const Treeview&);
// Disable assignment operator (=)
Treeview& operator = (const Treeview&);
// Methods
virtual void adjustSize();
@ -134,9 +134,9 @@ class Treeview : public finalcut::FDialog
void onClose (finalcut::FCloseEvent*);
// Data Members
bool initialized;
finalcut::FListView listView;
finalcut::FButton Quit;
bool initialized{false};
finalcut::FListView listView{this};
finalcut::FButton Quit{this};
static TreeItem africa[];
static TreeItem asia[];
static TreeItem europe[];
@ -298,9 +298,6 @@ Treeview::TreeItem Treeview::oceania[] =
//----------------------------------------------------------------------
Treeview::Treeview (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, initialized(false)
, listView(this)
, Quit(this)
{
// Set FListView geometry
listView.setGeometry(2, 1, 53, 14);

View File

@ -38,17 +38,16 @@ class ProgressDialog : public finalcut::FDialog
{
public:
// Constructor
explicit ProgressDialog (finalcut::FWidget* = 0);
explicit ProgressDialog (finalcut::FWidget* = nullptr);
// Disable copy constructor
ProgressDialog (const ProgressDialog&) = delete;
// Destructor
~ProgressDialog();
private:
// Disable copy constructor
ProgressDialog (const ProgressDialog&);
// Disable assignment operator (=)
ProgressDialog& operator = (const ProgressDialog&);
ProgressDialog& operator = (const ProgressDialog&) = delete;
private:
// Event handlers
virtual void onShow (finalcut::FShowEvent*);
virtual void onTimer (finalcut::FTimerEvent*);
@ -59,20 +58,16 @@ class ProgressDialog : public finalcut::FDialog
void cb_exit_bar (finalcut::FWidget*, data_ptr);
// Data Members
finalcut::FProgressbar progressBar;
finalcut::FButton reset;
finalcut::FButton more;
finalcut::FButton quit;
finalcut::FProgressbar progressBar{this};
finalcut::FButton reset{this};
finalcut::FButton more{this};
finalcut::FButton quit{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, progressBar(this)
, reset(this)
, more(this)
, quit(this)
{
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
setText("Progress bar");
@ -186,31 +181,30 @@ class TextWindow : public finalcut::FDialog
{
public:
// Constructor
explicit TextWindow (finalcut::FWidget* = 0);
explicit TextWindow (finalcut::FWidget* = nullptr);
// Disable copy constructor
TextWindow (const TextWindow&) = delete;
// Destructor
~TextWindow();
// Disable assignment operator (=)
TextWindow& operator = (const TextWindow&) = delete;
// Method
void append (const finalcut::FString&);
private:
// Disable copy constructor
TextWindow (const TextWindow&);
// Disable assignment operator (=)
TextWindow& operator = (const TextWindow&);
// Method
virtual void adjustSize();
// Data Members
finalcut::FTextView scrollText;
finalcut::FTextView scrollText{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
TextWindow::TextWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, scrollText(this)
{
scrollText.ignorePadding();
scrollText.setGeometry (1, 2, getWidth(), getHeight() - 1);
@ -255,16 +249,16 @@ class MyDialog : public finalcut::FDialog
{
public:
// Constructor
explicit MyDialog (finalcut::FWidget* = 0);
explicit MyDialog (finalcut::FWidget* = nullptr);
// Disable copy constructor
MyDialog (const MyDialog&) = delete;
// Destructor
~MyDialog();
private:
// Disable copy constructor
MyDialog (const MyDialog&);
// Disable assignment operator (=)
MyDialog& operator = (const MyDialog&);
MyDialog& operator = (const MyDialog&) = delete;
private:
// Method
void initMenu();
void initMenuCallbacks();
@ -302,108 +296,67 @@ class MyDialog : public finalcut::FDialog
void cb_setInput (finalcut::FWidget*, data_ptr);
// Data Members
bool initialized;
finalcut::FMenuBar Menubar;
finalcut::FMenu File; // Menu bar items
finalcut::FMenu Edit;
finalcut::FMenu View;
finalcut::FMenuItem Options;
finalcut::FDialogListMenu Window;
finalcut::FMenuItem Help;
finalcut::FMenuItem Open; // "File" menu items
finalcut::FMenu Recent;
finalcut::FMenuItem Line1;
finalcut::FMenuItem Quit;
finalcut::FMenuItem File1; // "Recent" menu items
finalcut::FMenuItem File2;
finalcut::FMenuItem File3;
finalcut::FMenuItem Undo;
finalcut::FMenuItem Redo;
finalcut::FMenuItem Line2;
finalcut::FMenuItem Cut;
finalcut::FMenuItem Copy;
finalcut::FMenuItem Paste;
finalcut::FMenuItem Clear;
finalcut::FMenuItem Env;
finalcut::FMenuItem Drive;
finalcut::FStatusBar Statusbar;
finalcut::FStatusKey key_F1;
finalcut::FStatusKey key_F2;
finalcut::FStatusKey key_F3;
finalcut::FButton MyButton1;
finalcut::FButton MyButton2;
finalcut::FButton MyButton3;
finalcut::FButtonGroup radioButtonGroup;
finalcut::FRadioButton radio1;
finalcut::FRadioButton radio2;
finalcut::FButtonGroup checkButtonGroup;
finalcut::FCheckBox check1;
finalcut::FCheckBox check2;
finalcut::FLineEdit myLineEdit;
finalcut::FButton MyButton4;
finalcut::FButton MyButton5;
finalcut::FButton MyButton6;
finalcut::FListBox myList;
finalcut::FLabel headline;
finalcut::FLabel tagged;
finalcut::FLabel tagged_count;
finalcut::FLabel sum;
finalcut::FLabel sum_count;
finalcut::FString clipboard;
bool initialized{false};
finalcut::FMenuBar Menubar{this};
// Menu bar items
finalcut::FMenu File{"&File", &Menubar};
finalcut::FMenu Edit{"&Edit", &Menubar};
finalcut::FMenu View{"&View", &Menubar};
finalcut::FMenuItem Options{"&Options", &Menubar};
finalcut::FDialogListMenu Window{"&Window", &Menubar};
finalcut::FMenuItem Help{"&Help", &Menubar};
// "File" menu items
finalcut::FMenuItem Open{"&Open...", &File};
finalcut::FMenu Recent{"&System files", &File};
finalcut::FMenuItem Line1{&File};
finalcut::FMenuItem Quit{"&Quit", &File};
// "Recent" menu items
finalcut::FMenuItem File1{"/etc/services", &Recent};
finalcut::FMenuItem File2{"/etc/fstab", &Recent};
finalcut::FMenuItem File3{"/etc/passwd", &Recent};
// "Edit" menu items
finalcut::FMenuItem Undo{finalcut::fc::Fckey_z, "Undo", &Edit};
finalcut::FMenuItem Redo{finalcut::fc::Fckey_y, "Redo", &Edit};
finalcut::FMenuItem Line2{&Edit};
finalcut::FMenuItem Cut{finalcut::fc::Fckey_x, "Cu&t", &Edit};
finalcut::FMenuItem Copy{finalcut::fc::Fckey_c, "&Copy", &Edit};
finalcut::FMenuItem Paste{finalcut::fc::Fckey_v, "&Paste", &Edit};
finalcut::FMenuItem Clear{finalcut::fc::Fkey_dc, "C&lear", &Edit};
// "View" menu items
finalcut::FMenuItem Env{"&Terminal...", &View};
finalcut::FMenuItem Drive{"&Drive symbols...", &View};
// Statusbar
finalcut::FStatusBar Statusbar{this};
finalcut::FStatusKey key_F1{finalcut::fc::Fkey_f1, "About", &Statusbar};
finalcut::FStatusKey key_F2{finalcut::fc::Fkey_f2, "View", &Statusbar};
finalcut::FStatusKey key_F3{finalcut::fc::Fkey_f3, "Quit", &Statusbar};
// Dialog widgets
finalcut::FButton MyButton1{this};
finalcut::FButton MyButton2{this};
finalcut::FButton MyButton3{this};
finalcut::FButtonGroup radioButtonGroup{"Button", this};
finalcut::FRadioButton radio1{"E&nable", &radioButtonGroup};
finalcut::FRadioButton radio2{&radioButtonGroup};
finalcut::FButtonGroup checkButtonGroup{"Options", this};
finalcut::FCheckBox check1{"&Bitmode", &checkButtonGroup};
finalcut::FCheckBox check2{"&8-Bit", &checkButtonGroup};
finalcut::FLineEdit myLineEdit{this};
finalcut::FButton MyButton4{this};
finalcut::FButton MyButton5{this};
finalcut::FButton MyButton6{this};
finalcut::FListBox myList{this};
finalcut::FLabel headline{this};
finalcut::FLabel tagged{L"Tagged:", this};
finalcut::FLabel tagged_count{this};
finalcut::FLabel sum{L"Sum:", this};
finalcut::FLabel sum_count{this};
finalcut::FString clipboard{};
};
#pragma pack(pop)
//----------------------------------------------------------------------
MyDialog::MyDialog (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, initialized(false)
, Menubar(this)
, File("&File", &Menubar)
, Edit("&Edit", &Menubar)
, View("&View", &Menubar)
, Options("&Options", &Menubar)
, Window("&Window", &Menubar)
, Help("&Help", &Menubar)
, Open("&Open...", &File)
, Recent("&System files", &File)
, Line1(&File)
, Quit("&Quit", &File)
, File1("/etc/services", &Recent)
, File2("/etc/fstab", &Recent)
, File3("/etc/passwd", &Recent)
, Undo(finalcut::fc::Fckey_z, "Undo", &Edit)
, Redo(finalcut::fc::Fckey_y, "Redo", &Edit)
, Line2(&Edit)
, Cut(finalcut::fc::Fckey_x, "Cu&t", &Edit)
, Copy(finalcut::fc::Fckey_c, "&Copy", &Edit)
, Paste(finalcut::fc::Fckey_v, "&Paste", &Edit)
, Clear(finalcut::fc::Fkey_dc, "C&lear", &Edit)
, Env("&Terminal...", &View)
, Drive("&Drive symbols...", &View)
, Statusbar(this)
, key_F1(finalcut::fc::Fkey_f1, "About", &Statusbar)
, key_F2(finalcut::fc::Fkey_f2, "View", &Statusbar)
, key_F3(finalcut::fc::Fkey_f3, "Quit", &Statusbar)
, MyButton1(this)
, MyButton2(this)
, MyButton3(this)
, radioButtonGroup("Button", this)
, radio1("E&nable", &radioButtonGroup)
, radio2(&radioButtonGroup)
, checkButtonGroup("Options", this)
, check1("&Bitmode", &checkButtonGroup)
, check2("&8-Bit", &checkButtonGroup)
, myLineEdit(this)
, MyButton4(this)
, MyButton5(this)
, MyButton6(this)
, myList(this)
, headline(this)
, tagged(L"Tagged:", this)
, tagged_count(this)
, sum(L"Sum:", this)
, sum_count(this)
, clipboard()
{
initMenu(); // Initialize the program menu
initMenuCallbacks(); // Initialize program menu callbacks
@ -816,7 +769,7 @@ void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, data_ptr)
void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
{
const char libver[] = F_VERSION;
finalcut::FString line(2, wchar_t(finalcut::fc::BoxDrawingsHorizontal));
finalcut::FString line(2, finalcut::fc::BoxDrawingsHorizontal);
finalcut::FMessageBox info ( "About"
, line + L" The Final Cut " + line + "\n\n"
@ -839,7 +792,7 @@ void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
<< " Type: " << getTermType() << "\n"
<< " Name: " << getTermFileName() << "\n"
<< " Mode: " << getEncodingString() << "\n"
<< " Size: " << x << wchar_t(finalcut::fc::Times)
<< " Size: " << x << finalcut::fc::Times
<< y << "\n"
<< "Colors: " << getMaxColor()
, finalcut::FMessageBox::Ok, 0, 0, this

View File

@ -35,11 +35,15 @@ class Watch : public finalcut::FDialog
{
public:
// Constructor
explicit Watch (finalcut::FWidget* = 0);
explicit Watch (finalcut::FWidget* = nullptr);
// Disable copy constructor
Watch (const Watch&) = delete;
// Destructor
~Watch();
// Disable assignment operator (=)
Watch& operator = (const Watch&) = delete;
// Method
void printTime();
@ -56,31 +60,19 @@ class Watch : public finalcut::FDialog
virtual void adjustSize();
private:
// Disable copy constructor
Watch (const Watch&);
// Disable assignment operator (=)
Watch& operator = (const Watch&);
// Data Members
bool sec;
finalcut::FLabel time_label;
finalcut::FLabel time_str;
finalcut::FSwitch clock_sw;
finalcut::FSwitch seconds_sw;
finalcut::FButton quit_btn;
bool sec{true};
finalcut::FLabel time_label{L"Time", this};
finalcut::FLabel time_str{L"--:--:--", this};
finalcut::FSwitch clock_sw{L"Clock", this};
finalcut::FSwitch seconds_sw{L"Seconds", this};
finalcut::FButton quit_btn{L"&Quit", this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Watch::Watch (FWidget* parent)
: finalcut::FDialog(parent)
, sec(true)
, time_label(L"Time", this)
, time_str(L"--:--:--", this)
, clock_sw(L"Clock", this)
, seconds_sw(L"Seconds", this)
, quit_btn(L"&Quit", this)
{
setText ("Watch");
int pw = int(getParentWidget()->getWidth());

View File

@ -35,18 +35,16 @@ class SmallWindow : public finalcut::FDialog
{
public:
// Constructor
explicit SmallWindow (finalcut::FWidget* = 0);
explicit SmallWindow (finalcut::FWidget* = nullptr);
// Disable copy constructor
SmallWindow (const SmallWindow&) = delete;
// Destructor
~SmallWindow();
private:
// Disable copy constructor
SmallWindow (const SmallWindow&);
// Disable assignment operator (=)
SmallWindow& operator = (const SmallWindow&);
SmallWindow& operator = (const SmallWindow&) = delete;
private:
// Method
virtual void adjustSize();
@ -55,22 +53,17 @@ class SmallWindow : public finalcut::FDialog
virtual void onTimer (finalcut::FTimerEvent*);
// Data Members
finalcut::FLabel left_arrow;
finalcut::FLabel right_arrow;
finalcut::FLabel top_left_label;
finalcut::FLabel top_right_label;
finalcut::FLabel bottom_label;
finalcut::FLabel left_arrow{this};
finalcut::FLabel right_arrow{this};
finalcut::FLabel top_left_label{this};
finalcut::FLabel top_right_label{this};
finalcut::FLabel bottom_label{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
SmallWindow::SmallWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, left_arrow(this)
, right_arrow(this)
, top_left_label(this)
, top_right_label(this)
, bottom_label(this)
{
wchar_t arrow_up, arrow_down;
arrow_up = finalcut::fc::BlackUpPointingTriangle;
@ -171,43 +164,36 @@ class Window : public finalcut::FDialog
{
public:
// Constructor
explicit Window (finalcut::FWidget* = 0);
explicit Window (finalcut::FWidget* = nullptr);
// Disable copy constructor
Window (const Window&) = delete;
// Destructor
~Window();
// Disable assignment operator (=)
Window& operator = (const Window&) = delete;
private:
// Typedefs
typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr);
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr);
class win_data
struct win_data
{
public:
win_data()
: is_open(false)
, title()
, dgl(0)
{ }
// Constructor
win_data() = default;
// Disable copy constructor
win_data (const win_data&) = delete;
// Disable assignment operator (=)
win_data& operator = (const win_data&) = delete;
// Data Members
bool is_open;
finalcut::FString title;
SmallWindow* dgl;
private:
// Disable copy constructor
win_data (const win_data&);
// Disable assignment operator (=)
win_data& operator = (const win_data&);
bool is_open{false};
finalcut::FString title{};
SmallWindow* dgl{nullptr};
};
// Disable copy constructor
Window (const Window&);
// Disable assignment operator (=)
Window& operator = (const Window&);
// Method
void configureFileMenuItems();
void configureDialogButtons();
@ -227,44 +213,28 @@ class Window : public finalcut::FDialog
void cb_destroyWindow (finalcut::FWidget*, data_ptr);
// Data Members
std::vector<win_data*> windows;
finalcut::FString drop_down_symbol;
finalcut::FMenuBar Menubar;
finalcut::FMenu File;
finalcut::FDialogListMenu DglList;
finalcut::FStatusBar Statusbar;
finalcut::FMenuItem New;
finalcut::FMenuItem Close;
finalcut::FMenuItem Line1;
finalcut::FMenuItem Next;
finalcut::FMenuItem Previous;
finalcut::FMenuItem Line2;
finalcut::FMenuItem Quit;
finalcut::FButton CreateButton;
finalcut::FButton CloseButton;
finalcut::FButton QuitButton;
std::vector<win_data*> windows{};
finalcut::FString drop_down_symbol{finalcut::fc::BlackDownPointingTriangle};
finalcut::FMenuBar Menubar{this};
finalcut::FMenu File{"&File", &Menubar};
finalcut::FDialogListMenu DglList{drop_down_symbol, &Menubar};
finalcut::FStatusBar Statusbar{this};
finalcut::FMenuItem New{"&New", &File};
finalcut::FMenuItem Close{"&Close", &File};
finalcut::FMenuItem Line1{&File};
finalcut::FMenuItem Next{"Ne&xt window", &File};
finalcut::FMenuItem Previous{"&Previous window", &File};
finalcut::FMenuItem Line2{&File};
finalcut::FMenuItem Quit{"&Quit", &File};
finalcut::FButton CreateButton{this};
finalcut::FButton CloseButton{this};
finalcut::FButton QuitButton{this};
};
#pragma pack(pop)
//----------------------------------------------------------------------
Window::Window (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
, windows()
, drop_down_symbol(wchar_t(finalcut::fc::BlackDownPointingTriangle))
, Menubar(this)
, File("&File", &Menubar)
, DglList(drop_down_symbol, &Menubar)
, Statusbar(this)
, New("&New", &File)
, Close("&Close", &File)
, Line1(&File)
, Next("Ne&xt window", &File)
, Previous("&Previous window", &File)
, Line2(&File)
, Quit("&Quit", &File)
, CreateButton(this)
, CloseButton(this)
, QuitButton(this)
{
// Menu bar item
File.setStatusbarMessage ("File management commands");
@ -578,7 +548,7 @@ void Window::cb_destroyWindow (finalcut::FWidget*, data_ptr data)
if ( win_dat )
{
win_dat->is_open = false;
win_dat->dgl = 0;
win_dat->dgl = nullptr;
}
}

19
finalcut.changes Normal file
View File

@ -0,0 +1,19 @@
-------------------------------------------------------------------
Sun Nov 25 00:03:36 UTC 2018 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.5.0)
-------------------------------------------------------------------
Sat Nov 04 07:53:19 UTC 2017 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.4.0)
-------------------------------------------------------------------
Sun Nov 27 14:00:41 UTC 2016 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.3.0)
-------------------------------------------------------------------
Sat Dec 19 21:01:48 UTC 2015 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.2.0)
-------------------------------------------------------------------
Fri Sep 18 22:35:57 UTC 2015 - Markus Gans <guru.mail@muenster.de>
- Initial Release (version 0.1.1)

View File

@ -4,46 +4,22 @@
# Copyright (c) 2018 by Markus Gans
#
%define sover 0
Name: @PACKAGE@
%define libname libfinal
%define libsoname %{libname}0
Version: @VERSION@
Release: %{buildno}
License: LGPL-3.0
Summary: The Final Cut
Url: https://github.com/gansm/finalcut/
Group: System/Libraries
Source: finalcut-%{version}.tar.gz
Summary: Console widget library
License: LGPL-3.0-or-later
Group: Development/Libraries/C and C++
URL: https://github.com/gansm/finalcut/
Source: https://github.com/gansm/finalcut/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gcc-c++
BuildRequires: glib2-devel
BuildRequires: gpm-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
%if 0%{?suse_version}
%if 0%{?suse_version} > 1130
BuildRequires: gpm-devel
%else
BuildRequires: gpm
%endif
%else
BuildRequires: gpm-devel
%endif
# Additionally required for tool operations
Requires: xxd
Requires: sed
Requires: tr
Requires: grep
Requires: gzip
Requires: bdftopcf
Requires: autoconf-archive
Requires: gcc-c++
Prefix: %_prefix
BuildRoot: %{_tmppath}/finalcut-%{version}-build
%description
The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports
@ -53,13 +29,21 @@ The C++ class design was inspired by the Qt framework. It provides
common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
%package devel
%package -n libfinal-devel
Summary: Development files for The Final Cut text widget library
Group: Development/Libraries/C and C++
Summary: Development files for the final cut library
Requires: %{libname} = %{version}
Requires: %{name} = %{version}
Requires: libfinal%{sover} = %{version}
Requires: bdftopcf
Requires: coreutils
Requires: gcc-c++
Requires: grep
Requires: gzip
Requires: sed
Requires: vim
Provides: libfinal-devel = %{version}
Recommends: libfinal-examples = %{version}
%description devel
%description -n libfinal-devel
The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows
@ -68,13 +52,12 @@ The C++ class design was inspired by the Qt framework. It provides
common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
%package -n %{libsoname}
Group: System/Libraries
Summary: Console widget toolkit
Provides: %{libname} = %{version}
Provides: %{name} = %{version}
%package -n libfinal-examples
Summary: Example files for The Final Cut library
Group: Development/Languages/C and C++
BuildArch: noarch
%description -n %{libsoname}
%description -n libfinal-examples
The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows
@ -83,11 +66,24 @@ The C++ class design was inspired by the Qt framework. It provides
common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
%package static
Group: System/Libraries
%package -n libfinal%{sover}
Summary: Console widget toolkit
Group: System/Libraries
%description static
%description -n libfinal%{sover}
The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows
the simultaneous handling of multiple windows on the screen.
The C++ class design was inspired by the Qt framework. It provides
common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
%package -n libfinal-static
Summary: Console widget toolkit
Group: System/Libraries
%description -n libfinal-static
The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows
@ -97,66 +93,56 @@ common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
%prep
%setup -q -n %{name}-%{version}
%setup -q
%build
autoreconf -v --install --force
%define warn_flags -Wall -Wextra -Wpedantic
export CPPFLAGS="$RPM_OPT_FLAGS %{warn_flags}"
autoreconf -vif
export CPPFLAGS="%{optflags} -Wall -Wextra -Wpedantic"
%ifnarch %ix86 x86_64
export CPPFLAGS="$CPPFLAGS -Wno-error=unused-parameter"
%endif
%configure
make %{?_smp_mflags} V=1
%install
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \
bindir=${RPM_BUILD_ROOT}%{_bindir} \
docdir=${RPM_BUILD_ROOT}%{_docdir}/finalcut/
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/.libs/* ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/*.cpp ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/Makefile.clang ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/Makefile.gcc ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
rm -f ${RPM_BUILD_ROOT}%{_libdir}/libfinal.la
%post -n %{libsoname} -p /sbin/ldconfig
%postun -n %{libsoname} -p /sbin/ldconfig
make install libdir=%{buildroot}%{_libdir}/ \
includedir=%{buildroot}%{_includedir} \
bindir=%{buildroot}%{_bindir} \
docdir=%{buildroot}%{_docdir}/%{name}/
mkdir -p %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/*.cpp %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/Makefile.clang %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/Makefile.gcc %{buildroot}%{_docdir}/%{name}/examples
rm -f %{buildroot}%{_libdir}/libfinal.la %{buildroot}%{_libdir}/%{name}/examples
rm %{buildroot}%{_docdir}/%{name}/ChangeLog %{buildroot}%{_docdir}/%{name}/COPYING.LESSER
%clean
rm -rf $RPM_BUILD_ROOT
%{__rm} -rf %{buildroot}
%files devel
%defattr(-,root,root)
%dir %{_docdir}/finalcut
%dir %{_libdir}/finalcut
%dir %{_libdir}/finalcut/examples
%{_docdir}/finalcut/*
%{_libdir}/pkgconfig/*
%{_libdir}/%{libname}.so
%{_libdir}/finalcut/*
%{_includedir}/*
%post -n libfinal%{sover} -p /sbin/ldconfig
%postun -n libfinal%{sover} -p /sbin/ldconfig
%files -n %{libsoname}
%defattr(-,root,root)
%_libdir/%{libname}.so.*
%files -n libfinal-devel
%if 0%{?sle_version} > 120200 || 0%{?suse_version} > 1500
%license COPYING.LESSER
%else
%doc COPYING.LESSER
%endif
%doc ChangeLog README.md
%exclude %{_docdir}/%{name}/examples
%{_docdir}/%{name}
%{_libdir}/libfinal.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/final
%files static
%files -n libfinal-examples
%{_docdir}/%{name}/examples
%files -n libfinal%{sover}
%{_libdir}/libfinal.so.*
%files -n libfinal-static
%defattr (-,root,root)
%{_libdir}/%{libname}.a
%{_libdir}/libfinal.a
%changelog
* Sun Nov 25 2018 Markus Gans <guru.mail@muenster.de> - 0.5.0-1
- Release (version 0.5.0)
* Sat Nov 04 2017 Markus Gans <guru.mail@muenster.de> - 0.4.0-1
- Release (version 0.4.0)
* Sun Nov 27 2016 Markus Gans <guru.mail@muenster.de> - 0.3.0-1
- Release (version 0.3.0)
* Sat Dec 19 2015 Markus Gans <guru.mail@muenster.de> - 0.2.0-1
- Release (version 0.2.0)
* Fri Sep 18 2015 Markus Gans <guru.mail@muenster.de> - 0.1.1-1
- Initial Release (version 0.1.1)

View File

@ -2,7 +2,7 @@
# Makefile.am - The Final Cut library
#----------------------------------------------------------------------
AM_CPPFLAGS = -Iinclude -Wall -Werror -DCOMPILE_FINAL_CUT
AM_CPPFLAGS = -Iinclude -Wall -Werror -DCOMPILE_FINAL_CUT -std=c++11
SUBDIRS = .

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.5.0"
VERSION = "0.5.1"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final
@ -63,7 +63,7 @@ INCLUDE_HEADERS = \
# compiler parameter
CXX = clang++
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions -std=c++11
MAKEFILE = -f Makefile.clang
LDFLAGS = $(TERMCAP) -lgpm
INCLUDES = -Iinclude
@ -149,7 +149,7 @@ all: dep $(OBJS)
$(LIB): all
debug:
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-reserved-id-macro"
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-implicit-fallthrough -Wno-reserved-id-macro"
profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg"
@ -179,7 +179,7 @@ clean:
$(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.gch *.plist *~
dep:
$(CXX) $(INCLUDES) -DCOMPILE_FINAL_CUT -MM *.cpp >.depend
$(CXX) $(INCLUDES) -std=c++11 -DCOMPILE_FINAL_CUT -MM *.cpp >.depend
#
# include .depend if it exists

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.5.0"
VERSION = "0.5.1"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final
@ -63,7 +63,7 @@ INCLUDE_HEADERS = \
# compiler parameter
CXX = g++
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions -std=c++11
MAKEFILE = -f Makefile.gcc
LDFLAGS = $(TERMCAP) -lgpm
INCLUDES = -Iinclude
@ -178,7 +178,7 @@ clean:
$(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.prof *~
dep:
$(CXX) $(INCLUDES) -MM -DCOMPILE_FINAL_CUT *.cpp >.depend
$(CXX) $(INCLUDES) -std=c++11 -MM -DCOMPILE_FINAL_CUT *.cpp >.depend
#
# include .depend if it exists

View File

@ -32,26 +32,26 @@ namespace finalcut
{
// Global application object
static FApplication* app_object = 0;
static FApplication* app_object = nullptr;
// Flag to exit the local event loop
static bool app_exit_loop = false;
// Static attributes
FWidget* FWidget::main_widget = 0; // main application widget
FWidget* FWidget::active_window = 0; // the active window
FWidget* FWidget::focus_widget = 0; // has keyboard input focus
FWidget* FWidget::clicked_widget = 0; // is focused by click
FWidget* FWidget::open_menu = 0; // currently open menu
FWidget* FWidget::move_size_widget = 0; // move/size by keyboard
FWidget* FApplication::keyboard_widget = 0; // has the keyboard focus
FKeyboard* FApplication::keyboard = 0; // keyboard access
FMouseControl* FApplication::mouse = 0; // mouse control
FWidget* FWidget::main_widget = nullptr; // main application widget
FWidget* FWidget::active_window = nullptr; // the active window
FWidget* FWidget::focus_widget = nullptr; // has keyboard input focus
FWidget* FWidget::clicked_widget = nullptr; // is focused by click
FWidget* FWidget::open_menu = nullptr; // currently open menu
FWidget* FWidget::move_size_widget = nullptr; // move/size by keyboard
FWidget* FApplication::keyboard_widget = nullptr; // has the keyboard focus
FKeyboard* FApplication::keyboard = nullptr; // keyboard access
FMouseControl* FApplication::mouse = nullptr; // mouse control
int FApplication::loop_level = 0; // event loop level
int FApplication::quit_code = 0;
bool FApplication::quit_now = false;
FApplication::eventQueue* FApplication::event_queue = 0;
FApplication::eventQueue* FApplication::event_queue = nullptr;
//----------------------------------------------------------------------
@ -64,10 +64,8 @@ FApplication::FApplication ( const int& _argc
, char* _argv[]
, bool disable_alt_screen )
: FWidget(processParameters(_argc, _argv), disable_alt_screen)
, app_argc(_argc)
, app_argv(_argv)
, key_timeout(100000) // 100 ms
, dblclick_interval(500000) // 500 ms
, app_argc{_argc}
, app_argv{_argv}
{
assert ( ! app_object
&& "FApplication: There should be only one application object" );
@ -89,7 +87,7 @@ FApplication::~FApplication() // destructor
if ( event_queue )
delete event_queue;
app_object = 0;
app_object = nullptr;
}
@ -500,16 +498,16 @@ inline void FApplication::findKeyboardWidget()
{
// Find the widget that has the keyboard focus
FWidget* widget = 0;
FWidget* focus_widget = getFocusWidget();
FWidget* move_size_widget = getMoveSizeWidget();
FWidget* widget = nullptr;
FWidget* focus = getFocusWidget();
FWidget* move_size = getMoveSizeWidget();
if ( focus_widget )
if ( focus )
{
if ( move_size_widget )
widget = move_size_widget;
if ( move_size )
widget = move_size;
else
widget = focus_widget;
widget = focus;
}
else
{
@ -692,11 +690,11 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n )
{
// unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
FWidget* move_size = getMoveSizeWidget();
if ( move_size_widget )
if ( move_size )
{
FWidget* w = move_size_widget;
FWidget* w = move_size;
setMoveSizeWidget(0);
w->redraw();
}
@ -731,11 +729,11 @@ bool FApplication::processAccelerator (const FWidget*& widget)
if ( iter->key == keyboard->getKey() )
{
// unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
FWidget* move_size = getMoveSizeWidget();
if ( move_size_widget )
if ( move_size )
{
FWidget* w = move_size_widget;
FWidget* w = move_size;
setMoveSizeWidget(0);
w->redraw();
}
@ -772,13 +770,13 @@ bool FApplication::getMouseEvent()
//----------------------------------------------------------------------
FWidget*& FApplication::determineClickedWidget()
{
FWidget*& clicked_widget = getClickedWidget();
FWidget*& clicked = getClickedWidget();
if ( clicked_widget )
return clicked_widget;
if ( clicked )
return clicked;
if ( ! mouse )
return clicked_widget;
return clicked;
if ( ! mouse->isLeftButtonPressed()
&& ! mouse->isLeftButtonDoubleClick()
@ -786,7 +784,7 @@ FWidget*& FApplication::determineClickedWidget()
&& ! mouse->isMiddleButtonPressed()
&& ! mouse->isWheelUp()
&& ! mouse->isWheelDown() )
return clicked_widget;
return clicked;
const FPoint& mouse_position = mouse->getPos();
@ -797,11 +795,11 @@ FWidget*& FApplication::determineClickedWidget()
{
// Determine the widget at the current click position
FWidget* child = childWidgetAt (window, mouse_position);
clicked_widget = ( child != 0 ) ? child : window;
setClickedWidget (clicked_widget);
clicked = ( child != 0 ) ? child : window;
setClickedWidget (clicked);
}
return clicked_widget;
return clicked;
}
//----------------------------------------------------------------------
@ -809,11 +807,11 @@ void FApplication::unsetMoveSizeMode()
{
// Unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
FWidget* move_size = getMoveSizeWidget();
if ( move_size_widget )
if ( move_size )
{
FWidget* w = move_size_widget;
FWidget* w = move_size;
setMoveSizeWidget(0);
w->redraw();
}
@ -824,10 +822,10 @@ void FApplication::closeOpenMenu()
{
// Close the open menu
FWidget* open_menu = getOpenMenu();
FMenu* menu = static_cast<FMenu*>(open_menu);
FWidget* openmenu = getOpenMenu();
FMenu* menu = static_cast<FMenu*>(openmenu);
if ( ! open_menu || ( mouse && mouse->isMoved()) )
if ( ! openmenu || ( mouse && mouse->isMoved()) )
return;
if ( mouse )
@ -867,10 +865,10 @@ void FApplication::unselectMenubarItems()
{
// Unselect the menu bar items
FWidget* open_menu = getOpenMenu();
FWidget* openmenu = getOpenMenu();
FMenuBar* menu_bar = getMenuBar();
if ( open_menu || (mouse && mouse->isMoved()) )
if ( openmenu || (mouse && mouse->isMoved()) )
return;
if ( ! menu_bar )
@ -907,9 +905,9 @@ void FApplication::unselectMenubarItems()
//----------------------------------------------------------------------
void FApplication::sendMouseEvent()
{
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( ! clicked_widget )
if ( ! clicked )
return;
if ( ! mouse )
@ -928,7 +926,7 @@ void FApplication::sendMouseEvent()
if ( mouse->isMetaKeyPressed() )
key_state |= fc::MetaButton;
widgetMousePos = clicked_widget->termToWidgetPos(mouse_position);
widgetMousePos = clicked->termToWidgetPos(mouse_position);
if ( mouse->isMoved() )
{
@ -953,7 +951,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
if ( ! mouse )
return;
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( mouse->isLeftButtonPressed() )
{
@ -961,7 +959,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
}
if ( mouse->isRightButtonPressed() )
@ -970,7 +968,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::RightButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
}
if ( mouse->isMiddleButtonPressed() )
@ -979,7 +977,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::MiddleButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
}
}
@ -991,7 +989,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
if ( ! mouse )
return;
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( mouse->isLeftButtonDoubleClick() )
{
@ -999,7 +997,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_dblclick_ev);
sendEvent (clicked, &m_dblclick_ev);
}
else if ( mouse->isLeftButtonPressed() )
{
@ -1007,7 +1005,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::LeftButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
}
else if ( mouse->isLeftButtonReleased() )
{
@ -1015,7 +1013,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::LeftButton | key_state );
FWidget* released_widget = clicked_widget;
FWidget* released_widget = clicked;
if ( ! mouse->isRightButtonPressed()
&& ! mouse->isMiddleButtonPressed() )
@ -1033,7 +1031,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
if ( ! mouse )
return;
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( mouse->isRightButtonPressed() )
{
@ -1041,7 +1039,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::RightButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
}
else if ( mouse->isRightButtonReleased() )
{
@ -1049,7 +1047,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::RightButton | key_state );
FWidget* released_widget = clicked_widget;
FWidget* released_widget = clicked;
if ( ! mouse->isLeftButtonPressed()
&& ! mouse->isMiddleButtonPressed() )
@ -1067,7 +1065,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
if ( ! mouse )
return;
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( mouse->isMiddleButtonPressed() )
{
@ -1075,7 +1073,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::MiddleButton | key_state );
sendEvent (clicked_widget, &m_down_ev);
sendEvent (clicked, &m_down_ev);
// gnome-terminal sends no released on middle click
if ( isGnomeTerminal() )
@ -1087,7 +1085,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::MiddleButton | key_state );
FWidget* released_widget = clicked_widget;
FWidget* released_widget = clicked;
if ( ! mouse->isLeftButtonPressed()
&& ! mouse->isRightButtonPressed() )
@ -1106,7 +1104,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
if ( ! mouse )
return;
FWidget* clicked_widget = getClickedWidget();
FWidget* clicked = getClickedWidget();
if ( mouse->isWheelUp() )
{
@ -1114,7 +1112,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::WheelUp );
FWidget* scroll_over_widget = clicked_widget;
FWidget* scroll_over_widget = clicked;
setClickedWidget(0);
sendEvent(scroll_over_widget, &wheel_ev);
}
@ -1125,7 +1123,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
, widgetMousePos
, mouse_position
, fc::WheelDown );
FWidget* scroll_over_widget = clicked_widget;
FWidget* scroll_over_widget = clicked;
setClickedWidget(0);
sendEvent (scroll_over_widget, &wheel_ev);
}

View File

@ -35,24 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FButton::FButton(FWidget* parent)
: FWidget(parent)
, text()
, button_down(false)
, active_focus(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
, hotkeypos(NOT_SET)
, indent(0)
, center_offset(0)
, vcenter_offset(0)
, txtlength(0)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
, button_focus_fg(wc.button_active_focus_fg)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
{
init();
}
@ -60,27 +42,9 @@ FButton::FButton(FWidget* parent)
//----------------------------------------------------------------------
FButton::FButton (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, button_down(false)
, active_focus(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
, hotkeypos(NOT_SET)
, indent(0)
, center_offset(0)
, vcenter_offset(0)
, txtlength(0)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
, button_focus_fg(wc.button_active_focus_fg)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
, text{txt}
{
init();
detectHotkey();
}
//----------------------------------------------------------------------
@ -449,6 +413,9 @@ void FButton::init()
setForegroundColor (wc.button_active_fg);
setBackgroundColor (wc.button_active_bg);
setShadow();
if ( ! text.isEmpty() )
detectHotkey();
}
//----------------------------------------------------------------------
@ -651,7 +618,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
else
center_offset = (getWidth() - txtlength - 1) / 2;
// Print button text line --------
// Print button text line
for (pos = 0; pos < center_offset; pos++)
print (space_char); // █

View File

@ -37,8 +37,6 @@ namespace finalcut
//----------------------------------------------------------------------
FButtonGroup::FButtonGroup(FWidget* parent)
: FScrollView(parent)
, text()
, buttonlist()
{
init();
}
@ -46,8 +44,7 @@ FButtonGroup::FButtonGroup(FWidget* parent)
//----------------------------------------------------------------------
FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
: FScrollView(parent)
, text(txt)
, buttonlist()
, text{txt}
{
init();
setText(txt);

View File

@ -27,18 +27,10 @@ namespace finalcut
//----------------------------------------------------------------------
// class FColorPalette
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FColorPalette::FColorPalette()
{ }
//----------------------------------------------------------------------
FColorPalette::~FColorPalette() // destructor
{ }
// public methods of FColorPalette
//----------------------------------------------------------------------
void FColorPalette::set8ColorPalette (funcp setPalette)

View File

@ -35,21 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FDialog::FDialog (FWidget* parent)
: FWindow(parent)
, tb_text()
, result_code(FDialog::Reject)
, zoom_button_pressed(false)
, zoom_button_active(false)
, setPos_error(false)
, setSize_error(false)
, titlebar_click_pos()
, resize_click_pos()
, save_geometry()
, dialog_menu()
, dgl_menuitem()
, move_size_item()
, zoom_item()
, close_item()
, tooltip()
{
init();
}
@ -58,20 +43,6 @@ FDialog::FDialog (FWidget* parent)
FDialog::FDialog (const FString& txt, FWidget* parent)
: FWindow(parent)
, tb_text(txt)
, result_code(FDialog::Reject)
, zoom_button_pressed(false)
, zoom_button_active(false)
, setPos_error(false)
, setSize_error(false)
, titlebar_click_pos()
, resize_click_pos()
, save_geometry()
, dialog_menu()
, dgl_menuitem()
, move_size_item()
, zoom_item()
, close_item()
, tooltip(0)
{
init();
}
@ -82,9 +53,9 @@ FDialog::~FDialog() // destructor
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
bool is_quit = fapp->isQuit();
delete dialog_menu;
dgl_menuitem = 0;
dgl_menuitem = nullptr;
delete accelerator_list;
accelerator_list = 0;
accelerator_list = nullptr;
if ( ! is_quit )
switchToPrevWindow(this);
@ -180,7 +151,7 @@ void FDialog::hide()
}
//----------------------------------------------------------------------
FDialog::DialogCode FDialog::exec()
int FDialog::exec()
{
result_code = FDialog::Reject;
show();
@ -380,13 +351,13 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
}
// set the cursor to the focus widget
FWidget* focus_widget = FWidget::getFocusWidget();
if ( focus_widget
&& focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() )
FWidget* focus = FWidget::getFocusWidget();
if ( focus
&& focus->isVisible()
&& focus->hasVisibleCursor() )
{
FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos);
FPoint cursor_pos = focus->getCursorPos();
focus->setCursorPos(cursor_pos);
}
}
@ -796,7 +767,7 @@ void FDialog::onWindowLowered (FEvent*)
// protected methods of FDialog
//----------------------------------------------------------------------
void FDialog::done(DialogCode result)
void FDialog::done(int result)
{
hide();
result_code = result;
@ -808,7 +779,7 @@ void FDialog::draw()
if ( tooltip && ! getMoveSizeWidget() )
{
delete tooltip;
tooltip = 0;
tooltip = nullptr;
}
// Fill the background
@ -1254,14 +1225,14 @@ void FDialog::setCursorToFocusWidget()
{
// Set the cursor to the focus widget
FWidget* focus_widget = FWidget::getFocusWidget();
FWidget* focus = FWidget::getFocusWidget();
if ( focus_widget
&& focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() )
if ( focus
&& focus->isVisible()
&& focus->hasVisibleCursor() )
{
FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos);
FPoint cursor_pos = focus->getCursorPos();
focus->setCursorPos(cursor_pos);
updateVTermCursor(vwin);
}
}
@ -1652,7 +1623,7 @@ inline void FDialog::acceptMoveSize()
if ( tooltip )
delete tooltip;
tooltip = 0;
tooltip = nullptr;
redraw();
}
@ -1664,7 +1635,7 @@ inline void FDialog::cancelMoveSize()
if ( tooltip )
delete tooltip;
tooltip = 0;
tooltip = nullptr;
setPos (save_geometry.getPos());
if ( isResizeable() )

View File

@ -32,7 +32,7 @@ namespace finalcut
//----------------------------------------------------------------------
FEvent::FEvent(int ev_type) // constructor
: t(ev_type)
: t{ev_type}
{ }
//----------------------------------------------------------------------
@ -50,8 +50,7 @@ int FEvent::type() const
FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
: FEvent(ev_type)
, k(key_num)
, accpt(false)
, k{key_num}
{ }
//----------------------------------------------------------------------
@ -81,22 +80,19 @@ void FKeyEvent::ignore()
FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& termPos
, int button )
: FEvent(ev_type)
, p(pos)
, tp()
, b(button)
, p{pos}
, tp{termPos}
, b{button}
{ }
//----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& termPos
, int button )
: FEvent(ev_type)
, p(pos)
, tp(termPos)
, b(button)
: FMouseEvent(ev_type, pos, FPoint(), button)
{ }
//----------------------------------------------------------------------
@ -138,22 +134,19 @@ int FMouseEvent::getButton() const
FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& termPos
, int wheel )
: FEvent(ev_type)
, p(pos)
, tp()
, w(wheel)
, p{pos}
, tp{termPos}
, w{wheel}
{ }
//----------------------------------------------------------------------
FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& termPos
, int wheel )
: FEvent(ev_type)
, p(pos)
, tp(termPos)
, w(wheel)
: FWheelEvent(ev_type, pos, FPoint(), wheel)
{ }
//----------------------------------------------------------------------
@ -195,8 +188,6 @@ int FWheelEvent::getWheel() const
FFocusEvent::FFocusEvent (int ev_type) // constructor
: FEvent(ev_type)
, accpt(true)
, focus_type(fc::FocusDefiniteWidget)
{ }
//----------------------------------------------------------------------
@ -242,8 +233,7 @@ void FFocusEvent::ignore()
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
: FEvent(ev_type)
, accpt(false)
, focus_widget(focused)
, focus_widget{focused}
{ }
//----------------------------------------------------------------------
@ -273,7 +263,6 @@ void FAccelEvent::ignore()
FResizeEvent::FResizeEvent(int ev_type) // constructor
: FEvent(ev_type)
, accpt(false)
{ }
//----------------------------------------------------------------------
@ -323,7 +312,6 @@ FHideEvent::~FHideEvent() // destructor
FCloseEvent::FCloseEvent(int ev_type) // constructor
: FEvent(ev_type)
, accpt(false)
{ }
//----------------------------------------------------------------------
@ -349,7 +337,7 @@ void FCloseEvent::ignore()
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
: FEvent(ev_type)
, id(timer_id)
, id{timer_id}
{ }
//----------------------------------------------------------------------

View File

@ -56,17 +56,6 @@ bool sortDirFirst ( const FFileDialog::dir_entry& lhs
//----------------------------------------------------------------------
FFileDialog::FFileDialog (FWidget* parent)
: FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern()
, filename()
, filebrowser()
, hidden()
, cancel()
, open()
, dlg_type(FFileDialog::Open)
, show_hidden(false)
{
init();
}
@ -74,20 +63,9 @@ FFileDialog::FFileDialog (FWidget* parent)
//----------------------------------------------------------------------
FFileDialog::FFileDialog (const FFileDialog& fdlg)
: FDialog(fdlg.getParentWidget())
, directory_stream(0)
, dir_entries()
, directory(fdlg.directory)
, filter_pattern(fdlg.filter_pattern)
, filename()
, filebrowser()
, hidden()
, cancel()
, open()
, dlg_type(fdlg.dlg_type)
, show_hidden(fdlg.show_hidden)
{
if ( directory )
setPath(directory);
if ( fdlg.directory )
setPath(fdlg.directory);
init();
}
@ -98,17 +76,8 @@ FFileDialog::FFileDialog ( const FString& dirname
, DialogType type
, FWidget* parent )
: FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern(filter)
, filename(this)
, filebrowser(this)
, hidden(this)
, cancel(this)
, open(this)
, dlg_type(type)
, show_hidden(false)
{
if ( ! dirname.isNull() )
setPath(dirname);

View File

@ -31,10 +31,10 @@ namespace finalcut
// static class attributes
long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
struct timeval FKeyboard::time_keypressed;
struct timeval FKeyboard::time_keypressed{};
#if defined(__linux__)
FTermLinux* FKeyboard::linux = 0;
FTermLinux* FKeyboard::linux = nullptr;
#endif
//----------------------------------------------------------------------
@ -45,12 +45,9 @@ struct timeval FKeyboard::time_keypressed;
//----------------------------------------------------------------------
FKeyboardCommand::FKeyboardCommand ( FApplication* object
, void(FApplication::*method)() )
: instance(0)
, handler(0)
{
instance = object;
handler = method;
}
: instance(object)
, handler(method)
{ }
// public methods of FKeyboardCommand
//----------------------------------------------------------------------
@ -67,18 +64,6 @@ void FKeyboardCommand::execute()
// constructors and destructor
//----------------------------------------------------------------------
FKeyboard::FKeyboard()
: key(0)
, fifo_offset(0)
, fifo_in_use(false)
, stdin_status_flags(0)
, input_data_pending(false)
, utf8_input(false)
, mouse_support(true)
, non_blocking_stdin(false)
, keypressed_cmd()
, keyreleased_cmd()
, escape_key_cmd()
, key_map(0)
{
// Initialize keyboard values
time_keypressed.tv_sec = 0;
@ -89,10 +74,6 @@ FKeyboard::FKeyboard()
if ( stdin_status_flags == -1 )
std::abort();
// Initialize arrays with '\0'
std::fill_n (read_buf, READ_BUF_SIZE, '\0');
std::fill_n (fifo_buf, FIFO_BUF_SIZE, '\0');
}
//----------------------------------------------------------------------

View File

@ -35,15 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FLabel::FLabel(FWidget* parent)
: FWidget(parent)
, multiline_text()
, multiline(false)
, text()
, alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg)
, emphasis(false)
, reverse_mode(false)
, accel_widget(0)
{
init();
}
@ -51,15 +42,7 @@ FLabel::FLabel(FWidget* parent)
//----------------------------------------------------------------------
FLabel::FLabel (const FString& txt, FWidget* parent)
: FWidget(parent)
, multiline_text()
, multiline(false)
, text(txt)
, alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg)
, emphasis(false)
, reverse_mode(false)
, accel_widget(0)
{
init();
setText(txt);
@ -86,6 +69,13 @@ FLabel& FLabel::operator << (const FString& s)
return *this;
}
//----------------------------------------------------------------------
FLabel& FLabel::operator << (fc::SpecialCharacter c)
{
setText(text + static_cast<wchar_t>(c));
return *this;
}
//----------------------------------------------------------------------
FLabel& FLabel::operator << (const wchar_t c)
{
@ -358,7 +348,7 @@ void FLabel::onAccel (FAccelEvent* ev)
//----------------------------------------------------------------------
void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
{
accel_widget = 0;
accel_widget = nullptr;
delAccelerator();
}

View File

@ -35,16 +35,7 @@ namespace finalcut
//----------------------------------------------------------------------
FLineEdit::FLineEdit(FWidget* parent)
: FWidget(parent)
, text("")
, label_text("")
, label(new FLabel("", parent))
, label_orientation(FLineEdit::label_left)
, drag_scroll(FLineEdit::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, insert_mode(true)
, cursor_pos(0)
, text_offset(0)
, label{new FLabel("", parent)}
{
init();
}
@ -53,15 +44,7 @@ FLineEdit::FLineEdit(FWidget* parent)
FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, label_text("")
, label(new FLabel("", parent))
, label_orientation(FLineEdit::label_left)
, drag_scroll(FLineEdit::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, insert_mode(true)
, cursor_pos(0)
, text_offset(0)
, label{new FLabel("", parent)}
{
init();
setText(txt);
@ -89,6 +72,13 @@ FLineEdit& FLineEdit::operator << (const FString& s)
return *this;
}
//----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (fc::SpecialCharacter c)
{
setText(text + static_cast<wchar_t>(c));
return *this;
}
//----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (const wchar_t c)
{
@ -537,7 +527,8 @@ void FLineEdit::onTimer (FTimerEvent*)
break;
case FLineEdit::scrollRight:
if ( text_offset == len - getWidth() + 2 )
if ( len < getWidth() - 2
|| text_offset == len - getWidth() + 2 )
{
drag_scroll = FLineEdit::noScroll;
return;

View File

@ -37,10 +37,6 @@ namespace finalcut
// constructor and destructor
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem()
: text()
, data_pointer(0)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
@ -55,8 +51,6 @@ FListBoxItem::FListBoxItem (const FListBoxItem& item)
FListBoxItem::FListBoxItem (const FString& txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
@ -90,28 +84,6 @@ FListBoxItem& FListBoxItem::operator = (const FListBoxItem& item)
//----------------------------------------------------------------------
FListBox::FListBox (FWidget* parent)
: FWidget(parent)
, convertToItem(0)
, itemlist()
, source_container(0)
, conv_type(FListBox::no_convert)
, vbar(0)
, hbar(0)
, text()
, inc_search()
, multi_select(false)
, mouse_select(false)
, drag_scroll(fc::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, scroll_distance(1)
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, max_line_width(0)
{
init();
}
@ -177,7 +149,10 @@ void FListBox::showInsideBrackets ( std::size_t index
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->setValue (xoffset);
@ -332,13 +307,19 @@ void FListBox::remove (std::size_t item)
++iter;
}
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
hbar->hide();
vbar->setMaximum (int(element_count - getHeight()) + 2);
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight()) + 2
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
if ( vbar->isVisible() && element_count < getHeight() - 1 )
@ -765,15 +746,15 @@ void FListBox::onFocusOut (FFocusEvent*)
// protected methods of FListBox
//----------------------------------------------------------------------
void FListBox::adjustYOffset()
void FListBox::adjustYOffset (std::size_t element_count)
{
std::size_t element_count = getCount();
std::size_t height = getClientHeight();
if ( element_count == 0 || getClientHeight() == 0 )
if ( height == 0 )
return;
if ( yoffset > int(element_count - getClientHeight()) )
yoffset = int(element_count - getClientHeight());
if ( yoffset > int(element_count - height) )
yoffset = int(element_count - height);
if ( yoffset < 0 )
yoffset = 0;
@ -781,36 +762,47 @@ void FListBox::adjustYOffset()
if ( current < std::size_t(yoffset) )
current = std::size_t(yoffset);
if ( yoffset < int(current - getClientHeight()) )
yoffset = int(current - getClientHeight());
if ( yoffset < int(current - height) )
yoffset = int(current - height);
}
//----------------------------------------------------------------------
void FListBox::adjustSize()
{
std::size_t element_count;
FWidget::adjustSize();
adjustYOffset();
std::size_t element_count = getCount();
std::size_t width = getClientWidth();
std::size_t height = getClientHeight();
element_count = getCount();
vbar->setMaximum (int(element_count - getClientHeight()));
vbar->setPageSize (int(element_count), int(getClientHeight()));
if ( element_count == 0 )
return;
adjustYOffset (element_count);
int vmax = ( element_count > height )
? int(element_count - height)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(height));
vbar->setX (int(getWidth()));
vbar->setHeight (getClientHeight(), false);
vbar->setHeight (height, false);
vbar->resize();
hbar->setMaximum (int(max_line_width - getClientWidth() + 2));
hbar->setPageSize (int(max_line_width), int(getClientWidth()) - 2);
int hmax = ( max_line_width > width - 2 )
? int(max_line_width - width + 2)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(width) - 2);
hbar->setY (int(getHeight()));
hbar->setWidth (getClientWidth() + nf_offset, false);
hbar->setWidth (width + nf_offset, false);
hbar->resize();
if ( element_count <= getClientHeight() )
if ( element_count <= height )
vbar->hide();
else
vbar->setVisible();
if ( max_line_width < getClientWidth() - 1 )
if ( max_line_width < width - 1 )
hbar->hide();
else
hbar->setVisible();
@ -1051,53 +1043,15 @@ inline void FListBox::drawListLine ( int y
//----------------------------------------------------------------------
inline void FListBox::printLeftBracket (fc::brackets_type bracket_type)
{
switch ( bracket_type )
{
case fc::NoBrackets:
break;
case fc::SquareBrackets:
print ('[');
break;
case fc::Parenthesis:
print ('(');
break;
case fc::CurlyBrackets:
print ('{');
break;
case fc::AngleBrackets:
print ('<');
break;
}
if ( bracket_type != fc::NoBrackets )
print ("\0[({<"[bracket_type]);
}
//----------------------------------------------------------------------
inline void FListBox::printRightBracket (fc::brackets_type bracket_type)
{
switch ( bracket_type )
{
case fc::NoBrackets:
break;
case fc::SquareBrackets:
print (']');
break;
case fc::Parenthesis:
print (')');
break;
case fc::CurlyBrackets:
print ('}');
break;
case fc::AngleBrackets:
print ('>');
break;
}
if ( bracket_type != fc::NoBrackets )
print ("\0])}>"[bracket_type]);
}
//----------------------------------------------------------------------
@ -1291,7 +1245,10 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->calculateSliderValues();
@ -1303,7 +1260,10 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
//----------------------------------------------------------------------
void FListBox::recalculateVerticalBar (std::size_t element_count)
{
vbar->setMaximum (int(element_count - getHeight() + 2));
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight() + 2)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues();

View File

@ -163,12 +163,6 @@ FListViewItem::FListViewItem (const FListViewItem& item)
: FObject(item.getParent())
, column_list(item.column_list)
, data_pointer(item.data_pointer)
, root()
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
FObject* parent = getParent();
@ -188,14 +182,6 @@ FListViewItem::FListViewItem (const FListViewItem& item)
//----------------------------------------------------------------------
FListViewItem::FListViewItem (FObjectIterator parent_iter)
: FObject((*parent_iter)->getParent())
, column_list()
, data_pointer(0)
, root()
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
insert (this, parent_iter);
}
@ -207,12 +193,6 @@ FListViewItem::FListViewItem ( const FStringList& cols
: FObject(0)
, column_list(cols)
, data_pointer(data)
, root()
, visible_lines(1)
, expandable(false)
, is_expand(false)
, checkable(false)
, is_checked(false)
{
if ( cols.empty() )
return;
@ -457,18 +437,9 @@ void FListViewItem::resetVisibleLineCounter()
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
FListViewIterator::FListViewIterator ()
: iter_path()
, node()
, position(0)
{ }
//----------------------------------------------------------------------
FListViewIterator::FListViewIterator (FObjectIterator iter)
: iter_path()
, node(iter)
, position(0)
: node(iter)
{ }
@ -615,34 +586,6 @@ void FListViewIterator::parentElement()
//----------------------------------------------------------------------
FListView::FListView (FWidget* parent)
: FWidget(parent)
, root()
, selflist()
, itemlist()
, current_iter()
, first_visible_line()
, last_visible_line()
, header()
, headerline()
, vbar(0)
, hbar(0)
, drag_scroll(fc::noScroll)
, scroll_repeat(100)
, scroll_distance(1)
, scroll_timer(false)
, tree_view(false)
, hide_sort_indicator(false)
, has_checkable_items(false)
, clicked_expander_pos(-1, -1)
, clicked_header_pos(-1, -1)
, clicked_checkbox_item(0)
, xoffset(0)
, nf_offset(0)
, max_line_width(1)
, sort_column(-1)
, sort_type()
, sort_order(fc::unsorted)
, user_defined_ascending(0)
, user_defined_descending(0)
{
init();
}
@ -1185,7 +1128,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
clicked_expander_pos.setPoint(-1, -1);
clicked_header_pos.setPoint(-1, -1);
clicked_checkbox_item = 0;
clicked_checkbox_item = nullptr;
}
//----------------------------------------------------------------------
@ -1371,12 +1314,11 @@ void FListView::onFocusOut (FFocusEvent*)
// protected methods of FListView
//----------------------------------------------------------------------
void FListView::adjustViewport()
void FListView::adjustViewport (int element_count)
{
int element_count = int(getCount());
int height = int(getClientHeight());
if ( element_count == 0 || height <= 0 )
if ( height <= 0 )
return;
if ( element_count < height )
@ -1414,29 +1356,40 @@ void FListView::adjustViewport()
//----------------------------------------------------------------------
void FListView::adjustSize()
{
std::size_t element_count;
FWidget::adjustSize();
adjustViewport();
std::size_t element_count = getCount();
std::size_t width = getClientWidth();
std::size_t height = getClientHeight();
element_count = getCount();
vbar->setMaximum (int(element_count - getClientHeight()));
vbar->setPageSize (int(element_count), int(getClientHeight()));
if ( element_count == 0 )
return;
adjustViewport (int(element_count));
int vmax = ( element_count > height )
? int(element_count - height)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(height));
vbar->setX (int(getWidth()));
vbar->setHeight (getClientHeight(), false);
vbar->setHeight (height, false);
vbar->resize();
hbar->setMaximum (max_line_width - int(getClientWidth()));
hbar->setPageSize (max_line_width, int(getClientWidth()));
int hmax = ( max_line_width > width )
? int(max_line_width - width)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(width));
hbar->setY (int(getHeight()));
hbar->setWidth (getClientWidth(), false);
hbar->setWidth (width, false);
hbar->resize();
if ( element_count <= getClientHeight() )
if ( element_count <= height )
vbar->hide();
else
vbar->setVisible();
if ( max_line_width <= int(getClientWidth()) )
if ( max_line_width <= width )
hbar->hide();
else
hbar->setVisible();
@ -1490,7 +1443,7 @@ void FListView::init()
setTopPadding(1);
setLeftPadding(1);
setBottomPadding(1);
setRightPadding(1 + nf_offset);
setRightPadding(1 + int(nf_offset));
}
//----------------------------------------------------------------------
@ -1763,7 +1716,7 @@ void FListView::drawListLine ( const FListViewItem* item
}
line = line.mid ( std::size_t(xoffset) + 1
, getWidth() - std::size_t(nf_offset) - 2);
, getWidth() - nf_offset - 2);
const wchar_t* const& element_str = line.wc_str();
std::size_t len = line.getLength();
std::size_t i;
@ -1771,7 +1724,7 @@ void FListView::drawListLine ( const FListViewItem* item
for (i = 0; i < len; i++)
*this << element_str[i];
for (; i < getWidth() - std::size_t(nf_offset) - 2; i++)
for (; i < getWidth() - nf_offset - 2; i++)
print (' ');
}
@ -1825,7 +1778,7 @@ inline FString FListView::getCheckBox (const FListViewItem* item)
checkbox = L"[ ] ";
if ( item->isChecked() )
checkbox[1] = wchar_t(fc::Times); // Times ×
checkbox[1] = fc::Times; // Times ×
}
return checkbox;
@ -1846,12 +1799,12 @@ inline FString FListView::getLinePrefix ( const FListViewItem* item
{
if ( item->isExpand() )
{
line += wchar_t(fc::BlackDownPointingTriangle); // ▼
line += fc::BlackDownPointingTriangle; // ▼
line += L' ';
}
else
{
line += wchar_t(fc::BlackRightPointingPointer); // ►
line += fc::BlackRightPointingPointer; // ►
line += L' ';
}
}
@ -1878,9 +1831,9 @@ inline void FListView::drawSortIndicator ( std::size_t& length
length++;
if ( sort_order == fc::ascending )
headerline << wchar_t(fc::BlackUpPointingTriangle); // ▲
headerline << fc::BlackUpPointingTriangle; // ▲
else if ( sort_order == fc::descending )
headerline << wchar_t(fc::BlackDownPointingTriangle); // ▼
headerline << fc::BlackDownPointingTriangle; // ▼
if ( length < column_width )
{
@ -1893,7 +1846,7 @@ inline void FListView::drawSortIndicator ( std::size_t& length
inline void FListView::drawHeaderBorder (std::size_t length)
{
setColor();
const FString line (length, wchar_t(fc::BoxDrawingsHorizontal));
const FString line (length, fc::BoxDrawingsHorizontal);
headerline << line; // horizontal line
}
@ -1982,10 +1935,10 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
}
//----------------------------------------------------------------------
int FListView::determineLineWidth (FListViewItem* item)
std::size_t FListView::determineLineWidth (FListViewItem* item)
{
static const int padding_space = 1;
int line_width = padding_space; // leading space
static const std::size_t padding_space = 1;
std::size_t line_width = padding_space; // leading space
uInt column_idx = 0;
uInt entries = uInt(item->column_list.size());
headerItems::iterator header_iter;
@ -1993,23 +1946,24 @@ int FListView::determineLineWidth (FListViewItem* item)
while ( header_iter != header.end() )
{
int width = header_iter->width;
std::size_t width = std::size_t(header_iter->width);
bool fixed_width = header_iter->fixed_width;
if ( ! fixed_width )
{
int len;
std::size_t len;
if ( column_idx < entries )
len = int(item->column_list[column_idx].getLength());
len = item->column_list[column_idx].getLength();
else
len = 0;
if ( len > width )
header_iter->width = len;
header_iter->width = int(len);
}
line_width += header_iter->width + padding_space; // width + trailing space
line_width += std::size_t(header_iter->width)
+ padding_space; // width + trailing space
column_idx++;
++header_iter;
}
@ -2020,7 +1974,7 @@ int FListView::determineLineWidth (FListViewItem* item)
//----------------------------------------------------------------------
inline void FListView::beforeInsertion (FListViewItem* item)
{
int line_width = determineLineWidth (item);
std::size_t line_width = determineLineWidth (item);
recalculateHorizontalBar (line_width);
}
@ -2038,22 +1992,25 @@ inline void FListView::afterInsertion()
// Sort list by a column (only if activated)
sort();
int element_count = int(getCount());
std::size_t element_count = getCount();
recalculateVerticalBar (element_count);
}
//----------------------------------------------------------------------
void FListView::recalculateHorizontalBar (int len)
void FListView::recalculateHorizontalBar (std::size_t len)
{
if ( len <= max_line_width )
return;
max_line_width = len;
if ( len >= int(getWidth()) - nf_offset - 3 )
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4);
hbar->calculateSliderValues();
if ( ! hbar->isVisible() )
@ -2062,13 +2019,16 @@ void FListView::recalculateHorizontalBar (int len)
}
//----------------------------------------------------------------------
void FListView::recalculateVerticalBar (int element_count)
void FListView::recalculateVerticalBar (std::size_t element_count)
{
vbar->setMaximum (element_count - int(getHeight()) + 2);
vbar->setPageSize (element_count, int(getHeight()) - 2);
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight() + 2)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues();
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
vbar->setVisible();
}
@ -2105,12 +2065,8 @@ void FListView::mouseHeaderClicked()
sort();
if ( isVisible() )
{
drawHeadlines();
drawList();
updateTerminal();
flush_out();
}
updateDrawing (true, false);
break;
}
@ -2300,7 +2256,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
// Collapse element
item->collapse();
adjustSize();
int element_count = int(getCount());
std::size_t element_count = getCount();
recalculateVerticalBar (element_count);
// Force vertical scrollbar redraw
first_line_position_before = -1;
@ -2344,7 +2300,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
//----------------------------------------------------------------------
inline void FListView::keyRight (int& first_line_position_before)
{
int xoffset_end = max_line_width - int(getClientWidth());
int xoffset_end = int(max_line_width) - int(getClientWidth());
FListViewItem* item = getCurrentItem();
if ( tree_view && item->isExpandable() && ! item->isExpand() )
@ -2522,7 +2478,7 @@ void FListView::stepBackward (int distance)
//----------------------------------------------------------------------
void FListView::scrollToX (int x)
{
int xoffset_end = max_line_width - int(getClientWidth());
int xoffset_end = int(max_line_width) - int(getClientWidth());
if ( xoffset == x )
return;

View File

@ -38,14 +38,6 @@ namespace finalcut
//----------------------------------------------------------------------
FMenu::FMenu(FWidget* parent)
: FWindow(parent)
, item()
, super_menu(0)
, opened_sub_menu(0)
, shown_sub_menu(0)
, max_item_width(0)
, hotkeypos(NOT_SET)
, mouse_down(false)
, has_checkable_items(false)
{
init(parent);
}
@ -54,13 +46,6 @@ FMenu::FMenu(FWidget* parent)
FMenu::FMenu (const FString& txt, FWidget* parent)
: FWindow(parent)
, item(txt, parent)
, super_menu(0)
, opened_sub_menu(0)
, shown_sub_menu(0)
, max_item_width(0)
, hotkeypos(NOT_SET)
, mouse_down(false)
, has_checkable_items(false)
{
init(parent);
}
@ -115,10 +100,10 @@ void FMenu::hide()
if ( ! isSubMenu() )
{
FMenu* open_menu = static_cast<FMenu*>(getOpenMenu());
FMenu* openmenu = static_cast<FMenu*>(getOpenMenu());
if ( open_menu && open_menu != this )
open_menu->hide();
if ( openmenu && openmenu != this )
openmenu->hide();
setOpenMenu(0);
}
@ -198,7 +183,7 @@ void FMenu::onKeyPress (FKeyEvent* ev)
//----------------------------------------------------------------------
void FMenu::onMouseDown (FMouseEvent* ev)
{
shown_sub_menu = 0;
shown_sub_menu = nullptr;
if ( ev->getButton() != fc::LeftButton )
{
@ -284,7 +269,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
isMouseOverMenuBar (ev->getTermPos())
};
shown_sub_menu = 0;
shown_sub_menu = nullptr;
// Mouse pointer over an entry in the menu list
mouseMoveOverList (ev->getPos(), ms);
@ -626,7 +611,7 @@ void FMenu::closeOpenedSubMenu()
opened_sub_menu->hideSubMenus();
opened_sub_menu->hide();
opened_sub_menu = 0;
opened_sub_menu = nullptr;
}
//----------------------------------------------------------------------
@ -637,7 +622,7 @@ void FMenu::hideSubMenus()
{
opened_sub_menu->hideSubMenus();
opened_sub_menu->hide();
opened_sub_menu = 0;
opened_sub_menu = nullptr;
}
unselectItem();
@ -1293,7 +1278,7 @@ inline void FMenu::drawSeparator (int y)
{
print (fc::NF_border_line_vertical_right);
FString line ( std::size_t(getWidth()) - 2
, wchar_t(fc::BoxDrawingsHorizontal) );
, fc::BoxDrawingsHorizontal );
print (line);
print (fc::NF_rev_border_line_vertical_left);
}
@ -1301,7 +1286,7 @@ inline void FMenu::drawSeparator (int y)
{
print (fc::BoxDrawingsVerticalAndRight);
FString line ( std::size_t(getWidth()) - 2
, wchar_t(fc::BoxDrawingsHorizontal));
, fc::BoxDrawingsHorizontal);
print (line);
print (fc::BoxDrawingsVerticalAndLeft);
}
@ -1462,9 +1447,9 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
if ( len > 0 )
{
// Print filling blank spaces
print (FString(len, wchar_t(' ')));
print (FString(len, L' '));
// Print BlackRightPointingPointer ►
print (wchar_t(fc::BlackRightPointingPointer));
print (fc::BlackRightPointingPointer);
startpos = max_item_width - (c + 2);
}
}
@ -1480,7 +1465,7 @@ inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
if ( len > 0 )
{
// Print filling blank spaces + accelerator key name
FString spaces (len, wchar_t(' '));
FString spaces (len, L' ');
print (spaces + accel_name);
startpos = max_item_width - (c + 2);
}

View File

@ -37,10 +37,6 @@ namespace finalcut
//----------------------------------------------------------------------
FMenuBar::FMenuBar(FWidget* parent)
: FWindow(parent)
, mouse_down(false)
, drop_down(false)
, focus_changed(false)
, screenWidth(80)
{
init();
}

View File

@ -39,19 +39,6 @@ namespace finalcut
//----------------------------------------------------------------------
FMenuItem::FMenuItem (FWidget* parent)
: FWidget(parent)
, text()
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(0)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
@ -60,18 +47,6 @@ FMenuItem::FMenuItem (FWidget* parent)
FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(0)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
@ -80,18 +55,7 @@ FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(k)
, menu(0)
, super_menu(0)
, associated_window(0)
{
init (parent);
}
@ -288,23 +252,20 @@ void FMenuItem::delAccelerator (FWidget* obj)
//----------------------------------------------------------------------
void FMenuItem::openMenu()
{
FMenu* dd_menu; // Drop-down menu
FMenu* open_menu;
if ( ! hasMenu() )
return;
dd_menu = getMenu(); // Drop-down menu
FMenu* dd_menu = getMenu(); // Drop-down menu
if ( dd_menu->isVisible() )
return;
open_menu = static_cast<FMenu*>(getOpenMenu());
FMenu* openmenu = static_cast<FMenu*>(getOpenMenu());
if ( open_menu && open_menu != dd_menu )
if ( openmenu && openmenu != dd_menu )
{
open_menu->hide();
open_menu->hideSubMenus();
openmenu->hide();
openmenu->hideSubMenus();
}
if ( dialog_index )
@ -498,7 +459,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
else
{
unsetSelected();
mbar->selected_item = 0;
mbar->selected_item = nullptr;
mbar->redraw();
processClicked();
mbar->drop_down = false;
@ -575,7 +536,7 @@ FMenuList* FMenuItem::getFMenuList (FWidget& widget)
menu_list = static_cast<FMenuList*>(Menubar);
}
else
menu_list = 0;
menu_list = nullptr;
return menu_list;
}
@ -774,8 +735,8 @@ void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
if ( win )
{
FWidget* focus_widget = getFocusWidget();
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
FWidget* focus = getFocusWidget();
FAccelEvent a_ev (fc::Accelerator_Event, focus);
FApplication::sendEvent (win, &a_ev);
}
}
@ -790,7 +751,7 @@ void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
{
delAccelerator(win);
delCallback(win);
associated_window = 0;
associated_window = nullptr;
}
}

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2015-2017 Markus Gans *
* Copyright 2015-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -32,12 +32,6 @@ namespace finalcut
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
FMenuList::FMenuList()
: selected_item()
, item_list()
{ }
//----------------------------------------------------------------------
FMenuList::~FMenuList() // destructor
{

View File

@ -49,17 +49,6 @@ static const char* const button_text[] =
//----------------------------------------------------------------------
FMessageBox::FMessageBox (FWidget* parent)
: FDialog(parent)
, headline_text()
, text()
, text_components(0)
, text_split()
, max_line_width(0)
, center_text(false)
, emphasis_color(wc.dialog_emphasis_fg)
, num_buttons(0)
, text_num_lines(0)
, button_digit()
, button()
{
setTitlebarText("Message for you");
init(FMessageBox::Ok, 0, 0);
@ -77,8 +66,6 @@ FMessageBox::FMessageBox (const FMessageBox& mbox)
, emphasis_color(mbox.emphasis_color)
, num_buttons(mbox.num_buttons)
, text_num_lines(mbox.text_num_lines)
, button_digit()
, button()
{
setTitlebarText (mbox.getTitlebarText());
init ( mbox.button_digit[0]
@ -94,17 +81,7 @@ FMessageBox::FMessageBox ( const FString& caption
, int button2
, FWidget* parent )
: FDialog(parent)
, headline_text()
, text(message)
, text_components(0)
, text_split()
, max_line_width(0)
, center_text(false)
, emphasis_color(wc.dialog_emphasis_fg)
, num_buttons(0)
, text_num_lines(0)
, button_digit()
, button()
{
setTitlebarText(caption);
init(button0, button1, button2);
@ -305,8 +282,8 @@ void FMessageBox::adjustSize()
//----------------------------------------------------------------------
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
{
FDialog::DialogCode* reply = static_cast<FDialog::DialogCode*>(data);
done (*reply);
int reply = *(static_cast<int*>(data));
done (reply);
}
@ -426,15 +403,18 @@ void FMessageBox::calculateDimensions()
std::size_t w, h;
std::size_t headline_height = 0;
text_split = text.split("\n");
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
max_line_width = 0;
text_num_lines = uInt(text_split.size());
if ( text_num_lines == 0 )
return;
if ( ! headline_text.isNull() )
headline_height = 2;
for (uInt i = 0; i < text_num_lines; i++)
{
text_components = &text_split[0];
std::size_t len = text_components[i].getLength();
if ( len > max_line_width )

View File

@ -40,16 +40,6 @@ namespace finalcut
// constructors and destructor
//----------------------------------------------------------------------
FMouse::FMouse()
: b_state()
, mouse_event_occurred(false)
, input_data_pending(false)
, dblclick_interval(500000) // 500 ms
, max_width(80)
, max_height(25)
, time_mousepressed()
, zero_point(0, 0) // zero point (x=0, y=0)
, mouse(0, 0) // mouse click position
, new_mouse_position()
{
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
@ -237,10 +227,6 @@ bool FMouse::isDblclickTimeout (timeval* time)
//----------------------------------------------------------------------
FMouseGPM::FMouseGPM()
: FMouse()
, gpm_ev()
, has_gpm_mouse_data(false)
, gpm_mouse_enabled(false)
, stdin_no(0)
{
gpm_ev.x = -1;
}
@ -283,6 +269,14 @@ void FMouseGPM::processEvent (struct timeval*)
{
Gpm_FitEvent (&gpm_ev);
if ( ! hasSignificantEvents() )
{
GPM_DRAWPOINTER(&gpm_ev);
has_gpm_mouse_data = false;
mouse_event_occurred = false;
return;
}
if ( gpm_ev.type & GPM_DRAG && gpm_ev.wdx == 0 && gpm_ev.wdy == 0 )
b_state.mouse_moved = true;
@ -295,6 +289,84 @@ void FMouseGPM::processEvent (struct timeval*)
{
case GPM_DOWN:
case GPM_DRAG:
interpretKeyDown();
break;
case GPM_UP:
interpretKeyUp();
default:
break;
}
setPos (FPoint( std::max(gpm_ev.x, sInt16(1))
, std::max(gpm_ev.y, sInt16(1)) ));
if ( gpmEvent(false) == mouse_event )
input_data_pending = true;
else
input_data_pending = false;
GPM_DRAWPOINTER(&gpm_ev);
has_gpm_mouse_data = false;
mouse_event_occurred = true;
return;
}
else
gpm_fd = -1;
has_gpm_mouse_data = false;
mouse_event_occurred = false;
}
//----------------------------------------------------------------------
bool FMouseGPM::gpmMouse (bool on)
{
// activate/deactivate the gpm mouse support
if ( on )
{
Gpm_Connect conn;
conn.eventMask = uInt16(~0); // Get all including wheel event
conn.defaultMask = GPM_MOVE;
conn.maxMod = uInt16(~0);
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;
}
}
else
{
Gpm_Close();
}
gpm_mouse_enabled = on;
return on;
}
//----------------------------------------------------------------------
bool FMouseGPM::hasSignificantEvents()
{
return ! (gpm_ev.type & GPM_MOVE)
|| gpm_ev.wdy != 0
|| gpm_ev.buttons & GPM_B_UP
|| gpm_ev.buttons & GPM_B_DOWN;
}
//----------------------------------------------------------------------
void FMouseGPM::interpretKeyDown()
{
if ( gpm_ev.buttons & GPM_B_LEFT )
{
if ( gpm_ev.type & GPM_DOUBLE )
@ -324,10 +396,11 @@ void FMouseGPM::processEvent (struct timeval*)
if ( gpm_ev.modifiers & (1 << KG_CTRL) )
b_state.control_button = true;
}
break;
case GPM_UP:
//----------------------------------------------------------------------
void FMouseGPM::interpretKeyUp()
{
if ( gpm_ev.buttons & GPM_B_LEFT )
b_state.left_button = Released;
@ -336,61 +409,6 @@ void FMouseGPM::processEvent (struct timeval*)
if ( gpm_ev.buttons & GPM_B_RIGHT )
b_state.right_button = Released;
default:
break;
}
setPos (FPoint(gpm_ev.x, gpm_ev.y));
if ( gpmEvent(false) == mouse_event )
input_data_pending = true;
else
input_data_pending = false;
GPM_DRAWPOINTER(&gpm_ev);
has_gpm_mouse_data = false;
mouse_event_occurred = true;
return;
}
has_gpm_mouse_data = false;
mouse_event_occurred = false;
}
//----------------------------------------------------------------------
bool FMouseGPM::gpmMouse (bool on)
{
// activate/deactivate the gpm mouse support
if ( on )
{
Gpm_Connect conn;
conn.eventMask = uInt16(~GPM_MOVE);
conn.defaultMask = GPM_MOVE;
conn.maxMod = uInt16(~0);
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;
}
}
else
{
Gpm_Close();
}
gpm_mouse_enabled = on;
return on;
}
//----------------------------------------------------------------------
@ -461,21 +479,6 @@ int FMouseGPM::gpmEvent (bool clear)
// class FMouseX11
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseX11::FMouseX11()
: FMouse()
, x11_mouse()
, x11_button_state(all_buttons_released)
{
x11_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseX11::~FMouseX11() // destructor
{ }
// public methods of FMouseX11
//----------------------------------------------------------------------
const char* FMouseX11::getClassName() const
@ -663,21 +666,6 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
// class FMouseSGR
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseSGR::FMouseSGR()
: FMouse()
, sgr_mouse()
, sgr_button_state(0x23)
{
sgr_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseSGR::~FMouseSGR() // destructor
{ }
// public methods of FMouseSGR
//----------------------------------------------------------------------
const char* FMouseSGR::getClassName() const
@ -917,21 +905,6 @@ void FMouseSGR::setReleasedButtonState (int btn)
// class FMouseUrxvt
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseUrxvt::FMouseUrxvt()
: FMouse()
, urxvt_mouse()
, urxvt_button_state(0x23)
{
urxvt_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseUrxvt::~FMouseUrxvt() // destructor
{ }
// public methods of FMouseUrxvt
//----------------------------------------------------------------------
const char* FMouseUrxvt::getClassName() const
@ -1198,11 +1171,6 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
// constructors and destructor
//----------------------------------------------------------------------
FMouseControl::FMouseControl()
: mouse_protocol()
, iter()
, zero_point(0, 0)
, use_gpm_mouse(false)
, use_xterm_mouse(false)
{
#ifdef F_HAVE_LIBGPM
mouse_protocol[FMouse::gpm] = FMouse::createMouseObject(FMouse::gpm);
@ -1484,21 +1452,26 @@ bool FMouseControl::isInputDataPending()
}
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
bool FMouseControl::isGpmMouseEnabled()
{
if ( mouse_protocol.empty() )
return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
return gpm_mouse->isGpmMouseEnabled();
#endif // F_HAVE_LIBGPM
return false;
}
#else // F_HAVE_LIBGPM
bool FMouseControl::isGpmMouseEnabled()
{
return false;
}
#endif // F_HAVE_LIBGPM
//----------------------------------------------------------------------
void FMouseControl::enable()
@ -1559,43 +1532,43 @@ void FMouseControl::processEvent (struct timeval* time)
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
bool FMouseControl::getGpmKeyPressed (bool pending)
#else
bool FMouseControl::getGpmKeyPressed (bool)
#endif // F_HAVE_LIBGPM
{
if ( mouse_protocol.empty() )
return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
return gpm_mouse->getGpmKeyPressed(pending);
#endif // F_HAVE_LIBGPM
return false;
}
#else // F_HAVE_LIBGPM
bool FMouseControl::getGpmKeyPressed (bool)
{
return false;
}
#endif // F_HAVE_LIBGPM
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
void FMouseControl::drawGpmPointer()
{
if ( mouse_protocol.empty() )
return;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
gpm_mouse->drawGpmPointer();
#endif // F_HAVE_LIBGPM
}
#else // F_HAVE_LIBGPM
void FMouseControl::drawGpmPointer()
{ }
#endif // F_HAVE_LIBGPM
// private methods of FMouseControl

View File

@ -27,8 +27,8 @@ namespace finalcut
// static class attributes
bool FObject::timer_modify_lock;
FObject::TimerList* FObject::timer_list = 0;
const FString* fc::emptyFString::empty_string = 0;
FObject::TimerList* FObject::timer_list = nullptr;
const FString* fc::emptyFString::empty_string = nullptr;
//----------------------------------------------------------------------
// class FObject
@ -37,10 +37,7 @@ const FString* fc::emptyFString::empty_string = 0;
// constructors and destructor
//----------------------------------------------------------------------
FObject::FObject (FObject* parent)
: widget_object(false)
, parent_obj(parent)
, children_list() // no children yet
, has_parent(false)
: parent_obj(parent)
{
if ( parent ) // add object to parent
{
@ -74,7 +71,7 @@ FObject::~FObject() // destructor
if ( ! has_parent && timer_list )
{
delete timer_list;
timer_list = 0;
timer_list = nullptr;
}
if ( ! has_parent && ! fc::emptyFString::isNull() )
@ -83,22 +80,16 @@ FObject::~FObject() // destructor
// Delete children objects
if ( hasChildren() )
{
constFObjectIterator iter, last;
FObjectList delete_list = children_list;
iter = delete_list.begin();
last = delete_list.end();
auto delete_list = children_list;
while ( iter != last )
{
delete *iter;
++iter;
}
for (auto&& obj : delete_list)
delete obj;
}
if ( parent_obj )
parent_obj->delChild(this);
parent_obj = 0;
parent_obj = nullptr;
}
// public methods of FObject
@ -113,8 +104,7 @@ FObject* FObject::getChild (int index) const
if ( index <= 0 || index > numOfChildren() )
return 0;
constFObjectIterator iter;
iter = begin();
auto iter = begin();
std::advance (iter, index - 1);
return *iter;
}
@ -124,7 +114,7 @@ bool FObject::isChild (FObject* obj) const
{
// Find out if obj is a child object of mine
FObject* p_obj = 0;
FObject* p_obj = nullptr;
while ( obj && (p_obj = obj->getParent()) )
{
@ -172,7 +162,7 @@ void FObject::delChild (FObject* obj)
if ( hasChildren() )
{
obj->parent_obj = 0;
obj->parent_obj = nullptr;
obj->has_parent = false;
children_list.remove(obj);
}
@ -236,7 +226,6 @@ int FObject::addTimer (int interval)
// Create a timer and returns the timer identifier number
// (interval in ms)
FObject::TimerList::iterator iter, last;
timeval time_interval;
timeval currentTime;
int id = 1;
@ -245,8 +234,8 @@ int FObject::addTimer (int interval)
// find an unused timer id
if ( ! timer_list->empty() )
{
iter = timer_list->begin();
last = timer_list->end();
auto iter = timer_list->begin();
auto last = timer_list->end();
while ( iter != last )
{
@ -270,8 +259,8 @@ int FObject::addTimer (int interval)
timer_data t = { id, time_interval, timeout, this };
// insert in list sorted by timeout
iter = timer_list->begin();
last = timer_list->end();
auto iter = timer_list->begin();
auto last = timer_list->end();
while ( iter != last && iter->timeout < t.timeout )
++iter;
@ -287,14 +276,12 @@ bool FObject::delTimer (int id)
{
// Deletes a timer by using the timer identifier number
FObject::TimerList::iterator iter, last;
if ( id <= 0 )
return false;
timer_modify_lock = true;
iter = timer_list->begin();
last = timer_list->end();
auto iter = timer_list->begin();
auto last = timer_list->end();
while ( iter != last && iter->id != id )
++iter;
@ -315,8 +302,6 @@ bool FObject::delOwnTimer()
{
// Deletes all timers of this object
FObject::TimerList::iterator iter;
if ( ! timer_list )
return false;
@ -324,7 +309,7 @@ bool FObject::delOwnTimer()
return false;
timer_modify_lock = true;
iter = timer_list->begin();
auto iter = timer_list->begin();
while ( iter != timer_list->end() )
{
@ -378,7 +363,6 @@ void FObject::onTimer (FTimerEvent*)
//----------------------------------------------------------------------
uInt FObject::processTimerEvent()
{
FObject::TimerList::iterator iter, last;
timeval currentTime;
uInt activated = 0;
@ -393,27 +377,23 @@ uInt FObject::processTimerEvent()
if ( timer_list->empty() )
return 0;
iter = timer_list->begin();
last = timer_list->end();
while ( iter != last )
for (auto&& timer : *timer_list)
{
if ( ! iter->id
|| ! iter->object
|| currentTime < iter->timeout ) // no timer expired
if ( ! timer.id
|| ! timer.object
|| currentTime < timer.timeout ) // no timer expired
break;
iter->timeout += iter->interval;
timer.timeout += timer.interval;
if ( iter->timeout < currentTime )
iter->timeout = currentTime + iter->interval;
if ( timer.timeout < currentTime )
timer.timeout = currentTime + timer.interval;
if ( iter->interval.tv_usec > 0 || iter->interval.tv_sec > 0 )
if ( timer.interval.tv_usec > 0 || timer.interval.tv_sec > 0 )
activated++;
FTimerEvent t_ev(fc::Timer_Event, iter->id);
performTimerAction (iter->object, &t_ev);
++iter;
FTimerEvent t_ev(fc::Timer_Event, timer.id);
performTimerAction (timer.object, &t_ev);
}
return activated;

View File

@ -34,57 +34,7 @@ namespace finalcut
// constructors and destructor
//----------------------------------------------------------------------
FOptiAttr::FOptiAttr()
: F_enter_bold_mode()
, F_exit_bold_mode()
, F_enter_dim_mode()
, F_exit_dim_mode()
, F_enter_italics_mode()
, F_exit_italics_mode()
, F_enter_underline_mode()
, F_exit_underline_mode()
, F_enter_blink_mode()
, F_exit_blink_mode()
, F_enter_reverse_mode()
, F_exit_reverse_mode()
, F_enter_standout_mode()
, F_exit_standout_mode()
, F_enter_secure_mode()
, F_exit_secure_mode()
, F_enter_protected_mode()
, F_exit_protected_mode()
, F_enter_crossed_out_mode()
, F_exit_crossed_out_mode()
, F_enter_dbl_underline_mode()
, F_exit_dbl_underline_mode()
, F_set_attributes()
, F_exit_attribute_mode()
, F_enter_alt_charset_mode()
, F_exit_alt_charset_mode()
, F_enter_pc_charset_mode()
, F_exit_pc_charset_mode()
, F_set_a_foreground()
, F_set_a_background()
, F_set_foreground()
, F_set_background()
, F_set_color_pair()
, F_orig_pair()
, F_orig_colors()
, on()
, off()
, reset_byte_mask()
, max_color(1)
, attr_without_color(0)
, ansi_default_color(false)
, alt_equal_pc_charset(false)
, monochron(true)
, fake_reverse(false)
, attr_ptr(attr_buf)
{
attr_buf[0] = '\0';
// Set to 0 to reset
reset_byte_mask.attr.byte[0] = 0;
reset_byte_mask.attr.byte[1] = 0;
reset_byte_mask.attr.byte[2] = 0;
// Set bits that must not be reset
reset_byte_mask.attr.bit.transparent = true;
reset_byte_mask.attr.bit.trans_shadow = true;

View File

@ -35,40 +35,10 @@ namespace finalcut
// constructors and destructor
//----------------------------------------------------------------------
FOptiMove::FOptiMove (int baud)
: F_cursor_home()
, F_carriage_return()
, F_cursor_to_ll()
, F_tab()
, F_back_tab()
, F_cursor_up()
, F_cursor_down()
, F_cursor_left()
, F_cursor_right()
, F_cursor_address()
, F_column_address()
, F_row_address()
, F_parm_up_cursor()
, F_parm_down_cursor()
, F_parm_left_cursor()
, F_parm_right_cursor()
, F_erase_chars()
, F_repeat_char()
, F_clr_bol()
, F_clr_eol()
, automatic_left_margin(false)
, eat_nl_glitch(false)
, move_buf()
, char_duration(1)
, baudrate(baud)
, tabstop(0)
, screen_width(80)
, screen_height(24)
: baudrate(baud)
{
assert ( baud >= 0 );
// Initialize arrays with '\0'
std::fill_n (move_buf, sizeof(move_buf), '\0');
calculateCharDuration();
// ANSI set cursor address preset for undefined terminals
@ -151,7 +121,7 @@ void FOptiMove::set_cursor_home (char cap[])
}
else
{
F_cursor_home.cap = 0;
F_cursor_home.cap = nullptr;
F_cursor_home.duration = \
F_cursor_home.length = LONG_DURATION;
}
@ -168,7 +138,7 @@ void FOptiMove::set_cursor_to_ll (char cap[])
}
else
{
F_cursor_to_ll.cap = 0;
F_cursor_to_ll.cap = nullptr;
F_cursor_to_ll.duration = \
F_cursor_to_ll.length = LONG_DURATION;
}
@ -185,7 +155,7 @@ void FOptiMove::set_carriage_return (char cap[])
}
else
{
F_carriage_return.cap = 0;
F_carriage_return.cap = nullptr;
F_carriage_return.duration = \
F_carriage_return.length = LONG_DURATION;
}
@ -202,7 +172,7 @@ void FOptiMove::set_tabular (char cap[])
}
else
{
F_tab.cap = 0;
F_tab.cap = nullptr;
F_tab.duration = \
F_tab.length = LONG_DURATION;
}
@ -219,7 +189,7 @@ void FOptiMove::set_back_tab (char cap[])
}
else
{
F_back_tab.cap = 0;
F_back_tab.cap = nullptr;
F_back_tab.duration = \
F_back_tab.length = LONG_DURATION;
}
@ -236,7 +206,7 @@ void FOptiMove::set_cursor_up (char cap[])
}
else
{
F_cursor_up.cap = 0;
F_cursor_up.cap = nullptr;
F_cursor_up.duration = \
F_cursor_up.length = LONG_DURATION;
}
@ -253,7 +223,7 @@ void FOptiMove::set_cursor_down (char cap[])
}
else
{
F_cursor_down.cap = 0;
F_cursor_down.cap = nullptr;
F_cursor_down.duration = \
F_cursor_down.length = LONG_DURATION;
}
@ -270,7 +240,7 @@ void FOptiMove::set_cursor_left (char cap[])
}
else
{
F_cursor_left.cap = 0;
F_cursor_left.cap = nullptr;
F_cursor_left.duration = \
F_cursor_left.length = LONG_DURATION;
}
@ -287,7 +257,7 @@ void FOptiMove::set_cursor_right (char cap[])
}
else
{
F_cursor_right.cap = 0;
F_cursor_right.cap = nullptr;
F_cursor_right.duration = \
F_cursor_right.length = LONG_DURATION;
}
@ -305,7 +275,7 @@ void FOptiMove::set_cursor_address (char cap[])
}
else
{
F_cursor_address.cap = 0;
F_cursor_address.cap = nullptr;
F_cursor_address.duration = \
F_cursor_address.length = LONG_DURATION;
}
@ -323,7 +293,7 @@ void FOptiMove::set_column_address (char cap[])
}
else
{
F_column_address.cap = 0;
F_column_address.cap = nullptr;
F_column_address.duration = \
F_column_address.length = LONG_DURATION;
}
@ -341,7 +311,7 @@ void FOptiMove::set_row_address (char cap[])
}
else
{
F_row_address.cap = 0;
F_row_address.cap = nullptr;
F_row_address.duration = \
F_row_address.length = LONG_DURATION;
}
@ -359,7 +329,7 @@ void FOptiMove::set_parm_up_cursor (char cap[])
}
else
{
F_parm_up_cursor.cap = 0;
F_parm_up_cursor.cap = nullptr;
F_parm_up_cursor.duration = \
F_parm_up_cursor.length = LONG_DURATION;
}
@ -377,7 +347,7 @@ void FOptiMove::set_parm_down_cursor (char cap[])
}
else
{
F_parm_down_cursor.cap = 0;
F_parm_down_cursor.cap = nullptr;
F_parm_down_cursor.duration = \
F_parm_down_cursor.length = LONG_DURATION;
}
@ -395,7 +365,7 @@ void FOptiMove::set_parm_left_cursor (char cap[])
}
else
{
F_parm_left_cursor.cap = 0;
F_parm_left_cursor.cap = nullptr;
F_parm_left_cursor.duration = \
F_parm_left_cursor.length = LONG_DURATION;
}
@ -413,7 +383,7 @@ void FOptiMove::set_parm_right_cursor (char cap[])
}
else
{
F_parm_right_cursor.cap = 0;
F_parm_right_cursor.cap = nullptr;
F_parm_right_cursor.duration = \
F_parm_right_cursor.length = LONG_DURATION;
}
@ -431,7 +401,7 @@ void FOptiMove::set_erase_chars (char cap[])
}
else
{
F_erase_chars.cap = 0;
F_erase_chars.cap = nullptr;
F_erase_chars.duration = \
F_erase_chars.length = LONG_DURATION;
}
@ -449,7 +419,7 @@ void FOptiMove::set_repeat_char (char cap[])
}
else
{
F_repeat_char.cap = 0;
F_repeat_char.cap = nullptr;
F_repeat_char.duration = \
F_repeat_char.length = LONG_DURATION;
}
@ -466,7 +436,7 @@ void FOptiMove::set_clr_bol (char cap[])
}
else
{
F_clr_bol.cap = 0;
F_clr_bol.cap = nullptr;
F_clr_bol.duration = \
F_clr_bol.length = LONG_DURATION;
}
@ -483,7 +453,7 @@ void FOptiMove::set_clr_eol (char cap[])
}
else
{
F_clr_eol.cap = 0;
F_clr_eol.cap = nullptr;
F_clr_eol.duration = \
F_clr_eol.length = LONG_DURATION;
}
@ -818,7 +788,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
{
std::strncpy ( hmove
, tparm(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE );
, BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_right_cursor.duration;
}
@ -938,7 +908,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
if ( move_xy )
{
char* move_ptr = move_buf;
std::strncpy (move_ptr, move_xy, BUF_SIZE);
std::strncpy (move_ptr, move_xy, BUF_SIZE - 1);
move_ptr[BUF_SIZE - 1] = '\0';
move_time = F_cursor_address.duration;
return true;

View File

@ -33,8 +33,6 @@ namespace finalcut
//----------------------------------------------------------------------
FProgressbar::FProgressbar(FWidget* parent)
: FWidget(parent)
, percentage(NOT_SET)
, bar_length(getWidth())
{
unsetFocusable();
setShadow();

View File

@ -35,24 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FScrollbar::FScrollbar(FWidget* parent)
: FWidget(parent)
, scroll_type(FScrollbar::noScroll)
, threshold_reached(false)
, threshold_time(500)
, repeat_time(10)
, slider_click_pos(-1)
, slider_click_stop_pos(-1)
, current_slider_pos(-1)
, slider_pos(0)
, slider_length(18) // = bar_length
, bar_length(18) // = length - 2
, val(0)
, min(0)
, max(99)
, steps(1)
, pagesize(0)
, length(20)
, bar_orientation(fc::vertical)
, max_color(getMaxColor())
{
// The default scrollbar orientation is vertical
setGeometry(1, 1, 1, length, false);
@ -62,24 +44,6 @@ FScrollbar::FScrollbar(FWidget* parent)
//----------------------------------------------------------------------
FScrollbar::FScrollbar(int o, FWidget* parent)
: FWidget(parent)
, scroll_type(FScrollbar::noScroll)
, threshold_reached(false)
, threshold_time(500)
, repeat_time(10)
, slider_click_pos(-1)
, slider_click_stop_pos(-1)
, current_slider_pos(-1)
, slider_pos(0)
, slider_length(18) // = bar_length
, bar_length(18) // = length - 2
, val(0)
, min(0)
, max(99)
, steps(1)
, pagesize(0)
, length(20)
, bar_orientation(fc::vertical)
, max_color(getMaxColor())
{
setOrientation (o);
init();
@ -118,15 +82,21 @@ void FScrollbar::setRange (int minimum, int maximum)
//----------------------------------------------------------------------
void FScrollbar::setValue (int value)
{
if ( value < min )
val = min;
else if ( value > max )
val = max;
else
val = value;
calculateSliderValues();
}
//----------------------------------------------------------------------
void FScrollbar::setSteps (double st)
{
if ( st <= 0 )
steps = 1;
if ( st <= 0.0 )
steps = 1.0;
else
steps = st;
@ -145,6 +115,10 @@ void FScrollbar::setPageSize (int document_size, int page_size)
else
{
pagesize = page_size;
if ( document_size <= 0 || page_size <= 0 )
steps = 1.0;
else
steps = double(double(document_size) / double(page_size));
}
}
@ -221,9 +195,9 @@ void FScrollbar::redraw()
void FScrollbar::calculateSliderValues()
{
if ( isNewFont() && bar_orientation == fc::horizontal )
bar_length = length - 4;
bar_length = ( length > 2 ) ? length - 4 : 1;
else
bar_length = length - 2;
bar_length = ( length > 2 ) ? length - 2 : 1;
slider_length = std::size_t(double(bar_length) / steps);
@ -244,13 +218,15 @@ void FScrollbar::calculateSliderValues()
return;
}
std::size_t v = std::size_t(val);
std::size_t v = ( min < 0 ) ? std::size_t(val - min) : std::size_t(val);
if ( slider_length >= bar_length )
slider_pos = 0;
else
slider_pos = int( round ( double((bar_length - slider_length) * v)
/ double(max - min) ) );
if ( slider_pos < 0 )
slider_pos = 0;
else if ( slider_pos > int(bar_length - slider_length) )
if ( slider_pos > int(bar_length - slider_length) )
slider_pos = int(bar_length - slider_length);
}

View File

@ -35,17 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FScrollView::FScrollView (FWidget* parent)
: FWidget(parent)
, scroll_geometry(1, 1, 1, 1)
, viewport_geometry()
, viewport(0)
, vbar(0)
, hbar(0)
, nf_offset(0)
, border(true)
, use_own_print_area(false)
, update_scrollbar(true)
, vMode(fc::Auto)
, hMode(fc::Auto)
{
init(parent);
}
@ -56,7 +45,7 @@ FScrollView::~FScrollView() // destructor
delete vbar;
delete hbar;
removeArea (viewport);
child_print_area = viewport = 0;
child_print_area = viewport = nullptr;
}
@ -541,12 +530,12 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
FRect widget_geometry;
FRect vp_geometry;
FWidget* focus_widget = FWidget::getFocusWidget();
FWidget* focus = FWidget::getFocusWidget();
if ( ! focus_widget )
if ( ! focus )
return;
widget_geometry = focus_widget->getGeometryWithShadow();
widget_geometry = focus->getGeometryWithShadow();
vp_geometry = viewport_geometry;
vp_geometry.move(1, 1);
@ -578,13 +567,13 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
{
// Change the focus away from FScrollView to another widget
FWidget* focus_widget = FWidget::getFocusWidget();
FWidget* focus = FWidget::getFocusWidget();
if ( out_ev->getFocusType() == fc::FocusNextWidget )
{
FWidget* last_widget = getLastFocusableWidget(getChildren());
if ( focus_widget == last_widget )
if ( focus == last_widget )
{
out_ev->accept();
focusNextChild();
@ -594,7 +583,7 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
{
FWidget* first_widget = getFirstFocusableWidget(getChildren());
if ( focus_widget == first_widget )
if ( focus == first_widget )
{
out_ev->accept();
focusPrevChild();
@ -611,7 +600,7 @@ FVTerm::term_area* FScrollView::getPrintArea()
if ( use_own_print_area || ! viewport )
{
child_print_area = 0;
child_print_area = nullptr;
term_area* area = FWidget::getPrintArea();
child_print_area = viewport;
return area;
@ -995,7 +984,7 @@ void FScrollView::cb_HBarChange (FWidget*, data_ptr)
//----------------------------------------------------------------------
inline void FScrollView::redrawHBar()
{
child_print_area = 0;
child_print_area = nullptr;
if ( hbar->isVisible() )
hbar->redraw();
@ -1006,7 +995,7 @@ inline void FScrollView::redrawHBar()
//----------------------------------------------------------------------
inline void FScrollView::redrawVBar()
{
child_print_area = 0;
child_print_area = nullptr;
if ( vbar->isVisible() )
vbar->redraw();
@ -1017,7 +1006,7 @@ inline void FScrollView::redrawVBar()
//----------------------------------------------------------------------
inline void FScrollView::drawHBar()
{
child_print_area = 0;
child_print_area = nullptr;
if ( hbar->isVisible() )
hbar->drawBar();
@ -1028,7 +1017,7 @@ inline void FScrollView::drawHBar()
//----------------------------------------------------------------------
inline void FScrollView::drawVBar()
{
child_print_area = 0;
child_print_area = nullptr;
if ( vbar->isVisible() )
vbar->drawBar();

View File

@ -35,11 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FStatusKey::FStatusKey(FWidget* parent)
: FWidget(parent)
, key(0)
, text()
, active(false)
, mouse_focus(false)
, bar(0)
{
init (parent);
}
@ -49,9 +44,6 @@ FStatusKey::FStatusKey (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
init (parent);
}
@ -133,13 +125,6 @@ void FStatusKey::processActivate()
//----------------------------------------------------------------------
FStatusBar::FStatusBar(FWidget* parent)
: FWindow(parent)
, key_list()
, text("")
, mouse_down()
, screenWidth(80)
, keyname_len(0)
, x(-1)
, x_msg(-1)
{
init();
}

View File

@ -33,20 +33,8 @@ namespace finalcut
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FString::FString()
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{ }
//----------------------------------------------------------------------
FString::FString (int len)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( len > 0 )
initLength(std::size_t(len));
@ -56,20 +44,12 @@ FString::FString (int len)
//----------------------------------------------------------------------
FString::FString (std::size_t len)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
initLength(len);
}
//----------------------------------------------------------------------
FString::FString (std::size_t len, wchar_t c)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
wchar_t* ps;
wchar_t* pe;
@ -82,30 +62,8 @@ FString::FString (std::size_t len, wchar_t c)
*--pe = c;
}
//----------------------------------------------------------------------
FString::FString (std::size_t len, char c)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
wchar_t* ps;
wchar_t* pe;
initLength(len);
ps = string;
pe = string + len;
while ( pe != ps )
*--pe = wchar_t(c);
}
//----------------------------------------------------------------------
FString::FString (const FString& s) // copy constructor
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( ! s.isNull() )
_assign (s.string);
@ -113,10 +71,6 @@ FString::FString (const FString& s) // copy constructor
//----------------------------------------------------------------------
FString::FString (const std::wstring& s)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( ! s.empty() )
_assign (s.c_str());
@ -124,10 +78,6 @@ FString::FString (const std::wstring& s)
//----------------------------------------------------------------------
FString::FString (const wchar_t s[])
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( s )
_assign (s);
@ -135,10 +85,6 @@ FString::FString (const wchar_t s[])
//----------------------------------------------------------------------
FString::FString (const std::string& s)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( ! s.empty() )
{
@ -150,10 +96,6 @@ FString::FString (const std::string& s)
//----------------------------------------------------------------------
FString::FString (const char s[])
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( s )
{
@ -163,12 +105,20 @@ FString::FString (const char s[])
}
}
//----------------------------------------------------------------------
FString::FString (fc::SpecialCharacter c)
{
if ( c )
{
wchar_t s[2];
s[0] = static_cast<wchar_t>(c);
s[1] = L'\0';
_assign (s);
}
}
//----------------------------------------------------------------------
FString::FString (const wchar_t c)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( c )
{
@ -181,10 +131,6 @@ FString::FString (const wchar_t c)
//----------------------------------------------------------------------
FString::FString (const char c)
: string(0)
, length(0)
, bufsize(0)
, c_string(0)
{
if ( c )
{
@ -259,6 +205,14 @@ FString& FString::operator << (const FString& s)
return *this;
}
//----------------------------------------------------------------------
FString& FString::operator << (fc::SpecialCharacter c)
{
FString s(static_cast<wchar_t>(c));
_insert (length, s.length, s.string);
return *this;
}
//----------------------------------------------------------------------
FString& FString::operator << (const wchar_t c)
{
@ -494,7 +448,7 @@ FString FString::clear()
length = 0;
bufsize = 0;
string = 0;
string = nullptr;
return *this;
}
@ -922,7 +876,7 @@ FStringList FString::split (const FString& delimiter)
if ( ! (string && *string) )
return string_list;
rest = 0;
rest = nullptr;
token = extractToken(&rest, s.string, delimiter.wc_str());
while ( token )
@ -1674,7 +1628,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
if ( mblength == -1 && errno != EILSEQ )
{
delete[](c_string);
c_string = 0;
c_string = nullptr;
return const_cast<char*>("");
}

View File

@ -33,8 +33,6 @@ namespace finalcut
//----------------------------------------------------------------------
FSwitch::FSwitch(FWidget* parent)
: FToggleButton(parent)
, switch_offset_pos(0)
, button_pressed(false)
{
button_width = 11;
}
@ -42,8 +40,6 @@ FSwitch::FSwitch(FWidget* parent)
//----------------------------------------------------------------------
FSwitch::FSwitch (const FString& txt, FWidget* parent)
: FToggleButton(txt, parent)
, switch_offset_pos(0)
, button_pressed(false)
{
switch_offset_pos = txt.getLength() + 1;
button_width = 11;

View File

@ -32,7 +32,7 @@ namespace finalcut
{
// global FTerm object
static FTerm* init_term_object = 0;
static FTerm* init_term_object = nullptr;
// global init state
static bool term_initialized = false;
@ -42,25 +42,25 @@ int (*FTerm::Fputchar)(int);
// static class attributes
FTerm::initializationValues FTerm::init_values;
FTermData* FTerm::data = 0;
FTermcap::tcap_map* FTerm::tcap = 0;
FOptiMove* FTerm::opti_move = 0;
FOptiAttr* FTerm::opti_attr = 0;
FTermDetection* FTerm::term_detection = 0;
FTermXTerminal* FTerm::xterm = 0;
FKeyboard* FTerm::keyboard = 0;
FMouseControl* FTerm::mouse = 0;
FTermData* FTerm::data = nullptr;
FTermcap::tcap_map* FTerm::tcap = nullptr;
FOptiMove* FTerm::opti_move = nullptr;
FOptiAttr* FTerm::opti_attr = nullptr;
FTermDetection* FTerm::term_detection = nullptr;
FTermXTerminal* FTerm::xterm = nullptr;
FKeyboard* FTerm::keyboard = nullptr;
FMouseControl* FTerm::mouse = nullptr;
#if defined(__linux__)
FTermLinux* FTerm::linux = 0;
FTermLinux* FTerm::linux = nullptr;
#elif defined(__FreeBSD__) || defined(__DragonFly__)
FTermFreeBSD* FTerm::freebsd = 0;
FTermFreeBSD* FTerm::freebsd = nullptr;
#elif defined(__NetBSD__) || defined(__OpenBSD__)
FTermOpenBSD* FTerm::openbsd = 0;
FTermOpenBSD* FTerm::openbsd = nullptr;
#endif
#if DEBUG
FTermDebugData* FTerm::debug_data = 0;
FTermDebugData* FTerm::debug_data = nullptr;
#endif
// function prototypes
@ -384,7 +384,7 @@ char* FTerm::cursorsVisibility (bool on)
{
// Hides or shows the input cursor on the terminal
char* visibility_str = 0;
char* visibility_str = nullptr;
if ( on == data->isCursorHidden() )
return 0;
@ -665,7 +665,7 @@ void FTerm::setEncoding (fc::encoding enc)
{
if ( enc == fc::VT100 || enc == fc::PC )
{
char* empty = 0;
char* empty = nullptr;
opti_move->set_tabular (empty);
}
else
@ -1407,7 +1407,7 @@ void FTerm::init_tab_quirks()
if ( enc == fc::VT100 || enc == fc::PC )
{
char* empty = 0;
char* empty = nullptr;
opti_move->set_tabular (empty);
}
}

View File

@ -30,19 +30,10 @@ namespace finalcut
//----------------------------------------------------------------------
// class FTermBuffer
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermBuffer::FTermBuffer()
: data()
{ }
//----------------------------------------------------------------------
FTermBuffer::~FTermBuffer() // destructor
{ }
// public methods of FTermBuffer
//----------------------------------------------------------------------
int FTermBuffer::writef (const FString format, ...)

View File

@ -40,23 +40,14 @@ bool FTermcap::no_utf8_acs_chars = false;
int FTermcap::max_color = 1;
int FTermcap::tabstop = 8;
int FTermcap::attr_without_color = 0;
FTermData* FTermcap::fterm_data = 0;
FTermDetection* FTermcap::term_detection = 0;
FTermData* FTermcap::fterm_data = nullptr;
FTermDetection* FTermcap::term_detection = nullptr;
//----------------------------------------------------------------------
// class FTermcap
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermcap::FTermcap()
{ }
//----------------------------------------------------------------------
FTermcap::~FTermcap() // destructor
{ }
/* Terminal capability data base
* -----------------------------
* Info under: man 5 terminfo

View File

@ -26,9 +26,9 @@ namespace finalcut
{
// static class attributes
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
FTermData* FTermcapQuirks::fterm_data = 0;
FTermDetection* FTermcapQuirks::term_detection = 0;
FTermcap::tcap_map* FTermcapQuirks::tcap = nullptr;
FTermData* FTermcapQuirks::fterm_data = nullptr;
FTermDetection* FTermcapQuirks::term_detection = nullptr;
//----------------------------------------------------------------------
@ -210,16 +210,16 @@ void FTermcapQuirks::linux()
TCAP(fc::t_exit_bold_mode) = C_STR(CSI "22m");
TCAP(fc::t_exit_blink_mode) = C_STR(CSI "25m");
TCAP(fc::t_exit_reverse_mode) = C_STR(CSI "27m");
TCAP(fc::t_exit_secure_mode) = 0;
TCAP(fc::t_exit_protected_mode) = 0;
TCAP(fc::t_exit_crossed_out_mode) = 0;
TCAP(fc::t_exit_secure_mode) = nullptr;
TCAP(fc::t_exit_protected_mode) = nullptr;
TCAP(fc::t_exit_crossed_out_mode) = nullptr;
TCAP(fc::t_orig_pair) = C_STR(CSI "39;49;25m");
// Avoid underline and dim mode
TCAP(fc::t_enter_dim_mode) = 0;
TCAP(fc::t_exit_dim_mode) = 0;
TCAP(fc::t_enter_underline_mode) = 0;
TCAP(fc::t_exit_underline_mode) = 0;
TCAP(fc::t_enter_dim_mode) = nullptr;
TCAP(fc::t_exit_dim_mode) = nullptr;
TCAP(fc::t_enter_underline_mode) = nullptr;
TCAP(fc::t_exit_underline_mode) = nullptr;
}
//----------------------------------------------------------------------

View File

@ -31,14 +31,14 @@ FTermDetection::terminalType FTermDetection::terminal_type = \
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
FTermDetection::colorEnv FTermDetection::color_env;
FTermDetection::secondaryDA FTermDetection::secondary_da;
FTermData* FTermDetection::fterm_data = 0;
FTermData* FTermDetection::fterm_data = nullptr;
char FTermDetection::termtype[256] = { };
char FTermDetection::ttytypename[256] = { };
bool FTermDetection::decscusr_support;
bool FTermDetection::terminal_detection;
bool FTermDetection::color256;
const FString* FTermDetection::answer_back = 0;
const FString* FTermDetection::sec_da = 0;
const FString* FTermDetection::answer_back = nullptr;
const FString* FTermDetection::sec_da = nullptr;
int FTermDetection::gnome_terminal_id;
#if DEBUG
@ -182,7 +182,7 @@ bool FTermDetection::getTTYtype()
{
char* name;
char* type;
type = name = 0; // 0 == not found
type = name = nullptr; // nullptr == not found
p = str;
while ( *p )
@ -311,7 +311,7 @@ void FTermDetection::detectTerminal()
{
// Terminal detection
char* new_termtype = 0;
char* new_termtype = nullptr;
if ( terminal_detection )
{
@ -359,7 +359,7 @@ void FTermDetection::detectTerminal()
//----------------------------------------------------------------------
char* FTermDetection::init_256colorTerminal()
{
char* new_termtype = 0;
char* new_termtype = nullptr;
if ( get256colorEnvString() )
color256 = true;
@ -422,7 +422,7 @@ bool FTermDetection::get256colorEnvString()
//----------------------------------------------------------------------
char* FTermDetection::termtype_256color_quirks()
{
char* new_termtype = 0;
char* new_termtype = nullptr;
if ( ! color256 )
return new_termtype;

View File

@ -39,15 +39,6 @@ namespace finalcut
// class FTermFreeBSD
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermFreeBSD::FTermFreeBSD()
{ }
//----------------------------------------------------------------------
FTermFreeBSD::~FTermFreeBSD() // destructor
{ }
// public methods of FTermFreeBSD
//----------------------------------------------------------------------
#if defined(__FreeBSD__) || defined(__DragonFly__)

View File

@ -51,7 +51,6 @@ FTermios::FTermios()
FTermios::~FTermios() // destructor
{ }
// public methods of FTermios
//----------------------------------------------------------------------
void FTermios::init()

View File

@ -44,7 +44,7 @@ namespace finalcut
bool FTermLinux::half_block_character = true;
bool FTermLinux::has_saved_palette = false;
FTermDetection* FTermLinux::term_detection = 0;
FTermDetection* FTermLinux::term_detection = nullptr;
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style;
FTermLinux::ColorMap FTermLinux::saved_color_map;
FTermLinux::ColorMap FTermLinux::cmap;
@ -57,10 +57,6 @@ namespace finalcut
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermLinux::FTermLinux()
{ }
//----------------------------------------------------------------------
FTermLinux::~FTermLinux() // destructor
{
@ -152,8 +148,8 @@ void FTermLinux::init()
{
// initialize Linux console
screen_unicode_map.entries = 0;
screen_font.data = 0;
screen_unicode_map.entries = nullptr;
screen_font.data = nullptr;
if ( FTerm::openConsole() == 0 )
{
@ -346,7 +342,7 @@ bool FTermLinux::loadOldFont (uInt char_map[][fc::NUM_OF_ENCODINGS])
, screen_font.height
, true );
delete[] screen_font.data;
screen_font.data = 0;
screen_font.data = nullptr;
if ( ret == 0 )
retval = true;
@ -357,7 +353,7 @@ bool FTermLinux::loadOldFont (uInt char_map[][fc::NUM_OF_ENCODINGS])
setUnicodeMap (&screen_unicode_map);
initCharMap(char_map);
delete[] screen_unicode_map.entries;
screen_unicode_map.entries = 0;
screen_unicode_map.entries = nullptr;
}
}
@ -573,7 +569,7 @@ bool FTermLinux::getUnicodeMap()
return false;
screen_unicode_map.entry_ct = 0;
screen_unicode_map.entries = 0;
screen_unicode_map.entries = nullptr;
// get count
ret = ioctl (fd_tty, GIO_UNIMAP, &screen_unicode_map);

View File

@ -36,15 +36,6 @@ namespace finalcut
// class FTermOpenBSD
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermOpenBSD::FTermOpenBSD()
{ }
//----------------------------------------------------------------------
FTermOpenBSD::~FTermOpenBSD() // destructor
{ }
// public methods of FTermOpenBSD
//----------------------------------------------------------------------
#if defined(__NetBSD__) || defined(__OpenBSD__)

View File

@ -33,16 +33,16 @@ bool FTermXTerminal::meta_sends_esc;
bool FTermXTerminal::xterm_default_colors;
std::size_t FTermXTerminal::term_width = 80;
std::size_t FTermXTerminal::term_height = 24;
const FString* FTermXTerminal::xterm_font = 0;
const FString* FTermXTerminal::xterm_title = 0;
const FString* FTermXTerminal::foreground_color = 0;
const FString* FTermXTerminal::background_color = 0;
const FString* FTermXTerminal::cursor_color = 0;
const FString* FTermXTerminal::mouse_foreground_color = 0;
const FString* FTermXTerminal::mouse_background_color = 0;
const FString* FTermXTerminal::highlight_background_color = 0;
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
FTermDetection* FTermXTerminal::term_detection = 0;
const FString* FTermXTerminal::xterm_font = nullptr;
const FString* FTermXTerminal::xterm_title = nullptr;
const FString* FTermXTerminal::foreground_color = nullptr;
const FString* FTermXTerminal::background_color = nullptr;
const FString* FTermXTerminal::cursor_color = nullptr;
const FString* FTermXTerminal::mouse_foreground_color = nullptr;
const FString* FTermXTerminal::mouse_background_color = nullptr;
const FString* FTermXTerminal::highlight_background_color = nullptr;
FTermcap::tcap_map* FTermXTerminal::tcap = nullptr;
FTermDetection* FTermXTerminal::term_detection = nullptr;
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
@ -257,7 +257,7 @@ void FTermXTerminal::resetForeground()
if ( foreground_color )
delete foreground_color;
foreground_color = 0;
foreground_color = nullptr;
resetXTermForeground();
}
@ -269,7 +269,7 @@ void FTermXTerminal::resetBackground()
if ( background_color )
delete background_color;
background_color = 0;
background_color = nullptr;
resetXTermBackground();
}
@ -281,7 +281,7 @@ void FTermXTerminal::resetCursorColor()
if ( cursor_color )
delete cursor_color;
cursor_color = 0;
cursor_color = nullptr;
resetXTermCursorColor();
}
@ -293,7 +293,7 @@ void FTermXTerminal::resetMouseForeground()
if ( mouse_foreground_color )
delete mouse_foreground_color;
mouse_foreground_color = 0;
mouse_foreground_color = nullptr;
resetXTermMouseForeground();
}
@ -305,7 +305,7 @@ void FTermXTerminal::resetMouseBackground()
if ( mouse_background_color )
delete mouse_background_color;
mouse_background_color = 0;
mouse_background_color = nullptr;
resetXTermMouseBackground();
}
@ -317,7 +317,7 @@ void FTermXTerminal::resetHighlightBackground()
if ( highlight_background_color )
delete highlight_background_color;
highlight_background_color = 0;
highlight_background_color = nullptr;
resetXTermHighlightBackground();
}

View File

@ -35,14 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FTextView::FTextView(FWidget* parent)
: FWidget(parent)
, data()
, vbar(0)
, hbar(0)
, update_scrollbar(true)
, xoffset(0)
, yoffset(0)
, nf_offset(0)
, maxLineWidth(0)
{
init();
}
@ -272,7 +264,10 @@ void FTextView::insert (const FString& str, int pos)
if ( len > getTextWidth() )
{
hbar->setMaximum (int(maxLineWidth) - int(getTextWidth()));
int hmax = ( maxLineWidth > getTextWidth() )
? int(maxLineWidth) - int(getTextWidth())
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
hbar->calculateSliderValues();
@ -283,7 +278,10 @@ void FTextView::insert (const FString& str, int pos)
}
data.insert (iter + pos, text_split.begin(), text_split.end());
vbar->setMaximum (int(getRows()) - int(getTextHeight()));
int vmax = ( getRows() > getTextHeight() )
? int(getRows()) - int(getTextHeight())
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(getRows()), int(getTextHeight()));
vbar->calculateSliderValues();
@ -583,7 +581,10 @@ void FTextView::adjustSize()
if ( height < 3 )
return;
vbar->setMaximum (last_line - int(height) + 2 - nf_offset);
int vmax = ( last_line > int(height) - 2 + nf_offset )
? last_line - int(height) + 2 - nf_offset
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (last_line, int(height) - 2 + nf_offset);
vbar->setX (int(width));
vbar->setHeight (height - 2 + std::size_t(nf_offset), false);
@ -593,7 +594,10 @@ void FTextView::adjustSize()
if ( width < 3 )
return;
hbar->setMaximum (max_width - int(width) + nf_offset + 2);
int hmax = ( max_width > int(width) - nf_offset - 2 )
? max_width - int(width) + nf_offset + 2
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (max_width, int(width) - nf_offset - 2);
hbar->setY (int(height));
hbar->setWidth (width - 2, false);

View File

@ -36,12 +36,6 @@ namespace finalcut
//----------------------------------------------------------------------
FToggleButton::FToggleButton (FWidget* parent)
: FWidget(parent)
, checked(false)
, label_offset_pos(0)
, button_width(0)
, button_group(0)
, focus_inside_group(true)
, text()
{
init();
@ -57,12 +51,6 @@ FToggleButton::FToggleButton (FWidget* parent)
//----------------------------------------------------------------------
FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
: FWidget(parent)
, checked(false)
, label_offset_pos(0)
, button_width(0)
, button_group(0)
, focus_inside_group(true)
, text()
{
FToggleButton::setText(txt); // call own method
init();

View File

@ -34,11 +34,6 @@ namespace finalcut
//----------------------------------------------------------------------
FToolTip::FToolTip (FWidget* parent)
: FWindow(parent)
, text()
, text_components(0)
, text_split()
, max_line_width(0)
, text_num_lines(0)
{
init();
}
@ -47,10 +42,6 @@ FToolTip::FToolTip (FWidget* parent)
FToolTip::FToolTip (const FString& txt, FWidget* parent)
: FWindow(parent)
, text(txt)
, text_components(0)
, text_split()
, max_line_width(0)
, text_num_lines(0)
{
init();
}
@ -63,7 +54,7 @@ FToolTip::~FToolTip() // destructor
if ( fapp->isQuit() )
return;
FWindow* parent_win = 0;
FWindow* parent_win = nullptr;
if ( FWidget* parent = getParentWidget() )
parent_win = getWindowWidget(parent);
@ -146,13 +137,16 @@ void FToolTip::calculateDimensions()
int x, y;
std::size_t w, h;
FWidget* r = getRootWidget();
max_line_width = 0;
text_split = text.split("\n");
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
max_line_width = 0;
if ( text_num_lines == 0 )
return;
for (std::size_t i = 0; i < text_num_lines; i++)
{
text_components = &text_split[0];
std::size_t len = text_components[i].getLength();
if ( len > max_line_width )

View File

@ -34,7 +34,7 @@ namespace finalcut
{
// global FVTerm object
static FVTerm* init_object = 0;
static FVTerm* init_object = nullptr;
// static class attributes
bool FVTerm::terminal_update_complete;
@ -47,14 +47,14 @@ uInt FVTerm::repeat_char_length;
uInt FVTerm::clr_bol_length;
uInt FVTerm::clr_eol_length;
uInt FVTerm::cursor_address_length;
std::queue<int>* FVTerm::output_buffer = 0;
FPoint* FVTerm::term_pos = 0;
FTerm* FVTerm::fterm = 0;
FVTerm::term_area* FVTerm::vterm = 0;
FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::active_area = 0;
FTermcap::tcap_map* FVTerm::tcap = 0;
FKeyboard* FVTerm::keyboard = 0;
std::queue<int>* FVTerm::output_buffer = nullptr;
FPoint* FVTerm::term_pos = nullptr;
FTerm* FVTerm::fterm = nullptr;
FVTerm::term_area* FVTerm::vterm = nullptr;
FVTerm::term_area* FVTerm::vdesktop = nullptr;
FVTerm::term_area* FVTerm::active_area = nullptr;
FTermcap::tcap_map* FVTerm::tcap = nullptr;
FKeyboard* FVTerm::keyboard = nullptr;
FVTerm::charData FVTerm::term_attribute;
FVTerm::charData FVTerm::next_attribute;
FVTerm::charData FVTerm::s_ch;
@ -68,9 +68,6 @@ FVTerm::charData FVTerm::i_ch;
// constructors and destructor
//----------------------------------------------------------------------
FVTerm::FVTerm (bool initialize, bool disable_alt_screen)
: print_area(0)
, child_print_area(0)
, vwin(0)
{
terminal_update_complete = false;
@ -454,7 +451,7 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
}
//----------------------------------------------------------------------
int FVTerm::print (int c)
int FVTerm::print (wchar_t c)
{
term_area* area = getPrintArea();
@ -470,14 +467,14 @@ int FVTerm::print (int c)
}
//----------------------------------------------------------------------
int FVTerm::print (term_area* area, int c)
int FVTerm::print (term_area* area, wchar_t c)
{
charData nc; // next character
if ( ! area )
return -1;
nc.code = c;
nc.code = wchar_t(c);
nc.fg_color = next_attribute.fg_color;
nc.bg_color = next_attribute.bg_color;
nc.attr.byte[0] = next_attribute.attr.byte[0];
@ -793,17 +790,17 @@ void FVTerm::removeArea (term_area*& area)
if ( area->changes != 0 )
{
delete[] area->changes;
area->changes = 0;
area->changes = nullptr;
}
if ( area->text != 0 )
{
delete[] area->text;
area->text = 0;
area->text = nullptr;
}
delete area;
area = 0;
area = nullptr;
}
}
@ -1975,8 +1972,8 @@ void FVTerm::flush_out()
void FVTerm::init (bool disable_alt_screen)
{
init_object = this;
vterm = 0;
vdesktop = 0;
vterm = nullptr;
vdesktop = nullptr;
try
{

View File

@ -31,17 +31,17 @@ namespace finalcut
{
// global FWidget object
static FWidget* rootObject = 0;
static FWidget* rootObject = nullptr;
// static class attributes
FStatusBar* FWidget::statusbar = 0;
FMenuBar* FWidget::menubar = 0;
FWidget* FWidget::show_root_widget = 0;
FWidget* FWidget::redraw_root_widget = 0;
FWidget::widgetList* FWidget::window_list = 0;
FWidget::widgetList* FWidget::dialog_list = 0;
FWidget::widgetList* FWidget::always_on_top_list = 0;
FWidget::widgetList* FWidget::close_widget = 0;
FStatusBar* FWidget::statusbar = nullptr;
FMenuBar* FWidget::menubar = nullptr;
FWidget* FWidget::show_root_widget = nullptr;
FWidget* FWidget::redraw_root_widget = nullptr;
FWidget::widgetList* FWidget::window_list = nullptr;
FWidget::widgetList* FWidget::dialog_list = nullptr;
FWidget::widgetList* FWidget::always_on_top_list = nullptr;
FWidget::widgetList* FWidget::close_widget = nullptr;
FWidgetColors FWidget::wc;
bool FWidget::init_desktop;
bool FWidget::hideable;
@ -57,26 +57,6 @@ uInt FWidget::modal_dialogs;
FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
: FVTerm(bool(! parent), disable_alt_screen)
, FObject(parent)
, accelerator_list(0)
, flags()
, callback_objects()
, member_callback_objects()
, widget_cursor_position(-1, -1)
, size_hints()
, double_flatline_mask()
, padding()
, ignore_padding(false)
, wsize(1, 1, 1, 1)
, adjust_wsize(1, 1, 1, 1)
, adjust_wsize_term()
, adjust_wsize_shadow()
, adjust_wsize_term_shadow()
, offset()
, client_offset()
, wshadow(0, 0)
, foreground_color(fc::Default)
, background_color(fc::Default)
, statusbar_message()
{
// init bit field with 0
memset (&flags, 0, sizeof(flags));
@ -85,7 +65,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
flags.visible = true; // A widget is visible by default
flags.focusable = true; // A widget is focusable by default
flags.visible_cursor = true; // A widget has a visible cursor by default
widget_object = true; // This FObject is a widget
setWidgetProperty (true); // This FObject is a widget
if ( ! parent )
{
@ -93,10 +73,10 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
&& "FTerm: There should be only one root object" );
rootObject = this;
show_root_widget = 0;
redraw_root_widget = 0;
show_root_widget = nullptr;
redraw_root_widget = nullptr;
modal_dialogs = 0;
statusbar = 0;
statusbar = nullptr;
init();
}
else
@ -1037,7 +1017,7 @@ void FWidget::redraw()
{
updateTerminal();
flush_out();
redraw_root_widget = 0;
redraw_root_widget = nullptr;
}
}
@ -1114,7 +1094,7 @@ void FWidget::show()
finishTerminalUpdate();
updateTerminal();
flush_out();
show_root_widget = 0;
show_root_widget = nullptr;
}
FShowEvent show_ev (fc::Show_Event);
@ -1689,7 +1669,7 @@ bool FWidget::focusNextChild()
continue;
}
FWidget* next = 0;
FWidget* next = nullptr;
constFObjectIterator next_element;
next_element = iter;
@ -1750,7 +1730,7 @@ bool FWidget::focusPrevChild()
if ( w != this )
continue;
FWidget* prev = 0;
FWidget* prev = nullptr;
constFObjectIterator prev_element;
prev_element = iter;
@ -1999,30 +1979,30 @@ void FWidget::init()
void FWidget::finish()
{
delete accelerator_list;
accelerator_list = 0;
accelerator_list = nullptr;
if ( close_widget )
{
delete close_widget;
close_widget = 0;
close_widget = nullptr;
}
if ( dialog_list )
{
delete dialog_list;
dialog_list = 0;
dialog_list = nullptr;
}
if ( always_on_top_list )
{
delete always_on_top_list;
always_on_top_list = 0;
always_on_top_list = nullptr;
}
if ( window_list )
{
delete window_list;
window_list = 0;
window_list = nullptr;
}
}

View File

@ -29,7 +29,7 @@ namespace finalcut
{
// static attributes
FWindow* FWindow::previous_window = 0;
FWindow* FWindow::previous_window = nullptr;
//----------------------------------------------------------------------
@ -40,10 +40,6 @@ FWindow* FWindow::previous_window = 0;
//----------------------------------------------------------------------
FWindow::FWindow(FWidget* parent)
: FWidget(parent)
, window_active(false)
, zoomed(false)
, win_focus_widget(0)
, normalGeometry()
{
setWindowWidget();
FRect geometry = getTermGeometry();
@ -58,7 +54,7 @@ FWindow::~FWindow() // destructor
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
if ( previous_window == this )
previous_window = 0;
previous_window = nullptr;
if ( isAlwaysOnTop() )
deleteFromAlwaysOnTopList (this);
@ -695,17 +691,17 @@ bool FWindow::zoomWindow()
}
//----------------------------------------------------------------------
void FWindow::switchToPrevWindow (FWidget* widget_object)
void FWindow::switchToPrevWindow (FWidget* widget)
{
// switch to previous window
// Disable terminal updates to avoid flickering
// when redrawing the focused widget
if ( widget_object )
widget_object->updateTerminal (FVTerm::stop_refresh);
if ( widget )
widget->updateTerminal (FVTerm::stop_refresh);
bool is_activated = activatePrevWindow();
FWindow* active_window = static_cast<FWindow*>(getActiveWindow());
FWindow* active_win = static_cast<FWindow*>(getActiveWindow());
if ( ! is_activated )
{
@ -722,7 +718,7 @@ void FWindow::switchToPrevWindow (FWidget* widget_object)
FWindow* w = static_cast<FWindow*>(*iter);
if ( w
&& w != active_window
&& w != active_win
&& ! (w->isWindowHidden() || w->isWindowActive())
&& w != static_cast<FWindow*>(getStatusBar())
&& w != static_cast<FWindow*>(getMenuBar()) )
@ -735,25 +731,25 @@ void FWindow::switchToPrevWindow (FWidget* widget_object)
}
}
if ( active_window )
if ( active_win )
{
FWidget* focus_widget = active_window->getWindowFocusWidget();
FWidget* focus = active_win->getWindowFocusWidget();
if ( ! active_window->isWindowActive() )
setActiveWindow(active_window);
if ( ! active_win->isWindowActive() )
setActiveWindow(active_win);
if ( focus_widget )
if ( focus)
{
focus_widget->setFocus();
focus->setFocus();
if ( ! focus_widget->isWindowWidget() )
focus_widget->redraw();
if ( ! focus->isWindowWidget() )
focus->redraw();
}
}
// Enable terminal updates again
if ( widget_object )
widget_object->updateTerminal (FVTerm::continue_refresh);
if ( widget )
widget->updateTerminal (FVTerm::continue_refresh);
}
//----------------------------------------------------------------------

View File

@ -45,20 +45,19 @@ namespace fc
class emptyFString
{
public:
emptyFString()
{ }
// Constructors
emptyFString() = default;
// Disable copy constructor
emptyFString (const emptyFString&) = delete;
// Disable assignment operator (=)
emptyFString& operator = (const emptyFString&) = delete;
static bool isNull();
static const FString& get();
static void clear();
private:
// Disable copy constructor
emptyFString (const emptyFString&);
// Disable assignment operator (=)
emptyFString& operator = (const emptyFString&);
// Data Member
static const FString* empty_string;
};
@ -93,7 +92,7 @@ inline const FString& emptyFString::get()
inline void emptyFString::clear()
{
delete empty_string;
empty_string = 0;
empty_string = nullptr;
}
} // namespace fc

View File

@ -84,10 +84,14 @@ class FApplication : public FWidget
public:
// Constructor
FApplication (const int&, char*[], bool = false);
// Disable copy constructor
FApplication (const FApplication&) = delete;
// Destructor
virtual ~FApplication();
// Disable assignment operator (=)
FApplication& operator = (const FApplication&) = delete;
// Accessors
const char* getClassName() const;
int getArgc() const;
@ -127,12 +131,6 @@ class FApplication : public FWidget
// Constants
static const int NEED_MORE_DATA = -1; // parseKeyString return value
// Disable copy constructor
FApplication (const FApplication&);
// Disable assignment operator (=)
FApplication& operator = (const FApplication&);
// Methods
void init (long, long);
void cmd_options (const int&, char*[]);
@ -179,8 +177,8 @@ class FApplication : public FWidget
// Data Members
int app_argc;
char** app_argv;
long key_timeout;
long dblclick_interval;
long key_timeout{100000}; // 100 ms
long dblclick_interval{500000}; // 500 ms
static FMouseControl* mouse;
static eventQueue* event_queue;
static int quit_code;

View File

@ -68,12 +68,16 @@ class FButton : public FWidget
{
public:
// Constructors
explicit FButton (FWidget* = 0);
explicit FButton (const FString&, FWidget* = 0);
explicit FButton (FWidget* = nullptr);
explicit FButton (const FString&, FWidget* = nullptr);
// Disable copy constructor
FButton (const FButton&) = delete;
// Destructor
virtual ~FButton();
// Disable assignment operator (=)
FButton& operator = (const FButton&) = delete;
// Accessors
const char* getClassName() const;
FString& getText();
@ -133,12 +137,6 @@ class FButton : public FWidget
// Constants
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
// Disable copy constructor
FButton (const FButton&);
// Disable assignment operator (=)
FButton& operator = (const FButton&);
// Methods
void init();
uChar getHotkey();
@ -157,24 +155,24 @@ class FButton : public FWidget
void processClick();
// Data Members
FString text;
bool button_down;
bool active_focus;
bool click_animation;
int click_time;
int space_char;
std::size_t hotkeypos;
std::size_t indent;
std::size_t center_offset;
std::size_t vcenter_offset;
std::size_t txtlength;
FColor button_fg;
FColor button_bg;
FColor button_hotkey_fg;
FColor button_focus_fg;
FColor button_focus_bg;
FColor button_inactive_fg;
FColor button_inactive_bg;
FString text{};
bool button_down{false};
bool active_focus{false};
bool click_animation{true};
int click_time{150};
int space_char{int(' ')};
std::size_t hotkeypos{NOT_SET};
std::size_t indent{0};
std::size_t center_offset{0};
std::size_t vcenter_offset{0};
std::size_t txtlength{0};
FColor button_fg{wc.button_active_fg};
FColor button_bg{wc.button_active_bg};
FColor button_hotkey_fg{wc.button_hotkey_fg};
FColor button_focus_fg{wc.button_active_focus_fg};
FColor button_focus_bg{wc.button_active_focus_bg};
FColor button_inactive_fg{wc.button_inactive_fg};
FColor button_inactive_bg{wc.button_inactive_bg};
};
#pragma pack(pop)

View File

@ -72,12 +72,16 @@ class FButtonGroup : public FScrollView
{
public:
// Constructors
explicit FButtonGroup (FWidget* = 0);
explicit FButtonGroup (const FString&, FWidget* = 0);
explicit FButtonGroup (FWidget* = nullptr);
explicit FButtonGroup (const FString&, FWidget* = nullptr);
// Disable copy constructor
FButtonGroup (const FButtonGroup&) = delete;
// Destructor
virtual ~FButtonGroup();
// Disable assignment operator (=)
FButtonGroup& operator = (const FButtonGroup&) = delete;
// Accessor
const char* getClassName() const;
FToggleButton* getFirstButton();
@ -128,12 +132,6 @@ class FButtonGroup : public FScrollView
// Constants
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
// Disable copy constructor
FButtonGroup (const FButtonGroup&);
// Disable assignment operator (=)
FButtonGroup& operator = (const FButtonGroup&);
// Inquiries
bool isRadioButton (FToggleButton*) const;
@ -144,8 +142,8 @@ class FButtonGroup : public FScrollView
void directFocus();
// Data Members
FString text;
FObjectList buttonlist;
FString text{};
FObjectList buttonlist{};
};
#pragma pack(pop)

View File

@ -93,7 +93,7 @@ enum encoding
};
// VT100 line graphic keys
enum vt100_keys
enum vt100_keys : char
{
vt100_key_rarrow = '+', // ► - arrow pointing right
vt100_key_larrow = ',', // ◄ - arrow pointing left
@ -136,7 +136,7 @@ enum vt100_keys
};
// Unicode characters
enum SpecialCharacter
enum SpecialCharacter : wchar_t
{
Euro = 0x20ac, // €
Pound = 0x00a3, // £
@ -237,7 +237,7 @@ enum SpecialCharacter
*/
// keyboard - single keys
enum keys
enum keys : FKey
{
Fckey_a = 0x00000001, // control-a
Fckey_b = 0x00000002, // control-b
@ -440,7 +440,7 @@ enum keys
};
// Keyboard - modifier key combinations
enum metakeys
enum metakeys : FKey
{
Fmkey_ic = 0x01500100, // M-insert
Fmkey_dc = 0x01500101, // M-delete
@ -651,7 +651,7 @@ enum metakeys
};
// Console color names
enum colornames
enum colornames : FColor
{
Black = 0,
Blue = 1,

View File

@ -73,22 +73,20 @@ class FCheckBox : public FToggleButton
{
public:
// Constructors
explicit FCheckBox (FWidget* = 0);
explicit FCheckBox (const FString&, FWidget* = 0);
explicit FCheckBox (FWidget* = nullptr);
explicit FCheckBox (const FString&, FWidget* = nullptr);
// Disable copy constructor
FCheckBox (const FCheckBox&) = delete;
// Destructor
virtual ~FCheckBox();
// Disable assignment operator (=)
FCheckBox& operator = (const FCheckBox&) = delete;
// Accessor
const char* getClassName() const;
private:
// Disable copy constructor
FCheckBox (const FCheckBox&);
// Disable assignment operator (=)
FCheckBox& operator = (const FCheckBox&);
// Methods
void init();
virtual void draw();

View File

@ -73,22 +73,20 @@ class FCheckMenuItem : public FMenuItem
{
public:
// Constructors
explicit FCheckMenuItem (FWidget* = 0);
explicit FCheckMenuItem (const FString&, FWidget* = 0);
explicit FCheckMenuItem (FWidget* = nullptr);
explicit FCheckMenuItem (const FString&, FWidget* = nullptr);
// Disable copy constructor
FCheckMenuItem (const FCheckMenuItem&) = delete;
// Destructor
virtual ~FCheckMenuItem();
// Disable assignment operator (=)
FCheckMenuItem& operator = (const FCheckMenuItem&) = delete;
// Accessor
const char* getClassName() const;
private:
// Disable copy constructor
FCheckMenuItem (const FCheckMenuItem&);
// Disable assignment operator (=)
FCheckMenuItem& operator = (const FCheckMenuItem&);
// Methods
void init (FWidget*);
void processToggle();

View File

@ -51,7 +51,7 @@ class FColorPalette
{
public:
// Constructor
FColorPalette();
FColorPalette() = default;
// Destructor
virtual ~FColorPalette();

View File

@ -183,7 +183,7 @@
/* Define to the full name and version of this package. */
#ifndef F_PACKAGE_STRING
#define F_PACKAGE_STRING "finalcut 0.5.0"
#define F_PACKAGE_STRING "finalcut 0.5.1"
#endif
/* Define to the one symbol short name of this package. */
@ -198,7 +198,7 @@
/* Define to the version of this package. */
#ifndef F_PACKAGE_VERSION
#define F_PACKAGE_VERSION "0.5.0"
#define F_PACKAGE_VERSION "0.5.1"
#endif
/* Define to 1 if you have the ANSI C header files. */
@ -230,7 +230,7 @@
/* Version number of package */
#ifndef F_VERSION
#define F_VERSION "0.5.0"
#define F_VERSION "0.5.1"
#endif
/* Define to 1 if on MINIX. */

View File

@ -87,12 +87,16 @@ class FDialog : public FWindow
};
// Constructors
explicit FDialog (FWidget* = 0);
explicit FDialog (const FString&, FWidget* = 0);
explicit FDialog (FWidget* = nullptr);
explicit FDialog (const FString&, FWidget* = nullptr);
// Disable copy constructor
FDialog (const FDialog&) = delete;
// Destructor
virtual ~FDialog();
// Disable assignment operator (=)
FDialog& operator = (const FDialog&) = delete;
// Accessors
virtual const char* getClassName() const;
FString getText() const;
@ -117,7 +121,7 @@ class FDialog : public FWindow
// Methods
virtual void show();
virtual void hide();
DialogCode exec();
int exec();
virtual void setPos (int, int, bool = true);
virtual void move (int, int);
bool moveUp (int);
@ -145,7 +149,7 @@ class FDialog : public FWindow
protected:
// Methods
virtual void done (DialogCode);
virtual void done (int);
virtual void draw();
void drawDialogShadow();
@ -172,12 +176,6 @@ class FDialog : public FWindow
// Using-declaration
using FWidget::drawBorder;
// Disable copy constructor
FDialog (const FDialog&);
// Disable assignment operator (=)
FDialog& operator = (const FDialog&);
// Methods
void init();
void initDialogMenu();
@ -222,21 +220,21 @@ class FDialog : public FWindow
void cb_close (FWidget*, data_ptr);
// Data Members
FString tb_text; // title bar text
DialogCode result_code;
bool zoom_button_pressed;
bool zoom_button_active;
bool setPos_error;
bool setSize_error;
FPoint titlebar_click_pos;
FPoint resize_click_pos;
FRect save_geometry; // required by keyboard move/size
FMenu* dialog_menu;
FMenuItem* dgl_menuitem;
FMenuItem* move_size_item;
FMenuItem* zoom_item;
FMenuItem* close_item;
FToolTip* tooltip;
FString tb_text{}; // title bar text
int result_code{FDialog::Reject};
bool zoom_button_pressed{false};
bool zoom_button_active{false};
bool setPos_error{false};
bool setSize_error{false};
FPoint titlebar_click_pos{};
FPoint resize_click_pos{};
FRect save_geometry{}; // required by keyboard move/size
FMenu* dialog_menu{nullptr};
FMenuItem* dgl_menuitem{nullptr};
FMenuItem* move_size_item{nullptr};
FMenuItem* zoom_item{nullptr};
FMenuItem* close_item{nullptr};
FToolTip* tooltip{nullptr};
// Friend function from FMenu
friend void FMenu::hideSuperMenus();

View File

@ -79,22 +79,20 @@ class FDialogListMenu : public FMenu
{
public:
// Constructors
explicit FDialogListMenu (FWidget* = 0);
explicit FDialogListMenu (const FString&, FWidget* = 0);
explicit FDialogListMenu (FWidget* = nullptr);
explicit FDialogListMenu (const FString&, FWidget* = nullptr);
// Disable copy constructor
FDialogListMenu (const FDialogListMenu&) = delete;
// Destructor
virtual ~FDialogListMenu();
// Disable assignment operator (=)
FDialogListMenu& operator = (const FDialogListMenu&) = delete;
// Accessors
virtual const char* getClassName() const;
private:
// Disable copy constructor
FDialogListMenu (const FDialogListMenu&);
// Disable assignment operator (=)
FDialogListMenu& operator = (const FDialogListMenu&);
// Method
void init();
};

View File

@ -92,12 +92,13 @@ namespace finalcut
class FEvent // event base class
{
public:
FEvent() = default;
explicit FEvent(int);
virtual ~FEvent();
int type() const;
protected:
int t;
int t{fc::None_Event};
};
#pragma pack(pop)
@ -113,6 +114,7 @@ class FEvent // event base class
class FKeyEvent : public FEvent // keyboard event
{
public:
FKeyEvent() = default;
FKeyEvent (int, FKey);
~FKeyEvent();
@ -122,8 +124,8 @@ class FKeyEvent : public FEvent // keyboard event
void ignore();
protected:
FKey k;
bool accpt;
FKey k{0};
bool accpt{false};
};
#pragma pack(pop)
@ -139,8 +141,9 @@ class FKeyEvent : public FEvent // keyboard event
class FMouseEvent : public FEvent // mouse event
{
public:
FMouseEvent (int, const FPoint&, int);
FMouseEvent() = default;
FMouseEvent (int, const FPoint&, const FPoint&, int);
FMouseEvent (int, const FPoint&, int);
~FMouseEvent();
const FPoint& getPos() const;
@ -170,6 +173,7 @@ class FMouseEvent : public FEvent // mouse event
class FWheelEvent : public FEvent // wheel event
{
public:
FWheelEvent() = default;
FWheelEvent (int, const FPoint&, int);
FWheelEvent (int, const FPoint&, const FPoint&, int);
~FWheelEvent();
@ -201,6 +205,7 @@ class FWheelEvent : public FEvent // wheel event
class FFocusEvent : public FEvent // focus event
{
public:
FFocusEvent() = default;
explicit FFocusEvent (int);
~FFocusEvent();
@ -212,8 +217,8 @@ class FFocusEvent : public FEvent // focus event
void accept();
void ignore();
protected:
bool accpt;
fc::FocusTypes focus_type;
bool accpt{true};
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
};
#pragma pack(pop)
@ -228,15 +233,12 @@ class FFocusEvent : public FEvent // focus event
class FAccelEvent : public FEvent // focus event
{
private:
// Disable copy constructor
FAccelEvent (const FAccelEvent&);
// Disable assignment operator (=)
FAccelEvent& operator = (const FAccelEvent&);
public:
FAccelEvent() = default;
FAccelEvent (int, void*);
FAccelEvent (const FAccelEvent&) = delete;
~FAccelEvent();
FAccelEvent& operator = (const FAccelEvent&) = delete;
void* focusedWidget() const;
bool isAccepted() const;
@ -244,7 +246,7 @@ class FAccelEvent : public FEvent // focus event
void ignore();
protected:
bool accpt;
bool accpt{false};
void* focus_widget;
};
@ -258,6 +260,7 @@ class FAccelEvent : public FEvent // focus event
class FResizeEvent : public FEvent // resize event
{
public:
FResizeEvent() = default;
explicit FResizeEvent (int);
~FResizeEvent();
@ -266,7 +269,7 @@ class FResizeEvent : public FEvent // resize event
void ignore();
protected:
bool accpt;
bool accpt{false};
};
@ -278,6 +281,7 @@ class FResizeEvent : public FEvent // resize event
class FShowEvent : public FEvent // show event
{
public:
FShowEvent() = default;
explicit FShowEvent (int);
~FShowEvent();
};
@ -291,6 +295,7 @@ class FShowEvent : public FEvent // show event
class FHideEvent : public FEvent // hide event
{
public:
FHideEvent() = default;
explicit FHideEvent (int);
~FHideEvent();
};
@ -304,6 +309,7 @@ class FHideEvent : public FEvent // hide event
class FCloseEvent : public FEvent // close event
{
public:
FCloseEvent() = default;
explicit FCloseEvent(int);
~FCloseEvent();
@ -312,7 +318,7 @@ class FCloseEvent : public FEvent // close event
void ignore();
protected:
bool accpt;
bool accpt{false};
};
@ -327,6 +333,7 @@ class FCloseEvent : public FEvent // close event
class FTimerEvent : public FEvent // timer event
{
public:
FTimerEvent() = default;
FTimerEvent(int, int);
~FTimerEvent();

View File

@ -102,12 +102,12 @@ class FFileDialog : public FDialog
};
// Constructors
explicit FFileDialog (FWidget* = 0);
explicit FFileDialog (FWidget* = nullptr);
FFileDialog (const FFileDialog&); // copy constructor
FFileDialog ( const FString&
, const FString&
, DialogType = FFileDialog::Open
, FWidget* = 0 );
, FWidget* = nullptr );
// Destructor
virtual ~FFileDialog();
@ -186,17 +186,17 @@ class FFileDialog : public FDialog
void cb_processShowHidden (FWidget*, data_ptr);
// Data Members
DIR* directory_stream;
dirEntries dir_entries;
FString directory;
FString filter_pattern;
FLineEdit filename;
FListBox filebrowser;
FCheckBox hidden;
FButton cancel;
FButton open;
DialogType dlg_type;
bool show_hidden;
DIR* directory_stream{nullptr};
dirEntries dir_entries{};
FString directory{};
FString filter_pattern{};
FLineEdit filename{this};
FListBox filebrowser{this};
FCheckBox hidden{this};
FButton cancel{this};
FButton open{this};
DialogType dlg_type{FFileDialog::Open};
bool show_hidden{false};
// Friend functions
friend bool sortByName ( const FFileDialog::dir_entry&

View File

@ -60,15 +60,16 @@ class FKeyboardCommand
{
public:
// Constructor
explicit FKeyboardCommand (FApplication* = 0, void(FApplication::*)() = 0);
explicit FKeyboardCommand ( FApplication* = nullptr
, void(FApplication::*)() = nullptr);
// Method
void execute();
private:
// Data Members
FApplication* instance;
void (FApplication::*handler)();
FApplication* instance{nullptr};
void (FApplication::*handler)(){nullptr};
};
#pragma pack(pop)
@ -84,17 +85,21 @@ class FKeyboard
{
public:
// Constants
static const std::size_t FIFO_BUF_SIZE = 512;
static const std::size_t FIFO_BUF_SIZE{512};
// Typedef
typedef char keybuffer[FIFO_BUF_SIZE];
// Constructor
FKeyboard();
// Disable copy constructor
FKeyboard (const FKeyboard&) = delete;
// Destructor
virtual ~FKeyboard();
// Disable assignment operator (=)
FKeyboard& operator = (const FKeyboard&) = delete;
// Accessors
virtual const char* getClassName() const;
FKey getKey();
@ -131,15 +136,9 @@ class FKeyboard
private:
// Constants
static const std::size_t READ_BUF_SIZE = 1024;
static const std::size_t READ_BUF_SIZE{1024};
static const FKey NOT_SET = static_cast<FKey>(-1);
// Disable copy constructor
FKeyboard (const FKeyboard&);
// Disable assignment operator (=)
FKeyboard& operator = (const FKeyboard&);
// Accessors
FKey getMouseProtocolKey();
FKey getTermcapKey();
@ -166,23 +165,23 @@ class FKeyboard
void escapeKeyPressed();
// Data Members
FKey key;
char read_buf[READ_BUF_SIZE];
char fifo_buf[FIFO_BUF_SIZE];
int fifo_offset;
bool fifo_in_use;
int stdin_status_flags;
FKey key{0};
char read_buf[READ_BUF_SIZE]{'\0'};
char fifo_buf[FIFO_BUF_SIZE]{'\0'};
int fifo_offset{0};
bool fifo_in_use{false};
int stdin_status_flags{0};
static long key_timeout;
bool input_data_pending;
bool utf8_input;
bool mouse_support;
bool non_blocking_stdin;
FKeyboardCommand keypressed_cmd;
FKeyboardCommand keyreleased_cmd;
FKeyboardCommand escape_key_cmd;
bool input_data_pending{false};
bool utf8_input{false};
bool mouse_support{true};
bool non_blocking_stdin{false};
FKeyboardCommand keypressed_cmd{};
FKeyboardCommand keyreleased_cmd{};
FKeyboardCommand escape_key_cmd{};
static timeval time_keypressed;
fc::fkeymap* key_map;
fc::fkeymap* key_map{nullptr};
#if defined(__linux__)
#undef linux

View File

@ -73,15 +73,20 @@ class FLabel : public FWidget
using FWidget::setEnable;
// Constructor
explicit FLabel (FWidget* = 0);
explicit FLabel (const FString&, FWidget* = 0);
explicit FLabel (FWidget* = nullptr);
explicit FLabel (const FString&, FWidget* = nullptr);
// Disable copy constructor
FLabel (const FLabel&) = delete;
// Destructor
virtual ~FLabel();
// Disable assignment operator (=)
FLabel& operator = (const FLabel&) = delete;
// Overloaded operators
FLabel& operator = (const FString&);
FLabel& operator << (const FString&);
FLabel& operator << (fc::SpecialCharacter);
FLabel& operator << (const wchar_t);
FLabel& operator << (const uInt);
FLabel& operator << (const int);
@ -99,7 +104,7 @@ class FLabel : public FWidget
FString& getText();
// Mutators
void setAccelWidget (FWidget* = 0);
void setAccelWidget (FWidget* = nullptr);
void setAlignment(fc::text_alignment);
bool setEmphasis(bool);
bool setEmphasis();
@ -134,12 +139,6 @@ class FLabel : public FWidget
// Constants
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
// Disable copy constructor
FLabel (const FLabel&);
// Disable assignment operator (=)
FLabel& operator = (const FLabel&);
// Methods
void init();
uChar getHotkey();
@ -153,15 +152,15 @@ class FLabel : public FWidget
, std::size_t, std::size_t = 0 );
// Data Members
FStringList multiline_text;
bool multiline;
FString text;
fc::text_alignment alignment;
FColor emphasis_color;
FColor ellipsis_color;
bool emphasis;
bool reverse_mode;
FWidget* accel_widget;
FStringList multiline_text{};
bool multiline{false};
FString text{};
fc::text_alignment alignment{fc::alignLeft};
FColor emphasis_color{wc.label_emphasis_fg};
FColor ellipsis_color{wc.label_ellipsis_fg};
bool emphasis{false};
bool reverse_mode{false};
FWidget* accel_widget{nullptr};
};
#pragma pack(pop)

View File

@ -76,15 +76,20 @@ class FLineEdit : public FWidget
};
// Constructor
explicit FLineEdit (FWidget* = 0);
explicit FLineEdit (const FString&, FWidget* = 0);
explicit FLineEdit (FWidget* = nullptr);
explicit FLineEdit (const FString&, FWidget* = nullptr);
// Disable copy constructor
FLineEdit (const FLineEdit&) = delete;
// Destructor
virtual ~FLineEdit();
// Disable assignment operator (=)
FLineEdit& operator = (const FLineEdit&) = delete;
// Overloaded operators
FLineEdit& operator = (const FString&);
FLineEdit& operator << (const FString&);
FLineEdit& operator << (fc::SpecialCharacter);
FLineEdit& operator << (const wchar_t);
FLineEdit& operator << (const uInt);
FLineEdit& operator << (const int);
@ -146,12 +151,6 @@ class FLineEdit : public FWidget
scrollRight = 2
};
// Disable copy constructor
FLineEdit (const FLineEdit&);
// Disable assignment operator (=)
FLineEdit& operator = (const FLineEdit&);
// Methods
void init();
bool hasHotkey();
@ -170,16 +169,16 @@ class FLineEdit : public FWidget
void processChanged();
// Data Members
FString text;
FString label_text;
FLabel* label;
label_o label_orientation;
dragScroll drag_scroll;
bool scroll_timer;
int scroll_repeat;
bool insert_mode;
std::size_t cursor_pos;
std::size_t text_offset;
FString text{""};
FString label_text{""};
FLabel* label{};
label_o label_orientation{FLineEdit::label_left};
dragScroll drag_scroll{FLineEdit::noScroll};
bool scroll_timer{false};
int scroll_repeat{100};
bool insert_mode{true};
std::size_t cursor_pos{0};
std::size_t text_offset{0};
};
#pragma pack(pop)

View File

@ -75,7 +75,7 @@ class FListBoxItem
// Constructors
FListBoxItem ();
FListBoxItem (const FListBoxItem&); // copy constructor
explicit FListBoxItem (const FString&, FWidget::data_ptr = 0);
explicit FListBoxItem (const FString&, FWidget::data_ptr = nullptr);
// Destructor
virtual ~FListBoxItem();
@ -99,10 +99,10 @@ class FListBoxItem
friend class FListBox;
// Data Members
FString text;
FWidget::data_ptr data_pointer;
fc::brackets_type brackets;
bool selected;
FString text{};
FWidget::data_ptr data_pointer{nullptr};
fc::brackets_type brackets{fc::NoBrackets};
bool selected{false};
};
#pragma pack(pop)
@ -146,15 +146,19 @@ class FListBox : public FWidget
using FWidget::setGeometry;
// Constructor
explicit FListBox (FWidget* = 0);
explicit FListBox (FWidget* = nullptr);
template <typename Iterator, typename InsertConverter>
FListBox (Iterator, Iterator, InsertConverter, FWidget* = 0);
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
template <typename Container, typename LazyConverter>
FListBox (Container, LazyConverter, FWidget* = 0);
FListBox (Container, LazyConverter, FWidget* = nullptr);
// Disable copy constructor
FListBox (const FListBox&) = delete;
// Destructor
virtual ~FListBox();
// Disable assignment operator (=)
FListBox& operator = (const FListBox&) = delete;
// Accessors
const char* getClassName() const;
std::size_t getCount() const;
@ -200,11 +204,11 @@ class FListBox : public FWidget
void insert ( const FString&
, fc::brackets_type = fc::NoBrackets
, bool = false
, data_ptr = 0 );
, data_ptr = nullptr );
void insert ( long
, fc::brackets_type = fc::NoBrackets
, bool = false
, data_ptr = 0 );
, data_ptr = nullptr );
void remove (std::size_t);
void clear();
@ -221,7 +225,7 @@ class FListBox : public FWidget
protected:
// Methods
void adjustYOffset();
void adjustYOffset (std::size_t);
virtual void adjustSize();
private:
@ -233,12 +237,6 @@ class FListBox : public FWidget
lazy_convert = 2
};
// Disable copy constructor
FListBox (const FListBox&);
// Disable assignment operator (=)
FListBox& operator = (const FListBox&);
// Accessors
static FString& getString (listBoxItems::iterator);
@ -299,30 +297,30 @@ class FListBox : public FWidget
// Function Pointer
void (*convertToItem) ( FListBoxItem&
, FWidget::data_ptr
, int index );
, int index ){nullptr};
// Data Members
listBoxItems itemlist;
FWidget::data_ptr source_container;
convert_type conv_type;
FScrollbar* vbar;
FScrollbar* hbar;
FString text;
FString inc_search;
bool multi_select;
bool mouse_select;
fc::dragScroll drag_scroll;
bool scroll_timer;
int scroll_repeat;
int scroll_distance;
std::size_t current;
int last_current;
int secect_from_item;
int xoffset;
int yoffset;
int last_yoffset;
std::size_t nf_offset;
std::size_t max_line_width;
listBoxItems itemlist{};
FWidget::data_ptr source_container{nullptr};
convert_type conv_type{FListBox::no_convert};
FScrollbar* vbar{nullptr};
FScrollbar* hbar{nullptr};
FString text{};
FString inc_search{};
bool multi_select{false};
bool mouse_select{false};
fc::dragScroll drag_scroll{fc::noScroll};
bool scroll_timer{false};
int scroll_repeat{100};
int scroll_distance{1};
std::size_t current{0};
int last_current{-1};
int secect_from_item{-1};
int xoffset{0};
int yoffset{0};
int last_yoffset{-1};
std::size_t nf_offset{0};
std::size_t max_line_width{0};
};
#pragma pack(pop)
@ -335,28 +333,6 @@ inline FListBox::FListBox ( Iterator first
, InsertConverter convert
, FWidget* parent )
: FWidget(parent)
, convertToItem(0)
, itemlist()
, source_container(0)
, conv_type(FListBox::no_convert)
, vbar(0)
, hbar(0)
, text()
, inc_search()
, multi_select(false)
, mouse_select(false)
, drag_scroll(fc::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, scroll_distance(1)
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, max_line_width(0)
{
init();
@ -373,28 +349,6 @@ inline FListBox::FListBox ( Container container
, LazyConverter convert
, FWidget* parent )
: FWidget(parent)
, convertToItem(0)
, itemlist()
, source_container(0)
, conv_type(FListBox::no_convert)
, vbar(0)
, hbar(0)
, text()
, inc_search()
, multi_select(false)
, mouse_select(false)
, drag_scroll(fc::noScroll)
, scroll_timer(false)
, scroll_repeat(100)
, scroll_distance(1)
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, max_line_width(0)
{
init();
insert (container, convert);

View File

@ -128,14 +128,14 @@ class FListViewItem : public FObject
void resetVisibleLineCounter();
// Data Members
FStringList column_list;
FWidget::data_ptr data_pointer;
FObjectIterator root;
std::size_t visible_lines;
bool expandable;
bool is_expand;
bool checkable;
bool is_checked;
FStringList column_list{};
FWidget::data_ptr data_pointer{nullptr};
FObjectIterator root{};
std::size_t visible_lines{1};
bool expandable{false};
bool is_expand{false};
bool checkable{false};
bool is_checked{false};
// Friend class
friend class FListView;
@ -198,7 +198,7 @@ class FListViewIterator
typedef std::stack<FObjectIterator> FObjectIteratorStack;
// Constructor
FListViewIterator ();
FListViewIterator () = default;
FListViewIterator (FObjectIterator);
// Overloaded operators
@ -226,9 +226,9 @@ class FListViewIterator
void prevElement (FObjectIterator&);
// Data Members
FObjectIteratorStack iter_path;
FObjectIterator node;
int position;
FObjectIteratorStack iter_path{};
FObjectIterator node{};
int position{0};
};
#pragma pack(pop)
@ -272,11 +272,15 @@ class FListView : public FWidget
using FWidget::setGeometry;
// Constructor
explicit FListView (FWidget* = 0);
explicit FListView (FWidget* = nullptr);
// Disable copy constructor
FListView (const FListView&) = delete;
// Destructor
virtual ~FListView();
// Disable assignment operator (=)
FListView& operator = (const FListView&) = delete;
// Accessors
const char* getClassName() const;
std::size_t getCount();
@ -311,14 +315,14 @@ class FListView : public FWidget
FObjectIterator insert (FListViewItem*);
FObjectIterator insert (FListViewItem*, FObjectIterator);
FObjectIterator insert ( const FStringList&
, data_ptr = 0 );
, data_ptr = nullptr );
FObjectIterator insert ( const FStringList&
, FObjectIterator );
FObjectIterator insert ( const FStringList&
, data_ptr
, FObjectIterator );
FObjectIterator insert ( const std::vector<long>&
, data_ptr = 0 );
, data_ptr = nullptr );
FObjectIterator insert ( const std::vector<long>&
, FObjectIterator );
FObjectIterator insert ( const std::vector<long>&
@ -344,7 +348,7 @@ class FListView : public FWidget
protected:
// Methods
void adjustViewport();
void adjustViewport (int);
virtual void adjustSize();
private:
@ -356,12 +360,6 @@ class FListView : public FWidget
// Constants
static const int USE_MAX_SIZE = -1;
// Disable copy constructor
FListView (const FListView&);
// Disable assignment operator (=)
FListView& operator = (const FListView&);
// Methods
void init();
template <typename Compare>
@ -382,11 +380,11 @@ class FListView : public FWidget
void drawColumnEllipsis ( headerItems::const_iterator&
, const FString& );
void updateDrawing (bool, bool);
int determineLineWidth (FListViewItem*);
std::size_t determineLineWidth (FListViewItem*);
void beforeInsertion (FListViewItem*);
void afterInsertion();
void recalculateHorizontalBar (int);
void recalculateVerticalBar (int);
void recalculateHorizontalBar (std::size_t);
void recalculateVerticalBar (std::size_t);
void mouseHeaderClicked();
void wheelUp (int);
void wheelDown (int);
@ -422,34 +420,34 @@ class FListView : public FWidget
void cb_HBarChange (FWidget*, data_ptr);
// Data Members
FObjectIterator root;
FObjectList selflist;
FObjectList itemlist;
FListViewIterator current_iter;
FListViewIterator first_visible_line;
FListViewIterator last_visible_line;
headerItems header;
FTermBuffer headerline;
FScrollbar* vbar;
FScrollbar* hbar;
fc::dragScroll drag_scroll;
int scroll_repeat;
int scroll_distance;
bool scroll_timer;
bool tree_view;
bool hide_sort_indicator;
bool has_checkable_items;
FPoint clicked_expander_pos;
FPoint clicked_header_pos;
const FListViewItem* clicked_checkbox_item;
int xoffset;
int nf_offset;
int max_line_width;
int sort_column;
sortTypes sort_type;
fc::sorting_order sort_order;
bool (*user_defined_ascending) (const FObject*, const FObject*);
bool (*user_defined_descending) (const FObject*, const FObject*);
FObjectIterator root{};
FObjectList selflist{};
FObjectList itemlist{};
FListViewIterator current_iter{};
FListViewIterator first_visible_line{};
FListViewIterator last_visible_line{};
headerItems header{};
FTermBuffer headerline{};
FScrollbar* vbar{nullptr};
FScrollbar* hbar{nullptr};
fc::dragScroll drag_scroll{fc::noScroll};
int scroll_repeat{100};
int scroll_distance{1};
bool scroll_timer{false};
bool tree_view{false};
bool hide_sort_indicator{false};
bool has_checkable_items{false};
FPoint clicked_expander_pos{-1, -1};
FPoint clicked_header_pos{-1, -1};
const FListViewItem* clicked_checkbox_item{nullptr};
int xoffset{0};
std::size_t nf_offset{0};
std::size_t max_line_width{1};
int sort_column{-1};
sortTypes sort_type{};
fc::sorting_order sort_order{fc::unsorted};
bool (*user_defined_ascending) (const FObject*, const FObject*){nullptr};
bool (*user_defined_descending) (const FObject*, const FObject*){nullptr};
// Friend class
friend class FListViewItem;
@ -466,17 +464,12 @@ class FListView : public FWidget
struct FListView::Header
{
public:
Header()
: name()
, width (0)
, fixed_width (false)
, alignment (fc::alignLeft)
{ }
Header() = default;
FString name;
int width;
bool fixed_width;
fc::text_alignment alignment;
FString name{};
int width{0};
bool fixed_width{false};
fc::text_alignment alignment{fc::alignLeft};
};
#pragma pack(pop)

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