diff --git a/src/fbutton.cpp b/src/fbutton.cpp index 70b67040..d68266a0 100644 --- a/src/fbutton.cpp +++ b/src/fbutton.cpp @@ -265,7 +265,6 @@ void FButton::hide() { std::size_t s, f, size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); FWidget::hide(); @@ -288,18 +287,7 @@ void FButton::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++) { @@ -307,7 +295,7 @@ void FButton::hide() print (blank); } - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/fbuttongroup.cpp b/src/fbuttongroup.cpp index 67f6dd6a..fcede4b7 100644 --- a/src/fbuttongroup.cpp +++ b/src/fbuttongroup.cpp @@ -191,7 +191,6 @@ void FButtonGroup::hide() { std::size_t size; short fg, bg; - char* blank; FWidget::hide(); FWidget* parent_widget = getParentWidget(); @@ -226,18 +225,7 @@ void FButtonGroup::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (int y = 0; y < int(getHeight()); y++) { @@ -245,7 +233,7 @@ void FButtonGroup::hide() print (blank); } - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/flabel.cpp b/src/flabel.cpp index 98ae734c..c2b1baec 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -243,7 +243,6 @@ void FLabel::hide() { short fg, bg; std::size_t size; - char* blank; FWidget* parent_widget = getParentWidget(); FWidget::hide(); @@ -265,21 +264,10 @@ void FLabel::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[getWidth()] = '\0'; + char* blank = createBlankArray(size + 1); setPrintPos (1, 1); print (blank); - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/flineedit.cpp b/src/flineedit.cpp index bbe87892..050a376b 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -283,7 +283,6 @@ void FLineEdit::hide() { std::size_t s, size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); FWidget::hide(); @@ -306,18 +305,7 @@ void FLineEdit::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (std::size_t y = 0; y < getHeight() + s; y++) { @@ -325,7 +313,7 @@ void FLineEdit::hide() print (blank); } - delete[] blank; + destroyBlankArray(blank); if ( label ) label->hide(); diff --git a/src/flistbox.cpp b/src/flistbox.cpp index 909353c4..9cca9f6d 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -169,16 +169,16 @@ void FListBox::showInsideBrackets ( std::size_t index if ( b == fc::NoBrackets ) return; - int len = int(iter->getText().getLength() + 2); + std::size_t len = iter->getText().getLength() + 2; if ( len > max_line_width ) { max_line_width = len; - if ( len >= int(getWidth()) - nf_offset - 3 ) + if ( len >= getWidth() - nf_offset - 3 ) { - hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4); - hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4); + hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4)); + hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4)); hbar->setValue (xoffset); if ( ! hbar->isVisible() ) @@ -197,7 +197,7 @@ void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adj if ( isNewFont() ) { vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2); - hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - std::size_t(nf_offset), 1); + hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - nf_offset, 1); } else { @@ -242,9 +242,7 @@ void FListBox::hide() { std::size_t n, size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); - FWidget::hide(); if ( parent_widget ) @@ -265,18 +263,7 @@ void FListBox::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset (blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (int y = 0; y < int(getHeight()); y++) { @@ -284,19 +271,19 @@ void FListBox::hide() print (blank); } - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- void FListBox::insert (FListBoxItem listItem) { - int len = int(listItem.text.getLength()); + std::size_t len = listItem.text.getLength(); bool has_brackets = bool(listItem.brackets); recalculateHorizontalBar (len, has_brackets); itemlist.push_back (listItem); - int element_count = int(getCount()); + std::size_t element_count = getCount(); recalculateVerticalBar (element_count); } @@ -337,7 +324,7 @@ void FListBox::remove (std::size_t item) while ( iter != itemlist.end() ) { - int len = int(iter->getText().getLength()); + std::size_t len = iter->getText().getLength(); if ( len > max_line_width ) max_line_width = len; @@ -345,10 +332,10 @@ void FListBox::remove (std::size_t item) ++iter; } - hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4); - hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4); + hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4)); + hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4)); - if ( hbar->isVisible() && max_line_width < int(getWidth()) - nf_offset - 3 ) + if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 ) hbar->hide(); vbar->setMaximum (int(element_count - getHeight()) + 2); @@ -374,10 +361,7 @@ void FListBox::remove (std::size_t item) void FListBox::clear() { std::size_t size; - char* blank; - itemlist.clear(); - current = 0; xoffset = 0; yoffset = 0; @@ -400,15 +384,7 @@ void FListBox::clear() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } + char* blank = createBlankArray(size + 1); std::memset (blank, ' ', size); blank[size] = '\0'; @@ -419,7 +395,7 @@ void FListBox::clear() print (blank); } - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- @@ -823,10 +799,10 @@ void FListBox::adjustSize() vbar->setHeight (getClientHeight(), false); vbar->resize(); - hbar->setMaximum (max_line_width - int(getClientWidth()) + 2); - hbar->setPageSize (max_line_width, int(getClientWidth()) - 2); + hbar->setMaximum (int(max_line_width - getClientWidth() + 2)); + hbar->setPageSize (int(max_line_width), int(getClientWidth()) - 2); hbar->setY (int(getHeight())); - hbar->setWidth (getClientWidth() + std::size_t(nf_offset), false); + hbar->setWidth (getClientWidth() + nf_offset, false); hbar->resize(); if ( element_count <= getClientHeight() ) @@ -834,7 +810,7 @@ void FListBox::adjustSize() else vbar->setVisible(); - if ( max_line_width < int(getClientWidth()) - 1 ) + if ( max_line_width < getClientWidth() - 1 ) hbar->hide(); else hbar->setVisible(); @@ -890,7 +866,7 @@ void FListBox::init() setTopPadding(1); setLeftPadding(1); setBottomPadding(1); - setRightPadding(1 + nf_offset); + setRightPadding(1 + int(nf_offset)); } //---------------------------------------------------------------------- @@ -1043,8 +1019,8 @@ inline void FListBox::drawListLine ( int y bool isCurrentLine = bool(y + yoffset + 1 == int(current)); bool isFocus = ((flags & fc::focus) != 0); FString element; - element = getString(iter).mid ( uInt(1 + xoffset) - , uInt(getWidth() - std::size_t(nf_offset) - 4) ); + element = getString(iter).mid ( std::size_t(1 + xoffset) + , getWidth() - nf_offset - 4 ); const wchar_t* const& element_str = element.wc_str(); len = element.getLength(); @@ -1072,7 +1048,7 @@ inline void FListBox::drawListLine ( int y i++; } - for (; i < getWidth() - std::size_t(nf_offset) - 3; i++) + for (; i < getWidth() - nf_offset - 3; i++) print (' '); } @@ -1153,11 +1129,11 @@ inline void FListBox::drawListBracketsLine ( int y printLeftBracket (iter->brackets); element = getString(iter).mid ( std::size_t(xoffset) + 1 - , getWidth() - std::size_t(nf_offset) - 5 ); + , getWidth() - nf_offset - 5 ); } else element = getString(iter).mid ( std::size_t(xoffset) - , getWidth() - std::size_t(nf_offset) - 4 ); + , getWidth() - nf_offset - 4 ); const wchar_t* const& element_str = element.wc_str(); len = element.getLength(); @@ -1177,7 +1153,7 @@ inline void FListBox::drawListBracketsLine ( int y full_length = getString(iter).getLength(); - if ( b + i < getWidth() - std::size_t(nf_offset) - 4 + if ( b + i < getWidth() - nf_offset - 4 && std::size_t(xoffset) <= full_length + 1 ) { if ( serach_mark && i == inc_len ) @@ -1194,7 +1170,7 @@ inline void FListBox::drawListBracketsLine ( int y i++; } - for (; b + i < getWidth() - std::size_t(nf_offset) - 3; i++) + for (; b + i < getWidth() - nf_offset - 3; i++) print (' '); } @@ -1310,7 +1286,7 @@ inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar) } //---------------------------------------------------------------------- -void FListBox::recalculateHorizontalBar (int len, bool has_brackets) +void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets) { if ( has_brackets ) len += 2; @@ -1320,10 +1296,10 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets) max_line_width = len; - if ( len >= int(getWidth()) - nf_offset - 3 ) + if ( len >= getWidth() - nf_offset - 3 ) { - hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4); - hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4); + hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4)); + hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4)); hbar->calculateSliderValues(); if ( ! hbar->isVisible() ) @@ -1332,13 +1308,13 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets) } //---------------------------------------------------------------------- -void FListBox::recalculateVerticalBar (int element_count) +void FListBox::recalculateVerticalBar (std::size_t element_count) { - vbar->setMaximum (element_count - int(getHeight()) + 2); - vbar->setPageSize (element_count, int(getHeight()) - 2); + vbar->setMaximum (int(element_count - getHeight() + 2)); + vbar->setPageSize (int(element_count), int(getHeight()) - 2); vbar->calculateSliderValues(); - if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 ) + if ( ! vbar->isVisible() && element_count >= getHeight() - 1 ) vbar->setVisible(); } @@ -1595,16 +1571,16 @@ void FListBox::nextListItem (int distance) //---------------------------------------------------------------------- void FListBox::scrollToX (int val) { - static const int padding_space = 2; // 1 leading space + 1 trailing space - int xoffset_end = max_line_width - int(getClientWidth()) + padding_space; + static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space + std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space; if ( xoffset == val ) return; xoffset = val; - if ( xoffset > xoffset_end ) - xoffset = xoffset_end; + if ( xoffset > int(xoffset_end) ) + xoffset = int(xoffset_end); if ( xoffset < 0 ) xoffset = 0; @@ -1652,15 +1628,15 @@ void FListBox::scrollLeft (int distance) //---------------------------------------------------------------------- void FListBox::scrollRight (int distance) { - static const int padding_space = 2; // 1 leading space + 1 trailing space - int xoffset_end = max_line_width - int(getClientWidth()) + padding_space; + static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space + std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space; xoffset += distance; - if ( xoffset == xoffset_end ) + if ( xoffset == int(xoffset_end) ) return; - if ( xoffset > xoffset_end ) - xoffset = xoffset_end; + if ( xoffset > int(xoffset_end) ) + xoffset = int(xoffset_end); if ( xoffset < 0 ) xoffset = 0; @@ -1923,7 +1899,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y) return; convertToItem (*iter, source_container, y + yoffset); - int len = int(iter->text.getLength()); + std::size_t len = iter->text.getLength(); recalculateHorizontalBar (len, hasBrackets(iter)); if ( hbar->isVisible() ) diff --git a/src/flistview.cpp b/src/flistview.cpp index bbbcbab9..7eb67cfb 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -343,7 +343,7 @@ void FListViewItem::collapse() // private methods of FListView //---------------------------------------------------------------------- -template +template void FListViewItem::sort (Compare cmp) { if ( ! expandable ) @@ -1429,7 +1429,7 @@ void FListView::init() } //---------------------------------------------------------------------- -template +template void FListView::sort (Compare cmp) { // Sort the top level @@ -1462,7 +1462,7 @@ std::size_t FListView::getAlignOffset ( fc::text_alignment align case fc::alignCenter: if ( txt_length < width ) - return std::size_t((width - txt_length) / 2); + return (width - txt_length) / 2; else return 0; diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index dfaf07b9..0564fd31 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -64,29 +64,15 @@ void FMenuBar::resetMenu() void FMenuBar::hide() { short fg, bg; - char* blank; - FWindow::hide(); fg = wc.term_fg; bg = wc.term_bg; setColor (fg, bg); screenWidth = getDesktopWidth(); - - try - { - blank = new char[screenWidth + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', screenWidth); - blank[screenWidth] = '\0'; + char* blank = createBlankArray (screenWidth + 1); setPrintPos (1, 1); print (blank); - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index 7bd62ff7..c856196a 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -724,7 +724,7 @@ void FMenuItem::createDialogList (FMenu* winmenu) } //---------------------------------------------------------------------- -template +template void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev , fc::events ev_type ) { diff --git a/src/fprogressbar.cpp b/src/fprogressbar.cpp index 54e70396..821ee5db 100644 --- a/src/fprogressbar.cpp +++ b/src/fprogressbar.cpp @@ -100,7 +100,6 @@ void FProgressbar::hide() { std::size_t s, size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); FWidget::hide(); @@ -123,18 +122,7 @@ void FProgressbar::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (std::size_t y = 0; y < getHeight() + s; y++) { @@ -142,7 +130,7 @@ void FProgressbar::hide() print (blank); } - delete[] blank; + destroyBlankArray (blank); setPrintPos (int(getWidth()) - 4, 0); print (" "); // hide percentage } diff --git a/src/fstatusbar.cpp b/src/fstatusbar.cpp index 2d073909..8011a876 100644 --- a/src/fstatusbar.cpp +++ b/src/fstatusbar.cpp @@ -197,29 +197,15 @@ bool FStatusBar::hasActivatedKey() void FStatusBar::hide() { short fg, bg; - char* blank; - FWindow::hide(); fg = wc.term_fg; bg = wc.term_bg; setColor (fg, bg); screenWidth = getDesktopWidth(); - - try - { - blank = new char[screenWidth + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', screenWidth); - blank[screenWidth] = '\0'; + char* blank = createBlankArray(screenWidth + 1); setPrintPos (1, 1); print (blank); - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/ftextview.cpp b/src/ftextview.cpp index d7fe4640..01c2b98e 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -195,7 +195,6 @@ void FTextView::hide() { std::size_t n, size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); FWidget::hide(); @@ -218,18 +217,7 @@ void FTextView::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (std::size_t y = 0; y < getHeight(); y++) { @@ -237,7 +225,7 @@ void FTextView::hide() print (blank); } - delete[] blank; + destroyBlankArray (blank); flush_out(); } @@ -325,8 +313,6 @@ void FTextView::replaceRange (const FString& str, int from, int to) void FTextView::clear() { std::size_t size; - char* blank; - data.clear(); xoffset = 0; yoffset = 0; @@ -347,18 +333,7 @@ void FTextView::clear() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); for (int y = 0; y < int(getTextHeight()); y++) { @@ -366,7 +341,7 @@ void FTextView::clear() print (blank); } - delete[] blank; + destroyBlankArray (blank); processChanged(); } diff --git a/src/ftogglebutton.cpp b/src/ftogglebutton.cpp index 15f8ba8e..b86bec1e 100644 --- a/src/ftogglebutton.cpp +++ b/src/ftogglebutton.cpp @@ -219,9 +219,7 @@ void FToggleButton::hide() { std::size_t size; short fg, bg; - char* blank; FWidget* parent_widget = getParentWidget(); - FWidget::hide(); if ( parent_widget ) @@ -241,21 +239,10 @@ void FToggleButton::hide() if ( size == 0 ) return; - try - { - blank = new char[size + 1]; - } - catch (const std::bad_alloc& ex) - { - std::cerr << "not enough memory to alloc " << ex.what() << std::endl; - return; - } - - std::memset(blank, ' ', size); - blank[size] = '\0'; + char* blank = createBlankArray(size + 1); setPrintPos (1, 1); print (blank); - delete[] blank; + destroyBlankArray (blank); } //---------------------------------------------------------------------- diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index a8cd7da2..37db0f41 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -147,9 +147,9 @@ class FListBox : public FWidget // Constructor explicit FListBox (FWidget* = 0); - template + template FListBox (Iterator, Iterator, InsertConverter, FWidget* = 0); - template + template FListBox (Container, LazyConverter, FWidget* = 0); // Destructor @@ -192,9 +192,9 @@ class FListBox : public FWidget // Methods virtual void hide(); - template + template void insert (Iterator, Iterator, InsertConverter); - template + template void insert (Container, LazyConverter); void insert (FListBoxItem); void insert ( const FString& @@ -254,8 +254,8 @@ class FListBox : public FWidget void setLineAttributes (int, bool, bool, bool&); void unsetAttributes(); void updateDrawing (bool, bool); - void recalculateHorizontalBar (int, bool); - void recalculateVerticalBar (int); + void recalculateHorizontalBar (std::size_t, bool); + void recalculateVerticalBar (std::size_t); void getWidgetFocus(); void multiSelection (std::size_t); void multiSelectionUpTo (std::size_t); @@ -321,15 +321,15 @@ class FListBox : public FWidget int xoffset; int yoffset; int last_yoffset; - int nf_offset; - int max_line_width; + std::size_t nf_offset; + std::size_t max_line_width; }; #pragma pack(pop) // FListBox inline functions //---------------------------------------------------------------------- -template +template inline FListBox::FListBox ( Iterator first , Iterator last , InsertConverter convert @@ -368,7 +368,7 @@ inline FListBox::FListBox ( Iterator first } //---------------------------------------------------------------------- -template +template inline FListBox::FListBox ( Container container , LazyConverter convert , FWidget* parent ) @@ -496,7 +496,7 @@ inline bool FListBox::hasBrackets(listBoxItems::iterator iter) const { return bool(iter->brackets > 0); } //---------------------------------------------------------------------- -template +template inline void FListBox::insert ( Iterator first , Iterator last , InsertConverter convert ) @@ -511,7 +511,7 @@ inline void FListBox::insert ( Iterator first } //---------------------------------------------------------------------- -template +template void FListBox::insert (Container container, LazyConverter convert) { conv_type = lazy_convert; @@ -522,7 +522,7 @@ void FListBox::insert (Container container, LazyConverter convert) if ( size > 0 ) itemlist.resize(size); - recalculateVerticalBar(int(size)); + recalculateVerticalBar(size); } //---------------------------------------------------------------------- diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h index 6453705d..57a81ecb 100644 --- a/src/include/final/flistview.h +++ b/src/include/final/flistview.h @@ -115,7 +115,7 @@ class FListViewItem : public FObject bool isExpandable() const; // Methods - template + template void sort (Compare); FObjectIterator appendItem (FListViewItem*); void replaceControlCodes(); @@ -276,9 +276,9 @@ class FListView : public FWidget = fc::by_name); void setColumnSort (int, fc::sorting_order \ = fc::ascending); - template + template void setUserAscendingCompare (Compare); - template + template void setUserDescendingCompare (Compare); bool setTreeView (bool); bool setTreeView(); @@ -342,7 +342,7 @@ class FListView : public FWidget // Methods void init(); - template + template void sort (Compare); std::size_t getAlignOffset ( fc::text_alignment , std::size_t @@ -465,12 +465,12 @@ inline FListViewItem* FListView::getCurrentItem() { return static_cast(*current_iter); } //---------------------------------------------------------------------- -template +template inline void FListView::setUserAscendingCompare (Compare cmp) { user_defined_ascending = cmp; } //---------------------------------------------------------------------- -template +template inline void FListView::setUserDescendingCompare (Compare cmp) { user_defined_descending = cmp; } diff --git a/src/include/final/fmenuitem.h b/src/include/final/fmenuitem.h index bec1e29f..7f5a891d 100644 --- a/src/include/final/fmenuitem.h +++ b/src/include/final/fmenuitem.h @@ -175,7 +175,7 @@ class FMenuItem : public FWidget void processActivate(); void processDeactivate(); void createDialogList (FMenu*); - template + template void passMouseEvent (T, FMouseEvent*, fc::events); // Callback methods diff --git a/src/include/final/fstring.h b/src/include/final/fstring.h index 73ac4866..9fd56227 100644 --- a/src/include/final/fstring.h +++ b/src/include/final/fstring.h @@ -308,7 +308,7 @@ inline const wchar_t& FString::operator [] (IndexT pos) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator < (CharT& s) const { const FString tmp(s); @@ -316,7 +316,7 @@ inline bool FString::operator < (CharT& s) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator <= (CharT& s) const { const FString tmp(s); @@ -324,7 +324,7 @@ inline bool FString::operator <= (CharT& s) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator == (CharT& s) const { const FString tmp(s); @@ -332,7 +332,7 @@ inline bool FString::operator == (CharT& s) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator != (CharT& s) const { const FString tmp(s); @@ -340,7 +340,7 @@ inline bool FString::operator != (CharT& s) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator >= (CharT& s) const { const FString tmp(s); @@ -348,7 +348,7 @@ inline bool FString::operator >= (CharT& s) const } //---------------------------------------------------------------------- -template +template inline bool FString::operator > (CharT& s) const { const FString tmp(s); diff --git a/src/include/final/ftermbuffer.h b/src/include/final/ftermbuffer.h index f6952246..c2dd5618 100644 --- a/src/include/final/ftermbuffer.h +++ b/src/include/final/ftermbuffer.h @@ -65,7 +65,8 @@ class FTermBuffer virtual ~FTermBuffer(); // Overloaded operators - template FTermBuffer& operator << (const type&); + template + FTermBuffer& operator << (const type&); // Non-member operators friend std::vector& operator << ( std::vector& , const FTermBuffer& ); @@ -93,7 +94,7 @@ class FTermBuffer // FTermBuffer inline functions //---------------------------------------------------------------------- -template +template inline FTermBuffer& FTermBuffer::operator << (const type& s) { std::wostringstream outstream; diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 389530f3..a60612e3 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -120,7 +120,8 @@ class FVTerm : public FTerm virtual ~FVTerm(); // Overloaded operators - template FVTerm& operator << (const type&); + template + FVTerm& operator << (const type&); FVTerm& operator << (const std::vector&); // Accessors @@ -503,7 +504,7 @@ struct FVTerm::term_area // define virtual terminal character properties // FVTerm inline functions //---------------------------------------------------------------------- -template +template inline FVTerm& FVTerm::operator << (const type& s) { std::wostringstream outstream; diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index 90154c6d..69fbef5f 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -932,6 +932,33 @@ const wchar_t CHECKED_RADIO_BUTTON[4] = '\0' }; +// non-member functions +//---------------------------------------------------------------------- +inline char* createBlankArray (std::size_t size) +{ + char* blank; + + try + { + blank = new char[size + 1]; + } + catch (const std::bad_alloc& ex) + { + std::cerr << "not enough memory to alloc " << ex.what() << std::endl; + return 0; + } + + std::memset(blank, ' ', size); + blank[size] = '\0'; + return blank; +} + +//---------------------------------------------------------------------- +inline void destroyBlankArray (char blank[]) +{ + delete[] blank; +} + } // namespace finalcut #endif // FWIDGET_H