version 6.30 0 Form1 1 4 0 0 0 2 0 0 3 0 0 0 0 0 0 0 0 6 0 0 238 268 1 WebBrowser.dll 1 WebBrowser.dll 1 web:WebBrowser Sub designer addform(Form1,"PPC Wiki","",220,220,220)@ addlabel(form1,Label2,5,190,230,75,"",220,220,220,0,0,0,False,False,9)@ addimagebutton(form1,ExitButton,185,5,40,30,"",212,208,200,0,0,0,"cCenterImage","logout.png",True,False,False,9)@ addtextbox(form1,TextBox3,5,45,230,140,"TextBox3",255,255,255,0,0,0,False,False,True,9)@ addimagebutton(form1,SaveButton,140,5,40,30,"",212,208,200,0,0,0,"cCenterImage","save.png",True,False,False,9)@ addimagebutton(form1,ConfigButton,100,5,40,30,"",212,208,200,0,0,0,"cCenterImage","settings.png",True,True,True,9)@ addimagebutton(form1,EditButton,50,5,40,30,"",212,208,200,0,0,0,"cCenterImage","edit.png",True,True,True,9)@ addimagebutton(form1,HomeButton,5,5,40,30,"",212,208,200,0,0,0,"cCenterImage","home.png",True,True,True,9)@ addtextbox(form1,TextBox1,5,235,230,22,"TextBox1",255,255,255,0,0,0,True,False,False,9)@ End Sub @EndOfDesignText@Sub Globals 'Declare the global variables here. programname="Personel Pocket PC Wiki" programversion="0.11" programplatform="Pocket PC" '8/1/08 - added wiki file extension ' wikiextension=".txt" homepage="homepage" ' currentpage="" navtopage="" ProgDir = "" bullet = False header1 = False header2 = False paragraph = False End Sub Sub App_Start Form1.Show Textbox1.Text="" Textbox3.Text="" web.New1("Form1",5,45,230,210) 'web.DocumentText="

Pocket PC


Version 0.1


" ProgDir = AppPath & "\" 'Msgbox(ProgDir) x=ReadWikiFile(homepage) 'Msgbox(x) 'currentpage=homepage navtopage=homepage web.DocumentText=x navtopage="" 'Msgbox(currentpage) End Sub Sub Button1_Click 'web.Navigate(Textbox1.Text) web.GoBack ' web.url = Textbox1.Text 'either Navigate or assigning to Url will load the web page End Sub Sub ReadWikiFile(file) file = ProgDir & file & wikiextension 'Msgbox(file) If FileExist (file) = true Then FileOpen (c1, file, cRead ,, cASCII) wiki = FileReadToEnd(c1) FileClose (c1) 'Msgbox(file) Return ParseWiki(wiki) Else ' wiki file doesn't exist - how did that happen? End If End Sub Sub ParseWiki(wiki) 'Msgbox(wiki) Return ParseBladeWiki (wiki) End Sub Sub ParseBladeWiki (wiki) tagBOLD=0 tagITALIC=0 tagSTRIKE=0 tagUNDERLINE=0 tagHEADING=0 'HTML Header HtmStr = "" & crlf HtmStr = HtmStr & "" & navtopage & "" & crlf ' HtmStr = HtmStr & "" & crlf HtmStr = HtmStr & "" & crlf For x=0 To StrLength(wiki) schr=SubString(wiki,x,1) ' Msgbox(schr) ' --- CONVERT SIMPLE SINGLE CHARACTERS --- If schr=" " Then HtmStr=HtmStr & " " End If If schr=Chr(13) Then HtmStr=Htmstr & "
" End If ' --- CONVERT LINK --- Select schr Case "[" If SubString(wiki,x,2)="[[" Then ' this is reference with differnt text ie [[wiki][welcome to my wiki!]] y=StrIndexOf(wiki, "]", x) z=StrIndexOf(wiki, "]", y+1) 'Msgbox(SubString(wiki,x+2,y-x-2)) HtmStr=Htmstr & "" & SubString(wiki,y+2,z-y-2) & "" x=z+1 Else y=StrIndexOf(wiki, "]", x) HtmStr=Htmstr & "" & SubString(wiki,x+1,y-x-1) & "" ' Msgbox(SubString(wiki,x+1,y-x-1)) 'Msgbox(htmstr) x=y End If Case "+" '

Locks Wiki

If tagHeading = 0 Then If SubString(wiki,x,3)="+++" Then ' Heading level 3 h3 ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=3 HtmStr = HtmStr & "

" x=x+2 End If Else If SubString(wiki,x,2)="++" Then ' Heading level 2 h2 ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=2 HtmStr = HtmStr & "

" x=x+1 End If Else ' Must be heading level 1 "

Locks Wiki

" ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=1 HtmStr = HtmStr & "

" End If End If End If Case "*" ' Bold If tagBOLD=0 Then HtmStr=HtmStr & "" tagBOLD=1 Else HtmStr=HtmStr & "" tagBOLD=0 End If Case "=" ' Italics If tagITALIC=0 Then HtmStr=HtmStr & "" tagITALIC=1 Else HtmStr=HtmStr & "" tagITALIC=0 End If Case "-" If tagSTRIKE=0 Then HtmStr=HtmStr & "" tagSTRIKE=1 Else HtmStr=HtmStr & "" tagSTRIKE=0 End If Case "_" 'check for additional underline: if so, this isn't. Its a horizontal line If SubString(wiki,x,3)="___" Then x=x+2 HtmStr=HtmStr & "
" Else If tagUNDERLINE=0 Then HtmStr=HtmStr & "" tagUNDERLINE=1 Else HtmStr=HtmStr & "" tagUNDERLINE=0 End If End If Case Chr(13) If tagHeading > 0 Then ' Id heading then make sure to close HtmStr = HtmStr & "
" If tagHeading = 1 Then ' close heading HtmStr = HtmStr & "

" Else If tagHeading = 2 Then ' close heading HtmStr = HtmStr & "

" Else If tagHeading = 3 Then ' close heading HtmStr = HtmStr & "" End If tagHeading = 0 End If Case Else HtmStr=HtmStr & schr End Select Next 'HTML FOOTER HtmStr=HtmStr & "" 'Msgbox("returning HTML") Return Htmstr End Sub Sub web_DocumentCompleted ' Msgbox("Completed", web.Url) 'Msgbox("web_completed") End Sub Sub ValidateURL (url) 'Msgbox(url) If SubString(url,0,6)="about:" Then url=SubString(url,6, StrLength(url)-6) End If If SubString(url,0,11)="about:blank" Then url=SubString(url,11, StrLength(url)-11) End If Return url End Sub Sub web_navigating If currentpage = "" Then 'we are just starting the program currentpage="homepage" Else If navtopage="" Then navtopage=validateURL(web.NavigatingURL) End If ''dg Msgbox("Navtopage: " & navtopage & crlf & "Currentpage: " & currentpage) If currentpage <> navtopage AND SubString(navtopage,0,5) <> "blank" Then ' navtopage=validateURL(web.NavigatingURL) ' currentpage=navtopage CheckWikiFile(navtopage) x=ReadWikiFile(navtopage) ' msgbox("Navtopage=" & navtopage & crlf & "Currentpage=" & currentpage) currentpage=navtopage web.DocumentText=x 'web.Visible=true End If End Sub Sub CheckWikiFile (file) If FileExist (file & wikiextension) = true Then ' do nothing Else ' create the file ' Msgbox(file) 'Msgbox("navtopage doesnt exist, creating a new one") FileOpen (c1,file & wikiextension,cWrite,,cASCII) FileWrite (c1, navtopage) FileWrite (c1,"[homepage]") FileClose (c1) End If End Sub Sub xweb_Navigating Msgbox("beginning sub web_navigating::" & currentpage) If web.NavigatingURL = "about:blank" Then ' nothing - we are loading the default page Else Msgbox (web.NavigatingURL) currentpage=SubString(web.NavigatingURL,6, StrLength(web.NavigatingURL)-6) Msgbox(currentpage) If SubString(currentpage,1,11)="about:blank" Then ' this is for pocket IE currentpage=SubString(currentpage,11, StrLength(currentpage)-11) End If Msgbox(currentpage) If FileExist (currentpage & wikiextension) = true Then ' do nothing Else ' create the file FileOpen (c1,currentpage & wikiextension,cWrite,,cASCII) FileWrite (c1, currentpage) FileWrite (c1,"[homepage]") FileClose (c1) End If 'x=getFile(currentpage) '(currentpage) 'Msgbox("about to read WikiFile") x=ReadWikiFile(currentpage) '(x) 'Msgbox(x) web.DocumentText=x End If End Sub Sub web_Navigated ' ("web_Navigated") 'Msgbox ("Navigated to URL " & web.Url & crlf & "and currentpage " & currentpage) 'currentpage=navtopage navtopage="" 'Textbox1.Text = web.Url End Sub Sub EditButton_Click label2.Enabled=true label2.Visible=true textbox3.Enabled=True textbox3.Visible=true EditButton.Enabled=false EditButton.Visible = false SaveButton.Enabled=true SaveButton.Visible=true HomeButton.Visible=false HomeButton.Enabled=false If FileExist (currentpage & wikiextension) = true Then FileOpen (c1,ProgDir & currentpage & wikiextension,cRead ,, cASCII) textbox3.Text=FileReadToEnd(c1) FileClose (c1) End If End Sub Sub SaveButton_Click 'Msgbox(currentpage) 'If FileExist(ProgDir & currentpage) = true Then FileOpen (c1,ProgDir & currentpage & wikiextension,cWrite,,cASCII) FileWrite (c1,TextBox3.Text) FileClose (c1) 'End If HomeButton.Enabled=true HomeButton.Visible=true EditButton.Visible=true EditButton.Enabled=true label2.Enabled=false label2.Visible=false SaveButton.Enabled=false SaveButton.Visible=false textbox3.Enabled=false textbox3.Visible=false x=ReadWikiFile(currentpage) 'x=getFile(currentpage) 'Msgbox(x) ' currentpage=navtopage web.DocumentText=x End Sub Sub HomeButton_Click 'x=getFile(homepage) x=ReadWikiFile(homepage) ' currentpage=navtopage web.DocumentText=x End Sub Sub ConfigButton_Click 'Msgbox("Current page = " & currentpage & crlf & "Navigate To page = " & navtopage & crlf & "Home page = " & homepage) End Sub