REBOL [ Title: "Mime Views" Author: "Brett Handley" Date: 29-April-2001 Purpose: "Some views of mime data." Rights: {Copyright © Brett Handley 2001 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subrights, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.} ] view-rights: does [ view/new center-face layout [ backdrop effect [gradient 1x1 220.220.255 0.0.172] text as-is system/script/header/rights ] ] ; Supporting code do load-thru http://www.codeconscious.com/rebsite/rebol-library/mime-model.r do load-thru http://www.codeconscious.com/rebsite/rebol-library/standard-guis.r show-message-parts: function [ "Generates a window which lists the parts of a multipart mime message." message-model [object!] ][window-size msg-list msg-area offset bnr sld msg-part part-list main-face-size cpyright txtdata][ part-list: mime-multipart-summary? message-model window-size: system/view/screen-face/size - 50x50 view/new center-face layout [ size window-size backdrop effect [gradient 1x1 220.220.255 0.0.172] space 0x0 bnr: banner "Message Parts" text {The list shows the parts of the message. An embedded message is indicated by "message/rfc822" and possibly a filename. For other parts of the message the content-type header is shown.} offset: at msg-list: text-list ( add multiply 1x0 (window-size - (2 * offset)) multiply 0x1 ((window-size - offset - bnr/offset) / 2) ) data part-list [ msg-part: pick message-model/content to-integer first parse first msg-list/picked " " either equal? (pick mime-typing? msg-part 1) 'image [ hide msg-area hide sld view/new center-face scroll-face layout [ backdrop effect [gradient 1x1 220.220.255 0.0.172] image load msg-part/content ] window-size ][ if not string? txtdata: msg-part/content [txtdata: mold msg-part/content] insert clear msg-area/text txtdata show msg-area show sld ] ] across msg-area: area copy {} silver as-is (msg-list/size - 16x0) sld: slider (add 16x0 multiply 0x1 msg-area/size) [scroll-para msg-area sld] return cpyright: text join copy/part system/script/header/rights ( find system/script/header/rights newline ) " - show license" silver [view-rights] do [ cpyright/offset: add ( multiply 1x0 (sld/offset + sld/size - cpyright/size) ) (multiply 0x1 cpyright/offset) ] return ] ]