Browse Source

Code generator (Alt+ins) now works again. fixed texteditor drawing bug.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@20 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 22 years ago
parent
commit
fc08e8e8d8
  1. 1
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs
  2. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs
  3. 23
      src/Main/Base/Project/Src/Internal/Auswerter/WindowActiveAuswerter.cs
  4. 15
      src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs
  5. 6
      src/Main/Base/Project/Src/TextEditor/Commands/GenerateCodeCommand.cs

1
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs

@ -134,7 +134,6 @@ namespace ICSharpCode.TextEditor.Document
} }
} }
public bool ReadOnly { public bool ReadOnly {
get { get {
return readOnly; return readOnly;

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.TextEditor
} }
} }
#region Paint functions #region Paint functions
public override void Paint(Graphics g, Rectangle rect) public override void Paint(Graphics g, Rectangle rect)
{ {
if (rect.Width <= 0 || rect.Height <= 0) { if (rect.Width <= 0 || rect.Height <= 0) {
@ -574,7 +574,7 @@ namespace ICSharpCode.TextEditor
// } // }
float wordWidth = g.MeasureString(word, font, 32768, measureStringFormat).Width; float wordWidth = g.MeasureString(word, font, 32768, measureStringFormat).Width;
g.FillRectangle(backBrush, g.FillRectangle(backBrush,
new RectangleF(position.X, position.Y, (float)Math.Ceiling(wordWidth), FontHeight)); new RectangleF(position.X, position.Y, (float)Math.Ceiling(wordWidth + 1), FontHeight));
g.DrawString(word, g.DrawString(word,
font, font,
@ -584,7 +584,7 @@ namespace ICSharpCode.TextEditor
measureStringFormat); measureStringFormat);
return wordWidth; return wordWidth;
} }
#endregion #endregion
#region Conversion Functions #region Conversion Functions
public float GetWidth(char ch) public float GetWidth(char ch)

23
src/Main/Base/Project/Src/Internal/Auswerter/WindowActiveAuswerter.cs

@ -36,25 +36,12 @@ namespace ICSharpCode.Core
} }
Type currentType = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.GetType(); Type currentType = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.GetType();
Type activeType = Type.GetType(activewindow);
if (activeType == null) {
if (currentType.Equals(prevType)) { return false;
return prevValidFlag;
} else {
prevType = currentType;
if (currentType.ToString() == activewindow) {
prevValidFlag = true;
return true;
}
foreach (Type i in currentType.GetInterfaces()) {
if (i.ToString() == activewindow) {
prevValidFlag = true;
return true;
}
}
} }
prevValidFlag = false;
return false; return activeType.IsAssignableFrom(currentType);
} }
} }
} }

15
src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs

@ -30,16 +30,19 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
public CodeGenerator(IClass currentClass) public CodeGenerator(IClass currentClass)
{ {
this.currentClass = currentClass;
try { try {
csa = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("CSharp", this); csa = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("C#", this);
vba = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("VBNET", this); csa.ConversionFlags = ConversionFlags.All;
} catch { } catch (Exception) {
Console.WriteLine("CSharpAmbience not found -- is the C# backend binding loaded???"); Console.WriteLine("CSharpAmbience not found -- is the C# backend binding loaded???");
return;
} }
this.currentClass = currentClass; try {
csa.ConversionFlags = ConversionFlags.All; vba = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("VBNET", this);
} catch (Exception) {
Console.WriteLine("VBNet ambience not found -- is the VB.NET backend binding loaded???");
}
} }
public abstract string CategoryName { public abstract string CategoryName {

6
src/Main/Base/Project/Src/TextEditor/Commands/GenerateCodeCommand.cs

@ -37,8 +37,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
} }
TextEditorControl textEditorControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; TextEditorControl textEditorControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
ParseInformation parseInformation; ParseInformation parseInformation;
if (window.ViewContent.IsUntitled) { if (window.ViewContent.IsUntitled) {
@ -139,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
// Must be called for initialization // Must be called for initialization
this.InitializeComponents(); this.InitializeComponents();
selectionListBox.Sorted = true; // selectionListBox.Sorted = true;
Point caretPos = textEditorControl.ActiveTextAreaControl.Caret.Position; Point caretPos = textEditorControl.ActiveTextAreaControl.Caret.Position;
TextArea textArea = textEditorControl.ActiveTextAreaControl.TextArea; TextArea textArea = textEditorControl.ActiveTextAreaControl.TextArea;
TextView textView = textArea.TextView; TextView textView = textArea.TextView;
@ -215,7 +213,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
selectionListBox.Items.Clear(); selectionListBox.Items.Clear();
if (codeGenerator.Content.Count > 0) { if (codeGenerator.Content.Count > 0) {
Hashtable objs = new Hashtable(); Hashtable objs = new Hashtable();
selectionListBox.Sorted = codeGenerator.Content.Count > 1; // selectionListBox.Sorted = codeGenerator.Content.Count > 1;
foreach (object o in codeGenerator.Content) { foreach (object o in codeGenerator.Content) {
if (!objs.Contains(o.ToString())) { if (!objs.Contains(o.ToString())) {
selectionListBox.Items.Add(o); selectionListBox.Items.Add(o);

Loading…
Cancel
Save