~do-core/do/weather-applet

« back to all changes in this revision

Viewing changes to Do.Interface.Linux.Docky/src/Docky.Interface/ItemPositionProvider.cs

  • Committer: Jason Smith
  • Date: 2009-02-09 05:07:34 UTC
  • mfrom: (935.4.4 do)
  • Revision ID: jassmith@gmail.com-20090209050734-qv12e2y1jonpg7zx
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
                const int HorizontalBuffer = 7;
36
36
                
37
37
                DockArea parent;
 
38
                List<Gdk.Point> static_positions;
38
39
                
39
40
                ReadOnlyCollection<AbstractDockItem> DockItems {
40
41
                        get { return DockServices.ItemsService.DockItems; }
84
85
                {
85
86
                        this.parent = parent;
86
87
                        MinimumDockArea = CalculateMinimumArea ();
 
88
                        static_positions = new List<Gdk.Point> ();
87
89
 
88
90
                        RegisterEvents ();
89
91
                }
104
106
 
105
107
                void HandleDockItemsChanged(IEnumerable<AbstractDockItem> items)
106
108
                {
 
109
                        static_positions.Clear ();
107
110
                        MinimumDockArea = CalculateMinimumArea ();
108
111
                }
109
112
 
194
197
                
195
198
                public Gdk.Point IconUnzoomedPosition (int icon)
196
199
                {
 
200
                        if (static_positions.Count != DockItems.Count) {
 
201
                                static_positions.Clear ();
 
202
                                
 
203
                                for (int i = 0; i < DockItems.Count; i++) {
 
204
                                        static_positions.Add (CalculateIconUnzoomedPosition (i));
 
205
                                }
 
206
                        }
 
207
                        
 
208
                        if (DockItems.Count <= icon)
 
209
                                return CalculateIconUnzoomedPosition (icon);
 
210
                        
 
211
                        return static_positions [icon];
 
212
                }
 
213
                
 
214
                private Gdk.Point CalculateIconUnzoomedPosition (int icon)
 
215
                {
197
216
                        // the first icons center is at dock X + border + IconBorder + half its width
198
217
                        // it is subtle, but it *is* a mistake to add the half width until the end.  adding
199
218
                        // premature will add the wrong width.  It hurts the brain.