[Monodevelop-patches-list] r913 - in trunk/MonoDevelop: build/data/resources/icons src/Libraries/MonoDevelop.Gui.Widgets src/Libraries/MonoDevelop.Gui.Widgets/TabLabel src/Main/Base/Gui/Workbench/Layouts
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat Feb 14 20:15:38 EST 2004
Author: jluke
Date: 2004-02-14 20:15:38 -0500 (Sat, 14 Feb 2004)
New Revision: 913
Added:
trunk/MonoDevelop/build/data/resources/icons/MonoDevelop.Close.png
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/TabLabel/
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/TabLabel/TabLabel.cs
Modified:
trunk/MonoDevelop/build/data/resources/icons/Makefile.am
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/Makefile.am
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
Log:
make the tablabel a widget using the
same close image as the dock
Modified: trunk/MonoDevelop/build/data/resources/icons/Makefile.am
===================================================================
--- trunk/MonoDevelop/build/data/resources/icons/Makefile.am 2004-02-15 01:08:22 UTC (rev 912)
+++ trunk/MonoDevelop/build/data/resources/icons/Makefile.am 2004-02-15 01:15:38 UTC (rev 913)
@@ -287,6 +287,7 @@
JScript.Project.ServiceProject \
JScript.Project.UserControl \
JScript.Project.WebProject \
+MonoDevelop.Close.png \
VB.File.EmptyFile \
VB.File.Form \
VB.File.FullFile \
Added: trunk/MonoDevelop/build/data/resources/icons/MonoDevelop.Close.png
===================================================================
(Binary files differ)
Property changes on: trunk/MonoDevelop/build/data/resources/icons/MonoDevelop.Close.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/Makefile.am 2004-02-15 01:08:22 UTC (rev 912)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/Makefile.am 2004-02-15 01:15:38 UTC (rev 913)
@@ -1,6 +1,10 @@
-DLL=../../../build/bin/MonoDevelop.Gui.Widgets.dll
-REFERENCES=/r:System.Drawing.dll /r:gtk-sharp.dll /r:gdk-sharp.dll /r:pango-sharp.dll /r:gnome-sharp.dll /r:glib-sharp.dll /r:glade-sharp.dll /r:../../../build/bin/MonoDevelop.Core.dll
+MCS = mcs -debug
+
+DLL = ../../../build/bin/MonoDevelop.Gui.Widgets.dll
+
+REFERENCES = /r:System.Drawing.dll /r:gtk-sharp.dll /r:gdk-sharp.dll /r:pango-sharp.dll /r:gnome-sharp.dll /r:glib-sharp.dll /r:glade-sharp.dll /r:../../../build/bin/MonoDevelop.Core.dll /r:../../../build/bin/MonoDevelop.Base.dll
+
SOURCES = ./Tree/TreeView.cs \
./Tree/TreeNodeCollection.cs \
./Tree/TreeNode.cs \
@@ -18,12 +22,13 @@
./FolderDialog/BaseFileEntry.cs \
./FolderDialog/FolderEntry.cs \
./FolderDialog/FileEntry.cs \
+./TabLabel/TabLabel.cs \
./GladeWidgetExtract/GladeWidgetExtract.cs
all: $(DLL)
$(DLL): $(SOURCES)
- @ mcs /debug /out:$(DLL) /target:library $(REFERENCES) $(SOURCES)
+ @ $(MCS) /debug /out:$(DLL) /target:library $(REFERENCES) $(SOURCES)
monodeveloplibdir = $(prefix)/lib/monodevelop
@@ -31,7 +36,7 @@
$(mkinstalldirs) $(DESTDIR)$(monodeveloplibdir)/bin
$(INSTALL_DATA) $(DLL) $(DESTDIR)$(monodeveloplibdir)/bin/MonoDevelop.Gui.Widgets.dll
-CLEANFILES=$(DLL)
+CLEANFILES = $(DLL)
EXTRA_DIST = $(SOURCES)
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/TabLabel/TabLabel.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/TabLabel/TabLabel.cs 2004-02-15 01:08:22 UTC (rev 912)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/TabLabel/TabLabel.cs 2004-02-15 01:15:38 UTC (rev 913)
@@ -0,0 +1,60 @@
+using System;
+using System.Drawing;
+using Gtk;
+using Gdk;
+
+using ICSharpCode.Core.Services;
+
+namespace MonoDevelop.Gui.Widgets
+{
+ public class TabLabel : HBox
+ {
+ private static GLib.GType gtype;
+ private Label title;
+ private Gtk.Image icon;
+ private Button btn;
+
+ public TabLabel (Label label, Gtk.Image icon) : base (GType)
+ {
+ this.icon = icon;
+ this.Add (icon);
+
+ title = label;
+ this.Add (title);
+
+ btn = new Button ();
+ btn.Child = new Gtk.Image ("../data/resources/icons/MonoDevelop.Close.png");
+ btn.Relief = ReliefStyle.None;
+ btn.RequestSize = new Size (16, 16);
+ this.Add (btn);
+ this.ShowAll ();
+ }
+
+ public Label Label
+ {
+ get { return title; }
+ set { title = value; }
+ }
+
+ public Gtk.Image Icon
+ {
+ get { return icon; }
+ set { icon = value; }
+ }
+
+ public Button Button
+ {
+ get { return btn; }
+ }
+
+ public static new GLib.GType GType
+ {
+ get
+ {
+ if (gtype == GLib.GType.Invalid)
+ gtype = RegisterGType (typeof (TabLabel));
+ return gtype;
+ }
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-02-15 01:08:22 UTC (rev 912)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-02-15 01:15:38 UTC (rev 913)
@@ -9,11 +9,8 @@
using System.IO;
using System.Collections;
using System.Drawing;
-using System.Diagnostics;
-using System.CodeDom.Compiler;
using ICSharpCode.Core.Properties;
-
using ICSharpCode.Core.Services;
using ICSharpCode.SharpDevelop.Services;
@@ -126,7 +123,7 @@
void CreateDefaultLayout()
{
- Console.WriteLine("Creating Default Layout...");
+ //Console.WriteLine("Creating Default Layout...");
WindowContent leftContent = null;
WindowContent rightContent = null;
WindowContent bottomContent = null;
@@ -190,7 +187,7 @@
public void Detach()
{
- Console.WriteLine("Call to SdiWorkSpaceLayout.Detach");
+ //Console.WriteLine("Call to SdiWorkSpaceLayout.Detach");
dockLayout.SaveToFile (configFile);
rootWidget.Remove(((DefaultWorkbench)workbench).TopMenu);
foreach (Gtk.Widget w in toolbarContainer.Children) {
@@ -307,10 +304,6 @@
public IWorkbenchWindow ShowView(IViewContent content)
{
- //content.Control.Dock = DockStyle.None;
- //content.Control.Visible = true;
-
-
string title = "";
Gtk.Image mimeimage;
if (content.IsUntitled) {
@@ -321,24 +314,12 @@
mimeimage = new Gtk.Image (FileIconLoader.GetPixbufForFile (content.ContentName, 16, 16));
}
- HBox hbox = new HBox (false, 3);
-
- Button btn = new Button ();
- btn.Child = new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu);
- btn.Relief = ReliefStyle.None;
- btn.RequestSize = new Size (16, 16);
- btn.Clicked += new EventHandler (closeClicked);
- btn.StateChanged += new StateChangedHandler (stateChanged);
-
- Label label = new Label (title);
- hbox.PackStart (mimeimage);
- hbox.PackStart (label, false, false, 0);
- hbox.PackEnd (btn, false, false, 0);
-
- hbox.ShowAll ();
- tabControl.AppendPage (content.Control, hbox);
+ TabLabel tabLabel = new TabLabel (new Label (), new Gtk.Image (""));
+ tabLabel.Button.Clicked += new EventHandler (closeClicked);
+ tabLabel.Button.StateChanged += new StateChangedHandler (stateChanged);
+ tabControl.AppendPage (content.Control, tabLabel);
- SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(content, tabControl, label, mimeimage);
+ SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(content, tabControl, tabLabel);
sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent);
sdiWorkspaceWindow.SwitchView(tabControl.Children.Length - 1);
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2004-02-15 01:08:22 UTC (rev 912)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2004-02-15 01:15:38 UTC (rev 913)
@@ -8,13 +8,13 @@
using System;
using System.Collections;
using System.IO;
-using System.Threading;
using Gtk;
using ICSharpCode.Core.Services;
using ICSharpCode.SharpDevelop.Services;
using MonoDevelop.Gui.Utils;
+using MonoDevelop.Gui.Widgets;
namespace ICSharpCode.SharpDevelop.Gui
{
@@ -24,8 +24,7 @@
IViewContent content;
ArrayList subViewContents = null;
- Label tabLabel;
- Image tabMimeType;
+ TabLabel tabLabel;
Widget tabPage;
Notebook tabControl;
@@ -39,16 +38,6 @@
}
set {
tabPage = value;
-#if GTK
- // FIXME: GTKize
-#else
- content.Control.Dock = DockStyle.Fill;
- if (subViewContents == null) {
- tabPage.Controls.Add(content.Control);
- } else {
- tabPage.Controls.Add(viewTabControl);
- }
-#endif
}
}
@@ -90,15 +79,6 @@
void ThreadSafeSelectWindow()
{
-#if GTK
- // FIXME: GTKize
-#else
- tabPage.Selected = true;
-// KSL, Start to fix the focus problem when changing tabs
- content.Control.Focus();
-// KSL End
-#endif
-
foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (viewContent != this.content) {
viewContent.WorkbenchWindow.OnWindowDeselected(EventArgs.Empty);
@@ -120,24 +100,14 @@
tabControl.CurrentPage = toSelect;
}
- public SdiWorkspaceWindow(IViewContent content, Notebook tabControl, Label label, Image type)
+ public SdiWorkspaceWindow(IViewContent content, Notebook tabControl, TabLabel tabLabel)
{
this.tabControl = tabControl;
this.content = content;
- this.tabLabel = label;
- this.tabMimeType = type;
+ this.tabLabel = tabLabel;
this.tabPage = content.Control;
- IconService iconService = (IconService)ServiceManager.Services.GetService(typeof(IconService));
content.WorkbenchWindow = this;
-
-#if GTK
- // FIXME: GTKize
-#else
- tabPage.Tag = this;
- tabPage.ImageList = iconService.ImageList;
- tabPage.TabIndexChanged += new EventHandler(LeaveTabPage);
-#endif
content.ContentNameChanged += new EventHandler(SetTitleEvent);
content.DirtyChanged += new EventHandler(SetTitleEvent);
@@ -213,9 +183,6 @@
public void DetachContent()
{
-#if !GTK
- tabPage.Control = null;
-#endif
content.ContentNameChanged -= new EventHandler(SetTitleEvent);
content.DirtyChanged -= new EventHandler(SetTitleEvent);
content.BeforeSave -= new EventHandler(BeforeSave);
@@ -225,18 +192,15 @@
{
if (!force && ViewContent != null && ViewContent.IsDirty) {
ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
- MessageDialog md = new MessageDialog ((Window) WorkbenchSingleton.Workbench, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, resourceService.GetString ("MainWindow.SaveChangesMessage"));
- int response = md.Run ();
- md.Hide ();
- md.Dispose ();
+ IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
+ bool response = messageService.AskQuestion (resourceService.GetString ("MainWindow.SaveChangesMessage"));
- switch ((ResponseType) response) {
- case ResponseType.Yes:
+ switch (response) {
+ case true:
if (content.ContentName == null) {
while (true) {
new ICSharpCode.SharpDevelop.Commands.SaveFileAs().Run();
if (ViewContent.IsDirty) {
- IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
if (messageService.AskQuestion("Do you really want to discard your changes ?")) {
break;
}
@@ -250,7 +214,7 @@
fileUtilityService.ObservedSave(new FileOperationDelegate(ViewContent.Save), ViewContent.ContentName , FileErrorPolicy.ProvideAlternative);
}
break;
- case ResponseType.No:
+ case false:
break;
default:
@@ -258,7 +222,6 @@
return;
}
}
- //tabControl.RemovePage (tabControl.CurrentPage);
if (fromMenu == true) {
WorkbenchSingleton.Workbench.WorkbenchLayout.RemoveTab (tabControl.CurrentPage);
} else {
@@ -270,37 +233,7 @@
public void AttachSecondaryViewContent(ISecondaryViewContent subViewContent)
{
-#if GTK
- // FIXME: GTKize
-#else
- TabPage newPage;
-
- if (subViewContents == null) {
- subViewContents = new ArrayList();
-
- viewTabControl = new TabControl();
- viewTabControl.Alignment = TabAlignment.Bottom;
- viewTabControl.Dock = DockStyle.Fill;
- viewTabControl.SelectedIndexChanged += new EventHandler(viewTabControlIndexChanged);
-
- tabPage.Controls.Clear();
- tabPage.Controls.Add(viewTabControl);
-
- newPage = new TabPage(stringParserService.Parse(content.TabPageText));
- newPage.Tag = content;
- content.Control.Dock = DockStyle.Fill;
- newPage.Controls.Add(content.Control);
- viewTabControl.TabPages.Add(newPage);
- }
- subViewContent.WorkbenchWindow = this;
- subViewContents.Add(subViewContent);
-
- newPage = new TabPage(stringParserService.Parse(subViewContent.TabPageText));
- newPage.Tag = subViewContent;
- subViewContent.Control.Dock = DockStyle.Fill;
- newPage.Controls.Add(subViewContent.Control);
- viewTabControl.TabPages.Add(newPage);
-#endif
+
}
int oldIndex = -1;
@@ -324,13 +257,13 @@
protected virtual void OnTitleChanged(EventArgs e)
{
- tabLabel.Text = Title;
+ tabLabel.Label.Text = Title;
try {
if (content.ContentName.IndexOfAny (new char[] { '*', '+'}) == -1) {
- tabMimeType.Pixbuf = FileIconLoader.GetPixbufForFile (content.ContentName, 16, 16);
+ tabLabel.Icon.Pixbuf = FileIconLoader.GetPixbufForFile (content.ContentName, 16, 16);
}
} catch {
- tabMimeType.Pixbuf = FileIconLoader.GetPixbufForType ("gnome-fs-regular").ScaleSimple (16, 16, Gdk.InterpType.Bilinear);
+ tabLabel.Icon.Pixbuf = FileIconLoader.GetPixbufForType ("gnome-fs-regular").ScaleSimple (16, 16, Gdk.InterpType.Bilinear);
}
if (TitleChanged != null) {
TitleChanged(this, e);
More information about the Monodevelop-patches-list
mailing list