~ubuntu-branches/ubuntu/precise/gnome-do/precise-proposed

« back to all changes in this revision

Viewing changes to Do.Addins/src/Do.UI/BaseWidgets/Frame.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2008-10-08 20:35:38 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20081008203538-yty5q4gpfx1ldint
Tags: 0.6.1.0-0ubuntu1
* New upstream release.  FFe is (LP: #279328)
* debian/patches/04_fix_locale_path:
  + Fix the translations path sent to gettext.  Without this, translations
    aren't used by Do.
* debian/gnome-do.gconf-defaults:
  + Don't popup the UI on login; wait for the user to summon Do.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
                                cairo.Arc (x+radius, y+radius, radius, Math.PI, (Math.PI*1.5));
129
129
                        }
130
130
                }
131
 
                
 
131
 
 
132
                protected virtual void GetBorderFrame (Cairo.Context cairo)
 
133
                {
 
134
                        /* Override coordinates to align to the cairo grid */
 
135
                        double X, Y, Width, Height;
 
136
                        X = x + cairo.LineWidth/2.0;
 
137
                        Y = y + cairo.LineWidth/2.0;
 
138
                        Width = width - cairo.LineWidth;
 
139
                        Height = height - cairo.LineWidth;
 
140
        
 
141
                        if (radius == 0)
 
142
                        {
 
143
                                cairo.MoveTo (X, Y);
 
144
                                cairo.Rectangle (X, Y, Width, Height);
 
145
                        } else {
 
146
                                cairo.MoveTo (X+radius, Y);
 
147
                                cairo.Arc (X+Width-radius, Y+radius, radius, (Math.PI*1.5), (Math.PI*2));
 
148
                                cairo.Arc (X+Width-radius, Y+Height-radius, radius, 0, (Math.PI*0.5));
 
149
                                cairo.Arc (X+radius, Y+Height-radius, radius, (Math.PI*0.5), Math.PI);
 
150
                                cairo.Arc (X+radius, Y+radius, radius, Math.PI, (Math.PI*1.5));
 
151
                        }
 
152
                }
 
153
 
132
154
                protected virtual void Paint (Gdk.Rectangle area)
133
155
                {
134
156
                        if (!IsDrawable) {
139
161
                                return;
140
162
                        }
141
163
 
142
 
                        // Why thickness?? Isn't it useless?
143
 
                        x = childAlloc.X + Style.XThickness;
144
 
                        y = childAlloc.Y + Style.YThickness;
 
164
                        /* You shouldn't change the size of the drawing area
 
165
                         * to avoid glitches when switching panes, though
 
166
                         * you can enlarge the big frame.
 
167
                         * This workaround is enlarging only the frame which has
 
168
                         * radius == 0, so when the window is not composited.
 
169
                         * Pretty ugly, I should think on something better.
 
170
                         *
 
171
                         * int offset = radius == 0 ? 1 : 0;
 
172
                         *
 
173
                         * x = childAlloc.X - offset;
 
174
                         * y = childAlloc.Y - offset;
 
175
                         * width  = childAlloc.Width + offset * 2;
 
176
                         * height = childAlloc.Height + offset * 2;
 
177
                         */
145
178
 
146
 
                        
147
 
                        //FIXME
148
 
                        width  = childAlloc.Width - 2 * Style.XThickness;
149
 
                        height = childAlloc.Height - 2 * Style.Ythickness;
 
179
                        x = childAlloc.X;
 
180
                        y = childAlloc.Y;
 
181
                        width  = childAlloc.Width;
 
182
                        height = childAlloc.Height;
150
183
 
151
184
                        if (this.radius < 0.0) {
152
185
                                radius = Math.Min (width, height);
204
237
                        b = (double) frameColor.Blue / ushort.MaxValue;
205
238
                        
206
239
                        cairo.Save ();
207
 
                        GetFrame (cairo);
208
 
                        
209
240
                        cairo.LineWidth = 2;
 
241
                        GetBorderFrame (cairo);
 
242
 
210
243
                        cairo.Color = new Cairo.Color (r, g, b, frameAlpha);
211
244
                        cairo.Stroke ();
212
 
                        
213
245
                        cairo.Restore ();
214
246
                }
215
247
 
232
264
                                requisition.Width = Math.Max (requisition.Width, cr.Width);
233
265
                                requisition.Height += cr.Height;
234
266
                        }
235
 
                        requisition.Width += (int)(BorderWidth + Style.XThickness * 2);
236
 
                        requisition.Height += (int)(BorderWidth + Style.Ythickness * 2);
 
267
                        requisition.Width += (int)(BorderWidth + 2);
 
268
                        requisition.Height += (int)(BorderWidth + 2);
237
269
                }
238
270
 
239
271
                protected override void OnSizeAllocated (Rectangle allocation)
240
272
                {
241
273
                        Rectangle new_alloc;
242
274
 
243
 
                        new_alloc.X = (int) BorderWidth + Style.XThickness;
 
275
                        new_alloc.X = (int) BorderWidth + 1;
244
276
                        new_alloc.Width = Math.Max (1, allocation.Width - new_alloc.X * 2);
245
 
                        new_alloc.Y = (int) BorderWidth  + Style.Ythickness;
246
 
                        new_alloc.Height = Math.Max (1, allocation.Height
247
 
                                                        - new_alloc.Y
248
 
                                                        - (int) BorderWidth
249
 
                                                        - Style.Ythickness);
 
277
                        new_alloc.Y = (int) BorderWidth + 1;
 
278
                        new_alloc.Height = Math.Max (1, allocation.Height - new_alloc.Y * 2);
250
279
                        new_alloc.X += allocation.X;
251
280
                        new_alloc.Y += allocation.Y;
252
281
                        if (IsMapped && new_alloc != childAlloc) {