mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-13 14:13:02 +00:00
Make update of file appear in the in-window editor instead of external editors
This commit is contained in:
parent
56d789e232
commit
87988f435c
5 changed files with 54 additions and 12 deletions
|
@ -30,10 +30,12 @@
|
|||
#import <ProjectCenter/PCBundleManager.h>
|
||||
#import <ProjectCenter/PCEditorManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCSaveModified.h>
|
||||
|
||||
#import <Protocols/CodeEditor.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
NSString *PCEditorDidChangeFileNameNotification =
|
||||
|
@ -556,13 +558,10 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
|
||||
- (void)gotoFile: (NSString *)fileName atLine: (NSUInteger)line
|
||||
{
|
||||
id<CodeEditor> editor = [self openEditorForFile: fileName
|
||||
editable: YES
|
||||
windowed: NO];
|
||||
|
||||
PCProject *project = [_projectManager rootActiveProject];
|
||||
[[project projectBrowser] setPath: fileName];
|
||||
[_projectManager openFileAtPath: fileName];
|
||||
PCProjectEditor *pe = [project projectEditor];
|
||||
|
||||
id<CodeEditor> editor = [pe openEditorForFilePath: fileName windowed: NO];
|
||||
|
||||
// [self orderFrontEditorForFile:fileName];
|
||||
[editor scrollToLineNumber: line];
|
||||
|
|
|
@ -177,6 +177,48 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id<CodeEditor>) openEditorForFilePath: (NSString *)filePath
|
||||
windowed: (BOOL)windowed
|
||||
{
|
||||
PCProject *activeProject = [[_project projectManager] activeProject];
|
||||
NSString *fileName = [filePath lastPathComponent];
|
||||
BOOL editable = YES;
|
||||
id<CodeEditor> editor = nil;
|
||||
|
||||
NSLog(@"PCPE: fileName: %@, filePath: %@, project: %@",
|
||||
fileName, filePath, [activeProject projectName]);
|
||||
|
||||
// Determine if file should be opened for read only
|
||||
if (![_project isEditableFile:fileName])
|
||||
{
|
||||
editable = NO;
|
||||
}
|
||||
|
||||
// Set the 'editor' var either by requesting already opened
|
||||
// editor or by creating the new one.
|
||||
editor = [self openEditorForFile:filePath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
if (!editor)
|
||||
{
|
||||
NSLog(@"We don't have editor for file: %@", fileName);
|
||||
[self setActiveEditor: nil];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Category path was changed by user's clicking inside browser.
|
||||
// That's why new category path must be transfered to editor.
|
||||
NSString *categoryPath = [NSString stringWithFormat: @"/Classes/%@/", fileName];
|
||||
[editor setCategoryPath:categoryPath];
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
|
||||
// Reload last column because editor has just been loaded
|
||||
[[_project projectBrowser] reloadLastColumnAndNotify:NO];
|
||||
[editor fileStructureItemSelected:fileName];
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
// Called by PCProjectBrowser
|
||||
// categoryPath:
|
||||
// 1. "/Classes/Class.m/- init"
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
||||
|
||||
- (id<CodeEditor>)openEditorForFilePath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
|
|
|
@ -312,13 +312,11 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
|
||||
- (void) updateEditor
|
||||
{
|
||||
NSLog(@"****************** UPDATE EDITOR HIT ***********************");
|
||||
PCAppController *controller = (PCAppController *)[NSApp delegate];
|
||||
PCProjectManager *pm = [controller projectManager];
|
||||
PCEditorManager *em = [pm editorManager];
|
||||
[em gotoFile: lastFileNameParsed
|
||||
atLine: lastLineNumberParsed];
|
||||
NSLog(@"****************** UPDATE EDITOR HIT ***********************");
|
||||
}
|
||||
|
||||
// kill process
|
||||
|
|
|
@ -183,7 +183,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
}
|
||||
}
|
||||
|
||||
NSLog(@"index: %i start: %i", index, line_start);
|
||||
NSLog(@"index: %li start: %li", index, line_start);
|
||||
|
||||
return line_start > index ? index : line_start;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
if (![wsCharSet characterIsMember:c])
|
||||
{
|
||||
offset = offset - line_start;
|
||||
NSLog(@"offset: %i", offset);
|
||||
NSLog(@"offset: %li", offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
|
|||
|
||||
// Get offset from BOL of previous line
|
||||
// offset = ComputeIndentingOffset([self string], line_start-1);
|
||||
NSLog(@"Indent offset: %i", offset);
|
||||
NSLog(@"Indent offset: %li", offset);
|
||||
|
||||
// Replace current line whitespaces with new ones
|
||||
indentString = [[NSMutableString alloc] initWithString:@""];
|
||||
|
|
Loading…
Reference in a new issue