Browse code

see Changelog in documentation folder

lorglas authored onWed/Jul/2020 05:0:th • Lorenz Glaser committed onMon/Aug/2020 12:0:th
Showing24 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,295 @@
1
+#!/boot/home/config/bin/yab
2
+
3
+screenWidth = peek("desktopwidth")
4
+screenHeight = peek("desktopheight")
5
+halfscreen_width=screenWidth/2
6
+halfscreen_height=screenHeight/2
7
+window_width_half=400
8
+window open (halfscreen_width-window_width_half),(halfscreen_height-300) to  (halfscreen_width+window_width_half),(halfscreen_height+300), "Main", "Changes in yab 1.7.9"
9
+WINDOW SET "Main", "Flags", "Not-Resizable"
10
+
11
+
12
+x = peek("menuheight")
13
+tabview 0,0 to WINDOW GET "Main", "Width",(WINDOW GET "Main", "Height")-10, "Tab", "Bottom", "Main"
14
+TABVIEW ADD "Tab", "Columbox"
15
+TABVIEW ADD "Tab", "Textcontrol"
16
+TABVIEW ADD "Tab", "Textedit"
17
+TABVIEW ADD "Tab", "Texturl"
18
+TABVIEW ADD "Tab","Sound"
19
+
20
+// on the 1 Tab
21
+draw text 10,15 ,upper$("Demonstration Columnbox sorting"), "Tab1"
22
+x=0
23
+i=0
24
+d=0
25
+COLUMNBOX 10,40 TO (View GET "Tab", "width")-20,(View GET "Tab", "Height")-310, "testcolumn", true, "movable, resizable, popup, removable", "Tab1"
26
+COLUMNBOX COLUMN "testcolumn", "ID", 1, 20, 20, 20, "align-center"
27
+COLUMNBOX COLUMN "testcolumn", "Customer", 2, 100, 50, 150, "align-left"
28
+COLUMNBOX COLUMN "testcolumn", "Price", 3, 100, 50, 150, "align-right"
29
+COLUMNBOX ADD "testcolumn", 1, 1, 20,"1" 
30
+COLUMNBOX ADD "testcolumn", 2, 1, 20,"Harry" 
31
+COLUMNBOX ADD "testcolumn", 3, 1, 20,"33.33" 
32
+COLUMNBOX ADD "testcolumn", 1, 2, 20,"2" 
33
+COLUMNBOX ADD "testcolumn", 2, 2, 20,"Sally" 
34
+COLUMNBOX ADD "testcolumn", 3, 2, 20,"56.31" 
35
+COLUMNBOX ADD "testcolumn", 1, 3, 20,"3" 
36
+COLUMNBOX ADD "testcolumn", 2, 3, 20,"Wilhelm" 
37
+COLUMNBOX ADD "testcolumn", 3, 3, 20,"8.83" 
38
+COLUMNBOX ADD "testcolumn", 1, 4, 20,"4" 
39
+COLUMNBOX ADD "testcolumn", 2, 4, 20,"Shake" 
40
+COLUMNBOX ADD "testcolumn", 3, 4, 20,"18.83" 
41
+
42
+textedit 10,300 to (View GET "Tab", "width")-20,(View GET "Tab", "Height")-40, "ausgabe1", 1, "Tab1"
43
+textedit add "ausgabe1","COLUMNBOX 10,40 TO (View GET \"Tab\", \"width\")-20,(View GET \"Tab\", \"Height\")-310, \"testcolumn\", true, \"movable, resizable, popup, removable\", \"Tab1\"\n"
44
+textedit add "ausgabe1","COLUMNBOX COLUMN \"testcolumn\", \"ID\", 1, 20, 20, 20, \"align-center\"\n"
45
+textedit add "ausgabe1","COLUMNBOX COLUMN \"testcolumn\", \"Customer\", 2, 100, 50, 150, \"align-left\"\n"
46
+textedit add "ausgabe1","COLUMNBOX COLUMN \"testcolumn\", \"Price\", 3, 100, 50, 150, \"align-right\"\n"
47
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 1, 1, 20,\"1\"\n" 
48
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 2, 1, 20,\"Harry\"\n" 
49
+textedit add "ausgabe1","OLUMNBOX ADD \"testcolumn\", 3, 1, 20,\"33.33\"\n" 
50
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 1, 2, 20,\"2\"\n" 
51
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 2, 2, 20,\"Sally\"\n" 
52
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 3, 2, 20,\"56.31\"\n" 
53
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 1, 3, 20,\"3\"\n" 
54
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 2, 3, 20,\"Wilhelm\"\n" 
55
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 3, 3, 20,\"8.83\"\n" 
56
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 1, 4, 20,\"4\"\n" 
57
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 2, 4, 20,\"Shake\"\n" 
58
+textedit add "ausgabe1","COLUMNBOX ADD \"testcolumn\", 3, 4, 20,\"18.83\"\n" 
59
+// on the 2 Tab
60
+
61
+draw text 10,15 ,"TEXTCONTROL WITH / WITHOUT LABEL", "Tab2"
62
+textcontrol 10,20 to 300,40, "ID", "Label","with Label", "Tab2"
63
+textcontrol 10,50 to 300,70, "ID", "","without Label","Tab2"
64
+textcontrol 10,80 to 300,100, "ID", "Label1","with Label", "Tab2"
65
+textcontrol 10,110 to 300,130, "ID", "Label and Label","with Label","Tab2"
66
+textcontrol 10,140 to 300,160, "ID", "","without Label","Tab2"
67
+textcontrol 10,170 to 300,190, "ID-right", "Label and Label","with Label align right","Tab2"
68
+textcontrol 10,200 to 300,220, "ID-right1", "","without Label align right","Tab2"
69
+textcontrol 10,230 to 300,250, "ID-center", "Label and Label","with Label align center","Tab2"
70
+textcontrol 10,260 to 300,290, "ID-center1", "","without Label align center","Tab2"
71
+TEXTCONTROL SET "ID-right", "align", "right"
72
+TEXTCONTROL SET "ID-right1", "align", "right"
73
+TEXTCONTROL SET "ID-center", "align", "center"
74
+TEXTCONTROL SET "ID-center1", "align", "center"
75
+
76
+textedit 10,300 to (View GET "Tab", "width")-20,(View GET "Tab", "Height")-40, "ausgabe2", 1, "Tab2"
77
+textedit add "ausgabe2","textcontrol 10,20 to 300,40, \"ID\", \"Label\",\"with Label\", \"Tab2\"\n"
78
+textedit add "ausgabe2","textcontrol 10,50 to 300,70, \"ID\", \"\",\"without Label\", \"Tab2\"\n"
79
+textedit add "ausgabe2","textcontrol 10,80 to 300,100, \"ID\", \"Label1\",\"with Label\", \"Tab2\"\n"
80
+textedit add "ausgabe2","textcontrol 10,110 to 300,130, \"ID\", \"Label and Label\",\"with Label\", \"Tab2\"\n"
81
+textedit add "ausgabe2","textcontrol 10,140 to 300,160, \"ID\", \"\",\"without Label\", \"Tab2\"\n"
82
+textedit add "ausgabe2","textcontrol 10,170 to 300,190, \"ID-right\", \"Label and Label\",\"with Label align right\",\"Tab2\"\n"
83
+textedit add "ausgabe2","textcontrol 10,200 to 300,220, \"ID-right1\", \"\",\"without Label align right\",\"Tab2\"\n"
84
+textedit add "ausgabe2","textcontrol 10,230 to 300,250, \"ID-center\", \"Label and Label\",\"with Label align center\",\"Tab2\"\n"
85
+textedit add "ausgabe2","textcontrol 10,260 to 300,290, \"ID-center1\", \"\",\"without Label align center\",\"Tab2\"\n"
86
+textedit add "ausgabe2","TEXTCONTROL SET \"ID-right\", \"align\", \"right\",\"Tab2\"\n"
87
+textedit add "ausgabe2","TEXTCONTROL SET \"ID-right1\", \"align\", \"right\",\"Tab2\"\n"
88
+textedit add "ausgabe2","TEXTCONTROL SET \"ID-center\", \"align\", \"center\",\"Tab2\"\n"
89
+textedit add "ausgabe2","TEXTCONTROL SET \"ID-center1\", \"align\", \"center\",\"Tab2\""
90
+
91
+// on the 3 Tab
92
+draw text 10,15 ,"TEXTEDIT align left/center/right", "Tab3"
93
+textedit 10,40 to (View GET "Tab", "width")-20,100, "test-left", 1, "Tab3"
94
+TEXTEDIT SET "test-left", "align", "left"
95
+textedit add "test-left","This is the test text align left\n"
96
+textedit 10,110 to (View GET "Tab", "width")-20,170, "test-center", 1, "Tab3"
97
+TEXTEDIT SET "test-center", "align", "center"
98
+textedit add "test-center","This is the test text  align center\n"
99
+textedit 10,180 to (View GET "Tab", "width")-20,240,"test-right", 1, "Tab3"
100
+TEXTEDIT SET "test-right", "align", "right"
101
+textedit add "test-right","This is the test text  align right\n"
102
+
103
+textedit 10,300 to (View GET "Tab", "width")-20,(View GET "Tab", "Height")-40, "ausgabe3", 1, "Tab3"
104
+textedit add "ausgabe3","textedit 10,40 to (View GET \"Tab\", \"width\")-20,100, \"test-left\", 1, \"Tab3\"\n"
105
+textedit add "ausgabe3","TEXTEDIT SET \"test-left\", \"align\", \"left\"\n"
106
+textedit add "ausgabe3","textedit add \"test-left\",\"This is the test text align left\\n\"\n"
107
+textedit add "ausgabe3","textedit 10,110 to (View GET \"Tab\", \"width\")-20,170, \"test-center\", 1, \"Tab3\"\n"
108
+textedit add "ausgabe3","TEXTEDIT SET \"test-center\", \"align\", \"center\"\n"
109
+textedit add "ausgabe3","textedit add \"test-center\",\"This is the test text  align center\\n\"\n"
110
+textedit add "ausgabe3","textedit 10,180 to (View GET \"Tab\", \"width\")-20,240,\"test-right\", 1, \"Tab3\"\n"
111
+textedit add "ausgabe3","TEXTEDIT SET \"test-right\", \"align\", \"right\"\n"
112
+textedit add "ausgabe3","textedit add \"test-right\",\"This is the test text  align right\\n\"\n"
113
+
114
+// on the 4 Tab
115
+draw text 10,15 ,"TEXTURL without duplication on mouseover", "Tab4"
116
+texturl 10,50, "email","mailto: xyz@ddd.de", "xyz@ddd.de",  "Tab4"
117
+texturl 10,90, "file","file://www.besly.de", "file://www.besly.de",  "Tab4"
118
+texturl 10,130, "https","https://software.besly.de", "https://software.besly.de",  "Tab4"
119
+texturl 10,170, "http","http://www.besly.de", "http://www.besly.de",  "Tab4"
120
+texturl 10,210, "ftp","ftp://www.besly.de", "ftp://www.besly.de",  "Tab4"
121
+
122
+textedit 10,300 to (View GET "Tab", "width")-20,(View GET "Tab", "Height")-40, "ausgabe5", 1, "Tab4"
123
+textedit add "ausgabe5","texturl 10,50, \"email\",\"mailto: xyz@ddd.de\", \"xyz@ddd.de\",  \"Tab4\"\n"
124
+textedit add "ausgabe5","texturl 10,90, \"file\",\"file://www.besly.de\", \"file://www.besly.de\",  \"Tab4\"\n"
125
+textedit add "ausgabe5","texturl 10,130, \"https\",\"https://www.besly.de\", \"https://www.besly.de\",  \"Tab4\"\n"
126
+textedit add "ausgabe5","texturl 10,170, \"https\",\"http://www.besly.de\", \"http://www.besly.de\",  \"Tab4\"\n"
127
+textedit add "ausgabe5","texturl 10,210, \"ftp\",\"ftp://www.besly.de\", \"ftp://www.besly.de\",  \"Tab4\"\n"
128
+
129
+// on the 5 Tab
130
+//Sound
131
+
132
+Button 20,10 to 200,30, "start","Playsound Start","Tab5"
133
+Button 20,40 to 200,60, "stop","Playsound Stop","Tab5"
134
+Button 20,70 to 200,90, "pause","Playsound Pause / Continue","Tab5"
135
+
136
+Button 20,100 to 200,120, "start_Media","MediaSound Start","Tab5"
137
+Button 20,130 to 200,150, "stop_Media","MediaSound Stop","Tab5"
138
+//tooltip "start_Media", "testetxt"
139
+//tooltipnew "start_Media" , "testetxt" ,"lowcolor", 255,255,255
140
+textedit 10,300 to (View GET "Tab", "width")-20,(View GET "Tab", "Height")-40, "ausgabe9", 1, "Tab5"
141
+//textedit 10,200 to 460,380, "ausgabe9", 3, "Tab5"
142
+textedit add "ausgabe9","case \"start|\"\n"
143
+textedit add "ausgabe9","  ID= SOUND PLAY \"yab_testsong.mp3\", 1\n"
144
+textedit add "ausgabe9","  IF sound is playing, you get 1 back, so you can use for the stop command. \n"				
145
+textedit add "ausgabe9","break\n"
146
+textedit add "ausgabe9","case \"stop|\n"
147
+textedit add "ausgabe9","  SOUND STOP ID\n"		
148
+textedit add "ausgabe9","break \n"
149
+textedit add "ausgabe9","case \"pause|\"\n"
150
+textedit add "ausgabe9","  SOUND WAIT ID \n Sound wait works, but with my soundcard i get a brumm signal. maybe on other soundcard is nothing or is a Haiku problem.\n"
151
+textedit add "ausgabe9","break\n"
152
+textedit add "ausgabe9","MEDIASOUND you must wait a little before you hear the stream\"\n"	
153
+textedit add "ausgabe9","  ID = MEDIASOUND play \"https://swr-edge-10b8-fra-dtag-cdn.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3\"\n"				
154
+textedit add "ausgabe9","break\n"
155
+textedit add "ausgabe9","case \"stop|\n"
156
+textedit add "ausgabe9","  MEDIASOUND STOP ID\n"		
157
+textedit add "ausgabe9","break \n"
158
+textedit add "ausgabe9","//If you click MEDIASOUND STOP  twice, the program breaks, because there is a little bug in my code. I'am working on this issue. \n"
159
+
160
+//-------------------------------------
161
+	dim mouse$(1)
162
+	dim part$(1)
163
+	inloop = true
164
+	while(inloop)
165
+
166
+		msg$ = message$
167
+
168
+		if (split(msg$, part$(), ":|") > 2) then
169
+			PartTwo$ = part$(2)
170
+			PartThree$ = part$(3)
171
+	         fi
172
+
173
+		if (msg$ <> "") print msg$
174
+			switch (msg$)
175
+
176
+				case "Main:_QuitRequested|":
177
+					window close "Main"
178
+					//window close "View"
179
+				break
180
+
181
+				case "Quit|"
182
+					window close "Main"
183
+				break
184
+
185
+				case "View:Spiel:Beenden|"
186
+				        window close "Main"
187
+				break
188
+				case ":_Select:"+PartThree$+"|"
189
+					eintragnummer=val(PartThree$)
190
+					print eintragnummer					
191
+				         rechte_seite(eintragnummer)				
192
+				break
193
+				case "tabdel|"
194
+				       tabview remove "Tab",1
195
+					//print old_tab
196
+				break
197
+				case "tabadd|"					
198
+				        TABVIEW ADD "Tab", "Textcontrol"
199
+					//draw text 10,15 ,"TEXTCONTROL WITH / WITHOUT LABEL", "Tab2"
200
+				break
201
+				case "start|"
202
+					ID=SOUND PLAY "yab_testsong.mp3", 1
203
+					
204
+					print "------"	
205
+					print ID
206
+					print "------"					
207
+				break
208
+				case "stop|"
209
+					IF (ID=1) THEN
210
+						SOUND STOP ID
211
+						ID=0
212
+						//print "ID:"+str$(ID)
213
+					ELSE
214
+						print "Nothing to do"
215
+					ENDIF				
216
+								
217
+				break 
218
+				case "pause|"
219
+					SOUND WAIT ID // 2
220
+				break 
221
+
222
+				case "start_Media|"
223
+					//ID = MEDIASOUND play "02 - Let Her Go.mp3"
224
+					NEW_ID = MEDIASOUND play "https://swr-edge-10b8-fra-dtag-cdn.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3"
225
+				break
226
+				case "stop_Media|"
227
+					IF (NEW_ID=1) THEN
228
+						MEDIASOUND STOP NEW_ID
229
+						NEW_ID=0
230
+						//print "NEW_ID:"+str$(NEW_ID)
231
+					ELSE
232
+						print "Nothing to do"
233
+					ENDIF						
234
+				break
235
+				
236
+				default
237
+				break
238
+			end switch	
239
+			if(window count<1) inloop = false
240
+		    sleep 0.1
241
+ mmsg$ = MOUSE MESSAGE$
242
+                        if (mmsg$<>"" and mmsg$<>old_mmsg$) then
243
+                                //print mmsg$
244
+                                //old_mmsg$= mmsg$ 
245
+                                nx = split(mmsg$, mouse$(), ":")
246
+                                Viewname$=mouse$(1)
247
+                                //print Viewname$
248
+                                Xmouse  = val(mouse$(2))
249
+                                Ymouse  = val(mouse$(3))
250
+                                BLmouse= val(mouse$(4))
251
+                                BCmouse= val(mouse$(5))
252
+                                BRmouse= val(mouse$(6))
253
+                                casestring$=Viewname$+":"+mouse$(4)+":"+mouse$(5)+":"+mouse$(6)
254
+                                print casestring$
255
+                        endif
256
+	wend
257
+
258
+sub baummenu(x,i,d)
259
+fileload$="hilfe.csv"
260
+	auslesen=open(fileload$, "r")
261
+	
262
+	while (not EOF(auslesen))
263
+	line input #auslesen b$
264
+	TEXTEDIT ADD "ausgabe", b$+"\n"
265
+	dim elements$(1)
266
+	
267
+	numElements = split(b$, elements$(),";")
268
+	for i = 1 to numElements
269
+			x=x+1
270
+			dim d$(x)
271
+			d$(x) = elements$(i)
272
+			
273
+	//print d$(x)
274
+	next i
275
+	wend
276
+	close(auslesen)
277
+
278
+anzahlspalten=numElements
279
+anzahlzeilen=x/anzahlspalten
280
+eintraege=anzahlspalten*anzahlzeilen
281
+name_baummenu$=d$(0)
282
+treebox 0,50 to 147,250, name_baummenu$, 3, "Tab1"
283
+for treezeilen=1 to anzahlzeilen*anzahlspalten step anzahlspalten
284
+	
285
+		          if (d$(treezeilen+2)="") then
286
+				treebox add name_baummenu$, d$(treezeilen+1)
287
+			
288
+			else
289
+				treebox add name_baummenu$, d$(treezeilen+1), d$(treezeilen+2),true		
290
+			endif
291
+		
292
+	print treezeilen
293
+next treezeilen
294
+
295
+end sub
0 296
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-#!/boot/home/config/bin/yab
2
-# mimetype "application/x-vnd.Pang.yab"
3
-
4
-doc See Ping.yab for more information.
5
-
6
-window open 400,100 to 600,300, "Pang", "Pang"
7
-
8
-dim msg$(1)
9
-while(not finished)
10
-	n = token(message$, msg$(), ":|")
11
-	for i = 1 to n 
12
-		if(instr(msg$(i), "Quit")) finished = true
13
-		if(instr(msg$(i), "_Scripting") and n>=i+2) then
14
-			x = val(msg$(i+1)) 
15
-			y = val(msg$(i+2))- 200
16
-			draw flush "Pang"
17
-			draw circle x,y, 8, "Pang"
18
-		endif
19
-	next i
20
-wend
21
-
22
-window close "Pang"
23 0
new file mode 100644
24 1
Binary files /dev/null and b/Examples/yab_testsong.mp3 differ
... ...
@@ -54,7 +54,7 @@ OPT = -O
54 54
 ##
55 55
 ## set libtrary name
56 56
 ##
57
-YABLIBRARY := libyab_1.7.8.so
57
+YABLIBRARY := libyab_1.7.9.so
58 58
 ##
59 59
 #
60 60
 
... ...
@@ -70,13 +70,13 @@ GPP_OPT = $(DBG) $(OPT) -I. -DHAVE_CONFIG -DUNIX $(HAIKUOPT)
70 70
 ## find out if we need to change the library to libyab_x86.so and use gcc instead of ld
71 71
 ifeq ($(USEDARCH), x86)
72 72
 	LD = gcc
73
-	YABLIBRARY:=libyab_x86_1.7.8.so
73
+	YABLIBRARY:=libyab_x86_1.7.9.so
74 74
 else
75 75
 	LD = ld
76 76
 endif
77 77
 ifeq ($(SYSTEMARCH),x86_64)
78 78
 	LD=gcc
79
-	YABLIBRARY:=libyab_1.7.8.so
79
+	YABLIBRARY:=libyab_1.7.9.so
80 80
 endif
81 81
 #
82 82
 
... ...
@@ -26,10 +26,10 @@ resource app_signature "application/x-vnd.yab-app";
26 26
 resource app_version {
27 27
 	major  = 1,
28 28
 	middle = 7,
29
-	minor  = 8,
29
+	minor  = 9,
30 30
 
31 31
 	variety = B_APPV_FINAL,
32
-	internal = 4,
32
+	internal = 1,
33 33
 
34 34
 	short_info = "Yab BASIC programming language",
35 35
 	long_info = "Yab allows fast prototyping with simple and clean code. yab contains a large number of BeAPI specific commands for GUI creation and much, much more."
36 36
Binary files a/YAB.rdef.rsrc and b/YAB.rdef.rsrc differ
... ...
@@ -945,7 +945,7 @@ void YabInterface::Launch(const char* strg)
945 945
 	status_t t = be_roster->Launch(ref);
946 946
 	if(t != B_OK)
947 947
 	{
948
-		if(tst.FindFirst("http://") != B_ERROR || tst.FindFirst("file://") != B_ERROR || tst.FindFirst("www.") != B_ERROR)
948
+		if(tst.FindFirst("http://")  != B_ERROR || tst.FindFirst("https://") != B_ERROR || tst.FindFirst("file://") != B_ERROR || tst.FindFirst("www.") != B_ERROR)
949 949
 		{
950 950
 			char *link = tst.LockBuffer( tst.Length()+1 );
951 951
                		status_t result = be_roster->Launch( "text/html", 1, &link );
... ...
@@ -5481,7 +5481,7 @@ void YabInterface::FileBox(BRect frame, const char* id, bool hasHScrollbar, cons
5481 5481
 			msg2->AddPointer("source", myColumnList);
5482 5482
 			myColumnList->SetInvocationMessage(msg1);
5483 5483
 			myColumnList->SetSelectionMessage(msg2);
5484
-			myColumnList->SetSortingEnabled(false);
5484
+			myColumnList->SetSortingEnabled(true);
5485 5485
 			myColumnList->SetSelectionMode(B_SINGLE_SELECTION_LIST);
5486 5486
 			rgb_color rgb = {195,195,195,255};
5487 5487
 			myColumnList->SetColor(B_COLOR_SELECTION, rgb);
... ...
@@ -8998,8 +8998,10 @@ void YabInterface::Canvas(BRect frame, const char* id, const char* view)
8998 8998
 	}
8999 8999
 	Error(view, "VIEW");
9000 9000
 }
9001
-int YabInterface::Sound(const char* filename) //Reactivate Sound Lorglas 2020.01.02
9001
+int YabInterface::Sound(const char* filename, int status) //Reactivate Sound Lorglas 2020.01.02
9002 9002
 {
9003
+	
9004
+	//printf("%s - %d",filename, status);
9003 9005
 	entry_ref ref; 
9004 9006
 	BEntry entry(filename, true); 
9005 9007
 	//Check, if filename is ok
... ...
@@ -9007,10 +9009,10 @@ int YabInterface::Sound(const char* filename) //Reactivate Sound Lorglas 2020.01
9007 9009
 		if (entry.GetRef(&ref) == B_OK) 
9008 9010
 		//delete playing fplayer, because we get no ID back from fplayer. So if we didn't deleting fplayer, a second sound will be played and the first one can't be stopped
9009 9011
 			delete fPlayer;
9010
-			fPlayer = new BFileGameSound(&ref, false);
9011
-			fPlayer->StartPlaying();
9012
-			
9013
-	return 1;	
9012
+	
9013
+	  		fPlayer = new BFileGameSound(&ref, status);			
9014
+			fPlayer->StartPlaying();	
9015
+			return 1;
9014 9016
 }
9015 9017
 
9016 9018
 void YabInterface::SoundStop(int32) //Reactivate Sound Lorglas 2020.01.02
... ...
@@ -10923,19 +10925,19 @@ void yi_Canvas(double x1, double y1, double x2, double y2, const char* id, const
10923 10925
 	yab->Canvas(BRect(x1,y1,x2,y2), id,view);
10924 10926
 }
10925 10927
 
10926
-int yi_Sound(const char* filename, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.02
10928
+int yi_Sound(const char* filename, int status, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.02
10927 10929
 {
10928
-	return yab->Sound(filename);
10930
+	return yab->Sound(filename, status);
10929 10931
 }
10930 10932
 
10931 10933
 void yi_SoundStop(int id, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.02
10932 10934
 {
10933
-	yab->SoundStop(id);
10935
+	return yab->SoundStop(id);
10934 10936
 }
10935 10937
 
10936 10938
 void yi_SoundWait(int id, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.03
10937 10939
 {
10938
-	yab->SoundWait(id);
10940
+	return yab->SoundWait(id);
10939 10941
 }
10940 10942
 
10941 10943
 int yi_MediaSound(const char* filename, YabInterface* yab)
... ...
@@ -215,7 +215,7 @@
215 215
 		void Screenshot(BRect frame, const char* bitmap);
216 216
 		int BitmapSave(const char* id, const char* filename, const char* type);
217 217
 		void Canvas(BRect frame, const char* id, const char* view);
218
-		int Sound(const char* filename);
218
+		int Sound(const char* filename, int status);
219 219
 		void SoundStop(int32 id); 
220 220
 		void SoundWait(int32 id);
221 221
 		int MediaSound(const char* filename);
... ...
@@ -495,7 +495,7 @@ extern void yi_BitmapRemove(const char* bitmap,YabInterface* yab);
495 495
 extern void yi_Screenshot(double x1, double y1, double x2, double y2, const char* bitmap, YabInterface* yab);
496 496
 extern int yi_BitmapSave(const char* id, const char* filename, const char* type, YabInterface* yab);
497 497
 extern void yi_Canvas(double x1, double y1, double x2, double y2, const char* id, const char* view, YabInterface *yab);
498
-extern int yi_Sound(const char* filename, YabInterface* yab);
498
+extern int yi_Sound(const char* filename, int status, 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);
... ...
@@ -1,31 +1,24 @@
1 1
 /*
2 2
 Open Tracker License
3
-
4 3
 Terms and Conditions
5
-
6 4
 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
7
-
8 5
 Permission is hereby granted, free of charge, to any person obtaining a copy of
9 6
 this software and associated documentation files (the "Software"), to deal in
10 7
 the Software without restriction, including without limitation the rights to
11 8
 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 9
 of the Software, and to permit persons to whom the Software is furnished to do
13 10
 so, subject to the following conditions:
14
-
15 11
 The above copyright notice and this permission notice applies to all licensees
16 12
 and shall be included in all copies or substantial portions of the Software.
17
-
18 13
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 14
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20 15
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 16
 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 17
 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23 18
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
-
25 19
 Except as contained in this notice, the name of Be Incorporated shall not be
26 20
 used in advertising or otherwise to promote the sale, use or other dealings in
27 21
 this Software without prior written authorization from Be Incorporated.
28
-
29 22
 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30 23
 of Be Incorporated in the United States and other countries. Other brand product
31 24
 names are registered trademarks or trademarks of their respective holders.
... ...
@@ -66,8 +59,6 @@ inline bool operator!=(const rgb_color c1, const rgb_color c2)
66 59
 
67 60
 // Color creation.
68 61
 
69
-#ifndef HAIKU
70
-
71 62
 inline rgb_color make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
72 63
 {
73 64
 	rgb_color c;
... ...
@@ -78,13 +69,11 @@ inline rgb_color make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
78 69
 	return c;
79 70
 }
80 71
 
81
-#endif
82
-
83 72
 // Mix two colors together, ignoring their relative alpha channels.
84 73
 // If amount is 0, the result is color1; if 255, the result is color2;
85 74
 // if another value, it is somewhere in-between.  The resulting alpha
86 75
 // channel is mixed exactly like the other color channels.
87
-//rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount);
76
+rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount);
88 77
 
89 78
 // Blend two colors together, weighting by their relative alpha channels.
90 79
 // The resulting color is the same as mix_color(), except that the amount
... ...
@@ -47,6 +47,7 @@ All rights reserved.
47 47
 
48 48
 #include <typeinfo>
49 49
 
50
+#include <algorithm>
50 51
 #include <stdio.h>
51 52
 #include <stdlib.h>
52 53
 
... ...
@@ -62,70 +63,22 @@ All rights reserved.
62 63
 #include <Region.h>
63 64
 #include <ScrollBar.h>
64 65
 #include <String.h>
66
+#include <SupportDefs.h>
65 67
 #include <Window.h>
66 68
 
67
-#include "ColorTools.h"
69
+#include <column/ObjectListPrivate.h>
70
+
68 71
 #include "ObjectList.h"
69 72
 
73
+
70 74
 #define DOUBLE_BUFFERED_COLUMN_RESIZE 1
71 75
 #define SMART_REDRAW 1
72 76
 #define DRAG_TITLE_OUTLINE 1
73 77
 #define CONSTRAIN_CLIPPING_REGION 1
74 78
 #define LOWER_SCROLLBAR 0
75 79
 
76
-namespace BPrivate {
77
-
78
-static const unsigned char kResizeCursorData[] = {
79
-	16, 1, 8, 8,
80
-	0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
81
-	0x1a, 0x58, 0x2a, 0x54, 0x4a, 0x52, 0x8a, 0x51,
82
-	0x8a, 0x51, 0x4a, 0x52, 0x2a, 0x54, 0x1a, 0x58,
83
-	0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
84
-
85
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
86
-	0x1b, 0xd8, 0x3b, 0xdc, 0x7b, 0xde, 0xfb, 0xdf,
87
-	0xfb, 0xdf, 0x7b, 0xde, 0x3b, 0xdc, 0x1b, 0xd8,
88
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
89
-};
90
-
91
-static const unsigned char kMaxResizeCursorData[] = {
92
-	16, 1, 8, 8,
93
-	0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
94
-	0x1a, 0x40, 0x2a, 0x40, 0x4a, 0x40, 0x8a, 0x40,
95
-	0x8a, 0x40, 0x4a, 0x40, 0x2a, 0x40, 0x1a, 0x40,
96
-	0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
97
-
98
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
99
-	0x1b, 0xc0, 0x3b, 0xc0, 0x7b, 0xc0, 0xfb, 0xc0,
100
-	0xfb, 0xc0, 0x7b, 0xc0, 0x3b, 0xc0, 0x1b, 0xc0,
101
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
102
-};
103 80
 
104
-static const unsigned char kMinResizeCursorData[] = {
105
-	16, 1, 8, 8,
106
-	0x03, 0xc0, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
107
-	0x02, 0x58, 0x02, 0x54, 0x02, 0x52, 0x02, 0x51,
108
-	0x02, 0x51, 0x02, 0x52, 0x02, 0x54, 0x02, 0x58,
109
-	0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xc0,
110
-
111
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
112
-	0x03, 0xd8, 0x03, 0xdc, 0x03, 0xde, 0x03, 0xdf,
113
-	0x03, 0xdf, 0x03, 0xde, 0x03, 0xdc, 0x03, 0xd8,
114
-	0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0
115
-};
116
-
117
-static const unsigned char kColumnMoveCursorData[] = {
118
-	16, 1, 8, 8,
119
-	0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10,
120
-	0x1e, 0x78, 0x2a, 0x54, 0x4e, 0x72, 0x80, 0x01,
121
-	0x80, 0x01, 0x4e, 0x72, 0x2a, 0x54, 0x1e, 0x78,
122
-	0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01, 0x80,
123
-
124
-	0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0,
125
-	0x1f, 0xf8, 0x3b, 0xdc, 0x7f, 0xfe, 0xff, 0xff,
126
-	0xff, 0xff, 0x7f, 0xfe, 0x3b, 0xdc, 0x1f, 0xf8,
127
-	0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80
128
-};
81
+namespace BPrivate {
129 82
 
130 83
 static const unsigned char kDownSortArrow8x8[] = {
131 84
 	0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
... ...
@@ -171,31 +124,17 @@ static const unsigned char kUpSortArrow8x8Invert[] = {
171 124
 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
172 125
 };
173 126
 
174
-static const float kTintedLineTint = 0.7 * B_NO_TINT + 0.3 * B_DARKEN_1_TINT;
175
-
176
-static const float kTitleHeight = 16.0;
177
-static const float kLatchWidth = 0.0; //5.0;
178
-
127
+static const float kTintedLineTint = 1.04;
179 128
 
180
-static const rgb_color kColor[B_COLOR_TOTAL] =
181
-{
182
-    {236, 236, 236, 255},           // B_COLOR_BACKGROUND
183
-    {  0,   0,   0, 255},           // B_COLOR_TEXT
184
-    {148, 148, 148, 255},           // B_COLOR_ROW_DIVIDER
185
-    {190, 190, 190, 255},           // B_COLOR_SELECTION
186
-    {  0,   0,   0, 255},           // B_COLOR_SELECTION_TEXT
187
-    {200, 200, 200, 255},           // B_COLOR_NON_FOCUS_SELECTION
188
-    {180, 180, 180, 180},           // B_COLOR_EDIT_BACKGROUND
189
-    {  0,   0,   0, 255},           // B_COLOR_EDIT_TEXT
190
-    {215, 215, 215, 255},           // B_COLOR_HEADER_BACKGROUND
191
-    {  0,   0,   0, 255},           // B_COLOR_HEADER_TEXT
192
-    {  0,   0,   0, 255},           // B_COLOR_SEPARATOR_LINE
193
-    {  0,   0,   0, 255},           // B_COLOR_SEPARATOR_BORDER
194
-};
129
+static const float kMinTitleHeight = 16.0;
130
+static const float kMinRowHeight = 16.0;
131
+static const float kTitleSpacing = 1.4;
132
+static const float kRowSpacing = 1.4;
133
+static const float kLatchWidth = 15.0;
195 134
 
196 135
 static const int32 kMaxDepth = 1024;
197 136
 static const float kLeftMargin = kLatchWidth;
198
-static const float kRightMargin = kLatchWidth;
137
+static const float kRightMargin = 8;
199 138
 static const float kOutlineLevelIndent = kLatchWidth;
200 139
 static const float kColumnResizeAreaWidth = 10.0;
201 140
 static const float kRowDragSensitivity = 5.0;
... ...
@@ -237,6 +176,8 @@ public:
237 176
 			void				SetEditMode(bool state)
238 177
 									{ fEditMode = state; }
239 178
 
179
+			float				MarginWidth() const;
180
+
240 181
 private:
241 182
 			void				GetTitleRect(BColumn* column, BRect* _rect);
242 183
 			int32				FindColumn(BPoint where, float* _leftEdge);
... ...
@@ -294,6 +235,7 @@ private:
294 235
 			BCursor*			fColumnMoveCursor;
295 236
 };
296 237
 
238
+
297 239
 class OutlineView : public BView {
298 240
 	typedef BView _inherited;
299 241
 public:
... ...
@@ -367,6 +309,7 @@ private:
367 309
 			float				fItemsHeight;
368 310
 			BRowContainer		fRows;
369 311
 			BRect				fVisibleRect;
312
+								
370 313
 
371 314
 #if DOUBLE_BUFFERED_COLUMN_RESIZE
372 315
 			BBitmap*			fDrawBuffer;
... ...
@@ -418,6 +361,7 @@ private:
418 361
 	friend class RecursiveOutlineIterator;
419 362
 };
420 363
 
364
+
421 365
 class RecursiveOutlineIterator {
422 366
 public:
423 367
 								RecursiveOutlineIterator(
... ...
@@ -486,6 +430,20 @@ BColumn::MouseUp(BColumnListView* /*parent*/, BRow* /*row*/, BField* /*field*/)
486 430
 // #pragma mark -
487 431
 
488 432
 
433
+BRow::BRow()
434
+	:
435
+	fChildList(NULL),
436
+	fIsExpanded(false),
437
+	fHeight(std::max(kMinRowHeight,
438
+		ceilf(be_plain_font->Size() * kRowSpacing))),
439
+	fNextSelected(NULL),
440
+	fPrevSelected(NULL),
441
+	fParent(NULL),
442
+	fList(NULL)
443
+{
444
+}
445
+
446
+
489 447
 BRow::BRow(float height)
490 448
 	:
491 449
 	fChildList(NULL),
... ...
@@ -547,9 +505,7 @@ BRow::SetField(BField* field, int32 logicalFieldIndex)
547 505
 
548 506
 	if (NULL != fList) {
549 507
 		ValidateField(field, logicalFieldIndex);
550
-		BRect inv;
551
-		fList->GetRowRect(this, &inv);
552
-		fList->Invalidate(inv);
508
+		Invalidate();
553 509
 	}
554 510
 
555 511
 	fFields.AddItem(field, logicalFieldIndex);
... ...
@@ -570,6 +526,21 @@ BRow::IsExpanded() const
570 526
 }
571 527
 
572 528
 
529
+bool
530
+BRow::IsSelected() const
531
+{
532
+	return fPrevSelected != NULL;
533
+}
534
+
535
+
536
+void
537
+BRow::Invalidate()
538
+{
539
+	if (fList != NULL)
540
+		fList->InvalidateRow(this);
541
+}
542
+
543
+
573 544
 void
574 545
 BRow::ValidateFields() const
575 546
 {
... ...
@@ -584,26 +555,25 @@ BRow::ValidateField(const BField* field, int32 logicalFieldIndex) const
584 555
 	// The Fields may be moved by the user, but the logicalFieldIndexes
585 556
 	// do not change, so we need to map them over when checking the
586 557
 	// Field types.
587
-	BColumn* col = NULL;
558
+	BColumn* column = NULL;
588 559
 	int32 items = fList->CountColumns();
589 560
 	for (int32 i = 0 ; i < items; ++i) {
590
-		col = fList->ColumnAt(i);
591
-		if( col->LogicalFieldNum() == logicalFieldIndex )
561
+		column = fList->ColumnAt(i);
562
+		if(column->LogicalFieldNum() == logicalFieldIndex )
592 563
 			break;
593 564
 	}
594 565
 
595
-	if (NULL == col) {
566
+	if (column == NULL) {
596 567
 		BString dbmessage("\n\n\tThe parent BColumnListView does not have "
597
-		                  "\n\ta BColumn at the logical field index ");
598
-		dbmessage << logicalFieldIndex << ".\n\n";
599
-		printf(dbmessage.String());
568
+			"\n\ta BColumn at the logical field index ");
569
+		dbmessage << logicalFieldIndex << ".\n";
570
+		puts(dbmessage.String());
600 571
 	} else {
601
-		if (!col->AcceptsField(field)) {
572
+		if (!column->AcceptsField(field)) {
602 573
 			BString dbmessage("\n\n\tThe BColumn of type ");
603
-			dbmessage << typeid(*col).name() << "\n\tat logical field index "
604
-			          << logicalFieldIndex << "\n\tdoes not support the "
605
-				          "field type "
606
-			          << typeid(*field).name() << ".\n\n";
574
+			dbmessage << typeid(*column).name() << "\n\tat logical field index "
575
+				<< logicalFieldIndex << "\n\tdoes not support the field type "
576
+				<< typeid(*field).name() << ".\n\n";
607 577
 			debugger(dbmessage.String());
608 578
 		}
609 579
 	}
... ...
@@ -776,9 +746,10 @@ BColumnListView::BColumnListView(BRect rect, const char* name,
776 746
 	fSelectionMessage(NULL),
777 747
 	fSortingEnabled(true),
778 748
 	fLatchWidth(kLatchWidth),
779
-	fBorderStyle(border)
749
+	fBorderStyle(border),
750
+	fShowingHorizontalScrollBar(showHorizontalScrollbar)
780 751
 {
781
-	_Init(showHorizontalScrollbar);
752
+	_Init();
782 753
 }
783 754
 
784 755
 
... ...
@@ -790,9 +761,10 @@ BColumnListView::BColumnListView(const char* name, uint32 flags,
790 761
 	fSelectionMessage(NULL),
791 762
 	fSortingEnabled(true),
792 763
 	fLatchWidth(kLatchWidth),
793
-	fBorderStyle(border)
764
+	fBorderStyle(border),
765
+	fShowingHorizontalScrollBar(showHorizontalScrollbar)
794 766
 {
795
-	_Init(showHorizontalScrollbar);
767
+	_Init();
796 768
 }
797 769
 
798 770
 
... ...
@@ -836,6 +808,7 @@ BColumnListView::Invoke(BMessage* message)
836 808
 void
837 809
 BColumnListView::ItemInvoked()
838 810
 {
811
+	
839 812
 	Invoke();
840 813
 }
841 814
 
... ...
@@ -972,7 +945,9 @@ BColumnListView::SetSortingEnabled(bool enabled)
972 945
 {
973 946
 	fSortingEnabled = enabled;
974 947
 	fSortColumns.MakeEmpty();
975
-	fTitleView->Invalidate();	// Erase sort indicators
948
+	fTitleView->Invalidate();
949
+	// erase sort indicators
950
+	
976 951
 }
977 952
 
978 953
 
... ...
@@ -996,16 +971,20 @@ BColumnListView::SetSortColumn(BColumn* column, bool add, bool ascending)
996 971
 		fSortColumns.AddItem(column);
997 972
 
998 973
 	column->fSortAscending = ascending;
999
-	fTitleView->Invalidate();
1000 974
 	fOutlineView->StartSorting();
975
+	fTitleView->Invalidate();
976
+	
977
+	
1001 978
 }
1002 979
 
1003 980
 
1004 981
 void
1005 982
 BColumnListView::ClearSortColumns()
1006 983
 {
984
+	
1007 985
 	fSortColumns.MakeEmpty();
1008
-	fTitleView->Invalidate();	// Erase sort indicators
986
+	fTitleView->Invalidate();
987
+		// erase sort indicators
1009 988
 }
1010 989
 
1011 990
 
... ...
@@ -1065,7 +1044,7 @@ BColumnListView::AddColumn(BColumn* column, int32 logicalFieldIndex)
1065 1044
 	column->fList = this;
1066 1045
 	column->fFieldID = logicalFieldIndex;
1067 1046
 
1068
-	// sanity check.  If there is already a field with this ID, remove it.
1047
+	// sanity check -- if there is already a field with this ID, remove it.
1069 1048
 	for (int32 index = 0; index < fColumns.CountItems(); index++) {
1070 1049
 		BColumn* existingColumn = (BColumn*) fColumns.ItemAt(index);
1071 1050
 		if (existingColumn && existingColumn->fFieldID == logicalFieldIndex) {
... ...
@@ -1124,7 +1103,7 @@ BColumnListView::ColumnAt(BPoint point) const
1124 1103
 	float left = MAX(kLeftMargin, LatchWidth());
1125 1104
 
1126 1105
 	for (int i = 0; BColumn* column = (BColumn*)fColumns.ItemAt(i); i++) {
1127
-		if (!column->IsVisible())
1106
+		if (column == NULL || !column->IsVisible())
1128 1107
 			continue;
1129 1108
 
1130 1109
 		float right = left + column->Width();
... ...
@@ -1149,7 +1128,7 @@ void
1149 1128
 BColumnListView::SetColumnVisible(int32 index, bool isVisible)
1150 1129
 {
1151 1130
 	BColumn* column = ColumnAt(index);
1152
-	if (column)
1131
+	if (column != NULL)
1153 1132
 		column->SetVisible(isVisible);
1154 1133
 }
1155 1134
 
... ...
@@ -1158,7 +1137,7 @@ bool
1158 1137
 BColumnListView::IsColumnVisible(int32 index) const
1159 1138
 {
1160 1139
 	BColumn* column = ColumnAt(index);
1161
-	if (column)
1140
+	if (column != NULL)
1162 1141
 		return column->IsVisible();
1163 1142
 
1164 1143
 	return false;
... ...
@@ -1303,6 +1282,60 @@ BColumnListView::UpdateRow(BRow* row)
1303 1282
 }
1304 1283
 
1305 1284
 
1285
+bool
1286
+BColumnListView::SwapRows(int32 index1, int32 index2, BRow* parentRow1,
1287
+	BRow* parentRow2)
1288
+{
1289
+	BRow* row1 = NULL;
1290
+	BRow* row2 = NULL;
1291
+
1292
+	BRowContainer* container1 = NULL;
1293
+	BRowContainer* container2 = NULL;
1294
+
1295
+	if (parentRow1 == NULL)
1296
+		container1 = fOutlineView->RowList();
1297
+	else
1298
+		container1 = parentRow1->fChildList;
1299
+
1300
+	if (container1 == NULL)
1301
+		return false;
1302
+
1303
+	if (parentRow2 == NULL)
1304
+		container2 = fOutlineView->RowList();
1305
+	else
1306
+		container2 = parentRow2->fChildList;
1307
+
1308
+	if (container2 == NULL)
1309
+		return false;
1310
+
1311
+	row1 = container1->ItemAt(index1);
1312
+
1313
+	if (row1 == NULL)
1314
+		return false;
1315
+
1316
+	row2 = container2->ItemAt(index2);
1317
+
1318
+	if (row2 == NULL)
1319
+		return false;
1320
+
1321
+	container1->ReplaceItem(index2, row1);
1322
+	container2->ReplaceItem(index1, row2);
1323
+
1324
+	BRect rect1;
1325
+	BRect rect2;
1326
+	BRect rect;
1327
+
1328
+	fOutlineView->FindRect(row1, &rect1);
1329
+	fOutlineView->FindRect(row2, &rect2);
1330
+
1331
+	rect = rect1 | rect2;
1332
+
1333
+	fOutlineView->Invalidate(rect);
1334
+
1335
+	return true;
1336
+}
1337
+
1338
+
1306 1339
 void
1307 1340
 BColumnListView::ScrollTo(const BRow* row)
1308 1341
 {
... ...
@@ -1320,14 +1353,25 @@ BColumnListView::ScrollTo(BPoint point)
1320 1353
 void
1321 1354
 BColumnListView::Clear()
1322 1355
 {
1356
+	fSortColumns.MakeEmpty();
1357
+	
1323 1358
 	fOutlineView->Clear();
1324 1359
 }
1325 1360
 
1326 1361
 
1327 1362
 void
1363
+BColumnListView::InvalidateRow(BRow* row)
1364
+{
1365
+	BRect updateRect;
1366
+	GetRowRect(row, &updateRect);
1367
+	fOutlineView->Invalidate(updateRect);
1368
+}
1369
+
1370
+
1371
+// This method is deprecated.
1372
+void
1328 1373
 BColumnListView::SetFont(const BFont* font, uint32 mask)
1329 1374
 {
1330
-	// This method is deprecated.
1331 1375
 	fOutlineView->SetFont(font, mask);
1332 1376
 	fTitleView->SetFont(font, mask);
1333 1377
 }
... ...
@@ -1373,36 +1417,46 @@ BColumnListView::GetFont(ColumnListViewFont font_num, BFont* font) const
1373 1417
 
1374 1418
 
1375 1419
 void
1376
-BColumnListView::SetColor(ColumnListViewColor color_num, const rgb_color color)
1420
+BColumnListView::SetColor(ColumnListViewColor colorIndex, const rgb_color color)
1377 1421
 {
1378
-	if ((int)color_num < 0) {
1422
+	if ((int)colorIndex < 0) {
1379 1423
 		ASSERT(false);
1380
-		color_num = (ColumnListViewColor) 0;
1424
+		colorIndex = (ColumnListViewColor)0;
1381 1425
 	}
1382 1426
 
1383
-	if ((int)color_num >= (int)B_COLOR_TOTAL) {
1427
+	if ((int)colorIndex >= (int)B_COLOR_TOTAL) {
1384 1428
 		ASSERT(false);
1385
-		color_num = (ColumnListViewColor) (B_COLOR_TOTAL - 1);
1429
+		colorIndex = (ColumnListViewColor)(B_COLOR_TOTAL - 1);
1386 1430
 	}
1387 1431
 
1388
-	fColorList[color_num] = color;
1432
+	fColorList[colorIndex] = color;
1433
+	fCustomColors = true;
1434
+}
1435
+
1436
+
1437
+void
1438
+BColumnListView::ResetColors()
1439
+{
1440
+	fCustomColors = false;
1441
+	_UpdateColors();
1442
+	Invalidate();
1389 1443
 }
1390 1444
 
1391 1445
 
1392 1446
 rgb_color
1393
-BColumnListView::Color(ColumnListViewColor color_num) const
1447
+BColumnListView::Color(ColumnListViewColor colorIndex) const
1394 1448
 {
1395
-	if ((int)color_num < 0) {
1449
+	if ((int)colorIndex < 0) {
1396 1450
 		ASSERT(false);
1397
-		color_num = (ColumnListViewColor) 0;
1451
+		colorIndex = (ColumnListViewColor)0;
1398 1452
 	}
1399 1453
 
1400
-	if ((int)color_num >= (int)B_COLOR_TOTAL) {
1454
+	if ((int)colorIndex >= (int)B_COLOR_TOTAL) {
1401 1455
 		ASSERT(false);
1402
-		color_num = (ColumnListViewColor) (B_COLOR_TOTAL - 1);
1456
+		colorIndex = (ColumnListViewColor)(B_COLOR_TOTAL - 1);
1403 1457
 	}
1404 1458
 
1405
-	return fColorList[color_num];
1459
+	return fColorList[colorIndex];
1406 1460
 }
1407 1461
 
1408 1462
 
... ...
@@ -1410,10 +1464,10 @@ void
1410 1464
 BColumnListView::SetHighColor(rgb_color color)
1411 1465
 {
1412 1466
 	BView::SetHighColor(color);
1413
-//	fOutlineView->Invalidate();	// Redraw things with the new color
1414
-								// Note that this will currently cause
1415
-								// an infinite loop, refreshing over and over.
1416
-								// A better solution is needed.
1467
+//	fOutlineView->Invalidate();
1468
+		// Redraw with the new color.
1469
+		// Note that this will currently cause an infinite loop, refreshing
1470
+		// over and over. A better solution is needed.
1417 1471
 }
1418 1472
 
1419 1473
 
... ...
@@ -1421,6 +1475,7 @@ void
1421 1475
 BColumnListView::SetSelectionColor(rgb_color color)
1422 1476
 {
1423 1477
 	fColorList[B_COLOR_SELECTION] = color;
1478
+	fCustomColors = true;
1424 1479
 }
1425 1480
 
1426 1481
 
... ...
@@ -1428,7 +1483,9 @@ void
1428 1483
 BColumnListView::SetBackgroundColor(rgb_color color)
1429 1484
 {
1430 1485
 	fColorList[B_COLOR_BACKGROUND] = color;
1431
-	fOutlineView->Invalidate();	// Repaint with new color
1486
+	fCustomColors = true;
1487
+	fOutlineView->Invalidate();
1488
+		// repaint with new color
1432 1489
 }
1433 1490
 
1434 1491
 
... ...
@@ -1436,6 +1493,7 @@ void
1436 1493
 BColumnListView::SetEditColor(rgb_color color)
1437 1494
 {
1438 1495
 	fColorList[B_COLOR_EDIT_BACKGROUND] = color;
1496
+	fCustomColors = true;
1439 1497
 }
1440 1498
 
1441 1499
 
... ...
@@ -1464,13 +1522,26 @@ BPoint
1464 1522
 BColumnListView::SuggestTextPosition(const BRow* row,
1465 1523
 	const BColumn* inColumn) const
1466 1524
 {
1525
+	BRect rect(GetFieldRect(row, inColumn));
1526
+
1527
+	font_height fh;
1528
+	fOutlineView->GetFontHeight(&fh);
1529
+	float baseline = floor(rect.top + fh.ascent
1530
+		+ (rect.Height() + 1 - (fh.ascent + fh.descent)) / 2);
1531
+	return BPoint(rect.left + 8, baseline);
1532
+}
1533
+
1534
+
1535
+BRect
1536
+BColumnListView::GetFieldRect(const BRow* row, const BColumn* inColumn) const
1537
+{
1467 1538
 	BRect rect;
1468 1539
 	GetRowRect(row, &rect);
1469
-	if (inColumn) {
1540
+	if (inColumn != NULL) {
1470 1541
 		float leftEdge = MAX(kLeftMargin, LatchWidth());
1471 1542
 		for (int index = 0; index < fColumns.CountItems(); index++) {
1472 1543
 			BColumn* column = (BColumn*) fColumns.ItemAt(index);
1473
-			if (!column->IsVisible())
1544
+			if (column == NULL || !column->IsVisible())
1474 1545
 				continue;
1475 1546
 
1476 1547
 			if (column == inColumn) {
... ...
@@ -1483,11 +1554,7 @@ BColumnListView::SuggestTextPosition(const BRow* row,
1483 1554
 		}
1484 1555
 	}
1485 1556
 
1486
-	font_height fh;
1487
-	fOutlineView->GetFontHeight(&fh);
1488
-	float baseline = floor(rect.top + fh.ascent
1489
-							+ (rect.Height()+1-(fh.ascent+fh.descent))/2);
1490
-	return BPoint(rect.left + 8, baseline);
1557
+	return rect;
1491 1558
 }
1492 1559
 
1493 1560
 
... ...
@@ -1510,14 +1577,12 @@ BColumnListView::DrawLatch(BView* view, BRect rect, LatchType position, BRow*)
1510 1577
 {
1511 1578
 	const int32 rectInset = 4;
1512 1579
 
1513
-	view->SetHighColor(0, 0, 0);
1514
-
1515
-	// Make Square
1580
+	// make square
1516 1581
 	int32 sideLen = rect.IntegerWidth();
1517 1582
 	if (sideLen > rect.IntegerHeight())
1518 1583
 		sideLen = rect.IntegerHeight();
1519 1584
 
1520
-	// Make Center
1585
+	// make center
1521 1586
 	int32 halfWidth  = rect.IntegerWidth() / 2;
1522 1587
 	int32 halfHeight = rect.IntegerHeight() / 2;
1523 1588
 	int32 halfSide   = sideLen / 2;
... ...
@@ -1532,12 +1597,15 @@ BColumnListView::DrawLatch(BView* view, BRect rect, LatchType position, BRow*)
1532 1597
 
1533 1598
 	itemRect.InsetBy(rectInset, rectInset);
1534 1599
 
1535
-	// Make it an odd number of pixels wide, the latch looks better this way
1600
+	// make it an odd number of pixels wide, the latch looks better this way
1536 1601
 	if ((itemRect.IntegerWidth() % 2) == 1) {
1537 1602
 		itemRect.right += 1;
1538 1603
 		itemRect.bottom += 1;
1539 1604
 	}
1540 1605
 
1606
+	rgb_color highColor = view->HighColor();
1607
+	view->SetHighColor(0, 0, 0);
1608
+
1541 1609
 	switch (position) {
1542 1610
 		case B_OPEN_LATCH:
1543 1611
 			view->StrokeRect(itemRect);
... ...
@@ -1578,9 +1646,12 @@ BColumnListView::DrawLatch(BView* view, BRect rect, LatchType position, BRow*)
1578 1646
 			break;
1579 1647
 
1580 1648
 		case B_NO_LATCH:
1649
+		default:
1581 1650
 			// No drawing
1582 1651
 			break;
1583 1652
 	}
1653
+
1654
+	view->SetHighColor(highColor);
1584 1655
 }
1585 1656
 
1586 1657
 
... ...
@@ -1611,6 +1682,9 @@ BColumnListView::MessageReceived(BMessage* message)
1611 1682
 			fOutlineView->MessageReceived(message);
1612 1683
 			return;
1613 1684
 		}
1685
+	} else if (message->what == B_COLORS_UPDATED) {
1686
+		// Todo: Is it worthwhile to optimize this?
1687
+		_UpdateColors();
1614 1688
 	}
1615 1689
 
1616 1690
 	BView::MessageReceived(message);
... ...
@@ -1625,24 +1699,36 @@ BColumnListView::KeyDown(const char* bytes, int32 numBytes)
1625 1699
 		case B_RIGHT_ARROW:
1626 1700
 		case B_LEFT_ARROW:
1627 1701
 		{
1628
-			float  minVal, maxVal;
1629
-			fHorizontalScrollBar->GetRange(&minVal, &maxVal);
1630
-			float smallStep, largeStep;
1631
-			fHorizontalScrollBar->GetSteps(&smallStep, &largeStep);
1632
-			float oldVal = fHorizontalScrollBar->Value();
1633
-			float newVal = oldVal;
1634
-
1635
-			if (c == B_LEFT_ARROW)
1636
-				newVal -= smallStep;
1637
-			else if (c == B_RIGHT_ARROW)
1638
-				newVal += smallStep;
1639
-
1640
-			if (newVal < minVal)
1641
-				newVal = minVal;
1642
-			else if (newVal > maxVal)
1643
-				newVal = maxVal;
1702
+			if ((modifiers() & B_SHIFT_KEY) != 0) {
1703
+				float  minVal, maxVal;
1704
+				fHorizontalScrollBar->GetRange(&minVal, &maxVal);
1705
+				float smallStep, largeStep;
1706
+				fHorizontalScrollBar->GetSteps(&smallStep, &largeStep);
1707
+				float oldVal = fHorizontalScrollBar->Value();
1708
+				float newVal = oldVal;
1709
+
1710
+				if (c == B_LEFT_ARROW)
1711
+					newVal -= smallStep;
1712
+				else if (c == B_RIGHT_ARROW)
1713
+					newVal += smallStep;
1714
+
1715
+				if (newVal < minVal)
1716
+					newVal = minVal;
1717
+				else if (newVal > maxVal)
1718
+					newVal = maxVal;
1719
+
1720
+				fHorizontalScrollBar->SetValue(newVal);
1721
+			} else {
1722
+				BRow* focusRow = fOutlineView->FocusRow();
1723
+				if (focusRow == NULL)
1724
+					break;
1644 1725
 
1645
-			fHorizontalScrollBar->SetValue(newVal);
1726
+				bool expanded = focusRow->IsExpanded();
1727
+				if ((c == B_RIGHT_ARROW && !expanded)
1728
+					|| (c == B_LEFT_ARROW && expanded)) {
1729
+					fOutlineView->ToggleFocusRowOpen();
1730
+				}
1731
+			}
1646 1732
 			break;
1647 1733
 		}
1648 1734
 
... ...
@@ -1720,9 +1806,10 @@ void
1720 1806
 BColumnListView::WindowActivated(bool active)
1721 1807
 {
1722 1808
 	fOutlineView->Invalidate();
1723
-		// Focus and selection appearance changes with focus
1724
-
1725
-	Invalidate(); 	// Redraw focus marks around view
1809
+		// focus and selection appearance changes with focus
1810
+	
1811
+	Invalidate();
1812
+		// redraw focus marks around view
1726 1813
 	BView::WindowActivated(active);
1727 1814
 }
1728 1815
 
... ...
@@ -1732,123 +1819,99 @@ BColumnListView::Draw(BRect updateRect)
1732 1819
 {
1733 1820
 	BRect rect = Bounds();
1734 1821
 
1735
-	if (be_control_look != NULL) {
1736
-		uint32 flags = 0;
1737
-		if (IsFocus() && Window()->IsActive())
1738
-			flags |= BControlLook::B_FOCUSED;
1739
-
1740
-		rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
1741
-
1742
-		BRect verticalScrollBarFrame;
1743
-		if (!fVerticalScrollBar->IsHidden())
1744
-			verticalScrollBarFrame = fVerticalScrollBar->Frame();
1745
-		BRect horizontalScrollBarFrame;
1746
-		if (!fHorizontalScrollBar->IsHidden())
1747
-			horizontalScrollBarFrame = fHorizontalScrollBar->Frame();
1748
-
1749
-		if (fBorderStyle == B_NO_BORDER) {
1750
-			// We still draw the left/top border, but not focused.
1751
-			// The scrollbars cannot be displayed without frame and
1752
-			// it looks bad to have no frame only along the left/top
1753
-			// side.
1754
-			rgb_color borderColor = tint_color(base, B_DARKEN_2_TINT);
1755
-			SetHighColor(borderColor);
1756
-			StrokeLine(BPoint(rect.left, rect.bottom),
1757
-				BPoint(rect.left, rect.top));
1758
-			StrokeLine(BPoint(rect.left + 1, rect.top),
1759
-				BPoint(rect.right, rect.top));
1760
-		}
1822
+	uint32 flags = 0;
1823
+	if (IsFocus() && Window()->IsActive())
1824
+		flags |= BControlLook::B_FOCUSED;
1761 1825
 
1762
-		be_control_look->DrawScrollViewFrame(this, rect, updateRect,
1763
-			verticalScrollBarFrame, horizontalScrollBarFrame,
1764
-			base, fBorderStyle, flags);
1765
-
1766
-		return;
1767
-	}
1826
+	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
1768 1827
 
1769
-	BRect cornerRect(rect.right - B_V_SCROLL_BAR_WIDTH,
1770
-		rect.bottom - B_H_SCROLL_BAR_HEIGHT, rect.right, rect.bottom);
1771
-	if (fBorderStyle == B_PLAIN_BORDER) {
1772
-		BView::SetHighColor(0, 0, 0);
1773
-		StrokeRect(rect);
1774
-		cornerRect.OffsetBy(-1, -1);
1775
-	} else if (fBorderStyle == B_FANCY_BORDER) {
1776
-		bool isFocus = IsFocus() && Window()->IsActive();
1828
+	BRect verticalScrollBarFrame;
1829
+	if (!fVerticalScrollBar->IsHidden())
1830
+		verticalScrollBarFrame = fVerticalScrollBar->Frame();
1777 1831
 
1778
-		if (isFocus) {
1779
-			// TODO: Need to find focus color programatically
1780
-			BView::SetHighColor(0, 0, 190);
1781
-		} else
1782
-			BView::SetHighColor(255, 255, 255);
1832
+	BRect horizontalScrollBarFrame;
1833
+	if (!fHorizontalScrollBar->IsHidden())
1834
+		horizontalScrollBarFrame = fHorizontalScrollBar->Frame();
1835
+
1836
+	if (fBorderStyle == B_NO_BORDER) {
1837
+		// We still draw the left/top border, but not focused.
1838
+		// The scrollbars cannot be displayed without frame and
1839
+		// it looks bad to have no frame only along the left/top
1840
+		// side.
1841
+		rgb_color borderColor = tint_color(base, B_DARKEN_2_TINT);
1842
+		SetHighColor(borderColor);
1843
+		StrokeLine(BPoint(rect.left, rect.bottom),
1844
+			BPoint(rect.left, rect.top));
1845
+		StrokeLine(BPoint(rect.left + 1, rect.top),
1846
+			BPoint(rect.right, rect.top));
1847
+	}
1783 1848
 
1784
-		StrokeRect(rect);
1785
-		if (!isFocus)
1786
-			BView::SetHighColor(184, 184, 184);
1787
-		else
1788
-			BView::SetHighColor(152, 152, 152);
1849
+	be_control_look->DrawScrollViewFrame(this, rect, updateRect,
1850
+		verticalScrollBarFrame, horizontalScrollBarFrame,
1851
+		base, fBorderStyle, flags);
1789 1852
 
1790
-		rect.InsetBy(1,1);
1791
-		StrokeRect(rect);
1792
-		cornerRect.OffsetBy(-2, -2);
1853
+	if (fStatusView != NULL) {
1854
+		rect = Bounds();
1855
+		BRegion region(rect & fStatusView->Frame().InsetByCopy(-2, -2));
1856
+		ConstrainClippingRegion(&region);
1857
+		rect.bottom = fStatusView->Frame().top - 1;
1858
+		be_control_look->DrawScrollViewFrame(this, rect, updateRect,
1859
+			BRect(), BRect(), base, fBorderStyle, flags);
1793 1860
 	}
1794
-
1795
-	BView::SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
1796
-		// fills lower right rect between scroll bars
1797
-	FillRect(cornerRect);
1798 1861
 }
1799 1862
 
1800 1863
 
1801 1864
 void
1802
-BColumnListView::SaveState(BMessage* msg)
1865
+BColumnListView::SaveState(BMessage* message)
1803 1866
 {
1804
-	msg->MakeEmpty();
1867
+	message->MakeEmpty();
1805 1868
 
1806
-	for (int32 i = 0; BColumn* col = (BColumn*)fColumns.ItemAt(i); i++) {
1807
-		msg->AddInt32("ID",col->fFieldID);
1808
-		msg->AddFloat("width", col->fWidth);
1809
-		msg->AddBool("visible", col->fVisible);
1869
+	for (int32 i = 0; BColumn* column = (BColumn*)fColumns.ItemAt(i); i++) {
1870
+		message->AddInt32("ID", column->fFieldID);
1871
+		message->AddFloat("width", column->fWidth);
1872
+		message->AddBool("visible", column->fVisible);
1810 1873
 	}
1811 1874
 
1812
-	msg->AddBool("sortingenabled", fSortingEnabled);
1875
+	message->AddBool("sortingenabled", fSortingEnabled);
1813 1876
 
1814 1877
 	if (fSortingEnabled) {
1815
-		for (int32 i = 0; BColumn* col = (BColumn*)fSortColumns.ItemAt(i);
1878
+		for (int32 i = 0; BColumn* column = (BColumn*)fSortColumns.ItemAt(i);
1816 1879
 				i++) {
1817
-			msg->AddInt32("sortID", col->fFieldID);
1818
-			msg->AddBool("sortascending", col->fSortAscending);
1880
+			message->AddInt32("sortID", column->fFieldID);
1881
+			message->AddBool("sortascending", column->fSortAscending);
1819 1882
 		}
1820 1883
 	}
1821 1884
 }
1822 1885
 
1823 1886
 
1824 1887
 void
1825
-BColumnListView::LoadState(BMessage* msg)
1888
+BColumnListView::LoadState(BMessage* message)
1826 1889
 {
1827 1890
 	int32 id;
1828
-	for (int i = 0; msg->FindInt32("ID", i, &id) == B_OK; i++) {
1891
+	for (int i = 0; message->FindInt32("ID", i, &id) == B_OK; i++) {
1829 1892
 		for (int j = 0; BColumn* column = (BColumn*)fColumns.ItemAt(j); j++) {
1830 1893
 			if (column->fFieldID == id) {
1831 1894
 				// move this column to position 'i' and set its attributes
1832 1895
 				MoveColumn(column, i);
1833 1896
 				float width;
1834
-				if (msg->FindFloat("width", i, &width) == B_OK)
1897
+				if (message->FindFloat("width", i, &width) == B_OK)
1835 1898
 					column->SetWidth(width);
1836 1899
 				bool visible;
1837
-				if (msg->FindBool("visible", i, &visible) == B_OK)
1900
+				if (message->FindBool("visible", i, &visible) == B_OK)
1838 1901
 					column->SetVisible(visible);
1839 1902
 			}
1840 1903
 		}
1841 1904
 	}
1842 1905
 	bool b;
1843
-	if (msg->FindBool("sortingenabled", &b) == B_OK) {
1906
+	if (message->FindBool("sortingenabled", &b) == B_OK) {
1844 1907
 		SetSortingEnabled(b);
1845
-		for (int k = 0; msg->FindInt32("sortID", k, &id) == B_OK; k++) {
1908
+		for (int k = 0; message->FindInt32("sortID", k, &id) == B_OK; k++) {
1846 1909
 			for (int j = 0; BColumn* column = (BColumn*)fColumns.ItemAt(j);
1847 1910
 					j++) {
1848 1911
 				if (column->fFieldID == id) {
1849 1912
 					// add this column to the sort list
1850 1913
 					bool value;
1851
-					if (msg->FindBool("sortascending", k, &value) == B_OK)
1914
+					if (message->FindBool("sortascending", k, &value) == B_OK)
1852 1915
 						SetSortColumn(column, true, value);
1853 1916
 				}
1854 1917
 			}
... ...
@@ -1883,7 +1946,9 @@ BColumnListView::MinSize()
1883 1946
 {
1884 1947
 	BSize size;
1885 1948
 	size.width = 100;
1886
-	size.height = kTitleHeight + 4 * B_H_SCROLL_BAR_HEIGHT;
1949
+	size.height = std::max(kMinTitleHeight,
1950
+		ceilf(be_plain_font->Size() * kTitleSpacing))
1951
+		+ 4 * B_H_SCROLL_BAR_HEIGHT;
1887 1952
 	if (!fHorizontalScrollBar->IsHidden())
1888 1953
 		size.height += fHorizontalScrollBar->Frame().Height() + 1;
1889 1954
 	// TODO: Take border size into account
... ...
@@ -1898,14 +1963,27 @@ BColumnListView::PreferredSize()
1898 1963
 	BSize size = MinSize();
1899 1964
 	size.height += ceilf(be_plain_font->Size()) * 20;
1900 1965
 
1966
+	// return MinSize().width if there are no columns.
1901 1967
 	int32 count = CountColumns();
1902 1968
 	if (count > 0) {
1903
-		// return MinSize().width if there are no columns.
1904
-		size.width = 40.0f;
1969
+		BRect titleRect;
1970
+		BRect outlineRect;
1971
+		BRect vScrollBarRect;
1972
+		BRect hScrollBarRect;
1973
+		_GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect,
1974
+			hScrollBarRect);
1975
+		// Start with the extra width for border and scrollbars etc.
1976
+		size.width = titleRect.left - Bounds().left;
1977
+		size.width += Bounds().right - titleRect.right;
1978
+
1979
+		// If we want all columns to be visible at their current width,
1980
+		// we also need to add the extra margin width that the TitleView
1981
+		// uses to compute its _VirtualWidth() for the horizontal scroll bar.
1982
+		size.width += fTitleView->MarginWidth();
1905 1983
 		for (int32 i = 0; i < count; i++) {
1906 1984
 			BColumn* column = ColumnAt(i);
1907 1985
 			if (column != NULL)
1908
-				size.width += fOutlineView->GetColumnPreferredWidth(column);
1986
+				size.width += column->Width();
1909 1987
 		}
1910 1988
 	}
1911 1989
 
... ...
@@ -1922,24 +2000,23 @@ BColumnListView::MaxSize()
1922 2000
 
1923 2001
 
1924 2002
 void
1925
-BColumnListView::InvalidateLayout(bool descendants)
2003
+BColumnListView::LayoutInvalidated(bool descendants)
1926 2004
 {
1927
-	BView::InvalidateLayout(descendants);
1928 2005
 }
1929 2006
 
1930 2007
 
1931 2008
 void
1932 2009
 BColumnListView::DoLayout()
1933 2010
 {
1934
-	if (!(Flags() & B_SUPPORTS_LAYOUT))
2011
+	if ((Flags() & B_SUPPORTS_LAYOUT) == 0)
1935 2012
 		return;
1936 2013
 
1937 2014
 	BRect titleRect;
1938 2015
 	BRect outlineRect;
1939 2016
 	BRect vScrollBarRect;
1940 2017
 	BRect hScrollBarRect;
1941
-	_GetChildViewRects(Bounds(), !fHorizontalScrollBar->IsHidden(),
1942
-		titleRect, outlineRect, vScrollBarRect, hScrollBarRect);
2018
+	_GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect,
2019
+		hScrollBarRect);
1943 2020
 
1944 2021
 	fTitleView->MoveTo(titleRect.LeftTop());
1945 2022
 	fTitleView->ResizeTo(titleRect.Width(), titleRect.Height());
... ...
@@ -1951,6 +2028,27 @@ BColumnListView::DoLayout()
1951 2028
 	fVerticalScrollBar->ResizeTo(vScrollBarRect.Width(),
1952 2029
 		vScrollBarRect.Height());
1953 2030
 
2031
+	if (fStatusView != NULL) {
2032
+		BSize size = fStatusView->MinSize();
2033
+		if (size.height > B_H_SCROLL_BAR_HEIGHT)
2034
+			size.height = B_H_SCROLL_BAR_HEIGHT;
2035
+		if (size.width > Bounds().Width() / 2)
2036
+			size.width = floorf(Bounds().Width() / 2);
2037
+
2038
+		BPoint offset(hScrollBarRect.LeftTop());
2039
+
2040
+		if (fBorderStyle == B_PLAIN_BORDER) {
2041
+			offset += BPoint(0, 1);
2042
+		} else if (fBorderStyle == B_FANCY_BORDER) {
2043
+			offset += BPoint(-1, 2);
2044
+			size.height -= 1;
2045
+		}
2046
+
2047
+		fStatusView->MoveTo(offset);
2048
+		fStatusView->ResizeTo(size.width, size.height);
2049
+		hScrollBarRect.left = offset.x + size.width + 1;
2050
+	}
2051
+
1954 2052
 	fHorizontalScrollBar->MoveTo(hScrollBarRect.LeftTop());
1955 2053
 	fHorizontalScrollBar->ResizeTo(hScrollBarRect.Width(),
1956 2054
 		hScrollBarRect.Height());
... ...
@@ -1960,25 +2058,26 @@ BColumnListView::DoLayout()
1960 2058
 
1961 2059
 
1962 2060
 void
1963
-BColumnListView::_Init(bool showHorizontalScrollbar)
2061
+BColumnListView::_Init()
1964 2062
 {
1965 2063
 	SetViewColor(B_TRANSPARENT_32_BIT);
1966 2064
 
1967 2065
 	BRect bounds(Bounds());
1968 2066
 	if (bounds.Width() <= 0)
1969 2067
 		bounds.right = 100;
2068
+
1970 2069
 	if (bounds.Height() <= 0)
1971 2070
 		bounds.bottom = 100;
1972 2071
 
1973
-	for (int i = 0; i < (int)B_COLOR_TOTAL; i++)
1974
-		fColorList[i] = kColor[i];
2072
+	fCustomColors = false;
2073
+	_UpdateColors();
1975 2074
 
1976 2075
 	BRect titleRect;
1977 2076
 	BRect outlineRect;
1978 2077
 	BRect vScrollBarRect;
1979 2078
 	BRect hScrollBarRect;
1980
-	_GetChildViewRects(bounds, showHorizontalScrollbar, titleRect, outlineRect,
1981
-		vScrollBarRect, hScrollBarRect);
2079
+	_GetChildViewRects(bounds, titleRect, outlineRect, vScrollBarRect,
2080
+		hScrollBarRect);
1982 2081
 
1983 2082
 	fOutlineView = new OutlineView(outlineRect, &fColumns, &fSortColumns, this);
1984 2083
 	AddChild(fOutlineView);
... ...
@@ -1996,7 +2095,7 @@ BColumnListView::_Init(bool showHorizontalScrollbar)
1996 2095
 		"horizontal_scroll_bar", fTitleView, 0.0, bounds.Width(), B_HORIZONTAL);
1997 2096
 	AddChild(fHorizontalScrollBar);
1998 2097
 
1999
-	if (!showHorizontalScrollbar)
2098
+	if (!fShowingHorizontalScrollBar)
2000 2099
 		fHorizontalScrollBar->Hide();
2001 2100
 
2002 2101
 	fOutlineView->FixScrollBar(true);
... ...
@@ -2004,12 +2103,47 @@ BColumnListView::_Init(bool showHorizontalScrollbar)
2004 2103
 
2005 2104
 
2006 2105
 void
2007
-BColumnListView::_GetChildViewRects(const BRect& bounds,
2008
-	bool showHorizontalScrollbar, BRect& titleRect, BRect& outlineRect,
2009
-	BRect& vScrollBarRect, BRect& hScrollBarRect)
2106
+BColumnListView::_UpdateColors()
2107
+{
2108
+	if (fCustomColors)
2109
+		return;
2110
+
2111
+	fColorList[B_COLOR_BACKGROUND] = ui_color(B_LIST_BACKGROUND_COLOR);
2112
+	fColorList[B_COLOR_TEXT] = ui_color(B_LIST_ITEM_TEXT_COLOR);
2113
+	fColorList[B_COLOR_ROW_DIVIDER] = tint_color(
2114
+		ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_2_TINT);
2115
+	fColorList[B_COLOR_SELECTION] = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
2116
+	fColorList[B_COLOR_SELECTION_TEXT] =
2117
+		ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
2118
+
2119
+	// For non focus selection uses the selection color as BListView
2120
+	fColorList[B_COLOR_NON_FOCUS_SELECTION] =
2121
+		ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
2122
+
2123
+	// edit mode doesn't work very well
2124
+	fColorList[B_COLOR_EDIT_BACKGROUND] = tint_color(
2125
+		ui_color(B_LIST_SELECTED_BACKGROUND_COLOR), B_DARKEN_1_TINT);
2126
+	fColorList[B_COLOR_EDIT_BACKGROUND].alpha = 180;
2127
+
2128
+	// Unused color
2129
+	fColorList[B_COLOR_EDIT_TEXT] = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
2130
+
2131
+	fColorList[B_COLOR_HEADER_BACKGROUND] = ui_color(B_PANEL_BACKGROUND_COLOR);
2132
+	fColorList[B_COLOR_HEADER_TEXT] = ui_color(B_PANEL_TEXT_COLOR);
2133
+
2134
+	// Unused colors
2135
+	fColorList[B_COLOR_SEPARATOR_LINE] = ui_color(B_LIST_ITEM_TEXT_COLOR);
2136
+	fColorList[B_COLOR_SEPARATOR_BORDER] = ui_color(B_LIST_ITEM_TEXT_COLOR);
2137
+}
2138
+
2139
+
2140
+void
2141
+BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect,
2142
+	BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect)
2010 2143
 {
2011 2144
 	titleRect = bounds;
2012
-	titleRect.bottom = titleRect.top + kTitleHeight;
2145
+	titleRect.bottom = titleRect.top + std::max(kMinTitleHeight,
2146
+		ceilf(be_plain_font->Size() * kTitleSpacing));
2013 2147
 #if !LOWER_SCROLLBAR
2014 2148
 	titleRect.right -= B_V_SCROLL_BAR_WIDTH;
2015 2149
 #endif
... ...
@@ -2017,16 +2151,17 @@ BColumnListView::_GetChildViewRects(const BRect& bounds,
2017 2151
 	outlineRect = bounds;
2018 2152
 	outlineRect.top = titleRect.bottom + 1.0;
2019 2153
 	outlineRect.right -= B_V_SCROLL_BAR_WIDTH;
2020
-	if (showHorizontalScrollbar)
2154
+	if (fShowingHorizontalScrollBar)
2021 2155
 		outlineRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
2022 2156
 
2023 2157
 	vScrollBarRect = bounds;
2024 2158
 #if LOWER_SCROLLBAR
2025
-	vScrollBarRect.top += kTitleHeight;
2159
+	vScrollBarRect.top += std::max(kMinTitleHeight,
2160
+		ceilf(be_plain_font->Size() * kTitleSpacing));
2026 2161
 #endif
2027 2162
 
2028 2163
 	vScrollBarRect.left = vScrollBarRect.right - B_V_SCROLL_BAR_WIDTH;
2029
-	if (showHorizontalScrollbar)
2164
+	if (fShowingHorizontalScrollBar)
2030 2165
 		vScrollBarRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
2031 2166
 
2032 2167
 	hScrollBarRect = bounds;
... ...
@@ -2095,10 +2230,10 @@ TitleView::TitleView(BRect rect, OutlineView* horizontalSlave,
2095 2230
 	fUpSortArrow->SetBits((const void*) kUpSortArrow8x8, 64, 0, B_CMAP8);
2096 2231
 	fDownSortArrow->SetBits((const void*) kDownSortArrow8x8, 64, 0, B_CMAP8);
2097 2232
 
2098
-	fResizeCursor = new BCursor(kResizeCursorData);
2099
-	fMinResizeCursor = new BCursor(kMinResizeCursorData);
2100
-	fMaxResizeCursor = new BCursor(kMaxResizeCursorData);
2101
-	fColumnMoveCursor = new BCursor(kColumnMoveCursorData);
2233
+	fResizeCursor = new BCursor(B_CURSOR_ID_RESIZE_EAST_WEST);
2234
+	fMinResizeCursor = new BCursor(B_CURSOR_ID_RESIZE_EAST);
2235
+	fMaxResizeCursor = new BCursor(B_CURSOR_ID_RESIZE_WEST);
2236
+	fColumnMoveCursor = new BCursor(B_CURSOR_ID_MOVE);
2102 2237
 
2103 2238
 	FixScrollBar(true);
2104 2239
 }
... ...
@@ -2168,6 +2303,8 @@ TitleView::SetColumnVisible(BColumn* column, bool visible)
2168 2303
 
2169 2304
 	Invalidate(titleInvalid);
2170 2305
 	fOutlineView->Invalidate(outlineInvalid);
2306
+
2307
+	FixScrollBar(false);
2171 2308
 }
2172 2309
 
2173 2310
 
... ...
@@ -2295,6 +2432,13 @@ TitleView::SetColumnFlags(column_flags flags)
2295 2432
 }
2296 2433
 
2297 2434
 
2435
+float
2436
+TitleView::MarginWidth() const
2437
+{
2438
+	return MAX(kLeftMargin, fMasterView->LatchWidth()) + kRightMargin;
2439
+}
2440
+
2441
+
2298 2442
 void
2299 2443
 TitleView::ResizeSelectedColumn(BPoint position, bool preferred)
2300 2444
 {
... ...
@@ -2404,38 +2548,7 @@ void
2404 2548
 TitleView::DrawTitle(BView* view, BRect rect, BColumn* column, bool depressed)
2405 2549
 {
2406 2550
 	BRect drawRect;
2407
-	rgb_color borderColor = mix_color(
2408
-		fMasterView->Color(B_COLOR_HEADER_BACKGROUND),
2409
-		make_color(0, 0, 0), 128);
2410
-	rgb_color backgroundColor;
2411
-
2412
-	rgb_color bevelHigh;
2413
-	rgb_color bevelLow;
2414
-	// Want exterior borders to overlap.
2415
-	if (be_control_look == NULL) {
2416
-		rect.right += 1;
2417
-		drawRect = rect;
2418
-		drawRect.InsetBy(2, 2);
2419
-		if (depressed) {
2420
-			backgroundColor = mix_color(
2421
-				fMasterView->Color(B_COLOR_HEADER_BACKGROUND),
2422
-				make_color(0, 0, 0), 64);
2423
-			bevelHigh = mix_color(backgroundColor, make_color(0, 0, 0), 64);
2424
-			bevelLow = mix_color(backgroundColor, make_color(255, 255, 255),
2425
-				128);
2426
-			drawRect.left++;
2427
-			drawRect.top++;
2428
-		} else {
2429
-			backgroundColor = fMasterView->Color(B_COLOR_HEADER_BACKGROUND);
2430
-			bevelHigh = mix_color(backgroundColor, make_color(255, 255, 255),
2431
-				192);
2432
-			bevelLow = mix_color(backgroundColor, make_color(0, 0, 0), 64);
2433
-			drawRect.bottom--;
2434
-			drawRect.right--;
2435
-		}
2436
-	} else {
2437
-		drawRect = rect;
2438
-	}
2551
+	drawRect = rect;
2439 2552
 
2440 2553
 	font_height fh;
2441 2554
 	GetFontHeight(&fh);
... ...
@@ -2443,49 +2556,27 @@ TitleView::DrawTitle(BView* view, BRect rect, BColumn* column, bool depressed)
2443 2556
 	float baseline = floor(drawRect.top + fh.ascent
2444 2557
 		+ (drawRect.Height() + 1 - (fh.ascent + fh.descent)) / 2);
2445 2558
 
2446
-	if (be_control_look != NULL) {
2447
-		BRect bgRect = rect;
2448
-
2449
-		rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
2450
-		view->SetHighColor(tint_color(base, B_DARKEN_2_TINT));
2451
-		view->StrokeLine(bgRect.LeftBottom(), bgRect.RightBottom());
2559
+	BRect bgRect = rect;
2452 2560
 
2453
-		bgRect.bottom--;
2454
-		bgRect.right--;
2561
+	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
2562
+	view->SetHighColor(tint_color(base, B_DARKEN_2_TINT));
2563
+	view->StrokeLine(bgRect.LeftBottom(), bgRect.RightBottom());
2455 2564
 
2456
-		if (depressed)
2457
-			base = tint_color(base, B_DARKEN_1_TINT);
2565
+	bgRect.bottom--;
2566
+	bgRect.right--;
2458 2567
 
2459
-		be_control_look->DrawButtonBackground(view, bgRect, rect, base, 0,
2460
-			BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
2568
+	if (depressed)
2569
+		base = tint_color(base, B_DARKEN_1_TINT);
2461 2570
 
2462
-		view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
2463
-			B_DARKEN_2_TINT));
2464
-		view->StrokeLine(rect.RightTop(), rect.RightBottom());
2571
+	be_control_look->DrawButtonBackground(view, bgRect, rect, base, 0,
2572
+		BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
2465 2573
 
2466
-	} else {
2467
-
2468
-		view->SetHighColor(borderColor);
2469
-		view->StrokeRect(rect);
2470
-		view->BeginLineArray(4);
2471
-		view->AddLine(BPoint(rect.left + 1, rect.top + 1),
2472
-			BPoint(rect.right - 1, rect.top + 1), bevelHigh);
2473
-		view->AddLine(BPoint(rect.left + 1, rect.top + 1),
2474
-			BPoint(rect.left + 1, rect.bottom - 1), bevelHigh);
2475
-		view->AddLine(BPoint(rect.right - 1, rect.top + 1),
2476
-			BPoint(rect.right - 1, rect.bottom - 1), bevelLow);
2477
-		view->AddLine(BPoint(rect.left + 2, rect.bottom-1),
2478
-			BPoint(rect.right - 1, rect.bottom - 1), bevelLow);
2479
-		view->EndLineArray();
2480
-
2481
-		view->SetHighColor(backgroundColor);
2482
-		view->SetLowColor(backgroundColor);
2483
-
2484
-		view->FillRect(rect.InsetByCopy(2, 2));
2485
-	}
2574
+	view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
2575
+		B_DARKEN_2_TINT));
2576
+	view->StrokeLine(rect.RightTop(), rect.RightBottom());
2486 2577
 
2487 2578
 	// If no column given, nothing else to draw.
2488
-	if (!column)
2579
+	if (column == NULL)
2489 2580
 		return;
2490 2581
 
2491 2582
 	view->SetHighColor(fMasterView->Color(B_COLOR_HEADER_TEXT));
... ...
@@ -2554,16 +2645,16 @@ TitleView::DrawTitle(BView* view, BRect rect, BColumn* column, bool depressed)
2554 2645
 float
2555 2646
 TitleView::_VirtualWidth() const
2556 2647
 {
2557
-	float width = 0.0f;
2648
+	float width = MarginWidth();
2558 2649
 
2559 2650
 	int32 count = fColumns->CountItems();
2560 2651
 	for (int32 i = 0; i < count; i++) {
2561 2652
 		BColumn* column = reinterpret_cast<BColumn*>(fColumns->ItemAt(i));
2562
-		width += column->Width();
2653
+		if (column->IsVisible())
2654
+			width += column->Width();
2563 2655
 	}
2564 2656
 
2565
-	return width + MAX(kLeftMargin,
2566
-		fMasterView->LatchWidth()) + kRightMargin * 2;
2657
+	return width;
2567 2658
 }
2568 2659
 
2569 2660
 
... ...
@@ -2593,14 +2684,14 @@ TitleView::Draw(BRect invalidRect)
2593 2684
 	}
2594 2685
 
2595 2686
 
2596
-	// Bevels for right title margin
2687
+	// bevels for right title margin
2597 2688
 	if (columnLeftEdge <= invalidRect.right) {
2598 2689
 		BRect titleRect(columnLeftEdge, 0, Bounds().right + 2,
2599 2690
 			fVisibleRect.Height());
2600 2691
 		DrawTitle(this, titleRect, NULL, false);
2601 2692
 	}
2602 2693
 
2603
-	// Bevels for left title margin
2694
+	// bevels for left title margin
2604 2695
 	if (invalidRect.left < MAX(kLeftMargin, fMasterView->LatchWidth())) {
2605 2696
 		BRect titleRect(0, 0, MAX(kLeftMargin, fMasterView->LatchWidth()) - 1,
2606 2697
 			fVisibleRect.Height());
... ...
@@ -2608,7 +2699,7 @@ TitleView::Draw(BRect invalidRect)
2608 2699
 	}
2609 2700
 
2610 2701
 #if DRAG_TITLE_OUTLINE
2611
-	// (Internal) Column Drag Indicator
2702
+	// (internal) column drag indicator
2612 2703
 	if (fCurrentState == DRAG_COLUMN_INSIDE_TITLE) {
2613 2704
 		BRect dragRect(fSelectedColumnRect);
2614 2705
 		dragRect.OffsetTo(fCurrentDragPosition.x - fClickPoint.x, 0);
... ...
@@ -2648,23 +2739,24 @@ TitleView::MessageReceived(BMessage* message)
2648 2739
 		if (message->FindInt32("be:field_num", &num) == B_OK) {
2649 2740
 			for (int index = 0; index < fColumns->CountItems(); index++) {
2650 2741
 				BColumn* column = (BColumn*) fColumns->ItemAt(index);
2651
-				if (!column)
2742
+				if (column == NULL)
2652 2743
 					continue;
2744
+
2653 2745
 				if (column->LogicalFieldNum() == num)
2654 2746
 					column->SetVisible(!column->IsVisible());
2655 2747
 			}
2656 2748
 		}
2657 2749
 		return;
2658
-	} else {
2659
-		BView::MessageReceived(message);
2660 2750
 	}
2751
+
2752
+	BView::MessageReceived(message);
2661 2753
 }
2662 2754
 
2663 2755
 
2664 2756
 void
2665 2757
 TitleView::MouseDown(BPoint position)
2666 2758
 {
2667
-	if(fEditMode)
2759
+	if (fEditMode)
2668 2760
 		return;
2669 2761
 
2670 2762
 	int32 buttons = 1;
... ...
@@ -2672,58 +2764,64 @@ TitleView::MouseDown(BPoint position)
2672 2764
 	if (buttons == B_SECONDARY_MOUSE_BUTTON
2673 2765
 		&& (fColumnFlags & B_ALLOW_COLUMN_POPUP)) {
2674 2766
 		// Right mouse button -- bring up menu to show/hide columns.
2675
-		if (!fColumnPop) fColumnPop = new BPopUpMenu("Columns", false, false);
2767
+		if (fColumnPop == NULL)
2768
+			fColumnPop = new BPopUpMenu("Columns", false, false);
2769
+
2676 2770
 		fColumnPop->RemoveItems(0, fColumnPop->CountItems(), true);
2677 2771
 		BMessenger me(this);
2678 2772
 		for (int index = 0; index < fColumns->CountItems(); index++) {
2679 2773
 			BColumn* column = (BColumn*) fColumns->ItemAt(index);
2680
-			if (!column) continue;
2774
+			if (column == NULL)
2775
+				continue;
2776
+
2681 2777
 			BString name;
2682 2778
 			column->GetColumnName(&name);
2683
-			BMessage* msg = new BMessage(kToggleColumn);
2684
-			msg->AddInt32("be:field_num", column->LogicalFieldNum());
2685
-			BMenuItem* it = new BMenuItem(name.String(), msg);
2686
-			it->SetMarked(column->IsVisible());
2687
-			it->SetTarget(me);
2688
-			fColumnPop->AddItem(it);
2779
+			BMessage* message = new BMessage(kToggleColumn);
2780
+			message->AddInt32("be:field_num", column->LogicalFieldNum());
2781
+			BMenuItem* item = new BMenuItem(name.String(), message);
2782
+			item->SetMarked(column->IsVisible());
2783
+			item->SetTarget(me);
2784
+			fColumnPop->AddItem(item);
2689 2785
 		}
2786
+
2690 2787
 		BPoint screenPosition = ConvertToScreen(position);
2691 2788
 		BRect sticky(screenPosition, screenPosition);
2692 2789
 		sticky.InsetBy(-5, -5);
2693 2790
 		fColumnPop->Go(ConvertToScreen(position), true, false, sticky, true);
2791
+
2694 2792
 		return;
2695 2793
 	}
2696 2794
 
2697 2795
 	fResizingFirstColumn = true;
2698 2796
 	float leftEdge = MAX(kLeftMargin, fMasterView->LatchWidth());
2699 2797
 	for (int index = 0; index < fColumns->CountItems(); index++) {
2700
-		BColumn* column = (BColumn*) fColumns->ItemAt(index);
2701
-		if (!column->IsVisible())
2798
+		BColumn* column = (BColumn*)fColumns->ItemAt(index);
2799
+		if (column == NULL || !column->IsVisible())
2702 2800
 			continue;
2703 2801
 
2704 2802
 		if (leftEdge > position.x + kColumnResizeAreaWidth / 2)
2705 2803
 			break;
2706 2804
 
2707
-		//	Check for resizing a column
2805
+		// check for resizing a column
2708 2806
 		float rightEdge = leftEdge + column->Width();
2709 2807
 
2710 2808
 		if (column->ShowHeading()) {
2711 2809
 			if (position.x > rightEdge - kColumnResizeAreaWidth / 2
2712 2810
 				&& position.x < rightEdge + kColumnResizeAreaWidth / 2
2713 2811
 				&& column->MaxWidth() > column->MinWidth()
2714
-				&& (fColumnFlags & B_ALLOW_COLUMN_RESIZE)) {
2812
+				&& (fColumnFlags & B_ALLOW_COLUMN_RESIZE) != 0) {
2715 2813
 
2716 2814
 				int32 clicks = 0;
2815
+				fSelectedColumn = column;
2816
+				fSelectedColumnRect.Set(leftEdge, 0, rightEdge,
2817
+					fVisibleRect.Height());
2717 2818
 				Window()->CurrentMessage()->FindInt32("clicks", &clicks);
2718
-				if (clicks == 2) {
2819
+				if (clicks == 2 || buttons == B_TERTIARY_MOUSE_BUTTON) {
2719 2820
 					ResizeSelectedColumn(position, true);
2720 2821
 					fCurrentState = INACTIVE;
2721 2822
 					break;
2722 2823
 				}
2723 2824
 				fCurrentState = RESIZING_COLUMN;
2724
-				fSelectedColumn = column;
2725
-				fSelectedColumnRect.Set(leftEdge, 0, rightEdge,
2726
-					fVisibleRect.Height());
2727 2825
 				fClickPoint = BPoint(position.x - rightEdge - 1,
2728 2826
 					position.y - fSelectedColumnRect.top);
2729 2827
 				SetMouseEventMask(B_POINTER_EVENTS,
... ...
@@ -2733,7 +2831,7 @@ TitleView::MouseDown(BPoint position)
2733 2831
 
2734 2832
 			fResizingFirstColumn = false;
2735 2833
 
2736
-			//	Check for clicking on a column.
2834
+			// check for clicking on a column
2737 2835
 			if (position.x > leftEdge && position.x < rightEdge) {
2738 2836
 				fCurrentState = PRESSING_COLUMN;
2739 2837
 				fSelectedColumn = column;
... ...
@@ -2971,7 +3069,7 @@ TitleView::FrameResized(float width, float height)
2971 3069
 }
2972 3070
 
2973 3071
 
2974
-// #pragma mark -
3072
+// #pragma mark - OutlineView
2975 3073
 
2976 3074
 
2977 3075
 OutlineView::OutlineView(BRect rect, BList* visibleColumns, BList* sortColumns,
... ...
@@ -3038,9 +3136,9 @@ OutlineView::Clear()
3038 3136
 	DeselectAll();
3039 3137
 		// Make sure selection list doesn't point to deleted rows!
3040 3138
 	RecursiveDeleteRows(&fRows, false);
3041
-	Invalidate();
3042 3139
 	fItemsHeight = 0.0;
3043 3140
 	FixScrollBar(true);
3141
+	Invalidate();
3044 3142
 }
3045 3143
 
3046 3144
 
... ...
@@ -3288,7 +3386,7 @@ OutlineView::Draw(BRect invalidBounds)
3288 3386
 		tintedLine = !tintedLine;
3289 3387
 		float rowHeight = row->Height();
3290 3388
 
3291
-		if (line > invalidBounds.top - rowHeight) {
3389
+		if (line >= invalidBounds.top - rowHeight) {
3292 3390
 			bool isFirstColumn = true;
3293 3391
 			float fieldLeftEdge = MAX(kLeftMargin, fMasterView->LatchWidth());
3294 3392
 
... ...
@@ -3467,6 +3565,7 @@ OutlineView::FindRow(float ypos, int32* _rowIndent, float* _top)
3467 3565
 			line += rowHeight + 1;
3468 3566
 		}
3469 3567
 	}
3568
+
3470 3569
 	return NULL;
3471 3570
 }
3472 3571
 
... ...
@@ -3543,8 +3642,11 @@ OutlineView::MouseDown(BPoint position)
3543 3642
 			fCurrentRow = new_row;
3544 3643
 			fCurrentField = new_field;
3545 3644
 			fCurrentCode = B_INSIDE_VIEW;
3645
+			BMessage* message = Window()->CurrentMessage();
3646
+			int32 buttons = 1;
3647
+			message->FindInt32("buttons", &buttons);
3546 3648
 			fCurrentColumn->MouseDown(fMasterView, fCurrentRow,
3547
-				fCurrentField, fFieldRect, position, 1);
3649
+				fCurrentField, fFieldRect, position, buttons);
3548 3650
 		}
3549 3651
 
3550 3652
 		if (!fEditMode) {
... ...
@@ -3928,6 +4030,7 @@ OutlineView::ChangeFocusRow(bool up, bool updateSelection,
3928 4030
 			fFocusRowRect.right = 10000;
3929 4031
 			Invalidate(fFocusRowRect);
3930 4032
 		}
4033
+		BRow* oldFocusRow = fFocusRow;
3931 4034
 		fFocusRow = newRow;
3932 4035
 		fFocusRowRect.top = top;
3933 4036
 		fFocusRowRect.left = 0;
... ...
@@ -3941,12 +4044,32 @@ OutlineView::ChangeFocusRow(bool up, bool updateSelection,
3941 4044
 				DeselectAll();
3942 4045
 			}
3943 4046
 
4047
+			// if the focus row isn't selected, add it to the selection
3944 4048
 			if (fFocusRow->fNextSelected == 0) {
3945 4049
 				fFocusRow->fNextSelected
3946 4050
 					= fSelectionListDummyHead.fNextSelected;
3947 4051
 				fFocusRow->fPrevSelected = &fSelectionListDummyHead;
3948 4052
 				fFocusRow->fNextSelected->fPrevSelected = fFocusRow;
3949 4053
 				fFocusRow->fPrevSelected->fNextSelected = fFocusRow;
4054
+			} else if (oldFocusRow != NULL
4055
+				&& fSelectionListDummyHead.fNextSelected == oldFocusRow
4056
+				&& (((IndexOf(oldFocusRow->fNextSelected)
4057
+						< IndexOf(oldFocusRow)) == up)
4058
+					|| fFocusRow == oldFocusRow->fNextSelected)) {
4059
+					// if the focus row is selected, if:
4060
+					// 1. the previous focus row is last in the selection
4061
+					// 2a. the next selected row is now the focus row
4062
+					// 2b. or the next selected row is beyond the focus row
4063
+					//	   in the move direction
4064
+					// then deselect the previous focus row
4065
+				fSelectionListDummyHead.fNextSelected
4066