disabled overhead base classes 'FbTk::Layer' and 'FbTk::LayerItem'

had to add <algorithm> at various other files as a result of this change.
This commit is contained in:
Mathias Gumz 2011-02-23 22:46:13 +01:00
parent c859ae3987
commit 813e6c4402
9 changed files with 30 additions and 21 deletions

View file

@ -42,6 +42,7 @@
#include <fstream>
#include <string>
#include <memory>
#include <algorithm>
#ifdef HAVE_CSTDIO
#include <cstdio>
#else

View file

@ -27,9 +27,9 @@
#include "MultLayers.hh"
#include <iostream>
#include <algorithm>
#include <numeric>
using std::find;
using namespace FbTk;
#ifdef DEBUG
@ -91,7 +91,7 @@ void XLayer::restack(const std::vector<XLayer*>& layers) {
std::vector<Window> stack;
std::vector<XLayer*>::const_iterator l;
for (l = layers.begin(); l != layers.end(); ++l) {
extract_windows_to_stack((*l)->getItemList(), 0, stack);
extract_windows_to_stack((*l)->itemList(), 0, stack);
}
if (!stack.empty())
@ -160,7 +160,7 @@ void XLayer::alignItem(XLayerItem &item) {
// Note: some other things effectively assume that the window list is
// sorted from highest to lowest
// get our item
iterator myit = find(itemList().begin(), itemList().end(), &item);
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
iterator it = myit;
// go to the one above it in our layer (top is front, so we decrement)
@ -211,7 +211,8 @@ void XLayer::raise(XLayerItem &item) {
return; // nothing to do
}
iterator it = find(itemList().begin(), itemList().end(), &item);
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
itemList().erase(it);
else {
@ -232,7 +233,7 @@ void XLayer::tempRaise(XLayerItem &item) {
if (!m_needs_restack && &item == itemList().front())
return; // nothing to do
iterator it = find(itemList().begin(), itemList().end(), &item);
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it == itemList().end()) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
@ -258,7 +259,7 @@ void XLayer::lower(XLayerItem &item) {
return; // nothing to do
}
iterator it = find(itemList().begin(), itemList().end(), &item);
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
// remove this item
itemList().erase(it);

View file

@ -23,7 +23,7 @@
#ifndef FBTK_XLAYER_HH
#define FBTK_XLAYER_HH
#include "Layer.hh"
#include <vector>
#include <list>
namespace FbTk {
@ -31,7 +31,7 @@ namespace FbTk {
class MultLayers;
class XLayerItem;
class XLayer : public FbTk::LayerBase<XLayerItem, std::list<XLayerItem *> > {
class XLayer {
public:
XLayer(MultLayers &manager, int layernum);
@ -49,8 +49,8 @@ public:
int countWindows();
void stackBelowItem(XLayerItem &item, XLayerItem *above);
XLayerItem *getLowestItem();
const ItemList &getItemList() const { return itemList(); }
ItemList &getItemList() { return itemList(); }
const ItemList &itemList() const { return m_items; }
ItemList &itemList() { return m_items; }
// we redefine these as XLayer has special optimisations, and X restacking needs
iterator insert(XLayerItem &item, unsigned int pos=0);
@ -77,6 +77,7 @@ private:
MultLayers &m_manager;
int m_layernum;
bool m_needs_restack;
ItemList m_items;
};
} // namespace FbTk

View file

@ -23,11 +23,13 @@
#include "XLayerItem.hh"
#include "XLayer.hh"
#include <algorithm>
using namespace FbTk;
XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) :
m_layer(&layer) {
m_windows.push_front(&win);
m_windows.push_back(&win);
m_layer->insert(*this);
}
@ -78,15 +80,15 @@ void XLayerItem::addWindow(FbWindow &win) {
}
void XLayerItem::removeWindow(FbWindow &win) {
// I'd like to think we can trust ourselves that it won't be added twice...
// Otherwise we're always scanning through the list.
// I'd like to think we can trust ourselves that it won't be added twice...
// Otherwise we're always scanning through the list.
XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win);
if (it != m_windows.end())
m_windows.erase(it);
XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win);
if (it != m_windows.end())
m_windows.erase(it);
}
void XLayerItem::bringToTop(FbWindow &win) {
removeWindow(win);
addWindow(win);
removeWindow(win);
addWindow(win);
}

View file

@ -23,17 +23,17 @@
#ifndef FBTK_XLAYERITEM_HH
#define FBTK_XLAYERITEM_HH
#include "LayerItem.hh"
#include "XLayer.hh"
#include "NotCopyable.hh"
#include <vector>
namespace FbTk {
class FbWindow;
class XLayerItem : public LayerItem, private NotCopyable {
class XLayerItem : private NotCopyable {
public:
typedef std::list<FbWindow *> Windows;
typedef std::vector<FbWindow *> Windows;
XLayerItem(FbWindow &win, XLayer &layer);
~XLayerItem();

View file

@ -34,6 +34,7 @@
#include <string>
#include <iostream>
#include <algorithm>
#ifdef HAVE_CSTRING
#include <cstring>
#else

View file

@ -31,6 +31,7 @@
#include "FbTk/MemFun.hh"
#include <vector>
#include <algorithm>
#ifdef HAVE_CSTRING
#include <cstring>

View file

@ -54,6 +54,7 @@
#include "FbTk/Transparent.hh"
#include <iostream>
#include <algorithm>
using std::cerr;
using std::endl;

View file

@ -75,6 +75,7 @@
#include <iterator>
#include <typeinfo>
#include <functional>
#include <algorithm>
using std::string;
using std::pair;