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 - libgpm-dev
- gperf - gperf
- libcppunit-dev - libcppunit-dev
homebrew:
packages:
- autoconf-archive
env: env:
global: global:
@ -56,7 +59,7 @@ matrix:
- lsb_release -a - lsb_release -a
- uname -a - uname -a
- whoami - whoami
- sudo apt-get install gpm libgpm-dev libcppunit-dev - sudo apt-get install gpm libgpm-dev libcppunit-dev autoconf-archive
script: script:
- autoreconf -v --install --force - autoreconf -v --install --force
- ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test - ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
@ -85,9 +88,8 @@ matrix:
- os: osx - os: osx
env: env:
- TEST="macOS" - TEST="macOS"
before_install:
- uname -a
script: script:
- uname -a
- autoreconf -v --install --force - autoreconf -v --install --force
- ./configure --prefix=/usr - ./configure --prefix=/usr
- make -j10 - 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> 2018-11-25 Markus Gans <guru.mail@muenster.de>
* Version 0.5.0 * Version 0.5.0
* Namespace fix in FTermFreeBSD and FTermOpenBSD * Namespace fix in FTermFreeBSD and FTermOpenBSD

View File

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

View File

@ -1,4 +1,4 @@
examples/.libs/* usr/lib/finalcut/examples examples/.libs/* usr/share/doc/libfinal-examples/examples
examples/*.cpp usr/lib/finalcut/examples examples/*.cpp usr/share/doc/libfinal-examples/examples
examples/Makefile.clang usr/lib/finalcut/examples examples/Makefile.clang usr/share/doc/libfinal-examples/examples
examples/Makefile.gcc usr/lib/finalcut/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/share/doc/libfinal-examples/examples/Makefile.gcc usr/share/doc/libfinal-examples/examples/Makefile
usr/lib/finalcut/examples usr/share/doc/libfinal-examples/examples

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 // Constructors
FClassName(); FClassName();
// Disable copy constructor
FClassName (const FClassName&) = delete;
// Destructor // Destructor
~FClassName(); ~FClassName();
// Disable assignment operator (=)
FClassName& operator = (const FClassName&) = delete;
// Overloaded operators // Overloaded operators
// Accessors // Accessors
@ -100,12 +106,6 @@ class FClassName
// Constants // Constants
// Disable copy constructor
FClassName (const FClassName&);
// Disable assignment operator (=)
FClassName& operator = (const FClassName&);
// Accessors // Accessors
// Inquiries // Inquiries

View File

@ -104,7 +104,7 @@ You need three things:
* libgpm-dev * libgpm-dev
How to compile FINAL CUT without gpm support? How to compile FINAL CUT without GPM support?
--------------------------------------------- ---------------------------------------------
```bash ```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? 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 * If the color palette redefinition causes problems, you can switch off
the color mapping with the parameter *--no-color-change*. 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, *(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 After entering the source code in *dialog.cpp* you can compile

View File

@ -5,7 +5,7 @@
if ! CPPUNIT_TEST if ! CPPUNIT_TEST
AM_LDFLAGS = -L$(top_builddir)/src/.libs -lfinal 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 = \ noinst_PROGRAMS = \
hello \ hello \

View File

@ -9,7 +9,7 @@ BINDIR = /usr/local/bin
CXX = clang++ CXX = clang++
SRCS = $(wildcard *.cpp) SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%) OBJS = $(SRCS:%.cpp=%)
CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG) CCXFLAGS = $(OPTIMIZE) $(PROFILE) $(DEBUG) -std=c++11
MAKEFILE = -f Makefile.clang MAKEFILE = -f Makefile.clang
LDFLAGS = -L../src -lfinal LDFLAGS = -L../src -lfinal
INCLUDES = -I../src/include -I/usr/include/final INCLUDES = -I../src/include -I/usr/include/final
@ -29,7 +29,7 @@ endif
all: $(OBJS) all: $(OBJS)
debug: 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: profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg" $(MAKE) $(MAKEFILE) PROFILE="-pg"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@
static finalcut::FVTerm* terminal; static finalcut::FVTerm* terminal;
// Global FApplication object // Global FApplication object
static finalcut::FApplication* app; static finalcut::FApplication* app = nullptr;
// function prototype // function prototype
bool keyPressed(); bool keyPressed();
@ -201,5 +201,5 @@ int main (int argc, char* argv[])
// Waiting for keypress // Waiting for keypress
keyPressed(); 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: public:
// Constructor // Constructor
explicit Scrollview (finalcut::FWidget* = 0); explicit Scrollview (finalcut::FWidget* = nullptr);
// Disable copy constructor
Scrollview (const Scrollview&) = delete;
// Destructor // Destructor
~Scrollview (); ~Scrollview ();
// Disable assignment operator (=)
Scrollview& operator = (const Scrollview&) = delete;
// Mutator // Mutator
void setScrollSize (std::size_t, std::size_t); void setScrollSize (std::size_t, std::size_t);
private: private:
// Disable copy constructor
Scrollview (const Scrollview&);
// Disable assignment operator (=)
Scrollview& operator = (const Scrollview&);
// Method // Method
virtual void draw(); virtual void draw();
@ -58,28 +57,20 @@ class Scrollview : public finalcut::FScrollView
void cb_go_north (finalcut::FWidget*, data_ptr); void cb_go_north (finalcut::FWidget*, data_ptr);
// Data Members // Data Members
wchar_t pointer_right; wchar_t pointer_right{finalcut::fc::BlackRightPointingPointer};
wchar_t pointer_down; wchar_t pointer_down{finalcut::fc::BlackDownPointingTriangle};
wchar_t pointer_left; wchar_t pointer_left{finalcut::fc::BlackLeftPointingPointer};
wchar_t pointer_up; wchar_t pointer_up{finalcut::fc::BlackUpPointingTriangle};
finalcut::FButton go_east; finalcut::FButton go_east{pointer_right, this};
finalcut::FButton go_south; finalcut::FButton go_south{pointer_down, this};
finalcut::FButton go_west; finalcut::FButton go_west{pointer_left, this};
finalcut::FButton go_north; finalcut::FButton go_north{pointer_up, this};
}; };
#pragma pack(pop) #pragma pack(pop)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Scrollview::Scrollview (finalcut::FWidget* parent) Scrollview::Scrollview (finalcut::FWidget* parent)
: finalcut::FScrollView(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 // Sets the navigation button geometry
go_east.setGeometry (1, 1, 5, 1); go_east.setGeometry (1, 1, 5, 1);
@ -198,7 +189,7 @@ class Scrollviewdemo : public finalcut::FDialog
{ {
public: public:
// Constructor // Constructor
explicit Scrollviewdemo (finalcut::FWidget* = 0); explicit Scrollviewdemo (finalcut::FWidget* = nullptr);
// Destructor // Destructor
~Scrollviewdemo(); ~Scrollviewdemo();
@ -207,12 +198,12 @@ class Scrollviewdemo : public finalcut::FDialog
virtual void onClose (finalcut::FCloseEvent*); virtual void onClose (finalcut::FCloseEvent*);
// Callback method // Callback method
void cb_quit (finalcut::FWidget* = 0, data_ptr = 0); void cb_quit (finalcut::FWidget* = nullptr, data_ptr = nullptr);
// Data Members // Data Members
Scrollview sview; Scrollview sview{this};
finalcut::FButton quit_btn; finalcut::FButton quit_btn{"&Quit", this};
finalcut::FLabel label; finalcut::FLabel label{this};
}; };
#pragma pack(pop) #pragma pack(pop)
@ -220,9 +211,6 @@ class Scrollviewdemo : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent) Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog(parent)
, sview(this)
, quit_btn("&Quit", this)
, label(this)
{ {
setGeometry (16, 3, 50, 19); setGeometry (16, 3, 50, 19);
setText ("Scrolling viewport example"); setText ("Scrolling viewport example");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,18 +35,16 @@ class SmallWindow : public finalcut::FDialog
{ {
public: public:
// Constructor // Constructor
explicit SmallWindow (finalcut::FWidget* = 0); explicit SmallWindow (finalcut::FWidget* = nullptr);
// Disable copy constructor
SmallWindow (const SmallWindow&) = delete;
// Destructor // Destructor
~SmallWindow(); ~SmallWindow();
private:
// Disable copy constructor
SmallWindow (const SmallWindow&);
// Disable assignment operator (=) // Disable assignment operator (=)
SmallWindow& operator = (const SmallWindow&); SmallWindow& operator = (const SmallWindow&) = delete;
private:
// Method // Method
virtual void adjustSize(); virtual void adjustSize();
@ -55,22 +53,17 @@ class SmallWindow : public finalcut::FDialog
virtual void onTimer (finalcut::FTimerEvent*); virtual void onTimer (finalcut::FTimerEvent*);
// Data Members // Data Members
finalcut::FLabel left_arrow; finalcut::FLabel left_arrow{this};
finalcut::FLabel right_arrow; finalcut::FLabel right_arrow{this};
finalcut::FLabel top_left_label; finalcut::FLabel top_left_label{this};
finalcut::FLabel top_right_label; finalcut::FLabel top_right_label{this};
finalcut::FLabel bottom_label; finalcut::FLabel bottom_label{this};
}; };
#pragma pack(pop) #pragma pack(pop)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
SmallWindow::SmallWindow (finalcut::FWidget* parent) SmallWindow::SmallWindow (finalcut::FWidget* parent)
: finalcut::FDialog(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; wchar_t arrow_up, arrow_down;
arrow_up = finalcut::fc::BlackUpPointingTriangle; arrow_up = finalcut::fc::BlackUpPointingTriangle;
@ -171,43 +164,36 @@ class Window : public finalcut::FDialog
{ {
public: public:
// Constructor // Constructor
explicit Window (finalcut::FWidget* = 0); explicit Window (finalcut::FWidget* = nullptr);
// Disable copy constructor
Window (const Window&) = delete;
// Destructor // Destructor
~Window(); ~Window();
// Disable assignment operator (=)
Window& operator = (const Window&) = delete;
private: private:
// Typedefs // Typedefs
typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr); typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr);
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr); typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr);
class win_data struct win_data
{ {
public: // Constructor
win_data() win_data() = default;
: is_open(false) // Disable copy constructor
, title() win_data (const win_data&) = delete;
, dgl(0)
{ } // Disable assignment operator (=)
win_data& operator = (const win_data&) = delete;
// Data Members // Data Members
bool is_open; bool is_open{false};
finalcut::FString title; finalcut::FString title{};
SmallWindow* dgl; SmallWindow* dgl{nullptr};
private:
// Disable copy constructor
win_data (const win_data&);
// Disable assignment operator (=)
win_data& operator = (const win_data&);
}; };
// Disable copy constructor
Window (const Window&);
// Disable assignment operator (=)
Window& operator = (const Window&);
// Method // Method
void configureFileMenuItems(); void configureFileMenuItems();
void configureDialogButtons(); void configureDialogButtons();
@ -227,44 +213,28 @@ class Window : public finalcut::FDialog
void cb_destroyWindow (finalcut::FWidget*, data_ptr); void cb_destroyWindow (finalcut::FWidget*, data_ptr);
// Data Members // Data Members
std::vector<win_data*> windows; std::vector<win_data*> windows{};
finalcut::FString drop_down_symbol; finalcut::FString drop_down_symbol{finalcut::fc::BlackDownPointingTriangle};
finalcut::FMenuBar Menubar; finalcut::FMenuBar Menubar{this};
finalcut::FMenu File; finalcut::FMenu File{"&File", &Menubar};
finalcut::FDialogListMenu DglList; finalcut::FDialogListMenu DglList{drop_down_symbol, &Menubar};
finalcut::FStatusBar Statusbar; finalcut::FStatusBar Statusbar{this};
finalcut::FMenuItem New; finalcut::FMenuItem New{"&New", &File};
finalcut::FMenuItem Close; finalcut::FMenuItem Close{"&Close", &File};
finalcut::FMenuItem Line1; finalcut::FMenuItem Line1{&File};
finalcut::FMenuItem Next; finalcut::FMenuItem Next{"Ne&xt window", &File};
finalcut::FMenuItem Previous; finalcut::FMenuItem Previous{"&Previous window", &File};
finalcut::FMenuItem Line2; finalcut::FMenuItem Line2{&File};
finalcut::FMenuItem Quit; finalcut::FMenuItem Quit{"&Quit", &File};
finalcut::FButton CreateButton; finalcut::FButton CreateButton{this};
finalcut::FButton CloseButton; finalcut::FButton CloseButton{this};
finalcut::FButton QuitButton; finalcut::FButton QuitButton{this};
}; };
#pragma pack(pop) #pragma pack(pop)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Window::Window (finalcut::FWidget* parent) Window::Window (finalcut::FWidget* parent)
: finalcut::FDialog(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 // Menu bar item
File.setStatusbarMessage ("File management commands"); File.setStatusbarMessage ("File management commands");
@ -578,7 +548,7 @@ void Window::cb_destroyWindow (finalcut::FWidget*, data_ptr data)
if ( win_dat ) if ( win_dat )
{ {
win_dat->is_open = false; 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 # Copyright (c) 2018 by Markus Gans
# #
%define sover 0
Name: @PACKAGE@ Name: @PACKAGE@
%define libname libfinal
%define libsoname %{libname}0
Version: @VERSION@ Version: @VERSION@
Release: %{buildno} Release: %{buildno}
License: LGPL-3.0 Summary: Console widget library
Summary: The Final Cut License: LGPL-3.0-or-later
Url: https://github.com/gansm/finalcut/ Group: Development/Libraries/C and C++
Group: System/Libraries URL: https://github.com/gansm/finalcut/
Source: finalcut-%{version}.tar.gz Source: https://github.com/gansm/finalcut/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: automake BuildRequires: automake
BuildRequires: libtool
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: glib2-devel BuildRequires: glib2-devel
BuildRequires: gpm-devel
BuildRequires: libtool
BuildRequires: ncurses-devel 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 %description
The Final Cut is a class library and widget toolkit with full mouse The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports 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, common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on. 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++ Group: Development/Libraries/C and C++
Summary: Development files for the final cut library Requires: libfinal%{sover} = %{version}
Requires: %{libname} = %{version} Requires: bdftopcf
Requires: %{name} = %{version} 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 The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows 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, common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on. radio buttons, input lines, list boxes, status bars and so on.
%package -n %{libsoname} %package -n libfinal-examples
Group: System/Libraries Summary: Example files for The Final Cut library
Summary: Console widget toolkit Group: Development/Languages/C and C++
Provides: %{libname} = %{version} BuildArch: noarch
Provides: %{name} = %{version}
%description -n %{libsoname} %description -n libfinal-examples
The Final Cut is a class library and widget toolkit with full mouse The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows 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, common controls like dialog windows, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on. radio buttons, input lines, list boxes, status bars and so on.
%package static %package -n libfinal%{sover}
Group: System/Libraries
Summary: Console widget toolkit 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 The Final Cut is a class library and widget toolkit with full mouse
support for creating a text-based user interface. The library supports support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows 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. radio buttons, input lines, list boxes, status bars and so on.
%prep %prep
%setup -q -n %{name}-%{version} %setup -q
%build %build
autoreconf -v --install --force autoreconf -vif
%define warn_flags -Wall -Wextra -Wpedantic export CPPFLAGS="%{optflags} -Wall -Wextra -Wpedantic"
export CPPFLAGS="$RPM_OPT_FLAGS %{warn_flags}" %ifnarch %ix86 x86_64
export CPPFLAGS="$CPPFLAGS -Wno-error=unused-parameter"
%endif
%configure %configure
make %{?_smp_mflags} V=1 make %{?_smp_mflags} V=1
%install %install
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \ make install libdir=%{buildroot}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \ includedir=%{buildroot}%{_includedir} \
bindir=${RPM_BUILD_ROOT}%{_bindir} \ bindir=%{buildroot}%{_bindir} \
docdir=${RPM_BUILD_ROOT}%{_docdir}/finalcut/ docdir=%{buildroot}%{_docdir}/%{name}/
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples mkdir -p %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/.libs/* ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples cp -p examples/*.cpp %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/*.cpp ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples cp -p examples/Makefile.clang %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/Makefile.clang ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples cp -p examples/Makefile.gcc %{buildroot}%{_docdir}/%{name}/examples
cp -p examples/Makefile.gcc ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples rm -f %{buildroot}%{_libdir}/libfinal.la %{buildroot}%{_libdir}/%{name}/examples
rm -f ${RPM_BUILD_ROOT}%{_libdir}/libfinal.la rm %{buildroot}%{_docdir}/%{name}/ChangeLog %{buildroot}%{_docdir}/%{name}/COPYING.LESSER
%post -n %{libsoname} -p /sbin/ldconfig
%postun -n %{libsoname} -p /sbin/ldconfig
%clean %clean
rm -rf $RPM_BUILD_ROOT %{__rm} -rf %{buildroot}
%files devel %post -n libfinal%{sover} -p /sbin/ldconfig
%defattr(-,root,root) %postun -n libfinal%{sover} -p /sbin/ldconfig
%dir %{_docdir}/finalcut
%dir %{_libdir}/finalcut
%dir %{_libdir}/finalcut/examples
%{_docdir}/finalcut/*
%{_libdir}/pkgconfig/*
%{_libdir}/%{libname}.so
%{_libdir}/finalcut/*
%{_includedir}/*
%files -n %{libsoname} %files -n libfinal-devel
%defattr(-,root,root) %if 0%{?sle_version} > 120200 || 0%{?suse_version} > 1500
%_libdir/%{libname}.so.* %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) %defattr (-,root,root)
%{_libdir}/%{libname}.a %{_libdir}/libfinal.a
%changelog %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 # 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 = . SUBDIRS = .

View File

@ -3,7 +3,7 @@
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# This is where make install will install the library # This is where make install will install the library
VERSION = "0.5.0" VERSION = "0.5.1"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1) MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final INCLUDEDIR1 = include/final
@ -63,7 +63,7 @@ INCLUDE_HEADERS = \
# compiler parameter # compiler parameter
CXX = clang++ 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 MAKEFILE = -f Makefile.clang
LDFLAGS = $(TERMCAP) -lgpm LDFLAGS = $(TERMCAP) -lgpm
INCLUDES = -Iinclude INCLUDES = -Iinclude
@ -149,7 +149,7 @@ all: dep $(OBJS)
$(LIB): all $(LIB): all
debug: 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: profile:
$(MAKE) $(MAKEFILE) PROFILE="-pg" $(MAKE) $(MAKEFILE) PROFILE="-pg"
@ -179,7 +179,7 @@ clean:
$(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.gch *.plist *~ $(RM) $(LIB)* $(OBJS) .depend *.gcno *.gcda *.gch *.plist *~
dep: 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 # include .depend if it exists

View File

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

View File

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

View File

@ -35,24 +35,6 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButton::FButton(FWidget* parent) FButton::FButton(FWidget* parent)
: 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(); init();
} }
@ -60,27 +42,9 @@ FButton::FButton(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButton::FButton (const FString& txt, FWidget* parent) FButton::FButton (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , 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)
{ {
init(); init();
detectHotkey();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -449,6 +413,9 @@ void FButton::init()
setForegroundColor (wc.button_active_fg); setForegroundColor (wc.button_active_fg);
setBackgroundColor (wc.button_active_bg); setBackgroundColor (wc.button_active_bg);
setShadow(); setShadow();
if ( ! text.isEmpty() )
detectHotkey();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -651,7 +618,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
else else
center_offset = (getWidth() - txtlength - 1) / 2; center_offset = (getWidth() - txtlength - 1) / 2;
// Print button text line -------- // Print button text line
for (pos = 0; pos < center_offset; pos++) for (pos = 0; pos < center_offset; pos++)
print (space_char); // █ print (space_char); // █

View File

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

View File

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

View File

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

View File

@ -32,7 +32,7 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FEvent::FEvent(int ev_type) // constructor 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 FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, k(key_num) , k{key_num}
, accpt(false)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -81,22 +80,19 @@ void FKeyEvent::ignore()
FMouseEvent::FMouseEvent ( int ev_type // constructor FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos
, int button ) , int button )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p{pos}
, tp() , tp{termPos}
, b(button) , b{button}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type // constructor FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos
, int button ) , int button )
: FEvent(ev_type) : FMouseEvent(ev_type, pos, FPoint(), button)
, p(pos)
, tp(termPos)
, b(button)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -138,22 +134,19 @@ int FMouseEvent::getButton() const
FWheelEvent::FWheelEvent ( int ev_type // constructor FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos
, int wheel ) , int wheel )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p{pos}
, tp() , tp{termPos}
, w(wheel) , w{wheel}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWheelEvent::FWheelEvent ( int ev_type // constructor FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos
, int wheel ) , int wheel )
: FEvent(ev_type) : FWheelEvent(ev_type, pos, FPoint(), wheel)
, p(pos)
, tp(termPos)
, w(wheel)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -195,8 +188,6 @@ int FWheelEvent::getWheel() const
FFocusEvent::FFocusEvent (int ev_type) // constructor FFocusEvent::FFocusEvent (int ev_type) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, accpt(true)
, focus_type(fc::FocusDefiniteWidget)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -242,8 +233,7 @@ void FFocusEvent::ignore()
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, accpt(false) , focus_widget{focused}
, focus_widget(focused)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -273,7 +263,6 @@ void FAccelEvent::ignore()
FResizeEvent::FResizeEvent(int ev_type) // constructor FResizeEvent::FResizeEvent(int ev_type) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, accpt(false)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -323,7 +312,6 @@ FHideEvent::~FHideEvent() // destructor
FCloseEvent::FCloseEvent(int ev_type) // constructor FCloseEvent::FCloseEvent(int ev_type) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, accpt(false)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -349,7 +337,7 @@ void FCloseEvent::ignore()
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
: FEvent(ev_type) : 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) FFileDialog::FFileDialog (FWidget* parent)
: FDialog(parent) : FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern()
, filename()
, filebrowser()
, hidden()
, cancel()
, open()
, dlg_type(FFileDialog::Open)
, show_hidden(false)
{ {
init(); init();
} }
@ -74,20 +63,9 @@ FFileDialog::FFileDialog (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FFileDialog::FFileDialog (const FFileDialog& fdlg) FFileDialog::FFileDialog (const FFileDialog& fdlg)
: FDialog(fdlg.getParentWidget()) : 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 ) if ( fdlg.directory )
setPath(directory); setPath(fdlg.directory);
init(); init();
} }
@ -98,17 +76,8 @@ FFileDialog::FFileDialog ( const FString& dirname
, DialogType type , DialogType type
, FWidget* parent ) , FWidget* parent )
: FDialog(parent) : FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern(filter) , filter_pattern(filter)
, filename(this)
, filebrowser(this)
, hidden(this)
, cancel(this)
, open(this)
, dlg_type(type) , dlg_type(type)
, show_hidden(false)
{ {
if ( ! dirname.isNull() ) if ( ! dirname.isNull() )
setPath(dirname); setPath(dirname);

View File

@ -31,10 +31,10 @@ namespace finalcut
// static class attributes // static class attributes
long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress) long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
struct timeval FKeyboard::time_keypressed; struct timeval FKeyboard::time_keypressed{};
#if defined(__linux__) #if defined(__linux__)
FTermLinux* FKeyboard::linux = 0; FTermLinux* FKeyboard::linux = nullptr;
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -45,12 +45,9 @@ struct timeval FKeyboard::time_keypressed;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyboardCommand::FKeyboardCommand ( FApplication* object FKeyboardCommand::FKeyboardCommand ( FApplication* object
, void(FApplication::*method)() ) , void(FApplication::*method)() )
: instance(0) : instance(object)
, handler(0) , handler(method)
{ { }
instance = object;
handler = method;
}
// public methods of FKeyboardCommand // public methods of FKeyboardCommand
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -67,18 +64,6 @@ void FKeyboardCommand::execute()
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyboard::FKeyboard() 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 // Initialize keyboard values
time_keypressed.tv_sec = 0; time_keypressed.tv_sec = 0;
@ -89,10 +74,6 @@ FKeyboard::FKeyboard()
if ( stdin_status_flags == -1 ) if ( stdin_status_flags == -1 )
std::abort(); 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) FLabel::FLabel(FWidget* parent)
: 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(); init();
} }
@ -51,15 +42,7 @@ FLabel::FLabel(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel::FLabel (const FString& txt, FWidget* parent) FLabel::FLabel (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, multiline_text()
, multiline(false)
, text(txt) , 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(); init();
setText(txt); setText(txt);
@ -86,6 +69,13 @@ FLabel& FLabel::operator << (const FString& s)
return *this; return *this;
} }
//----------------------------------------------------------------------
FLabel& FLabel::operator << (fc::SpecialCharacter c)
{
setText(text + static_cast<wchar_t>(c));
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel& FLabel::operator << (const wchar_t c) 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) void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
{ {
accel_widget = 0; accel_widget = nullptr;
delAccelerator(); delAccelerator();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,19 +39,6 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (FWidget* parent) FMenuItem::FMenuItem (FWidget* parent)
: 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); init (parent);
} }
@ -60,18 +47,6 @@ FMenuItem::FMenuItem (FWidget* parent)
FMenuItem::FMenuItem (const FString& txt, FWidget* parent) FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , 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); init (parent);
} }
@ -80,18 +55,7 @@ FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent) FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , text(txt)
, selected(false)
, separator(false)
, checkable(false)
, checked(false)
, radio_button(false)
, dialog_index(false)
, text_length(0)
, hotkey(0)
, accel_key(k) , accel_key(k)
, menu(0)
, super_menu(0)
, associated_window(0)
{ {
init (parent); init (parent);
} }
@ -288,23 +252,20 @@ void FMenuItem::delAccelerator (FWidget* obj)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::openMenu() void FMenuItem::openMenu()
{ {
FMenu* dd_menu; // Drop-down menu
FMenu* open_menu;
if ( ! hasMenu() ) if ( ! hasMenu() )
return; return;
dd_menu = getMenu(); // Drop-down menu FMenu* dd_menu = getMenu(); // Drop-down menu
if ( dd_menu->isVisible() ) if ( dd_menu->isVisible() )
return; 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(); openmenu->hide();
open_menu->hideSubMenus(); openmenu->hideSubMenus();
} }
if ( dialog_index ) if ( dialog_index )
@ -498,7 +459,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
else else
{ {
unsetSelected(); unsetSelected();
mbar->selected_item = 0; mbar->selected_item = nullptr;
mbar->redraw(); mbar->redraw();
processClicked(); processClicked();
mbar->drop_down = false; mbar->drop_down = false;
@ -575,7 +536,7 @@ FMenuList* FMenuItem::getFMenuList (FWidget& widget)
menu_list = static_cast<FMenuList*>(Menubar); menu_list = static_cast<FMenuList*>(Menubar);
} }
else else
menu_list = 0; menu_list = nullptr;
return menu_list; return menu_list;
} }
@ -774,8 +735,8 @@ void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
if ( win ) if ( win )
{ {
FWidget* focus_widget = getFocusWidget(); FWidget* focus = getFocusWidget();
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, focus);
FApplication::sendEvent (win, &a_ev); FApplication::sendEvent (win, &a_ev);
} }
} }
@ -790,7 +751,7 @@ void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
{ {
delAccelerator(win); delAccelerator(win);
delCallback(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 * * 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 * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -32,12 +32,6 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructor and destructor // constructor and destructor
//----------------------------------------------------------------------
FMenuList::FMenuList()
: selected_item()
, item_list()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuList::~FMenuList() // destructor FMenuList::~FMenuList() // destructor
{ {

View File

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

View File

@ -40,16 +40,6 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouse::FMouse() 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_sec = 0;
time_mousepressed.tv_usec = 0; time_mousepressed.tv_usec = 0;
@ -237,10 +227,6 @@ bool FMouse::isDblclickTimeout (timeval* time)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseGPM::FMouseGPM() FMouseGPM::FMouseGPM()
: FMouse() : FMouse()
, gpm_ev()
, has_gpm_mouse_data(false)
, gpm_mouse_enabled(false)
, stdin_no(0)
{ {
gpm_ev.x = -1; gpm_ev.x = -1;
} }
@ -283,6 +269,14 @@ void FMouseGPM::processEvent (struct timeval*)
{ {
Gpm_FitEvent (&gpm_ev); 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 ) if ( gpm_ev.type & GPM_DRAG && gpm_ev.wdx == 0 && gpm_ev.wdy == 0 )
b_state.mouse_moved = true; b_state.mouse_moved = true;
@ -295,6 +289,84 @@ void FMouseGPM::processEvent (struct timeval*)
{ {
case GPM_DOWN: case GPM_DOWN:
case GPM_DRAG: 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.buttons & GPM_B_LEFT )
{ {
if ( gpm_ev.type & GPM_DOUBLE ) if ( gpm_ev.type & GPM_DOUBLE )
@ -324,10 +396,11 @@ void FMouseGPM::processEvent (struct timeval*)
if ( gpm_ev.modifiers & (1 << KG_CTRL) ) if ( gpm_ev.modifiers & (1 << KG_CTRL) )
b_state.control_button = true; b_state.control_button = true;
}
break; //----------------------------------------------------------------------
void FMouseGPM::interpretKeyUp()
case GPM_UP: {
if ( gpm_ev.buttons & GPM_B_LEFT ) if ( gpm_ev.buttons & GPM_B_LEFT )
b_state.left_button = Released; b_state.left_button = Released;
@ -336,61 +409,6 @@ void FMouseGPM::processEvent (struct timeval*)
if ( gpm_ev.buttons & GPM_B_RIGHT ) if ( gpm_ev.buttons & GPM_B_RIGHT )
b_state.right_button = Released; 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 // 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 // public methods of FMouseX11
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FMouseX11::getClassName() const const char* FMouseX11::getClassName() const
@ -663,21 +666,6 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
// class FMouseSGR // 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 // public methods of FMouseSGR
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FMouseSGR::getClassName() const const char* FMouseSGR::getClassName() const
@ -917,21 +905,6 @@ void FMouseSGR::setReleasedButtonState (int btn)
// class FMouseUrxvt // 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 // public methods of FMouseUrxvt
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FMouseUrxvt::getClassName() const const char* FMouseUrxvt::getClassName() const
@ -1198,11 +1171,6 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseControl::FMouseControl() FMouseControl::FMouseControl()
: mouse_protocol()
, iter()
, zero_point(0, 0)
, use_gpm_mouse(false)
, use_xterm_mouse(false)
{ {
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
mouse_protocol[FMouse::gpm] = FMouse::createMouseObject(FMouse::gpm); mouse_protocol[FMouse::gpm] = FMouse::createMouseObject(FMouse::gpm);
@ -1484,21 +1452,26 @@ bool FMouseControl::isInputDataPending()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
bool FMouseControl::isGpmMouseEnabled() bool FMouseControl::isGpmMouseEnabled()
{ {
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return false; return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm]; FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse); FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
return gpm_mouse->isGpmMouseEnabled(); return gpm_mouse->isGpmMouseEnabled();
#endif // F_HAVE_LIBGPM
return false; return false;
} }
#else // F_HAVE_LIBGPM
bool FMouseControl::isGpmMouseEnabled()
{
return false;
}
#endif // F_HAVE_LIBGPM
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseControl::enable() void FMouseControl::enable()
@ -1559,43 +1532,43 @@ void FMouseControl::processEvent (struct timeval* time)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
bool FMouseControl::getGpmKeyPressed (bool pending) bool FMouseControl::getGpmKeyPressed (bool pending)
#else
bool FMouseControl::getGpmKeyPressed (bool)
#endif // F_HAVE_LIBGPM
{ {
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return false; return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm]; FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse); FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
return gpm_mouse->getGpmKeyPressed(pending); return gpm_mouse->getGpmKeyPressed(pending);
#endif // F_HAVE_LIBGPM
return false; return false;
} }
#else // F_HAVE_LIBGPM
bool FMouseControl::getGpmKeyPressed (bool)
{
return false;
}
#endif // F_HAVE_LIBGPM
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
void FMouseControl::drawGpmPointer() void FMouseControl::drawGpmPointer()
{ {
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return; return;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm]; FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse); FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
gpm_mouse->drawGpmPointer(); gpm_mouse->drawGpmPointer();
#endif // F_HAVE_LIBGPM
} }
#else // F_HAVE_LIBGPM
void FMouseControl::drawGpmPointer()
{ }
#endif // F_HAVE_LIBGPM
// private methods of FMouseControl // private methods of FMouseControl

View File

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

View File

@ -34,57 +34,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiAttr::FOptiAttr() 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 // Set bits that must not be reset
reset_byte_mask.attr.bit.transparent = true; reset_byte_mask.attr.bit.transparent = true;
reset_byte_mask.attr.bit.trans_shadow = true; reset_byte_mask.attr.bit.trans_shadow = true;

View File

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

View File

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

View File

@ -35,24 +35,6 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FScrollbar::FScrollbar(FWidget* parent) FScrollbar::FScrollbar(FWidget* parent)
: 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 // The default scrollbar orientation is vertical
setGeometry(1, 1, 1, length, false); setGeometry(1, 1, 1, length, false);
@ -62,24 +44,6 @@ FScrollbar::FScrollbar(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FScrollbar::FScrollbar(int o, FWidget* parent) FScrollbar::FScrollbar(int o, FWidget* parent)
: 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); setOrientation (o);
init(); init();
@ -118,15 +82,21 @@ void FScrollbar::setRange (int minimum, int maximum)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setValue (int value) void FScrollbar::setValue (int value)
{ {
if ( value < min )
val = min;
else if ( value > max )
val = max;
else
val = value; val = value;
calculateSliderValues(); calculateSliderValues();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setSteps (double st) void FScrollbar::setSteps (double st)
{ {
if ( st <= 0 ) if ( st <= 0.0 )
steps = 1; steps = 1.0;
else else
steps = st; steps = st;
@ -145,6 +115,10 @@ void FScrollbar::setPageSize (int document_size, int page_size)
else else
{ {
pagesize = page_size; pagesize = page_size;
if ( document_size <= 0 || page_size <= 0 )
steps = 1.0;
else
steps = double(double(document_size) / double(page_size)); steps = double(double(document_size) / double(page_size));
} }
} }
@ -221,9 +195,9 @@ void FScrollbar::redraw()
void FScrollbar::calculateSliderValues() void FScrollbar::calculateSliderValues()
{ {
if ( isNewFont() && bar_orientation == fc::horizontal ) if ( isNewFont() && bar_orientation == fc::horizontal )
bar_length = length - 4; bar_length = ( length > 2 ) ? length - 4 : 1;
else else
bar_length = length - 2; bar_length = ( length > 2 ) ? length - 2 : 1;
slider_length = std::size_t(double(bar_length) / steps); slider_length = std::size_t(double(bar_length) / steps);
@ -244,13 +218,15 @@ void FScrollbar::calculateSliderValues()
return; 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) slider_pos = int( round ( double((bar_length - slider_length) * v)
/ double(max - min) ) ); / double(max - min) ) );
if ( slider_pos < 0 ) if ( slider_pos > int(bar_length - slider_length) )
slider_pos = 0;
else if ( slider_pos > int(bar_length - slider_length) )
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) FScrollView::FScrollView (FWidget* parent)
: 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); init(parent);
} }
@ -56,7 +45,7 @@ FScrollView::~FScrollView() // destructor
delete vbar; delete vbar;
delete hbar; delete hbar;
removeArea (viewport); removeArea (viewport);
child_print_area = viewport = 0; child_print_area = viewport = nullptr;
} }
@ -541,12 +530,12 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
FRect widget_geometry; FRect widget_geometry;
FRect vp_geometry; FRect vp_geometry;
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus = FWidget::getFocusWidget();
if ( ! focus_widget ) if ( ! focus )
return; return;
widget_geometry = focus_widget->getGeometryWithShadow(); widget_geometry = focus->getGeometryWithShadow();
vp_geometry = viewport_geometry; vp_geometry = viewport_geometry;
vp_geometry.move(1, 1); vp_geometry.move(1, 1);
@ -578,13 +567,13 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
{ {
// Change the focus away from FScrollView to another widget // Change the focus away from FScrollView to another widget
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus = FWidget::getFocusWidget();
if ( out_ev->getFocusType() == fc::FocusNextWidget ) if ( out_ev->getFocusType() == fc::FocusNextWidget )
{ {
FWidget* last_widget = getLastFocusableWidget(getChildren()); FWidget* last_widget = getLastFocusableWidget(getChildren());
if ( focus_widget == last_widget ) if ( focus == last_widget )
{ {
out_ev->accept(); out_ev->accept();
focusNextChild(); focusNextChild();
@ -594,7 +583,7 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
{ {
FWidget* first_widget = getFirstFocusableWidget(getChildren()); FWidget* first_widget = getFirstFocusableWidget(getChildren());
if ( focus_widget == first_widget ) if ( focus == first_widget )
{ {
out_ev->accept(); out_ev->accept();
focusPrevChild(); focusPrevChild();
@ -611,7 +600,7 @@ FVTerm::term_area* FScrollView::getPrintArea()
if ( use_own_print_area || ! viewport ) if ( use_own_print_area || ! viewport )
{ {
child_print_area = 0; child_print_area = nullptr;
term_area* area = FWidget::getPrintArea(); term_area* area = FWidget::getPrintArea();
child_print_area = viewport; child_print_area = viewport;
return area; return area;
@ -995,7 +984,7 @@ void FScrollView::cb_HBarChange (FWidget*, data_ptr)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FScrollView::redrawHBar() inline void FScrollView::redrawHBar()
{ {
child_print_area = 0; child_print_area = nullptr;
if ( hbar->isVisible() ) if ( hbar->isVisible() )
hbar->redraw(); hbar->redraw();
@ -1006,7 +995,7 @@ inline void FScrollView::redrawHBar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FScrollView::redrawVBar() inline void FScrollView::redrawVBar()
{ {
child_print_area = 0; child_print_area = nullptr;
if ( vbar->isVisible() ) if ( vbar->isVisible() )
vbar->redraw(); vbar->redraw();
@ -1017,7 +1006,7 @@ inline void FScrollView::redrawVBar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FScrollView::drawHBar() inline void FScrollView::drawHBar()
{ {
child_print_area = 0; child_print_area = nullptr;
if ( hbar->isVisible() ) if ( hbar->isVisible() )
hbar->drawBar(); hbar->drawBar();
@ -1028,7 +1017,7 @@ inline void FScrollView::drawHBar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FScrollView::drawVBar() inline void FScrollView::drawVBar()
{ {
child_print_area = 0; child_print_area = nullptr;
if ( vbar->isVisible() ) if ( vbar->isVisible() )
vbar->drawBar(); vbar->drawBar();

View File

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

View File

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

View File

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

View File

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

View File

@ -30,19 +30,10 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTermBuffer // class FTermBuffer
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermBuffer::FTermBuffer()
: data()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermBuffer::~FTermBuffer() // destructor FTermBuffer::~FTermBuffer() // destructor
{ } { }
// public methods of FTermBuffer // public methods of FTermBuffer
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermBuffer::writef (const FString format, ...) 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::max_color = 1;
int FTermcap::tabstop = 8; int FTermcap::tabstop = 8;
int FTermcap::attr_without_color = 0; int FTermcap::attr_without_color = 0;
FTermData* FTermcap::fterm_data = 0; FTermData* FTermcap::fterm_data = nullptr;
FTermDetection* FTermcap::term_detection = 0; FTermDetection* FTermcap::term_detection = nullptr;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTermcap // class FTermcap
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermcap::FTermcap()
{ }
//----------------------------------------------------------------------
FTermcap::~FTermcap() // destructor
{ }
/* Terminal capability data base /* Terminal capability data base
* ----------------------------- * -----------------------------
* Info under: man 5 terminfo * Info under: man 5 terminfo

View File

@ -26,9 +26,9 @@ namespace finalcut
{ {
// static class attributes // static class attributes
FTermcap::tcap_map* FTermcapQuirks::tcap = 0; FTermcap::tcap_map* FTermcapQuirks::tcap = nullptr;
FTermData* FTermcapQuirks::fterm_data = 0; FTermData* FTermcapQuirks::fterm_data = nullptr;
FTermDetection* FTermcapQuirks::term_detection = 0; 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_bold_mode) = C_STR(CSI "22m");
TCAP(fc::t_exit_blink_mode) = C_STR(CSI "25m"); TCAP(fc::t_exit_blink_mode) = C_STR(CSI "25m");
TCAP(fc::t_exit_reverse_mode) = C_STR(CSI "27m"); TCAP(fc::t_exit_reverse_mode) = C_STR(CSI "27m");
TCAP(fc::t_exit_secure_mode) = 0; TCAP(fc::t_exit_secure_mode) = nullptr;
TCAP(fc::t_exit_protected_mode) = 0; TCAP(fc::t_exit_protected_mode) = nullptr;
TCAP(fc::t_exit_crossed_out_mode) = 0; TCAP(fc::t_exit_crossed_out_mode) = nullptr;
TCAP(fc::t_orig_pair) = C_STR(CSI "39;49;25m"); TCAP(fc::t_orig_pair) = C_STR(CSI "39;49;25m");
// Avoid underline and dim mode // Avoid underline and dim mode
TCAP(fc::t_enter_dim_mode) = 0; TCAP(fc::t_enter_dim_mode) = nullptr;
TCAP(fc::t_exit_dim_mode) = 0; TCAP(fc::t_exit_dim_mode) = nullptr;
TCAP(fc::t_enter_underline_mode) = 0; TCAP(fc::t_enter_underline_mode) = nullptr;
TCAP(fc::t_exit_underline_mode) = 0; 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 }; { 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::colorEnv FTermDetection::color_env;
FTermDetection::secondaryDA FTermDetection::secondary_da; FTermDetection::secondaryDA FTermDetection::secondary_da;
FTermData* FTermDetection::fterm_data = 0; FTermData* FTermDetection::fterm_data = nullptr;
char FTermDetection::termtype[256] = { }; char FTermDetection::termtype[256] = { };
char FTermDetection::ttytypename[256] = { }; char FTermDetection::ttytypename[256] = { };
bool FTermDetection::decscusr_support; bool FTermDetection::decscusr_support;
bool FTermDetection::terminal_detection; bool FTermDetection::terminal_detection;
bool FTermDetection::color256; bool FTermDetection::color256;
const FString* FTermDetection::answer_back = 0; const FString* FTermDetection::answer_back = nullptr;
const FString* FTermDetection::sec_da = 0; const FString* FTermDetection::sec_da = nullptr;
int FTermDetection::gnome_terminal_id; int FTermDetection::gnome_terminal_id;
#if DEBUG #if DEBUG
@ -182,7 +182,7 @@ bool FTermDetection::getTTYtype()
{ {
char* name; char* name;
char* type; char* type;
type = name = 0; // 0 == not found type = name = nullptr; // nullptr == not found
p = str; p = str;
while ( *p ) while ( *p )
@ -311,7 +311,7 @@ void FTermDetection::detectTerminal()
{ {
// Terminal detection // Terminal detection
char* new_termtype = 0; char* new_termtype = nullptr;
if ( terminal_detection ) if ( terminal_detection )
{ {
@ -359,7 +359,7 @@ void FTermDetection::detectTerminal()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FTermDetection::init_256colorTerminal() char* FTermDetection::init_256colorTerminal()
{ {
char* new_termtype = 0; char* new_termtype = nullptr;
if ( get256colorEnvString() ) if ( get256colorEnvString() )
color256 = true; color256 = true;
@ -422,7 +422,7 @@ bool FTermDetection::get256colorEnvString()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FTermDetection::termtype_256color_quirks() char* FTermDetection::termtype_256color_quirks()
{ {
char* new_termtype = 0; char* new_termtype = nullptr;
if ( ! color256 ) if ( ! color256 )
return new_termtype; return new_termtype;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,17 +31,17 @@ namespace finalcut
{ {
// global FWidget object // global FWidget object
static FWidget* rootObject = 0; static FWidget* rootObject = nullptr;
// static class attributes // static class attributes
FStatusBar* FWidget::statusbar = 0; FStatusBar* FWidget::statusbar = nullptr;
FMenuBar* FWidget::menubar = 0; FMenuBar* FWidget::menubar = nullptr;
FWidget* FWidget::show_root_widget = 0; FWidget* FWidget::show_root_widget = nullptr;
FWidget* FWidget::redraw_root_widget = 0; FWidget* FWidget::redraw_root_widget = nullptr;
FWidget::widgetList* FWidget::window_list = 0; FWidget::widgetList* FWidget::window_list = nullptr;
FWidget::widgetList* FWidget::dialog_list = 0; FWidget::widgetList* FWidget::dialog_list = nullptr;
FWidget::widgetList* FWidget::always_on_top_list = 0; FWidget::widgetList* FWidget::always_on_top_list = nullptr;
FWidget::widgetList* FWidget::close_widget = 0; FWidget::widgetList* FWidget::close_widget = nullptr;
FWidgetColors FWidget::wc; FWidgetColors FWidget::wc;
bool FWidget::init_desktop; bool FWidget::init_desktop;
bool FWidget::hideable; bool FWidget::hideable;
@ -57,26 +57,6 @@ uInt FWidget::modal_dialogs;
FWidget::FWidget (FWidget* parent, bool disable_alt_screen) FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
: FVTerm(bool(! parent), disable_alt_screen) : FVTerm(bool(! parent), disable_alt_screen)
, FObject(parent) , 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 // init bit field with 0
memset (&flags, 0, sizeof(flags)); 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.visible = true; // A widget is visible by default
flags.focusable = true; // A widget is focusable by default flags.focusable = true; // A widget is focusable by default
flags.visible_cursor = true; // A widget has a visible cursor 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 ) if ( ! parent )
{ {
@ -93,10 +73,10 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
&& "FTerm: There should be only one root object" ); && "FTerm: There should be only one root object" );
rootObject = this; rootObject = this;
show_root_widget = 0; show_root_widget = nullptr;
redraw_root_widget = 0; redraw_root_widget = nullptr;
modal_dialogs = 0; modal_dialogs = 0;
statusbar = 0; statusbar = nullptr;
init(); init();
} }
else else
@ -1037,7 +1017,7 @@ void FWidget::redraw()
{ {
updateTerminal(); updateTerminal();
flush_out(); flush_out();
redraw_root_widget = 0; redraw_root_widget = nullptr;
} }
} }
@ -1114,7 +1094,7 @@ void FWidget::show()
finishTerminalUpdate(); finishTerminalUpdate();
updateTerminal(); updateTerminal();
flush_out(); flush_out();
show_root_widget = 0; show_root_widget = nullptr;
} }
FShowEvent show_ev (fc::Show_Event); FShowEvent show_ev (fc::Show_Event);
@ -1689,7 +1669,7 @@ bool FWidget::focusNextChild()
continue; continue;
} }
FWidget* next = 0; FWidget* next = nullptr;
constFObjectIterator next_element; constFObjectIterator next_element;
next_element = iter; next_element = iter;
@ -1750,7 +1730,7 @@ bool FWidget::focusPrevChild()
if ( w != this ) if ( w != this )
continue; continue;
FWidget* prev = 0; FWidget* prev = nullptr;
constFObjectIterator prev_element; constFObjectIterator prev_element;
prev_element = iter; prev_element = iter;
@ -1999,30 +1979,30 @@ void FWidget::init()
void FWidget::finish() void FWidget::finish()
{ {
delete accelerator_list; delete accelerator_list;
accelerator_list = 0; accelerator_list = nullptr;
if ( close_widget ) if ( close_widget )
{ {
delete close_widget; delete close_widget;
close_widget = 0; close_widget = nullptr;
} }
if ( dialog_list ) if ( dialog_list )
{ {
delete dialog_list; delete dialog_list;
dialog_list = 0; dialog_list = nullptr;
} }
if ( always_on_top_list ) if ( always_on_top_list )
{ {
delete always_on_top_list; delete always_on_top_list;
always_on_top_list = 0; always_on_top_list = nullptr;
} }
if ( window_list ) if ( window_list )
{ {
delete window_list; delete window_list;
window_list = 0; window_list = nullptr;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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