~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/ui/dialog/layer-properties.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 * @brief  Dialog for renaming layers
 
3
 */
 
4
/* Author:
 
5
 *   Bryce W. Harrington <bryce@bryceharrington.com>
 
6
 *
 
7
 * Copyright (C) 2004 Bryce Harrington
 
8
 *
 
9
 * Released under GNU GPL.  Read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
#ifndef INKSCAPE_DIALOG_LAYER_PROPERTIES_H
 
13
#define INKSCAPE_DIALOG_LAYER_PROPERTIES_H
 
14
 
 
15
#include <gtkmm/dialog.h>
 
16
#include <gtkmm/notebook.h>
 
17
#include <gtkmm/separator.h>
 
18
#include <gtkmm/frame.h>
 
19
#include <gtkmm/entry.h>
 
20
#include <gtkmm/label.h>
 
21
#include <gtkmm/table.h>
 
22
#include <gtkmm/combobox.h>
 
23
#include <gtkmm/liststore.h>
 
24
 
 
25
#include "selection.h"
 
26
#include "layer-fns.h"
 
27
 
 
28
namespace Inkscape {
 
29
namespace UI {
 
30
namespace Dialogs {
 
31
 
 
32
class LayerPropertiesDialog : public Gtk::Dialog {
 
33
 public:
 
34
    LayerPropertiesDialog();
 
35
    virtual ~LayerPropertiesDialog();
 
36
 
 
37
    Glib::ustring     getName() const { return "LayerPropertiesDialog"; }
 
38
 
 
39
    static void showRename(SPDesktop *desktop, SPObject *layer) {
 
40
        _showDialog(Rename::instance(), desktop, layer);
 
41
    }
 
42
    static void showCreate(SPDesktop *desktop, SPObject *layer) {
 
43
        _showDialog(Create::instance(), desktop, layer);
 
44
    }
 
45
 
 
46
protected:
 
47
    struct Strategy {
 
48
        virtual ~Strategy() {}
 
49
        virtual void setup(LayerPropertiesDialog &)=0;
 
50
        virtual void perform(LayerPropertiesDialog &)=0;
 
51
    };
 
52
    struct Rename : public Strategy {
 
53
        static Rename &instance() { static Rename instance; return instance; }
 
54
        void setup(LayerPropertiesDialog &dialog);
 
55
        void perform(LayerPropertiesDialog &dialog);
 
56
    };
 
57
    struct Create : public Strategy {
 
58
        static Create &instance() { static Create instance; return instance; }
 
59
        void setup(LayerPropertiesDialog &dialog);
 
60
        void perform(LayerPropertiesDialog &dialog);
 
61
    };
 
62
 
 
63
    friend class Rename;
 
64
    friend class Create;
 
65
 
 
66
    Strategy *_strategy;
 
67
    SPDesktop *_desktop;
 
68
    SPObject *_layer;
 
69
 
 
70
    class PositionDropdownColumns : public Gtk::TreeModel::ColumnRecord {
 
71
    public:
 
72
        Gtk::TreeModelColumn<LayerRelativePosition> position;
 
73
        Gtk::TreeModelColumn<Glib::ustring> name;
 
74
 
 
75
        PositionDropdownColumns() {
 
76
            add(position); add(name);
 
77
        }
 
78
    };
 
79
 
 
80
    Gtk::Label        _layer_name_label;
 
81
    Gtk::Entry        _layer_name_entry;
 
82
    Gtk::Label        _layer_position_label;
 
83
    Gtk::ComboBox     _layer_position_combo;
 
84
    Gtk::Table        _layout_table;
 
85
    bool              _position_visible;
 
86
 
 
87
    PositionDropdownColumns _dropdown_columns;
 
88
    Gtk::CellRendererText _label_renderer;
 
89
    Glib::RefPtr<Gtk::ListStore> _dropdown_list;
 
90
 
 
91
    Gtk::Button       _close_button;
 
92
    Gtk::Button       _apply_button;
 
93
 
 
94
    sigc::connection    _destroy_connection;
 
95
 
 
96
    static LayerPropertiesDialog &_instance() {
 
97
        static LayerPropertiesDialog instance;
 
98
        return instance;
 
99
    }
 
100
 
 
101
    void _setDesktop(SPDesktop *desktop);
 
102
    void _setLayer(SPObject *layer);
 
103
 
 
104
    static void _showDialog(Strategy &strategy, SPDesktop *desktop, SPObject *layer);
 
105
    void _apply();
 
106
    void _close();
 
107
 
 
108
    void _setup_position_controls();
 
109
    void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row);
 
110
 
 
111
private:
 
112
    LayerPropertiesDialog(LayerPropertiesDialog const &); // no copy
 
113
    LayerPropertiesDialog &operator=(LayerPropertiesDialog const &); // no assign
 
114
};
 
115
 
 
116
} // namespace
 
117
} // namespace
 
118
} // namespace
 
119
 
 
120
 
 
121
#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H
 
122
 
 
123
/*
 
124
  Local Variables:
 
125
  mode:c++
 
126
  c-file-style:"stroustrup"
 
127
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
128
  indent-tabs-mode:nil
 
129
  fill-column:99
 
130
  End:
 
131
*/
 
132
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :