~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/helper/unit-tracker.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Inkscape::UnitTracker - Simple mediator to synchronize changes to a set
 
3
 *   of possible units
 
4
 *
 
5
 * Authors:
 
6
 *   Jon A. Cruz <jon@joncruz.org>
 
7
 *
 
8
 * Copyright (C) 2007 Jon A. Cruz
 
9
 *
 
10
 * Released under GNU GPL, read the file 'COPYING' for more information
 
11
 */
 
12
 
 
13
#ifndef SEEN_INKSCAPE_UNIT_TRACKER_H
 
14
#define SEEN_INKSCAPE_UNIT_TRACKER_H
 
15
 
 
16
#include <map>
 
17
 
 
18
#include <gtk/gtkaction.h>
 
19
 
 
20
#include "helper/units.h"
 
21
 
 
22
namespace Inkscape {
 
23
 
 
24
class UnitTracker
 
25
{
 
26
public:
 
27
    UnitTracker( guint bases = (SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE) );
 
28
    virtual ~UnitTracker();
 
29
 
 
30
    void setBase( guint bases ); // SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE
 
31
    void addUnit( SPUnitId id, gint index );
 
32
 
 
33
    bool isUpdating() const;
 
34
 
 
35
    void setActiveUnit( SPUnit const *unit );
 
36
    SPUnit const* getActiveUnit() const;
 
37
 
 
38
    void addAdjustment( GtkAdjustment* adj );
 
39
    void setFullVal( GtkAdjustment* adj, gdouble val );
 
40
 
 
41
    GtkAction* createAction( gchar const* name, gchar const* label, gchar const* tooltip );
 
42
 
 
43
private:
 
44
    static void _unitChangedCB( GtkAction* action, gpointer data );
 
45
    static void _actionFinalizedCB( gpointer data, GObject *where_the_object_was );
 
46
    static void _adjustmentFinalizedCB( gpointer data, GObject *where_the_object_was );
 
47
    void _setActive( gint index );
 
48
    void _fixupAdjustments( SPUnit const* oldUnit, SPUnit const *newUnit );
 
49
    void _actionFinalized( GObject *where_the_object_was );
 
50
    void _adjustmentFinalized( GObject *where_the_object_was );
 
51
 
 
52
    gint _active;
 
53
    bool _isUpdating;
 
54
    SPUnit* _activeUnit;
 
55
    GtkListStore* _store;
 
56
    GSList* _unitList;
 
57
    GSList* _actionList;
 
58
    GSList* _adjList;
 
59
    std::map <GtkAdjustment*, gdouble> _priorValues;
 
60
};
 
61
 
 
62
}
 
63
 
 
64
#endif // SEEN_INKSCAPE_UNIT_TRACKER_H
 
65
 
 
66
/*
 
67
  Local Variables:
 
68
  mode:c++
 
69
  c-file-style:"stroustrup"
 
70
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
71
  indent-tabs-mode:nil
 
72
  fill-column:99
 
73
  End:
 
74
*/
 
75
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :