Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2011-11-16 20:22:13 +0400
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2011-11-16 20:22:13 +0400
commit3a8df06e2c3d3d820369685d2c65509662cf4d06 (patch)
tree1deb6d7dab918613514207d51c65c0f90dd069b6 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui
parent43b2a5aee73f6bb82bdd3dbb3a439b562eb3d4fd (diff)
parent21762fd150143378373ff71dcfa7b20c9ff8d1a9 (diff)
Merge branch 'macgtk'
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs88
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs2
5 files changed, 66 insertions, 31 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
index 4c3ed90c63..90825c363f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
@@ -44,6 +44,7 @@ using MonoDevelop.Components.DockToolbars;
using Gtk;
using MonoDevelop.Components;
using MonoDevelop.Ide.Extensions;
+using Mono.TextEditor;
namespace MonoDevelop.Ide.Gui
{
@@ -78,8 +79,6 @@ namespace MonoDevelop.Ide.Gui
bool fullscreen;
Rectangle normalBounds = new Rectangle(0, 0, 640, 480);
- internal static GType gtype;
-
Gtk.Container rootWidget;
DockToolbarFrame toolbarFrame;
DockFrame dock;
@@ -211,15 +210,7 @@ namespace MonoDevelop.Ide.Gui
DeleteEvent += new Gtk.DeleteEventHandler (OnClosing);
- if (Gtk.IconTheme.Default.HasIcon ("monodevelop"))
- Gtk.Window.DefaultIconName = "monodevelop";
- else
- this.IconList = new Gdk.Pixbuf[] {
- ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Menu),
- ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Button),
- ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dnd),
- ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dialog)
- };
+ SetAppIcons ();
//this.WindowPosition = Gtk.WindowPosition.None;
@@ -228,6 +219,37 @@ namespace MonoDevelop.Ide.Gui
IdeApp.CommandService.SetRootWindow (this);
}
+
+ void SetAppIcons ()
+ {
+ //first try to get the icon from the GTK icon theme
+ var appIconName = BrandingService.GetString ("ApplicationIconId")
+ ?? BrandingService.ApplicationName.ToLower ();
+ if (Gtk.IconTheme.Default.HasIcon (appIconName)) {
+ Gtk.Window.DefaultIconName = appIconName;
+ return;
+ }
+
+ //branded icons
+ var iconsEl = BrandingService.GetElement ("ApplicationIcons");
+ if (iconsEl != null) {
+ try {
+ this.IconList = iconsEl.Elements ("Icon")
+ .Select (el => new Gdk.Pixbuf (BrandingService.GetFile ((string)el))).ToArray ();
+ return;
+ } catch (Exception ex) {
+ LoggingService.LogError ("Could not load app icons", ex);
+ }
+ }
+
+ //built-ins
+ this.IconList = new Gdk.Pixbuf[] {
+ ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Menu),
+ ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Button),
+ ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dnd),
+ ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.MonoDevelop, Gtk.IconSize.Dialog)
+ };
+ }
void onDragDataRec (object o, Gtk.DragDataReceivedArgs args)
{
@@ -807,16 +829,7 @@ namespace MonoDevelop.Ide.Gui
ToggleFullViewMode ();
};
- this.tabControl.PopupMenu += delegate {
- ShowPopup ();
- };
- this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) {
- int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
- if (tab < 0)
- return;
- if (e.Event.Button == 3)
- ShowPopup ();
- };
+ this.tabControl.DoPopupMenu = ShowPopup;
tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);
@@ -939,11 +952,10 @@ namespace MonoDevelop.Ide.Gui
}
}
- void ShowPopup ()
+ void ShowPopup (int tabIndex, Gdk.EventButton evt)
{
- Gtk.Menu contextMenu = IdeApp.CommandService.CreateMenu ("/MonoDevelop/Ide/ContextMenu/DocumentTab");
- if (contextMenu != null)
- contextMenu.Popup ();
+ this.tabControl.Page = tabIndex;
+ IdeApp.CommandService.ShowContextMenu (this.tabControl, evt, "/MonoDevelop/Ide/ContextMenu/DocumentTab");
}
void OnTabsReordered (Widget widget, int oldPlacement, int newPlacement)
@@ -1384,6 +1396,28 @@ namespace MonoDevelop.Ide.Gui
rect.Height -= CurrentPageWidget.Allocation.Height;
yield return rect;
}
+
+ public Action<int,Gdk.EventButton> DoPopupMenu { get; set; }
+
+ protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
+ {
+ if (DoPopupMenu != null && evnt.TriggersContextMenu ()) {
+ int tab = FindTabAtPosition (evnt.XRoot, evnt.YRoot);
+ if (tab >= 0) {
+ DoPopupMenu (tab, evnt);
+ return true;
+ }
+ }
+ return base.OnButtonPressEvent (evnt);
+ }
+
+ protected override bool OnPopupMenu ()
+ {
+ if (DoPopupMenu != null) {
+ DoPopupMenu (this.Page, null);
+ return true;
+ }
+ return base.OnPopupMenu ();
+ }
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs
index 5552b99c23..414015e081 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentSwitcher.cs
@@ -262,7 +262,8 @@ namespace MonoDevelop.Ide
{
Gdk.Key key;
Gdk.ModifierType mod;
- KeyBindingManager.MapRawKeys (evnt, out key, out mod);
+ uint keyval;
+ Mono.TextEditor.GtkWorkarounds.MapRawKeys (evnt, out key, out mod, out keyval);
switch (key) {
case Gdk.Key.Left:
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs
index 3b1cb8e493..367108f94b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs
@@ -28,6 +28,7 @@
using Gdk;
using Gtk;
using System;
+using Mono.TextEditor;
namespace MonoDevelop.Ide.Gui
{
@@ -101,7 +102,7 @@ namespace MonoDevelop.Ide.Gui
[GLib.ConnectBefore]
void OnButtonPress (object obj, ButtonPressEventArgs args) {
- if (DragInProgress)
+ if (DragInProgress || args.Event.TriggersContextMenu ())
return;
if (args.Event.Button == 1 && args.Event.Type == EventType.ButtonPress && FindTabAtPosition (args.Event.XRoot, args.Event.YRoot) >= 0)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs
index 36aa769d93..7a7e4fe0f3 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/InternalLog.cs
@@ -144,7 +144,6 @@ namespace MonoDevelop.Ide.Gui
public int InfoCount = 0;
public int DebugCount = 0;
- bool errorNotificationEnabled;
public LogMessage LastError = null;
public void Log (LogLevel level, string message)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
index 6431a73e7a..91b9da9aaa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
@@ -1055,7 +1055,7 @@ namespace MonoDevelop.Ide.Gui
} catch (InvalidEncodingException iex) {
fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. {1}", fileName, iex.Message), null);
return;
- } catch (OverflowException oex) {
+ } catch (OverflowException) {
fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. File too large.", fileName), null);
return;
}