mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-13 14:13:02 +00:00
commit
07c911b995
15 changed files with 200 additions and 55 deletions
5
CODEOWNERS
Normal file
5
CODEOWNERS
Normal file
|
@ -0,0 +1,5 @@
|
|||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence,
|
||||
# @global-owner1 and @global-owner2 will be requested for
|
||||
# review when someone opens a pull request.
|
||||
* @rmottola
|
31
ChangeLog
31
ChangeLog
|
@ -1,3 +1,34 @@
|
|||
2021-08-18 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Modules/Editors/ProjectCenter/PCEditor.m
|
||||
Turn off ligatures, both when setting up the editor as well as when
|
||||
loading a file.
|
||||
|
||||
2021-08-18 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* PCInfoContronoller.m
|
||||
Center info panel correctly the first time on load.
|
||||
|
||||
2021-08-10 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Framework/PCEditorManager.m: Add method -gotoFile:atLine:
|
||||
* Framework/PCProjectEditor.m: Add method openEditorForFilePath:windowed:
|
||||
* Framework/PCProjectManager.m: Add method openFileAtPath:windowed:
|
||||
* Headers/ProjectCenter/PCEditorManager.h
|
||||
* Headers/ProjectCenter/PCProjectEditor.h
|
||||
* Headers/ProjectCenter/PCProjectManager.h: Declarations for above methods.
|
||||
* Modules/Debuggers/ProjectCenter/GDBWrapper.h
|
||||
* Modules/Debuggers/ProjectCenter/GDBWrapper.m: Add code to pull
|
||||
"thread-selected" dictionary when the debugger stops by using break/pause
|
||||
or by using up or down. Code to syncronize editor with where the debugger
|
||||
has stopped.
|
||||
* Modules/Debuggers/ProjectCenter/PCDebugger.h
|
||||
* Modules/Debuggers/ProjectCenter/PCDebugger.m: updateEditor method. This
|
||||
method makes use of the gotoFile:atLine: method to get the file and show it
|
||||
in the code editor and go to the line where it has stopped.
|
||||
* Modules/Editors/ProjectCenter/PCEditor.m: Update internal editor
|
||||
* Modules/Editors/ProjectCenter/PCEditorView.m: minor bugfixes.
|
||||
|
||||
2021-07-16 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Modules/Debuggers/ProjectCenter/GDBWrapper.h
|
||||
|
|
|
@ -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 =
|
||||
|
@ -97,15 +99,6 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
selector:@selector(editorDidChangeFileName:)
|
||||
name:PCEditorDidChangeFileNameNotification
|
||||
object:nil];
|
||||
|
||||
// Debugger
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(debuggerDidHitBreakpoint:)
|
||||
name:PCProjectBreakpointNotification
|
||||
object:nil];
|
||||
|
||||
// Preferences
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -542,16 +535,15 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
[_editorsDict setObject:_editor forKey:_newFileName];
|
||||
}
|
||||
|
||||
- (void)debuggerDidHitBreakpoint:(NSNotification *)aNotif
|
||||
- (void)gotoFile: (NSString *)fileName atLine: (NSUInteger)line
|
||||
{
|
||||
id object = [aNotif object];
|
||||
NSString *filePath = [object objectForKey: @"file"];
|
||||
NSString *line = [object objectForKey: @"line"];
|
||||
id<CodeEditor> editor = [self openEditorForFile: filePath
|
||||
editable: YES
|
||||
windowed: NO];
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
[editor scrollToLineNumber: [line integerValue]];
|
||||
PCProject *project = [_projectManager rootActiveProject];
|
||||
PCProjectEditor *pe = [project projectEditor];
|
||||
|
||||
id<CodeEditor> editor = [pe openEditorForFilePath: fileName windowed: NO];
|
||||
|
||||
// [self orderFrontEditorForFile:fileName];
|
||||
[editor scrollToLineNumber: line];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -177,6 +177,54 @@
|
|||
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;
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
|
||||
NSLog(@"PCPE: fileName: %@, filePath: %@, project: %@",
|
||||
fileName, filePath, [activeProject projectName]);
|
||||
|
||||
if (![mgr fileExistsAtPath: filePath])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
// 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"
|
||||
|
|
|
@ -1124,6 +1124,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
// ============================================================================
|
||||
|
||||
- (void)openFileAtPath:(NSString *)filePath
|
||||
windowed:(BOOL)windowed
|
||||
{
|
||||
editorManager = [self editorManager];
|
||||
|
||||
|
@ -1131,11 +1132,17 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
{
|
||||
[editorManager openEditorForFile:filePath
|
||||
editable:YES
|
||||
windowed:YES];
|
||||
windowed:windowed];
|
||||
[editorManager orderFrontEditorForFile:filePath];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openFileAtPath:(NSString *)filePath
|
||||
{
|
||||
[self openFileAtPath: filePath windowed: YES];
|
||||
}
|
||||
|
||||
|
||||
- (void)openFile
|
||||
{
|
||||
NSArray *files = nil;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
- (NSArray *)allEditors;
|
||||
- (void)closeActiveEditor:(id)sender;
|
||||
- (void)closeEditorForFile:(NSString *)file;
|
||||
- (void)gotoFile: (NSString *)fileName atLine: (NSUInteger)line;
|
||||
|
||||
- (NSArray *)modifiedFiles;
|
||||
- (BOOL)hasModifiedFiles;
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
||||
|
||||
- (id<CodeEditor>)openEditorForFilePath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed;
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ extern NSString *PCActiveProjectDidChangeNotification;
|
|||
|
||||
// Also called by PCAppController
|
||||
- (void)openFileAtPath:(NSString *)filePath;
|
||||
- (void)openFileAtPath:(NSString *)filePath windowed: (BOOL)windowed;
|
||||
- (void)openFile;
|
||||
- (void)newFile;
|
||||
- (BOOL)saveFile;
|
||||
|
|
|
@ -379,6 +379,29 @@
|
|||
[debugger setLastLineNumberParsed: NSNotFound];
|
||||
}
|
||||
}
|
||||
|
||||
if ([dictionaryName isEqualToString: @"thread-selected"])
|
||||
{
|
||||
NSDictionary *d = [dict objectForKey: @"frame"];
|
||||
NSString *fileName;
|
||||
NSString *lineNum;
|
||||
|
||||
fileName = [d objectForKey:@"fullname"];
|
||||
lineNum = [d objectForKey:@"line"];
|
||||
|
||||
NSLog(@"parsed from GDB thread-selected: %@:%@", fileName, lineNum);
|
||||
if (fileName != nil && lineNum != nil)
|
||||
{
|
||||
[debugger setLastFileNameParsed: fileName];
|
||||
[debugger setLastLineNumberParsed: [lineNum intValue]];
|
||||
[debugger updateEditor];
|
||||
}
|
||||
else
|
||||
{
|
||||
[debugger setLastFileNameParsed: nil];
|
||||
[debugger setLastLineNumberParsed: NSNotFound];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -423,6 +446,7 @@
|
|||
{
|
||||
[debugger setLastFileNameParsed: fileName];
|
||||
[debugger setLastLineNumberParsed: [lineNum intValue]];
|
||||
[debugger updateEditor];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -66,5 +66,6 @@ extern NSString *PCDBDebuggerStartedNotification;
|
|||
- (void) setLastFileNameParsed: (NSString *)fname;
|
||||
- (NSUInteger)lastLineNumberParsed;
|
||||
- (void)setLastLineNumberParsed: (NSUInteger)num;
|
||||
- (void)updateEditor;
|
||||
|
||||
@end
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#import "PCDebugger.h"
|
||||
#import "PCDebuggerView.h"
|
||||
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCEditorManager.h>
|
||||
#import "PCAppController.h"
|
||||
|
||||
#import "Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h"
|
||||
#import "PCDebuggerWrapperProtocol.h"
|
||||
#import "GDBWrapper.h"
|
||||
|
@ -306,6 +310,15 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
lastLineNumberParsed = num;
|
||||
}
|
||||
|
||||
- (void) updateEditor
|
||||
{
|
||||
PCAppController *controller = (PCAppController *)[NSApp delegate];
|
||||
PCProjectManager *pm = [controller projectManager];
|
||||
PCEditorManager *em = [pm editorManager];
|
||||
[em gotoFile: lastFileNameParsed
|
||||
atLine: lastLineNumberParsed];
|
||||
}
|
||||
|
||||
// kill process
|
||||
- (void) interrupt
|
||||
{
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
tSelCol, NSForegroundColorAttributeName,
|
||||
nil];
|
||||
[ev setSelectedTextAttributes:selAttributes];
|
||||
[ev turnOffLigatures:self];
|
||||
|
||||
// Activate undo
|
||||
[ev setAllowsUndo: YES];
|
||||
|
@ -345,9 +346,13 @@
|
|||
textBackground = readOnlyColor;
|
||||
}
|
||||
|
||||
textColor = [prefs colorForKey:EditorForegroundColor defaultValue:textColor];
|
||||
|
||||
[attributes setObject:font forKey:NSFontAttributeName];
|
||||
[attributes setObject:textBackground forKey:NSBackgroundColorAttributeName];
|
||||
[attributes setObject:[prefs colorForKey:EditorForegroundColor defaultValue:textColor] forKey:NSForegroundColorAttributeName];
|
||||
[attributes setObject:textColor forKey:NSForegroundColorAttributeName];
|
||||
[attributes setObject:[NSNumber numberWithInt: 0] // disable ligatures
|
||||
forKey:NSLigatureAttributeName];
|
||||
|
||||
text = [NSString stringWithContentsOfFile:_path];
|
||||
attributedString = [attributedString initWithString:text attributes:attributes];
|
||||
|
@ -790,7 +795,11 @@
|
|||
|
||||
// This is temporary
|
||||
ft = [NSFont userFixedPitchFontOfSize:0.0];
|
||||
at = [NSDictionary dictionaryWithObject:ft forKey:NSFontAttributeName];
|
||||
at = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
ft, NSFontAttributeName,
|
||||
[NSNumber numberWithInt: 0], NSLigatureAttributeName,
|
||||
nil];
|
||||
|
||||
as = [[NSAttributedString alloc] initWithString:text attributes:at];
|
||||
|
||||
[self setIsEdited:NO];
|
||||
|
@ -985,15 +994,36 @@
|
|||
if ([object isKindOfClass:[NSTextView class]])
|
||||
{
|
||||
NSTextView *tv = (NSTextView *)object;
|
||||
NSArray *selArray;
|
||||
NSRange lastSelection;
|
||||
NSRange selRange;
|
||||
NSUInteger selLine;
|
||||
NSString *str = [tv string];
|
||||
NSRange selection;
|
||||
NSUInteger selLine = NSNotFound;
|
||||
|
||||
selArray = [tv selectedRanges];
|
||||
lastSelection = [[selArray lastObject] rangeValue];
|
||||
NSLog(@"last selection is %@", [selArray lastObject]);
|
||||
[[tv string] getLineStart:NULL end:&selLine contentsEnd:NULL forRange:lastSelection];
|
||||
// for speed reasons we cache [NSString characterAtIndex:index]
|
||||
SEL charAtIndexSel = @selector(characterAtIndex:);
|
||||
unichar (*charAtIndexFunc)(NSString *, SEL, NSUInteger);
|
||||
charAtIndexFunc = (unichar (*)())[str methodForSelector:charAtIndexSel];
|
||||
|
||||
selection = [tv selectedRange];
|
||||
// now we calculate given the selection the line count, splitting on \n
|
||||
// calling lineRangeForRange / paragraphForRange does the same thing
|
||||
// we want to avoid to scan the string twice
|
||||
{
|
||||
NSUInteger i;
|
||||
unichar ch;
|
||||
NSUInteger nlCount;
|
||||
|
||||
nlCount = 0;
|
||||
for (i = 0; i < selection.location; i++)
|
||||
{
|
||||
// ch = [str characterAtIndex:i];
|
||||
ch = (*charAtIndexFunc)(str, charAtIndexSel, i);
|
||||
if (ch == (unichar)0x000A) // new line
|
||||
nlCount++;
|
||||
}
|
||||
|
||||
selLine = nlCount + 1;
|
||||
}
|
||||
NSLog(@"%u corresponds to %u", selection.location, selLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1121,6 +1151,8 @@
|
|||
{
|
||||
[_intEditorView goToLineNumber:lineNumber];
|
||||
[_extEditorView goToLineNumber:lineNumber];
|
||||
[_intEditorView centerSelectionInVisibleArea: self];
|
||||
[_extEditorView centerSelectionInVisibleArea: self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -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:@""];
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(infoController);
|
||||
RELEASE(projectManager);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
|
||||
infoDict = [NSDictionary dictionaryWithContentsOfFile:file];
|
||||
RETAIN(infoDict);
|
||||
|
||||
if ([NSBundle loadNibNamed:@"Info" owner:self] == NO)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
[versionField setStringValue:[NSString stringWithFormat:@"Version %@", [infoDict objectForKey:@"ApplicationRelease"]]];
|
||||
[infoWindow center];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -56,29 +63,7 @@
|
|||
|
||||
- (void)showInfoWindow:(id)sender
|
||||
{
|
||||
if ([NSBundle loadNibNamed:@"Info" owner:self] == NO)
|
||||
{
|
||||
// PCLogError(self, @"error loading Menu NIB file!");
|
||||
return;
|
||||
}
|
||||
|
||||
[infoWindow makeKeyAndOrderFront:self];
|
||||
[versionField setStringValue:[NSString stringWithFormat:@"Version %@", [infoDict objectForKey:@"ApplicationRelease"]]];
|
||||
|
||||
/*#if defined(GNUSTEP)
|
||||
if (!infoWindow)
|
||||
{
|
||||
infoWindow = [[GSInfoPanel alloc] initWithDictionary:infoDict];
|
||||
}
|
||||
|
||||
[infoWindow setTitle:@"Info"];
|
||||
[infoWindow center];
|
||||
[infoWindow makeKeyAndOrderFront:self];
|
||||
#else
|
||||
NSRunAlertPanel(@"Info",
|
||||
@"OPENSTEP has no support for GSInfoPanel",
|
||||
@"OK",nil,nil,nil);
|
||||
#endif*/
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue