rem MindMap ....... Rev 6.0 rem A J Tooth // 29th February 2004 - 5th March 2004 rem Revised February 2005 for smoother colouring rem Revised file selection and text orientation February 2006 rem Revised to adapt to different screen resolution May 2007 rem on error if (err=17) then quit rem ========================================================= rem Implements a PC-based version of the Tony Buzan Mind-Map rem ========================================================= rem ========================================================= himem=lomem + 10000000 *FLOAT64 install @lib$+"MyUtils.bbc" rem ========================================================= rem Setup proc_setup rem Introductory Sequence proc_intro rem Set up or load Topic proc_topic rem MAIN SEQUENCE repeat proc_cont if f%=-1 then rem Only performed on EXIT proc_qsave(IName$) else proc_label endif until f%=-1 *FONT Verdana,12 print tab(5,3);"File saved as: ";IName$ repeat : a$=inkey$(10) : until a$="" a$=inkey$(150) quit end rem End of Program +++++++++++++++++++++++++++++++++++++++++++++ rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Setup def proc_setup rem Set up Full Screen and base colours proc_fullscreen(xscreen%,yscreen%) colour 143,255,255,255 colour 4 : colour 128 : cls dim rgb% 3 Sz%=50 : f%=0 colour 7,0,0,200 : rem Default label colour is BLUE endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Intro def proc_intro local w&,u& rem Find the path to this program, and therefore the default location of any saved MindMaps dim path% 255 sys "GetModuleFileName", 0, path%, 255 to le% repeat le% -= 1 : until path%?le% = asc"\" path%?(le%+1) = 13 path$ = $path% *CD C:\ command$ ="CD "+chr$(34)+path$+chr$(34) oscli command$ rem TITLE SEQUENCE *REFRESH OFF Font$="Algerian," colour 4 for w&=0 to 30 Fs%=40-int(30*(w&/30)) cls command$="FONT "+Font$+str$(Fs%) oscli command$ print tab(10+w&,10);"The Mind Map" *REFRESH a$=inkey$(1) next w& for u&=1 to 7 Fs&=10+6*u& cls command$="FONT "+Font$+str$(Fs&) oscli command$ print tab(5,5);"The Mind Map" *REFRESH a$=inkey$(1) next u& rem Display my Icon in compiled version *REFRESH ON proc_AJTicon(10,yscreen%/8) a$=inkey$(20) *FONT Verdana,12 endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Setup : Topic def proc_topic local x%,y%,h%,flg%,k%,a%,Tx%,Ty%,w$,t%,w&,j% proc_back(fn_adapt(0,40),fn_adapt(1,120),fn_adapt(0,1900),fn_adapt(1,480),100,100,0) msg$="\1Left-click to create a \2NEW \1Mind-Map, or right-click to fetch a saved Mind-Map." proc_msg("Georgia",14,"B",fn_adapt(0,150),fn_adapt(1,550),msg$) msg$="\1+ \4Once Mind-Map has been loaded or created, move the mouse over any \2COLOURED \4area." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,450),msg$) msg$="\1+ \4When the Mouse icon changes to \2CROSS-HAIRS \4then \2LEFT\4-click for the start of a branch." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,400),msg$) msg$="\1+ \4Then move the mouse to where the end of a branch is desired and \2RIGHT\4-click." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,350),msg$) msg$="\1+ \4Next, key in the name or label for the branch, and press -\2Enter\4-." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,300),msg$) msg$="\1+ \4To make the mouse icon reappear, press any key, or move the mouse-wheel." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,250),msg$) msg$="\1+ \4Press -\2F2\4- or roll the mouse wheel to \2CHANGE \4the \2LABEL COLOUR\4." proc_msg("Georgia",12,"",fn_adapt(0,100),fn_adapt(1,200),msg$) b&=0 : proc_mclick(b&) rem Spacebar has ASCII code 32 *FONT 12,B @vdu%!216=8 @vdu%!220=16 case b& of when 4: print tab(25,10);"Enter the TOPIC or SUBJECT for your Mind-Map. " colour 128 : colour 1 : print tab(76,10);"?"; rem Complex input routine with EDIT enabled Name$="" : t%=0 repeat repeat w&=inkey(1) until w&>0 rem Only permit "normal" characters if (w&>31 and w&<123) or w&=163 then Name$=Name$+chr$(w&) t%+=2 : colour 1: print tab((78+t%),10);chr$(w&); endif if (w&=8 or w&=135) then j&=len(Name$) print tab((78+t%),10);" "; t%-=2 if j&>0 then Name$=left$(Name$,(j&-1)) endif rem Only EXIT when -Enter- is pressed until (w&=13) rem Set the origin to the centre of the screen origin xscreen%,yscreen% : colour 143 : cls rem Display the central motif, bearing the TOPIC name for a&=0 to 50 fc=2*a&/50 : if fc>1.0 then fc=1.0 gr&=5*a& : re&=5*a& colour 7,int(255*(1-fc)+fc*re&),int(255*(1-fc)+fc*gr&),245 move 0,0 : move (200-a&),0 gcol 7 : plot 205,0,(100-a&) next a& nl&=len(Name$) gcol 0 : vdu 5 : move (-10*nl&),15 : print Name$ when 1: mouse on rem Select a mind map bitmap proc_mmchoose rem Display the chosen MindMap sys "SetStretchBltMode", @memhdc%, 3 command$=" DISPLAY "+chr$(34)+IName$+chr$(34)+" "+str$(0)+","+str$(0)+","+str$(2*xscreen%)+","+str$(2*yscreen%) oscli command$ origin xscreen%,yscreen% endcase colour 7,0,0,200 : rem Reset default label colour to BLUE endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Continue def proc_cont local x%,y%,h& *FONT Verdana,12,B vdu 4:colour 142:colour 4: print tab(0,0);spc(fn_adapt(0,150)) : rem Clear previous input line print tab(0,1);spc(fn_adapt(0,150)) print tab(0,0);"Press -F1- to QUIT and Save. Press -Esc- to just QUIT." mouse on 0 : gcol 7 rem Select first point f%=0 repeat f%=inkey(-114) : rem Checks for -F1- being pressed mouse x%,y%,h& ax%=x% : ay%=y% !rgb%=tint(x%,y%) : rem Get the screen colour at the mouse position r&=?rgb% g&=?(rgb%+1) b&=?(rgb%+2) if r&<230 or g&<230 or b&<230 then mouse on 3 else mouse on 0 endif rem Exit if the left mouse button is pressed or -F1- is pressed until (h&=4 and (r&<230 or g&<230 or b&<230)) or f%=-1 if (not(f%=-1)) then rem Select other end of line mouse off rem Set Colour and Level if b&=245 then re&=rnd(220) : gr&=rnd(220) : bl&=rnd(220) else re&=r& : gr&=g& : bl&=b& endif colour 5,re&,gr&,bl& repeat mouse x%,y%,h& bx%=x% : by%=y% rem Repeatedly draw and un-draw a line move ax%,ay% : gcol 5 : draw bx%,by% move ax%,ay% : gcol 15 : draw bx%,by% until h&=1 rem Draw the line in the chosen position move ax%,ay% : gcol 5 : draw bx%,by% endif endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Save MindMap def proc_qsave(return UName$) local k&,j% k&=len(Name$) if left$(Name$,2)<>"MM" then rem Replace any spaces with underscore character for j&=1 to k& ch$=mid$(Name$,j&,1) if ch$=" " then mid$(Name$,j&,1)="_" next j& UName$="MM"+Name$+".bmp" else UName$=Name$ endif vdu 26 rem Save the entire screen area command$=" SCREENSAVE "+chr$(34)+UName$+chr$(34) oscli command$ endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Enter & Display Label def proc_label local Pr%,w&,Fl%,md,a1,a2,u&,v%,k%,t& vdu 4 : print tab(0,0);spc(150) : rem Clear the input line *FONT Verdana,10,B colour 4 : print tab(0,0);"What is the label for this latest branch ", *FONT @vdu%!216=8 @vdu%!220=16 colour 1 : print tab(35,0);"?"; rem Complex input routine with EDIT enabled Fl&=0 : Lab$="" : t%=0 repeat repeat w&=inkey(1) until w&>0 rem Only displays palette if F2 pressed, or the mouse wheel is rotated if ((w&=140 or w&=141 or w&=146)) then proc_palt Fl&=1 rem Only permit "normal" characters if (w&>31 and w&<123) or w&=163 then Lab$=Lab$+chr$(w&) t%+=1 : colour 1: print tab((36+t%),0);chr$(w&); endif if (w&=8 or w&=135) then k%=len(Lab$) print tab((36+t%),0);" "; t%-=1 if k%>0 then Lab$=left$(Lab$,(k%-1)) endif rem Only EXIT when -Enter- is pressed, or another attempt is made to change the palette until w&=13 rem Work out base line for Label Display md=sqr((bx%-ax%)^2 + (by%-ay%)^2) a1=(by%-ay%)/md a2=-(bx%-ax%)/md if (bx%0 then Ang%=10*int(deg(atn((y2%-y1%)/(x2%-x1%)))) else if y2%>y1% then Ang%=900 else Ang%=-900 endif sys "CreateFont", 18, 0, Ang%, 900, 800,0, 0, 0, 0, 0, 0, 0, 0, "Verdana" to font% sys "SelectObject", @memhdc%, font% to oldfont% for t&=1 to n& rem Heuristically pleasing text orientation if (y2%-y1%)<(3*(x2%-x1%)) then c$=mid$(Lab$,t&,1) else c$=mid$(Lab$,(n&+1-t&),1) endif rem Space the label characters lam=(10+(70*t&/n&))/100 px%=int(x1%+lam*(x2%-x1%)) py%=int(y1%+lam*(y2%-y1%)) move px%,py% : print c$ next t& vdu 4 sys "InvalidateRect", @hwnd%, 0, 0 sys "SelectObject", @memhdc%, oldfont% sys "DeleteObject", font% endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Change Label Colour def proc_palt local q&,x%,y%,h& rem Display the available colours repeat until inkey(0)=-1 for q&=0 to 6 gcol q& rectangle fill (50*q&-(xscreen%-400)),-yscreen%,50 gcol (q&+8) rectangle fill (50*q&-xscreen%),-yscreen%,50 next q& repeat mouse x%,y%,h& !rgb%=tint(x%,y%) : rem Get the colour from the squares on the screen r&=?rgb% g&=?(rgb%+1) b&=?(rgb%+2) if (x%<-(xscreen%-800) and y%<-(yscreen%-50)) then mouse on 3 else mouse on 0 endif until (h&=4 and (x%<-(xscreen%-800) and y%<-(yscreen%-50))) colour 7,r&,g&,b& : rem Reset the plot colour (always reassigns "off-white") rem Get rid of the palette from the screen gcol 15 : rectangle fill -xscreen%,-yscreen%,750,50 rem Return to default mouse icon mouse on 0 endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rem Choose a File def proc_mmchoose local gg&,rn&,n$ dim pf% 75, ff% 30, fm% 255 !pf% = 76 pf%!4 = @hwnd% pf%!12 = ff% pf%!28 = fm% pf%!32 = 256 pf%!52 = 6 $ff% ="MindMap files"+chr$0+"MM*.bmp"+chr$0+chr$0 sys "GetOpenFileName", pf% to result% if result%<>0 then fullname$=$$fm% rn&=len(fullname$) gg&=0 : pic$="" repeat n$=mid$(fullname$,rn&-gg&,1) if n$<>"\" then pic$=n$+pic$ : gg&+=1 until n$="\" pre$=left$(fullname$,rn&-gg&) rem Change the current Directory command$="CD "+chr$(34)+pre$+chr$(34) oscli command$ IName$=pre$+pic$ Name$=pic$ endproc rem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++