[Gambas-devel] find your sub easier

na2492 at ...16... na2492 at ...16...
Sun Aug 1 20:29:40 CEST 2004


>* Wed Jul 31 2004 yizhou <yizhou at ...143...> 0.95-104   
>   
>All the modification below is to make developer can browe   
>function or sub of a class    
>and by click on the function or sub, the current focus will goto   
>the start of the function   
>or class. even if Gambas can fold cold in edit window, this   
>function will still be useful.    
>-----------------------------------------------------------------------------------
  
>- add sub RefreshchildList in class FEditor   
>   
>PRIVATE SUB RefreshchildList(sText AS String)   
>  DIM Linearray AS NEW String[]   
>  DIM isStatic AS Integer   
>  DIM isPublic AS Integer   
>  DIM isSub AS Integer   
>  DIM lines AS String   
>  DIM ChildName AS String   
>  DIM NamePos AS Integer   
>  DIM lineses AS String   
>  DIM LineNumber AS Integer   
>  DIM iLine AS Integer   
>  Linearray=Split(sText,"\n")   
>   
>  FOR EACH lineses IN Linearray   
>    LineNumber=LineNumber+1   
>    isStatic=0   
>    isPublic=0   
>    isSub=0   
>    lines=lineses   
>    IF lines="END" THEN    
>      'MESSAGE(ChildName)   
>      fmain.AddMethod(ChildName,Path,iLine)   
>    END IF       
>    IF Left(lines,7)="STATIC " THEN    
>      isStatic=1   
>      lines=Right(lines,Len(lines)-7)   
>    ENDIF   
>    IF Left(lines,7)="PUBLIC " THEN    
>      isPublic=1   
>      lines=Right(lines,Len(lines)-7)   
>    ENDIF   
>    IF Left(lines,8)="PRIVATE " THEN    
>      isPublic=0   
>      lines=Right(lines,Len(lines)-8)   
>    ENDIF   
>    IF Left(lines,4)="SUB " THEN    
>      isSub=1   
>      lines=Right(lines,Len(lines)-4)   
>    ENDIF   
>    IF Left(lines,9)="FUNCTION " THEN    
>      isSub=2   
>      lines=Right(lines,Len(lines)-9)   
>    ENDIF   
>    IF isSub>0 THEN    
>      NamePos=Instr(lines,"(")   
>      IF NamePos=0 THEN NamePos=Instr(lines," ")   
>      ChildName=Left(lines,NamePos-1)   
>      'To show the detail of function then use next line   
>      'ChildName=lines   
>      iLine=LineNumber   
>    ENDIF   
>    'message( isstatic+ispublic+issub)   
>       
>       
>  NEXT   
>END   
>   
>--------------------------------------------------------------------------------------
  
>- add function AddMethod in class FMain   
>   
>PUBLIC FUNCTION AddMethod(ChildName AS String,Name AS String,iLine   
>AS Integer) AS String   
>     
>  IF NOT tvwproject.Exist(CStr(iLine) & "@" & Name) THEN   
>tvwproject.Add(CStr(iLine) & "@" &   
>Name,ChildName,Picture["img/16/method.png"],Name)   
>  tvwproject.Current.Expanded=TRUE   
>END   
>   
>--------------------------------------------------------------------------------------
  
>   
>- Change sub tvwProject_Activate in class FMain   
>   
>PUBLIC SUB tvwProject_Activate()   
>DIM pos AS Integer   
>DIM iLine AS Integer   
>DIM iLineString AS String   
>  IF tvwProject.Key THEN   
>    IF CanEdit(tvwProject.Key) THEN   
>      pos=Instr(tvwProject.Key,"@")   
>      IF pos=0 THEN   
>        iLine=0   
>        iLineString=tvwProject.Key   
>      ELSE   
>        iLineString=Left(tvwProject.Key,pos-1)   
>        iLine=CInt(iLineString)   
>        iLineString=Right(tvwProject.Key,Len(tvwProject.Key)-pos)   
>           
>      ENDIF   
>      Project.OpenFile(iLineString,iLine)   
>    ENDIF   
>  ENDIF   
>   
>END    
>   
>----------------------------------------------------------------------------------------------
  
>   
>- Change sub Modify in class FEditor   
>   
>PUBLIC SUB Modify(OPTIONAL bReset AS Boolean)   
>   
>  IF Project.ReadOnly THEN RETURN   
>  IF $bModify <> bReset THEN RETURN   
>   
>  $bModify = NOT bReset   
>  DrawTitle   
>  RefreshChildList(edtEditor.Text)   
>END   
>   
>----------------------------------------------------------------------------------------------
  
>   
>- Change sub Goto in class FEditor   
>   
>PUBLIC SUB Goto(iLine AS Integer, OPTIONAL iColumn AS Integer =   
>-1)   
>   
>  DIM PosEndOfTheLine AS Integer   
>  DIM PosStartOfTheLine AS Integer   
>  edtEditor.Line = iLine   
>  edtEditor.Column=0    
>  PosEndOfTheLine=edtEditor.Pos   
>  edtEditor.Line = iLine-1   
>  PosStartOfTheLine=edtEditor.Pos   
>       
>  IF iColumn >= 0 THEN    
>    edtEditor.Column = iColumn    
>  ELSE    
>    edtEditor.Column=0   
>    edtEditor.Select(PosStartOfTheLine,PosEndOfTheLine-PosStartOfTheLine-1)
  
>  ENDIF   
>     
>END   
>   
>--------------------------------------------------------------------------------------------------
  
>- Change property of tvwProject.sort to Ture   
>   
>   
>Yizhou He   
>   
>Research Technician (Xiong Lab)   
>Lineberger Comprehensive Cancer Center   
>University of North Carolina at Chapel Hill   
>Chapel Hill, NC 27599-7295   
>Tel: (919)-962-2143   
 
Salut, 
 
realy usefull, but one question : 
For what reason Change property of tvwProject.sort to TRUE ? 
 
unsorted it shows like they placed in the file. 
Or is it needed for somethig I ingnore ? 
 
 
Amicalement 
Charlie 
 
* Gesendet mit / Sent by: FEN-Webmail * http://www.fen-net.de *




More information about the Devel mailing list