Listings des Stacks "HTnotes"Stack-Scripteon openStack start using stack "Schlagworte" if the hilite of bg button "Show Groups" is TRUE then show groups end if end openStack on closeStack stop using stack "Schlagworte" end closeStack -- -- HYPERMEDIA TOOLS -- on mouseUp -- Behandelt jeden Mausklick, es sei denn, -- Knöpfe oder Felder hätten ein eigenes -- Handle. -- Als erstes prüfen, ob der Klick in einem -- Feld war: if word 2 of name of the target is "field" then -- den angeklickten Text abschneiden und in -- eckigen Klammern einschließen: put "[" & truncate(clickText(), 25) & "]"¬ into myName -- Autoren-Aktionen: if the cmdKey is down then -- Apfel-Taste bedeutet "Autoren-Aktion" if the shiftKey is down then -- Apfel- und Umschalttaste bedeutet "Löschen" deleteLink clickChunk(), myName else addLink clickChunk(), myName end if -- und nun die Aktionen des "einfachen Lesers": -- 1. Leser klickte in "group Text": else if textstyle of clickChunk() contains "group" then popLinks myName else -- 2. Leser klickte auf einen nicht gruppierten Text: if isaPopUp(name of the target) then -- War dort ein PopUp Feld? set lockText of the target to TRUE -- dann schließe es! hide the target else -- Leser klickte irgendwohin, also alle PopUps schließen closeAllPopUps end if end if else -- 3. Leser klickte außerhalb jeden Feldes, -- ebenfalls alle PopUps schließen closeAllPopUps end if end mouseUp -- -- User Modus -- on popLinks myName if there is a cd fld myName then set topLeft of cd fld myName to clickH() + 10, clickV() + 10 -- paßt unser PopUp-Feld denn noch auf unsere Karte? if top of cd fld myName < top of card then set top of cd fld myName to top of card end if if left of cd fld myName < left of cd then set left of cd fld myName to left of card end if if right of cd fld myName > right of card then set right of cd fld myName to right of card end if if bottom of cd fld myName > bottom of cd then set bottom of cd fld myName to bottom of card end if show cd fld myName end if if there is a cd button myName then set loc of cd button myName to clickH(), clickV() - 10 show cd button myName end if end popLinks -- -- Hypertext Tools -- on addLink myChunk, myName -- fügt einen neuen HyperText Link hinzu; if "group" is in textStyle of myChunk then -- es gibt bereits einen Link popLinks myName -- zeige den Link beep answer "Es gibt bereit einen Link!"¬ with "OK" else -- jetzt berechnen wir Anfang und Ende des selektierten -- Textes if item 1 of mouseLoc() > item 1 of clickLoc() then put word 2 of myChunk + (length(msg) - 1)¬ into word 4 of myChunk end if -- Gültigkeitsüberprüfung: Der Leser muß von links nach -- rechts markiert haben! if value of myChunk <> msg then beep answer "Sie müssen von links nach rechts markieren."¬ & return & "Bitte versuchen Sie es noch einmal."¬ with "OK" exit addLink end if -- Es gibt also noch keine Links, wir müssen den Benutzer -- fragen, welche Art von Link er anlegen will: put return & "Wollen Sie einen Link zu einer neuen Karte," &&¬ "zu einem Moovie, zu einem Bild oder" &&¬ "ein PopUp-Feld für '" & value(myChunk) & "' anlegen?"¬ into myPrompt put empty into myLink put possibleLinks() into myList get showList(myList, myPrompt, TRUE, TRUE,"OK, Abbruch", 0) put it into myLink if it contains "Abbruch" then exit addLink else put "[" & truncate( value(myChunk), 25 ) & "]" into myName addStyle myChunk, "group" get line (item 1 of line 2 of it) of mylist if it contains "PopUp" then newPopUpLink myName end if if it contains "Karte" then newCardLink myName end if if it contains "PICT" then newPICTLink myName end if if it contains "Moovie" then newMoovieLink myName end if end if end if hide msg window end addLink function possibleLinks return ¬ "Neue Karte" & return & ¬ "Moovie" & return & ¬ "PICT" & return & ¬ "PopUp" end possibleLinks on deleteLink myChunk, myName -- löscht einen HyperText Link answer "Wollen Sie den Link für '" & value(myChunk) &¬ "' wirklich löschen?" with "Abbruch" OR "Löschen" if it is "Löschen" then lock screen set cursor to busy changeStyle myChunk, "group", "-" if there is a cd button myName then -- unsichtbare Objekte können nicht gelöscht werden! show cd button myName select cd button myName doMenu "Clear Button" end if if there is a cd fld myName then show cd fld myName select cd fld myName doMenu "Clear Field" end if if there is a menu "Neuer Link" then delete menu "Neuer Link" choose browse tool end if hide msg window end deleteLink -- -- Neuer PopUp Link -- on newPopUpLink myName -- fügt ein neues PopUp-Feld hinzu lock screen doMenu "New Field" set name of cd fld(number of cd flds) to myName set style of cd fld myName to "shadow" set the textFont of cd fld myName to "Geneva" put "Diesen Dummy-Text bitte mit Ihrem Text für PopUp " & ¬ myName & " ersetzen!" into cd fld myName choose browse tool click at the loc of cd fld myName end newPopUpLink -- -- Neuer Moovie Link -- function moovieLinkScript moovieFileName -- hier wird ein Skript als String-Konstante definiert return "on mouseUp" & return¬ & "closeAllPopUps" & return¬ & "set cursor to 4" & return¬ & "put" && quote & moovieFileName & quote¬ && "into theMoovieName" & return¬ & "if there is a window theMoovieName then" & return¬ & "close window theMoovieName" & return¬ & "else" & return¬ & "movie theMoovieName," && quote & "plain" & quote¬ & "," && quote & "card" & quote & "," && quote¬ & "invisible" & quote & "," && quote & "floating" & quote¬ & return¬ & "if the result is not empty then" & return¬ & "if" && quote & "Error" & quote && "is in the result then"¬ & return¬ & "answer the result" & return¬ & "end if" & return¬ & "exit mouseUp" & return¬ & "end if" & return¬ & "if there is a window theMoovieName then" & return¬ & "send" && quote & "movieIdle" & quote¬ && "to window theMoovieName" & return¬ & "show window theMoovieName" & return¬ & "end if" & return¬ & "end if" & return¬ & "end mouseUp" & return¬ & return¬ & "on mouseLeave" & return¬ & "hideLinkButton short name of me" & return¬ & "end mouseLeave" & return end moovieLinkScript on newMoovieLink myMoovieName -- fügt ein moovie hinzu answer file "Welcher Film soll hinzugefügt werden" of type "MooV" put it into MoovieFileName repeat while MoovieFileName contains ":" delete char 1 of MoovieFileName end repeat if fileName is NOT empty then put "Moovie" into myLinkType newPopButton myMoovieName, myLinkType, MoovieFileName hideLinkButton myMoovieName else exit newMoovieLink end if end newMoovieLink -- -- Neuer PICT Link -- function pictLinkScript pictFileName return "on mouseUp" & return¬ & "closeAllPopUps" & return¬ & "put" && quote & pictFileName & quote¬ && "into thePICTName" & return¬ & "picture thePICTName, file, windoid" & return¬ & "end mouseUp" & return¬ & return¬ & "on mouseLeave" & return¬ & "hideLinkButton short name of me" & return¬ & "end mouseLeave" & return end pictLinkScript on newPICTLink myPICTName -- fügt ein PICT hinzu answer file "Welches Bild soll hinzugefügt werden"¬ of type PNTG OR PICT put it into PICTFileName repeat while PICTFileName contains ":" delete char 1 of PICTFileName end repeat if fileName is NOT empty then put "PICT" into myLinkType newPopButton myPICTName, myLinkType, PICTFileName hideLinkButton myPICTName else exit newPICTLink end if end newPICTLink -- -- Erster Schritt für einen neuen Card Link -- function cardLinkScript return "on mouseUp" & return¬ & "closeAllPopUps" & return¬ & "beep" & return¬ & "end mouseUp" & return¬ & return¬ & "on mouseLeave" & return¬ & "hideLinkButton short name of me" & return¬ & "end mouseLeave" & return end cardLinkScript on newCardLink myLinkName global gPendingLink if there is a menu "Make Link" then get value("short name of" && gPendingLink) answer "Es gibt noch einen offenen Link für '" & it &¬ "'. Soll er gelöscht werden?" with "Löschen" OR "Abbruch" if it is "Löschen" then deletePendingLink end if else -- alles ok, die Luft ist rein put "Card" into myLinkType newPopButton myLinkName, myLinkType -- eine referenz auf den Button und die Karte in eine -- globale Variable packen: get ID of cd button myLinkName put "cd button ID" && it && "of" && ID of this cd into¬ gPendingLink createMakeLinkMenu myLinkName hideLinkButton myLinkName end if end newCardLink on createMakeLinkMenu myLinkName create menu "Neuer Link" put myLinkName & ":" after menu "Neuer Link" put "Link zu dieser Karte" after menu "Neuer Link"¬ with menuMessage "LinkToThisCard" put "Abbruch" after menu "Neuer Link"¬ with menuMessage "cancelLink" end createMakeLinkMenu -- -- Zweiter Schritt für einen neuen Card Link -- on LinkToThisCard global gPendingLink if gPendingLink <> empty then -- das Skript des Card Buttons abändern: get script of gPendingLink put "doCardLink" && short ID of this cd into line 3 of it set script of gPendingLink to it if there is a menu "Neuer Link" then delete menu "Neuer Link" -- die Referenz von gPendingLink in "it" speichern, so -- daß wir zur Ursprungskarte zurückkehren können: get gPendingLink put empty into gPendingLink go word 6 to 8 of it end if end LinkToThisCard on cancelLink global gPendingLink if there is a menu "Neuer Link" then delete menu "Neuer Link" if gPendingLink <> empty then deletePendingLink end cancelLink on doCardLink myCardID if myCardID <> short ID of this cd then hide the target -- makeLinkBack visual zoom open slow go cd ID myCardID end if end doCardLink -- -- Hilfs-Prozeduren und -Funktionen -- on newPopButton myName, myLinkType, myFileName -- erstellt einen neuen Card Button lock screen doMenu "New Button" choose browse tool set name of cd button(number of cd buttons) to myName set style of cd button myName to "transparent" set width of cd button myName to 32 set height of cd button myName to 32 if myLinkType is "Card" then set icon of cd button myName to "XL Up Arrow" set script of cd button myName to cardLinkScript() end if if myLinkType is "Moovie" then set icon of cd button myName to "Quicktime" set script of cd button myName to moovieLinkScript(myFileName) end if if myLinkType is "PICT" then set icon of cd button myName to "Scanned Art2" set script of cd button myName to pictLinkScript(myFileName) end if set showName of cd button myName to FALSE set autoHilite of cd button myName to TRUE end newPopButton on deletePendingLink global gPendingLink lock screen push card go card ID last word of gPendingLink show gPendingLink select gPendingLink doMenu "Clear Button" put empty into gPendingLink choose browse tool pop card end deletePendingLink on hideLinkButton myName if commandKey() is NOT down then if there is a cd button myName then hide cd button myName end if end if end hideLinkButton function truncate myString, myLength -- Erst einmal Anführungszeichen rausschmeissen: repeat with i = 1 to length(myString) if char i of myString = quote then put "'" into char i of myString end if end repeat if length(myString) > myLength then return char 1 to myLength - 1 of myString & "..." else return myString end if end truncate function isAPopUp myObjName get word 1 to 2 of myObjName if it is "card field" OR it is "card button" then get value(last word of myObjName) if char 1 of it is "[" AND last char of it is "]"¬ then return TRUE end if return FALSE end isAPopUp on closeAllPopUps repeat with i = 1 to number of cd fields if isAPopUp(name of cd fld i) then set lockText of cd fld i to TRUE hide cd fld i end if end repeat repeat with i = 1 to number of cd buttons if isAPopUp(name of cd button i) then hide cd button i end if end repeat end closeAllPopUps on addStyle myChunk, myStyles get textStyle of myChunk if it contains "mixed" then -- das ist der langsame und arbeitsintensive Fall changeStyle myChunk, myStyles, "+" else if it is "plain" then get myStyles else put "," & myStyles after it end if set textStyle of myChunk to it end if end addStyle on changeStyle myChunk, myStyle, op -- wenn op = "+" wird ein Textstil hinzugefügt, -- ist op = "-" wird ein Textstil entfernt. put word 2 of myChunk into n put word 4 of myChunk into m delete word 3 to 4 of myChunk repeat m - n+1 times get textStyle of myChunk if op = "+" then if it is empty OR it is "plain" then get myStyle else put "," & myStyle after it end if else if textStyle of myChunk is myStile then get "plain" else repeat with j = 1 to number of items in it if item j of it is myStyle then delete item j of it exit repeat end if end repeat end if end if set textStyle of myChunk to it add 1 to word 2 of myChunk end repeat end changeStyle Skript des Bg Button "Authoring"on mouseUp set the lockText of bg fld "Titel" to FALSE set the lockText of bg fld "Textfeld" to FALSE end mouseUp Skript des BG Button "Browsing"on mouseUp set the lockText of bg fld "Titel" to TRUE set the lockText of bg fld "Textfeld" to TRUE end mouseUp Skript des BG Button "Show Groups"on mouseUp if the hilite of me is TRUE then set the hilite of me to FALSE hide groups else set the hilite of me to TRUE show groups end if end mouseUp Skript des BG Button "recent"on mouseUp closeAllPopUps visual zoom close slow go recent card end mouseUp Skript des BG Button "Schlagworte"on mouseUp put return & "Bitte Schlagwörter mit Apfel-Taste auswählen"¬ into prompt put empty into schlagwortList put schlagworte() into list get showList(list, prompt, true, true,"OK, Cancel", 0) if line 2 of it is empty then exit mouseUp put the number of items in line 2 of it into numOfItems if numOfItems = 0 then exit mouseUp repeat with i = 1 to numOfItems put line (item i of line 2 of it) of list & ", "¬ after schlagwortList end repeat delete last char of schlagwortList delete last char of schlagwortList put schlagwortlist into bg field "Schlagworte" end mouseUp Zurück zum Inhaltsverzeichnis |