/** * Removes and destroys the specified layer. */ void UndoTransaction::removeLayer(Layer* layer) { ASSERT(layer); LayerFolder* parent = layer->get_parent(); // if the layer to be removed is the selected layer if (layer == m_sprite->getCurrentLayer()) { Layer* layer_select = NULL; // select: previous layer, or next layer, or parent(if it is not the // main layer of sprite set) if (layer->get_prev()) layer_select = layer->get_prev(); else if (layer->get_next()) layer_select = layer->get_next(); else if (parent != m_sprite->getFolder()) layer_select = parent; // select other layer setCurrentLayer(layer_select); } // remove the layer if (isEnabled()) m_undoHistory->pushUndoer(new undoers::RemoveLayer(m_undoHistory->getObjects(), layer)); parent->remove_layer(layer); // destroy the layer delete layer; }
void LayerManager::setCurrentLayer( Layer* layer ) { Object* o = editor()->object(); for ( int i = 0; i < o->getLayerCount(); ++i ) { if ( layer == o->getLayer( i ) ) { setCurrentLayer( i ); return; } } }
void Editor::newCameraLayer() { if ( mObject != NULL ) { bool ok; QString text = QInputDialog::getText( NULL, tr( "Layer Properties" ), tr( "Layer name:" ), QLineEdit::Normal, tr( "Camera Layer" ), &ok ); if ( ok && !text.isEmpty() ) { Layer *layer = mObject->addNewCameraLayer(); layer->mName = text; emit updateLayerCount(); setCurrentLayer( mObject->getLayerCount() - 1 ); } } }
/** * Creates a new transparent layer. */ LayerImage* UndoTransaction::newLayer() { // new layer LayerImage* layer = new LayerImage(m_sprite); // add the layer in the sprite set if (isEnabled()) m_undoHistory->pushUndoer(new undoers::AddLayer(m_undoHistory->getObjects(), m_sprite->getFolder(), layer)); m_sprite->getFolder()->add_layer(layer); // select the new layer setCurrentLayer(layer); return layer; }
bool LayerManager::deleteCurrentLayer() { if ( currentLayer()->type() == Layer::CAMERA ) { return false; } editor()->object()->deleteLayer( currentLayerIndex() ); if ( currentLayerIndex() == editor()->object()->getLayerCount() ) { setCurrentLayer( currentLayerIndex() - 1 ); } emit editor()->updateAllFrames(); emit layerCountChanged( count() ); return true; }
void Editor::newBitmapLayer() { if ( mObject != NULL ) { // bool ok; // QString text = QInputDialog::getText( NULL, tr( "Layer Properties" ), // tr( "Layer name:" ), QLineEdit::Normal, // tr( "Bitmap Layer" ), &ok ); // if ( ok && !text.isEmpty() ) // { Layer *layer = mObject->addNewBitmapLayer(); layer->mName = "image"; emit updateLayerCount(); setCurrentLayer( mObject->getLayerCount() - 1 ); //} } }
bool LayerManager::deleteCurrentLayer() { // FIXME: if ( currentLayer()->type() == Layer::CAMERA ) { return false; } editor()->object()->deleteLayer( currentLayerIndex() ); if ( currentLayerIndex() == editor()->object()->getLayerCount() ) { setCurrentLayer( currentLayerIndex() - 1 ); } Q_EMIT layerCountChanged( count() ); return true; }
bool StackDebugger::checkSanity (CompWindowList &serverWindows, bool verbose) { int current = 0xffffffff; int oldCurrent = current; bool err = false; if (verbose) compLogMessage ("stackdebugger", CompLogLevelDebug, "processing new stack --------"); /* go backwards down the stack */ for (CompWindowList::reverse_iterator rit = serverWindows.rbegin (); rit != serverWindows.rend (); ++rit) { CompWindow *w = (*rit); /* Override redirect windows set all kinds * of crazy stuff and are required to stack * themselves so skip those */ if (w->overrideRedirect ()) continue; /* ignore non-override redirect unmanaged windows */ if (!w->managed ()) continue; /* ignore any windows that just got created */ if (!w->mapNum ()) continue; /* determine the current layer */ if (w->type () == CompWindowTypeDockMask) { if ((current & DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) == DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) { bool fullscreenWindow = false; /* search down the stack to check if there is a fullscreen * window, otherwise we are not on the fullscreen layer */ for (CompWindow *rw = w->prev; rw; rw = rw->prev) { if (rw->type () & CompWindowTypeFullscreenMask) { fullscreenWindow = true; break; } } /* if there is no fullscreen window, change the layer */ if (!fullscreenWindow) err |= setCurrentLayer (w->id (), DOCKS, current); else err |= setCurrentLayer (w->id (), DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN, current); } else if (w->state () & CompWindowStateBelowMask) err |= setCurrentLayer (w->id (), DOCKS_BELOW, current); else err |= setCurrentLayer (w->id (), DOCKS, current); } else if (w->type () == CompWindowTypeFullscreenMask) { err |= setCurrentLayer (w->id (), FULLSCREEN, current); } else if (w->type () == CompWindowTypeDesktopMask) { err |= setCurrentLayer (w->id (), DESKTOP, current); } /* everything else that is not a fullscreen window or a desktop */ else { if (w->state () & CompWindowStateAboveMask) { if ((current & KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) == KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) { bool fullscreenWindow = false; /* search down the stack to check if there is a fullscreen * window, otherwise we are not on the fullscreen layer */ for (CompWindow *rw = w->prev; rw; rw = rw->prev) { if (rw->type () & CompWindowTypeFullscreenMask) { fullscreenWindow = true; break; } } if (!fullscreenWindow) err |= setCurrentLayer (w->id (), KEEP_ABOVE, current); else err |= setCurrentLayer (w->id (), KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN, current); } else err |= setCurrentLayer (w->id (), KEEP_ABOVE, current); } else if (w->state () & CompWindowStateBelowMask) err |= setCurrentLayer (w->id (), KEEP_BELOW, current); else { if ((current & TOPLEVELS_ABOVE_FULLSCREEN) == TOPLEVELS_ABOVE_FULLSCREEN) { bool fullscreenWindow = false; /* search down the stack to check if there is a fullscreen * window, otherwise we are not on the fullscreen layer */ for (CompWindow *rw = w->prev; rw; rw = rw->prev) { if (rw->type () & CompWindowTypeFullscreenMask) { fullscreenWindow = true; break; } } if (!fullscreenWindow) err |= setCurrentLayer (w->id (), TOPLEVELS, current); else err |= setCurrentLayer (w->id (), TOPLEVELS_ABOVE_FULLSCREEN, current); } else err |= setCurrentLayer (w->id (), TOPLEVELS, current); } } if ((current & DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) == DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer DOCKS_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN"); } else if ((current & KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) == KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer KEEP_ABOVE_TOPLEVELS_ABOVE_FULLSCREEN"); } else if ((current & TOPLEVELS_ABOVE_FULLSCREEN) == TOPLEVELS_ABOVE_FULLSCREEN) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer TOPLEVELS_ABOVE_FULLSCREEN"); } else if ((current & FULLSCREEN) == FULLSCREEN) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer FULLSCREEN"); } else if ((current & DOCKS) == DOCKS) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer DOCKS"); } else if ((current & KEEP_ABOVE) == KEEP_ABOVE) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer KEEP_ABOVE"); } else if ((current & TOPLEVELS) == TOPLEVELS) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer TOPLEVELS"); } else if ((current & DOCKS_BELOW) == DOCKS_BELOW) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer DOCKS_BELOW"); } else if ((current & KEEP_BELOW) == KEEP_BELOW) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer KEEP_BELOW"); } else if ((current & DESKTOP) == DESKTOP) { if (verbose && current != oldCurrent) compLogMessage ("stackdebugger", CompLogLevelDebug, "on layer DESKTOP"); } oldCurrent = current; } return err; }
void QgsMapCanvasSnappingUtils::canvasCurrentLayerChanged() { setCurrentLayer( qobject_cast<QgsVectorLayer*>( mCanvas->currentLayer() ) ); }