#!/usr/bin/newlisp ;; ;; Alternative network/local content/script browsing ;; check HELP below for more version inforomation. ;; (c) nodep 2006/2007, Enjoy! ;; ;; 2006 text version only ;; 2007 GS version initialized ;; ;; Hacked by CS 3.2.2008 08:00 ;; ---------------------------------------------------------- ;; HELP TEXT ;; ---------------------------------------------------------- (set 'HELP [text] ------------------------------------------------------------------------------------ NLIST HELP ------------------------------------------------------------------------------------ nlist enables browsing and execution of newlisp script/file collections. Personal code-screening and remote execution of scripts is possible with nlist. nlist content is loaded over the network or local directory's. Content displayed in nlist is formated in file called "nlist.idx" (the index file). The format of the "nlist.idx" file is static. You can create you own "nlist.idx" on your webpage or local directory's so others can view the content you want to make available. With nlist you can browse basicly any code you want to make available. Text or binary can be saved or send or copied. * Bookmarking Using the "Shelf Idx" menu-option. nlist saves the url from the Idx field. * Quit nlist: If you exit nlist with a "Quit" or window closure, nlist try's to store the its known contents ie. bookmarks, window coordinates, colors..etc.. to ./nlist/nlist.cfg * Using Idx: The url input field is called the "Idx field" in nlist. It enables you to enter a remote url or local directory. If the Idx starts with "http://" and ends with "/" nlist will always read the "nlist.idx" first. If nlist does find the "nlist.idx" file it will load and process the "nlist.idx" file and the content is displayed in the nlist. You can only load files ending with {.html|.lsp|.txt|.idx|.nlar} directly from the Idx else you need to create a "nlist.idx" at that location. If the Idx does NOT start with "http://" then nlist assumes a local file or directory. If it doesn't end with "/" it assumes a file. If the Idx ends with "nlist.idx" it will process the file. Displaying the "nlist.idx" content can be done via the "nlist.idx" by including it there. nlist is not a directory browser, but could be use so. If you created a nlist.idx in that directory it will read it, else you might need to enter the filename directly Loading content directly via the Idx does not give extra information in nlist. Prefered browsing is via "nlist.idx" files. * Idx History: The "history scroll" button on the Idx row is for browsing your Idx history. All files saved when scrolling history and not confirmed by enter do apply to the original load. History is not saved to the configuration file of nlist. * Saving a file: Saving a file does work for files listed inside the nlist.idx. When pressing the "Save file" from the options-menu nlist will save the file that was previously clicked/marked from the list-panel. This file is stored as ./nlist/. Everything inside the ./nlist directory is always overwritten without warning. * Send File: You can send the file currently listed in the output panel (right panel) using "send file" from the options menu. the format is "host:port". Sending is done based on UDP. No Ack. Data is always send as is. You can first encrypt or base64 code , or both, the content of the window and then use "send file". * Eval File: Use this at your own risk. This is primarly why nlist was created. You can check the file content befor running. Evatuate a selected ".lsp" file from nlist. The evaluation window is closed when clicking an other tab. * Update: This will check the current nlist version against the remote nlist version. * Text/Html: Clicking the right mouse button in the output window enables you to display or text/plain or text/html. This is the GS html format, When in HTML mode the window will follow HTML links, not the nlist.idx links. This is because the HTML mode is pre-programmed to seek for .html. * Font: You can select font settings via the "Font config" You need to select every Box befor action is taken. * Colors: You can select the color settings via the "Color config" * Net-Proxy: You can set your Net-Proxy (only http proxy handling) Press "Set" to set the enviroment. "Clear" clear the field and proxy. You need to restart nlist after removing the proxy with "Clear". * Base64-encoding / Base64-decoding: This enables you to encode / decode the text in the infopanel, currently shown. Ofcourse you must encode first befor decoding and you cant decode a none base64 coded text with success. * Decryption/Encryption: You can include encrypted files, text files or binary's on your location and display them by including them inside the nlist.idx. Pressing the right mouse button will popup the menu which includes "Decrypt/Encrypt Text". When you select this option a new window will appear that enables you to enter the "Crypt-Key" to Decrypt the text or Encrypt the text. If the text is not encrypted you can Encrypt the text by providing a Crypt-Key and then select "Crypt" and "Save File"/"Send File" from the Menu to store the file localy. If the text/binary is encrypted you can select the Crypt-Key to Decrypt the file and if the key is correct the text will be shown to you. This is a way to drop messages or files for people that only know the Crypt-Key. This option uses the newlisp 'encrypt. * nlist.idx file is not correct or not found: Reading the nlist.idx file from an url or directory you will see the error message displayed in the ouput-window when the nlist.idx could not be found. If a file from the list-panel (clicked for selection) could not be found you will also see an error message. * nlist.idx file layout: Quoted text starts with ";" The content of nlist.idx is static evey line contains 5 entry's If the content is not as described, nlist will not process the nlist.idx content. Every entry must be quoted between { and } , nothing else. The content inside the { and } must be text, ASCII => (char 32) upto (char 127). Every line contians: {script/binary name} {GS/TK/GTK/Console..} {Game/Tool/Api/Gag/data/pic/bin..} {Platform} {description} {about.txt} {empty} {empty} {empty} {this file contains information about this url/directory} {nlist.idx} {Console} {data} {all} {nlist content/index file} {nlist.lsp} {GS} {tool} {all} {newlisp network file/script browser} (newlisp.exe} {Console} {tool} {win} {newlisp binary for windows} {http://here} {html} {link} {all} {a new link} You are ofcourse completly free in what to display to the remote user as content or files. ------------------------------------------------------------------------------------ * History * ------------------------------------------------------------------------------------ v0.48 - Shell dialog popup remove, this is now a Tabbed window! v0.47 - Idx "Go button" is now also in async mode. v0.46 - Added png buttons again v0.45 - title of the "Eval Window" was incorrect - "Eval File" is now enabled correctly on ".lsp" files only v0.44 - Fixed: files that where directly linked inside nlist.idx could not be saved v0.43 - look and Feel now only forced for Win32 (Linux uses Java metal and OSX its own L&F) On Win32 and OSx the Idx field not always loaded correctly when pressing the or "Go" button. There is now a (sleep 1) inside the listpanel update. (please report if you still have problems) v0.42 - updated the update v0.41 - updated the update v0.40 - you can now check if your nlist version is uptodate v0.39 - Font selection menu, defaults and some ttf's - colors variables changed, nlist.cfg is different! - a blue button v0.38 - cosmetic's v0.37 - Attic Menu now works normal, no crashes! v0.36 - An Attic Menu is added where you can add you own tools/programs to execute. This is usefull for i.e. starting newlisp-edit Some linux itmes are pre-installed here but you can add anything. Attic uses "process" to execute the tools. The Attic Maintain window has a sleep inside its function because of ill-behaviour of the gs:get-text requests. This could go wrong or could go right..The solution with the sleep is an absolute workaround hack, no garantees. Because newlisp-edit cant yet handle commandline arguments you can copy&paste between nlisp and newlisp-edit v0.35 - Shell window is now resizable - replaced the red / green dots with normal buttons. - reviewed help - code cleanup v0.34 - fixed another evil bug on "green button pressed" v0.33 - fixed a bug on "green button pressed" v0.32 - Added a Find Dialog - Color and code changes v0.31 - HELP is now always in default colors - more color corrections v0.30 - removed look and feel v0.29 - color fixes v0.28 - java gui is default OS again - created a color selection menu (direct change) - added syntax highlighting for .lsp files (requested by Pjot) highlighting is always on for .lsp (could change) - different code changes v0.27 - default now 3 URLS in the Shelf. v0.26 - minor window size bug fixed v0.25 - Added a SplitPane view - Added a good resize ! (some layout needed changes) (requested by Pjot ;-) - red/green button changes position - "Idx" label is gone - doc needs update v0.24 - "Eval File" added Does evaluate a .lsp file. v0.23 - nlist.idx does now NOT react on { } this can be used as a seperator in the nlist.idx { } {myfile.lsp} {} {} {} {} { } v0.22 - added new dots - greendot is on Idx - red dot is history rotation v0.21 - Added "history scroll" button on the [Idx:] row [the red dot] Pressing this button does scroll your Idx browsing history. Pressing enter does confirm ther load. All files saved when scrolling history and not confirmed by enter do apply to the original load. v0.20 -[Idx:] behavior changed! I wanted to protect nlist from the web, but loading files directly from the [Idx:] simply is handy. I stil dont want nlist to automaticly load index.html files because thats confusing. As a primary behavior nlist only loads {.htm|.html|.lsp|.txt|.idx|.nlar} from the [idx:] directly. But "nlist.idx" stays the primary index file. See HELP for more info. - you can now add files ending with {.htm|.html|.lsp|.txt|.idx|.nlar} to the shelf as a bookmark. v0.19 - added base64-encoding and base64-decoding to the popup menu. v0.18 - "send file" added sends the content of the Infowindow (right panel) to a remote udp listener. You can crypt the content first befor sending! (just a hint :-) Because requesting 2 text-fields in 1 actions does create an error on the GS-network-bus (its too quick) "Send File" only has 1 text-field where you have to enter and HOST and UDP seperated by ":" like localhost:port v0.17 - more html/plain display switching fixed. v0.16 - fixed a problem in error displaying for local html files. (was caused by the autoswitching html/plain) - Proxy addon (quick hack) v0.15 - nlist banner created with this newlisp script (by cormullion) -> http://unbalanced-parentheses.nfshost.com/downloads/ascii-Impact.lsp.txt nlist.idx for nlist at -> http://unbalanced-parentheses.nfshost.com/downloads/ v0.14 - correction in plain/html switch - correction on root Idx display v0.13 - changed defaultfont "bold" to "plain" - root idx is now red colored - added a default shelf - added tooltips for the LabelPanels (at the bottom of nlist window) - idxPanel and LabelPanels are now resized with a fontsize assumption. (On windows and Linux this works, I have not tested OSX) still need to restart nlist after a resize. v0.12 - added "copy to clipboard" if in text/plain mode. Copies the content of the InfoPanel (right panel) to the clipboard. Normal copy and paste key-actions still work. - read-file/url now has a timeout of 10 seconds. - more color selections - tiny code changes v0.11 - tiny color adjustment - files ending with .html and .lsp are automaticly switched to html-view or text-view - HELP is now forced in text/plain v0.10 - added color selection for listpanel - removed unused features - Some little changes v0.9 - 1x mouse click in List-panel shows content information (bottom line) 2x mouse clicks in list-panel does loads the content Works only with GS ver 1.10+ (http://www.newlisp.org/downloads/development/) v0.8 - cryptkey is now correctly checked - Shelf is now automaticly sorted - "Make Idx Root" (from shelf menu) will make current Idx the startup Idx. - Now you can create local/remote nlist.idx file-links (links to other scripts/sites). Links are displayed inside the list-panel (on your left) with an extra + in front of the name like "+vigenere.lsp" If you are linking to a remote website ending with "/" in the idx link then nlist.lsp assume that the remote site has its own nlist.idx file and it will be shown inside the list-panel at "+idx+" (temporary solution) these are now possible: (on windows use {/} instead of {\}) * this links directly to a remote file called vigenere.lsp {http://www.nodep.nl/downloads/newlisp/vigenere.lsp} {Console} {Tool} {All} {vigenere encoding} * this links to a local directory with the file vigenere.lsp {/my/home/dir/vigenere.lsp} {Console} {Tool} {All} {vigenere encoding} * this links to the current [Idx:] to file vigenere.lsp {vigenere.lsp} {Console} {Tool} {All} {vigenere encoding} * this links to a remote site and load the remote nlist.idx {http://website/} {nlist} {link} {Linux} {More linux scripts} * this links to a remote site and displays the file nlist.idx {http://website/nlist.idx} {nlist} {link} {Linux} {More linux scripts} v0.7 - changed the list-panel back to 150 width - changed text/html procedure - windows/mac do not set "javax.swing.plaf.metal.MetalLookAndFeel" as default, now look-and-feel is fixed to be more transparent. This can change again in the future. - A remote nlist.cfg wont be saved, due to overwriting local nlist.cfg. - newlisp-edit will be the editor (or preconfigured by user) Executing the file was my initial purpous of nlist (in a save way). Convert will convert the newlisp script to a newlispDoc format. (All these will be enabled when ready :-) - A message appears inside the info-panel when reading an url/file. This is done to indicate the loading and will stay until read-file is finished or timed-out.('read-file has by default a newlisp timeout of 60 seconds). As long as this message appears no connection was made. - nlist now directly loads the url after selecting from the Shelf Idx. - info labels are now correctly cleared v0.6 - You can now decrypt text files that are crypted using 'Encrypt. This enables you to leave messages for others or protect code from being viewed by others. The person who knows the Crypt-Key can enter the key and the encrypted text will be shown in the output-panel. If the key is incorrect then text will be crypted again! You 'could' add inside nlist.idx a notification that the files is encrypted i.e. {crypt} {enc}.. - outlining is again to the "left" v0.5 - GUI changes windows size is now a little bigger 820 at startup - small bug in text/html switching when HELP window was open. v0.4 - Expirimented with Panels and grid. - Changed Info window to Monospaced, better font for script display. - XY coords/size of nlist are saved when doing "Quit" or windowclose - nlist now has a configfile called ./nlist/nlist.cfg - Removed nlist.uri, bookmarks are now stored inside nlist.cfg! - Shelf-menu is now automaticly updated after doing a bookmark - Switching between Text and HTLM is now possible in output window. last textmode is also saved when the nlist is closed. v0.3 - dont use the old nlist v0.2 version - 'load is no longer used, replaced with a saver procedure. - Shelf idx ads/selects bookmakrs - cleanup code and changes v0.2 - save of file to local directory ./nlist/filename - load url (which does reload the url nlist.idx) - shaved the gui - menu-bar v0.1 - initial version ------------------------------------------------------------------------------------ * Disclaimer * ------------------------------------------------------------------------------------ The use of nlist.lsp and related code is at your own risk. The functionality of nlist by using nlist as a regular web-browser cant be garantied. nlist functionality based on "nlist.idx" browsing is primary. No rights can be claimed from the code nor the functionality. (c) 2006/2007 nodep. ------------------------------------------------------------------------------------ [/text]) ;; ---------------------------------------------------------- ;; GS INIT ;; ---------------------------------------------------------- (load (append (env "NEWLISPDIR") "/guiserver.lsp")) (gs:init) ;; ---------------------------------------------------------- ;; Pre defines ;; ---------------------------------------------------------- (set 'vtag {@0.48/CS@}) (set 'version (trim vtag "@")) ;; nlist version (set 'nlist-dir {./nlist/}) ;; local nlist dir (set 'nlist-idx {nlist.idx}) ;; nlist name index (set 'nlist-cfg {nlist.cfg}) ;; nlist config file (set 'nlist-rem {http://www.nodep.nl/downloads/newlisp/nlist.lsp}) ;; nlist.lsp remote location (set 'eval-title {no-title}) ;; tilte for the EVAL-WINDOW (set 'url {http://www.nodep.nl/downloads/newlisp/}) ;; initial idx/url (set 'root url) ;; root is the ROOT idx (set 'site (first (regex {[a-z0-9-\.]*\.[a-z]{2,5}} url))) (set 'scripts '()) ;; list containing firsts from nlist.idx (set 'nlist '()) ;; list containing nlist.idx (set 'shelf (list url)) ;; bookself (set 'history (list url)) ;; url history (set 'displaytype "text/plain") ;; initial display (set 'timeout 10000) ;; network/read-file timeout (set 'fontsize 12) ;; static fontsize + used for column calculation. (set 'proxy "") ;; proxy settings (set 'udp-host "localhost:12345") ;; default send-file setting (set 'allowed {.htm|.html|.txt|.idx|.lsp|.src|.nlar}) ;; allowed to load directly from [Idx:] (set 'highlight {.lsp}) ;; files that are automaticly highlighted in lsp format (set 'ww 800) ;; initial width (set 'wh 600) ;; initial height (set 'fonts '( "Serif" "Sans Serif" "Monospaced" "Verdana" "Arial" "Tahoma")) ;; used in font-menu (set 'font-style '( "plain" "bold" "italic" )) ;; used in font-menu (set 'listpanelfont (map eval '( (fonts 1) fontsize (font-style 0)) )) ;; init font (set 'infopanelfont (map eval '( (fonts 2) fontsize (font-style 0)) )) ;; init font ;; extra url with newlisp nlist.idx (push {http://www.turtle.dds.nl/newlisp/} shelf -1) (push {http://unbalanced-parentheses.nfshost.com/downloads/} shelf -1) ;; store on attic (set 'attic '( ( {newlisp-edit} {/usr/bin/newlisp-edit} ) ( {newlisp-term} {/usr/X11R6/bin/xterm -bg lightyellow -fg black -ls -e newlisp} ) )) ;; nlist colors (set 'gs:azure '(0.9411764706 1 1)) (set 'gs:lightyellow '(1.0 1.0 0.8)) (set 'gs:cornsilk1 '(1 0.9725490196 0.862745098)) (set 'gs:steelblue '(0.2745098039 0.5098039216 0.7058823529)) (set 'gs:royalblue4 '(0.1529411765 0.2509803922 0.5450980392)) (set 'gs:yellowgreen '(0.6039215686 0.8039215686 0.1960784314)) (set 'gs:saddlebrown '(0.5450980392 0.2705882353 0.07450980392)) (set 'gs:darkorange '(1.0 0.5490196078 0.0)) (set 'gs:cornsilk '(0.5450980392 0.5333333333 0.4705882353)) (set 'gs:gold3 '(0.8039215686 0.6784313725 0)) (set 'gs:olivedrap '(0.4196078431 0.5568627451 0.137254902)) (set 'gs:indianred '(0.8039215686 0.3607843137 0.3607843137)) (set 'gs:lambda '(0.1843137255 0.3098039216 0.3098039216)) (set 'gs:bisque '(0.5450980392 0.4901960784 0.4196078431)) (set 'gs:seashell '(1 0.9607843137 0.9333333333)) ;; foreground - background (set 'listpanelcolor '( (0 0 0) (1 0.78431374 0) )) (set 'infopanelcolor '( (0 0 0) (1 0.9725490196 0.862745098) )) ;; foreground only 'comment_foreground 'keyword_foreground 'string_foreground 'number_foreground 'quoted_foreground 'parentheses_foreground (set 'syntaxcolor '( (0.5019608 0.5019608 0.5019608) (0.1529411765 0.2509803922 0.5450980392) (0.5450980392 0.2705882353 0.07450980392) (0.5450980392 0.2705882353 0.07450980392) (0.5450980392 0.5333333333 0.4705882353) (0.8039215686 0.3607843137 0.3607843137) )) (set 'colors '( gs:black gs:blue gs:cyan gs:darkGray gs:gray gs:green gs:lightGray gs:magenta gs:orange gs:pink gs:red gs:white gs:yellow gs:azure gs:lightyellow gs:steelblue gs:cornsilk1 gs:royalblue4 gs:yellowgreen gs:saddlebrown gs:darkorange gs:cornsilk gs:gold3 gs:olivedrap gs:indianred gs:lambda gs:bisque gs:seashell )) (set 'names '( {listpanel} {infopanel} {comment} {keyword} {string} {number} {quoted} {parentheses} )) (set 'LAF '( "com.sun.java.swing.plaf.motif.MotifLookAndFeel" "javax.swing.plaf.metal.MetalLookAndFeel" "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" "javax.swing.plaf.mac.MacLookAndFeel" "com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) (set 'go-button [text]iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAbFBMVEX8AgRMwlwEahRMylxc2myE+pQEYhRU0mRUzmRc0myU/qR06oRk4nw8tkwEVgxc2nRs4nxk3nREvlQ0skQEWgxk2nRc1mw0rkQspj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gzb9Cw2vLYSml0y4NTe60+eObHfHFoYdHACwKGx4rib94nX8qMmIVPkQWZBh5LTxLsvkA9AhgDuAYJi/t957fPpx+uTsV2wzoAxASAMCFJ2qigt9xHwYO5wh42HVHo5bRc0zHZUxwGg6RjWJq7loquKhKBHiZMjnuIEEAZyJyciGtXcwko+tLYTWd8pNUgHmRB+V66eb++JMRE/v/K3gJIYAalBCOSoiEqRRVqKx1HW/YcsQzDowB4F9dtJuB0scJLAAAAABJRU5ErkJggg==[/text]) (if (not (file? (append nlist-dir "nlist-hist.png"))) (write-file (append nlist-dir "nlist-hist.png") (base64-dec history-button))) (if (not (file? (append nlist-dir "nlist-go.png"))) (write-file (append nlist-dir "nlist-go.png") (base64-dec go-button))) (if (not (file? (append nlist-dir "cs-backward.png")))(write-file (append nlist-dir "cs-backward.png") (base64-dec cs-backward))) (if (not (file? (append nlist-dir "cs-forward.png"))) (write-file (append nlist-dir "cs-forward.png") (base64-dec cs-forward))) (if (not (file? (append nlist-dir "cs-reload.png"))) (write-file (append nlist-dir "cs-reload.png") (base64-dec cs-reload))) ;; ---------------------------------------------------------- ;; PRE init ;; ---------------------------------------------------------- ;; try and load the nlist.cfg config file (if (file? (append nlist-dir nlist-cfg)) (if (catch (load (append nlist-dir nlist-cfg)) 'result) (begin (set 'url root) (set 'history (list root))) (begin (println "* Problem loading" (append nlist-dir nlist-cfg)) (exit)))) ;; create nlist dir in current directory, needs to be chanched to USER HOME! (if (not (directory? nlist-dir)) (begin (make-dir nlist-dir 0700) (println "* created: " nlist-dir))) ;; ---------------------------------------------------------- ;; GUI PART -- GS ;; ---------------------------------------------------------- (gs:get-screen) (set 'sw (gs:screen 0) 'sh (gs:screen 1)) (if (= ostype "Win32") (gs:set-look-and-feel (LAF 1))) ;; get from config file (if main-width (set 'ww main-width)) (if main-height (set 'wh main-height)) (if main-pos-x (set 'wx main-pos-x) (set 'wx (- (div sw 2) (div ww 2)) )) (if main-pos-y (set 'wy main-pos-y) (set 'wy (- (div sh 2) (div wh 2)) )) (gs:frame 'F wx wy ww wh (append "nlist " version) ) (gs:set-border-layout 'F 5 1) (gs:set-resizable 'F true) (gs:window-moved 'F 'main-moved) (gs:window-resized 'F 'main-resized) (gs:window-closed 'F 'OptionsMenu_Quit_Action) ;; ------------------------------------------------------------------------------------ ;; options menu ;; ------------------------------------------------------------------------------------ (gs:menu 'OptionsMenu "Options") (gs:set-tool-tip 'OptionsMenu "Cheese flavors") (gs:set-foreground 'OptionsMenu gs:steelblue) (gs:menu-item 'OptionsMenu_Save 'OptionsMenu_Save_Action "Save File") (gs:menu-item 'OptionsMenu_Send 'OptionsMenu_Send_Action "Send File") (gs:menu-item 'OptionsMenu_Eval 'OptionsMenu_Eval_Action "Eval File") (gs:menu 'Configuration "Config") (gs:menu-item 'FontMenu 'fontdialog "Fonts") (gs:menu-item 'ColorMenu 'colordialog "Colors") (gs:menu-item 'ProxyMenu 'OptionsMenu_Proxy_action "Net-Proxy") (gs:menu-item 'OptionsMenu_Help 'OptionsMenu_Help_Action "Help") (gs:menu-item 'OptionsMenu_Update 'OptionsMenu_Update_Action "Update") (gs:menu-item 'OptionsMenu_Quit 'OptionsMenu_Quit_Action "Quit") (gs:add-to 'OptionsMenu 'OptionsMenu_Save 'OptionsMenu_Send) (gs:add-separator 'OptionsMenu) (gs:add-to 'OptionsMenu 'OptionsMenu_Eval) (gs:set-foreground 'OptionsMenu_Eval gs:red) (gs:add-separator 'OptionsMenu) (gs:add-to 'Configuration 'FontMenu) (gs:add-to 'Configuration 'ColorMenu) (gs:add-to 'Configuration 'ProxyMenu) (gs:add-to 'OptionsMenu 'Configuration) (gs:add-separator 'OptionsMenu) (gs:add-to 'OptionsMenu 'OptionsMenu_Help) (gs:add-to 'OptionsMenu 'OptionsMenu_Update) (gs:add-separator 'OptionsMenu) (gs:add-to 'OptionsMenu 'OptionsMenu_Quit) ; shelf menu (gs:menu 'ShelfMenu "Shelf") (gs:set-tool-tip 'ShelfMenu "Whats on the shelf?") (gs:set-foreground 'ShelfMenu gs:saddlebrown) (gs:menu-item 'ShelfMenu_Root 'ShelfMenu_Root_Action "Make Idx Root") (gs:menu-item 'ShelfMenu_Idx 'ShelfMenu_Idx_Action "Idx to Shelf") (gs:add-to 'ShelfMenu 'ShelfMenu_Root 'ShelfMenu_Idx) (gs:add-separator 'ShelfMenu) ;; ------------------------------------------------------------------------------------ ;; add bookmarks to idx menu-list ;; ------------------------------------------------------------------------------------ (define (display-shelf) (if shelf (begin (set 'shelf (sort shelf)) (dolist (s shelf) (gs:menu-item (sym (append "ShelfMenu_" (string $idx))) 'ShelfMenu_SelectIdx_Action s) (gs:add-to 'ShelfMenu (sym (append "ShelfMenu_" (string $idx)))) (gs:set-font (sym (append "ShelfMenu_" (string $idx))) "Sans Serif" fontsize "plain") (if (= (shelf $idx) root) (gs:set-foreground (sym (append "ShelfMenu_" (string $idx))) gs:red) (gs:set-foreground (sym (append "ShelfMenu_" (string $idx))) gs:saddlebrown)) ) ) ) ) (display-shelf) ;; user menu (gs:menu 'AtticMenu "Attic") (gs:set-tool-tip 'AtticMenu "Functional Curiosa") (gs:set-foreground 'AtticMenu gs:olivedrap) (gs:menu-item 'AtticMenu_Maintain 'personalmenu "Maintenance") (gs:add-to 'AtticMenu 'AtticMenu_Maintain) (gs:add-separator 'AtticMenu) ;; ------------------------------------------------------------------------------------ ;; Idx/Url ;; ------------------------------------------------------------------------------------ (gs:panel 'IdxPanel) (gs:set-border-layout 'IdxPanel 1 0) (gs:text-field 'IdxPanel_1 'LoadAndWrite (/ (- ww 21) fontsize)) (gs:set-background 'IdxPanel_1 gs:white) (gs:set-text 'IdxPanel_1 url) (gs:set-tool-tip 'IdxPanel_1 "Idx") (if cs-mode (begin (gs:panel 'HstPanel) (gs:set-border-layout 'HstPanel 1 0) (gs:image-button 'IdxPanel_2 'LoadAndWriteButton (append nlist-dir "cs-reload.png") (append nlist-dir "cs-reload.png") 20 20) (gs:set-tool-tip 'IdxPanel_2 "Reload Index") (gs:image-button 'IdxPanel_3 'GoForwardButton (append nlist-dir "cs-forward.png") (append nlist-dir "cs-forward.png") 20 20) (gs:set-tool-tip 'IdxPanel_3 "Go Forward") (gs:image-button 'IdxPanel_4 'GoBackwardButton (append nlist-dir "cs-backward.png") (append nlist-dir "cs-backward.png") 20 20) (gs:set-tool-tip 'IdxPanel_4 "Go Backward") (gs:add-to 'HstPanel 'IdxPanel_3 "east" 'IdxPanel_4 "west") (gs:add-to 'IdxPanel 'HstPanel "west" 'IdxPanel_1 "center" 'IdxPanel_2 "east")) (begin (gs:image-button 'IdxPanel_2 'LoadAndWriteButton (append nlist-dir "nlist-go.png") (append nlist-dir "nlist-go.png") 40 20) (gs:set-tool-tip 'IdxPanel_2 "Load Idx") (gs:image-button 'IdxPanel_3 'IdxPanel_Button_Action (append nlist-dir "nlist-hist.png") (append nlist-dir "nlist-hist.png") 22 20) (gs:set-tool-tip 'IdxPanel_3 "Scroll History") (gs:add-to 'IdxPanel 'IdxPanel_2 "west" 'IdxPanel_3 "east" 'IdxPanel_1 "center"))) ;; ------------------------------------------------------------------------------------ ;; listing & Info into 1 panel ;; ------------------------------------------------------------------------------------ (gs:split-pane 'ListPanel "vertical" 0.15 0.30 5) (gs:list-box 'ListPanel_ListBox 'ListPanel_Action scripts) (gs:set-background 'ListPanel_ListBox (listpanelcolor 1)) (gs:set-foreground 'ListPanel_ListBox (listpanelcolor 0)) (gs:set-font 'ListPanel_ListBox (listpanelfont 0) (listpanelfont 1) (listpanelfont 2)) (gs:set-size 'ListPanel_ListBox 120 0) (gs:add-to 'ListPanel 'ListPanel_ListBox) ;; ------------------------------------------------------------------------------------ ;; left pane ;; ------------------------------------------------------------------------------------ (define (infopanel itxt) (gs:text-pane 'InfoPanel_TextPane 'gs:no-action displaytype) (gs:set-font 'InfoPanel_TextPane (infopanelfont 0) (infopanelfont 1) (infopanelfont 2)) (gs:set-background 'InfoPanel_TextPane (infopanelcolor 1)) (gs:set-foreground 'InfoPanel_TextPane (infopanelcolor 0)) (gs:set-editable 'InfoPanel_TextPane nil) (gs:set-text 'InfoPanel_TextPane itxt) (gs:mouse-event 'InfoPanel_TextPane 'mouseclicked) (gs:add-to 'ListPanel 'InfoPanel_TextPane)) (infopanel (append {nlist } version { (c) nodep 2006/2007})) ;; ------------------------------------------------------------------------------------ ;; Shell area ;; ------------------------------------------------------------------------------------ (gs:text-area 'ShellDialog_TextArea 'gs:no-action (- ww 180) 270) (gs:set-background 'ShellDialog_TextArea gs:lightyellow) (gs:set-foreground 'ShellDialog_TextArea gs:black) (gs:set-font 'ShellDialog_TextArea "Monospaced" fontsize "plain") (gs:request-focus 'ShellDialog_TextArea) ;; ------------------------------------------------------------------------------------ ;; file info label ;; ------------------------------------------------------------------------------------ (gs:panel 'LabelPanel) (gs:set-grid-layout 'LabelPanel 1 5) (gs:text-field 'LabelPanel_1 'gs:no-action (/ ww (* fontsize 9))) (gs:text-field 'LabelPanel_2 'gs:no-action (/ ww (* fontsize 9))) (gs:text-field 'LabelPanel_3 'gs:no-action (/ ww (* fontsize 9))) (gs:text-field 'LabelPanel_0 'gs:no-action (/ (/ ww 3) fontsize)) (gs:text-field 'LabelPanel_4 'gs:no-action (/ (/ ww 3) fontsize)) (dotimes (x 5) (gs:set-font (sym (string "LabelPanel_" x)) "Sans Serif" fontsize "plain") (gs:add-to 'LabelPanel (sym (string "LabelPanel_" x)) )) (gs:set-tool-tip 'LabelPanel_0 "File/link") (gs:set-tool-tip 'LabelPanel_1 "Type of graphic output") (gs:set-tool-tip 'LabelPanel_2 "Type of file") (gs:set-tool-tip 'LabelPanel_3 "The OS the file was created for") (gs:set-tool-tip 'LabelPanel_4 "File/link description") (gs:tabbed-pane 'Tabs 'tabs-action "bottom" 'ListPanel "Main" ) (gs:add-to 'F 'IdxPanel "north" 'Tabs "center" 'LabelPanel "south") (gs:menu-bar 'F 'OptionsMenu 'ShelfMenu 'AtticMenu) (gs:request-focus 'IdxPanel_1) ;; ------------------------------------------------------------------------------------ ;; popup menu in output-window ;; ------------------------------------------------------------------------------------ (gs:menu-popup 'SwitchPopup "Options") (gs:menu-item 'FindText 'finddialog "Find Text") (gs:menu-item 'SwitchText 'SwitchDisplay "Display as Text") (gs:menu-item 'SwitchHtml 'SwitchDisplay "Display as Html") (gs:menu-item 'CopyText 'CopyDisplay "Copy to Clipboard") (gs:menu-item 'SwitchDecode 'SwitchDecodeText "Decrypt/Encrypt Text") (gs:menu-item 'SwitchBase64-enc 'SwitchBase64-enc "Base64-encode Text") (gs:menu-item 'SwitchBase64-dec 'SwitchBase64-dec "Base64-decode Text") (gs:add-to 'SwitchPopup 'FindText) (gs:add-separator 'SwitchPopup) (gs:add-to 'SwitchPopup 'SwitchText 'SwitchHtml) (gs:add-separator 'SwitchPopup) (gs:add-to 'SwitchPopup 'CopyText) (gs:add-separator 'SwitchPopup) (gs:add-to 'SwitchPopup 'SwitchDecode 'SwitchBase64-enc 'SwitchBase64-dec) ;; ------------------------------------------------------------------------------------ ;; Find Text dialog ;; ------------------------------------------------------------------------------------ (define (finddialog) (gs:dialog 'FindDialog 'F "Find Text" 400 60 nil true) (gs:set-resizable 'FindDialog nil) (gs:set-border-layout 'FindDialog 5 0) (gs:panel 'FindTop) (gs:button 'Find_Button 'FindDialog_Action "Find") (gs:text-field 'Find_TextArea 'FindDialog_Action 40) (gs:set-background 'Find_TextArea gs:lightyellow) (gs:set-foreground 'Find_TextArea gs:black) (gs:set-font 'Find_TextArea "Monospaced" fontsize "plain") (gs:set-font 'Find_Button "Sans Serif" fontsize "plain") (gs:add-to 'FindTop 'Find_Button 'Find_TextArea) (gs:add-to 'FindDialog 'FindTop "center") (gs:request-focus 'Find_TextArea) (gs:set-visible 'FindDialog true)) ;; ------------------------------------------------------------------------------------ ;; Crypt Dialog for Decrypt/Encrypt ;; ------------------------------------------------------------------------------------ (define (cryptdialog) (gs:dialog 'CryptDialog 'F "Decrypt/Encrypt KEY" 200 100 nil true) (gs:set-resizable 'CryptDialog nil) (gs:set-border-layout 'CryptDialog 2 0) (gs:panel 'CryptTop) (gs:text-field 'Crypt_TextArea 'gs:no-action 20) (gs:set-background 'Crypt_TextArea gs:gray) (gs:set-foreground 'Crypt_TextArea gs:black) (gs:set-font 'Crypt_TextArea "Monospaced" fontsize "plain") (gs:add-to 'CryptTop 'Crypt_TextArea) (gs:panel 'CryptBottom) (gs:button 'Crypt_Button_Crypt 'CryptDialog_Crypt "Crypt") (gs:button 'Crypt_Button_Cancel 'CryptDialog_Cancel "Cancel") (gs:set-font 'Crypt_Button_Crypt "Sans Serif" fontsize "plain") (gs:set-font 'Crypt_Button_Cancel "Sans Serif" fontsize "plain") (gs:add-to 'CryptBottom 'Crypt_Button_Crypt 'Crypt_Button_Cancel) (gs:add-to 'CryptDialog 'CryptTop "north" 'CryptBottom "south") (gs:request-focus 'Crypt_TextArea) (gs:set-visible 'CryptDialog true)) ;; ------------------------------------------------------------------------------------ ;; Send-file option ;; ------------------------------------------------------------------------------------ (define (senddialog) (gs:dialog 'SendDialog 'F "Send to Remote (UDP)" 400 70 nil true) (gs:set-resizable 'SendDialog nil) (gs:set-border-layout 'SendDialog 2 0) (gs:panel 'SendTop) (gs:label 'Send_Label "Host:port ") (gs:text-field 'Send_TextArea_Host 'gs:no-action 30) (gs:button 'Send_Button_Send 'SendDialog_Send "Send") (gs:set-background 'Send_TextArea_Host gs:lightyellow) (gs:set-foreground 'Send_TextArea_Host gs:black) (gs:set-font 'Send_Label "Monospaced" fontsize "plain") (gs:set-font 'Send_TextArea_Host "Monospaced" fontsize "plain") (gs:set-font 'Send_Button_Send "Sans Serif" fontsize "plain") (gs:add-to 'SendTop 'Send_Label 'Send_TextArea_Host 'Send_Button_Send) (gs:add-to 'SendDialog 'SendTop "north") (gs:set-text 'Send_TextArea_Host udp-host) (gs:request-focus 'Send_TextArea_Host) (gs:set-visible 'SendDialog true)) ;; ------------------------------------------------------------------------------------ ;; Proxy dialog ;; ------------------------------------------------------------------------------------ (define (proxydialog) (gs:dialog 'ProxyDialog 'F "Net-Proxy config" 300 100 nil true) (gs:set-resizable 'ProxyDialog nil) (gs:set-border-layout 'ProxyDialog 2 0) (gs:panel 'ProxyTop) (gs:text-field 'Proxy_TextArea 'gs:no-action 40) (gs:set-background 'Proxy_TextArea gs:lightyellow) (gs:set-foreground 'Proxy_TextArea gs:black) (gs:set-font 'Proxy_TextArea "Monospaced" fontsize "plain") (gs:add-to 'ProxyTop 'Proxy_TextArea) (gs:panel 'ProxyBottom) (gs:button 'Proxy_Button_Set 'ProxyDialog_Set "Set") (gs:button 'Proxy_Button_Clear 'ProxyDialog_Clear "Clear") (gs:set-font 'Proxy_Button_Set "Sans Serif" fontsize "plain") (gs:set-font 'Proxy_Button_Clear "Sans Serif" fontsize "plain") (gs:add-to 'ProxyBottom 'Proxy_Button_Set 'Proxy_Button_Clear) (gs:add-to 'ProxyDialog 'ProxyTop "north" 'ProxyBottom "south") (gs:request-focus 'Proxy_TextArea) (gs:set-text 'Proxy_TextArea proxy) (gs:set-visible 'ProxyDialog true)) ;; ------------------------------------------------------------------------------------ ; Colors dialog ;; ------------------------------------------------------------------------------------ (define (colordialog) (set 'color-item (names 0)) (gs:dialog 'Colors 'F "Colors Selection" 500 180 nil true) (gs:set-grid-layout 'Colors 1 1) (gs:set-resizable 'Colors nil) (gs:panel 'ColorListBox) (gs:set-titled-border 'ColorListBox "Item") (gs:list-box 'ColorListBox_ListBox 'return-listname names) (gs:set-font 'ColorListBox_ListBox "Sans Serif" fontsize "plain") (gs:set-size 'ColorListBox_ListBox 120 120) (gs:add-to 'ColorListBox 'ColorListBox_ListBox) (gs:panel 'ColorExample_FG) (gs:set-titled-border 'ColorExample_FG "Foreground") (dolist (c colors) (gs:button (sym (string "foreground_" $idx)) 'return-color "" c) (gs:set-size (sym (string "foreground_" $idx)) 20 20) (gs:set-background (sym (string "foreground_" $idx)) (eval c)) (gs:set-foreground (sym (string "foreground_" $idx)) (eval c)) (gs:add-to 'ColorExample_FG (sym (string "foreground_" $idx)))) (gs:panel 'ColorExample_BG) (gs:set-titled-border 'ColorExample_BG "Background") (dolist (c colors) (gs:button (sym (string "background_" $idx)) 'return-color "" c) (gs:set-size (sym (string "background_" $idx)) 20 20) (gs:set-background (sym (string "background_" $idx)) (eval c)) (gs:set-foreground (sym (string "background_" $idx)) (eval c)) (gs:add-to 'ColorExample_BG (sym (string "background_" $idx)))) (gs:add-to 'Colors 'ColorListBox 'ColorExample_FG 'ColorExample_BG) (gs:set-visible 'Colors true) ) ;; ------------------------------------------------------------------------------------ ; Font dialog ;; ------------------------------------------------------------------------------------ (define (fontdialog) (set 'font-item (names 0)) (gs:dialog 'Fonts 'F "Fonts Selection" 500 180 nil true) (gs:set-grid-layout 'Fonts 1 1) (gs:set-resizable 'Fonts nil) (gs:panel 'FontItem) (gs:set-titled-border 'FontItem "Item") (gs:list-box 'FontItem_ListBox 'return-font (0 2 names)) (gs:set-font 'FontItem_ListBox "Sans Serif" fontsize "plain") (gs:set-size 'FontItem_ListBox 120 120) (gs:set-background 'FontItem_ListBox gs:lightyellow) (gs:add-to 'FontItem 'FontItem_ListBox) (gs:panel 'FontName) (gs:set-titled-border 'FontName "Font Name") (gs:list-box 'FontName_ListBox 'return-font fonts) (gs:set-font 'FontName_ListBox "Sans Serif" fontsize "plain") (gs:set-size 'FontName_ListBox 120 120) (gs:add-to 'FontName 'FontName_ListBox) (gs:panel 'FontSize) (gs:set-titled-border 'FontSize "Font Size") (gs:list-box 'FontSize_ListBox 'return-font (map string (sequence 8 24))) (gs:set-font 'FontSize_ListBox "Sans Serif" fontsize "plain") (gs:set-size 'FontSize_ListBox 120 120) (gs:add-to 'FontSize 'FontSize_ListBox) (gs:panel 'FontType) (gs:set-titled-border 'FontType "Font Style") (gs:list-box 'FontType_ListBox 'return-font font-style) (gs:set-font 'FontType_ListBox "Sans Serif" fontsize "plain") (gs:set-size 'FontType_ListBox 120 120) (gs:add-to 'FontType 'FontType_ListBox) (gs:add-to 'Fonts 'FontItem 'FontName 'FontSize 'FontType) (gs:set-visible 'Fonts true) ) ;; ------------------------------------------------------------------------------------ ;; Maintenance Attic Menu ;; ------------------------------------------------------------------------------------ (define (personalmenu) (gs:dialog 'Maintain 'F "Attic Maintenance" 330 430 nil true) (gs:window-closed 'Maintain 'gs:no-action) (gs:set-flow-layout 'Maintain 5 10) (gs:set-resizable 'Maintain nil) (gs:panel 'MaintainName) (gs:set-titled-border 'MaintainName " Title ") (gs:set-font 'MaintainName "Sans Serif" fontsize "plain") (gs:text-field 'MaintainName_TextArea 'gs:no-action 26) (gs:add-to 'MaintainName 'MaintainName_TextArea) (gs:panel 'MaintainExec) (gs:set-titled-border 'MaintainExec " Executable ") (gs:set-font 'MaintainExec "Sans Serif" fontsize "plain") (gs:text-field 'MaintainExec_TextArea 'gs:no-action 26) (gs:add-to 'MaintainExec 'MaintainExec_TextArea ) (gs:panel 'MaintainList) (gs:set-titled-border 'MaintainList " Known ") (gs:set-font 'MaintainList "Sans Serif" fontsize "plain") (gs:list-box 'MaintainList_ListBox 'maintain-action (map first attic)) (gs:set-size 'MaintainList_ListBox 290 200) (gs:set-background 'MaintainList_ListBox gs:lightyellow) (gs:set-font 'MaintainList_ListBox "Sans Serif" fontsize "plain") (gs:add-to 'MaintainList 'MaintainList_ListBox) (gs:panel 'MaintainButtons) (gs:button 'MaintainButtons_Add 'attic-add-action "Add") (gs:set-font 'MaintainButtons_Add "Sans Serif" fontsize "plain") (gs:button 'MaintainButtons_Del 'attic-del-action "Remove") (gs:set-font 'MaintainButtons_Del "Sans Serif" fontsize "plain") (gs:add-to 'MaintainButtons 'MaintainButtons_Add 'MaintainButtons_Del) (gs:add-to 'Maintain 'MaintainList'MaintainName 'MaintainExec 'MaintainButtons) (gs:set-visible 'Maintain true) (gs:request-focus 'MaintainName_TextArea) (gs:set-visible 'Maintain true)) ;; ------------------------------------------------------------------------------------ ;; display/remove attic ;; ------------------------------------------------------------------------------------ (define (display-attic) (if attic (dolist (s attic) (gs:menu-item (sym (string "AtticMenu_" $idx)) 'attic-menu-action (s 0)) (gs:add-to 'AtticMenu (sym (string "AtticMenu_" $idx))) (gs:set-font (sym (string "AtticMenu_" $idx )) "Sans Serif" fontsize "plain") ))) (define (remove-attic) (if attic (dolist (s attic) (gs:remove-from 'AtticMenu (sym (string "AtticMenu_" $idx)))) )) (display-attic) ;; ------------------------------------------------------------------------------------ ;; make all menu item plain! instead of bold. ;; ------------------------------------------------------------------------------------ (dolist (f '( IdxPanel_1 IdxPanel_2 IdxPanel_3 Tabs OptionsMenu OptionsMenu_Save OptionsMenu_Send OptionsMenu_Eval OptionsMenu_Quit OptionsMenu_Help OptionsMenu_Update Configuration FontMenu ColorMenu ProxyMenu ShelfMenu ShelfMenu_Root ShelfMenu_Idx AtticMenu AtticMenu_Maintain FindText SwitchText SwitchHtml CopyText SwitchDecode SwitchBase64-enc SwitchBase64-dec )) (gs:set-font f "Sans Serif" fontsize "plain")) (gs:set-visible 'F true) ;; ---------------------------------------------------------- ;; GUI actions and newlisp code ;; ---------------------------------------------------------- ;; ------------------------------------------------------------------------------------ ;; LOAD FROM [Idx:] !!! ;; ------------------------------------------------------------------------------------ (define (loadidx) (set 'scripts '()) (set 'nlist '()) (gs:clear-list 'ListPanel_ListBox) (gs:set-background 'InfoPanel_TextPane (infopanelcolor 1)) (gs:set-foreground 'InfoPanel_TextPane (infopanelcolor 0)) (cleartags) (loading url) ;; ------------------------------------------------------------------------------------ ;; if nlist.idx found and not an error or empty, content is always converted to string! ;; ------------------------------------------------------------------------------------ (if (and (or (if (ends-with url "/") (set 'dummy (read-file (append url nlist-idx) timeout))) (if (ends-with url nlist-idx) (set 'dummy (read-file url timeout))) ) (string? dummy) (not (nil? dummy)) (not (starts-with dummy "ERR: ")) (!= "" dummy) ) (begin ;; make all content string (set 'dummy (format "%s" (list dummy))) ;; store localy and generate lists (write-file (append nlist-dir nlist-idx) dummy) (set 'dummy (open (append nlist-dir nlist-idx) "read")) (while (read-line dummy) (set 'dl (current-line)) (if (and (not (starts-with (trim dl) ";")) (!= dl "") (< (length dl) 2047)) (begin (push ((parse dl) 0) scripts -1) (push (parse dl) nlist -1)))) (close dummy) ;; display list items (gs:clear-list 'ListPanel_ListBox) (gs:clear-text 'InfoPanel_TextPane) ;; mark names that have a "/" in the name as a LINK with a "+" (dolist (s scripts) (sleep 1) ; timing hack (if (find "/" s) (begin (if (ends-with s "/") (set 's (append s "idx+"))) (gs:add-list-item 'ListPanel_ListBox (append "+" (last (parse s "/"))) )) (gs:add-list-item 'ListPanel_ListBox s) ) ) ) ;; ------------------------------------------------------------------------------------ ;; if not ending Idx with "/" load the file directly !! only "allowed" files! ;; ------------------------------------------------------------------------------------ (begin (if (and (ends-with url allowed 1) (set 'dummy (read-file url timeout)) (string? dummy) (not (nil? dummy)) (not (starts-with dummy "ERR: ")) (!= "" dummy)) (begin (gs:clear-list 'ListPanel_ListBox) (gs:clear-text 'InfoPanel_TextPane) (set 'TAGGED (last (parse url "/")) ) (set 'LOADED dummy) (gs:set-text 'InfoPanel_TextPane LOADED) ) ;;; Display error when realy nothing could be loaded! (begin (gs:clear-list 'ListPanel_ListBox) (errorloading (append "Cant load: (" url ")")) ) ) ) ) ) ;; ------------------------------------------------------------------------------------ ;; clear tags ;; ------------------------------------------------------------------------------------ (define (cleartags) (dotimes (x 5) (gs:clear-text (sym (append "LabelPanel_" (string x)))))) ;; ------------------------------------------------------------------------------------ ;; updatepanels ;; ------------------------------------------------------------------------------------ (define (updatepanels) (dotimes (x 5) (gs:set-text (sym (append "LabelPanel_" (string x))) (lookup TAGGED nlist x) )) (gs:set-syntax-colors (syntaxcolor 0) (syntaxcolor 1) (syntaxcolor 2) (syntaxcolor 3) (syntaxcolor 4) (syntaxcolor 5)) (if (and (!= LOADED HELP) (ends-with TAGGED highlight)) (gs:set-syntax 'InfoPanel_TextPane "lsp") (gs:set-syntax 'InfoPanel_TextPane nil)) ) ;; ------------------------------------------------------------------------------------ ;; update tags ;; ------------------------------------------------------------------------------------ (define (updatetags) (gs:set-background 'InfoPanel_TextPane (infopanelcolor 1)) (gs:set-foreground 'InfoPanel_TextPane (infopanelcolor 0)) (gs:set-text 'InfoPanel_TextPane LOADED) (updatepanels)) ;; ------------------------------------------------------------------------------------ ;; loading notification ;; ------------------------------------------------------------------------------------ (define (loading ltxt) (gs:set-text 'InfoPanel_TextPane (append "Loading: " ltxt) )) ;; ------------------------------------------------------------------------------------ ;; nothing found notifocation ;; ------------------------------------------------------------------------------------ (define (errorloading etxt) (and (= displaytype "text/html") (SwitchDisplay "MAIN:SwitchText") (set 'displaytype "text/plain")) (set 'LOADED "") (gs:set-text 'InfoPanel_TextPane etxt) (cleartags)) ;; ------------------------------------------------------------------------------------ ;; Net-proxy ;; ------------------------------------------------------------------------------------ (define (OptionsMenu_Proxy_action) (proxydialog)) (define (ProxyDialog_Set) (set 'proxy (gs:get-text 'Proxy_TextArea)) (env "HTTP_PROXY" proxy) (gs:dispose 'ProxyDialog)) (define (ProxyDialog_Clear) (gs:clear-text 'Proxy_TextArea) (set 'proxy "") (gs:dispose 'ProxyDialog)) ;; ------------------------------------------------------------------------------------ ;; decode the text panel by using encrypt ;; ------------------------------------------------------------------------------------ (define (SwitchDecodeText) (cryptdialog)) (define (CryptDialog_Cancel) (gs:clear-text 'Crypt_TextArea) (gs:dispose 'CryptDialog)) (define (CryptDialog_Crypt) (set 'cryptkey (gs:get-text 'Crypt_TextArea)) (and LOADED cryptkey (set 'LOADED (encrypt LOADED cryptkey)) (gs:set-text 'InfoPanel_TextPane LOADED) )) ;; ------------------------------------------------------------------------------------ ;; BASE64-enc ;; ------------------------------------------------------------------------------------ (define (SwitchBase64-enc) (set 'LOADED (base64-enc LOADED)) (gs:set-text 'InfoPanel_TextPane LOADED)) ;; BASE64-dec (define (SwitchBase64-dec) (set 'LOADED (base64-dec LOADED)) (gs:set-text 'InfoPanel_TextPane LOADED)) ;; ------------------------------------------------------------------------------------ ;; switch between text/html ;; ------------------------------------------------------------------------------------ (define (SwitchDisplay id) (if (= id "MAIN:SwitchText") (set 'displaytype "text/plain" )) (if (= id "MAIN:SwitchHtml") (set 'displaytype "text/html" )) (gs:remove-from 'ListPanel 'InfoPanel_TextPane) (infopanel (if LOADED LOADED HELP)) (gs:layout 'ListPanel)) ;; ------------------------------------------------------------------------------------ ;; switch TAGGED autoselection ;; ------------------------------------------------------------------------------------ ; (define (switch) ; (if (and (ends-with TAGGED ".html") (!= displaytype "text/html" )) (begin (SwitchDisplay "MAIN:SwitchHtml") (set 'displaytype "text/html" ))) ; (if (and (ends-with TAGGED ".lsp" ) (!= displaytype "text/plain")) (begin (SwitchDisplay "MAIN:SwitchText") (set 'displaytype "text/plain")))) ; Keep It Simple: anything, which is not html, is text (define (switch) (if (or (ends-with TAGGED ".html") (ends-with TAGGED ".htm")) (begin (SwitchDisplay "MAIN:SwitchHtml") (set 'displaytype "text/html" )) (begin (SwitchDisplay "MAIN:SwitchText") (set 'displaytype "text/plain")))) ;; ------------------------------------------------------------------------------------ ;; copy to clipboard ;; ------------------------------------------------------------------------------------ (define (CopyDisplay) (if (= displaytype "text/plain") (begin (gs:select-text 'InfoPanel_TextPane 0) (gs:copy-text 'InfoPanel_TextPane)))) ;; ------------------------------------------------------------------------------------ ;; colors selection ;; ------------------------------------------------------------------------------------ (define (return-color a, i c) (set 'i (parse (5 a) "_")) (set 'c (colors (int (i 1))) ) (if (= (i 0) "foreground") (begin (if (= color-item "listpanel") (nth-set 0 listpanelcolor (eval c))) (if (= color-item "infopanel") (nth-set 0 infopanelcolor (eval c))) (if (= color-item "comment") (nth-set 0 syntaxcolor (eval c))) (if (= color-item "keyword") (nth-set 1 syntaxcolor (eval c))) (if (= color-item "string") (nth-set 2 syntaxcolor (eval c))) (if (= color-item "number") (nth-set 3 syntaxcolor (eval c))) (if (= color-item "quoted") (nth-set 4 syntaxcolor (eval c))) (if (= color-item "parentheses") (nth-set 5 syntaxcolor (eval c))) (gs:set-foreground 'ColorListBox_ListBox (eval c)))) (if (= (i 0) "background") (begin (if (= color-item "listpanel") (nth-set 1 listpanelcolor (eval c))) (if (= color-item "infopanel") (nth-set 1 infopanelcolor (eval c))) (gs:set-background 'ColorListBox_ListBox (eval c)))) (gs:set-background 'ListPanel_ListBox (listpanelcolor 1)) (gs:set-foreground 'ListPanel_ListBox (listpanelcolor 0)) (gs:set-background 'InfoPanel_TextPane (infopanelcolor 1)) (gs:set-foreground 'InfoPanel_TextPane (infopanelcolor 0)) ; comment_foreground keyword_foreground string_foreground number_foreground quoted_foreground parentheses_foreground (gs:set-syntax-colors (syntaxcolor 0) (syntaxcolor 1) (syntaxcolor 2) (syntaxcolor 3) (syntaxcolor 4) (syntaxcolor 5)) (gs:layout 'ListPanel) (gs:layout 'InfoPanel_TextPane) (if (and TAGGED (ends-with TAGGED highlight)) (gs:set-syntax 'InfoPanel_TextPane "lsp") (gs:set-syntax 'InfoPanel_TextPane nil)) ) (define (return-listname a b c) (set 'color-item (base64-dec c))) ;; ------------------------------------------------------------------------------------ ;; font selection ;; ------------------------------------------------------------------------------------ (define (return-font tag txt) (if (= tag "MAIN:FontItem_ListBox") (set 'font-item (names txt))) (if (= tag "MAIN:FontName_ListBox") (set 'fname (fonts txt))) (if (= tag "MAIN:FontSize_ListBox") (set 'fsize (+ 8 txt))) (if (= tag "MAIN:FontType_ListBox") (set 'fstyle (font-style txt))) (and (= font-item "infopanel") fname fsize (gs:set-font 'InfoPanel_TextPane fname fsize fstyle) (set 'infopanelfont (list fname fsize fstyle))) (and (= font-item "listpanel") fname fsize (gs:set-font 'ListPanel_ListBox fname fsize fstyle) (set 'listpanelfont (list fname fsize fstyle))) ) ;; ------------------------------------------------------------------------------------ ;; popups ;; ------------------------------------------------------------------------------------ (define (mouseclicked id type x y button cnt modifiers) (if (or (= 3 button) (= modifiers 18)) (gs:show-popup 'SwitchPopup 'InfoPanel_TextPane x y))) ;; ------------------------------------------------------------------------------------ ;; track window move ;; ------------------------------------------------------------------------------------ (define (main-moved id x y) (set 'main-pos-x x 'main-pos-y y)) ;; track window resize (define (main-resized id width height) (set 'main-width width 'main-height height)) ;; ------------------------------------------------------------------------------------ ;; save after quit/window closure ;; ------------------------------------------------------------------------------------ (define (OptionsMenu_Quit_Action) (save (append nlist-dir nlist-cfg) 'main-pos-x 'main-pos-y 'main-width 'main-height 'nlist-idx 'proxy 'udp-host 'displaytype 'listpanelcolor 'infopanelcolor 'syntaxcolor 'infopanelfont 'listpanelfont 'root 'shelf 'attic 'cs-mode ) (exit) ) ;; ------------------------------------------------------------------------------------ ;; HELP ;; ------------------------------------------------------------------------------------ (define(OptionsMenu_Help_Action) (if (!= displaytype "text/plain") (begin (SwitchDisplay "MAIN:SwitchText") (set 'displaytype "text/plain"))) (gs:set-syntax 'InfoPanel_TextPane nil) (gs:disable 'OptionsMenu_Eval) (gs:set-text 'InfoPanel_TextPane HELP) (set 'LOADED HELP)) ;; ------------------------------------------------------------------------------------ ;; UPDATE ;; ------------------------------------------------------------------------------------ (define(OptionsMenu_Update_Action, v dsp) (if (!= displaytype "text/plain") (begin (SwitchDisplay "MAIN:SwitchText") (set 'displaytype "text/plain"))) (define (dsp x) (gs:set-text 'InfoPanel_TextPane (append { nlist version } x { available. Press "Save File" to store version } x { in } nlist-dir {nlist.lsp}))) (gs:set-syntax 'InfoPanel_TextPane nil) (gs:disable 'OptionsMenu_Eval) (set 'url nlist-rem) (loadidx) (set 'v (regex {@\d{1}\.\d{1,2}@} LOADED)) (if (and v LOADED) (if (< (int (join (parse version ".")) 0 10 ) (int (trim (join (parse (v 0) ".")) "@") 0 10)) (dsp (trim (v 0) "@")) (gs:set-text 'InfoPanel_TextPane " No nlist update available." ))) ) ;; ------------------------------------------------------------------------------------ ;; TAB Actions ;; ------------------------------------------------------------------------------------ (define (tabs-action id cid tab) (and (!= cid "MAIN:ShellDialog_TextArea") (gs:destroy-shell 'ShellDialog_TextArea) (gs:remove-tab 'Tabs 1))) ;; ------------------------------------------------------------------------------------ ;; EVAL SHELL ;; ------------------------------------------------------------------------------------ (define (OptionsMenu_Eval_Action) (if (and (!= LOADED HELP) (ends-with TAGGED ".lsp")) (begin (gs:insert-tab 'Tabs 'ShellDialog_TextArea (string "(" eval-title ")") 1) (gs:request-focus 'Tabs 1) (if (= ostype "Win32") (gs:run-shell 'ShellDialog_TextArea (string (env "NEWLISPDIR") "/newlisp.exe -C -w " nlist-dir )) (gs:run-shell 'ShellDialog_TextArea (string "/usr/bin/newlisp -C -w " nlist-dir ))) (gs:eval-shell 'ShellDialog_TextArea (string "[cmd]\n" LOADED "\n[/cmd]\n")) ))) ;; ------------------------------------------------------------------------------------ ;; SHELF click ;; ------------------------------------------------------------------------------------ (define (ShelfMenu_SelectIdx_Action tag) (set 'url (shelf (int (last (parse tag "_"))))) (gs:set-text 'IdxPanel_1 url) (gs:request-focus 'IdxPanel_1) ;; automated load after shelf selection (LoadAndWrite "MAIN:IdxPanel_1" (base64-enc url))) ;; ------------------------------------------------------------------------------------ ;; ATTIC ;; ------------------------------------------------------------------------------------ (define (maintain-action a b) (set 'attic-id b) (gs:set-text 'MaintainName_TextArea ((attic b) 0)) (gs:set-text 'MaintainExec_TextArea ((attic b) 1)) ) (define (attic-menu-action tag, x) (set 'x ((attic (int (15 tag))) 1)) (process (string x))) ; async (define (attic-add-action tag txt) (gs:get-text 'MaintainName_TextArea 'get-text-handler) (gs:get-text 'MaintainExec_TextArea 'get-text-handler)) ;; handle events, always call action (define (get-text-handler tag txt) (if (string? txt) (begin (if (= "MAIN:MaintainName_TextArea" tag) (set 'name-txt (base64-dec txt)) ) (if (= "MAIN:MaintainExec_TextArea" tag) (set 'exec-txt (base64-dec txt)) ) (this-is-the-final-countdown-tataaa-tata-ta-taaa-tatataaaaa-tatattatatatatataaaatatataa-tatatataa) ))) ; speaks for itself (define (this-is-the-final-countdown-tataaa-tata-ta-taaa-tatataaaaa-tatattatatatatataaaatatataa-tatatataa) (if (and name-txt exec-txt) (begin (remove-attic) (gs:add-list-item 'MaintainList_ListBox name-txt) (gs:clear-text 'MaintainName_TextArea) (gs:clear-text 'MaintainExec_TextArea) (gs:request-focus 'MaintainName_TextArea) (push (list name-txt exec-txt) attic -1) (display-attic) (set 'name-txt 'nil 'exec-txt'nil) )) ) ;; remove (define (attic-del-action tag a b) (if (and attic attic-id) (begin (remove-attic) (pop attic attic-id) (gs:remove-list-item 'MaintainList_ListBox attic-id) (gs:clear-text 'MaintainName_TextArea) (gs:clear-text 'MaintainExec_TextArea) (gs:request-focus 'MaintainName_TextArea) (set 'attic-id 0) (display-attic) ))) ;; ------------------------------------------------------------------------------------ ;; SEND UDP ;; ------------------------------------------------------------------------------------ (define (OptionsMenu_Send_Action) (senddialog)) (define (SendDialog_Send, h u) (set 'h (trim (gs:get-text 'Send_TextArea_Host)) 'u h) (and (find ":" h) (set 'h (parse h ":")) (= (length h) 2) (not (nil? (h 0))) (not (nil? (int (h 1)))) (net-send-udp (h 0) (int (h 1)) LOADED) (set 'udp-host u)) (gs:dispose 'SendDialog) ) ;; ------------------------------------------------------------------------------------ ;; FIND TEXT ;; ------------------------------------------------------------------------------------ (define (FindDialog_Action, text) (set 'text (gs:get-text 'Find_TextArea)) (gs:request-focus 'InfoPanel_TextPane) (gs:find-text 'InfoPanel_TextPane text 'gs:no-action)) ;; ------------------------------------------------------------------------------------ ;; SAVE ;; ------------------------------------------------------------------------------------ (define (OptionsMenu_Save_Action) (and (not (nil? TAGGED)) (not (nil? LOADED)) (not (ends-with TAGGED "/")) (!= TAGGED nlist-cfg) ;; dont save a remote nlist.cfg (not (starts-with LOADED "ERR: ")) ;; prse directory's from TAGGED and always pick the last name! (write-file (append nlist-dir (last (parse TAGGED "/")) ) LOADED))) ;; ------------------------------------------------------------------------------------ ;; ROTATE [Idx:] content ;; ------------------------------------------------------------------------------------ (define (GoBackwardButton) (set 'history (unique history)) (rotate history +1) (gs:set-text 'IdxPanel_1 (history 0)) (gs:request-focus 'IdxPanel_1)) (define (GoForwardButton) (set 'history (unique history)) (rotate history -1) (gs:set-text 'IdxPanel_1 (history 0)) (gs:request-focus 'IdxPanel_1)) (setq IdxPanel_Button_Action GoForwardButton) ;; ------------------------------------------------------------------------------------ ;; SHELF menu ;; ------------------------------------------------------------------------------------ (define (ShelfMenu_Idx_Action) (dolist (s shelf) (gs:remove-from 'ShelfMenu (sym (append "ShelfMenu_" (string $idx))))) (and (!= "" url) (not (find url shelf)) (push url shelf -1)) (display-shelf)) ; set root IDX (define (ShelfMenu_Root_Action tag) (set 'root url) (ShelfMenu_Idx_Action)) ;; ------------------------------------------------------------------------------------ ;; or BUTTON pressed in [Idx:] ;; ------------------------------------------------------------------------------------ ;(define (LoadAndWriteButton) ; (LoadAndWrite "MAIN:IdxPanel_2" (base64-enc (gs:get-text 'IdxPanel_1)))) (define (LoadAndWriteButton tag txt) (gs:get-text 'IdxPanel_1 'get-loadandwrite-text)) (define (get-loadandwrite-text tag txt) (if (string? txt)(LoadAndWrite "MAIN:IdxPanel_2" txt))) (define (LoadAndWrite tag txt) (set 'url (trim (base64-dec txt))) (and (>= (length url) 1) (push url history -1) (loadidx)) ) ;; ------------------------------------------------------------------------------------ ;; read a file from the list-panel ;; ------------------------------------------------------------------------------------ (define (ListPanel_Action tag idx txt clicks) (set 'TAGGED (base64-dec txt)) (if (not (ends-with TAGGED ".lsp")) (gs:disable 'OptionsMenu_Eval)) (define (load-error) (errorloading (append "no (" TAGGED ") found." ))) (if (starts-with TAGGED "+") (set 'TAGGED (scripts idx))) ;; load only when clicked twice, 1 click shows the info! ;; and if TAGGED is !+ " " (if (and (= clicks 2) (!= TAGGED " ")) (begin (set 'eval-title TAGGED) (if (ends-with TAGGED ".lsp") (gs:enable 'OptionsMenu_Eval)) (if (nil? (find "/" TAGGED)) (begin (loading (append url TAGGED)) (set 'LOADED (read-file (append url TAGGED) timeout)) (if LOADED (and (updatetags) (switch)) (load-error)) ) (if (not (ends-with TAGGED "/")) (begin (loading TAGGED) (set 'LOADED (read-file TAGGED timeout)) (if LOADED (and (updatetags) (switch)) (load-error)) ) (if (ends-with TAGGED "/") (begin (LoadAndWrite "MAIN:IdxPanel_1" (base64-enc TAGGED)) (set 'LOADED "") (gs:set-text 'IdxPanel_1 TAGGED) (gs:set-text 'LabelPanel_0 TAGGED)) (load-error)) ) ) ) ;; show tags when clicked once! (updatepanels)) ) ;;;;;; Extra GUI/nlist init actions just befor main (OptionsMenu_Help_Action) ;; ---------------------------------------------------------- ;; MAIN GUI LOOP ;; ---------------------------------------------------------- ;(while (gs:check-event 100000)) (gs:listen) ;(exit)