From 7e2187d8c5cb6c37d27be6794072d61abd7f1b24 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 3 Feb 2003 13:45:23 +0000 Subject: stoped --- src/FbTk/XLayer.cc | 116 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 50 deletions(-) diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc index d945f4b..6b1791f 100644 --- a/src/FbTk/XLayer.cc +++ b/src/FbTk/XLayer.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XLayer.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $ +// $Id: XLayer.cc,v 1.4 2003/02/03 13:45:23 fluxgen Exp $ #include "XLayer.hh" #include "XLayerItem.hh" @@ -35,45 +35,42 @@ XLayer::XLayer(MultLayers &manager, int layernum): } XLayer::~XLayer() { + } void XLayer::restack() { - int numWindows = countWindows(); + int num_windows = countWindows(); // each LayerItem can contain several windows iterator it = itemList().begin(); iterator it_end = itemList().end(); - it = itemList().begin(); - it_end = itemList().end(); - Window *winlist = new Window[numWindows]; + Window *winlist = new Window[num_windows]; size_t j=0; - for (size_t i=0; it != it_end; ++it, i++) { - XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); - XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); - for (; wit != wit_end; ++wit, j++) { - winlist[j] = (*wit); - } + for (size_t window=0; it != it_end; ++it, window++) { + winlist[window] = (*it)->window(); } - XRestackWindows(FbTk::App::instance()->display(), winlist, numWindows); + XRestackWindows(FbTk::App::instance()->display(), winlist, num_windows); delete [] winlist; } int XLayer::countWindows() { - int numWindows = 0; + int num_windows = 0; iterator it = itemList().begin(); iterator it_end = itemList().end(); for (size_t i=0; it != it_end; ++it, i++) { - numWindows += (*it)->numWindows(); + num_windows ++; // one window per item } - return numWindows; + return num_windows; } void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { + //!! What???? + // little optimisation - Window *winlist; + /* Window *winlist; size_t i, size, num = item->numWindows(); if (!above) { // must need to go right to top @@ -105,61 +102,70 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { XRestackWindows(FbTk::App::instance()->display(), winlist, size); delete [] winlist; + */ } XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) { #ifdef DEBUG - if (pos != 0) + if (pos != 0)//!! Why???? cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"<visible()) ++it; + while (it != it_end && !(*it)->visible()) + ++it; // if there is something to do - if (it != it_end) { + if (it != it_end) lower(**it); - } + } void XLayer::cycleDown() { // need to find highest visible window, and move it to bottom reverse_iterator it = itemList().rbegin(); reverse_iterator it_end = itemList().rend(); - while (it != it_end && !(*it)->visible()) ++it; + while (it != it_end && !(*it)->visible()) + ++it; // if there is something to do - if (it != it_end) { + if (it != it_end) raise(**it); - } } void XLayer::stepUp(XLayerItem &item) { // need to find next visible window upwards, and put it above that - if (&item == itemList().front()) return; // nothing to do + if (&item == itemList().front()) + return; // nothing to do + //!! better stable and slow than buggy! + /* // TODO: is there a better way of doing this? iterator it = item.getLayerIterator(); it--; - while ((*it) != itemList().front() && !(*it)->visible()) --it; + while ((*it) != itemList().front() && !(*it)->visible()) + --it; if (*it == itemList().front() && !(*it)->visible()) { // reached front item, but it wasn't visible, therefore it was already raised @@ -176,33 +182,36 @@ void XLayer::stepUp(XLayerItem &item) { stackBelowItem(&item, *it); } } + */ } void XLayer::stepDown(XLayerItem &item) { // need to find next visible window down, and put it below that - if (&item == itemList().back()) return; // nothing to do - + if (&item == itemList().back()) + return; // nothing to do - iterator it = item.getLayerIterator(); + //!! better stable and slow than buggy! + /* iterator it = item.getLayerIterator(); it++; iterator it_end = itemList().end(); - while (it != it_end && !(*it)->visible()) ++it; + while (it != it_end && !(*it)->visible()) + ++it; - if (it != it_end) { + if (it != it_end) stackBelowItem(&item, *it); - } + */ } +//!! void XLayer::raise(XLayerItem &item) { // assume it is already in this layer - if (&item == itemList().front()) { + if (&item == itemList().front()) return; // nothing to do - } - itemList().erase(item.getLayerIterator()); + // itemList().erase(item.getLayerIterator()); itemList().push_front(&item); - item.setLayerIterator(itemList().begin()); + // item.setLayerIterator(itemList().begin()); stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); } @@ -212,6 +221,8 @@ void XLayer::lower(XLayerItem &item) { if (&item == itemList().back()) return; // nothing to do + //!! better stable and slow than buggy! + /* itemList().erase(item.getLayerIterator()); itemList().push_back(&item); iterator it = itemList().end(); @@ -219,28 +230,33 @@ void XLayer::lower(XLayerItem &item) { item.setLayerIterator(it); it--; stackBelowItem(&item, *it); // must exist, otherwise item must == itemList().back() + */ } XLayerItem *XLayer::getLowestItem() { - if (itemList().empty()) return 0; - else return itemList().back(); + if (itemList().empty()) + return 0; + else + return itemList().back(); } XLayerItem *XLayer::getItemBelow(XLayerItem &item) { - iterator it = item.getLayerIterator(); - if (it == itemList().begin()) { + //!! better stable and slow than buggy! + /* iterator it = item.getLayerIterator(); + if (it == itemList().begin()) return 0; - } else { + else return *(--it); - } + */ } XLayerItem *XLayer::getItemAbove(XLayerItem &item) { - iterator it = item.getLayerIterator(); + //!! better stable and slow than buggy! + /* iterator it = item.getLayerIterator(); it++; - if (it == itemList().end()) { + if (it == itemList().end()) return 0; - } else { + else return *it; - } + */ } -- cgit v0.11.2