[Gambas-devel] find your sub easier

Yizhou He yizhou_he at ...143...
Sun Aug 1 19:20:28 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  
  
----- Original Message -----  
From: gambas-devel-request at lists.sourceforge.net  
Date: Friday, July 30, 2004 10:45 pm  
Subject: Welcome to the "Gambas-devel" mailing list (Digest  
mode)  
  
> Welcome to the Gambas-devel at lists.sourceforge.net mailing  
list!  
>   
> To post to this list, send your email to:  
>   
>  gambas-devel at lists.sourceforge.net  
>   
> General information about the mailing list is at:  
>   
>  https://lists.sourceforge.net/lists/listinfo/gambas-devel  
>   
> If you ever want to unsubscribe or change your options (eg,  
switch to  
> or from digest mode, change your password, etc.), visit your  
> subscription page at:  
>   
>  https://lists.sourceforge.net/lists/options/gambas-  
> devel/yizhou%40med.unc.edu  
>   
> You can also make such adjustments via email by sending a  
message to:  
>   
>  Gambas-devel-request at lists.sourceforge.net  
>   
> with the word `help' in the subject or body (don't include the  
> quotes), and you will get back a message with instructions.  
>   
> You must know your password to change your options (including  
changing  
> the password, itself) or to unsubscribe.  It is:  
>   
>  wskwntei  
>   
> If you forget your password, don't worry, you will receive a  
monthly  
> reminder telling you what all your lists.sourceforge.net  
mailing list  
> passwords are, and how to unsubscribe or change your options.   
There  
> is also a button on your options page that will email your  
current  
> password to you.  
>   
> You may also have your password mailed to you automatically  
off of the  
> Web page noted above.  
>





More information about the Devel mailing list