layers-panel.h revision 9604887a348217c2d981233696057d29be2ca63d
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#ifndef SEEN_LAYERS_PANEL_H
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#define SEEN_LAYERS_PANEL_H
36d9047104b5881ca587a71ade77b1f21d083bc4Jon A. Cruz/*
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould * A simple dialog for layer UI.
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould *
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould * Authors:
6870ed0e21db566752803f973d565bdd2cae8855Diederik van Lierop * Jon A. Cruz
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould *
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould * Copyright (C) 2006 Jon A. Cruz
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould *
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould * Released under GNU GPL, read the file 'COPYING' for more information
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop */
6debf70683e9b0f2787a5341a9e186903962d54edvlierop
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#include <gtkmm/treeview.h>
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#include <gtkmm/treestore.h>
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#include <gtkmm/tooltips.h>
36d9047104b5881ca587a71ade77b1f21d083bc4Jon A. Cruz#include <gtkmm/scrolledwindow.h>
36d9047104b5881ca587a71ade77b1f21d083bc4Jon A. Cruz#include <gtkmm/buttonbox.h>
36d9047104b5881ca587a71ade77b1f21d083bc4Jon A. Cruz
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#include "ui/widget/panel.h"
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould//#include "ui/previewholder.h"
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lieropclass SPObject;
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lieropnamespace Inkscape {
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lieropclass LayerManager;
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop
dd4813c95b01f50d65fad4afa4a221926c995a05Diederik van Lieropnamespace UI {
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lieropnamespace Dialogs {
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
e880856acecaf628f3066ed5688c97471762481bDiederik van Lierop
e880856acecaf628f3066ed5688c97471762481bDiederik van Lierop/**
e880856acecaf628f3066ed5688c97471762481bDiederik van Lierop * A panel that displays layers.
e880856acecaf628f3066ed5688c97471762481bDiederik van Lierop */
e880856acecaf628f3066ed5688c97471762481bDiederik van Lieropclass LayersPanel : public Inkscape::UI::Widget::Panel
2b7ee786ac3f40bb6b0d6e19f565b802f29f50e0dvlierop{
2b7ee786ac3f40bb6b0d6e19f565b802f29f50e0dvlieroppublic:
2b7ee786ac3f40bb6b0d6e19f565b802f29f50e0dvlierop LayersPanel();
2b7ee786ac3f40bb6b0d6e19f565b802f29f50e0dvlierop virtual ~LayersPanel();
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould static LayersPanel& getInstance();
2b7ee786ac3f40bb6b0d6e19f565b802f29f50e0dvlierop //virtual void setOrientation( Gtk::AnchorType how );
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop void setDesktop( SPDesktop* desktop );
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lieropprotected:
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop //virtual void _handleAction( int setId, int itemId );
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lieropprivate:
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White class ModelColumns;
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White class InternalUIBounce;
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop LayersPanel(LayersPanel const &); // no copy
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White LayersPanel &operator=(LayersPanel const &); // no assign
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White static LayersPanel* instance;
6debf70683e9b0f2787a5341a9e186903962d54edvlierop
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _fireAction( unsigned int code );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _preToggle( GdkEvent const *event );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _toggled( Glib::ustring const& str, int targetCol );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _handleButtonEvent(GdkEventButton* evt);
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _pushTreeSelectionToCurrent();
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _checkTreeSelection();
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz void _takeAction( int val );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz bool _executeAction();
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop void _updateLayer(SPObject *layer);
153bb1867986d6db392e2cfa711ad6231fce8abeJon A. Cruz bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop void _selectLayer(SPObject *layer);
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop void _layersChanged();
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop SPObject* _selectedLayer();
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop // Hooked to the layer manager:
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop sigc::connection _layerChangedConnection;
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop sigc::connection _layerUpdatedConnection;
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop sigc::connection _changedConnection;
f8526e9e32507aa02ffdb5fd9f3ee99393ec9afdDiederik van Lierop sigc::connection _addedConnection;
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White sigc::connection _removedConnection;
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White int _maxNestDepth;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Inkscape::LayerManager* _mgr;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould SPDesktop* _desktop;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould ModelColumns* _model;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould InternalUIBounce* _pending;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould GdkEvent* _toggleEvent;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Glib::RefPtr<Gtk::TreeStore> _store;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould std::vector<Gtk::Widget*> _watching;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould std::vector<Gtk::Widget*> _watchingNonTop;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould std::vector<Gtk::Widget*> _watchingNonBottom;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Gtk::Tooltips _tips;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Gtk::TreeView _tree;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Gtk::HButtonBox _buttonsRow;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould Gtk::ScrolledWindow _scroller;
a4030d5ca449e7e384bc699cd249ee704faaeab0Chris Morgan Gtk::Menu _popupMenu;
};
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
#endif // SEEN_LAYERS_PANEL_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :