Author: rmottola
Date: Mon Aug  4 00:03:38 2014
New Revision: 38031

URL: http://svn.gna.org/viewcvs/gnustep?rev=38031&view=rev
Log:
Move GoToLine to the View akin to the NSTextView find panel and declare it in 
the editor view protocol.

Modified:
    apps/projectcenter/trunk/ChangeLog
    apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/data.classes
    apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/objects.gorm
    apps/projectcenter/trunk/Headers/Protocols/CodeEditorView.h
    apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditor.m
    apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.h
    apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.m

Modified: apps/projectcenter/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/ChangeLog?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/ChangeLog  (original)
+++ apps/projectcenter/trunk/ChangeLog  Mon Aug  4 00:03:38 2014
@@ -1,3 +1,13 @@
+2014-08-04 Riccardo Mottola <[email protected]>
+
+       * English.lproj/ProjectCenter.gorm
+       * Headers/Protocols/CodeEditorView.h
+       * Modules/Editors/ProjectCenter/PCEditor.m
+       * Modules/Editors/ProjectCenter/PCEditorView.h
+       * Modules/Editors/ProjectCenter/PCEditorView.m
+       Move GoToLine to the View akin to the NSTextView find panel and
+       declare it in the editor view protocol.
+
 2014-08-03 German Arias <[email protected]>
 
        * Modules/Editors/ProjectCenter/PCEditor.m: Don't use

Modified: apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/data.classes
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/data.classes?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/data.classes      
(original)
+++ apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/data.classes      
Mon Aug  4 00:03:38 2014
@@ -7,8 +7,7 @@
            "findNext:",
            "findPrevious:",
            "findShowPanel:",
-           "openGoToLinePanel:",
-           "newAction:"
+           "performGoToLinePanelAction:"
        );
        Super = NSObject;
     };

Modified: apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/objects.gorm
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/English.lproj/ProjectCenter.gorm/objects.gorm?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
Binary files - no diff available.

Modified: apps/projectcenter/trunk/Headers/Protocols/CodeEditorView.h
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Headers/Protocols/CodeEditorView.h?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/Headers/Protocols/CodeEditorView.h (original)
+++ apps/projectcenter/trunk/Headers/Protocols/CodeEditorView.h Mon Aug  4 
00:03:38 2014
@@ -1,7 +1,7 @@
 /*
    GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
 
-   Copyright (C) 2010 Free Software Foundation
+   Copyright (C) 2010-2014 Free Software Foundation
 
    Authors: Riccardo Mottola
 
@@ -30,4 +30,7 @@
 
 - (NSObject <CodeEditor> *)editor;
 
+- (void)performGoToLinePanelAction:(id)sender;
+- (void)goToLineNumber:(NSUInteger)lineNumber;
+
 @end

Modified: apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditor.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditor.m?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditor.m   
(original)
+++ apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditor.m   Mon Aug 
 4 00:03:38 2014
@@ -990,30 +990,8 @@
 
 - (void)scrollToLineNumber:(NSUInteger)lineNumber
 {
-  NSUInteger   offset;
-  NSUInteger   i;
-  NSString     *line;
-  NSEnumerator *e;
-  NSArray      *lines;
-  NSRange      range;
-
-  lines = [[_intEditorView string] componentsSeparatedByString: @"\n"];
-  e = [lines objectEnumerator];
-
-  for (offset = 0, i = 1;
-       (line = [e nextObject]) != nil && i < lineNumber;
-       i++, offset += [line length] + 1);
-
-  if (line != nil)
-    {
-      range = NSMakeRange(offset, [line length]);
-    }
-  else
-    {
-      range = NSMakeRange([[_intEditorView string] length], 0);
-    }
-  [_intEditorView setSelectedRange:range];
-  [_intEditorView scrollRangeToVisible:range];
+  [_intEditorView goToLineNumber:lineNumber];
+  [_extEditorView goToLineNumber:lineNumber];
 }
 
 @end

Modified: apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.h
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.h?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.h       
(original)
+++ apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.h       
Mon Aug  4 00:03:38 2014
@@ -4,7 +4,7 @@
     Interface declaration of the EditorTextView class for the
     ProjectManager application.
 
-    Copyright (C) 2005-2010 Free Software Foundation
+    Copyright (C) 2005-2014 Free Software Foundation
       Saso Kiselkov
       Riccardo Mottola
 
@@ -50,4 +50,10 @@
 
 - (NSRect)selectionRect;
 
+// =====
+// CodeEditorView protocol
+// =====
+- (void)performGoToLinePanelAction:(id)sender;
+- (void)goToLineNumber:(NSUInteger)lineNumber;
+
 @end

Modified: apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.m?rev=38031&r1=38030&r2=38031&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.m       
(original)
+++ apps/projectcenter/trunk/Modules/Editors/ProjectCenter/PCEditorView.m       
Mon Aug  4 00:03:38 2014
@@ -616,4 +616,42 @@
   return _insertionPointRect;
 }
 
+- (void)usesFindPanel
+{
+  return YES;
+}
+
+- (void)performGoToLinePanelAction:(id)sender
+{
+  NSLog(@"perform go to line!");
+}
+
+- (void)goToLineNumber:(NSUInteger)lineNumber
+{
+  NSUInteger   offset;
+  NSUInteger   i;
+  NSString     *line;
+  NSEnumerator *e;
+  NSArray      *lines;
+  NSRange      range;
+
+  lines = [[self string] componentsSeparatedByString: @"\n"];
+  e = [lines objectEnumerator];
+
+  for (offset = 0, i = 1;
+       (line = [e nextObject]) != nil && i < lineNumber;
+       i++, offset += [line length] + 1);
+
+  if (line != nil)
+    {
+      range = NSMakeRange(offset, [line length]);
+    }
+  else
+    {
+      range = NSMakeRange([[self string] length], 0);
+    }
+  [self setSelectedRange:range];
+  [self scrollRangeToVisible:range];
+}
+
 @end


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to