Lorenz Glaser authored onThu/Sep/2020 13:0:rd
Showing1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,533 @@
1
+#!/boot/home/config/bin/yab
2
+//localize
3
+
4
+##### Allgemeines ##### 
5
+
6
+Programmname$="HtmlEditor"
7
+Version$="1.0"
8
+Versionsdatum$="11.10.2006"
9
+Entwickler$="Christian Albrecht, Lorenz Glaser"
10
+Nickname$="Lelldorin, Lorglas"
11
+Url_Label$="BeSly Projects"
12
+Url_Text$="http://www.besly.de"
13
+
14
+##### Fensternamen #####
15
+Hpt_Fenster$=Programmname$
16
+Lade_Fenster$=""
17
+
18
+##### Bildschirmgröße #####
19
+B_Breite = peek("desktopwidth")
20
+B_Hoehe = peek("desktopheight")
21
+
22
+##### Fenstergröße #####
23
+
24
+F_Hoehe1=((B_Hoehe/2)-300)
25
+F_Hoehe2=((B_Hoehe/2)+300)
26
+
27
+F_Breite1=((B_Breite/2)-300)
28
+F_Breite2=((B_Breite/2)+300)
29
+
30
+F_minBreite=800
31
+F_maxBreite=800
32
+F_minHoehe=600
33
+F_maxHoehe=600
34
+
35
+##### Editor View Groesse #####
36
+
37
+Editor_Breite1=240
38
+Editor_Breite2= 790
39
+Editor_Hoehe1=120
40
+Editor_Hoehe2=590
41
+
42
+##### Texteditor Groesse #####
43
+
44
+TE_Breite1=5
45
+TE_Breite2=535
46
+TE_Hoehe1=30
47
+TE_Hoehe2=420
48
+
49
+##### Tab Optionen #####
50
+
51
+Opt_Breite1=240
52
+Opt_Breite2=790
53
+Opt_Hoehe1=30
54
+Opt_Hoehe2=110
55
+
56
+##### Tab Auswahl #####
57
+
58
+Sel_Breite1=10
59
+Sel_Breite2=230
60
+Sel_Hoehe1=120
61
+Sel_Hoehe2=590
62
+
63
+##### Listbox Programmiersprache Auswahl #####
64
+
65
+LB_HTML_Breite1=10
66
+LB_HTML_Breite2=200
67
+LB_HTML_Hoehe1=40
68
+LB_HTML_Hoehe2=420
69
+
70
+##### Programmverzeichnis ######
71
+
72
+Prg_Ordner$=""
73
+Gfx_Ordner$=""
74
+Hlp_Ordner$=""
75
+Sfx_Ordner$=""
76
+ProgrammierSprachenVerzeichnis$="/boot/home/Projekte/yab/Html_Editor/ProgrammierSprachen"
77
+##### Programmstart #####
78
+
79
+Prg_Fenster()
80
+
81
+################################	
82
+	
83
+	ProgrammierSprachen(ProgrammierSprachenVerzeichnis$)
84
+	
85
+	
86
+dim part$(1)
87
+
88
+inloop = true
89
+while(inloop)
90
+
91
+	msg$ = message$
92
+	
93
+	if (split(msg$, part$(), ":|") > 2) then
94
+		PartOne$=part$(1)
95
+		PartTwo$ = part$(2)
96
+		PartThree$ = part$(3)
97
+	fi
98
+	
99
+	if (split(msg$, part$(), ":|") > 3) then
100
+		PartFour$ = part$(4)
101
+	fi
102
+
103
+	if (msg$ <> "") print msg$
104
+
105
+	switch msg$
106
+	
107
+	case Hpt_Fenster$+":_QuitRequested|"
108
+		window close Hpt_Fenster$
109
+		window close "View_Ueber"
110
+		window close "View_Hilfe"
111
+	break
112
+	
113
+	case translate$(Hpt_Fenster$+":Program:Quit")+"|"
114
+		window close Hpt_Fenster$
115
+		window close "View_Ueber"
116
+		window close "View_Hilfe"
117
+	break
118
+	
119
+	case "Beenden_View_Ueber|"
120
+		window close "View_Ueber"
121
+	break
122
+	
123
+	case "Beenden_View_Hilfe|"
124
+		window close "View_Hilfe"
125
+	break
126
+
127
+	
128
+	
129
+	//Funktionen
130
+	
131
+	case "DB_Drives:"+PartTwo$+"|"
132
+		Drive_Selection$=PartTwo$
133
+		read_folders()
134
+	break
135
+	
136
+	case Programmname$+":View:Fullscreen|"
137
+		F_Hoehe1=0
138
+		F_Hoehe2=B_Hoehe
139
+
140
+		F_Breite1=0
141
+		F_Breite2=B_Breite
142
+
143
+		F_minBreite=800
144
+		F_maxBreite=B_Breite
145
+		F_minHoehe=600
146
+		F_maxHoehe=B_Hoehe
147
+		
148
+		Editor_Breite2=F_Breite2-20
149
+		Editor_Hoehe2=F_Hoehe2-20
150
+		
151
+		TE_Breite2=Editor_Breite2-255
152
+		TE_Hoehe2=Editor_Hoehe2-190
153
+		
154
+		Opt_Breite2=Editor_Breite2
155
+		
156
+		Sel_Hoehe2=Editor_Hoehe2
157
+		
158
+		LB_HTML_Hoehe2=TE_Hoehe2
159
+		
160
+		window close Hpt_Fenster$
161
+		Prg_Fenster()
162
+	break
163
+	
164
+	case Programmname$+":View:Default|"
165
+		F_Hoehe1=((B_Hoehe/2)-300)
166
+		F_Hoehe2=((B_Hoehe/2)+300)
167
+
168
+		F_Breite1=((B_Breite/2)-300)
169
+		F_Breite2=((B_Breite/2)+300)
170
+
171
+		F_minBreite=800
172
+		F_maxBreite=800
173
+		F_minHoehe=600
174
+		F_maxHoehe=600
175
+		
176
+		Editor_Breite2=790
177
+		Editor_Hoehe2=590
178
+		
179
+		TE_Breite2=535
180
+		TE_Hoehe2=420
181
+		
182
+		Opt_Breite2=790
183
+		
184
+		Sel_Hoehe2=590
185
+		
186
+		LB_HTML_Hoehe2=420
187
+		
188
+		window close Hpt_Fenster$
189
+		Prg_Fenster()
190
+	break
191
+	
192
+	case "CB_Files:_Invoke:"+PartThree$+"|"
193
+		dateiauswahl$=COLUMNBOX GET$ "CB_Files", 2, val(PartThree$)
194
+		print dateiauswahl$
195
+		DateiLaden()
196
+	break
197
+	
198
+	case "CB_Folders:_Invoke:"+PartThree$+"|"
199
+		foldername$=COLUMNBOX GET$ "CB_Folders", 2, val(PartThree$)
200
+		if(foldername$="..")then
201
+			VerzeichnisZurueck()
202
+		else
203
+			Drive_Selection$=Drive_Selection$+"/"+foldername$
204
+			read_folders()
205
+		endif
206
+	break
207
+	
208
+	case "DB_Language:"+PartTwo$+"|"
209
+		Auswahl$=PartTwo$
210
+		COLUMNBOX CLEAR "CB_HTML" //ColumnBox$
211
+		ProgrammierSprachenInhalt(Auswahl$)		
212
+	break
213
+	
214
+	default:
215
+
216
+	end switch
217
+
218
+	if(window count<1) inloop = false
219
+	sleep 0.1
220
+wend
221
+
222
+sub Prg_Fenster()
223
+	window open F_Breite1,F_Hoehe1 to F_Breite2,F_Hoehe2, Hpt_Fenster$, "BeSly Software "+Programmname$
224
+		window set Hpt_Fenster$, "MinimumTo", F_minBreite,F_minHoehe
225
+		window set Hpt_Fenster$, "MaximumTo", F_maxBreite,F_maxHoehe
226
+		WINDOW SET Hpt_Fenster$, "Flags", "not-zoomable"
227
+		
228
+	menu "Program", translate$("About"), "", Hpt_Fenster$
229
+	menu "Program", translate$("Help"), "", Hpt_Fenster$
230
+	menu "Program", translate$("Documentation"), "", Hpt_Fenster$
231
+	menu "Program", translate$("Options"), "", Hpt_Fenster$
232
+	menu "Program", translate$("Quit"), "", Hpt_Fenster$
233
+	menu "View", translate$("Fullscreen"), "", Hpt_Fenster$
234
+	menu "View", translate$("Default"), "", Hpt_Fenster$
235
+	
236
+	TABVIEW Sel_Breite1,Sel_Hoehe1 TO Sel_Breite2,Sel_Hoehe2, "Tab_Selection", "bottom", Hpt_Fenster$
237
+		TABVIEW ADD "Tab_Selection", "File"
238
+			DROPBOX 4,10 TO 125,20, "DB_Drives", "", "Tab_Selection1"
239
+				DROPBOX ADD "DB_Drives", "Select Drive"
240
+				DROPBOX ADD "DB_Drives", "--"
241
+			COLUMNBOX 10,40 TO 200,200, "CB_Folders",true, "movable", "Tab_Selection1"
242
+				COLUMNBOX COLUMN "CB_Folders", "__Icon__", 1, 60, 20, 20, "align-left"
243
+				COLUMNBOX COLUMN "CB_Folders", "Name", 2, 60, 200, 20, "align-left"			
244
+			COLUMNBOX 10,220 TO 200,420, "CB_Files",true, "movable", "Tab_Selection1"
245
+				COLUMNBOX COLUMN "CB_Files", "__Icon__", 1, 60, 20, 20, "align-left"
246
+				COLUMNBOX COLUMN "CB_Files", "Name", 2, 60, 200, 20, "align-left"
247
+		TABVIEW ADD "Tab_Selection", "Code"
248
+			DROPBOX 4,10 TO 125,20, "DB_Language", "", "Tab_Selection2"
249
+			DROPBOX ADD "DB_Language", "Select Language"
250
+				DROPBOX ADD "DB_Language", "--"	
251
+			COLUMNBOX LB_HTML_Breite1,LB_HTML_Hoehe1 TO LB_HTML_Breite2,LB_HTML_Hoehe2, "CB_HTML", true, "movable", "Tab_Selection2"
252
+				columnbox column "CB_HTML", "__Icon__", 1, 60, 20, 20, "align-left"
253
+				columnbox column "CB_HTML", "Name", 2, 60, 200, 20, "align-left"
254
+
255
+	TABVIEW Opt_Breite1,Opt_Hoehe1 TO Opt_Breite2,Opt_Hoehe2, "Tab_Options", "top", Hpt_Fenster$
256
+		TABVIEW ADD "Tab_Options", "Frames" 
257
+		TABVIEW ADD "Tab_Options", "Tables" 
258
+		TABVIEW ADD "Tab_Options", "Fonts"
259
+		TABVIEW ADD "Tab_Options", "Images"  
260
+	
261
+	TABVIEW Editor_Breite1, Editor_Hoehe1 TO Editor_Breite2,Editor_Hoehe2, "Tab_Editor", "bottom", Hpt_Fenster$
262
+		TABVIEW ADD "Tab_Editor", "Default" 		
263
+		TEXTEDIT TE_Breite1,TE_Hoehe1 TO TE_Breite2,TE_Hoehe2, "editor", 3, "Tab_Editor1"
264
+			TEXTEDIT COLOR "editor", "char-color", "<"
265
+			TEXTEDIT COLOR "editor", "char-color", ">"
266
+			TEXTEDIT COLOR "editor", "char-color", "="
267
+			TEXTEDIT COLOR "editor", "char-color", "/"
268
+			TEXTEDIT COLOR "editor", "char-color", "#"
269
+			TEXTEDIT COLOR "editor", "char-color", "<?"
270
+			TEXTEDIT COLOR "editor", "char-color", "?>"
271
+	read_drives()
272
+	
273
+	
274
+	
275
+end sub
276
+
277
+
278
+
279
+sub ueber()
280
+	REM ###### Fenstergröße #######
281
+	
282
+	F_Hoehe_Ueber1=((B_Hoehe/2)-100)
283
+	F_Hoehe_Ueber2=((B_Hoehe/2)+100)
284
+	
285
+	F_Breite_Ueber1=((B_Breite/2)-100)
286
+	F_Breite_Ueber2=((B_Breite/2)+100)
287
+	
288
+	window open F_Breite_Ueber1,F_Hoehe_Ueber1 to F_Breite_Ueber2,F_Hoehe_Ueber2, "View_Ueber", "About"
289
+		window set "View_Ueber", "MinimumTo", 260,200
290
+		window set "View_Ueber", "MaximumTo", 260,200
291
+		window set "View_Ueber", "look", "modal"
292
+		
293
+	draw text 10, 20, Programmname$, "View_Ueber"
294
+	draw text 10, 60, translate$("Version/Date: ")+Version$+" / "+Versionsdatum$, "View_Ueber"
295
+	draw text 10, 80, translate$("Developer: ")+Entwickler$, "View_Ueber"
296
+	draw text 10, 100, translate$("Nickname: ")+Nickname$, "View_Ueber"
297
+	draw text 10, 120, translate$("Webside: "), "View_Ueber"
298
+	texturl 90,112, "", Url_Label$, Url_Text$, "View_Ueber"
299
+	BUTTON 80,160 TO 180,180, "Beenden_View_Ueber", translate$("Schließen"), "View_Ueber"
300
+end sub
301
+
302
+sub hilfe()
303
+	REM ###### Fenstergröße #######
304
+	
305
+	F_Hoehe_Hilfe1=((B_Hoehe/2)-150)
306
+	F_Hoehe_Hilfe2=((B_Hoehe/2)+150)
307
+	
308
+	F_Breite_Hilfe1=((B_Breite/2)-150)
309
+	F_Breite_Hilfe2=((B_Breite/2)+150)
310
+	
311
+	window open F_Breite_Hilfe1,F_Hoehe_Hilfe1 to F_Breite_Hilfe2,F_Hoehe_Hilfe2, "View_Hilfe", "Help"
312
+		window set "View_Hilfe", "MinimumTo", 300,300
313
+		window set "View_Hilfe", "MaximumTo", 300,300
314
+		window set "View_Hilfe", "look", "modal"		
315
+		
316
+	BUTTON 100,260 TO 200,280, "Beenden_View_Hilfe", translate$("Close"), "View_Hilfe"
317
+end sub
318
+
319
+sub read_drives()
320
+	rDrives$=system$("ls -G -1 /")	
321
+	dim SplitDrives$(1)
322
+	rda=0
323
+	rdb=0
324
+	rda = split(rDrives$, SplitDrives$(), "\n")            
325
+	for rdb = 1 to rda-1
326
+		dropbox add "DB_Drives", SplitDrives$(rdb)
327
+	next rdb
328
+end sub
329
+
330
+			
331
+sub read_folders()
332
+	COLUMNBOX CLEAR "CB_Files"
333
+	COLUMNBOX CLEAR "CB_Folders"
334
+	COLUMNBOX ADD "CB_Folders", 2, 1, 15, ".."
335
+	x=1
336
+	dim SplitFolderEntrys$(1)
337
+	CheckFolderEntrys$=system$("ls -1 /"+"\""+Drive_Selection$+"\"")
338
+	entrys=split(CheckFolderEntrys$, SplitFolderEntrys$(), "\n")
339
+	
340
+	dim SplitEntrys$(1)
341
+	for look = 2 to entrys
342
+		x=x+1
343
+		Folder$="/"+Drive_Selection$+"/"+SplitFolderEntrys$(x)
344
+		CheckFolder$=system$("ls -allAd "+"\""+Folder$+"\"")
345
+		g = split(CheckFolder$, SplitEntrys$(), " ")
346
+		if(mid$(SplitEntrys$(1),1,1)="-")then
347
+			columnbox add "CB_Files", 1, x, 15, "__Path__="+SplitFolderEntrys$(x)
348
+			COLUMNBOX ADD "CB_Files", 2, x, 15, SplitFolderEntrys$(x)
349
+		elseif(mid$(SplitEntrys$(1),1,1)="d")then
350
+			COLUMNBOX ADD "CB_Folders", 2, x, 15, SplitFolderEntrys$(x)
351
+		elseif(mid$(SplitEntrys$(1),1,1)="l")then
352
+		endif
353
+	next look
354
+end sub
355
+
356
+sub DateiLaden()
357
+	auslesen=open("/"+Drive_Selection$+"/"+dateiauswahl$, "r")
358
+	x=0
359
+	StatusLeisteAufbau()
360
+	while (not EOF(auslesen))
361
+   		x=x+1
362
+		dim FileLoad$(x)
363
+   	 	line input #auslesen b$
364
+		FileLoad$(x)=b$		
365
+		statusleiste(x)
366
+	wend
367
+	close(auslesen)
368
+	Dateigroesse=x
369
+	print "Dateigroesse "+str$(Dateigroesse)
370
+	//ladebalken()
371
+	WINDOW CLOSE "View_Ladebalken"
372
+end sub
373
+sub StatusLeisteAufbau() 
374
+	F_Hoehe_Ueber1=((B_Hoehe/2)-100)
375
+	F_Hoehe_Ueber2=((B_Hoehe/2)+100)
376
+	
377
+	F_Breite_Ueber1=((B_Breite/2)-200)
378
+	F_Breite_Ueber2=((B_Breite/2)+200)
379
+	
380
+	window open F_Breite_Ueber1,F_Hoehe_Ueber1 to F_Breite_Ueber2,F_Hoehe_Ueber2, "View_Ladebalken", "xxx"
381
+		window set "View_Ladebalken", "MinimumTo", 400,200
382
+		window set "View_Ladebalken", "MaximumTo", 400,200
383
+		window set "View_Ladebalken", "look", "modal"
384
+	
385
+	view 20,60 to 380,180, "DrawView", "View_Ladebalken"
386
+		draw set "BgColor", 255,255,255, "DrawView"
387
+ 		draw set "HighColor", 108,166,205,"DrawView"
388
+		draw set 0, "HighSolidFill"
389
+		
390
+	//STATUSBAR 10, 40 to 360, 80, "ID$", "Label1$", "Label2$", "DrawView"
391
+	
392
+end sub
393
+sub statusleiste(x)
394
+	draw set "highcolor", 0,0,0, "DrawView"	
395
+	draw set 1, "HighSolidFill"
396
+	draw circle 50,50, 41, "DrawView"
397
+	draw set "highcolor", 0,0,245, "DrawView"
398
+
399
+	radius=radius+0.125	
400
+	draw line 50,50 to 50+cos(radius)*40,50+sin(radius)*40, "DrawView"
401
+	//print radius
402
+	if (radius=360) then
403
+		radius=0
404
+	endif	
405
+	TEXTEDIT ADD "editor", FileLoad$(x)
406
+		TEXTEDIT ADD "editor", "\n"
407
+	//STATUSBAR SET "ID$", "Label1$", "Label2$", x
408
+	wait 0.01
409
+	DRAW FLUSH "DrawView"
410
+end sub
411
+sub ladebalken()
412
+	F_Hoehe_Ueber1=((B_Hoehe/2)-100)
413
+	F_Hoehe_Ueber2=((B_Hoehe/2)+100)
414
+	
415
+	F_Breite_Ueber1=((B_Breite/2)-200)
416
+	F_Breite_Ueber2=((B_Breite/2)+200)
417
+	
418
+	window open F_Breite_Ueber1,F_Hoehe_Ueber1 to F_Breite_Ueber2,F_Hoehe_Ueber2, "View_Ladebalken", "xxx"
419
+		window set "View_Ladebalken", "MinimumTo", 400,200
420
+		window set "View_Ladebalken", "MaximumTo", 400,200
421
+		window set "View_Ladebalken", "look", "modal"
422
+	
423
+	view 20,60 to 380,180, "DrawView", "View_Ladebalken"
424
+		draw set "BgColor", 255,255,255, "DrawView"
425
+ 		draw set "HighColor", 108,166,205,"DrawView"
426
+		draw set 0, "HighSolidFill"
427
+		
428
+	STATUSBAR 10, 40 to 360, 80, "ID$", "Label1$", "Label2$", "DrawView"
429
+	STATUSBAR SET "ID$", "Label1$", "Label2$", x
430
+		//BalkenPosition=0
431
+	//	TextLadebalken$="loading document"
432
+	//	TextLadebalken=len(TextLadebalken$) 
433
+	//	draw text (160-(TextLadebalken/2)), 15, TextLadebalken$, "DrawView"		
434
+	//	Prozent=Dateigroesse/100
435
+	//	print Prozent
436
+	//	BalkenPosition=(Prozent*360)/100
437
+	//	print BalkenPosition
438
+		//TeilBalken=BalkenPosition/3.6
439
+	//  schleife=360/BalkenPosition
440
+	//	print schleife
441
+	//	z=1
442
+	//for Balken=1 to schleife		
443
+	//	TeilBalken=BalkenPosition*Balken
444
+	//	draw rect 0,0 to TeilBalken,20, "DrawView"
445
+	//	//wait 0.1
446
+	//	z=z+1
447
+	//	print z	
448
+	//	print TeilBalken	
449
+	//next Balken
450
+	for size=1 to Dateigroesse			
451
+		//ProzentSize=(size*100)/320
452
+		//BalkenPosition=(320*ProzentSize)/100
453
+		TEXTEDIT ADD "editor", FileLoad$(size)
454
+		TEXTEDIT ADD "editor", "\n"
455
+	next size	
456
+	
457
+	DRAW FLUSH "DrawView"
458
+	TextLadebalken$="ready!"
459
+	TextLadebalken=len(TextLadebalken$)
460
+	WINDOW CLOSE "View_Ladebalken"
461
+	end sub
462
+
463
+sub VerzeichnisZurueck()
464
+	SizeFolderString=0
465
+	BackFolder=0
466
+	SizeFoldername=0
467
+	dim FolderBack$(1)
468
+	SizeFolderString=len(Drive_Selection$)
469
+	BackFolder=split(Drive_Selection$, FolderBack$(), "/")
470
+	SizeFoldername=len(FolderBack$(BackFolder))
471
+	BackDriveName$=left$(Drive_Selection$, (SizeFolderString-(SizeFoldername+1)))
472
+	if(BackDriveName$="")then
473
+		read_folders()
474
+	else
475
+		Drive_Selection$=BackDriveName$
476
+		read_folders()
477
+	endif
478
+end sub
479
+
480
+sub ProgrammierSprachen(ProgrammierSprachenVerzeichnis$)				
481
+				verzeichnisinhalt$=system$("ls -QA "+"\""+ProgrammierSprachenVerzeichnis$+"\"")
482
+				print verzeichnisinhalt$
483
+				dim splitdir_li$(1)
484
+				n = split(verzeichnisinhalt$, splitdir_li$(), "\n")
485
+					i=0
486
+				b_li$="\""
487
+				       
488
+				//dateiname anzeigen     
489
+				for i = 1 to n-1					
490
+				 	posname_li=instr(splitdir_li$(i),b_li$,1)		 
491
+		 			dateiname_li$=mid$(splitdir_li$(i),posname_li+1)
492
+		 			posname_ende_li=len(dateiname_li$)
493
+			 	    dateiname_ohne_li$=left$(dateiname_li$,posname_ende_li-1)
494
+			 	   // print dateiname_ohne_li$			
495
+				DROPBOX ADD "DB_Language", dateiname_ohne_li$			
496
+				next i
497
+end sub
498
+sub ProgrammierSprachenInhalt(Auswahl$)
499
+	ir=0
500
+	xt=0
501
+	az=0	
502
+	DateiAuswahl$=ProgrammierSprachenVerzeichnis$+"/"+Auswahl$
503
+	auslesen=open(DateiAuswahl$, "r")
504
+
505
+	while (not EOF(auslesen))
506
+		line input #auslesen b$
507
+		dim elements$(1)
508
+		numElements = split(b$, elements$(),";")
509
+		for ir = 1 to numElements
510
+			xt=xt+1
511
+			dim d$(xt)
512
+			d$(xt) = elements$(ir)
513
+			print d$(xt)
514
+		next ir
515
+	wend
516
+	close(auslesen)
517
+		anzahlspalten=numElements
518
+		
519
+	if (anzahlspalten<1) then
520
+		anzahlzeilen=0
521
+	else
522
+		anzahlzeilen=xt/anzahlspalten
523
+	endif
524
+	print anzahlzeilen
525
+	if (anzahlzeilen>0) then
526
+		for az = 1 to anzahlzeilen			
527
+			//COLUMNBOX ADD ColumnBox$, Column, Row, Height, Item$
528
+			columnbox ADD "CB_HTML", 2, az, 20, d$(az) 			
529
+		next az	
530
+	else
531
+			columnbox ADD "CB_HTML", 2, 1, 20, "Keine Inhalte vorhanden"
532
+	endif
533
+end sub