commit
da2bea4268
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2018-10-03 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* At the end of the lifetime of an FMenuItem object,
|
||||||
|
delete its entry from the object list of the parent object
|
||||||
|
* Reduce the use of the new operators in the examples
|
||||||
|
* Adding a unit test for the FTermData class
|
||||||
|
|
||||||
|
2018-10-01 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Extract FTerm data members into the data class FTermData
|
||||||
|
|
||||||
|
2018-09-28 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* FListView now has the ability to sort by columns
|
||||||
|
|
||||||
|
2018-09-27 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Move time event processing from FApplication to FObject
|
||||||
|
|
||||||
|
2018-09-26 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* The FListViewItem class now has a getData() and a setData() method
|
||||||
|
similar to the FListBoxItem class.
|
||||||
|
|
||||||
|
2018-09-24 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Stricter use of the keyword virtual
|
||||||
|
* Add a first steps document
|
||||||
|
|
||||||
2018-09-20 Markus Gans <guru.mail@muenster.de>
|
2018-09-20 Markus Gans <guru.mail@muenster.de>
|
||||||
* Added pkg-config file finalcut.pc
|
* Added pkg-config file finalcut.pc
|
||||||
* The entire library source code is now encapsulated under
|
* The entire library source code is now encapsulated under
|
||||||
|
|
46
README.md
46
README.md
|
@ -1,4 +1,5 @@
|
||||||
![The Final Cut](logo/png/finalcut-logo.png)
|
![FINAL CUT](logo/svg/finalcut-logo.svg)
|
||||||
|
============================================
|
||||||
|
|
||||||
### Building and code analysis
|
### Building and code analysis
|
||||||
*Travis CI:*<br />
|
*Travis CI:*<br />
|
||||||
|
@ -10,6 +11,9 @@
|
||||||
*Class Reference:*<br />
|
*Class Reference:*<br />
|
||||||
     [![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html)
|
     [![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html)
|
||||||
|
|
||||||
|
The Final Cut is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
|
||||||
|
The C++ class design was inspired by the Qt framework. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
```bash
|
```bash
|
||||||
> git clone git://github.com/gansm/finalcut.git
|
> git clone git://github.com/gansm/finalcut.git
|
||||||
|
@ -29,29 +33,47 @@
|
||||||
* Cygwin
|
* Cygwin
|
||||||
* Solaris
|
* Solaris
|
||||||
|
|
||||||
The Final Cut
|
### First steps
|
||||||
=============
|
|
||||||
The Final Cut is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
|
|
||||||
The C++ class design was inspired by the Qt framework. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.
|
|
||||||
|
|
||||||
![](doc/fileopen-dialog.png)
|
[How to use the library](doc/first-steps.md)
|
||||||
|
|
||||||
![](doc/progress-bar.png)
|
### Screenshots
|
||||||
|
|
||||||
![](doc/textview.png)
|
The FFileDialog widget:
|
||||||
|
|
||||||
![](doc/Mandelbrot.png)
|
![FFileDialog](doc/fileopen-dialog.png)
|
||||||
|
|
||||||
|
|
||||||
|
The Final Cut FProgressbar widget:
|
||||||
|
|
||||||
|
![FProgressbar](doc/progress-bar.png)
|
||||||
|
|
||||||
|
|
||||||
|
Scrollable text in the FTextView widget:
|
||||||
|
|
||||||
|
![FTextView](doc/textview.png)
|
||||||
|
|
||||||
|
|
||||||
|
The Mandelbrot set example:
|
||||||
|
|
||||||
|
![Mandelbrot set](doc/Mandelbrot.png)
|
||||||
|
|
||||||
|
|
||||||
newfont
|
newfont
|
||||||
-------
|
-------
|
||||||
A [graphical text font](fonts/) for X11 and the Linux console.
|
A [graphical text font](fonts/) for X11 and the Linux console.
|
||||||
|
|
||||||
![](doc/newfont1.png)
|
![ui example in newfont mode](doc/newfont1.png)
|
||||||
|
|
||||||
![](doc/newfont2.png)
|
|
||||||
|
|
||||||
![](doc/calculator.png)
|
Newfont drive symbols:
|
||||||
|
|
||||||
|
![drive symbols](doc/newfont2.png)
|
||||||
|
|
||||||
|
|
||||||
|
The calculator example in newfont mode:
|
||||||
|
|
||||||
|
![calculator](doc/calculator.png)
|
||||||
|
|
||||||
|
|
||||||
Virtual terminal
|
Virtual terminal
|
||||||
|
|
|
@ -3,7 +3,13 @@
|
||||||
if test "$1" = "update"
|
if test "$1" = "update"
|
||||||
then
|
then
|
||||||
# Update generated configuration files
|
# Update generated configuration files
|
||||||
|
if which autoreconf >/dev/null
|
||||||
|
then
|
||||||
autoreconf --force --install --verbose --warnings=all
|
autoreconf --force --install --verbose --warnings=all
|
||||||
|
else
|
||||||
|
echo "Update failed, please install autoconf first"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Set up an m4 environment
|
# Set up an m4 environment
|
||||||
aclocal
|
aclocal
|
||||||
|
|
11
build.sh
11
build.sh
|
@ -28,7 +28,16 @@ test "$CPU_COUNT" -eq 0 && CPU_COUNT=1
|
||||||
|
|
||||||
if [ -n "$1" ]
|
if [ -n "$1" ]
|
||||||
then
|
then
|
||||||
test ! -f ./configure && autoreconf --install --force
|
if [ ! -f ./configure ]
|
||||||
|
then
|
||||||
|
if which autoreconf >/dev/null
|
||||||
|
then
|
||||||
|
autoreconf --install --force
|
||||||
|
else
|
||||||
|
echo "Build failed, please install autoconf first"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build commands
|
# Build commands
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
|
||||||
|
First steps with the Final Cut widget toolkit
|
||||||
|
=============================================
|
||||||
|
|
||||||
|
|
||||||
|
How to use the library
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
At the beginning of this introduction to the Final Cut
|
||||||
|
we will start with a small example.
|
||||||
|
|
||||||
|
It creates an empty 30×10 character dialog.
|
||||||
|
|
||||||
|
**File:** *dialog.cpp*
|
||||||
|
```cpp
|
||||||
|
#include <final/final.h>
|
||||||
|
|
||||||
|
int main (int argc, char* argv[])
|
||||||
|
{
|
||||||
|
finalcut::FApplication app(argc, argv);
|
||||||
|
finalcut::FDialog dialog(&app);
|
||||||
|
dialog.setText ("A dialog");
|
||||||
|
dialog.setGeometry (25, 5, 30, 10);
|
||||||
|
app.setMainWidget(&dialog);
|
||||||
|
dialog.show();
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
*(Note: Use mouse or <kbd>Shift</kbd>+<kbd>F10</kbd> or
|
||||||
|
<kbd>Ctrl</kbd>+<kbd>^</kbd> to close the dialog)*
|
||||||
|
|
||||||
|
|
||||||
|
After entering the source code in *dialog.cpp* you can compile
|
||||||
|
the above program with gcc:
|
||||||
|
```cpp
|
||||||
|
g++ -O2 -lfinal dialog.cpp -o dialog
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
How it works
|
||||||
|
------------
|
||||||
|
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <final/final.h>
|
||||||
|
```
|
||||||
|
All final cut programs must include the *final.h* header.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
finalcut::FApplication app(argc, argv);
|
||||||
|
```
|
||||||
|
In this line creates the `finalcut::FApplication` object `app` with
|
||||||
|
the command line arguments `argc` and `argv`. This object manages
|
||||||
|
the application main event loop. It receives keyboard and mouse events
|
||||||
|
and sends them to the target widgets. Before widgets can be created,
|
||||||
|
an application object must be created! Only one `finalcut::FApplication`
|
||||||
|
object should be created.
|
||||||
|
|
||||||
|
The next line
|
||||||
|
```cpp
|
||||||
|
finalcut::FDialog dialog(&app);
|
||||||
|
```
|
||||||
|
creates the `finalcut::FDialog` object `dialog` with the object `app`
|
||||||
|
as parent object. The `finalcut::FDialog` class is the base class for
|
||||||
|
creating dialog windows.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
dialog.setText ("A dialog");
|
||||||
|
```
|
||||||
|
The title bar of the dialog box gets the text "A dialog".
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
dialog.setGeometry (25, 5, 30, 10);
|
||||||
|
```
|
||||||
|
The dialog window geometry is set to a width of 30 characters and
|
||||||
|
a height of 10 characters. The window in the terminal is positioned
|
||||||
|
at the positions x=25 and y=5 (note: x=1 and y=1 represents the upper
|
||||||
|
left corner).
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
app.setMainWidget(&dialog);
|
||||||
|
```
|
||||||
|
The `dialog` object is selected as the main widget for the application.
|
||||||
|
When the user closes a main widget, the application will be closed.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
dialog.show();
|
||||||
|
```
|
||||||
|
A window or widget is not visible directly after its creation.
|
||||||
|
Only the call of `show()` makes it (and its child objects,
|
||||||
|
if available) visible.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
return app.exec();
|
||||||
|
```
|
||||||
|
The last line calls `exec()` to start the application and return
|
||||||
|
the result to the operating system. When the application starts,
|
||||||
|
it enters the main event loop. This loop doesn't end until the
|
||||||
|
window/application is closed.
|
||||||
|
|
|
@ -16,7 +16,7 @@ INCLUDES = -I../src/include -I/usr/include/final
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
OPTIMIZE = -O0 -fsanitize=undefined
|
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||||
else
|
else
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Button : public finalcut::FButton
|
||||||
void setChecked(bool);
|
void setChecked(bool);
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onKeyPress (finalcut::FKeyEvent*);
|
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data Member
|
// Data Member
|
||||||
|
@ -118,9 +118,9 @@ class Calc : public finalcut::FDialog
|
||||||
~Calc();
|
~Calc();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (finalcut::FKeyEvent*);
|
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_buttonClicked (finalcut::FWidget*, data_ptr);
|
void cb_buttonClicked (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -212,7 +212,7 @@ class Calc : public finalcut::FDialog
|
||||||
void setInfixOperator (char);
|
void setInfixOperator (char);
|
||||||
void clearInfixOperator();
|
void clearInfixOperator();
|
||||||
void calcInfixOperator();
|
void calcInfixOperator();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
const wchar_t* getButtonText (int);
|
const wchar_t* getButtonText (int);
|
||||||
void mapKeyFunctions();
|
void mapKeyFunctions();
|
||||||
|
|
||||||
|
|
|
@ -96,26 +96,26 @@ int main (int argc, char* argv[])
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app(argc, argv);
|
||||||
|
|
||||||
// Create a simple modal dialog box
|
{ // Create a simple modal dialog box in this scope
|
||||||
finalcut::FDialog* dgl = new finalcut::FDialog(&app);
|
finalcut::FDialog dgl(&app);
|
||||||
dgl->setModal();
|
dgl.setModal();
|
||||||
dgl->setText ("UNIX select");
|
dgl.setText ("UNIX select");
|
||||||
w = 20;
|
w = 20;
|
||||||
h = 13;
|
h = 13;
|
||||||
x = (app.getDesktopWidth() - w) / 2;
|
x = (app.getDesktopWidth() - w) / 2;
|
||||||
y = (app.getDesktopHeight() - h) / 2;
|
y = (app.getDesktopHeight() - h) / 2;
|
||||||
dgl->setGeometry (x, y, w, h);
|
dgl.setGeometry (x, y, w, h);
|
||||||
|
|
||||||
// Create a button group
|
// Create a button group
|
||||||
finalcut::FButtonGroup* checkButtonGroup = new finalcut::FButtonGroup("choice", dgl);
|
finalcut::FButtonGroup checkButtonGroup("choice", &dgl);
|
||||||
checkButtonGroup->setGeometry (2, 1, 16, 7);
|
checkButtonGroup.setGeometry (2, 1, 16, 7);
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
std::vector<finalcut::FRadioButton*> os (9);
|
std::vector<finalcut::FRadioButton*> os (9);
|
||||||
populateChoice (os, checkButtonGroup);
|
populateChoice (os, &checkButtonGroup);
|
||||||
|
|
||||||
// Set the radio button geometry
|
// Set the radio button geometry
|
||||||
// => checkButtonGroup->setScrollSize(...) is not required
|
// => checkButtonGroup.setScrollSize(...) is not required
|
||||||
// because a FButtonGroup is self-adjusting
|
// because a FButtonGroup is self-adjusting
|
||||||
for (uInt i = 0; i < os.size(); i++)
|
for (uInt i = 0; i < os.size(); i++)
|
||||||
os[i]->setGeometry(1, int(1 + i), 12, 1);
|
os[i]->setGeometry(1, int(1 + i), 12, 1);
|
||||||
|
@ -124,40 +124,38 @@ int main (int argc, char* argv[])
|
||||||
|
|
||||||
// Scroll to the focused child element
|
// Scroll to the focused child element
|
||||||
finalcut::FFocusEvent cfi (finalcut::fc::ChildFocusIn_Event);
|
finalcut::FFocusEvent cfi (finalcut::fc::ChildFocusIn_Event);
|
||||||
finalcut::FApplication::sendEvent(checkButtonGroup, &cfi);
|
finalcut::FApplication::sendEvent(&checkButtonGroup, &cfi);
|
||||||
|
|
||||||
// Create a OK button
|
// Create a OK button
|
||||||
finalcut::FButton* ok = new finalcut::FButton("&OK", dgl);
|
finalcut::FButton ok("&OK", &dgl);
|
||||||
ok->setGeometry (10, 9, 8, 1);
|
ok.setGeometry (10, 9, 8, 1);
|
||||||
|
|
||||||
// Connect the button signal "clicked" with the callback function
|
// Connect the button signal "clicked" with the callback function
|
||||||
ok->addCallback
|
ok.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_FUNCTION_CALLBACK (&cb_quit),
|
F_FUNCTION_CALLBACK (&cb_quit),
|
||||||
dgl
|
&dgl
|
||||||
);
|
);
|
||||||
|
|
||||||
// Show the dialog
|
// Show the dialog
|
||||||
dgl->show();
|
dgl.show();
|
||||||
|
|
||||||
// Get the checked radio button text
|
// Get the checked radio button text
|
||||||
for (int n = 1; n <= int(checkButtonGroup->getCount()); n++)
|
for (int n = 1; n <= int(checkButtonGroup.getCount()); n++)
|
||||||
{
|
{
|
||||||
if ( checkButtonGroup->isChecked(n) )
|
if ( checkButtonGroup.isChecked(n) )
|
||||||
{
|
{
|
||||||
label_text = checkButtonGroup->getButton(n)->getText();
|
label_text = checkButtonGroup.getButton(n)->getText();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // Hide and destroy the dialog object
|
||||||
|
|
||||||
// Hide and destroy the dialog object
|
|
||||||
delete dgl;
|
|
||||||
|
|
||||||
// Create and show tooltip for two seconds
|
// Create and show tooltip for two seconds
|
||||||
finalcut::FToolTip* tooltip = new finalcut::FToolTip(&app);
|
finalcut::FToolTip tooltip(&app);
|
||||||
tooltip->setText ("You have chosen " + label_text);
|
tooltip.setText ("You have chosen " + label_text);
|
||||||
tooltip->show();
|
tooltip.show();
|
||||||
sleep(2);
|
sleep(2);
|
||||||
delete tooltip;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,64 +66,58 @@ int main (int argc, char* argv[])
|
||||||
dgl.setShadow();
|
dgl.setShadow();
|
||||||
|
|
||||||
// Create input fields
|
// Create input fields
|
||||||
finalcut::FLineEdit* name_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit name_field (&dgl);
|
||||||
finalcut::FLineEdit* email_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit email_field (&dgl);
|
||||||
finalcut::FLineEdit* org_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit org_field (&dgl);
|
||||||
finalcut::FLineEdit* city_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit city_field (&dgl);
|
||||||
finalcut::FLineEdit* st_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit st_field (&dgl);
|
||||||
finalcut::FLineEdit* c_field = new finalcut::FLineEdit(&dgl);
|
finalcut::FLineEdit c_field (&dgl);
|
||||||
|
|
||||||
name_field->setLabelText(L"&Name");
|
name_field.setLabelText (L"&Name");
|
||||||
email_field->setLabelText(L"&Email");
|
email_field.setLabelText (L"&Email");
|
||||||
org_field->setLabelText(L"Or&ganization");
|
org_field.setLabelText (L"Or&ganization");
|
||||||
city_field->setLabelText(L"&City");
|
city_field.setLabelText (L"&City");
|
||||||
st_field->setLabelText(L"&State");
|
st_field.setLabelText (L"&State");
|
||||||
c_field->setLabelText(L"&Country");
|
c_field.setLabelText (L"&Country");
|
||||||
|
|
||||||
name_field->setGeometry(15, 1, 19, 1);
|
name_field.setGeometry (15, 1, 19, 1);
|
||||||
email_field->setGeometry(15, 3, 19, 1);
|
email_field.setGeometry (15, 3, 19, 1);
|
||||||
org_field->setGeometry(15, 5, 19, 1);
|
org_field.setGeometry (15, 5, 19, 1);
|
||||||
city_field->setGeometry(15, 7, 19, 1);
|
city_field.setGeometry (15, 7, 19, 1);
|
||||||
st_field->setGeometry(15, 9, 19, 1);
|
st_field.setGeometry (15, 9, 19, 1);
|
||||||
c_field->setGeometry(15, 11, 4, 1);
|
c_field.setGeometry (15, 11, 4, 1);
|
||||||
|
|
||||||
// Create the button group
|
// Create the button group
|
||||||
finalcut::FButtonGroup* radioButtonGroup = \
|
finalcut::FButtonGroup radioButtonGroup ("Sex", &dgl);
|
||||||
new finalcut::FButtonGroup("Sex", &dgl);
|
radioButtonGroup.setGeometry(2, 13, 13, 4);
|
||||||
radioButtonGroup->setGeometry(2, 13, 13, 4);
|
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
finalcut::FRadioButton* male = \
|
finalcut::FRadioButton male ("&Male", &radioButtonGroup);
|
||||||
new finalcut::FRadioButton("&Male", radioButtonGroup);
|
finalcut::FRadioButton female ("&Female", &radioButtonGroup);
|
||||||
finalcut::FRadioButton* female = \
|
male.setGeometry (1, 1, 8, 1);
|
||||||
new finalcut::FRadioButton("&Female", radioButtonGroup);
|
female.setGeometry (1, 2, 10, 1);
|
||||||
male->setGeometry(1, 1, 8, 1);
|
|
||||||
female->setGeometry(1, 2, 10, 1);
|
|
||||||
|
|
||||||
// Create another button group
|
// Create another button group
|
||||||
finalcut::FButtonGroup* checkButtonGroup = \
|
finalcut::FButtonGroup checkButtonGroup ("&Data options", &dgl);
|
||||||
new finalcut::FButtonGroup("&Data options", &dgl);
|
checkButtonGroup.setGeometry(16, 13, 19, 4);
|
||||||
checkButtonGroup->setGeometry(16, 13, 19, 4);
|
|
||||||
|
|
||||||
// Create checkbox buttons
|
// Create checkbox buttons
|
||||||
finalcut::FCheckBox* check1 = \
|
finalcut::FCheckBox check1 ("Save data", &checkButtonGroup);
|
||||||
new finalcut::FCheckBox("Save data", checkButtonGroup);
|
finalcut::FCheckBox check2 ("Encrypt data", &checkButtonGroup);
|
||||||
finalcut::FCheckBox* check2 = \
|
check1.setGeometry (1, 1, 13, 1);
|
||||||
new finalcut::FCheckBox("Encrypt data", checkButtonGroup);
|
check2.setGeometry (1, 2, 16, 1);
|
||||||
check1->setGeometry(1, 1, 13, 1);
|
check2.setDisable();
|
||||||
check2->setGeometry(1, 2, 16, 1);
|
|
||||||
check2->setDisable();
|
|
||||||
|
|
||||||
// Create a OK button
|
// Create a OK button
|
||||||
finalcut::FButton btn("&OK", &dgl);
|
finalcut::FButton btn("&OK", &dgl);
|
||||||
btn.setGeometry (24, 18, 10, 1);
|
btn.setGeometry (24, 18, 10, 1);
|
||||||
|
|
||||||
// Connect checkbox signal "clicked" with a callback function
|
// Connect checkbox signal "clicked" with a callback function
|
||||||
check1->addCallback
|
check1.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_FUNCTION_CALLBACK (&cb_publish),
|
F_FUNCTION_CALLBACK (&cb_publish),
|
||||||
check2
|
&check2
|
||||||
);
|
);
|
||||||
|
|
||||||
// Connect the button signal "clicked" with the callback function
|
// Connect the button signal "clicked" with the callback function
|
||||||
|
|
|
@ -34,10 +34,12 @@ class Keyboard : public finalcut::FWidget
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (finalcut::FKeyEvent*);
|
virtual void onKeyPress (finalcut::FKeyEvent*);
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
|
|
||||||
void draw();
|
private:
|
||||||
|
// Methods
|
||||||
|
virtual void draw();
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -88,10 +88,14 @@ class Listbox : public finalcut::FDialog
|
||||||
Listbox& operator = (const Listbox&);
|
Listbox& operator = (const Listbox&);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Data Member
|
// Data Member
|
||||||
std::list<double>* double_list;
|
std::list<double> double_list;
|
||||||
|
finalcut::FListBox list1;
|
||||||
|
finalcut::FListBox list2;
|
||||||
|
finalcut::FListBox list3;
|
||||||
|
finalcut::FButton Quit;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -99,38 +103,41 @@ class Listbox : public finalcut::FDialog
|
||||||
Listbox::Listbox (finalcut::FWidget* parent)
|
Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, double_list()
|
, double_list()
|
||||||
|
, list1(this)
|
||||||
|
, list2(this)
|
||||||
|
, list3(this)
|
||||||
|
, Quit(this)
|
||||||
{
|
{
|
||||||
temp_str = new finalcut::FString;
|
temp_str = new finalcut::FString;
|
||||||
|
|
||||||
// listbox 1
|
// listbox 1
|
||||||
finalcut::FListBox* list1 = new finalcut::FListBox (this);
|
//----------
|
||||||
list1->setGeometry(2, 1, 18, 10);
|
list1.setGeometry(2, 1, 18, 10);
|
||||||
list1->setText ("FListBoxItem");
|
list1.setText ("FListBoxItem");
|
||||||
|
|
||||||
for (int i = 1; i < 30; i++)
|
for (int i = 1; i < 30; i++)
|
||||||
list1->insert (L"----- " + (finalcut::FString() << i) + L" -----");
|
list1.insert (L"----- " + (finalcut::FString() << i) + L" -----");
|
||||||
|
|
||||||
// listbox 2
|
// listbox 2
|
||||||
double_list = new std::list<double>;
|
//----------
|
||||||
|
|
||||||
for (double i = 1; i<=15; i++)
|
for (double i = 1; i<=15; i++)
|
||||||
double_list->push_back(2 * i + (i / 100));
|
double_list.push_back(2 * i + (i / 100));
|
||||||
|
|
||||||
finalcut::FListBox* list2 = new finalcut::FListBox (this);
|
list2.setGeometry(21, 1, 10, 10);
|
||||||
list2->setGeometry(21, 1, 10, 10);
|
list2.setText ("double");
|
||||||
list2->setText ("double");
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Import via lazy conversion on print
|
// Import via lazy conversion on print
|
||||||
//
|
//
|
||||||
list2->insert (double_list, doubleToItem);
|
list2.insert (&double_list, doubleToItem);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Direct import of the complete list
|
// Direct import of the complete list
|
||||||
//
|
//
|
||||||
//list2->insert (double_list->begin(), double_list->end(), doubleToString);
|
//list2.insert (double_list.begin(), double_list.end(), doubleToString);
|
||||||
|
|
||||||
// listbox 3
|
// listbox 3
|
||||||
|
//----------
|
||||||
std::map<finalcut::FString, finalcut::FString> TLD;
|
std::map<finalcut::FString, finalcut::FString> TLD;
|
||||||
TLD["com"] = "Commercial";
|
TLD["com"] = "Commercial";
|
||||||
TLD["org"] = "Organization";
|
TLD["org"] = "Organization";
|
||||||
|
@ -138,18 +145,16 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
TLD["edu"] = "Education";
|
TLD["edu"] = "Education";
|
||||||
TLD["gov"] = "Government";
|
TLD["gov"] = "Government";
|
||||||
|
|
||||||
finalcut::FListBox* list3;
|
list3.insert (TLD.begin(), TLD.end(), mapToString);
|
||||||
list3 = new finalcut::FListBox (TLD.begin(), TLD.end(), mapToString, this);
|
list3.setGeometry(32, 1, 21, 10);
|
||||||
list3->setGeometry(32, 1, 21, 10);
|
list3.setText ("key: value");
|
||||||
list3->setText ("key: value");
|
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
finalcut::FButton* Quit = new finalcut::FButton (this);
|
Quit.setGeometry(42, 12, 10, 1);
|
||||||
Quit->setGeometry(42, 12, 10, 1);
|
Quit.setText (L"&Quit");
|
||||||
Quit->setText (L"&Quit");
|
|
||||||
|
|
||||||
// Add quit button function callback
|
// Add quit button function callback
|
||||||
Quit->addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
|
@ -160,7 +165,6 @@ Listbox::Listbox (finalcut::FWidget* parent)
|
||||||
Listbox::~Listbox() // destructor
|
Listbox::~Listbox() // destructor
|
||||||
{
|
{
|
||||||
delete temp_str;
|
delete temp_str;
|
||||||
delete double_list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -50,52 +50,68 @@ class Listview : public finalcut::FDialog
|
||||||
Listview& operator = (const Listview&);
|
Listview& operator = (const Listview&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void populate (finalcut::FListView*);
|
void populate();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_showInMessagebox (finalcut::FWidget*, data_ptr);
|
void cb_showInMessagebox (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
finalcut::FListView listView;
|
||||||
|
finalcut::FButton Quit;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Listview::Listview (finalcut::FWidget* parent)
|
Listview::Listview (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
|
, listView(this)
|
||||||
|
, Quit(this)
|
||||||
{
|
{
|
||||||
// Create FListView object
|
// Create FListView object
|
||||||
finalcut::FListView* listView = new finalcut::FListView (this);
|
listView.setGeometry(2, 1, 33, 14);
|
||||||
listView->setGeometry(2, 1, 33, 14);
|
|
||||||
|
|
||||||
// Add columns to the view
|
// Add columns to the view
|
||||||
listView->addColumn ("City");
|
listView.addColumn ("City");
|
||||||
listView->addColumn ("Condition");
|
listView.addColumn ("Condition");
|
||||||
listView->addColumn ("Temp.");
|
listView.addColumn ("Temp.");
|
||||||
listView->addColumn ("Humidity");
|
listView.addColumn ("Humidity");
|
||||||
listView->addColumn ("Pressure", 10);
|
listView.addColumn ("Pressure", 10);
|
||||||
|
|
||||||
// Set right alignment for the third, fourth, and fifth column
|
// Set right alignment for the third, fourth, and fifth column
|
||||||
listView->setColumnAlignment (3, finalcut::fc::alignRight);
|
listView.setColumnAlignment (3, finalcut::fc::alignRight);
|
||||||
listView->setColumnAlignment (4, finalcut::fc::alignRight);
|
listView.setColumnAlignment (4, finalcut::fc::alignRight);
|
||||||
listView->setColumnAlignment (5, finalcut::fc::alignRight);
|
listView.setColumnAlignment (5, finalcut::fc::alignRight);
|
||||||
|
|
||||||
|
// Set the type of sorting
|
||||||
|
listView.setColumnSortType (1, finalcut::fc::by_name);
|
||||||
|
listView.setColumnSortType (2, finalcut::fc::by_name);
|
||||||
|
listView.setColumnSortType (3, finalcut::fc::by_number);
|
||||||
|
listView.setColumnSortType (4, finalcut::fc::by_number);
|
||||||
|
listView.setColumnSortType (5, finalcut::fc::by_number);
|
||||||
|
|
||||||
|
// Sort in ascending order by the 1st column
|
||||||
|
listView.setColumnSort (1, finalcut::fc::ascending);
|
||||||
|
// The sorting occurs later automatically at insert().
|
||||||
|
// Otherwise you could start the sorting directly with sort()
|
||||||
|
|
||||||
// Populate FListView with a list of items
|
// Populate FListView with a list of items
|
||||||
populate (listView);
|
populate();
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
finalcut::FButton* Quit = new finalcut::FButton (this);
|
Quit.setGeometry(24, 16, 10, 1);
|
||||||
Quit->setGeometry(24, 16, 10, 1);
|
Quit.setText (L"&Quit");
|
||||||
Quit->setText (L"&Quit");
|
|
||||||
|
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
Quit->addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
);
|
);
|
||||||
|
|
||||||
listView->addCallback
|
listView.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Listview::cb_showInMessagebox)
|
F_METHOD_CALLBACK (this, &Listview::cb_showInMessagebox)
|
||||||
|
@ -107,7 +123,7 @@ Listview::~Listview() // destructor
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listview::populate (finalcut::FListView* listView)
|
void Listview::populate()
|
||||||
{
|
{
|
||||||
std::string weather[][5] =
|
std::string weather[][5] =
|
||||||
{
|
{
|
||||||
|
@ -159,7 +175,7 @@ void Listview::populate (finalcut::FListView* listView)
|
||||||
for (int i = 0; i <= lastItem; i++)
|
for (int i = 0; i <= lastItem; i++)
|
||||||
{
|
{
|
||||||
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
|
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
|
||||||
listView->insert (line);
|
listView.insert (line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,10 +186,9 @@ void Listview::onClose (finalcut::FCloseEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listview::cb_showInMessagebox (finalcut::FWidget* widget, data_ptr)
|
void Listview::cb_showInMessagebox (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
finalcut::FListView* listView = static_cast<finalcut::FListView*>(widget);
|
finalcut::FListViewItem* item = listView.getCurrentItem();
|
||||||
finalcut::FListViewItem* item = listView->getCurrentItem();
|
|
||||||
finalcut::FMessageBox info ( "Weather in " + item->getText(1)
|
finalcut::FMessageBox info ( "Weather in " + item->getText(1)
|
||||||
, " Condition: " + item->getText(2) + "\n"
|
, " Condition: " + item->getText(2) + "\n"
|
||||||
"Temperature: " + item->getText(3) + "\n"
|
"Temperature: " + item->getText(3) + "\n"
|
||||||
|
|
|
@ -40,13 +40,13 @@ class Mandelbrot : public finalcut::FDialog
|
||||||
~Mandelbrot();
|
~Mandelbrot();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Methods
|
// Methods
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -47,81 +47,161 @@ class Menu : public finalcut::FDialog
|
||||||
Menu& operator = (const Menu&);
|
Menu& operator = (const Menu&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void createFileMenuItems (finalcut::FMenu*);
|
void configureFileMenuItems();
|
||||||
void createEditMenuItems (finalcut::FMenu*);
|
void configureEditMenuItems();
|
||||||
void createChoiceMenuItems (finalcut::FMenu*);
|
void configureChoiceMenuItems();
|
||||||
void createColorMenuItems (finalcut::FMenu*);
|
void configureColorMenuItems();
|
||||||
void createStyleMenuItems (finalcut::FMenu*);
|
void configureStyleMenuItems();
|
||||||
void createBorderMenuItems (finalcut::FMenu*);
|
void configureBorderMenuItems();
|
||||||
void createBorderColorMenuItems (finalcut::FMenu*);
|
|
||||||
void createBorderStyleMenuItems (finalcut::FMenu*);
|
|
||||||
void defaultCallback (finalcut::FMenuList*);
|
void defaultCallback (finalcut::FMenuList*);
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_message (finalcut::FWidget*, data_ptr);
|
void cb_message (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
finalcut::FString line;
|
||||||
|
finalcut::FMenuBar Menubar;
|
||||||
|
finalcut::FMenu File;
|
||||||
|
finalcut::FMenu Edit;
|
||||||
|
finalcut::FMenu Choice;
|
||||||
|
finalcut::FMenuItem Window;
|
||||||
|
finalcut::FMenuItem Help;
|
||||||
|
finalcut::FMenuItem New;
|
||||||
|
finalcut::FMenuItem Open;
|
||||||
|
finalcut::FMenuItem Save;
|
||||||
|
finalcut::FMenuItem SaveAs;
|
||||||
|
finalcut::FMenuItem Close;
|
||||||
|
finalcut::FMenuItem Line1;
|
||||||
|
finalcut::FMenuItem Print;
|
||||||
|
finalcut::FMenuItem Line2;
|
||||||
|
finalcut::FMenuItem Quit;
|
||||||
|
finalcut::FMenuItem Undo;
|
||||||
|
finalcut::FMenuItem Redo;
|
||||||
|
finalcut::FMenuItem Line3;
|
||||||
|
finalcut::FMenuItem Cut;
|
||||||
|
finalcut::FMenuItem Copy;
|
||||||
|
finalcut::FMenuItem Paste;
|
||||||
|
finalcut::FMenuItem Line4;
|
||||||
|
finalcut::FMenuItem Search;
|
||||||
|
finalcut::FMenuItem Next;
|
||||||
|
finalcut::FMenuItem Line5;
|
||||||
|
finalcut::FMenuItem SelectAll;
|
||||||
|
finalcut::FMenu Color;
|
||||||
|
finalcut::FMenu Style;
|
||||||
|
finalcut::FMenu Border;
|
||||||
|
finalcut::FRadioMenuItem Color1;
|
||||||
|
finalcut::FRadioMenuItem Color2;
|
||||||
|
finalcut::FRadioMenuItem Color3;
|
||||||
|
finalcut::FRadioMenuItem Color4;
|
||||||
|
finalcut::FRadioMenuItem Color5;
|
||||||
|
finalcut::FCheckMenuItem Bold;
|
||||||
|
finalcut::FCheckMenuItem Italic;
|
||||||
|
finalcut::FMenu BColor;
|
||||||
|
finalcut::FMenu BStyle;
|
||||||
|
finalcut::FRadioMenuItem BColor1;
|
||||||
|
finalcut::FRadioMenuItem BColor2;
|
||||||
|
finalcut::FRadioMenuItem BStyle1;
|
||||||
|
finalcut::FRadioMenuItem BStyle2;
|
||||||
|
finalcut::FRadioMenuItem BStyle3;
|
||||||
|
finalcut::FRadioMenuItem BStyle4;
|
||||||
|
finalcut::FStatusBar Statusbar;
|
||||||
|
finalcut::FLabel Headline1;
|
||||||
|
finalcut::FLabel Headline2;
|
||||||
|
finalcut::FLabel Info;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Menu::Menu (finalcut::FWidget* parent)
|
Menu::Menu (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
|
, line(13, wchar_t(finalcut::fc::BoxDrawingsHorizontal))
|
||||||
|
, Menubar(this)
|
||||||
|
, File("&File", &Menubar)
|
||||||
|
, Edit("&Edit", &Menubar)
|
||||||
|
, Choice("&Choice", &Menubar)
|
||||||
|
, Window("&Window", &Menubar)
|
||||||
|
, Help("&Help", &Menubar)
|
||||||
|
, New("&New", &File)
|
||||||
|
, Open("&Open...", &File)
|
||||||
|
, Save("&Save", &File)
|
||||||
|
, SaveAs("&Save as...", &File)
|
||||||
|
, Close("&Close", &File)
|
||||||
|
, Line1(&File)
|
||||||
|
, Print("&Print", &File)
|
||||||
|
, Line2(&File)
|
||||||
|
, Quit("&Quit", &File)
|
||||||
|
, Undo(finalcut::fc::Fckey_z, "&Undo", &Edit)
|
||||||
|
, Redo(finalcut::fc::Fckey_y, "&Redo", &Edit)
|
||||||
|
, Line3(&Edit)
|
||||||
|
, Cut(finalcut::fc::Fckey_x, "Cu&t", &Edit)
|
||||||
|
, Copy(finalcut::fc::Fckey_c, "&Copy", &Edit)
|
||||||
|
, Paste(finalcut::fc::Fckey_v, "&Paste", &Edit)
|
||||||
|
, Line4(&Edit)
|
||||||
|
, Search(finalcut::fc::Fckey_f, "&Search", &Edit)
|
||||||
|
, Next(finalcut::fc::Fkey_f3, "Search &next", &Edit)
|
||||||
|
, Line5(&Edit)
|
||||||
|
, SelectAll(finalcut::fc::Fckey_a, "Select &all", &Edit)
|
||||||
|
, Color("&Color", &Choice)
|
||||||
|
, Style("&Style", &Choice)
|
||||||
|
, Border("&Border", &Choice)
|
||||||
|
, Color1("Red", &Color)
|
||||||
|
, Color2("Green", &Color)
|
||||||
|
, Color3("Yellow", &Color)
|
||||||
|
, Color4("Brue", &Color)
|
||||||
|
, Color5("Black", &Color)
|
||||||
|
, Bold("Bold", &Style)
|
||||||
|
, Italic("Italic", &Style)
|
||||||
|
, BColor("&Color", &Border)
|
||||||
|
, BStyle("&Style", &Border)
|
||||||
|
, BColor1("Red", &BColor)
|
||||||
|
, BColor2("Blue", &BColor)
|
||||||
|
, BStyle1(line, &BStyle)
|
||||||
|
, BStyle2("-------------", &BStyle)
|
||||||
|
, BStyle3("- - - - - - -", &BStyle)
|
||||||
|
, BStyle4("- - - - -", &BStyle)
|
||||||
|
, Statusbar(this)
|
||||||
|
, Headline1(this)
|
||||||
|
, Headline2(this)
|
||||||
|
, Info(this)
|
||||||
{
|
{
|
||||||
// Menu bar
|
// Menu bar itms
|
||||||
finalcut::FMenuBar* Menubar = new finalcut::FMenuBar(this);
|
File.setStatusbarMessage ("File management commands");
|
||||||
|
Edit.setStatusbarMessage ("Cut-and-paste editing commands");
|
||||||
// Menu bar items
|
Choice.setStatusbarMessage ("Choice menu");
|
||||||
finalcut::FMenu* File = \
|
Window.setDisable();
|
||||||
new finalcut::FMenu ("&File", Menubar);
|
Help.setStatusbarMessage ("Show version and copyright information");
|
||||||
File->setStatusbarMessage ("File management commands");
|
|
||||||
finalcut::FMenu* Edit = \
|
|
||||||
new finalcut::FMenu ("&Edit", Menubar);
|
|
||||||
Edit->setStatusbarMessage ("Cut-and-paste editing commands");
|
|
||||||
finalcut::FMenu* Choice = \
|
|
||||||
new finalcut::FMenu ("&Choice", Menubar);
|
|
||||||
Choice->setStatusbarMessage ("Choice menu");
|
|
||||||
finalcut::FMenuItem* Window = \
|
|
||||||
new finalcut::FMenuItem ("&Window", Menubar);
|
|
||||||
Window->setDisable();
|
|
||||||
finalcut::FMenuItem* Help = \
|
|
||||||
new finalcut::FMenuItem ("&Help", Menubar);
|
|
||||||
Help->setStatusbarMessage ("Show version and copyright information");
|
|
||||||
|
|
||||||
// Menu items
|
// Menu items
|
||||||
createFileMenuItems (File);
|
configureFileMenuItems();
|
||||||
createEditMenuItems (Edit);
|
configureEditMenuItems();
|
||||||
createChoiceMenuItems (Choice);
|
configureChoiceMenuItems();
|
||||||
|
|
||||||
// Add default menu item callback
|
// Add default menu item callback
|
||||||
defaultCallback (Menubar);
|
defaultCallback (&Menubar);
|
||||||
|
|
||||||
// Statusbar at the bottom
|
// Statusbar at the bottom
|
||||||
finalcut::FStatusBar* Statusbar = \
|
Statusbar.setMessage("Status bar message");
|
||||||
new finalcut::FStatusBar (this);
|
|
||||||
Statusbar->setMessage("Status bar message");
|
|
||||||
|
|
||||||
// Headline labels
|
// Headline labels
|
||||||
finalcut::FLabel* Headline1 = \
|
Headline1 << " Key ";
|
||||||
new finalcut::FLabel(" Key ", this);
|
Headline1.ignorePadding();
|
||||||
Headline1->ignorePadding();
|
Headline1.setGeometry(3, 2, 5, 1);
|
||||||
Headline1->setGeometry(3, 2, 5, 1);
|
Headline1.setEmphasis();
|
||||||
Headline1->setEmphasis();
|
|
||||||
|
|
||||||
finalcut::FLabel* Headline2 = \
|
Headline2 << " Function ";
|
||||||
new finalcut::FLabel(" Function ", this);
|
Headline2.ignorePadding();
|
||||||
Headline2->ignorePadding();
|
Headline2.setGeometry(19, 2, 10, 1);
|
||||||
Headline2->setGeometry(19, 2, 10, 1);
|
Headline2.setEmphasis();
|
||||||
Headline2->setEmphasis();
|
|
||||||
|
|
||||||
// Info label
|
// Info label
|
||||||
finalcut::FLabel* Info = \
|
Info << "<F10> Activate menu bar\n"
|
||||||
new finalcut::FLabel( "<F10> Activate menu bar\n"
|
<< "<Ctrl>+<Space> Activate menu bar\n"
|
||||||
"<Ctrl>+<Space> Activate menu bar\n"
|
<< "<Meta>+<X> Exit";
|
||||||
"<Meta>+<X> Exit", this );
|
Info.setGeometry(2, 1, 36, 3);
|
||||||
Info->setGeometry(2, 1, 36, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -129,45 +209,27 @@ Menu::~Menu()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createFileMenuItems (finalcut::FMenu* File)
|
void Menu::configureFileMenuItems()
|
||||||
{
|
{
|
||||||
// "File" menu items
|
// "File" menu items
|
||||||
finalcut::FMenuItem* New = \
|
New.addAccelerator (finalcut::fc::Fckey_n); // Ctrl + N
|
||||||
new finalcut::FMenuItem ("&New", File);
|
New.setStatusbarMessage ("Create a new file");
|
||||||
New->addAccelerator (finalcut::fc::Fckey_n); // Ctrl + N
|
Open.addAccelerator (finalcut::fc::Fckey_o); // Ctrl + O
|
||||||
New->setStatusbarMessage ("Create a new file");
|
Open.setStatusbarMessage ("Locate and open a text file");
|
||||||
finalcut::FMenuItem* Open = \
|
Save.addAccelerator (finalcut::fc::Fckey_s); // Ctrl + S
|
||||||
new finalcut::FMenuItem ("&Open...", File);
|
Save.setStatusbarMessage ("Save the file");
|
||||||
Open->addAccelerator (finalcut::fc::Fckey_o); // Ctrl + O
|
SaveAs.setStatusbarMessage ("Save the current file under a different name");
|
||||||
Open->setStatusbarMessage ("Locate and open a text file");
|
Close.addAccelerator (finalcut::fc::Fckey_w); // Ctrl + W
|
||||||
finalcut::FMenuItem* Save = \
|
Close.setStatusbarMessage ("Close the current file");
|
||||||
new finalcut::FMenuItem ("&Save", File);
|
Line1.setSeparator();
|
||||||
Save->addAccelerator (finalcut::fc::Fckey_s); // Ctrl + S
|
Print.addAccelerator (finalcut::fc::Fckey_p); // Ctrl + P
|
||||||
Save->setStatusbarMessage ("Save the file");
|
Print.setStatusbarMessage ("Print the current file");
|
||||||
finalcut::FMenuItem* SaveAs = \
|
Line2.setSeparator();
|
||||||
new finalcut::FMenuItem ("&Save as...", File);
|
Quit.addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
||||||
SaveAs->setStatusbarMessage ("Save the current file under a different name");
|
Quit.setStatusbarMessage ("Exit the program");
|
||||||
finalcut::FMenuItem* Close = \
|
|
||||||
new finalcut::FMenuItem ("&Close", File);
|
|
||||||
Close->addAccelerator (finalcut::fc::Fckey_w); // Ctrl + W
|
|
||||||
Close->setStatusbarMessage ("Close the current file");
|
|
||||||
finalcut::FMenuItem* Line1 = \
|
|
||||||
new finalcut::FMenuItem (File);
|
|
||||||
Line1->setSeparator();
|
|
||||||
finalcut::FMenuItem* Print = \
|
|
||||||
new finalcut::FMenuItem ("&Print", File);
|
|
||||||
Print->addAccelerator (finalcut::fc::Fckey_p); // Ctrl + P
|
|
||||||
Print->setStatusbarMessage ("Print the current file");
|
|
||||||
finalcut::FMenuItem* Line2 = \
|
|
||||||
new finalcut::FMenuItem (File);
|
|
||||||
Line2->setSeparator();
|
|
||||||
finalcut::FMenuItem* Quit = \
|
|
||||||
new finalcut::FMenuItem ("&Quit", File);
|
|
||||||
Quit->addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
|
||||||
Quit->setStatusbarMessage ("Exit the program");
|
|
||||||
|
|
||||||
// Add quit menu item callback
|
// Add quit menu item callback
|
||||||
Quit->addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
|
@ -175,138 +237,73 @@ void Menu::createFileMenuItems (finalcut::FMenu* File)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createEditMenuItems (finalcut::FMenu* Edit)
|
void Menu::configureEditMenuItems()
|
||||||
{
|
{
|
||||||
// "Edit" menu items
|
// "Edit" menu items
|
||||||
finalcut::FMenuItem* Undo = \
|
Undo.setStatusbarMessage ("Undo the previous operation");
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_z, "&Undo", Edit);
|
Redo.setDisable();
|
||||||
Undo->setStatusbarMessage ("Undo the previous operation");
|
Line3.setSeparator();
|
||||||
finalcut::FMenuItem* Redo = \
|
Cut.setStatusbarMessage ( "Remove the input text "
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_y, "&Redo", Edit);
|
|
||||||
Redo->setDisable();
|
|
||||||
finalcut::FMenuItem* Line3 = \
|
|
||||||
new finalcut::FMenuItem (Edit);
|
|
||||||
Line3->setSeparator();
|
|
||||||
finalcut::FMenuItem* Cut = \
|
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_x, "Cu&t", Edit);
|
|
||||||
Cut->setStatusbarMessage ( "Remove the input text "
|
|
||||||
"and put it in the clipboard" );
|
"and put it in the clipboard" );
|
||||||
finalcut::FMenuItem* Copy = \
|
Copy.setStatusbarMessage ("Copy the input text into the clipboad");
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_c, "&Copy", Edit);
|
Paste.setStatusbarMessage ("Insert text form clipboard");
|
||||||
Copy->setStatusbarMessage ("Copy the input text into the clipboad");
|
Line4.setSeparator();
|
||||||
finalcut::FMenuItem* Paste = \
|
Search.setStatusbarMessage ("Search for text");
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_v, "&Paste", Edit);
|
Next.setStatusbarMessage ("Repeat the last search command");
|
||||||
Paste->setStatusbarMessage ("Insert text form clipboard");
|
Line5.setSeparator();
|
||||||
finalcut::FMenuItem* Line4 = \
|
SelectAll.setStatusbarMessage ("Select the whole text");
|
||||||
new finalcut::FMenuItem (Edit);
|
|
||||||
Line4->setSeparator();
|
|
||||||
finalcut::FMenuItem* Search = \
|
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_f, "&Search", Edit);
|
|
||||||
Search->setStatusbarMessage ("Search for text");
|
|
||||||
finalcut::FMenuItem* Next = \
|
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fkey_f3, "Search &next", Edit);
|
|
||||||
Next->setStatusbarMessage ("Repeat the last search command");
|
|
||||||
finalcut::FMenuItem* Line5 = \
|
|
||||||
new finalcut::FMenuItem (Edit);
|
|
||||||
Line5->setSeparator();
|
|
||||||
finalcut::FMenuItem* SelectAll = \
|
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_a, "Select &all", Edit);
|
|
||||||
SelectAll->setStatusbarMessage ("Select the whole text");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createChoiceMenuItems (finalcut::FMenu* Choice)
|
void Menu::configureChoiceMenuItems()
|
||||||
{
|
{
|
||||||
// "Choice" menu items
|
// "Choice" menu items
|
||||||
finalcut::FMenu* Color = new finalcut::FMenu ("&Color", Choice);
|
Color.setStatusbarMessage ("Choose a color");
|
||||||
Color->setStatusbarMessage ("Choose a color");
|
Style.setStatusbarMessage ("Choose a Style");
|
||||||
finalcut::FMenu* Style = new finalcut::FMenu ("&Style", Choice);
|
Border.setStatusbarMessage ("Choose Border");
|
||||||
Style->setStatusbarMessage ("Choose a Style");
|
|
||||||
finalcut::FMenu* Border = new finalcut::FMenu ("&Border", Choice);
|
|
||||||
Border->setStatusbarMessage ("Choose Border");
|
|
||||||
|
|
||||||
createColorMenuItems (Color);
|
configureColorMenuItems();
|
||||||
createStyleMenuItems (Style);
|
configureStyleMenuItems();
|
||||||
createBorderMenuItems (Border);
|
configureBorderMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createColorMenuItems (finalcut::FMenu* Color)
|
void Menu::configureColorMenuItems()
|
||||||
{
|
{
|
||||||
// "Color" menu items
|
// "Color" menu items
|
||||||
finalcut::FRadioMenuItem* Color1 = \
|
Color1.setStatusbarMessage ("Set text red");
|
||||||
new finalcut::FRadioMenuItem ("Red", Color);
|
Color2.setStatusbarMessage ("Set text green");
|
||||||
Color1->setStatusbarMessage ("Set text red");
|
Color3.setStatusbarMessage ("Set text yellow");
|
||||||
finalcut::FRadioMenuItem* Color2 = \
|
Color4.setStatusbarMessage ("Set text brue");
|
||||||
new finalcut::FRadioMenuItem ("Green", Color);
|
Color5.setStatusbarMessage ("Set text black");
|
||||||
Color2->setStatusbarMessage ("Set text green");
|
Color5.setChecked();
|
||||||
finalcut::FRadioMenuItem* Color3 = \
|
|
||||||
new finalcut::FRadioMenuItem ("Yellow", Color);
|
|
||||||
Color3->setStatusbarMessage ("Set text yellow");
|
|
||||||
finalcut::FRadioMenuItem* Color4 = \
|
|
||||||
new finalcut::FRadioMenuItem ("Brue", Color);
|
|
||||||
Color4->setStatusbarMessage ("Set text brue");
|
|
||||||
finalcut::FRadioMenuItem* Color5 = \
|
|
||||||
new finalcut::FRadioMenuItem ("Black", Color);
|
|
||||||
Color5->setStatusbarMessage ("Set text black");
|
|
||||||
Color5->setChecked();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createStyleMenuItems (finalcut::FMenu* Style)
|
void Menu::configureStyleMenuItems()
|
||||||
{
|
{
|
||||||
// "Style" menu items
|
// "Style" menu items
|
||||||
finalcut::FCheckMenuItem* Bold = \
|
Bold.setStatusbarMessage ("Set text bold");
|
||||||
new finalcut::FCheckMenuItem ("Bold", Style);
|
Italic.setStatusbarMessage ("Set text italic");
|
||||||
Bold->setStatusbarMessage ("Set text bold");
|
|
||||||
finalcut::FCheckMenuItem* Italic = \
|
|
||||||
new finalcut::FCheckMenuItem ("Italic", Style);
|
|
||||||
Italic->setStatusbarMessage ("Set text italic");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::createBorderMenuItems (finalcut::FMenu* Border)
|
void Menu::configureBorderMenuItems()
|
||||||
{
|
{
|
||||||
// "Border" menu items
|
// "Border" menu items
|
||||||
finalcut::FMenu* BColor = new finalcut::FMenu ("&Color", Border);
|
BColor.setStatusbarMessage ("Choose the border color");
|
||||||
BColor->setStatusbarMessage ("Choose the border color");
|
BStyle.setStatusbarMessage ("Choose the border Style");
|
||||||
finalcut::FMenu* BStyle = new finalcut::FMenu ("&Style", Border);
|
|
||||||
BStyle->setStatusbarMessage ("Choose the border Style");
|
|
||||||
|
|
||||||
createBorderColorMenuItems (BColor);
|
|
||||||
createBorderStyleMenuItems (BStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void Menu::createBorderColorMenuItems (finalcut::FMenu* BColor)
|
|
||||||
{
|
|
||||||
// "BColor" menu items
|
// "BColor" menu items
|
||||||
finalcut::FRadioMenuItem* BColor1 = \
|
BColor1.setStatusbarMessage ("Set red border");
|
||||||
new finalcut::FRadioMenuItem ("Red", BColor);
|
BColor2.setStatusbarMessage ("Set blue border");
|
||||||
BColor1->setStatusbarMessage ("Set red border");
|
|
||||||
finalcut::FRadioMenuItem* BColor2 = \
|
|
||||||
new finalcut::FRadioMenuItem ("Blue", BColor);
|
|
||||||
BColor2->setStatusbarMessage ("Set blue border");
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void Menu::createBorderStyleMenuItems (finalcut::FMenu* BStyle)
|
|
||||||
{
|
|
||||||
// "BStyle" menu items
|
// "BStyle" menu items
|
||||||
finalcut::FString line(13, wchar_t(finalcut::fc::BoxDrawingsHorizontal));
|
BStyle1.setChecked();
|
||||||
finalcut::FRadioMenuItem* BStyle1 = \
|
BStyle1.setStatusbarMessage ("Set border 1");
|
||||||
new finalcut::FRadioMenuItem (line, BStyle);
|
BStyle2.setStatusbarMessage ("Set border 2");
|
||||||
BStyle1->setChecked();
|
BStyle3.setStatusbarMessage ("Set border 3");
|
||||||
BStyle1->setStatusbarMessage ("Set border 1");
|
BStyle4.setStatusbarMessage ("Set border 4");
|
||||||
finalcut::FRadioMenuItem* BStyle2 = \
|
|
||||||
new finalcut::FRadioMenuItem ("-------------", BStyle);
|
|
||||||
BStyle2->setStatusbarMessage ("Set border 2");
|
|
||||||
finalcut::FRadioMenuItem* BStyle3 = \
|
|
||||||
new finalcut::FRadioMenuItem ("- - - - - - -", BStyle);
|
|
||||||
BStyle3->setStatusbarMessage ("Set border 3");
|
|
||||||
finalcut::FRadioMenuItem* BStyle4 = \
|
|
||||||
new finalcut::FRadioMenuItem ("- - - - -", BStyle);
|
|
||||||
BStyle4->setStatusbarMessage ("Set border 4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -50,14 +50,15 @@ class ColorChooser : public finalcut::FWidget
|
||||||
ColorChooser& operator = (const ColorChooser&);
|
ColorChooser& operator = (const ColorChooser&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onMouseDown (finalcut::FMouseEvent*);
|
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
short fg_color;
|
short fg_color;
|
||||||
short bg_color;
|
short bg_color;
|
||||||
|
finalcut::FLabel headline;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
, fg_color(finalcut::fc::White)
|
, fg_color(finalcut::fc::White)
|
||||||
, bg_color(finalcut::fc::Black)
|
, bg_color(finalcut::fc::Black)
|
||||||
|
, headline(this)
|
||||||
{
|
{
|
||||||
setSize (8, 12);
|
setSize (8, 12);
|
||||||
setFixedSize (8, 12);
|
setFixedSize (8, 12);
|
||||||
|
@ -73,16 +75,19 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
setForegroundColor(parent->getForegroundColor());
|
short fg = parent->getForegroundColor();
|
||||||
setBackgroundColor(parent->getBackgroundColor());
|
short bg = parent->getBackgroundColor();
|
||||||
|
setForegroundColor(fg);
|
||||||
|
setBackgroundColor(bg);
|
||||||
|
headline.setForegroundColor(fg);
|
||||||
|
headline.setBackgroundColor(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
finalcut::FLabel* headline = new finalcut::FLabel (this);
|
headline.setGeometry (1, 1, 8, 1);
|
||||||
headline->setGeometry(1, 1, 8, 1);
|
headline.setEmphasis();
|
||||||
headline->setEmphasis();
|
headline.setAlignment (finalcut::fc::alignCenter);
|
||||||
headline->setAlignment (finalcut::fc::alignCenter);
|
headline << "Color";
|
||||||
*headline << "Color";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -188,15 +193,16 @@ class Brushes : public finalcut::FWidget
|
||||||
Brushes& operator = (const Brushes&);
|
Brushes& operator = (const Brushes&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onMouseDown (finalcut::FMouseEvent*);
|
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
wchar_t brush;
|
wchar_t brush;
|
||||||
short fg_color;
|
short fg_color;
|
||||||
short bg_color;
|
short bg_color;
|
||||||
|
finalcut::FLabel headline;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -206,6 +212,7 @@ Brushes::Brushes (finalcut::FWidget* parent)
|
||||||
, brush(L' ')
|
, brush(L' ')
|
||||||
, fg_color(finalcut::fc::White)
|
, fg_color(finalcut::fc::White)
|
||||||
, bg_color(finalcut::fc::Black)
|
, bg_color(finalcut::fc::Black)
|
||||||
|
, headline(this)
|
||||||
{
|
{
|
||||||
setSize (8, 4);
|
setSize (8, 4);
|
||||||
setFixedSize (8, 4);
|
setFixedSize (8, 4);
|
||||||
|
@ -213,16 +220,19 @@ Brushes::Brushes (finalcut::FWidget* parent)
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
setForegroundColor(parent->getForegroundColor());
|
short fg = parent->getForegroundColor();
|
||||||
setBackgroundColor(parent->getBackgroundColor());
|
short bg = parent->getBackgroundColor();
|
||||||
|
setForegroundColor(fg);
|
||||||
|
setBackgroundColor(bg);
|
||||||
|
headline.setForegroundColor(fg);
|
||||||
|
headline.setBackgroundColor(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
finalcut::FLabel* headline = new finalcut::FLabel (this);
|
headline.setGeometry(1, 1, 8, 1);
|
||||||
headline->setGeometry(1, 1, 8, 1);
|
headline.setEmphasis();
|
||||||
headline->setEmphasis();
|
headline.setAlignment (finalcut::fc::alignCenter);
|
||||||
headline->setAlignment (finalcut::fc::alignCenter);
|
headline << "Brush";
|
||||||
*headline << "Brush";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -316,8 +326,8 @@ class MouseDraw : public finalcut::FDialog
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
void setGeometry (int, int, int, int, bool = true);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -329,19 +339,19 @@ class MouseDraw : public finalcut::FDialog
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawBrush (int, int, bool = false);
|
void drawBrush (int, int, bool = false);
|
||||||
void drawCanvas();
|
void drawCanvas();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onMouseDown (finalcut::FMouseEvent*);
|
virtual void onMouseDown (finalcut::FMouseEvent*);
|
||||||
void onMouseMove (finalcut::FMouseEvent*);
|
virtual void onMouseMove (finalcut::FMouseEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_colorChanged (finalcut::FWidget*, data_ptr);
|
void cb_colorChanged (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
term_area* canvas;
|
term_area* canvas;
|
||||||
ColorChooser* c_chooser;
|
ColorChooser c_chooser;
|
||||||
Brushes* brush;
|
Brushes brush;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -349,20 +359,18 @@ class MouseDraw : public finalcut::FDialog
|
||||||
MouseDraw::MouseDraw (finalcut::FWidget* parent)
|
MouseDraw::MouseDraw (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, canvas(0)
|
, canvas(0)
|
||||||
, c_chooser()
|
, c_chooser(this)
|
||||||
, brush()
|
, brush(this)
|
||||||
{
|
{
|
||||||
setText ("Drawing with the mouse");
|
setText ("Drawing with the mouse");
|
||||||
c_chooser = new ColorChooser(this);
|
c_chooser.setPos (1, 1);
|
||||||
c_chooser->setPos (1, 1);
|
c_chooser.addCallback
|
||||||
c_chooser->addCallback
|
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
|
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
|
||||||
);
|
);
|
||||||
|
|
||||||
brush = new Brushes(this);
|
brush.setPos (1, 12);
|
||||||
brush->setPos (1, 12);
|
|
||||||
|
|
||||||
finalcut::FPoint no_shadow(0,0);
|
finalcut::FPoint no_shadow(0,0);
|
||||||
finalcut::FRect scroll_geometry(0, 0, 1, 1);
|
finalcut::FRect scroll_geometry(0, 0, 1, 1);
|
||||||
|
@ -450,15 +458,15 @@ void MouseDraw::drawBrush (int x, int y, bool swap_color)
|
||||||
if ( x > 10 && x < Cols && y > 2 && y < Lines )
|
if ( x > 10 && x < Cols && y > 2 && y < Lines )
|
||||||
{
|
{
|
||||||
if ( swap_color )
|
if ( swap_color )
|
||||||
setColor (c_chooser->getBackground(), c_chooser->getForeground());
|
setColor (c_chooser.getBackground(), c_chooser.getForeground());
|
||||||
else
|
else
|
||||||
setColor (c_chooser->getForeground(), c_chooser->getBackground());
|
setColor (c_chooser.getForeground(), c_chooser.getBackground());
|
||||||
|
|
||||||
// set canvas print cursor position
|
// set canvas print cursor position
|
||||||
canvas->cursor_x = x - canvas->offset_left - 10;
|
canvas->cursor_x = x - canvas->offset_left - 10;
|
||||||
canvas->cursor_y = y - canvas->offset_top - 2;
|
canvas->cursor_y = y - canvas->offset_top - 2;
|
||||||
// print on canvas
|
// print on canvas
|
||||||
print (canvas, brush->getBrush());
|
print (canvas, brush.getBrush());
|
||||||
// copy canvas to the dialog
|
// copy canvas to the dialog
|
||||||
drawCanvas();
|
drawCanvas();
|
||||||
}
|
}
|
||||||
|
@ -539,9 +547,9 @@ void MouseDraw::onMouseMove (finalcut::FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::cb_colorChanged (finalcut::FWidget*, data_ptr)
|
void MouseDraw::cb_colorChanged (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
brush->setForeground (c_chooser->getForeground());
|
brush.setForeground (c_chooser.getForeground());
|
||||||
brush->setBackground (c_chooser->getBackground());
|
brush.setBackground (c_chooser.getBackground());
|
||||||
brush->redraw();
|
brush.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Scrollview : public finalcut::FScrollView
|
||||||
Scrollview& operator = (const Scrollview&);
|
Scrollview& operator = (const Scrollview&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_go_east (finalcut::FWidget*, data_ptr);
|
void cb_go_east (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -58,58 +58,55 @@ class Scrollview : public finalcut::FScrollView
|
||||||
void cb_go_north (finalcut::FWidget*, data_ptr);
|
void cb_go_north (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FButton* go_east;
|
wchar_t pointer_right;
|
||||||
finalcut::FButton* go_south;
|
wchar_t pointer_down;
|
||||||
finalcut::FButton* go_west;
|
wchar_t pointer_left;
|
||||||
finalcut::FButton* go_north;
|
wchar_t pointer_up;
|
||||||
|
finalcut::FButton go_east;
|
||||||
|
finalcut::FButton go_south;
|
||||||
|
finalcut::FButton go_west;
|
||||||
|
finalcut::FButton go_north;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Scrollview::Scrollview (finalcut::FWidget* parent)
|
Scrollview::Scrollview (finalcut::FWidget* parent)
|
||||||
: finalcut::FScrollView(parent)
|
: finalcut::FScrollView(parent)
|
||||||
, go_east()
|
, pointer_right(wchar_t(finalcut::fc::BlackRightPointingPointer))
|
||||||
, go_south()
|
, pointer_down(wchar_t(finalcut::fc::BlackDownPointingTriangle))
|
||||||
, go_west()
|
, pointer_left(wchar_t(finalcut::fc::BlackLeftPointingPointer))
|
||||||
, go_north()
|
, pointer_up(wchar_t(finalcut::fc::BlackUpPointingTriangle))
|
||||||
|
, go_east(pointer_right, this)
|
||||||
|
, go_south(pointer_down, this)
|
||||||
|
, go_west(pointer_left, this)
|
||||||
|
, go_north(pointer_up, this)
|
||||||
{
|
{
|
||||||
// Create the four navigation buttons
|
// Sets the navigation button geometry
|
||||||
wchar_t pointer_right = wchar_t(finalcut::fc::BlackRightPointingPointer);
|
go_east.setGeometry (1, 1, 5, 1);
|
||||||
go_east = new finalcut::FButton(pointer_right, this);
|
go_south.setGeometry (getScrollWidth() - 5, 1, 5, 1);
|
||||||
go_east->setGeometry (1, 1, 5, 1);
|
go_west.setGeometry (getScrollWidth() - 5, getScrollHeight() - 2, 5, 1);
|
||||||
|
go_north.setGeometry (1, getScrollHeight() - 2, 5, 1);
|
||||||
wchar_t pointer_down = wchar_t(finalcut::fc::BlackDownPointingTriangle);
|
|
||||||
go_south = new finalcut::FButton(pointer_down, this);
|
|
||||||
go_south->setGeometry (getScrollWidth() - 5, 1, 5, 1);
|
|
||||||
|
|
||||||
wchar_t pointer_left = wchar_t(finalcut::fc::BlackLeftPointingPointer);
|
|
||||||
go_west = new finalcut::FButton(pointer_left, this);
|
|
||||||
go_west->setGeometry (getScrollWidth() - 5, getScrollHeight() - 2, 5, 1);
|
|
||||||
|
|
||||||
wchar_t pointer_up = wchar_t(finalcut::fc::BlackUpPointingTriangle);
|
|
||||||
go_north = new finalcut::FButton(pointer_up, this);
|
|
||||||
go_north->setGeometry (1, getScrollHeight() - 2, 5, 1);
|
|
||||||
|
|
||||||
// Add scroll function callbacks to the buttons
|
// Add scroll function callbacks to the buttons
|
||||||
go_east->addCallback
|
go_east.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Scrollview::cb_go_east)
|
F_METHOD_CALLBACK (this, &Scrollview::cb_go_east)
|
||||||
);
|
);
|
||||||
|
|
||||||
go_south->addCallback
|
go_south.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Scrollview::cb_go_south)
|
F_METHOD_CALLBACK (this, &Scrollview::cb_go_south)
|
||||||
);
|
);
|
||||||
|
|
||||||
go_west->addCallback
|
go_west.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Scrollview::cb_go_west)
|
F_METHOD_CALLBACK (this, &Scrollview::cb_go_west)
|
||||||
);
|
);
|
||||||
|
|
||||||
go_north->addCallback
|
go_north.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Scrollview::cb_go_north)
|
F_METHOD_CALLBACK (this, &Scrollview::cb_go_north)
|
||||||
|
@ -124,9 +121,9 @@ Scrollview::~Scrollview()
|
||||||
void Scrollview::setScrollSize (int width, int height)
|
void Scrollview::setScrollSize (int width, int height)
|
||||||
{
|
{
|
||||||
FScrollView::setScrollSize (width, height);
|
FScrollView::setScrollSize (width, height);
|
||||||
go_south->setPos (width - 5, 1);
|
go_south.setPos (width - 5, 1);
|
||||||
go_west->setPos (width - 5, height - 1);
|
go_west.setPos (width - 5, height - 1);
|
||||||
go_north->setPos (1, height - 1);
|
go_north.setPos (1, height - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -156,36 +153,36 @@ void Scrollview::draw()
|
||||||
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToX (getScrollWidth() - getViewportWidth() + 1);
|
scrollToX (getScrollWidth() - getViewportWidth() + 1);
|
||||||
go_south->setFocus();
|
go_south.setFocus();
|
||||||
go_east->redraw();
|
go_east.redraw();
|
||||||
go_south->redraw();
|
go_south.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToY (getScrollHeight() - getViewportHeight() + 1);
|
scrollToY (getScrollHeight() - getViewportHeight() + 1);
|
||||||
go_west->setFocus();
|
go_west.setFocus();
|
||||||
go_south->redraw();
|
go_south.redraw();
|
||||||
go_west->redraw();
|
go_west.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Scrollview::cb_go_west (finalcut::FWidget*, data_ptr)
|
void Scrollview::cb_go_west (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToX (1);
|
scrollToX (1);
|
||||||
go_north->setFocus();
|
go_north.setFocus();
|
||||||
go_west->redraw();
|
go_west.redraw();
|
||||||
go_north->redraw();
|
go_north.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Scrollview::cb_go_north (finalcut::FWidget*, data_ptr)
|
void Scrollview::cb_go_north (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToY (1);
|
scrollToY (1);
|
||||||
go_east->setFocus();
|
go_east.setFocus();
|
||||||
go_north->redraw();
|
go_north.redraw();
|
||||||
go_east->redraw();
|
go_east.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,10 +203,15 @@ class Scrollviewdemo : public finalcut::FDialog
|
||||||
~Scrollviewdemo();
|
~Scrollviewdemo();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_quit (finalcut::FWidget* = 0, data_ptr = 0);
|
void cb_quit (finalcut::FWidget* = 0, data_ptr = 0);
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
Scrollview sview;
|
||||||
|
finalcut::FButton quit_btn;
|
||||||
|
finalcut::FLabel label;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -217,31 +219,31 @@ class Scrollviewdemo : public finalcut::FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
|
, sview(this)
|
||||||
|
, quit_btn("&Quit", this)
|
||||||
|
, label(this)
|
||||||
{
|
{
|
||||||
setGeometry (16, 3, 50, 19);
|
setGeometry (16, 3, 50, 19);
|
||||||
setText ("Scrolling viewport example");
|
setText ("Scrolling viewport example");
|
||||||
|
|
||||||
// The scrolling viewport widget
|
// The scrolling viewport widget
|
||||||
Scrollview* sview = new Scrollview (this);
|
sview.setGeometry(3, 2, 44, 12);
|
||||||
sview->setGeometry(3, 2, 44, 12);
|
sview.setScrollSize(188, 124);
|
||||||
sview->setScrollSize(188, 124);
|
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
finalcut::FButton* button = new finalcut::FButton("&Quit", this);
|
quit_btn.setGeometry(37, 15, 10, 1);
|
||||||
button->setGeometry(37, 15, 10, 1);
|
|
||||||
|
|
||||||
// Add function callback
|
// Add function callback
|
||||||
button->addCallback
|
quit_btn.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &Scrollviewdemo::cb_quit)
|
F_METHOD_CALLBACK (this, &Scrollviewdemo::cb_quit)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
finalcut::FLabel* label = new finalcut::FLabel (this);
|
label.setGeometry(2, 1, 46, 1);
|
||||||
label->setGeometry(2, 1, 46, 1);
|
label.setEmphasis();
|
||||||
label->setEmphasis();
|
label << L"Use scrollbars to change the viewport position";
|
||||||
*label << L"Use scrollbars to change the viewport position";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -40,9 +40,9 @@ class AttribDlg : public finalcut::FDialog
|
||||||
~AttribDlg();
|
~AttribDlg();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
void onWheel (finalcut::FWheelEvent*);
|
virtual void onWheel (finalcut::FWheelEvent*);
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_next (finalcut::FWidget* = 0, data_ptr = 0);
|
void cb_next (finalcut::FWidget* = 0, data_ptr = 0);
|
||||||
|
@ -58,11 +58,11 @@ class AttribDlg : public finalcut::FDialog
|
||||||
AttribDlg& operator = (const AttribDlg&);
|
AttribDlg& operator = (const AttribDlg&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FButton* next_button;
|
finalcut::FButton next_button;
|
||||||
finalcut::FButton* back_button;
|
finalcut::FButton back_button;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -70,28 +70,26 @@ class AttribDlg : public finalcut::FDialog
|
||||||
AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, bgcolor(wc.label_bg)
|
, bgcolor(wc.label_bg)
|
||||||
, next_button()
|
, next_button("&Next >", this)
|
||||||
, back_button()
|
, back_button("< &Back", this)
|
||||||
{
|
{
|
||||||
setText ( "A terminal attributes test ("
|
setText ( "A terminal attributes test ("
|
||||||
+ finalcut::FString(getTermType())
|
+ finalcut::FString(getTermType())
|
||||||
+ ")");
|
+ ")");
|
||||||
|
|
||||||
next_button = new finalcut::FButton("&Next >", this);
|
next_button.setGeometry(getWidth() - 13, getHeight() - 4, 10, 1);
|
||||||
next_button->setGeometry(getWidth() - 13, getHeight() - 4, 10, 1);
|
next_button.addAccelerator(finalcut::fc::Fkey_right);
|
||||||
next_button->addAccelerator(finalcut::fc::Fkey_right);
|
back_button.setGeometry(getWidth() - 25, getHeight() - 4, 10, 1);
|
||||||
back_button = new finalcut::FButton("< &Back", this);
|
back_button.addAccelerator(finalcut::fc::Fkey_left);
|
||||||
back_button->setGeometry(getWidth() - 25, getHeight() - 4, 10, 1);
|
|
||||||
back_button->addAccelerator(finalcut::fc::Fkey_left);
|
|
||||||
|
|
||||||
// Add function callbacks
|
// Add function callbacks
|
||||||
next_button->addCallback
|
next_button.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &AttribDlg::cb_next)
|
F_METHOD_CALLBACK (this, &AttribDlg::cb_next)
|
||||||
);
|
);
|
||||||
|
|
||||||
back_button->addCallback
|
back_button.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &AttribDlg::cb_back)
|
F_METHOD_CALLBACK (this, &AttribDlg::cb_back)
|
||||||
|
@ -167,8 +165,8 @@ void AttribDlg::adjustSize()
|
||||||
y = 1;
|
y = 1;
|
||||||
|
|
||||||
setGeometry(x, y, 69, 21, false);
|
setGeometry(x, y, 69, 21, false);
|
||||||
next_button->setGeometry(getWidth() - 13, getHeight() - 4, 10, 1, false);
|
next_button.setGeometry(getWidth() - 13, getHeight() - 4, 10, 1, false);
|
||||||
back_button->setGeometry(getWidth() - 25, getHeight() - 4, 10, 1, false);
|
back_button.setGeometry(getWidth() - 25, getHeight() - 4, 10, 1, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +189,7 @@ class AttribDemo : public finalcut::FWidget
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onWheel (finalcut::FWheelEvent* ev)
|
virtual void onWheel (finalcut::FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
AttribDlg* p = static_cast<AttribDlg*>(getParentWidget());
|
AttribDlg* p = static_cast<AttribDlg*>(getParentWidget());
|
||||||
|
|
||||||
|
@ -216,7 +214,7 @@ class AttribDemo : public finalcut::FWidget
|
||||||
void printStandout();
|
void printStandout();
|
||||||
void printInvisible();
|
void printInvisible();
|
||||||
void printProtected();
|
void printProtected();
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Data Member
|
// Data Member
|
||||||
int colors;
|
int colors;
|
||||||
|
@ -492,20 +490,20 @@ int main (int argc, char* argv[])
|
||||||
// Create a dialog box object.
|
// Create a dialog box object.
|
||||||
// This object will be automatically deleted by
|
// This object will be automatically deleted by
|
||||||
// the parent object "app" (FObject destructor).
|
// the parent object "app" (FObject destructor).
|
||||||
AttribDlg* dialog = new AttribDlg(&app);
|
AttribDlg dialog(&app);
|
||||||
|
|
||||||
dialog->setGeometry (6, 2, 69, 21);
|
dialog.setGeometry (6, 2, 69, 21);
|
||||||
dialog->addAccelerator('q'); // press 'q' to quit
|
dialog.addAccelerator('q'); // press 'q' to quit
|
||||||
dialog->setShadow();
|
dialog.setShadow();
|
||||||
|
|
||||||
// Create the attribute demo widget as a child object from the dialog
|
// Create the attribute demo widget as a child object from the dialog
|
||||||
AttribDemo* demo = new AttribDemo(dialog);
|
AttribDemo demo(&dialog);
|
||||||
demo->setGeometry (1, 1, 67, 19);
|
demo.setGeometry (1, 1, 67, 19);
|
||||||
|
|
||||||
// Set the dialog object as main widget
|
// Set the dialog object as main widget
|
||||||
app.setMainWidget(dialog);
|
app.setMainWidget(&dialog);
|
||||||
|
|
||||||
// Show and start the application
|
// Show and start the application
|
||||||
dialog->show();
|
dialog.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,18 +39,32 @@ void booleans();
|
||||||
void numeric();
|
void numeric();
|
||||||
void string(finalcut::FTermcap::tcap_map*&);
|
void string(finalcut::FTermcap::tcap_map*&);
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// struct data
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct termcap_string
|
struct data
|
||||||
{
|
{
|
||||||
|
static int getNumberOfItems();
|
||||||
|
|
||||||
|
struct termcap_string
|
||||||
|
{
|
||||||
const std::string name;
|
const std::string name;
|
||||||
const finalcut::fc::termcaps cap;
|
const finalcut::fc::termcaps cap;
|
||||||
|
};
|
||||||
|
|
||||||
|
static termcap_string strings[];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
// String data array
|
//----------------------------------------------------------------------
|
||||||
static const termcap_string strings[] =
|
// struct data - string data array
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
data::termcap_string data::strings[] =
|
||||||
{
|
{
|
||||||
{ "t_bell", finalcut::fc::t_bell },
|
{ "t_bell", finalcut::fc::t_bell },
|
||||||
{ "t_erase_chars", finalcut::fc::t_erase_chars },
|
{ "t_erase_chars", finalcut::fc::t_erase_chars },
|
||||||
|
@ -136,7 +150,12 @@ static const termcap_string strings[] =
|
||||||
{ "t_key_mouse", finalcut::fc::t_key_mouse }
|
{ "t_key_mouse", finalcut::fc::t_key_mouse }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int last_item = int ( sizeof(strings) / sizeof(strings[0]) ) - 1;
|
// data inline functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline int data::getNumberOfItems()
|
||||||
|
{
|
||||||
|
return int ( sizeof(strings) / sizeof(strings[0]) ) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -272,10 +291,10 @@ void string(finalcut::FTermcap::tcap_map*& tcap)
|
||||||
{
|
{
|
||||||
std::cout << "\r\n[String]\r\n";
|
std::cout << "\r\n[String]\r\n";
|
||||||
|
|
||||||
for (int n = 0; n <= last_item; n++ )
|
for (int n = 0; n <= data::getNumberOfItems(); n++ )
|
||||||
{
|
{
|
||||||
const std::string name = strings[n].name;
|
const std::string name = data::strings[n].name;
|
||||||
const finalcut::fc::termcaps cap = strings[n].cap;
|
const finalcut::fc::termcaps cap = data::strings[n].cap;
|
||||||
tcapString (name, tcap[cap].string);
|
tcapString (name, tcap[cap].string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,11 @@ class Timer : public finalcut::FWidget
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Method
|
// Method
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onTimer (finalcut::FTimerEvent*);
|
virtual void onTimer (finalcut::FTimerEvent*);
|
||||||
void onAccel (finalcut::FAccelEvent*);
|
virtual void onAccel (finalcut::FAccelEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -41,7 +41,6 @@ class Transparent : public finalcut::FDialog
|
||||||
inherit_background = 2
|
inherit_background = 2
|
||||||
} trans_type;
|
} trans_type;
|
||||||
|
|
||||||
public:
|
|
||||||
// Constructor
|
// Constructor
|
||||||
explicit Transparent (finalcut::FWidget* = 0, trans_type = transparent);
|
explicit Transparent (finalcut::FWidget* = 0, trans_type = transparent);
|
||||||
|
|
||||||
|
@ -56,10 +55,10 @@ class Transparent : public finalcut::FDialog
|
||||||
Transparent& operator = (const Transparent&);
|
Transparent& operator = (const Transparent&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (finalcut::FKeyEvent* ev);
|
virtual void onKeyPress (finalcut::FKeyEvent* ev);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
trans_type type;
|
trans_type type;
|
||||||
|
@ -150,9 +149,11 @@ void Transparent::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
|
|
||||||
class MainWindow : public finalcut::FDialog
|
class MainWindow : public finalcut::FDialog
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
finalcut::FString line1;
|
// Constructor
|
||||||
finalcut::FString line2;
|
explicit MainWindow (finalcut::FWidget* = 0);
|
||||||
|
// Destructor
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -160,13 +161,13 @@ class MainWindow : public finalcut::FDialog
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
MainWindow& operator = (const MainWindow&);
|
MainWindow& operator = (const MainWindow&);
|
||||||
|
|
||||||
void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
void onShow (finalcut::FShowEvent*);
|
virtual void onShow (finalcut::FShowEvent*);
|
||||||
void onTimer (finalcut::FTimerEvent*);
|
virtual void onTimer (finalcut::FTimerEvent*);
|
||||||
void onKeyPress (finalcut::FKeyEvent* ev)
|
virtual void onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
if ( ! ev )
|
if ( ! ev )
|
||||||
return;
|
return;
|
||||||
|
@ -180,11 +181,13 @@ class MainWindow : public finalcut::FDialog
|
||||||
finalcut::FDialog::onKeyPress(ev);
|
finalcut::FDialog::onKeyPress(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
// Data Members
|
||||||
// Constructor
|
finalcut::FString line1;
|
||||||
explicit MainWindow (finalcut::FWidget* = 0);
|
finalcut::FString line2;
|
||||||
// Destructor
|
Transparent transpwin;
|
||||||
~MainWindow();
|
Transparent shadowwin;
|
||||||
|
Transparent ibg;
|
||||||
|
finalcut::FStatusBar status_bar;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -193,28 +196,28 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
||||||
: FDialog(parent)
|
: FDialog(parent)
|
||||||
, line1()
|
, line1()
|
||||||
, line2()
|
, line2()
|
||||||
|
, transpwin(this)
|
||||||
|
, shadowwin(this, Transparent::shadow)
|
||||||
|
, ibg(this, Transparent::inherit_background)
|
||||||
|
, status_bar(this)
|
||||||
{
|
{
|
||||||
line1 = " .-. .-. .-.";
|
line1 = " .-. .-. .-.";
|
||||||
line2 = "`._.' `._.' `._.' ";
|
line2 = "`._.' `._.' `._.' ";
|
||||||
|
|
||||||
Transparent* transpwin = new Transparent(this);
|
transpwin.setText("transparent");
|
||||||
transpwin->setText("transparent");
|
transpwin.setGeometry (6, 3, 29, 12);
|
||||||
transpwin->setGeometry (6, 3, 29, 12);
|
transpwin.unsetTransparentShadow();
|
||||||
transpwin->unsetTransparentShadow();
|
|
||||||
|
|
||||||
Transparent* shadowwin = new Transparent(this, Transparent::shadow);
|
shadowwin.setText("shadow");
|
||||||
shadowwin->setText("shadow");
|
shadowwin.setGeometry (46, 11, 29, 12);
|
||||||
shadowwin->setGeometry (46, 11, 29, 12);
|
shadowwin.unsetTransparentShadow();
|
||||||
shadowwin->unsetTransparentShadow();
|
|
||||||
|
|
||||||
Transparent* ibg = new Transparent(this, Transparent::inherit_background);
|
ibg.setText("inherit background");
|
||||||
ibg->setText("inherit background");
|
ibg.setGeometry (42, 3, 29, 7);
|
||||||
ibg->setGeometry (42, 3, 29, 7);
|
ibg.unsetTransparentShadow();
|
||||||
ibg->unsetTransparentShadow();
|
|
||||||
|
|
||||||
// Statusbar at the bottom
|
// Statusbar at the bottom
|
||||||
finalcut::FStatusBar* status_bar = new finalcut::FStatusBar (this);
|
status_bar.setMessage("Press Q to quit");
|
||||||
status_bar->setMessage("Press Q to quit");
|
|
||||||
|
|
||||||
addAccelerator('q');
|
addAccelerator('q');
|
||||||
unsetTransparentShadow();
|
unsetTransparentShadow();
|
||||||
|
|
|
@ -53,20 +53,21 @@ class Treeview : public finalcut::FDialog
|
||||||
Treeview& operator = (const Treeview&);
|
Treeview& operator = (const Treeview&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
TreeItem* getAfrica();
|
|
||||||
TreeItem* getAsia();
|
|
||||||
TreeItem* getEurope();
|
|
||||||
TreeItem* getNorthAmerica();
|
|
||||||
TreeItem* getSouthAmerica();
|
|
||||||
TreeItem* getOceania();
|
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FListView* listView;
|
bool initialized;
|
||||||
finalcut::FButton* Quit;
|
finalcut::FListView listView;
|
||||||
|
finalcut::FButton Quit;
|
||||||
|
static TreeItem africa[];
|
||||||
|
static TreeItem asia[];
|
||||||
|
static TreeItem europe[];
|
||||||
|
static TreeItem north_america[];
|
||||||
|
static TreeItem south_america[];
|
||||||
|
static TreeItem oceania[];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -94,10 +95,10 @@ struct Treeview::TreeItem
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Treeview::TreeItem* Treeview::getAfrica()
|
// class Treeview - array data
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
Treeview::TreeItem Treeview::africa[] =
|
||||||
{
|
{
|
||||||
static TreeItem africa[] =
|
|
||||||
{
|
|
||||||
{ "Algeria", "40,400,000", "15.9", 0 },
|
{ "Algeria", "40,400,000", "15.9", 0 },
|
||||||
{ "Angola", "25,789,024", "20.69", 0 },
|
{ "Angola", "25,789,024", "20.69", 0 },
|
||||||
{ "Botswana", "2,250,260", "3.7", 0 },
|
{ "Botswana", "2,250,260", "3.7", 0 },
|
||||||
|
@ -121,16 +122,10 @@ Treeview::TreeItem* Treeview::getAfrica()
|
||||||
{ "Tanzania", "51,820,00", "47.5", 0 },
|
{ "Tanzania", "51,820,00", "47.5", 0 },
|
||||||
{ "Zambia", "16,212,000", "17.2", 0 },
|
{ "Zambia", "16,212,000", "17.2", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return africa;
|
Treeview::TreeItem Treeview::asia[] =
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
Treeview::TreeItem* Treeview::getAsia()
|
|
||||||
{
|
{
|
||||||
static TreeItem asia[] =
|
|
||||||
{
|
|
||||||
{ "Afghanistan", "34,656,032", "49.88", 0 },
|
{ "Afghanistan", "34,656,032", "49.88", 0 },
|
||||||
{ "China", "1,403,500,365", "145.0", 0 },
|
{ "China", "1,403,500,365", "145.0", 0 },
|
||||||
{ "India", "1,324,171,354", "393.9", 0 },
|
{ "India", "1,324,171,354", "393.9", 0 },
|
||||||
|
@ -151,16 +146,10 @@ Treeview::TreeItem* Treeview::getAsia()
|
||||||
{ "Vietnam", "94,569,072", "276.03", 0 },
|
{ "Vietnam", "94,569,072", "276.03", 0 },
|
||||||
{ "Yemen", "27,584,213", "44.7", 0 },
|
{ "Yemen", "27,584,213", "44.7", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return asia;
|
Treeview::TreeItem Treeview::europe[] =
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
Treeview::TreeItem* Treeview::getEurope()
|
|
||||||
{
|
{
|
||||||
static TreeItem europe[] =
|
|
||||||
{
|
|
||||||
{ "Austria", "8,794,267", "104.0", 0 },
|
{ "Austria", "8,794,267", "104.0", 0 },
|
||||||
{ "Belarus", "9,498,700", "45.8", 0 },
|
{ "Belarus", "9,498,700", "45.8", 0 },
|
||||||
{ "Bulgaria", "7,101,859", "64.9", 0 },
|
{ "Bulgaria", "7,101,859", "64.9", 0 },
|
||||||
|
@ -181,16 +170,11 @@ Treeview::TreeItem* Treeview::getEurope()
|
||||||
{ "Sweden", "10,065,389", "22.0", 0 },
|
{ "Sweden", "10,065,389", "22.0", 0 },
|
||||||
{ "United Kingdom", "65,648,000", "270.7", 0 },
|
{ "United Kingdom", "65,648,000", "270.7", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return europe;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
Treeview::TreeItem Treeview::north_america[] =
|
||||||
Treeview::TreeItem* Treeview::getNorthAmerica()
|
|
||||||
{
|
{
|
||||||
static TreeItem north_america[] =
|
|
||||||
{
|
|
||||||
{ "Canada", "35,151,728", "3.92", 0 },
|
{ "Canada", "35,151,728", "3.92", 0 },
|
||||||
{ "Cuba", "11,239,224", "102.3", 0 },
|
{ "Cuba", "11,239,224", "102.3", 0 },
|
||||||
{ "Greenland", "56,483", "0.028", 0 },
|
{ "Greenland", "56,483", "0.028", 0 },
|
||||||
|
@ -200,16 +184,10 @@ Treeview::TreeItem* Treeview::getNorthAmerica()
|
||||||
{ "Nicaragua", "6,167,237", "51.0", 0 },
|
{ "Nicaragua", "6,167,237", "51.0", 0 },
|
||||||
{ "USA", "325,365,189", "35.0", 0 },
|
{ "USA", "325,365,189", "35.0", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return north_america;
|
Treeview::TreeItem Treeview::south_america[] =
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
Treeview::TreeItem* Treeview::getSouthAmerica()
|
|
||||||
{
|
{
|
||||||
static TreeItem south_america[] =
|
|
||||||
{
|
|
||||||
{ "Argentina", "43,847,430", "14.4", 0 },
|
{ "Argentina", "43,847,430", "14.4", 0 },
|
||||||
{ "Bolivia", "11,410,651", "10.4", 0 },
|
{ "Bolivia", "11,410,651", "10.4", 0 },
|
||||||
{ "Brazil", "208,064,000", "24.35", 0 },
|
{ "Brazil", "208,064,000", "24.35", 0 },
|
||||||
|
@ -221,16 +199,10 @@ Treeview::TreeItem* Treeview::getSouthAmerica()
|
||||||
{ "Peru", "31,826,018", "23.0", 0 },
|
{ "Peru", "31,826,018", "23.0", 0 },
|
||||||
{ "Venezuela", "31,568,179", "33.75", 0 },
|
{ "Venezuela", "31,568,179", "33.75", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return south_america;
|
Treeview::TreeItem Treeview::oceania[] =
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
Treeview::TreeItem* Treeview::getOceania()
|
|
||||||
{
|
{
|
||||||
static TreeItem oceania[] =
|
|
||||||
{
|
|
||||||
{ "Australia", "24,675,900", "3.2", 0 },
|
{ "Australia", "24,675,900", "3.2", 0 },
|
||||||
{ "Papua New Guinea", "7,059,653", "15.0", 0 },
|
{ "Papua New Guinea", "7,059,653", "15.0", 0 },
|
||||||
{ "Papua", "3,486,432", "11.0", 0 },
|
{ "Papua", "3,486,432", "11.0", 0 },
|
||||||
|
@ -245,41 +217,32 @@ Treeview::TreeItem* Treeview::getOceania()
|
||||||
{ "Samoa", "192,342", "68.0", 0 },
|
{ "Samoa", "192,342", "68.0", 0 },
|
||||||
{ "Kiribati", "110,136", "152.0", 0 },
|
{ "Kiribati", "110,136", "152.0", 0 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
return oceania;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
Treeview::Treeview (finalcut::FWidget* parent)
|
Treeview::Treeview (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, listView()
|
, initialized(false)
|
||||||
, Quit()
|
, listView(this)
|
||||||
|
, Quit(this)
|
||||||
{
|
{
|
||||||
// Create FListView object
|
// Create FListView object
|
||||||
listView = new finalcut::FListView (this);
|
listView.setGeometry(2, 1, 53, 14);
|
||||||
listView->setGeometry(2, 1, 53, 14);
|
|
||||||
|
|
||||||
// Add columns to the view
|
// Add columns to the view
|
||||||
listView->addColumn ("Name", 23);
|
listView.addColumn ("Name", 23);
|
||||||
listView->addColumn ("Population");
|
listView.addColumn ("Population");
|
||||||
listView->addColumn ("Density/km²");
|
listView.addColumn ("Density/km²");
|
||||||
|
|
||||||
// Set right alignment for the second and third column
|
// Set right alignment for the second and third column
|
||||||
listView->setColumnAlignment (2, finalcut::fc::alignRight);
|
listView.setColumnAlignment (2, finalcut::fc::alignRight);
|
||||||
listView->setColumnAlignment (3, finalcut::fc::alignRight);
|
listView.setColumnAlignment (3, finalcut::fc::alignRight);
|
||||||
|
|
||||||
// Activate tree view
|
// Activate tree view
|
||||||
listView->setTreeView();
|
listView.setTreeView();
|
||||||
|
|
||||||
// Populate FListView with a list of items
|
// Populate FListView with a list of items
|
||||||
TreeItem* africa = getAfrica();
|
|
||||||
TreeItem* asia = getAsia();
|
|
||||||
TreeItem* europe = getEurope();
|
|
||||||
TreeItem* north_america = getNorthAmerica();
|
|
||||||
TreeItem* south_america = getSouthAmerica();
|
|
||||||
TreeItem* oceania = getOceania();
|
|
||||||
|
|
||||||
static TreeItem continent[] =
|
static TreeItem continent[] =
|
||||||
{
|
{
|
||||||
{ "Africa", "944,000,000", "31.2", africa },
|
{ "Africa", "944,000,000", "31.2", africa },
|
||||||
|
@ -300,13 +263,13 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
||||||
finalcut::FStringList continent_line ( continent_list->begin()
|
finalcut::FStringList continent_line ( continent_list->begin()
|
||||||
, continent_list->end() );
|
, continent_list->end() );
|
||||||
finalcut::FListViewIterator::FObjectIterator iter = \
|
finalcut::FListViewIterator::FObjectIterator iter = \
|
||||||
listView->insert (continent_line);
|
listView.insert (continent_line);
|
||||||
|
|
||||||
while ( country_list && country_list->name )
|
while ( country_list && country_list->name )
|
||||||
{
|
{
|
||||||
finalcut::FStringList country_line ( country_list->begin()
|
finalcut::FStringList country_line ( country_list->begin()
|
||||||
, country_list->end() );
|
, country_list->end() );
|
||||||
listView->insert (country_line, iter);
|
listView.insert (country_line, iter);
|
||||||
country_list++;
|
country_list++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,16 +277,17 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
Quit = new finalcut::FButton (this);
|
Quit.setGeometry(24, 16, 10, 1);
|
||||||
Quit->setGeometry(24, 16, 10, 1);
|
Quit.setText (L"&Quit");
|
||||||
Quit->setText (L"&Quit");
|
|
||||||
|
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
Quit->addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -342,11 +306,11 @@ void Treeview::adjustSize()
|
||||||
|
|
||||||
setX (X, false);
|
setX (X, false);
|
||||||
|
|
||||||
if ( listView )
|
if ( initialized )
|
||||||
listView->setHeight (getHeight() - 6, false);
|
{
|
||||||
|
listView.setHeight (getHeight() - 6, false);
|
||||||
if ( Quit )
|
Quit.setY(getHeight() - 4);
|
||||||
Quit->setY(getHeight() - 4);
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
593
examples/ui.cpp
593
examples/ui.cpp
|
@ -50,8 +50,8 @@ class ProgressDialog : public finalcut::FDialog
|
||||||
ProgressDialog& operator = (const ProgressDialog&);
|
ProgressDialog& operator = (const ProgressDialog&);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onShow (finalcut::FShowEvent*);
|
virtual void onShow (finalcut::FShowEvent*);
|
||||||
void onTimer (finalcut::FTimerEvent*);
|
virtual void onTimer (finalcut::FTimerEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_reset_bar (finalcut::FWidget*, data_ptr);
|
void cb_reset_bar (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -59,59 +59,55 @@ class ProgressDialog : public finalcut::FDialog
|
||||||
void cb_exit_bar (finalcut::FWidget*, data_ptr);
|
void cb_exit_bar (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FProgressbar* progressBar;
|
finalcut::FProgressbar progressBar;
|
||||||
finalcut::FButton* reset;
|
finalcut::FButton reset;
|
||||||
finalcut::FButton* more;
|
finalcut::FButton more;
|
||||||
finalcut::FButton* quit;
|
finalcut::FButton quit;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, progressBar()
|
, progressBar(this)
|
||||||
, reset()
|
, reset(this)
|
||||||
, more()
|
, more(this)
|
||||||
, quit()
|
, quit(this)
|
||||||
{
|
{
|
||||||
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
||||||
setText("Progress bar");
|
setText("Progress bar");
|
||||||
//setModal();
|
//setModal();
|
||||||
|
|
||||||
reset = new finalcut::FButton(this);
|
reset.setText("&Reset");
|
||||||
reset->setText("&Reset");
|
reset.setStatusbarMessage ("Reset the progress bar");
|
||||||
reset->setStatusbarMessage ("Reset the progress bar");
|
reset.setGeometry(2, 6, 8, 1, false);
|
||||||
reset->setGeometry(2, 6, 8, 1, false);
|
reset.setDisable();
|
||||||
reset->setDisable();
|
|
||||||
|
|
||||||
more = new finalcut::FButton(this);
|
more.setText("&More");
|
||||||
more->setText("&More");
|
more.setStatusbarMessage ("Increases the progress bar position");
|
||||||
more->setStatusbarMessage ("Increases the progress bar position");
|
more.setGeometry(15, 6, 8, 1, false);
|
||||||
more->setGeometry(15, 6, 8, 1, false);
|
more.setDisable();
|
||||||
more->setDisable();
|
|
||||||
|
|
||||||
quit = new finalcut::FButton(this);
|
quit.setText("E&xit");
|
||||||
quit->setText("E&xit");
|
quit.setGeometry(28, 6, 8, 1, false);
|
||||||
quit->setGeometry(28, 6, 8, 1, false);
|
quit.setDisable();
|
||||||
quit->setDisable();
|
|
||||||
|
|
||||||
progressBar = new finalcut::FProgressbar(this);
|
progressBar.setGeometry(2, 3, 34, 1, false);
|
||||||
progressBar->setGeometry(2, 3, 34, 1, false);
|
//progressBar.setPercentage(78);
|
||||||
//progressBar->setPercentage(78);
|
|
||||||
|
|
||||||
reset->addCallback
|
reset.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &ProgressDialog::cb_reset_bar)
|
F_METHOD_CALLBACK (this, &ProgressDialog::cb_reset_bar)
|
||||||
);
|
);
|
||||||
|
|
||||||
more->addCallback
|
more.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &ProgressDialog::cb_more_bar)
|
F_METHOD_CALLBACK (this, &ProgressDialog::cb_more_bar)
|
||||||
);
|
);
|
||||||
|
|
||||||
quit->addCallback
|
quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &ProgressDialog::cb_exit_bar)
|
F_METHOD_CALLBACK (this, &ProgressDialog::cb_exit_bar)
|
||||||
|
@ -122,13 +118,9 @@ ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
||||||
ProgressDialog::~ProgressDialog() // destructor
|
ProgressDialog::~ProgressDialog() // destructor
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
delCallback(quit);
|
delCallback(&quit);
|
||||||
delCallback(more);
|
delCallback(&more);
|
||||||
delCallback(reset);
|
delCallback(&reset);
|
||||||
delete(progressBar);
|
|
||||||
delete(quit);
|
|
||||||
delete(more);
|
|
||||||
delete(reset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -140,8 +132,8 @@ void ProgressDialog::onShow (finalcut::FShowEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
||||||
{
|
{
|
||||||
int p = progressBar->getPercentage();
|
int p = progressBar.getPercentage();
|
||||||
progressBar->setPercentage(++p);
|
progressBar.setPercentage(++p);
|
||||||
flush_out();
|
flush_out();
|
||||||
|
|
||||||
if ( p != 100 )
|
if ( p != 100 )
|
||||||
|
@ -150,10 +142,10 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
raiseWindow();
|
raiseWindow();
|
||||||
reset->setEnable();
|
reset.setEnable();
|
||||||
reset->setFocus();
|
reset.setFocus();
|
||||||
more->setEnable();
|
more.setEnable();
|
||||||
quit->setEnable();
|
quit.setEnable();
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
|
@ -166,14 +158,14 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ProgressDialog::cb_reset_bar (finalcut::FWidget*, data_ptr)
|
void ProgressDialog::cb_reset_bar (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
progressBar->reset();
|
progressBar.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
int p = progressBar->getPercentage();
|
int p = progressBar.getPercentage();
|
||||||
progressBar->setPercentage(++p);
|
progressBar.setPercentage(++p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -208,31 +200,30 @@ class TextWindow : public finalcut::FDialog
|
||||||
TextWindow& operator = (const TextWindow&);
|
TextWindow& operator = (const TextWindow&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FTextView* scrollText;
|
finalcut::FTextView scrollText;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
TextWindow::TextWindow (finalcut::FWidget* parent)
|
TextWindow::TextWindow (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, scrollText()
|
, scrollText(this)
|
||||||
{
|
{
|
||||||
scrollText = new finalcut::FTextView(this);
|
scrollText.ignorePadding();
|
||||||
scrollText->ignorePadding();
|
scrollText.setGeometry (1, 2, getWidth(), getHeight() - 1);
|
||||||
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
|
|
||||||
setMinimumSize (51, 6);
|
setMinimumSize (51, 6);
|
||||||
scrollText->setFocus();
|
scrollText.setFocus();
|
||||||
scrollText->insert(" -----------------------------------------------\n"
|
scrollText.insert(" -----------------------------------------------\n"
|
||||||
" line 1\n"
|
" line 1\n"
|
||||||
" -----------------------------------------------\n"
|
" -----------------------------------------------\n"
|
||||||
" line 3\n"
|
" line 3\n"
|
||||||
" line 4"
|
" line 4"
|
||||||
, -1);
|
, -1);
|
||||||
scrollText->replaceRange(" File viewer", 1, 1);
|
scrollText.replaceRange(" File viewer", 1, 1);
|
||||||
scrollText->deleteRange(3, 4);
|
scrollText.deleteRange(3, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -242,14 +233,14 @@ TextWindow::~TextWindow() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void TextWindow::append (const finalcut::FString& str)
|
void TextWindow::append (const finalcut::FString& str)
|
||||||
{
|
{
|
||||||
scrollText->append(str);
|
scrollText.append(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void TextWindow::adjustSize()
|
void TextWindow::adjustSize()
|
||||||
{
|
{
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
|
scrollText.setGeometry (1, 2, getWidth(), getHeight() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,7 +272,6 @@ class MyDialog : public finalcut::FDialog
|
||||||
void initEditMenuCallbacks();
|
void initEditMenuCallbacks();
|
||||||
void initViewMenuCallbacks();
|
void initViewMenuCallbacks();
|
||||||
void initHelpMenuCallback();
|
void initHelpMenuCallback();
|
||||||
void initStatusBar();
|
|
||||||
void initStatusBarCallbacks();
|
void initStatusBarCallbacks();
|
||||||
void initWidgets();
|
void initWidgets();
|
||||||
void initFlatButtons();
|
void initFlatButtons();
|
||||||
|
@ -289,10 +279,10 @@ class MyDialog : public finalcut::FDialog
|
||||||
void initButtons();
|
void initButtons();
|
||||||
void initLabels();
|
void initLabels();
|
||||||
void initWidgetsCallbacks();
|
void initWidgetsCallbacks();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_noFunctionMsg (finalcut::FWidget*, data_ptr);
|
void cb_noFunctionMsg (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -312,31 +302,53 @@ class MyDialog : public finalcut::FDialog
|
||||||
void cb_setInput (finalcut::FWidget*, data_ptr);
|
void cb_setInput (finalcut::FWidget*, data_ptr);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FMenuItem* Open;
|
bool initialized;
|
||||||
finalcut::FMenuItem* Quit;
|
finalcut::FMenuBar Menubar;
|
||||||
finalcut::FMenuItem* File1;
|
finalcut::FMenu File; // Menu bar items
|
||||||
finalcut::FMenuItem* File2;
|
finalcut::FMenu Edit;
|
||||||
finalcut::FMenuItem* File3;
|
finalcut::FMenu View;
|
||||||
finalcut::FMenuItem* Cut;
|
finalcut::FMenuItem Options;
|
||||||
finalcut::FMenuItem* Copy;
|
finalcut::FDialogListMenu Window;
|
||||||
finalcut::FMenuItem* Paste;
|
finalcut::FMenuItem Help;
|
||||||
finalcut::FMenuItem* Clear;
|
finalcut::FMenuItem Open; // "File" menu items
|
||||||
finalcut::FMenuItem* Env;
|
finalcut::FMenu Recent;
|
||||||
finalcut::FMenuItem* Drive;
|
finalcut::FMenuItem Line1;
|
||||||
finalcut::FMenuItem* Help;
|
finalcut::FMenuItem Quit;
|
||||||
finalcut::FStatusKey* key_F1;
|
finalcut::FMenuItem File1; // "Recent" menu items
|
||||||
finalcut::FStatusKey* key_F2;
|
finalcut::FMenuItem File2;
|
||||||
finalcut::FStatusKey* key_F3;
|
finalcut::FMenuItem File3;
|
||||||
finalcut::FButton* MyButton1;
|
finalcut::FMenuItem Undo;
|
||||||
finalcut::FButton* MyButton2;
|
finalcut::FMenuItem Redo;
|
||||||
finalcut::FButton* MyButton3;
|
finalcut::FMenuItem Line2;
|
||||||
finalcut::FButton* MyButton4;
|
finalcut::FMenuItem Cut;
|
||||||
finalcut::FButton* MyButton5;
|
finalcut::FMenuItem Copy;
|
||||||
finalcut::FButton* MyButton6;
|
finalcut::FMenuItem Paste;
|
||||||
finalcut::FRadioButton* radio1;
|
finalcut::FMenuItem Clear;
|
||||||
finalcut::FLabel* tagged_count;
|
finalcut::FMenuItem Env;
|
||||||
finalcut::FLineEdit* myLineEdit;
|
finalcut::FMenuItem Drive;
|
||||||
finalcut::FListBox* myList;
|
finalcut::FStatusBar Statusbar;
|
||||||
|
finalcut::FStatusKey key_F1;
|
||||||
|
finalcut::FStatusKey key_F2;
|
||||||
|
finalcut::FStatusKey key_F3;
|
||||||
|
finalcut::FButton MyButton1;
|
||||||
|
finalcut::FButton MyButton2;
|
||||||
|
finalcut::FButton MyButton3;
|
||||||
|
finalcut::FButtonGroup radioButtonGroup;
|
||||||
|
finalcut::FRadioButton radio1;
|
||||||
|
finalcut::FRadioButton radio2;
|
||||||
|
finalcut::FButtonGroup checkButtonGroup;
|
||||||
|
finalcut::FCheckBox check1;
|
||||||
|
finalcut::FCheckBox check2;
|
||||||
|
finalcut::FLineEdit myLineEdit;
|
||||||
|
finalcut::FButton MyButton4;
|
||||||
|
finalcut::FButton MyButton5;
|
||||||
|
finalcut::FButton MyButton6;
|
||||||
|
finalcut::FListBox myList;
|
||||||
|
finalcut::FLabel headline;
|
||||||
|
finalcut::FLabel tagged;
|
||||||
|
finalcut::FLabel tagged_count;
|
||||||
|
finalcut::FLabel sum;
|
||||||
|
finalcut::FLabel sum_count;
|
||||||
finalcut::FString clipboard;
|
finalcut::FString clipboard;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -344,39 +356,61 @@ class MyDialog : public finalcut::FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
MyDialog::MyDialog (finalcut::FWidget* parent)
|
MyDialog::MyDialog (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, Open()
|
, initialized(false)
|
||||||
, Quit()
|
, Menubar(this)
|
||||||
, File1()
|
, File("&File", &Menubar)
|
||||||
, File2()
|
, Edit("&Edit", &Menubar)
|
||||||
, File3()
|
, View("&View", &Menubar)
|
||||||
, Cut()
|
, Options("&Options", &Menubar)
|
||||||
, Copy()
|
, Window("&Window", &Menubar)
|
||||||
, Paste()
|
, Help("&Help", &Menubar)
|
||||||
, Clear()
|
, Open("&Open...", &File)
|
||||||
, Env()
|
, Recent("&System files", &File)
|
||||||
, Drive()
|
, Line1(&File)
|
||||||
, Help()
|
, Quit("&Quit", &File)
|
||||||
, key_F1()
|
, File1("/etc/services", &Recent)
|
||||||
, key_F2()
|
, File2("/etc/fstab", &Recent)
|
||||||
, key_F3()
|
, File3("/etc/passwd", &Recent)
|
||||||
, MyButton1()
|
, Undo(finalcut::fc::Fckey_z, "Undo", &Edit)
|
||||||
, MyButton2()
|
, Redo(finalcut::fc::Fckey_y, "Redo", &Edit)
|
||||||
, MyButton3()
|
, Line2(&Edit)
|
||||||
, MyButton4()
|
, Cut(finalcut::fc::Fckey_x, "Cu&t", &Edit)
|
||||||
, MyButton5()
|
, Copy(finalcut::fc::Fckey_c, "&Copy", &Edit)
|
||||||
, MyButton6()
|
, Paste(finalcut::fc::Fckey_v, "&Paste", &Edit)
|
||||||
, radio1()
|
, Clear(finalcut::fc::Fkey_dc, "C&lear", &Edit)
|
||||||
, tagged_count()
|
, Env("&Terminal...", &View)
|
||||||
, myLineEdit()
|
, Drive("&Drive symbols...", &View)
|
||||||
, myList()
|
, Statusbar(this)
|
||||||
|
, key_F1(finalcut::fc::Fkey_f1, "About", &Statusbar)
|
||||||
|
, key_F2(finalcut::fc::Fkey_f2, "View", &Statusbar)
|
||||||
|
, key_F3(finalcut::fc::Fkey_f3, "Quit", &Statusbar)
|
||||||
|
, MyButton1(this)
|
||||||
|
, MyButton2(this)
|
||||||
|
, MyButton3(this)
|
||||||
|
, radioButtonGroup("Button", this)
|
||||||
|
, radio1("E&nable", &radioButtonGroup)
|
||||||
|
, radio2(&radioButtonGroup)
|
||||||
|
, checkButtonGroup("Options", this)
|
||||||
|
, check1("&Bitmode", &checkButtonGroup)
|
||||||
|
, check2("&8-Bit", &checkButtonGroup)
|
||||||
|
, myLineEdit(this)
|
||||||
|
, MyButton4(this)
|
||||||
|
, MyButton5(this)
|
||||||
|
, MyButton6(this)
|
||||||
|
, myList(this)
|
||||||
|
, headline(this)
|
||||||
|
, tagged(L"Tagged:", this)
|
||||||
|
, tagged_count(this)
|
||||||
|
, sum(L"Sum:", this)
|
||||||
|
, sum_count(this)
|
||||||
, clipboard()
|
, clipboard()
|
||||||
{
|
{
|
||||||
initMenu(); // Initialize the program menu
|
initMenu(); // Initialize the program menu
|
||||||
initMenuCallbacks(); // Initialize program menu callbacks
|
initMenuCallbacks(); // Initialize program menu callbacks
|
||||||
initStatusBar(); // Initialize the status bar
|
|
||||||
initStatusBarCallbacks(); // Initialize status bar callbacks
|
initStatusBarCallbacks(); // Initialize status bar callbacks
|
||||||
initWidgets(); // Initialize the dialog widgets
|
initWidgets(); // Initialize the dialog widgets
|
||||||
initWidgetsCallbacks(); // Initialize dialog widget callbacks
|
initWidgetsCallbacks(); // Initialize dialog widget callbacks
|
||||||
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -386,69 +420,36 @@ MyDialog::~MyDialog() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::initMenu()
|
void MyDialog::initMenu()
|
||||||
{
|
{
|
||||||
// Menu bar
|
|
||||||
finalcut::FMenuBar* Menubar = new finalcut::FMenuBar (this);
|
|
||||||
|
|
||||||
// Menu bar items
|
// Menu bar items
|
||||||
finalcut::FMenu* File = new finalcut::FMenu ("&File", Menubar);
|
File.setStatusbarMessage ("File management commands");
|
||||||
File->setStatusbarMessage ("File management commands");
|
Edit.setStatusbarMessage ("Cut-and-paste editing commands");
|
||||||
finalcut::FMenu* Edit = new finalcut::FMenu ("&Edit", Menubar);
|
View.setStatusbarMessage ("Show internal informations");
|
||||||
Edit->setStatusbarMessage ("Cut-and-paste editing commands");
|
Options.setStatusbarMessage ("Set program defaults");
|
||||||
finalcut::FMenu* View = new finalcut::FMenu ("&View", Menubar);
|
Options.setDisable();
|
||||||
View->setStatusbarMessage ("Show internal informations");
|
Window.setStatusbarMessage ("List of all the active dialogs");
|
||||||
finalcut::FMenuItem* Options = \
|
Help.setStatusbarMessage ("Show version and copyright information");
|
||||||
new finalcut::FMenuItem ("&Options", Menubar);
|
|
||||||
Options->setStatusbarMessage ("Set program defaults");
|
|
||||||
Options->setDisable();
|
|
||||||
finalcut::FDialogListMenu* Window = \
|
|
||||||
new finalcut::FDialogListMenu ("&Window", Menubar);
|
|
||||||
Window->setStatusbarMessage ("List of all the active dialogs");
|
|
||||||
Help = new finalcut::FMenuItem ("&Help", Menubar);
|
|
||||||
Help->setStatusbarMessage ("Show version and copyright information");
|
|
||||||
|
|
||||||
// "File" menu items
|
// "File" menu items
|
||||||
Open = new finalcut::FMenuItem ("&Open...", File);
|
Open.addAccelerator (finalcut::fc::Fckey_o); // Ctrl + O
|
||||||
Open->addAccelerator (finalcut::fc::Fckey_o); // Ctrl + O
|
Open.setStatusbarMessage ("Locate and open a text file");
|
||||||
Open->setStatusbarMessage ("Locate and open a text file");
|
Recent.setStatusbarMessage ("View text file");
|
||||||
finalcut::FMenu* Recent = new finalcut::FMenu ("&System files", File);
|
Line1.setSeparator();
|
||||||
Recent->setStatusbarMessage ("View text file");
|
Quit.addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
||||||
|
Quit.setStatusbarMessage ("Exit the program");
|
||||||
finalcut::FMenuItem* Line1 = new finalcut::FMenuItem (File);
|
|
||||||
Line1->setSeparator();
|
|
||||||
Quit = new finalcut::FMenuItem ("&Quit", File);
|
|
||||||
Quit->addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
|
||||||
Quit->setStatusbarMessage ("Exit the program");
|
|
||||||
|
|
||||||
// "Recent" menu items
|
|
||||||
File1 = new finalcut::FMenuItem ("/etc/services", Recent);
|
|
||||||
File2 = new finalcut::FMenuItem ("/etc/fstab", Recent);
|
|
||||||
File3 = new finalcut::FMenuItem ("/etc/passwd", Recent);
|
|
||||||
|
|
||||||
// "Edit" menu items
|
// "Edit" menu items
|
||||||
finalcut::FMenuItem* Undo = \
|
Undo.setDisable();
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_z, "Undo", Edit);
|
Redo.setDisable();
|
||||||
Undo->setDisable();
|
Line2.setSeparator();
|
||||||
finalcut::FMenuItem* Redo = \
|
Cut.setStatusbarMessage ( "Remove the input text"
|
||||||
new finalcut::FMenuItem (finalcut::fc::Fckey_y, "Redo", Edit);
|
|
||||||
Redo->setDisable();
|
|
||||||
finalcut::FMenuItem* Line2 = \
|
|
||||||
new finalcut::FMenuItem (Edit);
|
|
||||||
Line2->setSeparator();
|
|
||||||
Cut = new finalcut::FMenuItem (finalcut::fc::Fckey_x, "Cu&t", Edit);
|
|
||||||
Cut->setStatusbarMessage ( "Remove the input text"
|
|
||||||
" and put it in the clipboard" );
|
" and put it in the clipboard" );
|
||||||
Copy= new finalcut::FMenuItem (finalcut::fc::Fckey_c, "&Copy", Edit);
|
Copy.setStatusbarMessage ("Copy the input text into the clipboad");
|
||||||
Copy->setStatusbarMessage ("Copy the input text into the clipboad");
|
Paste.setStatusbarMessage ("Insert text form clipboard");
|
||||||
Paste = new finalcut::FMenuItem (finalcut::fc::Fckey_v, "&Paste", Edit);
|
Clear.setStatusbarMessage ("Delete input text");
|
||||||
Paste->setStatusbarMessage ("Insert text form clipboard");
|
|
||||||
Clear = new finalcut::FMenuItem (finalcut::fc::Fkey_dc, "C&lear", Edit);
|
|
||||||
Clear->setStatusbarMessage ("Delete input text");
|
|
||||||
|
|
||||||
// "View" menu items
|
// "View" menu items
|
||||||
Env = new finalcut::FMenuItem ("&Terminal...", View);
|
Env.setStatusbarMessage ("Informations about this terminal");
|
||||||
Env->setStatusbarMessage ("Informations about this terminal");
|
Drive.setStatusbarMessage ("Show drive symbols");
|
||||||
Drive = new finalcut::FMenuItem ("&Drive symbols...", View);
|
|
||||||
Drive->setStatusbarMessage ("Show drive symbols");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -465,38 +466,38 @@ void MyDialog::initMenuCallbacks()
|
||||||
void MyDialog::initFileMenuCallbacks()
|
void MyDialog::initFileMenuCallbacks()
|
||||||
{
|
{
|
||||||
// File menu
|
// File menu
|
||||||
Open->addCallback
|
Open.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
||||||
);
|
);
|
||||||
|
|
||||||
Quit->addCallback
|
Quit.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
);
|
);
|
||||||
|
|
||||||
// System files submenu
|
// System files submenu
|
||||||
File1->addCallback
|
File1.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(File1)
|
static_cast<finalcut::FWidget::data_ptr>(&File1)
|
||||||
);
|
);
|
||||||
|
|
||||||
File2->addCallback
|
File2.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(File2)
|
static_cast<finalcut::FWidget::data_ptr>(&File2)
|
||||||
);
|
);
|
||||||
|
|
||||||
File3->addCallback
|
File3.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(File3)
|
static_cast<finalcut::FWidget::data_ptr>(&File3)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,25 +505,25 @@ void MyDialog::initFileMenuCallbacks()
|
||||||
void MyDialog::initEditMenuCallbacks()
|
void MyDialog::initEditMenuCallbacks()
|
||||||
{
|
{
|
||||||
// Edit menu
|
// Edit menu
|
||||||
Cut->addCallback
|
Cut.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_cutClipboard)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_cutClipboard)
|
||||||
);
|
);
|
||||||
|
|
||||||
Copy->addCallback
|
Copy.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_copyClipboard)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_copyClipboard)
|
||||||
);
|
);
|
||||||
|
|
||||||
Paste->addCallback
|
Paste.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_pasteClipboard)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_pasteClipboard)
|
||||||
);
|
);
|
||||||
|
|
||||||
Clear->addCallback
|
Clear.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_clearInput)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_clearInput)
|
||||||
|
@ -533,13 +534,13 @@ void MyDialog::initEditMenuCallbacks()
|
||||||
void MyDialog::initViewMenuCallbacks()
|
void MyDialog::initViewMenuCallbacks()
|
||||||
{
|
{
|
||||||
// View menu
|
// View menu
|
||||||
Env->addCallback
|
Env.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_terminfo)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_terminfo)
|
||||||
);
|
);
|
||||||
|
|
||||||
Drive->addCallback
|
Drive.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
||||||
|
@ -549,43 +550,31 @@ void MyDialog::initViewMenuCallbacks()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::initHelpMenuCallback()
|
void MyDialog::initHelpMenuCallback()
|
||||||
{
|
{
|
||||||
Help->addCallback
|
Help.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void MyDialog::initStatusBar()
|
|
||||||
{
|
|
||||||
// Statusbar at the bottom
|
|
||||||
finalcut::FStatusBar* Statusbar = new finalcut::FStatusBar (this);
|
|
||||||
|
|
||||||
// Statusbar keys
|
|
||||||
key_F1 = new finalcut::FStatusKey (finalcut::fc::Fkey_f1, "About", Statusbar);
|
|
||||||
key_F2 = new finalcut::FStatusKey (finalcut::fc::Fkey_f2, "View", Statusbar);
|
|
||||||
key_F3 = new finalcut::FStatusKey (finalcut::fc::Fkey_f3, "Quit", Statusbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::initStatusBarCallbacks()
|
void MyDialog::initStatusBarCallbacks()
|
||||||
{
|
{
|
||||||
// Add statusbar function callbacks
|
// Add statusbar function callbacks
|
||||||
|
|
||||||
key_F1->addCallback
|
key_F1.addCallback
|
||||||
(
|
(
|
||||||
"activate",
|
"activate",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
||||||
);
|
);
|
||||||
|
|
||||||
key_F2->addCallback
|
key_F2.addCallback
|
||||||
(
|
(
|
||||||
"activate",
|
"activate",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view)
|
||||||
);
|
);
|
||||||
|
|
||||||
key_F3->addCallback
|
key_F3.addCallback
|
||||||
(
|
(
|
||||||
"activate",
|
"activate",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
|
@ -602,24 +591,22 @@ void MyDialog::initWidgets()
|
||||||
initToggleButtons();
|
initToggleButtons();
|
||||||
|
|
||||||
// A text input field
|
// A text input field
|
||||||
myLineEdit = new finalcut::FLineEdit (this);
|
myLineEdit.setGeometry(22, 1, 10, 1);
|
||||||
myLineEdit->setGeometry(22, 1, 10, 1);
|
myLineEdit.setLabelText (L"&Input");
|
||||||
myLineEdit->setLabelText (L"&Input");
|
myLineEdit.setStatusbarMessage ("Press Enter to set the title");
|
||||||
myLineEdit->setStatusbarMessage ("Press Enter to set the title");
|
myLineEdit << finalcut::FString("EnTry").toLower();
|
||||||
*myLineEdit << finalcut::FString("EnTry").toLower();
|
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
initButtons();
|
initButtons();
|
||||||
|
|
||||||
// A multiple selection listbox
|
// A multiple selection listbox
|
||||||
myList = new finalcut::FListBox (this);
|
myList.setGeometry(38, 1, 14, 17);
|
||||||
myList->setGeometry(38, 1, 14, 17);
|
myList.setText ("Items");
|
||||||
myList->setText ("Items");
|
myList.setStatusbarMessage ("99 items in a list");
|
||||||
myList->setStatusbarMessage ("99 items in a list");
|
myList.setMultiSelection();
|
||||||
myList->setMultiSelection();
|
|
||||||
|
|
||||||
for (int z = 1; z < 100; z++)
|
for (int z = 1; z < 100; z++)
|
||||||
myList->insert (finalcut::FString() << z << L" placeholder");
|
myList.insert (finalcut::FString() << z << L" placeholder");
|
||||||
|
|
||||||
// Text labels
|
// Text labels
|
||||||
initLabels();
|
initLabels();
|
||||||
|
@ -629,43 +616,40 @@ void MyDialog::initWidgets()
|
||||||
void MyDialog::initFlatButtons()
|
void MyDialog::initFlatButtons()
|
||||||
{
|
{
|
||||||
// Flat buttons
|
// Flat buttons
|
||||||
MyButton1 = new finalcut::FButton (this);
|
MyButton1.setGeometry(3, 3, 5, 1);
|
||||||
MyButton1->setGeometry(3, 3, 5, 1);
|
MyButton1.setText (L"&SIN");
|
||||||
MyButton1->setText (L"&SIN");
|
MyButton1.setStatusbarMessage ("Sine function");
|
||||||
MyButton1->setStatusbarMessage ("Sine function");
|
MyButton1.setNoUnderline();
|
||||||
MyButton1->setNoUnderline();
|
MyButton1.setFlat();
|
||||||
MyButton1->setFlat();
|
MyButton1.setDoubleFlatLine (finalcut::fc::bottom);
|
||||||
MyButton1->setDoubleFlatLine (finalcut::fc::bottom);
|
|
||||||
|
|
||||||
MyButton2 = new finalcut::FButton (this);
|
MyButton2.setGeometry(3, 5, 5, 1);
|
||||||
MyButton2->setGeometry(3, 5, 5, 1);
|
MyButton2.setText (L"&COS");
|
||||||
MyButton2->setText (L"&COS");
|
MyButton2.setStatusbarMessage ("Cosine function");
|
||||||
MyButton2->setStatusbarMessage ("Cosine function");
|
MyButton2.setNoUnderline();
|
||||||
MyButton2->setNoUnderline();
|
MyButton2.setFlat();
|
||||||
MyButton2->setFlat();
|
MyButton2.setDoubleFlatLine (finalcut::fc::top);
|
||||||
MyButton2->setDoubleFlatLine (finalcut::fc::top);
|
|
||||||
|
|
||||||
MyButton3 = new finalcut::FButton (this);
|
MyButton3.setGeometry(10, 3, 5, 3);
|
||||||
MyButton3->setGeometry(10, 3, 5, 3);
|
MyButton3.setText (L"&=");
|
||||||
MyButton3->setText (L"&=");
|
MyButton3.setStatusbarMessage ("Equal");
|
||||||
MyButton3->setStatusbarMessage ("Equal");
|
MyButton3.setNoUnderline();
|
||||||
MyButton3->setNoUnderline();
|
MyButton3.setFlat();
|
||||||
MyButton3->setFlat();
|
|
||||||
|
|
||||||
// Add button callback functions
|
// Add button callback functions
|
||||||
MyButton1->addCallback
|
MyButton1.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
||||||
);
|
);
|
||||||
|
|
||||||
MyButton2->addCallback
|
MyButton2.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
||||||
);
|
);
|
||||||
|
|
||||||
MyButton3->addCallback
|
MyButton3.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_noFunctionMsg)
|
||||||
|
@ -676,77 +660,63 @@ void MyDialog::initFlatButtons()
|
||||||
void MyDialog::initToggleButtons()
|
void MyDialog::initToggleButtons()
|
||||||
{
|
{
|
||||||
// Radio buttons in a group
|
// Radio buttons in a group
|
||||||
finalcut::FButtonGroup* radioButtonGroup = \
|
radioButtonGroup.setGeometry(3, 8, 14, 4);
|
||||||
new finalcut::FButtonGroup ("Button", this);
|
|
||||||
radioButtonGroup->setGeometry(3, 8, 14, 4);
|
|
||||||
//radioButtonGroup->unsetBorder();
|
//radioButtonGroup->unsetBorder();
|
||||||
|
|
||||||
radio1 = new finalcut::FRadioButton ("E&nable", radioButtonGroup);
|
radio1.setGeometry(1, 1, 10, 1);
|
||||||
radio1->setGeometry(1, 1, 10, 1);
|
radio1.setStatusbarMessage ("Enable button Test");
|
||||||
radio1->setStatusbarMessage ("Enable button Test");
|
|
||||||
|
|
||||||
finalcut::FRadioButton* radio2 = \
|
radio2.setGeometry(1, 2, 11, 1);
|
||||||
new finalcut::FRadioButton (radioButtonGroup);
|
radio2.setText ("&Disable");
|
||||||
radio2->setGeometry(1, 2, 11, 1);
|
radio2.setStatusbarMessage ("Disable button Test");
|
||||||
radio2->setText ("&Disable");
|
radio2.setChecked();
|
||||||
radio2->setStatusbarMessage ("Disable button Test");
|
//radio2.setDisable();
|
||||||
radio2->setChecked();
|
|
||||||
//radio2->setDisable();
|
|
||||||
|
|
||||||
// Checkboxes in a group
|
// Checkboxes in a group
|
||||||
finalcut::FButtonGroup* checkButtonGroup = \
|
checkButtonGroup.setGeometry(3, 12, 14, 4);
|
||||||
new finalcut::FButtonGroup ("Options", this);
|
|
||||||
checkButtonGroup->setGeometry(3, 12, 14, 4);
|
|
||||||
|
|
||||||
finalcut::FCheckBox* check1 = \
|
check1.setGeometry(1, 1, 11, 1);
|
||||||
new finalcut::FCheckBox ("&Bitmode", checkButtonGroup);
|
check1.setNoUnderline();
|
||||||
check1->setGeometry(1, 1, 11, 1);
|
|
||||||
check1->setNoUnderline();
|
|
||||||
|
|
||||||
finalcut::FCheckBox* check2 = \
|
check2.setGeometry(1, 2, 9, 1);
|
||||||
new finalcut::FCheckBox ("&8-Bit", checkButtonGroup);
|
check2.setChecked();
|
||||||
check2->setGeometry(1, 2, 9, 1);
|
check2.setNoUnderline();
|
||||||
check2->setChecked();
|
|
||||||
check2->setNoUnderline();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::initButtons()
|
void MyDialog::initButtons()
|
||||||
{
|
{
|
||||||
// Buttons
|
// Buttons
|
||||||
MyButton4 = new finalcut::FButton (this);
|
MyButton4.setGeometry(20, 8, 12, 1);
|
||||||
MyButton4->setGeometry(20, 8, 12, 1);
|
MyButton4.setText (L"&Get input");
|
||||||
MyButton4->setText (L"&Get input");
|
MyButton4.setStatusbarMessage ("Take text from input field");
|
||||||
MyButton4->setStatusbarMessage ("Take text from input field");
|
MyButton4.setFocus();
|
||||||
MyButton4->setFocus();
|
|
||||||
|
|
||||||
MyButton5 = new finalcut::FButton (this);
|
MyButton5.setGeometry(20, 11, 12, 1);
|
||||||
MyButton5->setGeometry(20, 11, 12, 1);
|
MyButton5.setText (L"&Test");
|
||||||
MyButton5->setText (L"&Test");
|
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
|
||||||
MyButton5->setStatusbarMessage ("Progressbar testing dialog");
|
MyButton5.setDisable();
|
||||||
MyButton5->setDisable();
|
|
||||||
|
|
||||||
MyButton6 = new finalcut::FButton (this);
|
MyButton6.setGeometry(20, 14, 12, 1);
|
||||||
MyButton6->setGeometry(20, 14, 12, 1);
|
MyButton6.setText (L"&Quit");
|
||||||
MyButton6->setText (L"&Quit");
|
MyButton6.setStatusbarMessage ("Exit the program");
|
||||||
MyButton6->setStatusbarMessage ("Exit the program");
|
MyButton6.addAccelerator('x');
|
||||||
MyButton6->addAccelerator('x');
|
|
||||||
|
|
||||||
// Add button callback functions
|
// Add button callback functions
|
||||||
MyButton4->addCallback
|
MyButton4.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_input2buttonText),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_input2buttonText),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(myLineEdit)
|
static_cast<finalcut::FWidget::data_ptr>(&myLineEdit)
|
||||||
);
|
);
|
||||||
|
|
||||||
MyButton5->addCallback
|
MyButton5.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_ProgressBar)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_ProgressBar)
|
||||||
);
|
);
|
||||||
|
|
||||||
MyButton6->addCallback
|
MyButton6.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
|
@ -757,26 +727,21 @@ void MyDialog::initButtons()
|
||||||
void MyDialog::initLabels()
|
void MyDialog::initLabels()
|
||||||
{
|
{
|
||||||
// Text labels
|
// Text labels
|
||||||
finalcut::FLabel* headline = new finalcut::FLabel (this);
|
headline.setGeometry(21, 3, 10, 1);
|
||||||
headline->setGeometry(21, 3, 10, 1);
|
headline.setEmphasis();
|
||||||
headline->setEmphasis();
|
headline.setAlignment (finalcut::fc::alignCenter);
|
||||||
headline->setAlignment (finalcut::fc::alignCenter);
|
headline = L"List items";
|
||||||
*headline = L"List items";
|
|
||||||
|
|
||||||
finalcut::FLabel* tagged = new finalcut::FLabel (L"Tagged:", this);
|
tagged.setGeometry(21, 4, 7, 1);
|
||||||
tagged->setGeometry(21, 4, 7, 1);
|
|
||||||
|
|
||||||
tagged_count = new finalcut::FLabel(this);
|
tagged_count.setGeometry(29, 4, 5, 1);
|
||||||
tagged_count->setGeometry(29, 4, 5, 1);
|
tagged_count << 0;
|
||||||
*tagged_count << 0;
|
|
||||||
|
|
||||||
finalcut::FLabel* sum = new finalcut::FLabel (L"Sum:", this);
|
sum.setGeometry(21, 5, 7, 3);
|
||||||
sum->setGeometry(21, 5, 7, 3);
|
sum.setAlignment (finalcut::fc::alignRight);
|
||||||
sum->setAlignment (finalcut::fc::alignRight);
|
|
||||||
|
|
||||||
finalcut::FLabel* sum_count = new finalcut::FLabel (this);
|
sum_count.setGeometry(29, 5, 5, 3);
|
||||||
sum_count->setGeometry(29, 5, 5, 3);
|
sum_count << myList.getCount();
|
||||||
*sum_count << myList->getCount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -784,31 +749,31 @@ void MyDialog::initWidgetsCallbacks()
|
||||||
{
|
{
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
|
|
||||||
myLineEdit->addCallback
|
myLineEdit.addCallback
|
||||||
(
|
(
|
||||||
"activate", // e.g. on <Enter>
|
"activate", // e.g. on <Enter>
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_setTitlebar)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_setTitlebar)
|
||||||
);
|
);
|
||||||
|
|
||||||
radio1->addCallback
|
radio1.addCallback
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_activateButton),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_activateButton),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(MyButton5)
|
static_cast<finalcut::FWidget::data_ptr>(&MyButton5)
|
||||||
);
|
);
|
||||||
|
|
||||||
myList->addCallback
|
myList.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_setInput),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_setInput),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(myLineEdit)
|
static_cast<finalcut::FWidget::data_ptr>(&myLineEdit)
|
||||||
);
|
);
|
||||||
|
|
||||||
myList->addCallback
|
myList.addCallback
|
||||||
(
|
(
|
||||||
"row-selected",
|
"row-selected",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_updateNumber),
|
F_METHOD_CALLBACK (this, &MyDialog::cb_updateNumber),
|
||||||
static_cast<finalcut::FWidget::data_ptr>(tagged_count)
|
static_cast<finalcut::FWidget::data_ptr>(&tagged_count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,8 +789,8 @@ void MyDialog::adjustSize()
|
||||||
|
|
||||||
setX (X, false);
|
setX (X, false);
|
||||||
|
|
||||||
if ( myList )
|
if ( initialized )
|
||||||
myList->setHeight (getHeight() - 3, false);
|
myList.setHeight (getHeight() - 3, false);
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
@ -937,42 +902,30 @@ void MyDialog::cb_drives (finalcut::FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_cutClipboard (finalcut::FWidget*, data_ptr)
|
void MyDialog::cb_cutClipboard (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( ! myLineEdit )
|
clipboard = myLineEdit.getText();
|
||||||
return;
|
myLineEdit.clear();
|
||||||
|
myLineEdit.redraw();
|
||||||
clipboard = myLineEdit->getText();
|
|
||||||
myLineEdit->clear();
|
|
||||||
myLineEdit->redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_copyClipboard (finalcut::FWidget*, data_ptr)
|
void MyDialog::cb_copyClipboard (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( ! myLineEdit )
|
clipboard = myLineEdit.getText();
|
||||||
return;
|
|
||||||
|
|
||||||
clipboard = myLineEdit->getText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_pasteClipboard (finalcut::FWidget*, data_ptr)
|
void MyDialog::cb_pasteClipboard (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( ! myLineEdit )
|
myLineEdit = clipboard;
|
||||||
return;
|
myLineEdit.redraw();
|
||||||
|
|
||||||
*myLineEdit = clipboard;
|
|
||||||
myLineEdit->redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_clearInput (finalcut::FWidget*, data_ptr)
|
void MyDialog::cb_clearInput (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( ! myLineEdit )
|
|
||||||
return;
|
|
||||||
|
|
||||||
clipboard.clear();
|
clipboard.clear();
|
||||||
myLineEdit->clear();
|
myLineEdit.clear();
|
||||||
myLineEdit->redraw();
|
myLineEdit.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -44,8 +44,8 @@ class Watch : public finalcut::FDialog
|
||||||
void printTime();
|
void printTime();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onTimer (finalcut::FTimerEvent*);
|
virtual void onTimer (finalcut::FTimerEvent*);
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_clock (finalcut::FWidget*, data_ptr);
|
void cb_clock (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -53,7 +53,7 @@ class Watch : public finalcut::FDialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -64,10 +64,11 @@ class Watch : public finalcut::FDialog
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
bool sec;
|
bool sec;
|
||||||
finalcut::FLabel* time_label;
|
finalcut::FLabel time_label;
|
||||||
finalcut::FLabel* time_str;
|
finalcut::FLabel time_str;
|
||||||
finalcut::FSwitch* clock_sw;
|
finalcut::FSwitch clock_sw;
|
||||||
finalcut::FSwitch* seconds_sw;
|
finalcut::FSwitch seconds_sw;
|
||||||
|
finalcut::FButton quit_btn;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -75,49 +76,45 @@ class Watch : public finalcut::FDialog
|
||||||
Watch::Watch (FWidget* parent)
|
Watch::Watch (FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, sec(true)
|
, sec(true)
|
||||||
, time_label(0)
|
, time_label(L"Time", this)
|
||||||
, time_str(0)
|
, time_str(L"--:--:--", this)
|
||||||
, clock_sw(0)
|
, clock_sw(L"Clock", this)
|
||||||
, seconds_sw(0)
|
, seconds_sw(L"Seconds", this)
|
||||||
|
, quit_btn(L"&Quit", this)
|
||||||
{
|
{
|
||||||
setText ("Watch");
|
setText ("Watch");
|
||||||
int pw = getParentWidget()->getWidth();
|
int pw = getParentWidget()->getWidth();
|
||||||
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
||||||
|
|
||||||
// Create labels
|
// Labels
|
||||||
time_label = new finalcut::FLabel(L"Time", this);
|
time_label.setGeometry(5, 2, 5, 1);
|
||||||
time_label->setGeometry(5, 2, 5, 1);
|
time_label.setEmphasis();
|
||||||
time_label->setEmphasis();
|
time_str.setGeometry(10, 2, 8, 1);
|
||||||
time_str = new finalcut::FLabel(L"--:--:--", this);
|
|
||||||
time_str->setGeometry(10, 2, 8, 1);
|
|
||||||
|
|
||||||
// Create checkbox buttons
|
// Checkbox buttons
|
||||||
clock_sw = new finalcut::FSwitch(L"Clock", this);
|
clock_sw.setGeometry(4, 4, 9, 1);
|
||||||
seconds_sw = new finalcut::FSwitch(L"Seconds", this);
|
seconds_sw.setGeometry(2, 6, 11, 1);
|
||||||
clock_sw->setGeometry(4, 4, 9, 1);
|
sec = seconds_sw.setChecked();
|
||||||
seconds_sw->setGeometry(2, 6, 11, 1);
|
|
||||||
sec = seconds_sw->setChecked();
|
|
||||||
|
|
||||||
// Create button
|
// Quit button
|
||||||
finalcut::FButton* quit_btn = new finalcut::FButton(L"&Quit", this);
|
quit_btn.setGeometry(6, 9, 9, 1);
|
||||||
quit_btn->setGeometry(6, 9, 9, 1);
|
|
||||||
|
|
||||||
// Connect switch signal "toggled" with a callback member function
|
// Connect switch signal "toggled" with a callback member function
|
||||||
clock_sw->addCallback
|
clock_sw.addCallback
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (this, &Watch::cb_clock)
|
F_METHOD_CALLBACK (this, &Watch::cb_clock)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Connect switch signal "toggled" with a callback member function
|
// Connect switch signal "toggled" with a callback member function
|
||||||
seconds_sw->addCallback
|
seconds_sw.addCallback
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (this, &Watch::cb_seconds)
|
F_METHOD_CALLBACK (this, &Watch::cb_seconds)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Connect button signal "clicked" with a callback member function
|
// Connect button signal "clicked" with a callback member function
|
||||||
quit_btn->addCallback
|
quit_btn.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||||
|
@ -145,8 +142,8 @@ void Watch::printTime()
|
||||||
else
|
else
|
||||||
str.sprintf("%02d:%02d ", now.tm_hour, now.tm_min);
|
str.sprintf("%02d:%02d ", now.tm_hour, now.tm_min);
|
||||||
|
|
||||||
*time_str = str;
|
time_str = str;
|
||||||
time_str->redraw();
|
time_str.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -164,7 +161,7 @@ void Watch::onClose (finalcut::FCloseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Watch::cb_clock (finalcut::FWidget*, data_ptr)
|
void Watch::cb_clock (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( clock_sw->isChecked() )
|
if ( clock_sw.isChecked() )
|
||||||
{
|
{
|
||||||
printTime();
|
printTime();
|
||||||
addTimer(1000);
|
addTimer(1000);
|
||||||
|
@ -172,29 +169,29 @@ void Watch::cb_clock (finalcut::FWidget*, data_ptr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delAllTimer();
|
delAllTimer();
|
||||||
*time_str = "--:--:--";
|
time_str = "--:--:--";
|
||||||
time_str->redraw();
|
time_str.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Watch::cb_seconds (finalcut::FWidget*, data_ptr)
|
void Watch::cb_seconds (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( seconds_sw->isChecked() )
|
if ( seconds_sw.isChecked() )
|
||||||
sec = true;
|
sec = true;
|
||||||
else
|
else
|
||||||
sec = false;
|
sec = false;
|
||||||
|
|
||||||
if ( clock_sw->isChecked() )
|
if ( clock_sw.isChecked() )
|
||||||
printTime();
|
printTime();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( sec )
|
if ( sec )
|
||||||
*time_str = "--:--:--";
|
time_str = "--:--:--";
|
||||||
else
|
else
|
||||||
*time_str = "--:-- ";
|
time_str = "--:-- ";
|
||||||
|
|
||||||
time_str->redraw();
|
time_str.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,68 +48,65 @@ class SmallWindow : public finalcut::FDialog
|
||||||
SmallWindow& operator = (const SmallWindow&);
|
SmallWindow& operator = (const SmallWindow&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onShow (finalcut::FShowEvent*);
|
virtual void onShow (finalcut::FShowEvent*);
|
||||||
void onTimer (finalcut::FTimerEvent*);
|
virtual void onTimer (finalcut::FTimerEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
finalcut::FLabel* left_arrow;
|
finalcut::FLabel left_arrow;
|
||||||
finalcut::FLabel* right_arrow;
|
finalcut::FLabel right_arrow;
|
||||||
finalcut::FLabel* top_left_label;
|
finalcut::FLabel top_left_label;
|
||||||
finalcut::FLabel* top_right_label;
|
finalcut::FLabel top_right_label;
|
||||||
finalcut::FLabel* bottom_label;
|
finalcut::FLabel bottom_label;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, left_arrow()
|
, left_arrow(this)
|
||||||
, right_arrow()
|
, right_arrow(this)
|
||||||
, top_left_label()
|
, top_left_label(this)
|
||||||
, top_right_label()
|
, top_right_label(this)
|
||||||
, bottom_label()
|
, bottom_label(this)
|
||||||
{
|
{
|
||||||
wchar_t arrow_up, arrow_down;
|
wchar_t arrow_up, arrow_down;
|
||||||
|
|
||||||
arrow_up = finalcut::fc::BlackUpPointingTriangle;
|
arrow_up = finalcut::fc::BlackUpPointingTriangle;
|
||||||
arrow_down = finalcut::fc::BlackDownPointingTriangle;
|
arrow_down = finalcut::fc::BlackDownPointingTriangle;
|
||||||
|
|
||||||
left_arrow = new finalcut::FLabel (arrow_up, this);
|
left_arrow = arrow_up;
|
||||||
left_arrow->setForegroundColor (wc.label_inactive_fg);
|
left_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||||
left_arrow->setEmphasis();
|
left_arrow.setEmphasis();
|
||||||
left_arrow->ignorePadding();
|
left_arrow.ignorePadding();
|
||||||
left_arrow->setGeometry (2, 2, 1, 1);
|
left_arrow.setGeometry (2, 2, 1, 1);
|
||||||
|
|
||||||
right_arrow = new finalcut::FLabel (arrow_up, this);
|
right_arrow = arrow_up;
|
||||||
right_arrow->setForegroundColor (wc.label_inactive_fg);
|
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||||
right_arrow->setEmphasis();
|
right_arrow.setEmphasis();
|
||||||
right_arrow->ignorePadding();
|
right_arrow.ignorePadding();
|
||||||
right_arrow->setGeometry (getWidth() - 1, 2, 1, 1);
|
right_arrow.setGeometry (getWidth() - 1, 2, 1, 1);
|
||||||
|
|
||||||
const finalcut::FString& top_left_label_text = "menu";
|
top_left_label = "menu";
|
||||||
top_left_label = new finalcut::FLabel (top_left_label_text, this);
|
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
top_left_label->setForegroundColor (wc.label_inactive_fg);
|
top_left_label.setEmphasis();
|
||||||
top_left_label->setEmphasis();
|
top_left_label.setGeometry (1, 1, 6, 1);
|
||||||
top_left_label->setGeometry (1, 1, 6, 1);
|
|
||||||
|
|
||||||
const finalcut::FString& top_right_label_text = "zoom";
|
top_right_label = "zoom";
|
||||||
top_right_label = new finalcut::FLabel (top_right_label_text, this);
|
top_right_label.setAlignment (finalcut::fc::alignRight);
|
||||||
top_right_label->setAlignment (finalcut::fc::alignRight);
|
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
top_right_label->setForegroundColor (wc.label_inactive_fg);
|
top_right_label.setEmphasis();
|
||||||
top_right_label->setEmphasis();
|
top_right_label.setGeometry (getClientWidth() - 5, 1, 6, 1);
|
||||||
top_right_label->setGeometry (getClientWidth() - 5, 1, 6, 1);
|
|
||||||
|
|
||||||
finalcut::FString bottom_label_text = "resize\n"
|
finalcut::FString bottom_label_text = "resize\n"
|
||||||
"corner\n";
|
"corner\n";
|
||||||
bottom_label_text += arrow_down;
|
bottom_label_text += arrow_down;
|
||||||
bottom_label = new finalcut::FLabel (bottom_label_text, this);
|
bottom_label = bottom_label_text;
|
||||||
bottom_label->setAlignment (finalcut::fc::alignRight);
|
bottom_label.setAlignment (finalcut::fc::alignRight);
|
||||||
bottom_label->setForegroundColor (wc.label_inactive_fg);
|
bottom_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
bottom_label->setEmphasis();
|
bottom_label.setEmphasis();
|
||||||
bottom_label->setGeometry (13, 3, 6, 3);
|
bottom_label.setGeometry (13, 3, 6, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -124,19 +121,19 @@ void SmallWindow::adjustSize()
|
||||||
{
|
{
|
||||||
if ( isZoomed() )
|
if ( isZoomed() )
|
||||||
{
|
{
|
||||||
*top_right_label = "unzoom";
|
top_right_label = "unzoom";
|
||||||
bottom_label->hide();
|
bottom_label.hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*top_right_label = "zoom";
|
top_right_label = "zoom";
|
||||||
bottom_label->setVisible();
|
bottom_label.setVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
right_arrow->setGeometry (getWidth() - 1, 2, 1, 1);
|
right_arrow.setGeometry (getWidth() - 1, 2, 1, 1);
|
||||||
top_right_label->setGeometry (getClientWidth() - 5, 1, 6, 1);
|
top_right_label.setGeometry (getClientWidth() - 5, 1, 6, 1);
|
||||||
bottom_label->setGeometry (1, getClientHeight() - 2, getClientWidth(), 3);
|
bottom_label.setGeometry (1, getClientHeight() - 2, getClientWidth(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -148,16 +145,16 @@ void SmallWindow::onShow (finalcut::FShowEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void SmallWindow::onTimer (finalcut::FTimerEvent*)
|
void SmallWindow::onTimer (finalcut::FTimerEvent*)
|
||||||
{
|
{
|
||||||
left_arrow->unsetEmphasis();
|
left_arrow.unsetEmphasis();
|
||||||
left_arrow->redraw();
|
left_arrow.redraw();
|
||||||
right_arrow->unsetEmphasis();
|
right_arrow.unsetEmphasis();
|
||||||
right_arrow->redraw();
|
right_arrow.redraw();
|
||||||
top_left_label->unsetEmphasis();
|
top_left_label.unsetEmphasis();
|
||||||
top_left_label->redraw();
|
top_left_label.redraw();
|
||||||
top_right_label->unsetEmphasis();
|
top_right_label.unsetEmphasis();
|
||||||
top_right_label->redraw();
|
top_right_label.redraw();
|
||||||
bottom_label->unsetEmphasis();
|
bottom_label.unsetEmphasis();
|
||||||
bottom_label->redraw();
|
bottom_label.redraw();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
}
|
}
|
||||||
|
@ -183,13 +180,27 @@ class Window : public finalcut::FDialog
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr);
|
typedef void (Window::*WindowCallback)(finalcut::FWidget*, data_ptr);
|
||||||
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr);
|
typedef void (finalcut::FApplication::*FAppCallback)(finalcut::FWidget*, data_ptr);
|
||||||
typedef struct
|
|
||||||
|
class win_data
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
win_data()
|
||||||
|
: is_open(false)
|
||||||
|
, title()
|
||||||
|
, dgl(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// Data Members
|
||||||
bool is_open;
|
bool is_open;
|
||||||
finalcut::FString* title;
|
finalcut::FString title;
|
||||||
SmallWindow* dgl;
|
SmallWindow* dgl;
|
||||||
}
|
|
||||||
win_data;
|
private:
|
||||||
|
// Disable copy constructor
|
||||||
|
win_data (const win_data&);
|
||||||
|
// Disable assignment operator (=)
|
||||||
|
win_data& operator = (const win_data&);
|
||||||
|
};
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
Window (const Window&);
|
Window (const Window&);
|
||||||
|
@ -198,15 +209,15 @@ class Window : public finalcut::FDialog
|
||||||
Window& operator = (const Window&);
|
Window& operator = (const Window&);
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void createFileMenuItems (finalcut::FMenu*);
|
void configureFileMenuItems();
|
||||||
void createDialogButtons();
|
void configureDialogButtons();
|
||||||
void activateWindow (finalcut::FDialog*);
|
void activateWindow (finalcut::FDialog*);
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
void addClickedCallback (finalcut::FWidget*, WindowCallback);
|
void addClickedCallback (finalcut::FWidget*, WindowCallback);
|
||||||
void addClickedCallback (finalcut::FWidget*, FAppCallback);
|
void addClickedCallback (finalcut::FWidget*, FAppCallback);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onClose (finalcut::FCloseEvent*);
|
virtual void onClose (finalcut::FCloseEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_createWindows (finalcut::FWidget*, data_ptr);
|
void cb_createWindows (finalcut::FWidget*, data_ptr);
|
||||||
|
@ -217,6 +228,21 @@ class Window : public finalcut::FDialog
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
std::vector<win_data*> windows;
|
std::vector<win_data*> windows;
|
||||||
|
finalcut::FString drop_down_symbol;
|
||||||
|
finalcut::FMenuBar Menubar;
|
||||||
|
finalcut::FMenu File;
|
||||||
|
finalcut::FDialogListMenu DglList;
|
||||||
|
finalcut::FStatusBar Statusbar;
|
||||||
|
finalcut::FMenuItem New;
|
||||||
|
finalcut::FMenuItem Close;
|
||||||
|
finalcut::FMenuItem Line1;
|
||||||
|
finalcut::FMenuItem Next;
|
||||||
|
finalcut::FMenuItem Previous;
|
||||||
|
finalcut::FMenuItem Line2;
|
||||||
|
finalcut::FMenuItem Quit;
|
||||||
|
finalcut::FButton CreateButton;
|
||||||
|
finalcut::FButton CloseButton;
|
||||||
|
finalcut::FButton QuitButton;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -224,42 +250,42 @@ class Window : public finalcut::FDialog
|
||||||
Window::Window (finalcut::FWidget* parent)
|
Window::Window (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
, windows()
|
, windows()
|
||||||
|
, drop_down_symbol(wchar_t(finalcut::fc::BlackDownPointingTriangle))
|
||||||
|
, Menubar(this)
|
||||||
|
, File("&File", &Menubar)
|
||||||
|
, DglList(drop_down_symbol, &Menubar)
|
||||||
|
, Statusbar(this)
|
||||||
|
, New("&New", &File)
|
||||||
|
, Close("&Close", &File)
|
||||||
|
, Line1(&File)
|
||||||
|
, Next("Ne&xt window", &File)
|
||||||
|
, Previous("&Previous window", &File)
|
||||||
|
, Line2(&File)
|
||||||
|
, Quit("&Quit", &File)
|
||||||
|
, CreateButton(this)
|
||||||
|
, CloseButton(this)
|
||||||
|
, QuitButton(this)
|
||||||
{
|
{
|
||||||
finalcut::FMenu* File;
|
|
||||||
finalcut::FDialogListMenu* DglList;
|
|
||||||
finalcut::FString drop_down_symbol;
|
|
||||||
finalcut::FMenuBar* Menubar;
|
|
||||||
finalcut::FStatusBar* Statusbar;
|
|
||||||
|
|
||||||
// Menu bar
|
|
||||||
Menubar = new finalcut::FMenuBar (this);
|
|
||||||
|
|
||||||
// Menu bar item
|
// Menu bar item
|
||||||
File = new finalcut::FMenu ("&File", Menubar);
|
File.setStatusbarMessage ("File management commands");
|
||||||
File->setStatusbarMessage ("File management commands");
|
|
||||||
|
|
||||||
// Dialog list menu item
|
// Dialog list menu item
|
||||||
drop_down_symbol = wchar_t(finalcut::fc::BlackDownPointingTriangle);
|
DglList.setStatusbarMessage ("List of all the active dialogs");
|
||||||
DglList = new finalcut::FDialogListMenu (drop_down_symbol, Menubar);
|
|
||||||
DglList->setStatusbarMessage ("List of all the active dialogs");
|
|
||||||
|
|
||||||
// File menu items
|
// File menu items
|
||||||
createFileMenuItems (File);
|
configureFileMenuItems();
|
||||||
|
|
||||||
// Dialog buttons
|
// Dialog buttons
|
||||||
createDialogButtons();
|
configureDialogButtons();
|
||||||
|
|
||||||
// Statusbar at the bottom
|
// Statusbar at the bottom
|
||||||
Statusbar = new finalcut::FStatusBar (this);
|
Statusbar.setMessage("Status bar message");
|
||||||
Statusbar->setMessage("Status bar message");
|
|
||||||
|
|
||||||
// Generate data vector for the windows
|
// Generate data vector for the windows
|
||||||
for (int n = 1; n <= 6; n++)
|
for (int n = 1; n <= 6; n++)
|
||||||
{
|
{
|
||||||
win_data* win_dat = new win_data;
|
win_data* win_dat = new win_data;
|
||||||
win_dat->is_open = false;
|
win_dat->title.sprintf("Window %d", n);
|
||||||
win_dat->title = new finalcut::FString();
|
|
||||||
win_dat->title->sprintf("Window %d", n);
|
|
||||||
windows.push_back(win_dat);
|
windows.push_back(win_dat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,68 +304,49 @@ Window::~Window()
|
||||||
if ( win_dat->is_open && win_dat->dgl )
|
if ( win_dat->is_open && win_dat->dgl )
|
||||||
win_dat->dgl->delCallbacks();
|
win_dat->dgl->delCallbacks();
|
||||||
|
|
||||||
delete win_dat->title;
|
|
||||||
delete win_dat;
|
delete win_dat;
|
||||||
iter = windows.erase(iter);
|
iter = windows.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::createFileMenuItems (finalcut::FMenu* File)
|
void Window::configureFileMenuItems()
|
||||||
{
|
{
|
||||||
// "File" menu item
|
// "File" menu item setting
|
||||||
finalcut::FMenuItem* New = new finalcut::FMenuItem ("&New", File);
|
New.setStatusbarMessage ("Create the windows");
|
||||||
New->setStatusbarMessage ("Create the windows");
|
Close.setStatusbarMessage ("Close the windows");
|
||||||
|
Line1.setSeparator();
|
||||||
finalcut::FMenuItem* Close = new finalcut::FMenuItem ("&Close", File);
|
Next.addAccelerator (finalcut::fc::Fmkey_npage); // Meta/Alt + PgDn
|
||||||
Close->setStatusbarMessage ("Close the windows");
|
Next.setStatusbarMessage ("Switch to the next window");
|
||||||
|
Previous.addAccelerator (finalcut::fc::Fmkey_ppage); // Meta/Alt + PgUp
|
||||||
finalcut::FMenuItem* Line1 = new finalcut::FMenuItem (File);
|
Previous.setStatusbarMessage ("Switch to the previous window");
|
||||||
Line1->setSeparator();
|
Line2.setSeparator();
|
||||||
|
Quit.addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
||||||
finalcut::FMenuItem* Next = new finalcut::FMenuItem ("Ne&xt window", File);
|
Quit.setStatusbarMessage ("Exit the program");
|
||||||
Next->addAccelerator (finalcut::fc::Fmkey_npage); // Meta/Alt + PgDn
|
|
||||||
Next->setStatusbarMessage ("Switch to the next window");
|
|
||||||
|
|
||||||
finalcut::FMenuItem* Previous = new finalcut::FMenuItem ("&Previous window", File);
|
|
||||||
Previous->addAccelerator (finalcut::fc::Fmkey_ppage); // Meta/Alt + PgUp
|
|
||||||
Previous->setStatusbarMessage ("Switch to the previous window");
|
|
||||||
|
|
||||||
finalcut::FMenuItem* Line2 = new finalcut::FMenuItem (File);
|
|
||||||
Line2->setSeparator();
|
|
||||||
|
|
||||||
finalcut::FMenuItem* Quit = new finalcut::FMenuItem ("&Quit", File);
|
|
||||||
Quit->addAccelerator (finalcut::fc::Fmkey_x); // Meta/Alt + X
|
|
||||||
Quit->setStatusbarMessage ("Exit the program");
|
|
||||||
|
|
||||||
// Add menu item callback
|
// Add menu item callback
|
||||||
addClickedCallback (New, &Window::cb_createWindows);
|
addClickedCallback (&New, &Window::cb_createWindows);
|
||||||
addClickedCallback (Close, &Window::cb_closeWindows);
|
addClickedCallback (&Close, &Window::cb_closeWindows);
|
||||||
addClickedCallback (Next, &Window::cb_next);
|
addClickedCallback (&Next, &Window::cb_next);
|
||||||
addClickedCallback (Previous, &Window::cb_previous);
|
addClickedCallback (&Previous, &Window::cb_previous);
|
||||||
addClickedCallback (Quit, &finalcut::FApplication::cb_exitApp);
|
addClickedCallback (&Quit, &finalcut::FApplication::cb_exitApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Window::createDialogButtons()
|
void Window::configureDialogButtons()
|
||||||
{
|
{
|
||||||
// Dialog buttons
|
// Dialog buttons
|
||||||
finalcut::FButton* CreateButton = new finalcut::FButton (this);
|
CreateButton.setGeometry (2, 2, 9, 1);
|
||||||
CreateButton->setGeometry(2, 2, 9, 1);
|
CreateButton.setText (L"&Create");
|
||||||
CreateButton->setText (L"&Create");
|
CloseButton.setGeometry (15, 2, 9, 1);
|
||||||
|
CloseButton.setText (L"C&lose");
|
||||||
finalcut::FButton* CloseButton = new finalcut::FButton (this);
|
QuitButton.setGeometry (28, 2, 9, 1);
|
||||||
CloseButton->setGeometry(15, 2, 9, 1);
|
QuitButton.setText (L"&Quit");
|
||||||
CloseButton->setText (L"C&lose");
|
|
||||||
|
|
||||||
finalcut::FButton* QuitButton = new finalcut::FButton (this);
|
|
||||||
QuitButton->setGeometry(28, 2, 9, 1);
|
|
||||||
QuitButton->setText (L"&Quit");
|
|
||||||
|
|
||||||
// Add button callback
|
// Add button callback
|
||||||
addClickedCallback (CreateButton, &Window::cb_createWindows);
|
addClickedCallback (&CreateButton, &Window::cb_createWindows);
|
||||||
addClickedCallback (CloseButton, &Window::cb_closeWindows);
|
addClickedCallback (&CloseButton, &Window::cb_closeWindows);
|
||||||
addClickedCallback (QuitButton, &finalcut::FApplication::cb_exitApp);
|
addClickedCallback (&QuitButton, &finalcut::FApplication::cb_exitApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -442,7 +449,7 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
||||||
SmallWindow* win = new SmallWindow(this);
|
SmallWindow* win = new SmallWindow(this);
|
||||||
win_dat->dgl = win;
|
win_dat->dgl = win;
|
||||||
win_dat->is_open = true;
|
win_dat->is_open = true;
|
||||||
win->setText(*(win_dat)->title);
|
win->setText(win_dat->title);
|
||||||
int n = int(std::distance(first, iter))
|
int n = int(std::distance(first, iter))
|
||||||
, x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3
|
, x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3
|
||||||
, y = dy + 11 + int(n / 3) * 3;
|
, y = dy + 11 + int(n / 3) * 3;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
|
@ -11,7 +11,7 @@
|
||||||
version="1.1"
|
version="1.1"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
viewBox="0 0 750 128"
|
viewBox="0 0 650 128"
|
||||||
id="svg2"
|
id="svg2"
|
||||||
style="fill-rule:evenodd">
|
style="fill-rule:evenodd">
|
||||||
<metadata
|
<metadata
|
||||||
|
@ -27,7 +27,142 @@
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
</metadata>
|
</metadata>
|
||||||
<defs
|
<defs
|
||||||
id="defs43" />
|
id="defs43">
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3784"
|
||||||
|
xlink:href="#a"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3792"
|
||||||
|
xlink:href="#a"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3792-9"
|
||||||
|
xlink:href="#a-8"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<radialGradient
|
||||||
|
cx="134.06599"
|
||||||
|
cy="79.788696"
|
||||||
|
r="40.1213"
|
||||||
|
fx="134.06599"
|
||||||
|
fy="79.788696"
|
||||||
|
id="a-8"
|
||||||
|
gradientUnits="userSpaceOnUse">
|
||||||
|
<stop
|
||||||
|
id="stop5-1"
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1"
|
||||||
|
offset="0" />
|
||||||
|
<stop
|
||||||
|
id="stop7-0"
|
||||||
|
style="stop-color:#999999;stop-opacity:1"
|
||||||
|
offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3808"
|
||||||
|
xlink:href="#a-8"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<radialGradient
|
||||||
|
cx="134.06599"
|
||||||
|
cy="79.788696"
|
||||||
|
r="40.1213"
|
||||||
|
fx="134.06599"
|
||||||
|
fy="79.788696"
|
||||||
|
id="radialGradient3810"
|
||||||
|
gradientUnits="userSpaceOnUse">
|
||||||
|
<stop
|
||||||
|
id="stop3812"
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1"
|
||||||
|
offset="0" />
|
||||||
|
<stop
|
||||||
|
id="stop3814"
|
||||||
|
style="stop-color:#999999;stop-opacity:1"
|
||||||
|
offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3818"
|
||||||
|
xlink:href="#a-8"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(-153.08409,-173.48831)" />
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3792-0"
|
||||||
|
xlink:href="#a-1"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<radialGradient
|
||||||
|
cx="134.06599"
|
||||||
|
cy="79.788696"
|
||||||
|
r="40.1213"
|
||||||
|
fx="134.06599"
|
||||||
|
fy="79.788696"
|
||||||
|
id="a-1"
|
||||||
|
gradientUnits="userSpaceOnUse">
|
||||||
|
<stop
|
||||||
|
id="stop5-0"
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1"
|
||||||
|
offset="0" />
|
||||||
|
<stop
|
||||||
|
id="stop7-2"
|
||||||
|
style="stop-color:#999999;stop-opacity:1"
|
||||||
|
offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3861"
|
||||||
|
xlink:href="#a-1"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<radialGradient
|
||||||
|
cx="134.06599"
|
||||||
|
cy="79.788696"
|
||||||
|
r="40.1213"
|
||||||
|
fx="134.06599"
|
||||||
|
fy="79.788696"
|
||||||
|
id="radialGradient3863"
|
||||||
|
gradientUnits="userSpaceOnUse">
|
||||||
|
<stop
|
||||||
|
id="stop3865"
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1"
|
||||||
|
offset="0" />
|
||||||
|
<stop
|
||||||
|
id="stop3867"
|
||||||
|
style="stop-color:#999999;stop-opacity:1"
|
||||||
|
offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient
|
||||||
|
x1="165.74928"
|
||||||
|
y1="57.311855"
|
||||||
|
x2="674.01331"
|
||||||
|
y2="57.311855"
|
||||||
|
id="linearGradient3871"
|
||||||
|
xlink:href="#a-1"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(0.378418,-0.44196145)" />
|
||||||
|
</defs>
|
||||||
<radialGradient
|
<radialGradient
|
||||||
cx="134.06599"
|
cx="134.06599"
|
||||||
cy="79.788696"
|
cy="79.788696"
|
||||||
|
@ -107,6 +242,18 @@
|
||||||
xlink:href="#e"
|
xlink:href="#e"
|
||||||
gradientUnits="userSpaceOnUse"
|
gradientUnits="userSpaceOnUse"
|
||||||
gradientTransform="matrix(0.9999964,0,0,1,-39.981171,-27.394473)" />
|
gradientTransform="matrix(0.9999964,0,0,1,-39.981171,-27.394473)" />
|
||||||
|
<text
|
||||||
|
x="160.94762"
|
||||||
|
y="93.333893"
|
||||||
|
transform="scale(0.95126779,1.0512287)"
|
||||||
|
id="text37-5"
|
||||||
|
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;fill-rule:evenodd;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">
|
||||||
|
<tspan
|
||||||
|
x="160.94762"
|
||||||
|
y="93.333893"
|
||||||
|
id="tspan3006-1"
|
||||||
|
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">FINAL CUT</tspan>
|
||||||
|
</text>
|
||||||
<g
|
<g
|
||||||
id="g23"
|
id="g23"
|
||||||
style="stroke:#000000;stroke-width:0.70560098">
|
style="stroke:#000000;stroke-width:0.70560098">
|
||||||
|
@ -142,15 +289,15 @@
|
||||||
id="path35"
|
id="path35"
|
||||||
style="fill:url(#f);stroke:#000000;stroke-width:0.70560002" />
|
style="fill:url(#f);stroke:#000000;stroke-width:0.70560002" />
|
||||||
<text
|
<text
|
||||||
x="471.83469"
|
x="158.56929"
|
||||||
y="91.775856"
|
y="91.775856"
|
||||||
transform="scale(0.95126779,1.0512287)"
|
transform="scale(0.95126779,1.0512287)"
|
||||||
id="text37"
|
id="text37"
|
||||||
style="font-size:96px;font-weight:600;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:middle;fill:#083c99;fill-rule:evenodd;stroke:#00173d;font-family:FreeSans">
|
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;fill-rule:evenodd;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">
|
||||||
<tspan
|
<tspan
|
||||||
x="471.83469"
|
x="158.56929"
|
||||||
y="91.775856"
|
y="91.775856"
|
||||||
id="tspan39"
|
id="tspan3006"
|
||||||
style="font-size:96px;font-weight:600;writing-mode:lr-tb;text-anchor:middle;fill:#083c99;stroke:#00173d;font-family:FreeSans">The Final Cut</tspan>
|
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">FINAL CUT</tspan>
|
||||||
</text>
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
if [ $# -gt 0 ]
|
if [ $# -gt 0 ]
|
||||||
then
|
then
|
||||||
eval cppcheck --force --enable=all -I../include/ "$@"
|
eval cppcheck --force --enable=all -I../src/include/ "$@"
|
||||||
else
|
else
|
||||||
eval cppcheck --force --enable=all -I../include/ ../src/ ../examples/
|
eval cppcheck --force --enable=all -I../src/include/ ../src/ ../examples/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
find ../src/ \
|
find ../src/ \
|
||||||
../include/final/ \
|
../src/include/final/ \
|
||||||
../examples/ \
|
../examples/ \
|
||||||
|
../test/ \
|
||||||
-regextype posix-egrep \
|
-regextype posix-egrep \
|
||||||
-regex ".*\\.(cpp|h)$" \
|
-regex ".*\\.(cpp|h)$" \
|
||||||
-exec sed -i 's/ *$//' "{}" \;
|
-exec sed -i 's/ *$//' "{}" \;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
strace -c ../examples/.libs/ui
|
LD_LIBRARY_PATH=../src/.libs strace -c ../examples/.libs/ui
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ libfinal_la_SOURCES = \
|
||||||
fkey_map.cpp \
|
fkey_map.cpp \
|
||||||
ftextview.cpp \
|
ftextview.cpp \
|
||||||
fstatusbar.cpp \
|
fstatusbar.cpp \
|
||||||
|
ftermcap.cpp \
|
||||||
ftermcapquirks.cpp \
|
ftermcapquirks.cpp \
|
||||||
ftermxterminal.cpp \
|
ftermxterminal.cpp \
|
||||||
ftermfreebsd.cpp \
|
ftermfreebsd.cpp \
|
||||||
|
@ -108,7 +109,6 @@ finalcutinclude_HEADERS = \
|
||||||
include/final/fscrollview.h \
|
include/final/fscrollview.h \
|
||||||
include/final/fstatusbar.h \
|
include/final/fstatusbar.h \
|
||||||
include/final/fstring.h \
|
include/final/fstring.h \
|
||||||
include/final/ftcap_map.h \
|
|
||||||
include/final/ftermcap.h \
|
include/final/ftermcap.h \
|
||||||
include/final/ftermcapquirks.h \
|
include/final/ftermcapquirks.h \
|
||||||
include/final/ftermxterminal.h \
|
include/final/ftermxterminal.h \
|
||||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
||||||
fapplication.h \
|
fapplication.h \
|
||||||
fbuttongroup.h \
|
fbuttongroup.h \
|
||||||
fbutton.h \
|
fbutton.h \
|
||||||
|
ftogglebutton.h \
|
||||||
fcheckbox.h \
|
fcheckbox.h \
|
||||||
fswitch.h \
|
fswitch.h \
|
||||||
fdialog.h \
|
fdialog.h \
|
||||||
fevent.h \
|
fwindow.h \
|
||||||
ffiledialog.h \
|
ffiledialog.h \
|
||||||
final.h \
|
final.h \
|
||||||
flabel.h \
|
flabel.h \
|
||||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
||||||
flistbox.h \
|
flistbox.h \
|
||||||
flistview.h \
|
flistview.h \
|
||||||
fmenu.h \
|
fmenu.h \
|
||||||
fmouse.h \
|
|
||||||
fkeyboard.h \
|
|
||||||
fdialoglistmenu.h \
|
fdialoglistmenu.h \
|
||||||
fmenubar.h \
|
fmenubar.h \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
ftooltip.h \
|
ftooltip.h \
|
||||||
fobject.h \
|
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
ftermbuffer.h \
|
ftermbuffer.h \
|
||||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
fstring.h \
|
fstring.h \
|
||||||
|
fmouse.h \
|
||||||
|
fkeyboard.h \
|
||||||
ftermcap.h \
|
ftermcap.h \
|
||||||
fterm.h \
|
fterm.h \
|
||||||
ftermios.h \
|
ftermios.h \
|
||||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
||||||
ftermlinux.h \
|
ftermlinux.h \
|
||||||
fvterm.h \
|
fvterm.h \
|
||||||
ftextview.h \
|
ftextview.h \
|
||||||
ftogglebutton.h \
|
|
||||||
fcolorpalette.h \
|
fcolorpalette.h \
|
||||||
fwidgetcolors.h \
|
fwidgetcolors.h \
|
||||||
fwidget.h \
|
fwidget.h \
|
||||||
fwindow.h
|
fevent.h \
|
||||||
|
fobject.h \
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = clang++
|
CXX = clang++
|
||||||
|
@ -87,8 +87,6 @@ OBJS = \
|
||||||
flistbox.o \
|
flistbox.o \
|
||||||
flistview.o \
|
flistview.o \
|
||||||
fmenu.o \
|
fmenu.o \
|
||||||
fmouse.o \
|
|
||||||
fkeyboard.o \
|
|
||||||
fdialoglistmenu.o \
|
fdialoglistmenu.o \
|
||||||
fmenubar.o \
|
fmenubar.o \
|
||||||
fmenuitem.o \
|
fmenuitem.o \
|
||||||
|
@ -96,14 +94,17 @@ OBJS = \
|
||||||
fcheckmenuitem.o \
|
fcheckmenuitem.o \
|
||||||
fmenulist.o \
|
fmenulist.o \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fscrollview.o \
|
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
|
fscrollview.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
ftooltip.o \
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
fkey_map.o \
|
fkey_map.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
fmouse.o \
|
||||||
|
fkeyboard.o \
|
||||||
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
ftermios.o \
|
ftermios.o \
|
||||||
ftermdetection.o \
|
ftermdetection.o \
|
||||||
|
@ -113,7 +114,6 @@ OBJS = \
|
||||||
ftermopenbsd.o \
|
ftermopenbsd.o \
|
||||||
ftermlinux.o \
|
ftermlinux.o \
|
||||||
fvterm.o \
|
fvterm.o \
|
||||||
fevent.o \
|
|
||||||
foptiattr.o \
|
foptiattr.o \
|
||||||
foptimove.o \
|
foptimove.o \
|
||||||
ftermbuffer.o \
|
ftermbuffer.o \
|
||||||
|
@ -121,12 +121,14 @@ OBJS = \
|
||||||
fcolorpalette.o \
|
fcolorpalette.o \
|
||||||
fwidgetcolors.o \
|
fwidgetcolors.o \
|
||||||
fwidget.o \
|
fwidget.o \
|
||||||
|
fevent.o \
|
||||||
fobject.o
|
fobject.o
|
||||||
|
|
||||||
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
OPTIMIZE = -O0 -fsanitize=undefined
|
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||||
|
# OPTIMIZE = -O0 -fsanitize=undefined
|
||||||
else
|
else
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
||||||
fapplication.h \
|
fapplication.h \
|
||||||
fbuttongroup.h \
|
fbuttongroup.h \
|
||||||
fbutton.h \
|
fbutton.h \
|
||||||
|
ftogglebutton.h \
|
||||||
fcheckbox.h \
|
fcheckbox.h \
|
||||||
fswitch.h \
|
fswitch.h \
|
||||||
fdialog.h \
|
fdialog.h \
|
||||||
fevent.h \
|
fwindow.h \
|
||||||
ffiledialog.h \
|
ffiledialog.h \
|
||||||
final.h \
|
final.h \
|
||||||
flabel.h \
|
flabel.h \
|
||||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
||||||
flistbox.h \
|
flistbox.h \
|
||||||
flistview.h \
|
flistview.h \
|
||||||
fmenu.h \
|
fmenu.h \
|
||||||
fmouse.h \
|
|
||||||
fkeyboard.h \
|
|
||||||
fdialoglistmenu.h \
|
fdialoglistmenu.h \
|
||||||
fmenubar.h \
|
fmenubar.h \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
ftooltip.h \
|
ftooltip.h \
|
||||||
fobject.h \
|
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
ftermbuffer.h \
|
ftermbuffer.h \
|
||||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
fstring.h \
|
fstring.h \
|
||||||
|
fmouse.h \
|
||||||
|
fkeyboard.h \
|
||||||
ftermcap.h \
|
ftermcap.h \
|
||||||
fterm.h \
|
fterm.h \
|
||||||
ftermios.h \
|
ftermios.h \
|
||||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
||||||
ftermlinux.h \
|
ftermlinux.h \
|
||||||
fvterm.h \
|
fvterm.h \
|
||||||
ftextview.h \
|
ftextview.h \
|
||||||
ftogglebutton.h \
|
|
||||||
fcolorpalette.h \
|
fcolorpalette.h \
|
||||||
fwidgetcolors.h \
|
fwidgetcolors.h \
|
||||||
fwidget.h \
|
fwidget.h \
|
||||||
fwindow.h
|
fevent.h \
|
||||||
|
fobject.h
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = g++
|
CXX = g++
|
||||||
|
@ -87,8 +87,6 @@ OBJS = \
|
||||||
flistbox.o \
|
flistbox.o \
|
||||||
flistview.o \
|
flistview.o \
|
||||||
fmenu.o \
|
fmenu.o \
|
||||||
fmouse.o \
|
|
||||||
fkeyboard.o \
|
|
||||||
fdialoglistmenu.o \
|
fdialoglistmenu.o \
|
||||||
fmenubar.o \
|
fmenubar.o \
|
||||||
fmenuitem.o \
|
fmenuitem.o \
|
||||||
|
@ -96,14 +94,17 @@ OBJS = \
|
||||||
fcheckmenuitem.o \
|
fcheckmenuitem.o \
|
||||||
fmenulist.o \
|
fmenulist.o \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fscrollview.o \
|
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
|
fscrollview.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
ftooltip.o \
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
fkey_map.o \
|
fkey_map.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
fmouse.o \
|
||||||
|
fkeyboard.o \
|
||||||
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
ftermios.o \
|
ftermios.o \
|
||||||
ftermdetection.o \
|
ftermdetection.o \
|
||||||
|
@ -113,7 +114,6 @@ OBJS = \
|
||||||
ftermopenbsd.o \
|
ftermopenbsd.o \
|
||||||
ftermlinux.o \
|
ftermlinux.o \
|
||||||
fvterm.o \
|
fvterm.o \
|
||||||
fevent.o \
|
|
||||||
foptiattr.o \
|
foptiattr.o \
|
||||||
foptimove.o \
|
foptimove.o \
|
||||||
ftermbuffer.o \
|
ftermbuffer.o \
|
||||||
|
@ -121,6 +121,7 @@ OBJS = \
|
||||||
fcolorpalette.o \
|
fcolorpalette.o \
|
||||||
fwidgetcolors.o \
|
fwidgetcolors.o \
|
||||||
fwidget.o \
|
fwidget.o \
|
||||||
|
fevent.o \
|
||||||
fobject.o
|
fobject.o
|
||||||
|
|
||||||
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
||||||
|
|
|
@ -1149,51 +1149,6 @@ void FApplication::processResizeEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
int FApplication::processTimerEvent()
|
|
||||||
{
|
|
||||||
FObject::TimerList::iterator iter, last;
|
|
||||||
timeval currentTime;
|
|
||||||
int activated = 0;
|
|
||||||
|
|
||||||
getCurrentTime (¤tTime);
|
|
||||||
|
|
||||||
if ( isTimerInUpdating() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( ! timer_list )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( timer_list->empty() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
iter = timer_list->begin();
|
|
||||||
last = timer_list->end();
|
|
||||||
|
|
||||||
while ( iter != last )
|
|
||||||
{
|
|
||||||
if ( ! iter->id
|
|
||||||
|| ! iter->object
|
|
||||||
|| currentTime < iter->timeout ) // no timer expired
|
|
||||||
break;
|
|
||||||
|
|
||||||
iter->timeout += iter->interval;
|
|
||||||
|
|
||||||
if ( iter->timeout < currentTime )
|
|
||||||
iter->timeout = currentTime + iter->interval;
|
|
||||||
|
|
||||||
if ( iter->interval.tv_usec > 0 || iter->interval.tv_sec > 0 )
|
|
||||||
activated++;
|
|
||||||
|
|
||||||
FTimerEvent t_ev(fc::Timer_Event, iter->id);
|
|
||||||
sendEvent(iter->object, &t_ev);
|
|
||||||
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return activated;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FApplication::processCloseWidget()
|
void FApplication::processCloseWidget()
|
||||||
{
|
{
|
||||||
|
@ -1219,7 +1174,7 @@ void FApplication::processCloseWidget()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::processNextEvent()
|
bool FApplication::processNextEvent()
|
||||||
{
|
{
|
||||||
int num_events = 0;
|
uInt num_events = 0;
|
||||||
|
|
||||||
processKeyboardEvent();
|
processKeyboardEvent();
|
||||||
processMouseEvent();
|
processMouseEvent();
|
||||||
|
@ -1233,4 +1188,11 @@ bool FApplication::processNextEvent()
|
||||||
return ( num_events > 0 );
|
return ( num_events > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FApplication::performTimerAction ( const FObject* receiver
|
||||||
|
, const FEvent* event )
|
||||||
|
{
|
||||||
|
sendEvent(receiver, event);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -1548,15 +1548,31 @@ inline void FDialog::lowerActivateDialog()
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
||||||
|
{
|
||||||
|
// 3 characters in the lower right corner |
|
||||||
|
// x
|
||||||
|
// -----xx
|
||||||
|
|
||||||
|
if ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
||||||
|
|| ( ( ms.mouse_x == getWidth() - 1
|
||||||
|
|| ms.mouse_x == getWidth() ) && ms.mouse_y == getHeight() ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::resizeMouseDown (mouseStates& ms)
|
void FDialog::resizeMouseDown (mouseStates& ms)
|
||||||
{
|
{
|
||||||
// Click on the lower right resize corner
|
// Click on the lower right resize corner
|
||||||
|
|
||||||
if ( isResizeable()
|
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
||||||
&& ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight())
|
|
||||||
|| (ms.mouse_x == getWidth() - 1 && ms.mouse_y == getHeight())
|
|
||||||
|| (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1) ) )
|
|
||||||
{
|
{
|
||||||
resize_click_pos = ms.termPos;
|
resize_click_pos = ms.termPos;
|
||||||
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool sortByName ( const FFileDialog::dir_entry& lhs
|
||||||
, const FFileDialog::dir_entry& rhs )
|
, const FFileDialog::dir_entry& rhs )
|
||||||
{
|
{
|
||||||
// lhs < rhs
|
// lhs < rhs
|
||||||
return bool(strcasecmp(lhs.name, rhs.name) < 0);
|
return bool( strcasecmp(lhs.name, rhs.name) < 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -60,8 +60,8 @@ FFileDialog::FFileDialog (FWidget* parent)
|
||||||
, dir_entries()
|
, dir_entries()
|
||||||
, directory()
|
, directory()
|
||||||
, filter_pattern()
|
, filter_pattern()
|
||||||
, filebrowser()
|
|
||||||
, filename()
|
, filename()
|
||||||
|
, filebrowser()
|
||||||
, hidden()
|
, hidden()
|
||||||
, cancel()
|
, cancel()
|
||||||
, open()
|
, open()
|
||||||
|
@ -78,8 +78,8 @@ FFileDialog::FFileDialog (const FFileDialog& fdlg)
|
||||||
, dir_entries()
|
, dir_entries()
|
||||||
, directory(fdlg.directory)
|
, directory(fdlg.directory)
|
||||||
, filter_pattern(fdlg.filter_pattern)
|
, filter_pattern(fdlg.filter_pattern)
|
||||||
, filebrowser()
|
|
||||||
, filename()
|
, filename()
|
||||||
|
, filebrowser()
|
||||||
, hidden()
|
, hidden()
|
||||||
, cancel()
|
, cancel()
|
||||||
, open()
|
, open()
|
||||||
|
@ -102,11 +102,11 @@ FFileDialog::FFileDialog ( const FString& dirname
|
||||||
, dir_entries()
|
, dir_entries()
|
||||||
, directory()
|
, directory()
|
||||||
, filter_pattern(filter)
|
, filter_pattern(filter)
|
||||||
, filebrowser()
|
, filename(this)
|
||||||
, filename()
|
, filebrowser(this)
|
||||||
, hidden()
|
, hidden(this)
|
||||||
, cancel()
|
, cancel(this)
|
||||||
, open()
|
, open(this)
|
||||||
, dlg_type(type)
|
, dlg_type(type)
|
||||||
, show_hidden(false)
|
, show_hidden(false)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,6 @@ FFileDialog::FFileDialog ( const FString& dirname
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FFileDialog::~FFileDialog() // destructor
|
FFileDialog::~FFileDialog() // destructor
|
||||||
{
|
{
|
||||||
deallocation();
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,11 +133,6 @@ FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete open;
|
|
||||||
delete cancel;
|
|
||||||
delete hidden;
|
|
||||||
delete filebrowser;
|
|
||||||
delete filename;
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
if ( fdlg.getParentWidget() )
|
if ( fdlg.getParentWidget() )
|
||||||
|
@ -160,7 +154,7 @@ FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FFileDialog::getSelectedFile() const
|
const FString FFileDialog::getSelectedFile() const
|
||||||
{
|
{
|
||||||
uLong n = uLong(filebrowser->currentItem() - 1);
|
uLong n = uLong(filebrowser.currentItem() - 1);
|
||||||
|
|
||||||
if ( dir_entries[n].directory )
|
if ( dir_entries[n].directory )
|
||||||
return FString("");
|
return FString("");
|
||||||
|
@ -222,7 +216,7 @@ bool FFileDialog::setShowHiddenFiles (bool on)
|
||||||
|
|
||||||
show_hidden = on;
|
show_hidden = on;
|
||||||
readDir();
|
readDir();
|
||||||
filebrowser->redraw();
|
filebrowser.redraw();
|
||||||
return show_hidden;
|
return show_hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +228,7 @@ void FFileDialog::onKeyPress (FKeyEvent* ev)
|
||||||
|
|
||||||
FDialog::onKeyPress (ev);
|
FDialog::onKeyPress (ev);
|
||||||
|
|
||||||
if ( ! filebrowser->hasFocus() )
|
if ( ! filebrowser.hasFocus() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int key = ev->key();
|
int key = ev->key();
|
||||||
|
@ -374,10 +368,10 @@ void FFileDialog::adjustSize()
|
||||||
X = 1 + int((max_width - getWidth()) / 2);
|
X = 1 + int((max_width - getWidth()) / 2);
|
||||||
Y = 1 + int((max_height - getHeight()) / 3);
|
Y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(X, Y, false);
|
setPos(X, Y, false);
|
||||||
filebrowser->setHeight (h - 8, false);
|
filebrowser.setHeight (h - 8, false);
|
||||||
hidden->setY (h - 4, false);
|
hidden.setY (h - 4, false);
|
||||||
cancel->setY (h - 4, false);
|
cancel.setY (h - 4, false);
|
||||||
open->setY (h - 4, false);
|
open.setY (h - 4, false);
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
printPath(directory);
|
printPath(directory);
|
||||||
}
|
}
|
||||||
|
@ -408,92 +402,72 @@ void FFileDialog::init()
|
||||||
else
|
else
|
||||||
FDialog::setText("Open file");
|
FDialog::setText("Open file");
|
||||||
|
|
||||||
allocation (x, y); // Create widgets
|
widgetSettings (x, y); // Create widgets
|
||||||
initCallbacks();
|
initCallbacks();
|
||||||
setModal();
|
setModal();
|
||||||
readDir();
|
readDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FFileDialog::allocation (int x, int y)
|
inline void FFileDialog::widgetSettings (int x, int y)
|
||||||
{
|
{
|
||||||
try
|
filename.setLabelText ("File&name");
|
||||||
{
|
filename.setText (filter_pattern);
|
||||||
filename = new FLineEdit(this);
|
filename.setGeometry (11, 1, 28, 1);
|
||||||
filename->setLabelText("File&name");
|
filename.setFocus();
|
||||||
filename->setText(filter_pattern);
|
|
||||||
filename->setGeometry(11, 1, 28, 1);
|
|
||||||
filename->setFocus();
|
|
||||||
|
|
||||||
filebrowser = new FListBox(this);
|
filebrowser.setGeometry (2, 3, 38, 6);
|
||||||
filebrowser->setGeometry(2, 3, 38, 6);
|
printPath (directory);
|
||||||
printPath(directory);
|
|
||||||
|
|
||||||
hidden = new FCheckBox("&hidden files", this);
|
hidden.setText ("&hidden files");
|
||||||
hidden->setGeometry(2, 10, 16, 1);
|
hidden.setGeometry (2, 10, 16, 1);
|
||||||
|
|
||||||
cancel = new FButton("&Cancel", this);
|
cancel.setText ("&Cancel");
|
||||||
cancel->setGeometry(19, 10, 9, 1);
|
cancel.setGeometry(19, 10, 9, 1);
|
||||||
|
|
||||||
if ( dlg_type == FFileDialog::Save )
|
if ( dlg_type == FFileDialog::Save )
|
||||||
open = new FButton("&Save", this);
|
open.setText ("&Save");
|
||||||
else
|
else
|
||||||
open = new FButton("&Open", this);
|
open.setText ("&Open");
|
||||||
|
|
||||||
open->setGeometry(30, 10, 9, 1);
|
open.setGeometry(30, 10, 9, 1);
|
||||||
setGeometry (x, y, getWidth(), getHeight());
|
setGeometry (x, y, getWidth(), getHeight());
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FFileDialog::deallocation()
|
|
||||||
{
|
|
||||||
delete open;
|
|
||||||
delete cancel;
|
|
||||||
delete hidden;
|
|
||||||
delete filebrowser;
|
|
||||||
delete filename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::initCallbacks()
|
void FFileDialog::initCallbacks()
|
||||||
{
|
{
|
||||||
filename->addCallback
|
filename.addCallback
|
||||||
(
|
(
|
||||||
"activate",
|
"activate",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processActivate)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processActivate)
|
||||||
);
|
);
|
||||||
|
|
||||||
filebrowser->addCallback
|
filebrowser.addCallback
|
||||||
(
|
(
|
||||||
"row-changed",
|
"row-changed",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processRowChanged)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processRowChanged)
|
||||||
);
|
);
|
||||||
|
|
||||||
filebrowser->addCallback
|
filebrowser.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processClicked)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processClicked)
|
||||||
);
|
);
|
||||||
|
|
||||||
hidden->addCallback
|
hidden.addCallback
|
||||||
(
|
(
|
||||||
"toggled",
|
"toggled",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processShowHidden)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processShowHidden)
|
||||||
);
|
);
|
||||||
|
|
||||||
cancel->addCallback
|
cancel.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processCancel)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processCancel)
|
||||||
);
|
);
|
||||||
|
|
||||||
open->addCallback
|
open.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &FFileDialog::cb_processOpen)
|
F_METHOD_CALLBACK (this, &FFileDialog::cb_processOpen)
|
||||||
|
@ -725,7 +699,7 @@ void FFileDialog::dirEntriesToList()
|
||||||
{
|
{
|
||||||
// Fill list with directory entries
|
// Fill list with directory entries
|
||||||
|
|
||||||
filebrowser->clear();
|
filebrowser.clear();
|
||||||
|
|
||||||
if ( dir_entries.empty() )
|
if ( dir_entries.empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -737,9 +711,9 @@ void FFileDialog::dirEntriesToList()
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( iter->directory )
|
if ( iter->directory )
|
||||||
filebrowser->insert(FString(iter->name), fc::SquareBrackets);
|
filebrowser.insert(FString(iter->name), fc::SquareBrackets);
|
||||||
else
|
else
|
||||||
filebrowser->insert(FString(iter->name));
|
filebrowser.insert(FString(iter->name));
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
@ -774,7 +748,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
if ( newdir == FString("..") )
|
if ( newdir == FString("..") )
|
||||||
{
|
{
|
||||||
if ( lastdir == FString('/') )
|
if ( lastdir == FString('/') )
|
||||||
filename->setText('/');
|
filename.setText('/');
|
||||||
else if ( ! dir_entries.empty() )
|
else if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -788,8 +762,8 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
{
|
{
|
||||||
if ( std::strcmp(iter->name, baseName) == 0 )
|
if ( std::strcmp(iter->name, baseName) == 0 )
|
||||||
{
|
{
|
||||||
filebrowser->setCurrentItem(i);
|
filebrowser.setCurrentItem(i);
|
||||||
filename->setText(FString(baseName) + '/');
|
filename.setText(FString(baseName) + '/');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,14 +777,14 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
FString firstname = dir_entries[0].name;
|
FString firstname = dir_entries[0].name;
|
||||||
|
|
||||||
if ( dir_entries[0].directory )
|
if ( dir_entries[0].directory )
|
||||||
filename->setText(firstname + '/');
|
filename.setText(firstname + '/');
|
||||||
else
|
else
|
||||||
filename->setText(firstname);
|
filename.setText(firstname);
|
||||||
}
|
}
|
||||||
|
|
||||||
printPath(directory);
|
printPath(directory);
|
||||||
filename->redraw();
|
filename.redraw();
|
||||||
filebrowser->redraw();
|
filebrowser.redraw();
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -821,12 +795,12 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
void FFileDialog::printPath (const FString& txt)
|
void FFileDialog::printPath (const FString& txt)
|
||||||
{
|
{
|
||||||
const FString& path = txt;
|
const FString& path = txt;
|
||||||
const uInt max_width = uInt(filebrowser->getWidth()) - 4;
|
const uInt max_width = uInt(filebrowser.getWidth()) - 4;
|
||||||
|
|
||||||
if ( path.getLength() > max_width )
|
if ( path.getLength() > max_width )
|
||||||
filebrowser->setText(".." + path.right(max_width - 2));
|
filebrowser.setText(".." + path.right(max_width - 2));
|
||||||
else
|
else
|
||||||
filebrowser->setText(path);
|
filebrowser.setText(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -845,24 +819,24 @@ const FString FFileDialog::getHomeDir()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( filename->getText().includes('*')
|
if ( filename.getText().includes('*')
|
||||||
|| filename->getText().includes('?') )
|
|| filename.getText().includes('?') )
|
||||||
{
|
{
|
||||||
setFilter(filename->getText());
|
setFilter(filename.getText());
|
||||||
readDir();
|
readDir();
|
||||||
filebrowser->redraw();
|
filebrowser.redraw();
|
||||||
}
|
}
|
||||||
else if ( filename->getText().getLength() == 0 )
|
else if ( filename.getText().getLength() == 0 )
|
||||||
{
|
{
|
||||||
setFilter("*");
|
setFilter("*");
|
||||||
readDir();
|
readDir();
|
||||||
filebrowser->redraw();
|
filebrowser.redraw();
|
||||||
}
|
}
|
||||||
else if ( filename->getText().trim() == FString("..")
|
else if ( filename.getText().trim() == FString("..")
|
||||||
|| filename->getText().includes('/')
|
|| filename.getText().includes('/')
|
||||||
|| filename->getText().includes('~') )
|
|| filename.getText().includes('~') )
|
||||||
{
|
{
|
||||||
changeDir(filename->getText().trim());
|
changeDir(filename.getText().trim());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -871,7 +845,7 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
if ( ! dir_entries.empty() )
|
if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
std::vector<dir_entry>::const_iterator iter, last;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
const FString& input = filename->getText().trim();
|
const FString& input = filename.getText().trim();
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
last = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
|
@ -898,7 +872,7 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
const int n = filebrowser->currentItem();
|
const int n = filebrowser.currentItem();
|
||||||
|
|
||||||
if ( n == 0 )
|
if ( n == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -906,17 +880,17 @@ void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||||
const FString& name = dir_entries[uLong(n - 1)].name;
|
const FString& name = dir_entries[uLong(n - 1)].name;
|
||||||
|
|
||||||
if ( dir_entries[uLong(n - 1)].directory )
|
if ( dir_entries[uLong(n - 1)].directory )
|
||||||
filename->setText( name + '/' );
|
filename.setText( name + '/' );
|
||||||
else
|
else
|
||||||
filename->setText( name );
|
filename.setText( name );
|
||||||
|
|
||||||
filename->redraw();
|
filename.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::cb_processClicked (FWidget*, data_ptr)
|
void FFileDialog::cb_processClicked (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
const uLong n = uLong(filebrowser->currentItem() - 1);
|
const uLong n = uLong(filebrowser.currentItem() - 1);
|
||||||
|
|
||||||
if ( dir_entries[n].directory )
|
if ( dir_entries[n].directory )
|
||||||
changeDir(dir_entries[n].name);
|
changeDir(dir_entries[n].name);
|
||||||
|
|
|
@ -79,7 +79,7 @@ FKeyboard::FKeyboard()
|
||||||
, keypressed_cmd()
|
, keypressed_cmd()
|
||||||
, keyreleased_cmd()
|
, keyreleased_cmd()
|
||||||
, escape_key_cmd()
|
, escape_key_cmd()
|
||||||
, termcap_map(0)
|
, key_map(0)
|
||||||
{
|
{
|
||||||
// Initialize keyboard values
|
// Initialize keyboard values
|
||||||
time_keypressed.tv_sec = 0;
|
time_keypressed.tv_sec = 0;
|
||||||
|
@ -123,7 +123,7 @@ const FString FKeyboard::getKeyName (int keynum)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
|
void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
|
||||||
{
|
{
|
||||||
termcap_map = keymap;
|
key_map = keymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -232,10 +232,10 @@ inline int FKeyboard::getTermcapKey()
|
||||||
|
|
||||||
assert ( fifo_buf_size > 0 );
|
assert ( fifo_buf_size > 0 );
|
||||||
|
|
||||||
if ( ! termcap_map )
|
if ( ! key_map )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fc::fkeymap* keymap = reinterpret_cast<fc::fkeymap*>(termcap_map);
|
fc::fkeymap* keymap = reinterpret_cast<fc::fkeymap*>(key_map);
|
||||||
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* k = keymap[i].string;
|
char* k = keymap[i].string;
|
||||||
|
@ -515,9 +515,9 @@ int FKeyboard::keyCorrection (const int& keycode)
|
||||||
if ( linux )
|
if ( linux )
|
||||||
key_correction = linux->modifierKeyCorrection(keycode);
|
key_correction = linux->modifierKeyCorrection(keycode);
|
||||||
else
|
else
|
||||||
key_correction = key;
|
key_correction = keycode;
|
||||||
#else
|
#else
|
||||||
key_correction = key;
|
key_correction = keycode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return key_correction;
|
return key_correction;
|
||||||
|
|
|
@ -34,6 +34,123 @@ namespace finalcut
|
||||||
// Static class attribute
|
// Static class attribute
|
||||||
FObject::FObjectIterator FListView::null_iter;
|
FObject::FObjectIterator FListView::null_iter;
|
||||||
|
|
||||||
|
// Function prototypes
|
||||||
|
long firstNumberFromString (const FString&);
|
||||||
|
bool sortAscendingByName (const FObject*, const FObject*);
|
||||||
|
bool sortDescendingByName (const FObject*, const FObject*);
|
||||||
|
bool sortAscendingByNumber (const FObject*, const FObject*);
|
||||||
|
bool sortDescendingByNumber (const FObject*, const FObject*);
|
||||||
|
|
||||||
|
// non-member functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
long firstNumberFromString (const FString& str)
|
||||||
|
{
|
||||||
|
const FString::iterator last = str.end();
|
||||||
|
FString::iterator iter = str.begin();
|
||||||
|
FString::iterator first_pos;
|
||||||
|
FString::iterator last_pos;
|
||||||
|
long number;
|
||||||
|
|
||||||
|
while ( iter != last )
|
||||||
|
{
|
||||||
|
if ( wchar_t(*iter) >= L'0' && wchar_t(*iter) <= L'9' )
|
||||||
|
{
|
||||||
|
if ( wchar_t(*(iter - 1)) == L'-' )
|
||||||
|
--iter;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
first_pos = iter;
|
||||||
|
|
||||||
|
if ( first_pos == last )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while ( iter != last )
|
||||||
|
{
|
||||||
|
if ( wchar_t(*iter) < L'0' || wchar_t(*iter) > L'9' )
|
||||||
|
break;
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
last_pos = iter;
|
||||||
|
|
||||||
|
if ( last_pos == last )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
uInt pos = uInt(std::distance(str.begin(), first_pos)) + 1;
|
||||||
|
uInt length = uInt(std::distance(first_pos, last_pos));
|
||||||
|
const FString num_str = str.mid(pos, length);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
number = num_str.toLong();
|
||||||
|
}
|
||||||
|
catch (const std::exception&)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool sortAscendingByName (const FObject* lhs, const FObject* rhs)
|
||||||
|
{
|
||||||
|
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||||
|
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||||
|
const int column = l_item->getSortColumn();
|
||||||
|
const FString l_string = l_item->getText(column);
|
||||||
|
const FString r_string = r_item->getText(column);
|
||||||
|
|
||||||
|
// lhs < rhs
|
||||||
|
return bool( strcasecmp(l_string.c_str(), r_string.c_str()) < 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool sortDescendingByName (const FObject* lhs, const FObject* rhs)
|
||||||
|
{
|
||||||
|
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||||
|
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||||
|
const int column = l_item->getSortColumn();
|
||||||
|
const FString l_string = l_item->getText(column);
|
||||||
|
const FString r_string = r_item->getText(column);
|
||||||
|
|
||||||
|
// lhs > rhs
|
||||||
|
return bool( strcasecmp(l_string.c_str(), r_string.c_str()) > 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool sortAscendingByNumber (const FObject* lhs, const FObject* rhs)
|
||||||
|
{
|
||||||
|
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||||
|
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||||
|
const int column = l_item->getSortColumn();
|
||||||
|
const long l_number = firstNumberFromString(l_item->getText(column));
|
||||||
|
const long r_number = firstNumberFromString(r_item->getText(column));
|
||||||
|
|
||||||
|
// lhs < rhs
|
||||||
|
return bool( l_number < r_number );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool sortDescendingByNumber (const FObject* lhs, const FObject* rhs)
|
||||||
|
{
|
||||||
|
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||||
|
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||||
|
const int column = l_item->getSortColumn();
|
||||||
|
const long l_number = firstNumberFromString(l_item->getText(column));
|
||||||
|
const long r_number = firstNumberFromString(r_item->getText(column));
|
||||||
|
|
||||||
|
// lhs > rhs
|
||||||
|
return bool( l_number > r_number );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FListViewItem
|
// class FListViewItem
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -44,6 +161,7 @@ FListViewItem::FListViewItem (const FListViewItem& item)
|
||||||
: FObject(item.getParent())
|
: FObject(item.getParent())
|
||||||
, column_list(item.column_list)
|
, column_list(item.column_list)
|
||||||
, data_pointer(item.data_pointer)
|
, data_pointer(item.data_pointer)
|
||||||
|
, root()
|
||||||
, visible_lines(1)
|
, visible_lines(1)
|
||||||
, expandable(false)
|
, expandable(false)
|
||||||
, is_expand(false)
|
, is_expand(false)
|
||||||
|
@ -68,6 +186,7 @@ FListViewItem::FListViewItem (FObjectIterator parent_iter)
|
||||||
: FObject((*parent_iter)->getParent())
|
: FObject((*parent_iter)->getParent())
|
||||||
, column_list()
|
, column_list()
|
||||||
, data_pointer(0)
|
, data_pointer(0)
|
||||||
|
, root()
|
||||||
, visible_lines(1)
|
, visible_lines(1)
|
||||||
, expandable(false)
|
, expandable(false)
|
||||||
, is_expand(false)
|
, is_expand(false)
|
||||||
|
@ -82,6 +201,7 @@ FListViewItem::FListViewItem ( const FStringList& cols
|
||||||
: FObject(0)
|
: FObject(0)
|
||||||
, column_list(cols)
|
, column_list(cols)
|
||||||
, data_pointer(data)
|
, data_pointer(data)
|
||||||
|
, root()
|
||||||
, visible_lines(1)
|
, visible_lines(1)
|
||||||
, expandable(false)
|
, expandable(false)
|
||||||
, is_expand(false)
|
, is_expand(false)
|
||||||
|
@ -99,6 +219,16 @@ FListViewItem::~FListViewItem() // destructor
|
||||||
|
|
||||||
|
|
||||||
// public methods of FListViewItem
|
// public methods of FListViewItem
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int FListViewItem::getSortColumn() const
|
||||||
|
{
|
||||||
|
if ( ! *root )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
FListView* root_obj = static_cast<FListView*>(*root);
|
||||||
|
return root_obj->getSortColumn();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FListViewItem::getText (int column) const
|
FString FListViewItem::getText (int column) const
|
||||||
{
|
{
|
||||||
|
@ -208,11 +338,40 @@ void FListViewItem::collapse()
|
||||||
}
|
}
|
||||||
|
|
||||||
// private methods of FListView
|
// private methods of FListView
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template<typename Compare>
|
||||||
|
void FListViewItem::sort (Compare cmp)
|
||||||
|
{
|
||||||
|
if ( ! expandable )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Sort the top level
|
||||||
|
FObject::FObjectList& children_list = getChildren();
|
||||||
|
|
||||||
|
if ( ! children_list.empty() )
|
||||||
|
children_list.sort(cmp);
|
||||||
|
|
||||||
|
// Sort the sublevels
|
||||||
|
FListViewIterator iter = children_list.begin();
|
||||||
|
|
||||||
|
while ( iter != children_list.end() )
|
||||||
|
{
|
||||||
|
if ( *iter )
|
||||||
|
{
|
||||||
|
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||||
|
item->sort(cmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FObject::FObjectIterator FListViewItem::appendItem (FListViewItem* child)
|
FObject::FObjectIterator FListViewItem::appendItem (FListViewItem* child)
|
||||||
{
|
{
|
||||||
expandable = true;
|
expandable = true;
|
||||||
resetVisibleLineCounter();
|
resetVisibleLineCounter();
|
||||||
|
child->root = root;
|
||||||
addChild (child);
|
addChild (child);
|
||||||
// Return iterator to child/last element
|
// Return iterator to child/last element
|
||||||
return --FObject::end();
|
return --FObject::end();
|
||||||
|
@ -288,9 +447,6 @@ FListViewIterator::FListViewIterator (FObjectIterator iter)
|
||||||
, position(0)
|
, position(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
FListViewIterator::~FListViewIterator() // destructor
|
|
||||||
{ }
|
|
||||||
|
|
||||||
// FListViewIterator operators
|
// FListViewIterator operators
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -454,6 +610,11 @@ FListView::FListView (FWidget* parent)
|
||||||
, xoffset(0)
|
, xoffset(0)
|
||||||
, nf_offset(0)
|
, nf_offset(0)
|
||||||
, max_line_width(1)
|
, max_line_width(1)
|
||||||
|
, sort_column(-1)
|
||||||
|
, sort_type()
|
||||||
|
, sort_order(fc::unsorted)
|
||||||
|
, user_defined_ascending(0)
|
||||||
|
, user_defined_descending(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -507,6 +668,24 @@ FString FListView::getColumnText (int column) const
|
||||||
return header[uInt(column)].name;
|
return header[uInt(column)].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
fc::sorting_type FListView::getColumnSortType (int column) const
|
||||||
|
{
|
||||||
|
fc::sorting_type type;
|
||||||
|
std::size_t size = uInt(column);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
type = sort_type.at(size);
|
||||||
|
}
|
||||||
|
catch (const std::out_of_range&)
|
||||||
|
{
|
||||||
|
type = fc::unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
@ -559,6 +738,34 @@ void FListView::setColumnText (int column, const FString& label)
|
||||||
header[uInt(column)].name = label;
|
header[uInt(column)].name = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FListView::setColumnSortType (int column, fc::sorting_type type)
|
||||||
|
{
|
||||||
|
// Sets the sort type by which the list is to be sorted
|
||||||
|
|
||||||
|
if ( column < 1 || header.empty() || column > int(header.size()) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::size_t size = uInt(column + 1);
|
||||||
|
|
||||||
|
if ( sort_type.empty() || sort_type.size() < size )
|
||||||
|
sort_type.resize(size);
|
||||||
|
|
||||||
|
sort_type[uInt(column)] = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FListView::setColumnSort (int column, fc::sorting_order order)
|
||||||
|
{
|
||||||
|
// Sets the column to sort by + the sorting order
|
||||||
|
|
||||||
|
if ( column < 1 || header.empty() || column > int(header.size()) )
|
||||||
|
column = -1;
|
||||||
|
|
||||||
|
sort_column = column;
|
||||||
|
sort_order = order;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FListView::addColumn (const FString& label, int width)
|
int FListView::addColumn (const FString& label, int width)
|
||||||
{
|
{
|
||||||
|
@ -582,42 +789,14 @@ int FListView::addColumn (const FString& label, int width)
|
||||||
FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
||||||
, FObjectIterator parent_iter )
|
, FObjectIterator parent_iter )
|
||||||
{
|
{
|
||||||
static const int padding_space = 1;
|
|
||||||
int line_width = padding_space; // leading space
|
|
||||||
uInt column_idx = 0;
|
|
||||||
uInt entries = uInt(item->column_list.size());
|
|
||||||
FObjectIterator item_iter;
|
FObjectIterator item_iter;
|
||||||
headerItems::iterator header_iter;
|
int line_width;
|
||||||
|
int element_count;
|
||||||
|
|
||||||
if ( parent_iter == FListView::null_iter )
|
if ( parent_iter == FListView::null_iter )
|
||||||
return FListView::null_iter;
|
return FListView::null_iter;
|
||||||
|
|
||||||
// Determine the line width
|
line_width = determineLineWidth (item);
|
||||||
header_iter = header.begin();
|
|
||||||
|
|
||||||
while ( header_iter != header.end() )
|
|
||||||
{
|
|
||||||
int width = header_iter->width;
|
|
||||||
bool fixed_width = header_iter->fixed_width;
|
|
||||||
|
|
||||||
if ( ! fixed_width )
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if ( column_idx < entries )
|
|
||||||
len = int(item->column_list[column_idx].getLength());
|
|
||||||
else
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
if ( len > width )
|
|
||||||
header_iter->width = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
line_width += header_iter->width + padding_space; // width + trailing space
|
|
||||||
column_idx++;
|
|
||||||
++header_iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
recalculateHorizontalBar (line_width);
|
recalculateHorizontalBar (line_width);
|
||||||
|
|
||||||
if ( parent_iter == root )
|
if ( parent_iter == root )
|
||||||
|
@ -652,7 +831,10 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
||||||
first_visible_line = itemlist.begin();
|
first_visible_line = itemlist.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
int element_count = int(getCount());
|
// Sort list by a column (only if activated)
|
||||||
|
sort();
|
||||||
|
|
||||||
|
element_count = int(getCount());
|
||||||
recalculateVerticalBar (element_count);
|
recalculateVerticalBar (element_count);
|
||||||
return item_iter;
|
return item_iter;
|
||||||
}
|
}
|
||||||
|
@ -703,6 +885,55 @@ FObject::FObjectIterator FListView::insert ( const std::vector<long>& cols
|
||||||
return item_iter;
|
return item_iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FListView::sort()
|
||||||
|
{
|
||||||
|
// Sorts the list view according to the specified setting
|
||||||
|
|
||||||
|
if ( sort_column < 1 && sort_column > int(header.size()) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch ( getColumnSortType(sort_column) )
|
||||||
|
{
|
||||||
|
case fc::unknown:
|
||||||
|
case fc::by_name:
|
||||||
|
if ( sort_order == fc::ascending )
|
||||||
|
{
|
||||||
|
sort (sortAscendingByName);
|
||||||
|
}
|
||||||
|
else if ( sort_order == fc::descending )
|
||||||
|
{
|
||||||
|
sort (sortDescendingByName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case fc::by_number:
|
||||||
|
if ( sort_order == fc::ascending )
|
||||||
|
{
|
||||||
|
sort (sortAscendingByNumber);
|
||||||
|
}
|
||||||
|
else if ( sort_order == fc::descending )
|
||||||
|
{
|
||||||
|
sort (sortDescendingByNumber);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case fc::user_defined:
|
||||||
|
if ( sort_order == fc::ascending && user_defined_ascending )
|
||||||
|
{
|
||||||
|
sort (user_defined_ascending);
|
||||||
|
}
|
||||||
|
else if ( sort_order == fc::descending && user_defined_descending )
|
||||||
|
{
|
||||||
|
sort (user_defined_descending);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_iter = itemlist.begin();
|
||||||
|
first_visible_line = itemlist.begin();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::onKeyPress (FKeyEvent* ev)
|
void FListView::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
|
@ -1189,6 +1420,28 @@ void FListView::init()
|
||||||
setRightPadding(1 + nf_offset);
|
setRightPadding(1 + nf_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template<typename Compare>
|
||||||
|
void FListView::sort (Compare cmp)
|
||||||
|
{
|
||||||
|
// Sort the top level
|
||||||
|
itemlist.sort(cmp);
|
||||||
|
|
||||||
|
// Sort the sublevels
|
||||||
|
FListViewIterator iter = itemlist.begin();
|
||||||
|
|
||||||
|
while ( iter != itemlist.end() )
|
||||||
|
{
|
||||||
|
if ( *iter )
|
||||||
|
{
|
||||||
|
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||||
|
item->sort(cmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FListView::getAlignOffset ( fc::text_alignment align
|
uInt FListView::getAlignOffset ( fc::text_alignment align
|
||||||
, uInt txt_length
|
, uInt txt_length
|
||||||
|
@ -1581,6 +1834,42 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int FListView::determineLineWidth (FListViewItem* item)
|
||||||
|
{
|
||||||
|
static const int padding_space = 1;
|
||||||
|
int line_width = padding_space; // leading space
|
||||||
|
uInt column_idx = 0;
|
||||||
|
uInt entries = uInt(item->column_list.size());
|
||||||
|
headerItems::iterator header_iter;
|
||||||
|
header_iter = header.begin();
|
||||||
|
|
||||||
|
while ( header_iter != header.end() )
|
||||||
|
{
|
||||||
|
int width = header_iter->width;
|
||||||
|
bool fixed_width = header_iter->fixed_width;
|
||||||
|
|
||||||
|
if ( ! fixed_width )
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if ( column_idx < entries )
|
||||||
|
len = int(item->column_list[column_idx].getLength());
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
|
|
||||||
|
if ( len > width )
|
||||||
|
header_iter->width = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
line_width += header_iter->width + padding_space; // width + trailing space
|
||||||
|
column_idx++;
|
||||||
|
++header_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return line_width;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::recalculateHorizontalBar (int len)
|
void FListView::recalculateHorizontalBar (int len)
|
||||||
{
|
{
|
||||||
|
@ -1751,6 +2040,7 @@ void FListView::stopDragScroll()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FObject::FObjectIterator FListView::appendItem (FListViewItem* item)
|
FObject::FObjectIterator FListView::appendItem (FListViewItem* item)
|
||||||
{
|
{
|
||||||
|
item->root = root;
|
||||||
addChild (item);
|
addChild (item);
|
||||||
itemlist.push_back (item);
|
itemlist.push_back (item);
|
||||||
return --itemlist.end();
|
return --itemlist.end();
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace finalcut
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMenu::FMenu(FWidget* parent)
|
FMenu::FMenu(FWidget* parent)
|
||||||
: FWindow(parent)
|
: FWindow(parent)
|
||||||
, item(0)
|
, item()
|
||||||
, super_menu(0)
|
, super_menu(0)
|
||||||
, opened_sub_menu(0)
|
, opened_sub_menu(0)
|
||||||
, shown_sub_menu(0)
|
, shown_sub_menu(0)
|
||||||
|
@ -53,7 +53,7 @@ FMenu::FMenu(FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMenu::FMenu (const FString& txt, FWidget* parent)
|
FMenu::FMenu (const FString& txt, FWidget* parent)
|
||||||
: FWindow(parent)
|
: FWindow(parent)
|
||||||
, item(0)
|
, item(txt, parent)
|
||||||
, super_menu(0)
|
, super_menu(0)
|
||||||
, opened_sub_menu(0)
|
, opened_sub_menu(0)
|
||||||
, shown_sub_menu(0)
|
, shown_sub_menu(0)
|
||||||
|
@ -62,16 +62,6 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
||||||
, mouse_down(false)
|
, mouse_down(false)
|
||||||
, has_checkable_items(false)
|
, has_checkable_items(false)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
item = new FMenuItem(txt, parent);
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
init(parent);
|
init(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +94,7 @@ bool FMenu::setMenuWidget (bool on)
|
||||||
void FMenu::setStatusbarMessage (const FString& msg)
|
void FMenu::setStatusbarMessage (const FString& msg)
|
||||||
{
|
{
|
||||||
FWidget::setStatusbarMessage(msg);
|
FWidget::setStatusbarMessage(msg);
|
||||||
|
item.setStatusbarMessage(msg);
|
||||||
if ( item )
|
|
||||||
item->setStatusbarMessage(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -474,9 +462,7 @@ void FMenu::init(FWidget* parent)
|
||||||
|
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc.menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc.menu_active_bg);
|
||||||
|
item.setMenu(this);
|
||||||
if ( item )
|
|
||||||
item->setMenu(this);
|
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
|
@ -500,9 +486,7 @@ void FMenu::init(FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::calculateDimensions()
|
void FMenu::calculateDimensions()
|
||||||
{
|
{
|
||||||
int item_X
|
int item_X, item_Y, adjust_X;
|
||||||
, item_Y
|
|
||||||
, adjust_X;
|
|
||||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
last = item_list.end();
|
last = item_list.end();
|
||||||
|
@ -1038,7 +1022,7 @@ bool FMenu::containsMenuStructure (int x, int y)
|
||||||
return true;
|
return true;
|
||||||
else if ( si && si->hasMenu() && opened_sub_menu )
|
else if ( si && si->hasMenu() && opened_sub_menu )
|
||||||
return si->getMenu()->containsMenuStructure(x, y);
|
return si->getMenu()->containsMenuStructure(x, y);
|
||||||
else if ( item && item->getTermGeometry().contains(x, y) )
|
else if ( item.getTermGeometry().contains(x, y) )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -53,6 +53,13 @@ FMenuBar::~FMenuBar() // destructor
|
||||||
|
|
||||||
|
|
||||||
// public methods of FMenuBar
|
// public methods of FMenuBar
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMenuBar::resetMenu()
|
||||||
|
{
|
||||||
|
unselectItem();
|
||||||
|
drop_down = false;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::hide()
|
void FMenuBar::hide()
|
||||||
{
|
{
|
||||||
|
@ -85,13 +92,6 @@ void FMenuBar::hide()
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FMenuBar::resetMenu()
|
|
||||||
{
|
|
||||||
unselectItem();
|
|
||||||
drop_down = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::adjustSize()
|
void FMenuBar::adjustSize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,6 +99,14 @@ FMenuItem::FMenuItem (int k, const FString& txt, FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMenuItem::~FMenuItem() // destructor
|
FMenuItem::~FMenuItem() // destructor
|
||||||
{
|
{
|
||||||
|
if ( super_menu && (isMenu(super_menu) || isMenuBar(super_menu)) )
|
||||||
|
{
|
||||||
|
FMenuList* menu_list = dynamic_cast<FMenuList*>(super_menu);
|
||||||
|
|
||||||
|
if ( menu_list )
|
||||||
|
menu_list->remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
delAccelerator();
|
delAccelerator();
|
||||||
|
|
||||||
// remove dialog list item callback from the dialog
|
// remove dialog list item callback from the dialog
|
||||||
|
|
|
@ -240,22 +240,8 @@ int FObject::addTimer (int interval)
|
||||||
timeval time_interval;
|
timeval time_interval;
|
||||||
timeval currentTime;
|
timeval currentTime;
|
||||||
int id = 1;
|
int id = 1;
|
||||||
|
|
||||||
timer_modify_lock = true;
|
timer_modify_lock = true;
|
||||||
|
|
||||||
if ( ! timer_list )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
timer_list = new TimerList();
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// find an unused timer id
|
// find an unused timer id
|
||||||
if ( ! timer_list->empty() )
|
if ( ! timer_list->empty() )
|
||||||
{
|
{
|
||||||
|
@ -389,4 +375,52 @@ bool FObject::event (FEvent* ev)
|
||||||
void FObject::onTimer (FTimerEvent*)
|
void FObject::onTimer (FTimerEvent*)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
uInt FObject::processTimerEvent()
|
||||||
|
{
|
||||||
|
FObject::TimerList::iterator iter, last;
|
||||||
|
timeval currentTime;
|
||||||
|
uInt activated = 0;
|
||||||
|
|
||||||
|
getCurrentTime (¤tTime);
|
||||||
|
|
||||||
|
if ( isTimerInUpdating() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( ! timer_list )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( timer_list->empty() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
iter = timer_list->begin();
|
||||||
|
last = timer_list->end();
|
||||||
|
|
||||||
|
while ( iter != last )
|
||||||
|
{
|
||||||
|
if ( ! iter->id
|
||||||
|
|| ! iter->object
|
||||||
|
|| currentTime < iter->timeout ) // no timer expired
|
||||||
|
break;
|
||||||
|
|
||||||
|
iter->timeout += iter->interval;
|
||||||
|
|
||||||
|
if ( iter->timeout < currentTime )
|
||||||
|
iter->timeout = currentTime + iter->interval;
|
||||||
|
|
||||||
|
if ( iter->interval.tv_usec > 0 || iter->interval.tv_sec > 0 )
|
||||||
|
activated++;
|
||||||
|
|
||||||
|
FTimerEvent t_ev(fc::Timer_Event, iter->id);
|
||||||
|
performTimerAction (iter->object, &t_ev);
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return activated;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FObject::performTimerAction (const FObject*, const FEvent*)
|
||||||
|
{ }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -57,6 +57,7 @@ FOptiMove::FOptiMove (int baud)
|
||||||
, F_clr_eol()
|
, F_clr_eol()
|
||||||
, automatic_left_margin(false)
|
, automatic_left_margin(false)
|
||||||
, eat_nl_glitch(false)
|
, eat_nl_glitch(false)
|
||||||
|
, move_buf()
|
||||||
, char_duration(1)
|
, char_duration(1)
|
||||||
, baudrate(baud)
|
, baudrate(baud)
|
||||||
, tabstop(0)
|
, tabstop(0)
|
||||||
|
@ -64,7 +65,10 @@ FOptiMove::FOptiMove (int baud)
|
||||||
, screen_height(24)
|
, screen_height(24)
|
||||||
{
|
{
|
||||||
assert ( baud >= 0 );
|
assert ( baud >= 0 );
|
||||||
move_buf[0] = '\0';
|
|
||||||
|
// Initialize arrays with '\0'
|
||||||
|
std::fill_n (move_buf, sizeof(move_buf), '\0');
|
||||||
|
|
||||||
calculateCharDuration();
|
calculateCharDuration();
|
||||||
|
|
||||||
// ANSI set cursor address preset for undefined terminals
|
// ANSI set cursor address preset for undefined terminals
|
||||||
|
@ -830,7 +834,7 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x)
|
||||||
// Move to fixed column position1
|
// Move to fixed column position1
|
||||||
std::strncat ( hmove
|
std::strncat ( hmove
|
||||||
, tparm(F_column_address.cap, to_x, 0, 0, 0, 0, 0, 0, 0, 0)
|
, tparm(F_column_address.cap, to_x, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
, BUF_SIZE - std::strlen(hmove) );
|
, BUF_SIZE - std::strlen(hmove) - 1);
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove[BUF_SIZE - 1] = '\0';
|
||||||
htime = F_column_address.duration;
|
htime = F_column_address.duration;
|
||||||
}
|
}
|
||||||
|
@ -853,7 +857,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
{
|
{
|
||||||
std::strncpy ( hmove
|
std::strncpy ( hmove
|
||||||
, tparm(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
|
, tparm(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
, BUF_SIZE );
|
, BUF_SIZE - 1);
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove[BUF_SIZE - 1] = '\0';
|
||||||
htime = F_parm_right_cursor.duration;
|
htime = F_parm_right_cursor.duration;
|
||||||
}
|
}
|
||||||
|
@ -908,7 +912,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
{
|
{
|
||||||
std::strncpy ( hmove
|
std::strncpy ( hmove
|
||||||
, tparm(F_parm_left_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
|
, tparm(F_parm_left_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
, BUF_SIZE );
|
, BUF_SIZE - 1);
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove[BUF_SIZE - 1] = '\0';
|
||||||
htime = F_parm_left_cursor.duration;
|
htime = F_parm_left_cursor.duration;
|
||||||
}
|
}
|
||||||
|
@ -973,7 +977,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
|
||||||
if ( move_xy )
|
if ( move_xy )
|
||||||
{
|
{
|
||||||
char* move_ptr = move_buf;
|
char* move_ptr = move_buf;
|
||||||
std::strncpy (move_ptr, move_xy, BUF_SIZE);
|
std::strncpy (move_ptr, move_xy, BUF_SIZE - 1);
|
||||||
move_ptr[BUF_SIZE - 1] = '\0';
|
move_ptr[BUF_SIZE - 1] = '\0';
|
||||||
move_time = F_cursor_address.duration;
|
move_time = F_cursor_address.duration;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1123,7 +1127,7 @@ void FOptiMove::moveByMethod ( int method
|
||||||
case 2:
|
case 2:
|
||||||
if ( F_carriage_return.cap )
|
if ( F_carriage_return.cap )
|
||||||
{
|
{
|
||||||
std::strncpy (move_ptr, F_carriage_return.cap, BUF_SIZE);
|
std::strncpy (move_ptr, F_carriage_return.cap, BUF_SIZE - 1);
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
move_ptr[BUF_SIZE - 1] ='\0';
|
||||||
move_ptr += F_carriage_return.length;
|
move_ptr += F_carriage_return.length;
|
||||||
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
||||||
|
@ -1131,14 +1135,14 @@ void FOptiMove::moveByMethod ( int method
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
std::strncpy (move_ptr, F_cursor_home.cap, BUF_SIZE);
|
std::strncpy (move_ptr, F_cursor_home.cap, BUF_SIZE - 1);
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
move_ptr[BUF_SIZE - 1] ='\0';
|
||||||
move_ptr += F_cursor_home.length;
|
move_ptr += F_cursor_home.length;
|
||||||
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE);
|
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE - 1);
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
move_ptr[BUF_SIZE - 1] ='\0';
|
||||||
move_ptr += F_cursor_to_ll.length;
|
move_ptr += F_cursor_to_ll.length;
|
||||||
relativeMove (move_ptr, 0, screen_height - 1, xnew, ynew);
|
relativeMove (move_ptr, 0, screen_height - 1, xnew, ynew);
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool on)
|
||||||
if ( on == mouse_focus )
|
if ( on == mouse_focus )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return mouse_focus = ( on ) ? true : false;
|
return mouse_focus = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2676,14 +2676,13 @@ inline void FString::_assign (const wchar_t s[])
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
inline void FString::_insert (uInt len, const wchar_t s[])
|
||||||
{
|
{
|
||||||
if ( len == 0 ) // String s is a null or a empty string
|
if ( len == 0 ) // String s is a null or a empty string
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! string )
|
if ( string )
|
||||||
{
|
delete[](string);
|
||||||
// string is null
|
|
||||||
|
|
||||||
length = len;
|
length = len;
|
||||||
bufsize = FWDBUFFER + length + 1;
|
bufsize = FWDBUFFER + length + 1;
|
||||||
|
@ -2700,7 +2699,17 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||||
|
|
||||||
std::wcsncpy (string, s, bufsize);
|
std::wcsncpy (string, s, bufsize);
|
||||||
string[bufsize - 1] = L'\0';
|
string[bufsize - 1] = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||||
|
{
|
||||||
|
if ( len == 0 ) // String s is a null or a empty string
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( ! string ) // string is null
|
||||||
|
{
|
||||||
|
_insert (len, s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ FSwitch::FSwitch(FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FSwitch::FSwitch ( const FString& txt, FWidget* parent )
|
FSwitch::FSwitch (const FString& txt, FWidget* parent)
|
||||||
: FToggleButton(txt, parent)
|
: FToggleButton(txt, parent)
|
||||||
, switch_offset_pos(0)
|
, switch_offset_pos(0)
|
||||||
, button_pressed(false)
|
, button_pressed(false)
|
||||||
|
|
606
src/fterm.cpp
606
src/fterm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,9 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ftcap_map.h - Internally used termcap capabilities *
|
* ftermcap.cpp - Provides access to terminal capabilities *
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2017 Markus Gans *
|
* Copyright 2015-2018 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -20,22 +20,41 @@
|
||||||
* <http://www.gnu.org/licenses/>. *
|
* <http://www.gnu.org/licenses/>. *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#ifndef FTCAPMAP_H
|
|
||||||
#define FTCAPMAP_H
|
|
||||||
|
|
||||||
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
||||||
#error "Only <final/final.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace fc
|
// static class attributes
|
||||||
{
|
bool FTermcap::background_color_erase = false;
|
||||||
|
bool FTermcap::automatic_left_margin = false;
|
||||||
|
bool FTermcap::automatic_right_margin = false;
|
||||||
|
bool FTermcap::eat_nl_glitch = false;
|
||||||
|
bool FTermcap::ansi_default_color = false;
|
||||||
|
bool FTermcap::osc_support = false;
|
||||||
|
bool FTermcap::no_utf8_acs_chars = false;
|
||||||
|
int FTermcap::max_color = 1;
|
||||||
|
int FTermcap::tabstop = 8;
|
||||||
|
int FTermcap::attr_without_color = 0;
|
||||||
|
|
||||||
static FTermcap::tcap_map term_caps[] =
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FTermcap
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::FTermcap()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::~FTermcap() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
// private Data Member of FTermcap - termcap capabilities
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::tcap_map FTermcap::tcap[] =
|
||||||
{
|
{
|
||||||
// .------------- term string
|
// .------------- term string
|
||||||
// | .-------- Tcap-code
|
// | .-------- Tcap-code
|
||||||
|
@ -140,8 +159,4 @@ static FTermcap::tcap_map term_caps[] =
|
||||||
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} // namespace fc
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FTCAPMAP_H
|
|
|
@ -26,8 +26,8 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
char FTermcapQuirks::termtype[256] = { };
|
|
||||||
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
|
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
|
||||||
|
FTermData* FTermcapQuirks::fterm_data = 0;
|
||||||
FTermDetection* FTermcapQuirks::term_detection = 0;
|
FTermDetection* FTermcapQuirks::term_detection = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,9 @@ FTermDetection* FTermcapQuirks::term_detection = 0;
|
||||||
// constructors and destructor
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermcapQuirks::FTermcapQuirks()
|
FTermcapQuirks::FTermcapQuirks()
|
||||||
{ }
|
{
|
||||||
|
tcap = FTermcap::getTermcapMap();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermcapQuirks::~FTermcapQuirks() // destructor
|
FTermcapQuirks::~FTermcapQuirks() // destructor
|
||||||
|
@ -47,16 +49,9 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
|
||||||
|
|
||||||
// public methods of FTermcapQuirks
|
// public methods of FTermcapQuirks
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirks::setTerminalType (const char tt[])
|
void FTermcapQuirks::setTermData (FTermData* data)
|
||||||
{
|
{
|
||||||
std::strncpy (termtype, tt, sizeof(termtype));
|
fterm_data = data;
|
||||||
termtype[sizeof(termtype) - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FTermcapQuirks::setTermcapMap (FTermcap::tcap_map* tc)
|
|
||||||
{
|
|
||||||
tcap = tc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -255,6 +250,8 @@ void FTermcapQuirks::init_termcap_xterm_quirks()
|
||||||
void FTermcapQuirks::init_termcap_rxvt_quirks()
|
void FTermcapQuirks::init_termcap_rxvt_quirks()
|
||||||
{
|
{
|
||||||
// Set enter/exit alternative charset mode for rxvt terminal
|
// Set enter/exit alternative charset mode for rxvt terminal
|
||||||
|
const char* termtype = fterm_data->getTermType();
|
||||||
|
|
||||||
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
||||||
{
|
{
|
||||||
TCAP(fc::t_enter_alt_charset_mode) = \
|
TCAP(fc::t_enter_alt_charset_mode) = \
|
||||||
|
|
|
@ -31,8 +31,8 @@ FTermDetection::terminalType FTermDetection::terminal_type = \
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
FTermDetection::colorEnv FTermDetection::color_env;
|
FTermDetection::colorEnv FTermDetection::color_env;
|
||||||
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
||||||
|
FTermData* FTermDetection::fterm_data = 0;
|
||||||
char FTermDetection::termtype[256] = { };
|
char FTermDetection::termtype[256] = { };
|
||||||
char FTermDetection::termfilename[256] = { };
|
|
||||||
char FTermDetection::ttytypename[256] = { };
|
char FTermDetection::ttytypename[256] = { };
|
||||||
bool FTermDetection::decscusr_support;
|
bool FTermDetection::decscusr_support;
|
||||||
bool FTermDetection::terminal_detection;
|
bool FTermDetection::terminal_detection;
|
||||||
|
@ -89,13 +89,9 @@ FTermDetection::~FTermDetection() // destructor
|
||||||
|
|
||||||
// public methods of FTermDetection
|
// public methods of FTermDetection
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetection::setTermFileName (char term_filename[])
|
void FTermDetection::setTermData (FTermData* data)
|
||||||
{
|
{
|
||||||
if ( ! term_filename )
|
fterm_data = data;
|
||||||
return;
|
|
||||||
|
|
||||||
std::strncpy (termfilename, term_filename, sizeof(termfilename));
|
|
||||||
termfilename[sizeof(termfilename) - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -128,6 +124,7 @@ void FTermDetection::getSystemTermType()
|
||||||
{
|
{
|
||||||
// Import the untrusted environment variable TERM
|
// Import the untrusted environment variable TERM
|
||||||
const char* const& term_env = std::getenv(C_STR("TERM"));
|
const char* const& term_env = std::getenv(C_STR("TERM"));
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
|
|
||||||
if ( term_env )
|
if ( term_env )
|
||||||
{
|
{
|
||||||
|
@ -164,6 +161,7 @@ bool FTermDetection::getTTYtype()
|
||||||
// vt100 ttys0
|
// vt100 ttys0
|
||||||
|
|
||||||
// Get term basename
|
// Get term basename
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
const char* term_basename = std::strrchr(termfilename, '/');
|
const char* term_basename = std::strrchr(termfilename, '/');
|
||||||
|
|
||||||
if ( term_basename == 0 )
|
if ( term_basename == 0 )
|
||||||
|
@ -221,6 +219,7 @@ bool FTermDetection::getTTYSFileEntry()
|
||||||
// Analyse /etc/ttys and get the term name
|
// Analyse /etc/ttys and get the term name
|
||||||
|
|
||||||
// get term basename
|
// get term basename
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
const char* term_basename = std::strrchr(termfilename, '/');
|
const char* term_basename = std::strrchr(termfilename, '/');
|
||||||
|
|
||||||
if ( term_basename == 0 )
|
if ( term_basename == 0 )
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace finalcut
|
||||||
console_font_op FTermLinux::screen_font;
|
console_font_op FTermLinux::screen_font;
|
||||||
unimapdesc FTermLinux::screen_unicode_map;
|
unimapdesc FTermLinux::screen_unicode_map;
|
||||||
|
|
||||||
bool FTermLinux::NewFont;
|
bool FTermLinux::new_font;
|
||||||
bool FTermLinux::VGAFont;
|
bool FTermLinux::vga_font;
|
||||||
bool FTermLinux::shadow_character = true;
|
bool FTermLinux::shadow_character = true;
|
||||||
bool FTermLinux::half_block_character = true;
|
bool FTermLinux::half_block_character = true;
|
||||||
bool FTermLinux::has_saved_palette = false;
|
bool FTermLinux::has_saved_palette = false;
|
||||||
|
@ -194,7 +194,7 @@ void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
||||||
{
|
{
|
||||||
uInt c1, c2, c3, c4, c5;
|
uInt c1, c2, c3, c4, c5;
|
||||||
|
|
||||||
if ( NewFont || VGAFont )
|
if ( new_font || vga_font )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( screen_unicode_map.entry_ct != 0 )
|
if ( screen_unicode_map.entry_ct != 0 )
|
||||||
|
@ -255,7 +255,7 @@ void FTermLinux::finish()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::loadVGAFont()
|
bool FTermLinux::loadVGAFont()
|
||||||
{
|
{
|
||||||
VGAFont = true;
|
vga_font = true;
|
||||||
|
|
||||||
if ( FTerm::openConsole() == 0 )
|
if ( FTerm::openConsole() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ bool FTermLinux::loadVGAFont()
|
||||||
int ret = setScreenFont(fc::__8x16std, 256, 8, 16);
|
int ret = setScreenFont(fc::__8x16std, 256, 8, 16);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
struct unimapdesc unimap;
|
struct unimapdesc unimap;
|
||||||
|
@ -275,24 +275,24 @@ bool FTermLinux::loadVGAFont()
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
FTerm::detectTermSize();
|
FTerm::detectTermSize();
|
||||||
FTerm::closeConsole();
|
FTerm::closeConsole();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
if ( VGAFont )
|
if ( vga_font )
|
||||||
shadow_character = half_block_character = true;
|
shadow_character = half_block_character = true;
|
||||||
|
|
||||||
return VGAFont;
|
return vga_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::loadNewFont()
|
bool FTermLinux::loadNewFont()
|
||||||
{
|
{
|
||||||
NewFont = true;
|
new_font = true;
|
||||||
|
|
||||||
if ( FTerm::openConsole() == 0 )
|
if ( FTerm::openConsole() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -302,7 +302,7 @@ bool FTermLinux::loadNewFont()
|
||||||
int ret = setScreenFont(fc::__8x16graph, 256, 8, 16);
|
int ret = setScreenFont(fc::__8x16graph, 256, 8, 16);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
struct unimapdesc unimap;
|
struct unimapdesc unimap;
|
||||||
|
@ -312,18 +312,18 @@ bool FTermLinux::loadNewFont()
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
FTerm::detectTermSize();
|
FTerm::detectTermSize();
|
||||||
FTerm::closeConsole();
|
FTerm::closeConsole();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
if ( VGAFont )
|
if ( vga_font )
|
||||||
shadow_character = half_block_character = true;
|
shadow_character = half_block_character = true;
|
||||||
|
|
||||||
return NewFont;
|
return new_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -363,7 +363,7 @@ bool FTermLinux::loadOldFont (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( retval )
|
if ( retval )
|
||||||
VGAFont = NewFont = false;
|
vga_font = new_font = false;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,8 @@ namespace finalcut
|
||||||
bool FTermXTerminal::mouse_support;
|
bool FTermXTerminal::mouse_support;
|
||||||
bool FTermXTerminal::meta_sends_esc;
|
bool FTermXTerminal::meta_sends_esc;
|
||||||
bool FTermXTerminal::xterm_default_colors;
|
bool FTermXTerminal::xterm_default_colors;
|
||||||
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
|
int FTermXTerminal::term_width = 80;
|
||||||
FTermDetection* FTermXTerminal::term_detection = 0;
|
int FTermXTerminal::term_height = 24;
|
||||||
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
|
||||||
const FString* FTermXTerminal::xterm_font = 0;
|
const FString* FTermXTerminal::xterm_font = 0;
|
||||||
const FString* FTermXTerminal::xterm_title = 0;
|
const FString* FTermXTerminal::xterm_title = 0;
|
||||||
const FString* FTermXTerminal::foreground_color = 0;
|
const FString* FTermXTerminal::foreground_color = 0;
|
||||||
|
@ -42,6 +41,9 @@ const FString* FTermXTerminal::cursor_color = 0;
|
||||||
const FString* FTermXTerminal::mouse_foreground_color = 0;
|
const FString* FTermXTerminal::mouse_foreground_color = 0;
|
||||||
const FString* FTermXTerminal::mouse_background_color = 0;
|
const FString* FTermXTerminal::mouse_background_color = 0;
|
||||||
const FString* FTermXTerminal::highlight_background_color = 0;
|
const FString* FTermXTerminal::highlight_background_color = 0;
|
||||||
|
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
|
||||||
|
FTermDetection* FTermXTerminal::term_detection = 0;
|
||||||
|
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -56,6 +58,8 @@ FTermXTerminal::FTermXTerminal()
|
||||||
mouse_support = \
|
mouse_support = \
|
||||||
meta_sends_esc = \
|
meta_sends_esc = \
|
||||||
xterm_default_colors = false;
|
xterm_default_colors = false;
|
||||||
|
|
||||||
|
tcap = FTermcap::getTermcapMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -121,6 +125,16 @@ void FTermXTerminal::setTitle (const FString& title)
|
||||||
setXTermTitle();
|
setXTermTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermXTerminal::setTermSize (int width, int height)
|
||||||
|
{
|
||||||
|
// Set xterm size to {term_width} x {term_height}
|
||||||
|
|
||||||
|
term_width = width;
|
||||||
|
term_height = height;
|
||||||
|
setXTermSize();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermXTerminal::setForeground (const FString& fg)
|
void FTermXTerminal::setForeground (const FString& fg)
|
||||||
{
|
{
|
||||||
|
@ -398,6 +412,16 @@ void FTermXTerminal::setXTermTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermXTerminal::setXTermSize()
|
||||||
|
{
|
||||||
|
if ( term_detection->isXTerminal() )
|
||||||
|
{
|
||||||
|
FTerm::putstringf (CSI "8;%d;%dt", term_height, term_width);
|
||||||
|
std::fflush(stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermXTerminal::setXTermFont()
|
void FTermXTerminal::setXTermFont()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,8 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
|
||||||
, focus_inside_group(true)
|
, focus_inside_group(true)
|
||||||
, text()
|
, text()
|
||||||
{
|
{
|
||||||
init(txt);
|
FToggleButton::setText(txt); // call own method
|
||||||
|
init();
|
||||||
|
|
||||||
if ( parent && parent->isInstanceOf("FButtonGroup") )
|
if ( parent && parent->isInstanceOf("FButtonGroup") )
|
||||||
{
|
{
|
||||||
|
@ -611,13 +612,6 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
|
||||||
button_group = btngroup;
|
button_group = btngroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FToggleButton::init (const FString& txt)
|
|
||||||
{
|
|
||||||
setText(txt);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::init()
|
void FToggleButton::init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,8 +51,7 @@ FPoint* FVTerm::term_pos = 0;
|
||||||
FVTerm::term_area* FVTerm::vterm = 0;
|
FVTerm::term_area* FVTerm::vterm = 0;
|
||||||
FVTerm::term_area* FVTerm::vdesktop = 0;
|
FVTerm::term_area* FVTerm::vdesktop = 0;
|
||||||
FVTerm::term_area* FVTerm::active_area = 0;
|
FVTerm::term_area* FVTerm::active_area = 0;
|
||||||
FVTerm::termcap_map* FVTerm::tcap = 0;
|
FTermcap::tcap_map* FVTerm::tcap = 0;
|
||||||
FTermcap::tcap_map* FTermcap::tcap = 0;
|
|
||||||
FKeyboard* FVTerm::keyboard = 0;
|
FKeyboard* FVTerm::keyboard = 0;
|
||||||
FVTerm::charData FVTerm::term_attribute;
|
FVTerm::charData FVTerm::term_attribute;
|
||||||
FVTerm::charData FVTerm::next_attribute;
|
FVTerm::charData FVTerm::next_attribute;
|
||||||
|
@ -2099,7 +2098,7 @@ void FVTerm::init()
|
||||||
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
||||||
|
|
||||||
// Receive the terminal capabilities
|
// Receive the terminal capabilities
|
||||||
tcap = FTermcap().getTermcapMap();
|
tcap = FTermcap::getTermcapMap();
|
||||||
|
|
||||||
// Create virtual terminal
|
// Create virtual terminal
|
||||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||||
|
|
|
@ -361,7 +361,7 @@ bool FWidget::setEnable (bool on)
|
||||||
else
|
else
|
||||||
flags &= ~fc::active;
|
flags &= ~fc::active;
|
||||||
|
|
||||||
return enable = ( on ) ? true : false;
|
return enable = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -414,7 +414,7 @@ bool FWidget::setFocus (bool on)
|
||||||
window->setWindowFocusWidget(this);
|
window->setWindowFocusWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return focus = ( on ) ? true : false;
|
return focus = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool FWindow::activateWindow (bool on)
|
||||||
active_area = getVWin();
|
active_area = getVWin();
|
||||||
}
|
}
|
||||||
|
|
||||||
return window_active = ( on ) ? true : false;
|
return window_active = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -93,7 +93,7 @@ class FApplication : public FWidget
|
||||||
int getArgc() const;
|
int getArgc() const;
|
||||||
char** getArgv() const;
|
char** getArgv() const;
|
||||||
FWidget* getMainWidget() const;
|
FWidget* getMainWidget() const;
|
||||||
FWidget* getFocusWidget() const;
|
virtual FWidget* getFocusWidget() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setMainWidget (FWidget*);
|
void setMainWidget (FWidget*);
|
||||||
|
@ -175,9 +175,10 @@ class FApplication : public FWidget
|
||||||
void sendWheelEvent (const FPoint&, const FPoint&);
|
void sendWheelEvent (const FPoint&, const FPoint&);
|
||||||
void processMouseEvent();
|
void processMouseEvent();
|
||||||
void processResizeEvent();
|
void processResizeEvent();
|
||||||
int processTimerEvent();
|
|
||||||
void processCloseWidget();
|
void processCloseWidget();
|
||||||
bool processNextEvent();
|
bool processNextEvent();
|
||||||
|
virtual void performTimerAction ( const FObject*
|
||||||
|
, const FEvent* );
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
int app_argc;
|
int app_argc;
|
||||||
|
|
|
@ -89,13 +89,13 @@ class FButton : public FWidget
|
||||||
bool setNoUnderline(bool);
|
bool setNoUnderline(bool);
|
||||||
bool setNoUnderline();
|
bool setNoUnderline();
|
||||||
bool unsetNoUnderline();
|
bool unsetNoUnderline();
|
||||||
bool setEnable(bool);
|
virtual bool setEnable(bool);
|
||||||
bool setEnable();
|
virtual bool setEnable();
|
||||||
bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
bool setFocus(bool);
|
virtual bool setFocus(bool);
|
||||||
bool setFocus();
|
virtual bool setFocus();
|
||||||
bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
bool setFlat(bool);
|
bool setFlat(bool);
|
||||||
bool setFlat();
|
bool setFlat();
|
||||||
bool unsetFlat();
|
bool unsetFlat();
|
||||||
|
@ -117,17 +117,17 @@ class FButton : public FWidget
|
||||||
bool hasClickAnimation();
|
bool hasClickAnimation();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -149,7 +149,7 @@ class FButton : public FWidget
|
||||||
void drawMarginRight();
|
void drawMarginRight();
|
||||||
void drawTopBottomBackground();
|
void drawTopBottomBackground();
|
||||||
void drawButtonTextLine (wchar_t[]);
|
void drawButtonTextLine (wchar_t[]);
|
||||||
void draw();
|
virtual void draw();
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
void updateButtonColor();
|
void updateButtonColor();
|
||||||
void processClick();
|
void processClick();
|
||||||
|
|
|
@ -87,10 +87,10 @@ class FButtonGroup : public FScrollView
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
bool setEnable(bool);
|
virtual bool setEnable(bool);
|
||||||
bool setEnable();
|
virtual bool setEnable();
|
||||||
bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
|
@ -99,16 +99,16 @@ class FButtonGroup : public FScrollView
|
||||||
bool hasCheckedButton() const;
|
bool hasCheckedButton() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void insert (FToggleButton*);
|
void insert (FToggleButton*);
|
||||||
void remove (FToggleButton*);
|
void remove (FToggleButton*);
|
||||||
void checkScrollSize (FToggleButton*);
|
void checkScrollSize (FToggleButton*);
|
||||||
void checkScrollSize (const FRect&);
|
void checkScrollSize (const FRect&);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_buttonToggled (FWidget*, data_ptr);
|
void cb_buttonToggled (FWidget*, data_ptr);
|
||||||
|
|
|
@ -79,7 +79,7 @@ enum events
|
||||||
Timer_Event // timer event occur
|
Timer_Event // timer event occur
|
||||||
};
|
};
|
||||||
|
|
||||||
// Properties of a widget
|
// Properties of a widget ⚑
|
||||||
enum widget_flags
|
enum widget_flags
|
||||||
{
|
{
|
||||||
shadow = 0x00000001,
|
shadow = 0x00000001,
|
||||||
|
@ -1039,6 +1039,21 @@ enum sides
|
||||||
left = 3
|
left = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum sorting_type
|
||||||
|
{
|
||||||
|
by_name,
|
||||||
|
by_number,
|
||||||
|
user_defined,
|
||||||
|
unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
enum sorting_order
|
||||||
|
{
|
||||||
|
ascending,
|
||||||
|
descending,
|
||||||
|
unsorted
|
||||||
|
};
|
||||||
|
|
||||||
enum brackets_type
|
enum brackets_type
|
||||||
{
|
{
|
||||||
NoBrackets = 0,
|
NoBrackets = 0,
|
||||||
|
|
|
@ -91,7 +91,7 @@ class FCheckBox : public FToggleButton
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawCheckButton();
|
void drawCheckButton();
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -104,7 +104,7 @@ class FDialog : public FWindow
|
||||||
bool setModal (bool);
|
bool setModal (bool);
|
||||||
bool setModal();
|
bool setModal();
|
||||||
bool unsetModal();
|
bool unsetModal();
|
||||||
bool setResizeable (bool);
|
virtual bool setResizeable (bool);
|
||||||
bool setScrollable (bool);
|
bool setScrollable (bool);
|
||||||
bool setScrollable();
|
bool setScrollable();
|
||||||
bool unsetScrollable();
|
bool unsetScrollable();
|
||||||
|
@ -115,16 +115,16 @@ class FDialog : public FWindow
|
||||||
bool isScrollable();
|
bool isScrollable();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void show();
|
virtual void show();
|
||||||
void hide();
|
virtual void hide();
|
||||||
int exec();
|
int exec();
|
||||||
void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
void move (int, int);
|
virtual void move (int, int);
|
||||||
bool moveUp (int);
|
bool moveUp (int);
|
||||||
bool moveDown (int);
|
bool moveDown (int);
|
||||||
bool moveLeft (int);
|
bool moveLeft (int);
|
||||||
bool moveRight (int);
|
bool moveRight (int);
|
||||||
void setSize (int, int, bool = true);
|
virtual void setSize (int, int, bool = true);
|
||||||
bool reduceHeight (int);
|
bool reduceHeight (int);
|
||||||
bool expandHeight (int);
|
bool expandHeight (int);
|
||||||
bool reduceWidth (int);
|
bool reduceWidth (int);
|
||||||
|
@ -132,16 +132,16 @@ class FDialog : public FWindow
|
||||||
void activateDialog();
|
void activateDialog();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onMouseDoubleClick (FMouseEvent*);
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onWindowActive (FEvent*);
|
virtual void onWindowActive (FEvent*);
|
||||||
void onWindowInactive (FEvent*);
|
virtual void onWindowInactive (FEvent*);
|
||||||
void onWindowRaised (FEvent*);
|
virtual void onWindowRaised (FEvent*);
|
||||||
void onWindowLowered (FEvent*);
|
virtual void onWindowLowered (FEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -207,6 +207,7 @@ class FDialog : public FWindow
|
||||||
void moveSizeKey (FKeyEvent*);
|
void moveSizeKey (FKeyEvent*);
|
||||||
void raiseActivateDialog();
|
void raiseActivateDialog();
|
||||||
void lowerActivateDialog();
|
void lowerActivateDialog();
|
||||||
|
bool isLowerRightResizeCorner (mouseStates&);
|
||||||
void resizeMouseDown (mouseStates&);
|
void resizeMouseDown (mouseStates&);
|
||||||
void resizeMouseUpMove (mouseStates&, bool = false);
|
void resizeMouseUpMove (mouseStates&, bool = false);
|
||||||
void cancelMouseResize();
|
void cancelMouseResize();
|
||||||
|
|
|
@ -109,7 +109,7 @@ class FFileDialog : public FDialog
|
||||||
, DialogType = FFileDialog::Open
|
, DialogType = FFileDialog::Open
|
||||||
, FWidget* = 0 );
|
, FWidget* = 0 );
|
||||||
// Destructor
|
// Destructor
|
||||||
~FFileDialog();
|
virtual ~FFileDialog();
|
||||||
|
|
||||||
// Assignment operator (=)
|
// Assignment operator (=)
|
||||||
FFileDialog& operator = (const FFileDialog&);
|
FFileDialog& operator = (const FFileDialog&);
|
||||||
|
@ -129,7 +129,7 @@ class FFileDialog : public FDialog
|
||||||
bool unsetShowHiddenFiles();
|
bool unsetShowHiddenFiles();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static const FString fileOpenChooser ( FWidget*
|
static const FString fileOpenChooser ( FWidget*
|
||||||
|
@ -141,7 +141,7 @@ class FFileDialog : public FDialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedef
|
// Typedef
|
||||||
|
@ -163,10 +163,9 @@ class FFileDialog : public FDialog
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void init();
|
void init();
|
||||||
void allocation (int, int);
|
void widgetSettings (int, int);
|
||||||
void deallocation();
|
|
||||||
void initCallbacks();
|
void initCallbacks();
|
||||||
inline bool pattern_match (const char* const, char[]);
|
bool pattern_match (const char* const, char[]);
|
||||||
void clear();
|
void clear();
|
||||||
int numOfDirs();
|
int numOfDirs();
|
||||||
void sortDir();
|
void sortDir();
|
||||||
|
@ -191,11 +190,11 @@ class FFileDialog : public FDialog
|
||||||
dirEntries dir_entries;
|
dirEntries dir_entries;
|
||||||
FString directory;
|
FString directory;
|
||||||
FString filter_pattern;
|
FString filter_pattern;
|
||||||
FListBox* filebrowser;
|
FLineEdit filename;
|
||||||
FLineEdit* filename;
|
FListBox filebrowser;
|
||||||
FCheckBox* hidden;
|
FCheckBox hidden;
|
||||||
FButton* cancel;
|
FButton cancel;
|
||||||
FButton* open;
|
FButton open;
|
||||||
DialogType dlg_type;
|
DialogType dlg_type;
|
||||||
bool show_hidden;
|
bool show_hidden;
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ class FKeyboard
|
||||||
FKeyboardCommand escape_key_cmd;
|
FKeyboardCommand escape_key_cmd;
|
||||||
|
|
||||||
static timeval time_keypressed;
|
static timeval time_keypressed;
|
||||||
fc::fkeymap* termcap_map;
|
fc::fkeymap* key_map;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#undef linux
|
#undef linux
|
||||||
|
|
|
@ -107,7 +107,7 @@ class FLabel : public FWidget
|
||||||
bool setReverseMode(bool);
|
bool setReverseMode(bool);
|
||||||
bool setReverseMode();
|
bool setReverseMode();
|
||||||
bool unsetReverseMode();
|
bool unsetReverseMode();
|
||||||
bool setEnable (bool);
|
virtual bool setEnable (bool);
|
||||||
void setNumber (uLong);
|
void setNumber (uLong);
|
||||||
void setNumber (long);
|
void setNumber (long);
|
||||||
void setNumber (float, int = FLT_DIG);
|
void setNumber (float, int = FLT_DIG);
|
||||||
|
@ -120,12 +120,12 @@ class FLabel : public FWidget
|
||||||
bool hasReverseMode();
|
bool hasReverseMode();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
||||||
|
@ -143,7 +143,7 @@ class FLabel : public FWidget
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||||
void setHotkeyAccelerator();
|
void setHotkeyAccelerator();
|
||||||
int getAlignOffset (int);
|
int getAlignOffset (int);
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawMultiLine();
|
void drawMultiLine();
|
||||||
void drawSingleLine();
|
void drawSingleLine();
|
||||||
void printLine (wchar_t[], uInt, int, int = 0);
|
void printLine (wchar_t[], uInt, int, int = 0);
|
||||||
|
|
|
@ -104,13 +104,13 @@ class FLineEdit : public FWidget
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
void setLabelText (const FString&);
|
void setLabelText (const FString&);
|
||||||
void setLabelOrientation(const label_o);
|
void setLabelOrientation(const label_o);
|
||||||
bool setEnable(bool);
|
virtual bool setEnable(bool);
|
||||||
bool setEnable();
|
virtual bool setEnable();
|
||||||
bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
bool setFocus(bool);
|
virtual bool setFocus(bool);
|
||||||
bool setFocus();
|
virtual bool setFocus();
|
||||||
bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
bool setShadow(bool);
|
bool setShadow(bool);
|
||||||
bool setShadow();
|
bool setShadow();
|
||||||
bool unsetShadow();
|
bool unsetShadow();
|
||||||
|
@ -119,23 +119,23 @@ class FLineEdit : public FWidget
|
||||||
bool hasShadow();
|
bool hasShadow();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onHide (FHideEvent*);
|
virtual void onHide (FHideEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void adjustLabel();
|
void adjustLabel();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Enumeration
|
// Enumeration
|
||||||
|
@ -155,7 +155,7 @@ class FLineEdit : public FWidget
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
bool hasHotkey();
|
bool hasHotkey();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawInputField();
|
void drawInputField();
|
||||||
void keyLeft();
|
void keyLeft();
|
||||||
void keyRight();
|
void keyRight();
|
||||||
|
|
|
@ -153,7 +153,7 @@ class FListBox : public FWidget
|
||||||
FListBox (Container, LazyConverter, FWidget* = 0);
|
FListBox (Container, LazyConverter, FWidget* = 0);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FListBox();
|
virtual ~FListBox();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -173,14 +173,14 @@ class FListBox : public FWidget
|
||||||
void showInsideBrackets (int, fc::brackets_type);
|
void showInsideBrackets (int, fc::brackets_type);
|
||||||
void showNoBrackets (int);
|
void showNoBrackets (int);
|
||||||
void showNoBrackets (listBoxItems::iterator);
|
void showNoBrackets (listBoxItems::iterator);
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
void setMultiSelection (bool);
|
void setMultiSelection (bool);
|
||||||
void setMultiSelection ();
|
void setMultiSelection ();
|
||||||
void unsetMultiSelection ();
|
void unsetMultiSelection ();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
bool setFocus (bool);
|
virtual bool setFocus (bool);
|
||||||
bool setFocus();
|
virtual bool setFocus();
|
||||||
bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
|
@ -191,7 +191,7 @@ class FListBox : public FWidget
|
||||||
bool hasBrackets (listBoxItems::iterator) const;
|
bool hasBrackets (listBoxItems::iterator) const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
template <class Iterator, class InsertConverter>
|
template <class Iterator, class InsertConverter>
|
||||||
void insert (Iterator, Iterator, InsertConverter);
|
void insert (Iterator, Iterator, InsertConverter);
|
||||||
template <class Container, class LazyConverter>
|
template <class Container, class LazyConverter>
|
||||||
|
@ -209,21 +209,20 @@ class FListBox : public FWidget
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onMouseDoubleClick (FMouseEvent*);
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Methods
|
// Methods
|
||||||
void adjustYOffset();
|
void adjustYOffset();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Enumeration
|
// Enumeration
|
||||||
|
@ -245,7 +244,7 @@ class FListBox : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawLabel();
|
void drawLabel();
|
||||||
void drawList();
|
void drawList();
|
||||||
void drawListLine (int, listBoxItems::iterator, bool);
|
void drawListLine (int, listBoxItems::iterator, bool);
|
||||||
|
|
|
@ -84,7 +84,7 @@ class FListViewItem : public FObject
|
||||||
, FObjectIterator );
|
, FObjectIterator );
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FListViewItem();
|
virtual ~FListViewItem();
|
||||||
|
|
||||||
// Assignment operator (=)
|
// Assignment operator (=)
|
||||||
FListViewItem& operator = (const FListViewItem&);
|
FListViewItem& operator = (const FListViewItem&);
|
||||||
|
@ -92,12 +92,14 @@ class FListViewItem : public FObject
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
uInt getColumnCount() const;
|
uInt getColumnCount() const;
|
||||||
|
int getSortColumn() const;
|
||||||
FString getText (int) const;
|
FString getText (int) const;
|
||||||
|
FWidget::data_ptr getData() const;
|
||||||
uInt getDepth() const;
|
uInt getDepth() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setText (int, const FString&);
|
void setText (int, const FString&);
|
||||||
|
void setData (FWidget::data_ptr);
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isExpand() const;
|
bool isExpand() const;
|
||||||
|
@ -113,6 +115,8 @@ class FListViewItem : public FObject
|
||||||
bool isExpandable() const;
|
bool isExpandable() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
template<typename Compare>
|
||||||
|
void sort (Compare);
|
||||||
FObjectIterator appendItem (FListViewItem*);
|
FObjectIterator appendItem (FListViewItem*);
|
||||||
void replaceControlCodes();
|
void replaceControlCodes();
|
||||||
int getVisibleLines();
|
int getVisibleLines();
|
||||||
|
@ -121,6 +125,7 @@ class FListViewItem : public FObject
|
||||||
// Data Members
|
// Data Members
|
||||||
FStringList column_list;
|
FStringList column_list;
|
||||||
FWidget::data_ptr data_pointer;
|
FWidget::data_ptr data_pointer;
|
||||||
|
FObjectIterator root;
|
||||||
int visible_lines;
|
int visible_lines;
|
||||||
bool expandable;
|
bool expandable;
|
||||||
bool is_expand;
|
bool is_expand;
|
||||||
|
@ -141,6 +146,14 @@ inline const char* FListViewItem::getClassName() const
|
||||||
inline uInt FListViewItem::getColumnCount() const
|
inline uInt FListViewItem::getColumnCount() const
|
||||||
{ return uInt(column_list.size()); }
|
{ return uInt(column_list.size()); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::data_ptr FListViewItem::getData() const
|
||||||
|
{ return data_pointer; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FListViewItem::setData (FWidget::data_ptr data)
|
||||||
|
{ data_pointer = data; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListViewItem::isExpand() const
|
inline bool FListViewItem::isExpand() const
|
||||||
{ return is_expand; }
|
{ return is_expand; }
|
||||||
|
@ -166,12 +179,9 @@ class FListViewIterator
|
||||||
typedef std::stack<FObjectIterator> FObjectIteratorStack;
|
typedef std::stack<FObjectIterator> FObjectIteratorStack;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FListViewIterator ();
|
explicit FListViewIterator ();
|
||||||
FListViewIterator (FObjectIterator);
|
FListViewIterator (FObjectIterator);
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~FListViewIterator();
|
|
||||||
|
|
||||||
// Overloaded operators
|
// Overloaded operators
|
||||||
FListViewIterator& operator ++ (); // prefix
|
FListViewIterator& operator ++ (); // prefix
|
||||||
FListViewIterator operator ++ (int); // postfix
|
FListViewIterator operator ++ (int); // postfix
|
||||||
|
@ -246,19 +256,30 @@ class FListView : public FWidget
|
||||||
explicit FListView (FWidget* = 0);
|
explicit FListView (FWidget* = 0);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FListView();
|
virtual ~FListView();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
uInt getCount();
|
uInt getCount();
|
||||||
fc::text_alignment getColumnAlignment (int) const;
|
fc::text_alignment getColumnAlignment (int) const;
|
||||||
FString getColumnText (int) const;
|
FString getColumnText (int) const;
|
||||||
|
fc::sorting_type getColumnSortType (int) const;
|
||||||
|
fc::sorting_order getSortOrder() const;
|
||||||
|
int getSortColumn() const;
|
||||||
FListViewItem* getCurrentItem();
|
FListViewItem* getCurrentItem();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
void setColumnAlignment (int, fc::text_alignment);
|
void setColumnAlignment (int, fc::text_alignment);
|
||||||
void setColumnText (int, const FString&);
|
void setColumnText (int, const FString&);
|
||||||
|
void setColumnSortType (int,fc::sorting_type \
|
||||||
|
= fc::by_name);
|
||||||
|
void setColumnSort (int, fc::sorting_order \
|
||||||
|
= fc::ascending);
|
||||||
|
template<typename Compare>
|
||||||
|
void setUserAscendingCompare (Compare);
|
||||||
|
template<typename Compare>
|
||||||
|
void setUserDescendingCompare (Compare);
|
||||||
bool setTreeView (bool);
|
bool setTreeView (bool);
|
||||||
bool setTreeView();
|
bool setTreeView();
|
||||||
bool unsetTreeView();
|
bool unsetTreeView();
|
||||||
|
@ -283,17 +304,18 @@ class FListView : public FWidget
|
||||||
, FObjectIterator );
|
, FObjectIterator );
|
||||||
FObjectIterator beginOfList();
|
FObjectIterator beginOfList();
|
||||||
FObjectIterator endOfList();
|
FObjectIterator endOfList();
|
||||||
|
virtual void sort();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onMouseDoubleClick (FMouseEvent*);
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static FObjectIterator null_iter;
|
static FObjectIterator null_iter;
|
||||||
|
@ -301,12 +323,13 @@ class FListView : public FWidget
|
||||||
protected:
|
protected:
|
||||||
// Methods
|
// Methods
|
||||||
void adjustViewport();
|
void adjustViewport();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedef
|
// Typedef
|
||||||
struct Header; // forward declaration
|
struct Header; // forward declaration
|
||||||
typedef std::vector<Header> headerItems;
|
typedef std::vector<Header> headerItems;
|
||||||
|
typedef std::vector<fc::sorting_type> sortTypes;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const int USE_MAX_SIZE = -1;
|
static const int USE_MAX_SIZE = -1;
|
||||||
|
@ -319,8 +342,10 @@ class FListView : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
template<typename Compare>
|
||||||
|
void sort (Compare);
|
||||||
uInt getAlignOffset (fc::text_alignment, uInt, uInt);
|
uInt getAlignOffset (fc::text_alignment, uInt, uInt);
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawColumnLabels();
|
void drawColumnLabels();
|
||||||
void drawList();
|
void drawList();
|
||||||
void drawListLine (const FListViewItem*, bool, bool);
|
void drawListLine (const FListViewItem*, bool, bool);
|
||||||
|
@ -330,6 +355,7 @@ class FListView : public FWidget
|
||||||
void drawColumnEllipsis ( headerItems::const_iterator&
|
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||||
, const FString& );
|
, const FString& );
|
||||||
void updateDrawing (bool, bool);
|
void updateDrawing (bool, bool);
|
||||||
|
int determineLineWidth (FListViewItem* item);
|
||||||
void recalculateHorizontalBar (int);
|
void recalculateHorizontalBar (int);
|
||||||
void recalculateVerticalBar (int);
|
void recalculateVerticalBar (int);
|
||||||
void wheelUp (int);
|
void wheelUp (int);
|
||||||
|
@ -383,6 +409,11 @@ class FListView : public FWidget
|
||||||
int xoffset;
|
int xoffset;
|
||||||
int nf_offset;
|
int nf_offset;
|
||||||
int max_line_width;
|
int max_line_width;
|
||||||
|
int sort_column;
|
||||||
|
sortTypes sort_type;
|
||||||
|
fc::sorting_order sort_order;
|
||||||
|
bool (*user_defined_ascending) (const FObject*, const FObject*);
|
||||||
|
bool (*user_defined_descending) (const FObject*, const FObject*);
|
||||||
|
|
||||||
// Friend class
|
// Friend class
|
||||||
friend class FListViewItem;
|
friend class FListViewItem;
|
||||||
|
@ -399,16 +430,13 @@ class FListView : public FWidget
|
||||||
struct FListView::Header
|
struct FListView::Header
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Header()
|
explicit Header()
|
||||||
: name()
|
: name()
|
||||||
, width (0)
|
, width (0)
|
||||||
, fixed_width (false)
|
, fixed_width (false)
|
||||||
, alignment (fc::alignLeft)
|
, alignment (fc::alignLeft)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~Header()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
FString name;
|
FString name;
|
||||||
int width;
|
int width;
|
||||||
bool fixed_width;
|
bool fixed_width;
|
||||||
|
@ -422,13 +450,31 @@ struct FListView::Header
|
||||||
inline const char* FListView::getClassName() const
|
inline const char* FListView::getClassName() const
|
||||||
{ return "FListView"; }
|
{ return "FListView"; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline fc::sorting_order FListView::getSortOrder() const
|
||||||
|
{ return sort_order; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline int FListView::getSortColumn() const
|
||||||
|
{ return sort_column; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListViewItem* FListView::getCurrentItem()
|
inline FListViewItem* FListView::getCurrentItem()
|
||||||
{ return static_cast<FListViewItem*>(*current_iter); }
|
{ return static_cast<FListViewItem*>(*current_iter); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template<typename Compare>
|
||||||
|
inline void FListView::setUserAscendingCompare (Compare cmp)
|
||||||
|
{ user_defined_ascending = cmp; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template<typename Compare>
|
||||||
|
inline void FListView::setUserDescendingCompare (Compare cmp)
|
||||||
|
{ user_defined_descending = cmp; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListView::setTreeView (bool on)
|
inline bool FListView::setTreeView (bool on)
|
||||||
{ return tree_view = ( on ) ? true : false; }
|
{ return tree_view = on; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListView::setTreeView()
|
inline bool FListView::setTreeView()
|
||||||
|
@ -444,7 +490,7 @@ inline FObject::FObjectIterator FListView::insert (FListViewItem* item)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::FObjectIterator
|
inline FObject::FObjectIterator
|
||||||
FListView::insert ( const FStringList& cols, data_ptr d )
|
FListView::insert (const FStringList& cols, data_ptr d)
|
||||||
{ return insert (cols, d, root); }
|
{ return insert (cols, d, root); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -455,7 +501,7 @@ inline FObject::FObjectIterator
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FObject::FObjectIterator
|
inline FObject::FObjectIterator
|
||||||
FListView::insert ( const std::vector<long>& cols, data_ptr d )
|
FListView::insert (const std::vector<long>& cols, data_ptr d)
|
||||||
{ return insert (cols, d, root); }
|
{ return insert (cols, d, root); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -87,19 +87,19 @@ class FMenu : public FWindow, public FMenuList
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
FString getText() const;
|
FString getText() const;
|
||||||
FMenuItem* getItem() const;
|
FMenuItem* getItem();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
bool setEnable(bool);
|
virtual bool setEnable(bool);
|
||||||
bool setEnable();
|
virtual bool setEnable();
|
||||||
bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
void setSelected();
|
void setSelected();
|
||||||
void unsetSelected();
|
void unsetSelected();
|
||||||
bool setMenuWidget (bool);
|
bool setMenuWidget (bool);
|
||||||
bool setMenuWidget();
|
bool setMenuWidget();
|
||||||
bool unsetMenuWidget();
|
bool unsetMenuWidget();
|
||||||
void setStatusbarMessage (const FString&);
|
virtual void setStatusbarMessage (const FString&);
|
||||||
void setMenu (FMenu*);
|
void setMenu (FMenu*);
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
|
@ -110,15 +110,15 @@ class FMenu : public FWindow, public FMenuList
|
||||||
bool hasMenu() const;
|
bool hasMenu() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void show();
|
virtual void show();
|
||||||
void hide();
|
virtual void hide();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_menuitem_toggled (FWidget*, data_ptr);
|
void cb_menuitem_toggled (FWidget*, data_ptr);
|
||||||
|
@ -200,7 +200,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void keypressMenuBar (FKeyEvent*);
|
void keypressMenuBar (FKeyEvent*);
|
||||||
bool hotkeyMenu (FKeyEvent*);
|
bool hotkeyMenu (FKeyEvent*);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawSeparator (int);
|
void drawSeparator (int);
|
||||||
void drawMenuLine (FMenuItem*, int);
|
void drawMenuLine (FMenuItem*, int);
|
||||||
|
@ -228,7 +228,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
friend class FRadioMenuItem;
|
friend class FRadioMenuItem;
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FMenuItem* item;
|
FMenuItem item;
|
||||||
FWidget* super_menu;
|
FWidget* super_menu;
|
||||||
FMenu* opened_sub_menu;
|
FMenu* opened_sub_menu;
|
||||||
FMenu* shown_sub_menu;
|
FMenu* shown_sub_menu;
|
||||||
|
@ -247,35 +247,35 @@ inline const char* FMenu::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString FMenu::getText() const
|
inline FString FMenu::getText() const
|
||||||
{ return item->getText(); }
|
{ return item.getText(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FMenuItem* FMenu::getItem() const
|
inline FMenuItem* FMenu::getItem()
|
||||||
{ return item; }
|
{ return &item; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::setEnable(bool on)
|
inline bool FMenu::setEnable(bool on)
|
||||||
{ return item->setEnable(on); }
|
{ return item.setEnable(on); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::setEnable()
|
inline bool FMenu::setEnable()
|
||||||
{ return item->setEnable(); }
|
{ return item.setEnable(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::unsetEnable()
|
inline bool FMenu::unsetEnable()
|
||||||
{ return item->unsetEnable(); }
|
{ return item.unsetEnable(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::setDisable()
|
inline bool FMenu::setDisable()
|
||||||
{ return item->setDisable(); }
|
{ return item.setDisable(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::setSelected()
|
inline void FMenu::setSelected()
|
||||||
{ item->setSelected(); }
|
{ item.setSelected(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::unsetSelected()
|
inline void FMenu::unsetSelected()
|
||||||
{ item->unsetSelected(); }
|
{ item.unsetSelected(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::setMenuWidget()
|
inline bool FMenu::setMenuWidget()
|
||||||
|
@ -287,27 +287,27 @@ inline bool FMenu::unsetMenuWidget()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::setMenu (FMenu* m)
|
inline void FMenu::setMenu (FMenu* m)
|
||||||
{ item->setMenu(m); }
|
{ item.setMenu(m); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::setText (const FString& txt)
|
inline void FMenu::setText (const FString& txt)
|
||||||
{ item->setText(txt); }
|
{ item.setText(txt); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::isEnabled() const
|
inline bool FMenu::isEnabled() const
|
||||||
{ return item->isEnabled(); }
|
{ return item.isEnabled(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::isSelected() const
|
inline bool FMenu::isSelected() const
|
||||||
{ return item->isSelected(); }
|
{ return item.isSelected(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::hasHotkey() const
|
inline bool FMenu::hasHotkey() const
|
||||||
{ return item->hasHotkey(); }
|
{ return item.hasHotkey(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FMenu::hasMenu() const
|
inline bool FMenu::hasMenu() const
|
||||||
{ return item->hasMenu(); }
|
{ return item.hasMenu(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FWidget* FMenu::getSuperMenu() const
|
inline FWidget* FMenu::getSuperMenu() const
|
||||||
|
@ -327,7 +327,7 @@ inline FMenu* FMenu::superMenuAt (const FPoint& p)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::onAccel (FAccelEvent* ev)
|
inline void FMenu::onAccel (FAccelEvent* ev)
|
||||||
{ item->onAccel(ev); }
|
{ item.onAccel(ev); }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
|
@ -86,16 +86,16 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
|
||||||
void resetMenu();
|
void resetMenu();
|
||||||
void adjustSize();
|
virtual void hide();
|
||||||
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_item_deactivated (FWidget*, data_ptr);
|
void cb_item_deactivated (FWidget*, data_ptr);
|
||||||
|
@ -127,7 +127,7 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
bool hotkeyMenu (FKeyEvent*&);
|
bool hotkeyMenu (FKeyEvent*&);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawItem (FMenuItem*, int&);
|
void drawItem (FMenuItem*, int&);
|
||||||
void setLineAttributes (FMenuItem*);
|
void setLineAttributes (FMenuItem*);
|
||||||
|
|
|
@ -97,10 +97,10 @@ class FMenuItem : public FWidget
|
||||||
FString getText() const;
|
FString getText() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
bool setEnable (bool);
|
virtual bool setEnable (bool);
|
||||||
bool setFocus (bool);
|
virtual bool setFocus (bool);
|
||||||
bool setFocus();
|
virtual bool setFocus();
|
||||||
bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
void setSelected();
|
void setSelected();
|
||||||
void unsetSelected();
|
void unsetSelected();
|
||||||
void setSeparator();
|
void setSeparator();
|
||||||
|
@ -118,19 +118,19 @@ class FMenuItem : public FWidget
|
||||||
bool hasMenu() const;
|
bool hasMenu() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void addAccelerator (int, FWidget*);
|
virtual void addAccelerator (int, FWidget*);
|
||||||
void delAccelerator (FWidget*);
|
virtual void delAccelerator (FWidget*);
|
||||||
void openMenu();
|
void openMenu();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDoubleClick (FMouseEvent*);
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Accessor
|
// Accessor
|
||||||
|
|
|
@ -101,7 +101,7 @@ class FMessageBox : public FDialog
|
||||||
, int, int, int
|
, int, int, int
|
||||||
, FWidget* = 0 );
|
, FWidget* = 0 );
|
||||||
// Destructor
|
// Destructor
|
||||||
~FMessageBox();
|
virtual ~FMessageBox();
|
||||||
|
|
||||||
// Assignment operator (=)
|
// Assignment operator (=)
|
||||||
FMessageBox& operator = (const FMessageBox&);
|
FMessageBox& operator = (const FMessageBox&);
|
||||||
|
@ -142,7 +142,7 @@ class FMessageBox : public FDialog
|
||||||
, int = 0 );
|
, int = 0 );
|
||||||
protected:
|
protected:
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_processClick (FWidget*, data_ptr);
|
void cb_processClick (FWidget*, data_ptr);
|
||||||
|
|
|
@ -74,6 +74,7 @@ class FObject
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
FObject* getParent() const;
|
FObject* getParent() const;
|
||||||
FObject* getChild (int) const;
|
FObject* getChild (int) const;
|
||||||
|
FObjectList& getChildren();
|
||||||
const FObjectList& getChildren() const;
|
const FObjectList& getChildren() const;
|
||||||
int numOfChildren() const;
|
int numOfChildren() const;
|
||||||
FObjectIterator begin();
|
FObjectIterator begin();
|
||||||
|
@ -115,12 +116,17 @@ class FObject
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef std::vector<timer_data> TimerList;
|
typedef std::vector<timer_data> TimerList;
|
||||||
|
|
||||||
|
// Accessor
|
||||||
|
TimerList* getTimerList() const;
|
||||||
|
|
||||||
|
// Method
|
||||||
|
uInt processTimerEvent();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
virtual bool event (FEvent*);
|
virtual bool event (FEvent*);
|
||||||
virtual void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Member
|
||||||
static TimerList* timer_list;
|
|
||||||
bool widget_object;
|
bool widget_object;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -130,11 +136,15 @@ class FObject
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
FObject& operator = (const FObject&);
|
FObject& operator = (const FObject&);
|
||||||
|
|
||||||
|
// Method
|
||||||
|
virtual void performTimerAction (const FObject*, const FEvent*);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FObject* parent_obj;
|
FObject* parent_obj;
|
||||||
FObjectList children_list;
|
FObjectList children_list;
|
||||||
bool has_parent;
|
bool has_parent;
|
||||||
static bool timer_modify_lock;
|
static bool timer_modify_lock;
|
||||||
|
static TimerList* timer_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -147,6 +157,10 @@ inline const char* FObject::getClassName() const
|
||||||
inline FObject* FObject::getParent() const
|
inline FObject* FObject::getParent() const
|
||||||
{ return parent_obj; }
|
{ return parent_obj; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::FObjectList& FObject::getChildren()
|
||||||
|
{ return children_list; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FObject::FObjectList& FObject::getChildren() const
|
inline const FObject::FObjectList& FObject::getChildren() const
|
||||||
{ return children_list; }
|
{ return children_list; }
|
||||||
|
@ -195,7 +209,9 @@ inline bool FObject::isInstanceOf (const char classname[]) const
|
||||||
inline bool FObject::isTimerInUpdating() const
|
inline bool FObject::isTimerInUpdating() const
|
||||||
{ return timer_modify_lock; }
|
{ return timer_modify_lock; }
|
||||||
|
|
||||||
} // namespace finalcut
|
//----------------------------------------------------------------------
|
||||||
|
inline FObject::TimerList* FObject::getTimerList() const
|
||||||
|
{ return timer_list; }
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -252,4 +268,6 @@ static inline bool operator < (const timeval& t1, const timeval& t2)
|
||||||
|| (t1.tv_sec == t2.tv_sec && t1.tv_usec < t2.tv_usec);
|
|| (t1.tv_sec == t2.tv_sec && t1.tv_usec < t2.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FOBJECT_H
|
#endif // FOBJECT_H
|
||||||
|
|
|
@ -159,7 +159,7 @@ class FOptiAttr
|
||||||
explicit FOptiAttr();
|
explicit FOptiAttr();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FOptiAttr();
|
virtual ~FOptiAttr();
|
||||||
|
|
||||||
// Friend operator functions
|
// Friend operator functions
|
||||||
friend bool operator == (const charData&, const charData&);
|
friend bool operator == (const charData&, const charData&);
|
||||||
|
|
|
@ -110,7 +110,7 @@ class FOptiMove
|
||||||
explicit FOptiMove (int = 0);
|
explicit FOptiMove (int = 0);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FOptiMove();
|
virtual ~FOptiMove();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FProgressbar : public FWidget
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setPercentage (int);
|
void setPercentage (int);
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
bool setShadow (bool);
|
bool setShadow (bool);
|
||||||
bool setShadow();
|
bool setShadow();
|
||||||
bool unsetShadow();
|
bool unsetShadow();
|
||||||
|
@ -91,7 +91,7 @@ class FProgressbar : public FWidget
|
||||||
bool hasShadow();
|
bool hasShadow();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -91,7 +91,7 @@ class FRadioButton : public FToggleButton
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawRadioButton();
|
void drawRadioButton();
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -103,22 +103,22 @@ class FScrollbar : public FWidget
|
||||||
void setSteps (double);
|
void setSteps (double);
|
||||||
void setPageSize (int, int);
|
void setPageSize (int, int);
|
||||||
void setOrientation (int);
|
void setOrientation (int);
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void resize();
|
virtual void resize();
|
||||||
void redraw();
|
virtual void redraw();
|
||||||
void calculateSliderValues();
|
void calculateSliderValues();
|
||||||
void drawVerticalBar();
|
void drawVerticalBar();
|
||||||
void drawHorizontalBar();
|
void drawHorizontalBar();
|
||||||
void drawBar();
|
void drawBar();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onTimer (FTimerEvent*);
|
virtual void onTimer (FTimerEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -129,7 +129,7 @@ class FScrollbar : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawButtons();
|
void drawButtons();
|
||||||
sType getClickedScrollType (int, int);
|
sType getClickedScrollType (int, int);
|
||||||
sType getVerticalClickedScrollType (int);
|
sType getVerticalClickedScrollType (int);
|
||||||
|
|
|
@ -100,7 +100,7 @@ class FScrollView : public FWidget
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (int, bool = true);
|
||||||
virtual void setHeight (int, bool = true);
|
virtual void setHeight (int, bool = true);
|
||||||
virtual void setSize (int, int, bool = true);
|
virtual void setSize (int, int, bool = true);
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
void setCursorPos (int, int);
|
void setCursorPos (int, int);
|
||||||
void setPrintPos (int, int);
|
void setPrintPos (int, int);
|
||||||
bool setViewportPrint (bool);
|
bool setViewportPrint (bool);
|
||||||
|
@ -126,11 +126,11 @@ class FScrollView : public FWidget
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onChildFocusIn (FFocusEvent*);
|
virtual void onChildFocusIn (FFocusEvent*);
|
||||||
void onChildFocusOut (FFocusEvent*);
|
virtual void onChildFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
|
@ -140,7 +140,7 @@ class FScrollView : public FWidget
|
||||||
term_area* getPrintArea();
|
term_area* getPrintArea();
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
void copy2area();
|
void copy2area();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -92,6 +92,8 @@ class FStatusKey : public FWidget
|
||||||
virtual FString getText() const;
|
virtual FString getText() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
void setKey (int);
|
||||||
|
void setText (const FString&);
|
||||||
void setActive();
|
void setActive();
|
||||||
void unsetActive();
|
void unsetActive();
|
||||||
bool setMouseFocus(bool);
|
bool setMouseFocus(bool);
|
||||||
|
@ -103,12 +105,7 @@ class FStatusKey : public FWidget
|
||||||
bool hasMouseFocus() const;
|
bool hasMouseFocus() const;
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
|
|
||||||
protected:
|
|
||||||
// Mutators
|
|
||||||
void setKey (int);
|
|
||||||
void setText (const FString&);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -149,6 +146,14 @@ inline int FStatusKey::getKey() const
|
||||||
inline FString FStatusKey::getText() const
|
inline FString FStatusKey::getText() const
|
||||||
{ return text; }
|
{ return text; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FStatusKey::setKey (int k)
|
||||||
|
{ key = k; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FStatusKey::setText (const FString& txt)
|
||||||
|
{ text = txt; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FStatusKey::unsetActive()
|
inline void FStatusKey::unsetActive()
|
||||||
{ active = false; }
|
{ active = false; }
|
||||||
|
@ -169,14 +174,6 @@ inline bool FStatusKey::isActivated() const
|
||||||
inline bool FStatusKey::hasMouseFocus() const
|
inline bool FStatusKey::hasMouseFocus() const
|
||||||
{ return mouse_focus; }
|
{ return mouse_focus; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FStatusKey::setKey (int k)
|
|
||||||
{ key = k; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FStatusKey::setText (const FString& txt)
|
|
||||||
{ text = txt; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FStatusBar* FStatusKey::getConnectedStatusbar() const
|
inline FStatusBar* FStatusKey::getConnectedStatusbar() const
|
||||||
{ return bar; }
|
{ return bar; }
|
||||||
|
@ -218,19 +215,19 @@ class FStatusBar : public FWindow
|
||||||
bool hasActivatedKey();
|
bool hasActivatedKey();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void drawMessage();
|
void drawMessage();
|
||||||
void clearMessage();
|
void clearMessage();
|
||||||
void insert (FStatusKey*);
|
void insert (FStatusKey*);
|
||||||
void remove (FStatusKey*);
|
void remove (FStatusKey*);
|
||||||
void remove (int);
|
void remove (int);
|
||||||
void clear();
|
void clear();
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
|
|
||||||
// Callback method
|
// Callback method
|
||||||
void cb_statuskey_activated (FWidget*, data_ptr);
|
void cb_statuskey_activated (FWidget*, data_ptr);
|
||||||
|
@ -247,7 +244,7 @@ class FStatusBar : public FWindow
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawKeys();
|
void drawKeys();
|
||||||
void drawKey (keyList::const_iterator);
|
void drawKey (keyList::const_iterator);
|
||||||
void drawActiveKey (keyList::const_iterator);
|
void drawActiveKey (keyList::const_iterator);
|
||||||
|
|
|
@ -382,6 +382,7 @@ class FString
|
||||||
// Methods
|
// Methods
|
||||||
void initLength (uInt);
|
void initLength (uInt);
|
||||||
void _assign (const wchar_t[]);
|
void _assign (const wchar_t[]);
|
||||||
|
void _insert (uInt, const wchar_t[]);
|
||||||
void _insert (uInt, uInt, const wchar_t[]);
|
void _insert (uInt, uInt, const wchar_t[]);
|
||||||
void _remove (uInt, uInt);
|
void _remove (uInt, uInt);
|
||||||
char* wc_to_c_str (const wchar_t[]) const;
|
char* wc_to_c_str (const wchar_t[]) const;
|
||||||
|
|
|
@ -83,12 +83,12 @@ class FSwitch : public FToggleButton
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setText (const FString&);
|
virtual void setText (const FString&);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -98,7 +98,7 @@ class FSwitch : public FToggleButton
|
||||||
FSwitch& operator = (const FSwitch&);
|
FSwitch& operator = (const FSwitch&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawCheckButton();
|
void drawCheckButton();
|
||||||
void drawChecked();
|
void drawChecked();
|
||||||
void drawUnchecked();
|
void drawUnchecked();
|
||||||
|
|
|
@ -139,7 +139,6 @@
|
||||||
#include "final/fkey_map.h"
|
#include "final/fkey_map.h"
|
||||||
#include "final/fkeyboard.h"
|
#include "final/fkeyboard.h"
|
||||||
#include "final/fmouse.h"
|
#include "final/fmouse.h"
|
||||||
#include "final/fobject.h"
|
|
||||||
#include "final/foptiattr.h"
|
#include "final/foptiattr.h"
|
||||||
#include "final/foptimove.h"
|
#include "final/foptimove.h"
|
||||||
#include "final/fpoint.h"
|
#include "final/fpoint.h"
|
||||||
|
@ -147,6 +146,7 @@
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
#include "final/ftermcapquirks.h"
|
#include "final/ftermcapquirks.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermdetection.h"
|
#include "final/ftermdetection.h"
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -210,10 +210,8 @@ class FTerm
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
static bool isCursorHidden();
|
|
||||||
static bool isNormal (charData*&);
|
static bool isNormal (charData*&);
|
||||||
static bool isRaw();
|
static bool isRaw();
|
||||||
static bool hasPCcharset();
|
|
||||||
static bool hasUTF8();
|
static bool hasUTF8();
|
||||||
static bool hasVT100();
|
static bool hasVT100();
|
||||||
static bool hasASCII();
|
static bool hasASCII();
|
||||||
|
@ -238,17 +236,14 @@ class FTerm
|
||||||
static bool isScreenTerm();
|
static bool isScreenTerm();
|
||||||
static bool isTmuxTerm();
|
static bool isTmuxTerm();
|
||||||
static bool isNewFont();
|
static bool isNewFont();
|
||||||
static bool isUTF8();
|
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setTermType (const char[]);
|
static void setTermType (const char[]);
|
||||||
static void setInsertCursor (bool on);
|
static void setInsertCursor (bool on);
|
||||||
static void setInsertCursor();
|
static void setInsertCursor();
|
||||||
static void unsetInsertCursor();
|
static void unsetInsertCursor();
|
||||||
static bool setCursorOptimisation (bool);
|
|
||||||
static void redefineDefaultColors (bool);
|
static void redefineDefaultColors (bool);
|
||||||
static void setDblclickInterval (const long);
|
static void setDblclickInterval (const long);
|
||||||
static void disableAltScreen();
|
|
||||||
static bool setUTF8 (bool);
|
static bool setUTF8 (bool);
|
||||||
static bool setUTF8();
|
static bool setUTF8();
|
||||||
static bool unsetUTF8();
|
static bool unsetUTF8();
|
||||||
|
@ -304,10 +299,6 @@ class FTerm
|
||||||
static int putchar_ASCII (int);
|
static int putchar_ASCII (int);
|
||||||
static int putchar_UTF8 (int);
|
static int putchar_UTF8 (int);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
static int framebuffer_bpp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Inquiries
|
// Inquiries
|
||||||
static bool hasChangedTermSize();
|
static bool hasChangedTermSize();
|
||||||
|
@ -323,7 +314,7 @@ class FTerm
|
||||||
static char* changeAttribute ( charData*&
|
static char* changeAttribute ( charData*&
|
||||||
, charData*& );
|
, charData*& );
|
||||||
static void changeTermSizeFinished();
|
static void changeTermSizeFinished();
|
||||||
static void exitWithMessage (std::string)
|
static void exitWithMessage (const FString&)
|
||||||
#if defined(__clang__) || defined(__GNUC__)
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
__attribute__((noreturn))
|
__attribute__((noreturn))
|
||||||
#endif
|
#endif
|
||||||
|
@ -374,16 +365,14 @@ class FTerm
|
||||||
} init_values;
|
} init_values;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
|
||||||
typedef FTermcap::tcap_map termcap_map;
|
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FTerm (const FTerm&);
|
FTerm (const FTerm&);
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
FTerm& operator = (const FTerm&);
|
FTerm& operator = (const FTerm&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static void init_global_values();
|
static void init_global_values (bool);
|
||||||
|
static void init_terminal_device_path();
|
||||||
static void oscPrefix();
|
static void oscPrefix();
|
||||||
static void oscPostfix();
|
static void oscPostfix();
|
||||||
static void init_alt_charset();
|
static void init_alt_charset();
|
||||||
|
@ -398,6 +387,7 @@ class FTerm
|
||||||
static void init_termcap_booleans();
|
static void init_termcap_booleans();
|
||||||
static void init_termcap_numerics();
|
static void init_termcap_numerics();
|
||||||
static void init_termcap_strings (char*&);
|
static void init_termcap_strings (char*&);
|
||||||
|
static void init_termcap_keys_vt100 (char*&);
|
||||||
static void init_termcap_keys (char*&);
|
static void init_termcap_keys (char*&);
|
||||||
static void init_OptiMove();
|
static void init_OptiMove();
|
||||||
static void init_OptiAttr();
|
static void init_OptiAttr();
|
||||||
|
@ -407,7 +397,7 @@ class FTerm
|
||||||
static void init_encoding_set();
|
static void init_encoding_set();
|
||||||
static void init_term_encoding();
|
static void init_term_encoding();
|
||||||
static void init_individual_term_encoding();
|
static void init_individual_term_encoding();
|
||||||
static bool init_force_vt100_encoding();
|
static void init_force_vt100_encoding();
|
||||||
static void init_utf8_without_alt_charset();
|
static void init_utf8_without_alt_charset();
|
||||||
static void init_tab_quirks();
|
static void init_tab_quirks();
|
||||||
static void init_captureFontAndTitle();
|
static void init_captureFontAndTitle();
|
||||||
|
@ -421,8 +411,9 @@ class FTerm
|
||||||
static void useNormalScreenBuffer();
|
static void useNormalScreenBuffer();
|
||||||
void allocationValues();
|
void allocationValues();
|
||||||
void deallocationValues();
|
void deallocationValues();
|
||||||
void init();
|
void init (bool);
|
||||||
void initOSspecifics();
|
void initOSspecifics();
|
||||||
|
void initTermspecifics();
|
||||||
void finish();
|
void finish();
|
||||||
void finishOSspecifics1();
|
void finishOSspecifics1();
|
||||||
void finish_encoding();
|
void finish_encoding();
|
||||||
|
@ -432,49 +423,14 @@ class FTerm
|
||||||
static void signal_handler (int);
|
static void signal_handler (int);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static std::map <uChar,uChar>* vt100_alt_char;
|
static FTermData* data;
|
||||||
static std::map <std::string,fc::encoding>* encoding_set;
|
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
static fc::encoding term_encoding;
|
|
||||||
|
|
||||||
static bool shadow_character;
|
|
||||||
static bool half_block_character;
|
|
||||||
static bool cursor_optimisation;
|
|
||||||
static bool hidden_cursor;
|
|
||||||
static bool use_alternate_screen;
|
|
||||||
static bool pc_charset_console;
|
|
||||||
static bool utf8_state;
|
|
||||||
static bool utf8_console;
|
|
||||||
static bool utf8_linux_terminal;
|
|
||||||
static bool force_vt100;
|
|
||||||
static bool vt100_console;
|
|
||||||
static bool ascii_console;
|
|
||||||
static bool NewFont;
|
|
||||||
static bool VGAFont;
|
|
||||||
static bool monochron;
|
|
||||||
static char termtype[256];
|
|
||||||
static char termfilename[256];
|
|
||||||
static char exit_message[8192];
|
|
||||||
static char* locale_name;
|
|
||||||
static char* locale_xterm;
|
|
||||||
static FRect* term; // current terminal geometry
|
|
||||||
|
|
||||||
static int fd_tty;
|
|
||||||
static uInt baudrate;
|
|
||||||
static bool resize_term;
|
|
||||||
|
|
||||||
static fc::linuxConsoleCursorStyle \
|
|
||||||
linux_console_cursor_style;
|
|
||||||
static struct console_font_op \
|
|
||||||
screen_font;
|
|
||||||
static struct unimapdesc \
|
|
||||||
screen_unicode_map;
|
|
||||||
|
|
||||||
static FOptiMove* opti_move;
|
static FOptiMove* opti_move;
|
||||||
static FOptiAttr* opti_attr;
|
static FOptiAttr* opti_attr;
|
||||||
static FTermDetection* term_detection;
|
static FTermDetection* term_detection;
|
||||||
static FTermXTerminal* xterm;
|
static FTermXTerminal* xterm;
|
||||||
static FKeyboard* keyboard;
|
static FKeyboard* keyboard;
|
||||||
|
static FMouseControl* mouse;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#undef linux
|
#undef linux
|
||||||
|
@ -488,10 +444,6 @@ class FTerm
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
static FTermOpenBSD* openbsd;
|
static FTermOpenBSD* openbsd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FMouseControl* mouse;
|
|
||||||
static const FString* save_xterm_font;
|
|
||||||
static const FString* save_xterm_title;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -511,15 +463,15 @@ inline FMouseControl* FTerm::getMouseControl()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getTTYFileDescriptor()
|
inline int FTerm::getTTYFileDescriptor()
|
||||||
{ return fd_tty; }
|
{ return data->getTTYFileDescriptor(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FTerm::getTermType()
|
inline char* FTerm::getTermType()
|
||||||
{ return termtype; }
|
{ return data->getTermType(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FTerm::getTermFileName()
|
inline char* FTerm::getTermFileName()
|
||||||
{ return termfilename; }
|
{ return data->getTermFileName(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getTabstop()
|
inline int FTerm::getTabstop()
|
||||||
|
@ -552,32 +504,16 @@ inline const char* FTerm::getTermType_SecDA()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getFramebufferBpp()
|
inline int FTerm::getFramebufferBpp()
|
||||||
{ return framebuffer_bpp; }
|
{ return data->getFramebufferBpp(); }
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::isCursorHidden()
|
|
||||||
{ return hidden_cursor; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasPCcharset()
|
|
||||||
{ return pc_charset_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasUTF8()
|
inline bool FTerm::hasUTF8()
|
||||||
{ return utf8_console; }
|
{ return data->hasUTF8Console(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasVT100()
|
|
||||||
{ return vt100_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasASCII()
|
|
||||||
{ return ascii_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isMonochron()
|
inline bool FTerm::isMonochron()
|
||||||
{ return monochron; }
|
{ return data->isMonochron(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isXTerminal()
|
inline bool FTerm::isXTerminal()
|
||||||
|
@ -657,11 +593,7 @@ inline bool FTerm::isTmuxTerm()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isNewFont()
|
inline bool FTerm::isNewFont()
|
||||||
{ return NewFont; }
|
{ return data->isNewFont(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::isUTF8()
|
|
||||||
{ return utf8_state; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTerm::setInsertCursor()
|
inline void FTerm::setInsertCursor()
|
||||||
|
@ -671,14 +603,6 @@ inline void FTerm::setInsertCursor()
|
||||||
inline void FTerm::unsetInsertCursor()
|
inline void FTerm::unsetInsertCursor()
|
||||||
{ setInsertCursor(false); }
|
{ setInsertCursor(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::setCursorOptimisation (bool on)
|
|
||||||
{ return cursor_optimisation = ( on ) ? true : false; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTerm::disableAltScreen()
|
|
||||||
{ use_alternate_screen = false; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::setUTF8()
|
inline bool FTerm::setUTF8()
|
||||||
{ return setUTF8(true); }
|
{ return setUTF8(true); }
|
||||||
|
@ -689,19 +613,19 @@ inline bool FTerm::unsetUTF8()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasChangedTermSize()
|
inline bool FTerm::hasChangedTermSize()
|
||||||
{ return resize_term; }
|
{ return data->hasTermResized(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasShadowCharacter()
|
inline bool FTerm::hasShadowCharacter()
|
||||||
{ return shadow_character; }
|
{ return data->hasShadowCharacter(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasHalfBlockCharacter()
|
inline bool FTerm::hasHalfBlockCharacter()
|
||||||
{ return half_block_character; }
|
{ return data->hasHalfBlockCharacter(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasAlternateScreen()
|
inline bool FTerm::hasAlternateScreen()
|
||||||
{ return use_alternate_screen; }
|
{ return data->hasAlternateScreen(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FOptiMove* FTerm::getFOptiMove()
|
inline FOptiMove* FTerm::getFOptiMove()
|
||||||
|
@ -709,7 +633,7 @@ inline FOptiMove* FTerm::getFOptiMove()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTerm::changeTermSizeFinished()
|
inline void FTerm::changeTermSizeFinished()
|
||||||
{ resize_term = false; }
|
{ data->setTermResized(false); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2016-2017 Markus Gans *
|
* Copyright 2016-2018 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -61,12 +61,10 @@ class FTermcap
|
||||||
tcap_map;
|
tcap_map;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
FTermcap()
|
FTermcap();
|
||||||
{ }
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermcap()
|
~FTermcap();
|
||||||
{ }
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -76,12 +74,6 @@ class FTermcap
|
||||||
return tcap;
|
return tcap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutator
|
|
||||||
static void setTermcapMap (tcap_map* t)
|
|
||||||
{
|
|
||||||
tcap = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static bool background_color_erase;
|
static bool background_color_erase;
|
||||||
static bool automatic_left_margin;
|
static bool automatic_left_margin;
|
||||||
|
@ -95,16 +87,17 @@ class FTermcap
|
||||||
static int attr_without_color;
|
static int attr_without_color;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data Members
|
// Data Member
|
||||||
static tcap_map* tcap;
|
static tcap_map tcap[];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
// FOptiMove inline functions
|
// FTermcap inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FTermcap::getClassName() const
|
inline const char* FTermcap::getClassName() const
|
||||||
{ return "FTermcap"; }
|
{ return "FTermcap"; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
||||||
#endif // FTERMCAP_H
|
#endif // FTERMCAP_H
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fterm.h"
|
#include "final/fterm.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermdetection.h"
|
#include "final/ftermdetection.h"
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
|
@ -57,14 +58,13 @@ class FTermcapQuirks
|
||||||
FTermcapQuirks();
|
FTermcapQuirks();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermcapQuirks();
|
virtual ~FTermcapQuirks();
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
static void setTerminalType (const char[]);
|
static void setTermData (FTermData*);
|
||||||
static void setTermcapMap (FTermcap::tcap_map*);
|
|
||||||
static void setFTermDetection (FTermDetection*);
|
static void setFTermDetection (FTermDetection*);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -87,8 +87,8 @@ class FTermcapQuirks
|
||||||
static void init_termcap_general_quirks();
|
static void init_termcap_general_quirks();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static char termtype[256];
|
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
|
static FTermData* fterm_data;
|
||||||
static FTermDetection* term_detection;
|
static FTermDetection* term_detection;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -0,0 +1,397 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* ftermdata.h - Data class for FTerm *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2018 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
* as published by the Free Software Foundation; either version 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Lesser General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Lesser General Public *
|
||||||
|
* License along with this program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/* Standalone class
|
||||||
|
* ════════════════
|
||||||
|
*
|
||||||
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▏
|
||||||
|
* ▕ FTermData ▏
|
||||||
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FTERMDATA_H
|
||||||
|
#define FTERMDATA_H
|
||||||
|
|
||||||
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||||
|
#error "Only <final/final.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "final/fc.h"
|
||||||
|
#include "final/frect.h"
|
||||||
|
#include "final/fstring.h"
|
||||||
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FTermData
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
class FTermData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Typedefs
|
||||||
|
typedef std::map<std::string,fc::encoding> encodingMap;
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
FTermData();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~FTermData();
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
const char* getClassName() const;
|
||||||
|
encodingMap& getEncodingList();
|
||||||
|
fc::encoding getTermEncoding() const;
|
||||||
|
FRect& getTermGeometry();
|
||||||
|
int getTTYFileDescriptor() const;
|
||||||
|
uInt getBaudrate() const;
|
||||||
|
char* getTermType();
|
||||||
|
char* getTermFileName();
|
||||||
|
const FString& getXtermFont() const;
|
||||||
|
const FString& getXtermTitle() const;
|
||||||
|
#if DEBUG
|
||||||
|
int getFramebufferBpp() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Inquiries
|
||||||
|
bool hasShadowCharacter() const;
|
||||||
|
bool hasHalfBlockCharacter() const;
|
||||||
|
bool hasCursorOptimisation() const;
|
||||||
|
bool isCursorHidden() const;
|
||||||
|
bool hasAlternateScreen() const;
|
||||||
|
bool hasASCIIConsole() const;
|
||||||
|
bool hasVT100Console() const;
|
||||||
|
bool hasUTF8Console() const;
|
||||||
|
bool isUTF8() const;
|
||||||
|
bool isNewFont() const;
|
||||||
|
bool isVGAFont() const;
|
||||||
|
bool isMonochron() const;
|
||||||
|
bool hasTermResized() const;
|
||||||
|
|
||||||
|
// Mutators
|
||||||
|
void setTermEncoding(fc::encoding);
|
||||||
|
void setTTYFileDescriptor (int);
|
||||||
|
void setBaudrate (uInt);
|
||||||
|
void supportShadowCharacter (bool);
|
||||||
|
void supportHalfBlockCharacter (bool);
|
||||||
|
void supportCursorOptimisation (bool);
|
||||||
|
void setCursorHidden (bool);
|
||||||
|
void useAlternateScreen (bool);
|
||||||
|
void setASCIIConsole (bool);
|
||||||
|
void setVT100Console (bool);
|
||||||
|
void setUTF8Console (bool);
|
||||||
|
void setUTF8 (bool);
|
||||||
|
void setNewFont (bool);
|
||||||
|
void setVGAFont (bool);
|
||||||
|
void setMonochron (bool);
|
||||||
|
void setTermResized (bool);
|
||||||
|
void setTermType (const char[]);
|
||||||
|
void setTermFileName (const char[]);
|
||||||
|
void setXtermFont (const FString&);
|
||||||
|
void setXtermTitle (const FString&);
|
||||||
|
#if DEBUG
|
||||||
|
void setFramebufferBpp (int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Disable copy constructor
|
||||||
|
FTermData (const FTermData&);
|
||||||
|
|
||||||
|
// Disable assignment operator (=)
|
||||||
|
FTermData& operator = (const FTermData&);
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
encodingMap encoding_list;
|
||||||
|
fc::encoding term_encoding;
|
||||||
|
FRect term_geometry; // current terminal geometry
|
||||||
|
int fd_tty;
|
||||||
|
uInt baudrate;
|
||||||
|
bool shadow_character;
|
||||||
|
bool half_block_character;
|
||||||
|
bool cursor_optimisation;
|
||||||
|
bool hidden_cursor;
|
||||||
|
bool use_alternate_screen;
|
||||||
|
bool ascii_console;
|
||||||
|
bool vt100_console;
|
||||||
|
bool utf8_console;
|
||||||
|
bool utf8_state;
|
||||||
|
bool new_font;
|
||||||
|
bool vga_font;
|
||||||
|
bool monochron;
|
||||||
|
bool resize_term;
|
||||||
|
char termtype[256];
|
||||||
|
char termfilename[256];
|
||||||
|
FString xterm_font;
|
||||||
|
FString xterm_title;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
int framebuffer_bpp;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
// FTermData inline functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::FTermData()
|
||||||
|
: encoding_list()
|
||||||
|
, term_encoding(fc::UNKNOWN)
|
||||||
|
, term_geometry()
|
||||||
|
, fd_tty(-1) // Teletype (tty) file descriptor is still undefined
|
||||||
|
, baudrate(0)
|
||||||
|
, shadow_character(true)
|
||||||
|
, half_block_character(true)
|
||||||
|
, cursor_optimisation(true)
|
||||||
|
, hidden_cursor(false) // Global cursor hidden state
|
||||||
|
, use_alternate_screen(true)
|
||||||
|
, ascii_console(false)
|
||||||
|
, vt100_console(false)
|
||||||
|
, utf8_console(false)
|
||||||
|
, utf8_state(false)
|
||||||
|
, new_font(false)
|
||||||
|
, vga_font(false)
|
||||||
|
, monochron(false)
|
||||||
|
, resize_term(false)
|
||||||
|
, termtype()
|
||||||
|
, termfilename()
|
||||||
|
, xterm_font()
|
||||||
|
, xterm_title()
|
||||||
|
#if DEBUG
|
||||||
|
, framebuffer_bpp(-1)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// Initialize arrays with '\0'
|
||||||
|
std::fill_n (termtype, sizeof(termtype), '\0');
|
||||||
|
std::fill_n (termfilename, sizeof(termfilename), '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::~FTermData()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const char* FTermData::getClassName() const
|
||||||
|
{ return "FTermData"; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::encodingMap& FTermData::getEncodingList()
|
||||||
|
{ return encoding_list; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline fc::encoding FTermData::getTermEncoding() const
|
||||||
|
{ return term_encoding; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FRect& FTermData::getTermGeometry()
|
||||||
|
{ return term_geometry; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline int FTermData::getTTYFileDescriptor() const
|
||||||
|
{ return fd_tty; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline uInt FTermData::getBaudrate() const
|
||||||
|
{ return baudrate; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermData::getTermType()
|
||||||
|
{ return termtype; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermData::getTermFileName()
|
||||||
|
{ return termfilename; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FString& FTermData::getXtermFont() const
|
||||||
|
{ return xterm_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FString& FTermData::getXtermTitle() const
|
||||||
|
{ return xterm_title; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
#if DEBUG
|
||||||
|
inline int FTermData::getFramebufferBpp() const
|
||||||
|
{ return framebuffer_bpp; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasShadowCharacter() const
|
||||||
|
{ return shadow_character; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasHalfBlockCharacter() const
|
||||||
|
{ return half_block_character; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasCursorOptimisation() const
|
||||||
|
{ return cursor_optimisation; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isCursorHidden() const
|
||||||
|
{ return hidden_cursor; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasAlternateScreen() const
|
||||||
|
{ return use_alternate_screen; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasASCIIConsole() const
|
||||||
|
{ return ascii_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasVT100Console() const
|
||||||
|
{ return vt100_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasUTF8Console() const
|
||||||
|
{ return utf8_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isUTF8() const
|
||||||
|
{ return utf8_state; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isNewFont() const
|
||||||
|
{ return new_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isVGAFont() const
|
||||||
|
{ return vga_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isMonochron() const
|
||||||
|
{ return monochron; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasTermResized() const
|
||||||
|
{ return resize_term; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermEncoding (fc::encoding enc)
|
||||||
|
{ term_encoding = enc; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTTYFileDescriptor (int fd)
|
||||||
|
{ fd_tty = fd; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setBaudrate (uInt baud)
|
||||||
|
{ baudrate = baud; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportShadowCharacter (bool available)
|
||||||
|
{ shadow_character = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportHalfBlockCharacter (bool available)
|
||||||
|
{ half_block_character = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportCursorOptimisation (bool available)
|
||||||
|
{ cursor_optimisation = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setCursorHidden (bool hidden_state)
|
||||||
|
{ hidden_cursor = hidden_state; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::useAlternateScreen (bool use)
|
||||||
|
{ use_alternate_screen = use; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setASCIIConsole (bool ascii)
|
||||||
|
{ ascii_console = ascii; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setVT100Console (bool vt100)
|
||||||
|
{ vt100_console = vt100; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setUTF8Console (bool utf8)
|
||||||
|
{ utf8_console = utf8; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setUTF8 (bool utf8)
|
||||||
|
{ utf8_state = utf8; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setNewFont (bool nfont)
|
||||||
|
{ new_font = nfont; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setVGAFont (bool vga)
|
||||||
|
{ vga_font = vga; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setMonochron (bool mono)
|
||||||
|
{ monochron = mono; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermResized (bool resize)
|
||||||
|
{ resize_term = resize; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermType (const char name[])
|
||||||
|
{
|
||||||
|
if ( ! name )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::strncpy (termtype, name, sizeof(termtype));
|
||||||
|
termtype[sizeof(termtype) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermFileName (const char file_name[])
|
||||||
|
{
|
||||||
|
if ( ! file_name )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::strncpy (termfilename, file_name, sizeof(termfilename));
|
||||||
|
termfilename[sizeof(termfilename) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setXtermFont (const FString& font)
|
||||||
|
{ xterm_font = font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setXtermTitle (const FString& title)
|
||||||
|
{ xterm_title = title; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
#if DEBUG
|
||||||
|
inline void FTermData::setFramebufferBpp (int bpp)
|
||||||
|
{ framebuffer_bpp = bpp; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
||||||
|
#endif // FTERMDATA_H
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fconfig.h"
|
#include "final/fconfig.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermios.h"
|
#include "final/ftermios.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
@ -91,12 +92,11 @@ class FTermDetection
|
||||||
FTermDetection();
|
FTermDetection();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermDetection();
|
virtual ~FTermDetection();
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
static char* getTermType();
|
static char* getTermType();
|
||||||
static char* getTermFileName();
|
|
||||||
static int getGnomeTerminalID();
|
static int getGnomeTerminalID();
|
||||||
terminalType& getTermTypeStruct();
|
terminalType& getTermTypeStruct();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class FTermDetection
|
||||||
static void setScreenTerm (bool);
|
static void setScreenTerm (bool);
|
||||||
static void setTmuxTerm (bool);
|
static void setTmuxTerm (bool);
|
||||||
static void setTerminalDetection (bool);
|
static void setTerminalDetection (bool);
|
||||||
static void setTermFileName (char[]);
|
static void setTermData (FTermData*);
|
||||||
static void setTtyTypeFileName (char[]);
|
static void setTtyTypeFileName (char[]);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -199,7 +199,6 @@ class FTermDetection
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static char termtype[256];
|
static char termtype[256];
|
||||||
static char termfilename[256];
|
|
||||||
static char ttytypename[256];
|
static char ttytypename[256];
|
||||||
static bool decscusr_support;
|
static bool decscusr_support;
|
||||||
static bool terminal_detection;
|
static bool terminal_detection;
|
||||||
|
@ -207,6 +206,7 @@ class FTermDetection
|
||||||
static int gnome_terminal_id;
|
static int gnome_terminal_id;
|
||||||
static const FString* answer_back;
|
static const FString* answer_back;
|
||||||
static const FString* sec_da;
|
static const FString* sec_da;
|
||||||
|
static FTermData* fterm_data;
|
||||||
static terminalType terminal_type;
|
static terminalType terminal_type;
|
||||||
|
|
||||||
static struct colorEnv
|
static struct colorEnv
|
||||||
|
@ -256,10 +256,6 @@ inline const char* FTermDetection::getClassName() const
|
||||||
inline char* FTermDetection::getTermType()
|
inline char* FTermDetection::getTermType()
|
||||||
{ return termtype; }
|
{ return termtype; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline char* FTermDetection::getTermFileName()
|
|
||||||
{ return termfilename; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTermDetection::getGnomeTerminalID()
|
inline int FTermDetection::getGnomeTerminalID()
|
||||||
{ return gnome_terminal_id; }
|
{ return gnome_terminal_id; }
|
||||||
|
|
|
@ -66,7 +66,7 @@ class FTermFreeBSD
|
||||||
FTermFreeBSD();
|
FTermFreeBSD();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermFreeBSD();
|
virtual ~FTermFreeBSD();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
|
@ -57,7 +57,7 @@ class FTermios
|
||||||
FTermios();
|
FTermios();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermios();
|
virtual ~FTermios();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class FTermLinux
|
||||||
FTermLinux();
|
FTermLinux();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermLinux();
|
virtual ~FTermLinux();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -169,8 +169,8 @@ class FTermLinux
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
static bool VGAFont;
|
static bool vga_font;
|
||||||
static bool NewFont;
|
static bool new_font;
|
||||||
static bool shadow_character;
|
static bool shadow_character;
|
||||||
static bool half_block_character;
|
static bool half_block_character;
|
||||||
static bool has_saved_palette;
|
static bool has_saved_palette;
|
||||||
|
@ -210,11 +210,11 @@ inline bool FTermLinux::hasHalfBlockCharacter()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isVGAFontUsed()
|
inline bool FTermLinux::isVGAFontUsed()
|
||||||
{ return VGAFont; }
|
{ return vga_font; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isNewFontUsed()
|
inline bool FTermLinux::isNewFontUsed()
|
||||||
{ return NewFont; }
|
{ return new_font; }
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -59,7 +59,7 @@ class FTermOpenBSD
|
||||||
FTermOpenBSD();
|
FTermOpenBSD();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermOpenBSD();
|
virtual ~FTermOpenBSD();
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
|
@ -57,15 +57,15 @@ class FTermXTerminal
|
||||||
FTermXTerminal();
|
FTermXTerminal();
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermXTerminal();
|
virtual ~FTermXTerminal();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setTermcapMap (FTermcap::tcap_map*);
|
|
||||||
static void setFTermDetection (FTermDetection*);
|
static void setFTermDetection (FTermDetection*);
|
||||||
static void redefineDefaultColors (bool);
|
static void redefineDefaultColors (bool);
|
||||||
static void setCursorStyle (fc::xtermCursorStyle);
|
static void setCursorStyle (fc::xtermCursorStyle);
|
||||||
static void setFont (const FString&);
|
static void setFont (const FString&);
|
||||||
static void setTitle (const FString&);
|
static void setTitle (const FString&);
|
||||||
|
static void setTermSize (int, int);
|
||||||
static void setForeground (const FString&);
|
static void setForeground (const FString&);
|
||||||
static void setBackground (const FString&);
|
static void setBackground (const FString&);
|
||||||
static void setCursorColor (const FString&);
|
static void setCursorColor (const FString&);
|
||||||
|
@ -110,6 +110,7 @@ class FTermXTerminal
|
||||||
static void setXTermCursorStyle();
|
static void setXTermCursorStyle();
|
||||||
static void setXTermFont();
|
static void setXTermFont();
|
||||||
static void setXTermTitle();
|
static void setXTermTitle();
|
||||||
|
static void setXTermSize();
|
||||||
static void setXTermForeground();
|
static void setXTermForeground();
|
||||||
static void setXTermBackground();
|
static void setXTermBackground();
|
||||||
static void setXTermCursorColor();
|
static void setXTermCursorColor();
|
||||||
|
@ -135,9 +136,11 @@ class FTermXTerminal
|
||||||
static void disableXTermMetaSendsESC();
|
static void disableXTermMetaSendsESC();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static FTermcap::tcap_map* tcap;
|
static bool mouse_support;
|
||||||
static FTermDetection* term_detection;
|
static bool meta_sends_esc;
|
||||||
static fc::xtermCursorStyle cursor_style;
|
static bool xterm_default_colors;
|
||||||
|
static int term_width;
|
||||||
|
static int term_height;
|
||||||
static const FString* xterm_font;
|
static const FString* xterm_font;
|
||||||
static const FString* xterm_title;
|
static const FString* xterm_title;
|
||||||
static const FString* foreground_color;
|
static const FString* foreground_color;
|
||||||
|
@ -146,9 +149,9 @@ class FTermXTerminal
|
||||||
static const FString* mouse_foreground_color;
|
static const FString* mouse_foreground_color;
|
||||||
static const FString* mouse_background_color;
|
static const FString* mouse_background_color;
|
||||||
static const FString* highlight_background_color;
|
static const FString* highlight_background_color;
|
||||||
static bool mouse_support;
|
static FTermcap::tcap_map* tcap;
|
||||||
static bool meta_sends_esc;
|
static FTermDetection* term_detection;
|
||||||
static bool xterm_default_colors;
|
static fc::xtermCursorStyle cursor_style;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -157,10 +160,6 @@ class FTermXTerminal
|
||||||
inline const char* FTermXTerminal::getClassName() const
|
inline const char* FTermXTerminal::getClassName() const
|
||||||
{ return "FTermXTerminal"; }
|
{ return "FTermXTerminal"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTermXTerminal::setTermcapMap (FTermcap::tcap_map* tc)
|
|
||||||
{ tcap = tc; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
|
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
|
||||||
{ term_detection = td; }
|
{ term_detection = td; }
|
||||||
|
|
|
@ -80,7 +80,7 @@ class FTextView : public FWidget
|
||||||
explicit FTextView (FWidget* = 0);
|
explicit FTextView (FWidget* = 0);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTextView();
|
virtual ~FTextView();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -90,7 +90,7 @@ class FTextView : public FWidget
|
||||||
const FStringList& getLines() const;
|
const FStringList& getLines() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
void scrollToX (int);
|
void scrollToX (int);
|
||||||
void scrollToY (int);
|
void scrollToY (int);
|
||||||
|
@ -99,7 +99,7 @@ class FTextView : public FWidget
|
||||||
void scrollBy (int, int);
|
void scrollBy (int, int);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
void append (const FString&);
|
void append (const FString&);
|
||||||
void insert (const FString&, int);
|
void insert (const FString&, int);
|
||||||
void replaceRange (const FString&, int, int);
|
void replaceRange (const FString&, int, int);
|
||||||
|
@ -108,17 +108,17 @@ class FTextView : public FWidget
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onMouseMove (FMouseEvent*);
|
virtual void onMouseMove (FMouseEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Method
|
// Method
|
||||||
void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -133,7 +133,7 @@ class FTextView : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
void draw();
|
virtual void draw();
|
||||||
void drawText();
|
void drawText();
|
||||||
void processChanged();
|
void processChanged();
|
||||||
void drawHBar();
|
void drawHBar();
|
||||||
|
|
|
@ -85,17 +85,17 @@ class FToggleButton : public FWidget
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
bool setNoUnderline (bool);
|
bool setNoUnderline (bool);
|
||||||
bool setNoUnderline();
|
bool setNoUnderline();
|
||||||
bool unsetNoUnderline();
|
bool unsetNoUnderline();
|
||||||
bool setEnable (bool);
|
virtual bool setEnable (bool);
|
||||||
bool setEnable();
|
virtual bool setEnable();
|
||||||
bool unsetEnable();
|
virtual bool unsetEnable();
|
||||||
bool setDisable();
|
virtual bool setDisable();
|
||||||
bool setFocus (bool);
|
virtual bool setFocus (bool);
|
||||||
bool setFocus();
|
virtual bool setFocus();
|
||||||
bool unsetFocus();
|
virtual bool unsetFocus();
|
||||||
bool setChecked (bool);
|
bool setChecked (bool);
|
||||||
bool setChecked();
|
bool setChecked();
|
||||||
bool unsetChecked();
|
bool unsetChecked();
|
||||||
|
@ -105,15 +105,15 @@ class FToggleButton : public FWidget
|
||||||
bool isChecked();
|
bool isChecked();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide();
|
virtual void hide();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
virtual void onMouseUp (FMouseEvent*);
|
||||||
void onWheel (FWheelEvent*);
|
virtual void onWheel (FWheelEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
virtual void onAccel (FAccelEvent*);
|
||||||
void onFocusIn (FFocusEvent*);
|
virtual void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Accessor
|
// Accessor
|
||||||
|
@ -153,7 +153,6 @@ class FToggleButton : public FWidget
|
||||||
void setGroup (FButtonGroup*);
|
void setGroup (FButtonGroup*);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init (const FString&);
|
|
||||||
void init();
|
void init();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||||
void drawText (wchar_t[], int, uInt);
|
void drawText (wchar_t[], int, uInt);
|
||||||
|
|
|
@ -90,11 +90,11 @@ class FToolTip : public FWindow
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void show();
|
virtual void show();
|
||||||
void hide();
|
virtual void hide();
|
||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
void onMouseDown (FMouseEvent*);
|
virtual void onMouseDown (FMouseEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
|
|
@ -116,7 +116,7 @@ class FVTerm : public FTerm
|
||||||
explicit FVTerm (bool, bool = false);
|
explicit FVTerm (bool, bool = false);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FVTerm();
|
virtual ~FVTerm();
|
||||||
|
|
||||||
// Overloaded operators
|
// Overloaded operators
|
||||||
template<class type> FVTerm& operator << (const type&);
|
template<class type> FVTerm& operator << (const type&);
|
||||||
|
@ -440,7 +440,7 @@ class FVTerm : public FTerm
|
||||||
static charData s_ch; // shadow character
|
static charData s_ch; // shadow character
|
||||||
static charData i_ch; // inherit background character
|
static charData i_ch; // inherit background character
|
||||||
static FPoint* term_pos; // terminal cursor position
|
static FPoint* term_pos; // terminal cursor position
|
||||||
static termcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
static FKeyboard* keyboard;
|
static FKeyboard* keyboard;
|
||||||
static bool terminal_update_complete;
|
static bool terminal_update_complete;
|
||||||
static bool terminal_update_pending;
|
static bool terminal_update_pending;
|
||||||
|
|
|
@ -146,7 +146,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
explicit FWidget (FWidget* = 0, bool = false);
|
explicit FWidget (FWidget* = 0, bool = false);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FWidget();
|
virtual ~FWidget();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -349,7 +349,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
virtual bool focusPrevChild(); // ...focus
|
virtual bool focusPrevChild(); // ...focus
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
bool event (FEvent*);
|
virtual bool event (FEvent*);
|
||||||
virtual void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
virtual void onKeyUp (FKeyEvent*);
|
virtual void onKeyUp (FKeyEvent*);
|
||||||
virtual void onKeyDown (FKeyEvent*);
|
virtual void onKeyDown (FKeyEvent*);
|
||||||
|
@ -860,7 +860,7 @@ inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::move (const FPoint& pos)
|
inline void FWidget::move (const FPoint& pos)
|
||||||
{ move( pos.getX(), pos.getY() ); }
|
{ move(pos.getX(), pos.getY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::drawBorder()
|
inline void FWidget::drawBorder()
|
||||||
|
|
|
@ -85,7 +85,7 @@ class FWindow : public FWidget
|
||||||
explicit FWindow (FWidget* = 0);
|
explicit FWindow (FWidget* = 0);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FWindow ();
|
virtual ~FWindow ();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -157,7 +157,7 @@ class FWindow : public FWidget
|
||||||
virtual void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
bool event (FEvent*);
|
virtual bool event (FEvent*);
|
||||||
virtual void onWindowActive (FEvent*);
|
virtual void onWindowActive (FEvent*);
|
||||||
virtual void onWindowInactive (FEvent*);
|
virtual void onWindowInactive (FEvent*);
|
||||||
virtual void onWindowRaised (FEvent*);
|
virtual void onWindowRaised (FEvent*);
|
||||||
|
|
|
@ -10,6 +10,7 @@ noinst_PROGRAMS = \
|
||||||
fobject_test \
|
fobject_test \
|
||||||
fmouse_test \
|
fmouse_test \
|
||||||
fkeyboard_test \
|
fkeyboard_test \
|
||||||
|
ftermdata_test \
|
||||||
ftermdetection_test \
|
ftermdetection_test \
|
||||||
ftermcapquirks_test \
|
ftermcapquirks_test \
|
||||||
foptimove_test \
|
foptimove_test \
|
||||||
|
@ -21,6 +22,7 @@ noinst_PROGRAMS = \
|
||||||
fobject_test_SOURCES = fobject-test.cpp
|
fobject_test_SOURCES = fobject-test.cpp
|
||||||
fmouse_test_SOURCES = fmouse-test.cpp
|
fmouse_test_SOURCES = fmouse-test.cpp
|
||||||
fkeyboard_test_SOURCES = fkeyboard-test.cpp
|
fkeyboard_test_SOURCES = fkeyboard-test.cpp
|
||||||
|
ftermdata_test_SOURCES = ftermdata-test.cpp
|
||||||
ftermdetection_test_SOURCES = ftermdetection-test.cpp
|
ftermdetection_test_SOURCES = ftermdetection-test.cpp
|
||||||
ftermcapquirks_test_SOURCES = ftermcapquirks-test.cpp
|
ftermcapquirks_test_SOURCES = ftermcapquirks-test.cpp
|
||||||
foptimove_test_SOURCES = foptimove-test.cpp
|
foptimove_test_SOURCES = foptimove-test.cpp
|
||||||
|
@ -32,6 +34,7 @@ frect_test_SOURCES = frect-test.cpp
|
||||||
TESTS = fobject_test \
|
TESTS = fobject_test \
|
||||||
fmouse_test \
|
fmouse_test \
|
||||||
fkeyboard_test \
|
fkeyboard_test \
|
||||||
|
ftermdata_test \
|
||||||
ftermdetection_test \
|
ftermdetection_test \
|
||||||
ftermcapquirks_test \
|
ftermcapquirks_test \
|
||||||
foptimove_test \
|
foptimove_test \
|
||||||
|
|
|
@ -356,7 +356,8 @@ void FKeyboardTest::escapeKeyTest()
|
||||||
// Normal escape (needs a timeout)
|
// Normal escape (needs a timeout)
|
||||||
input("\033");
|
input("\033");
|
||||||
processInput();
|
processInput();
|
||||||
usleep(100000);
|
// Wait 100 ms (= 100,000,000 ns)
|
||||||
|
nanosleep ((const struct timespec[]){{0, 100000000L}}, NULL);
|
||||||
keyboard->escapeKeyHandling();
|
keyboard->escapeKeyHandling();
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_escape );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_escape );
|
||||||
|
@ -2085,7 +2086,8 @@ void FKeyboardTest::metaKeyTest()
|
||||||
// shifted meta-O
|
// shifted meta-O
|
||||||
input("\033O");
|
input("\033O");
|
||||||
processInput();
|
processInput();
|
||||||
usleep(100000); // Substring keys needs a timeout
|
// Wait 100 ms - Substring keys needs a timeout
|
||||||
|
nanosleep ((const struct timespec[]){{0, 100000000L}}, NULL);
|
||||||
keyboard->escapeKeyHandling();
|
keyboard->escapeKeyHandling();
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_O );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_O );
|
||||||
|
@ -2171,7 +2173,8 @@ void FKeyboardTest::metaKeyTest()
|
||||||
// meta-[
|
// meta-[
|
||||||
input("\033[");
|
input("\033[");
|
||||||
processInput();
|
processInput();
|
||||||
usleep(100000); // Substring keys needs a timeout
|
// Wait 100 ms - Substring keys needs a timeout
|
||||||
|
nanosleep ((const struct timespec[]){{0, 100000000L}}, NULL);
|
||||||
keyboard->escapeKeyHandling();
|
keyboard->escapeKeyHandling();
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_left_square_bracket );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_left_square_bracket );
|
||||||
|
@ -2187,7 +2190,8 @@ void FKeyboardTest::metaKeyTest()
|
||||||
// meta-]
|
// meta-]
|
||||||
input("\033]");
|
input("\033]");
|
||||||
processInput();
|
processInput();
|
||||||
usleep(100000); // Substring keys needs a timeout
|
// Wait 100 ms - Substring keys needs a timeout
|
||||||
|
nanosleep ((const struct timespec[]){{0, 100000000L}}, NULL);
|
||||||
keyboard->escapeKeyHandling();
|
keyboard->escapeKeyHandling();
|
||||||
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
|
||||||
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_right_square_bracket );
|
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fmkey_right_square_bracket );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* fmouse-test.cpp - finalcut::FMouse unit tests *
|
* fmouse-test.cpp - FMouse unit tests *
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
|
@ -199,6 +199,8 @@ void FMouseTest::noArgumentTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMouseTest::doubleClickTest()
|
void FMouseTest::doubleClickTest()
|
||||||
{
|
{
|
||||||
|
using finalcut::operator -;
|
||||||
|
|
||||||
FMouse_protected mouse;
|
FMouse_protected mouse;
|
||||||
CPPUNIT_ASSERT ( mouse.getDblclickInterval() == 500000 ); // 500 ms
|
CPPUNIT_ASSERT ( mouse.getDblclickInterval() == 500000 ); // 500 ms
|
||||||
timeval tv = { 0, 0 };
|
timeval tv = { 0, 0 };
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue