Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

MuhEdit 0.5.5

Uploader:MitgliedThe_Muh
Datum/Zeit:26.09.2007 17:52:53

'version 0.5.5
declare sub speichern(text as string, seite as string)
declare function laden(seite as string) as string
declare sub standartText()
declare function blaettern(seite as string) as string
declare sub cursor(text as string)
dim as string text, seite
dim shared as integer zeile=3, spalte=1
dim as integer mzeile, mspalte, buttons

function blaettern(seite as string) as string
    Dim zahl as integer
    do
    CLS
    standarttext()
    Locate 25, 1 : Print "__________________________________________________"
    Locate 26, 1 : Print "Which page do you want to open? (1-5)"
    sleep
    zahl = val(inkey)
    if zahl < 6 and zahl > 0 then seite = "page"+str(zahl)+".txt"
    loop until zahl > 0 and zahl < 6
    return seite
end function

sub speichern(text as string, seite as string)
    OPEN seite FOR OUTPUT AS #1
    print #1, zeile,spalte
    PRINT #1, text
    CLOSE #1
    beep
end sub

function laden(seite as string) as string
    Dim text as string
    OPEN seite FOR INPUT AS #1
    input #1, zeile,spalte
    while not EOF(1)
        dim neuezeile as string
        line INPUT #1, neuezeile
        text+=neuezeile+CHR(13,10)
    wend
    text=left(text,len(text)-2) 'letztes chr(13,10) wieder löschen da zu viel
    CLOSE #1
    CLS
    return text
end function

COLOR 0, 15
width 50, 27

sub standartText()
    locate 1, 1
    PRINT "MuhEdit / Load = F11 / Save = F12 / Quit = ESC  "
    locate 2, 1
    Print "__________________________________________________"
end sub
cls

locate 3, 1
DO
    standartText()
    Locate 25,1 : Print "__________________________________________________"
    Locate 26,1 : Print "Page: "& seite &" | Open another page = F9    "
    'auf eingabe warten
    dim d as string
    locate zeile ,spalte
    do:sleep 1:
    getmouse mspalte, mzeile,,buttons
    if buttons then
        mzeile += 1
        if mzeile < 24 and mzeile > 3 then
            zeile = mzeile
        end if
        mspalte += 1
        spalte = mspalte
        continue do
    end if
    d=inkey:loop until d<>"" or buttons 'wartet auf Usereingabe

    SELECT CASE d
        case CHR(255, 72)                       'oben
        if zeile > 3 then
            zeile -= 1
        else
            zeile = 24
        end if
    case CHR(255, 80)                           'unten
        if zeile < 24 then
            zeile += 1
            text = text+chr(13,10)
        else
            zeile = 3
        end if
    case CHR(255, 75)                           'links
        if spalte>1 then    'nicht am zeilenanfang
            spalte-=1
            locate zeile, spalte
            if asc(text,spalte + 1) < 65 and asc(text,spalte -1) < 65 and asc(text,spalte) < 65 then
                text=left(text,len(text)-1)
            end if
        else                'am zeilenanfang
            if zeile > 3 then
                zeile -= 1
                spalte = 50
            else
                zeile = 24
                spalte = 50
            end if
        end if
    case CHR(255, 77)                           'rechts
        if spalte <> 50 then
            spalte += 1
            text = text + " "
        elseif spalte = 50 and zeile < 24 then
            zeile += 1
            spalte = 1
        else
            zeile = 3
            spalte = 1
        end if
    case CHR$(8):                               'backspace
        if spalte>1 then           'nicht am zeilenanfang
            spalte-=1
            locate zeile,spalte
            print " "
            text=left(text,len(text)-1)
        else                        'am zeilenanfang
            if zeile > 3 then
                zeile -= 1
                spalte = 50
                locate zeile, spalte
                print " "
            else
                beep
            end if
        end if
    case CHR$(13):                              'enter
        if zeile > 23 then
            zeile = 3
            spalte = 1
        else
            spalte = 1
            zeile += 1
        end if
        text=text+chr(13,10)
    case chr$(27):                              'escape
        end
    case chr$(255, 107):                        'das X oben
        end
    case CHR(255,67):
        speichern(text, seite)
        seite = blaettern(seite)
        text = laden(seite)
        locate 3, 1
        print text
    case CHR(255,134):                          'seite speichern
        speichern(text, seite)
        locate 3, 1
    case CHR(255,133):                          'Laden
        standartText()
        text = laden(seite)
        locate 3,1
        print text
        locate zeile, spalte
    case Chr(255, 63):
        CLS
        zeile = 3 : spalte = 1
    case else:
        Print d;
        spalte += 1
        if spalte>50 then
            spalte=1
            zeile+=1
            if zeile>24 then zeile=3
        end if
        text = text + d
    end select
loop