;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. #@54 List of directories where toolbarx finds its images. (defvar toolbarx-image-path (byte-code "\302\303\304\305\"\" C\244\207" [load-path data-directory delq nil mapcar #[257 "\211\205\300\301!!\302\235\205\211\207" [file-name-nondirectory directory-file-name ("toolbar" "images")] 4 "\n\n(fn X)"]] 5) (#$ . 87)) #@103 Return a string from the name of a SYMBOL. Upcase initials and replace dashes by spaces. (fn SYMBOL) (defalias 'toolbarx-make-string-from-symbol #[257 "\300\301!!\302\303\302\"\211\203*\211@\211\304=\203\305B\262\202#\211B\262A\266\202\202\n\210\211\237\260\207" [upcase-initials symbol-name nil append 45 32] 7 (#$ . 411)]) #@98 Return a (intern) symbol from STRING. Downcase string and replace spaces by dashes. (fn STRING) (defalias 'toolbarx-make-symbol-from-string #[257 "\300\227\301\"\301\211\203'\211@\211\302=\203\303B\262\202 \211B\262A\266\202\202\210\304\237\260!\207" [append nil 32 45 intern] 7 (#$ . 756)]) #@216 Non-nil means the OPTION-LIST is of form (OPT FORM ... OPT FORM). Each OPT is member of VALID-OPTIONS and OPT are pairwise different. OPTION-LIST equal to nil is a good option list. (fn OPTION-LIST VALID-OPTIONS) (defalias 'toolbarx-good-option-list-p #[514 "\300\301G\302\245\211\303\211W\203D\211\211\303V\203AA\262@\211\235\203(\202,\211B\262\262\205:@>\262\210\211T\262\202 \266\205WG=\205WG\302\246\303=\207" [t nil 2 0] 12 (#$ . 1071)]) #@518 Return a cons cell with non-options and options of GROUP-LIST. The options-part is the largest tail of the list GROUP-LIST that has an element of VALID-OPTIONS (the comparation is made with `memq'.) The non-options-part is the beginning of GROUP-LIST less its tail. Return a cons cell which `car' is the non-options-part and the `cdr' is the options-part. If CHECK is non-nil, the tail is the largest that yield non-nil when applied to `toolbarx-good-option-list-p'. (fn GROUP-LIST VALID-OPTIONS &optional CHECK) (defalias 'toolbarx-separate-options #[770 "\300\211\211\2034\211@\211>\262GGV\203-\203#\301\"\202$\302\203-\211>\262A\266\202\202\210\303G\"B\207" [nil toolbarx-good-option-list-p t butlast] 10 (#$ . 1557)]) #@587 Merge property lists INNER-PROPS and OUTER-PROPS. INNER-PROPS and OUTER-PROPS are two lists in the format (PROP VAL PROP VAL ... PROP VAL). Returns a list with properties and values merged. OVERRIDE and ADD are supposed to be lists of symbols. The value of a property in OVERRIDE is the one on OUTER-PROPS or INNER-PROPS, but if the property is in both, the value in INNER-PROPS is used. The value of a property in ADD will be a list with first element the symbol `:add-value-list' and the rest are the properties, inner properties first. (fn INNER-PROPS OUTER-PROPS OVERRIDE ADD) (defalias 'toolbarx-merge-props #[1028 "\300\211\211\211\203<\211@\211 >\203!\301\211\f>A@D\"\262\2025\211>\2035\301\211 >A@D\"\262A\266\202\202\210\211\203\263\211@\211 >\262\203mA@<\203gA@@\302=\203gA@A\262\202mA@C\262\211>\262\203\226A@<\203\220A@@\302=\203\220A@A\262\202\226A@C\262\301\"\203\254\301\302\301\"BD\"\262A\266\202\202>\207" [nil append :add-value-list] 16 (#$ . 2314)]) #@289 Return a command made from COMM, PREP and APP. COMM is a command or a form. PREP and APP are forms. If PREP or APP are non-nil, they are added to the resulting command at the beginning and end, respectively. If both are nil and COMM is a command, COMM is returned. (fn COMM PREP APP) (defalias 'toolbarx-make-command #[771 "\300!\204\204\211\203\207\301\302%\207" [commandp make-closure #[0 "\304\301\203 \305\301\306\"\262\300\203\303\203\307\300!\202\305\300\306\"\262\302\203)\305\302\306\"\262\207" [V0 V1 V2 V3 nil eval t call-interactively] 4 nil nil]] 10 (#$ . 3356)]) #@233 Return an interactive `lambda'-expression that shows a popup menu. This function is the action of `toolbarx-mount-popup-menu' if inside Emacs. See documentation of that function for more. (fn STRINGS VAR TYPE &optional TITLE SAVE) (defalias 'toolbarx-emacs-mount-popup-menu #[1283 "\300!\301\302\303\304>\203\202\305\306\307\310\n\"\"\210\311\312>\203&\2020\305\306\307\313 \"\"\210\303\n\211\203\240\211@\314\315!\211\262>\203WT\262\316\307\317#!\262\202?B\262\266\320\321!\322 \323\324\f\f%\262\325\n\311=\203\211\326\327F\202\220\330\331F\257#\210T\262A\266\202\2022\210\211\332=\203\351\320\333\334#\210\314\335\211\262>\203\312T\262\316\307\317#!\262\202\263B\262\266\320\321!\322\336\337\303\340\341\342DEFE#\210\323\343\"\207" [make-sparse-keymap 1 (nil) nil (radio toggle) display-warning toolbarx format "TYPE should be symbols `radio' or `toggle', but %s found; using `radio'" radio (always offer nil) "SAVE should be symbols `nil', `offer' or `always', but %s found; using `nil'" 0 toolbarx-make-symbol-from-string intern "%s-%d" define-key-after vector menu-item make-closure #[0 "\300\301\304=\203 \303\202!\303\300J>\203\305\303\300J\"\202!\306\303\300JB\307\"L\210\310 \210\302\311=\2032\312\300\211J\"\210\300J\207" [V0 V1 V2 V3 radio delete sort < toolbarx-refresh always customize-save-variable] 4 nil nil] :button :radio eq :toggle memq offer [sep] (menu-item "--shadow-etched-in-dash") custom-save "Save state of this menu" lambda (interactive) customize-save-variable quote #[0 "\301\300!\207" [V0 popup-menu] 2 nil nil]] 25 (#$ . 3968)]) #@957 Return a command that show a popup menu. The return is a `lambda'-expression with a interactive declaration. STRINGS is a list of strings which will be the itens of the menu. VAR is a symbol that is set when an item is clicked. TYPE should be one of the symbols `radio' or `toggle': `radio' means that the nth item is selected if VAR is `n' and this item sets VAR to `n'; `toggle' means that VAR should be a list of integers and the nth item is selected if `n' belongs to VAR. The item inserts or deletes `n' from VAR. TITLE is a string (the title of the popup menu) or nil for no title. SAVE is one of the symbols nil, `offer' or `always'. If value is nil, do not try to save anything. If it is `offer', a menu item is added offering the user the possibiity to save state of that dropdown menu for future sesseions (using `custom'). If it is `always', state is saved every time that a item is clicked. (fn STRINGS VAR TYPE &optional TITLE SAVE) (defalias 'toolbarx-mount-popup-menu #[1283 "\300%\207" [toolbarx-emacs-mount-popup-menu] 11 (#$ . 5635)]) #@157 If OPT is a vector, return first element, otherwise, return OPT. If OPT is vector and length is smaller than the necessary, then nil is returned. (fn OPT) (defalias 'toolbarx-option-value #[257 "\300!\203\211G\301V\205\211\301H\207\211\207" [vectorp 0] 3 (#$ . 6710)]) #@584 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ non-nil means that VAL is a valid value, according to the car of the result of TYPE-TEST-FUNCTION, that should return a cons cell in the same format as the return of this function. If OBJECT applied to TYPE-TEST-FUNC return (GOOD-OBJ . VAL), and GOOD-OBJ is non-nil, return that. Else, check if OBJECT is a function. If so, evaluate and test again with TYPE-TEST-FUNC. If not a function or if GOOD-OBJ is again nil, test if OBJECT is a bound symbol, evaluate that and return the result of TYPE-TEST-FUNC. (fn OBJECT TYPE-TEST-FUNC) (defalias 'toolbarx-eval-function-or-symbol #[514 "\211!\211@\204:\300!\203) !\262\211@\204:9\203:\301!\203:J!\2079\203:\301!\203:J!\262\207" [functionp boundp] 5 (#$ . 6992)]) #@166 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid image object VAL (see documentation of function `toolbarx-process-symbol'). (fn OBJ) (defalias 'toolbarx-test-image-type #[257 "\300\301\"\207" [#[257 "\300!\301;\206U\242\302=\206U9\203)\303!\203)J:\203)J@\302=\206U<\205UG\304U\205U\211\203R\211@\205I\211;\206I\211\242\302=\262A\266\202\2026\262\211B\207" [toolbarx-option-value t image boundp 4] 7 "\n\n(fn IMG)"] toolbarx-eval-function-or-symbol] 5 (#$ . 7780)]) #@167 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid button object VAL (see documentation of function `toolbarx-process-symbol'). (fn OBJ) (defalias 'toolbarx-test-button-type #[257 "\300\301\"\207" [#[257 "\300!\211:\205\f\211@\301>\211B\207" [toolbarx-option-value (:toggle :radio)] 5 "\n\n(fn BUT)"] toolbarx-eval-function-or-symbol] 5 (#$ . 8314)]) #@139 Return a cons cell (t . VAL). If OBJ is vector, return VAL according to editor. Else, return OBJ, because it is a form anyway. (fn OBJ) (defalias 'toolbarx-test-any-type #[257 "\300\301!B\207" [t toolbarx-option-value] 4 (#$ . 8706)]) #@165 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid help object VAL (see documentation of function `toolbarx-process-symbol'). (fn OBJ) (defalias 'toolbarx-test-string-or-nil #[257 "\300\301\"\207" [#[257 "\300!\211;\206\n\211?\211B\207" [toolbarx-option-value] 5 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 8951)]) #@177 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid toolbar property object VAL (see documentation of function `toolbarx-process-symbol'). (fn OBJ) (defalias 'toolbarx-test-toolbar-type #[257 "\300\301\"\207" [#[257 "\300!\301B\207" [toolbarx-option-value t] 4 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 9321)]) #@204 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid `:type' property object VAL of a dropdown group (see documentation of function `toolbarx-process-dropdown-group'. (fn OBJ) (defalias 'toolbarx-test-dropdown-type #[257 "\300\301\"\207" [#[257 "\300!\211\301>\211B\207" [toolbarx-option-value (radio toggle)] 5 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 9687)]) #@208 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid `:variable' property object VAL of a dropdown group (see documentation of function `toolbarx-process-dropdown-group'. (fn OBJ) (defalias 'toolbarx-test-symbol #[257 "\300\301\"\207" [#[257 "\300!\2119\211B\207" [toolbarx-option-value] 5 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 10103)]) #@207 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid `:default' property object VAL of a dropdown group (see documentation of function `toolbarx-process-dropdown-group'. (fn OBJ) (defalias 'toolbarx-test-dropdown-default #[257 "\300\301\"\207" [#[257 "\300!\211\250\206)\211<\205)\301\211\203$\211@\205\211\250\262A\266\202\202\262\262\211B\207" [toolbarx-option-value t] 6 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 10498)]) #@204 Return a cons cell (GOOD-OBJ . VAL). GOOD-OBJ is non-nil if OBJ yields a valid `:save' property object VAL of a dropdown group (see documentation of function `toolbarx-process-dropdown-group'. (fn OBJ) (defalias 'toolbarx-test-dropdown-save #[257 "\300\301\"\207" [#[257 "\300!\211\301>\211B\207" [toolbarx-option-value (nil offer always)] 5 "\n\n(fn OBJ)"] toolbarx-eval-function-or-symbol] 5 (#$ . 10991)]) #@307 List yielding all encarnations of properties of a button. First element: alist, where each element is of form (PROP . (TYPE-TEST-FUNCTION . ADD-OR-NIL)) Second is a list with all properties. Third, a list with properties that override when merging. Fourth, a list of lists, each in the format (PROP ADD). (defconst toolbarx-button-props (byte-code "\300\301\211\203\211@\211@B\262A\266\202\202\262\262\237\301\211\2037\211@\211AA\2040\211@B\262A\266\202\202\262\262\237\301\211\203X\211@\211AA\203Q\211@B\262A\266\202\202?\262\262\237F\207" [((:image toolbarx-test-image-type) (:command toolbarx-test-any-type) (:enable toolbarx-test-any-type) (:visible toolbarx-test-any-type) (:help toolbarx-test-string-or-nil) (:insert toolbarx-test-any-type . and) (:button toolbarx-test-button-type) (:append-command toolbarx-test-any-type . progn) (:prepend-command toolbarx-test-any-type . progn)) nil] 8) (#$ . 11412)) #@489 List yielding all encarnations of properties of a dropdown group. First element: alist, where each element is of form (PROP . (TYPE-TEST-FUNCTION . ADD-OR-NIL)) Second is a list with all properties. Third, a list with properties that override when merging. Fourth, a list of lists, each in the format (PROP ADD). Convention: properties for the dropdown button should be formed with the strings ":dropdown-" with the button property name without `:'. This is used on the implementation. (defconst toolbarx-dropdown-props (byte-code "\300\301\211\203\211@\211@B\262A\266\202\202\262\262\237\301\211\2037\211@\211AA\2040\211@B\262A\266\202\202\262\262\237\301\211\203X\211@\211AA\203Q\211@B\262A\266\202\202?\262\262\237F\207" [((:type toolbarx-test-dropdown-type) (:variable toolbarx-test-symbol) (:default toolbarx-test-dropdown-default) (:save toolbarx-test-dropdown-save) (:title toolbarx-test-string-or-nil) (:dropdown-image toolbarx-test-image-type) (:dropdown-enable toolbarx-test-any-type) (:dropdown-visible toolbarx-test-any-type) (:dropdown-insert toolbarx-test-any-type . and) (:dropdown-help toolbarx-test-string-or-nil) (:dropdown-append-command toolbarx-test-any-type . progn) (:dropdown-prepend-command toolbarx-test-any-type . progn)) nil] 8) (#$ . 12367)) #@225 Return an updated version of SWITCHES. GROUP-WITHOUT-PROPS and MERGED-PROPS-WITHOUT-INSERT are preprocessed variables in `toolbarx-process-group'. (fn GROUP-WITHOUT-PROPS MERGED-PROPS-WITHOUT-INSERT MEANING-ALIST SWITCHES) (defalias 'toolbarx-process-group-without-insert #[1028 "\211\211\2037\211@\300!\262\2119\203 \301$\262\2020\211<\2030\302$\262A\266\202\202\207" [toolbarx-option-value toolbarx-process-symbol toolbarx-process-group] 12 (#$ . 13683)]) #@516 Return an updated version of SWITCHES. Append to already processed buttons (stored in SWITCHES) a processed version of GROUP. Groups are useful to distribute properties. External properties are given in PROPS, and merged with the internal properties that are in the end of GROUP. If properties (after merge) contain a `:insert' property, return a list where the first and second elements are `:insert' and its value, and after that a list in the same format as SWITCHES. (fn GROUP MEANING-ALIST PROPS SWITCHES) (defalias 'toolbarx-process-group #[1028 "@\302=\203\303$\207@\304=\203A\211A\211\203?\211@\305\306\"\307<\203,\202.C$\262\210A\266\202\202\207\310\311A@ A@\"\"\211A@\312\311\3138\313 8\"\311\3148\314 8\"$\315>\203\344\315>\211A@<\203\304\211A@@\316=\203\304\315@\236\211AAC\317A@A\211\203\252\211@A@!\262@\203\243AB\262A\266\202\202\213\210\237\262G\313=\203\276A@\266\203\202\307\266\203\202\307\211A@\311\320G\"AA\"\321\f\317$\311\315D\" \237B\237\207\321 $\207" [toolbarx-button-props toolbarx-dropdown-props :dropdown-group toolbarx-process-dropdown-group :eval-group eval t toolbarx-process-group toolbarx-separate-options append toolbarx-merge-props 2 3 :insert :add-value-list nil butlast toolbarx-process-group-without-insert] 16 (#$ . 14176)]) #@520 Process a button given by SYMBOL in MEANING-ALIST. The processed button is appended in SWITCHES, which is returned. Look for a association of SYMBOL in MEANING-ALIST for collecting properties. Such association is a list that represents either a normal button (a description of the button) or an alias group (the symbol is an alias for a group of buttons). PROPS is a externel list of properties that are merged and then applied to the button. Scope is given by GLOBAL-FLAG. (fn SYMBOL MEANING-ALIST PROPS SWITCHES) (defalias 'toolbarx-process-symbol #[1028 "\236A\211@\302=\203\303A$\207\3048\3058\306\307A@ A@\"\"\211@A\310>?\205:G\311V\205:\310@D\312>?\205MG\313V\205M\312A@D\307#\314\f\n\n$ B \237B\237\207" [toolbarx-button-props toolbarx-dropdown-props :alias toolbarx-process-group 2 3 toolbarx-separate-options append :image 0 :command 1 toolbarx-merge-props] 18 (#$ . 15528)]) #@385 Process buttons that appear according to dropdown menu. Process a dropdown group DROPDOWN with meaning alist MEANING-ALIST, external property list PROP and GLOBAL-FLAG specifying scope. For a complete description, see documentation of `toolbarx-install-toolbar'. The processed buttons are stored in the end of SWITCHES, which is returned. (fn DROPDOWN MEANING-ALIST PROPS SWITCHES) (defalias 'toolbarx-process-dropdown-group #[1028 "@\302=\203\fA\202 \303\304A@ A@\"\"\211@A\305\304\3068\306 8\"\304\3078\307 8\"$\310\211A@\211\203V\211@\211>\262\203O\304A@D\"\262A\266\202\2026\262\266\202\310\211 A@\211\203\201\211@\211>\262\203z\304A@D\"\262A\266\202\202`\262\266\202\310\211\211\311 \312\313\"\216 @\211\203\332\211@\314\315\316@!\"\204\323\211@>\262\203\323\211A@A@!\262@\203\312\304@AD\"\262\202\323\317\320\321\322@\"\"\210A\266\202\202\222\262)\262\266\203\310\311 \312\323\"\216 A@\211\203'\211@\211>\203 \314\324\316!\"\203 \325\326\316!\327\224\327\225OP!>A@\304D\"\262\266A\266\202\202\355\210)\210\330>\2048\304\330\331D\"\262\211\262\332B\333>\203L\333>A@\202M\334\335>\211A@\203]\211\266\202\202m\334=\203i\266\327\202m\327C\266\202\336>\205x\336>A@\211\203\214\337>\204\214\317\320\340\"\210\310\202\215\211\262\341>\205\234\341>A@\337>\203\254\337>A@\202\312\342\325\321\343\342\"!\344!\203\310T\262\325\321\343\"!\262\202\263\262\310\211\203\332\345\346#\210\202\345\344!\204\345L\210\211J\347=\203\211<\203\370\211\202%\211\250\203\211C\202%\327C\202%\211\250\203\211\202%\211\203$\211<\203$\211@\250\203$\211@\202%\327\262L\210\350\211\203A\211@\2058\2119\262A\266\202\202,\262\262\203\204\342\211\203\211@\351!B\262T\262\211\352 \334=\203n\353 E\202s\354 EEB\262A\266\202\202L\266\202\n@;\204\222\355\356\357\360\361$\210\342\310\211\203\344@\262A\262;\203\334B\262\211\203\322\304\237\352\f\334=\203\306\353\nE\202\314\354\nED\"B\262\310\262T\262\202\225B\262\202\225\211\203\304\237\352\f\334=\203\374\353\nE\202\354\nED\"B\262\266\237\262\211\237\262\362$\262\362\304\n\363\364 \f%D\"$\207" [toolbarx-button-props toolbarx-dropdown-props :dropdown-group toolbarx-separate-options append toolbarx-merge-props 2 3 nil match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match "^:dropdown-.*$" symbol-name display-warning toolbarx format "Wrong type for value in property `%s' in dropdown group" #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] "^:dropdown-\\(.*\\)$" intern ":" 1 :image "dropdown" dropdown :type radio :default :save :variable "`:save' property with non-nil value should be used only with the `:variable' property; using value nil for `:save'." :title 0 "toolbarx-internal-menu-var-%d" boundp custom-declare-variable "Used as variable of dropdown menu defined with `toolbarx'." toggle t toolbarx-make-string-from-symbol :insert eq memq error "%s %s %s" "If not all itens on dropdown are symbols, then a string" "must come before each set of buttons; no string found" "in first position." toolbarx-process-group :command toolbarx-mount-popup-menu] 32 (#$ . 16457)]) #@266 Return image descriptor or glyph for IMAGE. IMAGE is string. Usually IMAGE neither contains a directory nor an extension. If the extension is omitted, `xpm', `xbm' and `pbm' are tried. If the directory is omitted, `toolbarx-image-path' is searched. (fn IMAGE) (defalias 'toolbarx-find-image #[257 "\301\302\211\203\211@\204\303P\304#\262A\266\202\202\210\211\203%\305!\207\306\307\310\311\312PF\307\313\311\314PF\307\315\311\316PFE!\207" [toolbarx-image-path nil ("" ".xpm" ".xbm" ".pbm") locate-library t create-image find-image :type xpm :file ".xpm" xbm ".xbm" pbm ".pbm"] 10 (#$ . 19794)]) #@134 Store the list of processed buttons, used by `toolbarx-refresh'. This variable can store different values for the different buffers. (defvar toolbarx-internal-button-switches nil (#$ . 20419)) #@814 Insert a button where BUTTON is its description. USED-KEYS should be a list of symbols, where the first element is `:used-symbols'. This list should store the symbols of the buttons already inserted. This list is changed by side effect. KEYMAP is the keymap where the menu-item corresponding to the tool-bal button is going to be inserted. Insertion is made in the end of KEYMAP. BUTTON should be a list of form (SYMBOL . PROP-LIST). SYMBOL is a symbol that "names" this button. PROP-LIST is a list in the format (PROP VAL ... PROP VAL). The supported properties are `:image', `:command', `:append-command', `:prepend-command', `:help', `:enable', `:visible', `:button', and `:insert'. For a description of properties, see documentation of function `toolbar-install-toolbar'. (fn BUTTON USED-KEYS KEYMAP) (defalias 'toolbarx-emacs-add-button #[771 "@\205A\301\211\211@\211\203\225\211@\211@\n>\262\203\216\211AA\203uA@@\302=\203u\211AACA@A\211\203V\211@A@!\262@\203OAB\262A\266\202\2025\210\211\237\262\211G\303=\203g\211A@\262\304@D\"\262\210\202\216\211A@A@!\262@\203\216\304@AD\"\262A\266\202\202 \262\266\203\305>?\206\251\306\305>A@\307\"\211\203\264\310>A@\310>\205\370\211;\203\303\311!\202\370\211:\203\323\211@\312=\203\323\211\202\370\2119\203\361\313!\203\361\211J:\203\361\211J@\312=\203\361\211J\202\370\314\315\316\317\"\"\320>A@\321>A@\322>A@\204\204\211\205\323#\266\203\324>\324>A@B\325>\325>A@B\326>\326>A@B\327>\327 >A@B\304\330\331 !\310\n\257@\205]\324AD@\205g\325AD@\205q\326AD@\205{\327AD%\332\f\211 >\203\227T\262\333\334\335#!\262\202\262\203\262\203\262\211\fB\262\f\336\315!#\210\266 \205\273\241\207" [toolbarx-button-props nil :add-value-list 2 append :insert eval t :image toolbarx-find-image image boundp apply vector mapcar #[257 "\211;\203 \300!\207\207" [toolbarx-find-image] 3 "\n\n(fn IMG)"] :command :append-command :prepend-command toolbarx-make-command :help :enable :visible :button menu-item toolbarx-make-string-from-symbol 0 intern format "%s-%d" define-key-after] 22 (#$ . 20619)]) #@396 Process SWITCHES, inserting buttons in `tool-bar-map'. If a button is actually a `:insert' clause group (if `car' is `:insert') and evaluation of `cdr' yields non-nil, process `cddr' recursively as SWITCHES. USED-KEYS is a list which `car' is `:used-symbols' and which `cdr' is a list of symbols that have already been used as keys in the keymap `tool-bar-map'. (fn SWITCHES USED-KEYS KEYMAP) (defalias 'toolbarx-emacs-refresh-process-button-or-insert-list #[771 "\211\205/\211@\211@\300=\203\"\301A@\302\"\203(\303AA#\210\202(\304#\210A\266\202\202\207" [:insert eval t toolbarx-emacs-refresh-process-button-or-insert-list toolbarx-emacs-add-button] 9 (#$ . 22809)]) #@195 Refresh and redraw the toolbar in Emacs. If GLOBAL-FLAG is non-nil, the default value of toolbar switches is used and the default value of `toolbarx-map' is changed. (fn &optional GLOBAL-FLAG) (defalias 'toolbarx-emacs-refresh #[256 "\211\203\302\300!\203\303\300!\202\202\304\305D\306 \307#\210\203)\310\301\"\207\211\211\207" [toolbarx-internal-button-switches tool-bar-map default-boundp default-value :used-symbols nil make-sparse-keymap toolbarx-emacs-refresh-process-button-or-insert-list set-default] 8 (#$ . 23501)]) #@134 Redraw the toolbar, peviously installed with `toolbarx'. Force global refresh if GLOBAL-FLAG is non-nil. (fn &optional GLOBAL-FLAG) (defalias 'toolbarx-refresh #[256 "\300!\207" [toolbarx-emacs-refresh] 3 (#$ . 24051) "P"]) #@9321 Install toolbar buttons given in BUTTONS. Button properties are optionally given in MEANING-ALIST. If GLOBAL-FLAG is non-nil, toolbar is installed globally (on every buffer that does not have a toolbar set locally). BUTTONS is a list of format (ELEM ... ELEM . PROPS), where each ELEM is either - a list in the same format od BUTTONS, which is going to be refered as a *group*; groups are used to distribute properties recursively to its elements; there are groups with special format for special purpose: *dropdown groups* and also *eval groups*. - a symbol, which could be associated in MEANING-ALIST with a list of button properties (symbol + properties = a *button*) or associated to a special kind of group (an *alias group*). Meaning alist ============= MEANING-ALIST is a list where each element is in one of the formats (SYMB . BUTTON-PROPS-LIST) or (SYMB . ALIAS-GROUP). BUTTON-PROPS-LIST is a list in one of the formats (IMAGE COMMAND PROP VAL PROP VAL ... PROP VAL) or (PROP VAL PROP VAL ... PROP VAL). The IMAGE is going to be used as the `:image' property of the button (see button properties bellow), and COMMAND shall be used as the `:command' property of the button. Each PROP is one of the button properties, and VAL is its respective value. ALIAS-GROUP is a list which first element is the symbol `:alias' and the cdr shall be processed as a group. However, a symbol is not required to have an association in MEANING-ALIST, which is only a way to specify properties to a button. One can use groups to specify properties. Nil is a good MEANING-ALIST. Buttons ======= A toolbar button in `toolbarx' is the set with a symbol and properties used to display the button, like a image and a command to call when the button is pressed (which are the minimal elements that a button should have.) The supported properties for buttons and their `basic types' (see note on how values of properties are obtained!) are: :image -- either a string or image descriptor (see info for a definition), or a variable bound to a image descriptor (like those defined with `defimage') or a list of 4 strings or image descriptors; defines the image file displayed by the button. If it is a string, the image file found with that name (always using the function `toolbarx-find-image' to make the `internal' image descriptor) is used as button image. For the other formats, the button image is handled in the same way as it is treated by the editors; see info nodes bellow for a description of the capabilities: info file "elisp", node "Tool Bar" (see `:image' property); PS: a *vector* of four strings is used in the Emacs Lisp documentation as the `more ellaborated' image property format, but here we reserve vectors to provide editor-dependent values; this motivates our choice for a list instead of vector (however, internally the list becomes a vector when displaying the button). :command -- a form; if the form happens to be a command, it will be called with `call-interactively'. :append-command -- a form added to the end of the value of `:command'. :prepend-command -- a form added at the beginning of the value of `:command'. :help -- either a string or nil; defined the help string of the button; :enable -- a form, evaluated constantly by both editors to determine if a button is active (enabled) or not. :visible -- a form that is evaluated constantly to determine if a button is visible. :button -- a cons cell (TYPE . SELECTED) where the TYPE should be `:toggle' or `:radio' and the cdr should be a form. SELECTED is evaluated to determine when the button is selected. :insert -- a form that is evaluated every time that the toolbar is refresh (a call of `toolbarx-refresh') to determine if the button is inserted or just ignored (until next refresh). How to specify a button ======================= One can specify a button by its symbol or by a group to specify properties. For example, BUTTON = ( foo (bar :image "bar" :command bar-function :help "Bar help string") :insert foo-bar ) MEANING-ALIST = ( (foo :image "foo" :command foo-function) ) specifiy two buttons `foo' and `bar', each one with its necessary :image and :command properties, and both use the :insert property specified ate the end of BUTTONS (because groups distribute properties to all its elements). `foo' and `bar' will be inserted only if `foo-bar' evaluation yields non-nil. Note on how values of properties are obtained ============================================= For each property PROP, its value should be either: i) a vector of 2 elements; then each element should be of the basic type of PROP. ii) an element on the basic type of PROP. iii) a function (that does not need arguments); it is evaluated and the return should be ot type i) or ii) above iv) a symbol bound to a element of type i) or ii). The type is cheched in the order i), ii) iii) and iv). This evaluations are done every time that the oolbar is refresh. Ps.: in order to specify a vector as value of a property (like the :image in Emacs), it is necessary to provide the vector as element of another vector. Special groups ============== Eval groups ----------- If the first element of a group is the symbol `:eval-group', each element is evaluated (with `eval'), put inside a list and processed like a group. Eval groups are useful to store definition of buttons in a variable. Dropdown groups --------------- The idea is to specify a set of buttons that appear when a determined menu item of a dropdown menu is active. The dropdown menu appears when a button (by default with a triangle pointing down) is clicked. This button is called `dropdown button'. The dropdown button appears on the left of the currently visible buttons of the dropdown group. A dropdown group is a list which first element is the symbol `:dropdown-group' and in one of the following formats (:dropdown-group SYMBOL-1 ... SYMBOL-n PROP-1 VAL-1 ... PROP-k VAL-k) or (:dropdown-group STRING-1 ITEM-11 ... ITEM-1n STRING-2 ITEM-21 ... ITEM-2m . . . STRING-n ITEM-n1 ... ITEM-np PROP-1 VAL-1 ... PROP-j VAL-j) where SYMBOL-* is a symbol that defines a button in MEANING-ALIST; STRING-* is a string that will appear in the dropdown menu; ITEM-* is any format that define buttons or groups. (a dropdown group of first format is internally converted to the second by making strings from the symbols and each symbol is the item) The same rules for obtaining property values, described above, apply here. Properties are also distributed by groups. The supported properties and their basic type are: :type -- one of the symbols `radio' (default) or `toggle'; if type is radio, only one of the itens may be active, and if type is toggle, any item number of itens can be active. :variable -- a symbol; it is the variable that govern the dropdown button; every time the value should be an integer starting from 1 (if type is radio) or a list of integers (if type is toggle). The Nth set of buttons is :insert'ed. :default -- determines the default value when the menu is installed; it is ignored if a value was saved with custom; it defaults to 1 if type is radio or nil if type is toggle. If value is a integer and type is `toggle', value used is a list with that integer. :save -- one of the symbols nil (default), `offer' or `always'; determined if it is possible for the user to save the which menu itens are active, for a next session. If value is `offer', a item (offering to save) is added to the popup menu. If the value is `always', every time that a item is selected, the variable is saved. If value is nil, variable shall not be saved. If value is non-nil then `:variable' is mandatory. :title -- a string or nil; if a string, the popup menu will show is as menu title; if nil, no title is shown. :dropdown-help -- a string or nil; the help string of the dropdown button. :dropdown-image -- either a string or a vector of 4 strings; defines the image file displayed by the dropdown button; by default, it is the string "dropdown". :dropdown-append-command, :dropdownprepend-command -- a form; append or prepend forms to the command that shows the dropdown menu, allowing extra code to run before or after the menu appears (remember that every menu item clicked refresh the toolbar.) :dropdown-enable -- a form; evaluated constantly by both editors to determine if the dropdown button is active (enabled) or not. :dropdown-visible -- a form; it is evaluated constantly to determine if the dropdown button is visible. Also, if the symbol `dropdown' is associted in MEANING-ALIST with some properties, these properties override (or add) with higher precedence. Special buttons =============== If the symbol of a button is `:new-line', it is inserted a (faked) return, and the next button will be displayed a next line of buttons. The only property supported for this button is `:insert'. (fn BUTTONS &optional MEANING-ALIST GLOBAL-FLAG) (defalias 'toolbarx-install-toolbar #[769 "\301\302\211$\203\303\300\"\266\202\304\300!\210\211\304\305!\266\306!\207" [toolbarx-internal-button-switches toolbarx-process-group nil set-default make-local-variable tool-bar-map toolbarx-refresh] 8 (#$ . 24285)]) #@692 A meaning alist with definition of the default buttons. The following buttons are available: `open-file', `dired', `save-buffer', `undo', `cut', `copy', `paste', `search-replace', `print-buffer', `spell-buffer', `info'. `new-file', `write-file', `search-forward', `customize', `help', `kill-buffer', `exit-emacs'. To reproduce the default toolbar with use as BUTTON in `toolbarx-install-toolbar': (toolbarx-install-toolbar '((open-file dired kill-buffer save-buffer write-file undo cut copy paste search-forward print-buffer customize help)) toolbarx-default-toolbar-meaning-alist) Ps.: there are more buttons available than suggested in the expression above. (defconst toolbarx-default-toolbar-meaning-alist '((separator :image "sep" :command t :enable nil :help "") (new-file :image "new" :command find-file :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Specify a new file's name, to edit the file") (open-file :image "open" :command menu-find-file-existing :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Read a file into an Emacs buffer") (dired :image "diropen" :command dired :help "Read a directory, operate on its files") (save-buffer :image "save" :command save-buffer :enable (and (buffer-modified-p) (buffer-file-name) (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))) :help "Save current buffer to its file" :visible (or buffer-file-name (not (eq 'special (get major-mode 'mode-class))))) (write-file :image "saveas" :command write-file :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) :help "Write current buffer to another file" :visible (or buffer-file-name (not (eq 'special (get major-mode 'mode-class))))) (undo :image "undo" :command undo :enable (and (not buffer-read-only) (not (eq t buffer-undo-list)) (if (eq last-command #'undo) pending-undo-list (consp buffer-undo-list))) :help "Undo last operation" :visible (not (eq 'special (get major-mode 'mode-class)))) (cut :image "cut" :help "Delete text in region and copy it to the clipboard" :command clipboard-kill-region :visible (not (eq 'special (get major-mode 'mode-class)))) (copy :image "copy" :help "Copy text in region to the clipboard" :command clipboard-kill-ring-save) (paste :image "paste" :help "Paste text from clipboard" :command clipboard-yank :visible (not (eq 'special (get major-mode 'mode-class)))) (search-forward :command nonincremental-search-forward :help "Search forward for a string" :image "search") (search-replace :image "search-replace" :command query-replace :help "Replace string interactively, ask about each occurrence") (print-buffer :image "print" :command print-buffer :help "Print current buffer with page headings") (customize :image "preferences" :command customize :help "Edit preferences (customize)") (help :image "help" :command (lambda nil (interactive) (popup-menu menu-bar-help-menu)) :help "Pop up the Help menu") (kill-buffer :command kill-this-buffer :enable (kill-this-buffer-enabled-p) :help "Discard current buffer" :image "close") (exit-emacs :image "exit" :command save-buffers-kill-emacs :help "Offer to save unsaved buffers, then exit Emacs") (spell-buffer :image "spell" :command ispell-buffer :help "Check spelling of selected buffer") (info :image "info" :command info :help "Enter Info, the documentation browser")) (#$ . 33885)) (provide 'toolbar-x)