commit
25a068590f
|
@ -1,4 +1,4 @@
|
|||
PROJECT_NAME = "The Final Cut"
|
||||
PROJECT_NAME = "FINAL CUT"
|
||||
EXCLUDE = debian, doc, icon, logo, m4, scripts, examples
|
||||
EXCLUDE_PATTERNS = */test/*
|
||||
|
||||
|
|
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
2019-01-03 Markus Gans <guru.mail@muenster.de>
|
||||
* Improved PC encoding for Cygwin and Linux
|
||||
* Integration of an output filter to replace missing characters
|
||||
* Better Linux console support for UTF-8 encoding
|
||||
(Default is PC charset encoding)
|
||||
|
||||
2018-12-31 Markus Gans <guru.mail@muenster.de>
|
||||
* Use the override specifier
|
||||
|
||||
2018-12-30 Markus Gans <guru.mail@muenster.de>
|
||||
* Cygwin compiled fix for C++11
|
||||
|
||||
2018-12-29 Markus Gans <guru.mail@muenster.de>
|
||||
* Text scrolling in FTextView was broken since February 17th!
|
||||
* Replace redundant FString code with templates
|
||||
|
||||
2018-12-28 Markus Gans <guru.mail@muenster.de>
|
||||
* Add the assignment operator (=) for FButton to set the button text
|
||||
* Corrected shortening of overlong texts in the title bar of FDialog
|
||||
* Add a "signals and callbacks" chapter into the first steps document
|
||||
|
||||
2018-12-25 Markus Gans <guru.mail@muenster.de>
|
||||
* Add a "event processing" chapter into the first steps document
|
||||
|
||||
2018-12-24 Markus Gans <guru.mail@muenster.de>
|
||||
* Events can not only be sent to FWidgets, but also to FObjects
|
||||
* New event FUserEvent for user-defined events
|
||||
|
||||
2018-12-19 Markus Gans <guru.mail@muenster.de>
|
||||
* Use of smart pointers
|
||||
* Add a "memory management" chapter into the first steps document
|
||||
|
||||
2018-12-17 Markus Gans <guru.mail@muenster.de>
|
||||
* Improve FButton mouse click animation
|
||||
* Minor data type corrections
|
||||
|
@ -5,7 +37,7 @@
|
|||
|
||||
2018-12-15 Markus Gans <guru.mail@muenster.de>
|
||||
* Use of the C++11 auto specifier in the program code
|
||||
* Code reduction by using of Range-based for loop
|
||||
* Code reduction by using of range-based for loop
|
||||
* The example program for video attributes now replaces
|
||||
the switch statement with a vector of lambda expressions
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#----------------------------------------------------------------------
|
||||
# Makefile.am - The Final Cut terminal programming library
|
||||
# Makefile.am - FINAL CUT terminal programming library
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#----------------------------------------------------------------------
|
||||
# configure.ac - the Final Cut library
|
||||
# configure.ac - FINAL CUT library
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#----------------------------------------------------------------------
|
||||
# Makefile.am - the Final Cut library
|
||||
# Makefile.am - FINAL CUT library
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
docdir = ${datadir}/doc/${PACKAGE}
|
||||
|
|
|
@ -97,3 +97,550 @@ the result to the operating system. The started application enters
|
|||
the main event loop. This loop does not end until the window is
|
||||
not closed.
|
||||
|
||||
|
||||
Memory Management
|
||||
-----------------
|
||||
|
||||
To create a hierarchy of FObjects (or derived classes/widgets),
|
||||
a new FObject must initialize with its parent object.
|
||||
|
||||
```cpp
|
||||
FObject* parent = new FObject();
|
||||
FObject* child = new FObject(parent);
|
||||
```
|
||||
|
||||
To deallocate the used memory of a parent FObject, the allocated memory
|
||||
of its child objects will also automatically deallocate.
|
||||
|
||||
An object can also be assigned to another object later via `addChild()`.
|
||||
|
||||
```cpp
|
||||
FObject* parent = new FObject();
|
||||
FObject* child = new FObject();
|
||||
parent->addChild(child);
|
||||
```
|
||||
|
||||
The child object assignment can also remove at any time with
|
||||
`delChild()`.
|
||||
|
||||
```cpp
|
||||
FObject* parent = new FObject();
|
||||
FObject* child = new FObject(parent);
|
||||
parent->delChild(child);
|
||||
```
|
||||
|
||||
If an FObject with a parent will remove from the hierarchy,
|
||||
the destructor automatically deletes the object assignment from
|
||||
its parent object. If a class object doesn't derive from FObject,
|
||||
you must implement storage deallocation yourself.
|
||||
|
||||
**File:** *memory.cpp*
|
||||
```cpp
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FApplication app(argc, argv);
|
||||
|
||||
// The object dialog is managed by app
|
||||
FDialog* dialog = new FDialog(&app);
|
||||
dialog->setText ("Window Title");
|
||||
dialog->setGeometry (25, 5, 40, 8);
|
||||
|
||||
// The object input is managed by dialog
|
||||
FLineEdit* input = new FLineEdit("predefined text", dialog);
|
||||
input->setGeometry(8, 2, 29, 1);
|
||||
input->setLabelText (L"&Input");
|
||||
|
||||
// The object label is managed by dialog
|
||||
FLabel* label = new FLabel ( "Lorem ipsum dolor sit amet, consectetur "
|
||||
"adipiscing elit, sed do eiusmod tempor "
|
||||
"incididunt ut labore et dolore magna aliqua."
|
||||
, dialog );
|
||||
label->setGeometry (2, 4, 36, 1);
|
||||
app.setMainWidget(dialog);
|
||||
dialog->show();
|
||||
return app.exec();
|
||||
}
|
||||
```
|
||||
*(Note: You can close the window with the mouse,
|
||||
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
|
||||
|
||||
|
||||
After entering the source code in *memory.cpp* you can compile
|
||||
the above program with gcc:
|
||||
```cpp
|
||||
g++ -O2 -lfinal memory.cpp -o memory
|
||||
```
|
||||
|
||||
|
||||
Event Processing
|
||||
----------------
|
||||
|
||||
Calling `FApplication::exec()` starts the FINAL CUT main event loop.
|
||||
While the event loop is running, the system constantly checks whether
|
||||
an event has occurred and sends it to the application's currently focused
|
||||
object. The events of the terminal such as keystrokes, mouse actions or
|
||||
resizing the terminal are translated into `FEvent` objects and sent it to
|
||||
the active `FObject`. It is also possible to use `FApplication::sendEvent()`
|
||||
or `FApplication::queueEvent()` to send your own events to an object.
|
||||
|
||||
`FObject`-derived objects process incoming events by reimplementing the
|
||||
virtual method `event()`. The `FObject` itself calls only
|
||||
`onTimer()` or `onUserEvent()` and ignores all other events. The
|
||||
`FObject`-derived class `FWidget` also reimplements the `event()` method
|
||||
to handle further events. `FWidget` calls the `FWidget::onKeyPress` method
|
||||
when you press a key, or the `FWidget::onMouseDown` method when you click
|
||||
a mouse button.
|
||||
|
||||
|
||||
### Event handler reimplementation ###
|
||||
|
||||
An event in FINAL CUT is an object that inherits from the base class
|
||||
`FEvent`. There are several event types, represented by an enum value.
|
||||
For example, the method `FEvent::type()` returns the type
|
||||
`fc::MouseDown_Event` when you press down a mouse button.
|
||||
|
||||
Some event types have data that cannot store in an `FEvent` object.
|
||||
For example, a click event of the mouse must store which button it
|
||||
triggered where the mouse pointer was at that time. In classes derived
|
||||
from `FEvent`, such as `FMouseEvent()`, we store this data.
|
||||
|
||||
Widgets get their events from the `event()` method inherited from FObject.
|
||||
The implementation of `event()` in `FWidget` forwards the most common event
|
||||
types to specific event handlers such as `FMouseEvent()`, `FKeyEvent()` or
|
||||
`FResizeEvent()`. There are many other event types. It is also possible to
|
||||
create own event types and send them to other objects.
|
||||
|
||||
|
||||
**The FINAL CUT event types:**
|
||||
```cpp
|
||||
enum events
|
||||
{
|
||||
None_Event, // invalid event
|
||||
KeyPress_Event, // key pressed
|
||||
KeyUp_Event, // key released
|
||||
KeyDown_Event, // key pressed
|
||||
MouseDown_Event, // mouse button pressed
|
||||
MouseUp_Event, // mouse button released
|
||||
MouseDoubleClick_Event, // mouse button double click
|
||||
MouseWheel_Event, // mouse wheel rolled
|
||||
MouseMove_Event, // mouse move
|
||||
FocusIn_Event, // focus in
|
||||
FocusOut_Event, // focus out
|
||||
ChildFocusIn_Event, // child focus in
|
||||
ChildFocusOut_Event, // child focus out
|
||||
WindowActive_Event, // activate window
|
||||
WindowInactive_Event, // deactivate window
|
||||
WindowRaised_Event, // raise window
|
||||
WindowLowered_Event, // lower window
|
||||
Accelerator_Event, // keyboard accelerator
|
||||
Resize_Event, // terminal resize
|
||||
Show_Event, // widget is shown
|
||||
Hide_Event, // widget is hidden
|
||||
Close_Event, // widget close
|
||||
Timer_Event, // timer event occur
|
||||
User_Event // user defined event
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
**File:** *timer.cpp*
|
||||
```cpp
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
class dialogWidget : public FDialog
|
||||
{
|
||||
public:
|
||||
explicit dialogWidget (FWidget* parent = nullptr)
|
||||
: FDialog(parent)
|
||||
{
|
||||
setText ("Dialog");
|
||||
setGeometry (25, 5, 23, 4);
|
||||
label.setGeometry (1, 1, 10, 1);
|
||||
label.setAlignment (fc::alignRight);
|
||||
value.setGeometry (11, 1, 10, 1);
|
||||
id = addTimer(100);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void onTimer (FTimerEvent* ev)
|
||||
{
|
||||
if ( id == ev->getTimerId() && n < 9999999999 )
|
||||
{
|
||||
value.setNumber(n);
|
||||
value.redraw();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
FLabel label{"Counter: ", this};
|
||||
FLabel value{"0", this};
|
||||
long n{0};
|
||||
int id{0};
|
||||
};
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
```
|
||||
*(Note: You can close the window with the mouse,
|
||||
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
|
||||
|
||||
|
||||
After entering the source code in *timer.cpp* you can compile
|
||||
the above program with gcc:
|
||||
```cpp
|
||||
g++ -O2 -std=c++11 -lfinal timer.cpp -o timer
|
||||
```
|
||||
|
||||
|
||||
Signals and Callbacks
|
||||
---------------------
|
||||
|
||||
The callback mechanism is essential for developing applications with
|
||||
FINAL CUT. Callback routines allow the programmer to connect different
|
||||
objects (which do not need to know each other). Connected objects notify
|
||||
each other when an action occurs in a widget. To uniquely identify a widget
|
||||
action, it uses signal strings. For example, if an `FButton` object gets
|
||||
clicked by a keyboard or mouse, it sends the string "clicked". A signal
|
||||
handler explicitly provided by Widget, in the form of a callback function
|
||||
or a callback method, can react to such a signal.
|
||||
|
||||
A callback function is always structured as follows:
|
||||
|
||||
```cpp
|
||||
void cb_function (FWidget* w, FDataPtr data)
|
||||
{...}
|
||||
```
|
||||
|
||||
The structure of a callback method is the same:
|
||||
|
||||
```cpp
|
||||
void classname::cb_methode (FWidget* w, FDataPtr data)
|
||||
{...}
|
||||
```
|
||||
|
||||
We use the `addCallback()` method of the `FWidget` class to connect
|
||||
to other widget objects.
|
||||
|
||||
For calling functions and static methods:
|
||||
|
||||
```cpp
|
||||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FCallback cb_handler
|
||||
, FDataPtr data )
|
||||
{...}
|
||||
```
|
||||
|
||||
For calling a member method of a specific instance:
|
||||
|
||||
```cpp
|
||||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FWidget* cb_instance
|
||||
, FMemberCallback cb_handler
|
||||
, FDataPtr data )
|
||||
{...}
|
||||
```
|
||||
|
||||
There are two macros `F_FUNCTION_CALLBACK` and `F_METHOD_CALLBACK` to avoid
|
||||
having to deal with necessary type conversions. With `delCallback()` you can
|
||||
remove a connection to a signal handler or a widget. Alternatively, you can
|
||||
use `delCallbacks()` to remove all existing callbacks from an object.
|
||||
|
||||
|
||||
### The FINAL CUT widgets emit the following default signals ###
|
||||
|
||||
<dl>
|
||||
<dt>FButton</dt>
|
||||
<dd>"clicked"</dd>
|
||||
|
||||
<dt>FCheckMenuItem</dt>
|
||||
<dd>"clicked"<br />"toggled"</dd>
|
||||
|
||||
<dt>FLineEdit</dt>
|
||||
<dd>"activate"<br />"changed"</dd>
|
||||
|
||||
<dt>FListBox</dt>
|
||||
<dd>"clicked"<br />"row-changed"<br />"row-selected"</dd>
|
||||
|
||||
<dt>FListView</dt>
|
||||
<dd>"clicked"<br />"row-changed"</dd>
|
||||
|
||||
<dt>FMenu</dt>
|
||||
<dd>"activate"</dd>
|
||||
|
||||
<dt>FMenuItem</dt>
|
||||
<dd>"activate"<br />"clicked"<br />"deactivate"</dd>
|
||||
|
||||
<dt>FRadioMenuItem</dt>
|
||||
<dd>"clicked"<br />"toggled"</dd>
|
||||
|
||||
<dt>FScrollbar</dt>
|
||||
<dd>"change-value"</dd>
|
||||
|
||||
<dt>FStatusBar</dt>
|
||||
<dd>"activate"</dd>
|
||||
|
||||
<dt>FTextView</dt>
|
||||
<dd>"changed"</dd>
|
||||
|
||||
<dt>FToggleButton</dt>
|
||||
<dd>"clicked"<br />"toggled"</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
### Example of a callback function: ###
|
||||
|
||||
**File:** *callback-function.cpp*
|
||||
|
||||
```cpp
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
void cb_changeText (FWidget* w, FDataPtr data)
|
||||
{
|
||||
FButton& button = *(static_cast<FButton*>(w));
|
||||
FLabel& label = *(static_cast<FLabel*>(data));
|
||||
label.clear();
|
||||
label << "The " << button.getClassName() << " was pressed";
|
||||
label.redraw();
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FApplication app(argc, argv);
|
||||
FDialog dialog(&app);
|
||||
dialog.setText ("A dialog with callback function");
|
||||
dialog.setGeometry (25, 5, 45, 9);
|
||||
FLabel label (&dialog);
|
||||
label = "The button has never been pressed before";
|
||||
label.setGeometry (2, 2, 41, 1);
|
||||
FButton button (&dialog);
|
||||
// Character follows '&' will be used as the accelerator key
|
||||
button = "&Click me";
|
||||
button.setGeometry (15, 5, 14, 1);
|
||||
|
||||
// Connect the button signal "clicked" with the callback function
|
||||
button.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_FUNCTION_CALLBACK (&cb_changeText),
|
||||
&label
|
||||
);
|
||||
|
||||
app.setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
```
|
||||
*(Note: You can close the dialog with the mouse,
|
||||
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
|
||||
|
||||
|
||||
After entering the source code in *callback-function.cpp* you can compile
|
||||
the above program with gcc:
|
||||
```cpp
|
||||
g++ -O2 -lfinal callback-function.cpp -o callback-function
|
||||
```
|
||||
|
||||
|
||||
### Example of a callback method: ###
|
||||
|
||||
**File:** *callback-method.cpp*
|
||||
|
||||
```cpp
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
class dialogWidget : public FDialog
|
||||
{
|
||||
public:
|
||||
explicit dialogWidget (FWidget* parent = nullptr)
|
||||
: FDialog(parent)
|
||||
{
|
||||
setText ("Callback method");
|
||||
setGeometry (25, 5, 25, 7);
|
||||
button.setGeometry (7, 3, 10, 1);
|
||||
|
||||
// Connect the button signal "clicked" with the callback method
|
||||
button.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp),
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
FButton button{"&Quit", this};
|
||||
};
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
```
|
||||
*(Note: You can close the window with the mouse,
|
||||
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
|
||||
|
||||
|
||||
After entering the source code in *callback-method.cpp* you can compile
|
||||
the above program with gcc:
|
||||
```cpp
|
||||
g++ -O2 -std=c++11 -lfinal callback-method.cpp -o callback-method
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Send custom signals ###
|
||||
|
||||
You can use the `emitCallback()` method to generate a user-defined signal.
|
||||
You can connect this signal later with the method `addCallback()` to a
|
||||
self-defined routine.
|
||||
|
||||
**File:** *emit-signal.cpp*
|
||||
```cpp
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
class dialogWidget : public FDialog
|
||||
{
|
||||
public:
|
||||
explicit dialogWidget (FWidget* parent = nullptr)
|
||||
: FDialog(parent)
|
||||
{
|
||||
setGeometry (25, 5, 22, 7);
|
||||
setText ("Emit signal");
|
||||
label.setGeometry (8, 1, 5, 1);
|
||||
label.setAlignment (fc::alignRight);
|
||||
label.setForegroundColor (fc::Black);
|
||||
plus.setGeometry (3, 3, 5, 1);
|
||||
minus.setGeometry (13, 3, 5, 1);
|
||||
plus.setNoUnderline();
|
||||
minus.setNoUnderline();
|
||||
|
||||
// Connect the button signal "clicked" with the callback method
|
||||
plus.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &dialogWidget::cb_plus)
|
||||
);
|
||||
|
||||
minus.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &dialogWidget::cb_minus)
|
||||
);
|
||||
|
||||
// Connect own signals
|
||||
addCallback
|
||||
(
|
||||
"hot",
|
||||
F_METHOD_CALLBACK (this, &dialogWidget::cb_set_red)
|
||||
);
|
||||
|
||||
addCallback
|
||||
(
|
||||
"regular",
|
||||
F_METHOD_CALLBACK (this, &dialogWidget::cb_set_black)
|
||||
);
|
||||
|
||||
addCallback
|
||||
(
|
||||
"cold",
|
||||
F_METHOD_CALLBACK (this, &dialogWidget::cb_set_blue)
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
void cb_plus (FWidget*, FDataPtr)
|
||||
{
|
||||
if ( t < 100 )
|
||||
t++;
|
||||
|
||||
if ( t == 30 )
|
||||
emitCallback("hot");
|
||||
else if ( t == 1 )
|
||||
emitCallback("regular");
|
||||
|
||||
setTemperature();
|
||||
}
|
||||
|
||||
void cb_minus (FWidget*, FDataPtr)
|
||||
{
|
||||
if ( t > -99 )
|
||||
t--;
|
||||
|
||||
if ( t == 0 )
|
||||
emitCallback("cold");
|
||||
else if ( t == 29 )
|
||||
emitCallback("regular");
|
||||
|
||||
setTemperature();
|
||||
}
|
||||
|
||||
void cb_set_blue (FWidget*, FDataPtr)
|
||||
{
|
||||
label.setForegroundColor (fc::Blue);
|
||||
}
|
||||
|
||||
void cb_set_black (FWidget*, FDataPtr)
|
||||
{
|
||||
label.setForegroundColor (fc::Black);
|
||||
}
|
||||
|
||||
void cb_set_red (FWidget*, FDataPtr)
|
||||
{
|
||||
label.setForegroundColor (fc::Red);
|
||||
}
|
||||
|
||||
void setTemperature()
|
||||
{
|
||||
label.clear();
|
||||
label << t << "°C";
|
||||
label.redraw();
|
||||
}
|
||||
|
||||
int t = 20;
|
||||
FLabel label{FString() << t << "°C", this};
|
||||
FButton plus {"&+", this};
|
||||
FButton minus {"&-", this};
|
||||
};
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FApplication app(argc, argv);
|
||||
dialogWidget dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
```
|
||||
*(Note: You can close the window with the mouse,
|
||||
<kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Ctrl</kbd>+<kbd>^</kbd>)*
|
||||
|
||||
|
||||
After entering the source code in *emit-signal.cpp* you can compile
|
||||
the above program with gcc:
|
||||
```cpp
|
||||
g++ -O2 -std=c++11 -lfinal emit-signal.cpp -o emit-signal
|
||||
```
|
||||
The FINAL CUT widgets emit the following default signals:
|
|
@ -1,5 +1,5 @@
|
|||
#-----------------------------------------------------------------------------
|
||||
# Makefile for Final Cut
|
||||
# Makefile for FINAL CUT
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# This is where make install will install the executable
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#-----------------------------------------------------------------------------
|
||||
# Makefile for Final Cut
|
||||
# Makefile for FINAL CUT
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# This is where make install will install the executable
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
|
||||
#include <final/final.h>
|
||||
|
||||
const lDouble PI = 3.141592653589793238L;
|
||||
constexpr lDouble PI = 3.141592653589793238L;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -49,7 +50,7 @@ class Button : public finalcut::FButton
|
|||
void setChecked(bool);
|
||||
|
||||
// Event handler
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
|
||||
private:
|
||||
// Data Member
|
||||
|
@ -63,12 +64,12 @@ Button::Button (finalcut::FWidget* parent)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Button::setChecked (bool on)
|
||||
void Button::setChecked (bool enable)
|
||||
{
|
||||
if ( checked == on )
|
||||
if ( checked == enable )
|
||||
return;
|
||||
|
||||
checked = on;
|
||||
checked = enable;
|
||||
|
||||
if ( checked )
|
||||
{
|
||||
|
@ -117,12 +118,12 @@ class Calc : public finalcut::FDialog
|
|||
~Calc();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_buttonClicked (finalcut::FWidget*, data_ptr);
|
||||
void cb_buttonClicked (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Typedef and Enumeration
|
||||
|
@ -169,7 +170,7 @@ class Calc : public finalcut::FDialog
|
|||
|
||||
// Methods
|
||||
void drawDispay();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void clear (lDouble&);
|
||||
void zero (lDouble&);
|
||||
void one (lDouble&);
|
||||
|
@ -211,8 +212,8 @@ class Calc : public finalcut::FDialog
|
|||
void setInfixOperator (char);
|
||||
void clearInfixOperator();
|
||||
void calcInfixOperator();
|
||||
virtual void adjustSize();
|
||||
const wchar_t* getButtonText (int);
|
||||
virtual void adjustSize() override;
|
||||
const wchar_t* getButtonText (std::size_t);
|
||||
void mapKeyFunctions();
|
||||
|
||||
// Data Members
|
||||
|
@ -227,7 +228,7 @@ class Calc : public finalcut::FDialog
|
|||
char infix_operator{'\0'};
|
||||
char last_infix_operator{'\0'};
|
||||
finalcut::FString input{""};
|
||||
int button_no[Calc::NUM_OF_BUTTONS]{};
|
||||
std::size_t button_no[Calc::NUM_OF_BUTTONS]{};
|
||||
|
||||
struct stack_data
|
||||
{
|
||||
|
@ -236,7 +237,7 @@ class Calc : public finalcut::FDialog
|
|||
};
|
||||
|
||||
std::stack<stack_data> bracket_stack{};
|
||||
std::map<Calc::button, Button*> calculator_buttons{};
|
||||
std::map<Calc::button, std::shared_ptr<Button> > calculator_buttons{};
|
||||
std::map<Calc::button, keyFunction> key_map{};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
@ -252,19 +253,20 @@ Calc::Calc (FWidget* parent)
|
|||
setGeometry (19, 6, 37, 18);
|
||||
addAccelerator('q'); // Press 'q' to quit
|
||||
|
||||
for (int key = 0; key < Calc::NUM_OF_BUTTONS; key++)
|
||||
for (std::size_t key = 0; key < Calc::NUM_OF_BUTTONS; key++)
|
||||
{
|
||||
auto btn = new Button(this);
|
||||
auto btn = std::make_shared<Button>(this);
|
||||
button_no[key] = key;
|
||||
|
||||
if ( key == Equals )
|
||||
btn->setGeometry(30, 15, 5, 3);
|
||||
else
|
||||
{
|
||||
int x, y, n;
|
||||
int x, y;
|
||||
std::size_t n;
|
||||
( key <= Three ) ? n = 0 : n = 1;
|
||||
x = (key + n) % 5 * 7 + 2;
|
||||
y = (key + n) / 5 * 2 + 3;
|
||||
x = int(key + n) % 5 * 7 + 2;
|
||||
y = int(key + n) / 5 * 2 + 3;
|
||||
btn->setGeometry(x, y, 5, 1);
|
||||
}
|
||||
|
||||
|
@ -1052,7 +1054,7 @@ void Calc::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Calc::cb_buttonClicked (finalcut::FWidget*, data_ptr data)
|
||||
void Calc::cb_buttonClicked (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
lDouble& x = getValue();
|
||||
Calc::button key = *(static_cast<Calc::button*>(data));
|
||||
|
@ -1094,7 +1096,7 @@ void Calc::adjustSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const wchar_t* Calc::getButtonText (int key)
|
||||
const wchar_t* Calc::getButtonText (std::size_t key)
|
||||
{
|
||||
static const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] =
|
||||
{
|
||||
|
|
|
@ -40,8 +40,10 @@ class CheckList : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit CheckList (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
CheckList (const CheckList&) = delete;
|
||||
|
||||
// Destructor
|
||||
~CheckList();
|
||||
|
||||
|
@ -53,11 +55,11 @@ class CheckList : public finalcut::FDialog
|
|||
void populate();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_showList (finalcut::FWidget*, data_ptr);
|
||||
void cb_showList (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
finalcut::FListView listView{this};
|
||||
|
@ -123,7 +125,7 @@ void CheckList::populate()
|
|||
{ "Lemons", "Low" }
|
||||
};
|
||||
|
||||
const int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
||||
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
||||
|
||||
for (int i = 0; i <= lastItem; i++)
|
||||
{
|
||||
|
@ -158,7 +160,7 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void CheckList::cb_showList (finalcut::FWidget*, data_ptr)
|
||||
void CheckList::cb_showList (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto iter = listView.beginOfList();
|
||||
finalcut::FString shopping_list;
|
||||
|
|
|
@ -23,38 +23,40 @@
|
|||
#include <vector>
|
||||
#include <final/final.h>
|
||||
|
||||
// Typedef
|
||||
typedef std::shared_ptr<finalcut::FRadioButton> FRadioButtonPtr;
|
||||
|
||||
// function prototypes
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
||||
void populateChoice (std::vector<finalcut::FRadioButton*>&, finalcut::FButtonGroup*);
|
||||
void preset (std::vector<finalcut::FRadioButton*>&);
|
||||
// Function prototypes
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void populateChoice (std::vector<FRadioButtonPtr>&, finalcut::FButtonGroup&);
|
||||
void preset (std::vector<FRadioButtonPtr>&);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback functions
|
||||
// Callback functions
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto dlg = static_cast<finalcut::FDialog*>(data);
|
||||
dlg->close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void populateChoice ( std::vector<finalcut::FRadioButton*>& os
|
||||
, finalcut::FButtonGroup* group )
|
||||
void populateChoice ( std::vector<FRadioButtonPtr>& os
|
||||
, finalcut::FButtonGroup& group )
|
||||
{
|
||||
os[0] = new finalcut::FRadioButton("AIX", group);
|
||||
os[1] = new finalcut::FRadioButton("Cygwin", group);
|
||||
os[2] = new finalcut::FRadioButton("FreeBSD", group);
|
||||
os[3] = new finalcut::FRadioButton("HP-UX", group);
|
||||
os[4] = new finalcut::FRadioButton("Linux", group);
|
||||
os[5] = new finalcut::FRadioButton("Mac OS X", group);
|
||||
os[6] = new finalcut::FRadioButton("NetBSD", group);
|
||||
os[7] = new finalcut::FRadioButton("OpenBSD", group);
|
||||
os[8] = new finalcut::FRadioButton("Solaris", group);
|
||||
os[0] = std::make_shared<finalcut::FRadioButton>("AIX", &group);
|
||||
os[1] = std::make_shared<finalcut::FRadioButton>("Cygwin", &group);
|
||||
os[2] = std::make_shared<finalcut::FRadioButton>("FreeBSD", &group);
|
||||
os[3] = std::make_shared<finalcut::FRadioButton>("HP-UX", &group);
|
||||
os[4] = std::make_shared<finalcut::FRadioButton>("Linux", &group);
|
||||
os[5] = std::make_shared<finalcut::FRadioButton>("Mac OS X", &group);
|
||||
os[6] = std::make_shared<finalcut::FRadioButton>("NetBSD", &group);
|
||||
os[7] = std::make_shared<finalcut::FRadioButton>("OpenBSD", &group);
|
||||
os[8] = std::make_shared<finalcut::FRadioButton>("Solaris", &group);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void preset (std::vector<finalcut::FRadioButton*>& os)
|
||||
void preset (std::vector<FRadioButtonPtr>& os)
|
||||
{
|
||||
#if defined(_AIX)
|
||||
os[0]->setChecked();
|
||||
|
@ -111,8 +113,8 @@ int main (int argc, char* argv[])
|
|||
checkButtonGroup.setGeometry (2, 1, 16, 7);
|
||||
|
||||
// Create radio buttons
|
||||
std::vector<finalcut::FRadioButton*> os (9);
|
||||
populateChoice (os, &checkButtonGroup);
|
||||
std::vector<FRadioButtonPtr> os(9);
|
||||
populateChoice (os, checkButtonGroup);
|
||||
|
||||
// Set the radio button geometry
|
||||
// => checkButtonGroup.setScrollSize(...) is not required
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
#include <final/final.h>
|
||||
|
||||
// function prototype
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback function
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto app = static_cast<finalcut::FApplication*>(data);
|
||||
app->quit();
|
||||
auto& app = *(static_cast<finalcut::FApplication*>(data));
|
||||
app.quit();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
|
||||
|
||||
// function prototypes
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
||||
void cb_publish (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void cb_publish (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback functions
|
||||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto app = static_cast<finalcut::FApplication*>(data);
|
||||
app->quit();
|
||||
}
|
||||
|
||||
void cb_publish (finalcut::FWidget* widget, finalcut::FWidget::data_ptr data)
|
||||
void cb_publish (finalcut::FWidget* widget, FDataPtr data)
|
||||
{
|
||||
auto cbox1 = static_cast<finalcut::FCheckBox*>(widget);
|
||||
auto cbox2 = static_cast<finalcut::FCheckBox*>(data);
|
||||
|
|
|
@ -34,12 +34,12 @@ class Keyboard : public finalcut::FWidget
|
|||
|
||||
protected:
|
||||
// Event handlers
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -27,42 +27,45 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
|
||||
// Global application object
|
||||
static finalcut::FString* temp_str = nullptr;
|
||||
static std::weak_ptr<FString> temp_str;
|
||||
|
||||
|
||||
// Function prototypes
|
||||
void doubleToItem ( finalcut::FListBoxItem&
|
||||
, finalcut::FWidget::data_ptr container
|
||||
void doubleToItem ( FListBoxItem&
|
||||
, FDataPtr container
|
||||
, int index);
|
||||
finalcut::FString& doubleToString (std::list<double>::const_iterator iter);
|
||||
finalcut::FString& mapToString ( std::map<finalcut::FString
|
||||
, finalcut::FString>::const_iterator iter );
|
||||
FString& doubleToString (std::list<double>::const_iterator iter);
|
||||
FString& mapToString ( std::map<FString
|
||||
, FString>::const_iterator iter );
|
||||
|
||||
|
||||
// Lazy conversion import function
|
||||
void doubleToItem ( finalcut::FListBoxItem& item
|
||||
, finalcut::FWidget::data_ptr container, int index)
|
||||
void doubleToItem ( FListBoxItem& item
|
||||
, FDataPtr container, int index)
|
||||
{
|
||||
typedef std::list<double>* double_list_ptr;
|
||||
double_list_ptr dbllist = static_cast<double_list_ptr>(container);
|
||||
std::list<double>::iterator iter = dbllist->begin();
|
||||
std::advance (iter, index);
|
||||
item.setText (finalcut::FString() << *iter);
|
||||
item.setData (finalcut::FWidget::data_ptr(&(*iter)));
|
||||
item.setText (FString() << *iter);
|
||||
item.setData (FDataPtr(&(*iter)));
|
||||
}
|
||||
|
||||
// Import converter functions
|
||||
finalcut::FString& doubleToString (std::list<double>::const_iterator iter)
|
||||
FString& doubleToString (std::list<double>::const_iterator iter)
|
||||
{
|
||||
return temp_str->setNumber(*iter);
|
||||
auto temp = temp_str.lock();
|
||||
return temp->setNumber(*iter);
|
||||
}
|
||||
|
||||
finalcut::FString& mapToString ( std::map<finalcut::FString
|
||||
, finalcut::FString>::const_iterator iter )
|
||||
FString& mapToString ( std::map<FString
|
||||
, FString>::const_iterator iter )
|
||||
{
|
||||
return *temp_str = iter->first + ": " + iter->second;
|
||||
auto temp = temp_str.lock();
|
||||
return *temp = iter->first + ": " + iter->second;
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,13 +76,15 @@ finalcut::FString& mapToString ( std::map<finalcut::FString
|
|||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class Listbox : public finalcut::FDialog
|
||||
class Listbox : public FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit Listbox (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Listbox (const Listbox&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Listbox();
|
||||
|
||||
|
@ -88,22 +93,23 @@ class Listbox : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Event handlers
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (FCloseEvent*) override;
|
||||
|
||||
// Data Member
|
||||
std::list<double> double_list{};
|
||||
finalcut::FListBox list1{this};
|
||||
finalcut::FListBox list2{this};
|
||||
finalcut::FListBox list3{this};
|
||||
finalcut::FButton Quit{this};
|
||||
FListBox list1{this};
|
||||
FListBox list2{this};
|
||||
FListBox list3{this};
|
||||
FButton Quit{this};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
Listbox::Listbox (finalcut::FWidget* parent)
|
||||
: finalcut::FDialog(parent)
|
||||
Listbox::Listbox (FWidget* parent)
|
||||
: FDialog(parent)
|
||||
{
|
||||
temp_str = new finalcut::FString;
|
||||
auto temp = std::make_shared<FString>();
|
||||
temp_str = temp;
|
||||
|
||||
// listbox 1
|
||||
//----------
|
||||
|
@ -111,7 +117,7 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
|||
list1.setText ("FListBoxItem");
|
||||
|
||||
for (int i = 1; i < 30; i++)
|
||||
list1.insert (L"----- " + (finalcut::FString() << i) + L" -----");
|
||||
list1.insert (L"----- " + (FString() << i) + L" -----");
|
||||
|
||||
// listbox 2
|
||||
//----------
|
||||
|
@ -133,7 +139,7 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
|||
|
||||
// listbox 3
|
||||
//----------
|
||||
std::map<finalcut::FString, finalcut::FString> TLD;
|
||||
std::map<FString, FString> TLD;
|
||||
TLD["com"] = "Commercial";
|
||||
TLD["org"] = "Organization";
|
||||
TLD["net"] = "Network";
|
||||
|
@ -152,20 +158,18 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
|||
Quit.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
Listbox::~Listbox() // destructor
|
||||
{
|
||||
delete temp_str;
|
||||
}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Listbox::onClose (finalcut::FCloseEvent* ev)
|
||||
void Listbox::onClose (FCloseEvent* ev)
|
||||
{
|
||||
finalcut::FApplication::closeConfirmationDialog (this, ev);
|
||||
FApplication::closeConfirmationDialog (this, ev);
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,7 +180,7 @@ void Listbox::onClose (finalcut::FCloseEvent* ev)
|
|||
int main (int argc, char* argv[])
|
||||
{
|
||||
// Create the application object
|
||||
finalcut::FApplication app(argc, argv);
|
||||
FApplication app(argc, argv);
|
||||
|
||||
// Create main dialog object
|
||||
Listbox d(&app);
|
||||
|
|
|
@ -40,8 +40,10 @@ class Listview : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Listview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Listview (const Listview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Listview();
|
||||
|
||||
|
@ -53,10 +55,10 @@ class Listview : public finalcut::FDialog
|
|||
void populate();
|
||||
|
||||
// Event handlers
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_showInMessagebox (finalcut::FWidget*, data_ptr);
|
||||
void cb_showInMessagebox (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
finalcut::FListView listView{this};
|
||||
|
@ -171,7 +173,7 @@ void Listview::populate()
|
|||
{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }
|
||||
};
|
||||
|
||||
const int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
||||
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
||||
|
||||
for (int i = 0; i <= lastItem; i++)
|
||||
{
|
||||
|
@ -187,9 +189,9 @@ void Listview::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Listview::cb_showInMessagebox (finalcut::FWidget*, data_ptr)
|
||||
void Listview::cb_showInMessagebox (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto item = listView.getCurrentItem();
|
||||
const auto& item = listView.getCurrentItem();
|
||||
finalcut::FMessageBox info ( "Weather in " + item->getText(1)
|
||||
, " Condition: " + item->getText(2) + "\n"
|
||||
"Temperature: " + item->getText(3) + "\n"
|
||||
|
|
|
@ -40,13 +40,13 @@ class Mandelbrot : public finalcut::FDialog
|
|||
~Mandelbrot();
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
virtual void draw();
|
||||
virtual void adjustSize();
|
||||
virtual void draw() override;
|
||||
virtual void adjustSize() override;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ class Menu : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Menu (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Menu (const Menu&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Menu();
|
||||
|
||||
|
@ -52,13 +54,13 @@ class Menu : public finalcut::FDialog
|
|||
void configureStyleMenuItems();
|
||||
void configureBorderMenuItems();
|
||||
void defaultCallback (finalcut::FMenuList*);
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_message (finalcut::FWidget*, data_ptr);
|
||||
void cb_message (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
finalcut::FString line{13, finalcut::fc::BoxDrawingsHorizontal};
|
||||
|
@ -300,7 +302,7 @@ void Menu::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Menu::cb_message (finalcut::FWidget* widget, data_ptr)
|
||||
void Menu::cb_message (finalcut::FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto menuitem = static_cast<finalcut::FMenuItem*>(widget);
|
||||
auto text = menuitem->getText();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -35,8 +35,10 @@ class ColorChooser : public finalcut::FWidget
|
|||
public:
|
||||
// Constructor
|
||||
explicit ColorChooser (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
ColorChooser (const ColorChooser&) = delete;
|
||||
|
||||
// Destructor
|
||||
~ColorChooser();
|
||||
|
||||
|
@ -49,10 +51,10 @@ class ColorChooser : public finalcut::FWidget
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handler
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*) override;
|
||||
|
||||
// Data Members
|
||||
FColor fg_color{finalcut::fc::White};
|
||||
|
@ -171,8 +173,10 @@ class Brushes : public finalcut::FWidget
|
|||
public:
|
||||
// Constructor
|
||||
explicit Brushes (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Brushes (const Brushes&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Brushes();
|
||||
|
||||
|
@ -188,10 +192,10 @@ class Brushes : public finalcut::FWidget
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handler
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*) override;
|
||||
|
||||
// Data Members
|
||||
wchar_t brush{L' '};
|
||||
|
@ -309,8 +313,10 @@ class MouseDraw : public finalcut::FDialog
|
|||
|
||||
// Constructor
|
||||
explicit MouseDraw (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MouseDraw (const MouseDraw&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MouseDraw();
|
||||
|
||||
|
@ -318,25 +324,25 @@ class MouseDraw : public finalcut::FDialog
|
|||
MouseDraw& operator = (const MouseDraw&) = delete;
|
||||
|
||||
// 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) override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawBrush (int, int, bool = false);
|
||||
void drawCanvas();
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||
virtual void onMouseMove (finalcut::FMouseEvent*);
|
||||
virtual void onMouseDown (finalcut::FMouseEvent*) override;
|
||||
virtual void onMouseMove (finalcut::FMouseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_colorChanged (finalcut::FWidget*, data_ptr);
|
||||
void cb_colorChanged (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
term_area* canvas{nullptr};
|
||||
|
@ -483,10 +489,10 @@ void MouseDraw::drawCanvas()
|
|||
winchar = &print_area->text[(ay + y) * w_line_len + ax];
|
||||
std::memcpy (winchar, canvaschar, sizeof(charData) * unsigned(x_end));
|
||||
|
||||
if ( short(print_area->changes[ay + y].xmin) > ax )
|
||||
if ( int(print_area->changes[ay + y].xmin) > ax )
|
||||
print_area->changes[ay + y].xmin = uInt(ax);
|
||||
|
||||
if ( short(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
|
||||
if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
|
||||
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
|
||||
}
|
||||
|
||||
|
@ -532,7 +538,7 @@ void MouseDraw::onMouseMove (finalcut::FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MouseDraw::cb_colorChanged (finalcut::FWidget*, data_ptr)
|
||||
void MouseDraw::cb_colorChanged (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
brush.setForeground (c_chooser.getForeground());
|
||||
brush.setBackground (c_chooser.getBackground());
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -35,8 +35,10 @@ class Scrollview : public finalcut::FScrollView
|
|||
public:
|
||||
// Constructor
|
||||
explicit Scrollview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Scrollview (const Scrollview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Scrollview ();
|
||||
|
||||
|
@ -44,17 +46,17 @@ class Scrollview : public finalcut::FScrollView
|
|||
Scrollview& operator = (const Scrollview&) = delete;
|
||||
|
||||
// Mutator
|
||||
void setScrollSize (std::size_t, std::size_t);
|
||||
void setScrollSize (std::size_t, std::size_t) override;
|
||||
|
||||
private:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Callback methods
|
||||
void cb_go_east (finalcut::FWidget*, data_ptr);
|
||||
void cb_go_south (finalcut::FWidget*, data_ptr);
|
||||
void cb_go_west (finalcut::FWidget*, data_ptr);
|
||||
void cb_go_north (finalcut::FWidget*, data_ptr);
|
||||
void cb_go_east (finalcut::FWidget*, FDataPtr);
|
||||
void cb_go_south (finalcut::FWidget*, FDataPtr);
|
||||
void cb_go_west (finalcut::FWidget*, FDataPtr);
|
||||
void cb_go_north (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
wchar_t pointer_right{finalcut::fc::BlackRightPointingPointer};
|
||||
|
@ -142,7 +144,7 @@ void Scrollview::draw()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
||||
void Scrollview::cb_go_east (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
scrollToX (int(getScrollWidth() - getViewportWidth()) + 1);
|
||||
go_south.setFocus();
|
||||
|
@ -151,7 +153,7 @@ void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
||||
void Scrollview::cb_go_south (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
scrollToY (int(getScrollHeight() - getViewportHeight()) + 1);
|
||||
go_west.setFocus();
|
||||
|
@ -160,7 +162,7 @@ void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_west (finalcut::FWidget*, data_ptr)
|
||||
void Scrollview::cb_go_west (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
scrollToX (1);
|
||||
go_north.setFocus();
|
||||
|
@ -169,7 +171,7 @@ void Scrollview::cb_go_west (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_north (finalcut::FWidget*, data_ptr)
|
||||
void Scrollview::cb_go_north (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
scrollToY (1);
|
||||
go_east.setFocus();
|
||||
|
@ -195,10 +197,10 @@ class Scrollviewdemo : public finalcut::FDialog
|
|||
~Scrollviewdemo();
|
||||
|
||||
// Event handler
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_quit (finalcut::FWidget* = nullptr, data_ptr = nullptr);
|
||||
void cb_quit (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
|
||||
// Data Members
|
||||
Scrollview sview{this};
|
||||
|
@ -240,7 +242,7 @@ Scrollviewdemo::~Scrollviewdemo()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollviewdemo::cb_quit (finalcut::FWidget*, data_ptr)
|
||||
void Scrollviewdemo::cb_quit (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
|
|
@ -36,8 +36,10 @@ class AttribDlg : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit AttribDlg (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
AttribDlg (const AttribDlg&) = delete;
|
||||
|
||||
// Destructor
|
||||
~AttribDlg();
|
||||
|
||||
|
@ -45,20 +47,20 @@ class AttribDlg : public finalcut::FDialog
|
|||
AttribDlg& operator = (const AttribDlg&) = delete;
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onWheel (finalcut::FWheelEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onWheel (finalcut::FWheelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_next (finalcut::FWidget* = nullptr, data_ptr = nullptr);
|
||||
void cb_back (finalcut::FWidget* = nullptr, data_ptr = nullptr);
|
||||
void cb_next (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
void cb_back (finalcut::FWidget* = nullptr, FDataPtr = nullptr);
|
||||
|
||||
// Data Members
|
||||
FColor bgcolor;
|
||||
|
||||
private:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Data Members
|
||||
finalcut::FButton next_button{"&Next >", this};
|
||||
|
@ -123,7 +125,7 @@ void AttribDlg::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::cb_next (finalcut::FWidget*, data_ptr)
|
||||
void AttribDlg::cb_next (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return;
|
||||
|
@ -139,7 +141,7 @@ void AttribDlg::cb_next (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::cb_back (finalcut::FWidget*, data_ptr)
|
||||
void AttribDlg::cb_back (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return;
|
||||
|
@ -193,7 +195,7 @@ class AttribDemo : public finalcut::FWidget
|
|||
{ }
|
||||
|
||||
// Event handler
|
||||
virtual void onWheel (finalcut::FWheelEvent* ev)
|
||||
virtual void onWheel (finalcut::FWheelEvent* ev) override
|
||||
{
|
||||
auto p = static_cast<AttribDlg*>(getParentWidget());
|
||||
|
||||
|
@ -218,7 +220,7 @@ class AttribDemo : public finalcut::FWidget
|
|||
void printStandout();
|
||||
void printInvisible();
|
||||
void printProtected();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Data Member
|
||||
int colors;
|
||||
|
|
|
@ -35,11 +35,11 @@ class Timer : public finalcut::FWidget
|
|||
|
||||
protected:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onTimer (finalcut::FTimerEvent*);
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
virtual void onTimer (finalcut::FTimerEvent*) override;
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -70,7 +70,7 @@ void Timer::draw()
|
|||
void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||
{
|
||||
bool is_last_line = false;
|
||||
int timer_id = ev->timerId();
|
||||
int timer_id = ev->getTimerId();
|
||||
|
||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||
is_last_line = true;
|
||||
|
|
|
@ -44,8 +44,10 @@ class Transparent : public finalcut::FDialog
|
|||
// Constructor
|
||||
explicit Transparent ( finalcut::FWidget* = nullptr
|
||||
, trans_type = transparent );
|
||||
|
||||
// Disable copy constructor
|
||||
Transparent (const Transparent&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Transparent();
|
||||
|
||||
|
@ -54,10 +56,10 @@ class Transparent : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (finalcut::FKeyEvent* ev);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent* ev) override;
|
||||
|
||||
// Data Members
|
||||
trans_type type;
|
||||
|
@ -151,8 +153,10 @@ class MainWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit MainWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MainWindow (const MainWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MainWindow();
|
||||
|
||||
|
@ -161,13 +165,13 @@ class MainWindow : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onShow (finalcut::FShowEvent*);
|
||||
virtual void onTimer (finalcut::FTimerEvent*);
|
||||
virtual void onKeyPress (finalcut::FKeyEvent* ev)
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
virtual void onShow (finalcut::FShowEvent*) override;
|
||||
virtual void onTimer (finalcut::FTimerEvent*) override;
|
||||
virtual void onKeyPress (finalcut::FKeyEvent* ev) override
|
||||
{
|
||||
if ( ! ev )
|
||||
return;
|
||||
|
@ -201,7 +205,7 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
|||
// The memory allocation for the following three sub windows occurs
|
||||
// with the operator new. The lifetime of the generated widget
|
||||
// is managed by the parent object (this). The operator delete
|
||||
// is not required in this scope and would result in a double free.
|
||||
// is not required in this class and would result in a double free.
|
||||
transpwin = new Transparent(this);
|
||||
transpwin->setText("transparent");
|
||||
transpwin->setGeometry (6, 3, 29, 12);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -29,19 +29,20 @@
|
|||
|
||||
|
||||
// Function prototypes
|
||||
long StringToLong (const finalcut::FString&);
|
||||
sInt64 StringToNumber (const finalcut::FString&);
|
||||
bool sortAscending (const finalcut::FObject*, const finalcut::FObject*);
|
||||
bool sortDescending (const finalcut::FObject*, const finalcut::FObject*);
|
||||
|
||||
|
||||
// non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
long StringToLong (const finalcut::FString& str)
|
||||
sInt64 StringToNumber (const finalcut::FString& str)
|
||||
{
|
||||
auto NumString = str;
|
||||
// Cut off one character (because LONG_MAX = 2147483647)
|
||||
auto NumString = str.left(str.getLength() - 1);
|
||||
NumString = NumString.replace(",", "");
|
||||
NumString = NumString.replace('.', "");
|
||||
long number = NumString.toLong();
|
||||
sInt64 number = sInt64(NumString.toLong());
|
||||
return number;
|
||||
}
|
||||
|
||||
|
@ -57,8 +58,8 @@ bool sortAscending ( const finalcut::FObject* lhs
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
const long l_number = StringToLong(l_item->getText(column));
|
||||
const long r_number = StringToLong(r_item->getText(column));
|
||||
const sInt64 l_number = StringToNumber(l_item->getText(column));
|
||||
const sInt64 r_number = StringToNumber(r_item->getText(column));
|
||||
return bool( l_number < r_number ); // lhs < rhs
|
||||
}
|
||||
case 3:
|
||||
|
@ -85,8 +86,8 @@ bool sortDescending ( const finalcut::FObject* lhs
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
const long l_number = StringToLong(l_item->getText(column));
|
||||
const long r_number = StringToLong(r_item->getText(column));
|
||||
const sInt64 l_number = StringToNumber(l_item->getText(column));
|
||||
const sInt64 r_number = StringToNumber(r_item->getText(column));
|
||||
return bool( l_number > r_number ); // lhs > rhs
|
||||
}
|
||||
|
||||
|
@ -115,8 +116,10 @@ class Treeview : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Treeview (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Treeview (const Treeview&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Treeview();
|
||||
|
||||
|
@ -128,10 +131,10 @@ class Treeview : public finalcut::FDialog
|
|||
struct TreeItem; // forward declaration
|
||||
|
||||
// Methods
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
void onClose (finalcut::FCloseEvent*);
|
||||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Data Members
|
||||
bool initialized{false};
|
||||
|
@ -338,10 +341,10 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
|
||||
while ( continent_list->name )
|
||||
{
|
||||
auto country_list = continent_list->child_element;
|
||||
auto& country_list = continent_list->child_element;
|
||||
finalcut::FStringList continent_line ( continent_list->begin()
|
||||
, continent_list->end() );
|
||||
auto iter = listView.insert (continent_line);
|
||||
const auto& iter = listView.insert (continent_line);
|
||||
|
||||
while ( country_list && country_list->name )
|
||||
{
|
||||
|
|
169
examples/ui.cpp
169
examples/ui.cpp
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2018 Markus Gans *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -39,8 +39,10 @@ class ProgressDialog : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit ProgressDialog (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
ProgressDialog (const ProgressDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~ProgressDialog();
|
||||
|
||||
|
@ -49,13 +51,13 @@ class ProgressDialog : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Event handlers
|
||||
virtual void onShow (finalcut::FShowEvent*);
|
||||
virtual void onTimer (finalcut::FTimerEvent*);
|
||||
virtual void onShow (finalcut::FShowEvent*) override;
|
||||
virtual void onTimer (finalcut::FTimerEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_reset_bar (finalcut::FWidget*, data_ptr);
|
||||
void cb_more_bar (finalcut::FWidget*, data_ptr);
|
||||
void cb_exit_bar (finalcut::FWidget*, data_ptr);
|
||||
void cb_reset_bar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_more_bar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_exit_bar (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
finalcut::FProgressbar progressBar{this};
|
||||
|
@ -151,20 +153,20 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_reset_bar (finalcut::FWidget*, data_ptr)
|
||||
void ProgressDialog::cb_reset_bar (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
progressBar.reset();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto p = progressBar.getPercentage();
|
||||
progressBar.setPercentage(++p);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_exit_bar (finalcut::FWidget*, data_ptr)
|
||||
void ProgressDialog::cb_exit_bar (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
@ -182,8 +184,10 @@ class TextWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit TextWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
TextWindow (const TextWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~TextWindow();
|
||||
|
||||
|
@ -195,7 +199,7 @@ class TextWindow : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Data Members
|
||||
finalcut::FTextView scrollText{this};
|
||||
|
@ -250,8 +254,10 @@ class MyDialog : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit MyDialog (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
MyDialog (const MyDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
~MyDialog();
|
||||
|
||||
|
@ -273,27 +279,27 @@ class MyDialog : public finalcut::FDialog
|
|||
void initButtons();
|
||||
void initLabels();
|
||||
void initWidgetsCallbacks();
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_noFunctionMsg (finalcut::FWidget*, data_ptr);
|
||||
void cb_about (finalcut::FWidget*, data_ptr);
|
||||
void cb_terminfo (finalcut::FWidget*, data_ptr);
|
||||
void cb_drives (finalcut::FWidget*, data_ptr);
|
||||
void cb_cutClipboard (finalcut::FWidget*, data_ptr);
|
||||
void cb_copyClipboard (finalcut::FWidget*, data_ptr);
|
||||
void cb_pasteClipboard (finalcut::FWidget*, data_ptr);
|
||||
void cb_clearInput (finalcut::FWidget*, data_ptr);
|
||||
void cb_input2buttonText (finalcut::FWidget*, data_ptr);
|
||||
void cb_setTitlebar (finalcut::FWidget*, data_ptr);
|
||||
void cb_ProgressBar (finalcut::FWidget*, data_ptr);
|
||||
void cb_updateNumber (finalcut::FWidget*, data_ptr);
|
||||
void cb_activateButton (finalcut::FWidget*, data_ptr);
|
||||
void cb_view (finalcut::FWidget*, data_ptr);
|
||||
void cb_setInput (finalcut::FWidget*, data_ptr);
|
||||
void cb_noFunctionMsg (finalcut::FWidget*, FDataPtr);
|
||||
void cb_about (finalcut::FWidget*, FDataPtr);
|
||||
void cb_terminfo (finalcut::FWidget*, FDataPtr);
|
||||
void cb_drives (finalcut::FWidget*, FDataPtr);
|
||||
void cb_cutClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_copyClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_pasteClipboard (finalcut::FWidget*, FDataPtr);
|
||||
void cb_clearInput (finalcut::FWidget*, FDataPtr);
|
||||
void cb_input2buttonText (finalcut::FWidget*, FDataPtr);
|
||||
void cb_setTitlebar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_ProgressBar (finalcut::FWidget*, FDataPtr);
|
||||
void cb_updateNumber (finalcut::FWidget*, FDataPtr);
|
||||
void cb_activateButton (finalcut::FWidget*, FDataPtr);
|
||||
void cb_view (finalcut::FWidget*, FDataPtr);
|
||||
void cb_setInput (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
bool initialized{false};
|
||||
|
@ -436,21 +442,21 @@ void MyDialog::initFileMenuCallbacks()
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&File1)
|
||||
static_cast<FDataPtr>(&File1)
|
||||
);
|
||||
|
||||
File2.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&File2)
|
||||
static_cast<FDataPtr>(&File2)
|
||||
);
|
||||
|
||||
File3.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&File3)
|
||||
static_cast<FDataPtr>(&File3)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -660,7 +666,7 @@ void MyDialog::initButtons()
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_input2buttonText),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&myLineEdit)
|
||||
static_cast<FDataPtr>(&myLineEdit)
|
||||
);
|
||||
|
||||
MyButton5.addCallback
|
||||
|
@ -712,21 +718,21 @@ void MyDialog::initWidgetsCallbacks()
|
|||
(
|
||||
"toggled",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_activateButton),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&MyButton5)
|
||||
static_cast<FDataPtr>(&MyButton5)
|
||||
);
|
||||
|
||||
myList.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_setInput),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&myLineEdit)
|
||||
static_cast<FDataPtr>(&myLineEdit)
|
||||
);
|
||||
|
||||
myList.addCallback
|
||||
(
|
||||
"row-selected",
|
||||
F_METHOD_CALLBACK (this, &MyDialog::cb_updateNumber),
|
||||
static_cast<finalcut::FWidget::data_ptr>(&tagged_count)
|
||||
static_cast<FDataPtr>(&tagged_count)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -755,10 +761,10 @@ void MyDialog::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, data_ptr)
|
||||
void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto button = static_cast<finalcut::FButton*>(widget);
|
||||
auto text = button->getText();
|
||||
auto& button = *(static_cast<finalcut::FButton*>(widget));
|
||||
auto text = button.getText();
|
||||
text = text.replace('&', "");
|
||||
finalcut::FMessageBox::error ( this
|
||||
, "The \"" + text + "\" button has\n"
|
||||
|
@ -766,22 +772,22 @@ void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_about (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
const char libver[] = F_VERSION;
|
||||
finalcut::FString line(2, finalcut::fc::BoxDrawingsHorizontal);
|
||||
constexpr char libver[] = F_VERSION;
|
||||
const finalcut::FString line(2, finalcut::fc::BoxDrawingsHorizontal);
|
||||
|
||||
finalcut::FMessageBox info ( "About"
|
||||
, line + L" The Final Cut " + line + "\n\n"
|
||||
L"Version " + libver + "\n\n"
|
||||
L"(c) 2018 by Markus Gans"
|
||||
L"(c) 2019 by Markus Gans"
|
||||
, finalcut::FMessageBox::Ok, 0, 0, this );
|
||||
info.setCenterText();
|
||||
info.show();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_terminfo (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto x = getDesktopWidth();
|
||||
auto y = getDesktopHeight();
|
||||
|
@ -802,7 +808,7 @@ void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_drives (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_drives (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
finalcut::FMessageBox info2 \
|
||||
(
|
||||
|
@ -853,7 +859,7 @@ void MyDialog::cb_drives (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_cutClipboard (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_cutClipboard (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
clipboard = myLineEdit.getText();
|
||||
myLineEdit.clear();
|
||||
|
@ -861,20 +867,20 @@ void MyDialog::cb_cutClipboard (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_copyClipboard (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_copyClipboard (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
clipboard = myLineEdit.getText();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_pasteClipboard (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_pasteClipboard (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
myLineEdit = clipboard;
|
||||
myLineEdit.redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_clearInput (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_clearInput (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
clipboard.clear();
|
||||
myLineEdit.clear();
|
||||
|
@ -882,65 +888,65 @@ void MyDialog::cb_clearInput (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, data_ptr data)
|
||||
void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
|
||||
{
|
||||
auto button = static_cast<finalcut::FButton*>(widget);
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
button->setText(lineedit->getText());
|
||||
button->redraw();
|
||||
auto& button = *(static_cast<finalcut::FButton*>(widget));
|
||||
const auto& lineedit = *(static_cast<finalcut::FLineEdit*>(data));
|
||||
button.setText(lineedit.getText());
|
||||
button.redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, data_ptr)
|
||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(widget);
|
||||
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(widget));
|
||||
finalcut::FString title;
|
||||
*lineedit >> title;
|
||||
lineedit >> title;
|
||||
setTermTitle (title);
|
||||
setText (title);
|
||||
redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_ProgressBar (finalcut::FWidget*, data_ptr)
|
||||
void MyDialog::cb_ProgressBar (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto p_dgl = new ProgressDialog(this);
|
||||
p_dgl->show();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_updateNumber (finalcut::FWidget* widget, data_ptr data)
|
||||
void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data)
|
||||
{
|
||||
auto list = static_cast<finalcut::FListBox*>(widget);
|
||||
auto num = static_cast<finalcut::FLabel*>(data);
|
||||
auto count = list->getCount();
|
||||
auto& list = *(static_cast<finalcut::FListBox*>(widget));
|
||||
auto& num = *(static_cast<finalcut::FLabel*>(data));
|
||||
const auto& count = list.getCount();
|
||||
int select_num = 0;
|
||||
|
||||
for (std::size_t n = 1; n <= count; n++)
|
||||
if ( list->isSelected(n) )
|
||||
if ( list.isSelected(n) )
|
||||
select_num++;
|
||||
|
||||
num->clear();
|
||||
*num << select_num;
|
||||
num->redraw();
|
||||
num.clear();
|
||||
num << select_num;
|
||||
num.redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_activateButton (finalcut::FWidget* widget, data_ptr data)
|
||||
void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data)
|
||||
{
|
||||
auto rb = static_cast<finalcut::FRadioButton*>(widget);
|
||||
auto button = static_cast<finalcut::FButton*>(data);
|
||||
auto& rb = *(static_cast<finalcut::FRadioButton*>(widget));
|
||||
auto& button = *(static_cast<finalcut::FButton*>(data));
|
||||
|
||||
if ( rb->isChecked() )
|
||||
button->setEnable();
|
||||
if ( rb.isChecked() )
|
||||
button.setEnable();
|
||||
else
|
||||
button->setDisable();
|
||||
button.setDisable();
|
||||
|
||||
button->redraw();
|
||||
button.redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
||||
void MyDialog::cb_view (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
finalcut::FString file;
|
||||
auto item = static_cast<finalcut::FMenuItem*>(data);
|
||||
|
@ -953,7 +959,7 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
|||
if ( file.isNull() )
|
||||
return;
|
||||
|
||||
TextWindow* view = new TextWindow(this);
|
||||
const auto& view = new TextWindow(this);
|
||||
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
|
||||
view->setText ("Viewer: " + filename);
|
||||
view->setGeometry ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||
|
@ -961,7 +967,6 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
|||
60,
|
||||
getRootWidget()->getHeight() * 3 / 4 );
|
||||
view->setResizeable();
|
||||
|
||||
std::string line = "";
|
||||
std::ifstream infile;
|
||||
infile.open(file);
|
||||
|
@ -979,12 +984,12 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_setInput (finalcut::FWidget* widget, data_ptr data)
|
||||
void MyDialog::cb_setInput (finalcut::FWidget* widget, FDataPtr data)
|
||||
{
|
||||
auto ListBox = static_cast<finalcut::FListBox*>(widget);
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
*lineedit = ListBox->getItem(ListBox->currentItem()).getText();
|
||||
lineedit->redraw();
|
||||
auto& ListBox = *(static_cast<finalcut::FListBox*>(widget));
|
||||
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(data));
|
||||
lineedit = ListBox.getItem(ListBox.currentItem()).getText();
|
||||
lineedit.redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -994,10 +999,10 @@ void MyDialog::cb_setInput (finalcut::FWidget* widget, data_ptr data)
|
|||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
finalcut::FString ver = F_VERSION; // Library version
|
||||
finalcut::FString title = "The FINAL CUT "
|
||||
const finalcut::FString ver = F_VERSION; // Library version
|
||||
const finalcut::FString title = "The FINAL CUT "
|
||||
+ ver
|
||||
+ " (C) 2018 by Markus Gans";
|
||||
+ " (C) 2019 by Markus Gans";
|
||||
|
||||
// Create the application object app
|
||||
finalcut::FApplication app(argc, argv);
|
||||
|
|
|
@ -36,8 +36,10 @@ class Watch : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Watch (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Watch (const Watch&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Watch();
|
||||
|
||||
|
@ -48,16 +50,16 @@ class Watch : public finalcut::FDialog
|
|||
void printTime();
|
||||
|
||||
// Event handlers
|
||||
virtual void onTimer (finalcut::FTimerEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onTimer (finalcut::FTimerEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_clock (finalcut::FWidget*, data_ptr);
|
||||
void cb_seconds (finalcut::FWidget*, data_ptr);
|
||||
void cb_clock (finalcut::FWidget*, FDataPtr);
|
||||
void cb_seconds (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
protected:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Data Members
|
||||
|
@ -151,7 +153,7 @@ void Watch::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Watch::cb_clock (finalcut::FWidget*, data_ptr)
|
||||
void Watch::cb_clock (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( clock_sw.isChecked() )
|
||||
{
|
||||
|
@ -167,7 +169,7 @@ void Watch::cb_clock (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Watch::cb_seconds (finalcut::FWidget*, data_ptr)
|
||||
void Watch::cb_seconds (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( seconds_sw.isChecked() )
|
||||
sec = true;
|
||||
|
|
|
@ -36,8 +36,10 @@ class SmallWindow : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit SmallWindow (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
SmallWindow (const SmallWindow&) = delete;
|
||||
|
||||
// Destructor
|
||||
~SmallWindow();
|
||||
|
||||
|
@ -46,11 +48,11 @@ class SmallWindow : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onShow (finalcut::FShowEvent*);
|
||||
virtual void onTimer (finalcut::FTimerEvent*);
|
||||
virtual void onShow (finalcut::FShowEvent*) override;
|
||||
virtual void onTimer (finalcut::FTimerEvent*) override;
|
||||
|
||||
// Data Members
|
||||
finalcut::FLabel left_arrow{this};
|
||||
|
@ -165,8 +167,10 @@ class Window : public finalcut::FDialog
|
|||
public:
|
||||
// Constructor
|
||||
explicit Window (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Window (const Window&) = delete;
|
||||
|
||||
// Destructor
|
||||
~Window();
|
||||
|
||||
|
@ -175,8 +179,8 @@ class Window : public finalcut::FDialog
|
|||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr);
|
||||
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr);
|
||||
typedef void (Window::*WindowCallback)(finalcut::FWidget*, FDataPtr);
|
||||
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, FDataPtr);
|
||||
|
||||
struct win_data
|
||||
{
|
||||
|
@ -198,19 +202,19 @@ class Window : public finalcut::FDialog
|
|||
void configureFileMenuItems();
|
||||
void configureDialogButtons();
|
||||
void activateWindow (finalcut::FDialog*);
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
void addClickedCallback (finalcut::FWidget*, WindowCallback);
|
||||
void addClickedCallback (finalcut::FWidget*, FAppCallback);
|
||||
|
||||
// Event handlers
|
||||
virtual void onClose (finalcut::FCloseEvent*);
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_createWindows (finalcut::FWidget*, data_ptr);
|
||||
void cb_closeWindows (finalcut::FWidget*, data_ptr);
|
||||
void cb_next (finalcut::FWidget*, data_ptr);
|
||||
void cb_previous (finalcut::FWidget*, data_ptr);
|
||||
void cb_destroyWindow (finalcut::FWidget*, data_ptr);
|
||||
void cb_createWindows (finalcut::FWidget*, FDataPtr);
|
||||
void cb_closeWindows (finalcut::FWidget*, FDataPtr);
|
||||
void cb_next (finalcut::FWidget*, FDataPtr);
|
||||
void cb_previous (finalcut::FWidget*, FDataPtr);
|
||||
void cb_destroyWindow (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
std::vector<win_data*> windows{};
|
||||
|
@ -401,7 +405,7 @@ void Window::onClose (finalcut::FCloseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
||||
void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
auto first = windows.begin();
|
||||
auto iter = first;
|
||||
|
@ -431,7 +435,7 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
|||
(
|
||||
"destroy",
|
||||
F_METHOD_CALLBACK (this, &Window::cb_destroyWindow),
|
||||
static_cast<finalcut::FWidget::data_ptr>(win_dat)
|
||||
static_cast<FDataPtr>(win_dat)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -442,7 +446,7 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_closeWindows (finalcut::FWidget*, data_ptr)
|
||||
void Window::cb_closeWindows (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
@ -462,7 +466,7 @@ void Window::cb_closeWindows (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_next (finalcut::FWidget*, data_ptr)
|
||||
void Window::cb_next (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
@ -498,7 +502,7 @@ void Window::cb_next (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_previous (finalcut::FWidget*, data_ptr)
|
||||
void Window::cb_previous (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
@ -535,7 +539,7 @@ void Window::cb_previous (finalcut::FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Window::cb_destroyWindow (finalcut::FWidget*, data_ptr data)
|
||||
void Window::cb_destroyWindow (finalcut::FWidget*, FDataPtr data)
|
||||
{
|
||||
auto win_dat = static_cast<win_data*>(data);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ libdir=@libdir@
|
|||
includedir=${prefix}/include
|
||||
|
||||
Name: finalcut
|
||||
Description: The Final Cut text-based widget library
|
||||
Description: FINAL CUT text-based widget library
|
||||
Version: @VERSION@
|
||||
URL: https://github.com/gansm/finalcut
|
||||
Libs: -L${libdir} -lfinal
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# spec file for package finalcut
|
||||
#
|
||||
# Copyright (c) 2018 by Markus Gans
|
||||
# Copyright (c) 2019 by Markus Gans
|
||||
#
|
||||
|
||||
%define sover 0
|
||||
|
@ -21,7 +21,7 @@ BuildRequires: libtool
|
|||
BuildRequires: ncurses-devel
|
||||
|
||||
%description
|
||||
The Final Cut is a class library and widget toolkit with full mouse
|
||||
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.
|
||||
|
@ -30,7 +30,7 @@ common controls like dialog windows, push buttons, check boxes,
|
|||
radio buttons, input lines, list boxes, status bars and so on.
|
||||
|
||||
%package -n libfinal-devel
|
||||
Summary: Development files for The Final Cut text widget library
|
||||
Summary: Development files for the FINAL CUT text widget library
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: libfinal%{sover} = %{version}
|
||||
Requires: bdftopcf
|
||||
|
@ -44,7 +44,7 @@ Provides: libfinal-devel = %{version}
|
|||
Recommends: libfinal-examples = %{version}
|
||||
|
||||
%description -n libfinal-devel
|
||||
The Final Cut is a class library and widget toolkit with full mouse
|
||||
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.
|
||||
|
@ -53,12 +53,12 @@ common controls like dialog windows, push buttons, check boxes,
|
|||
radio buttons, input lines, list boxes, status bars and so on.
|
||||
|
||||
%package -n libfinal-examples
|
||||
Summary: Example files for The Final Cut library
|
||||
Summary: Example files for the FINAL CUT library
|
||||
Group: Development/Languages/C and C++
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n libfinal-examples
|
||||
The Final Cut is a class library and widget toolkit with full mouse
|
||||
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.
|
||||
|
@ -71,7 +71,7 @@ Summary: Console widget toolkit
|
|||
Group: System/Libraries
|
||||
|
||||
%description -n libfinal%{sover}
|
||||
The Final Cut is a class library and widget toolkit with full mouse
|
||||
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.
|
||||
|
@ -84,7 +84,7 @@ Summary: Console widget toolkit
|
|||
Group: System/Libraries
|
||||
|
||||
%description -n libfinal-static
|
||||
The Final Cut is a class library and widget toolkit with full mouse
|
||||
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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#----------------------------------------------------------------------
|
||||
# Makefile.am - the Final Cut library
|
||||
# Makefile.am - FINAL CUT library
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
|
@ -51,7 +52,7 @@ int FApplication::loop_level = 0; // event loop level
|
|||
int FApplication::quit_code = 0;
|
||||
bool FApplication::quit_now = false;
|
||||
|
||||
FApplication::eventQueuePtr FApplication::event_queue = nullptr;
|
||||
FApplication::eventQueue* FApplication::event_queue = nullptr;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -67,8 +68,10 @@ FApplication::FApplication ( const int& _argc
|
|||
, app_argc{_argc}
|
||||
, app_argv{_argv}
|
||||
{
|
||||
assert ( ! app_object
|
||||
&& "FApplication: There should be only one application object" );
|
||||
if ( app_object )
|
||||
throw std::runtime_error( "FApplication: There should be "
|
||||
"only one application object" );
|
||||
|
||||
app_object = this;
|
||||
|
||||
if ( ! (_argc && _argv) )
|
||||
|
@ -84,8 +87,8 @@ FApplication::FApplication ( const int& _argc
|
|||
//----------------------------------------------------------------------
|
||||
FApplication::~FApplication() // destructor
|
||||
{
|
||||
//if ( event_queue )
|
||||
// delete event_queue;
|
||||
if ( event_queue )
|
||||
delete event_queue;
|
||||
|
||||
app_object = nullptr;
|
||||
}
|
||||
|
@ -93,9 +96,9 @@ FApplication::~FApplication() // destructor
|
|||
|
||||
// public methods of FApplication
|
||||
//----------------------------------------------------------------------
|
||||
FWidget* FApplication::getApplicationObject()
|
||||
FApplication* FApplication::getApplicationObject()
|
||||
{
|
||||
return static_cast<FWidget*>(app_object);
|
||||
return app_object;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -170,9 +173,8 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
if ( ! receiver )
|
||||
return false;
|
||||
|
||||
if ( ! receiver->isWidget() )
|
||||
return false;
|
||||
|
||||
if ( receiver->isWidget() )
|
||||
{
|
||||
const auto r_widget = static_cast<const FWidget*>(receiver);
|
||||
auto widget = const_cast<FWidget*>(r_widget);
|
||||
|
||||
|
@ -190,7 +192,7 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
&& ! window->getFlags().modal
|
||||
&& ! window->isMenuWidget() )
|
||||
{
|
||||
switch ( event->type() )
|
||||
switch ( uInt(event->type()) )
|
||||
{
|
||||
case fc::KeyPress_Event:
|
||||
case fc::KeyUp_Event:
|
||||
|
@ -216,13 +218,11 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
&& event->type() <= fc::MouseMove_Event
|
||||
&& ! widget->isEnabled() )
|
||||
return false;
|
||||
|
||||
// For access to a protected base class member
|
||||
auto const_w = static_cast<const FApplication*>(widget);
|
||||
auto w = const_cast<FApplication*>(const_w);
|
||||
}
|
||||
|
||||
// Sends event event directly to receiver
|
||||
return w->event(const_cast<FEvent*>(event));
|
||||
auto r = const_cast<FObject*>(receiver);
|
||||
return r->event(const_cast<FEvent*>(event));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -359,10 +359,10 @@ void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev)
|
|||
|
||||
// private methods of FApplication
|
||||
//----------------------------------------------------------------------
|
||||
void FApplication::init (long key_time, long dblclick_time)
|
||||
void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
|
||||
{
|
||||
// Initialize keyboard
|
||||
keyboard = getKeyboard();
|
||||
keyboard = FVTerm::getKeyboard();
|
||||
|
||||
// Set the keyboard keypress timeout
|
||||
if ( keyboard )
|
||||
|
@ -377,7 +377,7 @@ void FApplication::init (long key_time, long dblclick_time)
|
|||
}
|
||||
|
||||
// Initialize mouse control
|
||||
mouse = getMouseControl();
|
||||
mouse = FVTerm::getMouseControl();
|
||||
|
||||
// Set stdin number for a gpm-mouse
|
||||
if ( mouse )
|
||||
|
@ -389,8 +389,7 @@ void FApplication::init (long key_time, long dblclick_time)
|
|||
|
||||
try
|
||||
{
|
||||
//event_queue = new eventQueue;
|
||||
event_queue = std::make_shared<eventQueue>();
|
||||
event_queue = new eventQueue;
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -630,7 +629,7 @@ inline bool FApplication::sendKeyUpEvent (FWidget* widget)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FApplication::sendKeyboardAccelerator()
|
||||
{
|
||||
if ( getOpenMenu() )
|
||||
if ( FWidget::getOpenMenu() )
|
||||
return;
|
||||
|
||||
// Switch to a specific dialog with Meta + 1..9
|
||||
|
@ -764,7 +763,7 @@ bool FApplication::getMouseEvent()
|
|||
//----------------------------------------------------------------------
|
||||
FWidget*& FApplication::determineClickedWidget()
|
||||
{
|
||||
FWidget*& clicked = getClickedWidget();
|
||||
FWidget*& clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( clicked )
|
||||
return clicked;
|
||||
|
@ -780,7 +779,7 @@ FWidget*& FApplication::determineClickedWidget()
|
|||
&& ! mouse->isWheelDown() )
|
||||
return clicked;
|
||||
|
||||
const FPoint& mouse_position = mouse->getPos();
|
||||
const auto& mouse_position = mouse->getPos();
|
||||
|
||||
// Determine the window object on the current click position
|
||||
auto window = FWindow::getWindowWidgetAt (mouse_position);
|
||||
|
@ -816,7 +815,7 @@ void FApplication::closeOpenMenu()
|
|||
{
|
||||
// Close the open menu
|
||||
|
||||
auto openmenu = getOpenMenu();
|
||||
auto openmenu = FWidget::getOpenMenu();
|
||||
auto menu = static_cast<FMenu*>(openmenu);
|
||||
|
||||
if ( ! openmenu || ( mouse && mouse->isMoved()) )
|
||||
|
@ -824,7 +823,7 @@ void FApplication::closeOpenMenu()
|
|||
|
||||
if ( mouse )
|
||||
{
|
||||
const FPoint& mouse_position = mouse->getPos();
|
||||
const auto& mouse_position = mouse->getPos();
|
||||
|
||||
if ( menu->containsMenuStructure(mouse_position) )
|
||||
return;
|
||||
|
@ -844,11 +843,11 @@ void FApplication::closeOpenMenu()
|
|||
menu->hideSuperMenus();
|
||||
|
||||
// No widget was been clicked and the menu is no dialog menu
|
||||
if ( ! (getClickedWidget() || is_window_menu) )
|
||||
if ( ! (FWidget::getClickedWidget() || is_window_menu) )
|
||||
FWindow::switchToPrevWindow(this);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->drawMessage();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -859,8 +858,8 @@ void FApplication::unselectMenubarItems()
|
|||
{
|
||||
// Unselect the menu bar items
|
||||
|
||||
auto openmenu = getOpenMenu();
|
||||
auto menu_bar = getMenuBar();
|
||||
auto openmenu = FWidget::getOpenMenu();
|
||||
auto menu_bar = FWidget::getMenuBar();
|
||||
|
||||
if ( openmenu || (mouse && mouse->isMoved()) )
|
||||
return;
|
||||
|
@ -874,22 +873,22 @@ void FApplication::unselectMenubarItems()
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
const FPoint& mouse_position = mouse->getPos();
|
||||
const auto& mouse_position = mouse->getPos();
|
||||
|
||||
if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) )
|
||||
if ( ! menu_bar->getTermGeometry().contains(mouse_position) )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->clearMessage();
|
||||
|
||||
getMenuBar()->resetMenu();
|
||||
getMenuBar()->redraw();
|
||||
menu_bar->resetMenu();
|
||||
menu_bar->redraw();
|
||||
|
||||
// No widget was been clicked
|
||||
if ( ! getClickedWidget() )
|
||||
if ( ! FWidget::getClickedWidget() )
|
||||
FWindow::switchToPrevWindow(this);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
if ( FWidget::getStatusBar() )
|
||||
FWidget::getStatusBar()->drawMessage();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -899,7 +898,7 @@ void FApplication::unselectMenubarItems()
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::sendMouseEvent()
|
||||
{
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( ! clicked )
|
||||
return;
|
||||
|
@ -907,8 +906,7 @@ void FApplication::sendMouseEvent()
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FPoint widgetMousePos;
|
||||
const FPoint& mouse_position = mouse->getPos();
|
||||
const auto& mouse_position = mouse->getPos();
|
||||
int key_state = 0;
|
||||
|
||||
if ( mouse->isShiftKeyPressed() )
|
||||
|
@ -920,7 +918,7 @@ void FApplication::sendMouseEvent()
|
|||
if ( mouse->isMetaKeyPressed() )
|
||||
key_state |= fc::MetaButton;
|
||||
|
||||
widgetMousePos = clicked->termToWidgetPos(mouse_position);
|
||||
auto widgetMousePos = clicked->termToWidgetPos(mouse_position);
|
||||
|
||||
if ( mouse->isMoved() )
|
||||
{
|
||||
|
@ -945,7 +943,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonPressed() )
|
||||
{
|
||||
|
@ -983,7 +981,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonDoubleClick() )
|
||||
{
|
||||
|
@ -1025,7 +1023,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isRightButtonPressed() )
|
||||
{
|
||||
|
@ -1059,7 +1057,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isMiddleButtonPressed() )
|
||||
{
|
||||
|
@ -1098,7 +1096,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
auto clicked = getClickedWidget();
|
||||
auto clicked = FWidget::getClickedWidget();
|
||||
|
||||
if ( mouse->isWheelUp() )
|
||||
{
|
||||
|
|
|
@ -54,6 +54,13 @@ FButton::~FButton() // destructor
|
|||
delOwnTimer();
|
||||
}
|
||||
|
||||
// FButton operator
|
||||
//----------------------------------------------------------------------
|
||||
FButton& FButton::operator = (const FString& s)
|
||||
{
|
||||
setText(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// public methods of FButton
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -119,38 +126,38 @@ void FButton::setInactiveBackgroundColor (FColor color)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setNoUnderline (bool on)
|
||||
bool FButton::setNoUnderline (bool enable)
|
||||
{
|
||||
return (flags.no_underline = on);
|
||||
return (flags.no_underline = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setEnable (bool on)
|
||||
bool FButton::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setHotkeyAccelerator();
|
||||
else
|
||||
delAccelerator();
|
||||
|
||||
updateButtonColor();
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setFocus (bool on)
|
||||
bool FButton::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
|
@ -164,19 +171,19 @@ bool FButton::setFocus (bool on)
|
|||
}
|
||||
|
||||
updateButtonColor();
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setFlat (bool on)
|
||||
bool FButton::setFlat (bool enable)
|
||||
{
|
||||
return (flags.flat = on);
|
||||
return (flags.flat = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setShadow (bool on)
|
||||
bool FButton::setShadow (bool enable)
|
||||
{
|
||||
if ( on
|
||||
if ( enable
|
||||
&& getEncoding() != fc::VT100
|
||||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
|
@ -193,15 +200,15 @@ bool FButton::setShadow (bool on)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButton::setDown (bool on)
|
||||
bool FButton::setDown (bool enable)
|
||||
{
|
||||
if ( button_down != on )
|
||||
if ( button_down != enable )
|
||||
{
|
||||
button_down = on;
|
||||
button_down = enable;
|
||||
redraw();
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -342,7 +349,7 @@ void FButton::onMouseMove (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::onTimer (FTimerEvent* ev)
|
||||
{
|
||||
delTimer(ev->timerId());
|
||||
delTimer(ev->getTimerId());
|
||||
setUp();
|
||||
}
|
||||
|
||||
|
@ -747,8 +754,8 @@ void FButton::updateStatusBar()
|
|||
if ( ! flags.focus || ! getStatusBar() )
|
||||
return;
|
||||
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -99,16 +99,16 @@ FToggleButton* FButtonGroup::getLastButton()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FButtonGroup::setEnable (bool on)
|
||||
bool FButtonGroup::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setHotkeyAccelerator();
|
||||
else
|
||||
delAccelerator();
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -380,38 +380,6 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
||||
{
|
||||
auto button = static_cast<FToggleButton*>(widget);
|
||||
|
||||
if ( ! button->isChecked() )
|
||||
return;
|
||||
|
||||
if ( buttonlist.empty() )
|
||||
return;
|
||||
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button != button
|
||||
&& toggle_button->isChecked()
|
||||
&& isRadioButton(toggle_button) )
|
||||
{
|
||||
toggle_button->unsetChecked();
|
||||
|
||||
if ( toggle_button->isVisible() && toggle_button->isShown() )
|
||||
toggle_button->redraw();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// protected methods of FButtonGroup
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -659,4 +627,36 @@ void FButtonGroup::directFocus()
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto button = static_cast<FToggleButton*>(widget);
|
||||
|
||||
if ( ! button->isChecked() )
|
||||
return;
|
||||
|
||||
if ( buttonlist.empty() )
|
||||
return;
|
||||
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button != button
|
||||
&& toggle_button->isChecked()
|
||||
&& isRadioButton(toggle_button) )
|
||||
{
|
||||
toggle_button->unsetChecked();
|
||||
|
||||
if ( toggle_button->isVisible() && toggle_button->isShown() )
|
||||
toggle_button->redraw();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/fdialog.h"
|
||||
#include "final/fstatusbar.h"
|
||||
|
@ -50,7 +52,7 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FDialog::~FDialog() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
bool is_quit = fapp->isQuit();
|
||||
delete dialog_menu;
|
||||
dgl_menuitem = nullptr;
|
||||
|
@ -69,55 +71,55 @@ FDialog::~FDialog() // destructor
|
|||
|
||||
// public methods of FDialog
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setDialogWidget (bool on)
|
||||
bool FDialog::setDialogWidget (bool enable)
|
||||
{
|
||||
if ( isDialogWidget() == on )
|
||||
if ( isDialogWidget() == enable )
|
||||
return true;
|
||||
|
||||
flags.dialog_widget = on;
|
||||
flags.dialog_widget = enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setTermOffsetWithPadding();
|
||||
else
|
||||
setParentOffset();
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setModal (bool on)
|
||||
bool FDialog::setModal (bool enable)
|
||||
{
|
||||
if ( isModal() == on )
|
||||
if ( isModal() == enable )
|
||||
return true;
|
||||
|
||||
flags.modal = on;
|
||||
flags.modal = enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
modal_dialogs++;
|
||||
else
|
||||
modal_dialogs--;
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setScrollable (bool on)
|
||||
bool FDialog::setScrollable (bool enable)
|
||||
{
|
||||
return (flags.scrollable = on);
|
||||
return (flags.scrollable = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setResizeable (bool on)
|
||||
bool FDialog::setResizeable (bool enable)
|
||||
{
|
||||
FWindow::setResizeable (on);
|
||||
FWindow::setResizeable (enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
zoom_item->setEnable();
|
||||
else
|
||||
zoom_item->setDisable();
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -130,7 +132,7 @@ void FDialog::show()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->enter_loop();
|
||||
|
||||
if ( this == getMainWidget() )
|
||||
|
@ -145,7 +147,7 @@ void FDialog::hide()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->exit_loop();
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +196,7 @@ void FDialog::setPos (int x, int y, bool)
|
|||
, dy = getY() - y
|
||||
, old_x = getTermX()
|
||||
, old_y = getTermY();
|
||||
const FPoint& shadow = getShadow();
|
||||
const auto& shadow = getShadow();
|
||||
rsw = shadow.getX(); // right shadow width;
|
||||
bsh = shadow.getY(); // bottom shadow height
|
||||
old_geometry = getTermGeometryWithShadow();
|
||||
|
@ -304,7 +306,7 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
, old_height = int(getHeight())
|
||||
, dw = old_width - int(w)
|
||||
, dh = old_height - int(h);
|
||||
const FPoint& shadow = getShadow();
|
||||
const auto& shadow = getShadow();
|
||||
int rsw = shadow.getX(); // right shadow width;
|
||||
int bsh = shadow.getY(); // bottom shadow height
|
||||
|
||||
|
@ -705,7 +707,7 @@ void FDialog::onWindowActive (FEvent*)
|
|||
void FDialog::onWindowInactive (FEvent*)
|
||||
{
|
||||
if ( dialog_menu && ! dialog_menu->isVisible() )
|
||||
FWindow::previous_window = this;
|
||||
FWindow::setPreviousWindow(this);
|
||||
|
||||
if ( isVisible() && isEnabled() )
|
||||
drawTitleBar();
|
||||
|
@ -1130,11 +1132,8 @@ inline void FDialog::drawZoomedButton()
|
|||
void FDialog::drawTextBar()
|
||||
{
|
||||
// Fill with spaces (left of the title)
|
||||
std::size_t center_offset
|
||||
, width
|
||||
, zoom_btn
|
||||
, length
|
||||
, x;
|
||||
std::size_t center_offset = 0;
|
||||
std::size_t x = 1;
|
||||
|
||||
if ( getMaxColor() < 16 )
|
||||
setBold();
|
||||
|
@ -1144,12 +1143,14 @@ void FDialog::drawTextBar()
|
|||
else
|
||||
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
||||
|
||||
width = std::size_t(getWidth());
|
||||
zoom_btn = getZoomButtonWidth();
|
||||
length = tb_text.getLength();
|
||||
std::size_t width = getWidth();
|
||||
std::size_t zoom_btn = getZoomButtonWidth();
|
||||
std::size_t length = tb_text.getLength();
|
||||
|
||||
if ( width > length + MENU_BTN + zoom_btn )
|
||||
center_offset = (width - length - MENU_BTN - zoom_btn) / 2;
|
||||
|
||||
for (x = 1; x <= center_offset; x++)
|
||||
for ( ; x <= center_offset; x++)
|
||||
print (' ');
|
||||
|
||||
// Print title bar text
|
||||
|
@ -1313,7 +1314,7 @@ inline void FDialog::deactivateZoomButton()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::activateZoomButton (mouseStates& ms)
|
||||
inline void FDialog::activateZoomButton (const mouseStates& ms)
|
||||
{
|
||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||
|| ms.mouse_y != 1 )
|
||||
|
@ -1325,7 +1326,7 @@ inline void FDialog::activateZoomButton (mouseStates& ms)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::leaveZoomButton (mouseStates& ms)
|
||||
inline void FDialog::leaveZoomButton (const mouseStates& ms)
|
||||
{
|
||||
bool zoom_button_pressed_before = zoom_button_pressed;
|
||||
|
||||
|
@ -1342,7 +1343,7 @@ inline void FDialog::leaveZoomButton (mouseStates& ms)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::pressZoomButton (mouseStates& ms)
|
||||
void FDialog::pressZoomButton (const mouseStates& ms)
|
||||
{
|
||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||
|| ms.mouse_y != 1
|
||||
|
@ -1357,7 +1358,7 @@ void FDialog::pressZoomButton (mouseStates& ms)
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
||||
{
|
||||
const FRect& menu_geometry = dialog_menu->getTermGeometry();
|
||||
const auto& menu_geometry = dialog_menu->getTermGeometry();
|
||||
|
||||
if ( dialog_menu->getCount() > 0 && menu_geometry.contains(termpos) )
|
||||
return true;
|
||||
|
@ -1366,7 +1367,7 @@ inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::passEventToSubMenu ( mouseStates& ms
|
||||
inline void FDialog::passEventToSubMenu ( const mouseStates& ms
|
||||
, FMouseEvent* ev )
|
||||
{
|
||||
// Mouse event handover to the dialog menu
|
||||
|
@ -1375,17 +1376,17 @@ inline void FDialog::passEventToSubMenu ( mouseStates& ms
|
|||
|| ! dialog_menu->isShown() )
|
||||
return;
|
||||
|
||||
const FPoint& g = ms.termPos;
|
||||
const FPoint& p = dialog_menu->termToWidgetPos(g);
|
||||
const auto& g = ms.termPos;
|
||||
const auto& p = dialog_menu->termToWidgetPos(g);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, g, b);
|
||||
dialog_menu->mouse_down = true;
|
||||
setClickedWidget(dialog_menu);
|
||||
dialog_menu->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
dialog_menu->onMouseMove(_ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -1482,7 +1483,7 @@ inline void FDialog::lowerActivateDialog()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
||||
bool FDialog::isLowerRightResizeCorner (const mouseStates& ms)
|
||||
{
|
||||
// 3 characters in the lower right corner |
|
||||
// x
|
||||
|
@ -1501,7 +1502,7 @@ bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::resizeMouseDown (mouseStates& ms)
|
||||
void FDialog::resizeMouseDown (const mouseStates& ms)
|
||||
{
|
||||
// Click on the lower right resize corner
|
||||
|
||||
|
@ -1525,7 +1526,7 @@ void FDialog::resizeMouseDown (mouseStates& ms)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
|
||||
void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
||||
{
|
||||
// Resize the dialog
|
||||
if ( isResizeable() && ! resize_click_pos.isNull() )
|
||||
|
@ -1646,7 +1647,7 @@ void FDialog::delDialog (FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_move (FWidget*, data_ptr)
|
||||
void FDialog::cb_move (FWidget*, FDataPtr)
|
||||
{
|
||||
if ( isZoomed() )
|
||||
return;
|
||||
|
@ -1697,7 +1698,7 @@ void FDialog::cb_move (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_zoom (FWidget*, data_ptr)
|
||||
void FDialog::cb_zoom (FWidget*, FDataPtr)
|
||||
{
|
||||
dialog_menu->unselectItem();
|
||||
dialog_menu->hide();
|
||||
|
@ -1708,7 +1709,7 @@ void FDialog::cb_zoom (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::cb_close (FWidget*, data_ptr)
|
||||
void FDialog::cb_close (FWidget*, FDataPtr)
|
||||
{
|
||||
dialog_menu->unselectItem();
|
||||
dialog_menu->hide();
|
||||
|
|
|
@ -31,16 +31,12 @@ namespace finalcut
|
|||
// class FEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FEvent::FEvent(int ev_type) // constructor
|
||||
FEvent::FEvent (fc::events ev_type) // constructor
|
||||
: t{ev_type}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FEvent::~FEvent() // destructor
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FEvent::type() const
|
||||
fc::events FEvent::type() const
|
||||
{ return t; }
|
||||
|
||||
|
||||
|
@ -48,7 +44,7 @@ int FEvent::type() const
|
|||
// class FKeyEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
|
||||
FKeyEvent::FKeyEvent (fc::events ev_type, FKey key_num) // constructor
|
||||
: FEvent(ev_type)
|
||||
, k{key_num}
|
||||
{ }
|
||||
|
@ -78,7 +74,7 @@ void FKeyEvent::ignore()
|
|||
// class FMouseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, const FPoint& termPos
|
||||
, int button )
|
||||
|
@ -89,7 +85,7 @@ FMouseEvent::FMouseEvent ( int ev_type // constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FMouseEvent::FMouseEvent ( int ev_type // constructor
|
||||
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, int button )
|
||||
: FMouseEvent(ev_type, pos, FPoint(), button)
|
||||
|
@ -132,7 +128,7 @@ int FMouseEvent::getButton() const
|
|||
// class FWheelEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, const FPoint& termPos
|
||||
, int wheel )
|
||||
|
@ -143,7 +139,7 @@ FWheelEvent::FWheelEvent ( int ev_type // constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWheelEvent::FWheelEvent ( int ev_type // constructor
|
||||
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||
, const FPoint& pos
|
||||
, int wheel )
|
||||
: FWheelEvent(ev_type, pos, FPoint(), wheel)
|
||||
|
@ -186,7 +182,7 @@ int FWheelEvent::getWheel() const
|
|||
// class FFocusEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FFocusEvent::FFocusEvent (int ev_type) // constructor
|
||||
FFocusEvent::FFocusEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -231,7 +227,7 @@ void FFocusEvent::ignore()
|
|||
// class FAccelEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FAccelEvent::FAccelEvent(int ev_type, void* focused) // constructor
|
||||
FAccelEvent::FAccelEvent (fc::events ev_type, void* focused) // constructor
|
||||
: FEvent(ev_type)
|
||||
, focus_widget{focused}
|
||||
{ }
|
||||
|
@ -261,7 +257,7 @@ void FAccelEvent::ignore()
|
|||
// class FResizeEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FResizeEvent::FResizeEvent(int ev_type) // constructor
|
||||
FResizeEvent::FResizeEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -286,7 +282,7 @@ void FResizeEvent::ignore()
|
|||
// class FShowEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FShowEvent::FShowEvent(int ev_type) // constructor
|
||||
FShowEvent::FShowEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -294,11 +290,12 @@ FShowEvent::FShowEvent(int ev_type) // constructor
|
|||
FShowEvent::~FShowEvent() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FHideEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FHideEvent::FHideEvent(int ev_type) // constructor
|
||||
FHideEvent::FHideEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -306,11 +303,12 @@ FHideEvent::FHideEvent(int ev_type) // constructor
|
|||
FHideEvent::~FHideEvent() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FCloseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FCloseEvent::FCloseEvent(int ev_type) // constructor
|
||||
FCloseEvent::FCloseEvent (fc::events ev_type) // constructor
|
||||
: FEvent(ev_type)
|
||||
{ }
|
||||
|
||||
|
@ -335,7 +333,7 @@ void FCloseEvent::ignore()
|
|||
// class FTimerEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FTimerEvent::FTimerEvent(int ev_type, int timer_id) // constructor
|
||||
FTimerEvent::FTimerEvent (fc::events ev_type, int timer_id) // constructor
|
||||
: FEvent(ev_type)
|
||||
, id{timer_id}
|
||||
{ }
|
||||
|
@ -345,7 +343,33 @@ FTimerEvent::~FTimerEvent() // destructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTimerEvent::timerId() const
|
||||
int FTimerEvent::getTimerId() const
|
||||
{ return id; }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FUserEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor
|
||||
: FEvent(ev_type)
|
||||
, uid{user_event_id}
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FUserEvent::~FUserEvent() // destructor
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FUserEvent::getUserId() const
|
||||
{ return uid; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FDataPtr FUserEvent::getData() const
|
||||
{ return data_pointer; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FUserEvent::setData (FDataPtr data)
|
||||
{ data_pointer = data; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#undef __STRICT_ANSI__ // need for realpath and strdup
|
||||
#include <strings.h> // need for strcasecmp
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "final/ffiledialog.h"
|
||||
|
@ -178,12 +183,12 @@ void FFileDialog::setFilter (const FString& filter)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FFileDialog::setShowHiddenFiles (bool on)
|
||||
bool FFileDialog::setShowHiddenFiles (bool enable)
|
||||
{
|
||||
if ( on == show_hidden )
|
||||
if ( show_hidden == enable )
|
||||
return show_hidden;
|
||||
|
||||
show_hidden = on;
|
||||
show_hidden = enable;
|
||||
readDir();
|
||||
filebrowser.redraw();
|
||||
return show_hidden;
|
||||
|
@ -220,7 +225,6 @@ const FString FFileDialog::fileOpenChooser ( FWidget* parent
|
|||
, const FString& dirname
|
||||
, const FString& filter )
|
||||
{
|
||||
FFileDialog* fileopen;
|
||||
FString ret;
|
||||
FString path = dirname;
|
||||
FString file_filter = filter;
|
||||
|
@ -236,25 +240,16 @@ const FString FFileDialog::fileOpenChooser ( FWidget* parent
|
|||
if ( file_filter.isNull() || file_filter.isEmpty() )
|
||||
file_filter = FString("*");
|
||||
|
||||
try
|
||||
{
|
||||
fileopen = new FFileDialog ( path
|
||||
FFileDialog fileopen ( path
|
||||
, file_filter
|
||||
, FFileDialog::Open
|
||||
, parent );
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||
return FString();
|
||||
}
|
||||
|
||||
if ( fileopen->exec() == FDialog::Accept )
|
||||
ret = fileopen->getPath() + fileopen->getSelectedFile();
|
||||
if ( fileopen.exec() == FDialog::Accept )
|
||||
ret = fileopen.getPath() + fileopen.getSelectedFile();
|
||||
else
|
||||
ret = FString();
|
||||
|
||||
delete fileopen;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -263,7 +258,6 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
|||
, const FString& dirname
|
||||
, const FString& filter )
|
||||
{
|
||||
FFileDialog* fileopen;
|
||||
FString ret;
|
||||
FString path = dirname;
|
||||
FString file_filter = filter;
|
||||
|
@ -279,25 +273,16 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
|||
if ( file_filter.isNull() || file_filter.isEmpty() )
|
||||
file_filter = FString("*");
|
||||
|
||||
try
|
||||
{
|
||||
fileopen = new FFileDialog ( path
|
||||
FFileDialog fileopen ( path
|
||||
, file_filter
|
||||
, FFileDialog::Save
|
||||
, parent );
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||
return FString();
|
||||
}
|
||||
|
||||
if ( fileopen->exec() == FDialog::Accept )
|
||||
ret = fileopen->getPath() + fileopen->getSelectedFile();
|
||||
if ( fileopen.exec() == FDialog::Accept )
|
||||
ret = fileopen.getPath() + fileopen.getSelectedFile();
|
||||
else
|
||||
ret = FString();
|
||||
|
||||
delete fileopen;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -349,8 +334,8 @@ void FFileDialog::adjustSize()
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::init()
|
||||
{
|
||||
static const std::size_t w = 42;
|
||||
static const std::size_t h = 15;
|
||||
static constexpr std::size_t w = 42;
|
||||
static constexpr std::size_t h = 15;
|
||||
int x, y;
|
||||
|
||||
setGeometry(1, 1, w, h, false);
|
||||
|
@ -744,7 +729,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::printPath (const FString& txt)
|
||||
{
|
||||
const FString& path = txt;
|
||||
const auto& path = txt;
|
||||
const uInt max_width = uInt(filebrowser.getWidth()) - 4;
|
||||
|
||||
if ( path.getLength() > max_width )
|
||||
|
@ -767,7 +752,7 @@ const FString FFileDialog::getHomeDir()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processActivate (FWidget*, FDataPtr)
|
||||
{
|
||||
if ( filename.getText().includes('*')
|
||||
|| filename.getText().includes('?') )
|
||||
|
@ -794,7 +779,7 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
|||
|
||||
if ( ! dir_entries.empty() )
|
||||
{
|
||||
const FString& input = filename.getText().trim();
|
||||
const auto& input = filename.getText().trim();
|
||||
|
||||
for (auto&& entry : dir_entries)
|
||||
{
|
||||
|
@ -815,14 +800,14 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processRowChanged (FWidget*, FDataPtr)
|
||||
{
|
||||
const std::size_t n = filebrowser.currentItem();
|
||||
|
||||
if ( n == 0 )
|
||||
return;
|
||||
|
||||
const FString& name = dir_entries[n - 1].name;
|
||||
const auto& name = FString(dir_entries[n - 1].name);
|
||||
|
||||
if ( dir_entries[n - 1].directory )
|
||||
filename.setText( name + '/' );
|
||||
|
@ -833,7 +818,7 @@ void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processClicked (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processClicked (FWidget*, FDataPtr)
|
||||
{
|
||||
const uLong n = uLong(filebrowser.currentItem() - 1);
|
||||
|
||||
|
@ -844,19 +829,19 @@ void FFileDialog::cb_processClicked (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processCancel (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processCancel (FWidget*, FDataPtr)
|
||||
{
|
||||
done (FDialog::Reject);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processOpen (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processOpen (FWidget*, FDataPtr)
|
||||
{
|
||||
done (FDialog::Accept);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processShowHidden (FWidget*, data_ptr)
|
||||
void FFileDialog::cb_processShowHidden (FWidget*, FDataPtr)
|
||||
{
|
||||
setShowHiddenFiles(! show_hidden);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
|
||||
#include <fcntl.h>
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include <sys/select.h> // need for FD_ZERO, FD_SET, FD_CLR, ...
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "final/fkeyboard.h"
|
||||
#include "final/fkey_map.h"
|
||||
#include "final/ftermios.h"
|
||||
|
@ -30,7 +36,7 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// static class attributes
|
||||
long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
|
||||
uInt64 FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
|
||||
struct timeval FKeyboard::time_keypressed{};
|
||||
|
||||
#if defined(__linux__)
|
||||
|
@ -321,12 +327,12 @@ inline FKey FKeyboard::getSingleKey()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FKeyboard::setNonBlockingInput (bool on)
|
||||
bool FKeyboard::setNonBlockingInput (bool enable)
|
||||
{
|
||||
if ( on == non_blocking_stdin )
|
||||
if ( enable == non_blocking_stdin )
|
||||
return non_blocking_stdin;
|
||||
|
||||
if ( on ) // make stdin non-blocking
|
||||
if ( enable ) // make stdin non-blocking
|
||||
{
|
||||
stdin_status_flags |= O_NONBLOCK;
|
||||
|
||||
|
@ -354,7 +360,7 @@ bool FKeyboard::isKeypressTimeout()
|
|||
FKey FKeyboard::UTF8decode (const char utf8[])
|
||||
{
|
||||
FKey ucs = 0; // Universal coded character
|
||||
const std::size_t max = 4;
|
||||
constexpr std::size_t max = 4;
|
||||
std::size_t len = std::strlen(utf8);
|
||||
|
||||
if ( len > max )
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/flabel.h"
|
||||
#include "final/fstatusbar.h"
|
||||
|
@ -180,34 +182,34 @@ void FLabel::setAlignment (fc::text_alignment align)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FLabel::setEmphasis (bool on)
|
||||
bool FLabel::setEmphasis (bool enable)
|
||||
{
|
||||
if ( emphasis != on )
|
||||
emphasis = on;
|
||||
if ( emphasis != enable )
|
||||
emphasis = enable;
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FLabel::setReverseMode (bool on)
|
||||
bool FLabel::setReverseMode (bool enable)
|
||||
{
|
||||
if ( reverse_mode != on )
|
||||
reverse_mode = on;
|
||||
if ( reverse_mode != enable )
|
||||
reverse_mode = enable;
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FLabel::setEnable (bool on)
|
||||
bool FLabel::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setHotkeyAccelerator();
|
||||
else
|
||||
delAccelerator();
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -272,14 +274,14 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
if ( auto parent = getParentWidget() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
const FPoint& p = parent->termToWidgetPos(tp);
|
||||
const auto& tp = ev->getTermPos();
|
||||
const auto& p = parent->termToWidgetPos(tp);
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -342,7 +344,7 @@ void FLabel::onAccel (FAccelEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
|
||||
void FLabel::cb_accel_widget_destroyed (FWidget*, FDataPtr)
|
||||
{
|
||||
accel_widget = nullptr;
|
||||
delAccelerator();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2018 Markus Gans *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -159,11 +159,11 @@ const FLineEdit& FLineEdit::operator >> (FString& s)
|
|||
|
||||
// public methods of FLineEdit
|
||||
//----------------------------------------------------------------------
|
||||
bool FLineEdit::setEnable (bool on)
|
||||
bool FLineEdit::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( hasFocus() )
|
||||
{
|
||||
|
@ -182,15 +182,15 @@ bool FLineEdit::setEnable (bool on)
|
|||
setBackgroundColor (wc.inputfield_inactive_bg);
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FLineEdit::setFocus (bool on)
|
||||
bool FLineEdit::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
|
@ -199,8 +199,8 @@ bool FLineEdit::setFocus (bool on)
|
|||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
|
@ -219,13 +219,13 @@ bool FLineEdit::setFocus (bool on)
|
|||
}
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FLineEdit::setShadow (bool on)
|
||||
bool FLineEdit::setShadow (bool enable)
|
||||
{
|
||||
if ( on
|
||||
if ( enable
|
||||
&& getEncoding() != fc::VT100
|
||||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
|
@ -690,8 +690,8 @@ void FLineEdit::draw()
|
|||
|
||||
if ( flags.focus && getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
@ -730,18 +730,9 @@ void FLineEdit::drawInputField()
|
|||
|
||||
show_text = text.mid(1 + text_offset, getWidth() - 2);
|
||||
|
||||
if ( isLinuxTerm() && hasUTF8() )
|
||||
{
|
||||
setUTF8(true);
|
||||
|
||||
if ( show_text )
|
||||
print (show_text);
|
||||
|
||||
setUTF8(false);
|
||||
}
|
||||
else if ( show_text )
|
||||
print (show_text);
|
||||
|
||||
x = show_text.getLength();
|
||||
|
||||
while ( x < getWidth() - 1 )
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/flistbox.h"
|
||||
|
@ -48,7 +49,7 @@ FListBoxItem::FListBoxItem (const FListBoxItem& item)
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListBoxItem::FListBoxItem (const FString& txt, FWidget::data_ptr data)
|
||||
FListBoxItem::FListBoxItem (const FString& txt, FDataPtr data)
|
||||
: text(txt)
|
||||
, data_pointer(data)
|
||||
{ }
|
||||
|
@ -92,8 +93,6 @@ FListBox::FListBox (FWidget* parent)
|
|||
FListBox::~FListBox() // destructor
|
||||
{
|
||||
delOwnTimer();
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,7 +162,9 @@ void FListBox::showInsideBrackets ( std::size_t index
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
void FListBox::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
{
|
||||
// Set the widget geometry
|
||||
|
||||
|
@ -182,16 +183,16 @@ void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adj
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FListBox::setFocus (bool on)
|
||||
bool FListBox::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
|
@ -203,7 +204,7 @@ bool FListBox::setFocus (bool on)
|
|||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -262,27 +263,6 @@ void FListBox::insert (FListBoxItem listItem)
|
|||
recalculateVerticalBar (element_count);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::insert ( const FString& item
|
||||
, fc::brackets_type b
|
||||
, bool s
|
||||
, data_ptr d )
|
||||
{
|
||||
FListBoxItem listItem (item, d);
|
||||
listItem.brackets = b;
|
||||
listItem.selected = s;
|
||||
insert (listItem);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::insert ( long item
|
||||
, fc::brackets_type b
|
||||
, bool s
|
||||
, data_ptr d )
|
||||
{
|
||||
insert (FString() << item, b, s, d);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::remove (std::size_t item)
|
||||
{
|
||||
|
@ -817,12 +797,12 @@ void FListBox::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
@ -896,8 +876,8 @@ void FListBox::draw()
|
|||
|
||||
if ( flags.focus && getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
@ -1512,7 +1492,7 @@ void FListBox::nextListItem (int distance)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::scrollToX (int val)
|
||||
{
|
||||
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||
static constexpr std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||
|
||||
if ( xoffset == val )
|
||||
|
@ -1569,7 +1549,7 @@ void FListBox::scrollLeft (int distance)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::scrollRight (int distance)
|
||||
{
|
||||
static const std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||
static constexpr std::size_t padding_space = 2; // 1 leading + 1 trailing space
|
||||
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||
xoffset += distance;
|
||||
|
||||
|
@ -1848,7 +1828,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
||||
void FListBox::cb_VBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType;
|
||||
std::size_t current_before = current;
|
||||
|
@ -1915,9 +1895,9 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::cb_HBarChange (FWidget*, data_ptr)
|
||||
void FListBox::cb_HBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
||||
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
|
||||
FScrollbar::sType scrollType;
|
||||
int distance = 1
|
||||
, pagesize = 4
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include <strings.h> // need for strcasecmp
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
|
@ -35,7 +40,7 @@ namespace finalcut
|
|||
FObject::FObjectIterator FListView::null_iter;
|
||||
|
||||
// Function prototypes
|
||||
long firstNumberFromString (const FString&);
|
||||
uInt64 firstNumberFromString (const FString&);
|
||||
bool sortAscendingByName (const FObject*, const FObject*);
|
||||
bool sortDescendingByName (const FObject*, const FObject*);
|
||||
bool sortAscendingByNumber (const FObject*, const FObject*);
|
||||
|
@ -43,13 +48,13 @@ bool sortDescendingByNumber (const FObject*, const FObject*);
|
|||
|
||||
// non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
long firstNumberFromString (const FString& str)
|
||||
uInt64 firstNumberFromString (const FString& str)
|
||||
{
|
||||
auto last = str.end();
|
||||
auto iter = str.begin();
|
||||
std::size_t pos;
|
||||
std::size_t length;
|
||||
long number;
|
||||
uInt64 number;
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -88,7 +93,7 @@ long firstNumberFromString (const FString& str)
|
|||
|
||||
try
|
||||
{
|
||||
number = num_str.toLong();
|
||||
number = uInt64(num_str.toLong());
|
||||
}
|
||||
catch (const std::exception&)
|
||||
{
|
||||
|
@ -186,7 +191,7 @@ FListViewItem::FListViewItem (FObjectIterator parent_iter)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FListViewItem::FListViewItem ( const FStringList& cols
|
||||
, FWidget::data_ptr data
|
||||
, FDataPtr data
|
||||
, FObjectIterator parent_iter )
|
||||
: FObject(0)
|
||||
, column_list(cols)
|
||||
|
@ -393,9 +398,9 @@ std::size_t FListViewItem::getVisibleLines()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListViewItem::setCheckable (bool on)
|
||||
void FListViewItem::setCheckable (bool enable)
|
||||
{
|
||||
checkable = on;
|
||||
checkable = enable;
|
||||
|
||||
if ( *root )
|
||||
{
|
||||
|
@ -581,8 +586,6 @@ FListView::FListView (FWidget* parent)
|
|||
FListView::~FListView() // destructor
|
||||
{
|
||||
delOwnTimer();
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
// public methods of FListView
|
||||
|
@ -790,7 +793,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FObject::FObjectIterator FListView::insert ( const FStringList& cols
|
||||
, data_ptr d
|
||||
, FDataPtr d
|
||||
, FObjectIterator parent_iter )
|
||||
{
|
||||
FListViewItem* item;
|
||||
|
@ -816,8 +819,8 @@ FObject::FObjectIterator FListView::insert ( const FStringList& cols
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FObject::FObjectIterator FListView::insert ( const std::vector<long>& cols
|
||||
, data_ptr d
|
||||
FObject::FObjectIterator FListView::insert ( const std::vector<uInt64>& cols
|
||||
, FDataPtr d
|
||||
, FObjectIterator parent_iter )
|
||||
{
|
||||
FStringList str_cols;
|
||||
|
@ -1390,12 +1393,12 @@ void FListView::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
@ -1507,8 +1510,8 @@ void FListView::draw()
|
|||
|
||||
if ( flags.focus && getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
@ -1537,7 +1540,7 @@ void FListView::drawHeadlines()
|
|||
|
||||
while ( iter != header.end() )
|
||||
{
|
||||
const FString& text = iter->name;
|
||||
const auto& text = iter->name;
|
||||
|
||||
if ( text.isNull() || text.isEmpty() )
|
||||
{
|
||||
|
@ -1634,11 +1637,11 @@ void FListView::drawListLine ( const FListViewItem* item
|
|||
{
|
||||
for (std::size_t col = 0; col < item->column_list.size(); )
|
||||
{
|
||||
static const std::size_t leading_space = 1;
|
||||
static const std::size_t checkbox_space = 4;
|
||||
static const std::size_t ellipsis_length = 2;
|
||||
static constexpr std::size_t leading_space = 1;
|
||||
static constexpr std::size_t checkbox_space = 4;
|
||||
static constexpr std::size_t ellipsis_length = 2;
|
||||
|
||||
const FString& text = item->column_list[col];
|
||||
const auto& text = item->column_list[col];
|
||||
std::size_t width = std::size_t(header[col].width);
|
||||
std::size_t txt_length = text.getLength();
|
||||
// Increment the value of i for the column position
|
||||
|
@ -1818,11 +1821,11 @@ inline void FListView::drawHeaderBorder (std::size_t length)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::drawHeadlineLabel (headerItems::const_iterator& iter)
|
||||
void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||
{
|
||||
// Print lable text
|
||||
static const std::size_t leading_space = 1;
|
||||
const FString& text = iter->name;
|
||||
static constexpr std::size_t leading_space = 1;
|
||||
const auto& text = iter->name;
|
||||
FString txt = " " + text;
|
||||
std::size_t width = std::size_t(iter->width);
|
||||
std::size_t txt_length = txt.getLength();
|
||||
|
@ -1865,11 +1868,11 @@ void FListView::drawHeadlineLabel (headerItems::const_iterator& iter)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::drawColumnEllipsis ( headerItems::const_iterator& iter
|
||||
void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
||||
, const FString& text )
|
||||
{
|
||||
// Print lable ellipsis
|
||||
static const int ellipsis_length = 2;
|
||||
static constexpr int ellipsis_length = 2;
|
||||
int width = iter->width;
|
||||
|
||||
headerline << ' ';
|
||||
|
@ -1904,7 +1907,7 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
|||
//----------------------------------------------------------------------
|
||||
std::size_t FListView::determineLineWidth (FListViewItem* item)
|
||||
{
|
||||
static const std::size_t padding_space = 1;
|
||||
static constexpr std::size_t padding_space = 1;
|
||||
std::size_t line_width = padding_space; // leading space
|
||||
uInt column_idx = 0;
|
||||
uInt entries = uInt(item->column_list.size());
|
||||
|
@ -2009,7 +2012,7 @@ void FListView::mouseHeaderClicked()
|
|||
|
||||
while ( iter != header.end() )
|
||||
{
|
||||
static const int leading_space = 1;
|
||||
static constexpr int leading_space = 1;
|
||||
bool has_sort_indicator = bool( column == sort_column );
|
||||
int click_width = int(iter->name.getLength());
|
||||
|
||||
|
@ -2506,7 +2509,7 @@ void FListView::scrollBy (int dx, int dy)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::cb_VBarChange (FWidget*, data_ptr)
|
||||
void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
int distance = 1
|
||||
|
@ -2566,7 +2569,7 @@ void FListView::cb_VBarChange (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::cb_HBarChange (FWidget*, data_ptr)
|
||||
void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
int distance = 1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -20,6 +20,7 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
|
@ -53,7 +54,7 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FMenu::~FMenu() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( ! fapp->isQuit() )
|
||||
switchToPrevWindow(this); // Switch to previous window
|
||||
|
@ -62,12 +63,12 @@ FMenu::~FMenu() // destructor
|
|||
|
||||
// public methods of FMenu
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenu::setMenuWidget (bool on)
|
||||
bool FMenu::setMenuWidget (bool enable)
|
||||
{
|
||||
if ( isMenuWidget() == on )
|
||||
if ( isMenuWidget() == enable )
|
||||
return true;
|
||||
|
||||
return (flags.menu_widget = on);
|
||||
return (flags.menu_widget = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -93,7 +94,7 @@ void FMenu::hide()
|
|||
return;
|
||||
|
||||
FWindow::hide();
|
||||
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||
const auto& t_geometry = getTermGeometryWithShadow();
|
||||
restoreVTerm (t_geometry);
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
|
@ -312,7 +313,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
||||
void FMenu::cb_menuitem_toggled (FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto menuitem = static_cast<FMenuItem*>(widget);
|
||||
|
||||
|
@ -392,7 +393,7 @@ bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
|
|||
{
|
||||
if ( opened_sub_menu )
|
||||
{
|
||||
const FRect& submenu_geometry = opened_sub_menu->getTermGeometry();
|
||||
const auto& submenu_geometry = opened_sub_menu->getTermGeometry();
|
||||
|
||||
if ( submenu_geometry.contains(termpos) )
|
||||
return true;
|
||||
|
@ -404,7 +405,7 @@ bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::isMouseOverSuperMenu (const FPoint& termpos)
|
||||
{
|
||||
auto smenu = superMenuAt (termpos);
|
||||
const auto smenu = superMenuAt (termpos);
|
||||
|
||||
if ( smenu )
|
||||
return true;
|
||||
|
@ -893,8 +894,8 @@ void FMenu::mouseMoveOverBorder (mouseStates& ms)
|
|||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
@ -912,17 +913,17 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev)
|
|||
{
|
||||
// Mouse event handover to sub-menu
|
||||
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = opened_sub_menu->termToWidgetPos(t);
|
||||
const auto& t = ev->getTermPos();
|
||||
const auto& p = opened_sub_menu->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, t, b);
|
||||
opened_sub_menu->mouse_down = true;
|
||||
setClickedWidget(opened_sub_menu);
|
||||
opened_sub_menu->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
opened_sub_menu->onMouseMove(_ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -935,18 +936,18 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev)
|
|||
{
|
||||
// Mouse event handover to super-menu
|
||||
|
||||
auto smenu = superMenuAt (ev->getTermPos());
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = smenu->termToWidgetPos(t);
|
||||
const auto& smenu = superMenuAt (ev->getTermPos());
|
||||
const auto& t = ev->getTermPos();
|
||||
const auto& p = smenu->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, t, b);
|
||||
smenu->mouse_down = true;
|
||||
setClickedWidget(smenu);
|
||||
smenu->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
smenu->onMouseMove(_ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -959,19 +960,19 @@ void FMenu::passEventToMenuBar (FMouseEvent*& ev)
|
|||
{
|
||||
// Mouse event handover to the menu bar
|
||||
|
||||
auto menu_bar = getMenuBar();
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = menu_bar->termToWidgetPos(t);
|
||||
const auto& menu_bar = getMenuBar();
|
||||
const auto& t = ev->getTermPos();
|
||||
const auto& p = menu_bar->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, t, b);
|
||||
setClickedWidget(menu_bar);
|
||||
auto mbar = static_cast<FMenuBar*>(menu_bar);
|
||||
mbar->mouse_down = true;
|
||||
mbar->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
auto& mbar = *(static_cast<FMenuBar*>(menu_bar));
|
||||
mbar.mouse_down = true;
|
||||
mbar.onMouseMove(_ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -1357,7 +1358,7 @@ inline void FMenu::drawCheckMarkPrefix (FMenuItem* menuitem)
|
|||
if ( isNewFont() )
|
||||
print (fc::NF_Bullet); // NF_Bullet ●
|
||||
else
|
||||
print (fc::Bullet); // Bullet ●
|
||||
print (fc::BlackCircle); // BlackCircle ●
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1395,7 +1396,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
if ( ! isNewFont()
|
||||
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
|
||||
|| int(data.text[z]) > fc::NF_check_mark )
|
||||
&& ! charEncodable(uInt(data.text[z])) )
|
||||
&& ! charEncodable(wchar_t(data.text[z])) )
|
||||
{
|
||||
data.text[z] = L' ';
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
|
@ -215,7 +216,7 @@ void FMenuBar::onAccel (FAccelEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
|
||||
void FMenuBar::cb_item_deactivated (FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto menuitem = static_cast<FMenuItem*>(widget);
|
||||
|
||||
|
@ -657,7 +658,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenuBar::drawEllipsis (menuText& txtdata, std::size_t x)
|
||||
inline void FMenuBar::drawEllipsis (const menuText& txtdata, std::size_t x)
|
||||
{
|
||||
if ( x > screenWidth + 1 )
|
||||
{
|
||||
|
@ -820,7 +821,7 @@ void FMenuBar::unselectMenuItem (FMenuItem* item)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::mouseDownOverList (FMouseEvent* ev)
|
||||
void FMenuBar::mouseDownOverList (const FMouseEvent* ev)
|
||||
{
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
@ -868,7 +869,7 @@ void FMenuBar::mouseDownOverList (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::mouseUpOverList (FMouseEvent* ev)
|
||||
void FMenuBar::mouseUpOverList (const FMouseEvent* ev)
|
||||
{
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
@ -910,7 +911,7 @@ void FMenuBar::mouseUpOverList (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::mouseMoveOverList (FMouseEvent* ev)
|
||||
void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
|
||||
{
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
@ -970,29 +971,29 @@ void FMenuBar::mouseMoveOverList (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuBar::passEventToMenu (FMouseEvent*& ev)
|
||||
void FMenuBar::passEventToMenu (const FMouseEvent*& ev)
|
||||
{
|
||||
if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() )
|
||||
return;
|
||||
|
||||
// Mouse event handover to the menu
|
||||
auto menu = getSelectedItem()->getMenu();
|
||||
const auto& menu = getSelectedItem()->getMenu();
|
||||
const auto& menu_geometry = menu->getTermGeometry();
|
||||
|
||||
if ( menu->getCount() > 0
|
||||
&& menu_geometry.contains(ev->getTermPos()) )
|
||||
{
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = menu->termToWidgetPos(t);
|
||||
const auto& t = ev->getTermPos();
|
||||
const auto& p = menu->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, t, b);
|
||||
menu->mouse_down = true;
|
||||
setClickedWidget(menu);
|
||||
menu->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
menu->onMouseMove(_ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
#include "final/fdialog.h"
|
||||
#include "final/fmenu.h"
|
||||
|
@ -81,12 +83,12 @@ FMenuItem::~FMenuItem() // destructor
|
|||
|
||||
// public methods of FMenuItem
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::setEnable (bool on)
|
||||
bool FMenuItem::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
auto super = getSuperMenu();
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( super && isMenuBar(super) )
|
||||
{
|
||||
|
@ -101,15 +103,15 @@ bool FMenuItem::setEnable (bool on)
|
|||
super->delAccelerator (this);
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::setFocus (bool on)
|
||||
bool FMenuItem::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
|
@ -147,8 +149,8 @@ bool FMenuItem::setFocus (bool on)
|
|||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
|
@ -161,7 +163,7 @@ bool FMenuItem::setFocus (bool on)
|
|||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -633,7 +635,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
|||
FMenuItem* win_item;
|
||||
uInt32 n = uInt32(std::distance(first, iter));
|
||||
// get the dialog title
|
||||
const FString& name = win->getText();
|
||||
const auto& name = win->getText();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -653,7 +655,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (win_item, &FMenuItem::cb_switchToDialog),
|
||||
static_cast<FWidget::data_ptr>(win)
|
||||
static_cast<FDataPtr>(win)
|
||||
);
|
||||
|
||||
win->addCallback
|
||||
|
@ -680,14 +682,14 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
|||
if ( ! widget )
|
||||
return;
|
||||
|
||||
FMouseEvent* _ev;
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p2 = widget->termToWidgetPos(t);
|
||||
const auto& t = ev->getTermPos();
|
||||
const auto& p2 = widget->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
std::shared_ptr<FMouseEvent> _ev;
|
||||
|
||||
try
|
||||
{
|
||||
_ev = new FMouseEvent (ev_type, p2, t, b);
|
||||
_ev = std::make_shared<FMouseEvent>(ev_type, p2, t, b);
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -698,27 +700,25 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
|||
switch ( int(ev_type) )
|
||||
{
|
||||
case fc::MouseDoubleClick_Event:
|
||||
widget->onMouseDoubleClick(_ev);
|
||||
widget->onMouseDoubleClick(_ev.get());
|
||||
break;
|
||||
|
||||
case fc::MouseDown_Event:
|
||||
widget->onMouseDown(_ev);
|
||||
widget->onMouseDown(_ev.get());
|
||||
break;
|
||||
|
||||
case fc::MouseUp_Event:
|
||||
widget->onMouseUp(_ev);
|
||||
widget->onMouseUp(_ev.get());
|
||||
break;
|
||||
|
||||
case fc::MouseMove_Event:
|
||||
widget->onMouseMove(_ev);
|
||||
widget->onMouseMove(_ev.get());
|
||||
break;
|
||||
}
|
||||
|
||||
delete _ev;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
|
||||
void FMenuItem::cb_switchToDialog (FWidget*, FDataPtr data)
|
||||
{
|
||||
auto win = static_cast<FDialog*>(data);
|
||||
|
||||
|
@ -731,10 +731,10 @@ void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
|
||||
void FMenuItem::cb_destroyDialog (FWidget* widget, FDataPtr)
|
||||
{
|
||||
auto win = static_cast<FDialog*>(widget);
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( win && fapp )
|
||||
{
|
||||
|
|
|
@ -160,97 +160,6 @@ void FMessageBox::setText (const FString& txt)
|
|||
adjustButtons();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FMessageBox::info ( FWidget* parent
|
||||
, const FString& caption
|
||||
, const FString& message
|
||||
, int button0
|
||||
, int button1
|
||||
, int button2 )
|
||||
{
|
||||
int reply;
|
||||
FMessageBox* mbox;
|
||||
|
||||
try
|
||||
{
|
||||
mbox = new FMessageBox ( caption, message
|
||||
, button0, button1, button2
|
||||
, parent );
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||
return FDialog::Reject;
|
||||
}
|
||||
|
||||
reply = mbox->exec();
|
||||
delete mbox;
|
||||
return reply;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FMessageBox::info ( FWidget* parent
|
||||
, const FString& caption
|
||||
, int num
|
||||
, int button0
|
||||
, int button1
|
||||
, int button2 )
|
||||
{
|
||||
int reply;
|
||||
FMessageBox* mbox;
|
||||
|
||||
try
|
||||
{
|
||||
mbox = new FMessageBox ( caption
|
||||
, FString() << num
|
||||
, button0, button1, button2
|
||||
, parent );
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||
return FDialog::Reject;
|
||||
}
|
||||
|
||||
reply = mbox->exec();
|
||||
delete mbox;
|
||||
return reply;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FMessageBox::error ( FWidget* parent
|
||||
, const FString& message
|
||||
, int button0
|
||||
, int button1
|
||||
, int button2 )
|
||||
{
|
||||
int reply;
|
||||
const FString& caption = "Error message";
|
||||
FMessageBox* mbox;
|
||||
|
||||
try
|
||||
{
|
||||
mbox = new FMessageBox ( caption, message
|
||||
, button0, button1, button2
|
||||
, parent );
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
std::cerr << bad_alloc_str << ex.what() << std::endl;
|
||||
return FDialog::Reject;
|
||||
}
|
||||
|
||||
mbox->beep();
|
||||
mbox->setHeadline("Warning:");
|
||||
mbox->setCenterText();
|
||||
mbox->setForegroundColor(mbox->wc.error_box_fg);
|
||||
mbox->setBackgroundColor(mbox->wc.error_box_bg);
|
||||
mbox->emphasis_color = mbox->wc.error_box_emphasis_fg;
|
||||
reply = mbox->exec();
|
||||
delete mbox;
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
// protected methods of FMessageBox
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -280,7 +189,7 @@ void FMessageBox::adjustSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
|
||||
void FMessageBox::cb_processClick (FWidget*, FDataPtr data)
|
||||
{
|
||||
int reply = *(static_cast<int*>(data));
|
||||
done (reply);
|
||||
|
@ -372,7 +281,7 @@ inline void FMessageBox::initCallbacks()
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &FMessageBox::cb_processClick),
|
||||
static_cast<FWidget::data_ptr>(&button_digit[0])
|
||||
static_cast<FDataPtr>(&button_digit[0])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -382,7 +291,7 @@ inline void FMessageBox::initCallbacks()
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &FMessageBox::cb_processClick),
|
||||
static_cast<FWidget::data_ptr>(&button_digit[1])
|
||||
static_cast<FDataPtr>(&button_digit[1])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -392,7 +301,7 @@ inline void FMessageBox::initCallbacks()
|
|||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &FMessageBox::cb_processClick),
|
||||
static_cast<FWidget::data_ptr>(&button_digit[2])
|
||||
static_cast<FDataPtr>(&button_digit[2])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -507,7 +416,7 @@ void FMessageBox::resizeButtons()
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::adjustButtons()
|
||||
{
|
||||
static const std::size_t gap = 4;
|
||||
static constexpr std::size_t gap = 4;
|
||||
std::size_t btn_width = 0;
|
||||
|
||||
for (std::size_t n = 0; n < num_buttons; n++)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <new>
|
||||
#include <stdio.h>
|
||||
|
@ -69,19 +70,19 @@ inline void FMouse::clearEvent()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMouse::setMaxWidth (short x_max)
|
||||
inline void FMouse::setMaxWidth (uInt16 x_max)
|
||||
{
|
||||
max_width = x_max;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMouse::setMaxHeight (short y_max)
|
||||
inline void FMouse::setMaxHeight (uInt16 y_max)
|
||||
{
|
||||
max_height = y_max;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMouse::setDblclickInterval (const long timeout)
|
||||
inline void FMouse::setDblclickInterval (const uInt64 timeout)
|
||||
{
|
||||
dblclick_interval = timeout;
|
||||
}
|
||||
|
@ -321,11 +322,11 @@ void FMouseGPM::processEvent (struct timeval*)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMouseGPM::gpmMouse (bool on)
|
||||
bool FMouseGPM::gpmMouse (bool enable)
|
||||
{
|
||||
// activate/deactivate the gpm mouse support
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
Gpm_Connect conn;
|
||||
conn.eventMask = uInt16(~0); // Get all including wheel event
|
||||
|
@ -351,8 +352,8 @@ bool FMouseGPM::gpmMouse (bool on)
|
|||
Gpm_Close();
|
||||
}
|
||||
|
||||
gpm_mouse_enabled = on;
|
||||
return on;
|
||||
gpm_mouse_enabled = enable;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -497,7 +498,7 @@ void FMouseX11::setRawData (FKeyboard::keybuffer& fifo_buf)
|
|||
{
|
||||
// Import the X11 xterm mouse protocol (SGR-Mode) raw mouse data
|
||||
|
||||
static const std::size_t len = 6;
|
||||
static constexpr std::size_t len = 6;
|
||||
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
||||
std::size_t n;
|
||||
x11_mouse[0] = fifo_buf[3];
|
||||
|
@ -523,7 +524,7 @@ void FMouseX11::processEvent (struct timeval* time)
|
|||
{
|
||||
// Parse and interpret the X11 xterm mouse string
|
||||
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
uChar x, y;
|
||||
int btn;
|
||||
|
||||
|
@ -586,7 +587,7 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
|
|||
{
|
||||
// Get the x11 mouse button state
|
||||
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
|
||||
switch ( btn )
|
||||
{
|
||||
|
@ -713,10 +714,10 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
|||
//----------------------------------------------------------------------
|
||||
void FMouseSGR::processEvent (struct timeval* time)
|
||||
{
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
char* p;
|
||||
int btn;
|
||||
short x, y;
|
||||
uInt16 x, y;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
@ -747,7 +748,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
|||
return;
|
||||
}
|
||||
|
||||
x = short(10 * x + (*p - '0'));
|
||||
x = uInt16(10 * x + (*p - '0'));
|
||||
}
|
||||
|
||||
while ( *p++ && *p != 'M' && *p != 'm' )
|
||||
|
@ -759,7 +760,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
|||
return;
|
||||
}
|
||||
|
||||
y = short(10 * y + (*p - '0'));
|
||||
y = uInt16(10 * y + (*p - '0'));
|
||||
}
|
||||
|
||||
new_mouse_position.setPoint (x, y);
|
||||
|
@ -821,7 +822,7 @@ void FMouseSGR::setPressedButtonState (int btn, struct timeval* time)
|
|||
{
|
||||
// Gets the extended x11 mouse mode (SGR) status for pressed buttons
|
||||
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
|
||||
switch ( btn )
|
||||
{
|
||||
|
@ -954,12 +955,12 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
|||
{
|
||||
// Parse and interpret the X11 xterm mouse string (Urxvt-Mode)
|
||||
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
char* p;
|
||||
bool x_neg;
|
||||
bool y_neg;
|
||||
int btn;
|
||||
short x, y;
|
||||
uInt16 x, y;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
@ -998,7 +999,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
|||
return;
|
||||
}
|
||||
|
||||
x = short(10 * x + (*p - '0'));
|
||||
x = uInt16(10 * x + (*p - '0'));
|
||||
p++;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1018,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
|||
return;
|
||||
}
|
||||
|
||||
y = short(10 * y + (*p - '0'));
|
||||
y = uInt16(10 * y + (*p - '0'));
|
||||
p++;
|
||||
}
|
||||
|
||||
|
@ -1088,7 +1089,7 @@ void FMouseUrxvt::setButtonState (int btn, struct timeval* time)
|
|||
{
|
||||
// Get the urxvt mouse button state
|
||||
|
||||
const FPoint& mouse_position = getPos();
|
||||
const auto& mouse_position = getPos();
|
||||
|
||||
switch ( btn )
|
||||
{
|
||||
|
@ -1226,19 +1227,19 @@ void FMouseControl::setStdinNo (int)
|
|||
#endif // F_HAVE_LIBGPM
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::setMaxWidth (short x_max)
|
||||
void FMouseControl::setMaxWidth (uInt16 x_max)
|
||||
{
|
||||
mouse_protocol[FMouse::urxvt]->setMaxWidth(x_max);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::setMaxHeight (short y_max)
|
||||
void FMouseControl::setMaxHeight (uInt16 y_max)
|
||||
{
|
||||
mouse_protocol[FMouse::urxvt]->setMaxHeight(y_max);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::setDblclickInterval (const long timeout)
|
||||
void FMouseControl::setDblclickInterval (const uInt64 timeout)
|
||||
{
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second )
|
||||
|
@ -1246,15 +1247,15 @@ void FMouseControl::setDblclickInterval (const long timeout)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::useGpmMouse (bool on)
|
||||
void FMouseControl::useGpmMouse (bool enable)
|
||||
{
|
||||
use_gpm_mouse = on;
|
||||
use_gpm_mouse = enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::useXtermMouse (bool on)
|
||||
void FMouseControl::useXtermMouse (bool enable)
|
||||
{
|
||||
use_xterm_mouse = on;
|
||||
use_xterm_mouse = enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1574,14 +1575,14 @@ FMouse* FMouseControl::getMouseWithEvent()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouseControl::xtermMouse (bool on)
|
||||
void FMouseControl::xtermMouse (bool enable)
|
||||
{
|
||||
// activate/deactivate the xterm mouse support
|
||||
|
||||
if ( ! use_xterm_mouse )
|
||||
return;
|
||||
|
||||
FTermXTerminal::setMouseSupport (on);
|
||||
FTermXTerminal::setMouseSupport (enable);
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fobject.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -30,6 +32,7 @@ bool FObject::timer_modify_lock;
|
|||
FObject::TimerList* FObject::timer_list = nullptr;
|
||||
const FString* fc::emptyFString::empty_string = nullptr;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FObject
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -52,7 +55,7 @@ FObject::FObject (FObject* parent)
|
|||
{
|
||||
try
|
||||
{
|
||||
timer_list = new TimerList();
|
||||
timer_list = new TimerList;
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -168,6 +171,26 @@ void FObject::delChild (FObject* obj)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
// Receives events on this object
|
||||
|
||||
if ( ev->type() == fc::Timer_Event )
|
||||
{
|
||||
onTimer ( static_cast<FTimerEvent*>(ev) );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ev->type() == fc::User_Event )
|
||||
{
|
||||
onUserEvent ( static_cast<FUserEvent*>(ev) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObject::getCurrentTime (timeval* time)
|
||||
{
|
||||
|
@ -198,11 +221,11 @@ void FObject::getCurrentTime (timeval* time)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::isTimeout (timeval* time, long timeout)
|
||||
bool FObject::isTimeout (timeval* time, uInt64 timeout)
|
||||
{
|
||||
// Checks whether the specified time span (timeout in µs) has elapse
|
||||
|
||||
long diff_usec;
|
||||
uInt64 diff_usec;
|
||||
struct timeval now;
|
||||
struct timeval diff;
|
||||
|
||||
|
@ -216,7 +239,7 @@ bool FObject::isTimeout (timeval* time, long timeout)
|
|||
diff.tv_usec += 1000000;
|
||||
}
|
||||
|
||||
diff_usec = (diff.tv_sec * 1000000) + diff.tv_usec;
|
||||
diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec);
|
||||
return ( diff_usec > timeout );
|
||||
}
|
||||
|
||||
|
@ -343,21 +366,11 @@ bool FObject::delAllTimer()
|
|||
|
||||
// protected methods of FObject
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
// Receives events on this object
|
||||
|
||||
if ( ev->type() == fc::Timer_Event )
|
||||
{
|
||||
onTimer ( const_cast<FTimerEvent*>(static_cast<const FTimerEvent*>(ev)) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
void FObject::onTimer (FTimerEvent*)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObject::onTimer (FTimerEvent*)
|
||||
void FObject::onUserEvent (FUserEvent*)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -557,7 +557,7 @@ char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
|
|||
|
||||
// Simulate invisible characters
|
||||
if ( ! F_enter_secure_mode.cap && next->attr.bit.invisible )
|
||||
next->code = ' ';
|
||||
next->encoded_code = ' ';
|
||||
|
||||
// Look for no changes
|
||||
if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) )
|
||||
|
|
|
@ -537,7 +537,7 @@ void FOptiMove::calculateCharDuration()
|
|||
{
|
||||
if ( baudrate != 0 )
|
||||
{
|
||||
static const int baudbyte = 9; // = 7 bit + 1 parity + 1 stop
|
||||
static constexpr int baudbyte = 9; // = 7 bit + 1 parity + 1 stop
|
||||
char_duration = (baudbyte * 1000 * 10)
|
||||
/ (baudrate > 0 ? baudrate : 9600); // milliseconds
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ void FProgressbar::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FProgressbar::setShadow (bool on)
|
||||
bool FProgressbar::setShadow (bool enable)
|
||||
{
|
||||
if ( on
|
||||
if ( enable
|
||||
&& getEncoding() != fc::VT100
|
||||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ bool FProgressbar::setShadow (bool on)
|
|||
setShadowSize(0, 0);
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fscrollview.h"
|
||||
#include "final/fwindow.h"
|
||||
|
||||
|
@ -42,8 +44,6 @@ FScrollView::FScrollView (FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FScrollView::~FScrollView() // destructor
|
||||
{
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
removeArea (viewport);
|
||||
child_print_area = viewport = nullptr;
|
||||
}
|
||||
|
@ -275,15 +275,15 @@ void FScrollView::setPrintPos (int x, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FScrollView::setViewportPrint (bool on)
|
||||
bool FScrollView::setViewportPrint (bool enable)
|
||||
{
|
||||
return (use_own_print_area = ! on);
|
||||
return (use_own_print_area = ! enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FScrollView::setBorder (bool on)
|
||||
bool FScrollView::setBorder (bool enable)
|
||||
{
|
||||
return (border = on);
|
||||
return (border = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -764,12 +764,12 @@ void FScrollView::init_scrollbar()
|
|||
{
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
@ -878,7 +878,7 @@ void FScrollView::setViewportCursor()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::cb_VBarChange (FWidget*, data_ptr)
|
||||
void FScrollView::cb_VBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
int distance = 1;
|
||||
|
@ -930,7 +930,7 @@ void FScrollView::cb_VBarChange (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::cb_HBarChange (FWidget*, data_ptr)
|
||||
void FScrollView::cb_HBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
int distance = 1;
|
||||
|
|
|
@ -86,12 +86,12 @@ void FStatusKey::setActive()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FStatusKey::setMouseFocus(bool on)
|
||||
bool FStatusKey::setMouseFocus(bool enable)
|
||||
{
|
||||
if ( on == mouse_focus )
|
||||
if ( mouse_focus == enable )
|
||||
return true;
|
||||
|
||||
return (mouse_focus = on);
|
||||
return (mouse_focus = enable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -479,7 +479,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
|
||||
void FStatusBar::cb_statuskey_activated (FWidget* widget, FDataPtr)
|
||||
{
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
|
|
|
@ -422,7 +422,7 @@ std::size_t FString::getUTF8length() const
|
|||
//----------------------------------------------------------------------
|
||||
FString& FString::sprintf (const FString format, ...)
|
||||
{
|
||||
static const int BUFSIZE = 4096;
|
||||
static constexpr int BUFSIZE = 4096;
|
||||
wchar_t buffer[BUFSIZE];
|
||||
va_list args;
|
||||
|
||||
|
@ -896,7 +896,7 @@ FString& FString::setString (const FString& s)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::setNumber (long num)
|
||||
FString& FString::setNumber (sInt64 num)
|
||||
{
|
||||
wchar_t* s;
|
||||
bool neg;
|
||||
|
@ -931,7 +931,7 @@ FString& FString::setNumber (long num)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::setNumber (uLong num)
|
||||
FString& FString::setNumber (uInt64 num)
|
||||
{
|
||||
wchar_t* s;
|
||||
wchar_t buf[30];
|
||||
|
@ -951,7 +951,7 @@ FString& FString::setNumber (uLong num)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::setNumber (lDouble num, int precision)
|
||||
FString& FString::setNumber (lDouble f_num, int precision)
|
||||
{
|
||||
wchar_t* s;
|
||||
wchar_t format[20]; // = "%.<precision>Lg"
|
||||
|
@ -980,11 +980,11 @@ FString& FString::setNumber (lDouble num, int precision)
|
|||
*s++ = L'g';
|
||||
*s = L'\0';
|
||||
|
||||
return sprintf(format, num);
|
||||
return sprintf(format, f_num);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::setFormatedNumber (long num, char separator)
|
||||
FString& FString::setFormatedNumber (sInt64 num, char separator)
|
||||
{
|
||||
int n;
|
||||
wchar_t* s;
|
||||
|
@ -1027,7 +1027,7 @@ FString& FString::setFormatedNumber (long num, char separator)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString& FString::setFormatedNumber (uLong num, char separator)
|
||||
FString& FString::setFormatedNumber (uInt64 num, char separator)
|
||||
{
|
||||
int n;
|
||||
wchar_t* s;
|
||||
|
|
145
src/fterm.cpp
145
src/fterm.cpp
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2018 Markus Gans *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -21,7 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -140,39 +140,42 @@ void FTerm::setTermType (const char term_name[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setInsertCursor (bool on)
|
||||
void FTerm::setInsertCursor (bool enable)
|
||||
{
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setInsertCursorStyle();
|
||||
else
|
||||
setOverwriteCursorStyle();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::redefineDefaultColors (bool on)
|
||||
void FTerm::redefineDefaultColors (bool enable)
|
||||
{
|
||||
xterm->redefineDefaultColors (on);
|
||||
if ( isNewFont() ) // NewFont need the reverse-video attribute
|
||||
return;
|
||||
|
||||
xterm->redefineDefaultColors (enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setDblclickInterval (const long timeout)
|
||||
void FTerm::setDblclickInterval (const uInt64 timeout)
|
||||
{
|
||||
mouse->setDblclickInterval(timeout);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FTerm::setUTF8 (bool on) // UTF-8 (Unicode)
|
||||
bool FTerm::setUTF8 (bool enable) // UTF-8 (Unicode)
|
||||
{
|
||||
if ( on == data->isUTF8() )
|
||||
return on;
|
||||
if ( data->isUTF8() == enable )
|
||||
return enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
data->setUTF8(true);
|
||||
else
|
||||
data->setUTF8(false);
|
||||
|
||||
#if defined(__linux__)
|
||||
linux->setUTF8 (on);
|
||||
linux->setUTF8 (enable);
|
||||
#endif
|
||||
|
||||
return data->isUTF8();
|
||||
|
@ -278,7 +281,7 @@ bool FTerm::setOldFont()
|
|||
if ( isXTerminal() || isScreenTerm()
|
||||
|| isUrxvtTerminal() || FTermcap::osc_support )
|
||||
{
|
||||
const FString& font = data->getXtermFont();
|
||||
const auto& font = data->getXtermFont();
|
||||
|
||||
if ( font.getLength() > 2 )
|
||||
{
|
||||
|
@ -380,16 +383,16 @@ char* FTerm::moveCursor (int xold, int yold, int xnew, int ynew)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
char* FTerm::cursorsVisibility (bool on)
|
||||
char* FTerm::cursorsVisibility (bool enable)
|
||||
{
|
||||
// Hides or shows the input cursor on the terminal
|
||||
|
||||
char* visibility_str = nullptr;
|
||||
|
||||
if ( on == data->isCursorHidden() )
|
||||
if ( data->isCursorHidden() == enable )
|
||||
return 0;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
visibility_str = disableCursor();
|
||||
|
||||
|
@ -418,7 +421,7 @@ char* FTerm::enableCursor()
|
|||
{
|
||||
// Returns the cursor enable string
|
||||
|
||||
static const std::size_t SIZE = 32;
|
||||
static constexpr std::size_t SIZE = 32;
|
||||
static char enable_str[SIZE] = { };
|
||||
const auto& vs = TCAP(fc::t_cursor_visible);
|
||||
const auto& ve = TCAP(fc::t_cursor_normal);
|
||||
|
@ -693,26 +696,69 @@ std::string FTerm::getEncodingString()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FTerm::charEncodable (uInt c)
|
||||
bool FTerm::charEncodable (wchar_t c)
|
||||
{
|
||||
uInt ch = charEncode(c);
|
||||
wchar_t ch = charEncode(c);
|
||||
return bool(ch > 0 && ch != c);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uInt FTerm::charEncode (uInt c)
|
||||
wchar_t FTerm::charEncode (wchar_t c)
|
||||
{
|
||||
return charEncode (c, data->getTermEncoding());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uInt FTerm::charEncode (uInt c, fc::encoding enc)
|
||||
wchar_t FTerm::charEncode (wchar_t c, fc::encoding enc)
|
||||
{
|
||||
for (std::size_t i = 0; i <= uInt(fc::lastCharItem); i++)
|
||||
wchar_t ch_enc = c;
|
||||
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++)
|
||||
{
|
||||
if ( fc::character[i][fc::UTF8] == c )
|
||||
if ( fc::character[i][fc::UTF8] == uInt(c) )
|
||||
{
|
||||
c = fc::character[i][enc];
|
||||
ch_enc = wchar_t(fc::character[i][enc]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( enc == fc::PC && ch_enc == c )
|
||||
ch_enc = FTerm::unicode_to_cp437(c);
|
||||
|
||||
return ch_enc;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
wchar_t FTerm::cp437_to_unicode (uChar c)
|
||||
{
|
||||
constexpr std::size_t CP437 = 0;
|
||||
constexpr std::size_t UNICODE = 1;
|
||||
wchar_t ucs = wchar_t(c);
|
||||
|
||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
||||
{
|
||||
if ( fc::cp437_to_ucs[i][CP437] == c ) // found
|
||||
{
|
||||
ucs = fc::cp437_to_ucs[UNICODE][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ucs;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uChar FTerm::unicode_to_cp437 (wchar_t ucs)
|
||||
{
|
||||
constexpr std::size_t CP437 = 0;
|
||||
constexpr std::size_t UNICODE = 1;
|
||||
uChar c = '?';
|
||||
|
||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
||||
{
|
||||
if ( fc::cp437_to_ucs[i][UNICODE] == ucs ) // found
|
||||
{
|
||||
c = uChar(fc::cp437_to_ucs[i][CP437]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -941,7 +987,7 @@ void FTerm::init_alt_charset()
|
|||
{
|
||||
// Read the used VT100 pairs
|
||||
|
||||
std::map <uChar,uChar> vt100_alt_char;
|
||||
std::unordered_map<uChar, uChar> vt100_alt_char;
|
||||
|
||||
if ( TCAP(fc::t_acs_chars) )
|
||||
{
|
||||
|
@ -1044,15 +1090,27 @@ void FTerm::init_pc_charset()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_cygwin_charmap()
|
||||
{
|
||||
// Replace don't printable characters in a Cygwin terminal
|
||||
// Replace don't printable PC charset characters in a Cygwin terminal
|
||||
|
||||
if ( ! isCygwinTerminal() )
|
||||
return;
|
||||
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
{
|
||||
if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle // ▲
|
||||
|| fc::character[i][fc::UTF8] == fc::BlackDownPointingTriangle // ▼
|
||||
if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle ) // ▲
|
||||
fc::character[i][fc::PC] = 0x18;
|
||||
|
||||
if ( fc::character[i][fc::UTF8] == fc::BlackDownPointingTriangle ) // ▼
|
||||
fc::character[i][fc::PC] = 0x19;
|
||||
|
||||
if ( fc::character[i][fc::UTF8] == fc::InverseBullet // ◘
|
||||
|| fc::character[i][fc::UTF8] == fc::InverseWhiteCircle // ◙
|
||||
|| fc::character[i][fc::UTF8] == fc::UpDownArrow // ↕
|
||||
|| fc::character[i][fc::UTF8] == fc::LeftRightArrow // ↔
|
||||
|| fc::character[i][fc::UTF8] == fc::DoubleExclamationMark // ‼
|
||||
|| fc::character[i][fc::UTF8] == fc::BlackRectangle // ▬
|
||||
|| fc::character[i][fc::UTF8] == fc::RightwardsArrow // →
|
||||
|| fc::character[i][fc::UTF8] == fc::Section // §
|
||||
|| fc::character[i][fc::UTF8] == fc::SquareRoot ) // SquareRoot √
|
||||
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
||||
}
|
||||
|
@ -1350,7 +1408,7 @@ void FTerm::init_individual_term_encoding()
|
|||
data->setTermEncoding (fc::PC);
|
||||
Fputchar = &FTerm::putchar_ASCII; // function pointer
|
||||
|
||||
if ( hasUTF8() )
|
||||
if ( hasUTF8() && init_values.encoding == fc::UNKNOWN )
|
||||
{
|
||||
if ( isLinuxTerm() )
|
||||
setUTF8(false);
|
||||
|
@ -1405,8 +1463,8 @@ void FTerm::init_captureFontAndTitle()
|
|||
// Save the used xterm font and window title
|
||||
|
||||
xterm->captureFontAndTitle();
|
||||
const FString* font = xterm->getFont();
|
||||
const FString* title = xterm->getTitle();
|
||||
const auto font = xterm->getFont();
|
||||
const auto title = xterm->getTitle();
|
||||
|
||||
if ( font )
|
||||
data->setXtermFont(*font);
|
||||
|
@ -1543,8 +1601,8 @@ void FTerm::enableMouse()
|
|||
xterm_mouse = true;
|
||||
|
||||
keyboard->enableMouseSequences();
|
||||
mouse->setMaxWidth (short(getColumnNumber()));
|
||||
mouse->setMaxHeight (short(getLineNumber()));
|
||||
mouse->setMaxWidth (uInt16(getColumnNumber()));
|
||||
mouse->setMaxHeight (uInt16(getLineNumber()));
|
||||
// Enable the linux general purpose mouse (gpm) server
|
||||
mouse->useGpmMouse (gpm_mouse);
|
||||
// Enable xterm mouse support
|
||||
|
@ -1844,6 +1902,7 @@ void FTerm::init (bool disable_alt_screen)
|
|||
void FTerm::initOSspecifics()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
linux->setFTermData(data);
|
||||
linux->setFTermDetection(term_detection);
|
||||
linux->init(); // Initialize Linux console
|
||||
|
||||
|
@ -1904,7 +1963,7 @@ void FTerm::finish()
|
|||
{
|
||||
// Set default signal handler
|
||||
|
||||
const FString& title = data->getXtermTitle();
|
||||
const auto& title = data->getXtermTitle();
|
||||
resetSignalHandler();
|
||||
|
||||
if ( title && isXTerminal() && ! isRxvtTerminal() )
|
||||
|
@ -1989,23 +2048,6 @@ void FTerm::finish_encoding()
|
|||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uInt FTerm::cp437_to_unicode (uChar c)
|
||||
{
|
||||
uInt ucs = uInt(c);
|
||||
|
||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
||||
{
|
||||
if ( fc::cp437_to_ucs[i][0] == c ) // found
|
||||
{
|
||||
ucs = fc::cp437_to_ucs[i][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ucs;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setSignalHandler()
|
||||
{
|
||||
|
@ -2060,7 +2102,6 @@ void FTerm::signal_handler (int signum)
|
|||
, strsignal(signum) );
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FTerm non-member functions
|
||||
|
|
|
@ -38,7 +38,7 @@ FTermBuffer::~FTermBuffer() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
int FTermBuffer::writef (const FString format, ...)
|
||||
{
|
||||
static const int BUFSIZE = 4096;
|
||||
static constexpr int BUFSIZE = 4096;
|
||||
wchar_t buffer[BUFSIZE];
|
||||
va_list args;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "final/ftermcap.h"
|
||||
|
@ -81,8 +82,8 @@ void FTermcap::init()
|
|||
void FTermcap::termcap()
|
||||
{
|
||||
std::vector<std::string> terminals;
|
||||
static const int success = 1;
|
||||
static const int uninitialized = -2;
|
||||
static constexpr int success = 1;
|
||||
static constexpr int uninitialized = -2;
|
||||
static char term_buffer[2048];
|
||||
static char string_buf[2048];
|
||||
char* buffer = string_buf;
|
||||
|
@ -128,9 +129,9 @@ void FTermcap::termcap()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcap::termcapError (int status)
|
||||
{
|
||||
static const int no_entry = 0;
|
||||
static const int db_not_found = -1;
|
||||
static const int uninitialized = -2;
|
||||
static constexpr int no_entry = 0;
|
||||
static constexpr int db_not_found = -1;
|
||||
static constexpr int uninitialized = -2;
|
||||
|
||||
if ( status == no_entry || status == uninitialized )
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "final/ftermcapquirks.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -503,7 +505,7 @@ void FTermcapQuirks::screen()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::general()
|
||||
{
|
||||
static const int not_available = -1;
|
||||
static constexpr int not_available = -1;
|
||||
|
||||
if ( FTermcap::tabstop == not_available )
|
||||
FTermcap::tabstop = 8;
|
||||
|
|
|
@ -79,11 +79,7 @@ FTermDetection::FTermDetection()
|
|||
//----------------------------------------------------------------------
|
||||
FTermDetection::~FTermDetection() // destructor
|
||||
{
|
||||
if ( sec_da )
|
||||
delete sec_da;
|
||||
|
||||
if ( answer_back )
|
||||
delete answer_back;
|
||||
deallocation();
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,6 +103,8 @@ void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetection::detect()
|
||||
{
|
||||
deallocation();
|
||||
|
||||
// Set the variable 'termtype' to the predefined type of the terminal
|
||||
getSystemTermType();
|
||||
|
||||
|
@ -119,6 +117,16 @@ void FTermDetection::detect()
|
|||
|
||||
|
||||
// private methods of FTermDetection
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDetection::deallocation()
|
||||
{
|
||||
if ( sec_da )
|
||||
delete sec_da;
|
||||
|
||||
if ( answer_back )
|
||||
delete answer_back;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDetection::getSystemTermType()
|
||||
{
|
||||
|
@ -515,7 +523,7 @@ const FString FTermDetection::getXTermColorName (int color)
|
|||
int stdin_no = FTermios::getStdIn();
|
||||
|
||||
char temp[512] = { };
|
||||
std::fprintf (stdout, OSC "4;%3d;?" BEL, color); // get color
|
||||
std::fprintf (stdout, OSC "4;%d;?" BEL, color); // get color
|
||||
std::fflush(stdout);
|
||||
|
||||
FD_ZERO(&ifds);
|
||||
|
|
|
@ -144,7 +144,7 @@ bool FTermFreeBSD::saveFreeBSDAltKey()
|
|||
{
|
||||
// Saving the current mapping for the alt key
|
||||
|
||||
static const int left_alt = 0x38;
|
||||
static constexpr int left_alt = 0x38;
|
||||
int ret;
|
||||
keymap_t keymap;
|
||||
|
||||
|
@ -163,7 +163,7 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
|||
{
|
||||
// Remapping the alt key
|
||||
|
||||
static const int left_alt = 0x38;
|
||||
static constexpr int left_alt = 0x38;
|
||||
int ret;
|
||||
keymap_t keymap;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -20,7 +20,11 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <map>
|
||||
#if defined(__CYGWIN__)
|
||||
#undef __STRICT_ANSI__ // need for fileno
|
||||
#endif
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "final/ftermios.h"
|
||||
#include "final/fterm.h"
|
||||
|
@ -155,17 +159,17 @@ void FTermios::unsetCaptureSendCharacters()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FTermios::setRawMode (bool on)
|
||||
bool FTermios::setRawMode (bool enable)
|
||||
{
|
||||
// set + unset flags for raw mode
|
||||
if ( on == raw_mode )
|
||||
if ( raw_mode == enable )
|
||||
return raw_mode;
|
||||
|
||||
// Info under: man 3 termios
|
||||
struct termios t;
|
||||
tcgetattr (stdin_no, &t);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
// local mode
|
||||
#if DEBUG
|
||||
|
@ -205,7 +209,7 @@ bool FTermios::setRawMode (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
uInt FTermios::getBaudRate()
|
||||
{
|
||||
std::map<speed_t,uInt> outspeed;
|
||||
std::unordered_map<speed_t, uInt> outspeed;
|
||||
outspeed[B0] = 0; // hang up
|
||||
outspeed[B50] = 50; // 50 baud
|
||||
outspeed[B75] = 75; // 75 baud
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* Copyright 2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -44,6 +44,7 @@ namespace finalcut
|
|||
bool FTermLinux::half_block_character = true;
|
||||
bool FTermLinux::has_saved_palette = false;
|
||||
|
||||
FTermData* FTermLinux::fterm_data = nullptr;
|
||||
FTermDetection* FTermLinux::term_detection = nullptr;
|
||||
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style;
|
||||
FTermLinux::ColorMap FTermLinux::saved_color_map;
|
||||
|
@ -100,12 +101,12 @@ char* FTermLinux::setCursorStyle ( fc::linuxConsoleCursorStyle style
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinux::setUTF8 (bool on)
|
||||
void FTermLinux::setUTF8 (bool enable)
|
||||
{
|
||||
if ( ! FTerm::isLinuxTerm() )
|
||||
return;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
FTerm::putstring (ESC "%G");
|
||||
else
|
||||
FTerm::putstring (ESC "%@");
|
||||
|
@ -191,7 +192,7 @@ void FTermLinux::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
||||
{
|
||||
uInt c1, c2, c3, c4, c5;
|
||||
constexpr sInt16 NOT_FOUND = -1;
|
||||
|
||||
if ( new_font || vga_font )
|
||||
return;
|
||||
|
@ -200,43 +201,31 @@ void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
|||
{
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
{
|
||||
bool known_unicode = false;
|
||||
auto ucs = wchar_t(char_map[i][fc::UTF8]);
|
||||
sInt16 fontpos = getFontPos(ucs);
|
||||
|
||||
for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++)
|
||||
{
|
||||
if ( char_map[i][fc::UTF8] == screen_unicode_map.entries[n].unicode )
|
||||
{
|
||||
if ( screen_unicode_map.entries[n].fontpos < 256 )
|
||||
known_unicode = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! known_unicode )
|
||||
// Fix for a non-cp437 Linux console with PC charset encoding
|
||||
if ( fontpos > 255 || fontpos == NOT_FOUND )
|
||||
char_map[i][fc::PC] = char_map[i][fc::ASCII];
|
||||
}
|
||||
}
|
||||
|
||||
c1 = fc::UpperHalfBlock;
|
||||
c2 = fc::LowerHalfBlock;
|
||||
c3 = fc::FullBlock;
|
||||
|
||||
if ( FTerm::charEncode(c1, fc::PC) == FTerm::charEncode(c1, fc::ASCII)
|
||||
|| FTerm::charEncode(c2, fc::PC) == FTerm::charEncode(c2, fc::ASCII)
|
||||
|| FTerm::charEncode(c3, fc::PC) == FTerm::charEncode(c3, fc::ASCII) )
|
||||
// Character substitutions for missing characters
|
||||
if ( fontpos == NOT_FOUND )
|
||||
{
|
||||
shadow_character = false;
|
||||
characterFallback (ucs, { L'▲', L'↑', L'^' });
|
||||
characterFallback (ucs, { L'▼', L'↓', L'v' });
|
||||
characterFallback (ucs, { L'►', L'▶', L'→', L'>' });
|
||||
characterFallback (ucs, { L'◄', L'◀', L'←', L'<' });
|
||||
characterFallback (ucs, { L'●', L'◆', L'⬤', L'*' });
|
||||
characterFallback (ucs, { L'•', L'●', L'◆', L'⬤', L'*' });
|
||||
characterFallback (ucs, { L'×', L'❌', L'x' });
|
||||
characterFallback (ucs, { L'÷', L'➗', L'/' });
|
||||
characterFallback (ucs, { L'√', L'✓', L'x' });
|
||||
characterFallback (ucs, { L'ˣ', L'ⁿ', L'ˆ', L'`' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c4 = fc::RightHalfBlock;
|
||||
c5 = fc::LeftHalfBlock;
|
||||
|
||||
if ( FTerm::charEncode(c4, fc::PC) == FTerm::charEncode(c4, fc::ASCII)
|
||||
|| FTerm::charEncode(c5, fc::PC) == FTerm::charEncode(c5, fc::ASCII) )
|
||||
{
|
||||
half_block_character = false;
|
||||
}
|
||||
initSpecialCharacter();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -515,7 +504,7 @@ int FTermLinux::getFramebuffer_bpp()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermLinux::getScreenFont()
|
||||
{
|
||||
static const std::size_t data_size = 4 * 32 * 512;
|
||||
static constexpr std::size_t data_size = 4 * 32 * 512;
|
||||
struct console_font_op font;
|
||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||
|
||||
|
@ -737,7 +726,7 @@ inline uInt16 FTermLinux::getInputStatusRegisterOne()
|
|||
// Gets the VGA input-status-register-1
|
||||
|
||||
// Miscellaneous output (read port)
|
||||
static const uInt16 misc_read = 0x3cc;
|
||||
static constexpr uInt16 misc_read = 0x3cc;
|
||||
const uInt16 io_base = ( inb(misc_read) & 0x01 ) ? 0x3d0 : 0x3b0;
|
||||
// 0x3ba : Input status 1 MDA (read port)
|
||||
// 0x3da : Input status 1 CGA (read port)
|
||||
|
@ -751,9 +740,9 @@ uChar FTermLinux::readAttributeController (uChar index)
|
|||
|
||||
uChar res;
|
||||
// Attribute controller (write port)
|
||||
static const uInt16 attrib_cntlr_write = 0x3c0;
|
||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||
// Attribute controller (read port)
|
||||
static const uInt16 attrib_cntlr_read = 0x3c1;
|
||||
static constexpr uInt16 attrib_cntlr_read = 0x3c1;
|
||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||
|
||||
inb (input_status_1); // switch to index mode
|
||||
|
@ -773,7 +762,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
|||
// Writes a byte from the attribute controller from a given index
|
||||
|
||||
// Attribute controller (write port)
|
||||
static const uInt16 attrib_cntlr_write = 0x3c0;
|
||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||
const uInt16 input_status_1 = getInputStatusRegisterOne();
|
||||
|
||||
inb (input_status_1); // switch to index mode
|
||||
|
@ -790,7 +779,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
|
|||
inline uChar FTermLinux::getAttributeMode()
|
||||
{
|
||||
// Gets the attribute mode value from the vga attribute controller
|
||||
static const uChar attrib_mode = 0x10;
|
||||
static constexpr uChar attrib_mode = 0x10;
|
||||
return readAttributeController(attrib_mode);
|
||||
}
|
||||
|
||||
|
@ -798,12 +787,12 @@ inline uChar FTermLinux::getAttributeMode()
|
|||
inline void FTermLinux::setAttributeMode (uChar data)
|
||||
{
|
||||
// Sets the attribute mode value from the vga attribute controller
|
||||
static const uChar attrib_mode = 0x10;
|
||||
static constexpr uChar attrib_mode = 0x10;
|
||||
writeAttributeController (attrib_mode, data);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTermLinux::setBlinkAsIntensity (bool on)
|
||||
int FTermLinux::setBlinkAsIntensity (bool enable)
|
||||
{
|
||||
// Uses blink-bit as background intensity.
|
||||
// That permits 16 colors for background
|
||||
|
@ -824,7 +813,7 @@ int FTermLinux::setBlinkAsIntensity (bool on)
|
|||
if ( ioctl(fd_tty, KDENABIO, 0) < 0 )
|
||||
return -1; // error on KDENABIO
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setAttributeMode (getAttributeMode() & 0xF7); // clear bit 3
|
||||
else
|
||||
setAttributeMode (getAttributeMode() | 0x08); // set bit 3
|
||||
|
@ -883,14 +872,14 @@ bool FTermLinux::resetVGAPalette()
|
|||
{
|
||||
rgb defaultColor[16] =
|
||||
{
|
||||
{0x00, 0x00, 0x00}, {0xAA, 0x00, 0x00},
|
||||
{0x00, 0xAA, 0x00}, {0xAA, 0x55, 0x00},
|
||||
{0x00, 0x00, 0xAA}, {0xAA, 0x00, 0xAA},
|
||||
{0x00, 0xAA, 0xAA}, {0xAA, 0xAA, 0xAA},
|
||||
{0x55, 0x55, 0x55}, {0xFF, 0x55, 0x55},
|
||||
{0x55, 0xFF, 0x55}, {0xFF, 0xFF, 0x55},
|
||||
{0x55, 0x55, 0xFF}, {0xFF, 0x55, 0xFF},
|
||||
{0x55, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF}
|
||||
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
||||
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
||||
{0x00, 0x00, 0xaa}, {0xaa, 0x00, 0xaa},
|
||||
{0x00, 0xaa, 0xaa}, {0xaa, 0xaa, 0xaa},
|
||||
{0x55, 0x55, 0x55}, {0xff, 0x55, 0x55},
|
||||
{0x55, 0xff, 0x55}, {0xff, 0xff, 0x55},
|
||||
{0x55, 0x55, 0xff}, {0xff, 0x55, 0xff},
|
||||
{0x55, 0xff, 0xff}, {0xff, 0xff, 0xff}
|
||||
};
|
||||
|
||||
for (std::size_t index = 0; index < 16; index++)
|
||||
|
@ -1187,6 +1176,65 @@ FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id)
|
|||
return key_id;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTermLinux::initSpecialCharacter()
|
||||
{
|
||||
wchar_t c1 = fc::UpperHalfBlock;
|
||||
wchar_t c2 = fc::LowerHalfBlock;
|
||||
wchar_t c3 = fc::FullBlock;
|
||||
|
||||
if ( FTerm::charEncode(c1, fc::PC) == FTerm::charEncode(c1, fc::ASCII)
|
||||
|| FTerm::charEncode(c2, fc::PC) == FTerm::charEncode(c2, fc::ASCII)
|
||||
|| FTerm::charEncode(c3, fc::PC) == FTerm::charEncode(c3, fc::ASCII) )
|
||||
{
|
||||
shadow_character = false;
|
||||
}
|
||||
|
||||
wchar_t c4 = fc::RightHalfBlock;
|
||||
wchar_t c5 = fc::LeftHalfBlock;
|
||||
|
||||
if ( FTerm::charEncode(c4, fc::PC) == FTerm::charEncode(c4, fc::ASCII)
|
||||
|| FTerm::charEncode(c5, fc::PC) == FTerm::charEncode(c5, fc::ASCII) )
|
||||
{
|
||||
half_block_character = false;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
sInt16 FTermLinux::getFontPos (wchar_t ucs)
|
||||
{
|
||||
for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++)
|
||||
{
|
||||
if ( screen_unicode_map.entries[n].unicode == ucs )
|
||||
return sInt16(screen_unicode_map.entries[n].fontpos);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinux::characterFallback ( wchar_t ucs
|
||||
, std::vector<wchar_t> fallback )
|
||||
{
|
||||
constexpr sInt16 NOT_FOUND = -1;
|
||||
characterSub& sub_map = fterm_data->getCharSubstitutionMap();
|
||||
|
||||
if ( fallback.size() < 2 || ucs != fallback[0] )
|
||||
return;
|
||||
|
||||
for (auto iter = fallback.begin() + 1; iter != fallback.end(); iter++)
|
||||
{
|
||||
sInt16 pos = getFontPos(*iter);
|
||||
|
||||
if ( pos != NOT_FOUND )
|
||||
{
|
||||
sub_map[ucs] = *iter;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(__linux__)
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -107,7 +107,7 @@ bool FTermOpenBSD::setBSDConsoleEncoding (kbd_t k_encoding)
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermOpenBSD::setBSDConsoleMetaEsc()
|
||||
{
|
||||
static const kbd_t meta_esc = 0x20; // generate ESC prefix on ALT-key
|
||||
static constexpr kbd_t meta_esc = 0x20; // generate ESC prefix on ALT-key
|
||||
|
||||
return setBSDConsoleEncoding (bsd_keyboard_encoding | meta_esc);
|
||||
}
|
||||
|
|
|
@ -208,22 +208,22 @@ void FTermXTerminal::setHighlightBackground (const FString& hbg)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setMouseSupport (bool on)
|
||||
void FTermXTerminal::setMouseSupport (bool enable)
|
||||
{
|
||||
// activate/deactivate the xterm mouse support
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
enableXTermMouse();
|
||||
else
|
||||
disableXTermMouse();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::metaSendsESC (bool on)
|
||||
void FTermXTerminal::metaSendsESC (bool enable)
|
||||
{
|
||||
// activate/deactivate the xterm meta key sends escape prefix
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
enableXTermMetaSendsESC();
|
||||
else
|
||||
disableXTermMetaSendsESC();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -20,6 +20,8 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fdialog.h"
|
||||
#include "final/fstatusbar.h"
|
||||
#include "final/ftextview.h"
|
||||
|
@ -41,10 +43,7 @@ FTextView::FTextView(FWidget* parent)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FTextView::~FTextView() // destructor
|
||||
{
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FTextView
|
||||
|
@ -144,7 +143,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
if ( ! isVisible() || ! (changeX || changeY) )
|
||||
return;
|
||||
|
||||
if ( xoffset != x )
|
||||
if ( changeX && isHorizontallyScrollable() )
|
||||
{
|
||||
int xoffset_end = int(maxLineWidth - getTextWidth());
|
||||
xoffset = x;
|
||||
|
@ -162,7 +161,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
if ( yoffset != y )
|
||||
if ( changeY && isVerticallyScrollable() )
|
||||
{
|
||||
int yoffset_end = int(getRows() - getTextHeight());
|
||||
yoffset = y;
|
||||
|
@ -417,15 +416,15 @@ void FTextView::onMouseDown (FMouseEvent* ev)
|
|||
&& ! dialog->isZoomed() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
const FPoint& p = parent->termToWidgetPos(tp);
|
||||
const auto& tp = ev->getTermPos();
|
||||
const auto& p = parent->termToWidgetPos(tp);
|
||||
parent->setFocus();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -446,15 +445,15 @@ void FTextView::onMouseUp (FMouseEvent* ev)
|
|||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
const FPoint& p = parent->termToWidgetPos(tp);
|
||||
const auto& tp = ev->getTermPos();
|
||||
const auto& p = parent->termToWidgetPos(tp);
|
||||
parent->setFocus();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseUp_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseUp_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -482,15 +481,15 @@ void FTextView::onMouseMove (FMouseEvent* ev)
|
|||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
const FPoint& p = parent->termToWidgetPos(tp);
|
||||
const auto& tp = ev->getTermPos();
|
||||
const auto& p = parent->termToWidgetPos(tp);
|
||||
parent->setFocus();
|
||||
|
||||
try
|
||||
{
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
const auto& _ev = \
|
||||
std::make_shared<FMouseEvent>(fc::MouseMove_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev.get());
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -624,12 +623,12 @@ void FTextView::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
@ -698,8 +697,8 @@ void FTextView::draw()
|
|||
|
||||
if ( hasFocus() && getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
@ -746,7 +745,7 @@ void FTextView::drawText()
|
|||
|
||||
// only printable and 1 column per character
|
||||
if ( ( (utf8 && std::iswprint(wint_t(ch)))
|
||||
|| (!utf8 && ch < 256 && std::isprint(ch)) )
|
||||
|| (!utf8 && std::isprint(ch)) )
|
||||
&& wcwidth(ch) == 1 )
|
||||
{
|
||||
print (ch);
|
||||
|
@ -784,7 +783,7 @@ inline void FTextView::drawVBar()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::cb_VBarChange (FWidget*, data_ptr)
|
||||
void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||
int distance = 1;
|
||||
|
@ -840,7 +839,7 @@ void FTextView::cb_VBarChange (FWidget*, data_ptr)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::cb_HBarChange (FWidget*, data_ptr)
|
||||
void FTextView::cb_HBarChange (FWidget*, FDataPtr)
|
||||
{
|
||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||
int distance = 1;
|
||||
|
|
|
@ -97,17 +97,17 @@ void FToggleButton::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FToggleButton::setNoUnderline (bool on)
|
||||
bool FToggleButton::setNoUnderline (bool enable)
|
||||
{
|
||||
return (flags.no_underline = on);
|
||||
return (flags.no_underline = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FToggleButton::setEnable (bool on)
|
||||
bool FToggleButton::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget::setEnable(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
setHotkeyAccelerator();
|
||||
|
||||
|
@ -129,15 +129,15 @@ bool FToggleButton::setEnable (bool on)
|
|||
setBackgroundColor (wc.toggle_button_inactive_bg);
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FToggleButton::setFocus (bool on)
|
||||
bool FToggleButton::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(on);
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
|
@ -149,8 +149,8 @@ bool FToggleButton::setFocus (bool on)
|
|||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
|
@ -169,15 +169,15 @@ bool FToggleButton::setFocus (bool on)
|
|||
}
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FToggleButton::setChecked (bool on)
|
||||
bool FToggleButton::setChecked (bool enable)
|
||||
{
|
||||
if ( checked != on )
|
||||
if ( checked != enable )
|
||||
{
|
||||
checked = on;
|
||||
checked = enable;
|
||||
processToggle();
|
||||
}
|
||||
|
||||
|
@ -447,8 +447,8 @@ void FToggleButton::draw()
|
|||
{
|
||||
if ( flags.focus && getStatusBar() )
|
||||
{
|
||||
const FString& msg = getStatusbarMessage();
|
||||
const FString& curMsg = getStatusBar()->getMessage();
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ FToolTip::FToolTip (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FToolTip::~FToolTip() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( fapp->isQuit() )
|
||||
return;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -135,11 +135,11 @@ void FVTerm::setTermXY (int x, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::hideCursor (bool on)
|
||||
void FVTerm::hideCursor (bool enable)
|
||||
{
|
||||
// Hides or shows the input cursor on the terminal
|
||||
|
||||
const char* visibility_str = FTerm::cursorsVisibility (on);
|
||||
const char* visibility_str = FTerm::cursorsVisibility (enable);
|
||||
|
||||
if ( visibility_str )
|
||||
appendOutputBuffer(visibility_str);
|
||||
|
@ -240,7 +240,7 @@ void FVTerm::updateTerminal()
|
|||
// Updates pending changes to the terminal
|
||||
|
||||
if ( stop_terminal_updates
|
||||
|| static_cast<FApplication*>(init_object)->isQuit() )
|
||||
|| FApplication::getApplicationObject()->isQuit() )
|
||||
return;
|
||||
|
||||
if ( ! force_terminal_update )
|
||||
|
@ -303,7 +303,7 @@ void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
|||
//----------------------------------------------------------------------
|
||||
int FVTerm::printf (const FString format, ...)
|
||||
{
|
||||
static const int BUFSIZE = 4096;
|
||||
static constexpr int BUFSIZE = 4096;
|
||||
wchar_t buffer[BUFSIZE];
|
||||
va_list args;
|
||||
|
||||
|
@ -412,7 +412,7 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
|||
break;
|
||||
|
||||
case '\t':
|
||||
area->cursor_x = short ( uInt(area->cursor_x)
|
||||
area->cursor_x = int ( uInt(area->cursor_x)
|
||||
+ tabstop
|
||||
- uInt(area->cursor_x)
|
||||
+ 1
|
||||
|
@ -539,10 +539,10 @@ int FVTerm::print (term_area* area, charData& term_char)
|
|||
// copy character to area
|
||||
std::memcpy (ac, &nc, sizeof(*ac));
|
||||
|
||||
if ( ax < short(area->changes[ay].xmin) )
|
||||
if ( ax < int(area->changes[ay].xmin) )
|
||||
area->changes[ay].xmin = uInt(ax);
|
||||
|
||||
if ( ax > short(area->changes[ay].xmax) )
|
||||
if ( ax > int(area->changes[ay].xmax) )
|
||||
area->changes[ay].xmax = uInt(ax);
|
||||
}
|
||||
}
|
||||
|
@ -845,10 +845,10 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
std::memcpy (tc, &sc, sizeof(*tc));
|
||||
}
|
||||
|
||||
if ( short(vterm->changes[ypos].xmin) > x )
|
||||
if ( int(vterm->changes[ypos].xmin) > x )
|
||||
vterm->changes[ypos].xmin = uInt(x);
|
||||
|
||||
if ( short(vterm->changes[ypos].xmax) < x + w - 1 )
|
||||
if ( int(vterm->changes[ypos].xmax) < x + w - 1 )
|
||||
vterm->changes[ypos].xmax = uInt(x + w - 1);
|
||||
}
|
||||
}
|
||||
|
@ -873,11 +873,10 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
|
||||
bool found = bool(area == vdesktop);
|
||||
auto is_covered = non_covered;
|
||||
auto w = static_cast<FWidget*>(area->widget);
|
||||
|
||||
if ( w->window_list && ! w->window_list->empty() )
|
||||
if ( FWidget::window_list && ! FWidget::window_list->empty() )
|
||||
{
|
||||
for (auto&& win_obj : *w->window_list)
|
||||
for (auto& win_obj : *FWidget::window_list)
|
||||
{
|
||||
auto win = win_obj->getVWin();
|
||||
|
||||
|
@ -1231,13 +1230,13 @@ void FVTerm::updateVTerm (term_area* area)
|
|||
_xmin = ax + line_xmin - ol;
|
||||
_xmax = ax + line_xmax;
|
||||
|
||||
if ( _xmin < short(vterm->changes[ay + y].xmin) )
|
||||
if ( _xmin < int(vterm->changes[ay + y].xmin) )
|
||||
vterm->changes[ay + y].xmin = uInt(_xmin);
|
||||
|
||||
if ( _xmax >= vterm->width )
|
||||
_xmax = vterm->width - 1;
|
||||
|
||||
if ( _xmax > short(vterm->changes[ay + y].xmax) )
|
||||
if ( _xmax > int(vterm->changes[ay + y].xmax) )
|
||||
vterm->changes[ay + y].xmax = uInt(_xmax);
|
||||
|
||||
area->changes[y].xmin = uInt(aw + rsh);
|
||||
|
@ -1359,10 +1358,10 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
|
|||
auto ac = &area->text[y * area->width]; // area character
|
||||
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[y].xmin) > 0 )
|
||||
if ( int(area->changes[y].xmin) > 0 )
|
||||
area->changes[y].xmin = 0;
|
||||
|
||||
if ( short(area->changes[y].xmax) < length - 1 )
|
||||
if ( int(area->changes[y].xmax) < length - 1 )
|
||||
area->changes[y].xmax = uInt(length - 1);
|
||||
}
|
||||
}
|
||||
|
@ -1413,10 +1412,10 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
|
|||
auto ac = &area->text[(dy + _y) * line_len + dx]; // area character
|
||||
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[dy + _y].xmin) > dx )
|
||||
if ( int(area->changes[dy + _y].xmin) > dx )
|
||||
area->changes[dy + _y].xmin = uInt(dx);
|
||||
|
||||
if ( short(area->changes[dy + _y].xmax) < dx + length - 1 )
|
||||
if ( int(area->changes[dy + _y].xmax) < dx + length - 1 )
|
||||
area->changes[dy + _y].xmax = uInt(dx + length - 1);
|
||||
}
|
||||
}
|
||||
|
@ -1503,10 +1502,10 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
|
|||
}
|
||||
}
|
||||
|
||||
if ( ax < short(vterm->changes[ay + y].xmin) )
|
||||
if ( ax < int(vterm->changes[ay + y].xmin) )
|
||||
vterm->changes[ay + y].xmin = uInt(ax);
|
||||
|
||||
if ( ax + length - 1 > short(vterm->changes[ay + y].xmax) )
|
||||
if ( ax + length - 1 > int(vterm->changes[ay + y].xmax) )
|
||||
vterm->changes[ay + y].xmax = uInt(ax + length - 1);
|
||||
}
|
||||
}
|
||||
|
@ -1696,13 +1695,12 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
{
|
||||
// Generates characters for a given position considering all areas
|
||||
|
||||
auto widget = static_cast<FWidget*>(vterm->widget);
|
||||
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
||||
|
||||
if ( ! widget->window_list || widget->window_list->empty() )
|
||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
||||
return *sc;
|
||||
|
||||
for (auto&& win_obj : *widget->window_list)
|
||||
for (auto& win_obj : *FWidget::window_list)
|
||||
{
|
||||
auto win = win_obj->getVWin();
|
||||
|
||||
|
@ -1794,15 +1792,15 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
yy = vterm->height - 1;
|
||||
|
||||
auto cc = &vdesktop->text[yy * vdesktop->width + xx]; // covered character
|
||||
auto w = static_cast<FWidget*>(obj);
|
||||
|
||||
if ( ! w->window_list || w->window_list->empty() )
|
||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
||||
return *cc;
|
||||
|
||||
// Get the window layer of this object
|
||||
auto w = static_cast<FWidget*>(obj);
|
||||
int layer = FWindow::getWindowLayer(w);
|
||||
|
||||
for (auto&& win_obj : *w->window_list)
|
||||
for (auto&& win_obj : *FWidget::window_list)
|
||||
{
|
||||
bool significant_char;
|
||||
|
||||
|
@ -1874,7 +1872,7 @@ FVTerm::charData FVTerm::getOverlappedCharacter ( int x
|
|||
void FVTerm::processTerminalUpdate()
|
||||
{
|
||||
// Retains terminal updates if there are unprocessed inputs
|
||||
static const int max_skip = 8;
|
||||
static constexpr int max_skip = 8;
|
||||
|
||||
if ( ! terminal_update_pending )
|
||||
return;
|
||||
|
@ -2509,7 +2507,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
|||
charsetChanges (print_char);
|
||||
appendAttributes (print_char);
|
||||
appendOutputBuffer (tparm(rp, print_char->code, repetitions, 0, 0, 0, 0, 0, 0, 0));
|
||||
term_pos->x_ref() += short(repetitions);
|
||||
term_pos->x_ref() += int(repetitions);
|
||||
x = x + repetitions - 1;
|
||||
}
|
||||
else
|
||||
|
@ -2727,8 +2725,8 @@ inline void FVTerm::newFontChanges (charData*& next_char)
|
|||
case fc::NF_rev_down_pointing_triangle2:
|
||||
case fc::NF_rev_menu_button3:
|
||||
case fc::NF_rev_border_line_right_and_left:
|
||||
// swap foreground and background color
|
||||
std::swap (next_char->fg_color, next_char->bg_color);
|
||||
// Show in reverse video
|
||||
next_char->attr.bit.reverse = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2740,22 +2738,24 @@ inline void FVTerm::newFontChanges (charData*& next_char)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::charsetChanges (charData*& next_char)
|
||||
{
|
||||
wchar_t& code = next_char->code;
|
||||
next_char->encoded_code = code;
|
||||
|
||||
if ( getEncoding() == fc::UTF8 )
|
||||
return;
|
||||
|
||||
uInt code = uInt(next_char->code);
|
||||
uInt ch_enc = FTerm::charEncode(code);
|
||||
wchar_t ch_enc = FTerm::charEncode(code);
|
||||
|
||||
if ( ch_enc == code )
|
||||
return;
|
||||
|
||||
if ( ch_enc == 0 )
|
||||
{
|
||||
next_char->code = int(FTerm::charEncode(code, fc::ASCII));
|
||||
next_char->encoded_code = wchar_t(FTerm::charEncode(code, fc::ASCII));
|
||||
return;
|
||||
}
|
||||
|
||||
next_char->code = int(ch_enc);
|
||||
next_char->encoded_code = ch_enc;
|
||||
|
||||
if ( getEncoding() == fc::VT100 )
|
||||
next_char->attr.bit.alt_charset = true;
|
||||
|
@ -2769,10 +2769,10 @@ inline void FVTerm::charsetChanges (charData*& next_char)
|
|||
if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f
|
||||
{
|
||||
if ( hasUTF8() )
|
||||
next_char->code = int(FTerm::charEncode(code, fc::ASCII));
|
||||
next_char->encoded_code = int(FTerm::charEncode(code, fc::ASCII));
|
||||
else
|
||||
{
|
||||
next_char->code += 0x5f;
|
||||
next_char->encoded_code += 0x5f;
|
||||
next_char->attr.bit.alt_charset = true;
|
||||
}
|
||||
}
|
||||
|
@ -2799,9 +2799,9 @@ inline void FVTerm::appendChar (charData*& next_char)
|
|||
{
|
||||
newFontChanges (next_char);
|
||||
charsetChanges (next_char);
|
||||
|
||||
appendAttributes (next_char);
|
||||
appendOutputBuffer (next_char->code);
|
||||
characterFilter (next_char);
|
||||
appendOutputBuffer (next_char->encoded_code);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2878,6 +2878,15 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
|||
return screen_char->code;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::characterFilter (charData*& next_char)
|
||||
{
|
||||
FTerm::characterSub& sub_map = fterm->getCharSubstitutionMap();
|
||||
|
||||
if ( sub_map[next_char->encoded_code] )
|
||||
next_char->encoded_code = sub_map[next_char->encoded_code];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::appendOutputBuffer (const std::string& s)
|
||||
{
|
||||
|
|
|
@ -69,9 +69,9 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
|
||||
if ( ! parent )
|
||||
{
|
||||
assert ( ! rootObject
|
||||
&& "FTerm: There should be only one root object" );
|
||||
|
||||
if ( rootObject )
|
||||
throw std::runtime_error( "FWidget: No parent defined! "
|
||||
"There should be only one root object" );
|
||||
rootObject = this;
|
||||
show_root_widget = nullptr;
|
||||
redraw_root_widget = nullptr;
|
||||
|
@ -248,24 +248,24 @@ void FWidget::setMainWidget (FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::setEnable (bool on)
|
||||
bool FWidget::setEnable (bool enable)
|
||||
{
|
||||
return (flags.active = on);
|
||||
return (flags.active = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::setFocus (bool on)
|
||||
bool FWidget::setFocus (bool enable)
|
||||
{
|
||||
if ( ! isEnabled() )
|
||||
return false;
|
||||
|
||||
if ( flags.focus == on )
|
||||
if ( flags.focus == enable )
|
||||
return true;
|
||||
|
||||
auto last_focus = FWidget::getFocusWidget();
|
||||
|
||||
// set widget focus
|
||||
if ( on && ! flags.focus )
|
||||
if ( enable && ! flags.focus )
|
||||
{
|
||||
int focusable_children = numOfFocusableChildren();
|
||||
|
||||
|
@ -282,7 +282,7 @@ bool FWidget::setFocus (bool on)
|
|||
auto window = FWindow::getWindowWidget(this);
|
||||
|
||||
// set window focus
|
||||
if ( on && window )
|
||||
if ( enable && window )
|
||||
{
|
||||
if ( ! window->isWindowActive() )
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ bool FWidget::setFocus (bool on)
|
|||
window->setWindowFocusWidget(this);
|
||||
}
|
||||
|
||||
return (flags.focus = on);
|
||||
return (flags.focus = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -826,7 +826,7 @@ bool FWidget::close()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FCallback cb_handler
|
||||
, data_ptr data )
|
||||
, FDataPtr data )
|
||||
{
|
||||
// add a (normal) function pointer as callback
|
||||
callback_data obj = { cb_signal, cb_handler, data };
|
||||
|
@ -837,7 +837,7 @@ void FWidget::addCallback ( const FString& cb_signal
|
|||
void FWidget::addCallback ( const FString& cb_signal
|
||||
, FWidget* cb_instance
|
||||
, FMemberCallback cb_handler
|
||||
, data_ptr data )
|
||||
, FDataPtr data )
|
||||
{
|
||||
// add a member function pointer as callback
|
||||
member_callback_data obj = { cb_signal, cb_instance, cb_handler, data };
|
||||
|
@ -1436,8 +1436,7 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::quit()
|
||||
{
|
||||
auto app_object = FApplication::getApplicationObject();
|
||||
auto fapp = static_cast<FApplication*>(app_object);
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
fapp->exit(0);
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1734,7 @@ bool FWidget::focusPrevChild()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::event (FEvent* ev)
|
||||
{
|
||||
switch ( ev->type() )
|
||||
switch ( uInt(ev->type()) )
|
||||
{
|
||||
case fc::KeyPress_Event:
|
||||
KeyPressEvent (static_cast<FKeyEvent*>(ev));
|
||||
|
@ -2340,7 +2339,7 @@ void FWidget::setColorTheme()
|
|||
wc.set16ColorTheme();
|
||||
|
||||
if ( isKdeTerminal() )
|
||||
wc.term_bg = fc::SteelBlue3;
|
||||
wc.term_bg = fc::SkyBlue2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ FWindow::FWindow(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FWindow::~FWindow() // destructor
|
||||
{
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = FApplication::getApplicationObject();
|
||||
|
||||
if ( previous_window == this )
|
||||
previous_window = nullptr;
|
||||
|
@ -67,7 +67,7 @@ FWindow::~FWindow() // destructor
|
|||
|
||||
if ( ! fapp->isQuit() )
|
||||
{
|
||||
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||
const auto& t_geometry = getTermGeometryWithShadow();
|
||||
restoreVTerm (t_geometry);
|
||||
}
|
||||
|
||||
|
@ -84,19 +84,19 @@ FWidget* FWindow::getWindowFocusWidget() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::setWindowWidget (bool on)
|
||||
bool FWindow::setWindowWidget (bool enable)
|
||||
{
|
||||
if ( isWindowWidget() == on )
|
||||
if ( isWindowWidget() == enable )
|
||||
return true;
|
||||
|
||||
flags.window_widget = on;
|
||||
flags.window_widget = enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setTermOffset();
|
||||
else
|
||||
setParentOffset();
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -148,16 +148,16 @@ void FWindow::setWindowFocusWidget (const FWidget* obj)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::activateWindow (bool on)
|
||||
bool FWindow::activateWindow (bool enable)
|
||||
{
|
||||
// activate/deactivate this window
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
FWidget::setActiveWindow (this);
|
||||
active_area = getVWin();
|
||||
}
|
||||
|
||||
return (window_active = on);
|
||||
return (window_active = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -168,31 +168,31 @@ void FWindow::unsetActiveWindow()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::setResizeable (bool on)
|
||||
bool FWindow::setResizeable (bool enable)
|
||||
{
|
||||
return (flags.resizeable = on);
|
||||
return (flags.resizeable = enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::setTransparentShadow (bool on)
|
||||
bool FWindow::setTransparentShadow (bool enable)
|
||||
{
|
||||
flags.shadow = flags.trans_shadow = on;
|
||||
flags.shadow = flags.trans_shadow = enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
setShadowSize (2, 1);
|
||||
else
|
||||
setShadowSize (0, 0);
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::setShadow (bool on)
|
||||
bool FWindow::setShadow (bool enable)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return false;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
flags.shadow = true;
|
||||
flags.trans_shadow = false;
|
||||
|
@ -205,18 +205,18 @@ bool FWindow::setShadow (bool on)
|
|||
setShadowSize (0, 0);
|
||||
}
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWindow::setAlwaysOnTop (bool on)
|
||||
bool FWindow::setAlwaysOnTop (bool enable)
|
||||
{
|
||||
if ( isAlwaysOnTop() == on )
|
||||
if ( isAlwaysOnTop() == enable )
|
||||
return true;
|
||||
|
||||
flags.always_on_top = on;
|
||||
flags.always_on_top = enable;
|
||||
|
||||
if ( on )
|
||||
if ( enable )
|
||||
{
|
||||
if ( always_on_top_list )
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ bool FWindow::setAlwaysOnTop (bool on)
|
|||
else
|
||||
deleteFromAlwaysOnTopList (this);
|
||||
|
||||
return on;
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -810,7 +810,7 @@ void FWindow::adjustSize()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWindow::event (FEvent* ev)
|
||||
{
|
||||
switch ( ev->type() )
|
||||
switch ( uInt(ev->type()) )
|
||||
{
|
||||
case fc::WindowActive_Event:
|
||||
onWindowActive (ev);
|
||||
|
|
|
@ -46,7 +46,8 @@ class emptyFString
|
|||
{
|
||||
public:
|
||||
// Constructors
|
||||
emptyFString() = default;
|
||||
emptyFString() = delete;
|
||||
|
||||
// Disable copy constructor
|
||||
emptyFString (const emptyFString&) = delete;
|
||||
|
||||
|
|
|
@ -85,8 +85,10 @@ class FApplication : public FWidget
|
|||
public:
|
||||
// Constructor
|
||||
FApplication (const int&, char*[], bool = false);
|
||||
|
||||
// Disable copy constructor
|
||||
FApplication (const FApplication&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FApplication();
|
||||
|
||||
|
@ -94,10 +96,10 @@ class FApplication : public FWidget
|
|||
FApplication& operator = (const FApplication&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
int getArgc() const;
|
||||
char** getArgv() const;
|
||||
static FWidget* getApplicationObject();
|
||||
static FApplication* getApplicationObject();
|
||||
|
||||
// Inquiry
|
||||
static bool isQuit();
|
||||
|
@ -122,19 +124,15 @@ class FApplication : public FWidget
|
|||
static void closeConfirmationDialog (FWidget*, FCloseEvent*);
|
||||
|
||||
// Callback method
|
||||
void cb_exitApp (FWidget*, data_ptr);
|
||||
void cb_exitApp (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Typedefs and Enumerations
|
||||
// Typedefs
|
||||
typedef std::pair<const FObject*, std::shared_ptr<const FEvent> > eventPair;
|
||||
typedef std::deque<eventPair> eventQueue;
|
||||
typedef std::shared_ptr<eventQueue> eventQueuePtr;
|
||||
|
||||
// Constants
|
||||
static const int NEED_MORE_DATA = -1; // parseKeyString return value
|
||||
|
||||
// Methods
|
||||
void init (long, long);
|
||||
void init (uInt64, uInt64);
|
||||
void cmd_options (const int&, char*[]);
|
||||
void findKeyboardWidget();
|
||||
bool isKeyPressed();
|
||||
|
@ -174,15 +172,15 @@ class FApplication : public FWidget
|
|||
void processCloseWidget();
|
||||
bool processNextEvent();
|
||||
virtual void performTimerAction ( const FObject*
|
||||
, const FEvent* );
|
||||
, const FEvent* ) override;
|
||||
|
||||
// Data Members
|
||||
int app_argc;
|
||||
char** app_argv;
|
||||
long key_timeout{100000}; // 100 ms
|
||||
long dblclick_interval{500000}; // 500 ms
|
||||
uInt64 key_timeout{100000}; // 100 ms
|
||||
uInt64 dblclick_interval{500000}; // 500 ms
|
||||
static FMouseControl* mouse;
|
||||
static eventQueuePtr event_queue;
|
||||
static eventQueue* event_queue;
|
||||
static int quit_code;
|
||||
static bool quit_now;
|
||||
static int loop_level;
|
||||
|
@ -207,7 +205,7 @@ inline char** FApplication::getArgv() const
|
|||
{ return app_argv; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FApplication::cb_exitApp (FWidget*, data_ptr)
|
||||
inline void FApplication::cb_exitApp (FWidget*, FDataPtr)
|
||||
{ close(); }
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -70,16 +70,21 @@ class FButton : public FWidget
|
|||
// Constructors
|
||||
explicit FButton (FWidget* = nullptr);
|
||||
explicit FButton (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FButton (const FButton&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FButton();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FButton& operator = (const FButton&) = delete;
|
||||
|
||||
// Overloaded operator
|
||||
FButton& operator = (const FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
|
@ -93,13 +98,13 @@ class FButton : public FWidget
|
|||
bool setNoUnderline(bool);
|
||||
bool setNoUnderline();
|
||||
bool unsetNoUnderline();
|
||||
virtual bool setEnable(bool);
|
||||
virtual bool setEnable();
|
||||
virtual bool unsetEnable();
|
||||
virtual bool setDisable();
|
||||
virtual bool setFocus(bool);
|
||||
virtual bool setFocus();
|
||||
virtual bool unsetFocus();
|
||||
virtual bool setEnable(bool) override;
|
||||
virtual bool setEnable() override;
|
||||
virtual bool unsetEnable() override;
|
||||
virtual bool setDisable() override;
|
||||
virtual bool setFocus(bool) override;
|
||||
virtual bool setFocus() override;
|
||||
virtual bool unsetFocus() override;
|
||||
bool setFlat(bool);
|
||||
bool setFlat();
|
||||
bool unsetFlat();
|
||||
|
@ -121,21 +126,21 @@ class FButton : public FWidget
|
|||
bool hasClickAnimation();
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onTimer (FTimerEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onFocusOut (FFocusEvent*) override;
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
|
@ -149,7 +154,7 @@ class FButton : public FWidget
|
|||
void drawMarginRight();
|
||||
void drawTopBottomBackground();
|
||||
void drawButtonTextLine (wchar_t[]);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void updateStatusBar();
|
||||
void updateButtonColor();
|
||||
void processClick();
|
||||
|
@ -239,8 +244,8 @@ inline bool FButton::setUp()
|
|||
{ return setDown(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FButton::setClickAnimation(bool on)
|
||||
{ return (click_animation = on); }
|
||||
inline bool FButton::setClickAnimation(bool enable)
|
||||
{ return (click_animation = enable); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FButton::setClickAnimation()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -74,8 +74,10 @@ class FButtonGroup : public FScrollView
|
|||
// Constructors
|
||||
explicit FButtonGroup (FWidget* = nullptr);
|
||||
explicit FButtonGroup (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FButtonGroup (const FButtonGroup&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FButtonGroup();
|
||||
|
||||
|
@ -83,7 +85,7 @@ class FButtonGroup : public FScrollView
|
|||
FButtonGroup& operator = (const FButtonGroup&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FToggleButton* getFirstButton();
|
||||
FToggleButton* getLastButton();
|
||||
FToggleButton* getButton (int) const;
|
||||
|
@ -91,10 +93,10 @@ class FButtonGroup : public FScrollView
|
|||
FString& getText();
|
||||
|
||||
// Mutator
|
||||
virtual bool setEnable(bool);
|
||||
virtual bool setEnable();
|
||||
virtual bool unsetEnable();
|
||||
virtual bool setDisable();
|
||||
virtual bool setEnable(bool) override;
|
||||
virtual bool setEnable() override;
|
||||
virtual bool unsetEnable() override;
|
||||
virtual bool setDisable() override;
|
||||
void setText (const FString&);
|
||||
|
||||
// Inquiries
|
||||
|
@ -103,19 +105,16 @@ class FButtonGroup : public FScrollView
|
|||
bool hasCheckedButton() const;
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
void insert (FToggleButton*);
|
||||
void remove (FToggleButton*);
|
||||
void checkScrollSize (FToggleButton*);
|
||||
void checkScrollSize (const FRect&);
|
||||
|
||||
// Event handlers
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
|
||||
// Callback method
|
||||
void cb_buttonToggled (FWidget*, data_ptr);
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
|
||||
protected:
|
||||
// Accessor
|
||||
|
@ -125,12 +124,12 @@ class FButtonGroup : public FScrollView
|
|||
void setHotkeyAccelerator();
|
||||
|
||||
// Methods
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawLabel();
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
||||
// Inquiries
|
||||
bool isRadioButton (FToggleButton*) const;
|
||||
|
@ -141,6 +140,9 @@ class FButtonGroup : public FScrollView
|
|||
void drawText (wchar_t[], std::size_t, std::size_t);
|
||||
void directFocus();
|
||||
|
||||
// Callback method
|
||||
void cb_buttonToggled (FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
FString text{};
|
||||
FObjectList buttonlist{};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -78,7 +78,8 @@ enum events
|
|||
Show_Event, // widget is shown
|
||||
Hide_Event, // widget is hidden
|
||||
Close_Event, // widget close
|
||||
Timer_Event // timer event occur
|
||||
Timer_Event, // timer event occur
|
||||
User_Event // user defined event
|
||||
};
|
||||
|
||||
// Internal character encoding
|
||||
|
@ -140,8 +141,19 @@ enum SpecialCharacter : wchar_t
|
|||
{
|
||||
Euro = 0x20ac, // €
|
||||
Pound = 0x00a3, // £
|
||||
Section = 0x00a7, // §
|
||||
Pi = 0x03c0, // π
|
||||
SuperscriptLatinSmallLetterN = 0x207F, // ⁿ
|
||||
InverseBullet = 0x25d8, // ◘
|
||||
InverseWhiteCircle = 0x25d9, // ◙
|
||||
UpDownArrow = 0x2195, // ↕
|
||||
LeftRightArrow = 0x2194, // ↔
|
||||
BlackRectangle = 0x25ac, // ▬
|
||||
UpwardsArrow = 0x2191, // ↑
|
||||
DownwardsArrow = 0x2193, // ↓
|
||||
RightwardsArrow = 0x2192, // →
|
||||
LeftwardsArrow = 0x2190, // ←
|
||||
DoubleExclamationMark = 0x203c, // ‼
|
||||
SuperscriptLatinSmallLetterN = 0x207f, // ⁿ
|
||||
GreaterThanOrEqualTo = 0x2265, // ≥
|
||||
LessThanOrEqualTo = 0x2264, // ≤
|
||||
NotEqualTo = 0x2260, // ≠
|
||||
|
@ -151,6 +163,7 @@ enum SpecialCharacter : wchar_t
|
|||
BlackVerticalRectangle = 0x25ae, // ▮ (1)
|
||||
SmallBullet = 0x00b7, // ·
|
||||
BlackDiamondSuit = 0x2666, // ◆
|
||||
BlackCircle = 0x25cf, // ●
|
||||
SymbolForNewline = 0x2424, //  (1)
|
||||
SymbolForVerticalTab = 0x240b, // ␋ (1)
|
||||
SymbolForHorizontalTab = 0x2409, // ␉ (1)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -45,6 +45,17 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
|||
// | | | |
|
||||
{0x20ac, 0, 0xee, 'E'}, // € - Euro
|
||||
{0x00a3, '}', 0x9c, 'P'}, // £ - Pound
|
||||
{0x00a7, '$', 0x15, '$'}, // § - Section
|
||||
{0x25d8, '*', 0x08, '*'}, // ◘ - InverseBullet
|
||||
{0x25d9, '*', 0x0a, '*'}, // ◙ - InverseWhiteCircle
|
||||
{0x203c, '!', 0x13, '!'}, // ‼ - DoubleExclamationMark
|
||||
{0x2195, 'I', 0x12, 'I'}, // ↕ - UpDownArrow
|
||||
{0x2194, '-', 0x1d, '-'}, // ↔ - LeftRightArrow
|
||||
{0x25ac, '_', 0x16, '_'}, // ▬ - BlackRectangle
|
||||
{0x2191, '^', 0x18, '^'}, // ↑ - UpwardsArrow
|
||||
{0x2193, 'v', 0x19, 'v'}, // ↓ - DownwardsArrow
|
||||
{0x2192, '>', 0x1a, '>'}, // → - RightwardsArrow
|
||||
{0x2190, '<', 0x1b, '<'}, // ← - LeftwardsArrow
|
||||
{0x03c0, '{', 0xe3, 'n'}, // π - Pi
|
||||
{0x207F, 'I', 0xfc, ' '}, // ⁿ - SuperscriptLatinSmallLetterN
|
||||
{0x2265, 'z', 0xf2, '>'}, // ≥ - GreaterThanOrEqualTo
|
||||
|
@ -57,6 +68,7 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
|||
{0x00b0, 'f', 0xb0, 'o'}, // ° - Degree
|
||||
{0x2022, '`', 0x04, '*'}, // • - Bullet
|
||||
{0x00b7, '`', 0xfa, '.'}, // · - small Bullet
|
||||
{0x25cf, '`', 0x04, '*'}, // ● - BlackCircle
|
||||
{0x2666, '`', 0x04, '*'}, // ◆ - BlackDiamondSuit
|
||||
{0x2424, 'h', ' ', ' '}, //  - SymbolForNewline (1)
|
||||
{0x240b, 'i', ' ', ' '}, // ␋ - SymbolForVerticalTab (1)
|
||||
|
@ -144,7 +156,8 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
|||
* (2) Only supported in use with newfont
|
||||
*/
|
||||
|
||||
const int lastCharItem = int(sizeof(character) / sizeof(character[0])) - 1;
|
||||
constexpr auto lastCharItem = \
|
||||
std::size_t((sizeof(character) / sizeof(character[0])) - 1);
|
||||
|
||||
|
||||
static int vt100_key_to_utf8[][2] =
|
||||
|
@ -190,12 +203,140 @@ static int vt100_key_to_utf8[][2] =
|
|||
{fc::vt100_key_diamond , fc::Bullet} // ◆
|
||||
};
|
||||
|
||||
const int lastKeyItem = int ( sizeof(vt100_key_to_utf8)
|
||||
/ sizeof(vt100_key_to_utf8[0]) ) - 1;
|
||||
constexpr auto lastKeyItem = \
|
||||
std::size_t((sizeof(vt100_key_to_utf8) / sizeof(vt100_key_to_utf8[0])) - 1);
|
||||
|
||||
|
||||
static uInt cp437_to_ucs[][2] =
|
||||
static wchar_t cp437_to_ucs[][2] =
|
||||
{
|
||||
{0x00, 0x0000}, // null
|
||||
{0x01, 0x263a}, // white smiling face
|
||||
{0x02, 0x263b}, // black smiling face
|
||||
{0x03, 0x2665}, // black heart suit
|
||||
{0x04, 0x2666}, // black diamond suit
|
||||
{0x05, 0x2663}, // black club suit
|
||||
{0x06, 0x2660}, // black spade suit
|
||||
{0x07, 0x2022}, // bullet
|
||||
{0x08, 0x25d8}, // inverse bullet
|
||||
{0x09, 0x25cb}, // white circle
|
||||
{0x0a, 0x25d9}, // inverse white circle
|
||||
{0x0b, 0x2642}, // male sign
|
||||
{0x0c, 0x2640}, // female sign
|
||||
{0x0d, 0x266a}, // eighth note
|
||||
{0x0e, 0x266b}, // beamed eighth notes
|
||||
{0x0f, 0x263c}, // white sun with rays
|
||||
{0x10, 0x25ba}, // black right-pointing pointer
|
||||
{0x11, 0x25c4}, // black left-pointing pointer
|
||||
{0x12, 0x2195}, // up down arrow
|
||||
{0x13, 0x203c}, // double exclamation mark
|
||||
{0x14, 0x00b6}, // pilcrow sign
|
||||
{0x15, 0x00a7}, // section sign
|
||||
{0x16, 0x25ac}, // black rectangle
|
||||
{0x17, 0x21a8}, // up down arrow with base
|
||||
{0x18, 0x2191}, // upwards arrow
|
||||
{0x19, 0x2193}, // downwards arrow
|
||||
{0x1a, 0x2192}, // rightwards arrow
|
||||
{0x1b, 0x2190}, // leftwards arrow
|
||||
{0x1c, 0x221f}, // right angle
|
||||
{0x1d, 0x2194}, // left right arrow
|
||||
{0x1e, 0x25b2}, // black up-pointing triangle
|
||||
{0x1f, 0x25bc}, // black down-pointing triangle
|
||||
{0x20, 0x0020}, // space
|
||||
{0x21, 0x0021}, // exclamation mark
|
||||
{0x22, 0x0022}, // quotation mark
|
||||
{0x23, 0x0023}, // number sign
|
||||
{0x24, 0x0024}, // dollar sign
|
||||
{0x25, 0x0025}, // percent sign
|
||||
{0x26, 0x0026}, // ampersand
|
||||
{0x27, 0x0027}, // apostrophe
|
||||
{0x28, 0x0028}, // left parenthesis
|
||||
{0x29, 0x0029}, // right parenthesis
|
||||
{0x2a, 0x002a}, // asterisk
|
||||
{0x2b, 0x002b}, // plus sign
|
||||
{0x2c, 0x002c}, // comma
|
||||
{0x2d, 0x002d}, // hyphen-minus
|
||||
{0x2e, 0x002e}, // full stop
|
||||
{0x2f, 0x002f}, // solidus
|
||||
{0x30, 0x0030}, // digit zero
|
||||
{0x31, 0x0031}, // digit one
|
||||
{0x32, 0x0032}, // digit two
|
||||
{0x33, 0x0033}, // digit three
|
||||
{0x34, 0x0034}, // digit four
|
||||
{0x35, 0x0035}, // digit five
|
||||
{0x36, 0x0036}, // digit six
|
||||
{0x37, 0x0037}, // digit seven
|
||||
{0x38, 0x0038}, // digit eight
|
||||
{0x39, 0x0039}, // digit nine
|
||||
{0x3a, 0x003a}, // colon
|
||||
{0x3b, 0x003b}, // semicolon
|
||||
{0x3c, 0x003c}, // less-than sign
|
||||
{0x3d, 0x003d}, // equals sign
|
||||
{0x3e, 0x003e}, // greater-than sign
|
||||
{0x3f, 0x003f}, // question mark
|
||||
{0x40, 0x0040}, // commercial at
|
||||
{0x41, 0x0041}, // latin capital letter a
|
||||
{0x42, 0x0042}, // latin capital letter b
|
||||
{0x43, 0x0043}, // latin capital letter c
|
||||
{0x44, 0x0044}, // latin capital letter d
|
||||
{0x45, 0x0045}, // latin capital letter e
|
||||
{0x46, 0x0046}, // latin capital letter f
|
||||
{0x47, 0x0047}, // latin capital letter g
|
||||
{0x48, 0x0048}, // latin capital letter h
|
||||
{0x49, 0x0049}, // latin capital letter i
|
||||
{0x4a, 0x004a}, // latin capital letter j
|
||||
{0x4b, 0x004b}, // latin capital letter k
|
||||
{0x4c, 0x004c}, // latin capital letter l
|
||||
{0x4d, 0x004d}, // latin capital letter m
|
||||
{0x4e, 0x004e}, // latin capital letter n
|
||||
{0x4f, 0x004f}, // latin capital letter o
|
||||
{0x50, 0x0050}, // latin capital letter p
|
||||
{0x51, 0x0051}, // latin capital letter q
|
||||
{0x52, 0x0052}, // latin capital letter r
|
||||
{0x53, 0x0053}, // latin capital letter s
|
||||
{0x54, 0x0054}, // latin capital letter t
|
||||
{0x55, 0x0055}, // latin capital letter u
|
||||
{0x56, 0x0056}, // latin capital letter v
|
||||
{0x57, 0x0057}, // latin capital letter w
|
||||
{0x58, 0x0058}, // latin capital letter x
|
||||
{0x59, 0x0059}, // latin capital letter y
|
||||
{0x5a, 0x005a}, // latin capital letter z
|
||||
{0x5b, 0x005b}, // left square bracket
|
||||
{0x5c, 0x005c}, // reverse solidus
|
||||
{0x5d, 0x005d}, // right square bracket
|
||||
{0x5e, 0x005e}, // circumflex accent
|
||||
{0x5f, 0x005f}, // low line
|
||||
{0x60, 0x0060}, // grave accent
|
||||
{0x61, 0x0061}, // latin small letter a
|
||||
{0x62, 0x0062}, // latin small letter b
|
||||
{0x63, 0x0063}, // latin small letter c
|
||||
{0x64, 0x0064}, // latin small letter d
|
||||
{0x65, 0x0065}, // latin small letter e
|
||||
{0x66, 0x0066}, // latin small letter f
|
||||
{0x67, 0x0067}, // latin small letter g
|
||||
{0x68, 0x0068}, // latin small letter h
|
||||
{0x69, 0x0069}, // latin small letter i
|
||||
{0x6a, 0x006a}, // latin small letter j
|
||||
{0x6b, 0x006b}, // latin small letter k
|
||||
{0x6c, 0x006c}, // latin small letter l
|
||||
{0x6d, 0x006d}, // latin small letter m
|
||||
{0x6e, 0x006e}, // latin small letter n
|
||||
{0x6f, 0x006f}, // latin small letter o
|
||||
{0x70, 0x0070}, // latin small letter p
|
||||
{0x71, 0x0071}, // latin small letter q
|
||||
{0x72, 0x0072}, // latin small letter r
|
||||
{0x73, 0x0073}, // latin small letter s
|
||||
{0x74, 0x0074}, // latin small letter t
|
||||
{0x75, 0x0075}, // latin small letter u
|
||||
{0x76, 0x0076}, // latin small letter v
|
||||
{0x77, 0x0077}, // latin small letter w
|
||||
{0x78, 0x0078}, // latin small letter x
|
||||
{0x79, 0x0079}, // latin small letter y
|
||||
{0x7a, 0x007a}, // latin small letter z
|
||||
{0x7b, 0x007b}, // left curly bracket
|
||||
{0x7c, 0x007c}, // vertical line
|
||||
{0x7d, 0x007d}, // right curly bracket
|
||||
{0x7e, 0x007e}, // tilde
|
||||
{0x7f, 0x007f}, // house
|
||||
{0x80, 0x00c7}, // latin capital letter c with cedilla
|
||||
{0x81, 0x00fc}, // latin small letter u with diaeresis
|
||||
{0x82, 0x00e9}, // latin small letter e with acute
|
||||
|
@ -326,8 +467,9 @@ static uInt cp437_to_ucs[][2] =
|
|||
{0xff, 0x00a0} // no-break space
|
||||
};
|
||||
|
||||
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
|
||||
/ sizeof(cp437_to_ucs[0]) ) - 1;
|
||||
constexpr auto lastCP437Item = \
|
||||
std::size_t((sizeof(cp437_to_ucs) / sizeof(cp437_to_ucs[0])) - 1);
|
||||
|
||||
} // namespace fc
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -75,8 +75,10 @@ class FCheckBox : public FToggleButton
|
|||
// Constructors
|
||||
explicit FCheckBox (FWidget* = nullptr);
|
||||
explicit FCheckBox (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FCheckBox (const FCheckBox&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FCheckBox();
|
||||
|
||||
|
@ -84,12 +86,12 @@ class FCheckBox : public FToggleButton
|
|||
FCheckBox& operator = (const FCheckBox&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawCheckButton();
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -75,8 +75,10 @@ class FCheckMenuItem : public FMenuItem
|
|||
// Constructors
|
||||
explicit FCheckMenuItem (FWidget* = nullptr);
|
||||
explicit FCheckMenuItem (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FCheckMenuItem (const FCheckMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FCheckMenuItem();
|
||||
|
||||
|
@ -84,13 +86,13 @@ class FCheckMenuItem : public FMenuItem
|
|||
FCheckMenuItem& operator = (const FCheckMenuItem&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked();
|
||||
virtual void processClicked() override;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -89,8 +89,10 @@ class FDialog : public FWindow
|
|||
// Constructors
|
||||
explicit FDialog (FWidget* = nullptr);
|
||||
explicit FDialog (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FDialog (const FDialog&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FDialog();
|
||||
|
||||
|
@ -98,7 +100,7 @@ class FDialog : public FWindow
|
|||
FDialog& operator = (const FDialog&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FString getText() const;
|
||||
|
||||
// Mutators
|
||||
|
@ -108,7 +110,7 @@ class FDialog : public FWindow
|
|||
bool setModal (bool);
|
||||
bool setModal();
|
||||
bool unsetModal();
|
||||
virtual bool setResizeable (bool);
|
||||
virtual bool setResizeable (bool) override;
|
||||
bool setScrollable (bool);
|
||||
bool setScrollable();
|
||||
bool unsetScrollable();
|
||||
|
@ -119,16 +121,16 @@ class FDialog : public FWindow
|
|||
bool isScrollable();
|
||||
|
||||
// Methods
|
||||
virtual void show();
|
||||
virtual void hide();
|
||||
virtual void show() override;
|
||||
virtual void hide() override;
|
||||
int exec();
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void move (int, int);
|
||||
virtual void setPos (int, int, bool = true) override;
|
||||
virtual void move (int, int) override;
|
||||
bool moveUp (int);
|
||||
bool moveDown (int);
|
||||
bool moveLeft (int);
|
||||
bool moveRight (int);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true) override;
|
||||
bool reduceHeight (int);
|
||||
bool expandHeight (int);
|
||||
bool reduceWidth (int);
|
||||
|
@ -136,27 +138,27 @@ class FDialog : public FWindow
|
|||
void activateDialog();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onWindowActive (FEvent*);
|
||||
virtual void onWindowInactive (FEvent*);
|
||||
virtual void onWindowRaised (FEvent*);
|
||||
virtual void onWindowLowered (FEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onMouseDoubleClick (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
virtual void onWindowActive (FEvent*) override;
|
||||
virtual void onWindowInactive (FEvent*) override;
|
||||
virtual void onWindowRaised (FEvent*) override;
|
||||
virtual void onWindowLowered (FEvent*) override;
|
||||
|
||||
protected:
|
||||
// Methods
|
||||
virtual void done (int);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawDialogShadow();
|
||||
|
||||
// Event handlers
|
||||
virtual void onShow (FShowEvent*);
|
||||
virtual void onHide (FHideEvent*);
|
||||
virtual void onClose (FCloseEvent*);
|
||||
virtual void onShow (FShowEvent*) override;
|
||||
virtual void onHide (FHideEvent*) override;
|
||||
virtual void onClose (FCloseEvent*) override;
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
|
@ -170,8 +172,8 @@ class FDialog : public FWindow
|
|||
} mouseStates;
|
||||
|
||||
// Constant
|
||||
static const std::size_t MENU_BTN = 3;
|
||||
static const bool PRINT_WIN_NUMBER = false; // Only for debug
|
||||
static constexpr std::size_t MENU_BTN = 3;
|
||||
static constexpr bool PRINT_WIN_NUMBER = false; // Only for debug
|
||||
|
||||
// Using-declaration
|
||||
using FWidget::drawBorder;
|
||||
|
@ -182,7 +184,7 @@ class FDialog : public FWindow
|
|||
void initMoveSizeMenuItem (FMenu*);
|
||||
void initZoomMenuItem (FMenu*);
|
||||
void initCloseMenuItem (FMenu*);
|
||||
virtual void drawBorder();
|
||||
virtual void drawBorder() override;
|
||||
void drawTitleBar();
|
||||
void drawBarButton();
|
||||
void drawZoomButton();
|
||||
|
@ -196,18 +198,18 @@ class FDialog : public FWindow
|
|||
void selectFirstMenuItem();
|
||||
void setZoomItem();
|
||||
std::size_t getZoomButtonWidth();
|
||||
void activateZoomButton (mouseStates&);
|
||||
void activateZoomButton (const mouseStates&);
|
||||
void deactivateZoomButton();
|
||||
void leaveZoomButton (mouseStates&);
|
||||
void pressZoomButton (mouseStates&);
|
||||
void leaveZoomButton (const mouseStates&);
|
||||
void pressZoomButton (const mouseStates&);
|
||||
bool isMouseOverMenu (const FPoint&);
|
||||
void passEventToSubMenu (mouseStates&, FMouseEvent*);
|
||||
void passEventToSubMenu (const mouseStates&, FMouseEvent*);
|
||||
void moveSizeKey (FKeyEvent*);
|
||||
void raiseActivateDialog();
|
||||
void lowerActivateDialog();
|
||||
bool isLowerRightResizeCorner (mouseStates&);
|
||||
void resizeMouseDown (mouseStates&);
|
||||
void resizeMouseUpMove (mouseStates&, bool = false);
|
||||
bool isLowerRightResizeCorner (const mouseStates&);
|
||||
void resizeMouseDown (const mouseStates&);
|
||||
void resizeMouseUpMove (const mouseStates&, bool = false);
|
||||
void cancelMouseResize();
|
||||
void acceptMoveSize();
|
||||
void cancelMoveSize();
|
||||
|
@ -215,9 +217,9 @@ class FDialog : public FWindow
|
|||
static void delDialog (FWidget*);
|
||||
|
||||
// Callback methods
|
||||
void cb_move (FWidget*, data_ptr);
|
||||
void cb_zoom (FWidget*, data_ptr);
|
||||
void cb_close (FWidget*, data_ptr);
|
||||
void cb_move (FWidget*, FDataPtr);
|
||||
void cb_zoom (FWidget*, FDataPtr);
|
||||
void cb_close (FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
FString tb_text{}; // title bar text
|
||||
|
|
|
@ -81,8 +81,10 @@ class FDialogListMenu : public FMenu
|
|||
// Constructors
|
||||
explicit FDialogListMenu (FWidget* = nullptr);
|
||||
explicit FDialogListMenu (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FDialogListMenu (const FDialogListMenu&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FDialogListMenu();
|
||||
|
||||
|
@ -90,7 +92,7 @@ class FDialogListMenu : public FMenu
|
|||
FDialogListMenu& operator = (const FDialogListMenu&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
|
||||
#include "final/fc.h"
|
||||
#include "final/fpoint.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
@ -93,12 +94,11 @@ class FEvent // event base class
|
|||
{
|
||||
public:
|
||||
FEvent() = default;
|
||||
explicit FEvent(int);
|
||||
virtual ~FEvent();
|
||||
int type() const;
|
||||
explicit FEvent(fc::events);
|
||||
fc::events type() const;
|
||||
|
||||
protected:
|
||||
int t{fc::None_Event};
|
||||
fc::events t{fc::None_Event};
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@ -115,7 +115,7 @@ class FKeyEvent : public FEvent // keyboard event
|
|||
{
|
||||
public:
|
||||
FKeyEvent() = default;
|
||||
FKeyEvent (int, FKey);
|
||||
FKeyEvent (fc::events, FKey);
|
||||
~FKeyEvent();
|
||||
|
||||
FKey key() const;
|
||||
|
@ -142,8 +142,8 @@ class FMouseEvent : public FEvent // mouse event
|
|||
{
|
||||
public:
|
||||
FMouseEvent() = default;
|
||||
FMouseEvent (int, const FPoint&, const FPoint&, int);
|
||||
FMouseEvent (int, const FPoint&, int);
|
||||
FMouseEvent (fc::events, const FPoint&, const FPoint&, int);
|
||||
FMouseEvent (fc::events, const FPoint&, int);
|
||||
~FMouseEvent();
|
||||
|
||||
const FPoint& getPos() const;
|
||||
|
@ -174,8 +174,8 @@ class FWheelEvent : public FEvent // wheel event
|
|||
{
|
||||
public:
|
||||
FWheelEvent() = default;
|
||||
FWheelEvent (int, const FPoint&, int);
|
||||
FWheelEvent (int, const FPoint&, const FPoint&, int);
|
||||
FWheelEvent (fc::events, const FPoint&, int);
|
||||
FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
|
||||
~FWheelEvent();
|
||||
|
||||
const FPoint& getPos() const;
|
||||
|
@ -206,7 +206,7 @@ class FFocusEvent : public FEvent // focus event
|
|||
{
|
||||
public:
|
||||
FFocusEvent() = default;
|
||||
explicit FFocusEvent (int);
|
||||
explicit FFocusEvent (fc::events);
|
||||
~FFocusEvent();
|
||||
|
||||
bool gotFocus() const;
|
||||
|
@ -235,7 +235,7 @@ class FAccelEvent : public FEvent // focus event
|
|||
{
|
||||
public:
|
||||
FAccelEvent() = default;
|
||||
FAccelEvent (int, void*);
|
||||
FAccelEvent (fc::events, void*);
|
||||
FAccelEvent (const FAccelEvent&) = delete;
|
||||
~FAccelEvent();
|
||||
FAccelEvent& operator = (const FAccelEvent&) = delete;
|
||||
|
@ -261,7 +261,7 @@ class FResizeEvent : public FEvent // resize event
|
|||
{
|
||||
public:
|
||||
FResizeEvent() = default;
|
||||
explicit FResizeEvent (int);
|
||||
explicit FResizeEvent (fc::events);
|
||||
~FResizeEvent();
|
||||
|
||||
bool isAccepted() const;
|
||||
|
@ -273,7 +273,6 @@ class FResizeEvent : public FEvent // resize event
|
|||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FShowEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -282,12 +281,11 @@ class FShowEvent : public FEvent // show event
|
|||
{
|
||||
public:
|
||||
FShowEvent() = default;
|
||||
explicit FShowEvent (int);
|
||||
explicit FShowEvent (fc::events);
|
||||
~FShowEvent();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FHideEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -296,12 +294,11 @@ class FHideEvent : public FEvent // hide event
|
|||
{
|
||||
public:
|
||||
FHideEvent() = default;
|
||||
explicit FHideEvent (int);
|
||||
explicit FHideEvent (fc::events);
|
||||
~FHideEvent();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FCloseEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -310,7 +307,7 @@ class FCloseEvent : public FEvent // close event
|
|||
{
|
||||
public:
|
||||
FCloseEvent() = default;
|
||||
explicit FCloseEvent(int);
|
||||
explicit FCloseEvent(fc::events);
|
||||
~FCloseEvent();
|
||||
|
||||
bool isAccepted() const;
|
||||
|
@ -322,7 +319,6 @@ class FCloseEvent : public FEvent // close event
|
|||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FTimerEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -334,10 +330,10 @@ class FTimerEvent : public FEvent // timer event
|
|||
{
|
||||
public:
|
||||
FTimerEvent() = default;
|
||||
FTimerEvent(int, int);
|
||||
FTimerEvent (fc::events, int);
|
||||
~FTimerEvent();
|
||||
|
||||
int timerId() const;
|
||||
int getTimerId() const;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
|
@ -345,6 +341,32 @@ class FTimerEvent : public FEvent // timer event
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FUserEvent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class FUserEvent : public FEvent // timer event
|
||||
{
|
||||
public:
|
||||
FUserEvent() = default;
|
||||
FUserEvent (fc::events, int);
|
||||
~FUserEvent();
|
||||
|
||||
int getUserId() const;
|
||||
FDataPtr getData() const;
|
||||
void setData (FDataPtr);
|
||||
|
||||
protected:
|
||||
int uid;
|
||||
FDataPtr data_pointer{nullptr};
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FEVENT_H
|
||||
|
|
|
@ -108,6 +108,7 @@ class FFileDialog : public FDialog
|
|||
, const FString&
|
||||
, DialogType = FFileDialog::Open
|
||||
, FWidget* = nullptr );
|
||||
|
||||
// Destructor
|
||||
virtual ~FFileDialog();
|
||||
|
||||
|
@ -115,7 +116,7 @@ class FFileDialog : public FDialog
|
|||
FFileDialog& operator = (const FFileDialog&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
const FString getPath() const;
|
||||
const FString getFilter() const;
|
||||
const FString getSelectedFile() const;
|
||||
|
@ -129,7 +130,7 @@ class FFileDialog : public FDialog
|
|||
bool unsetShowHiddenFiles();
|
||||
|
||||
// Event handler
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
|
||||
// Methods
|
||||
static const FString fileOpenChooser ( FWidget*
|
||||
|
@ -141,7 +142,7 @@ class FFileDialog : public FDialog
|
|||
|
||||
protected:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
|
@ -179,12 +180,12 @@ class FFileDialog : public FDialog
|
|||
static const FString getHomeDir();
|
||||
|
||||
// Callback methods
|
||||
void cb_processActivate (FWidget*, data_ptr);
|
||||
void cb_processRowChanged (FWidget*, data_ptr);
|
||||
void cb_processClicked (FWidget*, data_ptr);
|
||||
void cb_processCancel (FWidget*, data_ptr);
|
||||
void cb_processOpen (FWidget*, data_ptr);
|
||||
void cb_processShowHidden (FWidget*, data_ptr);
|
||||
void cb_processActivate (FWidget*, FDataPtr);
|
||||
void cb_processRowChanged (FWidget*, FDataPtr);
|
||||
void cb_processClicked (FWidget*, FDataPtr);
|
||||
void cb_processCancel (FWidget*, FDataPtr);
|
||||
void cb_processOpen (FWidget*, FDataPtr);
|
||||
void cb_processShowHidden (FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
DIR* directory_stream{nullptr};
|
||||
|
|
|
@ -85,15 +85,17 @@ class FKeyboard
|
|||
{
|
||||
public:
|
||||
// Constants
|
||||
static const std::size_t FIFO_BUF_SIZE{512};
|
||||
static constexpr std::size_t FIFO_BUF_SIZE{512};
|
||||
|
||||
// Typedef
|
||||
typedef char keybuffer[FIFO_BUF_SIZE];
|
||||
|
||||
// Constructor
|
||||
FKeyboard();
|
||||
|
||||
// Disable copy constructor
|
||||
FKeyboard (const FKeyboard&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FKeyboard();
|
||||
|
||||
|
@ -109,7 +111,7 @@ class FKeyboard
|
|||
|
||||
// Mutators
|
||||
void setTermcapMap (fc::fkeymap*);
|
||||
void setKeypressTimeout (const long);
|
||||
void setKeypressTimeout (const uInt64);
|
||||
void enableUTF8();
|
||||
void disableUTF8();
|
||||
void enableMouseSequences();
|
||||
|
@ -136,8 +138,8 @@ class FKeyboard
|
|||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t READ_BUF_SIZE{1024};
|
||||
static const FKey NOT_SET = static_cast<FKey>(-1);
|
||||
static constexpr std::size_t READ_BUF_SIZE{1024};
|
||||
static constexpr FKey NOT_SET = static_cast<FKey>(-1);
|
||||
|
||||
// Accessors
|
||||
FKey getMouseProtocolKey();
|
||||
|
@ -171,7 +173,7 @@ class FKeyboard
|
|||
int fifo_offset{0};
|
||||
bool fifo_in_use{false};
|
||||
int stdin_status_flags{0};
|
||||
static long key_timeout;
|
||||
static uInt64 key_timeout;
|
||||
bool input_data_pending{false};
|
||||
bool utf8_input{false};
|
||||
bool mouse_support{true};
|
||||
|
@ -208,7 +210,7 @@ inline timeval* FKeyboard::getKeyPressedTime()
|
|||
{ return &time_keypressed; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FKeyboard::setKeypressTimeout (const long timeout)
|
||||
inline void FKeyboard::setKeypressTimeout (const uInt64 timeout)
|
||||
{ key_timeout = timeout; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -75,8 +75,10 @@ class FLabel : public FWidget
|
|||
// Constructor
|
||||
explicit FLabel (FWidget* = nullptr);
|
||||
explicit FLabel (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FLabel (const FLabel&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FLabel();
|
||||
|
||||
|
@ -98,7 +100,7 @@ class FLabel : public FWidget
|
|||
const FLabel& operator >> (FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FWidget* getAccelWidget();
|
||||
fc::text_alignment getAlignment();
|
||||
FString& getText();
|
||||
|
@ -112,7 +114,7 @@ class FLabel : public FWidget
|
|||
bool setReverseMode(bool);
|
||||
bool setReverseMode();
|
||||
bool unsetReverseMode();
|
||||
virtual bool setEnable (bool);
|
||||
virtual bool setEnable (bool) override;
|
||||
void setNumber (uLong);
|
||||
void setNumber (long);
|
||||
void setNumber (float, int = FLT_DIG);
|
||||
|
@ -125,19 +127,19 @@ class FLabel : public FWidget
|
|||
bool hasReverseMode();
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
void clear();
|
||||
|
||||
// Event handlers
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
||||
void cb_accel_widget_destroyed (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
|
@ -145,7 +147,7 @@ class FLabel : public FWidget
|
|||
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
void setHotkeyAccelerator();
|
||||
std::size_t getAlignOffset (std::size_t);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawMultiLine();
|
||||
void drawSingleLine();
|
||||
void printLine ( wchar_t[], std::size_t
|
||||
|
|
|
@ -78,8 +78,10 @@ class FLineEdit : public FWidget
|
|||
// Constructor
|
||||
explicit FLineEdit (FWidget* = nullptr);
|
||||
explicit FLineEdit (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FLineEdit (const FLineEdit&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FLineEdit();
|
||||
|
||||
|
@ -101,7 +103,7 @@ class FLineEdit : public FWidget
|
|||
const FLineEdit& operator >> (FString&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FString getText() const;
|
||||
int getLabelOrientation();
|
||||
|
||||
|
@ -109,13 +111,13 @@ class FLineEdit : public FWidget
|
|||
void setText (const FString&);
|
||||
void setLabelText (const FString&);
|
||||
void setLabelOrientation(const label_o);
|
||||
virtual bool setEnable(bool);
|
||||
virtual bool setEnable();
|
||||
virtual bool unsetEnable();
|
||||
virtual bool setDisable();
|
||||
virtual bool setFocus(bool);
|
||||
virtual bool setFocus();
|
||||
virtual bool unsetFocus();
|
||||
virtual bool setEnable(bool) override;
|
||||
virtual bool setEnable() override;
|
||||
virtual bool unsetEnable() override;
|
||||
virtual bool setDisable() override;
|
||||
virtual bool setFocus(bool) override;
|
||||
virtual bool setFocus() override;
|
||||
virtual bool unsetFocus() override;
|
||||
bool setShadow(bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
|
@ -124,23 +126,23 @@ class FLineEdit : public FWidget
|
|||
bool hasShadow();
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
void clear();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onHide (FHideEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onTimer (FTimerEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
virtual void onHide (FHideEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onFocusOut (FFocusEvent*) override;
|
||||
|
||||
protected:
|
||||
void adjustLabel();
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -154,7 +156,7 @@ class FLineEdit : public FWidget
|
|||
// Methods
|
||||
void init();
|
||||
bool hasHotkey();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawInputField();
|
||||
void keyLeft();
|
||||
void keyRight();
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fscrollbar.h"
|
||||
|
@ -75,7 +76,7 @@ class FListBoxItem
|
|||
// Constructors
|
||||
FListBoxItem ();
|
||||
FListBoxItem (const FListBoxItem&); // copy constructor
|
||||
explicit FListBoxItem (const FString&, FWidget::data_ptr = nullptr);
|
||||
explicit FListBoxItem (const FString&, FDataPtr = nullptr);
|
||||
|
||||
// Destructor
|
||||
virtual ~FListBoxItem();
|
||||
|
@ -84,12 +85,13 @@ class FListBoxItem
|
|||
FListBoxItem& operator = (const FListBoxItem&);
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual FString& getText();
|
||||
virtual FWidget::data_ptr getData() const;
|
||||
virtual FDataPtr getData() const;
|
||||
|
||||
// Mutators
|
||||
void setText (const FString&);
|
||||
void setData (FWidget::data_ptr);
|
||||
void setData (FDataPtr);
|
||||
|
||||
// Methods
|
||||
void clear();
|
||||
|
@ -100,7 +102,7 @@ class FListBoxItem
|
|||
|
||||
// Data Members
|
||||
FString text{};
|
||||
FWidget::data_ptr data_pointer{nullptr};
|
||||
FDataPtr data_pointer{nullptr};
|
||||
fc::brackets_type brackets{fc::NoBrackets};
|
||||
bool selected{false};
|
||||
};
|
||||
|
@ -108,12 +110,16 @@ class FListBoxItem
|
|||
|
||||
|
||||
// FListBoxItem inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FListBoxItem::getClassName() const
|
||||
{ return "FListBoxItem"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString& FListBoxItem::getText()
|
||||
{ return text; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::data_ptr FListBoxItem::getData() const
|
||||
inline FDataPtr FListBoxItem::getData() const
|
||||
{ return data_pointer; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -121,7 +127,7 @@ inline void FListBoxItem::setText (const FString& txt)
|
|||
{ text = txt; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBoxItem::setData (FWidget::data_ptr data)
|
||||
inline void FListBoxItem::setData (FDataPtr data)
|
||||
{ data_pointer = data; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -151,8 +157,10 @@ class FListBox : public FWidget
|
|||
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
|
||||
template <typename Container, typename LazyConverter>
|
||||
FListBox (Container, LazyConverter, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FListBox (const FListBox&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FListBox();
|
||||
|
||||
|
@ -160,7 +168,7 @@ class FListBox : public FWidget
|
|||
FListBox& operator = (const FListBox&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
std::size_t getCount() const;
|
||||
FListBoxItem getItem (std::size_t);
|
||||
FListBoxItem getItem (listBoxItems::iterator) const;
|
||||
|
@ -177,14 +185,16 @@ class FListBox : public FWidget
|
|||
void showInsideBrackets (std::size_t, fc::brackets_type);
|
||||
void showNoBrackets (std::size_t);
|
||||
void showNoBrackets (listBoxItems::iterator);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true ) override;
|
||||
void setMultiSelection (bool);
|
||||
void setMultiSelection ();
|
||||
void unsetMultiSelection ();
|
||||
virtual bool setDisable();
|
||||
virtual bool setFocus (bool);
|
||||
virtual bool setFocus();
|
||||
virtual bool unsetFocus();
|
||||
virtual bool setDisable() override;
|
||||
virtual bool setFocus (bool) override;
|
||||
virtual bool setFocus() override;
|
||||
virtual bool unsetFocus() override;
|
||||
void setText (const FString&);
|
||||
|
||||
// Inquiries
|
||||
|
@ -195,40 +205,40 @@ class FListBox : public FWidget
|
|||
bool hasBrackets (listBoxItems::iterator) const;
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
template <typename Iterator, typename InsertConverter>
|
||||
void insert (Iterator, Iterator, InsertConverter);
|
||||
template <typename Container, typename LazyConverter>
|
||||
void insert (Container, LazyConverter);
|
||||
void insert (FListBoxItem);
|
||||
void insert ( const FString&
|
||||
template <typename ItemT>
|
||||
void insert ( const ItemT&
|
||||
, fc::brackets_type = fc::NoBrackets
|
||||
, bool = false
|
||||
, data_ptr = nullptr );
|
||||
void insert ( long
|
||||
, fc::brackets_type = fc::NoBrackets
|
||||
, bool = false
|
||||
, data_ptr = nullptr );
|
||||
, FDataPtr = nullptr );
|
||||
void remove (std::size_t);
|
||||
void clear();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||
virtual void onWheel (FWheelEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onMouseDoubleClick (FMouseEvent*) override;
|
||||
virtual void onWheel (FWheelEvent*) override;
|
||||
virtual void onTimer (FTimerEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onFocusOut (FFocusEvent*) override;
|
||||
|
||||
protected:
|
||||
// Methods
|
||||
void adjustYOffset (std::size_t);
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Enumeration
|
||||
enum convert_type
|
||||
{
|
||||
|
@ -242,7 +252,7 @@ class FListBox : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawHeadline();
|
||||
void drawList();
|
||||
void drawListLine (int, listBoxItems::iterator, bool);
|
||||
|
@ -291,20 +301,20 @@ class FListBox : public FWidget
|
|||
listBoxItems::iterator index2iterator (std::size_t);
|
||||
|
||||
// Callback methods
|
||||
void cb_VBarChange (FWidget*, data_ptr);
|
||||
void cb_HBarChange (FWidget*, data_ptr);
|
||||
void cb_VBarChange (FWidget*, FDataPtr);
|
||||
void cb_HBarChange (FWidget*, FDataPtr);
|
||||
|
||||
// Function Pointer
|
||||
void (*convertToItem) ( FListBoxItem&
|
||||
, FWidget::data_ptr
|
||||
, FDataPtr
|
||||
, int index ){nullptr};
|
||||
|
||||
// Data Members
|
||||
listBoxItems itemlist{};
|
||||
FWidget::data_ptr source_container{nullptr};
|
||||
FDataPtr source_container{nullptr};
|
||||
convert_type conv_type{FListBox::no_convert};
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
FString text{};
|
||||
FString inc_search{};
|
||||
bool multi_select{false};
|
||||
|
@ -406,8 +416,8 @@ inline void FListBox::showNoBrackets (listBoxItems::iterator iter)
|
|||
{ iter->brackets = fc::NoBrackets; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::setMultiSelection (bool on)
|
||||
{ multi_select = on; }
|
||||
inline void FListBox::setMultiSelection (bool enable)
|
||||
{ multi_select = enable; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::setMultiSelection()
|
||||
|
@ -479,6 +489,19 @@ void FListBox::insert (Container container, LazyConverter convert)
|
|||
recalculateVerticalBar(size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename ItemT>
|
||||
void FListBox::insert ( const ItemT& item
|
||||
, fc::brackets_type b
|
||||
, bool s
|
||||
, FDataPtr d )
|
||||
{
|
||||
FListBoxItem listItem (FString() << item, d);
|
||||
listItem.brackets = b;
|
||||
listItem.selected = s;
|
||||
insert (listItem);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FListBox::listBoxItems::iterator \
|
||||
FListBox::index2iterator (std::size_t index)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -53,9 +53,10 @@
|
|||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include "final/fmessagebox.h"
|
||||
|
||||
#include "final/fscrollbar.h"
|
||||
#include "final/fstring.h"
|
||||
#include "final/ftermbuffer.h"
|
||||
|
@ -81,7 +82,7 @@ class FListViewItem : public FObject
|
|||
FListViewItem (const FListViewItem&); // copy constructor
|
||||
explicit FListViewItem (FObjectIterator);
|
||||
FListViewItem ( const FStringList&
|
||||
, FWidget::data_ptr
|
||||
, FDataPtr
|
||||
, FObjectIterator );
|
||||
|
||||
// Destructor
|
||||
|
@ -91,16 +92,16 @@ class FListViewItem : public FObject
|
|||
FListViewItem& operator = (const FListViewItem&);
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const;
|
||||
uInt getColumnCount() const;
|
||||
int getSortColumn() const;
|
||||
FString getText (int) const;
|
||||
FWidget::data_ptr getData() const;
|
||||
FDataPtr getData() const;
|
||||
uInt getDepth() const;
|
||||
|
||||
// Mutators
|
||||
void setText (int, const FString&);
|
||||
void setData (FWidget::data_ptr);
|
||||
void setData (FDataPtr);
|
||||
void setCheckable (bool);
|
||||
void setChecked (bool);
|
||||
|
||||
|
@ -129,7 +130,7 @@ class FListViewItem : public FObject
|
|||
|
||||
// Data Members
|
||||
FStringList column_list{};
|
||||
FWidget::data_ptr data_pointer{nullptr};
|
||||
FDataPtr data_pointer{nullptr};
|
||||
FObjectIterator root{};
|
||||
std::size_t visible_lines{1};
|
||||
bool expandable{false};
|
||||
|
@ -154,11 +155,11 @@ inline uInt FListViewItem::getColumnCount() const
|
|||
{ return uInt(column_list.size()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::data_ptr FListViewItem::getData() const
|
||||
inline FDataPtr FListViewItem::getData() const
|
||||
{ return data_pointer; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListViewItem::setData (FWidget::data_ptr data)
|
||||
inline void FListViewItem::setData (FDataPtr data)
|
||||
{ data_pointer = data; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -273,8 +274,10 @@ class FListView : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FListView (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FListView (const FListView&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FListView();
|
||||
|
||||
|
@ -282,7 +285,7 @@ class FListView : public FWidget
|
|||
FListView& operator = (const FListView&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
std::size_t getCount();
|
||||
fc::text_alignment getColumnAlignment (int) const;
|
||||
FString getColumnText (int) const;
|
||||
|
@ -294,7 +297,7 @@ class FListView : public FWidget
|
|||
// Mutators
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true );
|
||||
, bool = true ) override;
|
||||
void setColumnAlignment (int, fc::text_alignment);
|
||||
void setColumnText (int, const FString&);
|
||||
void setColumnSortType (int, fc::sorting_type \
|
||||
|
@ -315,33 +318,33 @@ class FListView : public FWidget
|
|||
FObjectIterator insert (FListViewItem*);
|
||||
FObjectIterator insert (FListViewItem*, FObjectIterator);
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, data_ptr = nullptr );
|
||||
, FDataPtr = nullptr );
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, FObjectIterator );
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, data_ptr
|
||||
, FDataPtr
|
||||
, FObjectIterator );
|
||||
FObjectIterator insert ( const std::vector<long>&
|
||||
, data_ptr = nullptr );
|
||||
FObjectIterator insert ( const std::vector<long>&
|
||||
FObjectIterator insert ( const std::vector<uInt64>&
|
||||
, FDataPtr = nullptr );
|
||||
FObjectIterator insert ( const std::vector<uInt64>&
|
||||
, FObjectIterator );
|
||||
FObjectIterator insert ( const std::vector<long>&
|
||||
, data_ptr
|
||||
FObjectIterator insert ( const std::vector<uInt64>&
|
||||
, FDataPtr
|
||||
, FObjectIterator );
|
||||
FObjectIterator beginOfList();
|
||||
FObjectIterator endOfList();
|
||||
virtual void sort();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||
virtual void onWheel (FWheelEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onMouseDoubleClick (FMouseEvent*) override;
|
||||
virtual void onWheel (FWheelEvent*) override;
|
||||
virtual void onTimer (FTimerEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onFocusOut (FFocusEvent*) override;
|
||||
|
||||
// Data Members
|
||||
static FObjectIterator null_iter;
|
||||
|
@ -349,16 +352,17 @@ class FListView : public FWidget
|
|||
protected:
|
||||
// Methods
|
||||
void adjustViewport (int);
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
struct Header; // forward declaration
|
||||
typedef std::vector<Header> headerItems;
|
||||
typedef std::vector<fc::sorting_type> sortTypes;
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Constants
|
||||
static const int USE_MAX_SIZE = -1;
|
||||
static constexpr int USE_MAX_SIZE = -1;
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
|
@ -367,7 +371,7 @@ class FListView : public FWidget
|
|||
std::size_t getAlignOffset ( fc::text_alignment
|
||||
, std::size_t
|
||||
, std::size_t );
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawHeadlines();
|
||||
void drawList();
|
||||
void drawListLine (const FListViewItem*, bool, bool);
|
||||
|
@ -375,9 +379,9 @@ class FListView : public FWidget
|
|||
FString getCheckBox (const FListViewItem* item);
|
||||
FString getLinePrefix (const FListViewItem*, std::size_t);
|
||||
void drawSortIndicator (std::size_t&, std::size_t);
|
||||
void drawHeadlineLabel (headerItems::const_iterator&);
|
||||
void drawHeadlineLabel (const headerItems::const_iterator&);
|
||||
void drawHeaderBorder (std::size_t);
|
||||
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||
void drawColumnEllipsis ( const headerItems::const_iterator&
|
||||
, const FString& );
|
||||
void updateDrawing (bool, bool);
|
||||
std::size_t determineLineWidth (FListViewItem*);
|
||||
|
@ -416,8 +420,8 @@ class FListView : public FWidget
|
|||
bool hasCheckableItems() const;
|
||||
|
||||
// Callback methods
|
||||
void cb_VBarChange (FWidget*, data_ptr);
|
||||
void cb_HBarChange (FWidget*, data_ptr);
|
||||
void cb_VBarChange (FWidget*, FDataPtr);
|
||||
void cb_HBarChange (FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
FObjectIterator root{};
|
||||
|
@ -428,8 +432,8 @@ class FListView : public FWidget
|
|||
FListViewIterator last_visible_line{};
|
||||
headerItems header{};
|
||||
FTermBuffer headerline{};
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
fc::dragScroll drag_scroll{fc::noScroll};
|
||||
int scroll_repeat{100};
|
||||
int scroll_distance{1};
|
||||
|
@ -506,8 +510,8 @@ inline void FListView::hideSortIndicator (bool hide)
|
|||
{ hide_sort_indicator = hide; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView (bool on)
|
||||
{ return (tree_view = on); }
|
||||
inline bool FListView::setTreeView (bool enable)
|
||||
{ return (tree_view = enable); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView()
|
||||
|
@ -523,7 +527,7 @@ inline FObject::FObjectIterator FListView::insert (FListViewItem* item)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::FObjectIterator
|
||||
FListView::insert (const FStringList& cols, data_ptr d)
|
||||
FListView::insert (const FStringList& cols, FDataPtr d)
|
||||
{ return insert (cols, d, root); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -534,12 +538,12 @@ inline FObject::FObjectIterator
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::FObjectIterator
|
||||
FListView::insert (const std::vector<long>& cols, data_ptr d)
|
||||
FListView::insert (const std::vector<uInt64>& cols, FDataPtr d)
|
||||
{ return insert (cols, d, root); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::FObjectIterator
|
||||
FListView::insert ( const std::vector<long>& cols
|
||||
FListView::insert ( const std::vector<uInt64>& cols
|
||||
, FObjectIterator parent_iter )
|
||||
{ return insert (cols, 0, parent_iter); }
|
||||
|
||||
|
|
|
@ -80,8 +80,10 @@ class FMenu : public FWindow, public FMenuList
|
|||
// Constructor
|
||||
explicit FMenu (FWidget* = nullptr);
|
||||
explicit FMenu (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenu (const FMenu&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenu();
|
||||
|
||||
|
@ -89,21 +91,21 @@ class FMenu : public FWindow, public FMenuList
|
|||
FMenu& operator = (const FMenu&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
FString getText() const;
|
||||
FMenuItem* getItem();
|
||||
|
||||
// Mutators
|
||||
virtual bool setEnable(bool);
|
||||
virtual bool setEnable();
|
||||
virtual bool unsetEnable();
|
||||
virtual bool setDisable();
|
||||
virtual bool setEnable(bool) override;
|
||||
virtual bool setEnable() override;
|
||||
virtual bool unsetEnable() override;
|
||||
virtual bool setDisable() override;
|
||||
void setSelected();
|
||||
void unsetSelected();
|
||||
bool setMenuWidget (bool);
|
||||
bool setMenuWidget();
|
||||
bool unsetMenuWidget();
|
||||
virtual void setStatusbarMessage (const FString&);
|
||||
virtual void setStatusbarMessage (const FString&) override;
|
||||
void setMenu (FMenu*);
|
||||
void setText (const FString&);
|
||||
|
||||
|
@ -114,22 +116,23 @@ class FMenu : public FWindow, public FMenuList
|
|||
bool hasMenu() const;
|
||||
|
||||
// Methods
|
||||
virtual void show();
|
||||
virtual void hide();
|
||||
virtual void show() override;
|
||||
virtual void hide() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback method
|
||||
void cb_menuitem_toggled (FWidget*, data_ptr);
|
||||
void cb_menuitem_toggled (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr bool SELECT_ITEM = true;
|
||||
|
||||
// Typedef
|
||||
typedef struct
|
||||
|
@ -151,9 +154,6 @@ class FMenu : public FWindow, public FMenuList
|
|||
bool no_underline;
|
||||
} menuText;
|
||||
|
||||
// Constants
|
||||
static const bool SELECT_ITEM = true;
|
||||
|
||||
// Accessors
|
||||
FWidget* getSuperMenu() const;
|
||||
|
||||
|
@ -201,7 +201,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
void keypressMenuBar (FKeyEvent*);
|
||||
bool hotkeyMenu (FKeyEvent*);
|
||||
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawItems();
|
||||
void drawSeparator (int);
|
||||
void drawMenuLine (FMenuItem*, int);
|
||||
|
@ -255,8 +255,8 @@ inline FMenuItem* FMenu::getItem()
|
|||
{ return &item; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMenu::setEnable(bool on)
|
||||
{ return item.setEnable(on); }
|
||||
inline bool FMenu::setEnable(bool enable)
|
||||
{ return item.setEnable(enable); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMenu::setEnable()
|
||||
|
|
|
@ -78,8 +78,10 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
public:
|
||||
// Constructor
|
||||
explicit FMenuBar (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuBar (const FMenuBar&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuBar();
|
||||
|
||||
|
@ -87,26 +89,26 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
FMenuBar& operator = (const FMenuBar&) = delete;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Methods
|
||||
void resetMenu();
|
||||
virtual void hide();
|
||||
virtual void adjustSize();
|
||||
virtual void hide() override;
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
|
||||
// Callback methods
|
||||
void cb_item_deactivated (FWidget*, data_ptr);
|
||||
void cb_item_deactivated (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
||||
// Typedef
|
||||
typedef struct
|
||||
|
@ -128,12 +130,12 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
bool selectPrevItem();
|
||||
bool hotkeyMenu (FKeyEvent*&);
|
||||
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawItems();
|
||||
void drawItem (FMenuItem*, std::size_t&);
|
||||
void setLineAttributes (FMenuItem*);
|
||||
void drawMenuText (menuText&);
|
||||
void drawEllipsis (menuText&, std::size_t);
|
||||
void drawEllipsis (const menuText&, std::size_t);
|
||||
void drawLeadingSpace (std::size_t&);
|
||||
void drawTrailingSpace (std::size_t&);
|
||||
void adjustItems();
|
||||
|
@ -141,10 +143,10 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
bool clickItem (FMenuItem*);
|
||||
void unselectMenuItem (FMenuItem*);
|
||||
void selectMenuItem (FMenuItem*);
|
||||
void mouseDownOverList (FMouseEvent*);
|
||||
void mouseUpOverList (FMouseEvent*);
|
||||
void mouseMoveOverList (FMouseEvent*);
|
||||
void passEventToMenu (FMouseEvent*&);
|
||||
void mouseDownOverList (const FMouseEvent*);
|
||||
void mouseUpOverList (const FMouseEvent*);
|
||||
void mouseMoveOverList (const FMouseEvent*);
|
||||
void passEventToMenu (const FMouseEvent*&);
|
||||
void leaveMenuBar();
|
||||
|
||||
// Friend classes
|
||||
|
|
|
@ -85,8 +85,10 @@ class FMenuItem : public FWidget
|
|||
explicit FMenuItem (FWidget* = nullptr);
|
||||
explicit FMenuItem (const FString&, FWidget* = nullptr);
|
||||
FMenuItem (FKey, const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuItem (const FMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuItem();
|
||||
|
||||
|
@ -94,17 +96,17 @@ class FMenuItem : public FWidget
|
|||
FMenuItem& operator = (const FMenuItem&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
uChar getHotkey() const;
|
||||
FMenu* getMenu() const;
|
||||
std::size_t getTextLength() const;
|
||||
FString getText() const;
|
||||
|
||||
// Mutators
|
||||
virtual bool setEnable (bool);
|
||||
virtual bool setFocus (bool);
|
||||
virtual bool setFocus();
|
||||
virtual bool unsetFocus();
|
||||
virtual bool setEnable (bool) override;
|
||||
virtual bool setFocus (bool) override;
|
||||
virtual bool setFocus() override;
|
||||
virtual bool unsetFocus() override;
|
||||
void setSelected();
|
||||
void unsetSelected();
|
||||
void setSeparator();
|
||||
|
@ -122,19 +124,19 @@ class FMenuItem : public FWidget
|
|||
bool hasMenu() const;
|
||||
|
||||
// Methods
|
||||
virtual void addAccelerator (FKey, FWidget*);
|
||||
virtual void delAccelerator (FWidget*);
|
||||
virtual void addAccelerator (FKey, FWidget*) override;
|
||||
virtual void delAccelerator (FWidget*) override;
|
||||
void openMenu();
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onAccel (FAccelEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onMouseDoubleClick (FMouseEvent*) override;
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onAccel (FAccelEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onFocusOut (FFocusEvent*) override;
|
||||
|
||||
protected:
|
||||
// Accessor
|
||||
|
@ -177,8 +179,8 @@ class FMenuItem : public FWidget
|
|||
void passMouseEvent (T, FMouseEvent*, fc::events);
|
||||
|
||||
// Callback methods
|
||||
void cb_switchToDialog (FWidget*, data_ptr);
|
||||
void cb_destroyDialog (FWidget*, data_ptr);
|
||||
void cb_switchToDialog (FWidget*, FDataPtr);
|
||||
void cb_destroyDialog (FWidget*, FDataPtr);
|
||||
|
||||
virtual void processClicked();
|
||||
|
||||
|
|
|
@ -63,8 +63,10 @@ class FMenuList
|
|||
public:
|
||||
// Constructor
|
||||
FMenuList() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FMenuList (const FMenuList&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FMenuList();
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class FMessageBox : public FDialog
|
|||
FMessageBox& operator = (const FMessageBox&);
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
const FString getTitlebarText() const;
|
||||
const FString getHeadline() const;
|
||||
const FString getText() const;
|
||||
|
@ -121,31 +121,26 @@ class FMessageBox : public FDialog
|
|||
void setText (const FString&);
|
||||
|
||||
// Methods
|
||||
template <typename messageType>
|
||||
static int info ( FWidget*
|
||||
, const FString&
|
||||
, const FString&
|
||||
, int = FMessageBox::Ok
|
||||
, int = 0
|
||||
, int = 0 );
|
||||
|
||||
static int info ( FWidget*
|
||||
, const FString&
|
||||
, int
|
||||
, const messageType&
|
||||
, int = FMessageBox::Ok
|
||||
, int = 0
|
||||
, int = 0 );
|
||||
|
||||
template <typename messageType>
|
||||
static int error ( FWidget*
|
||||
, const FString&
|
||||
, const messageType&
|
||||
, int = FMessageBox::Ok
|
||||
, int = 0
|
||||
, int = 0 );
|
||||
protected:
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
|
||||
// Callback method
|
||||
void cb_processClick (FWidget*, data_ptr);
|
||||
void cb_processClick (FWidget*, FDataPtr);
|
||||
|
||||
private:
|
||||
// Methods
|
||||
|
@ -154,7 +149,7 @@ class FMessageBox : public FDialog
|
|||
void deallocation();
|
||||
void initCallbacks();
|
||||
void calculateDimensions();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void resizeButtons();
|
||||
void adjustButtons();
|
||||
|
||||
|
@ -196,8 +191,8 @@ inline void FMessageBox::setTitlebarText (const FString& txt)
|
|||
{ return FDialog::setText(txt); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMessageBox::setCenterText(bool on)
|
||||
{ return (center_text = on); }
|
||||
inline bool FMessageBox::setCenterText(bool enable)
|
||||
{ return (center_text = enable); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMessageBox::setCenterText()
|
||||
|
@ -207,6 +202,48 @@ inline bool FMessageBox::setCenterText()
|
|||
inline bool FMessageBox::unsetCenterText()
|
||||
{ return setCenterText(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename messageType>
|
||||
int FMessageBox::info ( FWidget* parent
|
||||
, const FString& caption
|
||||
, const messageType& message
|
||||
, int button0
|
||||
, int button1
|
||||
, int button2 )
|
||||
{
|
||||
int reply;
|
||||
FMessageBox mbox ( caption
|
||||
, FString() << message
|
||||
, button0, button1, button2
|
||||
, parent );
|
||||
reply = mbox.exec();
|
||||
return reply;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template <typename messageType>
|
||||
int FMessageBox::error ( FWidget* parent
|
||||
, const messageType& message
|
||||
, int button0
|
||||
, int button1
|
||||
, int button2 )
|
||||
{
|
||||
int reply;
|
||||
const FString& caption = "Error message";
|
||||
FMessageBox mbox ( caption
|
||||
, FString() << message
|
||||
, button0, button1, button2
|
||||
, parent );
|
||||
mbox.beep();
|
||||
mbox.setHeadline("Warning:");
|
||||
mbox.setCenterText();
|
||||
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
||||
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
||||
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
||||
reply = mbox.exec();
|
||||
return reply;
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FMESSAGEBOX_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -112,9 +112,9 @@ class FMouse
|
|||
void clearEvent();
|
||||
|
||||
// Mutators
|
||||
void setMaxWidth (short);
|
||||
void setMaxHeight (short);
|
||||
void setDblclickInterval (const long);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
|
||||
// Inquiries
|
||||
virtual bool hasData() = 0;
|
||||
|
@ -173,9 +173,9 @@ class FMouse
|
|||
button b_state{};
|
||||
bool mouse_event_occurred{false};
|
||||
bool input_data_pending{false};
|
||||
long dblclick_interval{500000}; // 500 ms
|
||||
short max_width{80};
|
||||
short max_height{25};
|
||||
uInt64 dblclick_interval{500000}; // 500 ms
|
||||
uInt16 max_width{80};
|
||||
uInt16 max_height{25};
|
||||
struct timeval time_mousepressed{};
|
||||
FPoint zero_point{0, 0}; // zero point (x=0, y=0)
|
||||
FPoint mouse{0, 0}; // mouse click position
|
||||
|
@ -202,18 +202,18 @@ class FMouseGPM : public FMouse
|
|||
virtual ~FMouseGPM();
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Mutators
|
||||
void setStdinNo(int);
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData();
|
||||
virtual bool hasData() override;
|
||||
bool isGpmMouseEnabled();
|
||||
|
||||
// Methods
|
||||
virtual void setRawData (FKeyboard::keybuffer&);
|
||||
virtual void processEvent (struct timeval*);
|
||||
virtual void setRawData (FKeyboard::keybuffer&) override;
|
||||
virtual void processEvent (struct timeval*) override;
|
||||
bool gpmMouse (bool);
|
||||
bool enableGpmMouse();
|
||||
bool disableGpmMouse();
|
||||
|
@ -274,14 +274,14 @@ class FMouseX11 : public FMouse
|
|||
virtual ~FMouseX11() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData();
|
||||
virtual bool hasData() override;
|
||||
|
||||
// Methods
|
||||
virtual void setRawData (FKeyboard::keybuffer&);
|
||||
virtual void processEvent (struct timeval*);
|
||||
virtual void setRawData (FKeyboard::keybuffer&) override;
|
||||
virtual void processEvent (struct timeval*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -306,7 +306,7 @@ class FMouseX11 : public FMouse
|
|||
};
|
||||
|
||||
// Constant
|
||||
static const std::size_t MOUSE_BUF_SIZE = 4;
|
||||
static constexpr std::size_t MOUSE_BUF_SIZE = 4;
|
||||
|
||||
// Method
|
||||
void setKeyState (int);
|
||||
|
@ -337,14 +337,14 @@ class FMouseSGR : public FMouse
|
|||
virtual ~FMouseSGR() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData();
|
||||
virtual bool hasData() override;
|
||||
|
||||
// Methods
|
||||
virtual void setRawData (FKeyboard::keybuffer&);
|
||||
virtual void processEvent (struct timeval*);
|
||||
virtual void setRawData (FKeyboard::keybuffer&) override;
|
||||
virtual void processEvent (struct timeval*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -368,7 +368,7 @@ class FMouseSGR : public FMouse
|
|||
};
|
||||
|
||||
// Constant
|
||||
static const std::size_t MOUSE_BUF_SIZE = 13;
|
||||
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||
|
||||
// Methods
|
||||
void setKeyState (int);
|
||||
|
@ -400,14 +400,14 @@ class FMouseUrxvt : public FMouse
|
|||
virtual ~FMouseUrxvt() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData();
|
||||
virtual bool hasData() override;
|
||||
|
||||
// Methods
|
||||
virtual void setRawData (FKeyboard::keybuffer&);
|
||||
virtual void processEvent (struct timeval*);
|
||||
virtual void setRawData (FKeyboard::keybuffer&) override;
|
||||
virtual void processEvent (struct timeval*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
|
@ -432,7 +432,7 @@ class FMouseUrxvt : public FMouse
|
|||
};
|
||||
|
||||
// Constant
|
||||
static const std::size_t MOUSE_BUF_SIZE = 13;
|
||||
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
||||
|
||||
// Methods
|
||||
void setKeyState (int);
|
||||
|
@ -468,9 +468,9 @@ class FMouseControl
|
|||
|
||||
// Mutators
|
||||
void setStdinNo (int);
|
||||
void setMaxWidth (short);
|
||||
void setMaxHeight (short);
|
||||
void setDblclickInterval (const long);
|
||||
void setMaxWidth (uInt16);
|
||||
void setMaxHeight (uInt16);
|
||||
void setDblclickInterval (const uInt64);
|
||||
void useGpmMouse (bool = true);
|
||||
void useXtermMouse (bool = true);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "final/emptyfstring.h"
|
||||
|
@ -72,8 +73,10 @@ class FObject
|
|||
|
||||
// Constructor
|
||||
explicit FObject (FObject* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FObject (const FObject&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FObject();
|
||||
|
||||
|
@ -106,9 +109,12 @@ class FObject
|
|||
void addChild (FObject*);
|
||||
void delChild (FObject*);
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
|
||||
// Timer methods
|
||||
static void getCurrentTime (timeval*);
|
||||
static bool isTimeout (timeval*, long);
|
||||
static bool isTimeout (timeval*, uInt64);
|
||||
int addTimer (int);
|
||||
bool delTimer (int);
|
||||
bool delOwnTimer();
|
||||
|
@ -123,7 +129,7 @@ class FObject
|
|||
FObject* object;
|
||||
};
|
||||
|
||||
// Typedef
|
||||
// Typedefs
|
||||
typedef std::vector<timer_data> TimerList;
|
||||
|
||||
// Accessor
|
||||
|
@ -136,8 +142,8 @@ class FObject
|
|||
uInt processTimerEvent();
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onUserEvent (FUserEvent*);
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -78,6 +78,7 @@ class FOptiAttr
|
|||
typedef struct
|
||||
{
|
||||
wchar_t code; // character code
|
||||
wchar_t encoded_code; // encoded output character
|
||||
FColor fg_color; // foreground color
|
||||
FColor bg_color; // background color
|
||||
|
||||
|
@ -157,8 +158,10 @@ class FOptiAttr
|
|||
|
||||
// Constructor
|
||||
FOptiAttr();
|
||||
|
||||
// Disable copy constructor
|
||||
FOptiAttr (const FOptiAttr&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FOptiAttr();
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class FOptiMove
|
|||
|
||||
private:
|
||||
// Constant
|
||||
static const std::size_t BUF_SIZE{512};
|
||||
static constexpr std::size_t BUF_SIZE{512};
|
||||
|
||||
// Typedef
|
||||
typedef struct
|
||||
|
@ -180,9 +180,9 @@ class FOptiMove
|
|||
} capability;
|
||||
|
||||
// Constants
|
||||
static const int LONG_DURATION{INT_MAX};
|
||||
static constexpr int LONG_DURATION{INT_MAX};
|
||||
// value for a long capability waiting time
|
||||
static const int MOVE_LIMIT{7};
|
||||
static constexpr int MOVE_LIMIT{7};
|
||||
// maximum character distance to avoid direct cursor addressing
|
||||
|
||||
// Methods
|
||||
|
|
|
@ -77,12 +77,14 @@ class FProgressbar : public FWidget
|
|||
virtual ~FProgressbar();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
std::size_t getPercentage();
|
||||
|
||||
// Mutators
|
||||
void setPercentage (std::size_t);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true) override;
|
||||
bool setShadow (bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
|
@ -91,15 +93,15 @@ class FProgressbar : public FWidget
|
|||
bool hasShadow();
|
||||
|
||||
// Methods
|
||||
virtual void hide();
|
||||
virtual void hide() override;
|
||||
void reset();
|
||||
|
||||
private:
|
||||
// Constants
|
||||
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
static constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
||||
// Methods
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawPercentage();
|
||||
void drawBar();
|
||||
|
||||
|
|
|
@ -75,8 +75,10 @@ class FRadioButton : public FToggleButton
|
|||
// Constructors
|
||||
explicit FRadioButton (FWidget* = nullptr);
|
||||
explicit FRadioButton (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FRadioButton (const FRadioButton&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FRadioButton();
|
||||
|
||||
|
@ -84,12 +86,12 @@ class FRadioButton : public FToggleButton
|
|||
FRadioButton& operator = (const FRadioButton&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawRadioButton();
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -75,8 +75,10 @@ class FRadioMenuItem : public FMenuItem
|
|||
// Constructors
|
||||
explicit FRadioMenuItem (FWidget* = nullptr);
|
||||
explicit FRadioMenuItem (const FString&, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FRadioMenuItem (const FRadioMenuItem&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FRadioMenuItem();
|
||||
|
||||
|
@ -84,13 +86,13 @@ class FRadioMenuItem : public FMenuItem
|
|||
FRadioMenuItem& operator = (const FRadioMenuItem&) = delete;
|
||||
|
||||
// Accessor
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked();
|
||||
virtual void processClicked() override;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -86,8 +86,10 @@ class FScrollbar : public FWidget
|
|||
// Constructors
|
||||
explicit FScrollbar (FWidget* = nullptr);
|
||||
explicit FScrollbar (int = fc::vertical, FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FScrollbar (const FScrollbar&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FScrollbar();
|
||||
|
||||
|
@ -95,7 +97,7 @@ class FScrollbar : public FWidget
|
|||
FScrollbar& operator = (const FScrollbar&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
int getValue() const;
|
||||
sType getScrollType() const;
|
||||
|
||||
|
@ -107,27 +109,29 @@ class FScrollbar : public FWidget
|
|||
void setSteps (double);
|
||||
void setPageSize (int, int);
|
||||
void setOrientation (int);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true) override;
|
||||
|
||||
// Methods
|
||||
virtual void resize();
|
||||
virtual void redraw();
|
||||
virtual void resize() override;
|
||||
virtual void redraw() override;
|
||||
void calculateSliderValues();
|
||||
void drawVerticalBar();
|
||||
void drawHorizontalBar();
|
||||
void drawBar();
|
||||
|
||||
// Event handlers
|
||||
virtual void onMouseDown (FMouseEvent*);
|
||||
virtual void onMouseUp (FMouseEvent*);
|
||||
virtual void onMouseMove (FMouseEvent*);
|
||||
virtual void onWheel (FWheelEvent*);
|
||||
virtual void onTimer (FTimerEvent*);
|
||||
virtual void onMouseDown (FMouseEvent*) override;
|
||||
virtual void onMouseUp (FMouseEvent*) override;
|
||||
virtual void onMouseMove (FMouseEvent*) override;
|
||||
virtual void onWheel (FWheelEvent*) override;
|
||||
virtual void onTimer (FTimerEvent*) override;
|
||||
|
||||
private:
|
||||
// Methods
|
||||
void init();
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void drawButtons();
|
||||
sType getClickedScrollType (int, int);
|
||||
sType getVerticalClickedScrollType (int);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -53,6 +53,8 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "final/fscrollbar.h"
|
||||
#include "final/fwidget.h"
|
||||
|
||||
|
@ -76,8 +78,10 @@ class FScrollView : public FWidget
|
|||
|
||||
// Constructor
|
||||
explicit FScrollView (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FScrollView (const FScrollView&) = delete;
|
||||
|
||||
// Destructor
|
||||
virtual ~FScrollView();
|
||||
|
||||
|
@ -85,7 +89,7 @@ class FScrollView : public FWidget
|
|||
FScrollView& operator = (const FScrollView&) = delete;
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
std::size_t getViewportWidth() const;
|
||||
std::size_t getViewportHeight() const;
|
||||
std::size_t getScrollWidth() const;
|
||||
|
@ -98,15 +102,15 @@ class FScrollView : public FWidget
|
|||
virtual void setScrollWidth (std::size_t);
|
||||
virtual void setScrollHeight (std::size_t);
|
||||
virtual void setScrollSize (std::size_t, std::size_t);
|
||||
virtual void setX (int, bool = true);
|
||||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
virtual void setHeight (std::size_t, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
virtual void setX (int, bool = true) override;
|
||||
virtual void setY (int, bool = true) override;
|
||||
virtual void setPos (int, int, bool = true) override;
|
||||
virtual void setWidth (std::size_t, bool = true) override;
|
||||
virtual void setHeight (std::size_t, bool = true) override;
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true) override;
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true );
|
||||
, bool = true ) override;
|
||||
void setCursorPos (int, int);
|
||||
void setPrintPos (int, int);
|
||||
bool setViewportPrint (bool);
|
||||
|
@ -123,36 +127,39 @@ class FScrollView : public FWidget
|
|||
bool isViewportPrint();
|
||||
|
||||
// Method
|
||||
virtual void clearArea (int = ' ');
|
||||
virtual void clearArea (int = ' ') override;
|
||||
void scrollToX (int);
|
||||
void scrollToY (int);
|
||||
void scrollTo (const FPoint&);
|
||||
void scrollTo (int, int);
|
||||
void scrollBy (int, int);
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onWheel (FWheelEvent*);
|
||||
virtual void onFocusIn (FFocusEvent*);
|
||||
virtual void onChildFocusIn (FFocusEvent*);
|
||||
virtual void onChildFocusOut (FFocusEvent*);
|
||||
virtual void onKeyPress (FKeyEvent*) override;
|
||||
virtual void onWheel (FWheelEvent*) override;
|
||||
virtual void onFocusIn (FFocusEvent*) override;
|
||||
virtual void onChildFocusIn (FFocusEvent*) override;
|
||||
virtual void onChildFocusOut (FFocusEvent*) override;
|
||||
|
||||
protected:
|
||||
// Using-declaration
|
||||
using FVTerm::clearArea;
|
||||
|
||||
// Accessor
|
||||
term_area* getPrintArea();
|
||||
virtual term_area* getPrintArea() override;
|
||||
|
||||
// Method
|
||||
virtual void adjustSize();
|
||||
virtual void adjustSize() override;
|
||||
void copy2area();
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Constants
|
||||
static const int vertical_border_spacing = 2;
|
||||
static const int horizontal_border_spacing = 2;
|
||||
static constexpr int vertical_border_spacing = 2;
|
||||
static constexpr int horizontal_border_spacing = 2;
|
||||
|
||||
// Accessors
|
||||
FPoint getViewportCursorPos();
|
||||
|
@ -170,15 +177,15 @@ class FScrollView : public FWidget
|
|||
void drawVBar();
|
||||
|
||||
// Callback methods
|
||||
void cb_VBarChange (FWidget*, data_ptr);
|
||||
void cb_HBarChange (FWidget*, data_ptr);
|
||||
void cb_VBarChange (FWidget*, FDataPtr);
|
||||
void cb_HBarChange (FWidget*, FDataPtr);
|
||||
|
||||
// Data Members
|
||||
FRect scroll_geometry{1, 1, 1, 1};
|
||||
FRect viewport_geometry{};
|
||||
term_area* viewport{nullptr}; // virtual scroll content
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
uInt8 nf_offset{0};
|
||||
bool border{true};
|
||||
bool use_own_print_area{false};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue