Browse Source

Fixed SD2-740: Right clicking a class bookmark

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2146 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
d2ed72122d
  1. 20
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/IconBarMargin.cs
  2. 3
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs
  3. 2
      src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs
  4. 2
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  5. 6
      src/Main/Base/Project/Src/Services/File/FileService.cs

20
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/IconBarMargin.cs

@ -68,17 +68,19 @@ namespace ICSharpCode.TextEditor
public override void HandleMouseDown(Point mousePos, MouseButtons mouseButtons) public override void HandleMouseDown(Point mousePos, MouseButtons mouseButtons)
{ {
int clickedVisibleLine = (mousePos.Y + textArea.VirtualTop.Y) / textArea.TextView.FontHeight;
int lineNumber = textArea.Document.GetFirstLogicalLine(clickedVisibleLine);
if ((mouseButtons & MouseButtons.Right) == MouseButtons.Right) {
if (textArea.Caret.Line != lineNumber) {
textArea.Caret.Line = lineNumber;
}
}
List<Bookmark> marks = textArea.Document.BookmarkManager.Marks; List<Bookmark> marks = textArea.Document.BookmarkManager.Marks;
int oldCount = marks.Count; int oldCount = marks.Count;
foreach (Bookmark mark in marks) { foreach (Bookmark mark in marks) {
int lineNumber = textArea.Document.GetVisibleLine(mark.LineNumber); if (mark.LineNumber == lineNumber) {
int fontHeight = textArea.TextView.FontHeight;
int yPos = lineNumber * fontHeight - textArea.VirtualTop.Y;
if (mousePos.Y >= yPos && mousePos.Y < yPos + fontHeight) {
if (lineNumber == textArea.Document.GetVisibleLine(mark.LineNumber - 1)) {
// marker is inside folded region, it cannot be clicked
continue;
}
mark.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0)); mark.Click(textArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0));
if (oldCount != marks.Count) { if (oldCount != marks.Count) {
textArea.UpdateLine(lineNumber); textArea.UpdateLine(lineNumber);
@ -239,7 +241,7 @@ namespace ICSharpCode.TextEditor
} else if(regionTop > top && regionTop < bottom) { } else if(regionTop > top && regionTop < bottom) {
// Region's top edge inside line. // Region's top edge inside line.
return true; return true;
} }
return false; return false;
} }
} }

3
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -231,7 +231,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string newProjectName = StringParser.Parse(name, new string[,] { string newProjectName = StringParser.Parse(name, new string[,] {
{"ProjectName", projectCreateInformation.ProjectName} {"ProjectName", projectCreateInformation.ProjectName}
}); });
string projectLocation = FileUtility.Combine(projectCreateInformation.ProjectBasePath, newProjectName + LanguageBindingService.GetProjectFileExtension(language)); string projectLocation = Path.GetFullPath(Path.Combine(projectCreateInformation.ProjectBasePath,
newProjectName + LanguageBindingService.GetProjectFileExtension(language)));
StringBuilder standardNamespace = new StringBuilder(); StringBuilder standardNamespace = new StringBuilder();

2
src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
if (descriptor == null || descriptor.Binding == null) if (descriptor == null || descriptor.Binding == null)
throw new InvalidOperationException("Cannot get Language Binding for " + TargetLanguageName); throw new InvalidOperationException("Cannot get Language Binding for " + TargetLanguageName);
info.OutputProjectFileName = Path.Combine(targetProjectDirectory, info.ProjectName + descriptor.ProjectFileExtension); info.OutputProjectFileName = Path.GetFullPath(Path.Combine(targetProjectDirectory, info.ProjectName + descriptor.ProjectFileExtension));
return descriptor.Binding.CreateProject(info); return descriptor.Binding.CreateProject(info);
} }

2
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -477,7 +477,7 @@ namespace ICSharpCode.SharpDevelop.Project
string guid = match.Result("${Guid}"); string guid = match.Result("${Guid}");
if (!FileUtility.IsUrl(location)) { if (!FileUtility.IsUrl(location)) {
location = Path.Combine(solutionDirectory, location); location = Path.GetFullPath(Path.Combine(solutionDirectory, location));
} }
if (projectGuid == FolderGuid) { if (projectGuid == FolderGuid) {

6
src/Main/Base/Project/Src/Services/File/FileService.cs

@ -108,6 +108,12 @@ namespace ICSharpCode.SharpDevelop
return GetOpenFile(fileName); return GetOpenFile(fileName);
} }
/// <summary>
/// Opens a new unsaved file.
/// </summary>
/// <param name="defaultName">The (unsaved) name of the to open</param>
/// <param name="language">Name of the language used to choose the display binding.</param>
/// <param name="content">Content of the file to create</param>
public static IWorkbenchWindow NewFile(string defaultName, string language, string content) public static IWorkbenchWindow NewFile(string defaultName, string language, string content)
{ {
IDisplayBinding binding = DisplayBindingService.GetBindingPerLanguageName(language); IDisplayBinding binding = DisplayBindingService.GetBindingPerLanguageName(language);

Loading…
Cancel
Save