34
34
using MonoDevelop.Ide.Gui;
35
35
using MonoDevelop.Components.Commands;
36
36
using MonoDevelop.Ide.Commands;
37
using MonoDevelop.Core;
38
using Mono.TextEditor;
39
40
namespace MonoDevelop.Ide
42
internal partial class DocumentSwitcher : Gtk.Window
44
Gtk.ListStore padListStore;
45
Gtk.ListStore documentListStore;
46
Gtk.TreeView treeviewPads, treeviewDocuments;
47
List<Document> documents;
49
class MyTreeView : Gtk.TreeView
51
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
55
protected override bool OnKeyReleaseEvent (Gdk.EventKey evnt)
61
void ShowSelectedPad ()
64
if (treeviewPads.Selection.GetSelected (out iter)) {
65
MonoDevelop.Ide.Gui.Pad pad = padListStore.GetValue (iter, 2) as MonoDevelop.Ide.Gui.Pad;
66
ShowType (ImageService.GetPixbuf (!pad.Icon.IsNull ? pad.Icon : MonoDevelop.Ide.Gui.Stock.MiscFiles, Gtk.IconSize.Dialog),
73
Pixbuf GetIconForDocument (MonoDevelop.Ide.Gui.Document document, Gtk.IconSize iconSize)
75
if (!string.IsNullOrEmpty (document.Window.ViewContent.StockIconId))
76
return ImageService.GetPixbuf (document.Window.ViewContent.StockIconId, iconSize);
77
if (string.IsNullOrEmpty (document.FileName))
78
return ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MiscFiles, iconSize);
80
return DesktopService.GetPixbufForFile (document.FileName, iconSize);
83
void ShowSelectedDocument ()
85
MonoDevelop.Ide.Gui.Document document = SelectedDocument;
86
if (document != null) {
87
ShowType (GetIconForDocument (document, IconSize.Dialog),
88
System.IO.Path.GetFileName (document.Name),
89
document.Window.DocumentType,
94
public DocumentSwitcher (Gtk.Window parent, bool startWithNext) : base(Gtk.WindowType.Popup)
96
this.documents = new List<Document> (IdeApp.Workbench.Documents.OrderByDescending (d => d.LastTimeActive));
97
this.TransientFor = parent;
42
class DocumentList : Gtk.DrawingArea
44
List<Category> categories = new List<Category> ();
46
const int maxItems = 20;
47
const int padding = 6;
48
const int headerDistance = 4;
49
const int maxRows = 2;
52
public Item ActiveItem {
53
get { return activeItem; }
56
OnActiveItemChanged (EventArgs.Empty);
63
protected virtual void OnActiveItemChanged (EventArgs e)
65
EventHandler handler = this.ActiveItemChanged;
70
public event EventHandler ActiveItemChanged;
72
public DocumentList ()
98
74
this.CanFocus = true;
99
this.Decorated = false;
100
this.DestroyWithParent = true;
101
//the following are specified using stetic, but documenting them here too
103
//this.WindowPosition = Gtk.WindowPosition.CenterOnParent;
104
//this.TypeHint = WindowTypeHint.Menu;
108
treeviewPads = new MyTreeView ();
109
scrolledwindow1.Child = treeviewPads;
111
treeviewDocuments = new MyTreeView ();
112
scrolledwindow2.Child = treeviewDocuments;
114
padListStore = new Gtk.ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (Pad));
115
treeviewPads.Model = padListStore;
116
treeviewPads.AppendColumn ("icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
117
treeviewPads.AppendColumn ("text", new Gtk.CellRendererText (), "text", 1);
118
treeviewPads.HeadersVisible = false;
120
treeviewPads.Selection.Changed += TreeviewPadsSelectionChanged;
121
documentListStore = new Gtk.ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (Document));
122
treeviewDocuments.Model = documentListStore;
123
treeviewDocuments.AppendColumn ("icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
124
treeviewDocuments.AppendColumn ("text", new Gtk.CellRendererText (), "text", 1);
125
treeviewDocuments.HeadersVisible = false;
126
treeviewDocuments.Selection.Changed += TreeviewDocumentsSelectionChanged;
129
this.labelFileName.Ellipsize = Pango.EllipsizeMode.Start;
130
if (IdeApp.Workbench.ActiveDocument != null) {
132
SelectDocument (startWithNext ? GetNextDocument (IdeApp.Workbench.ActiveDocument) : GetPrevDocument (IdeApp.Workbench.ActiveDocument));
138
void TreeviewPadsSelectionChanged (object sender, EventArgs e)
143
void TreeviewDocumentsSelectionChanged (object sender, EventArgs e)
145
ShowSelectedDocument ();
148
bool documentFocus = true;
149
Gtk.TreeIter selectedPadIter, selectedDocumentIter;
151
void SwitchToDocument ()
153
this.treeviewPads.Selection.GetSelected (out selectedPadIter);
154
this.treeviewPads.Selection.UnselectAll ();
155
if (documentListStore.IterIsValid (selectedDocumentIter))
156
this.treeviewDocuments.Selection.SelectIter (selectedDocumentIter);
158
this.treeviewDocuments.Selection.SelectPath (new TreePath ("0"));
160
// this.treeviewPads.Sensitive = false;
161
// this.treeviewDocuments.Sensitive = true;
162
documentFocus = true;
163
treeviewDocuments.GrabFocus ();
164
ShowSelectedDocument ();
169
this.treeviewDocuments.Selection.GetSelected (out selectedDocumentIter);
170
this.treeviewDocuments.Selection.UnselectAll ();
171
if (padListStore.IterIsValid (selectedPadIter))
172
this.treeviewPads.Selection.SelectIter (selectedPadIter);
174
this.treeviewPads.Selection.SelectPath (new TreePath ("0"));
176
// this.treeviewPads.Sensitive = true;
177
// this.treeviewDocuments.Sensitive = false;
178
documentFocus = false;
179
treeviewPads.GrabFocus ();
183
Document GetNextDocument (Document doc)
185
if (documents.Count == 0)
187
int index = documents.IndexOf (doc);
188
return documents [(index + 1) % documents.Count];
191
Document GetPrevDocument (Document doc)
193
if (documents.Count == 0)
195
int index = documents.IndexOf (doc);
196
return documents [(index + documents.Count - 1) % documents.Count];
199
Document SelectedDocument {
204
if (treeviewDocuments.Selection.GetSelected (out iter)) {
205
return documentListStore.GetValue (iter, 2) as Document;
211
Pad GetNextPad (Pad pad)
213
if (this.padListStore.NColumns == 0)
215
int index = IdeApp.Workbench.Pads.IndexOf (pad);
216
Pad result = IdeApp.Workbench.Pads [(index + 1) % IdeApp.Workbench.Pads.Count];
218
return GetNextPad (result);
222
Pad GetPrevPad (Pad pad)
224
if (this.padListStore.NColumns == 0)
226
int index = IdeApp.Workbench.Pads.IndexOf (pad);
227
Pad result = IdeApp.Workbench.Pads [(index + IdeApp.Workbench.Pads.Count - 1) % IdeApp.Workbench.Pads.Count];
229
return GetPrevPad (result);
238
if (this.treeviewPads.Selection.GetSelected (out iter)) {
239
return padListStore.GetValue (iter, 2) as Pad;
245
void SelectDocument (Document doc)
248
if (documentListStore.GetIterFirst (out iter)) {
250
Document curDocument = documentListStore.GetValue (iter, 2) as Document;
251
if (doc == curDocument) {
252
treeviewDocuments.Selection.SelectIter (iter);
255
} while (documentListStore.IterNext (ref iter));
259
void SelectPad (Pad pad)
262
if (padListStore.GetIterFirst (out iter)) {
264
Pad curPad = padListStore.GetValue (iter, 2) as Pad;
266
treeviewPads.Selection.SelectIter (iter);
269
} while (padListStore.IterNext (ref iter));
273
void ShowType (Gdk.Pixbuf image, string title, string type, string fileName)
275
// this.imageType.Pixbuf = image;
276
this.labelTitle.Markup = "<span size=\"xx-large\" weight=\"bold\">" +title + "</span>";
277
this.labelType.Markup = "<span size=\"small\">" +type + " </span>";
278
this.labelFileName.Text = fileName;
283
foreach (Pad pad in IdeApp.Workbench.Pads) {
286
padListStore.AppendValues (ImageService.GetPixbuf (!String.IsNullOrEmpty (pad.Icon) ? pad.Icon : MonoDevelop.Ide.Gui.Stock.MiscFiles, IconSize.Menu),
291
foreach (Document doc in documents) {
292
documentListStore.AppendValues (GetIconForDocument (doc, IconSize.Menu),
298
//FIXME: get ctrl(-shift)-tab keybindings from the Switch(Next|Previous)Document commands?
299
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
75
Events |= EventMask.KeyPressMask | EventMask.KeyReleaseMask | EventMask.PointerMotionMask | EventMask.ButtonPressMask | EventMask.LeaveNotifyMask;
78
public void AddCategory (Category category)
80
categories.Add (category);
83
Item GetItemAt (double x, double y)
85
double xPos = padding, yPos = padding;
86
using (var layout = PangoUtil.CreateLayout (this)) {
89
foreach (Category cat in categories) {
91
layout.SetMarkup ("<b>" + cat.Title + "</b>");
92
layout.SetMarkup ("");
93
layout.GetPixelSize (out w, out h);
95
yPos += headerDistance;
98
layout.SetText (new string ('X', maxLength));
99
layout.GetPixelSize (out w, out h);
100
var iconHeight = Math.Max (h, cat.Items[0].Icon.Height + 2);
101
if (cat.FirstVisibleItem > 0) {
105
for (int i = cat.FirstVisibleItem; i < cat.Items.Count; i++) {
106
var item = cat.Items[i];
107
if (xPos <= x && yPos <= y && x < xPos + w + item.Icon.Width + 2 && y < yPos + iconHeight)
110
if (++curItem >= maxItems) {
113
xPos += w + cat.Items[0].Icon.Width + 2 + padding;
116
xPos += w + cat.Items[0].Icon.Width + 2 + padding;
122
protected override bool OnButtonPressEvent (EventButton evnt)
124
if (evnt.Button == 1 && hoverItem != null)
125
ActiveItem = hoverItem;
126
return base.OnButtonPressEvent (evnt);
129
protected override bool OnMotionNotifyEvent (EventMotion evnt)
131
var item = GetItemAt (evnt.X, evnt.Y);
132
if (item != hoverItem) {
136
return base.OnMotionNotifyEvent (evnt);
139
protected override bool OnLeaveNotifyEvent (EventCrossing evnt)
141
if (hoverItem != null) {
145
return base.OnLeaveNotifyEvent (evnt);
149
static string Ellipsize (string str, int maxLength)
151
if (str != null && str.Length > maxLength)
152
return str.Substring (0, maxLength - 3) + "...";
156
const int upperGradientHeight = 16;
157
protected override bool OnExposeEvent (Gdk.EventExpose e)
159
using (Cairo.Context cr = Gdk.CairoHelper.Create (e.Window)) {
160
cr.Rectangle (0, 0, Allocation.Width, upperGradientHeight);
161
using (var pattern = new Cairo.LinearGradient (0, 0, 0, upperGradientHeight)) {
162
pattern.AddColorStopRgb (0, new Cairo.Color (0.6, 0.8, 0.6));
163
pattern.AddColorStopRgb (1, new Cairo.Color (0.8, 1.0, 0.8));
164
cr.Pattern = pattern;
168
cr.Rectangle (0, upperGradientHeight, Allocation.Width, Allocation.Height - upperGradientHeight);
169
using (var pattern = new Cairo.LinearGradient (0, upperGradientHeight, 0, Allocation.Height)) {
170
pattern.AddColorStop (0, new Cairo.Color (0.8, 1.0, 0.8));
171
pattern.AddColorStop (1, new Cairo.Color (0.6, 0.8, 0.6));
172
cr.Pattern = pattern;
177
cr.Line (0, 0, Allocation.Width, 0);
178
cr.Color = new Cairo.Color (0.4, 0.6, 0.4);
181
double xPos = padding, yPos = padding;
182
var layout = PangoUtil.CreateLayout (this);
184
layout.SetText (new string ('X', maxLength));
185
layout.GetPixelSize (out w, out h);
187
foreach (Category cat in categories) {
189
cr.MoveTo (xPos, yPos);
190
layout.SetMarkup ("<b>" + cat.Title + "</b>");
191
cr.Color = (HslColor)Style.Text (StateType.Normal);
192
cr.ShowLayout (layout);
193
layout.SetMarkup ("");
195
layout.GetPixelSize (out w2, out h2);
197
yPos += headerDistance;
201
var iconHeight = Math.Max (h, cat.Items [0].Icon.Height + 2);
202
if (cat.FirstVisibleItem > 0) {
203
Gtk.Style.PaintArrow (Style, e.Window, State, ShadowType.None,
204
new Rectangle ((int)xPos, (int)yPos, w, h),
217
for (int i = cat.FirstVisibleItem; i < cat.Items.Count; i++) {
218
var item = cat.Items [i];
220
if (curItem + 1 >= maxItems && row + 1 >= maxRows && i + 1 < cat.Items.Count) {
221
Gtk.Style.PaintArrow (Style, e.Window, State, ShadowType.None,
222
new Rectangle ((int)xPos, (int)yPos, w, h),
234
if (item == ActiveItem) {
235
cr.Rectangle (xPos + 0.5, yPos + 0.5, w + item.Icon.Width + 2, iconHeight);
237
using (var pattern = new Cairo.LinearGradient (xPos, yPos, xPos, yPos + iconHeight * 2)) {
238
pattern.AddColorStop (0, (HslColor)Style.Base (StateType.Selected));
239
pattern.AddColorStop (1, new Cairo.Color (0.8, 1.0, 0.8));
240
cr.Pattern = pattern;
244
cr.Color = (HslColor)Style.Base (StateType.Selected);
246
cr.Color = (HslColor)Style.Text (StateType.Selected);
247
} else if (item == hoverItem) {
248
cr.Rectangle (xPos + 0.5, yPos + 0.5, w + item.Icon.Width + 2, iconHeight);
249
using (var pattern = new Cairo.LinearGradient (xPos, yPos, xPos, yPos + iconHeight)) {
250
pattern.AddColorStop (0, new Cairo.Color (0.6, 0.8, 0.6));
251
pattern.AddColorStop (1, new Cairo.Color (0.8, 1.0, 0.8));
252
cr.Pattern = pattern;
255
cr.Color = (HslColor)Style.Text (StateType.Normal);
257
cr.Color = (HslColor)Style.Text (StateType.Normal);
259
cr.MoveTo (xPos + item.Icon.Width + 2, yPos + (iconHeight - h) / 2);
260
layout.SetText (Ellipsize (item.ListTitle ?? item.Title, maxLength));
261
cr.ShowLayout (layout);
262
e.Window.DrawPixbuf (Style.BaseGC (StateType.Normal), item.Icon, 0, 0, (int)xPos, (int)(yPos + (iconHeight - item.Icon.Height) / 2), item.Icon.Width, item.Icon.Height, RgbDither.None, 0, 0);
265
if (++curItem >= maxItems) {
268
xPos += w + cat.Items [0].Icon.Width + 2 + padding;
274
xPos += w + cat.Items [0].Icon.Width + 2 + padding;
281
protected override bool OnKeyPressEvent (EventKey evnt)
302
284
Gdk.ModifierType mod;
306
288
case Gdk.Key.Left:
309
291
case Gdk.Key.Right:
315
297
case Gdk.Key.Down:
318
300
case Gdk.Key.Tab:
319
301
if ((mod & ModifierType.ShiftMask) == 0)
307
return base.OnKeyPressEvent (evnt);
328
310
protected override bool OnKeyReleaseEvent (Gdk.EventKey evnt)
331
312
if (evnt.Key == Gdk.Key.Control_L || evnt.Key == Gdk.Key.Control_R) {
332
Gdk.Window focusTarget = null;
333
Document doc = SelectedDocument;
336
focusTarget = doc.ActiveView.Control.Toplevel.GdkWindow;
338
Pad pad = SelectedPad;
340
pad.BringToFront (true);
341
focusTarget = pad.Window.Content.Control.Toplevel.GdkWindow;
344
ret = base.OnKeyReleaseEvent (evnt);
345
Gtk.Window parent = this.TransientFor;
348
(focusTarget ?? parent.GdkWindow).Focus (0);
350
ret = base.OnKeyReleaseEvent (evnt);
313
OnRequestClose (EventArgs.Empty);
315
return base.OnKeyReleaseEvent (evnt);
318
protected virtual void OnRequestClose (EventArgs e)
320
EventHandler handler = this.RequestClose;
325
public event EventHandler RequestClose;
329
for (int i = 0; i < categories.Count; i++) {
330
var cat = categories[i];
331
int idx = cat.Items.IndexOf (ActiveItem);
334
int relIndex = idx - cat.FirstVisibleItem;
335
if (relIndex / maxItems == 0) {
337
int newIndex = Math.Min (categories[i -1].Items.Count - 1, categories[i - 1].FirstVisibleItem + relIndex);
338
ActiveItem = categories[i - 1].Items [newIndex];
341
ActiveItem = cat.Items [relIndex - maxItems];
349
for (int i = 0; i < categories.Count; i++) {
350
var cat = categories[i];
351
int idx = cat.Items.IndexOf (ActiveItem);
354
int relIndex = idx - cat.FirstVisibleItem;
355
if (relIndex / maxItems == maxRows - 1 || relIndex + maxItems >= cat.Items.Count) {
356
if (i + 1 < categories.Count) {
357
int newIndex = Math.Min (categories[i + 1].Items.Count - 1, categories[i + 1].FirstVisibleItem + relIndex);
358
ActiveItem = categories[i + 1].Items [newIndex];
361
ActiveItem = cat.Items [relIndex + maxItems];
366
public void NextItem ()
368
foreach (Category cat in categories) {
369
int idx = cat.Items.IndexOf (ActiveItem);
372
if (idx + 1 < cat.Items.Count) {
373
if (idx + 1 > cat.FirstVisibleItem + maxItems * maxRows - 3)
374
cat.FirstVisibleItem++;
375
ActiveItem = cat.Items[idx + 1];
377
cat.FirstVisibleItem = 0;
378
ActiveItem = cat.Items[0];
384
public void PrevItem ()
386
foreach (Category cat in categories) {
387
int idx = cat.Items.IndexOf (ActiveItem);
391
if (idx - 1 < cat.FirstVisibleItem)
392
cat.FirstVisibleItem--;
393
ActiveItem = cat.Items[idx - 1];
395
if (cat.Items.Count - 1 > cat.FirstVisibleItem + maxItems * maxRows)
396
cat.FirstVisibleItem = cat.Items.Count - maxItems * maxRows + 1;
397
ActiveItem = cat.Items[cat.Items.Count - 1];
403
protected override void OnSizeRequested (ref Requisition req)
406
foreach (var cat in categories) {
407
foreach (var item in cat.Items) {
408
maxLength = Math.Min (30, Math.Max (maxLength, (item.ListTitle ?? item.Title).Length));
412
var layout = PangoUtil.CreateLayout (this);
414
layout.SetText (new string ('X', maxLength));
415
layout.GetPixelSize (out w, out h);
420
foreach (var cat in categories) {
421
var iconHeight = Math.Max (h, cat.Items[0].Icon.Height + 2);
422
var iconWidth = cat.Items[0].Icon.Width + 2 + w;
423
var headerHeight = h + headerDistance;
424
totalHeight = Math.Max (totalHeight, headerHeight + (Math.Min (cat.Items.Count, maxItems)) * iconHeight);
425
totalWidth += (1 + Math.Min (maxRows - 1, cat.Items.Count / maxItems)) * iconWidth;
427
req.Width = totalWidth + padding * 2 + (categories.Count - 1) * padding;
428
req.Height = totalHeight + padding * 2;
433
public string Title {
438
public string ListTitle {
448
public string Description {
463
public override string ToString ()
465
return string.Format ("[Item: Title={0}]", Title);
470
public class Category
472
public string Title {
477
List<Item> items = new List<Item> ();
478
public List<Item> Items {
484
public int FirstVisibleItem {
489
public Category (string title)
494
public void AddItem (Item item)
499
public override string ToString ()
501
return string.Format ("[Category: Title={0}]", Title);
506
internal class DocumentSwitcher : Gtk.Window
508
List<MonoDevelop.Ide.Gui.Document> documents;
509
Gtk.Image imageTitle = new Gtk.Image ();
510
Label labelFileName = new Label ();
511
Label labelType = new Label ();
512
Label labelTitle = new Label ();
513
DocumentList documentList = new DocumentList ();
515
public DocumentSwitcher (Gtk.Window parent, bool startWithNext) : base(Gtk.WindowType.Toplevel)
517
IdeApp.CommandService.IsEnabled = false;
518
this.documents = new List<MonoDevelop.Ide.Gui.Document> (IdeApp.Workbench.Documents.OrderByDescending (d => d.LastTimeActive));
519
this.TransientFor = parent;
521
this.Decorated = false;
522
this.DestroyWithParent = true;
523
this.CanDefault = true;
526
this.WindowPosition = Gtk.WindowPosition.CenterOnParent;
527
this.TypeHint = WindowTypeHint.Dialog;
529
this.ModifyBg (StateType.Normal, this.Style.Base (StateType.Normal));
531
VBox vBox = new VBox ();
532
HBox hBox = new HBox ();
534
var hBox2 = new HBox ();
535
hBox2.PackStart (hBox, false, false, 8);
537
hBox.PackStart (imageTitle, true, false, 2);
538
labelTitle.Xalign = 0;
539
labelTitle.HeightRequest = 24;
540
hBox.PackStart (labelTitle, true, true, 2);
541
vBox.PackStart (hBox2, false, false, 6);
543
labelType.Xalign = 0;
544
labelType.HeightRequest = 16;
546
hBox.PackStart (labelType, false, false, 8);
547
vBox.PackStart (hBox, false, false, 2);
550
hBox.PackStart (documentList, true, true, 1);
551
vBox.PackStart (hBox, false, false, 0);
553
labelFileName.Xalign = 0;
554
labelFileName.Ellipsize = Pango.EllipsizeMode.Start;
556
hBox.PackStart (labelFileName, true, true, 8);
557
vBox.PackEnd (hBox, false, false, 6);
561
var padCategory = new DocumentList.Category (GettextCatalog.GetString ("Pads"));
562
DocumentList.Item activeItem = null;
564
foreach (Pad pad in IdeApp.Workbench.Pads) {
567
var item = new DocumentList.Item () {
568
Icon = ImageService.GetPixbuf (pad.Icon.Name ?? MonoDevelop.Ide.Gui.Stock.MiscFiles, IconSize.Menu),
572
if (pad.Window.Content.Control.HasFocus)
574
padCategory.AddItem (item);
576
documentList.AddCategory (padCategory);
578
var documentCategory = new DocumentList.Category (GettextCatalog.GetString ("Documents"));
579
foreach (var doc in documents) {
580
var item = new DocumentList.Item () {
581
Icon = GetIconForDocument (doc, IconSize.Menu),
582
Title = System.IO.Path.GetFileName (doc.Name),
583
ListTitle = doc.Window.Title,
584
Description = doc.Window.DocumentType,
588
if (doc.Window.ActiveViewContent.Control.HasFocus)
590
documentCategory.AddItem (item);
592
documentList.AddCategory (documentCategory);
594
documentList.ActiveItemChanged += delegate {
595
if (documentList.ActiveItem == null) {
596
labelFileName.Text = labelType.Text = labelTitle.Text = "";
599
imageTitle.Pixbuf = documentList.ActiveItem.Icon;
600
labelFileName.Text = documentList.ActiveItem.Path;
601
labelType.Markup = "<span size=\"small\">" + documentList.ActiveItem.Description + "</span>";
602
labelTitle.Markup = "<span size=\"xx-large\" weight=\"bold\">" + documentList.ActiveItem.Title + "</span>";
605
if (activeItem == null) {
606
if (documentCategory.Items.Count > 0) {
607
activeItem = documentCategory.Items[0];
608
} else if (padCategory.Items.Count > 0) {
609
activeItem = padCategory.Items[0];
616
documentList.ActiveItem = activeItem;
617
documentList.NextItem ();
618
documentList.RequestClose += delegate {
619
if (documentList.ActiveItem.Tag is Pad) {
620
((Pad)documentList.ActiveItem.Tag).BringToFront (true);
622
((MonoDevelop.Ide.Gui.Document)documentList.ActiveItem.Tag).Select ();
628
documentList.GrabFocus ();
632
Pixbuf GetIconForDocument (MonoDevelop.Ide.Gui.Document document, Gtk.IconSize iconSize)
634
if (!string.IsNullOrEmpty (document.Window.ViewContent.StockIconId))
635
return ImageService.GetPixbuf (document.Window.ViewContent.StockIconId, iconSize);
636
if (string.IsNullOrEmpty (document.FileName))
637
return ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MiscFiles, iconSize);
639
return DesktopService.GetPixbufForFile (document.FileName, iconSize);
643
protected override bool OnFocusOutEvent (EventFocus evnt)
646
return base.OnFocusOutEvent (evnt);
649
protected override void OnDestroyed ()
652
IdeApp.CommandService.IsEnabled = true;
355
655
protected override bool OnExposeEvent (EventExpose evnt)