Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '--------------Credits--------------'
- ' MuhEdit, version 0.9.11-2
- ' Programming and idea by The_Muh.
- '-----------------------------------'
- '
- function byte_2_x(B as ulongint) as string
- dim KiB as ulongint
- dim MiB as ulongint
- dim biggest as string
- dim stamp as string
- if B >= 1024 then
- KiB = int(B / 1024)
- B -= KiB * 1024
- Biggest = "KiB"
- end if
- if KiB >= 1024 then
- MiB = int(KiB / 1024)
- KiB -= MiB * 1024
- Biggest = "MiB"
- end if
- select case biggest
- case "KiB":
- stamp = Kib & " KiB, " & B & " Byte"
- case "MiB":
- stamp = Mib & "MiB, " & KiB & " KiB"
- end select
- return stamp
- end function
- type file_type
- title as string
- flag as integer
- end type
- 'declares:
- declare function search() as integer
- declare sub correct_cur()
- declare sub laden(seite as string)
- declare sub speichern(file as string = "")
- declare sub text(ByVal wahl As Integer, title as string = "")
- declare sub anzeige(anzeigetext() as string, X as integer, Y as integer)
- declare function new_file() as string
- declare function conv(key as string) as string
- declare function directory() as string
- declare function gen_row(number as integer, biggest as integer) as string
- declare function eingabe(ByVal frage As String ,vorgabe As String, X as integer,Y as integer, title as string = "") as string
- declare function Max(array() as string) as integer
- declare Function str_replace(ByVal V_Data As String, ByVal V_Expression As String, ByVal V_ReplaceBy As String) As String
- 'variablen:
- dim d as string
- dim as string Li, Re
- dim as integer ascL, ascR
- dim shared as string tZeile()
- dim shared as string seite
- dim shared as integer zeile=3, spalte=1
- dim as integer mzeile, mspalte, buttons, wheel, wheel_old, mdummy
- dim i as integer
- dim L as integer
- Dim as integer einf = 1
- dim shared dirs as string
- dim rest as string
- dim shared a as integer
- dim shared b as integer
- dim shared pot_spalte as integer = 1
- dim clip as integer
- dim shared ba as integer = 0
- 'Options-varis:
- dim shared row_num as integer = 1
- dim shared all_rows as integer = 0
- dim shared hoehe as integer = 60
- dim shared breite as integer = 65
- REDIM tzeile(1) AS STRING
- 'makros:#macro datei(fl, endung)
- #macro datei(fl, endung)
- K = DIR("*."& endung ,fl + &H04 + &H01)
- do
- if len(k) > 0 and k <> "." and k <> ".." then
- redim preserve files(i)
- files(i).title = K
- files(i).flag = fl
- i += 1
- end if
- K = DIR("")
- LOOP until LEN(K) = 0
- #endmacro
- #macro blubb()
- dim key as string
- dim sh as integer
- c = 0
- do
- cls
- locate 1, 1 : PRINT "MuhEdit Filebrowser";
- locate 2, 1 : Print String(breite, asc("_"));
- locate hoehe,1 :Print "Switch between File / Directory = F2 or F4 ";
- text(5)
- for sh = lbound(files) to (hoehe -5) 'text anzeigen...
- if SH + A <= ubound(files) then
- locate sh+3,1
- if sh = c then
- if files(sh+a).flag = &h10 then
- print "X) /"& files(sh+A).title;
- else
- print "X) "& files(sh+A).title;
- end if
- else
- if files(sh+a).flag = &h10 then
- print " ) /"& files(sh+A).title;
- else
- print " ) "& files(sh+A).title;
- end if
- end if
- else
- exit for
- end if
- next sh
- do : sleep 1 : key = inkey : loop until key <> ""
- select case asc(right(key,1))
- case 60, 62
- if flag = &h10 then
- flag = &h00
- else
- flag = &h10
- end if
- exit do
- case 73
- if A > 0 then
- A -= 1
- end if
- case 81
- if c + a < ubound(files) then A += 1
- case 72 'oben
- if c > 0 then c -= 1
- if A > 0 and c = 0 then a -= 1
- case 80 'unten
- if c < (hoehe -5) and c < ubound(files) then
- c += 1
- else
- if c + a < ubound(files) then A += 1
- end if
- end select
- select case asc(left(key,1))
- case 27
- if flag = &h10 then
- weiter = 0
- else
- C = -1
- weiter = 0
- end if
- exit do
- case 13
- if files(c).flag = &h10 then
- if c = 0 then
- dirs = ".."
- else
- dirs = files(c).title
- end if
- chdir(dirs)
- else
- seite = files(c).title
- weiter = 0
- end if
- exit do
- end select
- loop
- #endmacro
- 'subs und funktionen:
- sub angleichen()
- if ubound(tzeile) < zeile + A then redim preserve tzeile(zeile + A) as string
- end sub
- function gen_row(number as integer, biggest as integer) as string
- dim l_num as integer
- dim l_big as integer
- dim row as string
- l_num = len(str(number))
- l_big = len(str(biggest))
- row = string( (l_big - l_num), " ") & str(number) & "|"
- return row
- end function
- sub anzeige(anzeigetext() as string, X as integer,Y as integer)
- for sh as integer = 3 to (hoehe - 2) 'text anzeigen...
- if SH + X <= ubound(anzeigetext) then
- locate sh, 1
- if row_num = 1 then
- if ubound(anzeigetext) < hoehe -2 and all_rows = 1 then
- ba = len(gen_row(0,hoehe -2))
- print gen_row(sh + x -2, hoehe -2) & mid(anzeigetext(sh+X),Y+1,breite- ba)
- else
- ba = len(gen_row(0,ubound(anzeigetext)))
- print gen_row(sh + x -2, ubound(anzeigetext)) & mid(anzeigetext(sh+X),Y+1,breite -ba)
- shell "echo "& len(mid(anzeigetext(sh+X),1+Y,breite)) &" , "& breite
- end if
- else
- print mid(anzeigetext(sh+X),Y +1,breite)
- end if
- else
- exit for
- end if
- next sh
- if ubound(anzeigetext) < hoehe -2 and row_num = 1 and all_rows = 1 then
- for i as integer = ubound(anzeigetext) +1 to hoehe -2
- print gen_row(i -2, hoehe -2)
- next
- end if
- end sub
- function conv(key as string) as string
- dim con as string
- dim ascl as integer
- ascL = asc(left(key,1))
- select case ascL
- 'case 167 : con = chr(245) '§
- case 228 : con = chr(132) 'ä
- case 196 : con = chr(142)
- case 246 : con = chr(148) 'ö
- case 214 : con = chr(153)
- case 252 : con = chr(129) 'ü
- case 220 : con = chr(154)
- case 223 : con = chr(225) '�Ÿ
- case else: con = chr(ascl)
- end select
- return con
- end function
- sub correct_curs()
- angleichen()
- if len(tzeile(zeile + A)) >= pot_spalte and len(tzeile(zeile + a)) > 1 then
- spalte = pot_spalte
- end if
- if len(tzeile(zeile + A)) < pot_spalte then
- spalte = len(tzeile(zeile + A)) + 1
- if len(tzeile(zeile + A)) = 0 then spalte = 1
- end if
- if spalte + ba > breite then
- B = spalte - (breite + ba)
- spalte -= B
- else
- b = 0
- end if
- end sub
- sub counter()
- dim code as integer
- dim blank as integer
- dim i as integer
- for i = 1 to ubound(tzeile)-1
- if len(ltrim(tzeile(i))) = 0 or len(ltrim(tzeile(i),chr(9))) = 0 then blank += 1
- if len(ltrim(tzeile(i),chr(9))) <> 0 and len(ltrim(tzeile(i))) <> 0 then code += 1
- next i
- locate 8,1
- print "Textlines: "& code' - blank
- print "Blanklines: "& blank
- print ""
- print "Gesamt: "& code + blank
- end sub
- function directory() as string
- dim dirs as string
- dim files() as file_type
- dim as integer i = 1
- dim c as integer
- dim K as string
- dim A as integer
- dim key as string
- dim flag as integer
- dim weiter as integer
- weiter = 1
- Locate 4,1
- files(0).title = ".."
- do
- redim preserve files(2)
- i = 1
- files(0).flag = &h10
- datei(&h10,"*")
- datei(&h00,"txt")
- datei(&h00,"*ml")
- datei(&h00,"bas")
- blubb()
- if c > ubound(files) then continue do
- loop until weiter = 0
- if files(c).flag = &h00 then
- a = 0
- b = 0
- laden(seite)
- end if
- locate 1,1
- return curdir
- end function
- function eingabe(ByVal frage As String ,vorgabe As String, X as integer,Y as integer, title as string = "") as string
- dim zeichen as string
- dim zeichenkette as string
- dim L as integer
- dim Li as string
- dim Re as string
- dim ascR as integer
- dim ascL as integer
- dim einf as integer
- dim spalte as integer
- dim rest as string
- einf = 1
- zeichenkette = vorgabe
- locate x, 1
- print frage & Zeichenkette;
- spalte = len(zeichenkette) +1
- y = len(frage) +1
- do
- text(2)
- text(6, title)
- locate x,1: print frage;
- locate x,len(frage) + 1: print Zeichenkette;
- DRAW STRING ((y + spalte-2)*8 , (x-1)*8), "_" 'Cursor anzeigen
- do : sleep 1 : zeichen = inkey : loop while zeichen = ""
- Li = mid(zeichen, 1,1)
- Re = mid(zeichen, 2.1)
- ascL = asc(Li)
- ascR = asc(Re)
- L = len(zeichenkette)
- select case ascR
- case 82 'testen ob "einf" gedr�ckt wurde
- if einf = 1 then 'der umschalter
- einf = 0
- else
- einf = 1
- end if
- case 75: 'links
- if spalte > 1 then spalte -= 1
- case 77: 'rechts
- if spalte < L then spalte += 1
- end select
- if ascL <> 255 then
- select case ascL
- case 8 'backspace
- if L > spalte then
- zeichenkette = left(zeichenkette,spalte-2) + right(zeichenkette,L -(spalte-1))
- else
- zeichenkette=left(zeichenkette,len(zeichenkette)-1)
- end if
- if spalte <> 1 then spalte -= 1
- pot_spalte = spalte
- case 13 'enter
- return zeichenkette
- locate 3,1
- exit function
- case 27
- return vorgabe
- locate 3,1
- exit function
- case 127 'entf
- if L >= spalte then
- zeichenkette = left(zeichenkette,spalte-1) + right(zeichenkette,L -(spalte))
- end if
- case else
- if L >= spalte then
- if einf = 0 then
- MID(zeichenkette, spalte, 1) = zeichen
- else
- zeichenkette = left(zeichenkette, spalte-1) + zeichen + right(zeichenkette, (L - spalte +1) )
- end if
- else
- zeichenkette = zeichenkette + zeichen
- end if
- spalte += 1
- end select
- end if
- loop until zeichen = chr(13)
- end function
- sub info()
- cls
- text(1)
- dim array as integer
- dim zeilen as integer
- dim zeichen as integer
- dim filesize as integer
- OPEN seite FOR BINARY AS #1
- filesize = LOF(1)
- CLOSE #1
- array = ubound(tzeile)
- for i1 as integer = 1 to array
- if len(tzeile(i1)) > 0 then
- zeilen += 1
- end if
- next i1
- for i2 as integer = 1 to array
- zeichen += len(tzeile(i2))
- next
- locate 3,1:print "Filename: "& seite;
- locate 4,1:print "Letters: "& zeichen;
- locate 5,1:print "Filesize: "& byte_2_x(filesize)
- end sub
- sub laden(filename as string)
- dim as integer i = 2
- dim dummy as string
- redim tzeile(1) as string
- OPEN filename FOR INPUT AS #1
- while not EOF(1)
- i += 1
- REDIM Preserve tzeile(i) AS STRING
- line INPUT #1, dummy
- tzeile(i) = rtrim(str_replace(dummy, chr(9), " "))
- wend
- CLOSE #1
- redim preserve tzeile(max(tzeile())) 'leere zeilen am ende der datei "abschneiden"
- end sub
- function max(array() as string) as integer
- dim m as integer
- for i as integer = 3 to ubound(array)
- if len(ltrim(array(i))) <> 0 then
- m = i
- end if
- next
- return m
- end function
- function new_file() as string
- dim filename as string
- dim key as string
- cls
- text (6,"Create a new File")
- if seite <> "" then
- locate hoehe, 1 : print "Save old file? (J/N)";
- do : sleep 1 : key = inkey: loop until key <> ""
- if lcase(key) = "j" then
- speichern(seite)
- end if
- end if
- filename = eingabe("New Filename: ", "new.txt", hoehe, 1, "Create a new File")
- if DIR(filename, &h27) <> "" then
- locate hoehe, 1 : print "File already exists, overwrite? (J/N)";
- do : sleep 1 : key = inkey: loop until lcase(key) = "j" or lcase(key) = "n"
- if lcase(key) = "j" then
- open filename for output as #1
- close #1
- redim tzeile(0)
- elseif lcase(key) = "n" then
- exit function
- end if
- elseif len(filename) <> 0 then
- open filename for output as #1
- close #1
- redim tzeile(0)
- end if
- return filename
- end function
- Function str_replace(ByVal V_Data As String, ByVal V_Expression As String, ByVal V_ReplaceBy As String) As String
- Dim X As Long
- Dim SL As Long
- Dim D as String
- D = V_Data
- SL = Len(V_Expression)
- X = 0
- Do
- X = X + 1
- If X > Len(D) - SL + 1 Then Exit Do
- If Mid(D, X, SL) = V_Expression Then
- D = Mid(D, 1, X - 1) & V_ReplaceBy & Mid(D, X + SL)
- X = X - (SL - 1)
- If X < 0 then X = 0
- End If
- Loop
- Return D
- End Function
- sub replace()
- cls
- dim keyword as string
- dim positionX(1 to 46) as integer
- dim positionY(1 to 46) as integer
- dim repl as string
- dim hit as integer
- locate 1,1 : print "Search";
- locate 2, 1 : Print String(breite , asc("_"));
- text 5
- keyword = eingabe("Keyword:","",hoehe,1)
- repl = eingabe("Replace with:","",hoehe,1)
- locate 3,1
- for i as integer = 1 to ubound(tzeile)
- hit = instr(tzeile(i),keyword)
- if hit > 0 then
- tzeile(i) = left(tzeile(i),hit-1) + repl + right(tzeile(i), len(tzeile(i)) - hit -len(keyword) +1 )
- end if
- next
- end sub
- function search() as integer
- dim keyword as string
- dim key as string
- dim suchpos as integer
- dim as integer hit = -1
- locate 1,1 :Print String(breite , asc(" "));
- locate 1,1 : print "MuhEdit - Search";
- locate 2, 1 : Print String(breite, asc("_"));
- text 5
- keyword = eingabe("Keyword:","",hoehe,1)
- suchpos = spalte +B
- do
- for i as integer = zeile + A +hit to ubound(tzeile)
- do
- hit = instr(suchpos+1,lcase(tzeile(i)),lcase(keyword))
- if hit > 0 then
- zeile = i
- if zeile >= hoehe then
- A = (zeile - hoehe) +4
- zeile = zeile - A
- end if
- pot_spalte = hit
- correct_curs
- exit for
- end if
- suchpos = hit + len(keyword) -1
- loop until hit = 0
- suchpos = 0
- next
- cls
- locate 1,1 :Print String(breite , asc(" "));
- locate 1,1 : print "Search";
- locate 2, 1 : Print String(breite, asc("_"));
- anzeige(tzeile(),A, B)
- text 5
- if hit = 0 then
- print "Last result in File, start new?";
- else
- print "Continue search?";
- end if
- print " Y/N";
- do : sleep 1 : key = inkey : loop until key <> ""
- if lcase(key) = "y" or key = chr(13) then
- if hit = 0 then
- zeile = 3
- A = 0
- hit = 0
- end if
- else
- exit do
- end if
- loop
- return 0
- end function
- sub speichern(file as string = "")
- cls
- dim x as integer
- dim as integer i = 3
- dim K as string
- dim filename() as string
- dim dummy as string
- text (6,"MuhEdit Saver")
- if file = "" then
- redim filename(i)
- anzeige(filename(), 0, 0)
- if len(seite) > 0 then
- seite = eingabe("Filename:",seite,hoehe,1)
- else
- seite = eingabe("Filename:","example.txt",hoehe,1)
- end if
- else
- 'print file
- seite = file
- end if
- OPEN seite FOR OUTPUT AS #1
- For x = 3 to max(tzeile())
- dummy = str_replace(tzeile(x), " ", chr(9))
- PRINT #1, rtrim(dummy)
- next
- CLOSE #1
- if file = "" then text(3) : getkey
- end sub
- sub text(ByVal wahl As Integer, title as string = "")
- select case wahl
- case 1
- locate 1, 1 : PRINT "Load = F2 / Save = F3 / Directory = F4 / Quit = ESC";
- locate 2, 1 : Print String(breite , asc("_"));
- Locate (hoehe-1),1 : Print String(breite , asc("_"));
- Locate (hoehe),1 : Print String(breite , asc(" "));
- Locate (hoehe),1 : Print "File: "& right(seite,30) &" / Line: "& Zeile + A - 2 &" / Row:"& spalte+b;
- case 2
- locate (hoehe ), 1 : Print String(breite, asc(" "));
- case 3
- locate (hoehe), 1 : Print String(breite, asc(" "));
- Locate (hoehe), 1 : Print "Accepted";
- locate 3,1
- case 4
- locate (hoehe), 1 : Print String(breite, asc(" "));
- Locate (hoehe), 1 : Print "False";
- locate 3,1
- case 5
- Locate (hoehe-1),1 : Print String(breite, asc("_"));
- case 6
- locate 1, 1 : PRINT title;
- locate 2, 1 : Print String(breite, asc("_"));
- Locate (hoehe-1),1 : Print String(breite, asc("_"));
- Locate (hoehe),1 : Print String(breite, asc(" "));
- case else
- exit sub
- end select
- end sub
- '------------------Aufruf-flags auswerten------------------'
- dim s as integer
- if command(1) = "-S" then
- hoehe = HIWORD(WIDTH)
- breite = LOWORD(WIDTH)
- if command(2) <> "" then
- seite = command(2)
- laden(seite)
- end if
- CLS
- elseif command(1) <> "-S" then
- seite = command(1)
- laden(seite)
- screenres breite*8, hoehe * 8
- COLOR 0, 15
- CLS
- end if
- '------------------------hauptprogramm----------------------'
- dirs = curdir
- locate 3, 0
- DO
- '------ verwaltung + anzeige ------'
- angleichen()
- L = len(tzeile(zeile + A))
- anzeige(tzeile(), A, B)
- text 1
- locate zeile ,spalte,1
- DRAW STRING ((spalte-1 + ba)*8 , (zeile -1)*8), "_", 'Cursor anzeigen
- '------ Eingabe ------':
- do : sleep 1 'auf eingabe warten
- d = inkey
- getmouse mspalte, mzeile,wheel,buttons
- if mzeile = -1 and mspalte = -1 then continue do
- mzeile = (mzeile+4) / 8
- mspalte = (mspalte+4) / 8 - BA
- if mspalte <= 0 then mspalte = 1
- if buttons = 1 and mzeile <= (hoehe - 2) and mzeile > 2 then
- if mzeile < 3 then mzeile = 3
- if mzeile + a > ubound(tzeile) then
- mzeile = ubound(tzeile) -a
- if mzeile > hoehe then
- a = int(mzeile - hoehe)
- mzeile -= a
- end if
- end if
- while buttons <> 0
- getmouse mspalte, mzeile,wheel,buttons
- if mzeile = -1 and mspalte = -1 then continue while
- mzeile = (mzeile+4) / 8
- mspalte = (mspalte+4) / 8 - BA
- if mzeile < 3 then mzeile = 3
- if mzeile > ubound(tzeile) then
- mzeile = ubound(tzeile)
- if mzeile > hoehe then
- a = int(mzeile - hoehe)
- mzeile -= a
- end if
- end if
- if mzeile <= ubound(tzeile) and mzeile > 2 then
- if zeile <> mzeile or spalte <> mspalte then
- DRAW STRING ((spalte-1 + ba)*8 , (zeile -1)*8), "_",15
- end if
- zeile = mzeile
- spalte = mspalte
- 'Begin Mouse-Check Code
- if ubound(tZeile) < zeile + A then
- if ubound(tzeile) > hoehe -4 then
- A = (ubound(tzeile) - hoehe +2)
- zeile = (ubound(tzeile) - A)
- else
- zeile = (ubound(tzeile))
- end if
- end if
- if zeile > hoehe -2 then zeile = hoehe -2
- tZeile(zeile + A) = rtrim(tZeile(zeile + A))
- if mspalte > len(tZeile(zeile + A)) then
- spalte = len(tZeile(zeile + A)) + 1
- else
- spalte = mspalte
- end if
- if row_num = 1 then
- dim foo as string = str(ubound(tzeile)) & " "
- end if
- 'End Mouse-Check Code
- pot_spalte = spalte
- correct_curs
- DRAW STRING ((spalte-1 + ba)*8 , (zeile -1)*8), "_", 'Cursor anzeigen
- d = ""
- anzeige(tzeile(),A,B)
- end if
- wend
- exit do
- end if
- 'mausrad-code:
- mdummy = wheel - wheel_old
- if mdummy > 0 then 'hoch
- if A-3 > 0 then
- A -= 3
- else
- A = 0
- end if
- end if
- if mdummy < 0 and ubound(tzeile) > hoehe then 'runter
- if zeile + A +3 <= ubound(tzeile) then
- A += 3
- else
- A = ubound(tzeile) - zeile
- end if
- if zeile + A + (hoehe - 4 - zeile)+3 > ubound(tzeile) then
- dim dummy as integer = zeile + A + (hoehe - 2 - zeile) - ubound(tzeile)
- A = A - dummy
- end if
- end if
- wheel_old = wheel
- if mdummy <> 0 then exit do
- 'set_mark()
- 'ende Mausrad-code
- loop until d<>""
- if mdummy <> 0 then cls : correct_curs :continue do
- locate zeile ,spalte,1
- if d = "" then continue do
- Re = mid(d, 2.1)
- ascR = asc(Re)
- if command(1) <> "-S" then D = conv(D)
- Li = mid(d, 1,1)
- ascL = asc(Li)
- '------ Verarbeitung teil 1 ------':
- SELECT CASE ascR
- case 72 'oben
- if zeile > 3 then
- zeile -= 1
- else
- if A > 0 then A -= 1
- end if
- if zeile <> 2 then
- correct_curs
- end if
- case 80 'unten
- if zeile + a < ubound(tzeile) then
- if zeile < (hoehe - 2) then
- zeile += 1
- else
- A += 1
- end if
- correct_curs
- end if
- case 75 'links
- if spalte > 1 then 'nicht am zeilenanfang
- spalte-=1
- pot_spalte = spalte + b
- else 'am zeilenanfang
- if zeile > 3 and zeile < (hoehe - 2) then
- if B = 0 then
- zeile -= 1
- pot_spalte = len(tzeile(zeile +A)) +1
- if spalte > breite then
- B = pot_spalte - breite
- pot_spalte -= B
- end if
- correct_curs
- else
- B -= 1
- end if
- elseif zeile = 3 or zeile = (hoehe-2) then
- if B > 0 then
- B -= 1
- elseif B = 0 then
- if zeile = hoehe-2 then
- zeile -= 1
- else
- if A > 0 then A -= 1
- end if
- end if
- end if
- end if
- case 77 'rechts
- if spalte + b < L + 2 and spalte + b < L +1 orelse zeile + a < ubound(tzeile) then
- if spalte < breite then
- spalte += 1
- pot_spalte = spalte + b
- elseif spalte = hoehe then
- b += 1
- end if
- end if
- if spalte + b >= l +2 then
- spalte = 1
- B = 0
- if zeile < (hoehe - 2) then
- zeile += 1
- else
- A += 1
- end if
- end if
- case 107 'das X oben
- exit do
- case 59 'F1
- tzeile(zeile + a) = left(tzeile(zeile + a), spalte + b)
- correct_curs
- case 63 'F5, hohe und breite
- if command(1) <> "-S" then
- CLS
- text(1)
- locate 3,1 : print "The width must be 55 or higher"
- locate 4,1 : print "The Heigth must be 20 or higher"
- locate 5,1 : Input "Heigth: ", Hoehe
- Locate 6,1 : Input "Width: ", Breite
- if breite < 65 then breite = 65
- if hoehe < 40 then hoehe = 40
- screenres breite *8, hoehe * 8
- if zeile > hoehe then
- A += zeile-hoehe+2
- zeile = 3
- end if
- COLOR 0, 15
- end if
- case 64 'f6 (dateiinfo)
- info()
- counter()
- getkey
- case 65 'F7 Zeilennummern
- if row_num = 1 then
- row_num = 0
- ba = 0
- else
- row_num = 1
- end if
- case 66 'F8 Alle/nicht alle zeilennummern
- if row_num = 1 then
- if all_rows = 1 then
- all_rows = 0
- else
- all_rows = 1
- end if
- end if
- case 61 'seite speichern(F3)
- speichern()
- text(1)
- case 60 'Laden (F2)
- dirs = directory()
- spalte =1
- zeile = 3
- case 82 'einf�gen
- if einf = 1 then
- einf = 0
- else
- einf = 1
- end if
- case 73 'bild hoch
- if A-2 > 0 then
- A -= 3
- else
- A = 0
- end if
- correct_curs
- case 81 'bild runter
- if ubound(tzeile) > (zeile + A)+2 then
- a += 3
- else
- A = ubound(tzeile) - zeile
- end if
- correct_curs
- case 71 'Pos1
- pot_spalte = 1
- b = 0
- correct_curs
- case 79 'Ende
- pot_spalte = len(tzeile(zeile +A)) +1
- if spalte > breite then
- B = pot_spalte - breite
- pot_spalte -= B
- end if
- correct_curs
- #ifndef __fb_linux__
- case 83 'entf
- if L >= spalte + B then
- tzeile(zeile+A) = left(tzeile(zeile+A),B + spalte-1) + right(tzeile(zeile+A),L -(spalte+B))
- elseif L < spalte + B then
- redim preserve tzeile(ubound(tzeile) + 1)
- rest = tzeile(zeile + a +1)
- tzeile(zeile +a ) = tzeile(zeile + a) + rest
- for x as integer = zeile + a +1 TO max(tzeile())
- tzeile(x) = tzeile(x+1)
- next
- redim preserve tzeile(ubound(tzeile) -1)
- end if
- #endif
- end select
- '------ Verarbeitung teil 2 ------':
- if ascL <> 255 then
- select case ascL
- case 6
- search()
- if zeile > 46 then
- A = zeile - 46
- zeile -= A
- end if
- case 8 'backspace
- if spalte > 1 then 'nicht am zeilenanfang
- if B = 0 then
- spalte-=1
- else
- b -= 1
- end if
- locate zeile,spalte
- L = len(tzeile(zeile +A))
- if L >= spalte+B then
- tzeile(zeile+A) = left(tzeile(zeile+A),B + spalte-1) + right(tzeile(zeile+A),L -(spalte+B))
- else
- tzeile(zeile +A)=left(tzeile(zeile +A),len(tzeile(zeile +A))-1)
- end if
- else 'am zeilenanfang
- if zeile + A <= max(tzeile()) and zeile + A > 3 then
- spalte = len(tzeile(zeile +A -1)) +1
- redim preserve tzeile(ubound(tzeile) + 1)
- rest = tzeile(zeile + A)
- tzeile(zeile + A -1) = tzeile(zeile + A -1) + rest
- for x as integer = (zeile + A) TO max(tzeile())
- tzeile(x) = tzeile(x+1)
- next
- redim preserve tzeile(ubound(tzeile) -1)
- zeile -= 1
- end if
- if zeile +a > max(tzeile()) and zeile > 3 then
- zeile -= 1
- spalte = len(rtrim(tzeile(zeile + A)))+1
- end if
- if zeile = 3 and a > 0 then
- if A > 0 then A -= 1
- spalte = len(rtrim(tzeile(zeile+a)))+1
- end if
- pot_spalte = spalte
- end if
- case 13 'enter
- if L >= (spalte + b) and zeile >= 3 then
- redim preserve tzeile(ubound(tzeile) + 1)
- for x as integer = ubound(tzeile) to (zeile +a +1) step -1
- tzeile(x) = tzeile(x-1)
- next
- rest = right(tzeile(zeile +A), (L - (spalte + B))+1)
- tzeile(zeile+A) = left(tzeile(zeile+A), (Spalte +B) -1)
- tzeile(Zeile+A+1) = rest
- elseif zeile + a < max(tzeile()) and Len(ltrim(tzeile(zeile))) = 0 then
- redim preserve tzeile(ubound(tzeile) + 1)
- for x as integer = ubound(tzeile) to (zeile + a +1) step -1
- tzeile(x) = tzeile(x-1)
- next
- end if
- if zeile < (hoehe - 2) then
- zeile += 1
- spalte = 1
- B = 0
- else
- spalte = 1
- B = 0
- A += 1
- end if
- pot_spalte = spalte
- case 14
- seite = new_file
- cls
- #IFdef __fb_linux__
- case 127 'ENTF
- if L >= spalte + a then
- tzeile(zeile+A) = left(tzeile(zeile+A),B + spalte-1) + right(tzeile(zeile+A),L -(spalte+B))
- elseif L < spalte + a then
- redim preserve tzeile(ubound(tzeile) + 1)
- rest = tzeile(zeile + a +1)
- tzeile(zeile + a) = tzeile(zeile +a) + rest
- for x as integer = zeile+a+1 TO max(tzeile())
- tzeile(x) = tzeile(x+1)
- next
- redim preserve tzeile(ubound(tzeile) -1)
- end if
- if zeile + a > max(tzeile()) and L = 0 and zeile > 3 then
- zeile -= 1
- redim preserve tzeile(zeile + A)
- end if
- #endif
- '-----------------------------'
- case 18
- replace()
- case 19
- speichern()
- text(1)
- case 27 'escape
- exit do
- case 32 to 127,9,245, 132,142,148,153,129,154,225
- if ascL = 9 then
- D = string(4, " ")
- end if
- L = len(tzeile(zeile +A))
- if L >= spalte + B then
- if einf = 0 then
- MID(tzeile(zeile + A), spalte +B 1) = d
- else
- tzeile(zeile +A) = left(tzeile(zeile +A), spalte +B-1 -ba) + d + right(tzeile(zeile +A), (L - spalte -B +1))
- end if
- else
- tzeile(zeile +A) = tzeile(zeile +A) + d
- end if
- if spalte = breite then
- b += 1
- else
- spalte += 1
- end if
- if ascL = 9 then
- if spalte <= breite -4 then
- spalte += len(D) -1
- else
- B += len(D) -1 - (breite - spalte)
- end if
- end if
- pot_spalte = spalte + b
- end select
- end if
- cls
- loop
- end
Advertisement
Add Comment
Please, Sign In to add comment