Browse code

Correction

lorglas authored onFri/Apr/2020 11:0:th • GitHub committed onFri/Apr/2020 11:0:th
Showing5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,205 @@
1
+#!/boot/home/config/bin/yab
2
+
3
+window open 100,100 to 700,500, "MainView", "DrawWorld"
4
+
5
+// MainView
6
+draw set "highcolor", 0,0,0, "MainView"
7
+draw set "lowcolor", 235,235,235, "MainView"
8
+draw set "bgcolor", 235,235,235, "MainView"
9
+
10
+draw set 0, "HighSolidFill"
11
+if(peek$("os") = "Haiku") then
12
+        draw set "DejaVu Sans,Condensed Bold,48", "MainView"
13
+else
14
+	draw set "Zurich,Bold,48", "MainView"
15
+endif
16
+draw text 175,50, "DrawWorld", "MainView"
17
+
18
+button 510,370 to 590,390, "NextButton", "Next", "MainView"
19
+
20
+// Our drawing pad
21
+view 100,60 to 500,390, "DrawView", "MainView"
22
+draw set "highcolor", 0,0,0, "DrawView"
23
+draw set "lowcolor", 255,255,255, "DrawView"
24
+draw set "bgcolor", 255,255,255, "DrawView"
25
+
26
+// Dot and line
27
+draw set "Zurich,Bold,18", "DrawView"
28
+draw text 135,20, "Dot and Line", "DrawView"
29
+
30
+xold = 40
31
+yold = 260
32
+for a=10 to 720 step 10
33
+	x = 10+a*180/360
34
+	y = 230+60*sin(a*pi/180) 
35
+	draw line xold,yold to x,y, "DrawView"
36
+	xold = x + 30
37
+	yold = y + 30
38
+next a 
39
+
40
+for a = 0 to 720 step 10
41
+	x = 10+a*180/360
42
+	y = 100+60*sin(a*pi/180) 
43
+	draw dot x,y, "DrawView"
44
+next a 
45
+
46
+while(not instr(msg$,"NextButton"))
47
+	msg$ = message$
48
+	if(instr(msg$, "Quit")) then
49
+		window close "MainView"
50
+		end
51
+	endif
52
+	sleep 0.1
53
+wend
54
+msg$ = ""
55
+
56
+draw rect 0,0 to 400,330, "DrawView"
57
+draw flush "DrawView"
58
+draw set 1, "HighSolidFill"
59
+
60
+// Circle and ellipse
61
+draw set "Zurich,Bold,18", "DrawView"
62
+draw text 135,20, "Circle and Ellipse", "DrawView"
63
+
64
+// draw set 1, "LowSolidFill"
65
+draw circle 8,8, 36, "DrawView"
66
+draw set "highcolor", 50,0,245, "DrawView"
67
+draw set 0, "HighSolidFill"
68
+draw circle 70,70, 36, "DrawView"
69
+draw set "highcolor", 0,0,245, "DrawView"
70
+draw set 0, "HighSolidFill"
71
+draw circle 80,80, 36, "DrawView"
72
+draw set "highcolor", 50,0,245, "DrawView"
73
+draw set 0, "HighSolidFill"
74
+
75
+draw dot 70,70, "DrawView"
76
+draw line 72,70 to 105,70, "DrawView"
77
+draw line 105,70 to 100,65, "DrawView"
78
+draw line 105,70 to 100,75, "DrawView"
79
+draw text 85,68, "r", "DrawView"
80
+
81
+draw set "highcolor", 0,0,0, "DrawView"
82
+draw ellipse 210,70, 72, 36, "DrawView"
83
+draw set "highcolor", 0,0,245, "DrawView"
84
+draw dot 210,70, "DrawView"
85
+draw line 212,70 to 282,70, "DrawView"
86
+draw line 282,70 to 277,65, "DrawView"
87
+draw line 282,70 to 277,75, "DrawView"
88
+draw line 210,68 to 210,34, "DrawView"
89
+draw line 210,34 to 215,39, "DrawView"
90
+draw line 210,34 to 205,39, "DrawView"
91
+draw text 235,68, "rx", "DrawView"
92
+draw text 192,57, "ry", "DrawView"
93
+
94
+for i = 0 to 255 step 5
95
+	draw set "highcolor", i,0,0, "DrawView"
96
+	draw ellipse i+90, 230, 72-i/5, 36+i/5, "DrawView"
97
+next i
98
+draw set "highcolor", 0,0,0, "DrawView"
99
+
100
+
101
+while(not instr(msg$,"NextButton"))
102
+	msg$ = message$
103
+	if(instr(msg$, "Quit")) then
104
+		window close "MainView"
105
+		end
106
+	endif
107
+	sleep 0.1
108
+wend
109
+msg$ = ""
110
+
111
+draw rect 0,0 to 400,330, "DrawView"
112
+draw flush "DrawView"
113
+draw set "lowcolor", 255,255,255, "DrawView"
114
+draw set 1, "HighSolidFill"
115
+
116
+// Bezier curve
117
+draw set "Zurich,Bold,18", "DrawView"
118
+draw text 135,20, "Bezier Curve", "DrawView"
119
+
120
+draw set "highcolor", 50,50,250, "DrawView"
121
+draw circle 30,100, 3, "DrawView"
122
+draw circle 70,60, 3, "DrawView"
123
+draw circle 100,40, 3, "DrawView"
124
+draw circle 140,90, 3, "DrawView"
125
+draw line 30,100 to 70,60, "DrawView"
126
+draw line 70,60 to 100,40, "DrawView"
127
+draw line 100,40 to 140,90, "DrawView"
128
+draw set "highcolor", 0,0,0, "DrawView"
129
+draw curve 30,100, 70,60, 100,40, 140,90, "DrawView"
130
+
131
+draw set "highcolor", 50,50,250, "DrawView"
132
+draw circle 170,100, 3, "DrawView"
133
+draw circle 190,40, 3, "DrawView"
134
+draw circle 250,40, 3, "DrawView"
135
+draw circle 265,90, 3, "DrawView"
136
+draw line 170,100 to 190,40, "DrawView"
137
+draw line 190,40 to 250,40, "DrawView"
138
+draw line 250,40 to 265,90, "DrawView"
139
+draw set "highcolor", 0,0,0, "DrawView"
140
+draw curve 170,100, 190,40, 250,40, 265,90, "DrawView"
141
+
142
+draw set "highcolor", 50,50,250, "DrawView"
143
+draw circle 350,40, 3, "DrawView"
144
+draw circle 300,10, 3, "DrawView"
145
+draw circle 290,200, 3, "DrawView"
146
+draw circle 350,140, 3, "DrawView"
147
+draw line 350,40 to 300,10, "DrawView"
148
+draw line 300,10 to 290,200, "DrawView"
149
+draw line 290,200 to 350,140, "DrawView"
150
+draw set "highcolor", 0,0,0, "DrawView"
151
+draw set 0, "HighSolidFill"
152
+draw curve 350,40, 300,10, 290,200, 350,140, "DrawView"
153
+
154
+draw set 1, "HighSolidFill"
155
+draw curve 10,300, 120,100, 170,100, 390,300, "DrawView"
156
+
157
+while(not instr(msg$,"NextButton"))
158
+	msg$ = message$
159
+	if(instr(msg$, "Quit")) then
160
+		window close "MainView"
161
+		end
162
+	endif
163
+	sleep 0.1
164
+wend
165
+msg$ = ""
166
+
167
+draw rect 0,0 to 400,330, "DrawView"
168
+draw flush "DrawView"
169
+
170
+// Pattern
171
+draw set "Zurich,Bold,18", "DrawView"
172
+draw text 165,20, "Pattern", "DrawView"
173
+
174
+draw text 47,40, "HighSolidFill", "DrawView"
175
+draw text 247,40, "LowSolidFill", "DrawView"
176
+draw text 43,190, "CheckeredFill", "DrawView"
177
+draw text 247,190, "Userdefined", "DrawView"
178
+draw set "highcolor", 50,50,250, "DrawView"
179
+draw set "lowcolor", 250,50,50, "DrawView"
180
+draw set 0, "HighSolidFill"
181
+draw rect 40,50 to 160,130, "DrawView"
182
+draw set 0, "LowSolidFill"
183
+draw rect 240,50 to 360,130, "DrawView"
184
+draw set 0, "CheckeredFill"
185
+draw rect 40,200 to 160,280, "DrawView"
186
+pattern$ = "255239171199001199171239"
187
+draw set 0, pattern$
188
+draw rect 240,200 to 360,280, "DrawView"
189
+draw set 0, "255255255255255255255255"
190
+draw rect 40,50 to 160,130, "DrawView"
191
+
192
+draw set "highcolor", 0,0,0, "DrawView"
193
+draw set "lowcolor", 255,255,255, "DrawView"
194
+
195
+while(not instr(msg$,"NextButton"))
196
+	msg$ = message$
197
+	if(instr(msg$, "Quit")) then
198
+		window close "MainView"
199
+		end
200
+	endif
201
+	sleep 0.1
202
+wend
203
+
204
+window close "MainView"
205
+
... ...
@@ -2,6 +2,7 @@
2 2
 ## yab Haiku Makefile
3 3
 ##
4 4
 ## (c) Jan Bungeroth 2009 - 2012
5
+## (c) 2020 Lorenz Glaser (aka lorglas)
5 6
 ## Artistic License. 
6 7
 ##
7 8
 ## Use 
... ...
@@ -53,7 +54,7 @@ OPT = -O
53 54
 ##
54 55
 ## set libtrary name
55 56
 ##
56
-YABLIBRARY := libyab.so
57
+YABLIBRARY := libyab_1.7.8.so
57 58
 ##
58 59
 #
59 60
 
... ...
@@ -69,12 +70,13 @@ GPP_OPT = $(DBG) $(OPT) -I. -DHAVE_CONFIG -DUNIX $(HAIKUOPT)
69 70
 ## find out if we need to change the library to libyab_x86.so and use gcc instead of ld
70 71
 ifeq ($(USEDARCH), x86)
71 72
 	LD = gcc
72
-	YABLIBRARY:=libyab_x86.so
73
+	YABLIBRARY:=libyab_x86_1.7.8.so
73 74
 else
74 75
 	LD = ld
75 76
 endif
76 77
 ifeq ($(SYSTEMARCH),x86_64)
77 78
 	LD=gcc
79
+	YABLIBRARY:=libyab_1.7.8.so
78 80
 endif
79 81
 #
80 82
 
... ...
@@ -87,6 +87,7 @@ public:
87 87
 		#else
88 88
 			get_scroll_bar_info(&sbinfo);
89 89
 		#endif
90
+		
90 91
 	}
91 92
 	
92 93
 	~SpinnerPrivateData(void)
... ...
@@ -96,6 +97,7 @@ public:
96 97
 			exit_repeater=false;
97 98
 			kill_thread(repeaterid);
98 99
 		}
100
+		
99 101
 	}
100 102
 	thread_id repeaterid;
101 103
 	scroll_bar_info sbinfo;
... ...
@@ -160,7 +162,7 @@ Spinner::Spinner(BRect frame, const char *name, const char *label, int32 min, in
160 162
 		//fTextControl->SetDivider(width2+5);
161 163
 	//fTextControl->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_RIGHT);
162 164
 	BString string("QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,/qwertyuiop{}| "
163
-		"asdfghjkl:\"zxcvbnm<>?!@#$%^&*()-_=+`~\r");	
165
+		"asdfghjkl:\"zxcvbnm<>?!@#$%^&*()-_=+`~äöüÄÖÜß\r");	
164 166
 	
165 167
 	for(int32 i=0; i<string.CountChars(); i++)
166 168
 	{
... ...
@@ -245,12 +247,13 @@ void Spinner::ValueChanged(int32 value)
245 247
 void Spinner::MessageReceived(BMessage *msg)
246 248
 {
247 249
 	
248
-	if(msg->what==M_TEXT_CHANGED)
250
+	if(msg->what==M_TEXT_CHANGED) //
249 251
 	{
250 252
 		BString string(fTextControl->Text());
251 253
 		int32 newvalue=0;
252 254
 		
253
-		sscanf(string.String(),"%ld",&newvalue);
255
+		sscanf(string.String(),"%d",&newvalue); //change from %ld to %d | lorglas 11.02.2020
256
+		
254 257
 		if(newvalue>=GetMin() && newvalue<=GetMax())
255 258
 		{
256 259
 			// new value is in range, so set it and go
... ...
@@ -272,8 +275,7 @@ void Spinner::MessageReceived(BMessage *msg)
272 275
 				ValueChanged(Value());
273 276
 				
274 277
 			}
275
-			else
276
-			if(newvalue>GetMax() && Value()!=GetMax())
278
+			else if(newvalue>GetMax() && Value()!=GetMax())
277 279
 			{
278 280
 				SetValue(GetMax());
279 281
 				Invoke();
... ...
@@ -394,6 +396,7 @@ void SpinnerArrowButton::MouseDown(BPoint pt)
394 396
 		{
395 397
 			parent->privatedata->arrowdown=ARROW_DOWN;
396 398
 			newvalue-=step;
399
+			
397 400
 		}
398 401
 
399 402
 		if( newvalue>=parent->GetMin() && newvalue<=parent->GetMax())
... ...
@@ -401,6 +404,7 @@ void SpinnerArrowButton::MouseDown(BPoint pt)
401 404
 			// new value is in range, so set it and go
402 405
 			parent->SetValue(newvalue);
403 406
 			parent->Invoke();
407
+			
404 408
 //			parent->Draw(parent->Bounds());
405 409
 			parent->ValueChanged(parent->Value());
406 410
 		}
... ...
@@ -412,6 +416,7 @@ void SpinnerArrowButton::MouseDown(BPoint pt)
412 416
 			{
413 417
 				parent->SetValue(parent->GetMin());
414 418
 				parent->Invoke();
419
+			
415 420
 //				parent->Draw(parent->Bounds());
416 421
 				parent->ValueChanged(parent->Value());
417 422
 			}
... ...
@@ -420,11 +425,13 @@ void SpinnerArrowButton::MouseDown(BPoint pt)
420 425
 			{
421 426
 				parent->SetValue(parent->GetMax());
422 427
 				parent->Invoke();
428
+			
423 429
 //				parent->Draw(parent->Bounds());
424 430
 				parent->ValueChanged(parent->Value());
425 431
 			}
426 432
 			else
427 433
 			{
434
+				
428 435
 				// cases which go here are if new value is <minimum and value already at
429 436
 				// minimum or if > maximum and value already at maximum
430 437
 				return;
... ...
@@ -439,8 +446,8 @@ void SpinnerArrowButton::MouseDown(BPoint pt)
439 446
 
440 447
  		bool inside = bounds.Contains(point);
441 448
 			
442
-	//	if ((parent->Value() == B_CONTROL_ON) != inside)
443
-	//		parent->SetValue(inside ? B_CONTROL_ON : B_CONTROL_OFF);
449
+		//if ((parent->Value() == B_CONTROL_ON) != inside)
450
+		//	parent->SetValue(inside ? B_CONTROL_ON : B_CONTROL_OFF);
444 451
 		
445 452
 		if(waitvalue<=50000)
446 453
 			waitvalue=50000;
... ...
@@ -574,7 +581,8 @@ filter_result SpinnerMsgFilter::Filter(BMessage *msg, BHandler **target)
574 581
 						BString string(text->Text());
575 582
 						int32 newvalue=0;
576 583
 						
577
-						sscanf(string.String(),"%ld",&newvalue);
584
+						sscanf(string.String(),"%d",&newvalue); //change from %ld to %d | lorglas 11.02.2020
585
+						//printf("%d",newvalue);
578 586
 						if(newvalue!=spin->Value())
579 587
 						{
580 588
 							spin->SetValue(newvalue);
... ...
@@ -591,8 +599,8 @@ filter_result SpinnerMsgFilter::Filter(BMessage *msg, BHandler **target)
591 599
 		{
592 600
 			return B_DISPATCH_MESSAGE;	
593 601
 		}
594
-		/*
595
-		case B_TAB:
602
+		
603
+		/*case B_TAB:
596 604
 		{
597 605
 			// Cause Tab characters to perform keybaord navigation
598 606
 			BHandler *h=*target;
... ...
@@ -9027,11 +9027,13 @@ void YabInterface::SoundStop(int32) //Reactivate Sound Lorglas 2020.01.02
9027 9027
 
9028 9028
 void YabInterface::SoundWait(int32) //Reactivate Sound Lorglas 2020.01.03
9029 9029
 {	
9030
-	//Check, if fplayr is in Paused modus, if so Setpaused to false, so play again, if true fplayer paused 
9031
-	if (fPlayer->IsPaused()) {
9030
+	//Check, if fplayer is in Paused modus, if so Setpaused to false, so play again, if true fplayer paused 
9031
+	if (fPlayer->IsPaused()) 
9032
+	{
9032 9033
 		fPlayer->SetPaused(false, 0);	
9033 9034
 	}
9034
-	else {
9035
+	else 
9036
+	{
9035 9037
 		fPlayer->SetPaused(true, 0);
9036 9038
 	}
9037 9039
 }
... ...
@@ -10942,7 +10944,7 @@ int yi_MediaSound(const char* filename, YabInterface* yab)
10942 10944
 
10943 10945
 void yi_MediaSoundStop(int id,YabInterface* yab)
10944 10946
 {
10945
-	yab->MediaSoundStop(id);
10947
+	return yab->MediaSoundStop(id);
10946 10948
 }
10947 10949
 /*
10948 10950
 void yi_MediaSoundWait(int id, YabInterface* yab)
... ...
@@ -499,7 +499,7 @@ extern int yi_Sound(const char* filename, YabInterface* yab);
499 499
 extern void yi_SoundStop(int id, YabInterface* yab);
500 500
 extern void yi_SoundWait(int id, YabInterface* yab);
501 501
 extern int yi_MediaSound(const char* filename, YabInterface* yab);
502
-extern int yi_MediaSoundStop(int id, YabInterface* yab);
502
+extern void yi_MediaSoundStop(int id, YabInterface* yab);
503 503
 extern int yi_IsComputerOn(YabInterface* yab);
504 504
 extern void yi_ShortCut(const char* view, const char* key, const char* msg, YabInterface* yab);
505 505
 extern void yi_DrawSet4(const char* option, const char* color,const char* view, YabInterface* yab);