1=Intro= 2This is API for [[CudaText]] in Python. 3 4* Module: cudatext. Constants, functions, class Editor, objects of class Editor. 5* Module: cudatext_cmd. Constants for Editor.cmd(). 6* Module: cudatext_keys. Constants for on_key. 7* Module: cudax_lib. High-level functions for plugins, e.g. read/write configs. 8* Module: cudax_nodejs. Helper functions for plugins which use Node.js. 9 10=Event plugins= 11 12To make plugin react to some program event, add method to class Command. For example, method "Command.on_save" will be called by program event "on_save" - if plugin is subscribed to that event. Event methods have param "ed_self": this is Editor object in which event occurred. This object is the same as object "ed" in most cases ("ed" always refers to focused editor), but in some cases event occurs in inactive editor, e.g. command "Save all tabs" calls event "on_save" for passive tabs. 13 14Plugin can subscribe to events in several ways: 15 16* Static subscribing in "install.inf". This is used, when plugin needs to always react to some events, with any combination of its options. 17 18* Static subscribing via config file "settings/plugins.ini". This is used when plugin doesn't need some events initially, but after changing some options, it needs more events. File "plugins.ini" section [events] can contain lines like "cuda_modulename=event1,event2,...". File "plugins.ini" is read on plugins initialization, so after writing there, CudaText should be restarted. 19 20* Run-time subscribing/unsubscribing via API. See description of action PROC_SET_EVENTS in app_proc(). 21 22Event handlers (Command.on_nnnnn methods) return-value is ignored is many cases, but sometimes return value True or False has special meaning. Usually the False return value blocks propagation of event to other plugins, so don't return False if not necessary. 23 24==Events - General== 25 26* on_open(self, ed_self): Called after file is opened from disk. 27* on_open_pre(self, ed_self, filename): Called before file opening. Method can return False to disable opening, other value is ignored. 28* on_open_none(self, ed_self): Called after file is opened, and none lexer was detected/set for it. 29* on_close_pre(self, ed_self): Called before closing tab, before checking if tab modified or not. Method can return False to disable closing. 30* on_close(self, ed_self): Called before closing tab, after modified file was saved, and editor is still active. 31* on_save(self, ed_self): Called after saving file. 32* on_save_pre(self, ed_self): Called before saving file. Method can return False to disable saving, other value is ignored. 33* on_save_naming(self, ed_self): Called before saving untitled tab, to get suggested filename without path and extension. Method must return valid filename string or None. 34* on_start(self, ed_self): Called once on program start. ed_self is None. 35* on_exit(self, ed_self): Called on exiting application. This event is lazy, ie it's called only for already loaded plugins. ed_self is None. 36* on_app_activate(self, ed_self): Called when application window gets focus. ed_self is None. 37* on_app_deactivate(self, ed_self): Called when application window looses focus. ed_self is None. 38* on_cli(self, param1, param2...): Called when application gets command-line parameter "-p=cuda_pluginname#param1#param2...". Count of params is plugin-defined, e.g. Differ plugin needs 2 params. This event is not sent to all plugins, but only to the single specified plugin. 39 40==Events - Tabs== 41 42* on_tab_change(self, ed_self): Called after active tab is changed. 43* on_tab_move(self, ed_self): Called after closing a tab (another tab is already activated), or moving a tab (by drag-n-drop, or UI command). 44 45==Events - Editor== 46 47* on_change(self, ed_self): Called after editor text is changed. 48* on_change_slow(self, ed_self): Called after editor text is changed, and few seconds (option) passed. Used in CudaLint plugin, it needs to react to change after a delay. 49* on_caret(self, ed_self): Called after editor caret position and/or selection is changed. 50* on_insert(self, ed_self, text): Called before inserting a text. Method can return False to disable insertion, other return value is ignored. 51* on_key(self, ed_self, key, state): Called when user presses a key in editor. Param "key" is int key code; values are listed in the module cudatext_keys. Param "state" is string of chars: "a" if Alt pressed, "c" if Ctrl pressed, "s" if Shift pressed, "m" if Meta (Windows-key) pressed. Method can return False to disable key processing, other return value is ignored. 52* on_key_up(self, ed_self, key, state): Called when user depresses a key in editor. Params meaning is the same as in "on_key". Currently called only for Ctrl/Shift/Alt keys (to not slow down). 53* on_focus(self, ed_self): Called after any editor gets focus. 54* on_lexer(self, ed_self): Called after editor's lexer is changed. 55* on_lexer_parsed(self, ed_self): Called after lexer has finished its parsing. To not slow down usual work, event is called only if parsing time was >=600 msec. 56* on_paste(self, ed_self, keep_caret, select_then): Called before some Clipboard Paste command runs. Parameters are options of various paste commands. Method can return False to disable default operation. 57* on_scroll(self, ed_self): Called on scrolling in editor. 58* on_mouse_stop(self, ed_self, x, y): Called when mouse cursor stops (for a short delay) over editor. Params "x", "y" are mouse editor-related coords. 59* on_hotspot(self, ed_self, entered, hotspot_index): Called when mouse cursor moves in/out of hotspot. See ed.hotspots() API. 60* on_state(self, ed_self, state): Called after some app state is changed. Param "state" is one of APPSTATE_nnnn constants. ed_self is None. 61* on_state_ed(self, ed_self, state): Called after some editor state is changed. Param "state" is one of EDSTATE_nnnn constants. 62* on_snippet(self, ed_self, snippet_id, snippet_text): Called when user chooses snippet to insert, in ed.complete_alt() call. 63 64==Events - Editor clicks== 65 66* on_click(self, ed_self, state): Called after mouse click on text area. Param "state": same meaning as in on_key. 67* on_click_dbl(self, ed_self, state): Called after mouse double-click on text area. Param "state": same meaning as in on_key. Method can return False to disable default processing. 68* on_click_gutter(self, ed_self, state, nline, nband): Called on mouse click on gutter area. Param "state": same as in on_key. Param "nline": index of editor line. Param "nband": index of gutter band. Method can return False to disable default processing. 69* on_click_gap(self, ed_self, state, nline, ntag, size_x, size_y, pos_x, pos_y): Called after mouse click on inter-line gap: see Editor.gap(). Param "state": same meaning as in on_key. Other params: properties of clicked gap. 70* on_click_link(self, ed_self, state, link): Called after link/URL in the editor is activated by click or double-click (event is not called on URL opening from Command Palette or from editor context menu). Param "state": same meaning as in on_key. Param "link": link string. Method can return False to disable default program action. 71 72==Events - Smart commands== 73 74* on_complete(self, ed_self): Called by "auto-completion menu" command (default hotkey: Ctrl+Space). Method should read editor text, find all needed data, and call Editor.complete() API to show the actual auto-completion listbox to user. True return value means that plugin handled the event, don't call other plugins. 75* on_func_hint(self, ed_self): Called by "show function-hint" command (default hotkey: Ctrl+Shift+Space). Method should return function-hint string (comma-separated parameters, brackets are optional). Empty string or None mean that no hint was found. True return value means that plugin handled the event, don't call other plugins. 76* on_goto_def(self, ed_self): Called by "go to definition" command (e.g. by mouse shortcut or by menu item in the editor context menu). Method must return True if it handled the command, otherwise None. 77* on_goto_enter(self, ed_self, text): Called after user entered text in the Go To dialog. Method can return False to disable default processing. 78 79==Events - Panels== 80 81* on_message(self, ed_self, id, text): Called on showing a text in the statusbar. Param "id" means statusbar column index, currently only value 0 is used ("text message" statusbar cell). Method can return False to disable usual showing of message. Param "ed_self" is None here. 82* on_console_nav(self, ed_self, text): Called for Console panel events. Param "ed_self" is None here. 83** Called on double-clicking lines, or calling context menu item "Navigate", in the Console's memo-field. Param "text" is line with caret. 84** Called also when Console input-field is first changed. Param "text" value is "(console_input_change)". 85* on_output_nav(self, ed_self, text, tag): Called on clicking line, or pressing Enter, in the Output or Validate panel. Param "text" is clicked line, param "tag" is int value associated with line. Event is called only if app cannot parse output line by itself using given regex, or regex is not set. Param "ed_self" is None here. 86 87==Events - Macros== 88 89* on_macro(self, ed_self, text): Called when command "start/stop macro recording" stops the recording. Param "text" is "\n"-separated list of macro items, which were run during the macro recording. 90** if item is "number" then it's simple command. 91** if item is "number,string" then it's command with str parameter (usually it's command cCommand_TextInsert). 92** if item is "py:string_module,string_method,string_param" then it's call of Python plugin (usually string_param is empty). 93 94Note: To run each on_macro item (with number) later, call ed.cmd(): number is command code, string after comma is command text. 95 96==Events priority== 97 98By default all events in all plugins have priority=0. So for any event, if 2+ plugins handle this event, they're called in the order on module names (e.g. cuda_aa, then cuda_dd, then cuda_mmm). 99 100You may want to handle some event first. 101To change priority for your plugin event, write in install.inf event like this: "on_key+", "on_key++"... with any number of "+" up to 4. Each "+" makes higher priority. So first called "on_key" with maximal number of "+", last called "on_key" without "+". 102 103==Lazy events== 104 105By default all event handlers, except on_exit, are not "lazy". On_exit is always "lazy" - it means that it's called only for already loaded plugins. To make other event handlers lazy, write in install.inf event name with "~": 106 107 events=on_focus~,on_open~,on_state~ 108 109It's allowed to combine "+" and "~" suffixes, like on_focus~++ 110 111=Callback parameter= 112 113Callback parameter is supported in several API functions: dlg_proc, timer_proc, menu_proc, button_proc etc. For all functions, "string form" of callback is supported. For most but not all functions, "callable form" is supported too. 114 115Parameter can be in these forms: 116 117* callable, ie name of a Python function, or just "lambda". Internally, callable will be converted to a weird string. Note that some functions do not support "callable form". You can detect this support by reading the code of "py/cudatext.py" module, which performs the conversions from callable to string. 118* string "module=mmm;cmd=nnn;" - to call method nnn (in class Command) in plugin mmm, where mmm is usually sub-dir in the "cudatext/py", but can be any module name. 119* string "module=mmm;cmd=nnn;info=iii;" - the same, and callback will get param "info" with your value. 120* string "mmm.nnn" - the same, to call method, short form. 121* string "module=mmm;func=nnn;" - to call function nnn in root of module mmm. 122* string "module=mmm;func=nnn;info=iii;" - the same, and callback will get param "info" with your value. 123* string "exec=command_line_params_here" - to handle the contents of callback (after prefix "exec=") as a command line passed to CudaText process. For example, here you can pass filenames of text/picture files, of .cuda-proj project files, of .cuda-session session files. 124 125For example: 126 127* If you need to call function "f" from plugin cuda_my, from file "py/cuda_my/__init__.py", callback must be "module=cuda_my;func=f;" 128* If you need to call it from file "py/cuda_my/lib/mod.py", callback must be "module=cuda_my.lib.mod;func=f;". 129 130Value after "info=" can be of any type, e.g. "info=20;" will pass int 20 to callback, "info='my';" will pass string 'my'. 131 132=Global functions= 133 134===version=== 135 136 app_exe_version() 137 138Returns version of program. String, 4 dot-separated numbers. 139 140 app_api_version() 141 142Returns version of API. String, 3 dot-separated numbers. 143 144Example of version check: 145 146<syntaxhighlight lang="python"> 147 from cudatext import * 148 if app_api_version() < '1.0.350': 149 msg_box('Plugin needs newer program version', MB_OK+MB_ICONWARNING) 150</syntaxhighlight> 151 152===app_path=== 153 154 app_path(id) 155 156Returns file-system path. Possible values of "id": 157 158* APP_DIR_EXE: Folder of program executable. 159* APP_DIR_SETTINGS: Folder "settings" (it should contain user.json file). 160* APP_DIR_SETTINGS_DEF: Folder "settings_default". 161* APP_DIR_DATA: Folder "data". 162* APP_DIR_PY: Folder "py" with Python files. 163* APP_DIR_INSTALLED_ADDON: Folder of last installed addon (for plugins it is folder in "py", for data-files it is folder in "data", for lexers it is folder "lexlib"). This dir is updated only if addon installed via file_open() or from app (Open dialog or command line). 164* APP_FILE_SESSION: Filename of current session. Default filename is "history session.json" without path. Missing path means that folder "settings" will be used. 165* APP_FILE_RECENTS: Str: "\n"-separated filenames of recent files. 166 167===app_proc=== 168 169 app_proc(id, text) 170 171Performs application-wide action. 172 173Parameter "text" is usually string, but can be of other types (bool, int, float, tuple/list of simple types). 174 175====app_proc - Getting handles==== 176 177* PROC_GET_TAB_IMAGELIST: Returns int handle of imagelist, containing icons of all UI-tabs. Use imagelist_proc() to work with it. Use PROP_TAB_ICON property to get/set file-tab icon index (index in this imagelist). 178* PROC_GET_CODETREE: Returns int handle of built-in code-tree UI control. Use tree_proc() to work with it. 179* PROC_GET_CONSOLE_FORM: Returns int handle of built-in Console form. Use dlg_proc() to work with it. 180* PROC_GET_OUTPUT_FORM: Returns int handle of built-in Output form (contains the Output read-only editor). Use dlg_proc() to work with it. 181* PROC_GET_VALIDATE_FORM: Returns int handle of built-in Validate form (contains the Validate read-only editor). Use dlg_proc() to work with it. 182* PROC_GET_MAIN_TOOLBAR: Returns int handle of main app toolbar. Use toolbar_proc() to work with it. 183* PROC_GET_MAIN_STATUSBAR: Returns int handle of main app statusbar. Use statusbar_proc() to work with it. 184 185====app_proc - Misc properties==== 186 187* PROC_GET_LANG: Returns string id of active app translation. E.g. "ru_RU" if translation file is "ru_RU.ini", or "translation template" if such file is used. Returns empty string if built-in English translation is used. 188* PROC_GET_GROUPING: Returns grouping mode in program, one of GROUPS_nnnn int constants. 189* PROC_SET_GROUPING: Sets grouping mode in program, one of GROUPS_nnnn int constants. 190* PROC_PROGRESSBAR: Changes state of the progress-bar (hidden by default), which is located on the status-bar right corner. Int value<0: progressbar hides, value in 0..100: progressbar shows with the given value. 191 192* PROC_SET_FOLDER: Sets path of folder which will be used as initial folder in program's Open/Save-as dialogs. 193* PROC_SET_PROJECT: Informs the program that some "project" (in the Project Manager) has been opened or closed. Program will fire "on_state" event with APPSTATE_PROJECT. 194 195* PROC_WINDOW_TOPMOST_GET: Returns bool flag: main window has "always on top" style. 196* PROC_WINDOW_TOPMOST_SET: Sets bool flag: main window has "always on top" style. 197 198* PROC_CONFIG_READ: Reads param "text" as contents of CudaText JSON config file. 199* PROC_CONFIG_NEWDOC_EOL_GET: Returns str: line endings of newly created documents (app option "newdoc_ends"). 200* PROC_CONFIG_NEWDOC_EOL_SET: Sets str: line endings of newly created documents. 201* PROC_CONFIG_NEWDOC_ENC_GET: Returns str: encoding of newly created documents (app option "newdoc_encoding"). 202* PROC_CONFIG_NEWDOC_ENC_SET: Sets str: encoding of newly created documents. 203 204* PROC_CONFIG_SCALE_GET: Returns UI scales, as 2-tuple (int_scale_UI, int_scale_font). Both values are in percents, defaults are 100. 205* PROC_CONFIG_SCALE_SET: Sets UI scales, value must be 2-tuple (int_scale_UI, int_scale_font). 206 207* PROC_PARSE_COMMAND_LINE: Parses/handles the text as the program command line. Separator of params is space, double-quoted params are supported. Here you may pass, for example, several filenames, including project and session filenames (.cuda-proj and .cuda-session extensions). 208 209====app_proc - Search properties==== 210 211Actions work with props of Find/Replace dialog, and props of low-level search engine. When user runs some search command in the dialog, dialog applies its props to the search engine. So most of the time, props of dialog and search engine are sync'ed. But they aren't sync'ed if user just typed new text in the dialog. They also aren't sync'ed if user runs some search command via Command Palette or hotkey (e.g. "find current word, previous"). 212 213* PROC_GET_FINDER_PROP: Returns properties of Find/Replace dialog and search engine. Returns dict with keys: 214** "find": string "what to find" of search engine 215** "rep": string "replace with" of search engine 216** "find_d": string "what to find" of dialog field, None if dialog not inited 217** "rep_d": string "replace with" of dialog field, None if dialog not inited 218** "find_h": drop-down history list of "what to find" dialog field, None if dialog not inited 219** "rep_h": drop-down history list of "replace with" dialog field, None if dialog not inited 220** "op_case": option "case sensitive" of search engine 221** "op_word": option "whole words" of search engine 222** "op_regex": option "reg.ex." of search engine 223** "op_regex_subst": option "reg.ex. substitute in 'Replace with' field" of search engine 224** "op_cfm": option "confirm on replace" of search engine 225** "op_insel": option "in selection" of search engine 226** "op_wrap": option "wrapped search" of search engine 227** "op_back": option "backward search" (low level) of search engine 228** "op_fromcaret": option "search from caret" (low level) of search engine 229** "op_tokens": option "allowed syntax elements" of search engine (int) 230** "op_case_d": option "case sensitive" of dialog, None if dialog not inited 231** "op_word_d": option "whole words" of dialog, None if dialog not inited 232** "op_regex_d": option "reg.ex." of dialog, None if dialog not inited 233** "op_regex_subst_d": option "reg.ex. substitute in 'Replace with' field" of dialog, None if dialog not inited 234** "op_cfm_d": option "confirm on replace" of dialog, None if dialog not inited 235** "op_insel_d": option "in selection" of dialog, None if dialog not inited 236** "op_wrap_d": option "wrapped search" of dialog, None if dialog not inited 237** "op_mulline_d": option "multi-line input fields" of dialog, None if dialog not inited 238** "op_tokens_d": option "allowed syntax elements" of dialog (int), None if dialog not inited 239** "op_hi_d": option "highlight all matches" of dialog, None if dialog not inited 240 241* PROC_SET_FINDER_PROP: Sets properties of Find/Replace dialog and search engine. Param "text" must be dict, with all or some keys listed in PROC_GET_FINDER_PROP. Values types: str (for text fields), bool (for flags), int (for choices). 242 243====app_proc - System==== 244 245* PROC_GET_OS_SUFFIX: Returns string of OS suffix, which is used in some CudaText option names. Possible values are listed in the default.json file. 246* PROC_ENUM_FONTS: Returns list of font names, currently installed in OS. Note: only some names are common in all OSes (like Arial, Courier, Courier New, Terminal, maybe more). 247* PROC_GET_SYSTEM_PPI: Returns int value of screen pixels-per-inch. Usual value is 96. When OS UI is scaled, it's bigger, e.g. for scale 150% it is round(96*1.5). 248* PROC_GET_GUI_HEIGHT: Returns height (pixels) of GUI element for dlg_custom(). Possible values of 'text': 'button', 'label', 'linklabel', 'combo', 'combo_ro', 'edit', 'spinedit', 'check', 'radio', 'checkbutton', 'filter_listbox', 'filter_listview'. Special value 'scrollbar' gets size of OS scrollbar. Returns None for other values. 249* PROC_GET_MOUSE_POS: Returns mouse cursor position in screen-related coordinates, as (x, y) tuple. 250* PROC_SEND_MESSAGE: For Windows. Sends message to a window by its handle. Param "text" must be 4-tuple of int (window_handle, msg_code, param1, param2). 251* PROC_GET_UNIQUE_TAG: Gets integer value, which is unique for the current CudaText process (it starts with 100, increasing with each call). Use this value for Editor.markers() and Editor.attr() tag values. 252 253====app_proc - Clipboard==== 254 255* PROC_GET_CLIP: Returns clipboard text. 256* PROC_SET_CLIP: Copies text to clipboard (usual). 257* PROC_SET_CLIP_ALT: Copies text to alternate clipboard on Linux, called "primary selection". 258** CudaText Copy commands put text to usual clipboard + primary selection. 259** CudaText Paste commands get text from usual clipboard. 260** CudaText Paste with option "mouse_mid_click_paste":true gets text from primary selection. 261 262* PROC_CLIP_ENUM: Returns string, where each char represents a format stored in Clipboard. 263** "t": Text format. 264** "h": HTML format. 265** "p": Picture format. 266 267* PROC_CLIP_SAVE_PIC: If Clipboard has a picture format, saves it to given filename (recommended the .png extension). Returns bool: clipboard has a picture, file is saved. 268 269====app_proc - Plugin calls==== 270 271* PROC_SET_EVENTS: Subscribes plugin to events. First it removes all subscribed events for specified module name (even those from install.inf file) and then adds specified events (if event list is not empty). Param "text" must be 4 values ";"-separated: "module_name;event_list;lexer_list;filter". 272** module_name is plugin's main module name, usually starting with "cuda_". 273** event_list is comma-separated event names, e.g. "on_open,on_save", or empty string. 274** lexer_list is comma-separated lexer names, e.g. "C,C++", or empty string. 275** filter is additional parameter, used by some events, if that filter is not empty: 276*** filter for "on_key": comma-separated list of int key codes to handle in event, e.g. "9,32" means that event is only called for pressed Tab and Space. 277*** filter for "on_open", "on_open_pre": comma-separated list of lower-case file extensions, without leading dot, to handle in event. 278 279* PROC_GET_LAST_PLUGIN: Returns info about last plugin which run from program. It is str "module_name,method_name", values are empty if no plugins run yet. 280 281* PROC_SET_SUBCOMMANDS: Adds command items (items which can be called from Command Palette). These items will run specified module name and method name, but with different parameters to that method. For example, plugin External Tools uses this API to add command items for configured tools. Param "text" must be ";"-separated: "module_name;method_name;param_list". 282** "param_list" is "\n"-separated items, each item is param_caption+"\t"+param_value. 283** "param_caption" is caption for Command Palette. 284** "param_value" is parameter for Python method. It can be any primitive type: int, string, bool, None, or even some expression. 285 286* PROC_GET_COMMANDS: Returns list of all commands, as list of dict. Dict keys are: 287** "type": str: Possible values: 288*** "cmd": usual built-in command 289*** "lexer": command to activate lexer 290*** "plugin": plugin command 291*** "openedfile": command to switch active tab 292*** "recentfile": command to reopen recent file 293** "cmd": int: Command code, to use in ed.cmd() call. 294** "name": str: Pretty name, which is visible in the Commands dialog. 295** "key1": str: Hotkey-1. 296** "key2": str: Hotkey-2. 297** "key1_init": str: Hotkey-1 from built-in config. 298** "key2_init": str: Hotkey-2 from built-in config. 299** (for plugins) "p_caption": str: Menu-item caption from install.inf. 300** (for plugins) "p_module": str: Python module. 301** (for plugins) "p_method": str: Python method in Command class. 302** (for plugins) "p_method_params": str: Optional params for Python method. 303** (for plugins) "p_lexers": str: Comma-separated lexers list. 304** (for plugins) "p_from_api": bool: Shows that command was generated from API by some plugin. 305** (for plugins) "p_in_menu": str: Value of parameter "menu" from install.inf. 306 307====app_proc - Hotkeys==== 308 309* PROC_GET_ESCAPE: Returns Esc-key flag (bool). This flag is set when user presses Esc key, each Esc press is counted since app start. Note: to allow app to handle key press in long loop, call msg_status('text', True). 310* PROC_SET_ESCAPE: Sets Esc-key flag. Param "text" must be bool (or "0"/"1"). 311* PROC_GET_HOTKEY: Returns hotkeys strings for given command_id. Examples of result: "F1", "Ctrl+B * B", "Ctrl+B * B * C|Ctrl+B * D" (two hotkeys for one command). Returns empty str for unknown command_id. 312* PROC_SET_HOTKEY: Sets hotkeys for given command_id from strings. Text must be "command_id|hotkey1|hotkey2", where hotkey1/hotkey2 examples: "F1", "Ctrl+B * B", "Ctrl+B * B * C". Symbol "*" can be without near spaces. Returns bool: command_id exists, changed. 313* PROC_GET_KEYSTATE: Returns state of pressed keyboard keys and mouse buttons. String result has chars: 314** "c" for Ctrl 315** "a" for Alt 316** "s" for Shift 317** "m" for Meta (Windows key) 318** "L" for left mouse button 319** "R" for right mouse button 320** "M" for middle mouse button 321** "4" for the 4th mouse button 322** "5" for the 5th mouse button 323* PROC_HOTKEY_STR_TO_INT: Converts given string hotkey to int. Returns 0 for incorrect string. Example: converts "alt+shift+z" to 41050. 324* PROC_HOTKEY_INT_TO_STR: Converts given int hotkey to string. Returns empty str for unknown code. Example: converts 41050 to "Shift+Alt+Z". 325 326Notes: 327 328* Value of command_id can be: str(int_command_code) or "module,method" or "module,method,param". 329 330====app_proc - Python==== 331* PROC_EXEC_PYTHON: Runs Python string in the context of Console. It is not the same as standard exec() call, it uses the same globals/locals as CudaText Console. 332* PROC_EXEC_PLUGIN: Runs Python plugin's method. Text must be comma-separated: "module_name,method_name,params", where "params" is optional part, it is parameter(s) for the method. 333 334====app_proc - Themes==== 335 336Notes: 337* Theme names are short strings, lowercase, e.g. "cobalt", "sub". Empty string means built-in theme. 338* Setting default theme (empty str) resets both UI + syntax themes. 339* To enumerate themes, you need to list themes folder. 340 341Actions: 342 343* PROC_THEME_UI_GET: Returns name of UI-theme. 344* PROC_THEME_UI_SET: Sets name of UI-theme. 345* PROC_THEME_SYNTAX_GET: Returns name of syntax-theme. 346* PROC_THEME_SYNTAX_SET: Sets name of syntax-theme. 347 348* PROC_THEME_UI_DICT_GET: Returns contents of current UI-theme, as dict. 349* PROC_THEME_SYNTAX_DICT_GET: Returns contents of current syntax-theme, as dict. For description of keys of result, see LEXER_GET_STYLES. 350 351====app_proc - Sessions==== 352 353Session is a set of opened files + untitled tabs, with some properties of editors in these tabs, with group-indexes of tabs, with layout of groups. Session format is JSON. 354 355* PROC_SAVE_SESSION: Saves session to file with given name. Returns bool: session was saved. 356* PROC_LOAD_SESSION: Loads session from file with given name (closes all tabs first). Returns bool: tabs closed w/o pressing Cancel, session was loaded. 357* PROC_SET_SESSION: Tells to app filename of session. Session with this filename will be saved on exit, loaded on start, shown in app title in {} brackets. Don't set here empty string. Default filename is "history session.json" without path. Missing path means that folder "settings" will be used. 358 359====app_proc - Sidebar panels==== 360 361General notes: 362 363* Word "tab" here means: sidebar button with attached embedded dialog, which looks like a tab. 364* Caption of "tab" must not contain ",". Name of icon file - too. Tooltip string - too. 365* Actions find "tabs" by caption, caption is some latin text, which is not affected by CudaText translation. E.g. caption "Code tree" always refers to Code-Tree tab, with any active translation. 366* Name of icon file: path of PNG/BMP file. Icon size/dimensions should be equal to the size of current sidebar imagelist. Default is 20x20. You can detect size of this imagelist, by using PROC_SIDEBAR_GET_IMAGELIST and passing returned handle to imagelist_proc(). If filename is without path, CudaText subfolder "data/sideicons" is used. 367 368Actions: 369 370* PROC_SIDEPANEL_ADD_DIALOG: Adds tab, with embedded dialog. Returns bool: all parameters are correct, tab was added. Param "text" must be 3-tuple: 371** Item 0: Caption of tab. 372** Item 1: Int handle of dialog, from dlg_proc(). 373** Item 2: Name of icon file. 374 375* PROC_SIDEPANEL_REMOVE: Removes tab. Param "text" is caption of tab. (Note: actually it hides tab, dialog for this tab is still in memory). Returns bool: tab was found/removed. 376* PROC_SIDEPANEL_ACTIVATE: Activates tab. Returns bool: tab was found/activated. Param "text" can be string or tuple: 377** str: caption. 378** 2-tuple (caption, bool_set_focus). Default for bool_set_focus is False. 379 380* (deprecated) PROC_SIDEPANEL_ENUM: Enumerates tabs. Returns str, "\n"-separated captions of tabs. 381 382* PROC_SIDEPANEL_ENUM_ALL: Enumerates tabs. Returns list of dict, each dict item has keys: 383** "cap": str: Panel caption (not affected by translation) 384** "hint": str: Button's floating tooltip (affected by translation). 385** "dlg": int: Handle of panel's dialog. Can be 0, if dialog is not yet created. For example, plugins "Tabs List" and "Snippet Panel" do not create the dialog until plugin is called. 386** "img": int: Button's image-index in the imagelist. 387** "btn_h": int: Button's handle. Use this handle with button_proc(). 388** "module": str: Python module name, or empty str. 389** "method": str: Python method name, or empty str. 390 391* PROC_SIDEPANEL_GET_CONTROL: Returns int handle of dialog, inserted into tab. Param "text" is caption of tab. Returns None if cannot find tab. 392* PROC_SIDEPANEL_GET: Returns caption of last activated tab. 393 394* PROC_SIDEPANEL_SET_PROP: Changes properties of sidebar button. Returns bool: button was found/changed. Param "text" must be 3-tuple: 395** Item 0: Caption of tab. 396** Item 1: Int index of button's icon in sidebar's imagelist, or -1 to keep old value. 397** Item 2: Floating tooltip string (it's independent from caption), or empty str to keep old value. 398 399* PROC_SIDEPANEL_GET_IMAGELIST: Returns int handle of sidebar's imagelist. Use this handle with imagelist_proc(). 400 401====app_proc - Bottom-bar panels==== 402 403* PROC_BOTTOMPANEL_ADD_DIALOG: Adds tab. Same as for PROC_SIDEPANEL_ADD_DIALOG. 404* PROC_BOTTOMPANEL_REMOVE: Removes tab. Same as for PROC_SIDEPANEL_REMOVE. 405* PROC_BOTTOMPANEL_ACTIVATE: Activates tab. Same as for PROC_SIDEPANEL_ACTIVATE. 406* (deprecated) PROC_BOTTOMPANEL_ENUM: Enumerates tabs. Same as for PROC_SIDEPANEL_ENUM. 407* PROC_BOTTOMPANEL_ENUM_ELL: Enumerates tabs. Same as for PROC_SIDEPANEL_ENUM_ALL. 408* PROC_BOTTOMPANEL_GET_CONTROL: Returns int handle of control. Same as for PROC_SIDEPANEL_GET_CONTROL. 409* PROC_BOTTOMPANEL_GET: Returns caption of last activated tab. Same as for PROC_SIDEPANEL_GET. 410* PROC_BOTTOMPANEL_SET_PROP: Sets sidebar's button properties. Same as for PROC_SIDEPANEL_SET_PROP. 411 412====app_proc - Splitters==== 413 414Splitter id: 415 416* SPLITTER_SIDE: splitter near side panel. 417* SPLITTER_BOTTOM: splitter above bottom panel. 418* SPLITTER_G1 .. SPLITTER_G5: splitters between groups. 419 420Actions: 421 422* PROC_SPLITTER_GET: Returns info about splitter, as 4-tuple: (bool_vertical, bool_visible, int_pos, int_parent_panel_size). Param "text" is int splitter id. 423* PROC_SPLITTER_SET: Sets splitter pos. Param "text" is 2-tuple (int_splitter_id, int_splitter_pos). 424 425Positions of group splitters (G1, G2, G3, G4, G5) are determined by grouping view, in one view splitter may be horizontal with one parent panel, in other view - vertical with another parent panel. Detailed: 426 427<pre> 4282VERT t G1 t 429 4302HORZ t 431 G1 432 t 433 4343VERT t G1 t G2 t 435 4363HORZ t 437 G1 438 t 439 G2 440 t 441 4421P2VERT t G3 t 443 G2 444 t 445 4461P2HORZ t 447 G3 448 t G2 t 449 4504VERT t G1 t G2 t G3 t 451 4524HORZ t 453 G1 454 t 455 G2 456 t 457 G3 458 t 459 4604GRID t G1 t 461 G3 462 t G2 t 463 4646VERT t G1 t G2 t G3 t G4 t G5 t 465 4666HORZ t 467 G1 468 t 469 G2 470 t 471 G3 472 t 473 G4 474 t 475 G5 476 t 477 4786GRID t G1 t G2 t 479 G3 480 t G1 t G2 t 481</pre> 482 483====app_proc - Show/Hide/Undock UI elements==== 484 485Actions get/set state of UI elements, "value" must be False/True: 486 487* PROC_SHOW_STATUSBAR_GET: for main statusbar (on the bottom). 488* PROC_SHOW_STATUSBAR_SET 489* PROC_SHOW_TOOLBAR_GET: for horizontal toolbar (on the top). 490* PROC_SHOW_TOOLBAR_SET 491* PROC_SHOW_SIDEBAR_GET: for vertical sidebar. 492* PROC_SHOW_SIDEBAR_SET 493* PROC_SHOW_SIDEPANEL_GET: for panels near the sidebar (Code-Tree, Project Manager etc). 494* PROC_SHOW_SIDEPANEL_SET 495* PROC_SHOW_BOTTOMPANEL_GET: for panels near the statusbar (Console, Output etc.) 496* PROC_SHOW_BOTTOMPANEL_SET 497* PROC_SHOW_TABS_GET: for UI-tabs bar (can be placed at all 4 sides). 498* PROC_SHOW_TABS_SET 499* PROC_SHOW_TREEFILTER_GET: for Code-Tree "filter" input field. 500* PROC_SHOW_TREEFILTER_SET 501* PROC_SHOW_FLOATGROUP1_GET: for "floating group 1", which is activated by moving some UI-tabs there, from UI-tab context menu. 502* PROC_SHOW_FLOATGROUP1_SET 503* PROC_SHOW_FLOATGROUP2_GET: for "floating group 2". 504* PROC_SHOW_FLOATGROUP2_SET 505* PROC_SHOW_FLOATGROUP3_GET: for "floating group 3". 506* PROC_SHOW_FLOATGROUP3_SET 507 508* PROC_FLOAT_SIDE_GET: "floating" property of side panels. 509* PROC_FLOAT_SIDE_SET 510* PROC_FLOAT_BOTTOM_GET: "floating" property of bottom panels. 511* PROC_FLOAT_BOTTOM_SET 512 513====app_proc - Screen coordinates==== 514 515Notes: 516 517* When getting or setting coords, you get/set 4-tuple of int: (left, top, right, bottom). 518 519Actions: 520 521* PROC_COORD_WINDOW_GET: Returns coords of app window. 522* PROC_COORD_WINDOW_SET: Sets coords of app window. 523* PROC_COORD_DESKTOP: Returns coords of virtual desktop, which includes all monitors. 524* PROC_COORD_MONITOR: Returns coords of monitor with app window. 525* PROC_COORD_MONITOR0: Returns coords of 1st monitor. 526* PROC_COORD_MONITOR1: Returns coords of 2nd monitor, or None if no such monitor. 527* PROC_COORD_MONITOR2: Returns coords of 3rd monitor, or None if no such monitor. 528* PROC_COORD_MONITOR3: Returns coords of 4th monitor, or None if no such monitor. 529 530===app_log=== 531 532 app_log(id, text, tag=0, panel="") 533 534Performs action with standard panels in the bottom panel: Output, Validate, Console. 535 536Possible values of "panel": 537 538* value LOG_PANEL_OUTPUT: Output panel 539* value LOG_PANEL_VALIDATE: Validate panel 540 541Possible values of "id" for Output/Validate panels: 542 543* LOG_CLEAR: Clears log panel. Param "text" is ignored. 544* LOG_ADD: Adds line to log panel. 545* LOG_SET_REGEX: Sets parsing RegEx for log panel. Param "text" is RegEx string. RegEx must have some groups in round brackets, indexes of these groups must be passed in separate API calls. All lines in log panel, which can be parsed by this regex, will allow navigation to source code by click or double-click. 546* LOG_SET_LINE_ID: Sets index of regex group for line-number. Param "text" is one-char string from "1" to "8", and "0" means "not used". 547* LOG_SET_COL_ID: Sets index of regex group for column-number. Param "text" must be str(number). 548* LOG_SET_NAME_ID: Sets index of regex group for file-name. Param "text" must be str(number). 549* LOG_SET_FILENAME: Sets default file name, which will be used when regex cannot find file name in a string. Param "text" is value. 550* LOG_SET_ZEROBASE: Sets flag: line and column numbers are 0-based, not 1-based. Param "text" must be one-char string "0" or "1". 551* LOG_GET_LINES_LIST: Returns items in panel's listbox, as list of 2-tuples (line, 0). 552* LOG_GET_LINEINDEX: Returns index of selected line in panel's listbox. 553* LOG_SET_LINEINDEX: Sets index of selected line in panel's listbox. Param "text" must be str(number). 554 555Possible values of "id" for "Console" panel: 556 557* LOG_CONSOLE_CLEAR: Clears UI controls in console. 558** If text empty or has "m" then memo-control (above) is cleared. 559** If text empty or has "e" then edit-control (below) is cleared. 560** If text empty or has "h" then combobox history list is cleared. 561* LOG_CONSOLE_ADD: Adds line to console (its combobox and memo). 562* LOG_CONSOLE_GET_COMBO_LINES: Returns list of lines in combobox-control. 563* LOG_CONSOLE_GET_MEMO_LINES: Returns list of lines in memo-control. 564 565Parameter "tag" is deprecated and is not used. 566 567====Example==== 568 569For line "line 10 column 20: text message here" the following regex and indexes can be used: 570 571* regex "\w+ (\d+) \w+ (\d+): .+" 572* line-number index "1" 573* column-number index "2" 574* file-name index "0" (not used) 575* zero-base flag "0" (off) 576 577===app_idle=== 578 579 app_idle(wait=False) 580 581Performs application's message-processing. If wait=True, also waits for new UI event. 582 583===emmet=== 584 585 emmet(id, text, p1="", p2="") 586 587Performs action with embedded Emmet engine. Possible values of "id": 588 589* EMMET_EXPAND: Expand abbreviation. Returns 2-tuple (str_result, bool_multi_caret) or None. 590** Param "text": Emmet abbreviation. 591** Param "p1": Emmet syntax. Possible values: "html", "xml", "xsl", "css", "svg", "sass", "less". 592 593* EMMET_WRAP: Wrap text with abbreviation. Returns str result or None. 594** Param "text": Emmet abbreviation. 595** Param "p1": Emmet syntax. 596** Param "p2": Text to wrap. Can be multi-line with LF line breaks. 597 598* EMMET_GET_POS: Find beginning of abbreviation in given string. Returns offset in string (0-based), or None. 599** Param "text": Text string (can include unneeded text after caret position, can include HTML tags before abbreviation). 600** Param "p1": Caret offset (0-based) to search abbreviation to the left of it. 601 602===msg_box=== 603 604 msg_box(text, flags) 605 606Shows modal message-box. 607 608Param "text" is message text. Multi-line text with "\n" is supported. 609 610Param "flags" is sum of button-value (OK, OK/Cancel, Yes/No etc): 611* MB_OK 612* MB_OKCANCEL 613* MB_ABORTRETRYIGNORE 614* MB_YESNOCANCEL 615* MB_YESNO 616* MB_RETRYCANCEL 617 618and icon-value: 619* MB_ICONERROR 620* MB_ICONQUESTION 621* MB_ICONWARNING 622* MB_ICONINFO 623 624Returns int code of pressed button (returns ID_CANCEL if dialog cancelled): 625 626* ID_OK 627* ID_CANCEL 628* ID_ABORT 629* ID_RETRY 630* ID_IGNORE 631* ID_YES 632* ID_NO 633 634===msg_box_ex=== 635 636 msg_box_ex(caption, text, buttons, icon, focused=0) 637 638Shows modal message-box with any number of buttons with any captions. 639 640* Param "caption": str: Caption of dialog. 641* Param "text": str: Message text. Multi-line text with "\n" is supported. 642* Param "buttons": list of str: Non-empty list of button captions. Multi-line captions are not supported on Windows. 643* Param "icon": int: Icon in dialog, one of constants: 644** MB_ICONERROR 645** MB_ICONQUESTION 646** MB_ICONWARNING 647** MB_ICONINFO 648* Param "focused": int: Index of focused button. 649 650Returns int index of pressed button (0-based), or None of cancelled. 651 652===msg_status=== 653 654 msg_status(text, process_messages=False) 655 656Shows given text in statusbar. 657 658Param "process_messages": if True, function also does UI messages processing. It takes some time, it is needed to refresh status of Esc-key pressed. After call msg_status(..., True) you can get state of Esc-key pressed via PROC_GET_ESCAPE, otherwise plugin gets an old state, until UI messages are processed. 659 660===msg_status_alt=== 661 662 msg_status_alt(text, pause, pos=HINTPOS_CARET, x=0, y=0) 663 664Shows given text in the floating tooptip. 665 666* Param "text": Text of tooltip. Multi-line text, with "\n", is supported. 667* Param "pause": Show duration in seconds, 1..30. Value<=0 hides the tooltip, if it's already shown. 668* Param "pos": Possible values are: 669** HINTPOS_CARET: Show near the first caret. 670** HINTPOS_CARET_BRACKET: Like HINTPOS_CARET, but moves to the nearest opening bracket. 671** HINTPOS_TEXT: Show near custom text position specified by params "x" and "y" (0-based). 672** HINTPOS_TEXT_BRACKET: Like HINTPOS_TEXT, but moves to the nearest opening bracket. 673** HINTPOS_WINDOW_TOP: Show near the window top. 674** HINTPOS_WINDOW_BOTTOM: Show near the window bottom. 675 676===dlg_input=== 677 678 dlg_input(prompt, text) 679 680Shows modal dialog to input one string. Returns entered string or None if cancelled. 681 682* Param "prompt": Description text above the input field. It can be multi-line ("\n"-separated) and can have long line(s). 683* Param "text": Initial value of the input field. 684 685===dlg_input_ex=== 686 687 dlg_input_ex(number, caption, 688 prompt1 , text1="", prompt2="", text2="", prompt3="", text3="", 689 prompt4="", text4="", prompt5="", text5="", prompt6="", text6="", 690 prompt7="", text7="", prompt8="", text8="", prompt9="", text9="", 691 prompt10="", text10="") 692 693Shows modal dialog to enter 1 to 10 string fields at once. Returns list of strings or None if cancelled. 694 695* Param "number": Count of input fields. 696* Params "prompt*": Descriptions near input fields. They cannot be multi-line. 697* Params "text*": Initial values of input fields. 698 699===dlg_file=== 700 701 dlg_file(is_open, init_filename, init_dir, filters, caption="") 702 703Shows "Open file" or "Save file as" modal dialog. Returns filename (or list of filenames) or None if cancelled. 704 705* Param "is_open": True for "Open" dialog, False for "Save as" dialog. 706* Param "init_filename": Initial filename for "Save as" dialog. Can be empty. 707* Param "init_dir": Initial folder. Can be empty. 708* Param "filters": How to filter filenames from file system. Can be empty. Must be in format used by Lazarus IDE, example for 2 filters: "Source codes|*.pas;*.inc|Text files|*.txt" 709* Param "caption": If not empty, dialog caption. If empty, default dialog caption is used: "Open file", "Save file". 710 711Additional options: 712 713* To allow multi-selection in the "Open" dialog, pass init_filename="*". If single filename was selected, result is str. If several filenames were selected, result is list of str. 714* To disable checking "entered filename exists" in the "Open" dialog, start init_filename with "!". 715 716===dlg_dir=== 717 718 dlg_dir(init_dir, caption="Select folder") 719 720Shows dialog to select folder path. Returns path (str), or None if cancelled. 721 722* Param "init_dir": Initial folder. 723* Param "caption": Dialog caption. 724 725===dlg_menu=== 726 727 dlg_menu(id, items, focused=0, caption="", clip=0, w=0, h=0) 728 729Shows menu-like dialog. Returns index of selected item (0-based), or None if cancelled. 730 731Possible values of "id": 732 733* DMENU_LIST: Dialog with listbox and filter. 734* DMENU_LIST_ALT: Dialog with listbox and filter, but each item has double height, and instead of right-aligning, 2nd part of an item shows below. 735 736Additional flags to '''add''' to above "id" values: 737 738* DMENU_NO_FUZZY: Disable fuzzy search in the items list. 739* DMENU_NO_FULLFILTER: Disable filtering by second part of items (after "\t"), filter only by first part. 740* DMENU_CENTERED: Show menu centered on screen (otherwise it's aligned to current editor). 741* DMENU_EDITORFONT: Use editor's font (monospaced) for list items, instead of variable-width UI font. 742 743Parameters: 744 745* Param "items": Menu items, can be list of str, tuple of str, or string with "\n"-separated parts. Each item can be simple string or part1+"\t"+part2, where part2 shows right-aligned or below. 746* Param "focused": Index of initially selected item. 747* Param "caption": If not empty string, it is dialog caption. 748* Param "clip": How to shorten too long lines, one of values: CLIP_NONE (default), CLIP_LEFT, CLIP_MIDDLE, CLIP_RIGHT. 749* Param "w": If value>0, width of dialog. 750* Param "h": If value>0, height of dialog. 751 752===dlg_color=== 753 754 dlg_color(value) 755 756Shows select-color dialog with given initial color (int). 757 758Returns int color, or None if cancelled. 759 760===dlg_hotkey=== 761 762 dlg_hotkey(title="") 763 764Shows dialog to press single hotkey. 765 766Returns str of hotkey (e.g. "F1", "Ctrl+Alt+B") or None if cancelled. 767 768===dlg_hotkeys=== 769 770 dlg_hotkeys(command, lexer="") 771 772Shows dialog to configure hotkeys of internal command or plugin. Returns bool: OK pressed and hotkeys saved (to keys.json). 773 774Param "command" can be: 775 776* str(int_command): for internal command codes (module cudatext_cmd). 777* "module_name,method_name" or "module_name,method_name,method_param": for command plugin. 778 779Param "lexer" is optional lexer name. If not empty, dialog enables checkbox "For current lexer" and, if checkbox checked, saves hotkey to lexer-specific config "keys lexer NNNN.json". 780 781===dlg_custom=== 782 783 dlg_custom(title, size_x, size_y, text, focused=-1, get_dict=False) 784 785Shows dialog with controls of many types. This is legacy API, it is recommended to use "dlg_proc" instead. 786 787====dlg_custom - Types of controls==== 788 789* "button": simple button 790* "label": simple read-only text 791* "check": checkbox, checked/unchecked/grayed 792* "radio": radio-button, only one of radio-buttons can be checked 793* "edit": single-line input 794* "edit_pwd": single-line input for password, text is masked 795* "combo": combobox, editable + drop-down, value is text 796* "combo_ro": combobox, drop-down only, value is index of drop-down 797* "listbox": list of items with one item selected 798* "checkbutton": looks like button, but don't close dialog, checked/unchecked 799* "memo": multi-line input 800* "checkgroup": group of check-boxes 801* "radiogroup": group of radio-buttons 802* "checklistbox": listbox with checkboxes 803* "spinedit": input for numbers, has min-value, max-value, increment 804* "listview": list with columns, with column headers, value is index 805* "checklistview": listview with checkboxes, value is check-flags 806* "linklabel": label which activates URL on click 807* "panel": rectangle with centered caption only (client area is entire rect) 808* "group": rectangle with OS-themed border and caption on border (client area is decreased by this border) 809* "colorpanel": panel, with N-pixels colored border, with colored background 810* "image": picture, which shows picture-file 811* "trackbar": horiz/vert bar with handler, has position 812* "progressbar": horiz/vert bar, only shows position 813* "progressbar_ex": like progressbar, with new styles 814* "filter_listbox": input, which filters content of another "listbox" control 815* "filter_listview": input, which filter content of another "listview" control 816* "bevel": control which shows only border (at one side, or all 4 sides), w/o value/caption 817* "tabs": TabControl: set of tabs, w/o pages attached to them 818* "pages": PageControl: set of tabs, with pages attached to them (only one of pages is visible) 819* "splitter": divider bar (vertical or horizontal), which can be dragged by mouse, to change width/height of nearest control. It finds linked control, ie control with the same "parent" and "align", which position (coordinates) are nearest to the splitter. On mouse drag, splitter resizes this linked control. It's recommended to place another control with "align": ALIGN_CLIENT, so splitter will resize two controls at once. A panel may contain several splitters (mixed with other controls between them). 820* "scrollbox": like panel, but has two auto-shown scrollbars to scroll the area containing children controls (ie controls which parent is this scrollbox) 821 822Details: 823 824* Control "button_ex": to change advanced props, you must get handle via DLG_CTL_HANDLE, and pass it to button_proc(). 825* Control "treeview" don't have "items"/"value": to work with it, you must get handle of control via DLG_CTL_HANDLE, and pass it to tree_proc(). 826* Control "listbox_ex" don't have "items"/"value": to work with it, you must get handle of control via DLG_CTL_HANDLE, and pass it to listbox_proc(). 827* Control "toolbar" don't have "items"/"value": to work with it, you must get handle via DLG_CTL_HANDLE, and pass it to toolbar_proc(). 828* Control "statusbar" don't have "items"/"value": to work with it, you must get handle via DLG_CTL_HANDLE, and pass it to statusbar_proc(). 829* Controls "editor"/"editor_edit"/"editor_combo" don't have "items"/"value": to work with it, you must get handle via DLG_CTL_HANDLE, and pass it to Editor() to make editor object. 830* Control "paintbox" is empty area, plugin can paint on it. Get canvas_id via DLG_CTL_HANDLE, and use it in canvas_proc(). 831* Control property "name" is required for "filter_nnnnn" controls: must set name of listbox/listview, and name of its filter - to the same name with prefix "f_" (e.g. listbox name "mylist" with filter name "f_mylist"). 832 833====dlg_custom - Properties of controls==== 834 835Parameter "text" in "dlg_custom" is "\n"-separated items, one item per control. 836Each item is chr(1)-separated properties in the form "name=value". 837Possible properties: 838 839* "type": type of control; must be specified first 840* "cap": caption 841* "act": active state, bool. For many controls (edit, check, radio, combo_ro, checkbutton, listbox'es, listview's, tabs), it means that control's value change fires events (for dlg_proc) or closes form (for dlg_custom). 842* "x", "y": position, left/top 843* "w", "h": size, width/height 844* "w_min", "w_max": Constraints for width, min/max value. 845* "h_min", "h_max": Constraints for height, min/max value. 846* "pos": position, str in the form "left,top,right,bottom". Some one-line controls ignore bottom and do auto size. If specified "x/y/w/h" together with "pos", then last mentioned prop has effect. 847* "en": enabled state, bool 848* "vis": visible state, bool 849* "hint": hint string for mouse-over. Can be multiline, "\r"-separated. 850* "texthint": text, shown with italic+pale font when value of control is empty. For "edit", "memo", "editor", "editor_edit", "editor_combo". Cannot be multi-line. 851* "color": background color 852* "autosize": control is auto-sized (by width and/or height, it's control-specific) 853* "font_name": font name 854* "font_size": font size 855* "font_color": font color 856* "font_style": font styles. String, each char can be: "b": bold, "i": italic, "u": underline, "s": strikeout. 857* "name": optional name of control. It may be not unique for all controls. 858* "ex0"..."ex9": advanced control-specific props. Described below. 859* "val": value of control. Described below. 860* "items": list of items. Described below. 861 862====dlg_custom - Property "items"==== 863 864Possible values of "items" in "dlg_custom": 865 866* For "combo", "combo_ro", "listbox", "checkgroup", "radiogroup", "checklistbox", "tabs": "\t"-separated lines 867* For "listview", "checklistview": "\t"-separated items. 868** first item is column headers: title1+"="+size1 + "\r" + title2+"="+size2 + "\r" +... 869** size1...sizeN can be with lead char to specify alignment of column: L (default), R, C 870** other items are data: cell1+"\r"+cell2+"\r"+... (count of cells may be less than count of columns) 871* For "image": full path of picture file (png/gif/jpg/bmp) 872 873Action DLG_CTL_PROP_GET also returns key "items" (in the same format) for these controls: "listbox", "checklistbox", "listview", "checklistview". 874 875====dlg_custom - Property "columns"==== 876 877* For "listview", "checklistview": "\t"-separated items, each item is "\r"-separated props of a column: 878** caption (must be without "\t", "\r", "\n") 879** width, as str 880** (optional) minimal width, as str. 0 means "not used". Not supported on Windows. 881** (optional) maximal width, as str. 0 means "not used". Not supported on Windows. 882** (optional) alignment - one of "L", "R", "C" 883** (optional) autosize - "0", "1" 884** (optional) visible - "0", "1" 885 886* For "radiogroup", it is number of vertical columns of radiobuttons. 887 888Action DLG_CTL_PROP_GET also returns key "columns" in the same format. 889 890Action DLG_CTL_PROP_SET, for "listview", allows both "items" (it sets columns) and "columns", and "columns" is applied last. 891 892====dlg_custom - Property "val"==== 893 894* For "combo", "combo_ro", "listbox": value is 0-based index of selected item, or -1 if none is selected. 895* For "check": value is checked state "0"/"1" or "?" for "grayed" state. 896* For "radio", "checkbutton": value is checked state "0"/"1". 897* For "edit", "edit_pwd", "spinedit", "combo", "filter_*": value is text in control. 898* For "memo": value is "\t"-separated lines, in lines "\t" chars must be replaced with chr(3). 899* For "combo_ro", "listbox", "radiogroup", "listview": value is index (0-based) of selected item. 900* For "checkgroup": value is ","-separated checked states "0"/"1". 901* For "checklistbox", "checklistview": value is str(index) + ";" + checked_states. 902* For "tabs", "pages": value is index of active tab. 903* For "trackbar", "progressbar": value is position, int value. 904* For "scrollbox": 905** on reading: value is 6 numbers ","-separated: vert_position, horz_position, vert_range, horz_range, vert_pagesize, horz_pagesize 906** on writing: value is only 2 numbers ","-separated: vert_position, horz_position. 907 908====dlg_custom - Properties "ex"==== 909 910Properties "ex0"..."ex9" are control-specific. They have different simple type (str, bool, int...). 911 912* "button": 913** "ex0": bool: default for Enter key 914* "edit", "memo": 915** "ex0": bool: read-only 916** "ex1": bool: font is monospaced 917** "ex2": bool: show border 918* "spinedit": 919** "ex0": int: min value 920** "ex1": int: max value 921** "ex2": int: increment 922* "label": 923** "ex0": bool: right aligned 924* "linklabel": 925** "ex0": str: URL. Should not have ",". Clicking on http:/mailto: URLs should work, result of clicking on other kinds depends on OS. 926* "listview": 927** "ex0": bool: show grid lines 928* "radiogroup": 929** "ex0": int: 0: arrange items horizontally then vertically (default); 1: opposite 930* "tabs", "pages": 931** "ex0": int: 0: tab position on top, 1: on bottom, 2: on left, 3: on right 932* "colorpanel": 933** "ex0": int: border width (from 0) 934** "ex1": int: color of fill 935** "ex2": int: color of font 936** "ex3": int: color of border 937* "filter_listview": 938** "ex0": bool: filter works for all columns 939* "image": 940** "ex0": bool: center picture 941** "ex1": bool: stretch picture 942** "ex2": bool: allow stretch in 943** "ex3": bool: allow stretch out 944** "ex4": bool: keep origin x, when big picture clipped 945** "ex5": bool: keep origin y, when big picture clipped 946* "trackbar": 947** "ex0": int: orientation (0: horz, 1: vert) 948** "ex1": int: min value 949** "ex2": int: max value 950** "ex3": int: line size 951** "ex4": int: page size 952** "ex5": bool: reversed 953** "ex6": int: tick marks position (0: bottom-right, 1: top-left, 2: both) 954** "ex7": int: tick style (0: none, 1: auto, 2: manual) 955* "progressbar": 956** "ex0": int: orientation (0: horz, 1: vert, 2: right-to-left, 3: top-down) 957** "ex1": int: min value 958** "ex2": int: max value 959** "ex3": bool: smooth bar 960** "ex4": int: step 961** "ex5": int: style (0: normal, 1: marquee) 962** "ex6": bool: show text (only for some OSes) 963* "progressbar_ex": 964** "ex0": int: style (0: text only, 1: horz bar, 2: vert bar, 3: pie, 4: needle, 5: half-pie) 965** "ex1": int: min value 966** "ex2": int: max value 967** "ex3": bool: show text 968** "ex4": int: color of background 969** "ex5": int: color of foreground 970** "ex6": int: color of border 971* "bevel": 972** "ex0": int: shape (0: sunken panel, 1: 4 separate lines - use it as border for group of controls, 2: top line, 3: bottom line, 4: left line, 5: right line, 6: no lines, empty space) 973* "splitter": 974** "ex0": bool: paint border 975** "ex1": bool: on mouse drag, use instant repainting (else splitter paints after mouse released) 976** "ex2": bool: auto jump to edge, when size of linked control becomes < min size 977** "ex3": int: minimal size of linked control (controlled by splitter) 978 979====dlg_custom - Return value==== 980 981Dialog is closed by clicking any button or by changing of any control which has "act=1". 982 983* If cancelled, returns None 984* If get_dict=True, returns dict: {0: str_value_0, 1: str_value_1, ..., 'clicked': N, 'focused': N} 985* If get_dict=False, returns 2-tuple: (clicked_index, state_text) 986** "clicked_index": index of control which closed dialog (0-based). 987** "state_text": "\n"-separated values of controls. Same count of items as in text, plus optional additional lines in the form "key=value". Line "focused=N" with index of last focused control (0-based) or -1. 988 989====dlg_custom - Notes==== 990 991* Property "type" must be first. 992* Property "act" must be set after "val". 993 994* Controls sizes differ on Win/Linux/OSX, picture shows controls (Linux/Win) auto-aligned, not in CudaText, only example app: 995 996[[File:controls_autosizes.png]] 997 998* So it's good to use common height for single-line controls, 30 pixels is ok for edit/button/check/radio, 36 for combobox. 999* Control "tabs" height cannot auto-size, please make correct height for control (it is usually like big buttons). 1000 1001===dlg_proc=== 1002 1003 dlg_proc(id_dialog, id_action, prop="", index=-1, index2=-1, name="") 1004 1005Advanced work with dialogs (forms). More advanced than "dlg_custom", forms can show in modal/nonmodal way, controls can change their value during form showing. 1006 1007Often the function works with some control. To pass some control here, use one of 2 methods: 1008 1009* Set param "name" to control's name. You give name to a control when you create this control. Param "name" is used if it's not empty. 1010* Set param "index" to control's index. You get index of newly created control from dlg_proc call. You can find the index from name, using DLG_CTL_FIND action. Param "index" is used if it's >=0 and param "name" is empty. 1011 1012====dlg_proc - Types of controls==== 1013 1014Possible types of UI controls are described in "dlg_custom" topic. 1015Additional types, supported only by "dlg_proc": 1016 1017* "button_ex": button, application-themed, works via button_proc() 1018* "editor": full-featured multi-line editor, accessible via Editor API 1019* "editor_edit": one-line variant of "editor" 1020* "editor_combo": one-line variant of "editor", with drop-down arrow 1021* "listbox_ex": listbox, application-themed, works via listbox_proc() 1022* "paintbox": control which must be painted by plugin via canvas_proc() 1023* "statusbar": statusbar: panel with one horizontal row of cells, works via statusbar_proc() 1024* "toolbar": toolbar: panel which holds buttons with icons, works via toolbar_proc() 1025* "treeview": tree structure with nodes and nested nodes, works via tree_proc() 1026 1027====dlg_proc - Forms properties==== 1028 1029* "cap": str: Caption of form. 1030* "x", "y": int: Position (screen coordinates), left/top. 1031* "w", "h": int: Size, width/height. 1032* "w_min", "w_max": int: Constraints for width, min/max value. 1033* "h_min", "h_max": int: Constraints for height, min/max value. 1034* "p": int: Handle of parent form, or 0 if no parent. 1035* "tag": str: Any string, set by plugin. 1036 1037* "border": int: Sets border of form, DBORDER_nnn constants. Don't specify it together with deprecated "resize". 1038** DBORDER_NONE: No visible border, not resizable 1039** DBORDER_SIZE: Standard resizable border (on Windows: with Minimize/Maximize buttons) 1040** DBORDER_SINGLE: Single-line border, not resizable (on Windows: form has icon and Minimize button) 1041** DBORDER_DIALOG: Standard dialog box border, not resizable (on Windows: form has no icon nor Minimize button) 1042** DBORDER_TOOL: Like DBORDER_SINGLE but with a smaller caption 1043** DBORDER_TOOLSIZE: Like DBORDER_SIZE but with a smaller caption 1044 1045* "topmost": bool: Makes form stay on top of other forms in CudaText. 1046* "vis": bool: Visible state. 1047* "color": int: Background color. 1048* "autosize": bool: Form resizes to minimal size, which shows all visible controls. Don't use it together with "resize". 1049* "keypreview": bool: If on, then key press calls on_key_down before passing key to focused control. Should be True if form needs to handle on_key_down. 1050* "p": int: Parent handle. Set this property to int handle of any windowed UI control or form, this control/form will be parent of form. 1051* "focused" (only for reading): index of currently focused control. 1052* "form_state" (only for reading): current form state, string: "norm" for normal, "min" for minimized, "max" for maximized, "fullscr" for full-screen. 1053* (deprecated) "resize": bool: Border of form has "resizable" style. 1054 1055====dlg_proc - Forms events==== 1056 1057These are also properties of forms. 1058 1059* "on_resize": Called after form is resized. 1060* "on_close": Called after form is closed. 1061* "on_close_query": Called to ask plugin, is it allowed to close form (in any way: pressing Esc key, clicking X icon, pressing Alt+F4 or similar hotkey). Plugin must return bool, if True then form will be closed. 1062 1063* "on_show": Called after form shows. 1064* "on_hide": Called after form hides. 1065* "on_act": Called after form is activated (gets focus). 1066* "on_deact": Called after form is deactivated (lost focus). 1067* "on_mouse_enter": Called when mouse cursor enters form area. 1068* "on_mouse_exit": Called when mouse cursor leaves form area. 1069 1070* "on_form_state": Called after form is minimized/maximized/restored. 1071** param "data": Current form state, string value like in the property "form_state". 1072 1073* "on_key_down": Called when key is pressed in form (form should have "keypreview":True). If plugin returns False, key is blocked. 1074** param "id_ctl": int key code. 1075** param "data": key-state string: few chars, "c" for Ctrl, "a" for Alt, "s" for Shift, "m" for Meta. 1076 1077* "on_key_up": Called when key is depressed (after "on_key_down"). If plugin returns False, depressing of key is blocked. 1078 1079* "on_key_press": Called when character-key is pressed (additional to "on_key_down"). If plugin returns False, pressing of key is blocked. 1080** param "id_ctl": int character code. 1081** param "data": key-state string, like in "on_key_down". 1082 1083How to get nice key description in "on_key_down", e.g. "Ctrl+Alt+Esc" from id_ctl=27 and data="ca": 1084 1085<syntaxhighlight lang="python"> 1086 str_key =\ 1087 ('Meta+' if 'm' in data else '')+\ 1088 ('Ctrl+' if 'c' in data else '')+\ 1089 ('Alt+' if 'a' in data else '')+\ 1090 ('Shift+' if 's' in data else '')+\ 1091 app_proc(PROC_HOTKEY_INT_TO_STR, id_ctl) 1092</syntaxhighlight> 1093 1094====dlg_proc - Control properties==== 1095 1096* "name": str: Optional name of control, to find control later by name. May be not unique for controls. 1097* "cap": str: Caption. 1098* "act": bool: Active state. For many controls (edit, check, radio, combo_ro, checkbutton, listbox'es, listview's, tabs), it means that control's value change fires events (for dlg_proc) or closes form (for dlg_custom). 1099* "x", "y": int: Position (coordinates relative to dialog), left/top. 1100* "w", "h": int: Size, width/height. 1101* "en": bool: Enabled state. 1102* "vis": bool: Visible state. 1103* "color": int: Color. 1104* "border": bool: Control has border. 1105* "font_name": str: Font name. 1106* "font_size": int: Font size. 1107* "font_color": int: Font color. 1108* "hint": str: Hint (tooltip) for mouse-over. Newlines must be "\r". 1109* "ex0"..."ex9": Advanced control-specific props. Described in dlg_custom. 1110* "items": str: Usually tab-separated items. Described in dlg_custom. 1111* "val": str: Value of control. Described in dlg_custom. 1112* "tag": str: Any string, set by plugin. 1113 1114* "focused": bool: Shows if control has focus. 1115* "tab_stop": bool: Allows tab-key to jump to this control. 1116* "tab_order": int: Tab-key jumps to controls using tab_orders. First activated is control with tab_order=0, next with =1, etc. If tab_orders not set, controls activated by creation order. 1117 1118* "sp_l", "sp_r", "sp_t", "sp_b", "sp_a": int: Border spacing, ie padding of control's edge from anchored controls (or parent form). 5 props here: left, right, top, bottom, around. "Around" padding is added to padding of all 4 sides. 1119 1120* "a_l", "a_r", "a_t", "a_b": 2-tuple (str_control_name, str_side): Anchors of control. See [[#dlg_proc_-_Anchors]]. Value is 2-tuple, or None to disable anchor. 1121** Item-0: name of target control, or empty str to use control's parent (it is form by default). 1122** Item-1: side of target control, one of 3 values: "[" (left/top), "-" (center), "]" (right/bottom). 1123 1124* "align": alignment of control: 1125** ALIGN_NONE: no alignment (props "x", "y", "w", "h" have meaning) 1126** ALIGN_CLIENT: stretched to entire parent area (props "x", "y", "w", "h" are ignored) 1127** ALIGN_LEFT: glued to the left side of parent (only prop "w" has meaning) 1128** ALIGN_RIGHT: glued to the right side of parent (only prop "w" has meaning) 1129** ALIGN_TOP: glued to the top of parent (only prop "h" has meaning) 1130** ALIGN_BOTTOM: glued to the bottom of parent (only prop "h" has meaning) 1131 1132* "p": str: Name of control's parent control, or empty if the form is used as a parent. Coordinates x/y of a control are relative to the current parent, so control is attached to its parent. For example, you can place several controls on a "panel" control (panel can have hidden border), then change this panel's coordinates to visually move all child controls. Special case: to place control on PageControl's page with index N, specify such parent: pages_name+"."+str(N). 1133 1134Special properties for control "listview": 1135 1136* "imagelist_small": int: handle of ImageList with small icons. This ImageList is used in usual "report" mode of listview. 1137* "imagelist_large": int: handle of ImageList with large icons. This ImageList is used in "big icons" mode of listview. 1138* "imageindexes": str: string with '\t'-separated numbers. Each number is icon index, or -1 if icon is not used. 1139 1140Special properties for controls "tabs", "pages", "toolbar", "statusbar": 1141 1142* "tab_hovered": int: index of tab/cell under mouse cursor. Property is missed if no such tab/cell. 1143 1144====dlg_proc - Control events - general==== 1145 1146General events for all controls: 1147 1148* "on_change": Called after "value" of control is changed. For buttons, "on_change" is called on button click, instead of "on_click". 1149* "on_click": Called after mouse click on control, for non-active controls, which don't change "value" by click. Param "data" is tuple (x, y) with control-related coordinates of click. 1150* "on_click_dbl": Called after mouse double-click on control. Param "data" is tuple (x, y) with control-related coordinates. 1151* "on_mouse_down": Called when mouse button pressed. Param "data" is dict: { "btn": int_button_code, "state": str_keyboard_state, "x": int, "y": int }. Button code: 0: left; 1: right; 2: middle. Keyboard state: value like in global event "on_key". 1152* "on_mouse_up": Called when mouse button depressed (released). Param "data": like in "on_mouse_down". 1153* "on_mouse_enter": Called when mouse cursor enters control area. 1154* "on_mouse_exit": Called when mouse cursor leaves control area. 1155* "on_focus_enter": Called when control gets focus. Not supported for controls (they don't have OS window handle): label, button, button_ex, panel, linklabel, colorpanel, bevel, image, progressbar_ex, paintbox, statusbar. 1156* "on_focus_exit": Called when control looses focus. Supported for the same controls as "on_focus_enter". 1157* "on_menu": Called before showing context menu, after right click or ContextMenu hotkey. Param "data": like in "on_mouse_down". Method can return False to disable default menu (if any). 1158 1159====dlg_proc - Control events - for specific controls==== 1160 1161Special events for controls "listview", "checklistview": 1162 1163* "on_click_header": Called when user clicks on column header. Param "data": int column index. 1164* "on_select": Called after selection is changed. Param "data" is tuple: (int_item_index, bool_item_selected). 1165 1166Special events for control "listbox_ex": 1167 1168* "on_click_x": Called when listbox has X marks shown and X mark is clicked. 1169* "on_click_header": Called when listbox shows a header, and header is clicked. Param "data": int column index. 1170* "on_draw_item": Called if listbox is owner-drawn. Param "data" is dict: { "canvas": canvas_id, "index": int_item_index, "rect": item_rectangle_4_tuple }. 1171 1172Special events for control "treeview": 1173 1174* "on_fold", "on_unfold": Called before treeview node is folded/unfolded. Param "data" is int handle of treeview node. 1175* "on_select": Called after selection is changed. 1176 1177====dlg_proc - Control events - for editor control==== 1178 1179Special events for control "editor"/"editor_edit"/"editor_combo": 1180 1181* "on_change": Called after text is changed. 1182* "on_caret": Called after caret position and/or selection is changed. 1183* "on_scroll": Called after editor is scrolled. 1184* "on_key_down": Called when user presses a key. Param "data" is tuple (int_key_code, str_key_state). Method can return False to disable default processing. 1185* "on_key_up": Called when user depresses a key. Param "data" is tuple (int_key_code, str_key_state). Method can return False to disable default processing. 1186* "on_click_gutter": Called on mouse click on gutter area. Param "data" is dict: {"state": str_key_state, "line": int_line_index, "band": int_gutterband_index}. 1187* "on_click_gap": Called on mouse click on inter-line gap. Param "data" is dict: {"state": str_key_state, "line": int, "tag": int, "gap_w": int, "gap_h": int, "x": int, "y": int}. 1188* "on_click_link": Called on mouse click (single or double, depends on settings) over hyperlink (hyperlinks are defined via PROP_LINKS_SHOW, PROP_LINKS_REGEX). Param "data" is str. 1189* "on_paste": Called before doing one of Paste commands. Param "data" is dict: {"keep_caret": bool, "sel_then": bool}. Method can return False to disable default operation. 1190 1191====dlg_proc - Signatures of event callbacks==== 1192 1193Callbacks must be in forms shown in the topic [[#Callback_parameter]]. 1194 1195Callbacks for "dlg_proc" must be declared as: 1196 1197<syntaxhighlight lang="python"> 1198# for functions 1199def my(id_dlg, id_ctl, data='', info=''): 1200 pass 1201 1202# for class methods 1203class Command: 1204 def my(self, id_dlg, id_ctl, data='', info=''): 1205 pass 1206</syntaxhighlight> 1207 1208Parameters: 1209 1210* "id_dlg": Int handle of the form. 1211* "id_ctl": Int index of control. But for event "on_key_down" it has different meaning. 1212* "data": Value specific to event. 1213* "info": Additional value passed from CudaText, if extended form of callback is specified, with "info" part. 1214 1215====dlg_proc - Actions==== 1216 1217Param "prop": it can be of any simple type (str, int, bool), also tuple/list (of any simple type), also dict (keys: str, values: simple type or tuple/list). Most used is dict. Example: prop={"cap": "...", "x": 10, "y": 10, "w": 600, "en": False}. 1218 1219Param "id_dialog": int, form handle. Ignored only for DLG_CREATE action (pass 0 with it). 1220 1221Possible values of "id_action": 1222 1223* DLG_CREATE: Creates new empty form, returns form "handle". You must pass this handle (int) to next calls of dlg_proc(). 1224* DLG_HIDE: Hides form. 1225* DLG_FREE: Hides and deletes form. 1226* DLG_SHOW_MODAL: Shows form in modal mode. Waits for form to hide, then returns. 1227* DLG_SHOW_NONMODAL: Shows form in non-modal mode. Returns immediately. 1228* DLG_FOCUS: Focuses form (in non-modal mode). 1229* DLG_SCALE: Scales form, with all controls, for the current OS high-DPI value. E.g. of OS scale is 150%, all will be scaled by 1.5. 1230* DLG_TO_FRONT: Puts form to the foreground (in Z-order of forms). 1231 1232* DLG_PROP_GET: Returns form props, as dict. See example plugin, which props are returned. 1233* DLG_PROP_SET: Sets form props, from dict. Param "prop" is dict. Only props mentioned in "prop" are applied, other props don't change. 1234 1235* DLG_DOCK: Docks (inserts) form into another form. Param "index" is handle of another form, and 0 means main CudaText form. Param "prop" can be: "L", "R", "T", "B" for sides left/right/top/bottom (default is bottom). 1236* DLG_UNDOCK: Undocks form from it's current parent form. 1237 1238* DLG_LOCK: Disables updating of the form. This can be used before adding many controls at once, to remove flickering of these controls. 1239* DLG_UNLOCK: Enables updating of the form. This must be used in pair with DLG_LOCK. 1240 1241* DLG_CTL_COUNT: Returns count of controls on form. 1242* DLG_CTL_ADD: Adds new control to form, returns its index, or None if cannot add. Param "prop" is type of control. See description in dlg_custom. 1243* DLG_CTL_PROP_GET: Returns control props, as dict. Control must be specified by name or index. 1244* DLG_CTL_PROP_SET: Sets control props. Control must be specified by name or index. Param "prop" is dict with props. Only props mentioned in "prop" are applied, other props don't change. To "reset" some props, you must mention them with some value. 1245* DLG_CTL_FOCUS: Focuses control. Control must be specified by name or index. 1246* DLG_CTL_DELETE: Deletes control. Control must be specified by name or index. Controls are stored in list, so after a control deleted, indexes of next controls shift by -1. So don't use fixed indexes if you delete some, use DLG_CTL_FIND. 1247* DLG_CTL_DELETE_ALL: Deletes all controls. 1248* DLG_CTL_FIND: Returns index of control by name, or -1 if cannot find. Param "prop" is name. 1249* DLG_CTL_HANDLE: Returns int "handle" of control on a form. Control must be specified by name or index. This handle is currently useful for types: 1250** type "button_ex": pass handle to button_proc() 1251** types "editor"/"editor_edit"/"editor_combo": pass handle to Editor() constructor 1252** type "listbox_ex": pass handle to listbox_proc() 1253** type "paintbox": pass handle to canvas_proc() 1254** type "statusbar": pass handle to statusbar_proc() 1255** type "treeview": pass handle to tree_proc() 1256** type "toolbar": pass handle to toolbar_proc() 1257 1258* DLG_CTL_TO_FRONT: Puts control to the foreground (in Z-order of controls). 1259* DLG_CTL_TO_BACK: Puts control to the background (in Z-order of controls). 1260 1261* DLG_COORD_LOCAL_TO_SCREEN: Converts x/y coordinates from form-related, to screen-related. Param "index" is x, "index2" is y. Returns tuple (x,y). 1262* DLG_COORD_SCREEN_TO_LOCAL: Converts x/y coordinates from screen-related, to form-related. Param "index" is x, "index2" is y. Returns tuple (x,y). 1263 1264* DLG_POS_GET_STR: Returns form position/size as string. 1265* DLG_POS_SET_FROM_STR: Sets form position/size from string. Param "prop" is string value. 1266** It is faster than setting form properties "x", "y", "w", "h", it makes single resize. 1267** String format is the same as in DLG_POS_GET_STR, comma-separated numbers "x,y,w,h", any number can be skipped to keep old value. 1268 1269====dlg_proc - Anchors==== 1270 1271Anchor is attaching of control's side to another control, or to the parent form, so control is auto positioned, initially and on form resize. Lazarus IDE has such Anchor Editor dialog: 1272 1273[[Image:Anchor_Editor_en.png]] 1274 1275In this dialog you see, that all 4 sides of control attach to one of 3 sides of another control (or parent form). 1276 1277* Anchors override absolute positions, e.g. anchor of left side overrides prop "x". 1278* Anchoring to invisible control is allowed. 1279* Anchoring circles (A to B to C to A) is not allowed, but should not give errors. 1280 1281To change anchors of control, set its properties: a_l, a_r, a_t, a_b. 1282Initially left/top anchors are set (to the parent form). 1283 1284Side value "[" aligns control to left/top side of target: 1285 1286 +--------+ 1287 | target | 1288 +--------+ 1289 1290 +--------------+ 1291 | control | 1292 +--------------+ 1293 1294Side value "]" aligns control to right/bottom side of target: 1295 1296 +--------+ 1297 | target | 1298 +--------+ 1299 1300 +--------------+ 1301 | control | 1302 +--------------+ 1303 1304Side value "-" centers control relative to target: 1305 1306 +--------+ 1307 | target | 1308 +--------+ 1309 1310 +--------------+ 1311 | control | 1312 +--------------+ 1313 1314Useful information in the Lazarus wiki: [[Anchor_Docking#Why_use_Anchors_instead_of_Align.3F]]. 1315 1316Example: to attach "colorpanel" to the right side of form, clear left anchor (set to None), and add right/bottom anchors. This also sets spacing-aroung (padding) to 6 pixels. 1317 1318<syntaxhighlight lang="python"> 1319 #attach colorpanel to the right 1320 dlg_proc(id_form, DLG_CTL_PROP_SET, index=n, prop= 1321 { 'a_l': None, 'a_r': ('', ']'), 'a_b': ('', ']'), 'sp_a': 6 } ) 1322</syntaxhighlight> 1323 1324====dlg_proc - Example==== 1325 1326Detailed demo plugin exists, it shows many dlg_proc actions, shows modal/nonmodal forms, uses callbacks, moves control by button click, moves control on form resize. It is in the CudaText repo with name "cuda_testing_dlg_proc". 1327 1328===dlg_commands=== 1329 1330 dlg_commands(options, title="", w=0, h=0) 1331 1332Show commands dialog, which is customizable version of Commands (F1) dialog in CudaText. 1333 1334Param "options" should be 0 or sum of int flags: 1335 1336* COMMANDS_USUAL: Show usual commands, which have int codes. Function returns "c:"+str(int_command) for them. 1337* COMMANDS_PLUGINS: Show plugins commands. Function returns "p:"+callback_string for them. 1338* COMMANDS_LEXERS: Show lexers pseudo-commands. Function returns "l:"+lexer_name for them. 1339* COMMANDS_FILES: Show opened files pseudo-commands. Function returns "f:"+file_name for them. 1340* COMMANDS_RECENTS: Show recent files pseudo-commands. Function returns "r:"+file_name for them. 1341* COMMANDS_CONFIG: Allow to call Configure Hotkeys dialog by F9 key. 1342* COMMANDS_CONFIG_LEXER: Enable checkbox "For current lexer" when dialog to configure hotkey is called. 1343* COMMANDS_CENTERED: Set dialog position to the center of desktop. Otherwise, position depends on CudaText option. 1344 1345Params "w" and "h": if values>0, they are width and height of dialog. 1346 1347Returns string if command selected, or None if cancelled. 1348 1349===file_open=== 1350 1351 file_open(filename, group=-1, options="") 1352 file_open((filename1, filename2), group=-1, options="") 1353 1354Opens editor tab with given filename. If filename already opened, activates its tab. Pass empty string to open untitled tab. 1355 1356First parameter can be 2-tuple (or 2-list) of string, to open two files in a single tab, in a splitted view. In this case, second filename won't be handled specially for zip file, picture file, binary file etc. 1357 1358Returns bool. True, if first filename is empty. Otherwise, returns True if first filename exists, and second filename is empty or exists. 1359For zip file (only first filename is checked for it), returns True only if zip file contains valid CudaText add-on, and it was installed. 1360 1361* Param "group": index of tab-group, currently 0...8 (6 normal groups + 3 floating groups). Default means "current group". If you pass index of currently hidden group, group won't show, you need to call editor command to show it, see [[#cmd]]. 1362* Param "options": string: 1363** If it has "/preview", then file opens in a "temporary preview" tab, with italic caption. Param "group" is ignored then, used 1st group. 1364** If it has "/nohistory", file's saved history (caret, scroll pos, etc) won't be used. 1365** If it has "/noloadundo", file's persistent-undo (additional file created by using option "undo_persistent") won't be loaded. 1366** If it has "/nolexerdetect", lexer won't be auto-detected. 1367** If it has "/noevent", then "on_open_pre" event won't fire. 1368** If it has "/noopenedevent", then "on_open" event won't fire. 1369** If it has "/nononeevent", then "on_open_none" event won't fire. 1370** If it has "/silent", then zipped add-on will install w/o prompt and report. 1371** If it has "/passive", then tab will not activate, it will be passive tab. 1372** If it has "/nonear", then app option "ui_tab_new_near_current" will be ignored, tab will be appended to the end. 1373** If it has "/donear", then app option "ui_tab_new_near_current" will be ignored, tab will be opened near the active one. 1374** If it has "/nozip", then .zip files will not be handled specially. 1375** If it has "/nopictures", then picture files will not be handled specially. 1376** If it has "/view-text', then file will open in internal viewer, text (variable width) mode. 1377** If it has "/view-binary', then file will open in internal viewer, binary (fixed width) mode. 1378** If it has "/view-hex', then file will open in internal viewer, hex mode. 1379** If it has "/view-unicode', then file will open in internal viewer, unicode (variable width) mode. 1380** If it has "/nontext-view-text", then in the case of non-text file, file will open in internal viewer, text (variable width) mode. 1381** If it has "/nontext-view-binary", then in the case of non-text file, file will open in internal viewer, binary (fixed width) mode. 1382** If it has "/nontext-view-hex", then in the case of non-text file, file will open in internal viewer, hex mode. 1383** If it has "/nontext-view-unicode", then in the case of non-text file, file will open in internal viewer, unicode mode. 1384** If it has "/nontext-view-uhex", then in the case of non-text file, file will open in internal viewer, unicode+hex mode. 1385** If it has "/nontext-cancel", then in the case of non-text file, function will fail and return False. 1386 1387Note: "ed" is always the current editor, after file_open() current editor changes, and "ed" is the new cur editor. 1388 1389Example opens untitled tab, and writes multi-line text to it: 1390<syntaxhighlight lang="python"> 1391 file_open('') 1392 ed.set_text_all(text) 1393</syntaxhighlight> 1394 1395===ed_handles=== 1396 1397 ed_handles() 1398 1399Returns range object: it contains int handles of all editor tabs. Pass each handle to Editor() to make editor object from handle. 1400 1401Example code, which shows filenames of all tabs: 1402 1403<syntaxhighlight lang="python"> 1404 #show all file names in console 1405 for h in ed_handles(): 1406 e = Editor(h) 1407 print(e.get_filename()) 1408</syntaxhighlight> 1409 1410===ed_group=== 1411 1412 ed_group(index) 1413 1414Returns Editor object for active editor in tab-group with given group-index. Returns None for incorrect index, or if no tabs in this group. 1415 1416Index possible values: 0..5 (first 6 groups) and 6..8 (3 floating groups). 1417 1418===ini_read/ini_write=== 1419 1420 ini_read(filename, section, key, value) 1421 ini_write(filename, section, key, value) 1422 1423Reads/writes single string from/to .ini file. Params: 1424 1425* "filename": str: Path of file. Can be without path, this means that path of "settings" dir is used. 1426* "section": str: Section of ini file. 1427* "key": str: Key in section. 1428* "value": str: 1429** on read: default value which is returned if no such filename/section/key was found. 1430** on write: value to write. 1431 1432On read: returns string value. On write: returns None. 1433 1434===ini_proc=== 1435 1436 ini_proc(id, filename, section="", key="") 1437 1438Performs action on .ini file. Filename can be without path, this means that path of "settings" dir is used. 1439 1440Possible values of "id": 1441 1442* INI_GET_SECTIONS: Returns list of sections. Params "section", "key" ignored. 1443* INI_GET_KEYS: Returns list of keys in given section. Param "key" ignored. 1444* INI_DELETE_KEY: Deletes given key in given section. 1445* INI_DELETE_SECTION: Deletes given section with all its keys. Param "key" ignored. 1446 1447===lexer_proc=== 1448 1449 lexer_proc(id, value) 1450 1451Perform some lexer-related action. 1452 1453Possible values of "id": 1454 1455* LEXER_GET_LEXERS: Returns list of lexers. Param "value" must be bool: allow to include also hidden lexers (not visible in the lexers menu). 1456* LEXER_GET_PROP: For lexer name (param "value"), returns lexer general properties, as dict. Supported for "lite" lexers too (lexer name must end with ^ suffix). For incorrect lexer name, returns None. Keys of dict: 1457** "en": bool: lexer is visible in the lexers menu. 1458** "typ": list of str: list of file-types (they detect lexer when file loads; "ext" is simple extension, "ext1.ext2" is double extension, "/fullname" is name w/o path). 1459** "st": list of str: list of all styles. 1460** "st_c": list of str: list of styles of syntax comments (e.g. used by Spell Checker). 1461** "st_s": list of str: list of styles of syntax strings (e.g. used by Spell Checker). 1462** "sub": list of str: list of sub-lexers (some items can be empty if lexer setup broken). 1463** "kinds": list of str: list of token kind names. (This list has strings which lexer author had assigned in lexer properties, it has nothing common with "syntax elements" search.) 1464** "c_line": str or None: line comment (until end-of-line). 1465** "c_str": 2-tuple or None: stream comment (for any range). 1466** "c_lined": 2-tuple or None: comment for full lines. 1467 1468* LEXER_GET_STYLES: For lexer name (param "value"), returns lexer styles properties, as dict. This works even if CudaText lexer themes are disabled (option "ui_lexer_themes": false). Not supported for "lite" lexers. Dict keys: 1469** "type": Kind of style. Enum. 0: reserved value, 1: colors and font styles, 2: colors only, 3: background color only. 1470** "color_font": RGB color of font. 1471** "color_back": RGB color of background. Can be COLOR_NONE if not used. 1472** "color_border": RGB color of border. 1473** "border_left", "border_right", "border_top", "border_bottom": Kind of border at one side. Enum. Values from 0: none, solid, dash, dot, dash dot, dash dot dot, solid2, solid3, wave, double. 1474** "styles": Font styles, as string. If empty, no styles. If "b" in value, bold. If "i" in value, italic. If "u" in value, underline. If "s" in value, strikeout. 1475** "tkind": Kind of syntax element. "c" - comment, "s" - string, "a" - any other. 1476 1477* LEXER_DETECT: Detects lexer name by file name (param "value" is file name). Returns None if cannot detect. Returns string or tuple of string (for example, "C" and "C++" for "test.h"). Function tests file extension, or even filename before extension (e.g. "/path/makefile.gcc" gives "Makefile"). 1478* LEXER_REREAD_LIB: Re-reads lexer library from disk, updates lexer menu. Make sure that plugins' dialogs don't use editor with lexer, which may crash. 1479 1480* LEXER_ADD_VIRTUAL: Adds virtual lexer, which doesn't have a file and doesn't highlight text, it's only an item in lexers list. The purpose of virtual lexers is to avoid creating lexer files, but allow plugins to be activated by some lexer name / some file types. Param "value" must be tuple of string: (lexer_name, file_types, line_comment, range_comment_begin, range_comment_end). Item file_types here must have the same notation as for "lite" lexers, e.g. "*.pas;*.pp;*.lpr". Virtual lexers are added to the "lite" lexers list, and show the same suffix in lexer menu. To activate such a lexer, call Editor.set_prop(PROP_LEXER_FILE, lexer_name+suffix). Action returns bool: lexer_name didn't exist, lexer was added. 1481 1482===tree_proc=== 1483 1484 tree_proc(id_tree, id_action, id_item=0, index=0, text="", image_index=-1, data="") 1485 1486Perform action on treeview UI-control. 1487 1488* Param "id_tree": int handle of treeview. 1489* Param "id_item": int handle of tree-item. Can be 0 for invisible root-item: 1490** can clear entire tree using root-item 1491** can enumerate root level using root-item. 1492 1493Possible values of "id_action": 1494 1495* TREE_ITEM_ENUM: Enumerates subitems of given item. Params: "id_item". Returns list of 2-tuples, or None. 1496** tuple item 0: int: handle of item. 1497** tuple item 1: string: caption of item. 1498 1499* TREE_ITEM_ENUM_EX: Enumerates subitems of given item. Params: "id_item". Returns list of dict, or None. Dict keys are: 1500** "id": int: handle of item. 1501** "text": str: caption of item 1502** "data": str: data string of item. 1503** "img": int: icon index of item, or -1 if icon not used. 1504** "sub_items": bool: item has the sub-items. 1505 1506* TREE_ITEM_ADD: Adds subitem as item's child. Returns int handle of subitem. 1507** Param "id_item": handle of item. 1508** Param "index": at which subitem index to insert (0-based), or -1 to append. 1509** Param "text": caption of item. 1510** Param "image_index": index in tree's icon list or -1 to not show icon. 1511** Param "data": optional data string attached to item. 1512* TREE_ITEM_DELETE: Deletes item (with all subitems). Params: "id_item". 1513* TREE_ITEM_SET_TEXT: Sets item's text. Params: "id_item", "text". 1514* TREE_ITEM_SET_ICON: Sets item's icon. Params: "id_item", "image_index". 1515 1516* TREE_ITEM_SELECT: Selects the item specified by "id_item". If "id_item" is 0, it removes the selection. 1517* TREE_ITEM_SHOW: Makes item visible, ie scrolls control to this item. 1518* TREE_ITEM_GET_SELECTED: Returns int handle of selected item (param "id_item" is ignored). Returns None if nothing is selected. 1519 1520* TREE_ITEM_GET_PROPS: Returns properties of item, as dict. Dict keys are: 1521** "text": str: caption of item 1522** "data": str: data string of item 1523** "icon": int: index of icon in tree's imagelist object, or -1 for none 1524** "level": int: how deep this item is nested (how many parents this item has) 1525** "parent": int: id of parent item, or 0 if no parent 1526** "folded": bool: is this item folded (item itself, not parents) 1527** "selected": bool: is this item selected 1528** "sub_items": bool: item has sub-items 1529** "index": int: index of item, relative to its branch 1530** "index_abs": int: absolute index of item, relative to root 1531 1532* TREE_ITEM_FOLD: Folds item w/o subitems. 1533* TREE_ITEM_FOLD_DEEP: Folds item with subitems. Root-item allowed too. 1534* TREE_ITEM_FOLD_LEVEL: Folds all items (id_item ignored) from level with specified index, 1 or bigger. (This is what CudaText commands "fold level N" do for code-tree). 1535* TREE_ITEM_UNFOLD: Unfolds item w/o subitems. 1536* TREE_ITEM_UNFOLD_DEEP: Unfolds item with subitems. Root-item allowed too. 1537 1538* TREE_FIND_FOR_TEXT_POS: For the treeview, filled with code-tree information (it can be plugin-created treeview), finds the tree-item corresponding to given text position. Param "id_item" is ignored, param "text" must be 2-tuple of int (column, line). Returns handle of tree-item. Returns None if "text" doesn't contain valid text position. Returns 0 if tree-item is not found. 1539 1540* TREE_GET_IMAGELIST: Returns handle of imagelist object, int value. 1541* TREE_SET_IMAGELIST: Sets handle of imagelist object. Param "text" must be int handle, it can be 0 to remove current imagelist. 1542 1543* TREE_PROP_SHOW_ROOT: Allows to change "show root-item" property. When root-item is hidden, treeview (folded) looks like a listbox. Param "text" must be bool value. 1544* TREE_LOCK: Disables repainting of control. 1545* TREE_UNLOCK: Enables repainting of control. 1546* TREE_THEME: Applies current color theme to control. 1547 1548* TREE_ITEM_GET_RANGE: Should be used only for code-tree. Returns range, stored in tree-item, as 4-tuple (start_x, start_y, end_x, end_y). If range is not set, returns (-1,-1,-1,-1). 1549* TREE_ITEM_SET_RANGE: Should be used only for code-tree. Sets range for tree-item. Param "text" must be 4-tuple of int (start_x, start_y, end_x, end_y). 1550 1551Example of fast treeview filling, with locking to prevert treeview repaints: 1552 1553<syntaxhighlight lang="python"> 1554 tree_proc(h_tree, TREE_LOCK) 1555 1556 for i in range(5000): 1557 tree_proc(h_tree, TREE_ITEM_ADD, index=-1, text='text') 1558 1559 tree_proc(h_tree, TREE_UNLOCK) 1560</syntaxhighlight> 1561 1562===listbox_proc=== 1563 1564 listbox_proc(id_listbox, id_action, index=0, text="", tag=0) 1565 1566Perform action on listbox UI-control. 1567 1568* Param id_listbox: int handle of listbox. 1569* Param index: index of item (0-base). 1570 1571Possible values of "id_action": 1572 1573* LISTBOX_GET_COUNT: Returns number if items. 1574* LISTBOX_ADD: Adds item with given text and tag. Returns new count of items. Param "index": index of new item, or -1 to append. Param "text": text of item. Param "tag": int tag. 1575* LISTBOX_ADD_PROP: Adds item with given text and other properties. Returns new count of items. Param "index": index of new item, or -1 to append. Param "text": text of item. Param "tag": dict with keys "tag", "modified", "datatext". 1576* LISTBOX_DELETE: Deletes item with given index. 1577* LISTBOX_DELETE_ALL: Deletes all items. 1578* LISTBOX_GET_ITEM: Returns text/tag of item with given index. Returns 2-tuple (text, tag) or None if index incorrect. 1579* LISTBOX_SET_ITEM: Sets text/tag of item with given index. Params used: "index", "text", "tag". 1580* LISTBOX_GET_ITEM_PROP: Returns properties of item with given index, as dict or None. Dict keys are: "text", "tag", "modified", "datatext". 1581* LISTBOX_SET_ITEM_PROP: Sets properties of item with given index. Param "index": int value. Param "text": new text of item. Param "tag": dict with keys "tag", "modified", "datatext". 1582* LISTBOX_GET_ITEM_H: Returns height of items in pixels. 1583* LISTBOX_SET_ITEM_H: Sets height of items in pixels. Param "index": int value 1584* LISTBOX_GET_SEL: Returns selected index. -1 for none. 1585* LISTBOX_SET_SEL: Sets selected index. Param "index": int value 1586* LISTBOX_GET_TOP: Returns index of top visible item. 1587* LISTBOX_SET_TOP: Sets index of top visible item. Param "index": int value 1588* LISTBOX_GET_DRAWN: Returns owner-drawn state (bool). Owner-drawn state means that listbox doesn't paint itself, but plugin must paint it via event "on_draw_item". 1589* LISTBOX_SET_DRAWN: Sets owner-drawn state. Param "index": 0 or 1 (off/on). 1590* LISTBOX_GET_SHOW_X: Returns state of X marks. Int value: 0: don't show, 1: show for all items, 2: show for mouse-over item. 1591* LISTBOX_SET_SHOW_X: Sets state of X marks. Param "index": int value. 1592* LISTBOX_GET_HOTTRACK: Returns HotTrack state (bool). HotTrack means that listbox highlights item under mouse cursor. 1593* LISTBOX_SET_HOTTRACK: Sets HotTrack state. Param "index": 0 or 1 (off/on). 1594* LISTBOX_GET_SCROLLSTYLE_HORZ: Returns style of horizontal scrollbar. One of SCROLLSTYLE_ constants. 1595* LISTBOX_SET_SCROLLSTYLE_HORZ: Sets style of horizontal scrollbar. Param "index": int value, one of SCROLLSTYLE_ constants. 1596* LISTBOX_GET_SCROLLSTYLE_VERT: Returns style of vertical scrollbar. One of SCROLLSTYLE_ constants. 1597* LISTBOX_SET_SCROLLSTYLE_VERT: Sets style of vertical scrollbar. Param "index": int value, one of SCROLLSTYLE_ constants. 1598* LISTBOX_GET_SCROLLPOS_HORZ: Returns horizontal scroll position. 1599* LISTBOX_SET_SCROLLPOS_HORZ: Sets horizontal scroll position. Param "index": int value. 1600* LISTBOX_GET_HEADER: Returns header string. 1601* LISTBOX_SET_HEADER: Sets header string. It may contain "column separator char", see LISTBOX_SET_COLUMN_SEP. 1602* LISTBOX_GET_HEADER_IMAGELIST: Returns int handle of header's image-list. 1603* LISTBOX_SET_HEADER_IMAGELIST: Sets int handle of header's image-list. 1604* LISTBOX_GET_HEADER_IMAGEINDEXES: Returns header's image-list indexes, as list of int. 1605* LISTBOX_SET_HEADER_IMAGEINDEXES: Sets header's image-list indexes. Param "text": list of int. For example, [-1, 4, 6] means "show image=4 for column 1, and image=6 for column 2". 1606 1607Listbox can have columns. It works only if listbox is not owner-drawn, and column sizes were set via LISTBOX_SET_COLUMNS. You must add separator-chars inside items to split items into columns. Column sizes are passed as list of int. Each list item can be: 1608* value>0: Column width in pixels. 1609* value<0: Column width in percents (percents of the entire listbox width, minus all fixed sizes). 1610* value=0: Column is auto-stretched to fill the rest of the width. Several auto-stretched columns are allowed. 1611 1612Actions for columns: 1613 1614* LISTBOX_GET_COLUMN_SEP: Returns column separator char. 1615* LISTBOX_SET_COLUMN_SEP: Sets column separator char. Param "text" must be single-char string. 1616* LISTBOX_GET_COLUMNS: Returns list of column sizes. 1617* LISTBOX_SET_COLUMNS: Sets list of column sizes. Param "text" must be list of int. List items can be >0, <0, =0, see above. 1618 1619Example adds 3 columns: 1620<syntaxhighlight lang="python"> 1621 listbox_proc(h_list, LISTBOX_SET_COLUMN_SEP, text='|') 1622 listbox_proc(h_list, LISTBOX_SET_COLUMNS, text=[-50,0,-20]) # width<0 means value in % 1623 listbox_proc(h_list, LISTBOX_ADD, index=-1, text='first|second|third') 1624</syntaxhighlight> 1625 1626===canvas_proc=== 1627 1628 canvas_proc(id_canvas, id_action, 1629 text="", color=-1, size=-1, 1630 x=-1, y=-1, x2=-1, y2=-1, 1631 style=-1, p1=-1, p2=-1) 1632 1633Performs action on canvas (drawing surface of some GUI control). 1634Id_canvas is handle of canvas of some GUI control. Special value 0 means testing empty panel, it appears at the top of app, when used. 1635 1636Possible values of "id_action": 1637 1638* CANVAS_SET_FONT: Sets props of font. Params: 1639** "text": font name 1640** "color" 1641** "size" 1642** "style": 0 for normal, or sum of values FONT_B (bold), FONT_I (italic), FONT_U (underline), FONT_S (strikeout) 1643 1644* CANVAS_SET_PEN: Sets props of pen. Params: 1645** "color" 1646** "size" 1647** "style": one of PEN_STYLE_nnnn 1648** "p1": end caps style - one of PEN_CAPS_nnnn 1649** "p2": line joining style - one of PEN_JOIN_nnnn 1650 1651* CANVAS_SET_BRUSH: Sets props of brush. Params: 1652** "color" 1653** "style": one of BRUSH_nnnn. Usually used: BRUSH_SOLID (filled background), BRUSH_CLEAR (transparent background). 1654 1655* CANVAS_SET_ANTIALIAS: Sets anti-aliasing mode of canvas. Params: style - ANTIALIAS_NONE, _ON, _OFF. 1656* CANVAS_GET_TEXT_SIZE: Returns size of text on canvas, as 2-tuple (size_x, size_y). Uses font. Params: text. 1657* CANVAS_TEXT: Paints text at given coords. Uses font and brush. Params: text, x, y. 1658* CANVAS_LINE: Paints line at given coords. Uses pen. Params: x, y, x2, y2. 1659* CANVAS_PIXEL: Paints one pixel at given coords. Params: x, y, color. 1660* CANVAS_RECT: Paints rectangle. Uses pen and brush. Params: x, y, x2, y2. 1661* CANVAS_RECT_FRAME: Paints rectangle. Uses only pen. Params: x, y, x2, y2. 1662* CANVAS_RECT_FILL: Paints rectangle. Uses only brush. Params: x, y, x2, y2. 1663* CANVAS_RECT_ROUND: Paints rounded rectangle. Uses pen and brush. Params: x, y, x2, y2, style - radius of corners. 1664* CANVAS_ELLIPSE: Paints ellipse or circle. Uses pen and brush. Params: x, y, x2, y2. 1665* CANVAS_POLYGON: Paints polygon from any number of points (>2). Uses pen and brush. Params: text - comma separated list of (x,y) coords. Example: "10,10,200,50,10,100" - 3 points. 1666* CANVAS_SET_TESTPANEL: Sets height of testing panel at the top. Params: size. If it's "too small", panel hides; for big size, size is limited. 1667 1668=== timer_proc === 1669 1670 timer_proc(id, callback, interval, tag="") 1671 1672Perform action on timers. Many different timers are allowed, they work at the same time, each unique callback makes new timer with its own interval. To stop some timer, you must specify the same callback as you did on starting that timer. 1673 1674* "callback": Callback which is called on timer tick, see below. 1675* "interval": Timer delay in msec. For value<10, app will use 10. Specify it only on starting (ignored on stopping). 1676* "tag": Some string, if not empty, it will be parameter to callback. If empty, callback is called without additional params. 1677 1678Possible values of "id": 1679 1680* TIMER_START - Create and start timer, for infinite ticks. If timer for such callback is already created, then it's restated. 1681* TIMER_START_ONE - Create and start timer, for single tick. If timer for such callback is already created, then it's restated. 1682* TIMER_STOP - Stop timer (timer must be created before). 1683* TIMER_DELETE - Stop timer, and delete it from list of timers. Usually don't use it, use only to save memory if created lot of timers. 1684 1685Result is True if params are OK, False if params not OK (callback string incorrect, not created callback specified on stopping); or None (for unknown "id"). 1686 1687====timer_proc - Callbacks==== 1688 1689Callback param must be in one of these forms: [[#Callback_parameter]]. 1690 1691Callbacks in timer_proc must be declared as: 1692 1693<syntaxhighlight lang="python"> 1694#function 1695def my(tag='', info=''): 1696 pass 1697#method 1698class Command: 1699 def my(self, tag='', info=''): 1700 pass 1701</syntaxhighlight> 1702 1703===menu_proc=== 1704 1705 menu_proc(id_menu, id_action, command="", caption="", index=-1, hotkey="", tag="") 1706 1707Perform action on menu items. 1708 1709====menu_proc - Menu id==== 1710 1711Value of "id_menu" can be: 1712 1713* number, str(number): all menu items can be specified by unique int value 1714* "top": top menu 1715* "top-file": top menu "File" submenu 1716* "top-edit": top menu "Edit" submenu 1717* "top-sel": top menu "Selection" submenu 1718* "top-sr": top menu "Search" submenu 1719* "top-view": top menu "View" submenu 1720* "top-op": top menu "Options" submenu 1721* "top-help": top menu "Help" submenu 1722* "text": editor context menu 1723* "tab": tab header context menu 1724* "toolmenu:"+name: dropdown submenu of toolbar button 1725 1726====menu_proc - Command for new items==== 1727 1728Value of "command" parameter for MENU_ADD can be: 1729 1730* int_command or str(int_command) - int command code, from module cudatext_cmd (pass 0 if item does nothing) 1731* callback in one of these forms: [[#Callback_parameter]]. 1732* (deprecated callback form) callback in the form "module,method" or "module,method,param" (param can be of any primitive type). 1733 1734* to create standard special sub-menus, special values: 1735** "_recents": Recent-files submenu 1736** "_plugins": Plugins submenu 1737** "_oplugins": Settings-plugins submenu 1738 1739* empty string, if item will be used as submenu (item is a submenu, if any subitems are added to it) 1740 1741====menu_proc - Properties as dict==== 1742 1743Some actions get dict for menu items. Dict keys: 1744 1745* "id": menu_id, int 1746* "cap": caption, str (for separator items it is "-") 1747* "cmd": command code (e.g. from module cudatext_cmd), int 1748* "hint": callback (used if "cmd" value <=0), str 1749* "hotkey": hotkey, str 1750* "command": combined command description: int value of "cmd" (if code>0), or str value of "hint" (otherwise) 1751* "tag": plugin-defined tag, str 1752* "en": enabled state, bool 1753* "vis": visible state, bool 1754* "checked": checked state, bool 1755* "radio": radio-item state, bool (it means round checkmark in checked state) 1756 1757====menu_proc - Actions==== 1758 1759Possible values of "id_action": 1760 1761* MENU_CLEAR: Removes all sub-items from menu item. 1762* MENU_ENUM: Enumerates sub-items of the menu item. Returns list of dict, or None (for incorrect menu_id). 1763* MENU_GET_PROP: Returns props of menu item, as dict. 1764 1765* MENU_ADD: Adds sub-item to menu item. Returns string, menu_id for newly added sub-item. Params: 1766** "id_menu": Item in which you add sub-item. 1767** "caption": Caption of item, or "-" for menu separator. 1768** "index": Index (0-based) at which to insert sub-item. Default: append item to end. 1769** "command": Values are described above. 1770** "hotkey": String of hotkey (e.g. "Ctrl+Shift+A"). Hotkey combos are not allowed. It overrides hotkey, which is auto assigned from command code. 1771** "tag": Any string stored in menu item. 1772 1773* MENU_REMOVE: Deletes menu item. Note: don't remove items, which are auto-updated by CudaText, because you'll get Access Violation on showing menu containing these items. E.g. some items in the tab context menu are auto-updated. 1774* MENU_CREATE: Creates new popup-menu, independent from CudaText menus. It can be filled like other menus, then shown via MENU_SHOW. 1775* MENU_SHOW: Shows given popup-menu. Only menu created with MENU_CREATE should be specified here. Param "command" must be tuple (x,y) or string "x,y" with screen-related coordinates, if empty - menu shows at mouse cursor. 1776 1777* MENU_SET_CAPTION: Changes caption of menu item. Param "command" must be str value. 1778* MENU_SET_VISIBLE: Changes visible state of menu item. Param "command" must be bool value. 1779* MENU_SET_ENABLED: Changes enabled state of menu item. Param "command" must be bool value. 1780* MENU_SET_HOTKEY: Changes hotkey of menu item. Param "command" must be str value, e.g. "Ctrl+Alt+F1". 1781* MENU_SET_CHECKED: Changes checked state of menu item. When item is checked, it shows a checkmark. Param "command" must be bool value. 1782* MENU_SET_RADIOITEM: Changes radio kind of menu item. When item has radio kind, its checkmark is round (in checked state). Param "command" must be bool value. 1783* MENU_SET_IMAGELIST: Changes imagelist object of menu, which contains menu item. Param "command" must be imagelist handle. 1784* MENU_SET_IMAGEINDEX: Changes icon index of menu item (index in imagelist). Param "index" must be icon index. 1785 1786====menu_proc - Example==== 1787 1788Example adds item "Misc" to the main menu, and sub-items: "About", separator, "Rename file" (from CudaExt plugin): 1789 1790<syntaxhighlight lang="python"> 1791 menuid = menu_proc('top', MENU_ADD, caption='Misc') 1792 n = menu_proc(menuid, MENU_ADD, command=2700, caption='About') 1793 n = menu_proc(menuid, MENU_ADD, caption='-') 1794 n = menu_proc(menuid, MENU_ADD, command='cuda_ext.rename_file', caption='Rename file') 1795</syntaxhighlight> 1796 1797Example creates popup-menu with one item and shows it at (x=100, y=100): 1798 1799<syntaxhighlight lang="python"> 1800 h = menu_proc(0, MENU_CREATE) 1801 menu_proc(h, MENU_ADD, command=2700, caption='About...') 1802 menu_proc(h, MENU_SHOW, command=(100,100) ) 1803</syntaxhighlight> 1804 1805===toolbar_proc=== 1806 1807 toolbar_proc(id_toolbar, id_action, text="", text2="", command=0, index=-1, index2=-1) 1808 1809Perform action on toolbar UI control. 1810 1811Param "id_toolbar": int handle of toolbar. 1812Deprecated: it can be string "top" for main app toolbar. 1813Function returns None, if "id_toolbar" is not correct. 1814 1815Param "id_action" possible values: 1816 1817* TOOLBAR_GET_COUNT: Returns number of buttons in toolbar. 1818* TOOLBAR_GET_IMAGELIST: Returns int handle of imagelist object. 1819* TOOLBAR_GET_BUTTON_HANDLE: Returns int handle of button to use in button_proc(), or None if index not correct. Param "index": button index. 1820* TOOLBAR_GET_BUTTON_HANDLES: Returns list of handles of all buttons. 1821* TOOLBAR_GET_INDEX_HOVERED: Returns index of button under mouse cursor, or -1 if none. 1822* TOOLBAR_DELETE_ALL: Deletes all buttons. 1823* TOOLBAR_DELETE_BUTTON: Deletes one button. Param "index": button index. 1824* TOOLBAR_ADD_ITEM: Adds one button, of usual kind. Returns its handle. Param "index": button index at which to insert, -1 to append. 1825* TOOLBAR_ADD_MENU: Adds one button, with submenu appearing by left click (not context menu). Returns its handle. Param "index": button index at which to insert, -1 to append. 1826* TOOLBAR_UPDATE: Updates buttons positions and sizes (for current size of imagelist, current captions etc). 1827* TOOLBAR_GET_VERTICAL: Returns vertical state of toolbar. 1828* TOOLBAR_SET_VERTICAL: Sets vertical state of toolbar. Param "index": bool value. 1829* TOOLBAR_GET_WRAP: Returns wrappable state of toolbar. 1830* TOOLBAR_SET_WRAP: Sets wrappable state of toolbar (implemented for horizontal toolbar only). Param "index": bool value. 1831* TOOLBAR_THEME: Applies current UI theme to toolbar. 1832 1833===statusbar_proc=== 1834 1835 statusbar_proc(id_statusbar, id_action, index=-1, tag=0, value="") 1836 1837Perform action on statusbar UI control. 1838 1839* Param "id_statusbar": handle of control. Deprecated: it can be string "main" for main app statusbar. 1840* Param "index": index of cell (0-based), if action needs it. 1841* Param "tag": int tag of cell. Tag value, if not 0, overrides "index" param. It's needed to address a cell without knowing its index, only by tag. CudaText addresses standard cells by tag in the range 1..20. 1842 1843Param "id_action" can be: 1844 1845* STATUSBAR_GET_COUNT: Returns int number of cells. 1846* STATUSBAR_DELETE_ALL: Deletes all cells. 1847* STATUSBAR_DELETE_CELL: Deletes one cell (by "index" or "tag"). 1848 1849* STATUSBAR_ADD_CELL: Adds one cell. Param "index": -1: cell will be appended; >=0: cell will be inserted at given index. Param "tag" has special meaning: it is tag value of a new cell. Returns index of new cell, or None if cannot add (e.g. "tag" is busy). 1850* STATUSBAR_FIND_CELL: Returns index if cell from tag, or None. Param "value": int tag. Params "index", "tag" ignored. 1851 1852* STATUSBAR_GET_IMAGELIST: Returns handle of imagelist object, attached to statusbar, or 0 for none. 1853* STATUSBAR_SET_IMAGELIST: Sets handle if imagelist object. Param "value": handle. 1854* STATUSBAR_GET_PADDING: Returns cells padding (left and right, in pixels). 1855* STATUSBAR_SET_PADDING: Sets cells padding. Param "value": int value. 1856* STATUSBAR_GET_SEPARATOR: Returns inter-cell separator string. 1857* STATUSBAR_SET_SEPARATOR: Sets inter-cell separator string. Param "value": string value. 1858 1859* STATUSBAR_GET_OVERFLOW_LEFT: Returns bool flag "overflow to left". This flag takes action when sum of cells widths overflows the entire statusbar width - flag pushes "redundant first cells" to the left side. 1860* STATUSBAR_SET_OVERFLOW_LEFT: Sets bool flag "overflow to left". Param "value": bool value. 1861 1862* STATUSBAR_GET_COLOR_BACK: Returns color of background. 1863* STATUSBAR_GET_COLOR_FONT: Returns color of font. 1864* STATUSBAR_GET_COLOR_BORDER_TOP: Returns color of entire-border-top. 1865* STATUSBAR_GET_COLOR_BORDER_BOTTOM: Returns color of entire-border-bottom. 1866* STATUSBAR_GET_COLOR_BORDER_L: Returns color of cells-border-left. 1867* STATUSBAR_GET_COLOR_BORDER_R: Returns color of cells-border-right. 1868* STATUSBAR_GET_COLOR_BORDER_U: Returns color of cells-border-up. 1869* STATUSBAR_GET_COLOR_BORDER_D: Returns color of cells-border-down. 1870 1871* STATUSBAR_SET_COLOR_BACK: Sets color of background. Param "value": int color. 1872* STATUSBAR_SET_COLOR_FONT: Sets color of font. 1873* STATUSBAR_SET_COLOR_BORDER_TOP: Sets color of entire-border-top. 1874* STATUSBAR_SET_COLOR_BORDER_BOTTOM: Sets color of entire-border-bottom, which is painted if value not equals to COLOR_NONE. 1875* STATUSBAR_SET_COLOR_BORDER_L: Sets color of cells-border-left. 1876* STATUSBAR_SET_COLOR_BORDER_R: Sets color of cells-border-right. 1877* STATUSBAR_SET_COLOR_BORDER_U: Sets color of cells-border-up. 1878* STATUSBAR_SET_COLOR_BORDER_D: Sets color of cells-border-down. 1879 1880* STATUSBAR_GET_CELL_RECT: Returns rectangle of cell coordinates (related to control) as 4-tuple of int, or None. 1881* STATUSBAR_GET_CELL_SIZE: Returns width of cell, or None. 1882* STATUSBAR_GET_CELL_AUTOSIZE: Returns auto-size property of cell, bool. Auto-size: adjust width of cell to its icon+text. 1883* STATUSBAR_GET_CELL_AUTOSTRETCH: Returns auto-stretch property of cell, bool. Auto-stretch: stretch cell to fill the entire statusbar width. 1884* STATUSBAR_GET_CELL_ALIGN: Returns alignment of cell's content. One of str values: "L" (left), "C" (center), "R" (right). 1885* STATUSBAR_GET_CELL_TEXT: Returns text of cell. 1886* STATUSBAR_GET_CELL_HINT: Returns hint of cell. 1887* STATUSBAR_GET_CELL_IMAGEINDEX: Returns icon index (inside imagelist) of cell, -1 for none. 1888* STATUSBAR_GET_CELL_COLOR_FONT: Returns font color of cell, COLOR_NONE if not set. 1889* STATUSBAR_GET_CELL_COLOR_BACK: Returns background color of cell, COLOR_NONE if not set. 1890* STATUSBAR_GET_CELL_COLOR_LINE: Returns line-top color of cell, COLOR_NONE if not set. 1891* STATUSBAR_GET_CELL_COLOR_LINE2: Returns line-bottom color of cell, COLOR_NONE if not set. 1892* STATUSBAR_GET_CELL_FONT_NAME: Returns special font name of cell (if empty str, not used). 1893* STATUSBAR_GET_CELL_FONT_SIZE: Returns special font size of cell (if <=0, not used). 1894* STATUSBAR_GET_CELL_TAG: Returns int tag of cell. Tag is some plugin-defined int value. 1895* STATUSBAR_GET_CELL_CALLBACK: Returns callback string of cell. 1896* STATUSBAR_GET_CELL_OVERLAY: Returns overlay string of cell. 1897 1898* STATUSBAR_SET_CELL_SIZE: Sets width of cell. Param "value": int. 1899* STATUSBAR_SET_CELL_AUTOSIZE: Sets auto-size of cell. Param "value": bool. 1900* STATUSBAR_SET_CELL_AUTOSTRETCH: Sets auto-stretch of cell. Param "value": bool. 1901* STATUSBAR_SET_CELL_ALIGN: Sets alignment of cell. Param "value": str constant: "L", "C", "R". 1902* STATUSBAR_SET_CELL_TEXT: Sets text of cell. Param "value": str. 1903* STATUSBAR_SET_CELL_HINT: Sets hint of cell. Param "value": str. 1904* STATUSBAR_SET_CELL_IMAGEINDEX: Sets icon index (inside imagelist) of cell, -1 for none. Param "value": int. 1905* STATUSBAR_SET_CELL_COLOR_FONT: Sets font color of cell. Param "value": int color or COLOR_NONE. 1906* STATUSBAR_SET_CELL_COLOR_BACK: Sets background color of cell. Param "value": int color or COLOR_NONE. 1907* STATUSBAR_SET_CELL_COLOR_LINE: Sets line-top color of cell. Param "value": int color or COLOR_NONE. 1908* STATUSBAR_SET_CELL_COLOR_LINE2: Sets line-bottom color of cell. Param "value": int color or COLOR_NONE. 1909* STATUSBAR_SET_CELL_FONT_NAME: Sets special font name of cell (if empty str, not used). Param "value": str. 1910* STATUSBAR_SET_CELL_FONT_SIZE: Sets special font size of cell (if <=0, not used). Param "value": int. 1911* STATUSBAR_SET_CELL_TAG: Sets tag of cell. Param "value": int. 1912* STATUSBAR_SET_CELL_CALLBACK: Sets callback string of cell. 1913* STATUSBAR_SET_CELL_OVERLAY: Sets overlay string of cell. 1914 1915Notes: 1916 1917* If cell text not empty, alignment applies only for text, icon is on the left. If text empty, alignment applies for icon. 1918 1919===imagelist_proc=== 1920 1921 imagelist_proc(id_list, id_action, value="") 1922 1923Perform action on imagelist object. 1924 1925Param "id_list" is int handle of imagelist. It is required for all actions, except IMAGELIST_CREATE, where it should be 0. 1926 1927Possible values of "id_action": 1928 1929* IMAGELIST_CREATE: Creates new imagelist object with default icon size 16x16. Returns int handle of this imagelist. Param "value" must be int handle of owner form of object. 1930** If it is form handle from dlg_proc, object will be deleted after deletion of this form. 1931** If it is 0, main application form is used as owner, and object will be persistent. 1932 1933* IMAGELIST_COUNT: Returns int number of icons in imagelist. 1934* IMAGELIST_GET_SIZE: Returns current icon size as 2-tuple (width, height). 1935* IMAGELIST_SET_SIZE: Sets new icon size, and clears imagelist. Param "value" must be 2-tuple of int (width, height). Returns new icon size (corrected by minimal value) as 2-tuple. 1936* IMAGELIST_ADD: Loads image into imagelist. Param "value" must be full path to PNG/BMP image file. Size of image should be the same as size of imagelist (otherwise image will be loaded cropped or maybe stretched, it depends on IDE). Returns int icon index, or None if cannot load. 1937* IMAGELIST_DELETE: Deletes one icon. Param "value" is int icon index (0-based). 1938* IMAGELIST_DELETE_ALL: Deletes all icons. 1939* IMAGELIST_PAINT: Paints single icon on given canvas, at given coords. Param "value" must be tuple (canvas_id, x, y, icon_index). Value canvas_id can be 0 for testing paintbox in CudaText. 1940 1941===image_proc=== 1942 1943 image_proc(id_image, id_action, value="") 1944 1945Perform action on image object. 1946 1947Param "id_image" is int handle of image. It is required for all actions, except IMAGE_CREATE, where it should be 0. 1948 1949Possible values of "id_action": 1950 1951* IMAGE_CREATE: Creates new image object. Returns int handle of this image. Param "value" must be int handle of owner form of object. 1952** If it is form handle from dlg_proc, object will be deleted after deletion of this form. 1953** If it is 0, main application form is used as owner, and object will be persistent. 1954 1955* IMAGE_GET_SIZE: Returns current image size as 2-tuple (width, height). 1956* IMAGE_LOAD: Reads picture file into image object. Param "value" must be full file path (png, jpg, bmp, gif, ico). 1957* IMAGE_PAINT: Paints image object on given canvas, at given coords. Param "value" must be tuple (canvas_id, x, y). Value canvas_id can be 0, for testing paintbox in CudaText. 1958* IMAGE_PAINT_SIZED: Paints image object on given canvas, resized to given rectangle. Param "value" must be tuple (canvas_id, x1, y1, x2, y2). 1959 1960===button_proc=== 1961 1962 button_proc(id_button, id_action, value="") 1963 1964Perform action on extended button (control type "button_ex"). 1965 1966Param "id_button" is int handle of button. 1967 1968Possible values of "id_action": 1969 1970* BTN_UPDATE: Repaints button. 1971* BTN_GET_TEXT: Returns caption string. 1972* BTN_SET_TEXT: Sets caption string. 1973* BTN_GET_HINT: Returns hint (tooltip) string. 1974* BTN_SET_HINT: Sets hint string. 1975* BTN_GET_ENABLED: Returns enabled state, bool. 1976* BTN_SET_ENABLED: Sets enabled state. Param "value" must be bool. 1977* BTN_GET_VISIBLE: Returns visible state, bool. 1978* BTN_SET_VISIBLE: Sets visible state. Param "value" must be bool. 1979* BTN_GET_CHECKED: Returns checked state, bool. 1980* BTN_SET_CHECKED: Sets checked state. Param "value" must be bool. 1981* BTN_GET_IMAGELIST: Returns handle of imagelist for button. 1982* BTN_SET_IMAGELIST: Sets handle of imagelist. Param "value" must be int handle. 1983* BTN_GET_IMAGEINDEX: Returns icon index (in attached imagelist). 1984* BTN_SET_IMAGEINDEX: Sets icon index. Param "value" must be int index (0-based), or -1 for none. To show icon, you must also set appropriate kind of button. 1985* BTN_GET_MENU: Returns int handle of submenu. It can be passed to menu_proc(h, MENU_SHOW). 1986* BTN_SET_MENU: Sets int handle of submenu. It can be handle created by menu_proc(0, MENU_CREATE). 1987* BTN_GET_KIND: Returns kind of button. Int value, one of BTNKIND_nnn constants. 1988* BTN_SET_KIND: Sets kind of button. 1989* BTN_GET_BOLD: Returns bold-style of button, bool. 1990* BTN_SET_BOLD: Sets bold-style. Param "value" must be bool. 1991* BTN_GET_ARROW: Returns dropdown arrow visible flag, bool. 1992* BTN_SET_ARROW: Sets dropdown arrow visible flag. Param "value" must be bool. 1993* BTN_GET_ARROW_ALIGN: Returns alignment of dropdown arrow, as str: "L", "R", "C". 1994* BTN_SET_ARROW_ALIGN: Sets alignment of dropdown arrow. Param "value" must be str: "L", "R", "C". 1995* BTN_GET_FOCUSABLE: Returns focusable state, bool. 1996* BTN_SET_FOCUSABLE: Sets focusable state. Param "value" must be bool. 1997* BTN_GET_FLAT: Returns flat state, bool. 1998* BTN_SET_FLAT: Sets flat state. Param "value" must be bool. 1999* BTN_GET_DATA1: Returns data1 string. 2000* BTN_SET_DATA1: Sets data1 string. It must contain one of the following: 2001** str(command_code) to run command by its integer code, like Editor.cmd() API does. 2002** string with [[#Callback_parameter]]. Note: only string callback forms are allowed here, ie callable form is not allowed. 2003* BTN_GET_DATA2: Returns data2 string. This string is not used by CudaText, but is used by plugins. 2004* BTN_SET_DATA2: Sets data2 string. 2005* BTN_GET_WIDTH: Returns width (in pixels). 2006* BTN_SET_WIDTH: Sets width. 2007* BTN_GET_ITEMS: Returns choice items, used for kind=BTNKIND_TEXT_CHOICE, as "\n"-separated strings. 2008* BTN_SET_ITEMS: Sets choice items. Param "value" must be str, "\n"-separated strings. 2009* BTN_GET_ITEMINDEX: Returns choice index, used for kind=BTNKIND_TEXT_CHOICE. 2010* BTN_SET_ITEMINDEX: Sets choice index. Param "value" must be int >=0, or -1 for none. 2011* BTN_GET_OVERLAY: Returns overlay text. 2012* BTN_SET_OVERLAY: Sets overlay text. 2013* BTN_GET_COLOR_LINE: Returns color of line-top. 2014* BTN_SET_COLOR_LINE: Sets color of line-top. 2015* BTN_GET_COLOR_LINE2: Returns color of line-bottom. 2016* BTN_SET_COLOR_LINE2: Sets color of line-bottom. 2017 2018Note: Toolbars contain several "button_ex" objects, which are anchored one to another (horizontally or vertically). You can also construct such toolbar by hands. API toolbar_proc() don't allow to specify kind of buttons, it sets kind from button properties. 2019 2020===more=== 2021 2022=Editor class= 2023 2024Editor class has methods to work with editor-controls. 2025Global object of Editor exist: "ed", it always refers to the currently focused editor in UI-tabs. 2026 2027Notes: 2028 2029* Most of Editor APIs work for editor-controls in the UI-tabs and for editor-controls created by dlg_proc(). But not all the APIs, some of them require the editor-control in the UI-tab. For example, some get_prop()/set_prop() properties need the editor in UI-tab. 2030* While CudaText has the file viewer active (not the editor, only binary/hex viewer), the editor is hidden and empty, so Editor APIs don't work. 2031 2032==Carets== 2033===Editor.get_carets=== 2034 2035 get_carets() 2036 2037Returns list of 4-tuples, each item is info about one caret: (PosX, PosY, EndX, EndY). 2038 2039* PosX is caret's column (0-base). Tab-chars give x increment 1, like others. 2040* PosY is caret's line (0-base). 2041* EndX/EndY is position of selection edge for this caret. Both -1 if no selection for caret. 2042 2043Example shows text of first caret's selection: 2044 2045<syntaxhighlight lang="Python"> 2046 carets = ed.get_carets() 2047 x1, y1, x2, y2 = carets[0] 2048 if y2>=0: 2049 # sort (y,x) pairs 2050 if (y1, x1)>(y2, x2): 2051 x1, y1, x2, y2 = x2, y2, x1, y1 2052 s = ed.get_text_substr(x1, y1, x2, y2) 2053 msg_status('Selection: '+s) 2054</syntaxhighlight> 2055 2056===Editor.set_caret=== 2057 2058 set_caret(posx, posy, endx=-1, endy=-1, id=CARET_SET_ONE, options=0) 2059 2060Controls carets. Possible values of "id": 2061 2062* CARET_SET_ONE: Removes multi-carets and sets single caret to the given position (posx, posy, endx, endy). To place caret without selection, set both "endx", "endy" to -1. 2063* CARET_ADD: Adds caret (multi-carets feature) with given position (posx, posy, endx, endy). Returns number of carets after that. 2064* CARET_DELETE_ALL: Deletes all carets. Parameters "posx", "posy", "endx", "endy" are ignored here. Note: you must add caret(s) later, to enable text editing to user. 2065* CARET_SET_INDEX + N, where N is 0...1e6: Places single caret, with index N, to the given position (posx, posy, endx, endy). 2066* CARET_DELETE_INDEX + N, where N is 0...1e6: Deletes single caret, with index N. Parameters "posx", "posy", "endx", "endy" are ignored here. 2067 2068Param "options" must be 0 or sum of the following flags: 2069 2070* CARET_OPTION_NO_SCROLL: Don't scroll to new caret position. For id=CARET_SET_ONE. 2071 2072==Text read/write== 2073 2074===Editor.get_text_all=== 2075 2076 get_text_all() 2077 2078Returns the entire editor text, as string. 2079Returns "\n" as line-breaks. 2080 2081===Editor.set_text_all=== 2082 2083 set_text_all(text) 2084 2085Sets the entire editor text, from given string. 2086Text can have any line-breaks (LF, CRLF, CR, mixed). 2087 2088Notes: 2089* Function cannot work with read-only editor (see Editor.get_prop, Editor.set_prop and PROP_RO). 2090* Function looses Undo information. To support Undo, use another API to set text, e.g. Editor.replace(). 2091 2092===Editor.get_text_line=== 2093 2094 get_text_line(index, max_len=0) 2095 2096Returns single line (str) with given index (0-based). Without ending line-break char(s). 2097Returns None if index incorrect. 2098 2099If param "max_len" is non-zero, and UTF-8 length of given line is greater than "max_len", function returns empty str. This allows to skip huge lines. 2100 2101===Editor.set_text_line=== 2102 2103 set_text_line(index, text) 2104 2105Sets single line (str) with given index (0-based). 2106Text must be without line-breaks. 2107To add new line, pass index=-1. 2108 2109===Editor.get_text_substr=== 2110 2111 get_text_substr(x1, y1, x2, y2) 2112 2113Returns substring from position (x1, y1) to bigger position (x2, y2). 2114 2115===Editor.delete=== 2116 2117 delete(x1, y1, x2, y2) 2118 2119Deletes range from position (x1, y1) to bigger position (x2, y2). 2120 2121* Too big x1/x2 are allowed (after line-end) 2122* Too big y2 means delete to end of file 2123 2124Note: don't pass tuple from get_carets()[0], this tuple has not sorted pos=(x1, y1), end=(x2, y2), you need to sort them (first sort by y, then by x). 2125 2126Example replaces selection of 1st caret with text: 2127 2128<syntaxhighlight lang="Python"> 2129 x0, y0, x1, y1 = ed.get_carets()[0] 2130 if (y0, x0) >= (y1, x1): #note that y first 2131 x0, y0, x1, y1 = x1, y1, x0, y0 2132 2133 ed.set_caret(x0, y0) 2134 ed.delete(x0, y0, x1, y1) 2135 ed.insert(x0, y0, text) 2136</syntaxhighlight> 2137 2138===Editor.insert=== 2139 2140 insert(x, y, text) 2141 2142Inserts given text at position (x, y). If y too big, appends block to end (even to final line w/out line-end). 2143Text can be multi-line, all CR LF are converted to currently used line-breaks. 2144 2145Returns 2-tuple (x, y) of position after inserted text. It is on the same line, if text is single line. Returns None if cannot insert. 2146 2147===Editor.replace=== 2148 2149 replace(x1, y1, x2, y2, text) 2150 2151Replaces range from position (x1, y1) to bigger position (x2, y2), with new text. 2152 2153* Too big x1/x2 are allowed (after line-end) 2154* Too big y2 means delete to end of file 2155 2156Function does the same as delete+insert, but 2157 2158* optimized for replace inside one line (when y1==y2 and no line-breaks in text) 2159* for multi-line it also makes grouped-undo for delete+insert 2160 2161Returns 2-tuple (x, y) of position after inserted text. 2162 2163===Editor.replace_lines=== 2164 2165 replace_lines(y1, y2, lines) 2166 2167Deletes whole lines from index y1 to y2, then inserts new lines from specified list. 2168 2169* Index y1 must be valid index (0 to count-1) 2170* Index y2 can be less than y1 (to not delete), and can be too big (to delete lines to end) 2171* Param lines is list/tuple of str. Can be empty list to just delete lines. Inside items should not be "\n" and "\r": "\n" will generate additional lines, "\r" not handled. 2172 2173Returns bool: index y1 correct, replace done. 2174 2175==Selection== 2176 2177===Editor.get_text_sel=== 2178 2179 get_text_sel() 2180 2181Returns selected text for 1st caret (empty, if no selection). 2182 2183===Editor.get_sel_mode=== 2184 2185 get_sel_mode() 2186 2187Returns current selection mode: 2188 2189* SEL_NORMAL: normal (stream) selection; it doesn't mean that selection exists. 2190* SEL_COLUMN: column (vertical) selection. 2191 2192===Editor.get_sel_lines=== 2193 2194 get_sel_lines() 2195 2196Returns 2-tuple, indexes of first and last lines affected by first caret selection. Returns (-1,-1) if no selection. 2197 2198===Editor.get_sel_rect, Editor.set_sel_rect=== 2199 2200 get_sel_rect() 2201 set_sel_rect(x1, y1, x2, y2) 2202 2203Returns/sets coords of column selection. 2204 2205Returns 4-tuple (x1, y1, x2, y2). All 0 if no column selection. 2206 2207==Properties== 2208 2209===Editor.get_line_count=== 2210 2211 get_line_count() 2212 2213Returns number of lines. 2214 2215===Editor.get_filename=== 2216 2217 get_filename(options="") 2218 2219Returns filename (str) of the editor. 2220 2221* Returns empty string for untitled tab. 2222* Returns string "?" if tab contains not normal text editor. See: get_prop(PROP_KIND). 2223 2224If param "options" contains char "*", the real file name is always returned, even in hex/picture viewer mode. 2225 2226===Editor.get_prop=== 2227 2228 get_prop(id, value="") 2229 2230Returns editor's property. 2231 2232Param "value" can be: str, number, bool (for bool it can be also "0"/"1"). Possible values of "id": 2233 2234* PROP_GUTTER_ALL: bool: gutter (container for all gutter columns) is visible. 2235* PROP_GUTTER_STATES: bool: show gutter column "line states". 2236* PROP_GUTTER_NUM: bool: show gutter column "line numbers". 2237* PROP_GUTTER_FOLD: bool: show gutter column "folding". 2238* PROP_GUTTER_BM: bool: show gutter column "bookmarks". 2239* PROP_NEWLINE: str: kind of line endings. One of values "lf", "crlf", "cr". 2240* PROP_WRAP: int: word-wrap mode. One of WRAP_nnn values. 2241* PROP_RO: bool: read-only mode. 2242* PROP_MARGIN: int: position of fixed margin. 2243* PROP_MARGIN_STRING: str: user-defined margins positions, e.g. "20 25". 2244* PROP_INSERT: bool: insert/overwrite mode. 2245* PROP_MODIFIED: bool: editor is modified. 2246* PROP_MODIFIED_VERSION: int: counter which is incremented on each text change. 2247* PROP_RULER: bool: horz ruler is shown. 2248 2249* PROP_LINE_STATE: int: state of the line with given index. One of LINESTATE_nnn values. 2250* PROP_LINE_STATES: list of int: list of line states (LINESTATE_nnn values) for all lines. 2251* PROP_LINE_STATES_UPDATED: list of bool: list of "updated" flags for all lines, each flag shows that its line was added/changed since the last clearing of this "updated" flag. 2252 2253* PROP_LINE_NUMBERS: int: style of line numbers. One of LINENUM_nnn values. 2254* PROP_LINE_TOP: int: index of line visible at the top of editor. 2255** Note: If you set PROP_LINE_TOP immediately after file_open(), it may not work, you need to call app_idle(True) first. 2256* PROP_LINE_BOTTOM: int: index of line visible at the bottom of editor (considers word wrap). 2257 2258* PROP_SCROLL_VERT: int: approximate vertical scroll position. Index in WrapInfo list, you can read this list via get_wrapinfo(). 2259* PROP_SCROLL_HORZ: int: approximate horizontal scroll position. 2260* PROP_SCROLL_VERT_SMOOTH: int: smooth vertical scroll position. In pixels. 2261* PROP_SCROLL_HORZ_SMOOTH: int: smooth horizontal scroll position. In pixels. 2262* PROP_SCROLL_VERT_INFO: int: dict with all available info about vertical scroll. 2263* PROP_SCROLL_HORZ_INFO: int: dict with all available info about horizontal scroll. 2264* PROP_SCROLLSTYLE_HORZ: int: style of horizontal scrollbar, one of SCROLLSTYLE_ constants. 2265* PROP_SCROLLSTYLE_VERT: int: style of vertical scrollbar, one of SCROLLSTYLE_ constants. 2266 2267* PROP_SCALE_FONT: int: scale of editor's font in percents, or 0 to use global app font scale. 2268* PROP_COLOR: int: color property. Value must be one of COLOR_ID_nnn values. Returns None for incorrect id. 2269* PROP_ENC: str: encoding name. Names are listed at [[CudaText#Encodings]]. 2270* PROP_LEXER_FILE: str: name of lexer for entire file (empty str if none is active). 2271* PROP_LEXER_POS: str: name of lexer at specified position. Param "value" must be 2-tuple (column, line), or string str(column)+','+str(line), with 0-based indexes. 2272* PROP_LEXER_CARET: str: name of lexer at the position of 1st caret. 2273* PROP_INDEX_GROUP: int: index of group with editor's tab, 0-based. 2274* PROP_INDEX_TAB: int: index of editor's tab in group, 0-based. 2275* PROP_UNPRINTED_SHOW: bool: unprinted chars: global enable-flag. 2276* PROP_UNPRINTED_SPACES: bool: unprinted chars: show spaces/tabs. 2277* PROP_UNPRINTED_SPACES_TRAILING: bool: unprinted chars: show spaces/tabs only at end of lines. 2278* PROP_UNPRINTED_ENDS: bool: unprinted chars: show line ends. 2279* PROP_UNPRINTED_END_DETAILS: bool: unprinted chars: show line end details. 2280* PROP_TAG: str: some string attached to editor. Value must be "key:defvalue" or simply "defvalue". Saved value for "key" is returned, or "defvalue" returned if value for key was not set. Empty key means key "_". 2281* PROP_CARET_VIEW: 3-tuple: shape of caret, normal mode. Tuple contents is (int_width, int_height, bool_empty_inside). Width/height<0 means value in percents. 2282* PROP_CARET_VIEW_OVR: 3-tuple: shape of caret, overwrite mode. 2283* PROP_CARET_VIEW_RO: 3-tuple: shape of caret, read-only mode. 2284* PROP_CARET_VIRTUAL: bool: caret position is allowed after line-ends. 2285* PROP_CARET_STOP_UNFOCUSED: bool: caret blinks only when editor is focused. 2286* PROP_MACRO_REC: bool: currently macro is recording. 2287* PROP_MARKED_RANGE: 2-tuple with line indexes of "marked range"; (-1, -1) if range not set. 2288* PROP_VISIBLE_LINES: int: max count of lines that fit to window (doesn't consider word wrap). 2289* PROP_VISIBLE_COLUMNS: int: max count of columns that fit to window. 2290* PROP_PICTURE: properties of picture file as 3-tuple: (picture_filename, size_x, size_y), or None if not picture loaded in tab. For picture ed.get_filename() returns "?". 2291* PROP_MINIMAP: bool: minimap is visible. 2292* PROP_MICROMAP: bool: micromap is visible. 2293* PROP_LINK_AT_POS: str: hyperlink string in the document, at given position. Value must be 2-tuple: (pos_x, pos_y). 2294* PROP_LINKS_SHOW: bool: enable hyperlinks underlining. 2295* PROP_LINKS_REGEX: str: regular expression for hyperlinks. 2296* PROP_LINKS_CLICKS: int: how mouse clicks activate hyperlinks. 0: disabled, 1: single click, 2: double click. 2297* PROP_IN_SESSION: bool: document was loaded from "session". 2298* PROP_IN_HISTORY: bool: document history was loaded from history file (history embedded to "session" or main history file). 2299* PROP_TAB_SPACES: bool: tab-key inserts spaces (not tab-char). 2300* PROP_TAB_SIZE: int: size of tab-char. 2301* PROP_TAB_COLLECT_MARKERS: bool: tab-key collects (jumps to and deletes) markers (if markers placed). 2302* PROP_TAB_TITLE: str: title of tab, useful for untitled tabs, for tabs with picture files. 2303* PROP_TAB_COLOR: int: color of tab containing editor; COLOR_NONE if not set. 2304* PROP_TAB_ICON: int: index of tab icon, ie index in imagelist, which handle you can get via app_proc(PROC_GET_TAB_IMAGELIST). 2305* PROP_TAB_PINNED: bool: tab is "pinned" (shows additional confirmation on closing). 2306* PROP_TAB_ID: int: unique tab's identifier (one number for main/secondary editors in tab), it is not changed when tab is moved. 2307* PROP_TAB_UI_SHOW: bool: tab header is visible on the tabs-bar. 2308* PROP_INDENT_SIZE: int: size of indent for Indent/Unindent commands. N>0: indent in spaces, N<0: indent in tabs, N=0: indent from PROP_TAB_SIZE/PROP_TAB_SPACES. 2309* PROP_INDENT_KEEP_ALIGN: bool: command Unindent keeps alignment of block edge, ie don't unindent if any line reached column 0. 2310* PROP_INDENT_AUTO: bool: makes next line also indented on Enter command. 2311* PROP_INDENT_KIND: int: kind of auto-indented line, see description of app option "indent_kind". 2312* PROP_FOLD_ALWAYS: bool: always show icons on "folding" gutter bar, otherwise show them only on mouse over. 2313* PROP_FOLD_ICONS: int: icon set for "folding" gutter bar. Possible values: 0, 1. 2314* PROP_FOLD_TOOLTIP_SHOW: bool: show floating tooltip when mouse hovers [...] mark for folded block. 2315* PROP_LAST_LINE_ON_TOP: bool: allow to scroll control, so last line shows on top. 2316* PROP_FOCUSED: bool: editor is focused. When changing: for editor in UI-tab it focuses also editor's tab. Cannot change True to False. 2317* PROP_HILITE_CUR_COL: bool: highlight current column. 2318* PROP_HILITE_CUR_LINE: bool: highlight current line. 2319* PROP_HILITE_CUR_LINE_MINIMAL: bool: highlight current line, only minimal part of line. 2320* PROP_HILITE_CUR_LINE_IF_FOCUS: bool: highlight current line, only when editor focused. 2321* PROP_CODETREE: bool: enable standard code-tree filling. 2322* PROP_CODETREE_MODIFIED_VERSION: modification version of the editor for the moment of code-tree filling. See PROP_MODIFIED_VERSION. 2323* PROP_CODETREE_SUBLEXER: bool: enable code-tree to show nodes from sublexer(s) of current lexer. 2324* PROP_EDITORS_LINKED: bool: enable sharing of the same text by primary/secondary editors in file tab. 2325* PROP_CELL_SIZE: 2-tuple of int: size in pixels of average char cell. 2326* PROP_ONE_LINE: bool: editor has single-line mode. (Usual editors are multi-line.) 2327* PROP_MODERN_SCROLLBAR: bool: use custom-drawn themed scrollbars. 2328* PROP_SAVE_HISTORY: bool: allows to save history (caret, scroll pos, folding etc) on file closing. 2329* PROP_PREVIEW: bool: editor is inside "Preview tab" (it has italic caption). 2330* PROP_UNDO_GROUPED: bool: editor undo/redo is grouped. 2331* PROP_UNDO_LIMIT: int: max count of simple actions, which can be undone. 2332* PROP_UNDO_DATA: str: string representation of Undo data. See [[#Format_of_serialized_Undo]]. 2333* PROP_REDO_DATA: str: string representation of Redo data. 2334* PROP_ZEBRA: int: if 0, "zebra" mode is not active; if >0, it is alpha-blend value (1..255) of active zebra mode. 2335* PROP_ZEBRA_STEP: int: step (in lines) of "zebra" mode. 2336* PROP_FONT: 2-tuple (str, int): normal font: name, size. 2337* PROP_FONT_B: 2-tuple (str, int): bold font: name, size. Empty name: not used. 2338* PROP_FONT_I: 2-tuple (str, int): italic font: name, size. Empty name: not used. 2339* PROP_FONT_BI: 2-tuple (str, int): bold+italic font: name, size. Empty name: not used. 2340* PROP_ACTIVATION_TIME: int: relative time (in msec) when tab ("primary" or "secondaty" editor in the same tab) was last focused. It's 0 for not yet focused tabs. It's None for editors created by dlg_proc(). 2341* PROP_KIND: str: kind of UI control in the tab. 2342** "text": normal editor. 2343** "bin": text/binary/hex viewer. 2344** "pic": picture viewer. 2345 2346* PROP_SPLIT: 2-tuple: information about primary/secondary editors splitting as tuple (split_kind, split_pos). 2347** "split_kind": str: "-" (not splitted), "v" (splitted vertically), "h" (splitted horizontally). 2348** "split_pos": int: part of entire size for secondary editor, multiplied by 1000 (e.g. 500 is half of size). 2349 2350* PROP_SAVING_FORCE_FINAL_EOL: bool: on saving file, ensure the newline at end of document. 2351* PROP_SAVING_TRIM_SPACES: bool: on saving file, trim trailing whitespaces. 2352* PROP_SAVING_TRIM_FINAL_EMPTY_LINES: bool: on saving file, trim redundant empty lines at end of document. 2353 2354* PROP_HANDLE_SELF: int: handle of editor object, for which get_prop() is called. This handle is unique among all objects in program (it is memory address). 2355** To get editor object from handle, use ed_obj=Editor(handle_value). 2356** Object "ed" has virtual handle 0 for active focused editor, ie ed.h==0. And PROP_HANDLE_SELF returns the actual non-zero handle. 2357* PROP_HANDLE_PRIMARY: int: handle of editor object, which is primary editor in ui-tab (primary editor is always visible). It's None for editor objects created from dlg_proc(). 2358* PROP_HANDLE_SECONDARY: int: handle of editor object, which is secondary editor in ui-tab (secondary editor is visible only when ui-tab is splitted). It's None for editor objects created from dlg_proc(). 2359* PROP_HANDLE_PARENT: int: handle of parent of editor object, or 0 if no such parent. This handle is needed to dock forms near the editor. 2360 2361* PROP_COORDS: 4-tuple of int: rectangle of entire editor area, relative to screen. 2362* PROP_RECT_CLIENT: 4-tuple of int: rectangle of entire editor area, relative to editor. 2363* PROP_RECT_TEXT: 4-tuple of int: rectangle of "main text" editor area (excluding gutter/minimap/micromap/ruler), relative to editor. 2364* PROP_RECT_GUTTER: 4-tuple of int: rectangle of "gutter" editor area (all gutter columns at once), relative to editor. It is (0,0,0,0) if area is hidden. 2365* PROP_RECT_MINIMAP: 4-tuple of int: rectangle of "minimap" editor area, relative to editor. It is (0,0,0,0) if area is hidden. 2366* PROP_RECT_MICROMAP: 4-tuple of int: rectangle of "micromap" editor area, relative to editor. It is (0,0,0,0) if area is hidden. 2367* PROP_RECT_RULER: 4-tuple of int: rectangle of "horizontal ruler" editor area, relative to editor. It is (0,0,0,0) if area is hidden. 2368 2369* PROP_THEMED: bool: for editors out of UI-tabs, allows to automatically apply current theme on app theme changing. 2370* PROP_COMBO_ITEMS: only for "editor_combo" control, contents of drop-down list. On getting: list of str. On setting: value must be str with '\n'-separated items. 2371 2372* PROP_MASKCHAR: str: character to show in masked-mode. 2373* PROP_MASKCHAR_USED: bool: masked-mode is activated. 2374 2375* PROP_NUMBERS_ONLY: bool: allow to input only numbers. 2376* PROP_NUMBERS_NEGATIVE: bool: additional to PROP_NUMBERS_ONLY, allow negative numbers<0. 2377 2378* PROP_COMMAND_LOG: list of last executed commands, as list of dict. Dict keys are: 2379** "code": Integer command code. 2380*** Special codes: value cmd_PluginRun means 'plugin started', value cmd_PluginEnd means 'plugin returned'. For these codes, "text" key has the value "py:module,method," or "py:module,method,param". 2381** "invoke": String, how the command was invoked. One of values: 2382*** "int": Internal calling from core components. 2383*** "key": Calling via some hotkey. 2384*** "menu_ctx": Calling from some context menu. 2385*** "menu_main": Calling from the main menu. 2386*** "app_int": Internal calling from high-level CudaText code. 2387*** "app_pal": Calling from the Command Palette. 2388*** "app_toolbar": Calling via toolbar buttons. 2389*** "app_sidebar": Calling via sidebar buttons. 2390*** "app_charmap": Calling via Char Map dialog. 2391*** "app_dragdrop": Calling via drag-and-drop. 2392*** "app_api": Calling from some Python API handler. 2393** "text": Text of command. It's not empty only in few cases, e.g. for command codes cCommand_TextInsert / cmd_PluginRun / cmd_PluginEnd. 2394 2395* PROP_COMMAND_LOG_LIMIT: int: maximal count of items in the list returned by PROP_COMMAND_LOG. 2396 2397* PROP_V_MODE: int: mode of binary viewer. Reading it for editor, returns VMODE_NONE. Reading it for viewer, returns one of: VMODE_TEXT, VMODE_BINARY, VMODE_HEX, VMODE_UNICODE, VMODE_UNICODE_HEX. 2398* PROP_V_POS: int: for binary viewer, scroll position. 2399* PROP_V_SEL_START: int: for binary viewer, selection start offset. 2400* PROP_V_SEL_LEN: int: for binary viewer, selection length. 2401* PROP_V_WIDTH: int: for binary viewer, width of text in mode VMODE_BINARY. 2402* PROP_V_WIDTH_HEX: int: for binary viewer, width of text in mode VMODE_HEX. 2403* PROP_V_WIDTH_UHEX: int: for binary viewer, width of text in mode VMODE_UNICODE_HEX. 2404 2405===Editor.set_prop=== 2406 2407 set_prop(id, value) 2408 2409Sets editor's property. 2410 2411Param "value" can be: str, number, bool (for bool it can be also "0"/"1"), tuple of simple type. Possible values of "id": 2412 2413* PROP_GUTTER_ALL: bool: gutter (container for all gutter columns) is visible. 2414* PROP_GUTTER_STATES: bool: show gutter column "line states". 2415* PROP_GUTTER_NUM: bool: show gutter column "line numbers". 2416* PROP_GUTTER_FOLD: bool: show gutter column "folding". 2417* PROP_GUTTER_BM: bool: show gutter column "bookmarks". 2418* PROP_WRAP: int: word-wrap mode. One of WRAP_nnn values. 2419* PROP_RO: bool: read-only mode. 2420* PROP_NEWLINE: str: kind of line endings. One of values "lf", "crlf", "cr". 2421* PROP_MARGIN: int: position of fixed margin. 2422* PROP_MARGIN_STRING: str: space-separated user-margins columns. 2423* PROP_INSERT: bool: insert/overwrite mode. 2424* PROP_MODIFIED: bool: editor is modified. 2425* PROP_RULER: bool: show ruler. 2426* PROP_COLOR: color property, value must be 2-tuple (COLOR_ID_nnnn, int_color_value). 2427* PROP_LINE_TOP: int: index of line visible at the editor top. 2428** Note: If you set PROP_LINE_TOP immediately after file_open(), it may not work, you need to call app_idle(True) first. 2429* PROP_LINE_NUMBERS: int: style of line numbers. One of LINENUM_nnn values. 2430* PROP_LINE_STATE: 2-tuple: state of the line with given index. 2-tuple (line_index, LINESTATE_nnn). 2431* PROP_LINE_STATES_UPDATED: currently supports writing only empty string value, writing it means clearing of "updated" flags for all lines. 2432 2433* PROP_SCROLL_VERT: int: approximate vertical scroll position. Index in WrapInfo list, you can read this list via get_wrapinfo(). 2434* PROP_SCROLL_HORZ: int: approximate horizontal scroll position. 2435* PROP_SCROLL_VERT_SMOOTH: int: smooth vertical scroll position. In pixels. 2436* PROP_SCROLL_HORZ_SMOOTH: int: smooth horizontal scroll position. In pixels. 2437* PROP_SCROLLSTYLE_HORZ: int: style of horizontal scrollbar, one of SCROLLSTYLE_ constants. 2438* PROP_SCROLLSTYLE_VERT: int: style of vertical scrollbar, one of SCROLLSTYLE_ constants. 2439 2440* PROP_SCALE_FONT: int: scale of editor's font in percents, or 0 to use global app font scale. 2441* PROP_ENC: str: encoding name. Names listed at [[CudaText#Encodings]]. 2442* PROP_ENC_RELOAD: str: like PROP_ENC, but setting this property also reloads file in new encoding (if it's not modified). Supported only for editors embedded in ui-tabs. 2443* PROP_LEXER_FILE: str: name of lexer. 2444* PROP_INDEX_GROUP: int: index of group with editor's tab, 0-based. 2445* PROP_INDEX_TAB: int: index of editor's tab in group, 0-based. 2446* PROP_UNPRINTED_SHOW: bool: unprinted chars: global enable-flag. 2447* PROP_UNPRINTED_SPACES: bool: unprinted chars: show spaces/tabs. 2448* PROP_UNPRINTED_SPACES_TRAILING: bool: unprinted chars: show spaces/tabs only at end of lines. 2449* PROP_UNPRINTED_ENDS: bool: unprinted chars: show line ends. 2450* PROP_UNPRINTED_END_DETAILS: bool: unprinted chars: show line end details. 2451* PROP_TAG: str: some string attached to editor. Param text must be pair "key:value" or simply "value", this sets value for specified key (internally it is dictionary). Empty key means key "_". 2452* PROP_CARET_VIEW: 3-tuple: shape of caret, normal mode. Tuple contents is (int_width, int_height, bool_empty_inside). Width/height<0 means value in percents. 2453* PROP_CARET_VIEW_OVR: 3-tuple: shape of caret, overwrite mode. 2454* PROP_CARET_VIEW_RO: 3-tuple: shape of caret, read-only mode. 2455* PROP_CARET_VIRTUAL: bool: caret position is allowed after line-ends. 2456* PROP_CARET_STOP_UNFOCUSED: bool: caret blinks only when editor is focused. 2457* PROP_MARKED_RANGE: line indexes of "marked range", value is 2-tuple (index1, index2) or (-1, -1) to remove this range. 2458* PROP_MINIMAP: bool: minimap is visible. 2459* PROP_MICROMAP: bool: micromap is visible. 2460* PROP_LINKS_SHOW: bool: enable hyperlinks underlining. 2461* PROP_LINKS_REGEX: str: regular expression for hyperlinks. 2462* PROP_LINKS_CLICKS: int: how mouse clicks activate hyperlinks. 0: disabled, 1: single click, 2: double click. 2463* PROP_TAB_SPACES: bool: tab-key inserts spaces. 2464* PROP_TAB_SIZE: int: size of tab-char. 2465* PROP_TAB_COLLECT_MARKERS: bool: tab-key collects (jumps to and deletes) markers. 2466* PROP_TAB_COLOR: int: color of tab containing editor; set COLOR_NONE to reset. 2467* PROP_TAB_TITLE: str: title of tab, useful for untitled tabs. 2468* PROP_TAB_ICON: int: index of tab icon, ie index in imagelist, which handle you can get via app_proc(PROC_GET_TAB_IMAGELIST). 2469* PROP_TAB_PINNED: bool: tab is "pinned" (shows additional confirmation on closing). 2470* PROP_TAB_UI_SHOW: bool: tab header is visible on the tabs-bar. 2471* PROP_INDENT_SIZE: int: size of indent for Indent/Unindent commands. N>0: indent in spaces, N<0: indent in tabs, N=0: indent from PROP_TAB_SIZE/PROP_TAB_SPACES. 2472* PROP_INDENT_KEEP_ALIGN: bool: command Unindent keeps alignment of block edge, ie don't unindent if any line reached column 0. 2473* PROP_INDENT_AUTO: bool: makes next line also indented on Enter command. 2474* PROP_INDENT_KIND: int: kind of auto-indented line, see description of app option "indent_kind". 2475* PROP_FOLD_ALWAYS: bool: always show icons on "folding" gutter bar, otherwise show them only on mouse over. 2476* PROP_FOLD_ICONS: int: icon set for "folding" gutter bar. Possible values: 0, 1. 2477* PROP_FOLD_TOOLTIP_SHOW: bool: show floating tooltip when mouse hovers [...] mark for folded block. 2478* PROP_LAST_LINE_ON_TOP: bool: allow to scroll control, so last line shows on top. 2479* PROP_FOCUSED: bool: editor is focused. When changing: for editor in UI-tab it focuses also editor's tab. Cannot change True to False. 2480* PROP_HILITE_CUR_COL: bool: highlight current column. 2481* PROP_HILITE_CUR_LINE: bool: highlight current line. 2482* PROP_HILITE_CUR_LINE_MINIMAL: bool: highlight current line, only minimal part of line. 2483* PROP_HILITE_CUR_LINE_IF_FOCUS: bool: highlight current line, only when editor focused. 2484* PROP_CODETREE: bool: enable standard code-tree filling. 2485* PROP_EDITORS_LINKED: bool: enable sharing of the same text by primary/secondary editors in file tab. 2486* PROP_ONE_LINE: bool: editor has single-line mode. 2487* PROP_MODERN_SCROLLBAR: bool: use custom-drawn themed scrollbars. 2488* PROP_SAVE_HISTORY: bool: allows to save history (caret, scroll pos, folding etc) on file closing. 2489* PROP_PREVIEW: bool: editor is inside "Preview tab" (it has italic caption). Currently only False value can be written. 2490* PROP_UNDO_GROUPED: bool: editor undo/redo is grouped. 2491* PROP_UNDO_LIMIT: int: max count of simple actions, which can be undone. 2492* PROP_UNDO_DATA: str: string representation of Undo data. See [[#Format_of_serialized_Undo]]. 2493* PROP_REDO_DATA: str: string representation of Redo data. 2494* PROP_ZEBRA: int: if 0, "zebra" mode is not active; if >0, it is alpha-blend value (1..255) of active zebra mode. 2495* PROP_ZEBRA_STEP: int: step (in lines) of "zebra" mode. 2496* PROP_FONT: 2-tuple (str, int): normal font: name, size. 2497* PROP_FONT_B: 2-tuple (str, int): bold font: name, size. Empty name: not used. 2498* PROP_FONT_I: 2-tuple (str, int): italic font: name, size. Empty name: not used. 2499* PROP_FONT_BI: 2-tuple (str, int): bold+italic font: name, size. Empty name: not used. 2500* PROP_CODETREE_SUBLEXER: bool: enable code-tree to show nodes from sublexer(s) of current lexer. 2501 2502* PROP_SPLIT: 2-tuple: information about primary/secondary editors splitting as tuple (split_kind, split_pos). 2503** "split_kind": str: "-" (not splitted), "v" (splitted vertically), "h" (splitted horizontally). 2504** "split_pos": int: part of entire size for secondary editor, multiplied by 1000 (e.g. 500 is half of size). 2505 2506* PROP_SAVING_FORCE_FINAL_EOL: bool: on saving file, ensure the newline at end of document. 2507* PROP_SAVING_TRIM_SPACES: bool: on saving file, trim trailing whitespaces. 2508* PROP_SAVING_TRIM_FINAL_EMPTY_LINES: bool: on saving file, trim redundant empty lines at end of document. 2509 2510* PROP_THEMED: bool: for editors out of UI-tabs, allows to automatically apply current theme on app theme changing. 2511* PROP_COMBO_ITEMS: only for "editor_combo" control, contents of drop-down list. On getting: list of str. On setting: value must be str with '\n'-separated items. 2512 2513* PROP_MASKCHAR: str: character to show in masked-mode. 2514* PROP_MASKCHAR_USED: bool: masked-mode is activated. 2515 2516* PROP_NUMBERS_ONLY: bool: allow to input only numbers. 2517* PROP_NUMBERS_NEGATIVE: bool: additional to PROP_NUMBERS_ONLY, allow negative numbers<0. 2518 2519* PROP_COMMAND_LOG_LIMIT: int: maximal count of items in the list returned by PROP_COMMAND_LOG. 2520 2521* PROP_V_MODE: int: mode of binary viewer. Setting it for viewer to one of VMODE_ values, changes viewer mode. Setting it for editor to one of VMODE_ values, switches editor to viewer in the given mode. Setting it for viewer to VMODE_NONE, switches viewer to editor. 2522* PROP_V_POS: int: for binary viewer, scroll position. 2523* PROP_V_SEL_START: int: for binary viewer, selection start offset. 2524* PROP_V_SEL_LEN: int: for binary viewer, selection length. 2525* PROP_V_WIDTH: int: for binary viewer, width of text in mode VMODE_BINARY. 2526* PROP_V_WIDTH_HEX: int: for binary viewer, width of text in mode VMODE_HEX. 2527* PROP_V_WIDTH_UHEX: int: for binary viewer, width of text in mode VMODE_UNICODE_HEX. 2528 2529===props vs options=== 2530 2531Many get_prop/set_prop ids correspond to CudaText options. List of corresponding pairs: 2532 2533* PROP_CARET_VIRTUAL - "caret_after_end" 2534* PROP_GUTTER_ALL - "gutter_show" 2535* PROP_GUTTER_BM - "gutter_bookmarks" 2536* PROP_GUTTER_FOLD - "gutter_fold" 2537* PROP_HILITE_CUR_COL - "show_cur_column" 2538* PROP_HILITE_CUR_LINE - "show_cur_line" 2539* PROP_HILITE_CUR_LINE_MINIMAL - "show_cur_line_minimal" 2540* PROP_HILITE_CUR_LINE_IF_FOCUS - "show_cur_line_only_focused" 2541* PROP_INDENT_AUTO - "indent_auto" 2542* PROP_INDENT_KEEP_ALIGN - "unindent_keeps_align" 2543* PROP_INDENT_KIND - "indent_kind" 2544* PROP_INDENT_SIZE - "indent_size" 2545* PROP_LAST_LINE_ON_TOP - "show_last_line_on_top" 2546* PROP_MARGIN - "margin" 2547* PROP_MARGIN_STRING - "margin_string" 2548* PROP_MICROMAP - "micromap_show" 2549* PROP_MINIMAP - "minimap_show" 2550* PROP_RULER - "ruler_show" 2551* PROP_TAB_SIZE - "tab_size" 2552* PROP_TAB_SPACES - "tab_spaces" 2553* PROP_UNPRINTED_ENDS - "unprinted_ends" 2554* PROP_UNPRINTED_END_DETAILS - "unprinted_end_details" 2555* PROP_UNPRINTED_SHOW - "unprinted_show" 2556* PROP_UNPRINTED_SPACES - "unprinted_spaces" 2557* PROP_UNPRINTED_SPACES_TRAILING - "unprinted_spaces_trailing" 2558* PROP_WRAP - "wrap_mode" 2559 2560===Editor.bookmark=== 2561 2562 bookmark(id, nline, nkind=1, ncolor=-1, text="", auto_del=True, show=True, tag=0) 2563 2564Controls bookmarks. Possible values of "id": 2565 2566* BOOKMARK_GET_ALL: Returns list of bookmarks, as list of dict. Param "nline" ignored. Dict keys are: 2567** "line": int 2568** "kind": int 2569** "tag": int 2570** "hint": str 2571** "auto_delx": enum, 0: don't auto-delete; 1: auto-delete; 2: auto-delete if global option is set 2572** "auto_del" (deprecated): bool, True if "auto_delx" is 1 2573** "show_in_list": bool 2574* BOOKMARK_GET_LIST: Returns list of line indexes, which have bookmarks. Param "nline" ignored. 2575* BOOKMARK_GET_PROP: Returns properties of bookmark at line index, given by param "nline". Returns dict, like for BOOKMARK_GET_ALL, or None. 2576 2577* BOOKMARK_SET: Sets bookmark. 2578** Param "nline": int: line index of bookmark. 2579** Param "nkind": int: kind of bookmark: 1 means usual bookmark with usual color and icon. Other kind values mean custom bookmark, which must be setup via BOOKMARK_SETUP. 2580** Param "text": str: tooltip, shown when mouse moves over bookmark gutter icon. 2581** Param "auto_del": bool: auto delete bookmark on deleting its text line. 2582** Param "show": bool: show bookmark in "Go to bookmark" dialog. 2583** Param "tag": int: some value attached to bookmark. 2584 2585* BOOKMARK_CLEAR: Removes bookmark from line, specified by "nline" param. 2586* BOOKMARK_CLEAR_ALL: Removes all bookmarks ("nline" ignored). 2587* BOOKMARK_DELETE_BY_TAG: Removes all bookmarks, which have the tag, given by "tag" param. 2588 2589* BOOKMARK_SETUP: Configures bookmarks with kind, given by "nkind" param. 2590** Param "ncolor": Color of bookmarked line. 2591*** Can be COLOR_NONE to not use background color. 2592*** Can be COLOR_DEFAULT to use current themed color. 2593** Param "text": Path to icon file for gutter, 16x16 .bmp or .png file. Empty str: don't show icon. 2594 2595Additional internal list Bookmarks2 exists, which holds list of background bookmarks. They have lower paint priority than usual bookmarks, so background bookmark is painted only if usual bookmark not exists. Actions BOOKMARK2_* are used for Bookmarks2 list, actions have the same meaning. Background bookmarks don't have gutter icon and mouse-over tooltip. They share the single setup with usual bookmarks. 2596 2597* BOOKMARK2_GET_ALL 2598* BOOKMARK2_GET_PROP 2599* BOOKMARK2_SET 2600* BOOKMARK2_CLEAR 2601* BOOKMARK2_CLEAR_ALL 2602* BOOKMARK2_DELETE_BY_TAG 2603 2604Notes: 2605 2606* Param "nkind" must be in the range 1..63. 2607* Param "nkind" values 2..9 have setup by default: they have blue icons "1" to "8". 2608 2609===Editor.decor=== 2610 2611 decor(id, line=-1, tag=0, text="", color=0, bold=False, italic=False, image=-1, auto_del=True) 2612 2613Controls decorations on gutter. It is used to show some visual marks, which look like bookmark icons, but independent of bookmarks. Possible values of "id": 2614 2615* DECOR_GET_ALL: Returns list of all decorations, as list of dict. 2616* DECOR_GET: Returns decoration for single line, as dict. Params used: "line". 2617* DECOR_SET: Sets decoration for single line, overwriting existing item for that line. Returns bool: line index correct, item added. Params used: 2618** "line": int, line index. 2619** "tag": int, some value attached to item. 2620** "text": str, text to show; decoration will be text. 2621** "color": int, color of text decoration. 2622** "bold": bool, use bold font for text decoration. 2623** "italic": bool, use italic font for text decoration. 2624** "image": int, icon index from decoration imagelist; decoration will be icon, if text is empty. 2625** "auto_del": bool, auto-delete decoration, when its line is deleted. 2626 2627* DECOR_DELETE_BY_LINE: Deletes single decoration for given line. Params used: "line". 2628* DECOR_DELETE_BY_TAG: Deletes all decorations with the given tag. Param used: "tag". 2629* DECOR_DELETE_ALL: Deletes all decorations. 2630* DECOR_GET_IMAGELIST: Returns int handle of decoration imagelist (default size is 16x16). 2631 2632===Editor.folding=== 2633 2634 folding(id, index=-1, item_x=-1, item_y=-1, item_y2=-1, item_staple=False, item_hint="") 2635 2636Performs action on folding ranges. Possible values of "id": 2637 2638* FOLDING_GET_LIST: Returns list of folding ranges. Params used: none except "id". Returns list of tuples (y, y2, x, staple, folded), or None. 2639** "y": int: line of range start. 2640** "y2": int: line of range end. If y==y2, then range is simple and don't have gutter-mark and staple. 2641** "x": int: x-offset of range start (char index in start line). 2642** "staple": bool: range has block staple. 2643** "folded": bool: range is currently folded. 2644 2645* FOLDING_GET_LIST_FILTERED: Returns list of folding ranges, which contain given range: line indexes from param "item_y" to param "item_y2" (inclusive). If item_y<0, then no filtering is done. You can perform this filtering from the result of FOLDING_GET_LIST, but it's slower. 2646 2647* FOLDING_FOLD: Folds range with given index (index in list, from FOLDING_GET_LIST). Params used: "index". 2648* FOLDING_FOLD_ALL: Folds all ranges. 2649* FOLDING_FOLD_LEVEL: Unfolds all ranges, then folds ranges starting with given nesting level. Params used: "index": nesting level, 0..9. 2650 2651* FOLDING_UNFOLD: Unfolds range with given index (index in list, from FOLDING_GET_LIST). Params used: "index". 2652* FOLDING_UNFOLD_ALL: Unfolds all ranges. 2653* FOLDING_UNFOLD_LINE: Unfolds line with given index (index in lines list). Params used: "index". 2654 2655* FOLDING_ADD: Adds folding range. Life time of this range is until lexer analisys runs (it clears ranges and adds ranges from lexer), which runs after any text change. Params used: 2656** "item_x": char index (offset in line) of range start. 2657** "item_y": line index of range start. 2658** "item_y2": line index of range end. 2659** "item_staple" (optional): bool, range has block staple. 2660** "item_hint" (optional): str, hint which is shown when range is folded. 2661** "index": if it's valid range index (0-based), range inserts at this index, otherwise range appends. 2662 2663* FOLDING_DELETE: Deletes folding range with given index (index in list, from FOLDING_GET_LIST). Params used: "index". 2664* FOLDING_DELETE_ALL: Deletes all folding ranges. Params used: none except "id". 2665* FOLDING_FIND: Finds index of range (index in list, from FOLDING_GET_LIST). Returns None if not found. Params used: "item_y" is line index at which range begins. 2666* FOLDING_CHECK_RANGE_INSIDE: For 2 ranges, which indexes given by "index" and "item_x", detects: 1st range is inside 2nd range. Returns bool. Returns False if indexes incorrect. 2667* FOLDING_CHECK_RANGES_SAME: For 2 ranges, which indexes given by "index" and "item_x", detects: ranges are "equal" (x, y, y2 in ranges may differ). Returns bool. Returns False if indexes incorrect. 2668 2669===Editor.get_sublexer_ranges=== 2670 2671 get_sublexer_ranges() 2672 2673Returns list of ranges which belong to nested lexers (sublexers of current lexer for entire file, e.g. "JavaScript" inside "PHP", "CSS" inside "HTML"). Returns list of 5-tuples, or None if no ranges. Each tuple is: 2674 2675* str: sublexer name 2676* int: start column (0-based) 2677* int: start line (0-based) 2678* int: end column 2679* int: end line 2680 2681===Editor.get_token=== 2682 2683 get_token(id, index1=0, index2=0) 2684 2685Returns info about lexer "tokens". "Token" is minimal text fragment for lexer, e.g. one identifier, one operator, one whole comment, one whole string. Each token has its color from lexer properties or color theme. Function returns None if no lexer is active in editor. 2686 2687Possible values of "id": 2688 2689* TOKEN_GET_KIND: For text position given by "index1" (column) and "index2" (line), returns kind of lexer token: 2690** "c": syntax comment 2691** "s": syntax string 2692** "a": any other kind 2693 2694* TOKEN_LIST: Returns all tokens, as list of dict. Params "index1", "index2" are ignored. Returns None if no lexer active. Dict keys are: 2695** "x1": start column (0-based) 2696** "y1": start line (0-based) 2697** "x2": end column 2698** "y2": end line 2699** "str": text of token (can be multi-line with "\n") 2700** "style": lexer style of token (lexer dependent) 2701** "ki": index of token kind (0-based), in the list returned by lexer_proc() 2702** "ks": kind of syntax element: "c" - comment, "s" - string, "a" - any other 2703 2704* TOKEN_LIST_SUB: Like TOKEN_LIST, but returns tokens only for given lines range, from "index1" to "index2" inclusive. Index in "index2" can be too big, this makes list until end of file. 2705 2706===Editor.get_wrapinfo=== 2707 2708 get_wrapinfo(param1=-1, param2=-1) 2709 2710Gets info about wrapping of lines on screen. It allows to calculate, at which positions long lines are wrapped (when "word wrap mode" is on). It allows to see, which text parts are folded. 2711 2712Returns list of dict, for specified lines range. Dict items has keys: 2713 2714* "line": int: Original line index, for this part. 2715* "char": int: Char index (1-based, for UTF-16 stream of chars), at which this part starts. It is >1, for next parts of long wrapped line. 2716* "len": int: Length of this part. It equals to entire line length, if line is not wrapped. 2717* "indent": int: Screen indent in spaces, for this part, it's used in rendering when option "Show wrapped parts indented" is on. 2718* "final": int: State of this part. 0: final part of the entire line; 1: partially folded part; 2: first or middle part of the entire line. 2719* "initial": bool: True if part is initial for the entire (wrapped) line, False if it is continuation (ie, wrapped) part. 2720 2721Parameter "param1" is the minimal line index (0-based) for which to return the information. 2722Parameter "param2" is the maximal line index. 2723Notes: 2724 2725* If both "param1" and "param2" are default, returns entire document information. 2726* If "param2" < "param1", returns empty list. 2727* If "param1" < 0, its value is replaced to the minimal possible index. 2728* If "param1" specifies incorrect line index, returns empty list. 2729* If "param2" is < 0 or specifies incorrect line index, its value is replaced to the maximal possible index. 2730* Length of resulting list equals the lines count for non-wrapped document. For wrapped document, you get 1 or more list items per each document line. 2731 2732===Editor.markers=== 2733 2734 markers(id, x=0, y=0, tag=0, len_x=0, len_y=0, line_len=0) 2735 2736Controls markers (used e.g. in Snippets plugin). Possible values of "id": 2737 2738* MARKERS_GET: Returns list of markers. Each list item is [x, y, len_x, len_y, tag]. Returns None if no markers. 2739 2740* MARKERS_GET_DICT: Returns list of markers. Each list item is dict with the following keys: 2741** "x", "y": Position of markers. 2742** "len_x", "len_y": Length of selection, which is applied when this marker is "collected". See description of MARKERS_ADD. 2743** "tag": Tag of marker. 2744** "line_len": Line-length of marker. If <0, line is painted to the left. If >0, line is painted to the right. 2745** "micromap": Marker is shown only on micromap. 2746 2747* MARKERS_ADD: Adds marker. Also returns number of markers. Params: 2748** "x", "y": Position of marker (like caret position). 2749** "tag": Some int value attached to marker. Value>0 is needed if you want to place multi-carets when command "goto last marker (and delete)" runs. All markers with the same tag>0 will get multi-carets (after markers will be deleted). 2750** "len_x", "len_y": Selection length. It's applied when marker is "collected" by command "goto last marker". 2751*** if len_y==0: len_x is length of selection (single line), 2752*** if len_y>0: len_y is y-delta of selection-end, and len_x is absolute x-pos of selection-end. 2753** "line_len": Line length, in chars. If 0, not used. If <0, line is painted to the left. If >0, line is painted to the right. 2754 2755* MARKERS_DELETE_ALL: Deletes all markers. 2756* MARKERS_DELETE_LAST: Deletes last added marker. 2757* MARKERS_DELETE_BY_TAG: Deletes all markers with the given tag. Param "tag": tag value. 2758* MARKERS_DELETE_BY_INDEX: Deletes marker by its index in the markers list. Param "tag": index (0-based). 2759 2760===Editor.attr=== 2761 2762 attr(id, tag=0, x=0, y=0, len=1, 2763 color_font=COLOR_NONE, color_bg=COLOR_NONE, color_border=COLOR_NONE, 2764 font_bold=0, font_italic=0, font_strikeout=0, 2765 border_left=0, border_right=0, border_down=0, border_up=0, 2766 show_on_map=False, map_only=0 ) 2767 2768Controls additional color attributes. Possible values of "id": 2769 2770* MARKERS_ADD: Adds fragment with specified properties. Also returns number of fragments. Parameters: 2771** "tag": Some int value attached to fragment (different plugins should add fragments with different tags). 2772** "x", "y": Position of fragment start (text position like caret). 2773** "len": Length of fragment in chars. 2774*** If len<0, and "show_on_map" is set, it will be multi-line micromap fragment with specified height=-len. 2775** "color_nnnn": Color values (RGB) for font, background, borders. 2776** "font_nnnn": Font attributes: 0 - off, 1 - on. 2777** "border_nnnn": Border types for edges, int value 0..6: none, solid, dash, solid 2pixel, dotted, rounded, wave. 2778** "show_on_map": How to show this fragment on micromap: 2779*** int value>=0: Show on micromap column with given tag. Don't pass value=0, because micromap column with tag=0 is reserved. 2780*** int value=-1: Don't show on micromap. 2781*** int value=-2: Show on micromap as full-width fragment (over full micromap width). Fragment color will be XOR'ed with colors of all micromap columns. 2782*** True: Show on micromap column 1. 2783*** False: Don't show on micromap. 2784** "map_only": int: 0: Show on text area only; 1: Show on micromap only; 2: Show both on text area and micromap. 2785 2786* MARKERS_ADD_MANY: Adds one or multiple fragments at once. Also returns number of fragments. Parameters: 2787** "x", "y", "len": The same as for MARKERS_ADD, but can be also list/tuple of int. Lists/tuples must contain the equal number of elements (otherwise the minimal number of elements will be used). 2788** other parameters: The same as for MARKERS_ADD. 2789 2790* MARKERS_GET: Returns list of fragments, or None. Each item is list of int, corresponding to Editor.attr() params (bool values will be 0 or 1). 2791* MARKERS_GET_DICT: Returns list of fragments. Each item is dict, with keys named like parameters of Editor.attr. 2792 2793* MARKERS_DELETE_ALL: Deletes all fragments. 2794* MARKERS_DELETE_LAST: Deletes last added fragment. 2795* MARKERS_DELETE_BY_TAG: Deletes all fragments with the given tag. Param "tag": tag value. 2796* MARKERS_DELETE_BY_INDEX: Deletes fragment by its index in the list. Param "tag": index (0-based). 2797 2798Notes: 2799 2800* Fragment list is sorted by (x, y) pair. 2801* Duplicate fragments, ie with the same (x, y) pair, are allowed. Last added fragments go to the later indexes, and all fragments are painted in their order in the fragment list, so last added fragments are painted over previous ones. 2802* Param "color_bg" can be COLOR_NONE: it uses usual back-color. 2803* Params "color_font", "color_border" can be COLOR_NONE: it uses usual text-color. 2804 2805===Editor.hotspots=== 2806 2807 hotspots(id, tag=0, tag_str="", pos="") 2808 2809Controls hotspot ranges. When mouse cursor moves in/out of hotspot, event on_hotspot is called. 2810 2811Possible values of "id": 2812 2813* HOTSPOT_ADD: Adds hotspot. Returns bool: params correct, hotspot added. Params: 2814** "pos": 4-tuple of int, text coords: (x_start, y_start, x_end, y_end) 2815** "tag": optional int value 2816** "tag_str": optional str value 2817 2818* HOTSPOT_GET_LIST: Returns list of hotspots. Each item is dict with keys: 2819** "pos": 4-tuple of int 2820** "tag": int 2821** "tag_str": str 2822 2823* HOTSPOT_DELETE_ALL: Deletes all hotspots. 2824* HOTSPOT_DELETE_LAST: Deletes last hotspot. 2825* HOTSPOT_DELETE_BY_TAG: Deletes all hotspots with the given tag, "tag" param. 2826 2827==Misc== 2828 2829===Editor.save=== 2830 2831 save(filename="") 2832 2833Saves editor's tab to disk. 2834 2835Shows save-as dialog for untitled tab. 2836If param filename not empty, uses it (untitled tab becomes titled). 2837Returns bool: file was saved. 2838 2839===Editor.cmd=== 2840 2841 cmd(code, text="") 2842 2843Command runner, it runs any command in editor by its int code. 2844 2845See codes in module cudatext_cmd. Param text is needed for rare commands (e.g. by cCommand_TextInsert). 2846 2847===Editor.focus=== 2848 2849 focus() 2850 2851Activates editor's tab and focuses editor itself. It's needed when you want to activate inactive tab. You can get Editor objects of inactive tabs using ed_handles(). 2852 2853===Editor.lock, Editor.unlock=== 2854 2855 lock() 2856 unlock() 2857 2858Functions lock, then unlock editor. "Locked" editor is not painted and shows only hourglass (or another) icon. 2859 2860Call "lock" increases counter, "unlock" decreases this counter (it's safe to call "unlock" more times, counter will be 0). When counter is >0, editor is locked. 2861 2862===Editor.convert=== 2863 2864 convert(id, x, y, text="") 2865 2866Converts something in editor. Possible values of "id": 2867 2868* CONVERT_CHAR_TO_COL: Convert char coordinates (x,y) to column coordinates (column,y), using current tab size. 2869* CONVERT_COL_TO_CHAR: Convert column coordinates (x,y) to char coordinates (chars,y). 2870* CONVERT_LINE_TABS_TO_SPACES: Convert line (param "text") from tab-chars to spaces, using current tab size. Returns str. Returns original line, if no tab-chars in it. 2871* CONVERT_SCREEN_TO_LOCAL: Convert pixel coordinates (x,y), from screen-related to control-related. 2872* CONVERT_LOCAL_TO_SCREEN: Convert pixel coordinates (x,y), from control-related to screen-related. 2873* CONVERT_PIXELS_TO_CARET: Convert pixel control-related coords (x,y) to text position (column,line). 2874* CONVERT_CARET_TO_PIXELS: Convert text position (column,line) to pixel control-related coords (x,y). 2875* CONVERT_OFFSET_TO_CARET: Convert absolute offset (0-based) given by param "x", to text position (column,line). 2876* CONVERT_CARET_TO_OFFSET: Convert text position (column,line) to absolute offset. 2877 2878Returns None if params are incorrect, or cannot calculate the result. 2879 2880===Editor.complete=== 2881 2882 complete(text, len1, len2, selected=0, alt_order=False) 2883 2884Shows auto-completion listbox with given items. 2885 2886Function returns None and listbox stays open. When user chooses listbox item, its data is inserted. 2887 2888* Param "text": string with items, must be formatted as shown in the [[ATSynEdit#Auto-completion_lists]]. 2889* Param "len1": count of chars to the left of the caret, to be replaced. 2890* Param "len2": count of chars to the right of the caret, to be replaced. 2891* Param "selected": index of initially selected listbox item (0-based). 2892* Param "alt_order": 2893** alt_order=False: pass items in each line: prefix, id, desc. Listbox shows prefix at the left edge. 2894** alt_order=True: pass items in each line in such order: id, prefix, desc. Listbox shows id at the left edge. Use it if plugin needs to show long "prefixes". 2895 2896Note: listbox disappears if you move caret or type text, unlike usual auto-completion listboxes (they can recalculate items for new caret pos). 2897 2898===Editor.complete_alt=== 2899 2900 complete_alt(text, snippet_id, len_chars, selected=0) 2901 2902Shows alternative completion listbox. This allows to insert complex snippets, not only simple words. 2903 2904Function returns None and listbox stays open. When user chooses listbox item, event "on_snippet" is called in plugin. 2905 2906Function params: 2907 2908* Param "text": "\n"-separated lines, one line per snippet. Each line has 3 columns "\t"-separated. 2909** Column 1 is shown on left side of listbox (good to show here name of function) 2910** Column 2 is shown on right side of listbox (good to show here type of function) 2911** Column 3 is snippet text in any format. Can contain "\t" but not "\n". Can have any chars escaped in any form. 2912* Param "snippet_id": Some short string just to identify snippet between different plugins. Different plugins provide snippets in different formats, they must insert only their own snippets, so each plugin must check kind of the snippet, passed to "on_snippet" event. 2913* Param "len_chars": Listbox is shown lefter than the caret, by specified count of chars. 2914* Param "selected": Index of initially selected listbox item (0-based). 2915 2916After user has chosen some item in the completion listbox, event "on_snippet" will be called with parameters: 2917 2918* Param "snippet_id": Value from complete_alt() call. 2919* Param "snippet_text": Text of chosen snippet. 2920 2921===Editor.gap=== 2922 2923 gap(id, num1, num2, tag=-1, size=0, color=COLOR_NONE) 2924 2925Performs action on inter-line gaps (they don't overlap text above/below). 2926Possible values of "id": 2927 2928* GAP_GET_ALL: Returns list of gaps, as list of dict. Dict keys are: 2929** "line": int: Line index; or -1 for gap before the first line. 2930** "tag": int: Tag. 2931** "size": int: Height in pixels. 2932** "color": int: Color. 2933** "bitmap": 2-tuple of int: Size of bitmap, or (0, 0) if no bitmap. 2934 2935* GAP_MAKE_BITMAP: Action is needed only if you want to paint bitmap in gap, it's not needed for empty gaps. Makes new bitmap for future gap. Size of bitmap is (num1, num2). Returns 2-tuple (id_bitmap, id_canvas). 2936** "id_bitmap": bitmap handle, needed to later call GAP_ADD. 2937** "id_canvas": canvas handle, needed to paint on bitmap, by canvas_proc(). 2938 2939* GAP_ADD: Adds gap to editor. Returns bool: params correct, gap added. Params: 2940** "num1": int: Line index; can be -1 for gap before the first line. 2941** "num2": int: Can be: 2942*** 0: gap is empty, filled with specified color; 2943*** handle of bitmap (created via GAP_MAKE_BITMAP): place bitmap in the gap; 2944*** handle of dialog (created via dlg_proc()): place dialog in the gap. 2945** "tag": int: Some value, to separate gaps from several plugins. 2946** "size": int: If >0, it is gap height in pixels. If 0, gap height is calculated from bitmap handle. 2947** "color": int: If not COLOR_NONE, then it's gap background color. 2948 2949* GAP_DELETE_ALL: Deletes all gaps. 2950* GAP_DELETE: Deletes gaps for the given line indexes range, from value of "num1" to value of "num2" (inclusive). 2951* GAP_DELETE_BY_TAG: Deletes gaps which have the tag, given by param "tag". 2952 2953Example plugin: 2954 2955<syntaxhighlight lang="python"> 2956from cudatext import * 2957class Command: 2958 def run(self): 2959 for i in range(ed.get_line_count()//2): 2960 self.do_gap(i*2) 2961 2962 def do_gap(self, num): 2963 id_bitmap, id_canvas = ed.gap(GAP_MAKE_BITMAP, 600, 50) 2964 canvas_proc(id_canvas, CANVAS_SET_BRUSH, color=0xa0ffa0) 2965 canvas_proc(id_canvas, CANVAS_POLYGON, '200,0,300,30,200,50') 2966 canvas_proc(id_canvas, CANVAS_SET_BRUSH, color=0xffffff, style=BRUSH_CLEAR) 2967 canvas_proc(id_canvas, CANVAS_TEXT, x=230, y=10, text='gap %d'%(num+1)) 2968 canvas_proc(id_canvas, CANVAS_SET_BRUSH, color=0xffffff, style=BRUSH_SOLID) 2969 ed.gap(GAP_ADD, num, id_bitmap) 2970</syntaxhighlight> 2971 2972===Editor.dim=== 2973 2974 dim(id, index=0, index2=0, value=100) 2975 2976Controls dim (shade, fade) ranges, which blend text font color with background color. Dim value is 0..255, 0 means "no effect", 255 means "text is transparent". 2977 2978Possible values of "id": 2979 2980* DIM_ADD: Adds new range. 2981** Param "index": index of first range line (0-base). 2982** Param "index2": index if last range line (value bigger than line count is allowed). 2983** Param "value": dim value. 2984* DIM_DELETE: Deletes one range. Param "index" is index of range (0-base). 2985* DIM_DELETE_ALL: Deletes all ranges. 2986* DIM_ENUM: Enumerates ranges. Gives list of 3-tuples (line_from, line_to, dim_value). 2987 2988===Editor.action=== 2989 2990 action(id, param1="", param2="", param3="") 2991 2992Performs some action in editor. Possible values of "id": 2993 2994* EDACTION_UPDATE: Repaint editor. 2995** "param1": Can be empty or "0" or "1". If "1", WrapInfo internal structure will be updated. WrapInfo update is needed after text changes, if program did not detect that changes automatically (in this case simple repaint will be incorrect). 2996 2997* EDACTION_UNDOGROUP_BEGIN, EDACTION_UNDOGROUP_END: Begins/ends an undo-group. Text editions, which are enclosed in undo-group, are handled by Undo/Redo command in a single step. Other text editions are handled in a single or multiple steps, it depends on CudaText option. 2998 2999* EDACTION_FIND_ONE: Perform text search, get match as 4-tuple of int (start_x, start_y, end_x, end_y) or None if not found. This uses finder independent from CudaText Find/Replace dialog, you must configure this finder via options string. 3000** "param1": Search string. 3001** "param2": Search options, see [[#Finder_options_as_string]]. 3002** Note: returns False for incorrect RegEx. 3003 3004* EDACTION_REPLACE_ONE: Perform text search+replace, get match as 4-tuple of int (start_x, start_y, end_x, end_y) or None if not found. This uses finder independent from CudaText Find/Replace dialog, you must configure this finder via options string. 3005** "param1": String to find. 3006** "param2": String to replace with. 3007** "param3": Search options, see [[#Finder_options_as_string]]. 3008** Note: returns False for incorrect RegEx. 3009 3010* EDACTION_REPLACE_ALL: Perform text search+replace in the entire document (note: ignoring caret position), get count of replacements. This uses finder independent from CudaText Find/Replace dialog, you must configure this finder via options string. 3011** "param1": String to find. 3012** "param2": String to replace with. 3013** "param3": Search options, see [[#Finder_options_as_string]]. 3014** Note: returns False for incorrect RegEx. 3015 3016* EDACTION_FIND_ALL: Perform text search and get all matches in a list. Result list items are 4-tuples of int: (start_x, start_y, end_x, end_y). This uses finder independent from CudaText Find/Replace dialog, you must configure this finder via options string. 3017** "param1": Search string. 3018** "param2": Search options, see [[#Finder_options_as_string]]. 3019** "param3": Optional. Maximal line length (default is 0x7FFFFFFF). Lines longer than this value will be skipped during search. 3020** Note: returns False for incorrect RegEx. 3021 3022* EDACTION_FIND_BRACKETS: Find position of nearest opening bracket with its pair bracket. Returns 4-tuple (col_start, line_start, col_end, line_end), where line_end<0 if brackets not found. 3023** "param1": Text position as 2-tuple (column, line). 3024** "param2": String with allowed bracket pairs. Can have these pairs: () [] {} <>. 3025** "param3": Max distance, in lines, to the pair bracket. Must be 32-bit signed int. 3026 3027* EDACTION_SHOW_POS: Make text position visible without caret moving. Returns True if params correct and scrolling occurred, returns False if params correct and no scrolling occurred, returns None if params not correct. 3028** "param1": Text position as 2-tuple (column, line). 3029** "param2": Indentation of text position from edges as 2-tuple (indent_horz, indent_vert). Values meaning is like for CudaText options "find_indent_horz", "find_indent_vert". 3030 3031* EDACTION_CODETREE_FILL: Fill some visual TreeView control (it can be standard code-tree control, or TreeView control in some form) with editor's code-tree information. Param "param1" must be TreeView handle (to use with tree_proc()). Returns True if lexer is set and information is read, otherwise False. 3032 3033* EDACTION_LEXER_SCAN: Run lexer parsing (if lexer is set) from line index, given by "param1". Waits until parsing finishes. 3034 3035* EDACTION_APPLY_THEME: Apply current UI-theme colors to editor control. So you don't have to apply all COLOR_ID_nnn properties via Editor.set_prop(). 3036 3037* EDACTION_EXPORT_HTML: Create HTML file from editor's text with syntax highlighting. Returns bool: file is created. Param "param1" must be dict with the following keys: 3038** "file_name": str: Full path of file. 3039** "title": str: HTML page title. 3040** "font_name": str: Font name. 3041** "font_size": int: Font size, in HTML points. 3042** "with_numbers": bool: Show gutter with line numbers. 3043** "color_back": int: RGB color of page background. 3044** "color_numbers": int: RGB color of line numbers. 3045 3046===Editor.micromap=== 3047 3048 micromap(id, param1=0, param2=0, param3=0) 3049 3050Controls editor's micromap. Possible values of "id": 3051 3052* MICROMAP_GET: Get list of micromap columns, as list of dict. Dict keys are: 3053** "size_perc": Width of column in percents of average char width. 3054** "size_px": Width of column in pixels. 3055** "tag": Int tag of column. CudaText has 2 default columns with tag 0 and 1. 3056** "color": RGB color of column background. Can be COLOR_NONE. 3057 3058* MICROMAP_ADD: Add micromap column. Returns bool: tag was not used, column was added. 3059** "param1": Int (64 bit) tag of column. 3060** "param2": Width of column in percents of average char width. 3061** "param3": RGB color of column background, or COLOR_NONE for default themed color. 3062 3063* MICROMAP_DELETE: Delete micromap column by its tag. Param "param1": tag. Returns bool: column was found and deleted. 3064 3065=TreeHelpers= 3066 3067CudaText contains built-in support for TreeHelpers. They build code-tree for additional lexers. TreeHelpers must be plugins, which have special install.inf file (Ini format). 3068 3069Section "info": 3070* key "subdir" must begin with "cuda_tree_" 3071 3072Section(s) "treehelper" followed by any string (e.g. "treehelper1"): 3073* key "lexers" is comma-separated lexers list 3074* key "method" is name of getter method in __init__.py 3075 3076File __init__.py must contain getter method(s), referenced by install.inf. Getter has signature (with any name): 3077 3078 def get_headers(filename, lines) 3079 3080* param "lines" is list of str, editor contents in CudaText. 3081* param "filename" is full file path, it is to support included files or something. 3082 3083Getter must return list of tuples: (pos, level, caption, icon). 3084 3085* field "pos": tuple of int (x1, y1, x2, y2): range for tree node. 3086* field "level": 1-based level of node, node of level K+1 is nested into (nearest upper) node of level K. 3087* field "caption": caption of node. 3088* field "icon": 0-based index of icon from standard imagelist, or -1 if icon not used. 3089** 0: folder 3090** 1: parts1 3091** 2: parts2 3092** 3: parts3 3093** 4: box 3094** 5: func 3095** 6: arrow1 3096** 7: arrow2 3097 3098Getter can also return value not of "list" type, in this case CudaText will not update the code-tree. 3099 3100TreeHelpers can be written in Pascal too. This way they will work much faster. 3101To write/debug a TreeHelper in Pascal, use the project "treehelpertester" in the CudaText GitHub repo. 3102These TreeHelpers were rewritten from Python to Pascal and are built-in now: 3103 3104* Markdown 3105* MediaWiki 3106* reST 3107 3108=Linters= 3109 3110Linters are 2nd-level plugins for CudaLint plugin. CudaLint was ported from SublimeLinter 3, and its linters should be ported from SublimeLinter linters. 3111Here is example: 3112 3113* Original linter: https://github.com/SublimeLinter/SublimeLinter-javac 3114* Ported linter: https://github.com/cudatext-addons/cuda_lint_javac 3115 3116To see how to port, compare files "linter.py". Other files must be added like in other CudaLint linters. 3117 3118=Tech info= 3119 3120==Format of text for cmd_MouseClick== 3121 3122Text is "X,Y" where X/Y are position of caret relative to top-caret (other carets removed when command runs). If Y is 0, X is addition to caret's x. 3123If Y not 0, Y is addition to caret's y, and X is absolute caret's x. 3124 3125==Finder options as string== 3126 3127Some APIs allow to specify finder options as a string. Such string can have the following chars: 3128 3129* "b": Backward search 3130* "c": Case sensitive 3131* "r": Regular expression 3132* "w": Whole words 3133* "f": Search from caret 3134* "s": Search in selection 3135* "o": Confirm replaces 3136* "a": Wrap search at edge of text 3137* "T" followed by a digit: Allowed syntax elements. Digit can be: 3138** "0": any 3139** "1": only comments 3140** "2": only strings 3141** "3": only comments/string 3142** "4": except comments 3143** "5": except strings 3144** "6": except comments/strings 3145 3146==Format of text for cmd_FinderAction== 3147 3148Text is chr(1) separated items: 3149 3150* item 0: Finder action, one of: 3151** "findfirst": Find first 3152** "findnext": Find next 3153** "findprev": Find previous 3154** "rep": Replace next, and find next 3155** "repstop": Replace next, and don't find 3156** "repall": Replace all 3157** "findcnt": Count all 3158** "findsel": Find all, make selections 3159** "findmark": Find all, place markers 3160* item 1: Text to find 3161* item 2: Text to replace with 3162* item 3: Options string, see [[#Finder_options_as_string]] 3163 3164==Format of serialized Undo== 3165 3166Text is "\n"-separated undo/redo items. Each line is tab-separated elements: 3167 3168* editing action, number 0..5: 3169** 0: line changed 3170** 1: end-of-line mark changed 3171** 2: line inserted 3172** 3: line deleted 3173** 4: cleared document "modified" flag 3174** 5: mouse clicked 3175* index of changed line (not for mouse clicks), 0-based. 3176* end-of-line kind, number 0..3: 3177** 0: none 3178** 1: CRLF 3179** 2: LF 3180** 3: CR 3181* line state, number 0..3: 3182** 0: none 3183** 1: changed 3184** 2: added 3185** 3: saved 3186* caret position(s). "x0,y0;" + "x1,y1;" + "x2,y2;" + ... ie 2*N numbers for N carets. 3187* soft mark flag, number 0/1 (boolean). Logic of soft/hard marks is described in wiki page [[ATSynEdit]]. 3188* hard mark flag, number 0/1. 3189* line text, in UTF8. This text can have tab-chars, tab-char is not separator. 3190 3191Note that field "line state" was inserted in API 1.0.328, new format of data became incompatible with old format. 3192 3193=API of 3rd-party plugins= 3194==API of Options Editor== 3195Options Editor plugin (preinstalled in CudaText) has API which allows to call its dialog with custom options. Example shows dialog with 4 custom options, with custom title. Options which user changed in dialog will be saved to user.json or lexer-specific config. 3196 3197<syntaxhighlight lang="Python"> 3198import os 3199import cudax_lib as appx 3200import cuda_options_editor as op_ed 3201 3202fn_config = 'cuda_my_plugin.json' # without path! 3203meta_info = [ 3204 { 3205 "opt": "my_opt_1", 3206 "cmt": ["Comment line 1", 3207 "Comment line 2", 3208 "Comment line 3"], 3209 "def": True, # Default value 3210 "frm": "bool", # Value type from 3211 # bool float int str - simple types 3212 # font - font name 3213 # font-e - font name or empty 3214 # hotk - hotkey 3215 # file - file path 3216 # strs - list of str 3217 # int2s - dict int to str 3218 # str2s - dict str to str 3219 "chp": "MySection" # Section (can be empty) 3220 }, 3221 { "opt": "my_opt_2", 3222 "cmt": ["Comment"], 3223 "def": "v1", 3224 "frm": "strs", 3225 "lst": ["v1", "v2"] 3226 }, 3227 { "opt": "my_opt_3", 3228 "cmt": ["Comment"], 3229 "def": 11, 3230 "frm": "int2s", 3231 "dct": [[11, "value for 11"], [22, "value for 22"]] 3232 }, 3233 { "opt": "my_opt_4", 3234 "cmt": ["Comment"], 3235 "def": "a", 3236 "frm": "int2s", 3237 "dct": [["a", "value for a"], ["b", "value for b"]] 3238 } 3239 ] 3240 3241class Command: 3242 def get_opt(path, val): 3243 return appx.get_opt(path, val, user_json=fn_config) 3244 3245 def config(self): 3246 subset = '' # section in user.json, if user.json is used 3247 title = 'My Plugin Options' 3248 how = {'hide_lex_fil': True, 'stor_json': fn_config} 3249 op_ed.OptEdD( 3250 path_keys_info = meta_info, 3251 subset = subset, 3252 how = how 3253 ).show(title) 3254 do_load_plugin_options() # some plugin function to reread options 3255</syntaxhighlight> 3256 3257This will show: 3258 3259[[File:cudatext_options_editor.png]] 3260 3261Options Editor stores values in JSON with trailing comma, so to read these options, plugin must use cudax_lib.get_opt() instead of json.load(). 3262 3263==API of Project Manager== 3264Project Manager plugin (preinstalled in CudaText) gives API to read properties of currently opened project. It has global variable '''global_project_info''', which is dict with keys: 3265 3266* "filename": Path of project file (*.cuda-proj), or empty string if project is not saved. 3267* "mainfile": Path of "main file" (which must be set by user from Project Manager context menu). 3268* "nodes": List of root project nodes, ie folder and file paths in the root level. 3269* "vars": List of variables defined in the Project Properties dialog. List of strings in the form "name=value". 3270 3271Example gets list of root project items: 3272<syntaxhighlight lang="Python"> 3273 import cuda_project_man as p 3274 nodes = p.global_project_info['nodes'] 3275</syntaxhighlight> 3276 3277Result without opened project: 3278 3279<syntaxhighlight lang="Python"> 3280 >>> p.global_project_info 3281 {'filename': '', 'nodes': [], 'vars': [], 'mainfile': ''} 3282</syntaxhighlight> 3283 3284Result with opened folder in unsaved project: 3285 3286<syntaxhighlight lang="Python"> 3287 >>> p.global_project_info 3288 {'filename': '', 'nodes': ['/home/name/datadir'], 'vars': [], 'mainfile': ''} 3289</syntaxhighlight> 3290 3291Result with opened folder in saved project: 3292 3293<syntaxhighlight lang="Python"> 3294 >>> p.global_project_info 3295 {'filename': '/home/name/test.cuda-proj', 'nodes': ['/home/name/datadir'], 'vars': [], 'mainfile': ''} 3296</syntaxhighlight> 3297 3298Also global function '''project_variables()''' exists, which is handy wrapper around global_project_info. It returns dict with keys: 3299 3300* "ProjDir": Folder of project file (*.cuda-proj). 3301* "ProjMainFile": Path of "main file". 3302* "ProjMainFileNameOnly": Only name of "main file", without path. 3303* "ProjMainFileNameNoExt": Name of "main file", without path and extension. 3304* Additional keys for project variables. 3305 3306Its code currently is: 3307 3308<syntaxhighlight lang="Python"> 3309def project_variables(): 3310 res = collections.OrderedDict() 3311 data = global_project_info 3312 res['ProjDir'] = os.path.dirname(data.get('filename', '')) 3313 3314 fn = data.get('mainfile', '') 3315 res['ProjMainFile'] = fn 3316 res['ProjMainFileNameOnly'] = os.path.basename(fn) 3317 res['ProjMainFileNameNoExt'] = '.'.join(os.path.basename(fn).split('.')[0:-1]) 3318 3319 data = global_project_info.get('vars', []) 3320 for item in data: 3321 s1, s2 = item.split('=', maxsplit=1) 3322 res[s1] = s2 3323 return res 3324</syntaxhighlight> 3325 3326=Questions= 3327 3328==How plugin can fill code-tree== 3329 3330* Handle events on_open, on_focus, on_change_slow (better don't use on_change, it slows down the app) 3331* Get handle of code-tree: h_tree = app_proc(PROC_GET_CODETREE, "") 3332* Fill tree via tree_proc(h_tree, ...) 3333** Disable standard tree filling via ed.set_prop(PROP_CODETREE, False) 3334** Clear tree via tree_proc(h_tree, TREE_ITEM_DELETE, id_item=0) 3335** On adding tree items, set range for them via tree_proc(h_tree, TREE_ITEM_SET_RANGE...) 3336 3337==How plugin can show tooltips on mouse-over== 3338 3339* Create dialog for tooltip, via dlg_proc() 3340 3341* Handle events on_open, on_focus, on_change_slow (better don't use on_change, it will slow down the app) 3342** Find text regions which need tooltip 3343** Delete old hotspots via ed.hotspot(HOTSPOT_DELETE_BY_TAG...) 3344** Add hotspots via ed.hotspots(HOTSPOT_ADD...) 3345 3346* Handle event on_hotspot 3347** Find which text region is under cursor 3348** Fill dialog via dlg_proc() 3349** Set dialog prop "p" to the handle of editor, ed_self.h. Don't use ed.h, because it is virtual handle 0. 3350** Set dialog pos (props "x", "y") to editor-related pixel coords. It is complex. See example: plugin HTML Tooltips. 3351** Show dialog via dlg_proc(..., DLG_SHOW_NONMODAL) 3352* On exiting hotspot, hide dialog 3353 3354==How to make auto-completion plugin== 3355 3356Good example is "HTML Class Complete": https://github.com/CudaText-addons/cuda_html_class_complete 3357 3358* Use CudaText menu item "Plugins / Make Plugin" to create empty plugin. In the "Make Plugin" dialog, check event "on_complete", so method Command.on_complete is called when user pressed Ctrl+Space. 3359 3360* Plugin files are located in the "py/cuda_nnnn" folder. In install.inf, add line "lexers=NNNN" for the event on_complete, so event is called only for lexer NNN. 3361 3362* In plugin .py file, in method on_complete, read editor text via ed.get_text_all() or ed.get_text_line(), read caret position via ed.get_carets(), make the completions list. 3363 3364* Call ed.complete() or ed.complete_alt() to show completions list. 3365 3366=History= 3367 33681.0.167 3369* add: timer_proc. 3370 33711.0.168 3372* add: app_proc: PROC_SAVE_SESSION/ PROC_LOAD_SESSION get bool (session was saved/loaded) 3373* add: dlg_custom: "label" has prop to right-align 3374* add: ed.get_prop/set_prop: value can be int/bool too 3375 33761.0.169 3377* add: ed.insert does append, if y too big 3378* add: ed.delete can use too big y2 3379 33801.0.170 3381* add: app_proc: PROC_SET_CLIP_ALT 3382 33831.0.171 3384* add: app_proc: PROC_SIDEPANEL_ADD takes additional value icon_filename 3385* deprecated: app_log: LOG_PANEL_ADD 3386* deprecated: app_log: LOG_PANEL_DELETE 3387* deprecated: app_log: LOG_PANEL_FOCUS 3388 33891.0.172 3390* add: menu_proc() 3391* deprecated: app_proc actions: PROC_MENU_* 3392* change: PROP_ENC now uses short names, see [[CudaText#Encodings]] 3393 33941.0.173 3395* add: dlg_commands() 3396* add: toolbar_proc() 3397* deprecated: app_proc actions: PROC_TOOLBAR_* 3398 33991.0.174 3400* add: dlg_custom: "name=" (not required) 3401* add: dlg_custom: "font=" 3402* add: dlg_custom: "type=filter_listbox", "type=filter_listview". To setup these filter controls, you must set "name=" for filter and its listbox/listview 3403* add: app_proc: PROC_ENUM_FONTS 3404 34051.0.175 3406* add: dlg_proc() 3407* add: dlg_custom: added props x= y= w= h= vis= color= font_name= font_size= font_color= 3408* add: timer_proc: can also use callbacks "module=nnn;cmd=nnn;" and "module=nnn;func=nnn;" 3409* add: timer_proc: added param "tag" 3410* add: menu_proc: actions MENU_CREATE, MENU_SHOW 3411 34121.0.176 3413* reworked dlg_proc, many form props+events added 3414* add: dlg_proc/dlg_custom: control type "treeview" 3415* add: dlg_proc/dlg_custom: control type "listbox_ex" 3416* add: dlg_proc/dlg_custom: control type "trackbar" 3417* add: dlg_proc/dlg_custom: control type "progressbar" 3418* add: dlg_proc/dlg_custom: control type "progressbar_ex" 3419* add: dlg_proc/dlg_custom: control type "bevel" 3420* add: file_open: added param "args" 3421* add: toolbar_proc: TOOLBAR_GET_CHECKED, TOOLBAR_SET_CHECKED 3422* delete: event on_dlg 3423* delete: dlg_proc/dlg_custom: prop "font" (use font_name, font_size, font_color) 3424* delete: deprecated APIs LOG_PANEL_ADD LOG_PANEL_DELETE LOG_PANEL_FOCUS 3425* delete: deprecated APIs PROC_TOOLBAR_* 3426 34271.0.177 3428* add: ed.replace 3429* add: ed.replace_lines 3430* add: dlg_custom: parameter "get_dict" to get new dict result (not tuple) 3431* add: dlg_proc: action DLG_SCALE 3432* add: app_proc: action PROC_GET_SYSTEM_PPI 3433 34341.0.178 3435* add: dlg_proc: control props for anchors/spacing: "a_*", "sp_*" 3436* add: dlg_proc: param "name" to specify controls by name 3437* add: dlg_proc: form prop "color" 3438* add: dlg_proc: form prop "autosize" 3439* add: dlg_proc: actions DLG_DOCK, DLG_UNDOCK 3440* add: dlg_custom/dlg_proc: control type "paintbox" 3441 34421.0.179 3443* add: dlg_proc/timer_proc/menu_proc: callbacks can be "callable", ie function names 3444* add: dlg_proc/timer_proc: callbacks can be with "info=...;" at end 3445* add: menu_proc: can use new-style callbacks like in dlg_proc 3446* deprecated: menu_proc old-style callbacks "module,method[,param]" 3447 34481.0.180 3449* add: app_proc: PROC_SHOW_SIDEBAR_GET, PROC_SHOW_SIDEBAR_SET 3450* add: app_proc: can pass not only string value 3451* add: ed.get_prop: PROP_COORDS 3452* add: dlg_proc/dlg_custom: type "panel", type "group" 3453* add: dlg_proc: control prop "p" (parent) 3454 34551.0.181 3456* add: dlg_proc/dlg_custom: type "pages" 3457* add: dlg_proc: control "paintbox" has sub-event "on_click" with info="x,y" 3458 34591.0.182 3460* add: dlg_proc: type "toolbar" 3461* add: app_proc: PROC_PROGRESSBAR 3462* add: app_proc: PROC_SPLITTER_GET, PROC_SPLITTER_SET 3463* deprecated: app_proc: PROC_GET_SPLIT, PROC_SET_SPLIT 3464* add: app_log: LOG_CONSOLE_GET_COMBO_LINES 3465* add: app_log: LOG_CONSOLE_GET_MEMO_LINES 3466* add: app_log: LOG_GET_LINES_LIST 3467* deprecated: app_log: LOG_CONSOLE_GET, LOG_CONSOLE_GET_LOG, LOG_GET_LINES 3468 34691.0.183 3470* big changes in dlg_proc: 3471** deleted: parameter 'id_event' 3472** deleted: props 'callback', 'events' 3473** form events is not called for controls (forms have own events, controls have own events) 3474** add: events for forms: 'on_resize', 'on_close', 'on_close_query', 'on_key_down', 'on_key_up' 3475** add: events for controls: 'on_change', 'on_click', 'on_click_dbl', 'on_select', 'on_menu' 3476** add: events for 'treeview' control: 'on_fold', 'on_unfold' 3477 34781.0.184 3479* deprecated: app_proc: PROC_SIDEPANEL_ADD, PROC_BOTTOMPANEL_ADD 3480* deprecated: on_panel event 3481* add: app_proc: PROC_SIDEPANEL_ADD_DIALOG, PROC_BOTTOMPANEL_ADD_DIALOG 3482* add: tree_proc: TREE_ITEM_FOLD_LEVEL 3483* add: tree_proc: TREE_THEME 3484* add: listbox_proc: LISTBOX_THEME 3485* add: toolbar_proc: TOOLBAR_THEME 3486* add: toolbar_proc: used new callback form 3487* add: menu_proc: MENU_SHOW with command="" to show at cursor 3488* add: menu_proc: added param "hotkey" for MENU_ADD, "hotkey" returned from MENU_ENUM 3489* deleted deprecated: PROC_GET_SPLIT, PROC_SET_SPLIT 3490* deleted deprecated: LOG_GET_LINES 3491* deleted deprecated: LOG_CONSOLE_GET, LOG_CONSOLE_GET_LOG 3492 34931.0.185 (app 1.11.0) 3494* add: menu_proc: for MENU_ADD added param "tag" 3495* add: menu_proc: MENU_SHOW can use 2-tuple (x,y) 3496* add: menu_proc: MENU_ENUM gives additional dict key "command" 3497* deprecated: menu_proc command values: "recents", "enc", "langs", "lexers", "plugins", "themes-ui", "themes-syntax" 3498 34991.0.186 (app 1.12.0) 3500* add: tree_proc: TREE_ICON_GET_SIZES, TREE_ICON_SET_SIZES 3501* deleted deprecated: app_proc: PROC_MENU_* actions 3502* deleted deprecated: app_proc: PROC_SIDEPANEL_ADD, PROC_BOTTOMPANEL_ADD 3503 35041.0.187 (app 1.12.2) 3505* add: lexer_proc: LEXER_GET_PROP 3506* deprecated: lexer_proc: LEXER_GET_EXT, LEXER_GET_ENABLED, LEXER_GET_COMMENT, LEXER_GET_COMMENT_STREAM, LEXER_GET_COMMENT_LINED, LEXER_GET_LINKS, LEXER_GET_STYLES, LEXER_GET_STYLES_COMMENTS, LEXER_GET_STYLES_STRINGS 3507* deleted: lexer_proc: actions didnt work, lexer files were not saved: LEXER_SET_*, LEXER_DELETE, LEXER_IMPORT 3508* add: dlg_proc: control "listview" on_select returns "data" param with 2-tuple 3509 35101.0.188 (app 1.13.0) 3511* add: imagelist_proc() 3512* add: tree_proc: TREE_GET_IMAGELIST 3513* add: toolbar_proc: TOOLBAR_GET_IMAGELIST 3514* add: lexer_proc: LEXER_GET_LEXERS 3515* deprecated: tree_proc: TREE_ICON_ADD, TREE_ICON_DELETE, TREE_ICON_GET_SIZES, TREE_ICON_SET_SIZES 3516* deprecated: toolbar_proc: TOOLBAR_GET_ICON_SIZES, TOOLBAR_SET_ICON_SIZES, TOOLBAR_ADD_ICON 3517* deprecated: lexer_proc: LEXER_GET_LIST 3518 35191.0.189 (app 1.13.1) 3520* add: tree_proc: TREE_ITEM_SHOW 3521 35221.0.190 (app 1.14.0) 3523* add: app_proc: PROC_GET_TAB_IMAGELIST 3524* add: ed.get_prop/ed.set_prop: PROP_TAB_ICON 3525* add: imagelist_proc: IMAGELIST_PAINT 3526 35271.0.191 (app 1.14.2) 3528* add: dlg_proc: form property "border" 3529* add: dlg_proc: control type "button_ex" 3530* add: button_proc() to work with "button_ex" 3531 35321.0.192 (app 1.14.8) 3533* add: dlg_proc: control type "splitter" 3534* add: dlg_proc: control prop "align" 3535* add: dlg_proc: control "listbox_ex" has event "on_draw_item" 3536* add: listbox_proc: actions LISTBOX_GET_ITEM_H, LISTBOX_SET_ITEM_H 3537* add: listbox_proc: actions LISTBOX_GET_DRAWN, LISTBOX_SET_DRAWN 3538* add: event on_paste 3539* deleted deprecated: event on_panel 3540* deleted deprecated: menu_proc spec strings: "recents", "enc", "langs", "lexers", "plugins", "themes-ui", "themes-syntax" 3541 35421.0.193 (app 1.15.0) 3543* add: image_proc() 3544* deleted: canvas_proc actions: CANVAS_IMAGE, CANVAS_IMAGE_SIZED (use image_proc instead) 3545* add: dlg_menu can have argument of type list/tuple 3546* add: dlg_menu can have argument "caption" 3547 35481.0.194 (app 1.15.4) 3549* add: app_proc: PROC_SIDEPANEL_ACTIVATE has 2nd param 3550* add: menu_proc: MENU_GET_PROP 3551* add: menu_proc: MENU_SET_CAPTION 3552* add: menu_proc: MENU_SET_VISIBLE 3553* add: menu_proc: MENU_SET_ENABLED 3554* add: menu_proc: MENU_SET_CHECKED 3555* add: menu_proc: MENU_SET_RADIOITEM 3556* add: menu_proc: MENU_SET_HOTKEY 3557* add: tree_proc: TREE_ITEM_GET_PROPS 3558* deprecated: tree_proc: TREE_ITEM_GET_PROP, TREE_ITEM_GET_PARENT 3559 35601.0.195 (app 1.15.5) 3561* add: dlg_proc: control prop "border" 3562* add: dlg_proc: control "linklabel" uses "on_click" (after opening URL if it's valid) 3563 35641.0.196 (app 1.16.2) 3565* add: ed.dim() 3566 35671.0.197 (app 1.17.2) 3568* add: dlg_proc: type "editor" 3569* add: object ed_goto 3570* add: objects ed_con_log, ed_con_in 3571* add: events: on_goto_enter, on_goto_change, on_goto_caret, on_goto_key, on_goto_key_up 3572* add: ed.get_prop/set_prop: PROP_ONE_LINE 3573* add: ed.get_prop/set_prop: PROP_LINE_NUMBERS 3574 35751.0.198 (app 1.18.0) 3576* add: constants WRAP_nnn 3577* add: ed.set_prop works for PROP_LINE_STATE 3578 35791.0.199 (app 1.19.2) 3580* add: toolbar_proc: TOOLBAR_GET_VERTICAL, TOOLBAR_SET_VERTICAL 3581* add: toolbar_proc: TOOLBAR_GET_WRAP, TOOLBAR_SET_WRAP 3582* deleted deprecated: TOOLBAR_GET_ICON_SIZES, TOOLBAR_SET_ICON_SIZES, TOOLBAR_ADD_ICON 3583* deleted deprecated: TREE_ITEM_GET_PROP, TREE_ITEM_GET_PARENT 3584* deleted deprecated: TREE_ICON_ADD, TREE_ICON_DELETE, TREE_ICON_GET_SIZES, TREE_ICON_SET_SIZES 3585* deleted deprecated: LEXER_GET_LIST, LEXER_GET_EXT, LEXER_GET_ENABLED, LEXER_GET_COMMENT, LEXER_GET_COMMENT_STREAM, LEXER_GET_COMMENT_LINED, LEXER_GET_LINKS, LEXER_GET_STYLES, LEXER_GET_STYLES_COMMENTS, LEXER_GET_STYLES_STRINGS 3586 35871.0.200 (app 1.20.2) 3588* add: event on_insert 3589 35901.0.201 (app 1.21.0) 3591* add: several commands in cudatext_cmd.py: simple word jump, goto abs line begin/end 3592 35931.0.202 (app 1.23.0) 3594* add: file_open: can open preview-tab 3595* add: file_open: can open file ignoring history 3596* change: renamed file_open param "args" to "options" 3597 35981.0.203 (app 1.23.4) 3599* add: event on_scroll 3600* add: event on_group 3601* add: file_open: options can have "/noevent" 3602 36031.0.204 (app 1.23.5) 3604* add: ed.get_wrapinfo() 3605* add: ed.get_prop/ed.set_prop: PROP_SCROLL_VERT, PROP_SCROLL_HORZ 3606* add: ed.export_html() 3607* deleted: ed.set_prop: PROP_EXPORT_HTML 3608 36091.0.205 (app 1.24.1) 3610* add: dlg_proc: ctl "edit" supports "on_change" (if "act":True) 3611 36121.0.206 (app 1.24.2) 3613* add: dlg_proc: added ctl property "focused" 3614* add: dlg_proc: added form events "on_act", "on_deact" 3615 36161.0.207 (app 1.25.1) 3617* add: app_proc: PROC_GET_COMMANDS 3618 36191.0.208 (app 1.26.2) 3620* add: lexer_proc supports lite lexers too (their names have " ^" suffix) 3621 36221.0.208 (app 1.27.2) 3623* add: menu_proc: added MENU_SET_IMAGELIST, MENU_SET_IMAGEINDEX 3624* add: file_open: for zip files, returns True if zip installation completed 3625 36261.0.210 (app 1.29.0) 3627* add: file_open: for binary viewer, pass options='/binary' 3628* add: ed.get_prop/set_prop: PROP_KIND, PROP_V_MODE, PROP_V_POS, PROP_V_SEL_START, PROP_V_SEL_LEN 3629 36301.0.211 (app 1.32.0) 3631* add: statusbar_proc() 3632* add: dlg_proc: added type "statusbar" 3633* add: toolbar_proc: TOOLBAR_UPDATE 3634 36351.0.212 (app 1.32.2) 3636* add: toolbar_proc: TOOLBAR_GET_COUNT 3637* add: toolbar_proc: TOOLBAR_GET_BUTTON_HANDLE 3638* add: button_proc: BTN_GET_TEXT, BTN_SET_TEXT 3639* add: button_proc: BTN_GET_ENABLED, BTN_SET_ENABLED 3640* add: button_proc: BTN_GET_VISIBLE, BTN_SET_VISIBLE 3641* add: button_proc: BTN_GET_HINT, BTN_SET_HINT 3642* add: button_proc: BTN_GET_DATA1, BTN_SET_DATA1, BTN_GET_DATA2, BTN_SET_DATA2 3643* change: toolbar_proc: TOOLBAR_ENUM returns int value of "kind", before it was str 3644* deprecated: TOOLBAR_GET_CHECKED, TOOLBAR_SET_CHECKED - now use TOOLBAR_GET_BUTTON_HANDLE + button_proc() 3645* deprecated: PROC_GET_COMMAND, PROC_GET_COMMAND_INITIAL, PROC_GET_COMMAND_PLUGIN - now use PROC_GET_COMMANDS instead 3646 36471.0.213 (app 1.32.3) 3648* add: button_proc: BTN_GET_MENU, BTN_SET_MENU 3649* add: button_proc: BTN_GET_ARROW, BTN_SET_ARROW 3650* add: button_proc: BTN_GET_FOCUSABLE, BTN_SET_FOCUSABLE 3651* add: button_proc: BTN_GET_FLAT, BTN_SET_FLAT 3652* add: toolbar_proc: TOOLBAR_ADD_ITEM, TOOLBAR_ADD_MENU 3653* deprecated: toolbar_proc: TOOLBAR_ADD_BUTTON - now use TOOLBAR_ADD_ITEM/TOOLBAR_ADD_MENU + button_proc() 3654* deprecated: toolbar_proc: TOOLBAR_SET_BUTTON - now use TOOLBAR_GET_BUTTON_HANDLE + button_proc() 3655* deprecated: toolbar_proc: TOOLBAR_ENUM - now use TOOLBAR_GET_COUNT + TOOLBAR_GET_BUTTON_HANDLE + button_proc() 3656 36571.0.214 (app 1.32.4) 3658* add: button_proc supports callable param "value" 3659 36601.0.215 (app 1.34.1) 3661* add: dlg_proc: DLG_CTL_PROP_GET returns key "items" for controls "listview", "checklistview", "listbox", "checklistbox" 3662 36631.0.216 (app 1.34.2) 3664* add: statusbar_proc: STATUSBAR_GET_CELL_AUTOSIZE, STATUSBAR_SET_CELL_AUTOSIZE 3665* add: statusbar_proc: STATUSBAR_GET_CELL_AUTOSTRETCH, STATUSBAR_SET_CELL_AUTOSTRETCH 3666* add: statusbar_proc: 10 actions to get/set colors, STATUSBAR_GET/SET_COLOR_* 3667* deleted: STATUSBAR_GET_COLOR_BORDER, STATUSBAR_SET_COLOR_BORDER 3668* deleted: STATUSBAR_AUTOSIZE_CELL - now use STATUSBAR_SET_CELL_AUTOSTRETCH 3669 36701.0.217 (app 1.34.4) 3671* add: button_proc: const BTNKIND_TEXT_CHOICE 3672* add: button_proc: BTN_GET_WIDTH, BTN_SET_WIDTH 3673* add: button_proc: BTN_GET_ITEMS, BTN_SET_ITEMS 3674* add: button_proc: BTN_GET_ITEMINDEX, BTN_SET_ITEMINDEX 3675* add: button_proc: BTN_GET_ARROW_ALIGN, BTN_SET_ARROW_ALIGN 3676* add: button_proc: BTN_UPDATE 3677 36781.0.218 (app 1.38.0) 3679* add: Editor.hotspots() 3680* add: event on_hotspot 3681* add: app_proc: PROC_GET_MOUSE_POS 3682* add: dlg_proc: DLG_PROP_SET supports prop "p" (parent of form) 3683* add: Editor.convert: CONVERT_SCREEN_TO_LOCAL, CONVERT_LOCAL_TO_SCREEN 3684* add: Editor.convert: CONVERT_PIXELS_TO_CARET, CONVERT_CARET_TO_PIXELS 3685* add: Editor.markers: MARKERS_DELETE_BY_TAG 3686* add: Editor.get_prop: PROP_CELL_SIZE 3687 36881.0.219 (app 1.38.1) 3689* add: app_proc: PROC_THEME_UI_DATA_GET 3690* add: app_proc: PROC_THEME_SYNTAX_DATA_GET 3691 36921.0.220 (app 1.38.2) 3693* add: on_state event aslo called with new constants APPSTATE_nnnn 3694 36951.0.221 (app 1.38.3) 3696* add: Editor.get_prop/set_prop: PROP_INDENT_SIZE, PROP_INDENT_KEEP_ALIGN, PROP_INDENT_AUTO, PROP_INDENT_KIND 3697 36981.0.222 (app 1.38.5) 3699* add: dlg_proc: form events "on_mouse_enter", "on_mouse_exit" 3700* add: dlg_proc: form events "on_show", "on_hide" 3701* add: dlg_proc: control events "on_mouse_enter", "on_mouse_exit", "on_mouse_down", "on_mouse_up" 3702 37031.0.223 (app 1.39.1) 3704* add: install.inf supports param [info] os=, value is comma separated strings: win, linux, macos 3705* add: menu_proc: support for spec menu id "_oplugins" 3706 37071.0.224 (app 1.39.5) 3708* add: dlg_proc: control prop "ex" 3709* deprecated: dlg_proc/dlg_custom prop "props" - now use "ex0"..."ex9" 3710* deprecated: BOOKMARK_CLEAR_HINTS 3711 37121.0.225 (app 1.40.0) 3713* add: app_proc: PROC_SEND_MESSAGE 3714 37151.0.226 (app 1.40.1) 3716* add: app_proc: PROC_GET_CODETREE 3717* add: Editor.get_prop/set_prop: PROP_CODETREE 3718* add: tree_proc: TREE_ITEM_GET_RANGE, TREE_ITEM_SET_RANGE 3719* deprecated: tree_proc: TREE_ITEM_GET_SYNTAX_RANGE 3720* change: changed Code-Tree button caption from "Tree" to "Code tree" 3721 37221.0.227 (app 1.40.2) 3723* add: file_open: added options "/passive", "/nonear" 3724 37251.0.228 (app 1.40.7) 3726* add: event on_tab_change 3727 37281.0.229 (app 1.43.0) 3729* add: plugins can force show sidebar button, even if they don't run on start. New install.inf sections [sidebar1] .. [sidebar3]. Examples: ProjectManager, TabsList. 3730 37311.0.230 (app 1.44.0) 3732* add: dlg_proc: control "listview"/"checklistview" has event "on_click_header" 3733* add: install.inf: allow os= values with bitness: win32, win64, linux32, linux64, freebsd32, freebsd64 3734* deleted deprecated: PROC_GET_COMMAND 3735* deleted deprecated: PROC_GET_COMMAND_INITIAL 3736* deleted deprecated: PROC_GET_COMMAND_PLUGIN 3737 37381.0.231 (app 1.45.5) 3739* add: dlg_proc: control "listview" has prop "columns" 3740* removed: on_group; on_state(..., APPSTATE_GROUPS) called instead 3741 37421.0.232 (app 1.46.2) 3743* add: dlg_proc: control "radiogroup" has prop "columns" 3744* add: dlg_proc: control "radiogroup" has prop "ex0" 3745* add: Editor.get_prop/set_prop: PROP_GUTTER_ALL, PROP_GUTTER_STATES 3746 37471.0.233 (app 1.47.0) 3748* add: dlg_menu: option MENU_NO_FUZZY 3749* add: dlg_menu: option MENU_NO_FULLFILTER 3750 37511.0.233 (app 1.47.1) 3752* add: app_proc: PROC_GET_GUI_HEIGHT supports name "scrollbar" 3753 37541.0.234 (app 1.47.5) 3755* add: event on_exit 3756* add: ed.get_prop/set_prop: PROP_UNPRINTED_SPACES_TRAILING 3757* add: ed.get_prop/set_prop: PROP_LAST_LINE_ON_TOP 3758* add: ed.get_prop/set_prop: PROP_HILITE_CUR_COL 3759* add: ed.get_prop/set_prop: PROP_HILITE_CUR_LINE 3760* add: ed.get_prop/set_prop: PROP_HILITE_CUR_LINE_MINIMAL 3761* add: ed.get_prop/set_prop: PROP_HILITE_CUR_LINE_IF_FOCUS 3762* add: ed.get_prop/set_prop: PROP_MODERN_SCROLLBAR 3763 37641.0.235 (app 1.48.2) 3765* add: support for "lazy events" 3766* add: event on_console_print 3767* add: lexer_proc: LEXER_REREAD_LIB 3768 37691.0.236 (app 1.48.3) 3770* add: dlg_proc: controls have props "w_min/w_max/h_min/h_max", like forms 3771* fix: bug in dlg_proc/dlg_custom: controls with changed parent become not findable by name/index (and count of controls becomes smaller) 3772 37731.0.237 (app 1.49.1) 3774* add: statusbar_proc: STATUSBAR_GET_CELL_HINT, STATUSBAR_SET_CELL_HINT 3775 37761.0.238 (app 1.49.5) 3777* add: dlg_proc/dlg_custom: controls have prop "font_style" 3778* add: file_open: options "/view-text", "/view-binary", "/view-hex", "/view-unicode" 3779* change: file_open: deleted option "/binary" 3780 37811.0.239 (app 1.51.2) 3782* add: event on_mouse_stop 3783 37841.0.240 (app 1.52.1) 3785* add: ed.bookmark: BOOKMARK_SET can specify "delete bookmark on deleting line" 3786* deleted deprecated: BOOKMARK_CLEAR_HINTS 3787* deleted deprecated: TREE_ITEM_GET_SYNTAX_RANGE 3788 37891.0.242 (app 1.53.6) 3790* add/change: dlg_proc: form property "border" is now enum, with DBORDER_nnn values 3791* deprecated: dlg_proc: form property "resize" 3792* deleted deprecated: TOOLBAR_SET_BUTTON, TOOLBAR_ADD_BUTTON, TOOLBAR_ENUM, TOOLBAR_GET_CHECKED, TOOLBAR_SET_CHECKED 3793 37941.0.243 (app 1.55.0) 3795* add: event on_click_gutter 3796* deleted: events on_goto_enter, on_goto_change, on_goto_caret, on_goto_key, on_goto_key_up 3797* add: additional group indexes 6..8 for floating groups 3798* add: app_proc: PROC_SHOW_FLOATGROUP1_GET, PROC_SHOW_FLOATGROUP1_SET 3799* add: app_proc: PROC_SHOW_FLOATGROUP2_GET, PROC_SHOW_FLOATGROUP2_SET 3800* add: app_proc: PROC_SHOW_FLOATGROUP3_GET, PROC_SHOW_FLOATGROUP3_SET 3801* add: app_proc: PROC_FLOAT_SIDE_GET, PROC_FLOAT_SIDE_SET 3802* add: app_proc: PROC_FLOAT_BOTTOM_GET, PROC_FLOAT_BOTTOM_SET 3803 38041.0.244 (app 1.55.1) 3805* deleted: object ed_goto 3806 38071.0.245 (app 1.55.3) 3808* add: Editor.get_prop/set_prop: PROP_CARET_STOP_UNFOCUSED 3809* add: addon can require other addon(s) via install.inf: [info] req=cuda_aa,cuda_bb 3810 38111.0.246 (app 1.56.1) 3812* add: dlg_proc: controls have prop "autosize" 3813* add: dlg_proc: added events for control "editor": on_change, on_caret, on_scroll, on_key_down, on_key_up, on_click_gutter, on_click_gap, on_paste 3814* add: addon can require lexer(s) via install.inf: [info] reqlexer=Name1,Name2 3815 38161.0.247 (app 1.56.3) 3817* add: event on_close_pre 3818* add: ed.get_prop/set_prop: PROP_FOLD_ALWAYS 3819* add: ed.get_prop/set_prop: PROP_FOLD_ICONS 3820* add: ed.get_prop/set_prop: PROP_FOLD_TOOLTIP_SHOW 3821 38221.0.248 (app 1.56.6) 3823* add: app_proc: PROC_GET_FINDER_PROP 3824* add: app_proc: PROC_SET_FINDER_PROP 3825* deprecated: app_proc: PROC_GET_FIND_OPTIONS 3826* deprecated: app_proc: PROC_SET_FIND_OPTIONS 3827* deprecated: app_proc: PROC_GET_FIND_STRINGS 3828 38291.0.249 (app 1.57.5) 3830* add: dlg_proc: control "pages" supports prop "val" 3831* add: dlg_proc: control event "on_menu" can return False to disable default menu 3832* add: Editor.get_token: TOKEN_LIST, TOKEN_LIST_SUB 3833* add: Editor.get_token: index params are optional now 3834* deprecated: Editor.get_token: TOKEN_AT_POS, TOKEN_INDEX (now use TOKEN_LIST, TOKEN_LIST_SUB) 3835 38361.0.250 (app 1.57.7) 3837* add: event "on_open_none" 3838* add: dlg_proc: event "on_menu" has filled param "data" like in "on_mouse_down" 3839 38401.0.251 (app 1.57.8) 3841* add: Editor.get_prop: PROP_ACTIVATION_TIME 3842 38431.0.252 (app 1.58.1) 3844* add: app_log: added optional param "panel" 3845* add: Editor.bookmark: added 3 optional params: "auto_del", "show", "tag" 3846* add: Editor.bookmark: BOOKMARK_GET_ALL 3847* add: Editor.bookmark: BOOKMARK_GET_PROP 3848* add: Editor.bookmark: BOOKMARK_DELETE_BY_TAG 3849* change: Editor.bookmark: BOOKMARK_SET sets flag "delete on deleting line" from new param "auto_del" now (before: from "ncolor=1") 3850* change: on_change/on_change_slow now isn't called on file opening 3851* deprecated: app_log: LOG_SET_PANEL (now use parameter "panel") 3852* deprecated: Editor.bookmark: BOOKMARK_GET (now use BOOKMARK_GET_PROP) 3853 38541.0.253 (app 1.59.0) 3855* add: Editor.attr: added optional param "show_on_map" 3856* add: Editor.get_prop(PROP_ACTIVATION_TIME) is 0 for not yet focused tabs 3857* add: app_proc: PROC_BOTTOMPANEL_ACTIVATE now handles tuple like PROC_SIDEPANEL_ACTIVATE 3858 38591.0.254 (app 1.60.1) 3860* add: event on_tab_switch 3861 38621.0.255 (app 1.60.5) 3863* add: module cudax_nodejs 3864* add: menu_proc: support menu id "tab" 3865* add: menu_proc: MENU_REMOVE 3866* add: Editor.folding: FOLDING_FOLD_ALL 3867* add: Editor.folding: FOLDING_FOLD_LEVEL 3868* add: Editor.folding: FOLDING_UNFOLD_ALL 3869* add: Editor.folding: FOLDING_UNFOLD_LINE 3870 38711.0.256 (app 1.60.7) 3872* add: Editor.decor() 3873 38741.0.257 (app 1.62.0) 3875* deleted deprecated: TOKEN_AT_POS, TOKEN_INDEX (now use TOKEN_LIST, TOKEN_LIST_SUB) 3876* deleted deprecated: BOOKMARK_GET (now use BOOKMARK_GET_PROP) 3877* deleted deprecated: LOG_SET_PANEL (now use parameter "panel") 3878 38791.0.258 (app 1.62.5) 3880* deleted deprecated: PROC_GET_FIND_OPTIONS, PROC_GET_FIND_STRINGS (now use PROC_GET_FINDER_PROP) 3881* deleted deprecated: PROC_SET_FIND_OPTIONS (now use PROC_SET_FINDER_PROP) 3882 38831.0.259 (app 1.63.5) 3884* add: Editor.get_prop/set_prop: PROP_SAVE_HISTORY 3885* add: Editor.get_prop/set_prop: PROP_PREVIEW 3886 38871.0.260 (app 1.63.6) 3888* deleted event "on_console" 3889* deleted event "on_console_print" 3890 38911.0.261 (app 1.64.2) 3892* add: event on_goto_enter 3893* add: Editor.get_prop/set_prop: PROP_CARET_VIEW, PROP_CARET_VIEW_OVR, PROP_CARET_VIEW_RO 3894* deleted: Editor.get_prop/set_prop: PROP_CARET_SHAPE, PROP_CARET_SHAPE_OVR, PROP_CARET_SHAPE_RO 3895 38961.0.262 (app 1.64.4) 3897* add: ini_proc() 3898* add: app_proc: PROC_GET_KEYSTATE returns also state of pressed mouse buttons 3899 39001.0.263 (app 1.65.6) 3901* add: event on_lexer_parsed 3902 39031.0.264 (app 1.66.7) 3904* add: app_proc: PROC_SHOW_TREEFILTER_GET, _SET 3905* add: Editor.get_prop/set_prop: PROP_UNDO_GROUPED 3906* add: Editor.get_prop/set_prop: PROP_UNDO_LIMIT 3907 39081.0.265 (app 1.66.9) 3909* add: Editor.get_prop/set_prop: PROP_UNDO_DATA 3910* add: Editor.get_prop/set_prop: PROP_REDO_DATA 3911* add: Editor.folding: FOLDING_GET_LIST_FILTERED 3912 39131.0.266 (app 1.67.0) 3914* add: dlg_commands: add COMMANDS_CENTERED 3915* add: dlg_commands: add "title" param 3916 39171.0.267 (app 1.70.3) 3918* add: on_state: add APPSTATE_CONFIG_REREAD 3919* add: on_state: add APPSTATE_SESSION_LOAD 3920 39211.0.268 (app 1.71.5) 3922* add: event on_save_naming 3923 39241.0.269 (app 1.71.6) 3925* add: Editor.gap: allowed gap before the first line (line index = -1) 3926* add: file_open: options "/nontext-view-text", "/nontext-view-binary", "/nontext-view-hex", "/nontext-view-unicode", "/nontext-cancel" 3927* add: file_open: options "/nozip", "/nopictures" 3928 39291.0.270 (app 1.72.1) 3930* add: app_proc: PROC_WINDOW_TOPMOST_GET, PROC_WINDOW_TOPMOST_SET 3931 39321.0.271 (app 1.73.1) 3933* add: Editor.bookmark: added actions BOOKMARK2_* 3934 39351.0.272 (app 1.74.0) 3936* add: file_open: can open 2 files in a single tab 3937* add: Editor.get_prop/set_prop: PROP_EDITORS_LINKED 3938* add: Editor.get_prop/set_prop: PROP_SPLIT 3939* add: Editor.get_prop: PROP_HANDLE_SELF, PROP_HANDLE_PRIMARY, PROP_HANDLE_SECONDARY 3940* add: Editor.get_prop: PROP_RECT_CLIENT, PROP_RECT_TEXT 3941* change: deleted object "ed_bro" 3942* deprecated: file_save(); use ed.save() instead 3943* deprecated: Editor.get_split, Editor.set_split; use PROP_SPLIT instead 3944 39451.0.273 (app 1.74.1) 3946* add: Editor.gap: added params "size", "color" 3947* add: app_proc: PROC_SIDEPANEL_GET 3948* add: app_proc: PROC_BOTTOMPANEL_GET 3949 39501.0.274 (app 1.74.7) 3951* deleted deprecated: file_save() 3952* deleted deprecated: Editor.get_split, Editor.set_split 3953* add: Editor.gap: no limit for gap height 3954 39551.0.275 (app 1.76.0) 3956* add: Editor.get_text_line has optional param "max_len" 3957* add: dlg_menu: added MENU_CENTERED 3958 39591.0.276 (app 1.76.6) 3960* add: dlg_proc: form has property "p" (handle of parent form) 3961 39621.0.277 (app 1.77.2) 3963* change: dlg_proc: "memo" value must encode tab as chr(3) now (was chr(2)) 3964* add: get_prop: PROP_CODETREE_MODIFIED_VERSION 3965 39661.0.278 (app 1.77.4) 3967* add: Editor.get_prop/set_prop: PROP_SAVING_FORCE_FINAL_EOL 3968* add: Editor.get_prop/set_prop: PROP_SAVING_TRIM_SPACES 3969* add: Editor.get_prop/set_prop: PROP_SAVING_TRIM_FINAL_EMPTY_LINES 3970 39711.0.279 (app 1.77.6) 3972* add: app_proc: PROC_CONFIG_READ 3973* add: app_proc: PROC_CONFIG_NEWDOC_EOL_GET 3974* add: app_proc: PROC_CONFIG_NEWDOC_EOL_SET 3975* add: app_proc: PROC_CONFIG_NEWDOC_ENC_GET 3976* add: app_proc: PROC_CONFIG_NEWDOC_ENC_SET 3977 39781.0.280 (app 1.77.6) 3979* add: Editor.get_prop/set_prop: PROP_NEWLINE 3980* deprecated: PROP_EOL 3981 39821.0.281 (app 1.78.5) 3983* add: Editor.get_prop/set_prop: PROP_SCROLL_VERT_SMOOTH, PROP_SCROLL_HORZ_SMOOTH 3984* add: Editor.get_prop: PROP_SCROLL_VERT_INFO, PROP_SCROLL_HORZ_INFO 3985* add: Editor.get_wrapinfo: dict result has additional "initial" field 3986* deprecated: PROP_COLUMN_LEFT; use PROP_SCROLL_HORZ instead 3987 39881.0.282 (app 1.78.6) 3989* add: Editor.get_prop: PROP_LINE_STATES 3990* add: Editor.get_prop: PROP_LINE_STATES_UPDATED 3991* change: PROP_TAG is now stored per Editor object, so primary and secondary editors (in the same tab) have different PROP_TAG values 3992* add: TreeHelper getter can return not "list" type, to not refresh code tree 3993 39941.0.283 (app 1.78.7) 3995* add: Editor.get_prop/set_prop: PROP_ZEBRA 3996 39971.0.284 (app 1.79.0) 3998* add: msg_box_ex() 3999* add: Editor.get_prop/set_prop: COLOR_ID_BorderFocused, COLOR_ID_MinimapTooltipBg, COLOR_ID_MinimapTooltipBorder, COLOR_ID_BlockStapleActive 4000* add: app_proc: ids SPLITTER_G4, SPLITTER_G5 4001 40021.0.285 (app 1.79.1) 4003* add: Editor.gap: GAP_GET_ALL 4004* deprecated: GAP_GET_LIST 4005 40061.0.286 (app 1.79.2) 4007* add: Editor.get_prop: PROP_HANDLE_PARENT 4008* add: const COLOR_DEFAULT 4009 40101.0.287 (app 1.79.3) 4011* add: Editor.set_caret: param "options" 4012* add: Editor.set_caret: CARET_DELETE_INDEX 4013* add: Editor.get_filename: param "options" 4014* add: toolbar_proc: TOOLBAR_GET_BUTTON_HANDLES 4015 40161.0.288 (app 1.81.0) 4017* add: for BOOKMARK_SETUP it's allowed to use COLOR_DEFAULT 4018* change: removed menu id "_langs" 4019* change: removed menu id "_themes-ui" 4020* change: removed menu id "_themes-syntax" 4021 40221.0.289 (app 1.81.2) 4023* add: Editor.action() 4024* deprecated: Editor.lexer_scan() 4025* deprecated: Editor.export_html() 4026 40271.0.290 (app 1.81.3) 4028* add: listbox_proc: LISTBOX_GET_COLUMN_SEP, LISTBOX_SET_COLUMN_SEP 4029* add: listbox_proc: LISTBOX_GET_COLUMNS, LISTBOX_SET_COLUMNS 4030* removed: LISTBOX_THEME 4031* removed: event "on_tab_switch" 4032 40331.0.291 (app 1.83.0) 4034* add: emmet() 4035* add: app_proc: PROC_GET_FINDER_PROP dict has keys for option "Allowed syntax elements" 4036 40371.0.292 (app 1.83.2) 4038* add: Editor.action: EDACTION_UPDATE 4039* add: Editor.action: EDACTION_SHOW_POS 4040 40411.0.293 (app 1.84.2) 4042* removed deprecated: Editor.lexer_scan 4043* removed deprecated: Editor.export_html 4044* removed deprecated: PROP_COLUMN_LEFT 4045* removed deprecated: GAP_GET_LIST 4046* removed deprecated: PROP_EOL 4047* add: install.inf support for data with empty "subdir" 4048* add: install.inf support for "type=cudatext-package" 4049 40501.0.294 (app 1.84.5) 4051* add: timer_proc: behaviour when TIMER_START* restarts existing timer: now action updates old timer's tag to new value 4052 40531.0.295 (app 1.84.6) 4054* change: msg_status_alt now shows floating tooltip on the top (before: was statusbar on the bottom) 4055 40561.0.296 (app 1.85.1) 4057* add: dlg_proc: control property "texthint" 4058 40591.0.297 (app 1.85.1) 4060* add: dlg_dir: param "caption" 4061* add: dlg_file: param "caption" 4062 40631.0.298 (app 1.85.2) 4064* add: dlg_proc: control events "on_focus_enter", "on_focus_exit" 4065 40661.0.299 (app 1.86.0) 4067* change: Windows: embedded Python updated to 3.6 4068* change: Editor.set_text_all now looses Undo information 4069 40701.0.300 (app 1.86.2) 4071* deleted: STATUSBAR_GET_COLOR_FONT, STATUSBAR_SET_COLOR_FONT (other actions allow to get/set it) 4072* add: statusbar_proc: STATUSBAR_SET_CELL_FONT_NAME, STATUSBAR_GET_CELL_FONT_NAME 4073* add: statusbar_proc: STATUSBAR_SET_CELL_FONT_SIZE, STATUSBAR_GET_CELL_FONT_SIZE 4074* add: dlg_proc: DLG_LOCK, DLG_UNLOCK 4075 40761.0.301 (app 1.86.2) 4077* add: lexer_proc: LEXER_GET_STYLES 4078 40791.0.302 (app 1.86.3) 4080* add: app_proc: PROC_THEME_UI_DICT_GET 4081* add: app_proc: PROC_THEME_SYNTAX_DICT_GET 4082* deprecated: PROC_THEME_UI_DATA_GET 4083* deprecated: PROC_THEME_SYNTAX_DATA_GET 4084 40851.0.303 (app 1.87.5) 4086* add: listbox_proc: LISTBOX_GET_SHOW_X, LISTBOX_SET_SHOW_X 4087* add: listbox_proc: LISTBOX_GET_HOTTRACK, LISTBOX_SET_HOTTRACK 4088* add: listbox_proc: LISTBOX_GET_ITEM_PROP, LISTBOX_SET_ITEM_PROP 4089* add: listbox_proc: LISTBOX_ADD returns count of items 4090* add: dlg_proc: control "listbox_ex" has new event "on_click_x" 4091 40921.0.304 (app 1.87.5) 4093* add: listbox_proc: LISTBOX_ADD_PROP 4094 40951.0.305 (app 1.87.6) 4096* add: Editor.markers, Editor.attr: MARKERS_DELETE_BY_INDEX 4097* add: Editor.markers, Editor.attr: list allows "duplicate" items with the same x:y pos; attr list applies all "duplicate" items, left to right 4098 40991.0.306 (app 1.88.2) 4100* change: menu_proc: removed special menu id "_lexers" 4101 41021.0.307 (app 1.88.6) 4103* add: Editor.get_token: add TOKEN_GET_KIND 4104* add: Editor.action: add EDACTION_FIND_BRACKET 4105 41061.0.310 (app 1.88.8) 4107* add: Editor.attr: param "show_on_map" can be int 4108* add: Editor.attr: param "len" can be <0 to paint multiline micromap mark 4109* add: Editor.attr: added param "map_only" 4110* add: Editor.attr: MARKERS_ADD_MANY 4111* change: Editor.attr: added tuple item in MARKERS_GET 4112* add: Editor.action: EDACTION_MICROMAPCOL_GET 4113* add: Editor.action: EDACTION_MICROMAPCOL_ADD 4114* add: Editor.action: EDACTION_MICROMAPCOL_DELETE 4115 41161.0.312 (app 1.89.1) 4117* add: listbox_proc: LISTBOX_GET_SCROLLPOS_HORZ 4118* add: listbox_proc: LISTBOX_SET_SCROLLPOS_HORZ 4119* add: listbox_proc: LISTBOX_GET_SCROLLSTYLE_HORZ 4120* add: listbox_proc: LISTBOX_SET_SCROLLSTYLE_HORZ 4121* add: listbox_proc: LISTBOX_GET_SCROLLSTYLE_VERT 4122* add: listbox_proc: LISTBOX_SET_SCROLLSTYLE_VERT 4123 41241.0.313 (app 1.89.2) 4125* add: Editor.get_prop/set_prop: PROP_SCROLLSTYLE_HORZ, PROP_SCROLLSTYLE_VERT 4126* add: Editor.attr: MARKERS_GET_DICT 4127 41281.0.314 (app 1.89.4) 4129* add: Editor.action: EDACTION_FIND_BRACKETS 4130* deleted: EDACTION_FIND_BRACKET 4131* deleted deprecated: PROC_THEME_UI_DATA_GET 4132* deleted deprecated: PROC_THEME_SYNTAX_DATA_GET 4133 41341.0.315 (app 1.89.6) 4135* add: Editor.get_prop/set_prop: PROP_CODETREE_SUBLEXER 4136* add: dlg_commands: COMMANDS_FILES 4137* add: dlg_commands: COMMANDS_RECENTS 4138 41391.0.316 (app 1.90.0) 4140* add: app_proc: PROC_GET_COMMANDS returns new kinds "openedfile", "recentfile" 4141 41421.0.317 (app 1.91.1) 4143* add: supported encodings UTF-32 (LE and BE, with and without BOM) 4144 41451.0.318 (app 1.92.0) 4146* add: Editor.action: EDACTION_FIND_ONE 4147* add: Editor.action: EDACTION_FIND_ALL 4148 41491.0.319 (app 1.92.5) 4150* removed: menu_proc special constant "_enc" 4151 41521.0.320 (app 1.94.0) 4153* change: event on_state does not support EDSTATE_ values 4154* change: events are now called with ed_self==None: on_state, on_start, on_exit, on_output_nav, on_console_nav 4155* add: event on_state_ed 4156 41571.0.321 (app 1.94.5) 4158* add: events on_open / on_open_pre support filtering via "keys=" in install.inf like on_key 4159 41601.0.322 (app 1.96.2) 4161* add: Editor.action: EDACTION_FIND_ALL supports param3 4162* add: lexer_proc: LEXER_DETECT can give tuple result 4163 41641.0.323 (app 1.97.1) 4165* add: Editor.get_prop/set_prop: PROP_SCALE_FONT 4166 41671.0.324 (app 1.97.2) 4168* add: app_proc: PROC_SET_FOLDER 4169* add: file_open: added option "/nolexerdetect" 4170* add: file_open: added option "/noopenedevent" 4171* add: file_open: added option "/nononeevent" 4172 41731.0.325 (app 1.97.5.2) 4174* add: Editor.get_prop: PROP_IN_SESSION 4175* add: Editor.get_prop: PROP_IN_HISTORY 4176 41771.0.326 (app 1.98.3) 4178* add: dlg_proc: DLG_CTL_PROP_GET returns also the parent info in key "p" 4179 41801.0.327 (app 1.99.5) 4181* add: event "on_click_link" 4182* add: install.inf supports sections "bottombar*" to show button on sidebar near Console/Output, without loading the plugin 4183* change: install.inf supports sections "item*", earlier allowed sections were limited by regex "item\d+" 4184* change: install.inf supports sections "sidebar*", earlier allowed sections were limited by regex "sidebar\d+" 4185* change: install.inf supports sections "treehelper*", earlier allowed sections were limited by regex "treehelper\d+" 4186* add: dlg_proc: control "radiogroup" supports event "on_change" 4187* add: dlg_proc: control "checkgroup" supports event "on_change" 4188 41891.0.328 (app 1.100.5) 4190* change: changed format of string in PROP_UNDO_DATA, PROP_REDO_DATA (field "line state" was inserted in the middle of lines, could not append it to the end) 4191 41921.0.329 (app 1.101.0) 4193* add: event "on_message" 4194 41951.0.330 (app 1.102.2) 4196* add: Editor.get_prop/set_prop: PROP_FONT, PROP_FONT_B, PROP_FONT_I, PROP_FONT_BI 4197* add: Editor.get_prop/set_prop: PROP_ZEBRA_STEP 4198* add: Editor.get_prop/set_prop: PROP_LINKS_SHOW 4199* add: Editor.get_prop/set_prop: PROP_LINKS_REGEX 4200* add: Editor.get_prop/set_prop: PROP_LINKS_CLICKS 4201* add: dlg_proc: editor event "on_click_link" 4202 42031.0.331 (app 1.102.6) 4204* add: Editor.micromap() 4205* change: Editor.action: deleted actions EDACTION_MICROMAPCOL_* 4206* add: constant "cudatext.API", which will replace "cudatext.app_api_version" later 4207 42081.0.332 (app 1.102.7) 4209* add: lexer_proc: LEXER_ADD_VIRTUAL 4210* add: finder options as string (several APIs): support also "b" for backward search 4211* add: Editor.action: EDACTION_REPLACE_ONE 4212 42131.0.333 (app 1.103.2) 4214* add: Editor.action: EDACTION_REPLACE_ALL 4215 42161.0.334 (app 1.104.1) 4217* add: dlg_menu: params "clip", "w", "h" 4218* add: dlg_commands: COMMANDS_CONFIG_LEXER 4219 42201.0.335 (app 1.104.5) 4221* add: dlg_commands: params "w", "h" 4222* add: support encodings "koi8r", "koi8u", "koi8ru" 4223 42241.0.336 (app 1.105.1) 4225* add: Editor.set_prop: PROP_ENC_RELOAD 4226 42271.0.337 (app 1.105.1) 4228* fix: lexer_proc: LEXER_GET_PROP didn't return "sub" key 4229* add: lexer_proc: LEXER_GET_PROP returns new "kinds" key 4230* add: Editor.get_token: TOKEN_LIST_ALT 4231 42321.0.338 (app 1.105.2) 4233* add: msg_box_ex: added param "focused" 4234 42351.0.339 (app 1.105.3) 4236* deleted: Editor.get_token: TOKEN_LIST_ALT 4237* add: Editor.get_token: TOKEN_LIST* return additional keys "ki", "ks" 4238* add: lexer_proc: LEXER_GET_STYLES returns additional key "tkind" 4239 42401.0.340 (app 1.105.3) 4241* add: Editor.get_prop/set_prop: PROP_V_WIDTH_HEX, PROP_V_WIDTH_UHEX 4242* add: Editor.set_prop: setting PROP_V_MODE for usual editor switches editor to viewer, with given mode 4243* add: Editor.get_prop/set_prop: can switch from viewer to editor using new value VMODE_NONE 4244 42451.0.341 (app 1.105.6) 4246* add: Editor.action: EDACTION_UPDATE handles "param1" 4247 42481.0.342 (app 1.106.1) 4249* add: support loading plugin events also from settings/plugins.ini [events] cuda_modulename=comma_separated_events 4250* change: Editor.action: EDACTION_FIND* and EDACTION_REPLACE* return False for incorrect RegEx 4251* add: Editor.set_prop: PROP_PREVIEW is writable now 4252 42531.0.343 (app 1.106.8) 4254* add: app_proc: PROC_CONFIG_SCALE_GET, PROC_CONFIG_SCALE_SET 4255* add: finder_proc() 4256 42571.0.344 (app 1.106.8) 4258* add: dlg_proc: controls "editor_edit", "editor_combo" 4259* add: Editor.get_prop/set_prop: PROP_COMBO_ITEMS 4260 42611.0.345 (app 1.107.0) 4262* add: override Python's builtins.input() with CudaText implementation 4263 42641.0.346 (app 1.107.2) 4265* add: dlg_menu: option MENU_EDITORFONT 4266 42671.0.347 (app 1.107.6) 4268* add: app_proc: PROC_GET_FINDER_PROP/PROC_SET_FINDER_PROP support new keys: "find_h", "rep_h" 4269 42701.0.348 (app 1.108.0) 4271* add: Editor.action: EDACTION_UNDOGROUP_BEGIN, EDACTION_UNDOGROUP_END 4272 42731.0.349 (app 1.108.6) 4274* add: dlg_proc: DLG_POS_GET_STR, DLG_POS_SET_FROM_STR 4275 42761.0.350 (app 1.110.0) 4277* add: toolbar_proc: actions TOOLBAR_ADD_ITEM, TOOLBAR_ADD_MENU return handle of new button 4278* change: Editor.complete: "tooltip" line part is now shown only in tooltip, but not in listbox 4279* add: Editor.complete: "tooltip" line part can be multi-line, separator is chr(2) 4280 42811.0.351 (app 1.114.0) 4282* add: event on_app_activate 4283* add: event on_app_deactivate 4284 42851.0.352 (app 1.115.6) 4286* add: app_path: APP_DIR_SETTINGS_DEF 4287* add: file_open: added possible option "/nontext-view-uhex" 4288 42891.0.353 (app 1.115.7) 4290* add: Editor.markers: add param "line_len" 4291* add: Editor.markers: MARKERS_GET_DICT 4292 42931.0.354 (app 1.117.2) 4294* add: Editor.bookmark: BOOKMARK_GET_ALL gets additional dict key "auto_delx" 4295 42961.0.355 (app 1.119.5) 4297* change: Editor.attr: change param 'map_only' type from bool to int (enum) 4298 42991.0.357 (app 1.121.4) 4300* add: statusbar_proc: STATUSBAR_SET_CELL_CALLBACK, STATUSBAR_GET_CELL_CALLBACK 4301* add: app_proc: PROC_GET_UNIQUE_TAG 4302 43031.0.358 (app 1.123.0) 4304* add: dlg_proc: added props for control "listview": "imagelist_small", "imagelist_large", "imageindexes" 4305* add: tree_proc: added param "data" for TREE_ITEM_ADD 4306* add: tree_proc: added result key "data" for TREE_ITEM_GET_PROPS 4307* add: tree_proc: added TREE_ITEM_ENUM_EX 4308 43091.0.360 (app 1.123.0) 4310* add: dlg_proc: controls "tabs"/"pages" give property "tab_hovered" 4311* add: dlg_proc: control "pages" gives property "ex0" for tab-position 4312* change: dlg_proc: control "tabs" gives prop "ex0" with 4 values '0'..'3', previously it was bool '0'/'1' 4313* add: toolbar_proc: add TOOLBAR_GET_INDEX_HOVERED 4314 43151.0.362 (app 1.123.2) 4316* add: dlg_proc: DLG_PROP_GET returns also events, if they are set: 'on_close', 'on_close_query', 'on_key_down', 'on_key_up', 'on_resize', 'on_mouse_enter', 'on_mouse_exit', 'on_show', 'on_hide' 4317* add: dlg_proc: DLG_CTL_PROP_GET returns also events, if they are set: 'on_change', 'on_click', 'on_click_dbl', 'on_focus_enter', 'on_focus_exit', 'on_menu', 'on_select', 'on_fold', 'on_unfold', 'on_listbox_draw_item', 'on_mouse_enter', 'on_mouse_exit', 'on_mouse_down', 'on_mouse_up', 'on_editor_caret', 'on_editor_scroll', 'on_editor_key_down', 'on_editor_key_up', 'on_editor_click_gutter', 'on_editor_click_gap', 'on_editor_click_link', 'on_editor_paste' 4318* add: app_proc: add PROC_GET_CONSOLE_FORM 4319* deleted: editor objects "ed_con_log", "ed_con_in" 4320 43211.0.364 (app 1.123.5) 4322* change: dlg_menu: make aliases of MENU_* constants to DMENU_*; old MENU_ names are deprecated 4323* add: app_proc: PROC_CLIP_ENUM 4324* add: app_proc: PROC_CLIP_SAVE_PIC 4325 43261.0.365 (app 1.124.1) 4327* add: dlg_proc: property 'tab_hovered' is now returned also for controls 'toolbar', 'statusbar' 4328* add: dlg_proc: DLG_TO_FRONT 4329* add: dlg_proc: DLG_CTL_TO_FRONT, DLG_CTL_TO_BACK 4330* add: Editor.get_prop: PROP_RECT_GUTTER, PROP_RECT_MINIMAP, PROP_RECT_MICROMAP, PROP_RECT_RULER 4331* add: app_proc: PROC_SIDEPANEL_SET_PROP 4332* add: app_proc: PROC_BOTTOMPANEL_SET_PROP 4333* add: app_proc: PROC_SIDEPANEL_GET_IMAGELIST 4334 43351.0.366 (app 1.124.1) 4336* add: app_proc: PROC_SIDEPANEL_ENUM_ALL 4337* add: app_proc: PROC_BOTTOMPANEL_ENUM_ALL 4338* deprecated: app_proc: PROC_SIDEPANEL_ENUM 4339* deprecated: app_proc: PROC_BOTTOMPANEL_ENUM 4340 43411.0.367 (app 1.124.3) 4342* add: Editor.get_prop/set_prop: PROP_FOCUSED 4343* fix: control 'statusbar' crashed with "align" left/right/client 4344 43451.0.368 (app 1.125.0) 4346* add: can compare Editor objects by ==, it will be correct now because tests PROP_HANDLE_SELF values 4347 43481.0.369 (app 1.125.0) 4349* add: statusbar_proc: STATUSBAR_GET_CELL_COLOR_LINE 4350* add: statusbar_proc: STATUSBAR_SET_CELL_COLOR_LINE 4351* add: statusbar_proc: STATUSBAR_GET_CELL_COLOR_LINE2 4352* add: statusbar_proc: STATUSBAR_SET_CELL_COLOR_LINE2 4353* add: statusbar_proc: STATUSBAR_GET_CELL_OVERLAY 4354* add: statusbar_proc: STATUSBAR_SET_CELL_OVERLAY 4355* add: button_proc: BTN_GET_OVERLAY 4356* add: button_proc: BTN_SET_OVERLAY 4357* add: button_proc: BTN_GET_COLOR_LINE 4358* add: button_proc: BTN_SET_COLOR_LINE 4359* add: button_proc: BTN_GET_COLOR_LINE2 4360* add: button_proc: BTN_SET_COLOR_LINE2 4361 43621.0.370 (app 1.128.1) 4363* deleted deprecated API: dlg_proc/dlg_custom "props" - now use "ex0"..."ex9" 4364 43651.0.371 (app 1.128.5) 4366* add: Editor.get_prop/set_prop: PROP_MASKCHAR 4367* add: Editor.get_prop/set_prop: PROP_MASKCHAR_USED 4368 43691.0.372 (app 1.128.5) 4370* add: Editor.get_prop/set_prop: PROP_NUMBERS_ONLY 4371* add: Editor.get_prop/set_prop: PROP_NUMBERS_NEGATIVE 4372 43731.0.373 (app 1.129.4) 4374* change: timer_proc: minimal interval is now 10 msec 4375* change: timer_proc: specifying interval<10 will run timer with value 10 4376 43771.0.374 (app 1.129.7) 4378* change: Editor.get_carets() returns [] if no items 4379* change: Editor.markers(MARKERS_GET) returns [] if no items 4380* change: Editor.attr(MARKERS_GET) returns [] if no items 4381 43821.0.375 (app 1.129.8) 4383* add: Editor.get_prop/set_prop: PROP_TAB_PINNED 4384* add: on_state_ed: new flag EDSTATE_PINNED 4385* add: on_state_ed: new flag EDSTATE_READONLY 4386* add: on_state_ed: new flag EDSTATE_WRAP 4387 43881.0.376 (app 1.130.1) 4389* add: on_func_hint() propagation can be stopped by returning True 4390* change: Editor.bookmark returns [] if no items 4391* change: Editor.hotspots returns [] if no items 4392* change: Editor.decor returns [] if no items 4393* change: Editor.get_wrapinfo returns [] if no items 4394* change: Editor.folding returns [] if no items 4395* change: Editor.dim returns [] if no items 4396* change: Editor.gap returns [] if no items 4397 43981.0.377 (app 1.130.5) 4399* change: changed values of cCommand_MoveSelection* commands 4400 44011.0.379 (app 1.131.0) 4402* add: file_open: added option "/noloadundo" 4403* add: app_proc: PROC_GET_OUTPUT_FORM 4404* add: app_proc: PROC_GET_VALIDATE_FORM 4405 44061.0.381 (app 1.131.1) 4407* change: app_log: param "tag" is now ignored 4408* add: on_state: add APPSTATE_SESSION_LOAD_BEGIN, APPSTATE_SESSION_LOAD_FAIL 4409 44101.0.383 (app 1.132.0) 4411* add: msg_status_alt: added params "pos", "x", "y" 4412* add: app_proc: PROC_GET_FINDER_PROP/PROC_SET_FINDER_PROP support new key "op_hi_d" 4413 44141.0.385 (app 1.132.0) 4415* add: app_proc: PROC_SET_PROJECT 4416* add: on_state: APPSTATE_PROJECT 4417* add: on_console_nav: also it's called when Console input is changed 4418 44191.0.388 (app 1.132.9) 4420* add: dlg_proc: control "splitter" supports property "color" 4421* add: dlg_proc: control "listbox_ex" supports event "on_click_header" 4422* add: listbox_proc: LISTBOX_GET_HEADER, LISTBOX_SET_HEADER 4423* add: listbox_proc: LISTBOX_GET_HEADER_IMAGELIST, LISTBOX_SET_HEADER_IMAGELIST 4424* add: listbox_proc: LISTBOX_GET_HEADER_IMAGEINDEXES, LISTBOX_SET_HEADER_IMAGEINDEXES 4425* fix: controls "editor_edit" and "editor_combo" didn't support PROP_RO 4426 44271.0.390 (app 1.133.0) 4428* change: listbox_proc: LISTBOX_SET_COLUMNS calcs "percent values" (value<0) after the counting "pixel values" (value>0) 4429* add: dlg_proc: control "listbox_ex" border is themed now 4430* add: app_proc: PROC_GET_OS_SUFFIX 4431 44321.0.391 (app 1.133.1) 4433* add: tree_proc: TREE_ITEM_SELECT with id_item=0 removes the selection 4434 44351.0.392 (app 1.133.2) 4436* add: on_state: add values APPSTATE_CODETREE_* 4437* add: app_proc: PROC_SIDEPANEL_ENUM_ALL/PROC_BOTTOMPANEL_ENUM_ALL gets also button handles 4438 44391.0.393 (app 1.133.6) 4440* add: Editor.gap: add GAP_DELETE_BY_TAG 4441* add: Editor.gap: GAP_ADD can also add the dialog, using its handle 4442 44431.0.394 (app 1.134.1.2) 4444* add: app_proc: PROC_GET_MAIN_TOOLBAR 4445* add: app_proc: PROC_GET_MAIN_STATUSBAR 4446* delete: redundant "API" constant which had the API version (seems no one used it) 4447* deprecate: toolbar_proc() special string handle "top" 4448* deprecate: statusbar_proc() special string handle "main" 4449 44501.0.397 (app 1.135.2) 4451* add: Editor.get_wrapinfo: add optional params to specify lines range 4452* add: Editor.convert: CONVERT_OFFSET_TO_CARET 4453* add: Editor.convert: CONVERT_CARET_TO_OFFSET 4454* add: Editor.get_prop/set_prop: PROP_TAB_UI_SHOW 4455* add: editors in ui-tabs are now placed on a hidden form to support dlg_proc() API, you can get this form's handle via PROP_HANDLE_PARENT 4456 44571.0.398 (app 1.136.1) 4458* add: tree_proc: TREE_FIND_FOR_TEXT_POS 4459 44601.0.399 (app 1.136.2) 4461* add: statusbar_proc: STATUSBAR_GET_PADDING 4462* add: statusbar_proc: STATUSBAR_SET_PADDING 4463 44641.0.401 (app 1.137.1) 4465* add: statusbar_proc: STATUSBAR_GET_SEPARATOR 4466* add: statusbar_proc: STATUSBAR_SET_SEPARATOR 4467* add: statusbar_proc: STATUSBAR_GET_COLOR_BORDER_BOTTOM 4468* add: statusbar_proc: STATUSBAR_SET_COLOR_BORDER_BOTTOM 4469* add: statusbar_proc: STATUSBAR_GET_OVERFLOW_LEFT 4470* add: statusbar_proc: STATUSBAR_SET_OVERFLOW_LEFT 4471* add: statusbar_proc: STATUSBAR_GET_CELL_RECT 4472 44731.0.402 (app 1.137.3) 4474* add: dlg_proc: forms have the "on_form_state" event 4475* add: dlg_proc: forms have additional property "form_state" 4476* deleted deprecated: MENU_LIST, MENU_LIST_ALT, MENU_NO_FUZZY, MENU_NO_FULLFILTER, MENU_CENTERED, MENU_EDITORFONT 4477 44781.0.403 (app 1.137.3) 4479* add: code-tree is compatible with dlg_proc() API, you can get its form handle via app_proc(PROC_SIDEPANEL_GET_CONTROL, 'Code tree') 4480* add: tree_proc: TREE_SET_IMAGELIST 4481* add: file_open: option "/donear" 4482 44831.0.404 (app 1.137.7) 4484* add: forms now have "on_key_press" event 4485 44861.0.405 (app 1.139.0) 4487* add: Editor.action: EDACTION_APPLY_THEME 4488 44891.0.406 (app 1.139.1) 4490* add: on_state_ed is fired with EDSTATE_ZOOM 4491* add: on_state_ed is fired with EDSTATE_BOOKMARK 4492 44931.0.407 (app 1.139.2) 4494* add: Editor.get_prop/set_prop: PROP_THEMED 4495* add: app_proc: PROC_GET_KEYSTATE returns flags for 4th/5th mouse buttons 4496 44971.0.408 (app 1.140.6) 4498* add: Editor.get_prop: PROP_COMMAND_LOG 4499* add: Editor.get_prop/set_prop: PROP_COMMAND_LOG_LIMIT 4500 45011.0.409 (app 1.142.0) 4502* change: auto-completion is allowed in comments, if lexer name has 'HTML' 4503* add: event "on_cli" 4504 45051.0.410 (app 1.142.1) 4506* deprecate: option CARET_OPTION_UNFOLD (it's always On now) 4507* add: event "on_state" is now fired with more states: APPSTATE_API_SUBCOMMANDS, APPSTATE_API_MENU_xxxx 4508 45091.0.411 (app 1.145.1) 4510* add: callbacks (e.g. in toolbar buttons) can have form "exec=command_line_here" 4511* add: app_proc: PROC_PARSE_COMMAND_LINE 4512 45131.0.412 (app 1.146.1) 4514* change: command "macros: start recording" is renamed to "start/stop recording", commands "stop recording" and "cancel recording" are deprecated 4515 45161.0.413 (app 1.148.1) 4517* add: dlg_proc: new control "scrollbox" 4518 45191.0.414 (app 1.149.4) 4520* add: app_proc: PROC_GET_FINDER_PROP/PROC_SET_FINDER_PROP support new keys "op_regex_subst", "op_regex_subst_d" 4521 4522[[Category:CudaText]] 4523