Use of the C++11 auto specifier in the program code
This commit is contained in:
parent
6ce8c5cb27
commit
cef13611d1
|
@ -1,3 +1,6 @@
|
|||
2018-12-15 Markus Gans <guru.mail@muenster.de>
|
||||
* Use of the C++11 auto specifier in the program code
|
||||
|
||||
2018-12-09 Markus Gans <guru.mail@muenster.de>
|
||||
* Better handling of the scrollbar maximum
|
||||
* Deactivate copy constructor and assignment operator with "= delete"
|
||||
|
|
|
@ -254,7 +254,7 @@ Calc::Calc (FWidget* parent)
|
|||
|
||||
for (int key = 0; key < Calc::NUM_OF_BUTTONS; key++)
|
||||
{
|
||||
Button* btn = new Button(this);
|
||||
auto btn = new Button(this);
|
||||
button_no[key] = key;
|
||||
|
||||
if ( key == Equals )
|
||||
|
|
|
@ -128,9 +128,8 @@ void CheckList::populate()
|
|||
for (int i = 0; i <= lastItem; i++)
|
||||
{
|
||||
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
|
||||
finalcut::FObject::FObjectIterator iter = listView.insert (line);
|
||||
finalcut::FListViewItem* item = \
|
||||
static_cast<finalcut::FListViewItem*>(*iter);
|
||||
auto iter = listView.insert (line);
|
||||
auto item = static_cast<finalcut::FListViewItem*>(*iter);
|
||||
item->setCheckable(true);
|
||||
}
|
||||
}
|
||||
|
@ -161,13 +160,12 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void CheckList::cb_showList (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
finalcut::FListViewIterator iter = listView.beginOfList();
|
||||
auto iter = listView.beginOfList();
|
||||
finalcut::FString shopping_list;
|
||||
|
||||
while ( iter != listView.endOfList() )
|
||||
{
|
||||
const finalcut::FListViewItem* item = \
|
||||
static_cast<finalcut::FListViewItem*>(*iter);
|
||||
const auto item = static_cast<finalcut::FListViewItem*>(*iter);
|
||||
|
||||
if ( item->isChecked() )
|
||||
shopping_list << finalcut::fc::Bullet << ' '
|
||||
|
|
|
@ -34,7 +34,7 @@ void preset (std::vector<finalcut::FRadioButton*>&);
|
|||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
{
|
||||
finalcut::FDialog* dlg = static_cast<finalcut::FDialog*>(data);
|
||||
auto dlg = static_cast<finalcut::FDialog*>(data);
|
||||
dlg->close();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
|||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
{
|
||||
finalcut::FApplication* app = static_cast<finalcut::FApplication*>(data);
|
||||
auto app = static_cast<finalcut::FApplication*>(data);
|
||||
app->quit();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@ void cb_publish (finalcut::FWidget*, finalcut::FWidget::data_ptr);
|
|||
//----------------------------------------------------------------------
|
||||
void cb_quit (finalcut::FWidget*, finalcut::FWidget::data_ptr data)
|
||||
{
|
||||
finalcut::FApplication* app = static_cast<finalcut::FApplication*>(data);
|
||||
auto app = static_cast<finalcut::FApplication*>(data);
|
||||
app->quit();
|
||||
}
|
||||
|
||||
void cb_publish (finalcut::FWidget* widget, finalcut::FWidget::data_ptr data)
|
||||
{
|
||||
finalcut::FCheckBox* cbox1 = static_cast<finalcut::FCheckBox*>(widget);
|
||||
finalcut::FCheckBox* cbox2 = static_cast<finalcut::FCheckBox*>(data);
|
||||
auto cbox1 = static_cast<finalcut::FCheckBox*>(widget);
|
||||
auto cbox2 = static_cast<finalcut::FCheckBox*>(data);
|
||||
|
||||
if ( cbox1->isChecked() )
|
||||
cbox2->setEnable();
|
||||
|
|
|
@ -189,7 +189,7 @@ void Listview::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void Listview::cb_showInMessagebox (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
finalcut::FListViewItem* item = listView.getCurrentItem();
|
||||
auto item = listView.getCurrentItem();
|
||||
finalcut::FMessageBox info ( "Weather in " + item->getText(1)
|
||||
, " Condition: " + item->getText(2) + "\n"
|
||||
"Temperature: " + item->getText(3) + "\n"
|
||||
|
|
|
@ -260,7 +260,7 @@ void Menu::defaultCallback (finalcut::FMenuList* mb)
|
|||
{
|
||||
for (uInt i = 1; i <= mb->getCount(); i++)
|
||||
{
|
||||
finalcut::FMenuItem* item = mb->getItem(int(i));
|
||||
auto item = mb->getItem(int(i));
|
||||
|
||||
if ( item
|
||||
&& item->isEnabled()
|
||||
|
@ -302,9 +302,8 @@ void Menu::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void Menu::cb_message (finalcut::FWidget* widget, data_ptr)
|
||||
{
|
||||
finalcut::FMenuItem* menuitem = \
|
||||
static_cast<finalcut::FMenuItem*>(widget);
|
||||
finalcut::FString text = menuitem->getText();
|
||||
auto menuitem = static_cast<finalcut::FMenuItem*>(widget);
|
||||
auto text = menuitem->getText();
|
||||
text = text.replace('&', "");
|
||||
finalcut::FMessageBox::info ( this
|
||||
, "Info"
|
||||
|
|
|
@ -194,7 +194,7 @@ class AttribDemo : public finalcut::FWidget
|
|||
// Event handler
|
||||
virtual void onWheel (finalcut::FWheelEvent* ev)
|
||||
{
|
||||
AttribDlg* p = static_cast<AttribDlg*>(getParentWidget());
|
||||
auto p = static_cast<AttribDlg*>(getParentWidget());
|
||||
|
||||
if ( p )
|
||||
p->onWheel(ev);
|
||||
|
@ -240,7 +240,7 @@ AttribDemo::AttribDemo (finalcut::FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
void AttribDemo::printColorLine()
|
||||
{
|
||||
AttribDlg* parent = static_cast<AttribDlg*>(getParent());
|
||||
auto parent = static_cast<AttribDlg*>(getParent());
|
||||
|
||||
for (FColor color = 0; color < colors; color++)
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ void AttribDemo::printColorLine()
|
|||
//----------------------------------------------------------------------
|
||||
void AttribDemo::printAltCharset()
|
||||
{
|
||||
AttribDlg* parent = static_cast<AttribDlg*>(getParent());
|
||||
auto parent = static_cast<AttribDlg*>(getParent());
|
||||
|
||||
if ( ! isMonochron() )
|
||||
setColor (wc.label_fg, wc.label_bg);
|
||||
|
|
|
@ -38,7 +38,7 @@ bool sortDescending (const finalcut::FObject*, const finalcut::FObject*);
|
|||
//----------------------------------------------------------------------
|
||||
long StringToLong (const finalcut::FString& str)
|
||||
{
|
||||
finalcut::FString NumString = str;
|
||||
auto NumString = str;
|
||||
NumString = NumString.replace(",", "");
|
||||
NumString = NumString.replace('.', "");
|
||||
long number = NumString.toLong();
|
||||
|
@ -49,8 +49,8 @@ long StringToLong (const finalcut::FString& str)
|
|||
bool sortAscending ( const finalcut::FObject* lhs
|
||||
, const finalcut::FObject* rhs )
|
||||
{
|
||||
const finalcut::FListViewItem* l_item = static_cast<const finalcut::FListViewItem*>(lhs);
|
||||
const finalcut::FListViewItem* r_item = static_cast<const finalcut::FListViewItem*>(rhs);
|
||||
const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs);
|
||||
const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
|
||||
switch ( column )
|
||||
|
@ -77,8 +77,8 @@ bool sortAscending ( const finalcut::FObject* lhs
|
|||
bool sortDescending ( const finalcut::FObject* lhs
|
||||
, const finalcut::FObject* rhs )
|
||||
{
|
||||
const finalcut::FListViewItem* l_item = static_cast<const finalcut::FListViewItem*>(lhs);
|
||||
const finalcut::FListViewItem* r_item = static_cast<const finalcut::FListViewItem*>(rhs);
|
||||
const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs);
|
||||
const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
|
||||
switch ( column )
|
||||
|
@ -334,15 +334,14 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
TreeItem* continent_list = continent;
|
||||
auto continent_list = continent;
|
||||
|
||||
while ( continent_list->name )
|
||||
{
|
||||
TreeItem* country_list = continent_list->child_element;
|
||||
auto country_list = continent_list->child_element;
|
||||
finalcut::FStringList continent_line ( continent_list->begin()
|
||||
, continent_list->end() );
|
||||
finalcut::FListViewIterator::FObjectIterator iter = \
|
||||
listView.insert (continent_line);
|
||||
auto iter = listView.insert (continent_line);
|
||||
|
||||
while ( country_list && country_list->name )
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ void ProgressDialog::onShow (finalcut::FShowEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
||||
{
|
||||
std::size_t p = progressBar.getPercentage();
|
||||
auto p = progressBar.getPercentage();
|
||||
progressBar.setPercentage(++p);
|
||||
flush_out();
|
||||
|
||||
|
@ -159,7 +159,7 @@ void ProgressDialog::cb_reset_bar (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
std::size_t p = progressBar.getPercentage();
|
||||
auto p = progressBar.getPercentage();
|
||||
progressBar.setPercentage(++p);
|
||||
}
|
||||
|
||||
|
@ -733,9 +733,9 @@ void MyDialog::initWidgetsCallbacks()
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::adjustSize()
|
||||
{
|
||||
std::size_t h = getParentWidget()->getHeight() - 4;
|
||||
auto h = getParentWidget()->getHeight() - 4;
|
||||
setHeight (h, false);
|
||||
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
auto X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
|
||||
if ( X < 1 )
|
||||
X = 1;
|
||||
|
@ -757,8 +757,8 @@ void MyDialog::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_noFunctionMsg (finalcut::FWidget* widget, data_ptr)
|
||||
{
|
||||
finalcut::FButton* button = static_cast<finalcut::FButton*>(widget);
|
||||
finalcut::FString text = button->getText();
|
||||
auto button = static_cast<finalcut::FButton*>(widget);
|
||||
auto text = button->getText();
|
||||
text = text.replace('&', "");
|
||||
finalcut::FMessageBox::error ( this
|
||||
, "The \"" + text + "\" button has\n"
|
||||
|
@ -783,8 +783,8 @@ void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
std::size_t x = getDesktopWidth();
|
||||
std::size_t y = getDesktopHeight();
|
||||
auto x = getDesktopWidth();
|
||||
auto y = getDesktopHeight();
|
||||
finalcut::FMessageBox info1 \
|
||||
(
|
||||
"Environment"
|
||||
|
@ -884,16 +884,16 @@ void MyDialog::cb_clearInput (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, data_ptr data)
|
||||
{
|
||||
finalcut::FButton* button = static_cast<finalcut::FButton*>(widget);
|
||||
finalcut::FLineEdit* lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
button->setText( lineedit->getText() );
|
||||
auto button = static_cast<finalcut::FButton*>(widget);
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
button->setText(lineedit->getText());
|
||||
button->redraw();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, data_ptr)
|
||||
{
|
||||
finalcut::FLineEdit* lineedit = static_cast<finalcut::FLineEdit*>(widget);
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(widget);
|
||||
finalcut::FString title;
|
||||
*lineedit >> title;
|
||||
setTermTitle (title);
|
||||
|
@ -904,17 +904,17 @@ void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_ProgressBar (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
ProgressDialog* p_dgl = new ProgressDialog(this);
|
||||
auto p_dgl = new ProgressDialog(this);
|
||||
p_dgl->show();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_updateNumber (finalcut::FWidget* widget, data_ptr data)
|
||||
{
|
||||
finalcut::FListBox* list = static_cast<finalcut::FListBox*>(widget);
|
||||
finalcut::FLabel* num = static_cast<finalcut::FLabel*>(data);
|
||||
auto list = static_cast<finalcut::FListBox*>(widget);
|
||||
auto num = static_cast<finalcut::FLabel*>(data);
|
||||
auto count = list->getCount();
|
||||
int select_num = 0;
|
||||
std::size_t count = list->getCount();
|
||||
|
||||
for (std::size_t n = 1; n <= count; n++)
|
||||
if ( list->isSelected(n) )
|
||||
|
@ -928,8 +928,8 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, data_ptr data)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_activateButton (finalcut::FWidget* widget, data_ptr data)
|
||||
{
|
||||
finalcut::FRadioButton* rb = static_cast<finalcut::FRadioButton*>(widget);
|
||||
finalcut::FButton* button = static_cast<finalcut::FButton*>(data);
|
||||
auto rb = static_cast<finalcut::FRadioButton*>(widget);
|
||||
auto button = static_cast<finalcut::FButton*>(data);
|
||||
|
||||
if ( rb->isChecked() )
|
||||
button->setEnable();
|
||||
|
@ -943,7 +943,7 @@ void MyDialog::cb_activateButton (finalcut::FWidget* widget, data_ptr data)
|
|||
void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
||||
{
|
||||
finalcut::FString file;
|
||||
finalcut::FMenuItem* item = static_cast<finalcut::FMenuItem*>(data);
|
||||
auto item = static_cast<finalcut::FMenuItem*>(data);
|
||||
|
||||
if ( item && ! item->getText().isEmpty() )
|
||||
file = item->getText();
|
||||
|
@ -981,8 +981,8 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_setInput (finalcut::FWidget* widget, data_ptr data)
|
||||
{
|
||||
finalcut::FListBox* ListBox = static_cast<finalcut::FListBox*>(widget);
|
||||
finalcut::FLineEdit* lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
auto ListBox = static_cast<finalcut::FListBox*>(widget);
|
||||
auto lineedit = static_cast<finalcut::FLineEdit*>(data);
|
||||
*lineedit = ListBox->getItem(ListBox->currentItem()).getText();
|
||||
lineedit->redraw();
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ Window::Window (finalcut::FWidget* parent)
|
|||
// Generate data vector for the windows
|
||||
for (int n = 1; n <= 6; n++)
|
||||
{
|
||||
win_data* win_dat = new win_data;
|
||||
auto win_dat = new win_data;
|
||||
win_dat->title.sprintf("Window %1d", n);
|
||||
windows.push_back(win_dat);
|
||||
}
|
||||
|
@ -263,12 +263,11 @@ Window::Window (finalcut::FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
Window::~Window()
|
||||
{
|
||||
std::vector<win_data*>::iterator iter;
|
||||
iter = windows.begin();
|
||||
auto iter = windows.begin();
|
||||
|
||||
while ( iter != windows.end() )
|
||||
{
|
||||
win_data* win_dat = *iter;
|
||||
auto win_dat = *iter;
|
||||
|
||||
// Remove all callbacks before Window::cb_destroyWindow() will be called
|
||||
if ( win_dat->is_open && win_dat->dgl )
|
||||
|
@ -337,7 +336,6 @@ void Window::activateWindow (finalcut::FDialog* win)
|
|||
//----------------------------------------------------------------------
|
||||
void Window::adjustSize()
|
||||
{
|
||||
std::vector<win_data*>::const_iterator iter, first;
|
||||
std::size_t w = getRootWidget()->getWidth();
|
||||
std::size_t h = getRootWidget()->getHeight();
|
||||
int X = int(1 + (w - 40) / 2)
|
||||
|
@ -349,7 +347,8 @@ void Window::adjustSize()
|
|||
Y = 2;
|
||||
|
||||
setPos (X, Y);
|
||||
iter = first = windows.begin();
|
||||
auto first = windows.begin();
|
||||
auto iter = first;
|
||||
|
||||
while ( iter != windows.end() )
|
||||
{
|
||||
|
@ -404,10 +403,10 @@ void Window::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
std::vector<win_data*>::const_iterator iter, first;
|
||||
iter = first = windows.begin();
|
||||
std::size_t w = getRootWidget()->getWidth();
|
||||
std::size_t h = getRootWidget()->getHeight();
|
||||
auto first = windows.begin();
|
||||
auto iter = first;
|
||||
auto w = getRootWidget()->getWidth();
|
||||
auto h = getRootWidget()->getHeight();
|
||||
int dx = ( w > 80 ) ? int(w - 80) / 2 : 0;
|
||||
int dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
|
||||
|
||||
|
@ -415,8 +414,8 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
|||
{
|
||||
if ( ! (*iter)->is_open )
|
||||
{
|
||||
win_data* win_dat = *iter;
|
||||
SmallWindow* win = new SmallWindow(this);
|
||||
auto win_dat = *iter;
|
||||
auto win = new SmallWindow(this);
|
||||
win_dat->dgl = win;
|
||||
win_dat->is_open = true;
|
||||
win->setText(win_dat->title);
|
||||
|
@ -448,9 +447,8 @@ void Window::cb_closeWindows (finalcut::FWidget*, data_ptr)
|
|||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
||||
finalcut::FWidget::widgetList::const_iterator iter, first;
|
||||
iter = dialog_list->end();
|
||||
first = dialog_list->begin();
|
||||
auto iter = dialog_list->end();
|
||||
auto first = dialog_list->begin();
|
||||
activateWindow(this);
|
||||
|
||||
do
|
||||
|
@ -469,16 +467,14 @@ void Window::cb_next (finalcut::FWidget*, data_ptr)
|
|||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
||||
finalcut::FWidget::widgetList::const_iterator iter;
|
||||
iter = dialog_list->begin();
|
||||
auto iter = dialog_list->begin();
|
||||
|
||||
while ( iter != dialog_list->end() )
|
||||
{
|
||||
if ( static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
||||
{
|
||||
finalcut::FDialog* next;
|
||||
finalcut::FWidget::widgetList::const_iterator next_element;
|
||||
next_element = iter;
|
||||
auto next_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -507,8 +503,7 @@ void Window::cb_previous (finalcut::FWidget*, data_ptr)
|
|||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
||||
finalcut::FWidget::widgetList::const_iterator iter;
|
||||
iter = dialog_list->end();
|
||||
auto iter = dialog_list->end();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -518,8 +513,7 @@ void Window::cb_previous (finalcut::FWidget*, data_ptr)
|
|||
&& static_cast<finalcut::FWindow*>(*iter)->isWindowActive() )
|
||||
{
|
||||
finalcut::FDialog* prev;
|
||||
finalcut::FWidget::widgetList::const_iterator prev_element;
|
||||
prev_element = iter;
|
||||
auto prev_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -543,7 +537,7 @@ void Window::cb_previous (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void Window::cb_destroyWindow (finalcut::FWidget*, data_ptr data)
|
||||
{
|
||||
win_data* win_dat = static_cast<win_data*>(data);
|
||||
auto win_dat = static_cast<win_data*>(data);
|
||||
|
||||
if ( win_dat )
|
||||
{
|
||||
|
|
|
@ -173,12 +173,13 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
if ( ! receiver->isWidget() )
|
||||
return false;
|
||||
|
||||
const FWidget* r_widget = static_cast<const FWidget*>(receiver);
|
||||
FWidget* widget = const_cast<FWidget*>(r_widget);
|
||||
const auto r_widget = static_cast<const FWidget*>(receiver);
|
||||
auto widget = const_cast<FWidget*>(r_widget);
|
||||
|
||||
if ( modal_dialogs > 0 )
|
||||
{
|
||||
const FWidget* window;
|
||||
|
||||
if ( widget->isWindowWidget() )
|
||||
window = widget;
|
||||
else
|
||||
|
@ -217,8 +218,8 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
return false;
|
||||
|
||||
// For access to a protected base class member
|
||||
const FApplication* const_w = static_cast<const FApplication*>(widget);
|
||||
FApplication* w = const_cast<FApplication*>(const_w);
|
||||
auto const_w = static_cast<const FApplication*>(widget);
|
||||
auto w = const_cast<FApplication*>(const_w);
|
||||
|
||||
// Sends event event directly to receiver
|
||||
return w->event(const_cast<FEvent*>(event));
|
||||
|
@ -239,12 +240,10 @@ void FApplication::queueEvent ( const FObject* receiver
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::sendQueuedEvents()
|
||||
{
|
||||
eventQueue* events;
|
||||
|
||||
if ( ! eventInQueue() )
|
||||
return;
|
||||
|
||||
events = event_queue;
|
||||
auto events = event_queue;
|
||||
|
||||
while ( ! eventInQueue() )
|
||||
{
|
||||
|
@ -266,7 +265,6 @@ bool FApplication::eventInQueue()
|
|||
bool FApplication::removeQueuedEvent (const FObject* receiver)
|
||||
{
|
||||
bool retval;
|
||||
eventQueue::iterator iter;
|
||||
|
||||
if ( ! eventInQueue() )
|
||||
return false;
|
||||
|
@ -275,7 +273,7 @@ bool FApplication::removeQueuedEvent (const FObject* receiver)
|
|||
return false;
|
||||
|
||||
retval = false;
|
||||
iter = event_queue->begin();
|
||||
auto iter = event_queue->begin();
|
||||
|
||||
while ( iter != event_queue->end() )
|
||||
{
|
||||
|
@ -499,8 +497,8 @@ inline void FApplication::findKeyboardWidget()
|
|||
// Find the widget that has the keyboard focus
|
||||
|
||||
FWidget* widget = nullptr;
|
||||
FWidget* focus = getFocusWidget();
|
||||
FWidget* move_size = getMoveSizeWidget();
|
||||
auto focus = getFocusWidget();
|
||||
auto move_size = getMoveSizeWidget();
|
||||
|
||||
if ( focus )
|
||||
{
|
||||
|
@ -644,7 +642,7 @@ inline void FApplication::sendKeyboardAccelerator()
|
|||
// Windows keyboard accelerator
|
||||
if ( ! accpt )
|
||||
{
|
||||
const FWidget* window = getActiveWindow();
|
||||
auto window = static_cast<const FWidget*>(getActiveWindow());
|
||||
|
||||
if ( window )
|
||||
accpt = processAccelerator (window);
|
||||
|
@ -653,7 +651,7 @@ inline void FApplication::sendKeyboardAccelerator()
|
|||
// Global keyboard accelerator
|
||||
if ( ! accpt )
|
||||
{
|
||||
const FWidget* root_widget = getRootWidget();
|
||||
auto root_widget = static_cast<const FWidget*>(getRootWidget());
|
||||
|
||||
if ( root_widget )
|
||||
processAccelerator (root_widget);
|
||||
|
@ -690,11 +688,11 @@ bool FApplication::processDialogSwitchAccelerator()
|
|||
if ( s > 0 && s >= n )
|
||||
{
|
||||
// unset the move/size mode
|
||||
FWidget* move_size = getMoveSizeWidget();
|
||||
auto move_size = getMoveSizeWidget();
|
||||
|
||||
if ( move_size )
|
||||
{
|
||||
FWidget* w = move_size;
|
||||
auto w = move_size;
|
||||
setMoveSizeWidget(0);
|
||||
w->redraw();
|
||||
}
|
||||
|
@ -717,9 +715,8 @@ bool FApplication::processAccelerator (const FWidget*& widget)
|
|||
&& widget->accelerator_list
|
||||
&& ! widget->accelerator_list->empty() )
|
||||
{
|
||||
FWidget::Accelerators::const_iterator iter, last;
|
||||
iter = widget->accelerator_list->begin();
|
||||
last = widget->accelerator_list->end();
|
||||
auto iter = widget->accelerator_list->begin();
|
||||
auto last = widget->accelerator_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -729,11 +726,11 @@ bool FApplication::processAccelerator (const FWidget*& widget)
|
|||
if ( iter->key == keyboard->getKey() )
|
||||
{
|
||||
// unset the move/size mode
|
||||
FWidget* move_size = getMoveSizeWidget();
|
||||
auto move_size = getMoveSizeWidget();
|
||||
|
||||
if ( move_size )
|
||||
{
|
||||
FWidget* w = move_size;
|
||||
auto w = move_size;
|
||||
setMoveSizeWidget(0);
|
||||
w->redraw();
|
||||
}
|
||||
|
@ -789,12 +786,12 @@ FWidget*& FApplication::determineClickedWidget()
|
|||
const FPoint& mouse_position = mouse->getPos();
|
||||
|
||||
// Determine the window object on the current click position
|
||||
FWidget* window = FWindow::getWindowWidgetAt (mouse_position);
|
||||
auto window = FWindow::getWindowWidgetAt (mouse_position);
|
||||
|
||||
if ( window )
|
||||
{
|
||||
// Determine the widget at the current click position
|
||||
FWidget* child = childWidgetAt (window, mouse_position);
|
||||
auto child = childWidgetAt (window, mouse_position);
|
||||
clicked = ( child != 0 ) ? child : window;
|
||||
setClickedWidget (clicked);
|
||||
}
|
||||
|
@ -807,11 +804,11 @@ void FApplication::unsetMoveSizeMode()
|
|||
{
|
||||
// Unset the move/size mode
|
||||
|
||||
FWidget* move_size = getMoveSizeWidget();
|
||||
auto move_size = getMoveSizeWidget();
|
||||
|
||||
if ( move_size )
|
||||
{
|
||||
FWidget* w = move_size;
|
||||
auto w = move_size;
|
||||
setMoveSizeWidget(0);
|
||||
w->redraw();
|
||||
}
|
||||
|
@ -822,8 +819,8 @@ void FApplication::closeOpenMenu()
|
|||
{
|
||||
// Close the open menu
|
||||
|
||||
FWidget* openmenu = getOpenMenu();
|
||||
FMenu* menu = static_cast<FMenu*>(openmenu);
|
||||
auto openmenu = getOpenMenu();
|
||||
auto menu = static_cast<FMenu*>(openmenu);
|
||||
|
||||
if ( ! openmenu || ( mouse && mouse->isMoved()) )
|
||||
return;
|
||||
|
@ -837,7 +834,7 @@ void FApplication::closeOpenMenu()
|
|||
}
|
||||
|
||||
bool is_window_menu;
|
||||
FWidget* super = menu->getSuperMenu();
|
||||
auto super = menu->getSuperMenu();
|
||||
|
||||
if ( super && menu->isWindowsMenu(super) )
|
||||
is_window_menu = true;
|
||||
|
@ -865,8 +862,8 @@ void FApplication::unselectMenubarItems()
|
|||
{
|
||||
// Unselect the menu bar items
|
||||
|
||||
FWidget* openmenu = getOpenMenu();
|
||||
FMenuBar* menu_bar = getMenuBar();
|
||||
auto openmenu = getOpenMenu();
|
||||
auto menu_bar = getMenuBar();
|
||||
|
||||
if ( openmenu || (mouse && mouse->isMoved()) )
|
||||
return;
|
||||
|
@ -905,7 +902,7 @@ void FApplication::unselectMenubarItems()
|
|||
//----------------------------------------------------------------------
|
||||
void FApplication::sendMouseEvent()
|
||||
{
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( ! clicked )
|
||||
return;
|
||||
|
@ -951,7 +948,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonPressed() )
|
||||
{
|
||||
|
@ -989,7 +986,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( mouse->isLeftButtonDoubleClick() )
|
||||
{
|
||||
|
@ -1013,7 +1010,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
|
|||
, widgetMousePos
|
||||
, mouse_position
|
||||
, fc::LeftButton | key_state );
|
||||
FWidget* released_widget = clicked;
|
||||
auto released_widget = clicked;
|
||||
|
||||
if ( ! mouse->isRightButtonPressed()
|
||||
&& ! mouse->isMiddleButtonPressed() )
|
||||
|
@ -1031,7 +1028,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( mouse->isRightButtonPressed() )
|
||||
{
|
||||
|
@ -1047,7 +1044,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
|
|||
, widgetMousePos
|
||||
, mouse_position
|
||||
, fc::RightButton | key_state );
|
||||
FWidget* released_widget = clicked;
|
||||
auto released_widget = clicked;
|
||||
|
||||
if ( ! mouse->isLeftButtonPressed()
|
||||
&& ! mouse->isMiddleButtonPressed() )
|
||||
|
@ -1065,7 +1062,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( mouse->isMiddleButtonPressed() )
|
||||
{
|
||||
|
@ -1085,7 +1082,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
|
|||
, widgetMousePos
|
||||
, mouse_position
|
||||
, fc::MiddleButton | key_state );
|
||||
FWidget* released_widget = clicked;
|
||||
auto released_widget = clicked;
|
||||
|
||||
if ( ! mouse->isLeftButtonPressed()
|
||||
&& ! mouse->isRightButtonPressed() )
|
||||
|
@ -1104,7 +1101,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
|
|||
if ( ! mouse )
|
||||
return;
|
||||
|
||||
FWidget* clicked = getClickedWidget();
|
||||
auto clicked = getClickedWidget();
|
||||
|
||||
if ( mouse->isWheelUp() )
|
||||
{
|
||||
|
@ -1112,7 +1109,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
|
|||
, widgetMousePos
|
||||
, mouse_position
|
||||
, fc::WheelUp );
|
||||
FWidget* scroll_over_widget = clicked;
|
||||
auto scroll_over_widget = clicked;
|
||||
setClickedWidget(0);
|
||||
sendEvent(scroll_over_widget, &wheel_ev);
|
||||
}
|
||||
|
@ -1123,7 +1120,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
|
|||
, widgetMousePos
|
||||
, mouse_position
|
||||
, fc::WheelDown );
|
||||
FWidget* scroll_over_widget = clicked;
|
||||
auto scroll_over_widget = clicked;
|
||||
setClickedWidget(0);
|
||||
sendEvent (scroll_over_widget, &wheel_ev);
|
||||
}
|
||||
|
@ -1165,8 +1162,7 @@ void FApplication::processCloseWidget()
|
|||
|
||||
if ( close_widget && ! close_widget->empty() )
|
||||
{
|
||||
widgetList::iterator iter;
|
||||
iter = close_widget->begin();
|
||||
auto iter = close_widget->begin();
|
||||
|
||||
while ( iter != close_widget->end() && *iter )
|
||||
{
|
||||
|
|
|
@ -220,7 +220,7 @@ void FButton::hide()
|
|||
{
|
||||
std::size_t s, f, size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -242,7 +242,7 @@ void FButton::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
@ -360,7 +360,7 @@ void FButton::onAccel (FAccelEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
||||
if ( focused_widget && focused_widget->isWidget() )
|
||||
{
|
||||
|
@ -683,7 +683,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
void FButton::draw()
|
||||
{
|
||||
wchar_t* button_text;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
txtlength = text.getLength();
|
||||
space_char = int(' ');
|
||||
active_focus = flags.active && flags.focus;
|
||||
|
|
|
@ -53,16 +53,14 @@ FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FButtonGroup::~FButtonGroup() // destructor
|
||||
{
|
||||
FObjectIterator iter;
|
||||
|
||||
if ( buttonlist.empty() )
|
||||
return;
|
||||
|
||||
iter = buttonlist.begin();
|
||||
auto iter = buttonlist.begin();
|
||||
|
||||
while ( iter != buttonlist.end() )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
toggle_button->setGroup(0);
|
||||
iter = buttonlist.erase(iter);
|
||||
}
|
||||
|
@ -73,14 +71,13 @@ FButtonGroup::~FButtonGroup() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
FToggleButton* FButtonGroup::getButton (int index) const
|
||||
{
|
||||
constFObjectIterator iter;
|
||||
if ( buttonlist.empty() )
|
||||
return 0;
|
||||
|
||||
if ( index <= 0 || index > int(getCount()) )
|
||||
return 0;
|
||||
|
||||
iter = buttonlist.begin();
|
||||
auto iter = buttonlist.begin();
|
||||
std::advance (iter, index - 1);
|
||||
return static_cast<FToggleButton*>(*iter);
|
||||
}
|
||||
|
@ -88,16 +85,16 @@ FToggleButton* FButtonGroup::getButton (int index) const
|
|||
//----------------------------------------------------------------------
|
||||
FToggleButton* FButtonGroup::getFirstButton()
|
||||
{
|
||||
FWidget* widget = FWidget::getFirstFocusableWidget(buttonlist);
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(widget);
|
||||
auto widget = FWidget::getFirstFocusableWidget(buttonlist);
|
||||
auto toggle_button = static_cast<FToggleButton*>(widget);
|
||||
return toggle_button;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FToggleButton* FButtonGroup::getLastButton()
|
||||
{
|
||||
FWidget* widget = FWidget::getLastFocusableWidget(buttonlist);
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(widget);
|
||||
auto widget = FWidget::getLastFocusableWidget(buttonlist);
|
||||
auto toggle_button = static_cast<FToggleButton*>(widget);
|
||||
return toggle_button;
|
||||
}
|
||||
|
||||
|
@ -129,7 +126,7 @@ void FButtonGroup::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
bool FButtonGroup::isChecked (int index) const
|
||||
{
|
||||
FToggleButton* button = getButton(index);
|
||||
auto button = getButton(index);
|
||||
|
||||
if ( button )
|
||||
return button->isChecked();
|
||||
|
@ -143,13 +140,12 @@ bool FButtonGroup::hasFocusedButton() const
|
|||
if ( buttonlist.empty() )
|
||||
return false;
|
||||
|
||||
constFObjectIterator iter, last;
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button->hasFocus() )
|
||||
return true;
|
||||
|
@ -166,13 +162,12 @@ bool FButtonGroup::hasCheckedButton() const
|
|||
if ( buttonlist.empty() )
|
||||
return false;
|
||||
|
||||
constFObjectIterator iter, last;
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button->isChecked() )
|
||||
return true;
|
||||
|
@ -189,17 +184,16 @@ void FButtonGroup::hide()
|
|||
std::size_t size;
|
||||
FColor fg, bg;
|
||||
FWidget::hide();
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
if ( ! buttonlist.empty() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
toggle_button->hide();
|
||||
++iter;
|
||||
}
|
||||
|
@ -222,7 +216,7 @@ void FButtonGroup::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
|
@ -245,8 +239,7 @@ void FButtonGroup::insert (FToggleButton* button)
|
|||
// setChecked the first FRadioButton
|
||||
if ( buttonlist.size() == 1 )
|
||||
{
|
||||
FToggleButton* first_button;
|
||||
first_button = static_cast<FToggleButton*>(*buttonlist.begin());
|
||||
auto first_button = static_cast<FToggleButton*>(*buttonlist.begin());
|
||||
|
||||
if ( isRadioButton(first_button) )
|
||||
first_button->setChecked();
|
||||
|
@ -265,16 +258,14 @@ void FButtonGroup::insert (FToggleButton* button)
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::remove (FToggleButton* button)
|
||||
{
|
||||
FObjectIterator iter;
|
||||
|
||||
if ( ! button || buttonlist.empty() )
|
||||
return;
|
||||
|
||||
iter = buttonlist.begin();
|
||||
auto iter = buttonlist.begin();
|
||||
|
||||
while ( iter != buttonlist.end() )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button == button )
|
||||
{
|
||||
|
@ -330,19 +321,18 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
{
|
||||
if ( hasCheckedButton() && ! buttonlist.empty() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button->isChecked() )
|
||||
{
|
||||
if ( isRadioButton(toggle_button) )
|
||||
{
|
||||
FWidget* prev_element = getFocusWidget();
|
||||
auto prev_element = getFocusWidget();
|
||||
in_ev->ignore();
|
||||
toggle_button->setFocus();
|
||||
|
||||
|
@ -368,7 +358,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
if ( in_ev->isAccepted() )
|
||||
{
|
||||
in_ev->ignore();
|
||||
FWidget* prev_element = getFocusWidget();
|
||||
auto prev_element = getFocusWidget();
|
||||
|
||||
if ( in_ev->getFocusType() == fc::FocusNextWidget )
|
||||
focusFirstChild();
|
||||
|
@ -393,8 +383,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
||||
{
|
||||
FToggleButton* button = static_cast<FToggleButton*>(widget);
|
||||
constFObjectIterator iter, last;
|
||||
auto button = static_cast<FToggleButton*>(widget);
|
||||
|
||||
if ( ! button->isChecked() )
|
||||
return;
|
||||
|
@ -402,12 +391,12 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
|||
if ( buttonlist.empty() )
|
||||
return;
|
||||
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button != button
|
||||
&& toggle_button->isChecked()
|
||||
|
@ -489,7 +478,6 @@ void FButtonGroup::draw()
|
|||
void FButtonGroup::drawLabel()
|
||||
{
|
||||
wchar_t* LabelText;
|
||||
std::size_t hotkeypos;
|
||||
|
||||
if ( text.isNull() || text.isEmpty() )
|
||||
return;
|
||||
|
@ -510,7 +498,7 @@ void FButtonGroup::drawLabel()
|
|||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||
unsetViewportPrint();
|
||||
hotkeypos = getHotkeyPos(src, dest, length);
|
||||
auto hotkeypos = getHotkeyPos(src, dest, length);
|
||||
|
||||
if ( hotkeypos != NOT_SET )
|
||||
length--;
|
||||
|
@ -617,20 +605,19 @@ void FButtonGroup::directFocus()
|
|||
|
||||
if ( hasCheckedButton() && ! buttonlist.empty() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = buttonlist.begin();
|
||||
last = buttonlist.end();
|
||||
auto iter = buttonlist.begin();
|
||||
auto last = buttonlist.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
auto toggle_button = static_cast<FToggleButton*>(*iter);
|
||||
|
||||
if ( toggle_button->isChecked() )
|
||||
{
|
||||
if ( isRadioButton(toggle_button) )
|
||||
{
|
||||
found_checked = true;
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
toggle_button->setFocus();
|
||||
|
@ -653,7 +640,7 @@ void FButtonGroup::directFocus()
|
|||
|
||||
if ( ! found_checked )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
focusFirstChild();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2017 Markus Gans *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -61,7 +61,7 @@ void FCheckMenuItem::init (FWidget* parent)
|
|||
|
||||
if ( isMenu(parent) ) // Parent is menu
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(parent);
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
menu_ptr->has_checkable_items = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FDialog::~FDialog() // destructor
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
bool is_quit = fapp->isQuit();
|
||||
delete dialog_menu;
|
||||
dgl_menuitem = nullptr;
|
||||
|
@ -130,7 +130,7 @@ void FDialog::show()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
fapp->enter_loop();
|
||||
|
||||
if ( this == getMainWidget() )
|
||||
|
@ -145,7 +145,7 @@ void FDialog::hide()
|
|||
|
||||
if ( isModal() )
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
fapp->exit_loop();
|
||||
}
|
||||
}
|
||||
|
@ -334,9 +334,8 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
if ( window_list && ! window_list->empty() )
|
||||
{
|
||||
bool overlaid = false;
|
||||
widgetList::const_iterator iter, last;
|
||||
iter = window_list->begin();
|
||||
last = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -351,7 +350,7 @@ void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
|||
}
|
||||
|
||||
// set the cursor to the focus widget
|
||||
FWidget* focus = FWidget::getFocusWidget();
|
||||
auto focus = FWidget::getFocusWidget();
|
||||
if ( focus
|
||||
&& focus->isVisible()
|
||||
&& focus->hasVisibleCursor() )
|
||||
|
@ -407,8 +406,8 @@ void FDialog::activateDialog()
|
|||
if ( isWindowActive() )
|
||||
return;
|
||||
|
||||
FWidget* old_focus = FWidget::getFocusWidget();
|
||||
FWidget* win_focus = getWindowFocusWidget();
|
||||
auto old_focus = FWidget::getFocusWidget();
|
||||
auto win_focus = getWindowFocusWidget();
|
||||
setActiveWindow(this);
|
||||
setFocus();
|
||||
setFocusWidget(this);
|
||||
|
@ -637,12 +636,11 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
|||
if ( title_button.contains(tPos) )
|
||||
{
|
||||
// Double click on title button
|
||||
FWidget* window_focus_widget;
|
||||
dialog_menu->unselectItem();
|
||||
dialog_menu->hide();
|
||||
activateWindow();
|
||||
raiseWindow();
|
||||
window_focus_widget = getWindowFocusWidget();
|
||||
auto window_focus_widget = getWindowFocusWidget();
|
||||
|
||||
if ( window_focus_widget )
|
||||
window_focus_widget->setFocus();
|
||||
|
@ -688,7 +686,7 @@ void FDialog::onWindowActive (FEvent*)
|
|||
|
||||
if ( ! FWidget::getFocusWidget() )
|
||||
{
|
||||
FWidget* win_focus = getWindowFocusWidget();
|
||||
auto win_focus = getWindowFocusWidget();
|
||||
|
||||
if ( win_focus
|
||||
&& win_focus->isVisible()
|
||||
|
@ -731,9 +729,8 @@ void FDialog::onWindowRaised (FEvent*)
|
|||
// Handle always-on-top windows
|
||||
if ( always_on_top_list && ! always_on_top_list->empty() )
|
||||
{
|
||||
widgetList::const_iterator iter, last;
|
||||
iter = always_on_top_list->begin();
|
||||
last = always_on_top_list->end();
|
||||
auto iter = always_on_top_list->begin();
|
||||
auto last = always_on_top_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -746,16 +743,14 @@ void FDialog::onWindowRaised (FEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::onWindowLowered (FEvent*)
|
||||
{
|
||||
widgetList::const_iterator iter, last;
|
||||
|
||||
if ( ! window_list )
|
||||
return;
|
||||
|
||||
if ( window_list->empty() )
|
||||
return;
|
||||
|
||||
iter = window_list->begin();
|
||||
last = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -829,7 +824,6 @@ void FDialog::onClose (FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::init()
|
||||
{
|
||||
FWidget* old_focus;
|
||||
setTopPadding(2);
|
||||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
|
@ -844,7 +838,7 @@ void FDialog::init()
|
|||
setTransparentShadow();
|
||||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
old_focus = FWidget::getFocusWidget();
|
||||
auto old_focus = FWidget::getFocusWidget();
|
||||
|
||||
if ( old_focus )
|
||||
{
|
||||
|
@ -1204,9 +1198,8 @@ void FDialog::restoreOverlaidWindows()
|
|||
return;
|
||||
|
||||
bool overlaid = false;
|
||||
widgetList::const_iterator iter, last;
|
||||
iter = window_list->begin();
|
||||
last = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -1225,7 +1218,7 @@ void FDialog::setCursorToFocusWidget()
|
|||
{
|
||||
// Set the cursor to the focus widget
|
||||
|
||||
FWidget* focus = FWidget::getFocusWidget();
|
||||
auto focus = FWidget::getFocusWidget();
|
||||
|
||||
if ( focus
|
||||
&& focus->isVisible()
|
||||
|
@ -1285,9 +1278,8 @@ void FDialog::openMenu()
|
|||
void FDialog::selectFirstMenuItem()
|
||||
{
|
||||
// Focus to the first enabled menu item
|
||||
FMenuItem* first_item;
|
||||
dialog_menu->selectFirstItem();
|
||||
first_item = dialog_menu->getSelectedItem();
|
||||
auto first_item = dialog_menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -1409,7 +1401,7 @@ inline void FDialog::passEventToSubMenu ( mouseStates& ms
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
|
||||
dialog_menu->mouse_down = true;
|
||||
setClickedWidget(dialog_menu);
|
||||
dialog_menu->onMouseMove(_ev);
|
||||
|
@ -1558,7 +1550,7 @@ void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
|
|||
// Resize the dialog
|
||||
if ( isResizeable() && ! resize_click_pos.isNull() )
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
resize_click_pos = ms.termPos;
|
||||
int x2 = resize_click_pos.getX()
|
||||
, y2 = resize_click_pos.getY()
|
||||
|
@ -1659,8 +1651,7 @@ void FDialog::delDialog (FWidget* obj)
|
|||
if ( ! dialog_list || dialog_list->empty() )
|
||||
return;
|
||||
|
||||
widgetList::iterator iter;
|
||||
iter = dialog_list->begin();
|
||||
auto iter = dialog_list->begin();
|
||||
|
||||
while ( iter != dialog_list->end() )
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2017 Markus Gans *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -53,7 +53,7 @@ FDialogListMenu::~FDialogListMenu()
|
|||
//----------------------------------------------------------------------
|
||||
void FDialogListMenu::init()
|
||||
{
|
||||
FMenuItem* menuitem = getItem();
|
||||
auto menuitem = getItem();
|
||||
menuitem->dialog_index = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ void FFileDialog::adjustSize()
|
|||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
std::size_t h;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
auto root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
{
|
||||
|
@ -352,10 +352,9 @@ void FFileDialog::init()
|
|||
static const std::size_t w = 42;
|
||||
static const std::size_t h = 15;
|
||||
int x, y;
|
||||
FWidget* parent_widget;
|
||||
|
||||
setGeometry(1, 1, w, h, false);
|
||||
parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
|
@ -468,14 +467,12 @@ inline bool FFileDialog::pattern_match ( const char* const pattern
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::clear()
|
||||
{
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
|
||||
if ( dir_entries.empty() )
|
||||
return;
|
||||
|
||||
// delete all directory entries;
|
||||
iter = dir_entries.begin();
|
||||
last = dir_entries.end();
|
||||
auto iter = dir_entries.begin();
|
||||
auto last = dir_entries.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -493,9 +490,8 @@ int FFileDialog::numOfDirs()
|
|||
return 0;
|
||||
|
||||
int n = 0;
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
iter = dir_entries.begin();
|
||||
last = dir_entries.end();
|
||||
auto iter = dir_entries.begin();
|
||||
auto last = dir_entries.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -672,9 +668,8 @@ void FFileDialog::dirEntriesToList()
|
|||
if ( dir_entries.empty() )
|
||||
return;
|
||||
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
iter = dir_entries.begin();
|
||||
last = dir_entries.end();
|
||||
auto iter = dir_entries.begin();
|
||||
auto last = dir_entries.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -720,11 +715,10 @@ int FFileDialog::changeDir (const FString& dirname)
|
|||
else if ( ! dir_entries.empty() )
|
||||
{
|
||||
std::size_t i = 1;
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
const char* const baseName = \
|
||||
basename(C_STR(lastdir.c_str()));
|
||||
iter = dir_entries.begin();
|
||||
last = dir_entries.end();
|
||||
auto iter = dir_entries.begin();
|
||||
auto last = dir_entries.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -812,10 +806,9 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
|||
|
||||
if ( ! dir_entries.empty() )
|
||||
{
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
const FString& input = filename.getText().trim();
|
||||
iter = dir_entries.begin();
|
||||
last = dir_entries.end();
|
||||
auto iter = dir_entries.begin();
|
||||
auto last = dir_entries.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ void FKeyboard::fetchKeyCode()
|
|||
//----------------------------------------------------------------------
|
||||
const FString FKeyboard::getKeyName (FKey keynum)
|
||||
{
|
||||
for (int i = 0; fc::FkeyName[i].string[0] != 0; i++)
|
||||
for (std::size_t i = 0; fc::FkeyName[i].string[0] != 0; i++)
|
||||
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
|
||||
return FString(fc::FkeyName[i].string);
|
||||
|
||||
|
@ -215,7 +215,7 @@ inline FKey FKeyboard::getTermcapKey()
|
|||
if ( ! key_map )
|
||||
return NOT_SET;
|
||||
|
||||
for (int i = 0; key_map[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; key_map[i].tname[0] != 0; i++)
|
||||
{
|
||||
char* k = key_map[i].string;
|
||||
std::size_t len = ( k ) ? std::strlen(k) : 0;
|
||||
|
@ -245,7 +245,7 @@ inline FKey FKeyboard::getMetaKey()
|
|||
|
||||
assert ( FIFO_BUF_SIZE > 0 );
|
||||
|
||||
for (int i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
||||
for (std::size_t i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
||||
{
|
||||
char* kmeta = fc::Fmetakey[i].string; // The string is never null
|
||||
std::size_t len = std::strlen(kmeta);
|
||||
|
@ -419,7 +419,7 @@ void FKeyboard::parseKeyBuffer()
|
|||
{
|
||||
if ( bytesread + fifo_offset <= int(FIFO_BUF_SIZE) )
|
||||
{
|
||||
for (int i = 0; i < bytesread; i++)
|
||||
for (std::size_t i = 0; i < std::size_t(bytesread); i++)
|
||||
{
|
||||
fifo_buf[fifo_offset] = read_buf[i];
|
||||
fifo_offset++;
|
||||
|
|
|
@ -233,7 +233,7 @@ void FLabel::hide()
|
|||
{
|
||||
FColor fg, bg;
|
||||
std::size_t size;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
|
||||
|
@ -254,7 +254,7 @@ void FLabel::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
|
@ -269,7 +269,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
if ( ! (isEnabled() && accel_widget) )
|
||||
{
|
||||
// send click to the parent widget
|
||||
if ( FWidget* parent = getParentWidget() )
|
||||
if ( auto parent = getParentWidget() )
|
||||
{
|
||||
int b = ev->getButton();
|
||||
const FPoint& tp = ev->getTermPos();
|
||||
|
@ -277,7 +277,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
if ( ! accel_widget->hasFocus() )
|
||||
{
|
||||
// focus the accelerator widget
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
accel_widget->setFocus();
|
||||
|
@ -321,7 +321,7 @@ void FLabel::onAccel (FAccelEvent* ev)
|
|||
|
||||
if ( ! accel_widget->hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
||||
if ( focused_widget && focused_widget->isWidget() )
|
||||
{
|
||||
|
@ -357,7 +357,7 @@ void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void FLabel::init()
|
||||
{
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
unsetFocusable();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -523,8 +523,8 @@ void FLabel::drawMultiLine()
|
|||
return;
|
||||
}
|
||||
|
||||
wchar_t* src = const_cast<wchar_t*>(multiline_text[y].wc_str());
|
||||
wchar_t* dest = const_cast<wchar_t*>(label_text);
|
||||
auto src = const_cast<wchar_t*>(multiline_text[y].wc_str());
|
||||
auto dest = const_cast<wchar_t*>(label_text);
|
||||
|
||||
if ( ! hotkey_printed )
|
||||
hotkeypos = getHotkeyPos(src, dest, length);
|
||||
|
|
|
@ -273,7 +273,7 @@ void FLineEdit::hide()
|
|||
{
|
||||
std::size_t s, size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
|
||||
|
@ -295,7 +295,7 @@ void FLineEdit::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (std::size_t y = 0; y < getHeight() + s; y++)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
@ -558,7 +558,7 @@ void FLineEdit::onAccel (FAccelEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
||||
if ( focused_widget && focused_widget->isWidget() )
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ void FListBox::setCurrentItem (listBoxItems::iterator iter)
|
|||
void FListBox::showInsideBrackets ( std::size_t index
|
||||
, fc::brackets_type b )
|
||||
{
|
||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
||||
auto iter = index2iterator(index - 1);
|
||||
iter->brackets = b;
|
||||
|
||||
if ( b == fc::NoBrackets )
|
||||
|
@ -217,7 +217,7 @@ void FListBox::hide()
|
|||
{
|
||||
std::size_t n, size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -238,7 +238,7 @@ void FListBox::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ void FListBox::remove (std::size_t item)
|
|||
element_count = getCount();
|
||||
max_line_width = 0;
|
||||
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
auto iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ void FListBox::clear()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
std::memset (blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
@ -750,7 +750,7 @@ void FListBox::adjustYOffset (std::size_t element_count)
|
|||
{
|
||||
std::size_t height = getClientHeight();
|
||||
|
||||
if ( height == 0 )
|
||||
if ( height == 0 || element_count == 0 )
|
||||
return;
|
||||
|
||||
if ( yoffset > int(element_count - height) )
|
||||
|
@ -774,9 +774,6 @@ void FListBox::adjustSize()
|
|||
std::size_t width = getClientWidth();
|
||||
std::size_t height = getClientHeight();
|
||||
|
||||
if ( element_count == 0 )
|
||||
return;
|
||||
|
||||
adjustYOffset (element_count);
|
||||
|
||||
int vmax = ( element_count > height )
|
||||
|
@ -943,14 +940,11 @@ void FListBox::drawHeadline()
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::drawList()
|
||||
{
|
||||
std::size_t start, num;
|
||||
listBoxItems::iterator iter;
|
||||
|
||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||
return;
|
||||
|
||||
start = 0;
|
||||
num = uInt(getHeight() - 2);
|
||||
std::size_t start = 0;
|
||||
std::size_t num = uInt(getHeight() - 2);
|
||||
|
||||
if ( num > getCount() )
|
||||
num = getCount();
|
||||
|
@ -966,7 +960,7 @@ void FListBox::drawList()
|
|||
num = std::max(last_pos, current_pos) + 1;
|
||||
}
|
||||
|
||||
iter = index2iterator(start + std::size_t(yoffset));
|
||||
auto iter = index2iterator(start + std::size_t(yoffset));
|
||||
|
||||
for (std::size_t y = start; y < num && iter != itemlist.end() ; y++)
|
||||
{
|
||||
|
@ -1277,7 +1271,7 @@ inline void FListBox::getWidgetFocus()
|
|||
if ( hasFocus() )
|
||||
return;
|
||||
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
@ -1688,7 +1682,7 @@ inline bool FListBox::keySpace()
|
|||
{
|
||||
inc_search += L' ';
|
||||
bool inc_found = false;
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
auto iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
|
@ -1763,7 +1757,7 @@ inline bool FListBox::keyBackspace()
|
|||
|
||||
if ( inc_len > 1 )
|
||||
{
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
auto iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
|
@ -1798,7 +1792,7 @@ inline bool FListBox::keyIncSearchInput (FKey key)
|
|||
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
bool inc_found = false;
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
auto iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
|
|
|
@ -45,10 +45,8 @@ bool sortDescendingByNumber (const FObject*, const FObject*);
|
|||
//----------------------------------------------------------------------
|
||||
long firstNumberFromString (const FString& str)
|
||||
{
|
||||
const FString::iterator last = str.end();
|
||||
FString::iterator iter = str.begin();
|
||||
FString::iterator first_pos;
|
||||
FString::iterator last_pos;
|
||||
auto last = str.end();
|
||||
auto iter = str.begin();
|
||||
std::size_t pos;
|
||||
std::size_t length;
|
||||
long number;
|
||||
|
@ -66,7 +64,7 @@ long firstNumberFromString (const FString& str)
|
|||
++iter;
|
||||
}
|
||||
|
||||
first_pos = iter;
|
||||
auto first_pos = iter;
|
||||
|
||||
if ( first_pos == last )
|
||||
return 0;
|
||||
|
@ -79,14 +77,14 @@ long firstNumberFromString (const FString& str)
|
|||
++iter;
|
||||
}
|
||||
|
||||
last_pos = iter;
|
||||
auto last_pos = iter;
|
||||
|
||||
if ( last_pos == last )
|
||||
return 0;
|
||||
|
||||
pos = std::size_t(std::distance(str.begin(), first_pos)) + 1;
|
||||
length = std::size_t(std::distance(first_pos, last_pos));
|
||||
const FString num_str = str.mid(pos, length);
|
||||
const auto& num_str = str.mid(pos, length);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -103,11 +101,11 @@ long firstNumberFromString (const FString& str)
|
|||
//----------------------------------------------------------------------
|
||||
bool sortAscendingByName (const FObject* lhs, const FObject* rhs)
|
||||
{
|
||||
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const auto l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const auto r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
const FString l_string = l_item->getText(column);
|
||||
const FString r_string = r_item->getText(column);
|
||||
const auto& l_string = l_item->getText(column);
|
||||
const auto& r_string = r_item->getText(column);
|
||||
|
||||
// lhs < rhs
|
||||
return bool( strcasecmp(l_string.c_str(), r_string.c_str()) < 0 );
|
||||
|
@ -116,11 +114,11 @@ bool sortAscendingByName (const FObject* lhs, const FObject* rhs)
|
|||
//----------------------------------------------------------------------
|
||||
bool sortDescendingByName (const FObject* lhs, const FObject* rhs)
|
||||
{
|
||||
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const auto l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const auto r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
const FString l_string = l_item->getText(column);
|
||||
const FString r_string = r_item->getText(column);
|
||||
const auto& l_string = l_item->getText(column);
|
||||
const auto& r_string = r_item->getText(column);
|
||||
|
||||
// lhs > rhs
|
||||
return bool( strcasecmp(l_string.c_str(), r_string.c_str()) > 0 );
|
||||
|
@ -129,11 +127,11 @@ bool sortDescendingByName (const FObject* lhs, const FObject* rhs)
|
|||
//----------------------------------------------------------------------
|
||||
bool sortAscendingByNumber (const FObject* lhs, const FObject* rhs)
|
||||
{
|
||||
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const auto l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const auto r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
const long l_number = firstNumberFromString(l_item->getText(column));
|
||||
const long r_number = firstNumberFromString(r_item->getText(column));
|
||||
const auto& l_number = firstNumberFromString(l_item->getText(column));
|
||||
const auto& r_number = firstNumberFromString(r_item->getText(column));
|
||||
|
||||
// lhs < rhs
|
||||
return bool( l_number < r_number );
|
||||
|
@ -142,11 +140,11 @@ bool sortAscendingByNumber (const FObject* lhs, const FObject* rhs)
|
|||
//----------------------------------------------------------------------
|
||||
bool sortDescendingByNumber (const FObject* lhs, const FObject* rhs)
|
||||
{
|
||||
const FListViewItem* l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const FListViewItem* r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const auto l_item = static_cast<const FListViewItem*>(lhs);
|
||||
const auto r_item = static_cast<const FListViewItem*>(rhs);
|
||||
const int column = l_item->getSortColumn();
|
||||
const long l_number = firstNumberFromString(l_item->getText(column));
|
||||
const long r_number = firstNumberFromString(r_item->getText(column));
|
||||
const auto& l_number = firstNumberFromString(l_item->getText(column));
|
||||
const auto& r_number = firstNumberFromString(r_item->getText(column));
|
||||
|
||||
// lhs > rhs
|
||||
return bool( l_number > r_number );
|
||||
|
@ -164,7 +162,7 @@ FListViewItem::FListViewItem (const FListViewItem& item)
|
|||
, column_list(item.column_list)
|
||||
, data_pointer(item.data_pointer)
|
||||
{
|
||||
FObject* parent = getParent();
|
||||
auto parent = getParent();
|
||||
|
||||
if ( ! parent )
|
||||
return;
|
||||
|
@ -213,7 +211,7 @@ int FListViewItem::getSortColumn() const
|
|||
if ( ! *root )
|
||||
return -1;
|
||||
|
||||
FListView* root_obj = static_cast<FListView*>(*root);
|
||||
auto root_obj = static_cast<FListView*>(*root);
|
||||
return root_obj->getSortColumn();
|
||||
}
|
||||
|
||||
|
@ -233,11 +231,11 @@ FString FListViewItem::getText (int column) const
|
|||
//----------------------------------------------------------------------
|
||||
uInt FListViewItem::getDepth() const
|
||||
{
|
||||
FObject* parent = getParent();
|
||||
auto parent = getParent();
|
||||
|
||||
if ( parent && parent->isInstanceOf("FListViewItem") )
|
||||
{
|
||||
FListViewItem* parent_item = static_cast<FListViewItem*>(parent);
|
||||
auto parent_item = static_cast<FListViewItem*>(parent);
|
||||
return parent_item->getDepth() + 1;
|
||||
}
|
||||
|
||||
|
@ -254,11 +252,11 @@ void FListViewItem::setText (int column, const FString& text)
|
|||
|
||||
// Convert column position to address offset (index)
|
||||
std::size_t index = uInt(column - 1);
|
||||
FObject* parent = getParent();
|
||||
auto parent = getParent();
|
||||
|
||||
if ( parent && parent->isInstanceOf("FListView") )
|
||||
{
|
||||
FListView* listview = static_cast<FListView*>(parent);
|
||||
auto listview = static_cast<FListView*>(parent);
|
||||
|
||||
if ( ! listview->header[index].fixed_width )
|
||||
{
|
||||
|
@ -294,13 +292,13 @@ FObject::FObjectIterator FListViewItem::insert ( FListViewItem* child
|
|||
if ( (*parent_iter)->isInstanceOf("FListView") )
|
||||
{
|
||||
// Add FListViewItem to a FListView parent
|
||||
FListView* parent = static_cast<FListView*>(*parent_iter);
|
||||
auto parent = static_cast<FListView*>(*parent_iter);
|
||||
return parent->insert (child);
|
||||
}
|
||||
else if ( (*parent_iter)->isInstanceOf("FListViewItem") )
|
||||
{
|
||||
// Add FListViewItem to a FListViewItem parent
|
||||
FListViewItem* parent = static_cast<FListViewItem*>(*parent_iter);
|
||||
auto parent = static_cast<FListViewItem*>(*parent_iter);
|
||||
return parent->insert (child);
|
||||
}
|
||||
}
|
||||
|
@ -342,18 +340,8 @@ void FListViewItem::sort (Compare cmp)
|
|||
children.sort(cmp);
|
||||
|
||||
// Sort the sublevels
|
||||
FListViewIterator iter = begin();
|
||||
|
||||
while ( iter != end() )
|
||||
{
|
||||
if ( *iter )
|
||||
{
|
||||
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||
item->sort(cmp);
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& item : children)
|
||||
static_cast<FListViewItem*>(item)->sort(cmp);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -371,7 +359,7 @@ FObject::FObjectIterator FListViewItem::appendItem (FListViewItem* child)
|
|||
void FListViewItem::replaceControlCodes()
|
||||
{
|
||||
// Replace the control codes characters
|
||||
FStringList::iterator iter = column_list.begin();
|
||||
auto iter = column_list.begin();
|
||||
|
||||
while ( iter != column_list.end() )
|
||||
{
|
||||
|
@ -392,11 +380,11 @@ std::size_t FListViewItem::getVisibleLines()
|
|||
return visible_lines;
|
||||
}
|
||||
|
||||
constFObjectIterator iter = FObject::begin();
|
||||
auto iter = FObject::begin();
|
||||
|
||||
while ( iter != FObject::end() )
|
||||
{
|
||||
FListViewItem* child = static_cast<FListViewItem*>(*iter);
|
||||
auto child = static_cast<FListViewItem*>(*iter);
|
||||
visible_lines += child->getVisibleLines();
|
||||
++iter;
|
||||
}
|
||||
|
@ -411,7 +399,7 @@ void FListViewItem::setCheckable (bool on)
|
|||
|
||||
if ( *root )
|
||||
{
|
||||
FListView* root_obj = static_cast<FListView*>(*root);
|
||||
auto root_obj = static_cast<FListView*>(*root);
|
||||
|
||||
if ( ! root_obj->hasCheckableItems() && isCheckable() )
|
||||
root_obj->has_checkable_items = true;
|
||||
|
@ -422,11 +410,11 @@ void FListViewItem::setCheckable (bool on)
|
|||
void FListViewItem::resetVisibleLineCounter()
|
||||
{
|
||||
visible_lines = 0;
|
||||
FObject* parent = getParent();
|
||||
auto parent = getParent();
|
||||
|
||||
if ( parent && parent->isInstanceOf("FListViewItem") )
|
||||
{
|
||||
FListViewItem* parent_item = static_cast<FListViewItem*>(parent);
|
||||
auto parent_item = static_cast<FListViewItem*>(parent);
|
||||
return parent_item->resetVisibleLineCounter();
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +490,7 @@ FListViewIterator& FListViewIterator::operator -= (volatile int n)
|
|||
//----------------------------------------------------------------------
|
||||
void FListViewIterator::nextElement (FObjectIterator& iter)
|
||||
{
|
||||
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||
auto item = static_cast<FListViewItem*>(*iter);
|
||||
|
||||
if ( item->isExpandable() && item->isExpand() )
|
||||
{
|
||||
|
@ -517,7 +505,7 @@ void FListViewIterator::nextElement (FObjectIterator& iter)
|
|||
|
||||
if ( ! iter_path.empty() )
|
||||
{
|
||||
FObjectIterator& parent_iter = iter_path.top();
|
||||
auto& parent_iter = iter_path.top();
|
||||
|
||||
if ( iter == (*parent_iter)->end() )
|
||||
{
|
||||
|
@ -532,12 +520,11 @@ void FListViewIterator::nextElement (FObjectIterator& iter)
|
|||
//----------------------------------------------------------------------
|
||||
void FListViewIterator::prevElement (FObjectIterator& iter)
|
||||
{
|
||||
FListViewItem* item;
|
||||
FObjectIterator start_iter = iter;
|
||||
auto start_iter = iter;
|
||||
|
||||
if ( ! iter_path.empty() )
|
||||
{
|
||||
FObjectIterator& parent_iter = iter_path.top();
|
||||
auto& parent_iter = iter_path.top();
|
||||
|
||||
if ( start_iter == (*parent_iter)->begin() )
|
||||
{
|
||||
|
@ -549,7 +536,7 @@ void FListViewIterator::prevElement (FObjectIterator& iter)
|
|||
}
|
||||
|
||||
--iter;
|
||||
item = static_cast<FListViewItem*>(*iter);
|
||||
auto item = static_cast<FListViewItem*>(*iter);
|
||||
|
||||
if ( iter == start_iter )
|
||||
return;
|
||||
|
@ -571,7 +558,7 @@ void FListViewIterator::parentElement()
|
|||
if ( iter_path.empty() )
|
||||
return;
|
||||
|
||||
FObjectIterator& parent_iter = iter_path.top();
|
||||
auto& parent_iter = iter_path.top();
|
||||
|
||||
while ( node != parent_iter )
|
||||
prevElement(node);
|
||||
|
@ -603,11 +590,11 @@ FListView::~FListView() // destructor
|
|||
std::size_t FListView::getCount()
|
||||
{
|
||||
int n = 0;
|
||||
FObjectIterator iter = itemlist.begin();
|
||||
auto iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||
auto item = static_cast<FListViewItem*>(*iter);
|
||||
n += item->getVisibleLines();
|
||||
++iter;
|
||||
}
|
||||
|
@ -782,13 +769,13 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
|||
if ( (*parent_iter)->isInstanceOf("FListView") )
|
||||
{
|
||||
// Add FListViewItem to a FListView parent
|
||||
FListView* parent = static_cast<FListView*>(*parent_iter);
|
||||
auto parent = static_cast<FListView*>(*parent_iter);
|
||||
item_iter = parent->appendItem (item);
|
||||
}
|
||||
else if ( (*parent_iter)->isInstanceOf("FListViewItem") )
|
||||
{
|
||||
// Add FListViewItem to a FListViewItem parent
|
||||
FListViewItem* parent = static_cast<FListViewItem*>(*parent_iter);
|
||||
auto parent = static_cast<FListViewItem*>(*parent_iter);
|
||||
item_iter = parent->appendItem (item);
|
||||
}
|
||||
else
|
||||
|
@ -833,7 +820,6 @@ FObject::FObjectIterator FListView::insert ( const std::vector<long>& cols
|
|||
, data_ptr d
|
||||
, FObjectIterator parent_iter )
|
||||
{
|
||||
FObjectIterator item_iter;
|
||||
FStringList str_cols;
|
||||
|
||||
if ( ! cols.empty() )
|
||||
|
@ -842,7 +828,7 @@ FObject::FObjectIterator FListView::insert ( const std::vector<long>& cols
|
|||
str_cols.push_back (FString().setNumber(cols[i]));
|
||||
}
|
||||
|
||||
item_iter = insert (str_cols, d, parent_iter);
|
||||
auto item_iter = insert (str_cols, d, parent_iter);
|
||||
|
||||
return item_iter;
|
||||
}
|
||||
|
@ -996,7 +982,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
@ -1026,7 +1012,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
|||
if ( new_pos < int(getCount()) )
|
||||
setRelativePosition (mouse_y - 2);
|
||||
|
||||
const FListViewItem* item = getCurrentItem();
|
||||
const auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view )
|
||||
{
|
||||
|
@ -1084,7 +1070,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
|
|||
else if ( mouse_y > 1 && mouse_y < int(getHeight()) ) // List
|
||||
{
|
||||
int indent = 0;
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view )
|
||||
{
|
||||
|
@ -1191,7 +1177,7 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
|||
if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) )
|
||||
return;
|
||||
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view && item->isExpandable() )
|
||||
{
|
||||
|
@ -1318,7 +1304,7 @@ void FListView::adjustViewport (int element_count)
|
|||
{
|
||||
int height = int(getClientHeight());
|
||||
|
||||
if ( height <= 0 )
|
||||
if ( height <= 0 || element_count == 0 )
|
||||
return;
|
||||
|
||||
if ( element_count < height )
|
||||
|
@ -1361,9 +1347,6 @@ void FListView::adjustSize()
|
|||
std::size_t width = getClientWidth();
|
||||
std::size_t height = getClientHeight();
|
||||
|
||||
if ( element_count == 0 )
|
||||
return;
|
||||
|
||||
adjustViewport (int(element_count));
|
||||
|
||||
int vmax = ( element_count > height )
|
||||
|
@ -1454,18 +1437,8 @@ void FListView::sort (Compare cmp)
|
|||
itemlist.sort(cmp);
|
||||
|
||||
// Sort the sublevels
|
||||
FListViewIterator iter = itemlist.begin();
|
||||
|
||||
while ( iter != itemlist.end() )
|
||||
{
|
||||
if ( *iter )
|
||||
{
|
||||
FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||
item->sort(cmp);
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& item : itemlist)
|
||||
static_cast<FListViewItem*>(item)->sort(cmp);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1551,7 +1524,6 @@ void FListView::draw()
|
|||
void FListView::drawHeadlines()
|
||||
{
|
||||
std::vector<charData>::const_iterator first, last;
|
||||
headerItems::const_iterator iter;
|
||||
|
||||
if ( header.empty()
|
||||
|| getHeight() <= 2
|
||||
|
@ -1559,7 +1531,7 @@ void FListView::drawHeadlines()
|
|||
|| max_line_width < 1 )
|
||||
return;
|
||||
|
||||
iter = header.begin();
|
||||
headerItems::const_iterator iter = header.begin();
|
||||
headerline.clear();
|
||||
|
||||
if ( hasCheckableItems() )
|
||||
|
@ -1602,20 +1574,17 @@ void FListView::drawHeadlines()
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::drawList()
|
||||
{
|
||||
uInt page_height, y;
|
||||
FListViewIterator iter;
|
||||
|
||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||
return;
|
||||
|
||||
y = 0;
|
||||
page_height = uInt(getHeight() - 2);
|
||||
iter = first_visible_line;
|
||||
uInt y = 0;
|
||||
uInt page_height = uInt(getHeight() - 2);
|
||||
auto iter = first_visible_line;
|
||||
|
||||
while ( iter != itemlist.end() && y < page_height )
|
||||
{
|
||||
bool is_current_line = bool( iter == current_iter );
|
||||
const FListViewItem* item = static_cast<FListViewItem*>(*iter);
|
||||
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));
|
||||
|
@ -1941,8 +1910,7 @@ std::size_t FListView::determineLineWidth (FListViewItem* item)
|
|||
std::size_t line_width = padding_space; // leading space
|
||||
uInt column_idx = 0;
|
||||
uInt entries = uInt(item->column_list.size());
|
||||
headerItems::iterator header_iter;
|
||||
header_iter = header.begin();
|
||||
headerItems::iterator header_iter = header.begin();
|
||||
|
||||
while ( header_iter != header.end() )
|
||||
{
|
||||
|
@ -2039,8 +2007,7 @@ void FListView::mouseHeaderClicked()
|
|||
int checkbox_offset = ( hasCheckableItems() ) ? 4 : 0;
|
||||
int header_start = 2 + checkbox_offset;
|
||||
int header_pos = clicked_header_pos.getX() + xoffset;
|
||||
headerItems::const_iterator iter;
|
||||
iter = header.begin();
|
||||
headerItems::const_iterator iter = header.begin();
|
||||
|
||||
while ( iter != header.end() )
|
||||
{
|
||||
|
@ -2237,7 +2204,7 @@ void FListView::processChanged()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FListView::keySpace()
|
||||
{
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( item->isCheckable() )
|
||||
item->setChecked(! item->isChecked());
|
||||
|
@ -2247,7 +2214,7 @@ inline void FListView::keySpace()
|
|||
inline void FListView::keyLeft (int& first_line_position_before)
|
||||
{
|
||||
int position_before = current_iter.getPosition();
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( xoffset == 0 )
|
||||
{
|
||||
|
@ -2264,7 +2231,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
|
|||
else if ( item->hasParent() )
|
||||
{
|
||||
// Jump to parent element
|
||||
FObject* parent = item->getParent();
|
||||
auto parent = item->getParent();
|
||||
|
||||
if ( parent->isInstanceOf("FListViewItem") )
|
||||
{
|
||||
|
@ -2301,7 +2268,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
|
|||
inline void FListView::keyRight (int& first_line_position_before)
|
||||
{
|
||||
int xoffset_end = int(max_line_width) - int(getClientWidth());
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view && item->isExpandable() && ! item->isExpand() )
|
||||
{
|
||||
|
@ -2344,7 +2311,7 @@ inline void FListView::keyEnd()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FListView::keyPlus()
|
||||
{
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view && item->isExpandable() && ! item->isExpand() )
|
||||
{
|
||||
|
@ -2359,7 +2326,7 @@ inline bool FListView::keyPlus()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FListView::keyMinus()
|
||||
{
|
||||
FListViewItem* item = getCurrentItem();
|
||||
auto item = getCurrentItem();
|
||||
|
||||
if ( tree_view && item->isExpandable() && item->isExpand() )
|
||||
{
|
||||
|
|
130
src/fmenu.cpp
130
src/fmenu.cpp
|
@ -53,7 +53,7 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FMenu::~FMenu() // destructor
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
|
||||
if ( ! fapp->isQuit() )
|
||||
switchToPrevWindow(this); // Switch to previous window
|
||||
|
@ -100,7 +100,7 @@ void FMenu::hide()
|
|||
|
||||
if ( ! isSubMenu() )
|
||||
{
|
||||
FMenu* openmenu = static_cast<FMenu*>(getOpenMenu());
|
||||
auto openmenu = static_cast<FMenu*>(getOpenMenu());
|
||||
|
||||
if ( openmenu && openmenu != this )
|
||||
openmenu->hide();
|
||||
|
@ -114,18 +114,16 @@ void FMenu::hide()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::onKeyPress (FKeyEvent* ev)
|
||||
{
|
||||
FWidget* menu_bar;
|
||||
|
||||
// looking for menu hotkey
|
||||
if ( hotkeyMenu(ev) )
|
||||
return;
|
||||
|
||||
// looking for menu bar hotkey
|
||||
menu_bar = getMenuBar();
|
||||
auto menu_bar = getMenuBar();
|
||||
|
||||
if ( menu_bar )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(menu_bar);
|
||||
auto mbar = static_cast<FMenuBar*>(menu_bar);
|
||||
|
||||
if ( mbar->hotkeyMenu(ev) )
|
||||
return;
|
||||
|
@ -316,8 +314,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
||||
{
|
||||
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
auto menuitem = static_cast<FMenuItem*>(widget);
|
||||
|
||||
if ( ! has_checkable_items )
|
||||
return;
|
||||
|
@ -328,8 +325,8 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
|
|||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -373,7 +370,7 @@ bool FMenu::isRadioMenuItem (FWidget* w) const
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::isSubMenu() const
|
||||
{
|
||||
FWidget* super = getSuperMenu();
|
||||
auto super = getSuperMenu();
|
||||
|
||||
if ( super && isMenu(super) )
|
||||
return true;
|
||||
|
@ -407,7 +404,7 @@ bool FMenu::isMouseOverSubMenu (const FPoint& termpos)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::isMouseOverSuperMenu (const FPoint& termpos)
|
||||
{
|
||||
FMenu* smenu = superMenuAt (termpos);
|
||||
auto smenu = superMenuAt (termpos);
|
||||
|
||||
if ( smenu )
|
||||
return true;
|
||||
|
@ -448,12 +445,12 @@ void FMenu::init(FWidget* parent)
|
|||
{
|
||||
if ( isMenuBar(parent) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(parent);
|
||||
auto mbar = static_cast<FMenuBar*>(parent);
|
||||
mbar->calculateDimensions();
|
||||
}
|
||||
else if ( isMenu(parent) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(parent);
|
||||
auto smenu = static_cast<FMenu*>(parent);
|
||||
smenu->calculateDimensions();
|
||||
}
|
||||
|
||||
|
@ -467,9 +464,8 @@ void FMenu::init(FWidget* parent)
|
|||
void FMenu::calculateDimensions()
|
||||
{
|
||||
int item_X, item_Y, adjust_X;
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
max_item_width = 10; // minimum width
|
||||
|
||||
// find the maximum item width
|
||||
|
@ -528,16 +524,15 @@ void FMenu::calculateDimensions()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::adjustItems()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
int menu_X, menu_Y;
|
||||
FMenu* menu = (*iter)->getMenu();
|
||||
auto menu = (*iter)->getMenu();
|
||||
|
||||
menu_X = getTermX() + int(max_item_width) + 1;
|
||||
menu_X = menu->adjustX(menu_X);
|
||||
|
@ -632,27 +627,27 @@ void FMenu::hideSubMenus()
|
|||
void FMenu::hideSuperMenus()
|
||||
{
|
||||
// hide all menus to the top
|
||||
FWidget* super = getSuperMenu();
|
||||
auto super = getSuperMenu();
|
||||
|
||||
if ( ! super )
|
||||
return;
|
||||
|
||||
if ( isMenuBar(super) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super);
|
||||
auto mbar = static_cast<FMenuBar*>(super);
|
||||
|
||||
if ( mbar->hasSelectedItem() )
|
||||
mbar->leaveMenuBar();
|
||||
}
|
||||
else if ( isMenu(super) )
|
||||
{
|
||||
FMenu* m = static_cast<FMenu*>(super);
|
||||
auto m = static_cast<FMenu*>(super);
|
||||
m->hide();
|
||||
m->hideSuperMenus();
|
||||
}
|
||||
else if ( isWindowsMenu(super) )
|
||||
{
|
||||
FDialog* dgl = static_cast<FDialog*>(super);
|
||||
auto dgl = static_cast<FDialog*>(super);
|
||||
dgl->leaveMenu();
|
||||
}
|
||||
}
|
||||
|
@ -660,10 +655,9 @@ void FMenu::hideSuperMenus()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
bool focus_changed = false;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||
|
||||
while ( iter != last )
|
||||
|
@ -695,7 +689,7 @@ void FMenu::mouseDownSubmenu (FMenuItem* m_item)
|
|||
if ( ! hasSelectedItem() )
|
||||
return;
|
||||
|
||||
FMenuItem* sel_item = getSelectedItem();
|
||||
auto sel_item = getSelectedItem();
|
||||
|
||||
if ( ! sel_item
|
||||
|| ! sel_item->hasMenu()
|
||||
|
@ -727,7 +721,7 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
|||
return;
|
||||
|
||||
unselectItem();
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
m_item->setSelected();
|
||||
|
@ -743,7 +737,7 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
|||
|
||||
if ( m_item->hasMenu() )
|
||||
{
|
||||
FMenu* sub_menu = m_item->getMenu();
|
||||
auto sub_menu = m_item->getMenu();
|
||||
if ( ! sub_menu->isVisible() )
|
||||
shown_sub_menu = sub_menu;
|
||||
}
|
||||
|
@ -752,9 +746,8 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||
|
||||
while ( iter != last )
|
||||
|
@ -773,7 +766,7 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
|||
// Mouse pointer over item
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
FMenu* sub_menu = (*iter)->getMenu();
|
||||
auto sub_menu = (*iter)->getMenu();
|
||||
if ( ! sub_menu->isVisible() )
|
||||
openSubMenu (sub_menu, SELECT_ITEM);
|
||||
else if ( opened_sub_menu )
|
||||
|
@ -812,9 +805,8 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||
|
||||
while ( iter != last )
|
||||
|
@ -843,7 +835,7 @@ void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
|||
return;
|
||||
|
||||
// Mouse pointer over item
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
m_item->setSelected();
|
||||
|
@ -860,7 +852,7 @@ void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
|||
// Sub menu handling
|
||||
if ( m_item->hasMenu() )
|
||||
{
|
||||
FMenu* sub_menu = m_item->getMenu();
|
||||
auto sub_menu = m_item->getMenu();
|
||||
|
||||
if ( ! sub_menu->isVisible() )
|
||||
shown_sub_menu = sub_menu;
|
||||
|
@ -930,7 +922,7 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
opened_sub_menu->mouse_down = true;
|
||||
setClickedWidget(opened_sub_menu);
|
||||
opened_sub_menu->onMouseMove(_ev);
|
||||
|
@ -947,14 +939,14 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev)
|
|||
{
|
||||
// Mouse event handover to super-menu
|
||||
|
||||
FMenu* smenu = superMenuAt (ev->getTermPos());
|
||||
auto smenu = superMenuAt (ev->getTermPos());
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = smenu->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
smenu->mouse_down = true;
|
||||
setClickedWidget(smenu);
|
||||
smenu->onMouseMove(_ev);
|
||||
|
@ -971,16 +963,16 @@ void FMenu::passEventToMenuBar (FMouseEvent*& ev)
|
|||
{
|
||||
// Mouse event handover to the menu bar
|
||||
|
||||
FWidget* menu_bar = getMenuBar();
|
||||
auto menu_bar = getMenuBar();
|
||||
const FPoint& t = ev->getTermPos();
|
||||
const FPoint& p = menu_bar->termToWidgetPos(t);
|
||||
int b = ev->getButton();
|
||||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
setClickedWidget(menu_bar);
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(menu_bar);
|
||||
auto mbar = static_cast<FMenuBar*>(menu_bar);
|
||||
mbar->mouse_down = true;
|
||||
mbar->onMouseMove(_ev);
|
||||
delete _ev;
|
||||
|
@ -996,7 +988,7 @@ bool FMenu::containsMenuStructure (int x, int y)
|
|||
{
|
||||
// Check mouse click position for item, menu and all sub menus
|
||||
|
||||
FMenuItem* si = getSelectedItem();
|
||||
auto si = getSelectedItem();
|
||||
|
||||
if ( getTermGeometry().contains(x, y) )
|
||||
return true;
|
||||
|
@ -1016,7 +1008,7 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
|||
if ( getTermGeometry().contains(x, y) )
|
||||
return 0;
|
||||
|
||||
FWidget* super = getSuperMenu();
|
||||
auto super = getSuperMenu();
|
||||
|
||||
if ( super && isMenu(super) )
|
||||
{
|
||||
|
@ -1024,7 +1016,7 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
|||
return static_cast<FMenu*>(super);
|
||||
else
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
auto smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
|
||||
if ( smenu )
|
||||
return smenu->superMenuAt(x, y);
|
||||
|
@ -1037,17 +1029,15 @@ FMenu* FMenu::superMenuAt (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::selectNextItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isSelected() )
|
||||
{
|
||||
FMenuItem* next;
|
||||
std::vector<FMenuItem*>::const_iterator next_element;
|
||||
next_element = iter;
|
||||
auto next_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1087,9 +1077,8 @@ bool FMenu::selectNextItem()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::selectPrevItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, first;
|
||||
iter = item_list.end();
|
||||
first = item_list.begin();
|
||||
auto iter = item_list.end();
|
||||
auto first = item_list.begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1098,8 +1087,7 @@ bool FMenu::selectPrevItem()
|
|||
if ( (*iter)->isSelected() )
|
||||
{
|
||||
FMenuItem* prev;
|
||||
std::vector<FMenuItem*>::const_iterator prev_element;
|
||||
prev_element = iter;
|
||||
auto prev_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1138,7 +1126,7 @@ bool FMenu::selectPrevItem()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::keypressMenuBar (FKeyEvent* ev)
|
||||
{
|
||||
FMenuBar* mbar = getMenuBar();
|
||||
auto mbar = getMenuBar();
|
||||
|
||||
if ( mbar )
|
||||
mbar->onKeyPress(ev);
|
||||
|
@ -1147,9 +1135,8 @@ void FMenu::keypressMenuBar (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -1172,7 +1159,7 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
|||
{
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
FMenu* sub_menu = (*iter)->getMenu();
|
||||
auto sub_menu = (*iter)->getMenu();
|
||||
unselectItem();
|
||||
(*iter)->setSelected();
|
||||
setSelectedItem (*iter);
|
||||
|
@ -1248,10 +1235,9 @@ void FMenu::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenu::drawItems()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
int y = 0;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -1566,7 +1552,7 @@ inline void FMenu::keyLeft (FKeyEvent* ev)
|
|||
{
|
||||
if ( isSubMenu() )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
auto smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
hideSubMenus();
|
||||
hide();
|
||||
|
||||
|
@ -1590,7 +1576,7 @@ inline void FMenu::keyRight (FKeyEvent* ev)
|
|||
{
|
||||
if ( hasSelectedItem() && getSelectedItem()->hasMenu() )
|
||||
{
|
||||
FMenu* sub_menu = getSelectedItem()->getMenu();
|
||||
auto sub_menu = getSelectedItem()->getMenu();
|
||||
|
||||
if ( ! sub_menu->isVisible() )
|
||||
openSubMenu (sub_menu, SELECT_ITEM);
|
||||
|
@ -1607,7 +1593,7 @@ inline void FMenu::keyEnter()
|
|||
if ( ! hasSelectedItem() )
|
||||
return;
|
||||
|
||||
FMenuItem* sel_item = getSelectedItem();
|
||||
auto sel_item = getSelectedItem();
|
||||
|
||||
if ( sel_item->hasMenu() )
|
||||
openSubMenu (sel_item->getMenu(), SELECT_ITEM);
|
||||
|
@ -1629,7 +1615,7 @@ inline void FMenu::keyEscape()
|
|||
|
||||
if ( isSubMenu() )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
auto smenu = static_cast<FMenu*>(getSuperMenu());
|
||||
|
||||
if ( smenu->getSelectedItem() )
|
||||
smenu->getSelectedItem()->setFocus();
|
||||
|
@ -1638,7 +1624,7 @@ inline void FMenu::keyEscape()
|
|||
}
|
||||
else
|
||||
{
|
||||
FWidget* super = getSuperMenu();
|
||||
auto super = getSuperMenu();
|
||||
hideSuperMenus();
|
||||
|
||||
if ( getStatusBar() )
|
||||
|
|
143
src/fmenubar.cpp
143
src/fmenubar.cpp
|
@ -59,13 +59,12 @@ void FMenuBar::resetMenu()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::hide()
|
||||
{
|
||||
FColor fg, bg;
|
||||
FWindow::hide();
|
||||
fg = wc.term_fg;
|
||||
bg = wc.term_bg;
|
||||
FColor fg = wc.term_fg;
|
||||
FColor bg = wc.term_bg;
|
||||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
char* blank = createBlankArray (screenWidth + 1);
|
||||
auto blank = createBlankArray (screenWidth + 1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
|
@ -89,15 +88,14 @@ void FMenuBar::onKeyPress (FKeyEvent* ev)
|
|||
case fc::Fkey_down:
|
||||
if ( hasSelectedItem() )
|
||||
{
|
||||
FMenuItem* sel_item = getSelectedItem();
|
||||
auto sel_item = getSelectedItem();
|
||||
|
||||
if ( sel_item->hasMenu() )
|
||||
{
|
||||
FMenuItem* first_item;
|
||||
FMenu* menu = sel_item->getMenu();
|
||||
auto menu = sel_item->getMenu();
|
||||
sel_item->openMenu();
|
||||
menu->selectFirstItem();
|
||||
first_item = menu->getSelectedItem();
|
||||
auto first_item = menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -219,11 +217,11 @@ void FMenuBar::onAccel (FAccelEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
|
||||
{
|
||||
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
|
||||
auto menuitem = static_cast<FMenuItem*>(widget);
|
||||
|
||||
if ( menuitem->hasMenu() )
|
||||
{
|
||||
FMenu* menu = menuitem->getMenu();
|
||||
auto menu = menuitem->getMenu();
|
||||
menu->hide();
|
||||
menu->hideSubMenus();
|
||||
}
|
||||
|
@ -234,8 +232,8 @@ void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::init()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
std::size_t w = r->getWidth();
|
||||
auto r = getRootWidget();
|
||||
auto w = r->getWidth();
|
||||
// initialize geometry values
|
||||
setGeometry (1, 1, w, 1, false);
|
||||
setAlwaysOnTop();
|
||||
|
@ -257,9 +255,8 @@ void FMenuBar::calculateDimensions()
|
|||
{
|
||||
int item_X = 1;
|
||||
int item_Y = 1;
|
||||
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
// find the maximum item width
|
||||
while ( iter != last )
|
||||
|
@ -283,17 +280,15 @@ void FMenuBar::calculateDimensions()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenuBar::selectNextItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isSelected() )
|
||||
{
|
||||
FMenuItem* next;
|
||||
std::vector<FMenuItem*>::const_iterator next_element;
|
||||
next_element = iter;
|
||||
auto next_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -319,11 +314,10 @@ bool FMenuBar::selectNextItem()
|
|||
|
||||
if ( drop_down && next->hasMenu() )
|
||||
{
|
||||
FMenuItem* first_item;
|
||||
FMenu* menu = next->getMenu();
|
||||
auto menu = next->getMenu();
|
||||
next->openMenu();
|
||||
menu->selectFirstItem();
|
||||
first_item = menu->getSelectedItem();
|
||||
auto first_item = menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -348,9 +342,8 @@ bool FMenuBar::selectNextItem()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenuBar::selectPrevItem()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, first;
|
||||
iter = item_list.end();
|
||||
first = item_list.begin();
|
||||
auto iter = item_list.end();
|
||||
auto first = item_list.begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -359,8 +352,7 @@ bool FMenuBar::selectPrevItem()
|
|||
if ( (*iter)->isSelected() )
|
||||
{
|
||||
FMenuItem* prev;
|
||||
std::vector<FMenuItem*>::const_iterator prev_element;
|
||||
prev_element = iter;
|
||||
auto prev_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -385,11 +377,10 @@ bool FMenuBar::selectPrevItem()
|
|||
|
||||
if ( drop_down && prev->hasMenu() )
|
||||
{
|
||||
FMenuItem* first_item;
|
||||
FMenu* menu = prev->getMenu();
|
||||
auto menu = prev->getMenu();
|
||||
prev->openMenu();
|
||||
menu->selectFirstItem();
|
||||
first_item = menu->getSelectedItem();
|
||||
auto first_item = menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -414,9 +405,8 @@ bool FMenuBar::selectPrevItem()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -427,7 +417,7 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
|||
|
||||
if ( fc::Fmkey_meta + FKey(std::tolower(hotkey)) == key )
|
||||
{
|
||||
FMenuItem* sel_item = getSelectedItem();
|
||||
auto sel_item = getSelectedItem();
|
||||
|
||||
if ( sel_item && sel_item->hasMenu() )
|
||||
sel_item->getMenu()->unselectItem();
|
||||
|
@ -436,14 +426,13 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
|||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
FMenuItem* first_item;
|
||||
FMenu* menu = (*iter)->getMenu();
|
||||
auto menu = (*iter)->getMenu();
|
||||
(*iter)->setSelected();
|
||||
setSelectedItem(*iter);
|
||||
(*iter)->setFocus();
|
||||
(*iter)->openMenu();
|
||||
menu->selectFirstItem();
|
||||
first_item = menu->getSelectedItem();
|
||||
auto first_item = menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -509,9 +498,6 @@ void FMenuBar::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuBar::drawItems()
|
||||
{
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
std::size_t x = 1;
|
||||
|
||||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
|
@ -521,8 +507,9 @@ void FMenuBar::drawItems()
|
|||
setReverse(true);
|
||||
|
||||
screenWidth = getDesktopWidth();
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
std::size_t x = 1;
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -718,9 +705,8 @@ void FMenuBar::adjustItems()
|
|||
{
|
||||
int item_X = 1;
|
||||
int item_Y = 1;
|
||||
std::vector<FMenuItem*>::const_iterator last, iter;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -729,7 +715,7 @@ void FMenuBar::adjustItems()
|
|||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
FMenu* menu = (*iter)->getMenu();
|
||||
auto menu = (*iter)->getMenu();
|
||||
|
||||
// set menu position
|
||||
menu->setPos (menu->adjustX(item_X), item_Y);
|
||||
|
@ -749,7 +735,7 @@ void FMenuBar::selectMenuItem (FMenuItem* item)
|
|||
if ( ! item->isEnabled() || item->isSelected() )
|
||||
return;
|
||||
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
item->setSelected();
|
||||
|
@ -764,7 +750,7 @@ void FMenuBar::selectMenuItem (FMenuItem* item)
|
|||
|
||||
if ( item->hasMenu() )
|
||||
{
|
||||
FMenu* menu = item->getMenu();
|
||||
auto menu = item->getMenu();
|
||||
|
||||
if ( menu->hasSelectedItem() )
|
||||
{
|
||||
|
@ -781,13 +767,12 @@ bool FMenuBar::activateMenu (FMenuItem* item)
|
|||
if ( ! item->hasMenu() )
|
||||
return false;
|
||||
|
||||
FMenu* menu = item->getMenu();
|
||||
auto menu = item->getMenu();
|
||||
|
||||
if ( ! menu->hasSelectedItem() )
|
||||
{
|
||||
FMenuItem* first_item;
|
||||
menu->selectFirstItem();
|
||||
first_item = menu->getSelectedItem();
|
||||
auto first_item = menu->getSelectedItem();
|
||||
|
||||
if ( first_item )
|
||||
first_item->setFocus();
|
||||
|
@ -842,20 +827,16 @@ void FMenuBar::mouseDownOverList (FMouseEvent* ev)
|
|||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
int mouse_x, mouse_y;
|
||||
focus_changed = false;
|
||||
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
int x1 = (*iter)->getX();
|
||||
int x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_y == 1 )
|
||||
{
|
||||
|
@ -894,18 +875,15 @@ void FMenuBar::mouseUpOverList (FMouseEvent* ev)
|
|||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
int mouse_x, mouse_y;
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
int x1 = (*iter)->getX();
|
||||
int x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_y == 1
|
||||
&& mouse_x >= x1
|
||||
|
@ -939,23 +917,20 @@ void FMenuBar::mouseMoveOverList (FMouseEvent* ev)
|
|||
if ( item_list.empty() )
|
||||
return;
|
||||
|
||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||
int mouse_x, mouse_y;
|
||||
bool mouse_over_menubar = false;
|
||||
focus_changed = false;
|
||||
iter = item_list.begin();
|
||||
last = item_list.end();
|
||||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
bool mouse_over_menubar = false;
|
||||
auto iter = item_list.begin();
|
||||
auto last = item_list.end();
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( getTermGeometry().contains(ev->getTermPos()) )
|
||||
mouse_over_menubar = true;
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
int x1 = (*iter)->getX();
|
||||
int x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x < x2
|
||||
|
@ -1003,8 +978,8 @@ void FMenuBar::passEventToMenu (FMouseEvent*& ev)
|
|||
return;
|
||||
|
||||
// Mouse event handover to the menu
|
||||
FMenu* menu = getSelectedItem()->getMenu();
|
||||
const FRect& menu_geometry = menu->getTermGeometry();
|
||||
auto menu = getSelectedItem()->getMenu();
|
||||
const auto& menu_geometry = menu->getTermGeometry();
|
||||
|
||||
if ( menu->getCount() > 0
|
||||
&& menu_geometry.contains(ev->getTermPos()) )
|
||||
|
@ -1015,7 +990,7 @@ void FMenuBar::passEventToMenu (FMouseEvent*& ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, t, b);
|
||||
menu->mouse_down = true;
|
||||
setClickedWidget(menu);
|
||||
menu->onMouseMove(_ev);
|
||||
|
|
|
@ -65,7 +65,7 @@ FMenuItem::~FMenuItem() // destructor
|
|||
{
|
||||
if ( super_menu && (isMenu(super_menu) || isMenuBar(super_menu)) )
|
||||
{
|
||||
FMenuList* menu_list = getFMenuList(*super_menu);
|
||||
auto menu_list = getFMenuList(*super_menu);
|
||||
|
||||
if ( menu_list )
|
||||
menu_list->remove(this);
|
||||
|
@ -84,7 +84,7 @@ FMenuItem::~FMenuItem() // destructor
|
|||
bool FMenuItem::setEnable (bool on)
|
||||
{
|
||||
FWidget::setEnable(on);
|
||||
FWidget* super = getSuperMenu();
|
||||
auto super = getSuperMenu();
|
||||
|
||||
if ( on )
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ bool FMenuItem::setFocus (bool on)
|
|||
{
|
||||
if ( ! selected )
|
||||
{
|
||||
FMenuList* menu_list = getFMenuList(*getSuperMenu());
|
||||
auto menu_list = getFMenuList(*getSuperMenu());
|
||||
setSelected();
|
||||
|
||||
if ( menu_list )
|
||||
|
@ -127,18 +127,18 @@ bool FMenuItem::setFocus (bool on)
|
|||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
|
||||
FWidget* parent = getSuperMenu();
|
||||
auto parent = getSuperMenu();
|
||||
|
||||
if ( isMenuBar(parent) )
|
||||
{
|
||||
FMenuBar* menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
auto menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
|
||||
if ( menubar_ptr )
|
||||
menubar_ptr->redraw();
|
||||
}
|
||||
else if ( isMenu(parent) )
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(parent);
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->redraw();
|
||||
|
@ -198,7 +198,7 @@ void FMenuItem::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuItem::addAccelerator (FKey key, FWidget* obj)
|
||||
{
|
||||
FWidget* root = getRootWidget();
|
||||
auto root = getRootWidget();
|
||||
accelerator accel = { key, obj };
|
||||
|
||||
if ( root && root->accelerator_list )
|
||||
|
@ -209,7 +209,7 @@ void FMenuItem::addAccelerator (FKey key, FWidget* obj)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->calculateDimensions();
|
||||
|
@ -219,14 +219,13 @@ void FMenuItem::addAccelerator (FKey key, FWidget* obj)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuItem::delAccelerator (FWidget* obj)
|
||||
{
|
||||
FWidget* root = getRootWidget();
|
||||
auto root = getRootWidget();
|
||||
|
||||
if ( root
|
||||
&& root->accelerator_list
|
||||
&& ! root->accelerator_list->empty() )
|
||||
{
|
||||
FWidget::Accelerators::iterator iter;
|
||||
iter = root->accelerator_list->begin();
|
||||
auto iter = root->accelerator_list->begin();
|
||||
|
||||
while ( iter != root->accelerator_list->end() )
|
||||
{
|
||||
|
@ -242,7 +241,7 @@ void FMenuItem::delAccelerator (FWidget* obj)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->calculateDimensions();
|
||||
|
@ -255,12 +254,12 @@ void FMenuItem::openMenu()
|
|||
if ( ! hasMenu() )
|
||||
return;
|
||||
|
||||
FMenu* dd_menu = getMenu(); // Drop-down menu
|
||||
auto dd_menu = getMenu(); // Drop-down menu
|
||||
|
||||
if ( dd_menu->isVisible() )
|
||||
return;
|
||||
|
||||
FMenu* openmenu = static_cast<FMenu*>(getOpenMenu());
|
||||
auto openmenu = static_cast<FMenu*>(getOpenMenu());
|
||||
|
||||
if ( openmenu && openmenu != dd_menu )
|
||||
{
|
||||
|
@ -288,13 +287,13 @@ void FMenuItem::onKeyPress (FKeyEvent* ev)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(super_menu);
|
||||
auto smenu = static_cast<FMenu*>(super_menu);
|
||||
smenu->onKeyPress(ev);
|
||||
}
|
||||
|
||||
if ( isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
|
||||
if ( mbar )
|
||||
{
|
||||
|
@ -314,19 +313,19 @@ void FMenuItem::onMouseDoubleClick (FMouseEvent* ev)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(super_menu);
|
||||
auto smenu = static_cast<FMenu*>(super_menu);
|
||||
passMouseEvent (smenu, ev, fc::MouseDoubleClick_Event);
|
||||
}
|
||||
|
||||
if ( isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
passMouseEvent (mbar, ev, fc::MouseDoubleClick_Event);
|
||||
}
|
||||
|
||||
if ( isWindowsMenu(super_menu) )
|
||||
{
|
||||
FDialog* dgl = static_cast<FDialog*>(super_menu);
|
||||
auto dgl = static_cast<FDialog*>(super_menu);
|
||||
passMouseEvent (dgl, ev, fc::MouseDoubleClick_Event);
|
||||
}
|
||||
}
|
||||
|
@ -339,19 +338,19 @@ void FMenuItem::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(super_menu);
|
||||
auto smenu = static_cast<FMenu*>(super_menu);
|
||||
passMouseEvent (smenu, ev, fc::MouseDown_Event);
|
||||
}
|
||||
|
||||
if ( isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
passMouseEvent (mbar, ev, fc::MouseDown_Event);
|
||||
}
|
||||
|
||||
if ( isWindowsMenu(super_menu) )
|
||||
{
|
||||
FDialog* dgl = static_cast<FDialog*>(super_menu);
|
||||
auto dgl = static_cast<FDialog*>(super_menu);
|
||||
passMouseEvent (dgl, ev, fc::MouseDown_Event);
|
||||
}
|
||||
}
|
||||
|
@ -364,19 +363,19 @@ void FMenuItem::onMouseUp (FMouseEvent* ev)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(super_menu);
|
||||
auto smenu = static_cast<FMenu*>(super_menu);
|
||||
passMouseEvent (smenu, ev, fc::MouseUp_Event);
|
||||
}
|
||||
|
||||
if ( isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
passMouseEvent (mbar, ev, fc::MouseUp_Event);
|
||||
}
|
||||
|
||||
if ( isWindowsMenu(super_menu) )
|
||||
{
|
||||
FDialog* dgl = static_cast<FDialog*>(super_menu);
|
||||
auto dgl = static_cast<FDialog*>(super_menu);
|
||||
passMouseEvent (dgl, ev, fc::MouseUp_Event);
|
||||
}
|
||||
}
|
||||
|
@ -389,19 +388,19 @@ void FMenuItem::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
if ( isMenu(super_menu) )
|
||||
{
|
||||
FMenu* smenu = static_cast<FMenu*>(super_menu);
|
||||
auto smenu = static_cast<FMenu*>(super_menu);
|
||||
passMouseEvent (smenu, ev, fc::MouseMove_Event);
|
||||
}
|
||||
|
||||
if ( isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
passMouseEvent (mbar, ev, fc::MouseMove_Event);
|
||||
}
|
||||
|
||||
if ( isWindowsMenu(super_menu) )
|
||||
{
|
||||
FDialog* dgl = static_cast<FDialog*>(super_menu);
|
||||
auto dgl = static_cast<FDialog*>(super_menu);
|
||||
passMouseEvent (dgl, ev, fc::MouseMove_Event);
|
||||
}
|
||||
}
|
||||
|
@ -418,20 +417,17 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
|
||||
if ( menu )
|
||||
{
|
||||
FWidget* focused_widget;
|
||||
|
||||
if ( mbar->getSelectedItem() )
|
||||
mbar->getSelectedItem()->unsetSelected();
|
||||
|
||||
setSelected();
|
||||
mbar->selected_item = this;
|
||||
openMenu();
|
||||
|
||||
focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
||||
if ( focused_widget && focused_widget->isWidget() )
|
||||
{
|
||||
|
@ -482,7 +478,7 @@ void FMenuItem::onFocusOut (FFocusEvent*)
|
|||
|
||||
if ( super_menu && isMenuBar(super_menu) )
|
||||
{
|
||||
FMenuBar* mbar = static_cast<FMenuBar*>(super_menu);
|
||||
auto mbar = static_cast<FMenuBar*>(super_menu);
|
||||
mbar->redraw();
|
||||
}
|
||||
|
||||
|
@ -527,12 +523,12 @@ FMenuList* FMenuItem::getFMenuList (FWidget& widget)
|
|||
|
||||
if ( isMenu(&widget) )
|
||||
{
|
||||
FMenu* Menu = static_cast<FMenu*>(&widget);
|
||||
auto Menu = static_cast<FMenu*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(Menu);
|
||||
}
|
||||
else if ( isMenuBar(&widget) )
|
||||
{
|
||||
FMenuBar* Menubar = static_cast<FMenuBar*>(&widget);
|
||||
auto Menubar = static_cast<FMenuBar*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(Menubar);
|
||||
}
|
||||
else
|
||||
|
@ -560,14 +556,14 @@ void FMenuItem::init (FWidget* parent)
|
|||
if ( accel_key )
|
||||
addAccelerator (accel_key);
|
||||
|
||||
FMenuList* menu_list = getFMenuList(*parent);
|
||||
auto menu_list = getFMenuList(*parent);
|
||||
|
||||
if ( menu_list )
|
||||
menu_list->insert(this);
|
||||
|
||||
if ( isMenuBar(parent) ) // Parent is menubar
|
||||
{
|
||||
FMenuBar* menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
auto menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
menubar_ptr->calculateDimensions();
|
||||
|
||||
if ( hotkey ) // Meta + hotkey
|
||||
|
@ -582,7 +578,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
}
|
||||
else if ( isMenu(parent) ) // Parent is menu
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(parent);
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
menu_ptr->calculateDimensions();
|
||||
}
|
||||
}
|
||||
|
@ -632,12 +628,12 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
|||
|
||||
if ( dialog_list && ! dialog_list->empty() )
|
||||
{
|
||||
widgetList::const_iterator iter, first;
|
||||
iter = first = dialog_list->begin();
|
||||
auto first = dialog_list->begin();
|
||||
auto iter = first;
|
||||
|
||||
while ( iter != dialog_list->end() && *iter )
|
||||
{
|
||||
FDialog* win = static_cast<FDialog*>(*iter);
|
||||
auto win = static_cast<FDialog*>(*iter);
|
||||
|
||||
if ( win )
|
||||
{
|
||||
|
@ -731,11 +727,11 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
|
||||
{
|
||||
FDialog* win = static_cast<FDialog*>(data);
|
||||
auto win = static_cast<FDialog*>(data);
|
||||
|
||||
if ( win )
|
||||
{
|
||||
FWidget* focus = getFocusWidget();
|
||||
auto focus = getFocusWidget();
|
||||
FAccelEvent a_ev (fc::Accelerator_Event, focus);
|
||||
FApplication::sendEvent (win, &a_ev);
|
||||
}
|
||||
|
@ -744,8 +740,8 @@ void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
|
|||
//----------------------------------------------------------------------
|
||||
void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
|
||||
{
|
||||
FDialog* win = static_cast<FDialog*>(widget);
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto win = static_cast<FDialog*>(widget);
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
|
||||
if ( win && fapp )
|
||||
{
|
||||
|
|
|
@ -259,7 +259,7 @@ void FMessageBox::adjustSize()
|
|||
int X, Y;
|
||||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
auto root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ void FMessageBox::adjustButtons()
|
|||
if ( btn_width >= getWidth() - 4 )
|
||||
{
|
||||
std::size_t max_width;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
auto root_widget = getRootWidget();
|
||||
setWidth(btn_width + 5);
|
||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||
setX (int((max_width - getWidth()) / 2));
|
||||
|
|
117
src/fmouse.cpp
117
src/fmouse.cpp
|
@ -1184,15 +1184,8 @@ FMouseControl::FMouseControl()
|
|||
//----------------------------------------------------------------------
|
||||
FMouseControl::~FMouseControl() // destructor
|
||||
{
|
||||
iter = mouse_protocol.begin();
|
||||
|
||||
while ( iter != mouse_protocol.end() )
|
||||
{
|
||||
if ( iter->second )
|
||||
delete iter->second;
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& m : mouse_protocol)
|
||||
delete m.second;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1200,7 +1193,7 @@ FMouseControl::~FMouseControl() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
FPoint& FMouseControl::getPos()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->getPos();
|
||||
|
@ -1221,8 +1214,8 @@ void FMouseControl::clearEvent()
|
|||
#ifdef F_HAVE_LIBGPM
|
||||
void FMouseControl::setStdinNo (int file_descriptor)
|
||||
{
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
gpm_mouse->setStdinNo(file_descriptor);
|
||||
|
@ -1247,15 +1240,9 @@ void FMouseControl::setMaxHeight (short y_max)
|
|||
//----------------------------------------------------------------------
|
||||
void FMouseControl::setDblclickInterval (const long timeout)
|
||||
{
|
||||
iter = mouse_protocol.begin();
|
||||
|
||||
while ( iter != mouse_protocol.end() )
|
||||
{
|
||||
if ( iter->second )
|
||||
iter->second->setDblclickInterval(timeout);
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second )
|
||||
m.second->setDblclickInterval(timeout);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1273,7 +1260,7 @@ void FMouseControl::useXtermMouse (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::hasData()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithData();
|
||||
auto mouse_object = getMouseWithData();
|
||||
|
||||
if ( mouse_object ) // with data
|
||||
return true;
|
||||
|
@ -1284,7 +1271,7 @@ bool FMouseControl::hasData()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::hasEvent()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object ) // with event
|
||||
return true;
|
||||
|
@ -1295,7 +1282,7 @@ bool FMouseControl::hasEvent()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isLeftButtonPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isLeftButtonPressed();
|
||||
|
@ -1306,7 +1293,7 @@ bool FMouseControl::isLeftButtonPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isLeftButtonReleased()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isLeftButtonReleased();
|
||||
|
@ -1317,7 +1304,7 @@ bool FMouseControl::isLeftButtonReleased()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isLeftButtonDoubleClick()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isLeftButtonDoubleClick();
|
||||
|
@ -1328,7 +1315,7 @@ bool FMouseControl::isLeftButtonDoubleClick()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isRightButtonPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isRightButtonPressed();
|
||||
|
@ -1339,7 +1326,7 @@ bool FMouseControl::isRightButtonPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isRightButtonReleased()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isRightButtonReleased();
|
||||
|
@ -1350,7 +1337,7 @@ bool FMouseControl::isRightButtonReleased()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isMiddleButtonPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isMiddleButtonPressed();
|
||||
|
@ -1361,7 +1348,7 @@ bool FMouseControl::isMiddleButtonPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isMiddleButtonReleased()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isMiddleButtonReleased();
|
||||
|
@ -1372,7 +1359,7 @@ bool FMouseControl::isMiddleButtonReleased()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isShiftKeyPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isShiftKeyPressed();
|
||||
|
@ -1383,7 +1370,7 @@ bool FMouseControl::isShiftKeyPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isControlKeyPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isControlKeyPressed();
|
||||
|
@ -1394,7 +1381,7 @@ bool FMouseControl::isControlKeyPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isMetaKeyPressed()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isMetaKeyPressed();
|
||||
|
@ -1405,7 +1392,7 @@ bool FMouseControl::isMetaKeyPressed()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isWheelUp()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isWheelUp();
|
||||
|
@ -1416,7 +1403,7 @@ bool FMouseControl::isWheelUp()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isWheelDown()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isWheelDown();
|
||||
|
@ -1427,7 +1414,7 @@ bool FMouseControl::isWheelDown()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isMoved()
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithEvent();
|
||||
auto mouse_object = getMouseWithEvent();
|
||||
|
||||
if ( mouse_object )
|
||||
return mouse_object->isMoved();
|
||||
|
@ -1438,16 +1425,10 @@ bool FMouseControl::isMoved()
|
|||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isInputDataPending()
|
||||
{
|
||||
iter = mouse_protocol.begin();
|
||||
|
||||
while ( iter != mouse_protocol.end() )
|
||||
{
|
||||
if ( iter->second && iter->second->isInputDataPending() )
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second && m.second->isInputDataPending() )
|
||||
return true;
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1458,8 +1439,8 @@ bool FMouseControl::isGpmMouseEnabled()
|
|||
if ( mouse_protocol.empty() )
|
||||
return false;
|
||||
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
return gpm_mouse->isGpmMouseEnabled();
|
||||
|
@ -1479,8 +1460,8 @@ void FMouseControl::enable()
|
|||
#ifdef F_HAVE_LIBGPM
|
||||
if ( use_gpm_mouse )
|
||||
{
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
use_gpm_mouse = gpm_mouse->enableGpmMouse();
|
||||
|
@ -1497,8 +1478,8 @@ void FMouseControl::disable()
|
|||
#ifdef F_HAVE_LIBGPM
|
||||
if ( use_gpm_mouse )
|
||||
{
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
gpm_mouse->disableGpmMouse();
|
||||
|
@ -1513,7 +1494,7 @@ void FMouseControl::disable()
|
|||
void FMouseControl::setRawData ( FMouse::mouse_type mt
|
||||
, FKeyboard::keybuffer& fifo_buf)
|
||||
{
|
||||
FMouse* mouse = mouse_protocol[mt];
|
||||
auto mouse = mouse_protocol[mt];
|
||||
|
||||
if ( mouse )
|
||||
mouse->setRawData (fifo_buf);
|
||||
|
@ -1522,7 +1503,7 @@ void FMouseControl::setRawData ( FMouse::mouse_type mt
|
|||
//----------------------------------------------------------------------
|
||||
void FMouseControl::processEvent (struct timeval* time)
|
||||
{
|
||||
FMouse* mouse_object = getMouseWithData();
|
||||
auto mouse_object = getMouseWithData();
|
||||
// Clear all old mouse events
|
||||
clearEvent();
|
||||
|
||||
|
@ -1537,8 +1518,8 @@ bool FMouseControl::getGpmKeyPressed (bool pending)
|
|||
if ( mouse_protocol.empty() )
|
||||
return false;
|
||||
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
return gpm_mouse->getGpmKeyPressed(pending);
|
||||
|
@ -1559,8 +1540,8 @@ void FMouseControl::drawGpmPointer()
|
|||
if ( mouse_protocol.empty() )
|
||||
return;
|
||||
|
||||
FMouse* mouse = mouse_protocol[FMouse::gpm];
|
||||
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
auto mouse = mouse_protocol[FMouse::gpm];
|
||||
auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
|
||||
|
||||
if ( gpm_mouse )
|
||||
gpm_mouse->drawGpmPointer();
|
||||
|
@ -1575,15 +1556,9 @@ void FMouseControl::drawGpmPointer()
|
|||
//----------------------------------------------------------------------
|
||||
FMouse* FMouseControl::getMouseWithData()
|
||||
{
|
||||
iter = mouse_protocol.begin();
|
||||
|
||||
while ( iter != mouse_protocol.end() )
|
||||
{
|
||||
if ( iter->second && iter->second->hasData() )
|
||||
return iter->second;
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second && m.second->hasData() )
|
||||
return m.second;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1591,15 +1566,9 @@ FMouse* FMouseControl::getMouseWithData()
|
|||
//----------------------------------------------------------------------
|
||||
FMouse* FMouseControl::getMouseWithEvent()
|
||||
{
|
||||
iter = mouse_protocol.begin();
|
||||
|
||||
while ( iter != mouse_protocol.end() )
|
||||
{
|
||||
if ( iter->second && iter->second->hasEvent() )
|
||||
return iter->second;
|
||||
|
||||
++iter;
|
||||
}
|
||||
for (auto&& m : mouse_protocol)
|
||||
if ( m.second && m.second->hasEvent() )
|
||||
return m.second;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1455,7 +1455,7 @@ inline void FOptiAttr::change_to_default_color ( charData*& term
|
|||
else if ( bg == fc::Default && term->bg_color != fc::Default )
|
||||
{
|
||||
char* sgr_49;
|
||||
char* op = F_orig_pair.cap;
|
||||
auto& op = F_orig_pair.cap;
|
||||
|
||||
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
|
||||
sgr_49 = C_STR(CSI "49;25m");
|
||||
|
@ -1479,11 +1479,11 @@ inline void FOptiAttr::change_current_color ( charData*& term
|
|||
, FColor fg, FColor bg )
|
||||
{
|
||||
char* color_str;
|
||||
char* AF = F_set_a_foreground.cap;
|
||||
char* AB = F_set_a_background.cap;
|
||||
char* Sf = F_set_foreground.cap;
|
||||
char* Sb = F_set_background.cap;
|
||||
char* sp = F_set_color_pair.cap;
|
||||
auto& AF = F_set_a_foreground.cap;
|
||||
auto& AB = F_set_a_background.cap;
|
||||
auto& Sf = F_set_foreground.cap;
|
||||
auto& Sb = F_set_background.cap;
|
||||
auto& sp = F_set_color_pair.cap;
|
||||
bool frev = ( off.attr.bit.reverse
|
||||
|| off.attr.bit.standout
|
||||
|| term->attr.bit.reverse
|
||||
|
@ -1491,8 +1491,8 @@ inline void FOptiAttr::change_current_color ( charData*& term
|
|||
|
||||
if ( AF && AB )
|
||||
{
|
||||
FColor ansi_fg = vga2ansi(fg);
|
||||
FColor ansi_bg = vga2ansi(bg);
|
||||
auto ansi_fg = vga2ansi(fg);
|
||||
auto ansi_bg = vga2ansi(bg);
|
||||
|
||||
if ( (term->fg_color != fg || frev)
|
||||
&& (color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0)) )
|
||||
|
@ -1546,9 +1546,9 @@ inline void FOptiAttr::reset (charData*& attr)
|
|||
bool FOptiAttr::caused_reset_attributes (char cap[], uChar test)
|
||||
{
|
||||
// test if "cap" reset all attributes
|
||||
char* ue = F_exit_underline_mode.cap;
|
||||
char* se = F_exit_standout_mode.cap;
|
||||
char* me = F_exit_attribute_mode.cap;
|
||||
auto& ue = F_exit_underline_mode.cap;
|
||||
auto& se = F_exit_standout_mode.cap;
|
||||
auto& me = F_exit_attribute_mode.cap;
|
||||
|
||||
if ( cap )
|
||||
{
|
||||
|
@ -1578,10 +1578,10 @@ inline bool FOptiAttr::hasCharsetEquivalence()
|
|||
{
|
||||
// Detect if alt charset and pc charset are the same sequences
|
||||
|
||||
char* alt_on = F_enter_alt_charset_mode.cap;
|
||||
char* alt_off = F_enter_pc_charset_mode.cap;
|
||||
char* pc_on = F_enter_pc_charset_mode.cap;
|
||||
char* pc_off = F_exit_pc_charset_mode.cap;
|
||||
auto& alt_on = F_enter_alt_charset_mode.cap;
|
||||
auto& alt_off = F_enter_pc_charset_mode.cap;
|
||||
auto& pc_on = F_enter_pc_charset_mode.cap;
|
||||
auto& pc_off = F_exit_pc_charset_mode.cap;
|
||||
|
||||
if ( alt_on && pc_on && std::strcmp (alt_on, pc_on) == 0 )
|
||||
return true;
|
||||
|
@ -1637,14 +1637,14 @@ inline void FOptiAttr::detectSwitchOff (charData*& term, charData*& next)
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FOptiAttr::switchOn()
|
||||
{
|
||||
charData* on_ptr = &on;
|
||||
auto on_ptr = &on;
|
||||
return hasAttribute(on_ptr);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FOptiAttr::switchOff()
|
||||
{
|
||||
charData* off_ptr = &off;
|
||||
auto off_ptr = &off;
|
||||
return hasAttribute(off_ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,9 +98,8 @@ bool FProgressbar::setShadow (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
void FProgressbar::hide()
|
||||
{
|
||||
std::size_t s, size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
|
||||
|
@ -116,13 +115,13 @@ void FProgressbar::hide()
|
|||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
s = hasShadow() ? 1 : 0;
|
||||
size = getWidth() + s;
|
||||
auto s = hasShadow() ? 1 : 0;
|
||||
auto size = getWidth() + s;
|
||||
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (std::size_t y = 0; y < getHeight() + s; y++)
|
||||
{
|
||||
|
@ -166,7 +165,7 @@ void FProgressbar::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FProgressbar::drawPercentage()
|
||||
{
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2017 Markus Gans *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -62,7 +62,7 @@ void FRadioMenuItem::init (FWidget* parent)
|
|||
|
||||
if ( isMenu(parent) ) // Parent is menu
|
||||
{
|
||||
FMenu* menu_ptr = static_cast<FMenu*>(parent);
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
menu_ptr->has_checkable_items = true;
|
||||
|
||||
addCallback // for this element
|
||||
|
|
|
@ -404,7 +404,7 @@ void FScrollView::draw()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
if ( FWidget* p = getParentWidget() )
|
||||
if ( auto p = getParentWidget() )
|
||||
setColor (p->getForegroundColor(), p->getBackgroundColor());
|
||||
else
|
||||
setColor();
|
||||
|
@ -505,7 +505,7 @@ void FScrollView::onFocusIn (FFocusEvent* in_ev)
|
|||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
FWidget* prev_element = getFocusWidget();
|
||||
auto prev_element = getFocusWidget();
|
||||
|
||||
if ( in_ev->getFocusType() == fc::FocusNextWidget )
|
||||
focusFirstChild();
|
||||
|
@ -530,7 +530,7 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
|
|||
|
||||
FRect widget_geometry;
|
||||
FRect vp_geometry;
|
||||
FWidget* focus = FWidget::getFocusWidget();
|
||||
auto focus = FWidget::getFocusWidget();
|
||||
|
||||
if ( ! focus )
|
||||
return;
|
||||
|
@ -567,11 +567,11 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
|
|||
{
|
||||
// Change the focus away from FScrollView to another widget
|
||||
|
||||
FWidget* focus = FWidget::getFocusWidget();
|
||||
auto focus = FWidget::getFocusWidget();
|
||||
|
||||
if ( out_ev->getFocusType() == fc::FocusNextWidget )
|
||||
{
|
||||
FWidget* last_widget = getLastFocusableWidget(getChildren());
|
||||
auto last_widget = getLastFocusableWidget(getChildren());
|
||||
|
||||
if ( focus == last_widget )
|
||||
{
|
||||
|
@ -581,7 +581,7 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
|
|||
}
|
||||
else if ( out_ev->getFocusType() == fc::FocusPreviousWidget )
|
||||
{
|
||||
FWidget* first_widget = getFirstFocusableWidget(getChildren());
|
||||
auto first_widget = getFirstFocusableWidget(getChildren());
|
||||
|
||||
if ( focus == first_widget )
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ FVTerm::term_area* FScrollView::getPrintArea()
|
|||
if ( use_own_print_area || ! viewport )
|
||||
{
|
||||
child_print_area = nullptr;
|
||||
term_area* area = FWidget::getPrintArea();
|
||||
auto area = FWidget::getPrintArea();
|
||||
child_print_area = viewport;
|
||||
return area;
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ void FScrollView::copy2area()
|
|||
//----------------------------------------------------------------------
|
||||
inline FPoint FScrollView::getViewportCursorPos()
|
||||
{
|
||||
FWidget* window = FWindow::getWindowWidget(this);
|
||||
auto window = FWindow::getWindowWidget(this);
|
||||
|
||||
if ( window )
|
||||
{
|
||||
|
|
|
@ -135,8 +135,7 @@ FStatusBar::~FStatusBar() // destructor
|
|||
// delete all keys
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::iterator iter;
|
||||
iter = key_list.begin();
|
||||
auto iter = key_list.begin();
|
||||
|
||||
while ( iter != key_list.end() )
|
||||
{
|
||||
|
@ -162,9 +161,8 @@ bool FStatusBar::hasActivatedKey()
|
|||
{
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -181,13 +179,12 @@ bool FStatusBar::hasActivatedKey()
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::hide()
|
||||
{
|
||||
FColor fg, bg;
|
||||
FWindow::hide();
|
||||
fg = wc.term_fg;
|
||||
bg = wc.term_bg;
|
||||
FColor fg = wc.term_fg;
|
||||
FColor bg = wc.term_bg;
|
||||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
char* blank = createBlankArray(screenWidth + 1);
|
||||
auto blank = createBlankArray(screenWidth + 1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
|
@ -213,7 +210,7 @@ void FStatusBar::drawMessage()
|
|||
|
||||
if ( hasKeys )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter = key_list.end();
|
||||
auto iter = key_list.end();
|
||||
isLastActiveFocus = bool ( (*(iter - 1))->isActivated()
|
||||
|| (*(iter - 1))->hasMouseFocus() );
|
||||
}
|
||||
|
@ -284,14 +281,12 @@ void FStatusBar::insert (FStatusKey* skey)
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::remove (FStatusKey* skey)
|
||||
{
|
||||
std::vector<FStatusKey*>::iterator iter;
|
||||
|
||||
delAccelerator (skey);
|
||||
|
||||
if ( key_list.empty() )
|
||||
return;
|
||||
|
||||
iter = key_list.begin();
|
||||
auto iter = key_list.begin();
|
||||
|
||||
while ( iter != key_list.end() )
|
||||
{
|
||||
|
@ -340,9 +335,8 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -362,10 +356,9 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
int X = 1;
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -406,10 +399,9 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
|
|||
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
int X = 1;
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -451,11 +443,10 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
if ( mouse_down && ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
bool focus_changed = false;
|
||||
int X = 1;
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -499,11 +490,9 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
|
|||
{
|
||||
if ( ! key_list.empty() )
|
||||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, last;
|
||||
FStatusKey* statuskey = static_cast<FStatusKey*>(widget);
|
||||
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto statuskey = static_cast<FStatusKey*>(widget);
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -522,7 +511,7 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::init()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
std::size_t w = r->getWidth();
|
||||
int h = int(r->getHeight());
|
||||
// initialize geometry values
|
||||
|
@ -550,8 +539,6 @@ void FStatusBar::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::drawKeys()
|
||||
{
|
||||
keyList::const_iterator iter, last;
|
||||
|
||||
screenWidth = getDesktopWidth();
|
||||
x = 1;
|
||||
|
||||
|
@ -566,8 +553,8 @@ void FStatusBar::drawKeys()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
iter = key_list.begin();
|
||||
last = key_list.end();
|
||||
auto iter = key_list.begin();
|
||||
auto last = key_list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -603,7 +590,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
|||
// Draw not active key
|
||||
|
||||
std::size_t txt_length;
|
||||
FStatusKey* item = *iter;
|
||||
auto item = *iter;
|
||||
|
||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
||||
x++;
|
||||
|
@ -663,7 +650,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
|||
// Draw active key
|
||||
|
||||
std::size_t txt_length;
|
||||
FStatusKey* item = *iter;
|
||||
auto item = *iter;
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
|
|
@ -91,7 +91,7 @@ FTerm::~FTerm() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
std::size_t FTerm::getLineNumber()
|
||||
{
|
||||
FRect& term_geometry = data->getTermGeometry();
|
||||
auto& term_geometry = data->getTermGeometry();
|
||||
|
||||
if ( term_geometry.getHeight() == 0 )
|
||||
detectTermSize();
|
||||
|
@ -102,7 +102,7 @@ std::size_t FTerm::getLineNumber()
|
|||
//----------------------------------------------------------------------
|
||||
std::size_t FTerm::getColumnNumber()
|
||||
{
|
||||
FRect& term_geometry = data->getTermGeometry();
|
||||
auto& term_geometry = data->getTermGeometry();
|
||||
|
||||
if ( term_geometry.getWidth() == 0 )
|
||||
detectTermSize();
|
||||
|
@ -125,7 +125,7 @@ bool FTerm::isNormal (charData*& ch)
|
|||
//----------------------------------------------------------------------
|
||||
bool FTerm::isCursorHideable()
|
||||
{
|
||||
char* cursor_off_str = disableCursor();
|
||||
const char* cursor_off_str = disableCursor();
|
||||
|
||||
if ( cursor_off_str && std::strlen(cursor_off_str) > 0 )
|
||||
return true;
|
||||
|
@ -319,7 +319,7 @@ bool FTerm::setOldFont()
|
|||
int FTerm::openConsole()
|
||||
{
|
||||
int fd = data->getTTYFileDescriptor();
|
||||
char* termfilename = data->getTermFileName();
|
||||
const char* termfilename = data->getTermFileName();
|
||||
|
||||
static const char* terminal_devices[] =
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ int FTerm::openConsole()
|
|||
if ( ! *termfilename )
|
||||
return 0;
|
||||
|
||||
for (int i = 0; terminal_devices[i] != 0; i++)
|
||||
for (std::size_t i = 0; terminal_devices[i] != 0; i++)
|
||||
{
|
||||
fd = open(terminal_devices[i], O_RDWR, 0);
|
||||
data->setTTYFileDescriptor(fd);
|
||||
|
@ -420,8 +420,8 @@ char* FTerm::enableCursor()
|
|||
|
||||
static const std::size_t SIZE = 32;
|
||||
static char enable_str[SIZE] = { };
|
||||
char*& vs = TCAP(fc::t_cursor_visible);
|
||||
char*& ve = TCAP(fc::t_cursor_normal);
|
||||
const auto& vs = TCAP(fc::t_cursor_visible);
|
||||
const auto& ve = TCAP(fc::t_cursor_normal);
|
||||
|
||||
if ( ve )
|
||||
std::strncpy (enable_str, ve, SIZE - 1);
|
||||
|
@ -432,8 +432,7 @@ char* FTerm::enableCursor()
|
|||
if ( isLinuxTerm() )
|
||||
{
|
||||
// Restore the last used Linux console cursor style
|
||||
char* cstyle;
|
||||
cstyle = linux->restoreCursorStyle();
|
||||
const char* cstyle = linux->restoreCursorStyle();
|
||||
std::strncat (enable_str, cstyle, SIZE - std::strlen(enable_str) - 1);
|
||||
}
|
||||
#endif // defined(__linux__)
|
||||
|
@ -456,7 +455,7 @@ char* FTerm::disableCursor()
|
|||
{
|
||||
// Returns the cursor disable string
|
||||
|
||||
char*& vi = TCAP(fc::t_cursor_invisible);
|
||||
const auto& vi = TCAP(fc::t_cursor_invisible);
|
||||
|
||||
if ( vi )
|
||||
return vi;
|
||||
|
@ -483,7 +482,7 @@ void FTerm::detectTermSize()
|
|||
close_after_detect = true;
|
||||
}
|
||||
|
||||
FRect& term_geometry = data->getTermGeometry();
|
||||
auto& term_geometry = data->getTermGeometry();
|
||||
ret = ioctl (fd, TIOCGWINSZ, &win_size);
|
||||
|
||||
if ( ret != 0 || win_size.ws_col == 0 || win_size.ws_row == 0 )
|
||||
|
@ -549,8 +548,8 @@ void FTerm::saveColorMap()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::resetColorMap()
|
||||
{
|
||||
char*& oc = TCAP(fc::t_orig_colors);
|
||||
char*& op = TCAP(fc::t_orig_pair);
|
||||
const auto& oc = TCAP(fc::t_orig_colors);
|
||||
const auto& op = TCAP(fc::t_orig_pair);
|
||||
|
||||
if ( oc )
|
||||
putstring (oc);
|
||||
|
@ -571,8 +570,8 @@ void FTerm::setPalette (FColor index, int r, int g, int b)
|
|||
{
|
||||
// Redefine RGB color value for a palette entry
|
||||
|
||||
char*& Ic = TCAP(fc::t_initialize_color);
|
||||
char*& Ip = TCAP(fc::t_initialize_pair);
|
||||
const auto& Ic = TCAP(fc::t_initialize_color);
|
||||
const auto& Ip = TCAP(fc::t_initialize_pair);
|
||||
|
||||
index = FOptiAttr::vga2ansi(index);
|
||||
|
||||
|
@ -682,12 +681,11 @@ fc::encoding FTerm::getEncoding()
|
|||
//----------------------------------------------------------------------
|
||||
std::string FTerm::getEncodingString()
|
||||
{
|
||||
fc::encoding term_encoding = data->getTermEncoding();
|
||||
FTermData::encodingMap& encoding_list = data->getEncodingList();
|
||||
std::map<std::string, fc::encoding>::const_iterator it, end;
|
||||
end = encoding_list.end();
|
||||
auto term_encoding = data->getTermEncoding();
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
auto end = encoding_list.end();
|
||||
|
||||
for (it = encoding_list.begin(); it != end; ++it )
|
||||
for (auto it = encoding_list.begin(); it != end; ++it )
|
||||
if ( it->second == term_encoding )
|
||||
return it->first;
|
||||
|
||||
|
@ -710,7 +708,7 @@ uInt FTerm::charEncode (uInt c)
|
|||
//----------------------------------------------------------------------
|
||||
uInt FTerm::charEncode (uInt c, fc::encoding enc)
|
||||
{
|
||||
for (uInt i = 0; i <= uInt(fc::lastCharItem); i++)
|
||||
for (std::size_t i = 0; i <= uInt(fc::lastCharItem); i++)
|
||||
{
|
||||
if ( fc::character[i][fc::UTF8] == c )
|
||||
{
|
||||
|
@ -947,7 +945,7 @@ void FTerm::init_alt_charset()
|
|||
|
||||
if ( TCAP(fc::t_acs_chars) )
|
||||
{
|
||||
for (int n = 0; TCAP(fc::t_acs_chars)[n]; n += 2)
|
||||
for (std::size_t n = 0; TCAP(fc::t_acs_chars)[n]; n += 2)
|
||||
{
|
||||
// insert the VT100 key/value pairs into a map
|
||||
uChar p1 = uChar(TCAP(fc::t_acs_chars)[n]);
|
||||
|
@ -963,7 +961,7 @@ void FTerm::init_alt_charset()
|
|||
};
|
||||
|
||||
// Update array 'character' with discovered VT100 pairs
|
||||
for (int n = 0; n <= fc::lastKeyItem; n++ )
|
||||
for (std::size_t n = 0; n <= fc::lastKeyItem; n++ )
|
||||
{
|
||||
uChar keyChar = uChar(fc::vt100_key_to_utf8[n][vt100_key]);
|
||||
uChar altChar = uChar(vt100_alt_char[keyChar]);
|
||||
|
@ -1051,7 +1049,7 @@ void FTerm::init_cygwin_charmap()
|
|||
if ( ! isCygwinTerminal() )
|
||||
return;
|
||||
|
||||
for (int i = 0; i <= fc::lastCharItem; i++ )
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
{
|
||||
if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle // ▲
|
||||
|| fc::character[i][fc::UTF8] == fc::BlackDownPointingTriangle // ▼
|
||||
|
@ -1082,7 +1080,7 @@ void FTerm::init_teraterm_charmap()
|
|||
if ( ! isTeraTerm() )
|
||||
return;
|
||||
|
||||
for (int i = 0; i <= fc::lastCharItem; i++ )
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
if ( fc::character[i][fc::PC] < 0x20 )
|
||||
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
||||
}
|
||||
|
@ -1208,21 +1206,11 @@ void FTerm::init_optiAttr()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_font()
|
||||
{
|
||||
if ( init_values.vgafont )
|
||||
{
|
||||
bool ret = setVGAFont();
|
||||
if ( init_values.vgafont && ! setVGAFont() )
|
||||
exitWithMessage ("VGAfont is not supported by this terminal");
|
||||
|
||||
if ( ! ret )
|
||||
exitWithMessage ("VGAfont is not supported by this terminal");
|
||||
}
|
||||
|
||||
if ( init_values.newfont )
|
||||
{
|
||||
bool ret = setNewFont();
|
||||
|
||||
if ( ! ret )
|
||||
exitWithMessage ("Newfont is not supported by this terminal");
|
||||
}
|
||||
if ( init_values.newfont && ! setNewFont() )
|
||||
exitWithMessage ("Newfont is not supported by this terminal");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1310,8 +1298,7 @@ inline void FTerm::init_encoding_set()
|
|||
{
|
||||
// Define the encoding set
|
||||
|
||||
FTermData::encodingMap& encoding_list = data->getEncodingList();
|
||||
|
||||
auto& encoding_list = data->getEncodingList();
|
||||
encoding_list["UTF8"] = fc::UTF8;
|
||||
encoding_list["UTF-8"] = fc::UTF8;
|
||||
encoding_list["VT100"] = fc::VT100; // VT100 line drawing
|
||||
|
@ -1403,7 +1390,7 @@ void FTerm::init_tab_quirks()
|
|||
// on the terminal and does not move the cursor to the next tab stop
|
||||
// position
|
||||
|
||||
fc::encoding enc = data->getTermEncoding();
|
||||
auto enc = data->getTermEncoding();
|
||||
|
||||
if ( enc == fc::VT100 || enc == fc::PC )
|
||||
{
|
||||
|
@ -1498,9 +1485,8 @@ void FTerm::setInsertCursorStyle()
|
|||
setKDECursor(fc::UnderlineCursor);
|
||||
|
||||
#if defined(__linux__)
|
||||
char* cstyle;
|
||||
cstyle = linux->setCursorStyle ( fc::underscore_cursor
|
||||
, data->isCursorHidden() );
|
||||
const char* cstyle = linux->setCursorStyle ( fc::underscore_cursor
|
||||
, data->isCursorHidden() );
|
||||
putstring (cstyle);
|
||||
std::fflush(stdout);
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
|
@ -1519,9 +1505,8 @@ void FTerm::setOverwriteCursorStyle()
|
|||
setKDECursor(fc::BlockCursor);
|
||||
|
||||
#if defined(__linux__)
|
||||
char* cstyle;
|
||||
cstyle = linux->setCursorStyle ( fc::full_block_cursor
|
||||
, data->isCursorHidden() );
|
||||
char* cstyle = linux->setCursorStyle ( fc::full_block_cursor
|
||||
, data->isCursorHidden() );
|
||||
putstring (cstyle);
|
||||
std::fflush(stdout);
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
|
@ -2009,7 +1994,7 @@ uInt FTerm::cp437_to_unicode (uChar c)
|
|||
{
|
||||
uInt ucs = uInt(c);
|
||||
|
||||
for (uInt i = 0; i <= fc::lastCP437Item; i++)
|
||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
||||
{
|
||||
if ( fc::cp437_to_ucs[i][0] == c ) // found
|
||||
{
|
||||
|
|
|
@ -81,7 +81,6 @@ void FTermcap::init()
|
|||
void FTermcap::termcap()
|
||||
{
|
||||
std::vector<std::string> terminals;
|
||||
std::vector<std::string>::iterator iter;
|
||||
static const int success = 1;
|
||||
static const int uninitialized = -2;
|
||||
static char term_buffer[2048];
|
||||
|
@ -104,7 +103,7 @@ void FTermcap::termcap()
|
|||
terminals.push_back("xterm"); // 2nd fallback if not found
|
||||
terminals.push_back("ansi"); // 3rd fallback if not found
|
||||
terminals.push_back("vt100"); // 4th fallback if not found
|
||||
iter = terminals.begin();
|
||||
auto iter = terminals.begin();
|
||||
|
||||
while ( iter != terminals.end() )
|
||||
{
|
||||
|
@ -225,7 +224,7 @@ void FTermcap::termcapStrings (char*& buffer)
|
|||
// Get termcap strings
|
||||
|
||||
// Read termcap output strings
|
||||
for (int i = 0; tcap[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; tcap[i].tname[0] != 0; i++)
|
||||
tcap[i].string = tgetstr(tcap[i].tname, &buffer);
|
||||
}
|
||||
|
||||
|
@ -234,7 +233,7 @@ void FTermcap::termcapKeys (char*& buffer)
|
|||
{
|
||||
// Read termcap key strings
|
||||
|
||||
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
{
|
||||
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
|
||||
|
||||
|
@ -288,13 +287,13 @@ void FTermcap::termcapKeysVt100 (char*& buffer)
|
|||
// Some terminals (e.g. PuTTY) send vt100 key codes for
|
||||
// the arrow and function keys.
|
||||
|
||||
char* key_up_string = tgetstr(C_STR("ku"), &buffer);
|
||||
const char* key_up_string = tgetstr(C_STR("ku"), &buffer);
|
||||
|
||||
if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0))
|
||||
|| ( TCAP(fc::t_cursor_up)
|
||||
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
|
||||
{
|
||||
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
{
|
||||
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
|
||||
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
|
||||
|
|
|
@ -65,7 +65,7 @@ void FTermcapQuirks::setFTermDetection (FTermDetection* td)
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::terminalFixup()
|
||||
{
|
||||
FTermDetection* td = term_detection;
|
||||
auto td = term_detection;
|
||||
|
||||
if ( td->isCygwinTerminal() )
|
||||
{
|
||||
|
@ -405,7 +405,7 @@ void FTermcapQuirks::sunConsole()
|
|||
C_STR(CSI "%p1%dD");
|
||||
|
||||
// Sun Microsystems workstation console keys
|
||||
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
||||
{
|
||||
if ( std::strncmp(fc::Fkey[i].tname, "K2", 2) == 0 )
|
||||
fc::Fkey[i].string = C_STR(CSI "218z"); // center of keypad
|
||||
|
|
|
@ -111,7 +111,7 @@ void FTermFreeBSD::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
|||
if ( ! isFreeBSDConsole() )
|
||||
return;
|
||||
|
||||
for (int i = 0; i <= fc::lastCharItem; i++)
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++)
|
||||
if ( char_map[i][fc::PC] < 0x1c )
|
||||
char_map[i][fc::PC] = char_map[i][fc::ASCII];
|
||||
}
|
||||
|
|
|
@ -198,11 +198,11 @@ void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
|||
|
||||
if ( screen_unicode_map.entry_ct != 0 )
|
||||
{
|
||||
for (int i = 0; i <= fc::lastCharItem; i++ )
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
{
|
||||
bool known_unicode = false;
|
||||
|
||||
for (uInt n = 0; n < screen_unicode_map.entry_ct; n++)
|
||||
for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++)
|
||||
{
|
||||
if ( char_map[i][fc::UTF8] == screen_unicode_map.entries[n].unicode )
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ bool FTermLinux::resetVGAPalette()
|
|||
{0x55, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF}
|
||||
};
|
||||
|
||||
for (int index = 0; index < 16; index++)
|
||||
for (std::size_t index = 0; index < 16; index++)
|
||||
{
|
||||
cmap.color[index].red = defaultColor[index].red;
|
||||
cmap.color[index].green = defaultColor[index].green;
|
||||
|
|
|
@ -187,10 +187,8 @@ void FTextView::scrollTo (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::hide()
|
||||
{
|
||||
std::size_t n, size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
auto parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -205,13 +203,13 @@ void FTextView::hide()
|
|||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
n = isNewFont() ? 1 : 0;
|
||||
size = getWidth() + n;
|
||||
auto n = isNewFont() ? 1 : 0;
|
||||
auto size = getWidth() + n;
|
||||
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
|
@ -232,10 +230,7 @@ void FTextView::append (const FString& str)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::insert (const FString& str, int pos)
|
||||
{
|
||||
FStringList::iterator iter;
|
||||
FStringList text_split;
|
||||
FString s;
|
||||
std::size_t num;
|
||||
|
||||
if ( pos < 0 || pos >= int(getRows()) )
|
||||
pos = int(getRows());
|
||||
|
@ -245,18 +240,17 @@ void FTextView::insert (const FString& str, int pos)
|
|||
else
|
||||
s = FString(str).rtrim().expandTabs(getTabstop());
|
||||
|
||||
iter = data.begin();
|
||||
text_split = s.split("\r\n");
|
||||
num = text_split.size();
|
||||
auto iter = data.begin();
|
||||
auto text_split = s.split("\r\n");
|
||||
auto num = text_split.size();
|
||||
|
||||
for (std::size_t i = 0; i < num; i++)
|
||||
{
|
||||
std::size_t len;
|
||||
text_split[i] = text_split[i].removeBackspaces()
|
||||
.removeDel()
|
||||
.replaceControlCodes()
|
||||
.rtrim();
|
||||
len = text_split[i].getLength();
|
||||
auto len = text_split[i].getLength();
|
||||
|
||||
if ( len > maxLineWidth )
|
||||
{
|
||||
|
@ -297,12 +291,10 @@ void FTextView::insert (const FString& str, int pos)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::replaceRange (const FString& str, int from, int to)
|
||||
{
|
||||
FStringList::iterator iter;
|
||||
|
||||
if ( from > to || from >= int(getRows()) || to >= int(getRows()) )
|
||||
return;
|
||||
|
||||
iter = data.begin();
|
||||
auto iter = data.begin();
|
||||
data.erase (iter + from, iter + to + 1);
|
||||
|
||||
if ( ! str.isNull() )
|
||||
|
@ -333,7 +325,7 @@ void FTextView::clear()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
|
||||
for (int y = 0; y < int(getTextHeight()); y++)
|
||||
{
|
||||
|
@ -398,9 +390,6 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
FWidget* parent;
|
||||
FDialog* dialog;
|
||||
|
||||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
|
@ -418,12 +407,12 @@ void FTextView::onMouseDown (FMouseEvent* ev)
|
|||
getStatusBar()->drawMessage();
|
||||
}
|
||||
|
||||
parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
|
||||
if ( ! parent )
|
||||
return;
|
||||
|
||||
dialog = static_cast<FDialog*>(parent);
|
||||
auto dialog = static_cast<FDialog*>(parent);
|
||||
|
||||
if ( parent->isDialogWidget()
|
||||
&& dialog->isResizeable()
|
||||
|
@ -436,7 +425,7 @@ void FTextView::onMouseDown (FMouseEvent* ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseDown_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -450,11 +439,11 @@ void FTextView::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::onMouseUp (FMouseEvent* ev)
|
||||
{
|
||||
FWidget* parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
|
||||
if ( parent && parent->isDialogWidget() )
|
||||
{
|
||||
FDialog* dialog = static_cast<FDialog*>(parent);
|
||||
auto dialog = static_cast<FDialog*>(parent);
|
||||
|
||||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||
{
|
||||
|
@ -465,7 +454,7 @@ void FTextView::onMouseUp (FMouseEvent* ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseUp_Event, p, tp, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseUp_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -486,11 +475,11 @@ void FTextView::onMouseUp (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::onMouseMove (FMouseEvent* ev)
|
||||
{
|
||||
FWidget* parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
|
||||
if ( parent && parent->isDialogWidget() )
|
||||
{
|
||||
FDialog* dialog = static_cast<FDialog*>(parent);
|
||||
auto dialog = static_cast<FDialog*>(parent);
|
||||
|
||||
if ( dialog->isResizeable() && ! dialog->isZoomed() )
|
||||
{
|
||||
|
@ -501,7 +490,7 @@ void FTextView::onMouseMove (FMouseEvent* ev)
|
|||
|
||||
try
|
||||
{
|
||||
FMouseEvent* _ev = new FMouseEvent (fc::MouseMove_Event, p, tp, b);
|
||||
auto _ev = new FMouseEvent (fc::MouseMove_Event, p, tp, b);
|
||||
FApplication::sendEvent (parent, _ev);
|
||||
delete _ev;
|
||||
}
|
||||
|
@ -675,7 +664,7 @@ void FTextView::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::draw()
|
||||
{
|
||||
FWidget* parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
bool is_text_dialog;
|
||||
setColor();
|
||||
|
||||
|
@ -732,7 +721,7 @@ void FTextView::drawText()
|
|||
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
||||
return;
|
||||
|
||||
std::size_t num = getTextHeight();
|
||||
auto num = getTextHeight();
|
||||
|
||||
if ( num > getRows() )
|
||||
num = getRows();
|
||||
|
@ -744,14 +733,13 @@ void FTextView::drawText()
|
|||
|
||||
for (std::size_t y = 0; y < num; y++)
|
||||
{
|
||||
std::size_t i, len;
|
||||
std::size_t i;
|
||||
FString line;
|
||||
const wchar_t* line_str;
|
||||
setPrintPos (2, 2 - nf_offset + int(y));
|
||||
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
|
||||
, getTextWidth() );
|
||||
line_str = line.wc_str();
|
||||
len = line.getLength();
|
||||
const auto line_str = line.wc_str();
|
||||
const auto len = line.getLength();
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
|
|
|
@ -204,7 +204,7 @@ void FToggleButton::hide()
|
|||
{
|
||||
std::size_t size;
|
||||
FColor fg, bg;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
auto parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
|
||||
if ( parent_widget )
|
||||
|
@ -224,7 +224,7 @@ void FToggleButton::hide()
|
|||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
char* blank = createBlankArray(size + 1);
|
||||
auto blank = createBlankArray(size + 1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
destroyBlankArray (blank);
|
||||
|
@ -239,7 +239,7 @@ void FToggleButton::onMouseDown (FMouseEvent* ev)
|
|||
if ( hasFocus() )
|
||||
return;
|
||||
|
||||
FWidget* focused_widget = getFocusWidget();
|
||||
auto focused_widget = getFocusWidget();
|
||||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
@ -301,7 +301,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
|
|||
|
||||
if ( ! hasFocus() )
|
||||
{
|
||||
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
auto focused_widget = static_cast<FWidget*>(ev->focusedWidget());
|
||||
|
||||
if ( focused_widget && focused_widget->isWidget() )
|
||||
{
|
||||
|
@ -470,7 +470,6 @@ void FToggleButton::draw()
|
|||
void FToggleButton::drawLabel()
|
||||
{
|
||||
wchar_t* LabelText;
|
||||
std::size_t hotkeypos;
|
||||
|
||||
if ( ! isVisible() )
|
||||
return;
|
||||
|
@ -493,7 +492,7 @@ void FToggleButton::drawLabel()
|
|||
FString txt = text;
|
||||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||
hotkeypos = getHotkeyPos(src, dest, length);
|
||||
auto hotkeypos = getHotkeyPos(src, dest, length);
|
||||
|
||||
if ( hotkeypos != NOT_SET )
|
||||
length--;
|
||||
|
|
|
@ -49,14 +49,14 @@ FToolTip::FToolTip (const FString& txt, FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FToolTip::~FToolTip() // destructor
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
|
||||
if ( fapp->isQuit() )
|
||||
return;
|
||||
|
||||
FWindow* parent_win = nullptr;
|
||||
|
||||
if ( FWidget* parent = getParentWidget() )
|
||||
if ( auto parent = getParentWidget() )
|
||||
parent_win = getWindowWidget(parent);
|
||||
|
||||
if ( parent_win )
|
||||
|
@ -85,9 +85,9 @@ void FToolTip::draw()
|
|||
clearArea();
|
||||
drawBorder();
|
||||
|
||||
for (int i = 0; i < int(text_num_lines); i++)
|
||||
for (std::size_t i = 0; i < text_num_lines; i++)
|
||||
{
|
||||
setPrintPos (3, 2 + i);
|
||||
setPrintPos (3, 2 + int(i));
|
||||
print(text_components[i]);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void FToolTip::calculateDimensions()
|
|||
{
|
||||
int x, y;
|
||||
std::size_t w, h;
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
max_line_width = 0;
|
||||
text_split = text.split("\n");
|
||||
text_num_lines = uInt(text_split.size());
|
||||
|
|
275
src/fvterm.cpp
275
src/fvterm.cpp
|
@ -89,7 +89,7 @@ FVTerm::~FVTerm() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
FPoint FVTerm::getPrintCursor()
|
||||
{
|
||||
term_area* win = getPrintArea();
|
||||
auto win = getPrintArea();
|
||||
|
||||
if ( win )
|
||||
return FPoint ( win->offset_left + win->cursor_x
|
||||
|
@ -103,7 +103,6 @@ void FVTerm::setTermXY (int x, int y)
|
|||
{
|
||||
// Sets the hardware cursor to the given (x,y) position
|
||||
int term_x, term_y, term_width, term_height;
|
||||
char* move_str;
|
||||
|
||||
if ( term_pos->getX() == x && term_pos->getY() == y )
|
||||
return;
|
||||
|
@ -126,7 +125,7 @@ void FVTerm::setTermXY (int x, int y)
|
|||
term_x = term_pos->getX();
|
||||
term_y = term_pos->getY();
|
||||
|
||||
move_str = FTerm::moveCursor (term_x, term_y, x, y);
|
||||
const char* move_str = FTerm::moveCursor (term_x, term_y, x, y);
|
||||
|
||||
if ( move_str )
|
||||
appendOutputBuffer(move_str);
|
||||
|
@ -140,7 +139,7 @@ void FVTerm::hideCursor (bool on)
|
|||
{
|
||||
// Hides or shows the input cursor on the terminal
|
||||
|
||||
char* visibility_str = FTerm::cursorsVisibility (on);
|
||||
const char* visibility_str = FTerm::cursorsVisibility (on);
|
||||
|
||||
if ( visibility_str )
|
||||
appendOutputBuffer(visibility_str);
|
||||
|
@ -151,7 +150,7 @@ void FVTerm::hideCursor (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
void FVTerm::setPrintCursor (int x, int y)
|
||||
{
|
||||
term_area* win = getPrintArea();
|
||||
auto win = getPrintArea();
|
||||
|
||||
if ( win )
|
||||
{
|
||||
|
@ -290,8 +289,7 @@ void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
|||
if ( ! print_area || print_area->preprocessing_call.empty() )
|
||||
return;
|
||||
|
||||
FPreprocessing::iterator iter;
|
||||
iter = print_area->preprocessing_call.begin();
|
||||
auto iter = print_area->preprocessing_call.begin();
|
||||
|
||||
while ( iter != print_area->preprocessing_call.end() )
|
||||
{
|
||||
|
@ -324,7 +322,7 @@ int FVTerm::printf (const FString format, ...)
|
|||
int FVTerm::print (const FString& s)
|
||||
{
|
||||
assert ( ! s.isNull() );
|
||||
term_area* area = getPrintArea();
|
||||
auto area = getPrintArea();
|
||||
|
||||
if ( ! area )
|
||||
{
|
||||
|
@ -341,13 +339,12 @@ int FVTerm::print (const FString& s)
|
|||
int FVTerm::print (term_area* area, const FString& s)
|
||||
{
|
||||
assert ( ! s.isNull() );
|
||||
const wchar_t* p;
|
||||
std::vector<charData> term_string;
|
||||
|
||||
if ( ! area )
|
||||
return -1;
|
||||
|
||||
p = s.wc_str();
|
||||
std::vector<charData> term_string;
|
||||
const wchar_t* p = s.wc_str();
|
||||
|
||||
if ( p )
|
||||
{
|
||||
|
@ -376,7 +373,7 @@ int FVTerm::print (const std::vector<charData>& term_string)
|
|||
if ( term_string.empty() )
|
||||
return 0;
|
||||
|
||||
term_area* area = getPrintArea();
|
||||
auto area = getPrintArea();
|
||||
|
||||
if ( ! area )
|
||||
{
|
||||
|
@ -393,8 +390,6 @@ int FVTerm::print (const std::vector<charData>& term_string)
|
|||
int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
||||
{
|
||||
int len = 0;
|
||||
std::vector<charData>::const_iterator iter;
|
||||
iter = term_string.begin();
|
||||
uInt tabstop = uInt(getTabstop());
|
||||
|
||||
if ( ! area )
|
||||
|
@ -403,11 +398,11 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
|||
if ( term_string.empty() )
|
||||
return 0;
|
||||
|
||||
while ( iter != term_string.end() )
|
||||
for (auto&& ch : term_string)
|
||||
{
|
||||
bool printable_character = false;
|
||||
|
||||
switch ( iter->code )
|
||||
switch ( ch.code )
|
||||
{
|
||||
case '\n':
|
||||
area->cursor_y++;
|
||||
|
@ -434,7 +429,7 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
|||
|
||||
default:
|
||||
{
|
||||
charData nc = *iter; // next character
|
||||
auto nc = ch; // next character
|
||||
print (area, nc);
|
||||
printable_character = true;
|
||||
}
|
||||
|
@ -444,7 +439,6 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
|||
break; // end of area reached
|
||||
|
||||
len++;
|
||||
++iter;
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -453,7 +447,7 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
|||
//----------------------------------------------------------------------
|
||||
int FVTerm::print (wchar_t c)
|
||||
{
|
||||
term_area* area = getPrintArea();
|
||||
auto area = getPrintArea();
|
||||
|
||||
if ( ! area )
|
||||
{
|
||||
|
@ -487,7 +481,7 @@ int FVTerm::print (term_area* area, wchar_t c)
|
|||
//----------------------------------------------------------------------
|
||||
int FVTerm::print (charData& term_char)
|
||||
{
|
||||
term_area* area = getPrintArea();
|
||||
auto area = getPrintArea();
|
||||
|
||||
if ( ! area )
|
||||
{
|
||||
|
@ -521,9 +515,8 @@ int FVTerm::print (term_area* area, charData& term_char)
|
|||
&& ax < area->width + area->right_shadow
|
||||
&& ay < area->height + area->bottom_shadow )
|
||||
{
|
||||
charData* ac; // area character
|
||||
int line_len = area->width + area->right_shadow;
|
||||
ac = &area->text[ay * line_len + ax];
|
||||
auto ac = &area->text[ay * line_len + ax]; // area character
|
||||
|
||||
if ( *ac != nc ) // compare with an overloaded operator
|
||||
{
|
||||
|
@ -816,9 +809,6 @@ void FVTerm::restoreVTerm (const FRect& box)
|
|||
//----------------------------------------------------------------------
|
||||
void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
||||
{
|
||||
charData* tc; // terminal character
|
||||
charData sc; // shown character
|
||||
|
||||
x--;
|
||||
y--;
|
||||
|
||||
|
@ -850,8 +840,8 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
for (int tx = 0; tx < w; tx++)
|
||||
{
|
||||
int xpos = x + tx;
|
||||
tc = &vterm->text[ypos * vterm->width + xpos];
|
||||
sc = generateCharacter(xpos, ypos);
|
||||
auto tc = &vterm->text[ypos * vterm->width + xpos]; // terminal character
|
||||
auto sc = generateCharacter(xpos, ypos); // shown character
|
||||
std::memcpy (tc, &sc, sizeof(*tc));
|
||||
}
|
||||
|
||||
|
@ -878,27 +868,22 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
{
|
||||
// Determines the covered state for the given position
|
||||
|
||||
bool found;
|
||||
covered_state is_covered;
|
||||
FWidget* w;
|
||||
|
||||
if ( ! area )
|
||||
return non_covered;
|
||||
|
||||
is_covered = non_covered;
|
||||
found = bool(area == vdesktop);
|
||||
auto is_covered = non_covered;
|
||||
bool found = bool(area == vdesktop);
|
||||
|
||||
w = static_cast<FWidget*>(area->widget);
|
||||
auto w = static_cast<FWidget*>(area->widget);
|
||||
|
||||
if ( w->window_list && ! w->window_list->empty() )
|
||||
{
|
||||
FWidget::widgetList::const_iterator iter, end;
|
||||
iter = w->window_list->begin();
|
||||
end = w->window_list->end();
|
||||
auto iter = w->window_list->begin();
|
||||
auto end = w->window_list->end();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
auto win = (*iter)->getVWin();
|
||||
|
||||
if ( ! win )
|
||||
continue;
|
||||
|
@ -915,9 +900,8 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
|
||||
if ( found && geometry.contains(x, y) )
|
||||
{
|
||||
charData* tmp;
|
||||
int line_len = win->width + win->right_shadow;
|
||||
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
|
||||
auto tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
|
||||
|
||||
if ( tmp->attr.bit.trans_shadow )
|
||||
{
|
||||
|
@ -948,14 +932,14 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
|||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
charData* ac = &area->text[y * line_len + x];
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// New character
|
||||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(nc));
|
||||
// Overlapped character
|
||||
charData oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
|
||||
nc.fg_color = oc.fg_color;
|
||||
nc.bg_color = oc.bg_color;
|
||||
nc.attr.bit.reverse = false;
|
||||
|
@ -979,9 +963,9 @@ void FVTerm::updateOverlappedCharacter (term_area* area, int tx, int ty)
|
|||
// Restore one character on vterm
|
||||
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// Overlapped character
|
||||
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
||||
std::memcpy (tc, &oc, sizeof(*tc));
|
||||
}
|
||||
|
@ -996,11 +980,11 @@ void FVTerm::updateShadedCharacter ( term_area* area
|
|||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
charData* ac = &area->text[y * line_len + x];
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// Overlapped character
|
||||
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
oc.fg_color = ac->fg_color;
|
||||
oc.bg_color = ac->bg_color;
|
||||
oc.attr.bit.reverse = false;
|
||||
|
@ -1028,14 +1012,14 @@ void FVTerm::updateInheritBackground ( term_area* area
|
|||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
charData* ac = &area->text[y * line_len + x];
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
// New character
|
||||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(nc));
|
||||
// Covered character
|
||||
charData cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
auto cc = getCoveredCharacter (tx + 1, ty + 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));
|
||||
|
@ -1051,9 +1035,9 @@ void FVTerm::updateCharacter ( term_area* area
|
|||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
charData* ac = &area->text[y * line_len + x];
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||
std::memcpy (tc, ac, sizeof(*tc));
|
||||
|
||||
if ( tc->attr.bit.printed && *tc == *ac )
|
||||
|
@ -1070,10 +1054,10 @@ bool FVTerm::updateVTermCharacter ( term_area* area
|
|||
int& rsh = area->right_shadow;
|
||||
int line_len = aw + rsh;
|
||||
// Area character
|
||||
charData* ac = &area->text[y * line_len + x];
|
||||
auto ac = &area->text[y * line_len + x];
|
||||
|
||||
// Get covered state
|
||||
covered_state is_covered = isCovered(tx, ty, area);
|
||||
auto is_covered = isCovered(tx, ty, area);
|
||||
|
||||
if ( is_covered == fully_covered )
|
||||
return false;
|
||||
|
@ -1112,9 +1096,8 @@ void FVTerm::callPreprocessingHandler (term_area* area)
|
|||
|
||||
if ( ! area->preprocessing_call.empty() )
|
||||
{
|
||||
FPreprocessing::const_iterator iter, end;
|
||||
iter = area->preprocessing_call.begin();
|
||||
end = area->preprocessing_call.end();
|
||||
auto iter = area->preprocessing_call.begin();
|
||||
auto end = area->preprocessing_call.end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -1142,13 +1125,12 @@ void FVTerm::updateVTerm()
|
|||
if ( ! widget->window_list || widget->window_list->empty() )
|
||||
return;
|
||||
|
||||
FWidget::widgetList::const_iterator iter, end;
|
||||
iter = widget->window_list->begin();
|
||||
end = widget->window_list->end();
|
||||
auto iter = widget->window_list->begin();
|
||||
auto end = widget->window_list->end();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
auto win = (*iter)->getVWin();
|
||||
|
||||
if ( ! win )
|
||||
continue;
|
||||
|
@ -1163,9 +1145,8 @@ void FVTerm::updateVTerm()
|
|||
}
|
||||
else if ( ! win->preprocessing_call.empty() )
|
||||
{
|
||||
FPreprocessing::const_iterator iter2, end2;
|
||||
iter2 = win->preprocessing_call.begin();
|
||||
end2 = win->preprocessing_call.end();
|
||||
auto iter2 = win->preprocessing_call.begin();
|
||||
auto end2 = win->preprocessing_call.end();
|
||||
|
||||
while ( iter2 != end2 )
|
||||
{
|
||||
|
@ -1378,10 +1359,8 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
|
|||
|
||||
for (int y = 0; y < y_end; y++) // line loop
|
||||
{
|
||||
charData* tc; // terminal character
|
||||
charData* ac; // area character
|
||||
tc = &vterm->text[(ay + y) * vterm->width + ax];
|
||||
ac = &area->text[y * area->width];
|
||||
auto tc = &vterm->text[(ay + y) * vterm->width + ax]; // terminal character
|
||||
auto ac = &area->text[y * area->width]; // area character
|
||||
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[y].xmin) > 0 )
|
||||
|
@ -1433,11 +1412,9 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
|
|||
|
||||
for (int _y = 0; _y < y_end; _y++) // line loop
|
||||
{
|
||||
charData* tc; // terminal character
|
||||
charData* ac; // area character
|
||||
int line_len = area->width + area->right_shadow;
|
||||
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
|
||||
ac = &area->text[(dy + _y) * line_len + dx];
|
||||
auto tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1]; // terminal character
|
||||
auto ac = &area->text[(dy + _y) * line_len + dx]; // area character
|
||||
std::memcpy (ac, tc, sizeof(*ac) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[dy + _y].xmin) > dx )
|
||||
|
@ -1513,8 +1490,8 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
|
|||
if ( area->changes[y].trans_count == 0 )
|
||||
{
|
||||
// Line has only covered characters
|
||||
ac = &area->text[y * line_len + ol];
|
||||
tc = &vterm->text[(ay + y) * vterm->width + ax];
|
||||
auto ac = &area->text[y * line_len + ol];
|
||||
auto tc = &vterm->text[(ay + y) * vterm->width + ax];
|
||||
putAreaLine (ac, tc, length);
|
||||
}
|
||||
else
|
||||
|
@ -1561,10 +1538,9 @@ void FVTerm::scrollAreaForward (term_area* area)
|
|||
|
||||
for (int y = 0; y < y_max; y++)
|
||||
{
|
||||
charData* sc; // source character
|
||||
int pos1 = y * total_width;
|
||||
int pos2 = (y + 1) * total_width;
|
||||
sc = &area->text[pos2];
|
||||
auto sc = &area->text[pos2]; // source character
|
||||
dc = &area->text[pos1];
|
||||
std::memcpy (dc, sc, sizeof(*dc) * unsigned(length));
|
||||
area->changes[y].xmin = 0;
|
||||
|
@ -1622,10 +1598,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
|
|||
|
||||
for (int y = y_max; y > 0; y--)
|
||||
{
|
||||
charData* sc; // source character
|
||||
int pos1 = (y - 1) * total_width;
|
||||
int pos2 = y * total_width;
|
||||
sc = &area->text[pos1];
|
||||
auto sc = &area->text[pos1]; // source character
|
||||
dc = &area->text[pos2];
|
||||
std::memcpy (dc, sc, sizeof(*dc) * unsigned(length));
|
||||
area->changes[y].xmin = 0;
|
||||
|
@ -1666,7 +1641,6 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
|||
// Clear the area with the current attributes
|
||||
|
||||
charData nc; // next character
|
||||
uInt w;
|
||||
|
||||
// Current attributes with a space character
|
||||
std::memcpy (&nc, &next_attribute, sizeof(nc));
|
||||
|
@ -1678,7 +1652,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
|||
return;
|
||||
}
|
||||
|
||||
w = uInt(area->width + area->right_shadow);
|
||||
uInt w = uInt(area->width + area->right_shadow);
|
||||
|
||||
if ( area->right_shadow == 0 )
|
||||
{
|
||||
|
@ -1725,22 +1699,19 @@ FVTerm::charData FVTerm::generateCharacter (const FPoint& pos)
|
|||
FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
||||
{
|
||||
// Generates characters for a given position considering all areas
|
||||
FWidget::widgetList::const_iterator iter, end;
|
||||
charData* sc; // shown character
|
||||
FWidget* widget;
|
||||
|
||||
widget = static_cast<FWidget*>(vterm->widget);
|
||||
sc = &vdesktop->text[y * vdesktop->width + x];
|
||||
auto widget = static_cast<FWidget*>(vterm->widget);
|
||||
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
||||
|
||||
if ( ! widget->window_list || widget->window_list->empty() )
|
||||
return *sc;
|
||||
|
||||
iter = widget->window_list->begin();
|
||||
end = widget->window_list->end();
|
||||
auto iter = widget->window_list->begin();
|
||||
auto end = widget->window_list->end();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
auto win = (*iter)->getVWin();
|
||||
|
||||
if ( ! win || ! win->visible )
|
||||
continue;
|
||||
|
@ -1755,9 +1726,8 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
// Window is visible and contains current character
|
||||
if ( geometry.contains(x, y) )
|
||||
{
|
||||
charData* tmp;
|
||||
int line_len = win->width + win->right_shadow;
|
||||
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
|
||||
auto tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
|
||||
|
||||
if ( ! tmp->attr.bit.transparent ) // Current character not transparent
|
||||
{
|
||||
|
@ -1798,8 +1768,8 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCharacter ( character_type type
|
||||
, const FPoint& pos
|
||||
, FVTerm* obj )
|
||||
, const FPoint& pos
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped or the covered character for a given position
|
||||
return getCharacter (type, pos.getX(), pos.getY(), obj);
|
||||
|
@ -1807,20 +1777,16 @@ FVTerm::charData FVTerm::getCharacter ( character_type type
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
||||
, int x
|
||||
, int y
|
||||
, FVTerm* obj )
|
||||
, int x
|
||||
, int y
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped or the covered character for the position (x,y)
|
||||
int xx, yy, layer;
|
||||
charData* cc; // covered character
|
||||
FWidget* w;
|
||||
FWidget::widgetList::const_iterator iter, end;
|
||||
|
||||
x--;
|
||||
y--;
|
||||
xx = x;
|
||||
yy = y;
|
||||
int xx = x;
|
||||
int yy = y;
|
||||
|
||||
if ( xx < 0 )
|
||||
xx = 0;
|
||||
|
@ -1834,16 +1800,16 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
if ( yy >= vterm->height )
|
||||
yy = vterm->height - 1;
|
||||
|
||||
cc = &vdesktop->text[yy * vdesktop->width + xx];
|
||||
w = static_cast<FWidget*>(obj);
|
||||
auto cc = &vdesktop->text[yy * vdesktop->width + xx]; // covered character
|
||||
auto w = static_cast<FWidget*>(obj);
|
||||
|
||||
if ( ! w->window_list || w->window_list->empty() )
|
||||
return *cc;
|
||||
|
||||
// Get the window layer of this object
|
||||
layer = FWindow::getWindowLayer(w);
|
||||
iter = w->window_list->begin();
|
||||
end = w->window_list->end();
|
||||
int layer = FWindow::getWindowLayer(w);
|
||||
auto iter = w->window_list->begin();
|
||||
auto end = w->window_list->end();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
|
@ -1858,7 +1824,7 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
|
||||
if ( obj && *iter != obj && significant_char )
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
auto win = (*iter)->getVWin();
|
||||
|
||||
if ( ! win || ! win->visible )
|
||||
continue;
|
||||
|
@ -1881,7 +1847,7 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCoveredCharacter ( const FPoint& pos
|
||||
, FVTerm* obj )
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the covered character for a given position
|
||||
return getCharacter (covered_character, pos.getX(), pos.getY(), obj);
|
||||
|
@ -1889,8 +1855,8 @@ FVTerm::charData FVTerm::getCoveredCharacter ( const FPoint& pos
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getCoveredCharacter ( int x
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
{
|
||||
// Gets the covered character for the position (x,y)
|
||||
return getCharacter (covered_character, x, y, obj);
|
||||
|
@ -1898,7 +1864,7 @@ FVTerm::charData FVTerm::getCoveredCharacter ( int x
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getOverlappedCharacter ( const FPoint& pos
|
||||
, FVTerm* obj )
|
||||
, FVTerm* obj )
|
||||
{
|
||||
// Gets the overlapped character for a given position
|
||||
return getCharacter (overlapped_character, pos.getX(), pos.getY(), obj);
|
||||
|
@ -1906,8 +1872,8 @@ FVTerm::charData FVTerm::getOverlappedCharacter ( const FPoint& pos
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FVTerm::charData FVTerm::getOverlappedCharacter ( int x
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
, int y
|
||||
, FVTerm* obj)
|
||||
{
|
||||
// Gets the overlapped character for the position (x,y)
|
||||
return getCharacter (overlapped_character, x, y, obj);
|
||||
|
@ -2135,11 +2101,10 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
void FVTerm::getAreaCharacter ( int x, int y, term_area* area
|
||||
, charData*& cc )
|
||||
{
|
||||
charData* tmp;
|
||||
int area_x = area->offset_left;
|
||||
int area_y = area->offset_top;
|
||||
int line_len = area->width + area->right_shadow;
|
||||
tmp = &area->text[(y - area_y) * line_len + (x - area_x)];
|
||||
auto tmp = &area->text[(y - area_y) * line_len + (x - area_x)];
|
||||
|
||||
// Current character not transparent
|
||||
if ( ! tmp->attr.bit.transparent )
|
||||
|
@ -2171,11 +2136,11 @@ bool FVTerm::clearTerm (int fillchar)
|
|||
{
|
||||
// Clear the real terminal and put cursor at home
|
||||
|
||||
char*& cl = TCAP(fc::t_clear_screen);
|
||||
char*& cd = TCAP(fc::t_clr_eos);
|
||||
char*& cb = TCAP(fc::t_clr_eol);
|
||||
auto& cl = TCAP(fc::t_clear_screen);
|
||||
auto& cd = TCAP(fc::t_clr_eos);
|
||||
auto& cb = TCAP(fc::t_clr_eol);
|
||||
bool ut = FTermcap::background_color_erase;
|
||||
charData* next = &next_attribute;
|
||||
auto next = &next_attribute;
|
||||
bool normal = FTerm::isNormal(next);
|
||||
appendAttributes(next);
|
||||
|
||||
|
@ -2275,8 +2240,8 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
|
|||
// => clear to end of line
|
||||
|
||||
term_area*& vt = vterm;
|
||||
char*& ce = TCAP(fc::t_clr_eol);
|
||||
charData* min_char = &vt->text[y * uInt(vt->width) + xmin];
|
||||
auto& ce = TCAP(fc::t_clr_eol);
|
||||
auto min_char = &vt->text[y * uInt(vt->width) + xmin];
|
||||
|
||||
if ( ce && min_char->code == ' ' )
|
||||
{
|
||||
|
@ -2286,7 +2251,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
|
|||
|
||||
for (uInt x = xmin + 1; x < uInt(vt->width); x++)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + x];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( *min_char == *ch )
|
||||
beginning_whitespace++;
|
||||
|
@ -2310,8 +2275,8 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
|
|||
// => clear from xmin to beginning of line
|
||||
|
||||
term_area*& vt = vterm;
|
||||
char*& cb = TCAP(fc::t_clr_bol);
|
||||
charData* first_char = &vt->text[y * uInt(vt->width)];
|
||||
auto& cb = TCAP(fc::t_clr_bol);
|
||||
auto first_char = &vt->text[y * uInt(vt->width)];
|
||||
|
||||
if ( cb && first_char->code == ' ' )
|
||||
{
|
||||
|
@ -2321,7 +2286,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
|
|||
|
||||
for (uInt x = 1; x < uInt(vt->width); x++)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + x];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( *first_char == *ch )
|
||||
leading_whitespace++;
|
||||
|
@ -2348,8 +2313,8 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
|
|||
// => clear from xmax to end of line
|
||||
|
||||
term_area*& vt = vterm;
|
||||
char*& ce = TCAP(fc::t_clr_eol);
|
||||
charData* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
|
||||
auto& ce = TCAP(fc::t_clr_eol);
|
||||
auto last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
|
||||
|
||||
if ( ce && last_char->code == ' ' )
|
||||
{
|
||||
|
@ -2359,7 +2324,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
|
|||
|
||||
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + x];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( *last_char == *ch )
|
||||
trailing_whitespace++;
|
||||
|
@ -2385,7 +2350,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
|
|||
// Skip characters without changes if it is faster than redrawing
|
||||
|
||||
term_area*& vt = vterm;
|
||||
charData* print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
auto print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
print_char->attr.bit.printed = true;
|
||||
|
||||
if ( print_char->attr.bit.no_changes )
|
||||
|
@ -2394,7 +2359,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
|
|||
|
||||
for (uInt i = x + 1; i <= xmax; i++)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + i];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + i];
|
||||
|
||||
if ( ch->attr.bit.no_changes )
|
||||
count++;
|
||||
|
@ -2419,11 +2384,10 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
|
|||
{
|
||||
for (uInt x = xmin; x <= xmax; x++)
|
||||
{
|
||||
charData* print_char;
|
||||
term_area*& vt = vterm;
|
||||
char*& ec = TCAP(fc::t_erase_chars);
|
||||
char*& rp = TCAP(fc::t_repeat_char);
|
||||
print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
auto& ec = TCAP(fc::t_erase_chars);
|
||||
auto& rp = TCAP(fc::t_repeat_char);
|
||||
auto print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
print_char->attr.bit.printed = true;
|
||||
|
||||
// skip character with no changes
|
||||
|
@ -2458,8 +2422,8 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
|||
// Erase a number of characters to draw simple whitespaces
|
||||
|
||||
term_area*& vt = vterm;
|
||||
char*& ec = TCAP(fc::t_erase_chars);
|
||||
charData* print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
auto& ec = TCAP(fc::t_erase_chars);
|
||||
auto print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( ! ec || print_char->code != ' ' )
|
||||
return not_used;
|
||||
|
@ -2469,7 +2433,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
|||
|
||||
for (uInt i = x + 1; i <= xmax; i++)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + i];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + i];
|
||||
|
||||
if ( *print_char == *ch )
|
||||
whitespace++;
|
||||
|
@ -2520,8 +2484,8 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
|||
// Repeat one character n-fold
|
||||
|
||||
term_area*& vt = vterm;
|
||||
char*& rp = TCAP(fc::t_repeat_char);
|
||||
charData* print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
auto& rp = TCAP(fc::t_repeat_char);
|
||||
auto print_char = &vt->text[y * uInt(vt->width) + x];
|
||||
|
||||
if ( ! rp )
|
||||
return not_used;
|
||||
|
@ -2530,7 +2494,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
|||
|
||||
for (uInt i = x + 1; i <= xmax; i++)
|
||||
{
|
||||
charData* ch = &vt->text[y * uInt(vt->width) + i];
|
||||
auto ch = &vt->text[y * uInt(vt->width) + i];
|
||||
|
||||
if ( *print_char == *ch )
|
||||
repetitions++;
|
||||
|
@ -2637,10 +2601,10 @@ void FVTerm::updateTerminalLine (uInt y)
|
|||
{
|
||||
bool draw_leading_ws = false;
|
||||
bool draw_trailing_ws = false;
|
||||
char*& ce = TCAP(fc::t_clr_eol);
|
||||
charData* first_char = &vt->text[y * uInt(vt->width)];
|
||||
charData* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
|
||||
charData* min_char = &vt->text[y * uInt(vt->width) + xmin];
|
||||
auto& ce = TCAP(fc::t_clr_eol);
|
||||
auto first_char = &vt->text[y * uInt(vt->width)];
|
||||
auto last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
|
||||
auto min_char = &vt->text[y * uInt(vt->width) + xmin];
|
||||
|
||||
// Clear rest of line
|
||||
bool is_eol_clean = canClearToEOL (xmin, y);
|
||||
|
@ -2666,7 +2630,7 @@ void FVTerm::updateTerminalLine (uInt y)
|
|||
{
|
||||
if ( draw_leading_ws )
|
||||
{
|
||||
char*& cb = TCAP(fc::t_clr_bol);
|
||||
auto& cb = TCAP(fc::t_clr_bol);
|
||||
appendAttributes (first_char);
|
||||
appendOutputBuffer (cb);
|
||||
markAsPrinted (0, xmin, y);
|
||||
|
@ -2852,11 +2816,10 @@ inline void FVTerm::appendChar (charData*& next_char)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::appendAttributes (charData*& next_attr)
|
||||
{
|
||||
char* attr_str;
|
||||
charData* term_attr = &term_attribute;
|
||||
auto term_attr = &term_attribute;
|
||||
|
||||
// generate attribute string for the next character
|
||||
attr_str = FTerm::changeAttribute (term_attr, next_attr);
|
||||
char* attr_str = FTerm::changeAttribute (term_attr, next_attr);
|
||||
|
||||
if ( attr_str )
|
||||
appendOutputBuffer (attr_str);
|
||||
|
@ -2865,8 +2828,8 @@ inline void FVTerm::appendAttributes (charData*& next_attr)
|
|||
//----------------------------------------------------------------------
|
||||
int FVTerm::appendLowerRight (charData*& screen_char)
|
||||
{
|
||||
char* SA = TCAP(fc::t_enter_am_mode);
|
||||
char* RA = TCAP(fc::t_exit_am_mode);
|
||||
auto& SA = TCAP(fc::t_enter_am_mode);
|
||||
auto& RA = TCAP(fc::t_exit_am_mode);
|
||||
|
||||
if ( ! FTermcap::automatic_right_margin )
|
||||
{
|
||||
|
@ -2881,11 +2844,11 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
|||
else
|
||||
{
|
||||
int x, y;
|
||||
char* IC = TCAP(fc::t_parm_ich);
|
||||
char* im = TCAP(fc::t_enter_insert_mode);
|
||||
char* ei = TCAP(fc::t_exit_insert_mode);
|
||||
char* ip = TCAP(fc::t_insert_padding);
|
||||
char* ic = TCAP(fc::t_insert_character);
|
||||
auto& IC = TCAP(fc::t_parm_ich);
|
||||
auto& im = TCAP(fc::t_enter_insert_mode);
|
||||
auto& ei = TCAP(fc::t_exit_insert_mode);
|
||||
auto& ip = TCAP(fc::t_insert_padding);
|
||||
auto& ic = TCAP(fc::t_insert_character);
|
||||
|
||||
x = int(getColumnNumber()) - 2;
|
||||
y = int(getLineNumber()) - 1;
|
||||
|
|
293
src/fwidget.cpp
293
src/fwidget.cpp
|
@ -104,7 +104,7 @@ FWidget::~FWidget() // destructor
|
|||
// unset the local window widget focus
|
||||
if ( flags.focus )
|
||||
{
|
||||
if ( FWindow* window = FWindow::getWindowWidget(this) )
|
||||
if ( auto window = FWindow::getWindowWidget(this) )
|
||||
window->setWindowFocusWidget(0);
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,8 @@ FWidget::~FWidget() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
FWidget* FWidget::getRootWidget() const
|
||||
{
|
||||
FWidget* obj = const_cast<FWidget*>(this);
|
||||
FWidget* p_obj = getParentWidget();
|
||||
auto obj = const_cast<FWidget*>(this);
|
||||
auto p_obj = getParentWidget();
|
||||
|
||||
while ( ! obj->isRootWidget() && p_obj )
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ FWidget* FWidget::getRootWidget() const
|
|||
//----------------------------------------------------------------------
|
||||
FWidget* FWidget::getParentWidget() const
|
||||
{
|
||||
FObject* p_obj = getParent();
|
||||
auto p_obj = getParent();
|
||||
|
||||
if ( p_obj && p_obj->isWidget() )
|
||||
return static_cast<FWidget*>(p_obj);
|
||||
|
@ -158,15 +158,14 @@ FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
|
|||
if ( list.empty() )
|
||||
return 0;
|
||||
|
||||
constFObjectIterator iter, last;
|
||||
iter = list.begin();
|
||||
last = list.end();
|
||||
auto iter = list.begin();
|
||||
auto last = list.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
FWidget* child = static_cast<FWidget*>(*iter);
|
||||
auto child = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( child->isEnabled() && child->acceptFocus() )
|
||||
return child;
|
||||
|
@ -184,9 +183,8 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
|||
if ( list.empty() )
|
||||
return 0;
|
||||
|
||||
constFObjectIterator iter, first;
|
||||
first = list.begin();
|
||||
iter = list.end();
|
||||
auto first = list.begin();
|
||||
auto iter = list.end();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -195,7 +193,7 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
|||
if ( ! (*iter)->isWidget() )
|
||||
continue;
|
||||
|
||||
FWidget* child = static_cast<FWidget*>(*iter);
|
||||
auto child = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( child->isEnabled() && child->acceptFocus() )
|
||||
return child;
|
||||
|
@ -208,11 +206,9 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
|||
//----------------------------------------------------------------------
|
||||
FPoint FWidget::getPrintPos()
|
||||
{
|
||||
const FPoint cur = getPrintCursor();
|
||||
int cx = cur.getX();
|
||||
int cy = cur.getY();
|
||||
return FPoint ( cx - offset.getX1() - getX() + 1
|
||||
, cy - offset.getY1() - getY() + 1 );
|
||||
const auto cur = getPrintCursor();
|
||||
return FPoint ( cur.getX() - offset.getX1() - getX() + 1
|
||||
, cur.getY() - offset.getY1() - getY() + 1 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -245,7 +241,7 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
|
|||
void FWidget::setMainWidget (FWidget* obj)
|
||||
{
|
||||
main_widget = obj;
|
||||
FWidget* app_object = FApplication::getApplicationObject();
|
||||
auto app_object = FApplication::getApplicationObject();
|
||||
|
||||
if ( obj && app_object && ! getFocusWidget() )
|
||||
app_object->focusFirstChild();
|
||||
|
@ -260,16 +256,13 @@ bool FWidget::setEnable (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::setFocus (bool on)
|
||||
{
|
||||
FWindow* window;
|
||||
FWidget* last_focus;
|
||||
|
||||
if ( ! isEnabled() )
|
||||
return false;
|
||||
|
||||
if ( flags.focus == on )
|
||||
return true;
|
||||
|
||||
last_focus = FWidget::getFocusWidget();
|
||||
auto last_focus = FWidget::getFocusWidget();
|
||||
|
||||
// set widget focus
|
||||
if ( on && ! flags.focus )
|
||||
|
@ -286,7 +279,7 @@ bool FWidget::setFocus (bool on)
|
|||
}
|
||||
}
|
||||
|
||||
window = FWindow::getWindowWidget(this);
|
||||
auto window = FWindow::getWindowWidget(this);
|
||||
|
||||
// set window focus
|
||||
if ( on && window )
|
||||
|
@ -457,7 +450,7 @@ void FWidget::setTopPadding (int top, bool adjust)
|
|||
{
|
||||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
auto r = rootObject;
|
||||
r->client_offset.setY1 (r->padding.top);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
|
@ -478,7 +471,7 @@ void FWidget::setLeftPadding (int left, bool adjust)
|
|||
{
|
||||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
auto r = rootObject;
|
||||
r->client_offset.setX1 (r->padding.left);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
|
@ -499,7 +492,7 @@ void FWidget::setBottomPadding (int bottom, bool adjust)
|
|||
{
|
||||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
auto r = rootObject;
|
||||
r->client_offset.setY2 (int(r->getHeight()) - 1 - r->padding.bottom);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
|
@ -520,7 +513,7 @@ void FWidget::setRightPadding (int right, bool adjust)
|
|||
{
|
||||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
auto r = rootObject;
|
||||
r->client_offset.setX2 (int(r->getWidth()) - 1 - r->padding.right);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
|
@ -532,7 +525,7 @@ void FWidget::setRightPadding (int right, bool adjust)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::setParentOffset()
|
||||
{
|
||||
FWidget* p = getParentWidget();
|
||||
auto p = getParentWidget();
|
||||
|
||||
if ( p )
|
||||
offset = p->client_offset;
|
||||
|
@ -541,7 +534,7 @@ void FWidget::setParentOffset()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::setTermOffset()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
int w = int(r->getWidth());
|
||||
int h = int(r->getHeight());
|
||||
offset.setCoordinates (0, 0, w - 1, h - 1);
|
||||
|
@ -550,7 +543,7 @@ void FWidget::setTermOffset()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::setTermOffsetWithPadding()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
offset.setCoordinates ( r->getLeftPadding()
|
||||
, r->getTopPadding()
|
||||
, int(r->getWidth()) - 1 - r->getRightPadding()
|
||||
|
@ -633,7 +626,7 @@ bool FWidget::setCursorPos (int x, int y)
|
|||
if ( ! FWindow::getWindowWidget(this) )
|
||||
return false;
|
||||
|
||||
term_area* area = getPrintArea();
|
||||
auto area = getPrintArea();
|
||||
|
||||
if ( area->widget )
|
||||
{
|
||||
|
@ -752,9 +745,8 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
|||
{
|
||||
if ( p && p->hasChildren() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = p->begin();
|
||||
last = p->end();
|
||||
auto iter = p->begin();
|
||||
auto last = p->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -764,14 +756,14 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
|||
continue;
|
||||
}
|
||||
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( widget->isEnabled()
|
||||
&& widget->isVisible()
|
||||
&& ! widget->isWindowWidget()
|
||||
&& widget->getTermGeometry().contains(x, y) )
|
||||
{
|
||||
FWidget* child = childWidgetAt(widget, x, y);
|
||||
auto child = childWidgetAt(widget, x, y);
|
||||
return ( child != 0 ) ? child : widget;
|
||||
}
|
||||
|
||||
|
@ -785,20 +777,18 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
int FWidget::numOfFocusableChildren()
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
|
||||
if ( ! hasChildren() )
|
||||
return 0;
|
||||
|
||||
int num = 0;
|
||||
iter = FObject::begin();
|
||||
last = FObject::end();
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( widget->acceptFocus() )
|
||||
num++;
|
||||
|
@ -859,12 +849,10 @@ void FWidget::delCallback (FCallback cb_handler)
|
|||
{
|
||||
// delete a cb_handler function pointer
|
||||
|
||||
CallbackObjects::iterator iter;
|
||||
|
||||
if ( callback_objects.empty() )
|
||||
return;
|
||||
|
||||
iter = callback_objects.begin();
|
||||
auto iter = callback_objects.begin();
|
||||
|
||||
while ( iter != callback_objects.end() )
|
||||
{
|
||||
|
@ -880,12 +868,10 @@ void FWidget::delCallback (FWidget* cb_instance)
|
|||
{
|
||||
// delete all member function pointer from cb_instance
|
||||
|
||||
FWidget::MemberCallbackObjects::iterator iter;
|
||||
|
||||
if ( member_callback_objects.empty() )
|
||||
return;
|
||||
|
||||
iter = member_callback_objects.begin();
|
||||
auto iter = member_callback_objects.begin();
|
||||
|
||||
while ( iter != member_callback_objects.end() )
|
||||
{
|
||||
|
@ -909,19 +895,19 @@ void FWidget::delCallbacks()
|
|||
void FWidget::emitCallback (const FString& emit_signal)
|
||||
{
|
||||
// member function pointer
|
||||
|
||||
if ( ! member_callback_objects.empty() )
|
||||
{
|
||||
MemberCallbackObjects::const_iterator m_iter, m_end;
|
||||
m_iter = member_callback_objects.begin();
|
||||
m_end = member_callback_objects.end();
|
||||
auto m_iter = member_callback_objects.begin();
|
||||
auto m_end = member_callback_objects.end();
|
||||
|
||||
while ( m_iter != m_end )
|
||||
{
|
||||
if ( m_iter->cb_signal == emit_signal )
|
||||
{
|
||||
FMemberCallback callback = m_iter->cb_handler;
|
||||
auto callback = m_iter->cb_handler;
|
||||
// call the member function pointer
|
||||
(m_iter->cb_instance->*callback)(this, m_iter->data);
|
||||
(m_iter->cb_instance->*callback) (this, m_iter->data);
|
||||
}
|
||||
|
||||
++m_iter;
|
||||
|
@ -931,17 +917,16 @@ void FWidget::emitCallback (const FString& emit_signal)
|
|||
// function pointer
|
||||
if ( ! callback_objects.empty() )
|
||||
{
|
||||
CallbackObjects::const_iterator iter, last;
|
||||
iter = callback_objects.begin();
|
||||
last = callback_objects.end();
|
||||
auto iter = callback_objects.begin();
|
||||
auto last = callback_objects.end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( iter->cb_signal == emit_signal )
|
||||
{
|
||||
FCallback callback = iter->cb_handler;
|
||||
auto callback = iter->cb_handler;
|
||||
// call the function pointer
|
||||
callback(this, iter->data);
|
||||
callback (this, iter->data);
|
||||
}
|
||||
|
||||
++iter;
|
||||
|
@ -952,7 +937,7 @@ void FWidget::emitCallback (const FString& emit_signal)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::addAccelerator (FKey key, FWidget* obj)
|
||||
{
|
||||
FWidget* widget = FWindow::getWindowWidget(obj);
|
||||
auto widget = static_cast<FWidget*>(FWindow::getWindowWidget(obj));
|
||||
accelerator accel = { key, obj };
|
||||
|
||||
if ( ! widget || widget == statusbar || widget == menubar )
|
||||
|
@ -965,7 +950,7 @@ void FWidget::addAccelerator (FKey key, FWidget* obj)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::delAccelerator (FWidget* obj)
|
||||
{
|
||||
FWidget* widget = FWindow::getWindowWidget(this);
|
||||
auto widget = static_cast<FWidget*>(FWindow::getWindowWidget(this));
|
||||
|
||||
if ( ! widget || widget == statusbar || widget == menubar )
|
||||
widget = getRootWidget();
|
||||
|
@ -974,8 +959,7 @@ void FWidget::delAccelerator (FWidget* obj)
|
|||
&& widget->accelerator_list
|
||||
&& ! widget->accelerator_list->empty() )
|
||||
{
|
||||
FWidget::Accelerators::iterator iter;
|
||||
iter = widget->accelerator_list->begin();
|
||||
auto iter = widget->accelerator_list->begin();
|
||||
|
||||
while ( iter != widget->accelerator_list->end() )
|
||||
{
|
||||
|
@ -1056,7 +1040,7 @@ void FWidget::show()
|
|||
initScreenSettings();
|
||||
|
||||
// draw the vdesktop
|
||||
FWidget* r = getRootWidget();
|
||||
auto r = getRootWidget();
|
||||
setColor(r->getForegroundColor(), r->getBackgroundColor());
|
||||
clearArea (vdesktop);
|
||||
init_desktop = true;
|
||||
|
@ -1073,15 +1057,14 @@ void FWidget::show()
|
|||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = FObject::begin();
|
||||
last = FObject::end();
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
widget->show();
|
||||
}
|
||||
|
||||
|
@ -1127,13 +1110,11 @@ void FWidget::hide()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::focusFirstChild()
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
|
||||
if ( ! hasChildren() )
|
||||
return false;
|
||||
|
||||
iter = FObject::begin();
|
||||
last = FObject::end();
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -1143,7 +1124,7 @@ bool FWidget::focusFirstChild()
|
|||
continue;
|
||||
}
|
||||
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( widget->isEnabled()
|
||||
&& widget->acceptFocus()
|
||||
|
@ -1171,13 +1152,11 @@ bool FWidget::focusFirstChild()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::focusLastChild()
|
||||
{
|
||||
constFObjectIterator iter, first;
|
||||
|
||||
if ( ! hasChildren() )
|
||||
return false;
|
||||
|
||||
iter = FObject::end();
|
||||
first = FObject::begin();
|
||||
auto iter = FObject::end();
|
||||
auto first = FObject::begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1186,7 +1165,7 @@ bool FWidget::focusLastChild()
|
|||
if ( ! (*iter)->isWidget() )
|
||||
continue;
|
||||
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( widget->isEnabled()
|
||||
&& widget->acceptFocus()
|
||||
|
@ -1211,7 +1190,7 @@ bool FWidget::focusLastChild()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::detectTermSize()
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
auto r = rootObject;
|
||||
FTerm::detectTermSize();
|
||||
r->adjust_wsize.setRect (1, 1, getDesktopWidth(), getDesktopHeight());
|
||||
r->offset.setRect (0, 0, getDesktopWidth(), getDesktopHeight());
|
||||
|
@ -1275,14 +1254,14 @@ void FWidget::clearShadow()
|
|||
setColor (wc.shadow_fg, wc.shadow_bg);
|
||||
setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( FWidget* p = getParentWidget() )
|
||||
else if ( auto p = getParentWidget() )
|
||||
setColor (wc.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
if ( w <= offset.getX2() )
|
||||
{
|
||||
for (int i = 1; i <= int(getHeight()); i++)
|
||||
for (std::size_t y = 1; y <= getHeight(); y++)
|
||||
{
|
||||
setPrintPos (w + 1, i);
|
||||
setPrintPos (w + 1, int(y));
|
||||
print (' '); // clear █
|
||||
}
|
||||
}
|
||||
|
@ -1310,14 +1289,14 @@ void FWidget::drawFlatBorder()
|
|||
, y1 = 0
|
||||
, y2 = int(getHeight()) + 1;
|
||||
|
||||
if ( FWidget* p = getParentWidget() )
|
||||
if ( auto p = getParentWidget() )
|
||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + y + 1);
|
||||
setPrintPos (x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.left[uLong(y)] )
|
||||
// left+right line (on left side)
|
||||
|
@ -1329,9 +1308,9 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x2, y1 + 1);
|
||||
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
if ( double_flatline_mask.right[uLong(y)] )
|
||||
if ( double_flatline_mask.right[y] )
|
||||
// left+right line (on right side)
|
||||
print (fc::NF_rev_border_line_right_and_left);
|
||||
else
|
||||
|
@ -1343,9 +1322,9 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x1, y1);
|
||||
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[uLong(x)] )
|
||||
if ( double_flatline_mask.top[x] )
|
||||
// top+bottom line (at top)
|
||||
print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
|
@ -1355,9 +1334,9 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x1, y2);
|
||||
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||
if ( double_flatline_mask.bottom[x] )
|
||||
// top+bottom line (at bottom)
|
||||
print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
|
@ -1377,28 +1356,28 @@ void FWidget::clearFlatBorder()
|
|||
, y1 = 0
|
||||
, y2 = int(getHeight()) + 1;
|
||||
|
||||
if ( FWidget* p = getParentWidget() )
|
||||
if ( auto p = getParentWidget() )
|
||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||
|
||||
// clear on left side
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + y + 1);
|
||||
setPrintPos (x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.left[uLong(y)] )
|
||||
if ( double_flatline_mask.left[y] )
|
||||
print (fc::NF_border_line_left);
|
||||
else
|
||||
print (' ');
|
||||
}
|
||||
|
||||
// clear on right side
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
for (std::size_t y = 0; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2, y1 + y + 1);
|
||||
setPrintPos (x2, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.right[uLong(y)] )
|
||||
if ( double_flatline_mask.right[y] )
|
||||
print (fc::NF_rev_border_line_right);
|
||||
else
|
||||
print (' ');
|
||||
|
@ -1407,9 +1386,9 @@ void FWidget::clearFlatBorder()
|
|||
// clear at top
|
||||
setPrintPos (x1, y1);
|
||||
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[uLong(x)] )
|
||||
if ( double_flatline_mask.top[x] )
|
||||
print (fc::NF_border_line_upper);
|
||||
else
|
||||
print (' ');
|
||||
|
@ -1418,9 +1397,9 @@ void FWidget::clearFlatBorder()
|
|||
// clear at bottom
|
||||
setPrintPos (x1, y2);
|
||||
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
for (std::size_t x = 0; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||
if ( double_flatline_mask.bottom[x] )
|
||||
print (fc::NF_border_line_bottom);
|
||||
else
|
||||
print (' ');
|
||||
|
@ -1457,8 +1436,8 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::quit()
|
||||
{
|
||||
FWidget* app_object = FApplication::getApplicationObject();
|
||||
FApplication* fapp = static_cast<FApplication*>(app_object);
|
||||
auto app_object = FApplication::getApplicationObject();
|
||||
auto fapp = static_cast<FApplication*>(app_object);
|
||||
fapp->exit(0);
|
||||
}
|
||||
|
||||
|
@ -1520,7 +1499,7 @@ void FWidget::delPreprocessingHandler (FVTerm* instance)
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::isChildPrintArea() const
|
||||
{
|
||||
FWidget* p_obj = static_cast<FWidget*>(getParent());
|
||||
auto p_obj = static_cast<FWidget*>(getParent());
|
||||
|
||||
if ( p_obj
|
||||
&& p_obj->child_print_area
|
||||
|
@ -1559,7 +1538,7 @@ void FWidget::adjustSize()
|
|||
{
|
||||
if ( ! isRootWidget() )
|
||||
{
|
||||
FWidget* p = getParentWidget();
|
||||
auto p = getParentWidget();
|
||||
|
||||
if ( isWindowWidget() )
|
||||
{
|
||||
|
@ -1595,15 +1574,14 @@ void FWidget::adjustSize()
|
|||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
constFObjectIterator iter, last;
|
||||
iter = FObject::begin();
|
||||
last = FObject::end();
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( ! widget->isWindowWidget() )
|
||||
widget->adjustSize();
|
||||
|
@ -1624,15 +1602,8 @@ void FWidget::adjustSizeGlobal()
|
|||
|
||||
if ( window_list && ! window_list->empty() )
|
||||
{
|
||||
widgetList::const_iterator iter, last;
|
||||
iter = window_list->begin();
|
||||
last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
(*iter)->adjustSize();
|
||||
++iter;
|
||||
}
|
||||
for (auto&& window : *window_list)
|
||||
window->adjustSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1642,16 +1613,15 @@ bool FWidget::focusNextChild()
|
|||
if ( isDialogWidget() || ! hasParent() )
|
||||
return false;
|
||||
|
||||
FWidget* parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
|
||||
if ( ! parent
|
||||
|| ! parent->hasChildren()
|
||||
|| parent->numOfFocusableChildren() <= 1 )
|
||||
return false;
|
||||
|
||||
FObjectIterator iter, last;
|
||||
iter = parent->begin();
|
||||
last = parent->end();
|
||||
auto iter = parent->begin();
|
||||
auto last = parent->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
|
@ -1661,7 +1631,7 @@ bool FWidget::focusNextChild()
|
|||
continue;
|
||||
}
|
||||
|
||||
FWidget* w = static_cast<FWidget*>(*iter);
|
||||
auto w = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( w != this )
|
||||
{
|
||||
|
@ -1670,8 +1640,7 @@ bool FWidget::focusNextChild()
|
|||
}
|
||||
|
||||
FWidget* next = nullptr;
|
||||
constFObjectIterator next_element;
|
||||
next_element = iter;
|
||||
auto next_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1707,16 +1676,15 @@ bool FWidget::focusPrevChild()
|
|||
if ( isDialogWidget() || ! hasParent() )
|
||||
return false;
|
||||
|
||||
FWidget* parent = getParentWidget();
|
||||
auto parent = getParentWidget();
|
||||
|
||||
if ( ! parent
|
||||
|| ! parent->hasChildren()
|
||||
|| parent->numOfFocusableChildren() <= 1 )
|
||||
return false;
|
||||
|
||||
FObjectIterator iter, first;
|
||||
iter = parent->end();
|
||||
first = parent->begin();
|
||||
auto iter = parent->end();
|
||||
auto first = parent->begin();
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1725,14 +1693,13 @@ bool FWidget::focusPrevChild()
|
|||
if ( ! (*iter)->isWidget() )
|
||||
continue;
|
||||
|
||||
FWidget* w = static_cast<FWidget*>(*iter);
|
||||
auto w = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( w != this )
|
||||
continue;
|
||||
|
||||
FWidget* prev = nullptr;
|
||||
constFObjectIterator prev_element;
|
||||
prev_element = iter;
|
||||
auto prev_element = iter;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1771,75 +1738,75 @@ bool FWidget::event (FEvent* ev)
|
|||
switch ( ev->type() )
|
||||
{
|
||||
case fc::KeyPress_Event:
|
||||
KeyPressEvent ( static_cast<FKeyEvent*>(ev) );
|
||||
KeyPressEvent (static_cast<FKeyEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::KeyUp_Event:
|
||||
onKeyUp ( static_cast<FKeyEvent*>(ev) );
|
||||
onKeyUp (static_cast<FKeyEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::KeyDown_Event:
|
||||
KeyDownEvent ( static_cast<FKeyEvent*>(ev) );
|
||||
KeyDownEvent (static_cast<FKeyEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::MouseDown_Event:
|
||||
onMouseDown ( static_cast<FMouseEvent*>(ev) );
|
||||
onMouseDown (static_cast<FMouseEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::MouseUp_Event:
|
||||
onMouseUp ( static_cast<FMouseEvent*>(ev) );
|
||||
onMouseUp (static_cast<FMouseEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::MouseDoubleClick_Event:
|
||||
onMouseDoubleClick ( static_cast<FMouseEvent*>(ev) );
|
||||
onMouseDoubleClick (static_cast<FMouseEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::MouseWheel_Event:
|
||||
onWheel ( static_cast<FWheelEvent*>(ev) );
|
||||
onWheel (static_cast<FWheelEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::MouseMove_Event:
|
||||
onMouseMove ( static_cast<FMouseEvent*>(ev) );
|
||||
onMouseMove (static_cast<FMouseEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::FocusIn_Event:
|
||||
onFocusIn ( static_cast<FFocusEvent*>(ev) );
|
||||
onFocusIn (static_cast<FFocusEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::FocusOut_Event:
|
||||
onFocusOut ( static_cast<FFocusEvent*>(ev) );
|
||||
onFocusOut (static_cast<FFocusEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::ChildFocusIn_Event:
|
||||
onChildFocusIn ( static_cast<FFocusEvent*>(ev) );
|
||||
onChildFocusIn (static_cast<FFocusEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::ChildFocusOut_Event:
|
||||
onChildFocusOut ( static_cast<FFocusEvent*>(ev) );
|
||||
onChildFocusOut (static_cast<FFocusEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Accelerator_Event:
|
||||
onAccel ( static_cast<FAccelEvent*>(ev) );
|
||||
onAccel (static_cast<FAccelEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Resize_Event:
|
||||
onResize ( static_cast<FResizeEvent*>(ev) );
|
||||
onResize (static_cast<FResizeEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Show_Event:
|
||||
onShow ( static_cast<FShowEvent*>(ev) );
|
||||
onShow (static_cast<FShowEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Hide_Event:
|
||||
onHide ( static_cast<FHideEvent*>(ev) );
|
||||
onHide (static_cast<FHideEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Close_Event:
|
||||
onClose ( static_cast<FCloseEvent*>(ev) );
|
||||
onClose (static_cast<FCloseEvent*>(ev));
|
||||
break;
|
||||
|
||||
case fc::Timer_Event:
|
||||
onTimer ( static_cast<FTimerEvent*>(ev) );
|
||||
onTimer (static_cast<FTimerEvent*>(ev));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2169,15 +2136,14 @@ void FWidget::drawWindows()
|
|||
if ( ! window_list || window_list->empty() )
|
||||
return;
|
||||
|
||||
widgetList::const_iterator iter, last;
|
||||
iter = window_list->begin();
|
||||
last = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isVisible() )
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
auto win = (*iter)->getVWin();
|
||||
int w = win->width + win->right_shadow;
|
||||
int h = win->height + win->bottom_shadow;
|
||||
std::fill_n (win->text, w * h, default_char);
|
||||
|
@ -2196,15 +2162,14 @@ void FWidget::drawChildren()
|
|||
if ( ! hasChildren() )
|
||||
return;
|
||||
|
||||
constFObjectIterator iter, last;
|
||||
iter = FObject::begin();
|
||||
last = FObject::end();
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
|
||||
if ( widget->isVisible() && ! widget->isWindowWidget() )
|
||||
widget->redraw();
|
||||
|
@ -2226,9 +2191,9 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
|||
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (int i = 1; i < int(getHeight()); i++)
|
||||
for (std::size_t y = 1; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + i);
|
||||
setPrintPos (x2 + 1, y1 + int(y));
|
||||
print (" ");
|
||||
}
|
||||
|
||||
|
@ -2241,7 +2206,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
|||
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (std::size_t i = 2; i <= getWidth() + 1; i++)
|
||||
for (std::size_t x = 2; x <= getWidth() + 1; x++)
|
||||
print (' ');
|
||||
|
||||
unsetTransShadow();
|
||||
|
@ -2266,7 +2231,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
setColor (wc.shadow_fg, wc.shadow_bg);
|
||||
setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( FWidget* p = getParentWidget() )
|
||||
else if ( auto p = getParentWidget() )
|
||||
setColor (wc.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
block = fc::FullBlock; // █
|
||||
|
@ -2275,9 +2240,9 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
if ( isWindowWidget() )
|
||||
unsetInheritBackground();
|
||||
|
||||
for (int i = 1; i < int(getHeight()); i++)
|
||||
for (std::size_t y = 1; y < getHeight(); y++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + i);
|
||||
setPrintPos (x2 + 1, y1 + int(y));
|
||||
print (block); // █
|
||||
}
|
||||
|
||||
|
@ -2286,7 +2251,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
if ( isWindowWidget() )
|
||||
setInheritBackground();
|
||||
|
||||
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||
for (std::size_t x = 1; x <= getWidth(); x++)
|
||||
print (fc::UpperHalfBlock); // ▀
|
||||
|
||||
if ( isWindowWidget() )
|
||||
|
|
|
@ -51,7 +51,7 @@ FWindow::FWindow(FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FWindow::~FWindow() // destructor
|
||||
{
|
||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||
auto fapp = static_cast<FApplication*>(getRootWidget());
|
||||
|
||||
if ( previous_window == this )
|
||||
previous_window = nullptr;
|
||||
|
@ -103,7 +103,6 @@ bool FWindow::setWindowWidget (bool on)
|
|||
void FWindow::setActiveWindow (FWindow* window)
|
||||
{
|
||||
// activate FWindow object window
|
||||
widgetList::const_iterator iter, end;
|
||||
|
||||
if ( ! window_list )
|
||||
return;
|
||||
|
@ -111,8 +110,8 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
if ( window_list->empty() )
|
||||
return;
|
||||
|
||||
iter = window_list->begin();
|
||||
end = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto end = window_list->end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -127,7 +126,7 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
}
|
||||
else
|
||||
{
|
||||
FWindow* w = static_cast<FWindow*>(*iter);
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
|
||||
if ( w->isWindowActive() )
|
||||
{
|
||||
|
@ -439,16 +438,15 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
|
|||
// returns the window object to the corresponding coordinates
|
||||
if ( window_list && ! window_list->empty() )
|
||||
{
|
||||
widgetList::const_iterator iter, begin;
|
||||
iter = window_list->end();
|
||||
begin = window_list->begin();
|
||||
auto iter = window_list->end();
|
||||
auto begin = window_list->begin();
|
||||
|
||||
do
|
||||
{
|
||||
--iter;
|
||||
if ( *iter )
|
||||
{
|
||||
FWindow* w = static_cast<FWindow*>(*iter);
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
|
||||
if ( ! w->isWindowHidden()
|
||||
&& w->getTermGeometry().contains(x, y) )
|
||||
|
@ -478,8 +476,7 @@ void FWindow::delWindow (FWidget* obj)
|
|||
if ( ! window_list || window_list->empty() )
|
||||
return;
|
||||
|
||||
widgetList::iterator iter;
|
||||
iter = window_list->begin();
|
||||
auto iter = window_list->begin();
|
||||
|
||||
while ( iter != window_list->end() )
|
||||
{
|
||||
|
@ -497,7 +494,7 @@ void FWindow::delWindow (FWidget* obj)
|
|||
FWindow* FWindow::getWindowWidget (const FWidget* obj)
|
||||
{
|
||||
// returns the window object to the given widget obj
|
||||
FWidget* p_obj = obj->getParentWidget();
|
||||
auto p_obj = obj->getParentWidget();
|
||||
|
||||
while ( ! obj->isWindowWidget() && p_obj )
|
||||
{
|
||||
|
@ -515,7 +512,7 @@ FWindow* FWindow::getWindowWidget (const FWidget* obj)
|
|||
int FWindow::getWindowLayer (const FWidget* obj)
|
||||
{
|
||||
// returns the window layer from the widget obj
|
||||
widgetList::iterator iter, end;
|
||||
|
||||
const FWidget* window;
|
||||
|
||||
if ( ! window_list )
|
||||
|
@ -532,8 +529,8 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
|||
else
|
||||
window = obj;
|
||||
|
||||
iter = window_list->begin();
|
||||
end = window_list->end();
|
||||
auto iter = window_list->begin();
|
||||
auto end = window_list->end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -550,7 +547,6 @@ int FWindow::getWindowLayer (const FWidget* obj)
|
|||
void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
||||
{
|
||||
// swaps the window layer between obj1 and obj2
|
||||
widgetList::iterator iter, iter1, iter2, end;
|
||||
|
||||
if ( ! window_list )
|
||||
return;
|
||||
|
@ -564,10 +560,10 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
|||
if ( obj2->getFlags().modal )
|
||||
return;
|
||||
|
||||
iter = window_list->begin();
|
||||
end = window_list->end();
|
||||
iter1 = end;
|
||||
iter2 = end;
|
||||
auto iter = window_list->begin();
|
||||
auto end = window_list->end();
|
||||
auto iter1 = end;
|
||||
auto iter2 = end;
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
|
@ -587,7 +583,6 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
|
|||
bool FWindow::raiseWindow (FWidget* obj)
|
||||
{
|
||||
// raises the window widget obj to the top
|
||||
widgetList::iterator iter;
|
||||
|
||||
if ( ! window_list )
|
||||
return false;
|
||||
|
@ -605,7 +600,7 @@ bool FWindow::raiseWindow (FWidget* obj)
|
|||
&& ! obj->isMenuWidget() )
|
||||
return false;
|
||||
|
||||
iter = window_list->begin();
|
||||
auto iter = window_list->begin();
|
||||
|
||||
while ( iter != window_list->end() )
|
||||
{
|
||||
|
@ -629,7 +624,6 @@ bool FWindow::raiseWindow (FWidget* obj)
|
|||
bool FWindow::lowerWindow (FWidget* obj)
|
||||
{
|
||||
// lowers the window widget obj to the bottom
|
||||
widgetList::iterator iter;
|
||||
|
||||
if ( ! window_list )
|
||||
return false;
|
||||
|
@ -646,7 +640,7 @@ bool FWindow::lowerWindow (FWidget* obj)
|
|||
if ( obj->getFlags().modal )
|
||||
return false;
|
||||
|
||||
iter = window_list->begin();
|
||||
auto iter = window_list->begin();
|
||||
|
||||
while ( iter != window_list->end() )
|
||||
{
|
||||
|
@ -701,21 +695,20 @@ void FWindow::switchToPrevWindow (FWidget* widget)
|
|||
widget->updateTerminal (FVTerm::stop_refresh);
|
||||
|
||||
bool is_activated = activatePrevWindow();
|
||||
FWindow* active_win = static_cast<FWindow*>(getActiveWindow());
|
||||
auto active_win = static_cast<FWindow*>(getActiveWindow());
|
||||
|
||||
if ( ! is_activated )
|
||||
{
|
||||
// no previous window -> looking for another window
|
||||
if ( window_list && window_list->size() > 1 )
|
||||
{
|
||||
widgetList::const_iterator iter, begin;
|
||||
iter = window_list->end();
|
||||
begin = window_list->begin();
|
||||
auto iter = window_list->end();
|
||||
auto begin = window_list->begin();
|
||||
|
||||
do
|
||||
{
|
||||
--iter;
|
||||
FWindow* w = static_cast<FWindow*>(*iter);
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
|
||||
if ( w
|
||||
&& w != active_win
|
||||
|
@ -733,7 +726,7 @@ void FWindow::switchToPrevWindow (FWidget* widget)
|
|||
|
||||
if ( active_win )
|
||||
{
|
||||
FWidget* focus = active_win->getWindowFocusWidget();
|
||||
auto focus = active_win->getWindowFocusWidget();
|
||||
|
||||
if ( ! active_win->isWindowActive() )
|
||||
setActiveWindow(active_win);
|
||||
|
@ -756,7 +749,7 @@ void FWindow::switchToPrevWindow (FWidget* widget)
|
|||
bool FWindow::activatePrevWindow()
|
||||
{
|
||||
// activate the previous window
|
||||
FWindow* w = previous_window;
|
||||
auto w = previous_window;
|
||||
|
||||
if ( w )
|
||||
{
|
||||
|
@ -787,7 +780,7 @@ void FWindow::setShadowSize (int right, int bottom)
|
|||
if ( isVirtualWindow()
|
||||
&& (new_right != old_right || new_bottom != old_bottom) )
|
||||
{
|
||||
FRect geometry = getTermGeometry();
|
||||
auto geometry = getTermGeometry();
|
||||
geometry.move(-1, -1);
|
||||
resizeArea (geometry, getShadow(), vwin);
|
||||
}
|
||||
|
@ -867,8 +860,7 @@ void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
|||
if ( ! always_on_top_list || always_on_top_list->empty() )
|
||||
return;
|
||||
|
||||
widgetList::iterator iter;
|
||||
iter = always_on_top_list->begin();
|
||||
auto iter = always_on_top_list->begin();
|
||||
|
||||
while ( iter != always_on_top_list->end() )
|
||||
{
|
||||
|
@ -889,8 +881,7 @@ void FWindow::processAlwaysOnTop()
|
|||
if ( ! always_on_top_list || always_on_top_list->empty() )
|
||||
return;
|
||||
|
||||
widgetList::iterator iter;
|
||||
iter = always_on_top_list->begin();
|
||||
auto iter = always_on_top_list->begin();
|
||||
|
||||
while ( iter != always_on_top_list->end() )
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#define null NULL
|
||||
#define null nullptr
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ void FObjectTest::noArgumentTest()
|
|||
CPPUNIT_ASSERT ( o1.getChild(0) == 0 );
|
||||
CPPUNIT_ASSERT ( o1.getChild(1) == 0 );
|
||||
CPPUNIT_ASSERT ( o1.numOfChildren() == 0 );
|
||||
finalcut::FObject::FObjectList& children_list = o1.getChildren();
|
||||
auto& children_list = o1.getChildren();
|
||||
CPPUNIT_ASSERT ( children_list.begin() == o1.begin() );
|
||||
CPPUNIT_ASSERT ( children_list.begin() == o1.end() );
|
||||
CPPUNIT_ASSERT ( children_list.end() == o1.begin() );
|
||||
|
@ -162,7 +162,7 @@ void FObjectTest::noArgumentTest()
|
|||
CPPUNIT_ASSERT ( ! o1.isTimerInUpdating() );
|
||||
|
||||
FObject_protected t;
|
||||
finalcut::FEvent* ev = new finalcut::FEvent(finalcut::fc::None_Event);
|
||||
auto ev = new finalcut::FEvent(finalcut::fc::None_Event);
|
||||
CPPUNIT_ASSERT ( ! t.event(ev) );
|
||||
delete ev;
|
||||
|
||||
|
@ -183,13 +183,13 @@ void FObjectTest::childObjectTest()
|
|||
* -> c4
|
||||
*/
|
||||
finalcut::FObject obj;
|
||||
finalcut::FObject* c1 = new finalcut::FObject(&obj);
|
||||
finalcut::FObject* c2 = new finalcut::FObject(&obj);
|
||||
finalcut::FObject* c3 = new finalcut::FObject(&obj);
|
||||
finalcut::FObject* c4 = new finalcut::FObject(&obj);
|
||||
finalcut::FObject* c5 = new finalcut::FObject(c1);
|
||||
finalcut::FObject* c6 = new finalcut::FObject(c5);
|
||||
finalcut::FObject* c7 = new finalcut::FObject();
|
||||
auto c1 = new finalcut::FObject(&obj);
|
||||
auto c2 = new finalcut::FObject(&obj);
|
||||
auto c3 = new finalcut::FObject(&obj);
|
||||
auto c4 = new finalcut::FObject(&obj);
|
||||
auto c5 = new finalcut::FObject(c1);
|
||||
auto c6 = new finalcut::FObject(c5);
|
||||
auto c7 = new finalcut::FObject();
|
||||
|
||||
CPPUNIT_ASSERT ( obj.hasChildren() );
|
||||
CPPUNIT_ASSERT ( obj.getChild(0) == 0 );
|
||||
|
@ -222,7 +222,7 @@ void FObjectTest::childObjectTest()
|
|||
CPPUNIT_ASSERT ( c2->getChild(1) == 0 );
|
||||
CPPUNIT_ASSERT ( c1->numOfChildren() == 1 );
|
||||
CPPUNIT_ASSERT ( c2->numOfChildren() == 0 );
|
||||
const finalcut::FObject::FObjectList& children_list2 = c1->getChildren();
|
||||
const auto& children_list2 = c1->getChildren();
|
||||
CPPUNIT_ASSERT ( children_list2.begin() == c1->begin() );
|
||||
CPPUNIT_ASSERT ( children_list2.begin() != c1->end() );
|
||||
CPPUNIT_ASSERT ( children_list2.end() != c1->begin() );
|
||||
|
@ -249,8 +249,8 @@ void FObjectTest::removeParentTest()
|
|||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
finalcut::FObject* obj = new finalcut::FObject();
|
||||
finalcut::FObject* child = new finalcut::FObject(obj);
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject(obj);
|
||||
|
||||
CPPUNIT_ASSERT ( obj->hasChildren() );
|
||||
CPPUNIT_ASSERT ( obj->numOfChildren() == 1 );
|
||||
|
@ -276,8 +276,8 @@ void FObjectTest::addTest()
|
|||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
finalcut::FObject* obj = new finalcut::FObject();
|
||||
finalcut::FObject* child = new finalcut::FObject();
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject();
|
||||
|
||||
CPPUNIT_ASSERT ( ! obj->hasChildren() );
|
||||
CPPUNIT_ASSERT ( obj->numOfChildren() == 0 );
|
||||
|
@ -302,8 +302,8 @@ void FObjectTest::delTest()
|
|||
{/*
|
||||
* obj -> child
|
||||
*/
|
||||
finalcut::FObject* obj = new finalcut::FObject();
|
||||
finalcut::FObject* child = new finalcut::FObject(obj);
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child = new finalcut::FObject(obj);
|
||||
|
||||
CPPUNIT_ASSERT ( obj->hasChildren() );
|
||||
CPPUNIT_ASSERT ( obj->numOfChildren() == 1 );
|
||||
|
@ -331,10 +331,10 @@ void FObjectTest::iteratorTest()
|
|||
* -> child2
|
||||
* -> child3
|
||||
*/
|
||||
finalcut::FObject* obj = new finalcut::FObject();
|
||||
finalcut::FObject* child1 = new finalcut::FObject(obj);
|
||||
finalcut::FObject* child2 = new finalcut::FObject(obj);
|
||||
finalcut::FObject* child3 = new finalcut::FObject(obj);
|
||||
auto obj = new finalcut::FObject();
|
||||
auto child1 = new finalcut::FObject(obj);
|
||||
auto child2 = new finalcut::FObject(obj);
|
||||
auto child3 = new finalcut::FObject(obj);
|
||||
|
||||
CPPUNIT_ASSERT ( child1->getParent() == obj );
|
||||
CPPUNIT_ASSERT ( child2->getParent() == obj );
|
||||
|
|
|
@ -230,7 +230,7 @@ void FTermcapQuirksTest::generalTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -297,7 +297,7 @@ void FTermcapQuirksTest::xtermTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -330,7 +330,7 @@ void FTermcapQuirksTest::freebsdTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -369,7 +369,7 @@ void FTermcapQuirksTest::cygwinTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -396,7 +396,7 @@ void FTermcapQuirksTest::linuxTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -470,7 +470,7 @@ void FTermcapQuirksTest::rxvtTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -513,7 +513,7 @@ void FTermcapQuirksTest::vteTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -539,7 +539,7 @@ void FTermcapQuirksTest::puttyTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -631,7 +631,7 @@ void FTermcapQuirksTest::teratermTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -663,7 +663,7 @@ void FTermcapQuirksTest::sunTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
@ -686,7 +686,7 @@ void FTermcapQuirksTest::sunTest()
|
|||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_left_cursor].string
|
||||
, C_STR(CSI "%p1%dD") );
|
||||
|
||||
for (int i = 0; finalcut::fc::Fkey[i].tname[0] != 0; i++)
|
||||
for (std::size_t i = 0; finalcut::fc::Fkey[i].tname[0] != 0; i++)
|
||||
{
|
||||
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "K2", 2) == 0 ) // center of keypad
|
||||
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
|
||||
|
@ -783,7 +783,7 @@ void FTermcapQuirksTest::screenTest()
|
|||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||
|
||||
for (int i = 0; i < last_item; i++)
|
||||
for (std::size_t i = 0; i < last_item; i++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
|
|
|
@ -127,13 +127,13 @@ void FTermDataTest::dataTest()
|
|||
finalcut::FTermData data;
|
||||
|
||||
CPPUNIT_ASSERT ( data.getEncodingList().size() == 0 );
|
||||
finalcut::FTermData::encodingMap& encoding_list = data.getEncodingList();
|
||||
auto& encoding_list = data.getEncodingList();
|
||||
encoding_list["UTF8"] = finalcut::fc::UTF8;
|
||||
encoding_list["UTF-8"] = finalcut::fc::UTF8;
|
||||
encoding_list["VT100"] = finalcut::fc::VT100;
|
||||
encoding_list["PC"] = finalcut::fc::PC;
|
||||
encoding_list["ASCII"] = finalcut::fc::ASCII;
|
||||
finalcut::FTermData::encodingMap& enc_list = data.getEncodingList();
|
||||
auto& enc_list = data.getEncodingList();
|
||||
CPPUNIT_ASSERT ( enc_list.size() == 5 );
|
||||
CPPUNIT_ASSERT ( enc_list["UTF8"] == finalcut::fc::UTF8 );
|
||||
CPPUNIT_ASSERT ( enc_list["UTF-8"] == finalcut::fc::UTF8 );
|
||||
|
|
|
@ -390,7 +390,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture
|
|||
pid_t forkProcess();
|
||||
bool isChildProcess (pid_t);
|
||||
void terminalSimulation (console);
|
||||
void parseTerminalBuffer (int, console);
|
||||
void parseTerminalBuffer (std::size_t, console);
|
||||
|
||||
// Adds code needed to register the test suite
|
||||
CPPUNIT_TEST_SUITE (FTermDetectionTest);
|
||||
|
@ -2331,9 +2331,9 @@ void FTermDetectionTest::terminalSimulation (console con)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::parseTerminalBuffer (int length, console con)
|
||||
void FTermDetectionTest::parseTerminalBuffer (std::size_t length, console con)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
if ( buffer[i] == ENQ[0] ) // Enquiry character
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue