~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/Mono.Texteditor/Mono.TextEditor/TextEditorAccessibility.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
25
// THE SOFTWARE.
 
26
 
 
27
#if ATK
 
28
 
26
29
using System;
27
30
using Atk;
28
31
using System.Collections.Generic;
191
194
 
192
195
                void TextImplementor.GetCharacterExtents (int offset, out int x, out int y, out int width, out int height, CoordType coords)
193
196
                {
194
 
                        var point = editor.DocumentToVisualLocation (Document.OffsetToLocation (offset));
195
 
                        x = point.X + editor.TextViewMargin.XOffset;
 
197
                        var point = editor.LocationToPoint (Document.OffsetToLocation (offset));
 
198
                        x = point.X + (int)editor.TextViewMargin.XOffset;
196
199
                        y = point.Y;
197
 
                        width = editor.TextViewMargin.CharWidth;
198
 
                        height = editor.LineHeight;
 
200
                        width = (int)editor.TextViewMargin.CharWidth;
 
201
                        height = (int)editor.LineHeight;
199
202
                        switch (coords) {
200
203
                        case Atk.CoordType.Screen:
201
204
                                int ox, oy;
214
217
                        switch (coords) {
215
218
                        case Atk.CoordType.Screen:
216
219
                                editor.TranslateCoordinates (editor, x, y, out rx, out ry);
217
 
                                rx -= editor.TextViewMargin.XOffset;
 
220
                                rx -= (int)editor.TextViewMargin.XOffset;
218
221
                                break;
219
222
                        case Atk.CoordType.Window:
220
 
                                rx = x - editor.TextViewMargin.XOffset;
 
223
                                rx = x - (int)editor.TextViewMargin.XOffset;
221
224
                                ry = y;
222
225
                                break;
223
226
                        }
224
 
                        return Document.LocationToOffset (editor.TextViewMargin.VisualToDocumentLocation (rx, ry));
 
227
                        return Document.LocationToOffset (editor.PointToLocation (rx, ry));
225
228
                }
226
229
 
227
230
                string TextImplementor.GetSelection (int selection_num, out int start_offset, out int end_offset)
263
266
                void TextImplementor.GetRangeExtents (int start_offset, int end_offset, CoordType coord_type, out TextRectangle rect)
264
267
                {
265
268
                        Atk.TextRectangle result = new Atk.TextRectangle ();
266
 
                        var point1 = editor.DocumentToVisualLocation (Document.OffsetToLocation (start_offset));
267
 
                        var point2 = editor.DocumentToVisualLocation (Document.OffsetToLocation (end_offset));
 
269
                        var point1 = editor.LocationToPoint (Document.OffsetToLocation (start_offset));
 
270
                        var point2 = editor.LocationToPoint (Document.OffsetToLocation (end_offset));
268
271
 
269
272
                        result.X = System.Math.Min (point2.X, point1.Y);
270
273
                        result.Y = System.Math.Min (point2.Y, point1.Y);
271
274
                        result.Width = System.Math.Abs (point2.X - point1.X);
272
 
                        result.Height = System.Math.Abs (point2.Y - point1.Y) + editor.LineHeight;
 
275
                        result.Height = (int)(System.Math.Abs (point2.Y - point1.Y) + editor.LineHeight);
273
276
                        rect = result;
274
277
                }
275
278
 
351
354
                        }
352
355
                }
353
356
                #endregion
354
 
                /*
355
357
                internal sealed class Factory : Atk.ObjectFactory
356
358
                {
357
 
                        public static void Init ()
 
359
                        public static void Init (object editor)
358
360
                        {
359
 
                                Atk.Global.DefaultRegistry.SetFactoryType ((GLib.GType)typeof(TextEditor), (GLib.GType)typeof(TextEditor));
 
361
                                Atk.Global.DefaultRegistry.SetFactoryType ((GLib.GType)editor.GetType (), (GLib.GType)typeof(Factory));
360
362
                        }
361
363
 
362
364
                        protected override Atk.Object OnCreateAccessible (GLib.Object obj)
363
365
                        {
364
 
                                return new TextEditorAccessible ( (TextEditor) obj);
 
366
                                // seems to be never get called ?
 
367
                                return new TextEditorAccessible ((TextEditor) obj);
365
368
                        }
366
369
 
367
370
                        protected override GLib.GType OnGetAccessibleType ()
368
371
                        {
369
372
                                return TextEditorAccessible.GType;
370
373
                        }
371
 
                }*/
 
374
                }
372
375
        }
373
376
 
374
377
        public class BaseWidgetAccessible : Gtk.Accessible, Atk.ComponentImplementor
594
597
                #endregion Atk.Component
595
598
                
596
599
        }
597
 
        
 
600
 
598
601
}
 
602
#endif