[Gambas-devel] update on Easier to find your subs
Yizhou He
yizhou_he at ...143...
Thu Aug 5 17:03:45 CEST 2004
Sorry,guys
I forget to include this change for "Easier to find your
sub" function. All the change based on Gambas 0.96
'-------Modify sub in class FEditor----------
PUBLIC SUB Form_Activate()
Project.Activate(ME)
'edtEditor.SetFocus
'-------Yizhou He Start----------------
createmenu
'-------Yizhou He End----------------
END
'-------To make it complete, I include last change ------
'------- add sub in class FMain---------
PUBLIC SUB AddMethod(sClass AS String,sItemName AS
String,iLine AS
Integer)
IF NOT tvwProject.exist(sClass & ":" & sItemName & "@" &
iLine )
AND iLine<>0 THEN tvwProject.add(sClass & ":" & sItemName &
"@" &
iLine,sItemName,picture["img/16/method.png"],sClass)
tvwProject.current.Expanded=TRUE
END
PUBLIC SUB ExpandClass(sClass AS String )
tvwProject.Current.Expanded=TRUE
END
'------- Modify sub in class FMain----
PUBLIC SUB tvwProject_Activate()
DIM iAtPos AS Integer
DIM iLine AS Integer
DIM sLine AS String
IF tvwProject.Key THEN
IF CanEdit(tvwProject.Key) THEN
iAtPos=Instr(tvwProject.Key,"@")
IF iAtPos=0 THEN
iLine=0
sLine=tvwProject.Key
ELSE
sLine=Right(tvwProject.Key,Len(tvwproject.Key)-iAtPos)
iLine=CInt(sLine)
sLine=Left(tvwProject.Key,Instr(tvwProject.Key,":")-1)
ENDIF
Project.OpenFile(sLine,iLine)
ENDIF
ENDIF
END
'--------- Modify sub in class FEditor -----------
PUBLIC FUNCTION Save() AS Boolean
DIM iLig AS Integer
DIM iProc AS Integer
DIM iFull AS Integer
DIM sLig AS String
DIM iPosProc AS Integer
DIM sData AS String
DIM iLine AS Integer
DIM iCol AS Integer
DIM bChange AS Boolean
DIM iCount AS Integer
DIM iVoidLine AS Integer
'----Yizhou He Start----------------
CreateMenu()
'----Yizhou He End---------------
IF Project.ReadOnly THEN RETURN
IF NOT $bModify THEN RETURN
Save.Begin(Path)
IF $bCleanOnSave THEN
iProc = -1
iLine = edtEditor.Line
iCol = edtEditor.Column
iCount = edtEditor.Lines.Count
FOR iLig = 0 TO iCount
IF iLig < iCount THEN
sLig = RTrim(edtEditor.Lines[iLig])
ELSE
sLig = "SUB gambas()"
ENDIF
IF NOT LTrim(sLig) THEN
INC iVoidLine
CONTINUE
ENDIF
IF IsProc(sLig) THEN
IF iProc >= 0 THEN
IF iFull < 2 THEN
bChange = TRUE
sData = Left(sData, iPosProc)
IF iLine > iProc THEN
IF iLine < iLig THEN
iLine = iProc - 1
ELSE
iLine = iLine - (iLig - iProc + 1)
ENDIF
ENDIF
ENDIF
ENDIF
iProc = iLig
iFull = 0
iPosProc = Len(sData)
ELSE
INC iFull
ENDIF
IF iLig < iCount THEN
sData = sData & String(iVoidLine, "\n") & sLig & "\n"
iVoidLine = 0
ENDIF
NEXT
IF Len(sData) <> Len(edtEditor.Text) THEN
File.Save(Path, sData)
edtEditor.Frozen = TRUE
edtEditor.Text = sData
TRY edtEditor.Line = iLine
IF Error = 0 THEN
TRY edtEditor.Column = iCol
ENDIF
edtEditor.Frozen = FALSE
ENDIF
ENDIF
IF NOT bChange THEN File.Save(Path, edtEditor.Text)
$bModify = FALSE
DrawTitle
Save.End()
CATCH
RETURN Save.Error()
END
'-------- Modify sub in class FEditor -----------
PUBLIC SUB Goto(iLine AS Integer, OPTIONAL iColumn AS
Integer = -1)
DIM iPosEOL AS Integer
DIM iposSOL AS Integer
edtEditor.Line=iLine
edtEditor.Column=0
iPosEOL=edtEditor.Pos
edtEditor.Line = iLine - 1
iPosSOL=edtEditor.Pos
IF iColumn >= 0 THEN
edtEditor.Column = iColumn
ELSE
edtEditor.Select(iPosSOL,iPosEOL-iPosSOL-1)
ENDIF
createmenu
END
'------- Modify sub in class FEditor ----------
PRIVATE SUB CreateMenu()
DIM iInd AS Integer
DIM sLine AS String
DIM sName AS String
DIM hMenu AS Menu
DIM cFunc AS NEW String[]
DIM sParent AS String
DIM sNewParent AS String
DIM hParent AS Menu
DIM sFullName AS String
DIM sDesc AS String
DIM iPos AS Integer
'IF $hMenuGo THEN $hMenuGo.Delete
'$hMenuGo = NEW Menu(mnuEditor)
'$hMenuGo.Caption = "&Go to"
INC Application.Busy
mnuGoto.Children.Clear
$cLine.Clear
FOR iInd = 0 TO edtEditor.Lines.Count - 1
'sLine = edtEditor.Lines[iInd]
'PRINT sLine
IF IsProc(edtEditor.Lines[iInd]) THEN
IF NOT $cLine.Exist($sName) THEN
'PRINT $sName
'IF $bPublic THEN $sName = "#" & $sName
$cLine[$sName] = iInd
cFunc.Add($sName)
ENDIF
ENDIF
NEXT
cFunc.Sort(gb.Text)
hParent = mnuGoto
'------ Yizhou He Start ------
project.ProjectTree[Path].Clear
'------- Yizhou He End -------
FOR EACH sName IN cFunc
'IF Left$(sName) = "#" THEN
' sName = Mid$(sName, 2)
' $bPublic = TRUE
'ELSE
' $bPublic = FALSE
'ENDIF
sFullName = sName
iPos = Instr(sName, "_")
IF iPos THEN
sNewParent = Left$(sName, iPos - 1)
sName = Mid$(sName, iPos + 1)
IF Len(sNewParent) = 0 THEN
sNewParent = "(Special)"
sName = "_" & sName
ENDIF
ELSE
sNewParent = ""
ENDIF
IF UCase(sNewParent) <> UCase(sParent) THEN
IF sNewParent THEN
hParent = NEW Menu(mnuGoto)
hParent.Text = sNewParent
ELSE
hParent = mnuGoto
ENDIF
sParent = sNewParent
ENDIF
hMenu = NEW Menu(hParent) AS "mnuGoto"
hMenu.Text = sName
hMenu.Tag = sFullName
hMenu.Checked = $bPublic
'----Yizhou He Start-----
fmain.AddMethod(Path,sFullName,$cLine[sFullName]+1)
'----Yizhou He End-----
NEXT
mnuGoto.Visible = $cLine.count > 0
mnuSepGoto.Visible = $cLine.count > 0
'mnuWatch.Visible = Project.Running
mnuWatch.Enabled = Project.Running AND
Len(Trim(edtEditor.Selection.Text)) > 0
'btnWatch.Enabled = mnuWatch
'mnuSepWatch.Visible = Project.Running
DEC Application.Busy
END
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: Thursday, August 5, 2004 11:10 am
Subject: Gambas-devel digest, Vol 1 #280 - 1 msg
> Send Gambas-devel mailing list submissions to
> gambas-devel at lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
https://lists.sourceforge.net/lists/listinfo/gambas-devel
> or, via email, send a message with subject or body 'help'
to
> gambas-devel-request at lists.sourceforge.net
>
> You can reach the person managing the list at
> gambas-devel-admin at lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more
specific
> than "Re: Contents of Gambas-devel digest..."
>
>
> Today's Topics:
>
> 1. Re: Pretty Printer for gambas-0.96 (Benoit Minisini)
>
> --__--__--
>
> Message: 1
> From: Benoit Minisini <gambas at ...1...>
> To: gambas-devel at lists.sourceforge.net
> Subject: Re: [Gambas-devel] Pretty Printer for gambas-0.96
> Date: Wed, 4 Aug 2004 22:31:34 +0200
> Reply-To: gambas-devel at lists.sourceforge.net
>
> On Wednesday 04 August 2004 22:08, Charlie wrote:
> > Salut Beno=EEt,
> >
> > I send you the PrettyPrinter for gambas-0.96.
> > I changed FEditor and FOption from the IDE .
> > In the FEditor I added a ToolButton to call it and in
FOption a
> Button> to configure it.
> >
> > I made a script to install and patch all the files, but
you have
> to copy
> > the unpacked PrettyPrinter Dir into the
> > gambas-0.96 Directory, then cd
to .../gambas-0.96/PrettyPrinter
> Dir and
> > start the ./PrettyPrinter.sh script.
> >
> > I make a copy of each file who will be patched, back to
the
> > PrettyPrinter Dir.
> >
> > At the end I make a su -c 'make install'
> >
> > Hope you enjoy, because I would like to see it included
in gambas.
> >
> > Amicalement
> > Charlie
>
> Hi, Charlie.
>
> I would like to see your pretty printer in Gambas too, and
I can
> include it=
> =20
> now because I won't release a 0.97 immediately.
>
> I'm very glad that you took the time to make patches and a
script
> to apply=
> =20
> them. Alas, I prefer that you send me the whole files and
not just
> the diff=
> s,=20
> because it is easier for me to look at your modifications
before
> inserting==20
> them in my current source tree (which is always more
advanced than
> what I=20
> have released).
>
> And do you think it is possible to rewrite your pretty
printer by
> using som=
> e=20
> functions I will export from the gb.eval component ? These
> functions will=20
> analyze the syntax for you, will tell you if a line is the
> beginning of a=20
> procedure, the end, a variable declaration, ... Tell me
what you need.
>
> I tell you that, because these functions are needed by the
IDE too
> when it=
> =20
> does auto-completion (at the moment, part is done by the
editor
> component,==20
> and part is done by the IDE itself). And Yizhou He (the
chinese
> translator)==20
> want to integrate a function browser directly in the IDE
project
> window, an=
> d=20
> so these functions will be welcome too.
>
> So, if you are agree, send me first your modifications as
plain
> file so tha=
> t I=20
> look at it. Then I will implement the needed functions in
the
> gb.eval=20component, and will explain to you how to use
them.
>
> Regards,
>
> =2D-=20
> Benoit Minisini
> mailto:gambas at ...1...
>
>
>
> --__--__--
>
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
>
> End of Gambas-devel Digest
>
More information about the Devel
mailing list