More accurate interfaces through the strict use of FPoint() and FSize()
This commit is contained in:
parent
4dcc573be7
commit
eeb32bd66e
|
@ -1,3 +1,7 @@
|
|||
2019-01-21 Markus Gans <guru.mail@muenster.de>
|
||||
* More accurate interfaces through the strict use of FPoint()
|
||||
and FSize()
|
||||
|
||||
2019-01-16 Markus Gans <guru.mail@muenster.de>
|
||||
* New class FSize for storing dimensions
|
||||
|
||||
|
|
2
build.sh
2
build.sh
|
@ -59,7 +59,7 @@ case "$1" in
|
|||
;;
|
||||
|
||||
"--fulldebug"|"fulldebug")
|
||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy"
|
||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy -ftree-loop-distribute-patterns -Wmemset-transposed-args"
|
||||
then
|
||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||
exit -1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -30,6 +30,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
constexpr lDouble PI = 3.141592653589793238L;
|
||||
|
||||
|
||||
|
@ -119,7 +122,6 @@ class Calc : public finalcut::FDialog
|
|||
|
||||
// Event handlers
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Callback method
|
||||
|
@ -250,8 +252,7 @@ Calc::Calc (FWidget* parent)
|
|||
clearInfixOperator();
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
setText ("Calculator");
|
||||
setGeometry (19, 6, 37, 18);
|
||||
addAccelerator('q'); // Press 'q' to quit
|
||||
setGeometry (FPoint(19, 6), FSize(37, 18));
|
||||
|
||||
for (std::size_t key = 0; key < Calc::NUM_OF_BUTTONS; key++)
|
||||
{
|
||||
|
@ -259,7 +260,7 @@ Calc::Calc (FWidget* parent)
|
|||
button_no[key] = key;
|
||||
|
||||
if ( key == Equals )
|
||||
btn->setGeometry(30, 15, 5, 3);
|
||||
btn->setGeometry(FPoint(30, 15), FSize(5, 3));
|
||||
else
|
||||
{
|
||||
int x, y;
|
||||
|
@ -267,7 +268,7 @@ Calc::Calc (FWidget* parent)
|
|||
( key <= Three ) ? n = 0 : n = 1;
|
||||
x = int(key + n) % 5 * 7 + 2;
|
||||
y = int(key + n) / 5 * 2 + 3;
|
||||
btn->setGeometry(x, y, 5, 1);
|
||||
btn->setGeometry(FPoint(x, y), FSize(5, 1));
|
||||
}
|
||||
|
||||
btn->setFlat();
|
||||
|
@ -337,7 +338,7 @@ void Calc::drawDispay()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
setPrintPos (3, 3);
|
||||
setPrintPos (FPoint(3, 3));
|
||||
print(display);
|
||||
print(L' ');
|
||||
setColor(wc.dialog_fg, wc.dialog_bg);
|
||||
|
@ -352,13 +353,13 @@ void Calc::drawDispay()
|
|||
wchar_t top_line = finalcut::fc::NF_border_line_upper;
|
||||
wchar_t right_line = finalcut::fc::NF_rev_border_line_right;
|
||||
wchar_t left_line = finalcut::fc::NF_border_line_left;
|
||||
setPrintPos (3, 2);
|
||||
setPrintPos (FPoint(3, 2));
|
||||
print (finalcut::FString(33, bottom_line));
|
||||
setPrintPos (2, 3);
|
||||
setPrintPos (FPoint(2, 3));
|
||||
print (right_line);
|
||||
setPrintPos (36, 3);
|
||||
setPrintPos (FPoint(36, 3));
|
||||
print (left_line);
|
||||
setPrintPos (3, 4);
|
||||
setPrintPos (FPoint(3, 4));
|
||||
finalcut::FString top_bottom_line_5 (5, top_bottom_line);
|
||||
finalcut::FString top_line_2 (2, top_line);
|
||||
print ( top_bottom_line_5 + top_line_2
|
||||
|
@ -375,7 +376,7 @@ void Calc::drawDispay()
|
|||
finalcut::FString separator = finalcut::FString(vertical_and_right)
|
||||
+ finalcut::FString(35, horizontal)
|
||||
+ finalcut::FString(vertical_and_left);
|
||||
setPrintPos (1, 4);
|
||||
setPrintPos (FPoint(1, 4));
|
||||
print(separator);
|
||||
}
|
||||
}
|
||||
|
@ -1034,19 +1035,17 @@ void Calc::onKeyPress (finalcut::FKeyEvent* ev)
|
|||
ev->accept();
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
close();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
finalcut::FDialog::onKeyPress(ev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Calc::onAccel (finalcut::FAccelEvent* ev)
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Calc::onClose (finalcut::FCloseEvent* ev)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class CheckList
|
||||
|
@ -73,9 +76,10 @@ CheckList::CheckList (finalcut::FWidget* parent)
|
|||
{
|
||||
setText (L"Shopping list");
|
||||
setShadow();
|
||||
setGeometry (int(1 + (parent->getWidth() - 30) / 2), 5, 30, 13);
|
||||
setGeometry ( FPoint(int(1 + (parent->getWidth() - 30) / 2), 5)
|
||||
, FSize(30, 13) );
|
||||
listView.ignorePadding();
|
||||
listView.setGeometry (1, 2, getWidth(), getHeight() - 1);
|
||||
listView.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
|
||||
|
||||
// Add columns to the view
|
||||
listView.addColumn ("Item");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -23,6 +23,9 @@
|
|||
#include <vector>
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
// Typedef
|
||||
typedef std::shared_ptr<finalcut::FRadioButton> FRadioButtonPtr;
|
||||
|
||||
|
@ -106,11 +109,11 @@ int main (int argc, char* argv[])
|
|||
std::size_t h = 13;
|
||||
int x = int(app.getDesktopWidth() - w) / 2;
|
||||
int y = int(app.getDesktopHeight() - h) / 2;
|
||||
dgl.setGeometry (x, y, w, h);
|
||||
dgl.setGeometry (FPoint(x, y), FSize(w, h));
|
||||
|
||||
// Create a button group
|
||||
finalcut::FButtonGroup checkButtonGroup("choice", &dgl);
|
||||
checkButtonGroup.setGeometry (2, 1, 16, 7);
|
||||
checkButtonGroup.setGeometry (FPoint(2, 1), FSize(16, 7));
|
||||
|
||||
// Create radio buttons
|
||||
std::vector<FRadioButtonPtr> os(9);
|
||||
|
@ -120,7 +123,7 @@ int main (int argc, char* argv[])
|
|||
// => checkButtonGroup.setScrollSize(...) is not required
|
||||
// because a FButtonGroup is self-adjusting
|
||||
for (uInt i = 0; i < os.size(); i++)
|
||||
os[i]->setGeometry(1, int(1 + i), 12, 1);
|
||||
os[i]->setGeometry(FPoint(1, int(1 + i)), FSize(12, 1));
|
||||
|
||||
preset(os);
|
||||
|
||||
|
@ -130,7 +133,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Create a OK button
|
||||
finalcut::FButton ok("&OK", &dgl);
|
||||
ok.setGeometry (10, 9, 8, 1);
|
||||
ok.setGeometry (FPoint(10, 9), FSize(8, 1));
|
||||
|
||||
// Connect the button signal "clicked" with the callback function
|
||||
ok.addCallback
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
// function prototype
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
|
@ -47,7 +50,7 @@ int main (int argc, char* argv[])
|
|||
// Create a simple dialog box
|
||||
finalcut::FDialog dgl(&app);
|
||||
dgl.setText ("FDialog");
|
||||
dgl.setGeometry (4, 3, 41, 11);
|
||||
dgl.setGeometry (FPoint(4, 3), FSize(41, 11));
|
||||
|
||||
// Create text labels
|
||||
finalcut::FLabel label_1(&dgl);
|
||||
|
@ -62,12 +65,12 @@ int main (int argc, char* argv[])
|
|||
<< "or push the button below to exit\n"
|
||||
<< "the program.";
|
||||
|
||||
label_1.setGeometry (1, 1, 38, 2);
|
||||
label_2.setGeometry (5, 3, 34, 3);
|
||||
label_1.setGeometry (FPoint(1, 1), FSize(38, 2));
|
||||
label_2.setGeometry (FPoint(5, 3), FSize(34, 3));
|
||||
|
||||
// Create the quit button
|
||||
finalcut::FButton btn("&Quit", &dgl);
|
||||
btn.setGeometry (16, 7, 9, 1);
|
||||
btn.setGeometry (FPoint(16, 7), FSize(9, 1));
|
||||
|
||||
// Connect the button signal "clicked" with the callback function
|
||||
btn.addCallback
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -22,11 +22,14 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
// function prototypes
|
||||
void cb_quit (finalcut::FWidget*, FDataPtr);
|
||||
void cb_publish (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// callback functions
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -62,7 +65,7 @@ int main (int argc, char* argv[])
|
|||
// Create a simple dialog box
|
||||
finalcut::FDialog dgl(&app);
|
||||
dgl.setText ("Data input");
|
||||
dgl.setGeometry (4, 2, 37, 22);
|
||||
dgl.setGeometry (FPoint(4, 2), FSize(37, 22));
|
||||
dgl.setShadow();
|
||||
|
||||
// Create input fields
|
||||
|
@ -80,37 +83,37 @@ int main (int argc, char* argv[])
|
|||
st_field.setLabelText (L"&State");
|
||||
c_field.setLabelText (L"&Country");
|
||||
|
||||
name_field.setGeometry (15, 1, 19, 1);
|
||||
email_field.setGeometry (15, 3, 19, 1);
|
||||
org_field.setGeometry (15, 5, 19, 1);
|
||||
city_field.setGeometry (15, 7, 19, 1);
|
||||
st_field.setGeometry (15, 9, 19, 1);
|
||||
c_field.setGeometry (15, 11, 4, 1);
|
||||
name_field.setGeometry (FPoint(15, 1), FSize(19, 1));
|
||||
email_field.setGeometry (FPoint(15, 3), FSize(19, 1));
|
||||
org_field.setGeometry (FPoint(15, 5), FSize(19, 1));
|
||||
city_field.setGeometry (FPoint(15, 7), FSize(19, 1));
|
||||
st_field.setGeometry (FPoint(15, 9), FSize(19, 1));
|
||||
c_field.setGeometry (FPoint(15, 11), FSize(4, 1));
|
||||
|
||||
// Create the button group
|
||||
finalcut::FButtonGroup radioButtonGroup ("Sex", &dgl);
|
||||
radioButtonGroup.setGeometry(2, 13, 13, 4);
|
||||
radioButtonGroup.setGeometry(FPoint(2, 13), FSize(13, 4));
|
||||
|
||||
// Create radio buttons
|
||||
finalcut::FRadioButton male ("&Male", &radioButtonGroup);
|
||||
finalcut::FRadioButton female ("&Female", &radioButtonGroup);
|
||||
male.setGeometry (1, 1, 8, 1);
|
||||
female.setGeometry (1, 2, 10, 1);
|
||||
male.setGeometry (FPoint(1, 1), FSize(8, 1));
|
||||
female.setGeometry (FPoint(1, 2), FSize(10, 1));
|
||||
|
||||
// Create another button group
|
||||
finalcut::FButtonGroup checkButtonGroup ("&Data options", &dgl);
|
||||
checkButtonGroup.setGeometry(16, 13, 19, 4);
|
||||
checkButtonGroup.setGeometry(FPoint(16, 13), FSize(19, 4));
|
||||
|
||||
// Create checkbox buttons
|
||||
finalcut::FCheckBox check1 ("Save data", &checkButtonGroup);
|
||||
finalcut::FCheckBox check2 ("Encrypt data", &checkButtonGroup);
|
||||
check1.setGeometry (1, 1, 13, 1);
|
||||
check2.setGeometry (1, 2, 16, 1);
|
||||
check1.setGeometry (FPoint(1, 1), FSize(13, 1));
|
||||
check2.setGeometry (FPoint(1, 2), FSize(16, 1));
|
||||
check2.setDisable();
|
||||
|
||||
// Create a OK button
|
||||
finalcut::FButton btn("&OK", &dgl);
|
||||
btn.setGeometry (24, 18, 10, 1);
|
||||
btn.setGeometry (FPoint(24, 18), FSize(10, 1));
|
||||
|
||||
// Connect checkbox signal "clicked" with a callback function
|
||||
check1.addCallback
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -65,7 +65,8 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
|||
if ( is_last_line )
|
||||
scrollAreaForward (vdesktop);
|
||||
|
||||
setAreaCursor (1, getPrintPos().getY(), true, vdesktop);
|
||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
||||
, true, vdesktop );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -78,11 +79,11 @@ void Keyboard::onAccel (finalcut::FAccelEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void Keyboard::draw()
|
||||
{
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (finalcut::FPoint(1, 1));
|
||||
print() << "---------------\n"
|
||||
<< "Press Q to quit\n"
|
||||
<< "---------------\n";
|
||||
setAreaCursor (1, 4, true, vdesktop);
|
||||
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -28,6 +28,8 @@
|
|||
#include <final/final.h>
|
||||
|
||||
using namespace finalcut;
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
// Global application object
|
||||
static std::weak_ptr<FString> temp_str;
|
||||
|
@ -113,7 +115,7 @@ Listbox::Listbox (FWidget* parent)
|
|||
|
||||
// listbox 1
|
||||
//----------
|
||||
list1.setGeometry(2, 1, 18, 10);
|
||||
list1.setGeometry(FPoint(2, 1), FSize(18, 10));
|
||||
list1.setText ("FListBoxItem");
|
||||
|
||||
for (int i = 1; i < 30; i++)
|
||||
|
@ -124,7 +126,7 @@ Listbox::Listbox (FWidget* parent)
|
|||
for (double i = 1; i<=15; i++)
|
||||
double_list.push_back(2 * i + (i / 100));
|
||||
|
||||
list2.setGeometry(21, 1, 10, 10);
|
||||
list2.setGeometry(FPoint(21, 1), FSize(10, 10));
|
||||
list2.setText ("double");
|
||||
|
||||
//
|
||||
|
@ -147,11 +149,11 @@ Listbox::Listbox (FWidget* parent)
|
|||
TLD["gov"] = "Government";
|
||||
|
||||
list3.insert (TLD.begin(), TLD.end(), mapToString);
|
||||
list3.setGeometry(32, 1, 21, 10);
|
||||
list3.setGeometry(FPoint(32, 1), FSize(21, 10));
|
||||
list3.setText ("key: value");
|
||||
|
||||
// Quit button
|
||||
Quit.setGeometry(42, 12, 10, 1);
|
||||
Quit.setGeometry(FPoint(42, 12), FSize(10, 1));
|
||||
Quit.setText (L"&Quit");
|
||||
|
||||
// Add quit button function callback
|
||||
|
@ -185,7 +187,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
Listbox d(&app);
|
||||
d.setText (L"Listbox");
|
||||
d.setGeometry (int(1 + (app.getWidth() - 56) / 2), 5, 56, 16);
|
||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 56) / 2), 5)
|
||||
, FSize(56, 16) );
|
||||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Listview
|
||||
|
@ -71,7 +74,7 @@ Listview::Listview (finalcut::FWidget* parent)
|
|||
: finalcut::FDialog(parent)
|
||||
{
|
||||
// Set FListView geometry
|
||||
listView.setGeometry(2, 1, 33, 14);
|
||||
listView.setGeometry(FPoint(2, 1), FSize(33, 14));
|
||||
|
||||
// Add columns to the view
|
||||
listView.addColumn ("City");
|
||||
|
@ -104,7 +107,7 @@ Listview::Listview (finalcut::FWidget* parent)
|
|||
populate();
|
||||
|
||||
// Quit button
|
||||
Quit.setGeometry(24, 16, 10, 1);
|
||||
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
|
||||
Quit.setText (L"&Quit");
|
||||
|
||||
// Add some function callbacks
|
||||
|
@ -214,7 +217,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
Listview d(&app);
|
||||
d.setText (L"Weather data");
|
||||
d.setGeometry (int(1 + (app.getWidth() - 37) / 2), 3, 37, 20);
|
||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 37) / 2), 3)
|
||||
, FSize(37, 20) );
|
||||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Mandelbrot
|
||||
|
@ -40,7 +43,7 @@ class Mandelbrot : public finalcut::FDialog
|
|||
~Mandelbrot();
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
private:
|
||||
|
@ -89,7 +92,7 @@ void Mandelbrot::draw()
|
|||
for (y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
|
||||
{
|
||||
current_line++;
|
||||
setPrintPos (xoffset, yoffset + current_line);
|
||||
setPrintPos (FPoint(xoffset, yoffset + current_line));
|
||||
|
||||
for (x0 = x_min; x0 < x_max; x0 += dX)
|
||||
{
|
||||
|
@ -116,10 +119,18 @@ void Mandelbrot::draw()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Mandelbrot::onAccel (finalcut::FAccelEvent* ev)
|
||||
void Mandelbrot::onKeyPress (finalcut::FKeyEvent* ev)
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
if ( ! ev )
|
||||
return;
|
||||
|
||||
if ( ev->key() == 'q' )
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
finalcut::FDialog::onKeyPress(ev);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -133,7 +144,7 @@ void Mandelbrot::adjustSize()
|
|||
{
|
||||
std::size_t h = getParentWidget()->getHeight() - 1;
|
||||
std::size_t w = getParentWidget()->getWidth() - 10;
|
||||
setGeometry(6, 1, w, h, false);
|
||||
setGeometry(FPoint(6, 1), FSize(w, h), false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
@ -147,8 +158,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Create a simple dialog box
|
||||
Mandelbrot mb(&app);
|
||||
mb.setGeometry (6, 1, 70, 23);
|
||||
mb.addAccelerator('q'); // press 'q' to quit
|
||||
mb.setGeometry (FPoint(6, 1), FSize(70, 23));
|
||||
mb.setShadow();
|
||||
|
||||
// Set the mandelbrot object as main widget
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Menu
|
||||
|
@ -140,19 +143,19 @@ Menu::Menu (finalcut::FWidget* parent)
|
|||
// Headline labels
|
||||
Headline1 << " Key ";
|
||||
Headline1.ignorePadding();
|
||||
Headline1.setGeometry(3, 2, 5, 1);
|
||||
Headline1.setGeometry(FPoint(3, 2), FSize(5, 1));
|
||||
Headline1.setEmphasis();
|
||||
|
||||
Headline2 << " Function ";
|
||||
Headline2.ignorePadding();
|
||||
Headline2.setGeometry(19, 2, 10, 1);
|
||||
Headline2.setGeometry(FPoint(19, 2), FSize(10, 1));
|
||||
Headline2.setEmphasis();
|
||||
|
||||
// Info label
|
||||
Info << "<F10> Activate menu bar\n"
|
||||
<< "<Ctrl>+<Space> Activate menu bar\n"
|
||||
<< "<Meta>+<X> Exit";
|
||||
Info.setGeometry(2, 1, 36, 3);
|
||||
Info.setGeometry(FPoint(2, 1), FSize(36, 3));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -325,7 +328,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
Menu main_dlg (&app);
|
||||
main_dlg.setText ("Menu example");
|
||||
main_dlg.setGeometry (int(1 + (app.getWidth() - 40) / 2), 2, 40, 6);
|
||||
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
|
||||
, FSize(40, 6) );
|
||||
main_dlg.setShadow();
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class ColorChooser
|
||||
|
@ -67,8 +70,8 @@ class ColorChooser : public finalcut::FWidget
|
|||
ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
||||
: FWidget(parent)
|
||||
{
|
||||
setSize (8, 12);
|
||||
setFixedSize (8, 12);
|
||||
setSize (FSize(8, 12));
|
||||
setFixedSize (FSize(8, 12));
|
||||
unsetFocusable();
|
||||
|
||||
if ( parent )
|
||||
|
@ -82,7 +85,7 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
// Text label
|
||||
headline.setGeometry (1, 1, 8, 1);
|
||||
headline.setGeometry (FPoint(1, 1), FSize(8, 1));
|
||||
headline.setEmphasis();
|
||||
headline.setAlignment (finalcut::fc::alignCenter);
|
||||
headline << "Color";
|
||||
|
@ -128,7 +131,7 @@ void ColorChooser::draw()
|
|||
|
||||
for (FColor c = 0; c < 16; c++)
|
||||
{
|
||||
setPrintPos (2 + (c / 8) * 3, 3 + c % 8);
|
||||
setPrintPos (FPoint(2 + (c / 8) * 3, 3 + c % 8));
|
||||
|
||||
if ( c < 6 )
|
||||
setColor (finalcut::fc::LightGray, c);
|
||||
|
@ -209,8 +212,8 @@ class Brushes : public finalcut::FWidget
|
|||
Brushes::Brushes (finalcut::FWidget* parent)
|
||||
: FWidget(parent)
|
||||
{
|
||||
setSize (8, 4);
|
||||
setFixedSize (8, 4);
|
||||
setSize (FSize(8, 4));
|
||||
setFixedSize (FSize(8, 4));
|
||||
unsetFocusable();
|
||||
|
||||
if ( parent )
|
||||
|
@ -224,7 +227,7 @@ Brushes::Brushes (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
// Text label
|
||||
headline.setGeometry(1, 1, 8, 1);
|
||||
headline.setGeometry(FPoint(1, 1), FSize(8, 1));
|
||||
headline.setEmphasis();
|
||||
headline.setAlignment (finalcut::fc::alignCenter);
|
||||
headline << "Brush";
|
||||
|
@ -242,7 +245,7 @@ void Brushes::draw()
|
|||
setColor();
|
||||
finalcut::FWidget::drawBorder (1, 2, 8, 4);
|
||||
setColor (fg_color, bg_color);
|
||||
setPrintPos (2, 3);
|
||||
setPrintPos (FPoint(2, 3));
|
||||
print(" ");
|
||||
print(finalcut::FString(3, finalcut::fc::MediumShade));
|
||||
|
||||
|
@ -252,9 +255,9 @@ void Brushes::draw()
|
|||
pos = 3;
|
||||
|
||||
setColor();
|
||||
setPrintPos (3 + pos, 2);
|
||||
setPrintPos (FPoint(3 + pos, 2));
|
||||
print(finalcut::fc::BlackDownPointingTriangle);
|
||||
setPrintPos (3 + pos, 4);
|
||||
setPrintPos (FPoint(3 + pos, 4));
|
||||
print(finalcut::fc::BlackUpPointingTriangle);
|
||||
}
|
||||
|
||||
|
@ -324,10 +327,10 @@ class MouseDraw : public finalcut::FDialog
|
|||
MouseDraw& operator = (const MouseDraw&) = delete;
|
||||
|
||||
// Methods
|
||||
void setGeometry (int, int, std::size_t, std::size_t, bool = true) override;
|
||||
void setGeometry (const FPoint&, const FSize&, bool = true) override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
private:
|
||||
|
@ -356,16 +359,16 @@ MouseDraw::MouseDraw (finalcut::FWidget* parent)
|
|||
: finalcut::FDialog(parent)
|
||||
{
|
||||
setText ("Drawing with the mouse");
|
||||
c_chooser.setPos (1, 1);
|
||||
c_chooser.setPos (FPoint(1, 1));
|
||||
c_chooser.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
|
||||
);
|
||||
|
||||
brush.setPos (1, 12);
|
||||
brush.setPos (FPoint(1, 12));
|
||||
|
||||
finalcut::FSize no_shadow(0, 0);
|
||||
FSize no_shadow(0, 0);
|
||||
finalcut::FRect scroll_geometry(0, 0, 1, 1);
|
||||
createArea (scroll_geometry, no_shadow, canvas);
|
||||
}
|
||||
|
@ -375,16 +378,15 @@ MouseDraw::~MouseDraw()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MouseDraw::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void MouseDraw::setGeometry ( const FPoint& p, const FSize& s, bool adjust)
|
||||
{
|
||||
int old_w, old_h;
|
||||
finalcut::FDialog::setGeometry (x, y, w, h, adjust);
|
||||
finalcut::FSize no_shadow(0, 0);
|
||||
finalcut::FRect scroll_geometry (0, 0, w - 11, h - 3);
|
||||
old_w = canvas->width;
|
||||
old_h = canvas->height;
|
||||
finalcut::FDialog::setGeometry (p, s, adjust);
|
||||
std::size_t w = s.getWidth();
|
||||
std::size_t h = s.getHeight();
|
||||
finalcut::FRect scroll_geometry (FPoint(0, 0), FSize(w - 11, h - 3));
|
||||
FSize no_shadow(0, 0);
|
||||
int old_w = canvas->width;
|
||||
int old_h = canvas->height;
|
||||
resizeArea (scroll_geometry, no_shadow, canvas);
|
||||
|
||||
if ( old_w != canvas->width || old_h != canvas->height )
|
||||
|
@ -395,10 +397,18 @@ void MouseDraw::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MouseDraw::onAccel (finalcut::FAccelEvent* ev)
|
||||
void MouseDraw::onKeyPress (finalcut::FKeyEvent* ev)
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
if ( ! ev )
|
||||
return;
|
||||
|
||||
if ( ev->key() == 'q' )
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
finalcut::FDialog::onKeyPress(ev);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -418,25 +428,25 @@ void MouseDraw::draw()
|
|||
{
|
||||
for (int y = 2; y < y_max; y++)
|
||||
{
|
||||
setPrintPos (10, y);
|
||||
setPrintPos (FPoint(10, y));
|
||||
print (finalcut::fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
setPrintPos (10, y_max);
|
||||
setPrintPos (FPoint(10, y_max));
|
||||
print (finalcut::fc::NF_rev_border_corner_lower_right);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPrintPos (10, 2);
|
||||
setPrintPos (FPoint(10, 2));
|
||||
print (finalcut::fc::BoxDrawingsDownAndHorizontal);
|
||||
|
||||
for (int y = 3; y < y_max; y++)
|
||||
{
|
||||
setPrintPos (10, y);
|
||||
setPrintPos (FPoint(10, y));
|
||||
print (finalcut::fc::BoxDrawingsVertical);
|
||||
}
|
||||
|
||||
setPrintPos (10, y_max);
|
||||
setPrintPos (FPoint(10, y_max));
|
||||
print (finalcut::fc::BoxDrawingsUpAndHorizontal);
|
||||
}
|
||||
|
||||
|
@ -505,7 +515,7 @@ void MouseDraw::adjustSize()
|
|||
std::size_t w = 60, h = 18;
|
||||
int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||
int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||
setGeometry (x, y, w, h, false);
|
||||
setGeometry (FPoint(x, y), FSize(w, h), false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
@ -556,8 +566,7 @@ int main (int argc, char* argv[])
|
|||
|
||||
// Create a simple dialog box
|
||||
MouseDraw mouse_draw(&app);
|
||||
mouse_draw.setGeometry (12, 4, 60, 18);
|
||||
mouse_draw.addAccelerator('q'); // press 'q' to quit
|
||||
mouse_draw.setGeometry (FPoint(12, 4), FSize(60, 18));
|
||||
|
||||
// Set dialog object mouse_draw as main widget
|
||||
app.setMainWidget(&mouse_draw);
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Scrollview
|
||||
|
@ -46,7 +49,7 @@ class Scrollview : public finalcut::FScrollView
|
|||
Scrollview& operator = (const Scrollview&) = delete;
|
||||
|
||||
// Mutator
|
||||
void setScrollSize (std::size_t, std::size_t) override;
|
||||
void setScrollSize (const FSize&) override;
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
@ -75,11 +78,14 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
|
|||
: finalcut::FScrollView(parent)
|
||||
{
|
||||
// Sets the navigation button geometry
|
||||
go_east.setGeometry (1, 1, 5, 1);
|
||||
go_south.setGeometry (int(getScrollWidth()) - 5, 1, 5, 1);
|
||||
go_west.setGeometry ( int(getScrollWidth()) - 5
|
||||
, int(getScrollHeight()) - 2, 5, 1);
|
||||
go_north.setGeometry (1, int(getScrollHeight()) - 2, 5, 1);
|
||||
go_east.setGeometry (FPoint(1, 1), FSize(5, 1));
|
||||
go_south.setGeometry ( FPoint(int(getScrollWidth()) - 5, 1)
|
||||
, FSize(5, 1) );
|
||||
go_west.setGeometry ( FPoint( int(getScrollWidth()) - 5
|
||||
, int(getScrollHeight()) - 2 )
|
||||
, FSize(5, 1) );
|
||||
go_north.setGeometry ( FPoint(1, int(getScrollHeight()) - 2)
|
||||
, FSize(5, 1) );
|
||||
|
||||
// Add scroll function callbacks to the buttons
|
||||
go_east.addCallback
|
||||
|
@ -112,12 +118,14 @@ Scrollview::~Scrollview()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::setScrollSize (std::size_t width, std::size_t height)
|
||||
void Scrollview::setScrollSize (const FSize& size)
|
||||
{
|
||||
FScrollView::setScrollSize (width, height);
|
||||
go_south.setPos (int(width) - 5, 1);
|
||||
go_west.setPos (int(width) - 5, int(height) - 1);
|
||||
go_north.setPos (1, int(height) - 1);
|
||||
FScrollView::setScrollSize (size);
|
||||
auto width = int(size.getWidth());
|
||||
auto height = int(size.getHeight());
|
||||
go_south.setPos (FPoint(width - 5, 1));
|
||||
go_west.setPos (FPoint(width - 5, height - 1));
|
||||
go_north.setPos (FPoint(1, height - 1));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -131,7 +139,7 @@ void Scrollview::draw()
|
|||
|
||||
for (int y = 0; y < int(getScrollHeight()); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
setPrintPos (FPoint(1, 1 + y));
|
||||
|
||||
for (int x = 0; x < int(getScrollWidth()); x++)
|
||||
print (32 + ((x + y) % 0x5f));
|
||||
|
@ -214,15 +222,15 @@ class Scrollviewdemo : public finalcut::FDialog
|
|||
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
||||
: finalcut::FDialog(parent)
|
||||
{
|
||||
setGeometry (16, 3, 50, 19);
|
||||
setGeometry (FPoint(16, 3), FSize(50, 19));
|
||||
setText ("Scrolling viewport example");
|
||||
|
||||
// The scrolling viewport widget
|
||||
sview.setGeometry(3, 2, 44, 12);
|
||||
sview.setScrollSize(188, 124);
|
||||
sview.setGeometry(FPoint(3, 2), FSize(44, 12));
|
||||
sview.setScrollSize(FSize(188, 124));
|
||||
|
||||
// Quit button
|
||||
quit_btn.setGeometry(37, 15, 10, 1);
|
||||
quit_btn.setGeometry(FPoint(37, 15), FSize(10, 1));
|
||||
|
||||
// Add function callback
|
||||
quit_btn.addCallback
|
||||
|
@ -232,7 +240,7 @@ Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
|||
);
|
||||
|
||||
// Text label
|
||||
label.setGeometry(2, 1, 46, 1);
|
||||
label.setGeometry(FPoint(2, 1), FSize(46, 1));
|
||||
label.setEmphasis();
|
||||
label << L"Use scrollbars to change the viewport position";
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -23,6 +23,9 @@
|
|||
#include <functional>
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class AttribDlg
|
||||
|
@ -47,7 +50,7 @@ class AttribDlg : public finalcut::FDialog
|
|||
AttribDlg& operator = (const AttribDlg&) = delete;
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
virtual void onKeyPress (finalcut::FKeyEvent*) override;
|
||||
virtual void onWheel (finalcut::FWheelEvent*) override;
|
||||
virtual void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
|
@ -77,10 +80,12 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
|||
+ finalcut::FString(getTermType())
|
||||
+ ")");
|
||||
|
||||
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1);
|
||||
next_button.addAccelerator(finalcut::fc::Fkey_right);
|
||||
back_button.setGeometry(int(getWidth()) - 25, int(getHeight()) - 4, 10, 1);
|
||||
back_button.addAccelerator(finalcut::fc::Fkey_left);
|
||||
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
|
||||
, FSize(10, 1) );
|
||||
next_button.addAccelerator (finalcut::fc::Fkey_right);
|
||||
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
|
||||
, FSize(10, 1) );
|
||||
back_button.addAccelerator (finalcut::fc::Fkey_left);
|
||||
|
||||
// Add function callbacks
|
||||
next_button.addCallback
|
||||
|
@ -101,10 +106,18 @@ AttribDlg::~AttribDlg()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void AttribDlg::onAccel (finalcut::FAccelEvent* ev)
|
||||
void AttribDlg::onKeyPress (finalcut::FKeyEvent* ev)
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
if ( ! ev )
|
||||
return;
|
||||
|
||||
if ( ev->key() == 'q' )
|
||||
{
|
||||
close();
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
finalcut::FDialog::onKeyPress(ev);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -168,11 +181,11 @@ void AttribDlg::adjustSize()
|
|||
if ( y < 1 )
|
||||
y = 1;
|
||||
|
||||
setGeometry(x, y, 69, 21, false);
|
||||
next_button.setGeometry ( int(getWidth()) - 13, int(getHeight()) - 4
|
||||
, 10, 1, false );
|
||||
back_button.setGeometry ( int(getWidth()) - 25, int(getHeight()) - 4
|
||||
, 10, 1, false );
|
||||
setGeometry(FPoint(x, y), FSize(69, 21), false);
|
||||
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
|
||||
, FSize(10, 1), false );
|
||||
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
|
||||
, FSize(10, 1), false );
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
@ -260,7 +273,7 @@ void AttribDemo::printAltCharset()
|
|||
if ( ! isMonochron() )
|
||||
setColor (wc.label_fg, wc.label_bg);
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
print("alternate charset: ");
|
||||
|
||||
if ( parent->bgcolor == finalcut::fc::Default )
|
||||
|
@ -427,7 +440,7 @@ void AttribDemo::draw()
|
|||
|
||||
for (std::size_t y = 0; y < getParentWidget()->getHeight() - 7; y++)
|
||||
{
|
||||
setPrintPos (1, 2 + int(y));
|
||||
setPrintPos (FPoint(1, 2 + int(y)));
|
||||
|
||||
if ( ! isMonochron() )
|
||||
setColor (wc.label_fg, wc.label_bg);
|
||||
|
@ -439,7 +452,7 @@ void AttribDemo::draw()
|
|||
if ( ! isMonochron() )
|
||||
setColor(wc.label_fg, wc.label_bg);
|
||||
|
||||
setPrintPos (1, 15);
|
||||
setPrintPos (FPoint(1, 15));
|
||||
FColor bg = static_cast<AttribDlg*>(getParent())->bgcolor;
|
||||
print (" Background color:");
|
||||
|
||||
|
@ -448,7 +461,7 @@ void AttribDemo::draw()
|
|||
else
|
||||
printf ( " %d", bg);
|
||||
|
||||
setPrintPos (16, 17);
|
||||
setPrintPos (FPoint(16, 17));
|
||||
print ("Change background color ->");
|
||||
}
|
||||
|
||||
|
@ -466,13 +479,12 @@ int main (int argc, char* argv[])
|
|||
// the parent object "app" (FObject destructor).
|
||||
AttribDlg dialog(&app);
|
||||
|
||||
dialog.setGeometry (6, 2, 69, 21);
|
||||
dialog.addAccelerator('q'); // press 'q' to quit
|
||||
dialog.setGeometry (FPoint(6, 2), FSize(69, 21));
|
||||
dialog.setShadow();
|
||||
|
||||
// Create the attribute demo widget as a child object from the dialog
|
||||
AttribDemo demo(&dialog);
|
||||
demo.setGeometry (1, 1, 67, 19);
|
||||
demo.setGeometry (FPoint(1, 1), FSize(67, 19));
|
||||
|
||||
// Set the dialog object as main widget
|
||||
app.setMainWidget(&dialog);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -59,11 +59,11 @@ Timer::Timer (finalcut::FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
void Timer::draw()
|
||||
{
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (finalcut::FPoint(1, 1));
|
||||
print() << "---------------\n"
|
||||
<< "Press Q to quit\n"
|
||||
<< "---------------\n";
|
||||
setAreaCursor (1, 4, true, vdesktop);
|
||||
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -81,7 +81,8 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
|
|||
if ( is_last_line )
|
||||
scrollAreaForward (vdesktop);
|
||||
|
||||
setAreaCursor (1, getPrintPos().getY(), true, vdesktop);
|
||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
||||
, true, vdesktop );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Transparent
|
||||
|
@ -108,7 +111,7 @@ void Transparent::draw()
|
|||
|
||||
for (int n = 1; n <= int(getClientHeight()); n++)
|
||||
{
|
||||
setPrintPos (2, 2 + n);
|
||||
setPrintPos (FPoint(2, 2 + n));
|
||||
print(line);
|
||||
}
|
||||
|
||||
|
@ -206,17 +209,17 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
|||
// is not required in this class and would result in a double free.
|
||||
transpwin = new Transparent(this);
|
||||
transpwin->setText("transparent");
|
||||
transpwin->setGeometry (6, 3, 29, 12);
|
||||
transpwin->setGeometry (FPoint(6, 3), FSize(29, 12));
|
||||
transpwin->unsetTransparentShadow();
|
||||
|
||||
shadowwin = new Transparent(this, Transparent::shadow);
|
||||
shadowwin->setText("shadow");
|
||||
shadowwin->setGeometry (46, 11, 29, 12);
|
||||
shadowwin->setGeometry (FPoint(46, 11), FSize(29, 12));
|
||||
shadowwin->unsetTransparentShadow();
|
||||
|
||||
ibg = new Transparent(this, Transparent::inherit_background);
|
||||
ibg->setText("inherit background");
|
||||
ibg->setGeometry (42, 3, 29, 7);
|
||||
ibg->setGeometry (FPoint(42, 3), FSize(29, 7));
|
||||
ibg->unsetTransparentShadow();
|
||||
|
||||
// Statusbar at the bottom
|
||||
|
@ -239,9 +242,9 @@ void MainWindow::draw()
|
|||
setReverse(true);
|
||||
|
||||
setColor();
|
||||
setPrintPos (2, 4);
|
||||
setPrintPos (FPoint(2, 4));
|
||||
print(line1);
|
||||
setPrintPos (2, 5);
|
||||
setPrintPos (FPoint(2, 5));
|
||||
print(line2);
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -287,7 +290,7 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
MainWindow main_dlg (&app);
|
||||
main_dlg.setText ("non-transparent");
|
||||
main_dlg.setGeometry (8, 16, 26, 7);
|
||||
main_dlg.setGeometry (FPoint(8, 16), FSize(26, 7));
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget (&main_dlg);
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
// Function prototypes
|
||||
sInt64 StringToNumber (const finalcut::FString&);
|
||||
|
@ -303,7 +306,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
: finalcut::FDialog(parent)
|
||||
{
|
||||
// Set FListView geometry
|
||||
listView.setGeometry(2, 1, 53, 14);
|
||||
listView.setGeometry(FPoint(2, 1), FSize(53, 14));
|
||||
|
||||
// Add columns to the view
|
||||
listView.addColumn ("Name", 23);
|
||||
|
@ -358,7 +361,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
}
|
||||
|
||||
// Quit button
|
||||
Quit.setGeometry(24, 16, 10, 1);
|
||||
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
|
||||
Quit.setText (L"&Quit");
|
||||
|
||||
// Add some function callbacks
|
||||
|
@ -415,7 +418,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
Treeview d(&app);
|
||||
d.setText (L"Continents");
|
||||
d.setGeometry (int(1 + (app.getWidth() - 57) / 2), 3, 57, 20);
|
||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 57) / 2), 3)
|
||||
, FSize(57, 20) );
|
||||
d.setShadow();
|
||||
|
||||
// Set dialog d as main widget
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class ProgressDialog
|
||||
|
@ -71,25 +74,26 @@ class ProgressDialog : public finalcut::FDialog
|
|||
ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
||||
: finalcut::FDialog(parent)
|
||||
{
|
||||
setGeometry (int((getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
|
||||
setGeometry ( FPoint(int((getParentWidget()->getWidth() - 40) / 2), 7)
|
||||
, FSize(40, 10) );
|
||||
setText("Progress bar");
|
||||
//setModal();
|
||||
|
||||
reset.setText("&Reset");
|
||||
reset.setStatusbarMessage ("Reset the progress bar");
|
||||
reset.setGeometry(2, 6, 8, 1, false);
|
||||
reset.setGeometry(FPoint(2, 6), FSize(8, 1), false);
|
||||
reset.setDisable();
|
||||
|
||||
more.setText("&More");
|
||||
more.setStatusbarMessage ("Increases the progress bar position");
|
||||
more.setGeometry(15, 6, 8, 1, false);
|
||||
more.setGeometry(FPoint(15, 6), FSize(8, 1), false);
|
||||
more.setDisable();
|
||||
|
||||
quit.setText("E&xit");
|
||||
quit.setGeometry(28, 6, 8, 1, false);
|
||||
quit.setGeometry(FPoint(28, 6), FSize(8, 1), false);
|
||||
quit.setDisable();
|
||||
|
||||
progressBar.setGeometry(2, 3, 34, 1, false);
|
||||
progressBar.setGeometry(FPoint(2, 3), FSize(34, 1), false);
|
||||
//progressBar.setPercentage(78);
|
||||
|
||||
reset.addCallback
|
||||
|
@ -211,8 +215,8 @@ TextWindow::TextWindow (finalcut::FWidget* parent)
|
|||
: finalcut::FDialog(parent)
|
||||
{
|
||||
scrollText.ignorePadding();
|
||||
scrollText.setGeometry (1, 2, getWidth(), getHeight() - 1);
|
||||
setMinimumSize (51, 6);
|
||||
scrollText.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
|
||||
setMinimumSize (FSize(51, 6));
|
||||
scrollText.setFocus();
|
||||
scrollText.insert(" -----------------------------------------------\n"
|
||||
" line 1\n"
|
||||
|
@ -238,7 +242,7 @@ void TextWindow::append (const finalcut::FString& str)
|
|||
void TextWindow::adjustSize()
|
||||
{
|
||||
finalcut::FDialog::adjustSize();
|
||||
scrollText.setGeometry (1, 2, getWidth(), getHeight() - 1);
|
||||
scrollText.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
|
||||
}
|
||||
|
||||
|
||||
|
@ -550,7 +554,7 @@ void MyDialog::initWidgets()
|
|||
initToggleButtons();
|
||||
|
||||
// A text input field
|
||||
myLineEdit.setGeometry(22, 1, 10, 1);
|
||||
myLineEdit.setGeometry(FPoint(22, 1), FSize(10, 1));
|
||||
myLineEdit.setLabelText (L"&Input");
|
||||
myLineEdit.setStatusbarMessage ("Press Enter to set the title");
|
||||
myLineEdit << finalcut::FString("EnTry").toLower();
|
||||
|
@ -559,7 +563,7 @@ void MyDialog::initWidgets()
|
|||
initButtons();
|
||||
|
||||
// A multiple selection listbox
|
||||
myList.setGeometry(38, 1, 14, 17);
|
||||
myList.setGeometry(FPoint(38, 1), FSize(14, 17));
|
||||
myList.setText ("Items");
|
||||
myList.setStatusbarMessage ("99 items in a list");
|
||||
myList.setMultiSelection();
|
||||
|
@ -575,21 +579,21 @@ void MyDialog::initWidgets()
|
|||
void MyDialog::initFlatButtons()
|
||||
{
|
||||
// Flat buttons
|
||||
MyButton1.setGeometry(3, 3, 5, 1);
|
||||
MyButton1.setGeometry(FPoint(3, 3), FSize(5, 1));
|
||||
MyButton1.setText (L"&SIN");
|
||||
MyButton1.setStatusbarMessage ("Sine function");
|
||||
MyButton1.setNoUnderline();
|
||||
MyButton1.setFlat();
|
||||
MyButton1.setDoubleFlatLine (finalcut::fc::bottom);
|
||||
|
||||
MyButton2.setGeometry(3, 5, 5, 1);
|
||||
MyButton2.setGeometry(FPoint(3, 5), FSize(5, 1));
|
||||
MyButton2.setText (L"&COS");
|
||||
MyButton2.setStatusbarMessage ("Cosine function");
|
||||
MyButton2.setNoUnderline();
|
||||
MyButton2.setFlat();
|
||||
MyButton2.setDoubleFlatLine (finalcut::fc::top);
|
||||
|
||||
MyButton3.setGeometry(10, 3, 5, 3);
|
||||
MyButton3.setGeometry(FPoint(10, 3), FSize(5, 3));
|
||||
MyButton3.setText (L"&=");
|
||||
MyButton3.setStatusbarMessage ("Equal");
|
||||
MyButton3.setNoUnderline();
|
||||
|
@ -619,25 +623,25 @@ void MyDialog::initFlatButtons()
|
|||
void MyDialog::initToggleButtons()
|
||||
{
|
||||
// Radio buttons in a group
|
||||
radioButtonGroup.setGeometry(3, 8, 14, 4);
|
||||
radioButtonGroup.setGeometry(FPoint(3, 8), FSize(14, 4));
|
||||
//radioButtonGroup->unsetBorder();
|
||||
|
||||
radio1.setGeometry(1, 1, 10, 1);
|
||||
radio1.setGeometry(FPoint(1, 1), FSize(10, 1));
|
||||
radio1.setStatusbarMessage ("Enable button Test");
|
||||
|
||||
radio2.setGeometry(1, 2, 11, 1);
|
||||
radio2.setGeometry(FPoint(1, 2), FSize(11, 1));
|
||||
radio2.setText ("&Disable");
|
||||
radio2.setStatusbarMessage ("Disable button Test");
|
||||
radio2.setChecked();
|
||||
//radio2.setDisable();
|
||||
|
||||
// Checkboxes in a group
|
||||
checkButtonGroup.setGeometry(3, 12, 14, 4);
|
||||
checkButtonGroup.setGeometry(FPoint(3, 12), FSize(14, 4));
|
||||
|
||||
check1.setGeometry(1, 1, 11, 1);
|
||||
check1.setGeometry(FPoint(1, 1), FSize(11, 1));
|
||||
check1.setNoUnderline();
|
||||
|
||||
check2.setGeometry(1, 2, 9, 1);
|
||||
check2.setGeometry(FPoint(1, 2), FSize(9, 1));
|
||||
check2.setChecked();
|
||||
check2.setNoUnderline();
|
||||
}
|
||||
|
@ -646,17 +650,17 @@ void MyDialog::initToggleButtons()
|
|||
void MyDialog::initButtons()
|
||||
{
|
||||
// Buttons
|
||||
MyButton4.setGeometry(20, 8, 12, 1);
|
||||
MyButton4.setGeometry(FPoint(20, 8), FSize(12, 1));
|
||||
MyButton4.setText (L"&Get input");
|
||||
MyButton4.setStatusbarMessage ("Take text from input field");
|
||||
MyButton4.setFocus();
|
||||
|
||||
MyButton5.setGeometry(20, 11, 12, 1);
|
||||
MyButton5.setGeometry(FPoint(20, 11), FSize(12, 1));
|
||||
MyButton5.setText (L"&Test");
|
||||
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
|
||||
MyButton5.setDisable();
|
||||
|
||||
MyButton6.setGeometry(20, 14, 12, 1);
|
||||
MyButton6.setGeometry(FPoint(20, 14), FSize(12, 1));
|
||||
MyButton6.setText (L"&Quit");
|
||||
MyButton6.setStatusbarMessage ("Exit the program");
|
||||
MyButton6.addAccelerator('x');
|
||||
|
@ -686,20 +690,20 @@ void MyDialog::initButtons()
|
|||
void MyDialog::initLabels()
|
||||
{
|
||||
// Text labels
|
||||
headline.setGeometry(21, 3, 10, 1);
|
||||
headline.setGeometry(FPoint(21, 3), FSize(10, 1));
|
||||
headline.setEmphasis();
|
||||
headline.setAlignment (finalcut::fc::alignCenter);
|
||||
headline = L"List items";
|
||||
|
||||
tagged.setGeometry(21, 4, 7, 1);
|
||||
tagged.setGeometry(FPoint(21, 4), FSize(7, 1));
|
||||
|
||||
tagged_count.setGeometry(29, 4, 5, 1);
|
||||
tagged_count.setGeometry(FPoint(29, 4), FSize(5, 1));
|
||||
tagged_count << 0;
|
||||
|
||||
sum.setGeometry(21, 5, 7, 3);
|
||||
sum.setGeometry(FPoint(21, 5), FSize(7, 3));
|
||||
sum.setAlignment (finalcut::fc::alignRight);
|
||||
|
||||
sum_count.setGeometry(29, 5, 5, 3);
|
||||
sum_count.setGeometry(FPoint(29, 5), FSize(5, 3));
|
||||
sum_count << myList.getCount();
|
||||
}
|
||||
|
||||
|
@ -822,21 +826,21 @@ void MyDialog::cb_drives (finalcut::FWidget*, FDataPtr)
|
|||
if ( isNewFont() )
|
||||
{
|
||||
finalcut::FLabel drive (finalcut::NF_Drive, &info2);
|
||||
drive.setGeometry (11, 2, 4, 1);
|
||||
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
|
||||
finalcut::FLabel net (finalcut::NF_Net_Drive, &info2);
|
||||
net.setGeometry (11, 4, 4, 1);
|
||||
net.setGeometry (FPoint(11, 4), FSize(4, 1));
|
||||
finalcut::FLabel cd (finalcut::NF_CD_ROM, &info2);
|
||||
cd.setGeometry (11, 6, 4, 1);
|
||||
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
|
||||
info2.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
finalcut::FLabel drive (" - ", &info2);
|
||||
drive.setGeometry (11, 2, 4, 1);
|
||||
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
|
||||
finalcut::FLabel net (" N ", &info2);
|
||||
net.setGeometry (11, 4, 4, 1);
|
||||
net.setGeometry (FPoint(11, 4), FSize(4, 1));
|
||||
finalcut::FLabel cd (" CD ", &info2);
|
||||
cd.setGeometry (11, 6, 4, 1);
|
||||
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
{
|
||||
|
@ -962,10 +966,9 @@ void MyDialog::cb_view (finalcut::FWidget*, FDataPtr data)
|
|||
const auto& view = new TextWindow(this);
|
||||
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
|
||||
view->setText ("Viewer: " + filename);
|
||||
view->setGeometry ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||
int(getRootWidget()->getHeight() / 6),
|
||||
60,
|
||||
getRootWidget()->getHeight() * 3 / 4 );
|
||||
view->setGeometry ( FPoint ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||
int(getRootWidget()->getHeight() / 6) )
|
||||
, FSize(60, getRootWidget()->getHeight() * 3 / 4) );
|
||||
view->setResizeable();
|
||||
std::string line = "";
|
||||
std::ifstream infile;
|
||||
|
@ -1021,7 +1024,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object d
|
||||
MyDialog d(&app);
|
||||
d.setText (title);
|
||||
d.setGeometry (int((app.getWidth() - 56) / 2), 2, 56, app.getHeight() - 4);
|
||||
d.setGeometry ( FPoint(int((app.getWidth() - 56) / 2), 2)
|
||||
, FSize(56, app.getHeight() - 4) );
|
||||
d.setShadow();
|
||||
|
||||
// Set the dialog object d as the main widget of the application.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -23,6 +23,9 @@
|
|||
#include <ctime>
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Watch
|
||||
|
@ -78,20 +81,20 @@ Watch::Watch (FWidget* parent)
|
|||
{
|
||||
setText ("Watch");
|
||||
int pw = int(getParentWidget()->getWidth());
|
||||
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
||||
setGeometry (FPoint(1 + (pw - 22) / 2, 3), FSize(22, 13));
|
||||
|
||||
// Labels
|
||||
time_label.setGeometry(5, 2, 5, 1);
|
||||
time_label.setGeometry(FPoint(5, 2), FSize(5, 1));
|
||||
time_label.setEmphasis();
|
||||
time_str.setGeometry(10, 2, 8, 1);
|
||||
time_str.setGeometry(FPoint(10, 2), FSize(8, 1));
|
||||
|
||||
// Checkbox buttons
|
||||
clock_sw.setGeometry(4, 4, 9, 1);
|
||||
seconds_sw.setGeometry(2, 6, 11, 1);
|
||||
clock_sw.setGeometry(FPoint(4, 4), FSize(9, 1));
|
||||
seconds_sw.setGeometry(FPoint(2, 6), FSize(11, 1));
|
||||
sec = seconds_sw.setChecked();
|
||||
|
||||
// Quit button
|
||||
quit_btn.setGeometry(6, 9, 9, 1);
|
||||
quit_btn.setGeometry(FPoint(6, 9), FSize(9, 1));
|
||||
|
||||
// Connect switch signal "toggled" with a callback member function
|
||||
clock_sw.addCallback
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -23,6 +23,9 @@
|
|||
#include <vector>
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class SmallWindow
|
||||
|
@ -75,24 +78,24 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
|||
left_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||
left_arrow.setEmphasis();
|
||||
left_arrow.ignorePadding();
|
||||
left_arrow.setGeometry (2, 2, 1, 1);
|
||||
left_arrow.setGeometry (FPoint(2, 2), FSize(1, 1));
|
||||
|
||||
right_arrow = arrow_up;
|
||||
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||
right_arrow.setEmphasis();
|
||||
right_arrow.ignorePadding();
|
||||
right_arrow.setGeometry (int(getWidth()) - 1, 2, 1, 1);
|
||||
right_arrow.setGeometry (FPoint(int(getWidth()) - 1, 2), FSize(1, 1));
|
||||
|
||||
top_left_label = "menu";
|
||||
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
||||
top_left_label.setEmphasis();
|
||||
top_left_label.setGeometry (1, 1, 6, 1);
|
||||
top_left_label.setGeometry (FPoint(1, 1), FSize(6, 1));
|
||||
|
||||
top_right_label = "zoom";
|
||||
top_right_label.setAlignment (finalcut::fc::alignRight);
|
||||
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
||||
top_right_label.setEmphasis();
|
||||
top_right_label.setGeometry (int(getClientWidth()) - 5, 1, 6, 1);
|
||||
top_right_label.setGeometry (FPoint(int(getClientWidth()) - 5, 1), FSize(6, 1));
|
||||
|
||||
finalcut::FString bottom_label_text = "resize\n"
|
||||
"corner\n";
|
||||
|
@ -101,7 +104,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
|||
bottom_label.setAlignment (finalcut::fc::alignRight);
|
||||
bottom_label.setForegroundColor (wc.label_inactive_fg);
|
||||
bottom_label.setEmphasis();
|
||||
bottom_label.setGeometry (13, 3, 6, 3);
|
||||
bottom_label.setGeometry (FPoint(13, 3), FSize(6, 3));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -126,9 +129,12 @@ void SmallWindow::adjustSize()
|
|||
}
|
||||
|
||||
finalcut::FDialog::adjustSize();
|
||||
right_arrow.setGeometry (int(getWidth()) - 1, 2, 1, 1);
|
||||
top_right_label.setGeometry (int(getClientWidth()) - 5, 1, 6, 1);
|
||||
bottom_label.setGeometry (1, int(getClientHeight()) - 2, getClientWidth(), 3);
|
||||
right_arrow.setGeometry ( FPoint(int(getWidth()) - 1, 2)
|
||||
, FSize(1, 1) );
|
||||
top_right_label.setGeometry ( FPoint(int(getClientWidth()) - 5, 1)
|
||||
, FSize(6, 1) );
|
||||
bottom_label.setGeometry ( FPoint(1, int(getClientHeight()) - 2)
|
||||
, FSize(getClientWidth(), 3) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -309,11 +315,11 @@ void Window::configureFileMenuItems()
|
|||
void Window::configureDialogButtons()
|
||||
{
|
||||
// Dialog buttons
|
||||
CreateButton.setGeometry (2, 2, 9, 1);
|
||||
CreateButton.setGeometry (FPoint(2, 2), FSize(9, 1));
|
||||
CreateButton.setText (L"&Create");
|
||||
CloseButton.setGeometry (15, 2, 9, 1);
|
||||
CloseButton.setGeometry (FPoint(15, 2), FSize(9, 1));
|
||||
CloseButton.setText (L"C&lose");
|
||||
QuitButton.setGeometry (28, 2, 9, 1);
|
||||
QuitButton.setGeometry (FPoint(28, 2), FSize(9, 1));
|
||||
QuitButton.setText (L"&Quit");
|
||||
|
||||
// Add button callback
|
||||
|
@ -350,7 +356,7 @@ void Window::adjustSize()
|
|||
if ( Y < 2 )
|
||||
Y = 2;
|
||||
|
||||
setPos (X, Y);
|
||||
setPos (FPoint(X, Y));
|
||||
auto first = windows.begin();
|
||||
auto iter = first;
|
||||
|
||||
|
@ -361,7 +367,7 @@ void Window::adjustSize()
|
|||
int n = int(std::distance(first, iter))
|
||||
, x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3
|
||||
, y = dy + 11 + int(n / 3) * 3;
|
||||
(*iter)->dgl->setPos (x, y);
|
||||
(*iter)->dgl->setPos (FPoint(x, y));
|
||||
}
|
||||
|
||||
++iter;
|
||||
|
@ -426,8 +432,8 @@ void Window::cb_createWindows (finalcut::FWidget*, FDataPtr)
|
|||
int n = int(std::distance(first, iter))
|
||||
, x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3
|
||||
, y = dy + 11 + int(n / 3) * 3;
|
||||
win->setGeometry (x, y, 20, 8);
|
||||
win->setMinimumSize (20, 8);
|
||||
win->setGeometry (FPoint(x, y), FSize(20, 8));
|
||||
win->setMinimumSize (FSize(20, 8));
|
||||
win->setResizeable();
|
||||
win->show();
|
||||
|
||||
|
@ -563,7 +569,8 @@ int main (int argc, char* argv[])
|
|||
// Create main dialog object
|
||||
Window main_dlg (&app);
|
||||
main_dlg.setText ("Main window");
|
||||
main_dlg.setGeometry (int(1 + (app.getWidth() - 40) / 2), 2, 40, 6);
|
||||
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
|
||||
, FSize(40, 6) );
|
||||
|
||||
// Set dialog main_dlg as main widget
|
||||
app.setMainWidget (&main_dlg);
|
||||
|
|
|
@ -188,12 +188,12 @@ bool FButton::setShadow (bool enable)
|
|||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
flags.shadow = true;
|
||||
setShadowSize(1, 1);
|
||||
setShadowSize(FSize(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.shadow = false;
|
||||
setShadowSize(0, 0);
|
||||
setShadowSize(FSize(0, 0));
|
||||
}
|
||||
|
||||
return flags.shadow;
|
||||
|
@ -253,7 +253,7 @@ void FButton::hide()
|
|||
|
||||
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
|
||||
{
|
||||
setPrintPos (1 - int(f), 1 + int(y - f));
|
||||
setPrintPos (FPoint(1 - int(f), 1 + int(y - f)));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
|||
|
||||
for (std::size_t y = 1; y <= getHeight(); y++)
|
||||
{
|
||||
setPrintPos (1, int(y));
|
||||
setPrintPos (FPoint(1, int(y)));
|
||||
print (' '); // clear one left █
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
|||
if ( isMonochron() )
|
||||
setReverse(true); // Light background
|
||||
|
||||
setPrintPos (1 + int(getWidth()), y);
|
||||
setPrintPos (FPoint(1 + int(getWidth()), y));
|
||||
print (' '); // clear right
|
||||
|
||||
if ( flags.active && isMonochron() )
|
||||
|
@ -531,7 +531,7 @@ inline void FButton::drawMarginLeft()
|
|||
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (1 + int(indent), 1 + int(y));
|
||||
setPrintPos (FPoint(1 + int(indent), 1 + int(y)));
|
||||
|
||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||
print (fc::BlackRightPointingPointer); // ►
|
||||
|
@ -547,7 +547,7 @@ inline void FButton::drawMarginRight()
|
|||
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (int(getWidth() + indent), 1 + int(y));
|
||||
setPrintPos (FPoint(int(getWidth() + indent), 1 + int(y)));
|
||||
|
||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||
print (fc::BlackLeftPointingPointer); // ◄
|
||||
|
@ -566,7 +566,7 @@ inline void FButton::drawTopBottomBackground()
|
|||
|
||||
for (std::size_t y = 0; y < vcenter_offset; y++)
|
||||
{
|
||||
setPrintPos (2 + int(indent), 1 + int(y));
|
||||
setPrintPos (FPoint(2 + int(indent), 1 + int(y)));
|
||||
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
||||
print (space_char); // █
|
||||
|
@ -574,7 +574,7 @@ inline void FButton::drawTopBottomBackground()
|
|||
|
||||
for (std::size_t y = vcenter_offset + 1; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (2 + int(indent), 1 + int(y));
|
||||
setPrintPos (FPoint(2 + int(indent), 1 + int(y)));
|
||||
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
||||
print (space_char); // █
|
||||
|
@ -585,7 +585,7 @@ inline void FButton::drawTopBottomBackground()
|
|||
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||
{
|
||||
std::size_t pos;
|
||||
setPrintPos (2 + int(indent), 1 + int(vcenter_offset));
|
||||
setPrintPos (FPoint(2 + int(indent), 1 + int(vcenter_offset)));
|
||||
setColor (button_fg, button_bg);
|
||||
|
||||
if ( getWidth() < txtlength + 1 )
|
||||
|
@ -598,11 +598,11 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
print (space_char); // █
|
||||
|
||||
if ( hotkeypos == NOT_SET )
|
||||
setCursorPos ( 2 + int(center_offset)
|
||||
, 1 + int(vcenter_offset) ); // first character
|
||||
setCursorPos (FPoint ( 2 + int(center_offset)
|
||||
, 1 + int(vcenter_offset) )); // first character
|
||||
else
|
||||
setCursorPos ( 2 + int(center_offset + hotkeypos)
|
||||
, 1 + int(vcenter_offset) ); // hotkey
|
||||
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
|
||||
, 1 + int(vcenter_offset) )); // hotkey
|
||||
|
||||
if ( ! flags.active && isMonochron() )
|
||||
setReverse(true); // Light background
|
||||
|
@ -643,7 +643,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
if ( txtlength >= getWidth() - 1 )
|
||||
{
|
||||
// Print ellipsis
|
||||
setPrintPos (int(getWidth() + indent) - 2, 1);
|
||||
setPrintPos (FPoint(int(getWidth() + indent) - 2, 1));
|
||||
print (L"..");
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ void FButtonGroup::hide()
|
|||
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
FWidget::setPrintPos (1, 1 + y);
|
||||
FWidget::setPrintPos (FPoint(1, 1 + y));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -296,8 +296,8 @@ void FButtonGroup::checkScrollSize (const FRect& r)
|
|||
|
||||
if ( ! scrollgeometry.contains(r) )
|
||||
{
|
||||
FRect new_size = scrollgeometry.combined(r);
|
||||
setScrollSize (new_size.getWidth(), new_size.getHeight());
|
||||
FRect r_combined = scrollgeometry.combined(r);
|
||||
setScrollSize (r_combined.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,9 +449,9 @@ void FButtonGroup::drawLabel()
|
|||
length--;
|
||||
|
||||
if ( hasBorder() )
|
||||
FWidget::setPrintPos (2, 1);
|
||||
FWidget::setPrintPos (FPoint(2, 1));
|
||||
else
|
||||
FWidget::setPrintPos (0, 1);
|
||||
FWidget::setPrintPos (FPoint(0, 1));
|
||||
|
||||
drawText (LabelText, hotkeypos, length);
|
||||
setViewportPrint();
|
||||
|
@ -475,7 +475,7 @@ void FButtonGroup::init()
|
|||
{
|
||||
setForegroundColor (wc.label_fg);
|
||||
setBackgroundColor (wc.label_bg);
|
||||
setMinimumSize (7, 4);
|
||||
setMinimumSize (FSize(7, 4));
|
||||
buttonlist.clear(); // no buttons yet
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2017 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -72,7 +72,7 @@ void FCheckBox::drawCheckButton()
|
|||
if ( ! isVisible() )
|
||||
return;
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
setColor();
|
||||
|
||||
if ( isMonochron() )
|
||||
|
|
100
src/fdialog.cpp
100
src/fdialog.cpp
|
@ -161,9 +161,11 @@ int FDialog::exec()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::setPos (int x, int y, bool)
|
||||
void FDialog::setPos (const FPoint& pos, bool)
|
||||
{
|
||||
int rsw, bsh, width, height;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
FRect old_geometry;
|
||||
setPos_error = false;
|
||||
|
||||
|
@ -202,7 +204,7 @@ void FDialog::setPos (int x, int y, bool)
|
|||
old_geometry = getTermGeometryWithShadow();
|
||||
|
||||
// move to the new position
|
||||
FWindow::setPos(x, y, false);
|
||||
FWindow::setPos(pos, false);
|
||||
putArea (getTermPos(), vwin);
|
||||
|
||||
// restoring the non-covered terminal areas
|
||||
|
@ -218,25 +220,25 @@ void FDialog::setPos (int x, int y, bool)
|
|||
if ( dx > 0 )
|
||||
{
|
||||
if ( dy > 0 )
|
||||
restoreVTerm ( old_x + width + rsw - dx, old_y
|
||||
, dx, height + bsh - dy );
|
||||
restoreVTerm (FRect ( old_x + width + rsw - dx, old_y
|
||||
, std::size_t(dx), std::size_t(height + bsh - dy) ));
|
||||
else
|
||||
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
||||
, dx, height + bsh - std::abs(dy));
|
||||
restoreVTerm (FRect ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
||||
, std::size_t(dx), std::size_t(height + bsh - std::abs(dy)) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dy > 0 )
|
||||
restoreVTerm (old_x, old_y, std::abs(dx), height + bsh - dy);
|
||||
restoreVTerm (FRect(old_x, old_y, std::size_t(std::abs(dx)), std::size_t(height + bsh - dy)));
|
||||
else
|
||||
restoreVTerm ( old_x, old_y + std::abs(dy)
|
||||
, std::abs(dx), height + bsh - std::abs(dy) );
|
||||
restoreVTerm (FRect ( old_x, old_y + std::abs(dy)
|
||||
, std::size_t(std::abs(dx)), std::size_t(height + bsh - std::abs(dy)) ));
|
||||
}
|
||||
|
||||
if ( dy > 0 )
|
||||
restoreVTerm (old_x, old_y + height + bsh - dy, width + rsw, dy);
|
||||
restoreVTerm (FRect(old_x, old_y + height + bsh - dy, std::size_t(width + rsw), std::size_t(dy)));
|
||||
else
|
||||
restoreVTerm (old_x, old_y, width + rsw, std::abs(dy));
|
||||
restoreVTerm (FRect(old_x, old_y, std::size_t(width + rsw), std::size_t(std::abs(dy))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -250,45 +252,45 @@ void FDialog::setPos (int x, int y, bool)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::move (int dx, int dy)
|
||||
void FDialog::move (const FPoint& d_pos)
|
||||
{
|
||||
setPos (getX() + dx, getY() + dy);
|
||||
setPos (getPos() + d_pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::moveUp (int n)
|
||||
{
|
||||
move (0, -n);
|
||||
move (FPoint(0, -n));
|
||||
return ! setPos_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::moveDown (int n)
|
||||
{
|
||||
move (0, n);
|
||||
move (FPoint(0, n));
|
||||
return ! setPos_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::moveLeft (int n)
|
||||
{
|
||||
move (-n, 0);
|
||||
move (FPoint(-n, 0));
|
||||
return ! setPos_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::moveRight (int n)
|
||||
{
|
||||
move (n, 0);
|
||||
move (FPoint(n, 0));
|
||||
return ! setPos_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||
void FDialog::setSize (const FSize& size, bool adjust)
|
||||
{
|
||||
setSize_error = false;
|
||||
|
||||
if ( getWidth() == w && getHeight() == h )
|
||||
if ( getSize() == size )
|
||||
{
|
||||
setSize_error = true;
|
||||
return;
|
||||
|
@ -304,17 +306,17 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
, y = getTermY()
|
||||
, old_width = int(getWidth())
|
||||
, old_height = int(getHeight())
|
||||
, dw = old_width - int(w)
|
||||
, dh = old_height - int(h);
|
||||
, dw = old_width - int(size.getWidth())
|
||||
, dh = old_height - int(size.getHeight());
|
||||
const auto& shadow = getShadow();
|
||||
int rsw = int(shadow.getWidth()); // right shadow width;
|
||||
int bsh = int(shadow.getHeight()); // bottom shadow height
|
||||
|
||||
FWindow::setSize (w, h, adjust);
|
||||
FWindow::setSize (size, adjust);
|
||||
|
||||
// get adjust width and height
|
||||
w = getWidth();
|
||||
h = getHeight();
|
||||
std::size_t w = getWidth();
|
||||
std::size_t h = getHeight();
|
||||
|
||||
// dw > 0 : scale down width
|
||||
// dw = 0 : scale only height
|
||||
|
@ -325,10 +327,10 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
|
||||
// restoring the non-covered terminal areas
|
||||
if ( dw > 0 )
|
||||
restoreVTerm (x + int(w) + rsw, y, dw, int(h) + bsh + dh); // restore right
|
||||
restoreVTerm (FRect(x + int(w) + rsw, y, std::size_t(dw), h + std::size_t(bsh + dh))); // restore right
|
||||
|
||||
if ( dh > 0 )
|
||||
restoreVTerm (x, y + int(h) + bsh, int(w) + rsw + dw, dh); // restore bottom
|
||||
restoreVTerm (FRect(x, y + int(h) + bsh, w + std::size_t(rsw + dw), std::size_t(dh))); // restore bottom
|
||||
|
||||
redraw();
|
||||
|
||||
|
@ -364,7 +366,7 @@ bool FDialog::reduceHeight (int n)
|
|||
if ( ! isResizeable() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth(), getHeight() - std::size_t(n));
|
||||
setSize (FSize(getWidth(), getHeight() - std::size_t(n)));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -374,7 +376,7 @@ bool FDialog::expandHeight (int n)
|
|||
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth(), getHeight() + std::size_t(n));
|
||||
setSize (FSize(getWidth(), getHeight() + std::size_t(n)));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -384,7 +386,7 @@ bool FDialog::reduceWidth (int n)
|
|||
if ( ! isResizeable() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth() - std::size_t(n), getHeight());
|
||||
setSize (FSize(getWidth() - std::size_t(n), getHeight()));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -394,7 +396,7 @@ bool FDialog::expandWidth (int n)
|
|||
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth() + std::size_t(n), getHeight());
|
||||
setSize (FSize(getWidth() + std::size_t(n), getHeight()));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -410,7 +412,7 @@ void FDialog::activateDialog()
|
|||
setFocus();
|
||||
setFocusWidget(this);
|
||||
|
||||
if ( win_focus && numOfFocusableChildren() > 1 )
|
||||
if ( win_focus )
|
||||
{
|
||||
win_focus->setFocus();
|
||||
win_focus->redraw();
|
||||
|
@ -771,7 +773,7 @@ void FDialog::draw()
|
|||
clearArea();
|
||||
drawBorder();
|
||||
drawTitleBar();
|
||||
setCursorPos(2, int(getHeight()) - 1);
|
||||
setCursorPos(FPoint(2, int(getHeight()) - 1));
|
||||
|
||||
if ( flags.shadow )
|
||||
drawDialogShadow();
|
||||
|
@ -816,8 +818,8 @@ void FDialog::init()
|
|||
ignorePadding();
|
||||
setDialogWidget();
|
||||
// Initialize geometry values
|
||||
setGeometry (1, 1, 10, 10, false);
|
||||
setMinimumSize (15, 4);
|
||||
setGeometry (FPoint(1, 1), FSize(10, 10), false);
|
||||
setMinimumSize (FSize(15, 4));
|
||||
addDialog(this);
|
||||
setActiveWindow(this);
|
||||
setTransparentShadow();
|
||||
|
@ -860,7 +862,9 @@ void FDialog::initDialogMenu()
|
|||
return;
|
||||
}
|
||||
|
||||
dialog_menu->setPos (getX(), getY() + 1);
|
||||
FPoint p = getPos();
|
||||
p.y_ref()++;
|
||||
dialog_menu->setPos (p);
|
||||
dgl_menuitem = dialog_menu->getItem();
|
||||
dgl_menuitem->ignorePadding();
|
||||
dgl_menuitem->unsetFocusable();
|
||||
|
@ -961,22 +965,22 @@ void FDialog::drawBorder()
|
|||
{
|
||||
for (int y = y1; y < y2; y++)
|
||||
{
|
||||
setPrintPos (x1, y);
|
||||
setPrintPos (FPoint(x1, y));
|
||||
// Border left ⎸
|
||||
print (fc::NF_border_line_left);
|
||||
setPrintPos (x2, y);
|
||||
setPrintPos (FPoint(x2, y));
|
||||
// Border right⎹
|
||||
print (fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
// Lower left corner border ⎣
|
||||
print (fc::NF_border_corner_lower_left);
|
||||
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++) // low line _
|
||||
print (fc::NF_border_line_bottom);
|
||||
|
||||
setPrintPos (x2, y2);
|
||||
setPrintPos (FPoint(x2, y2));
|
||||
// Lower right corner border ⎦
|
||||
print (fc::NF_rev_border_corner_lower_right);
|
||||
}
|
||||
|
@ -1003,7 +1007,7 @@ void FDialog::drawTitleBar()
|
|||
if ( PRINT_WIN_NUMBER )
|
||||
{
|
||||
// Print the number of window in stack
|
||||
setPrintPos (getWidth() - 2, 1);
|
||||
setPrintPos (FPoint(int(getWidth()) - 2, 1));
|
||||
printf ("(%d)", getWindowLayer(this));
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
@ -1013,7 +1017,7 @@ void FDialog::drawTitleBar()
|
|||
void FDialog::drawBarButton()
|
||||
{
|
||||
// Print the title button
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( dialog_menu && dialog_menu->isShown() )
|
||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
||||
|
@ -1245,7 +1249,9 @@ void FDialog::openMenu()
|
|||
else
|
||||
{
|
||||
setOpenMenu(dialog_menu);
|
||||
dialog_menu->setPos (getX(), getY() + 1);
|
||||
FPoint pos = getPos();
|
||||
pos.y_ref()++;
|
||||
dialog_menu->setPos (pos);
|
||||
dialog_menu->setVisible();
|
||||
dialog_menu->show();
|
||||
dialog_menu->raiseWindow();
|
||||
|
@ -1514,7 +1520,8 @@ void FDialog::resizeMouseDown (const mouseStates& ms)
|
|||
FPoint deltaPos = ms.termPos - lower_right_pos;
|
||||
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||
setSize (std::size_t(w), std::size_t(h));
|
||||
const FSize& size = FSize(std::size_t(w), std::size_t(h));
|
||||
setSize (size, true);
|
||||
}
|
||||
else
|
||||
drawBorder();
|
||||
|
@ -1557,8 +1564,9 @@ void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
|||
else
|
||||
h = int(getMaxHeight()) - getTermY() + y2_offset + 1;
|
||||
|
||||
setSize ( ( w >= 0) ? std::size_t(w) : 0
|
||||
, ( h >= 0) ? std::size_t(h) : 0 );
|
||||
const FSize size ( ( w >= 0) ? std::size_t(w) : 0
|
||||
, ( h >= 0) ? std::size_t(h) : 0 );
|
||||
setSize (size);
|
||||
}
|
||||
|
||||
if ( mouse_up )
|
||||
|
@ -1610,7 +1618,7 @@ inline void FDialog::cancelMoveSize()
|
|||
setPos (save_geometry.getPos());
|
||||
|
||||
if ( isResizeable() )
|
||||
setSize (save_geometry.getWidth(), save_geometry.getHeight());
|
||||
setSize (save_geometry.getSize());
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -304,7 +304,7 @@ void FFileDialog::adjustSize()
|
|||
setHeight (h, false);
|
||||
X = 1 + int((max_width - getWidth()) / 2);
|
||||
Y = 1 + int((max_height - getHeight()) / 3);
|
||||
setPos(X, Y, false);
|
||||
setPos(FPoint(X, Y), false);
|
||||
filebrowser.setHeight (h - 8, false);
|
||||
hidden.setY (int(h) - 4, false);
|
||||
cancel.setY (int(h) - 4, false);
|
||||
|
@ -322,7 +322,7 @@ void FFileDialog::init()
|
|||
static constexpr std::size_t h = 15;
|
||||
int x, y;
|
||||
|
||||
setGeometry(1, 1, w, h, false);
|
||||
setGeometry(FPoint(1, 1), FSize(w, h), false);
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -338,36 +338,36 @@ void FFileDialog::init()
|
|||
else
|
||||
FDialog::setText("Open file");
|
||||
|
||||
widgetSettings (x, y); // Create widgets
|
||||
widgetSettings (FPoint(x, y)); // Create widgets
|
||||
initCallbacks();
|
||||
setModal();
|
||||
readDir();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FFileDialog::widgetSettings (int x, int y)
|
||||
inline void FFileDialog::widgetSettings (const FPoint& pos)
|
||||
{
|
||||
filename.setLabelText ("File&name");
|
||||
filename.setText (filter_pattern);
|
||||
filename.setGeometry (11, 1, 28, 1);
|
||||
filename.setGeometry (FPoint(11, 1), FSize(28, 1));
|
||||
filename.setFocus();
|
||||
|
||||
filebrowser.setGeometry (2, 3, 38, 6);
|
||||
filebrowser.setGeometry (FPoint(2, 3), FSize(38, 6));
|
||||
printPath (directory);
|
||||
|
||||
hidden.setText ("&hidden files");
|
||||
hidden.setGeometry (2, 10, 16, 1);
|
||||
hidden.setGeometry (FPoint(2, 10), FSize(16, 1));
|
||||
|
||||
cancel.setText ("&Cancel");
|
||||
cancel.setGeometry(19, 10, 9, 1);
|
||||
cancel.setGeometry(FPoint(19, 10), FSize(9, 1));
|
||||
|
||||
if ( dlg_type == FFileDialog::Save )
|
||||
open.setText ("&Save");
|
||||
else
|
||||
open.setText ("&Open");
|
||||
|
||||
open.setGeometry(30, 10, 9, 1);
|
||||
setGeometry (x, y, getWidth(), getHeight());
|
||||
open.setGeometry(FPoint(30, 10), FSize(9, 1));
|
||||
setPos (pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -234,7 +234,7 @@ void FLabel::setText (const FString& txt)
|
|||
void FLabel::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
hideSize (getWidth(), getHeight());
|
||||
hideSize (getSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -480,7 +480,7 @@ void FLabel::drawMultiLine()
|
|||
else
|
||||
std::wcsncpy(dest, src, length);
|
||||
|
||||
setPrintPos (1, 1 + int(y));
|
||||
setPrintPos (FPoint(1, 1 + int(y)));
|
||||
|
||||
if ( hotkeypos != NOT_SET )
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ void FLabel::drawSingleLine()
|
|||
if ( hotkeypos != NOT_SET )
|
||||
length--;
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
align_offset = getAlignOffset(length);
|
||||
printLine (label_text, length, hotkeypos, align_offset);
|
||||
delete[] label_text;
|
||||
|
|
|
@ -230,12 +230,12 @@ bool FLineEdit::setShadow (bool enable)
|
|||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
flags.shadow = true;
|
||||
setShadowSize(1, 1);
|
||||
setShadowSize(FSize(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.shadow = false;
|
||||
setShadowSize(0, 0);
|
||||
setShadowSize(FSize(0, 0));
|
||||
}
|
||||
|
||||
return flags.shadow;
|
||||
|
@ -275,8 +275,8 @@ void FLineEdit::hide()
|
|||
label->hide();
|
||||
|
||||
FWidget::hide();
|
||||
std::size_t s = hasShadow() ? 1 : 0;
|
||||
hideSize (getWidth() + s, getHeight() + s);
|
||||
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
||||
hideSize (getSize() + shadow);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -598,12 +598,13 @@ void FLineEdit::adjustLabel()
|
|||
switch ( label_orientation )
|
||||
{
|
||||
case label_above:
|
||||
label->setGeometry(getX(), getY() - 1, label_length, 1);
|
||||
label->setGeometry ( FPoint(getX(), getY() - 1)
|
||||
, FSize(label_length, 1) );
|
||||
break;
|
||||
|
||||
case label_left:
|
||||
label->setGeometry(getX() - int(label_length) - 1, getY()
|
||||
, label_length, 1);
|
||||
label->setGeometry ( FPoint(getX() - int(label_length) - 1, getY())
|
||||
, FSize(label_length, 1) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -677,7 +678,7 @@ void FLineEdit::drawInputField()
|
|||
std::size_t x;
|
||||
FString show_text;
|
||||
bool isActiveFocus = flags.active && flags.focus;
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
{
|
||||
|
@ -724,7 +725,7 @@ void FLineEdit::drawInputField()
|
|||
drawShadow ();
|
||||
|
||||
// set the cursor to the first pos.
|
||||
setCursorPos (int(2 + cursor_pos - text_offset), 1);
|
||||
setCursorPos (FPoint(int(2 + cursor_pos - text_offset), 1));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -160,23 +160,22 @@ void FListBox::showInsideBrackets ( std::size_t index
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void FListBox::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust)
|
||||
{
|
||||
// Set the widget geometry
|
||||
|
||||
FWidget::setGeometry(x, y, w, h, adjust);
|
||||
FWidget::setGeometry(pos, size, adjust);
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - nf_offset, 1);
|
||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
|
||||
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2 - nf_offset, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
|
||||
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +214,7 @@ void FListBox::setText (const FString& txt)
|
|||
void FListBox::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
hideSize (getWidth(), getHeight());
|
||||
hideSize (getSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -316,7 +315,7 @@ void FListBox::clear()
|
|||
|
||||
for (int y = 0; y < int(getHeight()) - 2; y++)
|
||||
{
|
||||
setPrintPos (2, 2 + y);
|
||||
setPrintPos (FPoint(2, 2 + y));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -762,7 +761,7 @@ void FListBox::init()
|
|||
{
|
||||
initScrollbar (vbar, fc::vertical, &FListBox::cb_VBarChange);
|
||||
initScrollbar (hbar, fc::horizontal, &FListBox::cb_HBarChange);
|
||||
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
nf_offset = isNewFont() ? 1 : 0;
|
||||
|
@ -820,7 +819,7 @@ void FListBox::draw()
|
|||
|
||||
for (int y = 2; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (int(getWidth()), y);
|
||||
setPrintPos (FPoint(int(getWidth()), y));
|
||||
print (' '); // clear right side of the scrollbar
|
||||
}
|
||||
}
|
||||
|
@ -855,7 +854,7 @@ void FListBox::drawHeadline()
|
|||
|
||||
FString txt = " " + text + " ";
|
||||
std::size_t length = txt.getLength();
|
||||
setPrintPos (2, 1);
|
||||
setPrintPos (FPoint(2, 1));
|
||||
|
||||
if ( isEnabled() )
|
||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||
|
@ -1061,7 +1060,7 @@ inline void FListBox::setLineAttributes ( int y
|
|||
{
|
||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
setPrintPos (2, 2 + int(y));
|
||||
setPrintPos (FPoint(2, 2 + int(y)));
|
||||
|
||||
if ( isLineSelected )
|
||||
{
|
||||
|
@ -1094,7 +1093,7 @@ inline void FListBox::setLineAttributes ( int y
|
|||
setColor ( wc.selected_current_element_fg
|
||||
, wc.selected_current_element_bg );
|
||||
|
||||
setCursorPos (3, 2 + int(y)); // first character
|
||||
setCursorPos (FPoint(3, 2 + int(y))); // first character
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1111,10 +1110,10 @@ inline void FListBox::setLineAttributes ( int y
|
|||
{
|
||||
serach_mark = true;
|
||||
// Place the cursor on the last found character
|
||||
setCursorPos (2 + b + int(inc_len), 2 + int(y));
|
||||
setCursorPos (FPoint(2 + b + int(inc_len), 2 + int(y)));
|
||||
}
|
||||
else // only highlighted
|
||||
setCursorPos (3 + b, 2 + int(y)); // first character
|
||||
setCursorPos (FPoint(3 + b, 2 + int(y))); // first character
|
||||
}
|
||||
else
|
||||
setColor ( wc.current_element_fg
|
||||
|
|
|
@ -650,23 +650,22 @@ fc::sorting_type FListView::getColumnSortType (int column) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void FListView::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust)
|
||||
{
|
||||
// Set the widget geometry
|
||||
|
||||
FWidget::setGeometry(x, y, w, h, adjust);
|
||||
FWidget::setGeometry(pos, size, adjust);
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, int(getHeight()), getWidth() - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
|
||||
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
|
||||
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -756,7 +755,7 @@ int FListView::addColumn (const FString& label, int width)
|
|||
void FListView::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
hideSize (getWidth(), getHeight());
|
||||
hideSize (getSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1374,7 +1373,7 @@ void FListView::init()
|
|||
selflist.push_back(this);
|
||||
root = selflist.begin();
|
||||
null_iter = selflist.end();
|
||||
setGeometry (1, 1, 5, 4, false); // initialize geometry values
|
||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
nf_offset = isNewFont() ? 1 : 0;
|
||||
|
@ -1470,7 +1469,7 @@ void FListView::draw()
|
|||
|
||||
for (int y = 2; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (int(getWidth()), y);
|
||||
setPrintPos (FPoint(int(getWidth()), y));
|
||||
print (' '); // clear right side of the scrollbar
|
||||
}
|
||||
}
|
||||
|
@ -1544,7 +1543,7 @@ void FListView::drawHeadlines()
|
|||
last = h.begin() + len;
|
||||
}
|
||||
|
||||
setPrintPos (2, 1);
|
||||
setPrintPos (FPoint(2, 1));
|
||||
print() << std::vector<charData>(first, last);
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1563,7 @@ void FListView::drawList()
|
|||
const auto item = static_cast<FListViewItem*>(*iter);
|
||||
int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
|
||||
int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
|
||||
setPrintPos (2, 2 + int(y));
|
||||
setPrintPos (FPoint(2, 2 + int(y)));
|
||||
|
||||
// Draw one FListViewItem
|
||||
drawListLine (item, flags.focus, is_current_line);
|
||||
|
@ -1572,8 +1571,8 @@ void FListView::drawList()
|
|||
if ( flags.focus && is_current_line )
|
||||
{
|
||||
setVisibleCursor (item->isCheckable());
|
||||
setCursorPos ( 3 + tree_offset + checkbox_offset - xoffset
|
||||
, 2 + int(y)); // first character
|
||||
setCursorPos (FPoint ( 3 + tree_offset + checkbox_offset - xoffset
|
||||
, 2 + int(y) )); // first character
|
||||
}
|
||||
|
||||
last_visible_line = iter;
|
||||
|
@ -1590,7 +1589,7 @@ void FListView::drawList()
|
|||
// Clean empty space after last element
|
||||
while ( y < uInt(getClientHeight()) )
|
||||
{
|
||||
setPrintPos (2, 2 + int(y));
|
||||
setPrintPos (FPoint(2, 2 + int(y)));
|
||||
print (FString(std::size_t(getClientWidth()), ' '));
|
||||
y++;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ void FMenu::init(FWidget* parent)
|
|||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
setRightPadding(1);
|
||||
setGeometry (1, 1, 10, 2, false); // initialize geometry values
|
||||
setGeometry (FPoint(1, 1), FSize(10, 2), false); // initialize geometry values
|
||||
setTransparentShadow();
|
||||
setMenuWidget();
|
||||
hide();
|
||||
|
@ -498,7 +498,8 @@ void FMenu::calculateDimensions()
|
|||
adjust_X = adjustX(getX());
|
||||
|
||||
// set widget geometry
|
||||
setGeometry (adjust_X, getY(), max_item_width + 2, getCount() + 2);
|
||||
setGeometry ( FPoint(adjust_X, getY())
|
||||
, FSize(max_item_width + 2, getCount() + 2) );
|
||||
|
||||
// set geometry of all items
|
||||
iter = item_list.begin();
|
||||
|
@ -507,14 +508,14 @@ void FMenu::calculateDimensions()
|
|||
|
||||
while ( iter != last )
|
||||
{
|
||||
(*iter)->setGeometry (item_X, item_Y, max_item_width, 1);
|
||||
(*iter)->setGeometry (FPoint(item_X, item_Y), FSize(max_item_width, 1));
|
||||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
int menu_X = getTermX() + int(max_item_width) + 1;
|
||||
int menu_Y = (*iter)->getTermY() - 2;
|
||||
// set sub-menu position
|
||||
(*iter)->getMenu()->setPos (menu_X, menu_Y, false);
|
||||
(*iter)->getMenu()->setPos (FPoint(menu_X, menu_Y), false);
|
||||
}
|
||||
|
||||
item_Y++;
|
||||
|
@ -540,7 +541,7 @@ void FMenu::adjustItems()
|
|||
menu_Y = (*iter)->getTermY() - 2;
|
||||
|
||||
// set sub-menu position
|
||||
menu->setPos (menu_X, menu_Y);
|
||||
menu->setPos (FPoint(menu_X, menu_Y));
|
||||
|
||||
// call sub-menu adjustItems()
|
||||
if ( menu->getCount() > 0 )
|
||||
|
@ -1250,7 +1251,7 @@ void FMenu::drawItems()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawSeparator (int y)
|
||||
{
|
||||
setPrintPos (1, 2 + y);
|
||||
setPrintPos (FPoint(1, 2 + y));
|
||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -1497,7 +1498,7 @@ inline void FMenu::setLineAttributes (FMenuItem* menuitem, int y)
|
|||
setReverse(true);
|
||||
}
|
||||
|
||||
setPrintPos (2, 2 + y);
|
||||
setPrintPos (FPoint(2, 2 + y));
|
||||
setColor();
|
||||
}
|
||||
|
||||
|
@ -1513,9 +1514,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* menuitem)
|
|||
if ( is_selected )
|
||||
{
|
||||
if ( is_checkable )
|
||||
menuitem->setCursorPos (3, 1);
|
||||
menuitem->setCursorPos (FPoint(3, 1));
|
||||
else
|
||||
menuitem->setCursorPos (2, 1);
|
||||
menuitem->setCursorPos (FPoint(2, 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1524,9 +1525,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* menuitem)
|
|||
{
|
||||
// set cursor to the hotkey position
|
||||
if ( is_checkable )
|
||||
menuitem->setCursorPos (3 + int(hotkeypos), 1);
|
||||
menuitem->setCursorPos (FPoint(3 + int(hotkeypos), 1));
|
||||
else
|
||||
menuitem->setCursorPos (2 + int(hotkeypos), 1);
|
||||
menuitem->setCursorPos (FPoint(2 + int(hotkeypos), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void FMenuBar::hide()
|
|||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
auto blank = createBlankArray (screenWidth + 1);
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void FMenuBar::hide()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::adjustSize()
|
||||
{
|
||||
setGeometry (1, 1, getDesktopWidth(), 1, false);
|
||||
setGeometry (FPoint(1, 1), FSize(getDesktopWidth(), 1), false);
|
||||
adjustItems();
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ void FMenuBar::init()
|
|||
auto r = getRootWidget();
|
||||
auto w = r->getWidth();
|
||||
// initialize geometry values
|
||||
setGeometry (1, 1, w, 1, false);
|
||||
setGeometry (FPoint(1, 1), FSize(w, 1), false);
|
||||
setAlwaysOnTop();
|
||||
setMenuBar(this);
|
||||
ignorePadding();
|
||||
|
@ -254,8 +254,7 @@ void FMenuBar::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::calculateDimensions()
|
||||
{
|
||||
int item_X = 1;
|
||||
int item_Y = 1;
|
||||
FPoint item_pos (1, 1);
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
|
@ -266,13 +265,13 @@ void FMenuBar::calculateDimensions()
|
|||
int item_width = int(len) + 2;
|
||||
|
||||
// set item geometry
|
||||
(*iter)->setGeometry (item_X, item_Y, std::size_t(item_width), 1, false);
|
||||
(*iter)->setGeometry (item_pos, FSize(std::size_t(item_width), 1), false);
|
||||
|
||||
// set menu position
|
||||
if ( (*iter)->hasMenu() )
|
||||
(*iter)->getMenu()->setPos (item_X, item_Y, false);
|
||||
(*iter)->getMenu()->setPos (item_pos, false);
|
||||
|
||||
item_X += item_width;
|
||||
item_pos.x_ref() += item_width;
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
@ -502,7 +501,7 @@ void FMenuBar::drawItems()
|
|||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
@ -665,13 +664,13 @@ inline void FMenuBar::drawEllipsis (const menuText& txtdata, std::size_t x)
|
|||
if ( txtdata.startpos < screenWidth )
|
||||
{
|
||||
// Print ellipsis
|
||||
setPrintPos (int(screenWidth) - 1, 1);
|
||||
setPrintPos (FPoint(int(screenWidth) - 1, 1));
|
||||
print ("..");
|
||||
}
|
||||
else if ( txtdata.startpos - 1 <= screenWidth )
|
||||
{
|
||||
// Hide first character from text
|
||||
setPrintPos (int(screenWidth), 1);
|
||||
setPrintPos (FPoint(int(screenWidth), 1));
|
||||
print (' ');
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +718,7 @@ void FMenuBar::adjustItems()
|
|||
auto menu = (*iter)->getMenu();
|
||||
|
||||
// set menu position
|
||||
menu->setPos (menu->adjustX(item_X), item_Y);
|
||||
menu->setPos (FPoint(menu->adjustX(item_X), item_Y));
|
||||
|
||||
// call menu adjustItems()
|
||||
menu->adjustItems();
|
||||
|
|
|
@ -194,7 +194,7 @@ void FMenuItem::setText (const FString& txt)
|
|||
if ( hotkey )
|
||||
text_length--;
|
||||
|
||||
setWidth(text_length);
|
||||
updateSuperMenuDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -209,13 +209,7 @@ void FMenuItem::addAccelerator (FKey key, FWidget* obj)
|
|||
root->accelerator_list->push_back(accel);
|
||||
}
|
||||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
updateSuperMenuDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -241,13 +235,7 @@ void FMenuItem::delAccelerator (FWidget* obj)
|
|||
}
|
||||
}
|
||||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
updateSuperMenuDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -540,7 +528,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
if ( hotkey )
|
||||
text_length--;
|
||||
|
||||
setGeometry (1, 1, text_length + 2, 1, false);
|
||||
setGeometry (FPoint(1, 1), FSize(text_length + 2, 1), false);
|
||||
|
||||
if ( ! parent )
|
||||
return;
|
||||
|
@ -603,6 +591,18 @@ uChar FMenuItem::hotKey()
|
|||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::updateSuperMenuDimensions()
|
||||
{
|
||||
if ( ! super_menu || ! isMenu(super_menu) )
|
||||
return;
|
||||
|
||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::processActivate()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -165,7 +165,6 @@ void FMessageBox::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::adjustSize()
|
||||
{
|
||||
int X, Y;
|
||||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
auto root_widget = getRootWidget();
|
||||
|
@ -182,9 +181,9 @@ void FMessageBox::adjustSize()
|
|||
max_height = 24;
|
||||
}
|
||||
|
||||
X = 1 + int((max_width - getWidth()) / 2);
|
||||
Y = 1 + int((max_height - getHeight()) / 3);
|
||||
setPos(X, Y, false);
|
||||
int x = 1 + int((max_width - getWidth()) / 2);
|
||||
int y = 1 + int((max_height - getHeight()) / 3);
|
||||
setPos(FPoint(x, y), false);
|
||||
FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
@ -235,7 +234,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[0] = new FButton (this);
|
||||
button[0]->setText(button_text[button0]);
|
||||
button[0]->setPos(3, int(getHeight()) - 4, false);
|
||||
button[0]->setPos(FPoint(3, int(getHeight()) - 4), false);
|
||||
button[0]->setWidth(1, false);
|
||||
button[0]->setHeight(1, false);
|
||||
button[0]->setFocus();
|
||||
|
@ -244,7 +243,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[1] = new FButton(this);
|
||||
button[1]->setText(button_text[button1]);
|
||||
button[1]->setPos(17, int(getHeight()) - 4, false);
|
||||
button[1]->setPos(FPoint(17, int(getHeight()) - 4), false);
|
||||
button[1]->setWidth(0, false);
|
||||
button[1]->setHeight(1, false);
|
||||
}
|
||||
|
@ -253,7 +252,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[2] = new FButton(this);
|
||||
button[2]->setText(button_text[button2]);
|
||||
button[2]->setPos(32, int(getHeight()) - 4, false);
|
||||
button[2]->setPos(FPoint(32, int(getHeight()) - 4), false);
|
||||
button[2]->setWidth(0, false);
|
||||
button[2]->setHeight(1, false);
|
||||
}
|
||||
|
@ -309,8 +308,8 @@ inline void FMessageBox::initCallbacks()
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::calculateDimensions()
|
||||
{
|
||||
std::size_t w, h;
|
||||
std::size_t headline_height = 0;
|
||||
FSize size;
|
||||
std::size_t headline_height{0};
|
||||
text_split = text.split("\n");
|
||||
max_line_width = 0;
|
||||
text_num_lines = uInt(text_split.size());
|
||||
|
@ -330,13 +329,13 @@ void FMessageBox::calculateDimensions()
|
|||
max_line_width = len;
|
||||
}
|
||||
|
||||
h = text_num_lines + 8 + headline_height;
|
||||
w = max_line_width + 4;
|
||||
size.setHeight (text_num_lines + 8 + headline_height);
|
||||
size.setWidth (max_line_width + 4);
|
||||
|
||||
if ( w < 20 )
|
||||
w = 20;
|
||||
if ( size.getWidth() < 20 )
|
||||
size.setWidth(20);
|
||||
|
||||
setSize (w, h);
|
||||
setSize(size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -360,7 +359,7 @@ void FMessageBox::draw()
|
|||
if ( center_text ) // center one line
|
||||
center_x = int((max_line_width - headline_length) / 2);
|
||||
|
||||
setPrintPos (1 + msg_x + center_x, 4);
|
||||
setPrintPos (FPoint(1 + msg_x + center_x, 4));
|
||||
print (headline_text);
|
||||
head_offset = 2;
|
||||
}
|
||||
|
@ -374,7 +373,7 @@ void FMessageBox::draw()
|
|||
if ( center_text ) // center one line
|
||||
center_x = int((max_line_width - line_length) / 2);
|
||||
|
||||
setPrintPos (1 + msg_x + center_x, 4 + head_offset + i);
|
||||
setPrintPos (FPoint(1 + msg_x + center_x, 4 + head_offset + i));
|
||||
print(text_components[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ bool FPoint::isOrigin() const
|
|||
//----------------------------------------------------------------------
|
||||
std::ostream& operator << (std::ostream& outstr, const FPoint& p)
|
||||
{
|
||||
outstr << p.getX() << " " << p.getY();
|
||||
outstr << p.xpos << " " << p.ypos;
|
||||
return outstr;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,14 +66,13 @@ void FProgressbar::setPercentage (std::size_t percentage_value)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FProgressbar::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
void FProgressbar::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust )
|
||||
{
|
||||
// Set the progress bar geometry
|
||||
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
bar_length = w;
|
||||
FWidget::setGeometry (pos, size, adjust);
|
||||
bar_length = size.getWidth();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -84,12 +83,12 @@ bool FProgressbar::setShadow (bool enable)
|
|||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
flags.shadow = true;
|
||||
setShadowSize(1, 1);
|
||||
setShadowSize(FSize(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.shadow = false;
|
||||
setShadowSize(0, 0);
|
||||
setShadowSize(FSize(0, 0));
|
||||
}
|
||||
|
||||
return enable;
|
||||
|
@ -99,9 +98,9 @@ bool FProgressbar::setShadow (bool enable)
|
|||
void FProgressbar::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
std::size_t s = hasShadow() ? 1 : 0;
|
||||
hideSize (getWidth() + s, getHeight() + s);
|
||||
setPrintPos (int(getWidth()) - 4, 0);
|
||||
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
||||
hideSize (getSize() + shadow);
|
||||
setPrintPos (FPoint(int(getWidth()) - 4, 0));
|
||||
print (" "); // hide percentage
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ void FProgressbar::drawPercentage()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
setPrintPos (int(getWidth()) - 3, 0);
|
||||
setPrintPos (FPoint(int(getWidth()) - 3, 0));
|
||||
|
||||
if ( percentage > 100 )
|
||||
print ("--- %");
|
||||
|
@ -163,7 +162,7 @@ void FProgressbar::drawBar()
|
|||
{
|
||||
std::size_t i = 0;
|
||||
double length;
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
setColor ( wc.progressbar_bg
|
||||
, wc.progressbar_fg );
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2017 Markus Gans *
|
||||
e Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -73,7 +73,7 @@ void FRadioButton::drawRadioButton()
|
|||
if ( ! isVisible() )
|
||||
return;
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
setColor();
|
||||
|
||||
if ( isMonochron() )
|
||||
|
|
|
@ -151,10 +151,19 @@ void FRect::setSize (const FSize& s)
|
|||
//----------------------------------------------------------------------
|
||||
void FRect::setRect (const FRect& r)
|
||||
{
|
||||
setRect ( r.X1
|
||||
, r.Y1
|
||||
, std::size_t(r.X2 - r.X1 + 1)
|
||||
, std::size_t(r.Y2 - r.Y1 + 1) );
|
||||
X1 = r.X1;
|
||||
Y1 = r.Y1;
|
||||
X2 = r.X2;
|
||||
Y2 = r.Y2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setRect (const FPoint& p, const FSize& s)
|
||||
{
|
||||
X1 = p.getX();
|
||||
Y1 = p.getY();
|
||||
X2 = p.getX() + int(s.getWidth()) - 1;
|
||||
Y2 = p.getY() + int(s.getHeight()) - 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -300,10 +309,10 @@ bool operator != (const FRect& r1, const FRect& r2)
|
|||
//----------------------------------------------------------------------
|
||||
std::ostream& operator << (std::ostream& outstr, const FRect& r)
|
||||
{
|
||||
outstr << r.getX1() << " "
|
||||
<< r.getY1() << " "
|
||||
<< r.getX2() << " "
|
||||
<< r.getY2();
|
||||
outstr << r.X1 << " "
|
||||
<< r.Y1 << " "
|
||||
<< r.X2 << " "
|
||||
<< r.Y2;
|
||||
return outstr;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ FScrollbar::FScrollbar(FWidget* parent)
|
|||
: FWidget(parent)
|
||||
{
|
||||
// The default scrollbar orientation is vertical
|
||||
setGeometry(1, 1, 1, length, false);
|
||||
setGeometry(FPoint(1, 1), FSize(1, length), false);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -148,15 +148,16 @@ void FScrollbar::setOrientation (fc::orientation o)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollbar::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
void FScrollbar::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust )
|
||||
{
|
||||
// Set the scrollbar geometry
|
||||
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
FWidget::setGeometry (pos, size, adjust);
|
||||
|
||||
std::size_t nf = 0;
|
||||
std::size_t w = size.getWidth();
|
||||
std::size_t h = size.getHeight();
|
||||
length = ( h > w ) ? h : w;
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
|
@ -239,7 +240,7 @@ void FScrollbar::drawVerticalBar()
|
|||
|
||||
for (z = 1; z <= slider_pos; z++)
|
||||
{
|
||||
setPrintPos (1, 1 + z);
|
||||
setPrintPos (FPoint(1, 1 + z));
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
|
@ -262,7 +263,7 @@ void FScrollbar::drawVerticalBar()
|
|||
|
||||
for (z = 1; z <= int(slider_length); z++)
|
||||
{
|
||||
setPrintPos (1, 1 + slider_pos + z);
|
||||
setPrintPos (FPoint(1, 1 + slider_pos + z));
|
||||
|
||||
if ( isNewFont() )
|
||||
print (' ');
|
||||
|
@ -277,7 +278,7 @@ void FScrollbar::drawVerticalBar()
|
|||
|
||||
for (z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
||||
{
|
||||
setPrintPos (1, 1 + z);
|
||||
setPrintPos (FPoint(1, 1 + z));
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
|
@ -304,9 +305,9 @@ void FScrollbar::drawHorizontalBar()
|
|||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
|
||||
if ( isNewFont() )
|
||||
setPrintPos (3, 1);
|
||||
setPrintPos (FPoint(3, 1));
|
||||
else
|
||||
setPrintPos (2, 1);
|
||||
setPrintPos (FPoint(2, 1));
|
||||
|
||||
for (z = 0; z < slider_pos; z++)
|
||||
{
|
||||
|
@ -568,7 +569,7 @@ void FScrollbar::init()
|
|||
{
|
||||
unsetFocusable();
|
||||
ignorePadding();
|
||||
setGeometry(1, 1, getWidth(), getHeight());
|
||||
setGeometry(FPoint(1, 1), FSize(getWidth(), getHeight()));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -589,13 +590,13 @@ void FScrollbar::drawButtons()
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
print (fc::NF_rev_up_arrow1);
|
||||
print (fc::NF_rev_up_arrow2);
|
||||
setPrintPos (1, int(length));
|
||||
setPrintPos (FPoint(1, int(length)));
|
||||
print (fc::NF_rev_down_arrow1);
|
||||
print (fc::NF_rev_down_arrow2);
|
||||
}
|
||||
|
@ -603,14 +604,14 @@ void FScrollbar::drawButtons()
|
|||
{
|
||||
print (fc::NF_rev_left_arrow1);
|
||||
print (fc::NF_rev_left_arrow2);
|
||||
setPrintPos (int(length) - 1, 1);
|
||||
setPrintPos (FPoint(int(length) - 1, 1));
|
||||
print (fc::NF_rev_right_arrow1);
|
||||
print (fc::NF_rev_right_arrow2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
@ -618,13 +619,13 @@ void FScrollbar::drawButtons()
|
|||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
print (fc::BlackUpPointingTriangle); // ▲
|
||||
setPrintPos (1, int(length));
|
||||
setPrintPos (FPoint(1, int(length)));
|
||||
print (fc::BlackDownPointingTriangle); // ▼
|
||||
}
|
||||
else // horizontal
|
||||
{
|
||||
print (fc::BlackLeftPointingPointer); // ◄
|
||||
setPrintPos (int(length), 1);
|
||||
setPrintPos (FPoint(int(length), 1));
|
||||
print (fc::BlackRightPointingPointer); // ►
|
||||
}
|
||||
|
||||
|
|
|
@ -106,10 +106,11 @@ void FScrollView::setScrollHeight (std::size_t height)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setScrollSize (std::size_t width, std::size_t height)
|
||||
void FScrollView::setScrollSize (const FSize& size)
|
||||
{
|
||||
int xoffset_end
|
||||
, yoffset_end;
|
||||
int xoffset_end, yoffset_end;
|
||||
std::size_t width = size.getWidth();
|
||||
std::size_t height = size.getHeight();
|
||||
|
||||
if ( width < getViewportWidth() )
|
||||
width = getViewportWidth();
|
||||
|
@ -185,9 +186,9 @@ void FScrollView::setY (int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setPos (int x, int y, bool adjust)
|
||||
void FScrollView::setPos (const FPoint& p, bool adjust)
|
||||
{
|
||||
FWidget::setPos (x, y, adjust);
|
||||
FWidget::setPos (p, adjust);
|
||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||
, getTermY() + getTopPadding() - 1 );
|
||||
|
||||
|
@ -224,26 +225,29 @@ void FScrollView::setHeight (std::size_t h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||
void FScrollView::setSize (const FSize& size, bool adjust)
|
||||
{
|
||||
FWidget::setSize (w, h, adjust);
|
||||
std::size_t w = size.getWidth();
|
||||
std::size_t h = size.getHeight();
|
||||
FWidget::setSize (size, adjust);
|
||||
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
|
||||
, h - horizontal_border_spacing );
|
||||
calculateScrollbarPos();
|
||||
|
||||
if ( getScrollWidth() < getViewportWidth()
|
||||
|| getScrollHeight() < getViewportHeight() )
|
||||
setScrollSize (getViewportWidth(), getViewportHeight());
|
||||
setScrollSize (getViewportSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
void FScrollView::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust )
|
||||
{
|
||||
// Set the scroll view geometry
|
||||
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
FWidget::setGeometry (pos, size, adjust);
|
||||
std::size_t w = size.getWidth();
|
||||
std::size_t h = size.getHeight();
|
||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||
, getTermY() + getTopPadding() - 1 );
|
||||
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
|
||||
|
@ -253,7 +257,7 @@ void FScrollView::setGeometry ( int x, int y
|
|||
if ( getScrollWidth() < getViewportWidth()
|
||||
|| getScrollHeight() < getViewportHeight() )
|
||||
{
|
||||
setScrollSize (getViewportWidth(), getViewportHeight());
|
||||
setScrollSize (getViewportSize());
|
||||
}
|
||||
else if ( ! adjust && viewport )
|
||||
{
|
||||
|
@ -263,15 +267,17 @@ void FScrollView::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setCursorPos (int x, int y)
|
||||
void FScrollView::setCursorPos (const FPoint& p)
|
||||
{
|
||||
FWidget::setCursorPos (x + getLeftPadding(), y + getTopPadding());
|
||||
FWidget::setCursorPos (FPoint ( p.getX() + getLeftPadding()
|
||||
, p.getY() + getTopPadding() ));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setPrintPos (int x, int y)
|
||||
void FScrollView::setPrintPos (const FPoint& p)
|
||||
{
|
||||
FWidget::setPrintPos (x + getLeftPadding(), y + getTopPadding());
|
||||
FWidget::setPrintPos (FPoint( p.getX() + getLeftPadding()
|
||||
, p.getY() + getTopPadding() ));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -726,8 +732,8 @@ void FScrollView::init (FWidget* parent)
|
|||
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_HBarChange);
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
setGeometry (1, 1, 4, 4);
|
||||
setMinimumSize (4, 4);
|
||||
setGeometry (FPoint(1, 1), FSize(4, 4));
|
||||
setMinimumSize (FSize(4, 4));
|
||||
int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||
nf_offset = isNewFont() ? 1 : 0;
|
||||
|
@ -792,13 +798,13 @@ void FScrollView::calculateScrollbarPos()
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (int(width), 2, 2, height - 2);
|
||||
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(width), 2), FSize(2, height - 2));
|
||||
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
|
||||
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
|
||||
}
|
||||
|
||||
vbar->resize();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -93,7 +93,7 @@ bool FSize::isEmpty() const
|
|||
//----------------------------------------------------------------------
|
||||
std::ostream& operator << (std::ostream& outstr, const FSize& s)
|
||||
{
|
||||
outstr << s.getWidth() << " " << s.getHeight();
|
||||
outstr << s.width << " " << s.height;
|
||||
return outstr;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool enable)
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusKey::init (FWidget* parent)
|
||||
{
|
||||
setGeometry (1, 1, 1, 1);
|
||||
setGeometry (FPoint(1, 1), FSize(1, 1));
|
||||
|
||||
if ( parent && parent->isInstanceOf("FStatusBar") )
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ void FStatusBar::hide()
|
|||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
auto blank = createBlankArray(screenWidth + 1);
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ void FStatusBar::drawMessage()
|
|||
space_offset = 0;
|
||||
|
||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||
setPrintPos (x, 1);
|
||||
setPrintPos (FPoint(x, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
@ -312,7 +312,8 @@ void FStatusBar::clear()
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::adjustSize()
|
||||
{
|
||||
setGeometry (1, int(getDesktopHeight()), getDesktopWidth(), 1, false);
|
||||
setGeometry ( FPoint(1, int(getDesktopHeight()))
|
||||
, FSize(getDesktopWidth(), 1), false );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -507,7 +508,7 @@ void FStatusBar::init()
|
|||
std::size_t w = r->getWidth();
|
||||
int h = int(r->getHeight());
|
||||
// initialize geometry values
|
||||
setGeometry (1, h, w, 1, false);
|
||||
setGeometry (FPoint(1, h), FSize(w, 1), false);
|
||||
setAlwaysOnTop();
|
||||
setStatusBar(this);
|
||||
ignorePadding();
|
||||
|
@ -540,7 +541,7 @@ void FStatusBar::drawKeys()
|
|||
return;
|
||||
}
|
||||
|
||||
setPrintPos (1, 1);
|
||||
setPrintPos (FPoint(1, 1));
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -127,7 +127,7 @@ void FSwitch::drawCheckButton()
|
|||
if ( ! isVisible() )
|
||||
return;
|
||||
|
||||
setPrintPos (1 + int(switch_offset_pos), 1);
|
||||
setPrintPos (FPoint(1 + int(switch_offset_pos), 1));
|
||||
|
||||
if ( checked )
|
||||
drawChecked();
|
||||
|
@ -181,7 +181,7 @@ void FSwitch::drawChecked()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
setCursorPos (3 + int(switch_offset_pos), 1);
|
||||
setCursorPos (FPoint(3 + int(switch_offset_pos), 1));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -228,7 +228,7 @@ void FSwitch::drawUnchecked()
|
|||
if ( isMonochron() || getMaxColor() < 16 )
|
||||
setBold(false);
|
||||
|
||||
setCursorPos (7 + int(switch_offset_pos), 1);
|
||||
setCursorPos (FPoint(7 + int(switch_offset_pos), 1));
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -527,11 +527,11 @@ void FTerm::detectTermSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setTermSize (std::size_t width, std::size_t height)
|
||||
void FTerm::setTermSize (const FSize& size)
|
||||
{
|
||||
// Set xterm size to {width} x {height}
|
||||
// Set xterm size
|
||||
|
||||
xterm->setTermSize (width, height);
|
||||
xterm->setTermSize (size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* Copyright 2018-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -126,12 +126,12 @@ void FTermXTerminal::setTitle (const FString& title)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setTermSize (std::size_t width, std::size_t height)
|
||||
void FTermXTerminal::setTermSize (const FSize& size)
|
||||
{
|
||||
// Set xterm size to {term_width} x {term_height}
|
||||
|
||||
term_width = width;
|
||||
term_height = height;
|
||||
term_width = size.getWidth();
|
||||
term_height = size.getHeight();
|
||||
setXTermSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -84,25 +84,24 @@ const FString FTextView::getText() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void FTextView::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust)
|
||||
{
|
||||
// Set the text view geometry
|
||||
|
||||
FWidget::setGeometry(x, y, w, h, adjust);
|
||||
FWidget::setGeometry(pos, size, adjust);
|
||||
std::size_t width = getWidth();
|
||||
std::size_t height = getHeight();
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (int(width), 1, 2, height - 1);
|
||||
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(width), 1), FSize(2, height - 1));
|
||||
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
|
||||
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
|
||||
}
|
||||
|
||||
vbar->resize();
|
||||
|
@ -187,7 +186,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
void FTextView::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
hideSize (getWidth(), getHeight());
|
||||
hideSize (getSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -298,7 +297,7 @@ void FTextView::clear()
|
|||
|
||||
for (int y = 0; y < int(getTextHeight()); y++)
|
||||
{
|
||||
setPrintPos (2, 2 - nf_offset + y);
|
||||
setPrintPos (FPoint(2, 2 - nf_offset + y));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -671,7 +670,7 @@ void FTextView::draw()
|
|||
}
|
||||
}
|
||||
|
||||
setCursorPos (int(getWidth()), int(getHeight()));
|
||||
setCursorPos (FPoint(int(getWidth()), int(getHeight())));
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
}
|
||||
|
@ -696,7 +695,7 @@ void FTextView::drawText()
|
|||
{
|
||||
std::size_t i;
|
||||
FString line;
|
||||
setPrintPos (2, 2 - nf_offset + int(y));
|
||||
setPrintPos (FPoint(2, 2 - nf_offset + int(y)));
|
||||
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
|
||||
, getTextWidth() );
|
||||
const auto line_str = line.wc_str();
|
||||
|
|
|
@ -76,24 +76,24 @@ FToggleButton::~FToggleButton() // destructor
|
|||
|
||||
// public methods of FToggleButton
|
||||
//----------------------------------------------------------------------
|
||||
void FToggleButton::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
void FToggleButton::setGeometry ( const FPoint& pos, const FSize& s
|
||||
, bool adjust )
|
||||
{
|
||||
// Set the toggle button geometry
|
||||
|
||||
FSize size = s;
|
||||
std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0;
|
||||
std::size_t min_width = button_width + text.getLength() - hotkey_mark;
|
||||
|
||||
if ( w < min_width )
|
||||
w = min_width;
|
||||
if ( size.getWidth() < min_width )
|
||||
size.setWidth(min_width);
|
||||
|
||||
const FRect geometry(x, y, w, h);
|
||||
const FRect geometry(pos, size);
|
||||
|
||||
if ( hasGroup() )
|
||||
getGroup()->checkScrollSize(geometry);
|
||||
|
||||
FWidget::setGeometry(x, y, w, h, adjust);
|
||||
FWidget::setGeometry(pos, size, adjust);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -203,7 +203,7 @@ void FToggleButton::setText (const FString& txt)
|
|||
void FToggleButton::hide()
|
||||
{
|
||||
FWidget::hide();
|
||||
hideSize (getWidth(), getHeight());
|
||||
hideSize (getSize());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -411,7 +411,7 @@ void FToggleButton::draw()
|
|||
|
||||
// set the cursor to the button
|
||||
if ( isRadioButton() || isCheckboxButton() )
|
||||
setCursorPos (2, 1);
|
||||
setCursorPos (FPoint(2, 1));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -445,7 +445,7 @@ void FToggleButton::drawLabel()
|
|||
if ( hotkeypos != NOT_SET )
|
||||
length--;
|
||||
|
||||
setPrintPos (1 + int(label_offset_pos), 1);
|
||||
setPrintPos (FPoint(1 + int(label_offset_pos), 1));
|
||||
drawText (LabelText, hotkeypos, length);
|
||||
delete[] LabelText;
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
|
|||
//----------------------------------------------------------------------
|
||||
void FToggleButton::init()
|
||||
{
|
||||
setGeometry (1, 1, 4, 1, false); // initialize geometry values
|
||||
setGeometry (FPoint(1, 1), FSize(4, 1), false); // initialize geometry values
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -87,7 +87,7 @@ void FToolTip::draw()
|
|||
|
||||
for (std::size_t i = 0; i < text_num_lines; i++)
|
||||
{
|
||||
setPrintPos (3, 2 + int(i));
|
||||
setPrintPos (FPoint(3, 2 + int(i)));
|
||||
print(text_components[i]);
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ void FToolTip::init()
|
|||
setAlwaysOnTop();
|
||||
ignorePadding();
|
||||
// initialize geometry values
|
||||
setGeometry (1, 1, 3, 3, false);
|
||||
setMinimumSize (3, 3);
|
||||
setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
||||
setMinimumSize (FSize(3, 3));
|
||||
setForegroundColor (wc.tooltip_fg);
|
||||
setBackgroundColor (wc.tooltip_bg);
|
||||
calculateDimensions();
|
||||
|
@ -164,7 +164,7 @@ void FToolTip::calculateDimensions()
|
|||
else
|
||||
x = y = 1;
|
||||
|
||||
setGeometry (x, y, w, h);
|
||||
setGeometry (FPoint(x, y), FSize(w, h));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
375
src/fvterm.cpp
375
src/fvterm.cpp
|
@ -148,8 +148,10 @@ void FVTerm::hideCursor (bool enable)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::setPrintCursor (int x, int y)
|
||||
void FVTerm::setPrintCursor (const FPoint& pos)
|
||||
{
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
auto win = getPrintArea();
|
||||
|
||||
if ( win )
|
||||
|
@ -177,31 +179,23 @@ void FVTerm::clearArea (int fillchar)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::createVTerm (const FRect& r)
|
||||
void FVTerm::createVTerm (const FSize& size)
|
||||
{
|
||||
// initialize virtual terminal
|
||||
|
||||
const FRect box(0, 0, size.getWidth(), size.getHeight());
|
||||
const FSize shadow(0, 0);
|
||||
createArea (r, shadow, vterm);
|
||||
createArea (box, shadow, vterm);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::createVTerm (int width, int height)
|
||||
void FVTerm::resizeVTerm (const FSize& size)
|
||||
{
|
||||
// initialize virtual terminal
|
||||
createArea (0, 0, width, height, 0, 0, vterm);
|
||||
}
|
||||
// resize virtual terminal
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::resizeVTerm (const FRect& r)
|
||||
{
|
||||
const FRect box(0, 0, size.getWidth(), size.getHeight());
|
||||
const FSize shadow(0, 0);
|
||||
resizeArea (r, shadow, vterm);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::resizeVTerm (int width, int height)
|
||||
{
|
||||
resizeArea (0, 0, width, height, 0, 0, vterm);
|
||||
resizeArea (box, shadow, vterm);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -593,23 +587,8 @@ FVTerm::term_area* FVTerm::getPrintArea()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::createArea ( const FRect& r
|
||||
, const FSize& s
|
||||
, term_area*& area )
|
||||
{
|
||||
createArea ( r.getX()
|
||||
, r.getY()
|
||||
, int(r.getWidth())
|
||||
, int(r.getHeight())
|
||||
, int(s.getWidth())
|
||||
, int(s.getHeight())
|
||||
, area );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::createArea ( int offset_left, int offset_top
|
||||
, int width, int height
|
||||
, int rsw, int bsh
|
||||
void FVTerm::createArea ( const FRect& box
|
||||
, const FSize& shadow
|
||||
, term_area*& area )
|
||||
{
|
||||
// initialize virtual window
|
||||
|
@ -625,34 +604,26 @@ void FVTerm::createArea ( int offset_left, int offset_top
|
|||
}
|
||||
|
||||
area->widget = static_cast<FWidget*>(this);
|
||||
resizeArea (offset_left, offset_top, width, height, rsw, bsh, area);
|
||||
resizeArea (box, shadow, area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::resizeArea ( const FRect& r
|
||||
, const FSize& s
|
||||
, term_area* area )
|
||||
{
|
||||
resizeArea ( r.getX()
|
||||
, r.getY()
|
||||
, int(r.getWidth())
|
||||
, int(r.getHeight())
|
||||
, int(s.getWidth())
|
||||
, int(s.getHeight())
|
||||
, area );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::resizeArea ( int offset_left, int offset_top
|
||||
, int width, int height
|
||||
, int rsw, int bsh
|
||||
void FVTerm::resizeArea ( const FRect& box
|
||||
, const FSize& shadow
|
||||
, term_area* area )
|
||||
{
|
||||
// Resize the virtual window to a new size.
|
||||
|
||||
int offset_left = box.getX();
|
||||
int offset_top = box.getY();
|
||||
int width = int(box.getWidth());
|
||||
int height = int(box.getHeight());
|
||||
int rsw = int(shadow.getWidth());
|
||||
int bsh = int(shadow.getHeight());
|
||||
|
||||
assert ( offset_top >= 0 );
|
||||
assert ( width > 0 );
|
||||
assert ( height > 0 );
|
||||
assert ( width > 0 && width + rsw > 0 );
|
||||
assert ( height > 0 && height + bsh > 0 );
|
||||
assert ( rsw >= 0 );
|
||||
assert ( bsh >= 0 );
|
||||
std::size_t area_size;
|
||||
|
@ -701,17 +672,16 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
|
|||
area->bottom_shadow = bsh;
|
||||
area->has_changes = false;
|
||||
|
||||
setTextToDefault (area, width + rsw, height + bsh);
|
||||
FSize size(std::size_t(width + rsw), std::size_t(height + bsh));
|
||||
setTextToDefault (area, size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::setTextToDefault ( term_area* area
|
||||
, int width
|
||||
, int height )
|
||||
, const FSize& size )
|
||||
{
|
||||
charData default_char;
|
||||
line_changes unchanged;
|
||||
int size = width * height;
|
||||
|
||||
default_char.code = ' ';
|
||||
default_char.fg_color = fc::Default;
|
||||
|
@ -720,13 +690,13 @@ inline void FVTerm::setTextToDefault ( term_area* area
|
|||
default_char.attr.byte[1] = 0;
|
||||
default_char.attr.byte[2] = 0;
|
||||
|
||||
std::fill_n (area->text, size, default_char);
|
||||
std::fill_n (area->text, size.getArea(), default_char);
|
||||
|
||||
unchanged.xmin = uInt(width);
|
||||
unchanged.xmin = uInt(size.getWidth());
|
||||
unchanged.xmax = 0;
|
||||
unchanged.trans_count = 0;
|
||||
|
||||
std::fill_n (area->changes, height, unchanged);
|
||||
std::fill_n (area->changes, size.getHeight(), unchanged);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -734,6 +704,9 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
|
|||
, std::size_t height
|
||||
, std::size_t size )
|
||||
{
|
||||
// Reallocate "height" lines for changes
|
||||
// and "size" bytes for the text area
|
||||
|
||||
if ( area->changes != 0 )
|
||||
delete[] area->changes;
|
||||
|
||||
|
@ -757,6 +730,8 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::reallocateTextArea (term_area* area, std::size_t size)
|
||||
{
|
||||
// Reallocate "size" bytes for the text area
|
||||
|
||||
if ( area->text != 0 )
|
||||
delete[] area->text;
|
||||
|
||||
|
@ -800,17 +775,10 @@ void FVTerm::removeArea (term_area*& area)
|
|||
//----------------------------------------------------------------------
|
||||
void FVTerm::restoreVTerm (const FRect& box)
|
||||
{
|
||||
restoreVTerm ( box.getX()
|
||||
, box.getY()
|
||||
, int(box.getWidth())
|
||||
, int(box.getHeight()) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
||||
{
|
||||
x--;
|
||||
y--;
|
||||
int x = box.getX() - 1;
|
||||
int y = box.getY() - 1;
|
||||
int w = int(box.getWidth());
|
||||
int h = int(box.getHeight());
|
||||
|
||||
if ( x < 0 )
|
||||
x = 0;
|
||||
|
@ -841,7 +809,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
{
|
||||
int xpos = x + tx;
|
||||
auto tc = &vterm->text[ypos * vterm->width + xpos]; // terminal character
|
||||
auto sc = generateCharacter(xpos, ypos); // shown character
|
||||
auto sc = generateCharacter(FPoint(xpos, ypos)); // shown character
|
||||
std::memcpy (tc, &sc, sizeof(*tc));
|
||||
}
|
||||
|
||||
|
@ -859,15 +827,6 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
|||
{
|
||||
// Determines the covered state for the given position
|
||||
|
||||
return isCovered (pos.getX(), pos.getY(), area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
||||
, term_area* area )
|
||||
{
|
||||
// Determines the covered state for the given position
|
||||
|
||||
if ( ! area )
|
||||
return non_covered;
|
||||
|
||||
|
@ -893,9 +852,11 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
, std::size_t(win->width + win->right_shadow)
|
||||
, std::size_t(win->height + win->bottom_shadow) );
|
||||
|
||||
if ( found && geometry.contains(x, y) )
|
||||
if ( found && geometry.contains(pos) )
|
||||
{
|
||||
int line_len = win->width + win->right_shadow;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
auto tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
|
||||
|
||||
if ( tmp->attr.bit.trans_shadow )
|
||||
|
@ -919,13 +880,18 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedColor ( term_area* area
|
||||
, int x, int y, int tx, int ty )
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Add the overlapping color to this character
|
||||
|
||||
int& aw = area->width;
|
||||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
int x = area_pos.getX();
|
||||
int y = area_pos.getY();
|
||||
int tx = terminal_pos.getX();
|
||||
int ty = terminal_pos.getY();
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
|
@ -934,7 +900,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
|||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(nc));
|
||||
// Overlapped character
|
||||
auto oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getOverlappedCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||
nc.fg_color = oc.fg_color;
|
||||
nc.bg_color = oc.bg_color;
|
||||
nc.attr.bit.reverse = false;
|
||||
|
@ -953,33 +919,41 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedCharacter (term_area* area, int tx, int ty)
|
||||
void FVTerm::updateOverlappedCharacter ( term_area* area
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Restore one character on vterm
|
||||
|
||||
// Terminal character
|
||||
int tx = terminal_pos.getX();
|
||||
int ty = terminal_pos.getY();
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// Overlapped character
|
||||
auto oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
||||
std::memcpy (tc, &oc, sizeof(*tc));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateShadedCharacter ( term_area* area
|
||||
, int x, int y, int tx, int ty )
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Get covered character + add the current color
|
||||
|
||||
int& aw = area->width;
|
||||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
int x = area_pos.getX();
|
||||
int y = area_pos.getY();
|
||||
int tx = terminal_pos.getX();
|
||||
int ty = terminal_pos.getY();
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// Overlapped character
|
||||
auto oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||
oc.fg_color = ac->fg_color;
|
||||
oc.bg_color = ac->bg_color;
|
||||
oc.attr.bit.reverse = false;
|
||||
|
@ -999,13 +973,18 @@ void FVTerm::updateShadedCharacter ( term_area* area
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateInheritBackground ( term_area* area
|
||||
, int x, int y, int tx, int ty )
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Add the covered background to this character
|
||||
|
||||
int& aw = area->width;
|
||||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
int x = area_pos.getX();
|
||||
int y = area_pos.getY();
|
||||
int tx = terminal_pos.getX();
|
||||
int ty = terminal_pos.getY();
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
|
@ -1014,7 +993,7 @@ void FVTerm::updateInheritBackground ( term_area* area
|
|||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(nc));
|
||||
// Covered character
|
||||
auto cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto cc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||
nc.bg_color = cc.bg_color;
|
||||
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
|
||||
std::memcpy (tc, &nc, sizeof(*tc));
|
||||
|
@ -1022,13 +1001,18 @@ void FVTerm::updateInheritBackground ( term_area* area
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateCharacter ( term_area* area
|
||||
, int x, int y, int tx, int ty )
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
// Copy a area character to the virtual terminal
|
||||
|
||||
int& aw = area->width;
|
||||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
int x = area_pos.getX();
|
||||
int y = area_pos.getY();
|
||||
int tx = terminal_pos.getX();
|
||||
int ty = terminal_pos.getY();
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
|
@ -1043,41 +1027,44 @@ void FVTerm::updateCharacter ( term_area* area
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
bool FVTerm::updateVTermCharacter ( term_area* area
|
||||
, int x, int y, int tx, int ty )
|
||||
, const FPoint& area_pos
|
||||
, const FPoint& terminal_pos )
|
||||
{
|
||||
int& aw = area->width;
|
||||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
int x = area_pos.getX();
|
||||
int y = area_pos.getY();
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
|
||||
// Get covered state
|
||||
auto is_covered = isCovered(tx, ty, area);
|
||||
auto is_covered = isCovered(terminal_pos, area);
|
||||
|
||||
if ( is_covered == fully_covered )
|
||||
return false;
|
||||
|
||||
if ( is_covered == half_covered )
|
||||
{
|
||||
updateOverlappedColor(area, x, y, tx, ty);
|
||||
updateOverlappedColor(area, area_pos, terminal_pos);
|
||||
}
|
||||
else if ( ac->attr.bit.transparent ) // Transparent
|
||||
{
|
||||
updateOverlappedCharacter(area, tx, ty);
|
||||
updateOverlappedCharacter(area, terminal_pos);
|
||||
}
|
||||
else // Not transparent
|
||||
{
|
||||
if ( ac->attr.bit.trans_shadow ) // Transparent shadow
|
||||
{
|
||||
updateShadedCharacter (area, x, y, tx, ty);
|
||||
updateShadedCharacter (area, area_pos, terminal_pos);
|
||||
}
|
||||
else if ( ac->attr.bit.inherit_bg )
|
||||
{
|
||||
updateInheritBackground (area, x, y, tx, ty);
|
||||
updateInheritBackground (area, area_pos, terminal_pos);
|
||||
}
|
||||
else // Default
|
||||
{
|
||||
updateCharacter (area, x, y, tx, ty);
|
||||
updateCharacter (area, area_pos, terminal_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1212,15 +1199,15 @@ void FVTerm::updateVTerm (term_area* area)
|
|||
for (int x = line_xmin; x <= line_xmax; x++) // Column loop
|
||||
{
|
||||
// Global terminal positions
|
||||
int tx = ax + x
|
||||
, ty = ay + y;
|
||||
int tx = ax + x;
|
||||
int ty = ay + y;
|
||||
|
||||
if ( tx < 0 || ty < 0 )
|
||||
continue;
|
||||
|
||||
tx -= ol;
|
||||
|
||||
if ( updateVTermCharacter (area, x, y, tx, ty) )
|
||||
if ( updateVTermCharacter(area, FPoint(x, y), FPoint(tx, ty)) )
|
||||
modified = true;
|
||||
|
||||
if ( ! modified )
|
||||
|
@ -1271,9 +1258,9 @@ bool FVTerm::updateVTermCursor (term_area* area)
|
|||
x = ax + cx;
|
||||
y = ay + cy;
|
||||
|
||||
if ( isInsideArea(cx, cy, area)
|
||||
&& isInsideTerminal(x, y)
|
||||
&& isCovered(x, y, area) == non_covered )
|
||||
if ( isInsideArea (FPoint(cx, cy), area)
|
||||
&& isInsideTerminal (FPoint(x, y))
|
||||
&& isCovered (FPoint(x, y), area) == non_covered )
|
||||
{
|
||||
vterm->input_cursor_x = x;
|
||||
vterm->input_cursor_y = y;
|
||||
|
@ -1287,16 +1274,15 @@ bool FVTerm::updateVTermCursor (term_area* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FVTerm::isInsideArea (int x, int y, term_area* area)
|
||||
bool FVTerm::isInsideArea (const FPoint& pos, term_area* area)
|
||||
{
|
||||
// Check whether the coordinates are within the area
|
||||
|
||||
int ax = 0, ay = 0;
|
||||
std::size_t aw = std::size_t(area->width);
|
||||
std::size_t ah = std::size_t(area->height);
|
||||
FRect area_geometry(ax, ay, aw, ah);
|
||||
auto aw = std::size_t(area->width);
|
||||
auto ah = std::size_t(area->height);
|
||||
FRect area_geometry(0, 0, aw, ah);
|
||||
|
||||
if ( area_geometry.contains(x, y) )
|
||||
if ( area_geometry.contains(pos) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -1306,41 +1292,27 @@ bool FVTerm::isInsideArea (int x, int y, term_area* area)
|
|||
void FVTerm::setAreaCursor ( const FPoint& pos
|
||||
, bool visible
|
||||
, term_area* area )
|
||||
{
|
||||
setAreaCursor (pos.getX(), pos.getY(), visible, area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::setAreaCursor ( int x, int y
|
||||
, bool visible
|
||||
, term_area* area )
|
||||
{
|
||||
if ( ! area )
|
||||
return;
|
||||
|
||||
area->input_cursor_x = x - 1;
|
||||
area->input_cursor_y = y - 1;
|
||||
area->input_cursor_x = pos.getX() - 1;
|
||||
area->input_cursor_y = pos.getY() - 1;
|
||||
area->input_cursor_visible = visible;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (const FPoint& pos, term_area* area)
|
||||
{
|
||||
return getArea (pos.getX(), pos.getY(), area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (int ax, int ay, term_area* area)
|
||||
{
|
||||
// Copies a block from the virtual terminal position to the given area
|
||||
int y_end;
|
||||
int length;
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
||||
ax--;
|
||||
ay--;
|
||||
int y_end;
|
||||
int length;
|
||||
int ax = pos.getX() - 1;
|
||||
int ay = pos.getY() - 1;
|
||||
|
||||
if ( area->height + ay > vterm->height )
|
||||
y_end = area->height - ay;
|
||||
|
@ -1368,26 +1340,20 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (const FRect& box, term_area* area)
|
||||
{
|
||||
getArea ( box.getX()
|
||||
, box.getY()
|
||||
, int(box.getWidth())
|
||||
, int(box.getHeight())
|
||||
, area );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
|
||||
{
|
||||
// Copies a block from the virtual terminal rectangle to the given area
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
||||
int dx = x - area->offset_left + 1
|
||||
, dy = y - area->offset_top + 1
|
||||
, y_end
|
||||
, length;
|
||||
int x = box.getX();
|
||||
int y = box.getY();
|
||||
int w = int(box.getWidth());
|
||||
int h = int(box.getHeight());
|
||||
int dx = x - area->offset_left + 1;
|
||||
int dy = y - area->offset_top + 1;
|
||||
int y_end;
|
||||
int length;
|
||||
|
||||
if ( x < 0 || y < 0 )
|
||||
return;
|
||||
|
@ -1425,20 +1391,6 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
|||
{
|
||||
// Copies the given area block to the virtual terminal position
|
||||
|
||||
if ( ! area )
|
||||
return;
|
||||
|
||||
if ( ! area->visible )
|
||||
return;
|
||||
|
||||
putArea (pos.getX(), pos.getY(), area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::putArea (int ax, int ay, term_area* area)
|
||||
{
|
||||
// Copies the given area block to the virtual terminal position
|
||||
|
||||
charData* tc; // terminal character
|
||||
charData* ac; // area character
|
||||
|
||||
|
@ -1448,16 +1400,15 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
|
|||
if ( ! area->visible )
|
||||
return;
|
||||
|
||||
ax--;
|
||||
ay--;
|
||||
|
||||
int aw = area->width
|
||||
, ah = area->height
|
||||
, rsh = area->right_shadow
|
||||
, bsh = area->bottom_shadow
|
||||
, ol = 0 // outside left
|
||||
, y_end
|
||||
, length;
|
||||
int ax = pos.getX() - 1;
|
||||
int ay = pos.getY() - 1;
|
||||
int aw = area->width;
|
||||
int ah = area->height;
|
||||
int rsh = area->right_shadow;
|
||||
int bsh = area->bottom_shadow;
|
||||
int ol = 0; // outside left
|
||||
int y_end;
|
||||
int length;
|
||||
|
||||
if ( ax < 0 )
|
||||
{
|
||||
|
@ -1498,7 +1449,7 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
|
|||
int cy = ay + y;
|
||||
ac = &area->text[y * line_len + ol + x];
|
||||
tc = &vterm->text[cy * vterm->width + cx];
|
||||
putAreaCharacter (cx + 1, cy + 1, area->widget, ac, tc);
|
||||
putAreaCharacter (FPoint(cx + 1, cy + 1), area->widget, ac, tc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1558,7 +1509,7 @@ void FVTerm::scrollAreaForward (term_area* area)
|
|||
{
|
||||
setTermXY (0, vdesktop->height);
|
||||
FTerm::scrollTermForward();
|
||||
putArea (1, 1, vdesktop);
|
||||
putArea (FPoint(1, 1), vdesktop);
|
||||
|
||||
// avoid update lines from 0 to (y_max - 1)
|
||||
for (int y = 0; y < y_max; y++)
|
||||
|
@ -1618,7 +1569,7 @@ void FVTerm::scrollAreaReverse (term_area* area)
|
|||
{
|
||||
setTermXY (0, 0);
|
||||
FTerm::scrollTermReverse();
|
||||
putArea (1, 1, vdesktop);
|
||||
putArea (FPoint(1, 1), vdesktop);
|
||||
|
||||
// avoid update lines from 1 to y_max
|
||||
for (int y = 1; y <= y_max; y++)
|
||||
|
@ -1685,16 +1636,11 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::generateCharacter (const FPoint& pos)
|
||||
{
|
||||
// Generates characters for a given position considering all areas
|
||||
return generateCharacter (pos.getX(), pos.getY());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
||||
{
|
||||
// Generates characters for a given position considering all areas
|
||||
|
||||
int x = pos.getX();
|
||||
int y =pos.getY();
|
||||
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
||||
|
||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
||||
|
@ -1758,24 +1704,14 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCharacter ( character_type type
|
||||
FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
||||
, const FPoint& pos
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped or the covered character for a given position
|
||||
return getCharacter (type, pos.getX(), pos.getY(), obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
||||
, int x
|
||||
, int y
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped or the covered character for the position (x,y)
|
||||
|
||||
x--;
|
||||
y--;
|
||||
int x = pos.getX() - 1;
|
||||
int y = pos.getY() - 1;
|
||||
int xx = x;
|
||||
int yy = y;
|
||||
|
||||
|
@ -1825,7 +1761,7 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
|
||||
// Window visible and contains current character
|
||||
if ( geometry.contains(x, y) )
|
||||
getAreaCharacter (x, y, win, cc);
|
||||
getAreaCharacter (FPoint(x, y), win, cc);
|
||||
}
|
||||
else if ( char_type == covered_character )
|
||||
break;
|
||||
|
@ -1839,16 +1775,7 @@ FVTerm::charData FVTerm::getCoveredCharacter ( const FPoint& pos
|
|||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the covered character for a given position
|
||||
return getCharacter (covered_character, pos.getX(), pos.getY(), obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCoveredCharacter ( int x
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
{
|
||||
// Gets the covered character for the position (x,y)
|
||||
return getCharacter (covered_character, x, y, obj);
|
||||
return getCharacter (covered_character, pos, obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1856,16 +1783,7 @@ FVTerm::charData FVTerm::getOverlappedCharacter ( const FPoint& pos
|
|||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped character for a given position
|
||||
return getCharacter (overlapped_character, pos.getX(), pos.getY(), obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getOverlappedCharacter ( int x
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
{
|
||||
// Gets the overlapped character for the position (x,y)
|
||||
return getCharacter (overlapped_character, x, y, obj);
|
||||
return getCharacter (overlapped_character, pos, obj);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1963,7 +1881,7 @@ void FVTerm::init (bool disable_alt_screen)
|
|||
|
||||
// Create virtual terminal
|
||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||
createVTerm (term_geometry);
|
||||
createVTerm (term_geometry.getSize());
|
||||
|
||||
// Create virtual desktop area
|
||||
FSize shadow_size(0, 0);
|
||||
|
@ -2039,7 +1957,7 @@ void FVTerm::putAreaLine (charData* ac, charData* tc, int length)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
||||
void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
|
||||
, charData* ac
|
||||
, charData* tc )
|
||||
{
|
||||
|
@ -2047,7 +1965,7 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
{
|
||||
// Restore one character on vterm
|
||||
charData ch;
|
||||
ch = getCoveredCharacter (x, y, obj);
|
||||
ch = getCoveredCharacter (pos, obj);
|
||||
std::memcpy (tc, &ch, sizeof(*tc));
|
||||
}
|
||||
else // Mot transparent
|
||||
|
@ -2056,7 +1974,7 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
{
|
||||
// Get covered character + add the current color
|
||||
charData ch;
|
||||
ch = getCoveredCharacter (x, y, obj);
|
||||
ch = getCoveredCharacter (pos, obj);
|
||||
ch.fg_color = ac->fg_color;
|
||||
ch.bg_color = ac->bg_color;
|
||||
ch.attr.bit.reverse = false;
|
||||
|
@ -2077,7 +1995,7 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
// Add the covered background to this character
|
||||
charData ch, cc;
|
||||
std::memcpy (&ch, ac, sizeof(ch));
|
||||
cc = getCoveredCharacter (x, y, obj);
|
||||
cc = getCoveredCharacter (pos, obj);
|
||||
ch.bg_color = cc.bg_color;
|
||||
std::memcpy (tc, &ch, sizeof(*tc));
|
||||
}
|
||||
|
@ -2087,12 +2005,14 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::getAreaCharacter ( int x, int y, term_area* area
|
||||
void FVTerm::getAreaCharacter ( const FPoint& pos, term_area* area
|
||||
, charData*& cc )
|
||||
{
|
||||
int area_x = area->offset_left;
|
||||
int area_y = area->offset_top;
|
||||
int line_len = area->width + area->right_shadow;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
auto tmp = &area->text[(y - area_y) * line_len + (x - area_x)];
|
||||
|
||||
// Current character not transparent
|
||||
|
@ -2652,7 +2572,7 @@ bool FVTerm::updateTerminalCursor()
|
|||
int x = vterm->input_cursor_x;
|
||||
int y = vterm->input_cursor_y;
|
||||
|
||||
if ( isInsideTerminal(x, y) )
|
||||
if ( isInsideTerminal(FPoint(x, y)) )
|
||||
{
|
||||
setTermXY (x, y);
|
||||
showCursor();
|
||||
|
@ -2666,12 +2586,13 @@ bool FVTerm::updateTerminalCursor()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FVTerm::isInsideTerminal (int x, int y)
|
||||
bool FVTerm::isInsideTerminal (const FPoint& pos)
|
||||
{
|
||||
// Check whether the coordinates are within the virtual terminal
|
||||
|
||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||
|
||||
if ( term_geometry.contains(x, y) )
|
||||
if ( term_geometry.contains(pos) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
141
src/fwidget.cpp
141
src/fwidget.cpp
|
@ -339,25 +339,27 @@ void FWidget::setY (int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setPos (int x, int y, bool adjust)
|
||||
void FWidget::setPos (const FPoint& p, bool adjust)
|
||||
{
|
||||
if ( getX() == x && wsize.getX() == x
|
||||
&& getY() == y && wsize.getY() == y )
|
||||
FPoint pos = p;
|
||||
|
||||
if ( getX() == pos.getX() && wsize.getX() == pos.getX()
|
||||
&& getY() == pos.getY() && wsize.getY() == pos.getY() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isWindowWidget() )
|
||||
{
|
||||
if ( x < 1 )
|
||||
x = 1;
|
||||
if ( pos.getX() < 1 )
|
||||
pos.setX(1);
|
||||
|
||||
if ( y < 1 )
|
||||
y = 1;
|
||||
if ( pos.getY() < 1 )
|
||||
pos.setY(1);
|
||||
}
|
||||
|
||||
wsize.setPos(x, y);
|
||||
adjust_wsize.setPos(x, y);
|
||||
wsize.setPos(pos);
|
||||
adjust_wsize.setPos(pos);
|
||||
|
||||
if ( adjust )
|
||||
adjustSize();
|
||||
|
@ -408,8 +410,10 @@ void FWidget::setHeight (std::size_t height, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setSize (std::size_t width, std::size_t height, bool adjust)
|
||||
void FWidget::setSize (const FSize& size, bool adjust)
|
||||
{
|
||||
std::size_t width = size.getWidth();
|
||||
std::size_t height = size.getHeight();
|
||||
width = std::min (width, size_hints.max_width);
|
||||
width = std::max (width, size_hints.min_width);
|
||||
height = std::min (height, size_hints.max_height);
|
||||
|
@ -552,34 +556,34 @@ void FWidget::setTermOffsetWithPadding()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setTermSize (std::size_t w, std::size_t h)
|
||||
void FWidget::setTermSize (const FSize& size)
|
||||
{
|
||||
// Set xterm size to w x h
|
||||
// Set xterm size to width x height
|
||||
|
||||
if ( isXTerminal() )
|
||||
{
|
||||
rootObject->wsize.setRect(1, 1, w, h);
|
||||
rootObject->wsize.setRect(FPoint(1, 1), size);
|
||||
rootObject->adjust_wsize = rootObject->wsize;
|
||||
FTerm::setTermSize (w, h); // w = columns / h = lines
|
||||
FTerm::setTermSize(size); // width = columns / height = lines
|
||||
detectTermSize();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void FWidget::setGeometry (const FPoint& p, const FSize& s, bool adjust)
|
||||
{
|
||||
// Sets the geometry of the widget relative to its parent
|
||||
|
||||
int term_x, term_y;
|
||||
|
||||
int x = p.getX();
|
||||
int y = p.getY();
|
||||
std::size_t w = s.getWidth();
|
||||
std::size_t h = s.getHeight();
|
||||
w = std::min (w, size_hints.max_width);
|
||||
w = std::max (w, size_hints.min_width);
|
||||
h = std::min (h, size_hints.max_height);
|
||||
h = std::max (h, size_hints.min_height);
|
||||
|
||||
if ( getX() == x && getY() == y && getWidth() == w && getHeight() == h )
|
||||
if ( getPos() == p && getWidth() == w && getHeight() == h )
|
||||
return;
|
||||
|
||||
if ( ! isWindowWidget() )
|
||||
|
@ -597,8 +601,8 @@ void FWidget::setGeometry ( int x, int y
|
|||
( h < 1 ) ? wsize.setHeight(1) : wsize.setHeight(h);
|
||||
|
||||
adjust_wsize = wsize;
|
||||
term_x = getTermX();
|
||||
term_y = getTermY();
|
||||
int term_x = getTermX();
|
||||
int term_y = getTermY();
|
||||
|
||||
client_offset.setCoordinates ( term_x - 1 + padding.left
|
||||
, term_y - 1 + padding.top
|
||||
|
@ -615,11 +619,11 @@ void FWidget::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FWidget::setCursorPos (int x, int y)
|
||||
bool FWidget::setCursorPos (const FPoint& pos)
|
||||
{
|
||||
// sets the input cursor position
|
||||
|
||||
widget_cursor_position.setPoint(x, y);
|
||||
widget_cursor_position.setPoint(pos);
|
||||
|
||||
if ( ! flags.focus || isWindowWidget() )
|
||||
return false;
|
||||
|
@ -640,8 +644,8 @@ bool FWidget::setCursorPos (int x, int y)
|
|||
widget_offsetY += (1 - area->widget->getTopPadding());
|
||||
}
|
||||
|
||||
setAreaCursor ( widget_offsetX + x
|
||||
, widget_offsetY + y
|
||||
setAreaCursor ( FPoint ( widget_offsetX + pos.getX()
|
||||
, widget_offsetY + pos.getY() )
|
||||
, flags.visible_cursor
|
||||
, area );
|
||||
return true;
|
||||
|
@ -651,10 +655,11 @@ bool FWidget::setCursorPos (int x, int y)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setPrintPos (int x, int y)
|
||||
void FWidget::setPrintPos (const FPoint& pos)
|
||||
{
|
||||
setPrintCursor ( offset.getX1() + getX() + x - 1,
|
||||
offset.getY1() + getY() + y - 1 );
|
||||
FPoint p{ offset.getX1() + getX() + pos.getX() - 1,
|
||||
offset.getY1() + getY() + pos.getY() - 1 };
|
||||
setPrintCursor(p);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -742,7 +747,7 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
||||
FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
|
||||
{
|
||||
if ( p && p->hasChildren() )
|
||||
{
|
||||
|
@ -762,9 +767,9 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
|||
if ( widget->isEnabled()
|
||||
&& widget->isShown()
|
||||
&& ! widget->isWindowWidget()
|
||||
&& widget->getTermGeometry().contains(x, y) )
|
||||
&& widget->getTermGeometry().contains(pos) )
|
||||
{
|
||||
auto child = childWidgetAt(widget, x, y);
|
||||
auto child = childWidgetAt(widget, pos);
|
||||
return ( child != 0 ) ? child : widget;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1022,7 @@ void FWidget::resize()
|
|||
FRect term_geometry = getTermGeometry();
|
||||
term_geometry.move (-1, -1);
|
||||
|
||||
resizeVTerm (term_geometry);
|
||||
resizeVTerm (term_geometry.getSize());
|
||||
resizeArea (term_geometry, getShadow(), vdesktop);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
|
@ -1211,10 +1216,10 @@ void FWidget::detectTermSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::move (int dx, int dy)
|
||||
void FWidget::move (const FPoint& pos)
|
||||
{
|
||||
wsize.move(dx, dy);
|
||||
adjust_wsize.move(dx, dy);
|
||||
wsize.move(pos);
|
||||
adjust_wsize.move(pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1268,14 +1273,14 @@ void FWidget::clearShadow()
|
|||
{
|
||||
for (std::size_t y = 1; y <= getHeight(); y++)
|
||||
{
|
||||
setPrintPos (w + 1, int(y));
|
||||
setPrintPos (FPoint(w + 1, int(y)));
|
||||
print (' '); // clear █
|
||||
}
|
||||
}
|
||||
|
||||
if ( h <= offset.getY2() )
|
||||
{
|
||||
setPrintPos (2, h + 1);
|
||||
setPrintPos (FPoint(2, h + 1));
|
||||
|
||||
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||
print (' '); // clear ▀
|
||||
|
@ -1303,7 +1308,7 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + int(y) + 1);
|
||||
setPrintPos (FPoint(x1 - 1, y1 + int(y) + 1));
|
||||
|
||||
if ( double_flatline_mask.left[uLong(y)] )
|
||||
// left+right line (on left side)
|
||||
|
@ -1313,7 +1318,7 @@ void FWidget::drawFlatBorder()
|
|||
print (fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
setPrintPos (x2, y1 + 1);
|
||||
setPrintPos (FPoint(x2, y1 + 1));
|
||||
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
|
@ -1324,10 +1329,10 @@ void FWidget::drawFlatBorder()
|
|||
// left line (on right side)
|
||||
print (fc::NF_border_line_left);
|
||||
|
||||
setPrintPos (x2, y1 + int(y) + 2);
|
||||
setPrintPos (FPoint(x2, y1 + int(y) + 2));
|
||||
}
|
||||
|
||||
setPrintPos (x1, y1);
|
||||
setPrintPos (FPoint(x1, y1));
|
||||
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
|
@ -1339,7 +1344,7 @@ void FWidget::drawFlatBorder()
|
|||
print (fc::NF_border_line_bottom);
|
||||
}
|
||||
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
|
@ -1371,7 +1376,7 @@ void FWidget::clearFlatBorder()
|
|||
// clear on left side
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + int(y) + 1);
|
||||
setPrintPos (FPoint(x1 - 1, y1 + int(y) + 1));
|
||||
|
||||
if ( double_flatline_mask.left[y] )
|
||||
print (fc::NF_border_line_left);
|
||||
|
@ -1382,7 +1387,7 @@ void FWidget::clearFlatBorder()
|
|||
// clear on right side
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2, y1 + int(y) + 1);
|
||||
setPrintPos (FPoint(x2, y1 + int(y) + 1));
|
||||
|
||||
if ( double_flatline_mask.right[y] )
|
||||
print (fc::NF_rev_border_line_right);
|
||||
|
@ -1391,7 +1396,7 @@ void FWidget::clearFlatBorder()
|
|||
}
|
||||
|
||||
// clear at top
|
||||
setPrintPos (x1, y1);
|
||||
setPrintPos (FPoint(x1, y1));
|
||||
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
|
@ -1402,7 +1407,7 @@ void FWidget::clearFlatBorder()
|
|||
}
|
||||
|
||||
// clear at bottom
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
|
@ -1614,9 +1619,9 @@ void FWidget::adjustSizeGlobal()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::hideSize (std::size_t width, std::size_t height)
|
||||
void FWidget::hideSize (const FSize& size)
|
||||
{
|
||||
if ( width == 0 || height == 0 )
|
||||
if ( size.isEmpty() )
|
||||
return;
|
||||
|
||||
FColor fg, bg;
|
||||
|
@ -1634,14 +1639,14 @@ void FWidget::hideSize (std::size_t width, std::size_t height)
|
|||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
auto blank = createBlankArray(width);
|
||||
auto blank = createBlankArray(size.getWidth());
|
||||
|
||||
if ( blank == 0 )
|
||||
return;
|
||||
|
||||
for (int y = 0; y < int(height); y++)
|
||||
for (int y = 0; y < int(size.getWidth()); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
setPrintPos (FPoint(1, 1 + y));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -2225,7 +2230,7 @@ void FWidget::drawChildren()
|
|||
void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// transparent shadow
|
||||
setPrintPos (x2 + 1, y1);
|
||||
setPrintPos (FPoint(x2 + 1, y1));
|
||||
setTransparent();
|
||||
print (" ");
|
||||
unsetTransparent();
|
||||
|
@ -2235,12 +2240,12 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
|||
|
||||
for (std::size_t y = 1; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + int(y));
|
||||
setPrintPos (FPoint(x2 + 1, y1 + int(y)));
|
||||
print (" ");
|
||||
}
|
||||
|
||||
unsetTransShadow();
|
||||
setPrintPos (x1, y2 + 1);
|
||||
setPrintPos (FPoint(x1, y2 + 1));
|
||||
setTransparent();
|
||||
print (" ");
|
||||
unsetTransparent();
|
||||
|
@ -2266,7 +2271,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
if ( ! hasShadowCharacter() )
|
||||
return;
|
||||
|
||||
setPrintPos (x2 + 1, y1);
|
||||
setPrintPos (FPoint(x2 + 1, y1));
|
||||
|
||||
if ( isWindowWidget() )
|
||||
{
|
||||
|
@ -2284,11 +2289,11 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
|
||||
for (std::size_t y = 1; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + int(y));
|
||||
setPrintPos (FPoint(x2 + 1, y1 + int(y)));
|
||||
print (block); // █
|
||||
}
|
||||
|
||||
setPrintPos (x1 + 1, y2 + 1);
|
||||
setPrintPos (FPoint(x1 + 1, y2 + 1));
|
||||
|
||||
if ( isWindowWidget() )
|
||||
setInheritBackground();
|
||||
|
@ -2305,7 +2310,7 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
|
|||
{
|
||||
// Use box-drawing characters to draw a border
|
||||
|
||||
setPrintPos (x1, y1);
|
||||
setPrintPos (FPoint(x1, y1));
|
||||
print (fc::BoxDrawingsDownAndRight); // ┌
|
||||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
|
@ -2315,13 +2320,13 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
|
|||
|
||||
for (int y = y1 + 1; y < y2; y++)
|
||||
{
|
||||
setPrintPos (x1, y);
|
||||
setPrintPos (FPoint(x1, y));
|
||||
print (fc::BoxDrawingsVertical); // │
|
||||
setPrintPos (x2, y);
|
||||
setPrintPos (FPoint(x2, y));
|
||||
print (fc::BoxDrawingsVertical); // │
|
||||
}
|
||||
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
print (fc::BoxDrawingsUpAndRight); // └
|
||||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
|
@ -2331,9 +2336,9 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
|
|||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
{
|
||||
setPrintPos (x, y1);
|
||||
setPrintPos (FPoint(x, y1));
|
||||
print (fc::BoxDrawingsHorizontal); // ─
|
||||
setPrintPos (x, y2);
|
||||
setPrintPos (FPoint(x, y2));
|
||||
print (fc::BoxDrawingsHorizontal); // ─
|
||||
}
|
||||
}
|
||||
|
@ -2343,7 +2348,7 @@ inline void FWidget::drawNewFontBox (int x1, int y1, int x2, int y2)
|
|||
{
|
||||
// Use new graphical font characters to draw a border
|
||||
|
||||
setPrintPos (x1, y1);
|
||||
setPrintPos (FPoint(x1, y1));
|
||||
print (fc::NF_border_corner_middle_upper_left); // ┌
|
||||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
|
@ -2353,13 +2358,13 @@ inline void FWidget::drawNewFontBox (int x1, int y1, int x2, int y2)
|
|||
|
||||
for (int y = y1 + 1; y <= y2; y++)
|
||||
{
|
||||
setPrintPos (x1, y);
|
||||
setPrintPos (FPoint(x1, y));
|
||||
print (fc::NF_border_line_left); // border left ⎸
|
||||
setPrintPos (x2, y);
|
||||
setPrintPos (FPoint(x2, y));
|
||||
print (fc::NF_rev_border_line_right); // border right⎹
|
||||
}
|
||||
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
print (fc::NF_border_corner_middle_lower_left); // └
|
||||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
|
|
|
@ -179,9 +179,9 @@ bool FWindow::setTransparentShadow (bool enable)
|
|||
flags.shadow = flags.trans_shadow = enable;
|
||||
|
||||
if ( enable )
|
||||
setShadowSize (2, 1);
|
||||
setShadowSize (FSize(2, 1));
|
||||
else
|
||||
setShadowSize (0, 0);
|
||||
setShadowSize (FSize(0, 0));
|
||||
|
||||
return enable;
|
||||
}
|
||||
|
@ -196,13 +196,13 @@ bool FWindow::setShadow (bool enable)
|
|||
{
|
||||
flags.shadow = true;
|
||||
flags.trans_shadow = false;
|
||||
setShadowSize (1, 1);
|
||||
setShadowSize (FSize(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
flags.shadow = false;
|
||||
flags.trans_shadow = false;
|
||||
setShadowSize (0, 0);
|
||||
setShadowSize (FSize(0, 0));
|
||||
}
|
||||
|
||||
return enable;
|
||||
|
@ -251,7 +251,7 @@ void FWindow::drawBorder()
|
|||
, y1 = 1
|
||||
, y2 = 1 + int(getHeight()) - 1;
|
||||
|
||||
setPrintPos (x1, y1);
|
||||
setPrintPos (FPoint(x1, y1));
|
||||
print (fc::NF_border_corner_upper_left); // ⎡
|
||||
|
||||
for (int x = x1 + 1; x < x2; x++)
|
||||
|
@ -261,22 +261,22 @@ void FWindow::drawBorder()
|
|||
|
||||
for (int y = y1 + 1; y < y2; y++)
|
||||
{
|
||||
setPrintPos (x1, y);
|
||||
setPrintPos (FPoint(x1, y));
|
||||
// border left ⎸
|
||||
print (fc::NF_border_line_left);
|
||||
setPrintPos (x2, y);
|
||||
setPrintPos (FPoint(x2, y));
|
||||
// border right⎹
|
||||
print (fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
setPrintPos (x1, y2);
|
||||
setPrintPos (FPoint(x1, y2));
|
||||
// lower left corner border ⎣
|
||||
print (fc::NF_border_corner_lower_left);
|
||||
|
||||
for (std::size_t x = 2; x < getWidth(); x++) // low line _
|
||||
print (fc::NF_border_line_bottom);
|
||||
|
||||
setPrintPos (x2, y2);
|
||||
setPrintPos (FPoint(x2, y2));
|
||||
// lower right corner border ⎦
|
||||
print (fc::NF_rev_border_corner_lower_right);
|
||||
}
|
||||
|
@ -326,12 +326,14 @@ void FWindow::setY (int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setPos (int x, int y, bool adjust)
|
||||
void FWindow::setPos (const FPoint& p, bool adjust)
|
||||
{
|
||||
if ( y < 1 )
|
||||
y = 1;
|
||||
FPoint pos = p;
|
||||
|
||||
FWidget::setPos (x, y, adjust);
|
||||
if ( pos.getY() < 1 )
|
||||
pos.setY(1);
|
||||
|
||||
FWidget::setPos (pos, adjust);
|
||||
|
||||
if ( isVirtualWindow() )
|
||||
{
|
||||
|
@ -369,11 +371,11 @@ void FWindow::setHeight (std::size_t h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||
void FWindow::setSize (const FSize& size, bool adjust)
|
||||
{
|
||||
std::size_t old_width = getWidth();
|
||||
std::size_t old_height = getHeight();
|
||||
FWidget::setSize (w, h, adjust);
|
||||
FWidget::setSize (size, adjust);
|
||||
|
||||
if ( isVirtualWindow()
|
||||
&& (getWidth() != old_width || getHeight() != old_height) )
|
||||
|
@ -385,9 +387,7 @@ void FWindow::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setGeometry ( int x, int y
|
||||
, std::size_t w, std::size_t h
|
||||
, bool adjust )
|
||||
void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
|
||||
{
|
||||
// Sets the geometry of the widget
|
||||
|
||||
|
@ -395,11 +395,12 @@ void FWindow::setGeometry ( int x, int y
|
|||
int old_y = getY();
|
||||
std::size_t old_width = getWidth();
|
||||
std::size_t old_height = getHeight();
|
||||
FPoint pos = p;
|
||||
|
||||
if ( y < 1 )
|
||||
y = 1;
|
||||
if ( pos.getY() < 1 )
|
||||
pos.setY(1);
|
||||
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
FWidget::setGeometry (pos, size, adjust);
|
||||
|
||||
if ( ! isVirtualWindow() )
|
||||
return;
|
||||
|
@ -421,9 +422,9 @@ void FWindow::setGeometry ( int x, int y
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::move (int dx, int dy)
|
||||
void FWindow::move (const FPoint& pos)
|
||||
{
|
||||
FWidget::move (dx, dy);
|
||||
FWidget::move(pos);
|
||||
|
||||
if ( isVirtualWindow() )
|
||||
{
|
||||
|
@ -676,7 +677,7 @@ bool FWindow::zoomWindow()
|
|||
// save the current geometry
|
||||
normalGeometry = getGeometry();
|
||||
FRect oldGeometry = getTermGeometryWithShadow();
|
||||
setGeometry (1, 1, getMaxWidth(), getMaxHeight());
|
||||
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()));
|
||||
restoreVTerm (oldGeometry);
|
||||
redraw();
|
||||
}
|
||||
|
@ -767,18 +768,13 @@ bool FWindow::activatePrevWindow()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setShadowSize (std::size_t right, std::size_t bottom)
|
||||
void FWindow::setShadowSize (const FSize& size)
|
||||
{
|
||||
std::size_t old_right = getShadow().getWidth();
|
||||
std::size_t old_bottom = getShadow().getHeight();
|
||||
const FSize& old_shadow = getShadow();
|
||||
FWidget::setShadowSize (size);
|
||||
const FSize& new_shadow = getShadow();
|
||||
|
||||
FWidget::setShadowSize (right, bottom);
|
||||
|
||||
std::size_t new_right = getShadow().getWidth();
|
||||
std::size_t new_bottom = getShadow().getHeight();
|
||||
|
||||
if ( isVirtualWindow()
|
||||
&& (new_right != old_right || new_bottom != old_bottom) )
|
||||
if ( isVirtualWindow() && (new_shadow != old_shadow) )
|
||||
{
|
||||
auto geometry = getTermGeometry();
|
||||
geometry.move(-1, -1);
|
||||
|
@ -796,7 +792,7 @@ void FWindow::adjustSize()
|
|||
FWidget::adjustSize();
|
||||
|
||||
if ( zoomed )
|
||||
setGeometry (1, 1, getMaxWidth(), getMaxHeight(), false);
|
||||
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()), false);
|
||||
else if ( isVirtualWindow() )
|
||||
{
|
||||
if ( getX() != old_x )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2018 Markus Gans *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -76,8 +76,6 @@ class FDialog : public FWindow
|
|||
public:
|
||||
// Using-declaration
|
||||
using FWindow::setResizeable;
|
||||
using FWindow::move;
|
||||
using FWindow::setPos;
|
||||
|
||||
// Enumeration
|
||||
enum DialogCode
|
||||
|
@ -124,13 +122,13 @@ class FDialog : public FWindow
|
|||
virtual void show() override;
|
||||
virtual void hide() override;
|
||||
int exec();
|
||||
virtual void setPos (int, int, bool = true) override;
|
||||
virtual void move (int, int) override;
|
||||
virtual void setPos (const FPoint&, bool = true) override;
|
||||
virtual void move (const FPoint&) override;
|
||||
bool moveUp (int);
|
||||
bool moveDown (int);
|
||||
bool moveLeft (int);
|
||||
bool moveRight (int);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true) override;
|
||||
virtual void setSize (const FSize&, bool = true) override;
|
||||
bool reduceHeight (int);
|
||||
bool expandHeight (int);
|
||||
bool reduceWidth (int);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -336,7 +336,7 @@ class FTimerEvent : public FEvent // timer event
|
|||
int getTimerId() const;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
int id{0};
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@ -353,15 +353,22 @@ class FUserEvent : public FEvent // timer event
|
|||
{
|
||||
public:
|
||||
FUserEvent() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FUserEvent (const FUserEvent&) = delete;
|
||||
FUserEvent (fc::events, int);
|
||||
|
||||
~FUserEvent();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FUserEvent& operator = (const FUserEvent&) = delete;
|
||||
|
||||
int getUserId() const;
|
||||
FDataPtr getData() const;
|
||||
void setData (FDataPtr);
|
||||
|
||||
protected:
|
||||
int uid;
|
||||
int uid{0};
|
||||
FDataPtr data_pointer{nullptr};
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -169,7 +169,7 @@ class FFileDialog : public FDialog
|
|||
|
||||
// Method
|
||||
void init();
|
||||
void widgetSettings (int, int);
|
||||
void widgetSettings (const FPoint&);
|
||||
void initCallbacks();
|
||||
bool pattern_match (const char* const, char[]);
|
||||
void clear();
|
||||
|
|
|
@ -185,8 +185,7 @@ class FListBox : public FWidget
|
|||
void showInsideBrackets (std::size_t, fc::brackets_type);
|
||||
void showNoBrackets (std::size_t);
|
||||
void showNoBrackets (listBoxItems::iterator);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
void setMultiSelection (bool);
|
||||
void setMultiSelection ();
|
||||
|
|
|
@ -295,8 +295,7 @@ class FListView : public FWidget
|
|||
FListViewItem* getCurrentItem();
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
void setColumnAlignment (int, fc::text_alignment);
|
||||
void setColumnText (int, const FString&);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* Copyright 2015-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -172,6 +172,7 @@ class FMenuItem : public FWidget
|
|||
// Methods
|
||||
void init (FWidget*);
|
||||
uChar hotKey();
|
||||
void updateSuperMenuDimensions();
|
||||
void processActivate();
|
||||
void processDeactivate();
|
||||
void createDialogList (FMenu*);
|
||||
|
|
|
@ -78,6 +78,7 @@ class FPoint
|
|||
int getY() const;
|
||||
void setX (int);
|
||||
void setY (int);
|
||||
void setPoint (const FPoint&);
|
||||
void setPoint (int, int);
|
||||
|
||||
// Inquiry
|
||||
|
@ -140,6 +141,10 @@ inline int FPoint::getX() const
|
|||
inline int FPoint::getY() const
|
||||
{ return ypos; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FPoint::setPoint (const FPoint& p)
|
||||
{ setPoint(p.xpos, p.ypos); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int& FPoint::x_ref()
|
||||
{ return xpos; }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* Copyright 2014-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -82,9 +82,8 @@ class FProgressbar : public FWidget
|
|||
|
||||
// Mutators
|
||||
void setPercentage (std::size_t);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true) override;
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
bool setShadow (bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
|
|
|
@ -107,6 +107,7 @@ class FRect
|
|||
void setSize (std::size_t, std::size_t);
|
||||
void setSize (const FSize&);
|
||||
void setRect (const FRect&);
|
||||
void setRect (const FPoint&, const FSize&);
|
||||
void setRect (int, int, std::size_t, std::size_t);
|
||||
void setCoordinates (const FPoint&, const FPoint&);
|
||||
void setCoordinates (int, int, int, int);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2018 Markus Gans *
|
||||
* Copyright 2012-2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -109,9 +109,8 @@ class FScrollbar : public FWidget
|
|||
void setSteps (double);
|
||||
void setPageSize (int, int);
|
||||
void setOrientation (fc::orientation);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true) override;
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
|
||||
// Methods
|
||||
virtual void resize() override;
|
||||
|
|
|
@ -73,8 +73,6 @@ class FScrollView : public FWidget
|
|||
public:
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
using FWidget::setPrintPos;
|
||||
using FWidget::setPos;
|
||||
|
||||
// Constructor
|
||||
explicit FScrollView (FWidget* = nullptr);
|
||||
|
@ -92,8 +90,10 @@ class FScrollView : public FWidget
|
|||
virtual const char* getClassName() const override;
|
||||
std::size_t getViewportWidth() const;
|
||||
std::size_t getViewportHeight() const;
|
||||
const FSize getViewportSize();
|
||||
std::size_t getScrollWidth() const;
|
||||
std::size_t getScrollHeight() const;
|
||||
const FSize getScrollSize() const;
|
||||
const FPoint getScrollPos() const;
|
||||
int getScrollX() const;
|
||||
int getScrollY() const;
|
||||
|
@ -101,18 +101,17 @@ class FScrollView : public FWidget
|
|||
// Mutator
|
||||
virtual void setScrollWidth (std::size_t);
|
||||
virtual void setScrollHeight (std::size_t);
|
||||
virtual void setScrollSize (std::size_t, std::size_t);
|
||||
virtual void setScrollSize (const FSize&);
|
||||
virtual void setX (int, bool = true) override;
|
||||
virtual void setY (int, bool = true) override;
|
||||
virtual void setPos (int, int, bool = true) override;
|
||||
virtual void setPos (const FPoint&, bool = true) override;
|
||||
virtual void setWidth (std::size_t, bool = true) override;
|
||||
virtual void setHeight (std::size_t, bool = true) override;
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true) override;
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
virtual void setSize (const FSize&, bool = true) override;
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
void setCursorPos (int, int);
|
||||
void setPrintPos (int, int);
|
||||
void setCursorPos (const FPoint&);
|
||||
void setPrintPos (const FPoint&);
|
||||
bool setViewportPrint (bool);
|
||||
bool setViewportPrint();
|
||||
bool unsetViewportPrint();
|
||||
|
@ -208,6 +207,10 @@ inline std::size_t FScrollView::getViewportWidth() const
|
|||
inline std::size_t FScrollView::getViewportHeight() const
|
||||
{ return getHeight() - horizontal_border_spacing; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FSize FScrollView::getViewportSize()
|
||||
{ return FSize(getViewportWidth(), getViewportHeight()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::size_t FScrollView::getScrollWidth() const
|
||||
{ return scroll_geometry.getWidth(); }
|
||||
|
@ -216,6 +219,10 @@ inline std::size_t FScrollView::getScrollWidth() const
|
|||
inline std::size_t FScrollView::getScrollHeight() const
|
||||
{ return scroll_geometry.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FSize FScrollView::getScrollSize() const
|
||||
{ return scroll_geometry.getSize(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FPoint FScrollView::getScrollPos() const
|
||||
{ return viewport_geometry.getPos(); }
|
||||
|
|
|
@ -247,7 +247,7 @@ class FTerm final
|
|||
static char* enableCursor();
|
||||
static char* disableCursor();
|
||||
static void detectTermSize();
|
||||
static void setTermSize (std::size_t, std::size_t);
|
||||
static void setTermSize (const FSize&);
|
||||
static void setTermTitle (const FString&);
|
||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||
static void saveColorMap();
|
||||
|
|
|
@ -65,7 +65,7 @@ class FTermXTerminal final
|
|||
static void setCursorStyle (fc::xtermCursorStyle);
|
||||
static void setFont (const FString&);
|
||||
static void setTitle (const FString&);
|
||||
static void setTermSize (std::size_t, std::size_t);
|
||||
static void setTermSize (const FSize&);
|
||||
static void setForeground (const FString&);
|
||||
static void setBackground (const FString&);
|
||||
static void setCursorColor (const FString&);
|
||||
|
|
|
@ -97,8 +97,7 @@ class FTextView : public FWidget
|
|||
const FStringList& getLines() const;
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
void setText (const FString&);
|
||||
void scrollToX (int);
|
||||
|
|
|
@ -91,9 +91,8 @@ class FToggleButton : public FWidget
|
|||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true) override;
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
bool setNoUnderline (bool);
|
||||
bool setNoUnderline();
|
||||
bool unsetNoUnderline();
|
||||
|
|
|
@ -158,7 +158,6 @@ class FVTerm
|
|||
void hideCursor();
|
||||
void showCursor();
|
||||
void setPrintCursor (const FPoint&);
|
||||
void setPrintCursor (int, int);
|
||||
FColor rgb2ColorIndex (uInt8, uInt8, uInt8);
|
||||
void setColor (FColor, FColor);
|
||||
static void setNormal();
|
||||
|
@ -277,10 +276,8 @@ class FVTerm
|
|||
|
||||
// Methods
|
||||
virtual void clearArea (int = ' ');
|
||||
void createVTerm (const FRect&);
|
||||
void createVTerm (int, int);
|
||||
void resizeVTerm (const FRect&);
|
||||
void resizeVTerm (int, int);
|
||||
void createVTerm (const FSize&);
|
||||
void resizeVTerm (const FSize&);
|
||||
void putVTerm();
|
||||
void updateTerminal (terminal_update);
|
||||
void updateTerminal();
|
||||
|
@ -340,83 +337,56 @@ class FVTerm
|
|||
void createArea ( const FRect&
|
||||
, const FSize&
|
||||
, term_area*& );
|
||||
|
||||
void createArea ( int, int, int, int
|
||||
, int, int
|
||||
, term_area*& );
|
||||
|
||||
void resizeArea ( const FRect&
|
||||
, const FSize&
|
||||
, term_area* );
|
||||
|
||||
void resizeArea ( int, int, int, int
|
||||
, int, int
|
||||
, term_area* );
|
||||
|
||||
static void removeArea (term_area*&);
|
||||
static void restoreVTerm (const FRect&);
|
||||
static void restoreVTerm (int, int, int, int);
|
||||
void setTextToDefault (term_area*, int, int);
|
||||
void setTextToDefault (term_area*, const FSize&);
|
||||
static bool reallocateTextArea ( term_area*
|
||||
, std::size_t
|
||||
, std::size_t );
|
||||
static bool reallocateTextArea ( term_area*
|
||||
, std::size_t );
|
||||
|
||||
static covered_state isCovered ( const FPoint&
|
||||
, term_area* );
|
||||
|
||||
static covered_state isCovered ( int, int
|
||||
, term_area* );
|
||||
static covered_state isCovered (const FPoint&, term_area*);
|
||||
|
||||
static void updateOverlappedColor ( term_area*
|
||||
, int, int, int, int );
|
||||
static void updateOverlappedCharacter (term_area*, int, int);
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateOverlappedCharacter ( term_area*
|
||||
, const FPoint& );
|
||||
static void updateShadedCharacter ( term_area*
|
||||
, int, int, int, int );
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateInheritBackground ( term_area*
|
||||
, int, int, int, int );
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void updateCharacter ( term_area*
|
||||
, int, int, int, int );
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static bool updateVTermCharacter ( term_area*
|
||||
, int, int, int, int );
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void callPreprocessingHandler (term_area*);
|
||||
void updateVTerm();
|
||||
void updateVTerm (term_area*);
|
||||
bool updateVTermCursor (term_area*);
|
||||
static bool isInsideArea (int, int, term_area*);
|
||||
|
||||
static bool isInsideArea (const FPoint&, term_area*);
|
||||
static void setAreaCursor ( const FPoint&
|
||||
, bool, term_area* );
|
||||
|
||||
static void setAreaCursor ( int, int
|
||||
, bool, term_area*);
|
||||
|
||||
static void getArea (const FPoint&, term_area*);
|
||||
static void getArea (int, int, term_area*);
|
||||
static void getArea (const FRect&, term_area*);
|
||||
static void getArea (int, int, int, int, term_area*);
|
||||
static void putArea (const FPoint&, term_area*);
|
||||
static void putArea (int, int, term_area*);
|
||||
void scrollAreaForward (term_area*);
|
||||
void scrollAreaReverse (term_area*);
|
||||
void clearArea (term_area*, int = ' ');
|
||||
|
||||
static charData generateCharacter (const FPoint&);
|
||||
static charData generateCharacter (int, int);
|
||||
|
||||
static charData getCharacter ( character_type
|
||||
, const FPoint&
|
||||
, FVTerm* );
|
||||
|
||||
static charData getCharacter ( character_type
|
||||
, int
|
||||
, int, FVTerm* );
|
||||
|
||||
static charData getCoveredCharacter (const FPoint&, FVTerm*);
|
||||
static charData getCoveredCharacter (int, int, FVTerm*);
|
||||
static charData getOverlappedCharacter (const FPoint&, FVTerm*);
|
||||
static charData getOverlappedCharacter (int, int, FVTerm*);
|
||||
void processTerminalUpdate();
|
||||
static void startTerminalUpdate();
|
||||
static void finishTerminalUpdate();
|
||||
|
@ -457,9 +427,9 @@ class FVTerm
|
|||
static void init_characterLengths (FOptiMove*);
|
||||
void finish();
|
||||
static void putAreaLine (charData*, charData*, int);
|
||||
static void putAreaCharacter ( int, int, FVTerm*
|
||||
static void putAreaCharacter ( const FPoint&, FVTerm*
|
||||
, charData*, charData* );
|
||||
static void getAreaCharacter ( int, int, term_area*
|
||||
static void getAreaCharacter ( const FPoint&, term_area*
|
||||
, charData*& );
|
||||
bool clearTerm (int = ' ');
|
||||
bool clearFullArea (term_area*, charData&);
|
||||
|
@ -475,7 +445,7 @@ class FVTerm
|
|||
bool printWrap (term_area*);
|
||||
void updateTerminalLine (uInt);
|
||||
bool updateTerminalCursor();
|
||||
bool isInsideTerminal (int, int);
|
||||
bool isInsideTerminal (const FPoint&);
|
||||
static void markAsPrinted (uInt, uInt);
|
||||
static void markAsPrinted (uInt, uInt, uInt);
|
||||
static void newFontChanges (charData*&);
|
||||
|
@ -646,10 +616,6 @@ inline void FVTerm::hideCursor()
|
|||
inline void FVTerm::showCursor()
|
||||
{ return hideCursor(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::setPrintCursor (const FPoint& pos)
|
||||
{ setPrintCursor (pos.getX(), pos.getY()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::setColor (FColor fg, FColor bg)
|
||||
{
|
||||
|
|
|
@ -202,6 +202,7 @@ class FWidget : public FVTerm, public FObject
|
|||
const FPoint getTermPos() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
const FSize getSize() const;
|
||||
int getTopPadding() const;
|
||||
int getLeftPadding() const;
|
||||
int getBottomPadding() const;
|
||||
|
@ -254,11 +255,9 @@ class FWidget : public FVTerm, public FObject
|
|||
virtual void setX (int, bool = true); // positioning
|
||||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (const FPoint&, bool = true);
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
virtual void setHeight (std::size_t, bool = true);
|
||||
virtual void setSize (FSize, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
virtual void setSize (const FSize&, bool = true);
|
||||
void setTopPadding (int, bool = true);
|
||||
void setLeftPadding (int, bool = true);
|
||||
void setBottomPadding (int, bool = true);
|
||||
|
@ -266,25 +265,20 @@ class FWidget : public FVTerm, public FObject
|
|||
void setParentOffset();
|
||||
void setTermOffset();
|
||||
void setTermOffsetWithPadding();
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
void setTermSize (const FSize&);
|
||||
virtual void setGeometry (const FRect&, bool = true);
|
||||
virtual void setGeometry (const FPoint&, const FSize&, bool = true);
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
, bool = true );
|
||||
virtual void setShadowSize (std::size_t, std::size_t);
|
||||
virtual void setShadowSize (const FSize&);
|
||||
void setMinimumWidth (std::size_t);
|
||||
void setMinimumHeight (std::size_t);
|
||||
void setMinimumSize (std::size_t, std::size_t);
|
||||
void setMinimumSize (const FSize&);
|
||||
void setMaximumWidth (std::size_t);
|
||||
void setMaximumHeight (std::size_t);
|
||||
void setMaximumHeight (const FSize&);
|
||||
void setMaximumSize (std::size_t, std::size_t);
|
||||
void setFixedSize (std::size_t, std::size_t);
|
||||
void setFixedSize (const FSize&);
|
||||
bool setCursorPos (const FPoint&);
|
||||
bool setCursorPos (int, int);
|
||||
void unsetCursorPos();
|
||||
void setPrintPos (const FPoint&);
|
||||
void setPrintPos (int, int);
|
||||
void setDoubleFlatLine (fc::sides, bool = true);
|
||||
void unsetDoubleFlatLine (fc::sides);
|
||||
void setDoubleFlatLine (fc::sides, int, bool = true);
|
||||
|
@ -305,7 +299,6 @@ class FWidget : public FVTerm, public FObject
|
|||
|
||||
// Methods
|
||||
static FWidget* childWidgetAt (FWidget*, const FPoint&);
|
||||
static FWidget* childWidgetAt (FWidget*, int, int);
|
||||
int numOfFocusableChildren();
|
||||
virtual bool close();
|
||||
void clearStatusbarMessage();
|
||||
|
@ -333,7 +326,6 @@ class FWidget : public FVTerm, public FObject
|
|||
FPoint termToWidgetPos (const FPoint&);
|
||||
void detectTermSize();
|
||||
virtual void move (const FPoint&);
|
||||
virtual void move (int, int);
|
||||
void drawShadow();
|
||||
void clearShadow();
|
||||
void drawFlatBorder();
|
||||
|
@ -382,7 +374,7 @@ class FWidget : public FVTerm, public FObject
|
|||
// Methods
|
||||
virtual void adjustSize();
|
||||
void adjustSizeGlobal();
|
||||
void hideSize (std::size_t, std::size_t);
|
||||
void hideSize (const FSize&);
|
||||
virtual bool focusNextChild(); // Change child...
|
||||
virtual bool focusPrevChild(); // ...focus
|
||||
|
||||
|
@ -442,16 +434,16 @@ class FWidget : public FVTerm, public FObject
|
|||
widget_size_hints() = default;
|
||||
~widget_size_hints() = default;
|
||||
|
||||
void setMinimum (std::size_t w, std::size_t h)
|
||||
void setMinimum (const FSize& s)
|
||||
{
|
||||
min_width = w;
|
||||
min_height = h;
|
||||
min_width = s.getWidth();
|
||||
min_height = s.getHeight();
|
||||
}
|
||||
|
||||
void setMaximum (std::size_t w, std::size_t h)
|
||||
void setMaximum (const FSize& s)
|
||||
{
|
||||
max_width = w;
|
||||
max_height = h;
|
||||
max_width = s.getWidth();
|
||||
max_height = s.getHeight();
|
||||
}
|
||||
|
||||
std::size_t min_width{0};
|
||||
|
@ -603,6 +595,10 @@ inline std::size_t FWidget::getWidth() const
|
|||
inline std::size_t FWidget::getHeight() const
|
||||
{ return adjust_wsize.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FSize FWidget::getSize() const
|
||||
{ return adjust_wsize.getSize(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getTopPadding() const
|
||||
{ return padding.top; }
|
||||
|
@ -804,82 +800,54 @@ inline void FWidget::setBackgroundColor (FColor color)
|
|||
background_color = color;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setPos (const FPoint& p, bool adjust)
|
||||
{ setPos (p.getX(), p.getY(), adjust); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setSize (FSize s, bool adjust)
|
||||
{ setSize(s.getWidth(), s.getHeight(), adjust); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||
{
|
||||
setGeometry ( box.getX()
|
||||
, box.getY()
|
||||
, std::size_t(box.getWidth())
|
||||
, std::size_t(box.getHeight())
|
||||
, adjust );
|
||||
setGeometry (box.getPos(), box.getSize(), adjust);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setGeometry (const FPoint& p, const FSize& s, bool adjust)
|
||||
inline void FWidget::setShadowSize (const FSize& size)
|
||||
{
|
||||
setGeometry ( p.getX()
|
||||
, p.getY()
|
||||
, s.getWidth()
|
||||
, s.getHeight()
|
||||
, adjust );
|
||||
// width = right shadow / height = bottom shadow
|
||||
wshadow.setSize (size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setShadowSize (std::size_t right, std::size_t bottom)
|
||||
{ wshadow.setSize (right, bottom); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumWidth (std::size_t min_width)
|
||||
{ size_hints.setMinimum (min_width, size_hints.min_height); }
|
||||
{ size_hints.setMinimum (FSize(min_width, size_hints.min_height)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumHeight (std::size_t min_height)
|
||||
{ size_hints.setMinimum (size_hints.min_width, min_height); }
|
||||
{ size_hints.setMinimum (FSize(size_hints.min_width, min_height)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumSize ( std::size_t min_width
|
||||
, std::size_t min_height )
|
||||
{ size_hints.setMinimum (min_width, min_height); }
|
||||
inline void FWidget::setMinimumSize (const FSize& size)
|
||||
{ size_hints.setMinimum (size); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumWidth (std::size_t max_width)
|
||||
{ size_hints.setMaximum (max_width, size_hints.max_height); }
|
||||
{ size_hints.setMaximum (FSize(max_width, size_hints.max_height)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumHeight (std::size_t max_height)
|
||||
{ size_hints.setMaximum (size_hints.max_width, max_height); }
|
||||
inline void FWidget::setMaximumHeight (const FSize& size)
|
||||
{ size_hints.setMaximum (size); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumSize ( std::size_t max_width
|
||||
, std::size_t max_height )
|
||||
{ size_hints.setMaximum (max_width, max_height); }
|
||||
{ size_hints.setMaximum (FSize(max_width, max_height)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setFixedSize (std::size_t width, std::size_t height)
|
||||
inline void FWidget::setFixedSize (const FSize& size)
|
||||
{
|
||||
size_hints.setMinimum (width, height);
|
||||
size_hints.setMaximum (width, height);
|
||||
size_hints.setMinimum (size);
|
||||
size_hints.setMaximum (size);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setCursorPos (const FPoint& pos)
|
||||
{ return setCursorPos (pos.getX(), pos.getY()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::unsetCursorPos()
|
||||
{ setCursorPos(-1, -1); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setPrintPos (const FPoint& pos)
|
||||
{ setPrintPos (pos.getX(), pos.getY()); }
|
||||
{ setCursorPos (FPoint(-1, -1)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::unsetDoubleFlatLine (fc::sides side)
|
||||
|
@ -933,10 +901,6 @@ inline bool FWidget::acceptFocus() const // is focusable
|
|||
inline bool FWidget::isPaddingIgnored()
|
||||
{ return ignore_padding; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
|
||||
{ return childWidgetAt (p, pos.getX(), pos.getY()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::clearStatusbarMessage()
|
||||
{ statusbar_message.clear(); }
|
||||
|
@ -956,10 +920,6 @@ inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
|||
, tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::move (const FPoint& pos)
|
||||
{ move(pos.getX(), pos.getY()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::drawBorder()
|
||||
{ drawBorder (1, 1, int(getWidth()), int(getHeight())); }
|
||||
|
|
|
@ -77,9 +77,7 @@ class FWindow : public FWidget
|
|||
public:
|
||||
// Using-declaration
|
||||
using FWidget::drawBorder;
|
||||
using FWidget::setPos;
|
||||
using FWidget::setGeometry;
|
||||
using FWidget::move;
|
||||
|
||||
// Constructor
|
||||
explicit FWindow (FWidget* = nullptr);
|
||||
|
@ -137,14 +135,13 @@ class FWindow : public FWidget
|
|||
virtual void hide() override;
|
||||
virtual void setX (int, bool = true) override;
|
||||
virtual void setY (int, bool = true) override;
|
||||
virtual void setPos (int, int, bool = true) override;
|
||||
virtual void setPos (const FPoint&, bool = true) override;
|
||||
virtual void setWidth (std::size_t, bool = true) override;
|
||||
virtual void setHeight (std::size_t, bool = true) override;
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true) override;
|
||||
virtual void setGeometry ( int, int
|
||||
, std::size_t, std::size_t
|
||||
virtual void setSize (const FSize&, bool = true) override;
|
||||
virtual void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
virtual void move (int, int) override;
|
||||
virtual void move (const FPoint&) override;
|
||||
static FWindow* getWindowWidgetAt (const FPoint&);
|
||||
static FWindow* getWindowWidgetAt (int, int);
|
||||
static void addWindow (FWidget*);
|
||||
|
@ -157,7 +154,7 @@ class FWindow : public FWidget
|
|||
bool zoomWindow ();
|
||||
static void switchToPrevWindow (FWidget*);
|
||||
static bool activatePrevWindow();
|
||||
virtual void setShadowSize (std::size_t, std::size_t) override;
|
||||
virtual void setShadowSize (const FSize&) override;
|
||||
|
||||
protected:
|
||||
// Method
|
||||
|
|
|
@ -166,7 +166,8 @@ void FPointTest::additionAssignmentTest()
|
|||
p2 += finalcut::FPoint ( -std::numeric_limits<int>::max()
|
||||
, std::numeric_limits<int>::max() );
|
||||
CPPUNIT_ASSERT ( p2.getX() == 0 );
|
||||
CPPUNIT_ASSERT ( p2.getY() == std::numeric_limits<int>::min() + std::numeric_limits<int>::max() );
|
||||
CPPUNIT_ASSERT ( p2.getY() == std::numeric_limits<int>::min()
|
||||
+ std::numeric_limits<int>::max() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -188,6 +188,15 @@ void FRectTest::assignmentTest()
|
|||
CPPUNIT_ASSERT ( r3.getHeight() == 6 );
|
||||
CPPUNIT_ASSERT ( r3.getSize() == finalcut::FSize(6, 6) );
|
||||
|
||||
r3.setRect(finalcut::FPoint(34, 8), finalcut::FSize(40, 12));
|
||||
CPPUNIT_ASSERT ( r3.getX1() == 34 );
|
||||
CPPUNIT_ASSERT ( r3.getY1() == 8 );
|
||||
CPPUNIT_ASSERT ( r3.getX2() == 73 );
|
||||
CPPUNIT_ASSERT ( r3.getY2() == 19 );
|
||||
CPPUNIT_ASSERT ( r3.getWidth() == 40 );
|
||||
CPPUNIT_ASSERT ( r3.getHeight() == 12 );
|
||||
CPPUNIT_ASSERT ( r3.getSize() == finalcut::FSize(40, 12) );
|
||||
|
||||
r3.setRect(r1);
|
||||
CPPUNIT_ASSERT ( r3 == r1 );
|
||||
CPPUNIT_ASSERT ( r3.getX1() == 3 );
|
||||
|
|
|
@ -54,8 +54,11 @@ class FSizeTest : public CPPUNIT_NS::TestFixture
|
|||
void subtractionAssignmentTest();
|
||||
void equalTest();
|
||||
void notEqualTest();
|
||||
void greaterTest();
|
||||
void LessTest();
|
||||
void additionTest();
|
||||
void subtractionTest();
|
||||
void areaTest();
|
||||
void referenceTest();
|
||||
void streamInsertionTest();
|
||||
void streamExtractionTest();
|
||||
|
@ -73,8 +76,11 @@ class FSizeTest : public CPPUNIT_NS::TestFixture
|
|||
CPPUNIT_TEST (subtractionAssignmentTest);
|
||||
CPPUNIT_TEST (equalTest);
|
||||
CPPUNIT_TEST (notEqualTest);
|
||||
CPPUNIT_TEST (greaterTest);
|
||||
CPPUNIT_TEST (LessTest);
|
||||
CPPUNIT_TEST (additionTest);
|
||||
CPPUNIT_TEST (subtractionTest);
|
||||
CPPUNIT_TEST (areaTest);
|
||||
CPPUNIT_TEST (referenceTest);
|
||||
CPPUNIT_TEST (streamInsertionTest);
|
||||
CPPUNIT_TEST (streamExtractionTest);
|
||||
|
@ -134,6 +140,11 @@ void FSizeTest::assignmentTest()
|
|||
CPPUNIT_ASSERT ( s2.getWidth() == 40 );
|
||||
CPPUNIT_ASSERT ( s2.getHeight() == 12 );
|
||||
|
||||
const finalcut::FSize size{5, 4};
|
||||
s2.setSize (size);
|
||||
CPPUNIT_ASSERT ( s2.getWidth() == 5 );
|
||||
CPPUNIT_ASSERT ( s2.getHeight() == 4 );
|
||||
|
||||
// Value limit
|
||||
const finalcut::FSize s3 ( std::numeric_limits<std::size_t>::min()
|
||||
, std::numeric_limits<std::size_t>::max() );
|
||||
|
@ -244,6 +255,38 @@ void FSizeTest::notEqualTest()
|
|||
CPPUNIT_ASSERT ( s1 != finalcut::FSize() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::greaterTest()
|
||||
{
|
||||
const finalcut::FSize s1 (5, 9);
|
||||
const finalcut::FSize s2 (3, 5);
|
||||
CPPUNIT_ASSERT ( s1 > s2 );
|
||||
CPPUNIT_ASSERT ( s1 >= s2 );
|
||||
|
||||
const finalcut::FSize s3 (5, 9);
|
||||
CPPUNIT_ASSERT ( s1 >= s3 );
|
||||
CPPUNIT_ASSERT ( s1 >= finalcut::FSize(4, 9) );
|
||||
CPPUNIT_ASSERT ( s1 >= finalcut::FSize(5, 8) );
|
||||
CPPUNIT_ASSERT ( s1 >= finalcut::FSize(4, 8) );
|
||||
CPPUNIT_ASSERT ( s1 > finalcut::FSize(4, 8) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::LessTest()
|
||||
{
|
||||
const finalcut::FSize s1 (2, 2);
|
||||
const finalcut::FSize s2 (4, 4);
|
||||
CPPUNIT_ASSERT ( s1 < s2 );
|
||||
CPPUNIT_ASSERT ( s1 <= s2 );
|
||||
|
||||
const finalcut::FSize s3 (2, 2);
|
||||
CPPUNIT_ASSERT ( s1 <= s3 );
|
||||
CPPUNIT_ASSERT ( s1 <= finalcut::FSize(3, 2) );
|
||||
CPPUNIT_ASSERT ( s1 <= finalcut::FSize(2, 3) );
|
||||
CPPUNIT_ASSERT ( s1 <= finalcut::FSize(3, 3) );
|
||||
CPPUNIT_ASSERT ( s1 < finalcut::FSize(3, 3) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::additionTest()
|
||||
{
|
||||
|
@ -272,6 +315,20 @@ void FSizeTest::subtractionTest()
|
|||
CPPUNIT_ASSERT ( s3 - finalcut::FSize(100, 20) == finalcut::FSize(0, 0) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::areaTest()
|
||||
{
|
||||
const finalcut::FSize s1 (99, 101);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 99 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 101 );
|
||||
CPPUNIT_ASSERT ( s1.getArea() == 9999 );
|
||||
|
||||
const finalcut::FSize s2 (33, 87);
|
||||
CPPUNIT_ASSERT ( s2.getWidth() == 33 );
|
||||
CPPUNIT_ASSERT ( s2.getHeight() == 87 );
|
||||
CPPUNIT_ASSERT ( s2.getArea() == 2871 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::referenceTest()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue