summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f07e17f)
raw | patch | inline | side by side (parent: f07e17f)
author | joncruz <joncruz@users.sourceforge.net> | |
Fri, 13 Jun 2008 15:55:51 +0000 (15:55 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Fri, 13 Jun 2008 15:55:51 +0000 (15:55 +0000) |
src/desktop.cpp | patch | blob | history | |
src/desktop.h | patch | blob | history | |
src/dialogs/layers-panel.cpp | patch | blob | history | |
src/verbs.cpp | patch | blob | history | |
src/verbs.h | patch | blob | history |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 5796ed6386ba810fa01aef91ed359249c94f47d8..e16b030a44dfc9d2c2705502fcc61b661bcc172e 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
#include "xml/repr.h"
#include "message-context.h"
#include "device-manager.h"
+#include "layer-fns.h"
#include "layer-manager.h"
#include "event-log.h"
#include "display/canvas-grid.h"
_layer_hierarchy->setBottom(object);
}
+void SPDesktop::toggleLayerSolo(SPObject *object) {
+ g_return_if_fail(SP_IS_GROUP(object));
+ g_return_if_fail( currentRoot() == object || (currentRoot() && currentRoot()->isAncestorOf(object)) );
+
+ bool othersShowing = false;
+ std::vector<SPObject*> layers;
+ for ( SPObject* obj = Inkscape::next_layer(currentRoot(), object); obj; obj = Inkscape::next_layer(currentRoot(), obj) ) {
+ layers.push_back(obj);
+ othersShowing |= !SP_ITEM(obj)->isHidden();
+ }
+ for ( SPObject* obj = Inkscape::previous_layer(currentRoot(), object); obj; obj = Inkscape::previous_layer(currentRoot(), obj) ) {
+ layers.push_back(obj);
+ othersShowing |= !SP_ITEM(obj)->isHidden();
+ }
+
+
+ if ( SP_ITEM(object)->isHidden() ) {
+ SP_ITEM(object)->setHidden(false);
+ }
+
+ for ( std::vector<SPObject*>::iterator it = layers.begin(); it != layers.end(); ++it ) {
+ SP_ITEM(*it)->setHidden(othersShowing);
+ }
+}
+
/**
* Return layer that contains \a object.
*/
diff --git a/src/desktop.h b/src/desktop.h
index af0d41b2a573ff7335480670e114e1faee43ab77..adb6cb98b1f67089c9877d5801ce7846be458912 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
SPObject *currentRoot() const;
SPObject *currentLayer() const;
void setCurrentLayer(SPObject *object);
+ void toggleLayerSolo(SPObject *object);
SPObject *layerForObject(SPObject *object);
bool isLayer(SPObject *object) const;
bool isWithinViewport(SPItem *item) const;
index 480b60b633a2d1005e4fcd5d01639a721d8e10be..ebb6d989d2086a7bd86259f8356dad284ab15da9 100644 (file)
BUTTON_UP,
BUTTON_DOWN,
// BUTTON_DUPLICATE,
- BUTTON_DELETE
+ BUTTON_DELETE,
+ BUTTON_SOLO
};
class ImageToggler : public Gtk::CellRendererPixbuf {
{
_fireAction( SP_VERB_LAYER_DELETE );
}
+ case BUTTON_SOLO:
+ {
+ _fireAction( SP_VERB_LAYER_SOLO );
+ }
break;
}
row[_model->_colVisible] = newValue;
item->setHidden( !newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
+ sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
newValue? _("Unhide layer") : _("Hide layer"));
}
break;
row[_model->_colLocked] = newValue;
item->setLocked( newValue );
item->updateRepr();
- sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
+ sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS,
newValue? _("Lock layer") : _("Unlock layer"));
}
break;
{
_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) );
_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) );
+ _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) );
_popupMenu.items().push_back( Gtk::Menu_Helpers::SeparatorElem() );
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 509dff087c0cfe63be06d42769ba349d4be4ccfc..a362d3c0f9e3678901c64648b3e6be595c61b7a3 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
}
break;
}
+ case SP_VERB_LAYER_SOLO: {
+ if ( dt->currentLayer() == dt->currentRoot() ) {
+ dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
+ } else {
+ dt->toggleLayerSolo( dt->currentLayer() );
+ sp_document_maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
+ }
+ break;
+ }
}
return;
N_("Lower the current layer"), "lower_layer"),
new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
N_("Delete the current layer"), "delete_layer"),
+ new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Solo Current Layer"),
+ N_("Solo the current layer"), 0),
/* Object */
new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90° CW"),
diff --git a/src/verbs.h b/src/verbs.h
index 6447bbadd45a7801b145568419421bb63a4f62c1..198a25521de91d0efc4a296112f013d37cdeebab 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_LAYER_RAISE,
SP_VERB_LAYER_LOWER,
SP_VERB_LAYER_DELETE,
+ SP_VERB_LAYER_SOLO,
/* Object */
SP_VERB_OBJECT_ROTATE_90_CW,
SP_VERB_OBJECT_ROTATE_90_CCW,