diff --git a/examples/calculator.cpp b/examples/calculator.cpp index 1d18c146..4ae11734 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -213,7 +213,7 @@ class Calc : public finalcut::FDialog void clearInfixOperator(); void calcInfixOperator(); virtual void adjustSize(); - const wchar_t* getButtonText (int); + const wchar_t* getButtonText (std::size_t); void mapKeyFunctions(); // Data Members @@ -228,7 +228,7 @@ class Calc : public finalcut::FDialog char infix_operator{'\0'}; char last_infix_operator{'\0'}; finalcut::FString input{""}; - int button_no[Calc::NUM_OF_BUTTONS]{}; + std::size_t button_no[Calc::NUM_OF_BUTTONS]{}; struct stack_data { @@ -262,10 +262,11 @@ Calc::Calc (FWidget* parent) btn->setGeometry(30, 15, 5, 3); else { - int x, y, n; + int x, y; + std::size_t n; ( key <= Three ) ? n = 0 : n = 1; - x = (key + n) % 5 * 7 + 2; - y = (key + n) / 5 * 2 + 3; + x = int(key + n) % 5 * 7 + 2; + y = int(key + n) / 5 * 2 + 3; btn->setGeometry(x, y, 5, 1); } @@ -1095,7 +1096,7 @@ void Calc::adjustSize() } //---------------------------------------------------------------------- -const wchar_t* Calc::getButtonText (int key) +const wchar_t* Calc::getButtonText (std::size_t key) { static const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] = { diff --git a/examples/mouse.cpp b/examples/mouse.cpp index 470f9a22..fa49f324 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -489,10 +489,10 @@ void MouseDraw::drawCanvas() winchar = &print_area->text[(ay + y) * w_line_len + ax]; std::memcpy (winchar, canvaschar, sizeof(charData) * unsigned(x_end)); - if ( short(print_area->changes[ay + y].xmin) > ax ) + if ( int(print_area->changes[ay + y].xmin) > ax ) print_area->changes[ay + y].xmin = uInt(ax); - if ( short(print_area->changes[ay + y].xmax) < ax + x_end - 1 ) + if ( int(print_area->changes[ay + y].xmax) < ax + x_end - 1 ) print_area->changes[ay + y].xmax = uInt(ax + x_end - 1); } diff --git a/examples/treeview.cpp b/examples/treeview.cpp index 6cb1f2b4..46df5fd1 100644 --- a/examples/treeview.cpp +++ b/examples/treeview.cpp @@ -29,19 +29,19 @@ // Function prototypes -long StringToLong (const finalcut::FString&); +uInt64 StringToNumber (const finalcut::FString&); bool sortAscending (const finalcut::FObject*, const finalcut::FObject*); bool sortDescending (const finalcut::FObject*, const finalcut::FObject*); // non-member functions //---------------------------------------------------------------------- -long StringToLong (const finalcut::FString& str) +uInt64 StringToNumber (const finalcut::FString& str) { auto NumString = str; NumString = NumString.replace(",", ""); NumString = NumString.replace('.', ""); - long number = NumString.toLong(); + uInt64 number = uInt64(NumString.toLong()); return number; } @@ -57,8 +57,8 @@ bool sortAscending ( const finalcut::FObject* lhs { case 2: { - const long l_number = StringToLong(l_item->getText(column)); - const long r_number = StringToLong(r_item->getText(column)); + const uInt64 l_number = StringToNumber(l_item->getText(column)); + const uInt64 r_number = StringToNumber(r_item->getText(column)); return bool( l_number < r_number ); // lhs < rhs } case 3: @@ -85,8 +85,8 @@ bool sortDescending ( const finalcut::FObject* lhs { case 2: { - const long l_number = StringToLong(l_item->getText(column)); - const long r_number = StringToLong(r_item->getText(column)); + const uInt64 l_number = StringToNumber(l_item->getText(column)); + const uInt64 r_number = StringToNumber(r_item->getText(column)); return bool( l_number > r_number ); // lhs > rhs } diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 51223d6d..e86d37f6 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include "final/fapplication.h" @@ -51,7 +52,7 @@ int FApplication::loop_level = 0; // event loop level int FApplication::quit_code = 0; bool FApplication::quit_now = false; -FApplication::eventQueuePtr FApplication::event_queue = nullptr; +FApplication::eventQueue* FApplication::event_queue = nullptr; //---------------------------------------------------------------------- @@ -86,6 +87,9 @@ FApplication::FApplication ( const int& _argc //---------------------------------------------------------------------- FApplication::~FApplication() // destructor { + if ( event_queue ) + delete event_queue; + app_object = nullptr; } @@ -188,7 +192,7 @@ bool FApplication::sendEvent ( const FObject* receiver && ! window->getFlags().modal && ! window->isMenuWidget() ) { - switch ( event->type() ) + switch ( uInt(event->type()) ) { case fc::KeyPress_Event: case fc::KeyUp_Event: @@ -355,7 +359,7 @@ void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev) // private methods of FApplication //---------------------------------------------------------------------- -void FApplication::init (long key_time, long dblclick_time) +void FApplication::init (uInt64 key_time, uInt64 dblclick_time) { // Initialize keyboard keyboard = FVTerm::getKeyboard(); @@ -385,7 +389,7 @@ void FApplication::init (long key_time, long dblclick_time) try { - event_queue = std::make_shared(); + event_queue = new eventQueue; } catch (const std::bad_alloc& ex) { diff --git a/src/fdialog.cpp b/src/fdialog.cpp index 1cdcd272..17d6f538 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fapplication.h" #include "final/fdialog.h" #include "final/fstatusbar.h" @@ -1312,7 +1314,7 @@ inline void FDialog::deactivateZoomButton() } //---------------------------------------------------------------------- -inline void FDialog::activateZoomButton (mouseStates& ms) +inline void FDialog::activateZoomButton (const mouseStates& ms) { if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn) || ms.mouse_y != 1 ) @@ -1324,7 +1326,7 @@ inline void FDialog::activateZoomButton (mouseStates& ms) } //---------------------------------------------------------------------- -inline void FDialog::leaveZoomButton (mouseStates& ms) +inline void FDialog::leaveZoomButton (const mouseStates& ms) { bool zoom_button_pressed_before = zoom_button_pressed; @@ -1341,7 +1343,7 @@ inline void FDialog::leaveZoomButton (mouseStates& ms) } //---------------------------------------------------------------------- -void FDialog::pressZoomButton (mouseStates& ms) +void FDialog::pressZoomButton (const mouseStates& ms) { if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn) || ms.mouse_y != 1 @@ -1365,7 +1367,7 @@ inline bool FDialog::isMouseOverMenu (const FPoint& termpos) } //---------------------------------------------------------------------- -inline void FDialog::passEventToSubMenu ( mouseStates& ms +inline void FDialog::passEventToSubMenu ( const mouseStates& ms , FMouseEvent* ev ) { // Mouse event handover to the dialog menu @@ -1481,7 +1483,7 @@ inline void FDialog::lowerActivateDialog() } //---------------------------------------------------------------------- -bool FDialog::isLowerRightResizeCorner (mouseStates& ms) +bool FDialog::isLowerRightResizeCorner (const mouseStates& ms) { // 3 characters in the lower right corner | // x @@ -1500,7 +1502,7 @@ bool FDialog::isLowerRightResizeCorner (mouseStates& ms) } //---------------------------------------------------------------------- -void FDialog::resizeMouseDown (mouseStates& ms) +void FDialog::resizeMouseDown (const mouseStates& ms) { // Click on the lower right resize corner @@ -1524,7 +1526,7 @@ void FDialog::resizeMouseDown (mouseStates& ms) } //---------------------------------------------------------------------- -void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up) +void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up) { // Resize the dialog if ( isResizeable() && ! resize_click_pos.isNull() ) diff --git a/src/fevent.cpp b/src/fevent.cpp index e9edd8a0..5051f638 100644 --- a/src/fevent.cpp +++ b/src/fevent.cpp @@ -35,10 +35,6 @@ FEvent::FEvent (fc::events ev_type) // constructor : t{ev_type} { } -//---------------------------------------------------------------------- -FEvent::~FEvent() // destructor -{ } - //---------------------------------------------------------------------- fc::events FEvent::type() const { return t; } diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index d28b86c5..df578c9f 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -220,7 +220,6 @@ const FString FFileDialog::fileOpenChooser ( FWidget* parent , const FString& dirname , const FString& filter ) { - //FFileDialog* fileopen; FString ret; FString path = dirname; FString file_filter = filter; diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 270c4694..25ce15e9 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ #include +#include #include "final/fkeyboard.h" #include "final/fkey_map.h" @@ -30,7 +31,7 @@ namespace finalcut { // static class attributes -long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress) +uInt64 FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress) struct timeval FKeyboard::time_keypressed{}; #if defined(__linux__) diff --git a/src/flabel.cpp b/src/flabel.cpp index e9e48471..4092ab08 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fapplication.h" #include "final/flabel.h" #include "final/fstatusbar.h" diff --git a/src/flistbox.cpp b/src/flistbox.cpp index a9ca484b..2fe8655e 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ #include +#include #include "final/fapplication.h" #include "final/flistbox.h" @@ -161,7 +162,9 @@ void FListBox::showInsideBrackets ( std::size_t index } //---------------------------------------------------------------------- -void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust) +void FListBox::setGeometry ( int x, int y + , std::size_t w, std::size_t h + , bool adjust ) { // Set the widget geometry @@ -260,27 +263,6 @@ void FListBox::insert (FListBoxItem listItem) recalculateVerticalBar (element_count); } -//---------------------------------------------------------------------- -void FListBox::insert ( const FString& item - , fc::brackets_type b - , bool s - , FDataPtr d ) -{ - FListBoxItem listItem (item, d); - listItem.brackets = b; - listItem.selected = s; - insert (listItem); -} - -//---------------------------------------------------------------------- -void FListBox::insert ( long item - , fc::brackets_type b - , bool s - , FDataPtr d ) -{ - insert (FString() << item, b, s, d); -} - //---------------------------------------------------------------------- void FListBox::remove (std::size_t item) { diff --git a/src/flistview.cpp b/src/flistview.cpp index c092ed41..efc0601e 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include "final/fapplication.h" @@ -35,7 +36,7 @@ namespace finalcut FObject::FObjectIterator FListView::null_iter; // Function prototypes -long firstNumberFromString (const FString&); +uInt64 firstNumberFromString (const FString&); bool sortAscendingByName (const FObject*, const FObject*); bool sortDescendingByName (const FObject*, const FObject*); bool sortAscendingByNumber (const FObject*, const FObject*); @@ -43,13 +44,13 @@ bool sortDescendingByNumber (const FObject*, const FObject*); // non-member functions //---------------------------------------------------------------------- -long firstNumberFromString (const FString& str) +uInt64 firstNumberFromString (const FString& str) { auto last = str.end(); auto iter = str.begin(); std::size_t pos; std::size_t length; - long number; + uInt64 number; while ( iter != last ) { @@ -88,7 +89,7 @@ long firstNumberFromString (const FString& str) try { - number = num_str.toLong(); + number = uInt64(num_str.toLong()); } catch (const std::exception&) { @@ -814,7 +815,7 @@ FObject::FObjectIterator FListView::insert ( const FStringList& cols } //---------------------------------------------------------------------- -FObject::FObjectIterator FListView::insert ( const std::vector& cols +FObject::FObjectIterator FListView::insert ( const std::vector& cols , FDataPtr d , FObjectIterator parent_iter ) { @@ -1816,7 +1817,7 @@ inline void FListView::drawHeaderBorder (std::size_t length) } //---------------------------------------------------------------------- -void FListView::drawHeadlineLabel (headerItems::const_iterator& iter) +void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter) { // Print lable text static constexpr std::size_t leading_space = 1; @@ -1863,7 +1864,7 @@ void FListView::drawHeadlineLabel (headerItems::const_iterator& iter) } //---------------------------------------------------------------------- -void FListView::drawColumnEllipsis ( headerItems::const_iterator& iter +void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter , const FString& text ) { // Print lable ellipsis diff --git a/src/fmenu.cpp b/src/fmenu.cpp index a6b8dea3..065557e5 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include "final/fapplication.h" diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index a6718fde..c470f306 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include "final/fapplication.h" @@ -657,7 +658,7 @@ inline void FMenuBar::drawMenuText (menuText& data) } //---------------------------------------------------------------------- -inline void FMenuBar::drawEllipsis (menuText& txtdata, std::size_t x) +inline void FMenuBar::drawEllipsis (const menuText& txtdata, std::size_t x) { if ( x > screenWidth + 1 ) { @@ -820,7 +821,7 @@ void FMenuBar::unselectMenuItem (FMenuItem* item) } //---------------------------------------------------------------------- -void FMenuBar::mouseDownOverList (FMouseEvent* ev) +void FMenuBar::mouseDownOverList (const FMouseEvent* ev) { if ( item_list.empty() ) return; @@ -868,7 +869,7 @@ void FMenuBar::mouseDownOverList (FMouseEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::mouseUpOverList (FMouseEvent* ev) +void FMenuBar::mouseUpOverList (const FMouseEvent* ev) { if ( item_list.empty() ) return; @@ -910,7 +911,7 @@ void FMenuBar::mouseUpOverList (FMouseEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::mouseMoveOverList (FMouseEvent* ev) +void FMenuBar::mouseMoveOverList (const FMouseEvent* ev) { if ( item_list.empty() ) return; @@ -970,7 +971,7 @@ void FMenuBar::mouseMoveOverList (FMouseEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::passEventToMenu (FMouseEvent*& ev) +void FMenuBar::passEventToMenu (const FMouseEvent*& ev) { if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) return; diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index 559b1bb7..180e3651 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fapplication.h" #include "final/fdialog.h" #include "final/fmenu.h" diff --git a/src/fmouse.cpp b/src/fmouse.cpp index 2f348ce5..05789e65 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ #include +#include #include #include #include @@ -69,19 +70,19 @@ inline void FMouse::clearEvent() } //---------------------------------------------------------------------- -inline void FMouse::setMaxWidth (short x_max) +inline void FMouse::setMaxWidth (uInt16 x_max) { max_width = x_max; } //---------------------------------------------------------------------- -inline void FMouse::setMaxHeight (short y_max) +inline void FMouse::setMaxHeight (uInt16 y_max) { max_height = y_max; } //---------------------------------------------------------------------- -inline void FMouse::setDblclickInterval (const long timeout) +inline void FMouse::setDblclickInterval (const uInt64 timeout) { dblclick_interval = timeout; } @@ -716,7 +717,7 @@ void FMouseSGR::processEvent (struct timeval* time) const auto& mouse_position = getPos(); char* p; int btn; - short x, y; + uInt16 x, y; x = 0; y = 0; @@ -747,7 +748,7 @@ void FMouseSGR::processEvent (struct timeval* time) return; } - x = short(10 * x + (*p - '0')); + x = uInt16(10 * x + (*p - '0')); } while ( *p++ && *p != 'M' && *p != 'm' ) @@ -759,7 +760,7 @@ void FMouseSGR::processEvent (struct timeval* time) return; } - y = short(10 * y + (*p - '0')); + y = uInt16(10 * y + (*p - '0')); } new_mouse_position.setPoint (x, y); @@ -959,7 +960,7 @@ void FMouseUrxvt::processEvent (struct timeval* time) bool x_neg; bool y_neg; int btn; - short x, y; + uInt16 x, y; x = 0; y = 0; @@ -998,7 +999,7 @@ void FMouseUrxvt::processEvent (struct timeval* time) return; } - x = short(10 * x + (*p - '0')); + x = uInt16(10 * x + (*p - '0')); p++; } @@ -1017,7 +1018,7 @@ void FMouseUrxvt::processEvent (struct timeval* time) return; } - y = short(10 * y + (*p - '0')); + y = uInt16(10 * y + (*p - '0')); p++; } @@ -1226,19 +1227,19 @@ void FMouseControl::setStdinNo (int) #endif // F_HAVE_LIBGPM //---------------------------------------------------------------------- -void FMouseControl::setMaxWidth (short x_max) +void FMouseControl::setMaxWidth (uInt16 x_max) { mouse_protocol[FMouse::urxvt]->setMaxWidth(x_max); } //---------------------------------------------------------------------- -void FMouseControl::setMaxHeight (short y_max) +void FMouseControl::setMaxHeight (uInt16 y_max) { mouse_protocol[FMouse::urxvt]->setMaxHeight(y_max); } //---------------------------------------------------------------------- -void FMouseControl::setDblclickInterval (const long timeout) +void FMouseControl::setDblclickInterval (const uInt64 timeout) { for (auto&& m : mouse_protocol) if ( m.second ) diff --git a/src/fobject.cpp b/src/fobject.cpp index 44647561..41c46fa4 100644 --- a/src/fobject.cpp +++ b/src/fobject.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fobject.h" namespace finalcut @@ -216,11 +218,11 @@ void FObject::getCurrentTime (timeval* time) } //---------------------------------------------------------------------- -bool FObject::isTimeout (timeval* time, long timeout) +bool FObject::isTimeout (timeval* time, uInt64 timeout) { // Checks whether the specified time span (timeout in µs) has elapse - long diff_usec; + uInt64 diff_usec; struct timeval now; struct timeval diff; @@ -234,7 +236,7 @@ bool FObject::isTimeout (timeval* time, long timeout) diff.tv_usec += 1000000; } - diff_usec = (diff.tv_sec * 1000000) + diff.tv_usec; + diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec); return ( diff_usec > timeout ); } diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index 2a011dd1..3fccc6a4 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -21,6 +21,8 @@ * . * ***********************************************************************/ +#include + #include "final/fscrollview.h" #include "final/fwindow.h" diff --git a/src/fterm.cpp b/src/fterm.cpp index 4d86d4b4..75dc76f9 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -155,7 +155,7 @@ void FTerm::redefineDefaultColors (bool enable) } //---------------------------------------------------------------------- -void FTerm::setDblclickInterval (const long timeout) +void FTerm::setDblclickInterval (const uInt64 timeout) { mouse->setDblclickInterval(timeout); } @@ -941,7 +941,7 @@ void FTerm::init_alt_charset() { // Read the used VT100 pairs - std::map vt100_alt_char; + std::map vt100_alt_char; if ( TCAP(fc::t_acs_chars) ) { @@ -1543,8 +1543,8 @@ void FTerm::enableMouse() xterm_mouse = true; keyboard->enableMouseSequences(); - mouse->setMaxWidth (short(getColumnNumber())); - mouse->setMaxHeight (short(getLineNumber())); + mouse->setMaxWidth (uInt16(getColumnNumber())); + mouse->setMaxHeight (uInt16(getLineNumber())); // Enable the linux general purpose mouse (gpm) server mouse->useGpmMouse (gpm_mouse); // Enable xterm mouse support @@ -2060,7 +2060,6 @@ void FTerm::signal_handler (int signum) , strsignal(signum) ); std::terminate(); } - } // FTerm non-member functions diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index 8bc332e6..b1d644fb 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ #include +#include #include #include "final/ftermcap.h" diff --git a/src/ftermcapquirks.cpp b/src/ftermcapquirks.cpp index b0ad5c57..17eff812 100644 --- a/src/ftermcapquirks.cpp +++ b/src/ftermcapquirks.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/ftermcapquirks.h" namespace finalcut diff --git a/src/ftermios.cpp b/src/ftermios.cpp index 18f9f042..dfe05201 100644 --- a/src/ftermios.cpp +++ b/src/ftermios.cpp @@ -205,7 +205,7 @@ bool FTermios::setRawMode (bool enable) //---------------------------------------------------------------------- uInt FTermios::getBaudRate() { - std::map outspeed; + std::map outspeed; outspeed[B0] = 0; // hang up outspeed[B50] = 50; // 50 baud outspeed[B75] = 75; // 75 baud diff --git a/src/ftextview.cpp b/src/ftextview.cpp index e369c3c5..87f2989b 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fdialog.h" #include "final/fstatusbar.h" #include "final/ftextview.h" diff --git a/src/fvterm.cpp b/src/fvterm.cpp index fcb4237c..450b8577 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -412,11 +412,11 @@ int FVTerm::print (term_area* area, const std::vector& term_string) break; case '\t': - area->cursor_x = short ( uInt(area->cursor_x) - + tabstop - - uInt(area->cursor_x) - + 1 - % tabstop ); + area->cursor_x = int ( uInt(area->cursor_x) + + tabstop + - uInt(area->cursor_x) + + 1 + % tabstop ); break; case '\b': @@ -539,10 +539,10 @@ int FVTerm::print (term_area* area, charData& term_char) // copy character to area std::memcpy (ac, &nc, sizeof(*ac)); - if ( ax < short(area->changes[ay].xmin) ) + if ( ax < int(area->changes[ay].xmin) ) area->changes[ay].xmin = uInt(ax); - if ( ax > short(area->changes[ay].xmax) ) + if ( ax > int(area->changes[ay].xmax) ) area->changes[ay].xmax = uInt(ax); } } @@ -845,10 +845,10 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h) std::memcpy (tc, &sc, sizeof(*tc)); } - if ( short(vterm->changes[ypos].xmin) > x ) + if ( int(vterm->changes[ypos].xmin) > x ) vterm->changes[ypos].xmin = uInt(x); - if ( short(vterm->changes[ypos].xmax) < x + w - 1 ) + if ( int(vterm->changes[ypos].xmax) < x + w - 1 ) vterm->changes[ypos].xmax = uInt(x + w - 1); } } @@ -1230,13 +1230,13 @@ void FVTerm::updateVTerm (term_area* area) _xmin = ax + line_xmin - ol; _xmax = ax + line_xmax; - if ( _xmin < short(vterm->changes[ay + y].xmin) ) + if ( _xmin < int(vterm->changes[ay + y].xmin) ) vterm->changes[ay + y].xmin = uInt(_xmin); if ( _xmax >= vterm->width ) _xmax = vterm->width - 1; - if ( _xmax > short(vterm->changes[ay + y].xmax) ) + if ( _xmax > int(vterm->changes[ay + y].xmax) ) vterm->changes[ay + y].xmax = uInt(_xmax); area->changes[y].xmin = uInt(aw + rsh); @@ -1358,10 +1358,10 @@ void FVTerm::getArea (int ax, int ay, term_area* area) auto ac = &area->text[y * area->width]; // area character std::memcpy (ac, tc, sizeof(*ac) * unsigned(length)); - if ( short(area->changes[y].xmin) > 0 ) + if ( int(area->changes[y].xmin) > 0 ) area->changes[y].xmin = 0; - if ( short(area->changes[y].xmax) < length - 1 ) + if ( int(area->changes[y].xmax) < length - 1 ) area->changes[y].xmax = uInt(length - 1); } } @@ -1412,10 +1412,10 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area) auto ac = &area->text[(dy + _y) * line_len + dx]; // area character std::memcpy (ac, tc, sizeof(*ac) * unsigned(length)); - if ( short(area->changes[dy + _y].xmin) > dx ) + if ( int(area->changes[dy + _y].xmin) > dx ) area->changes[dy + _y].xmin = uInt(dx); - if ( short(area->changes[dy + _y].xmax) < dx + length - 1 ) + if ( int(area->changes[dy + _y].xmax) < dx + length - 1 ) area->changes[dy + _y].xmax = uInt(dx + length - 1); } } @@ -1502,10 +1502,10 @@ void FVTerm::putArea (int ax, int ay, term_area* area) } } - if ( ax < short(vterm->changes[ay + y].xmin) ) + if ( ax < int(vterm->changes[ay + y].xmin) ) vterm->changes[ay + y].xmin = uInt(ax); - if ( ax + length - 1 > short(vterm->changes[ay + y].xmax) ) + if ( ax + length - 1 > int(vterm->changes[ay + y].xmax) ) vterm->changes[ay + y].xmax = uInt(ax + length - 1); } } @@ -2507,7 +2507,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) charsetChanges (print_char); appendAttributes (print_char); appendOutputBuffer (tparm(rp, print_char->code, repetitions, 0, 0, 0, 0, 0, 0, 0)); - term_pos->x_ref() += short(repetitions); + term_pos->x_ref() += int(repetitions); x = x + repetitions - 1; } else diff --git a/src/fwidget.cpp b/src/fwidget.cpp index f51505f9..9794b637 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1734,7 +1734,7 @@ bool FWidget::focusPrevChild() //---------------------------------------------------------------------- bool FWidget::event (FEvent* ev) { - switch ( ev->type() ) + switch ( uInt(ev->type()) ) { case fc::KeyPress_Event: KeyPressEvent (static_cast(ev)); diff --git a/src/fwindow.cpp b/src/fwindow.cpp index bfe7b2b9..92dae41f 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -810,7 +810,7 @@ void FWindow::adjustSize() //---------------------------------------------------------------------- bool FWindow::event (FEvent* ev) { - switch ( ev->type() ) + switch ( uInt(ev->type()) ) { case fc::WindowActive_Event: onWindowActive (ev); diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index 99febf82..2c4be384 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -127,13 +127,12 @@ class FApplication : public FWidget void cb_exitApp (FWidget*, FDataPtr); private: - // Typedefs and Enumerations + // Typedefs typedef std::pair > eventPair; typedef std::deque eventQueue; - typedef std::shared_ptr eventQueuePtr; // Methods - void init (long, long); + void init (uInt64, uInt64); void cmd_options (const int&, char*[]); void findKeyboardWidget(); bool isKeyPressed(); @@ -178,10 +177,10 @@ class FApplication : public FWidget // Data Members int app_argc; char** app_argv; - long key_timeout{100000}; // 100 ms - long dblclick_interval{500000}; // 500 ms + uInt64 key_timeout{100000}; // 100 ms + uInt64 dblclick_interval{500000}; // 500 ms static FMouseControl* mouse; - static eventQueuePtr event_queue; + static eventQueue* event_queue; static int quit_code; static bool quit_now; static int loop_level; diff --git a/src/include/final/fdialog.h b/src/include/final/fdialog.h index 37f2abc3..0d27db70 100644 --- a/src/include/final/fdialog.h +++ b/src/include/final/fdialog.h @@ -198,18 +198,18 @@ class FDialog : public FWindow void selectFirstMenuItem(); void setZoomItem(); std::size_t getZoomButtonWidth(); - void activateZoomButton (mouseStates&); + void activateZoomButton (const mouseStates&); void deactivateZoomButton(); - void leaveZoomButton (mouseStates&); - void pressZoomButton (mouseStates&); + void leaveZoomButton (const mouseStates&); + void pressZoomButton (const mouseStates&); bool isMouseOverMenu (const FPoint&); - void passEventToSubMenu (mouseStates&, FMouseEvent*); + void passEventToSubMenu (const mouseStates&, FMouseEvent*); void moveSizeKey (FKeyEvent*); void raiseActivateDialog(); void lowerActivateDialog(); - bool isLowerRightResizeCorner (mouseStates&); - void resizeMouseDown (mouseStates&); - void resizeMouseUpMove (mouseStates&, bool = false); + bool isLowerRightResizeCorner (const mouseStates&); + void resizeMouseDown (const mouseStates&); + void resizeMouseUpMove (const mouseStates&, bool = false); void cancelMouseResize(); void acceptMoveSize(); void cancelMoveSize(); diff --git a/src/include/final/fevent.h b/src/include/final/fevent.h index fb754679..49a8c8fd 100644 --- a/src/include/final/fevent.h +++ b/src/include/final/fevent.h @@ -95,7 +95,6 @@ class FEvent // event base class public: FEvent() = default; explicit FEvent(fc::events); - virtual ~FEvent(); fc::events type() const; protected: diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index 0cb03077..65846a7d 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -111,7 +111,7 @@ class FKeyboard // Mutators void setTermcapMap (fc::fkeymap*); - void setKeypressTimeout (const long); + void setKeypressTimeout (const uInt64); void enableUTF8(); void disableUTF8(); void enableMouseSequences(); @@ -173,7 +173,7 @@ class FKeyboard int fifo_offset{0}; bool fifo_in_use{false}; int stdin_status_flags{0}; - static long key_timeout; + static uInt64 key_timeout; bool input_data_pending{false}; bool utf8_input{false}; bool mouse_support{true}; @@ -210,7 +210,7 @@ inline timeval* FKeyboard::getKeyPressedTime() { return &time_keypressed; } //---------------------------------------------------------------------- -inline void FKeyboard::setKeypressTimeout (const long timeout) +inline void FKeyboard::setKeypressTimeout (const uInt64 timeout) { key_timeout = timeout; } //---------------------------------------------------------------------- diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index 148fa219..7bad8f3e 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -53,6 +53,7 @@ #error "Only can be included directly." #endif +#include #include #include "final/fscrollbar.h" @@ -179,7 +180,9 @@ class FListBox : public FWidget void showInsideBrackets (std::size_t, fc::brackets_type); void showNoBrackets (std::size_t); void showNoBrackets (listBoxItems::iterator); - virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true); + virtual void setGeometry ( int, int + , std::size_t, std::size_t + , bool = true ); void setMultiSelection (bool); void setMultiSelection (); void unsetMultiSelection (); @@ -203,11 +206,8 @@ class FListBox : public FWidget template void insert (Container, LazyConverter); void insert (FListBoxItem); - void insert ( const FString& - , fc::brackets_type = fc::NoBrackets - , bool = false - , FDataPtr = nullptr ); - void insert ( long + template + void insert ( const ItemT& , fc::brackets_type = fc::NoBrackets , bool = false , FDataPtr = nullptr ); @@ -484,6 +484,19 @@ void FListBox::insert (Container container, LazyConverter convert) recalculateVerticalBar(size); } +//---------------------------------------------------------------------- +template +void FListBox::insert ( const ItemT& item + , fc::brackets_type b + , bool s + , FDataPtr d ) +{ + FListBoxItem listItem (FString() << item, d); + listItem.brackets = b; + listItem.selected = s; + insert (listItem); +} + //---------------------------------------------------------------------- inline FListBox::listBoxItems::iterator \ FListBox::index2iterator (std::size_t index) diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h index f020e615..72e5e96d 100644 --- a/src/include/final/flistview.h +++ b/src/include/final/flistview.h @@ -53,9 +53,10 @@ #endif #include +#include #include #include - #include "final/fmessagebox.h" + #include "final/fscrollbar.h" #include "final/fstring.h" #include "final/ftermbuffer.h" @@ -323,11 +324,11 @@ class FListView : public FWidget FObjectIterator insert ( const FStringList& , FDataPtr , FObjectIterator ); - FObjectIterator insert ( const std::vector& + FObjectIterator insert ( const std::vector& , FDataPtr = nullptr ); - FObjectIterator insert ( const std::vector& + FObjectIterator insert ( const std::vector& , FObjectIterator ); - FObjectIterator insert ( const std::vector& + FObjectIterator insert ( const std::vector& , FDataPtr , FObjectIterator ); FObjectIterator beginOfList(); @@ -378,9 +379,9 @@ class FListView : public FWidget FString getCheckBox (const FListViewItem* item); FString getLinePrefix (const FListViewItem*, std::size_t); void drawSortIndicator (std::size_t&, std::size_t); - void drawHeadlineLabel (headerItems::const_iterator&); + void drawHeadlineLabel (const headerItems::const_iterator&); void drawHeaderBorder (std::size_t); - void drawColumnEllipsis ( headerItems::const_iterator& + void drawColumnEllipsis ( const headerItems::const_iterator& , const FString& ); void updateDrawing (bool, bool); std::size_t determineLineWidth (FListViewItem*); @@ -537,12 +538,12 @@ inline FObject::FObjectIterator //---------------------------------------------------------------------- inline FObject::FObjectIterator - FListView::insert (const std::vector& cols, FDataPtr d) + FListView::insert (const std::vector& cols, FDataPtr d) { return insert (cols, d, root); } //---------------------------------------------------------------------- inline FObject::FObjectIterator - FListView::insert ( const std::vector& cols + FListView::insert ( const std::vector& cols , FObjectIterator parent_iter ) { return insert (cols, 0, parent_iter); } diff --git a/src/include/final/fmenubar.h b/src/include/final/fmenubar.h index f8e6c17a..69cd3468 100644 --- a/src/include/final/fmenubar.h +++ b/src/include/final/fmenubar.h @@ -135,7 +135,7 @@ class FMenuBar : public FWindow, public FMenuList void drawItem (FMenuItem*, std::size_t&); void setLineAttributes (FMenuItem*); void drawMenuText (menuText&); - void drawEllipsis (menuText&, std::size_t); + void drawEllipsis (const menuText&, std::size_t); void drawLeadingSpace (std::size_t&); void drawTrailingSpace (std::size_t&); void adjustItems(); @@ -143,10 +143,10 @@ class FMenuBar : public FWindow, public FMenuList bool clickItem (FMenuItem*); void unselectMenuItem (FMenuItem*); void selectMenuItem (FMenuItem*); - void mouseDownOverList (FMouseEvent*); - void mouseUpOverList (FMouseEvent*); - void mouseMoveOverList (FMouseEvent*); - void passEventToMenu (FMouseEvent*&); + void mouseDownOverList (const FMouseEvent*); + void mouseUpOverList (const FMouseEvent*); + void mouseMoveOverList (const FMouseEvent*); + void passEventToMenu (const FMouseEvent*&); void leaveMenuBar(); // Friend classes diff --git a/src/include/final/fmouse.h b/src/include/final/fmouse.h index 5fdd9100..ed819863 100644 --- a/src/include/final/fmouse.h +++ b/src/include/final/fmouse.h @@ -112,9 +112,9 @@ class FMouse void clearEvent(); // Mutators - void setMaxWidth (short); - void setMaxHeight (short); - void setDblclickInterval (const long); + void setMaxWidth (uInt16); + void setMaxHeight (uInt16); + void setDblclickInterval (const uInt64); // Inquiries virtual bool hasData() = 0; @@ -173,9 +173,9 @@ class FMouse button b_state{}; bool mouse_event_occurred{false}; bool input_data_pending{false}; - long dblclick_interval{500000}; // 500 ms - short max_width{80}; - short max_height{25}; + uInt64 dblclick_interval{500000}; // 500 ms + uInt16 max_width{80}; + uInt16 max_height{25}; struct timeval time_mousepressed{}; FPoint zero_point{0, 0}; // zero point (x=0, y=0) FPoint mouse{0, 0}; // mouse click position @@ -468,9 +468,9 @@ class FMouseControl // Mutators void setStdinNo (int); - void setMaxWidth (short); - void setMaxHeight (short); - void setDblclickInterval (const long); + void setMaxWidth (uInt16); + void setMaxHeight (uInt16); + void setDblclickInterval (const uInt64); void useGpmMouse (bool = true); void useXtermMouse (bool = true); diff --git a/src/include/final/fobject.h b/src/include/final/fobject.h index 135e090c..1ed7be98 100644 --- a/src/include/final/fobject.h +++ b/src/include/final/fobject.h @@ -114,7 +114,7 @@ class FObject // Timer methods static void getCurrentTime (timeval*); - static bool isTimeout (timeval*, long); + static bool isTimeout (timeval*, uInt64); int addTimer (int); bool delTimer (int); bool delOwnTimer(); diff --git a/src/include/final/fscrollview.h b/src/include/final/fscrollview.h index a33cb12a..2c560c6c 100644 --- a/src/include/final/fscrollview.h +++ b/src/include/final/fscrollview.h @@ -53,6 +53,8 @@ #error "Only can be included directly." #endif +#include + #include "final/fscrollbar.h" #include "final/fwidget.h" diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index 8025149a..6d06582a 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -227,7 +227,7 @@ class FTerm static void setTermType (const char[]); static void setInsertCursor (bool); static void redefineDefaultColors (bool); - static void setDblclickInterval (const long); + static void setDblclickInterval (const uInt64); static bool setUTF8 (bool); static bool setUTF8(); static bool unsetUTF8(); diff --git a/src/include/final/ftextview.h b/src/include/final/ftextview.h index d6a568b6..189d17e0 100644 --- a/src/include/final/ftextview.h +++ b/src/include/final/ftextview.h @@ -52,6 +52,7 @@ #error "Only can be included directly." #endif +#include #include #include "final/fapplication.h" diff --git a/src/include/final/ftypes.h b/src/include/final/ftypes.h index e680d308..661f4aca 100644 --- a/src/include/final/ftypes.h +++ b/src/include/final/ftypes.h @@ -79,7 +79,7 @@ struct is_negative }; template -struct is_negative +struct is_negative { inline bool operator () (const T&) { diff --git a/test/fmouse-test.cpp b/test/fmouse-test.cpp index bed7604e..6ac1d65b 100644 --- a/test/fmouse-test.cpp +++ b/test/fmouse-test.cpp @@ -50,12 +50,12 @@ class FMouse_protected : public finalcut::FMouse virtual void processEvent (struct timeval*) { } - short getMaxWidth() + uInt16 getMaxWidth() { return max_width; } - short getMaxHeight() + uInt16 getMaxHeight() { return max_height; } @@ -65,7 +65,7 @@ class FMouse_protected : public finalcut::FMouse return new_mouse_position; } - long getDblclickInterval() + uInt64 getDblclickInterval() { return dblclick_interval; } diff --git a/test/fobject-test.cpp b/test/fobject-test.cpp index 4a14aa4e..71bebfb1 100644 --- a/test/fobject-test.cpp +++ b/test/fobject-test.cpp @@ -433,7 +433,7 @@ void FObjectTest::iteratorTest() void FObjectTest::timeTest() { struct timeval time1; - long timeout = 750000; // 750 ms + uInt64 timeout = 750000; // 750 ms finalcut::FObject::getCurrentTime(&time1); CPPUNIT_ASSERT ( ! finalcut::FObject::isTimeout (&time1, timeout) ); sleep(1);