diff --git a/programs/develop/libraries/box_lib/branch/COPYING.TXT b/programs/develop/libraries/box_lib/branch/COPYING.TXT new file mode 100644 index 0000000000..f6213b69c6 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/COPYING.TXT @@ -0,0 +1,347 @@ + + GNU GENERAL PUBLIC LICENSE + + Version 2, June 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + + GNU GENERAL PUBLIC LICENSE + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/programs/develop/libraries/box_lib/branch/bl_sys.mac b/programs/develop/libraries/box_lib/branch/bl_sys.mac new file mode 100644 index 0000000000..5f6093afc1 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/bl_sys.mac @@ -0,0 +1,10 @@ +;include 'editbox.mac' ;macro which should make life easier :) specially for editbox +include 'checkbox.mac' ;macro implements checkbox +;include 'optionbox.mac' ;macro implements optionbox +;include 'scrollbar.mac' ;macro implements scrollbar +;include 'd_button.mac' ;macro implements dinamic_button +;include 'menubar.mac' ;macro implements menubar +;include 'filebrowser.mac' ;macro implements filebrowser +;include 'tree_list.mac' ;macro implements tree_list, image_list, list_box +;include 'pathshow.mac' ;macro implements pathshow +;include 't_edit.mac' ;macro implements text_editor \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/branch/box_lib.asm b/programs/develop/libraries/box_lib/branch/box_lib.asm new file mode 100644 index 0000000000..ce741070d3 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/box_lib.asm @@ -0,0 +1,316 @@ +; Copyright (C) KolibriOS team 2004-2010. All rights reserved. +; Refer to the GNU General Public license (the "GPL") for full details. +; +;***************************************************************************** +; Box_Lib - library of graphical components +; +; Authors: +; Alexey Teplov aka +; Marat Zakiyanov aka Mario79, aka Mario +; Evtikhov Maxim aka Maxxxx32 +; Eugene Grechnikov aka Diamond +; hidnplayr +; Igor Afanasiev aka IgorA +;***************************************************************************** + +format MS COFF + +public EXPORTS + +section '.flat' code readable align 16 +include '../../../../macros.inc' +include '../../../../proc32.inc' +include 'bl_sys.mac' +include 'box_lib.mac' ;macro which should make life easier :) + +;----------------------------------------------------------------------------- +mem.alloc dd ? ;функция для выделения памяти +mem.free dd ? ;функция для освобождения памяти +mem.realloc dd ? ;функция для перераспределения памяти +dll.load dd ? + +;---------------------------------------------------- +;EditBox +;---------------------------------------------------- +align 16 +;use_editbox_draw ;macro reveals the function of the display. +align 16 +;use_editbox_key ;macro reveals processing function of the keypad. +align 16 +;use_editbox_mouse ;macro reveals processing function of the mouse. + +;---------------------------------------------------- +;CheckBox +;---------------------------------------------------- +align 16 +use_checkbox_draw ;macro reveals the function of the display. +align 16 +use_checkbox_mouse ;macro reveals processing function of the mouse. + + +;-------------------------------------------------- +;radiobutton Group +;-------------------------------------------------- +align 16 +;use_optionbox_driver ;macro that control the operating modes +align 16 +;use_optionbox_draw ;macro reveals the function of the display. +align 16 +;use_optionbox_mouse ;macro reveals processing function of the mouse. + +;-------------------------------------------------- +;scrollbar Group +;-------------------------------------------------- +align 16 +;use_scroll_bar +align 16 +;use_scroll_bar_vertical +align 16 +;use_scroll_bar_horizontal + +;-------------------------------------------------- +;dinamic button Group +;-------------------------------------------------- +align 16 +;use_dinamic_button + +;-------------------------------------------------- +;menubar Group +;-------------------------------------------------- +align 16 +;use_menu_bar + +;-------------------------------------------------- +;filebrowser Group +;-------------------------------------------------- +align 16 +;use_file_browser + +;-------------------------------------------------- +;tree list +;-------------------------------------------------- +align 16 +;use_tree_list + +;-------------------------------------------------- +;PathShow Group +;-------------------------------------------------- +align 16 +;use_path_show + +;-------------------------------------------------- +;text editor +;-------------------------------------------------- +align 16 +;use_text_edit + +;input: +; eax = указатель на функцию выделения памяти +; ebx = ... освобождения памяти +; ecx = ... перераспределения памяти +; edx = ... загрузки библиотеки (пока не используется) +align 16 +lib_init: + mov [mem.alloc], eax + mov [mem.free], ebx + mov [mem.realloc], ecx + mov [dll.load], edx +ret + + +align 16 +EXPORTS: + + +dd sz_init, lib_init +dd sz_version, 0x00000001 + +;dd sz_edit_box, edit_box +;dd sz_edit_box_key, edit_box_key +;dd sz_edit_box_mouse, edit_box_mouse +;dd sz_edit_box_set_text, edit_box_set_text +;dd szVersion_ed, 0x00000001 + +dd sz_check_box_draw, check_box_draw +dd sz_check_box_mouse, check_box_mouse +dd szVersion_ch, 0x00000001 + +;dd sz_option_box_draw, option_box_draw +;dd sz_option_box_mouse, option_box_mouse +;dd szVersion_op, 0x00000001 + +;dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw +;dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse +;dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw +;dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse +;dd szVersion_scrollbar, 0x00010001 + +;dd sz_Dbutton_draw, dinamic_button.draw +;dd sz_Dbutton_mouse, dinamic_button.mouse +;dd szVersion_dbutton, 0x00010001 + +;dd sz_Menu_bar_draw, menu_bar.draw +;dd sz_Menu_bar_mouse, menu_bar.mouse +;dd sz_Menu_bar_activate, menu_bar.activate +;dd szVersion_menu_bar, 0x00010002 + +;dd sz_FileBrowser_draw, fb_draw_panel +;dd sz_FileBrowser_mouse, fb_mouse +;dd sz_FileBrowser_key, fb_key +;dd szVersion_FileBrowser, 0x00010001 + +;dd sz_tl_data_init, tl_data_init +;dd sz_tl_data_clear, tl_data_clear +;dd sz_tl_info_clear, tl_info_clear +;dd sz_tl_key, tl_key +;dd sz_tl_mouse, tl_mouse +;dd sz_tl_draw, tl_draw +;dd sz_tl_info_undo, tl_info_undo +;dd sz_tl_info_redo, tl_info_redo +;dd sz_tl_node_add, tl_node_add +;dd sz_tl_node_set_data, tl_node_set_data +;dd sz_tl_node_get_data, tl_node_get_data +;dd sz_tl_node_delete, tl_node_delete +;dd sz_tl_cur_beg, tl_cur_beg +;dd sz_tl_cur_next, tl_cur_next +;dd sz_tl_cur_perv, tl_cur_perv +;dd sz_tl_node_close_open, tl_node_close_open +;dd sz_tl_node_lev_inc, tl_node_lev_inc +;dd sz_tl_node_lev_dec, tl_node_lev_dec +;dd sz_tl_node_move_up, tl_node_move_up +;dd sz_tl_node_move_down, tl_node_move_down +;dd sz_tl_node_poi_get_info, tl_node_poi_get_info +;dd sz_tl_node_poi_get_next_info, tl_node_poi_get_next_info +;dd sz_tl_node_poi_get_data, tl_node_poi_get_data +;dd sz_tl_save_mem, tl_save_mem +;dd sz_tl_load_mem, tl_load_mem +;dd sz_tl_get_mem_size, tl_get_mem_size +;dd sz_tl_version_tree_list, 0x00000001 + +;dd sz_PathShow_prepare, path_show.prepare +;dd sz_PathShow_draw, path_show.draw +;dd szVersion_path_show, 0x00010001 + +;dd sz_ted_but_save_file, ted_but_save_file +;dd sz_ted_but_sumb_upper, ted_but_sumb_upper +;dd sz_ted_but_sumb_lover, ted_but_sumb_lover +;dd sz_ted_can_save, ted_can_save +;dd sz_ted_clear, ted_clear +;dd sz_ted_delete, ted_delete +;dd sz_ted_draw, ted_draw +;dd sz_ted_init, ted_init +;dd sz_ted_init_scroll_bars, ted_init_scroll_bars +;dd sz_ted_init_syntax_file, ted_init_syntax_file +;dd sz_ted_is_select, ted_is_select +;dd sz_ted_key, ted_key +;dd sz_ted_mouse, ted_mouse +;dd sz_ted_open_file, ted_open_file +;dd sz_ted_text_add, ted_text_add +;dd sz_ted_but_select_word, ted_but_select_word +;dd sz_ted_but_cut, ted_but_cut +;dd sz_ted_but_copy, ted_but_copy +;dd sz_ted_but_paste, ted_but_paste +;dd sz_ted_but_undo, ted_but_undo +;dd sz_ted_but_redo, ted_but_redo +;dd sz_ted_but_reverse, ted_but_reverse +;dd sz_ted_but_find_next, ted_but_find_next +;dd sz_ted_text_colored, ted_text_colored +;dd sz_ted_version, 0x00000002 + +dd 0,0 + + +sz_init db 'lib_init',0 +sz_version db 'version',0 + +sz_edit_box db 'edit_box',0 +sz_edit_box_key db 'edit_box_key',0 +sz_edit_box_mouse db 'edit_box_mouse',0 +sz_edit_box_set_text db 'edit_box_set_text',0 +szVersion_ed db 'version_ed',0 + +sz_check_box_draw db 'check_box_draw',0 +sz_check_box_mouse db 'check_box_mouse',0 +szVersion_ch db 'version_ch',0 + +sz_option_box_draw db 'option_box_draw',0 +sz_option_box_mouse db 'option_box_mouse',0 +szVersion_op db 'version_op',0 + +sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0 +sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0 +sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0 +sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0 +szVersion_scrollbar db 'version_scrollbar',0 + +sz_Dbutton_draw db 'dbutton_draw',0 +sz_Dbutton_mouse db 'dbutton_mouse',0 +szVersion_dbutton db 'version_dbutton',0 + +sz_Menu_bar_draw db 'menu_bar_draw',0 +sz_Menu_bar_mouse db 'menu_bar_mouse',0 +sz_Menu_bar_activate db 'menu_bar_activate',0 +szVersion_menu_bar db 'version_menu_bar',0 + +sz_FileBrowser_draw db 'FileBrowser_draw',0 +sz_FileBrowser_mouse db 'FileBrowser_mouse',0 +sz_FileBrowser_key db 'FileBrowser_key',0 +szVersion_FileBrowser db 'version_FileBrowser',0 + +sz_tl_data_init db 'tl_data_init',0 +sz_tl_data_clear db 'tl_data_clear',0 +sz_tl_info_clear db 'tl_info_clear',0 +sz_tl_key db 'tl_key',0 +sz_tl_mouse db 'tl_mouse',0 +sz_tl_draw db 'tl_draw',0 +sz_tl_info_undo db 'tl_info_undo',0 +sz_tl_info_redo db 'tl_info_redo',0 +sz_tl_node_add db 'tl_node_add',0 +sz_tl_node_set_data db 'tl_node_set_data',0 +sz_tl_node_get_data db 'tl_node_get_data',0 +sz_tl_node_delete db 'tl_node_delete',0 +sz_tl_cur_beg db 'tl_cur_beg',0 +sz_tl_cur_next db 'tl_cur_next',0 +sz_tl_cur_perv db 'tl_cur_perv',0 +sz_tl_node_close_open db 'tl_node_close_open',0 +sz_tl_node_lev_inc db 'tl_node_lev_inc',0 +sz_tl_node_lev_dec db 'tl_node_lev_dec',0 +sz_tl_node_move_up db 'tl_node_move_up',0 +sz_tl_node_move_down db 'tl_node_move_down',0 +sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 +sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 +sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 +sz_tl_save_mem db 'tl_save_mem',0 +sz_tl_load_mem db 'tl_load_mem',0 +sz_tl_get_mem_size db 'tl_get_mem_size',0 +sz_tl_version_tree_list db 'version_tree_list',0 + +sz_PathShow_prepare db 'PathShow_prepare',0 +sz_PathShow_draw db 'PathShow_draw',0 +szVersion_path_show db 'version_PathShow',0 + +sz_ted_but_save_file db 'ted_but_save_file',0 +sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0 +sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0 +sz_ted_can_save db 'ted_can_save',0 +sz_ted_clear db 'ted_clear',0 +sz_ted_delete db 'ted_delete',0 +sz_ted_draw db 'ted_draw',0 +sz_ted_init db 'ted_init',0 +sz_ted_init_scroll_bars db 'ted_init_scroll_bars',0 +sz_ted_init_syntax_file db 'ted_init_syntax_file',0 +sz_ted_is_select db 'ted_is_select',0 +sz_ted_key db 'ted_key',0 +sz_ted_mouse db 'ted_mouse',0 +sz_ted_open_file db 'ted_open_file',0 +sz_ted_text_add db 'ted_text_add',0 +sz_ted_but_select_word db 'ted_but_select_word',0 +sz_ted_but_cut db 'ted_but_cut',0 +sz_ted_but_copy db 'ted_but_copy',0 +sz_ted_but_paste db 'ted_but_paste',0 +sz_ted_but_undo db 'ted_but_undo',0 +sz_ted_but_redo db 'ted_but_redo',0 +sz_ted_but_reverse db 'ted_but_reverse',0 +sz_ted_but_find_next db 'ted_but_find_next',0 +sz_ted_text_colored db 'ted_text_colored',0 +sz_ted_version db 'version_text_edit',0 \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/branch/box_lib.mac b/programs/develop/libraries/box_lib/branch/box_lib.mac new file mode 100644 index 0000000000..490daac4f8 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/box_lib.mac @@ -0,0 +1,361 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use EditBox ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +ed_width equ [edi] ;ширина компонента +ed_left equ [edi+4] ;положение по оси х +ed_top equ [edi+8] ;положение по оси у +ed_color equ [edi+12] ;цвет фона компонента +shift_color equ [edi+16] ;=0x6a9480 для примера возьем желеный цвет бокса +ed_focus_border_color equ [edi+20] ;цвет рамки компонента +ed_blur_border_color equ [edi+24] ;цвет не активного компонента +ed_text_color equ [edi+28] ;цвет текста +ed_max equ [edi+32] ;кол-во символов которые можно максимально ввести +ed_text equ [edi+36] ;указатель на буфер +ed_mouse_variable equ [edi+40] ; указатель на переменную для бокса/группы +ed_flags equ [edi+44] ;флаги +bp_flags equ [ebp+44] ;в некоторых процедурах edi используется, взамен указатель храниться в ebp +ed_size equ [edi+48] ;кол-во символов +bp_size equ [ebp+48] ;кол-во симвполов, для адресации испльзуется ebpб edi занят +ed_pos equ [edi+52] ;позиция курсора +ed_offset equ [edi+56] ;смещение +cl_curs_x equ [edi+60] ;предыдущее координата курсора по х +cl_curs_y equ [edi+64] ;предыдущее координата курсора по у +ed_shift_pos equ [edi+68] ;положение курсора +ed_shift_pos_old equ [edi+72] ;старое положение курсора + +ed_struc_size=76 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Bit mask from editbox +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +ed_figure_only= 1000000000000000b ;одни символы +ed_always_focus= 100000000000000b +ed_focus= 10b ;фокус приложения +ed_shift_on= 1000b ;если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая shift +ed_shift_on_off=1111111111110111b +ed_shift= 100b ;включается при нажатии на shift т.е. если нажимаю +ed_shift_off= 1111111111111011b +ed_shift_bac= 10000b ;бит для очистки выделеного shift т.е. при установке говорит что есть выделение +ed_shift_bac_cl=1111111111101111b ;очистка при удалении выделения +ed_shift_cl= 1111111111100011b +ed_shift_mcl= 1111111111111011b +ed_left_fl= 100000b +ed_right_fl= 1111111111011111b +ed_offset_fl= 1000000b +ed_offset_cl= 1111111110111111b +ed_insert= 10000000b +ed_insert_cl= 1111111101111111b +ed_mouse_on = 100000000b +ed_mous_adn_b= 100011000b +ed_mouse_on_off=1111111011111111b +ed_height=14 ; высота + +struc edit_box width,left,top,color,shift_color,focus_border_color,\ + blur_border_color,text_color,max,text,mouse_variable,flags,size,pos +{ +.width dd width +.left dd left +.top dd top +.color dd color +.shift_color dd shift_color +.focus_border_color dd focus_border_color +.blur_border_color dd blur_border_color +.text_color dd text_color +.max dd max +.text dd text +.mouse_variable dd mouse_variable +.flags dd flags+0 +.size dd size+0 +.pos dd pos+0 +.offset dd 0 +.cl_curs_x dd 0 +.cl_curs_y dd 0 +.shift dd 0 +.shift_old dd 0 +} + +macro edit_boxes_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) + mov esi,color_table +@@: + mov eax,dword [esi+36] + mov ebx,dword [esi+20] + push dword eax + pop dword ed_focus_border_color + shr bh,1 + shr bl,1 + shr ah,1 + shr al,1 + add ah,bh + add al,bl + ror eax,16 + ror ebx,16 + shr bl,1 + shr al,1 + add al,bl + ror eax,16 + mov dword ed_blur_border_color,eax + mov dword shift_color,eax + add edi,ed_struc_size + loop @b +} +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use CheckBox ; +;Last change 03.10.2010 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +ch_struc_size=36 ;размер структуры +ch_flag_en=10b ;флаг установленного чек бокса. + +ch_left_s equ [ebp] ;кордината начала рисования по х +ch_top_s equ [ebp+4] ;координата начала рисования по у +ch_text_margin equ [ebp+8] ;=4 расстояние от прямоугольника чек бокса до надписи +ch_color equ [ebp+12] ;цвет внутри checkbox +ch_border_color equ [ebp+16] ; or [edi+4] ;цвет рамки checkbox ее можно задать самостоятельно +ch_text_color equ [ebp+20] ;[edi+4] ;цвет текста +ch_text_ptr equ [ebp+24] ;указатель на начало текстовой строки +ch_text_length equ [ebp+28] ;длинна строки +ch_flags equ [ebp+32] ;флаги + +struc check_box left_s,top_s,ch_text_margin,color,border_color,text_color,text,ch_text_length,flags +{ ;структура параметров для чек бокса +.left_s: dd left_s ;+0 положение по х dw + размер dw +.top_s: dd top_s ;+4 положение по у dw + размер dw +.ch_text_margin: dd ch_text_margin ;расстояние от прямоугольника чек бокса до надписи +.color: dd color ;цвет внутри чекбокса +.border_color: dd border_color ;цвет рамки +.text_color: dd text_color ;цвет надписи +.text: dd text ;адрес в коде программы где расположен текст +.ch_text_length: dd ch_text_length ;длинна строки с символами +.flags: dd flags+0 ; флаги +} + +macro check_boxes_set_sys_color start,end,color_table +{ + mov ebp,start + mov ecx,((end-start)/ch_struc_size) + mov esi,color_table +@@: + push dword [esi+32] ;цвет текста в рабочей области окна + pop dword ch_text_color + push dword [esi+36] ;цвет графики в окне (разделительные линии и т.п.) + pop dword ch_border_color + add ebp,ch_struc_size + loop @b +} + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use OptionBox ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags +{ ;структура параметров для чек бокса +op_flag_en=10b +.option_group: dd point_gr +.left: dw left ;+0 ;положение по х +.top: dw top ;положение по у +.ch_text_margin: dd op_text_margin ;расстояние от прямоугольника чек бокса до надписи +.ch_size: dd op_size ;размер квадрата чек бокса, для примера 12 +.color: dd color ;цвет внутри чекбокса +.border_color: dd border_color ;цвет рамки +.text_color: dd text_color ;цвет надписи +.text: dd text ;адрес в коде программы где расположен текст +.ch_text_length: dd op_text_length ;длинна строки с символами +.flags: dd flags+0 ; флаги +} + +option_group equ [edi] +op_left equ [edi+4] ;координата начала рисования по х +op_top equ [edi+6] ;координата начала рисования по у +op_text_margin equ [edi+8] ;=4 расстояние от прямоугольника чек бокса до надписи +op_size equ [edi+12] ;12 размер квадрата чек бокса +op_color equ [edi+16] +op_border_color equ [edi+20] ; or [edi+4] ;цвет рамки checkbox ее можно задать самостоятельно +op_text_color equ [edi+24];[edi+4] ;цвет текста +op_text_ptr equ [edi+28] ;указатель на начало текстовой строки +op_text_length equ [edi+32] +op_flags equ [edi+36] ;флаги + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use TreeList ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +struc tree_list info_size,info_max_count,style, img_cx,img_cy,\ + col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\ + info_capt_len,el_focus, p_scrol,on_press { + .data_info dd 0 + .info_size dw info_size + .info_max_count dd info_max_count + .style dd style + .data_nodes dd 0 + .data_img dd 0 + .img_cx dw img_cx + .img_cy dw img_cy + .data_img_sys dd 0 + .ch_tim dd 0 + .ls_tim dd 0 + .tim_undo dd 0 + .cur_pos dd 0 + .col_bkg dd col_bkg + .col_zag dd col_zag + .col_txt dd col_txt + .box_left dd box_l + .box_top dd box_t + .box_width dd box_w + .box_height dd box_h + .capt_cy dw capt_cy + .info_capt_offs dw info_capt_offs + .info_capt_len dw info_capt_len + .el_focus dd el_focus + .p_scrol dd p_scrol + rb 4 + .on_activate dd 0 + .on_press dd on_press +} + +tl_info_size equ word[edi +4] ;размер данных выделяемых для каждого узла (пользовательськие данные + текст для подписи) +tl_info_max_count equ dword[edi+6] ;максимальное количество узлов, которые можно добавить в элемент +tl_style equ dword[edi+10] ;стили элемента +tl_data_nodes equ dword[edi+14] ;указатель на структуры узлов +tl_data_img equ dword[edi+18] ;указатель на изображения с иконками узлов +tl_img_cx equ word[edi+22] ;ширина иконок +tl_img_cy equ word[edi+24] ;высота иконок +tl_data_img_sys equ dword[edi+26] ;указатель на системные изображения (стрелки, плюсики) +tl_ch_tim equ dword[edi+30] ;количество изменений в файле +tl_tim_undo equ dword[edi+38] ;количество отмененных действий +tl_cur_pos equ dword[edi+42] ;позиция курсора +tl_col_bkg equ dword[edi+46] ;цвет фона +tl_col_zag equ dword[edi+50] ;цвет заголовка +tl_col_txt equ dword[edi+54] ;цвет текста +tl_box_left equ dword[edi+58] +tl_box_top equ dword[edi+62] +tl_box_width equ dword[edi+66] +tl_box_height equ dword[edi+70] +tl_capt_cy equ word[edi+74] ;высота подписи +tl_info_capt_offs equ word[edi+76] ;сдвиг для начала текста (подписи узла) +tl_info_capt_len equ word[edi+78] ;длинна текста подписи узла (если = 0 то до конца структуры) +tl_el_focus equ dword[edi+80] ;указатель на структуру элемента в фокусе +tl_p_scrol equ dword[edi+84] ;указатель на структуру скроллинга +tl_on_press equ dword[edi+96] ;указатель на функцию, которая вызывается при нажатии Enter + +;data_info dd ? ;+ 0 указатель на основные даные +;ls_tim dd ? ;+34 время последнего сохранения +;on_activate dd ? ;+92 указатель на функцию при активировании узла + +;константы стиля +tl_key_no_edit equ 1b ;элемент нельзя редактировать на клавиатуре (изменять уровни, удалять) +tl_draw_par_line equ 10b ;рисовать линии к родительскому узлу +tl_list_box_mode equ 100b ;стиль не отображает уровни (как в ListBox все одного уровня) + +;константы для функций +tl_err_save_memory_size equ 10b ;не хватает памяти для сохранения элемента +tl_err_load_caption equ 1b ;в памяти нет заголовка 'tree' +tl_err_load_info_size equ 100b ;не совпадает размер информационной структуры при открытии +tl_load_mode_add equ 0x20000 ;опция считывания в режиме добавления информации +tl_save_load_heder_size equ 26 ;размер заголовка для записи/чтения элементов +tl_offs_box equ 58 ;начало BOX структуры для tree_list + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use TextEditor ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +ted_wnd_l equ dword[edi+ 0] ;окно редактора: отступ слева +ted_wnd_t equ dword[edi+ 4] ;окно редактора: отступ сверху +ted_wnd_w equ dword[edi+ 8] ;окно редактора: ширина +ted_wnd_h equ dword[edi+12] ;окно редактора: высота +ted_rec_l equ dword[edi+16] ;ширина панели в окне +ted_rec_t equ dword[edi+20] ;высота панели в окне +ted_rec_w equ dword[edi+24] ;ширина символа (знакоместа) в окне +ted_rec_h equ dword[edi+28] ;высота символа (знакоместа) в окне +ted_drag_m equ byte[edi+32] ;выделение от мыши +ted_drag_k equ byte[edi+33] ;выделение от клавиатуры +ted_sel_x0 equ dword[edi+34] ;координата выделения x0 +ted_sel_y0 equ dword[edi+38] ;координата выделения y0 +ted_sel_x1 equ dword[edi+42] ;координата выделения x1 +ted_sel_y1 equ dword[edi+46] ;координата выделения y1 +;запасные координаты выделения +ted_seln_x0 equ dword[edi+50] +ted_seln_y0 equ dword[edi+54] +ted_seln_x1 equ dword[edi+58] +ted_seln_y1 equ dword[edi+62] + +ted_tex equ dword[edi+66] ;указатель на память для хранения текста +ted_tex_1 equ dword[edi+70] ;указатель на 1-ю стркутру символа +ted_tex_end equ dword[edi+74] ;указатель на последнюю структуру символа +ted_cur_x equ dword[edi+78] ;координата x курсора +ted_cur_y equ dword[edi+82] ;координата y курсора +ted_max_chars equ dword[edi+86] ;максимальное число символов в одном документе +ted_colors_text_count equ dword[edi+90] ;колличество цветов текста +ted_key_words_count equ dword[edi+94] ;колличество ключевых слов +ted_color_cursor equ dword[edi+98] ;цвет курсора +ted_color_wnd_capt equ dword[edi+102] ;цвет полей вокруг окна +ted_color_wnd_work equ dword[edi+106] ;цвет фона окна +ted_color_wnd_bord equ dword[edi+110] ;цвет текста на полях +ted_color_select equ dword[edi+114] ;цвет выделения +ted_color_cur_text equ dword[edi+118] ;цвет символа под курсором +ted_color_wnd_text equ dword[edi+122] ;цвет текста в окне +ted_syntax_file equ dword[edi+126] ;указатель на начало файла синтаксиса +ted_syntax_file_size equ dword[edi+130] ;максимальный размер файла синтаксиса +ted_text_colors equ dword[edi+134] ;указатель на массив цветов текста +ted_help_text_f1 equ dword[edi+138] ;указатель на текст справки (по нажатии F1) +ted_help_id equ dword[edi+142] ;идентификатор для справки +ted_key_words_data equ dword[edi+146] ;указатель на структуры ключевых слов TexColViv +ted_tim_ch equ dword[edi+150] ;колличество изменений в файле +ted_tim_undo equ dword[edi+154] ;колличество отмененных действий +ted_tim_ls equ dword[edi+158] ;время последнего сохранения +ted_tim_co equ dword[edi+162] ;время последней цветовой разметки +ted_el_focus equ dword[edi+166] ;указатель на переменную элемента в фокусе +ted_err_save equ byte[edi+170] ;ошибка сохранения файла +ted_panel_id equ byte[edi+171] ;номер открытой панели +ted_key_new equ byte[edi+172] ;символ, который будет добавлятся с клавиатуры +ted_symbol_new_line equ byte[edi+173] ;символ завершения строки +ted_scr_w equ dword[edi+174] ;вертикальный скроллинг +ted_scr_h equ dword[edi+178] ;горизонтальный скроллинг +ted_arr_key_pos equ dword[edi+182] ;указатель на массив позиций ключевых слов +ted_buffer equ dword[edi+186] ;указатель на буфер копирования/вставки +ted_buffer_find equ dword[edi+190] ;указатель на буфер для поиска +ted_cur_ins equ byte[edi+194] ;режим работы курсора (обычный или замена) +ted_mode_color equ byte[edi+195] ;режим выделения слов цветом (0-выкл. 1-вкл.) +ted_mode_invis equ byte[edi+196] ;режим показа непечатаемых символов +ted_gp_opt equ byte[edi+197] ;опции возвращаемые функцией ted_get_pos_by_cursor +ted_fun_on_key_ctrl_o equ dword[edi+198] ;указатель на функцию вызываемую при нажатии Ctrl+O (открытие файла) +ted_fun_on_key_ctrl_f equ dword[edi+202] ;... Ctrl+F (вызова/скрытия панели поиска) +ted_fun_on_key_ctrl_n equ dword[edi+206] ;... Ctrl+N (создание нового документа) +ted_fun_on_key_ctrl_s equ dword[edi+210] ;... Ctrl+S +ted_buffer_size equ dword[edi+214] ;размер буфера копирования/вставки +ted_fun_find_err equ dword[edi+218] ;указатель на функцию вызываемую если поиск закончился неудачно +ted_fun_init_synt_err equ dword[edi+222] ;указатель на функцию вызываемую при ошибочном открытии файла синтаксиса +ted_fun_draw_panel_buttons equ dword[edi+226] ;указатель на функцию рисования панели с кнопками +ted_fun_draw_panel_find equ dword[edi+230] ;указатель на функцию рисования панели поиска +ted_fun_draw_panel_syntax equ dword[edi+234] ;указатель на функцию рисования панели синтаксиса +ted_fun_save_err equ dword[edi+238] ;указатель на функцию вызываемую если сохранение файла закончилось неудачно +ted_increase_size equ dword[edi+242] ;число символов на которые будет увечиваться память при нехватке +ted_ptr_free_symb equ dword[edi+246] ;указатель на свободную память, в которую можно добавлять символ (используется внутри элемента для ускорения вставки текста) +;------------------------------------------------------------------------------ +ted_opt_ed_move_cursor equ 1 ;двигать курсор после добавления текста +ted_opt_ed_change_time equ 2 ;добавлять изменения при редактировании текста +ted_offs_sel equ 34 ;смещение структуры sel +ted_offs_seln equ 50 ;смещение структуры seln +ted_offs_count_colors equ 90 ;смещение переменной колличества цветов +ted_offs_key_new equ 172 +ted_offs_symbol_new_line equ 173 ;смещение символа новой строки +;------------------------------------------------------------------------------ + + + +; *** scroll bar constant *** +sb_offs_size_x equ 0 +sb_offs_start_x equ 2 +sb_offs_size_y equ 4 +sb_offs_start_y equ 6 +sb_offs_max_area equ 16 +sb_offs_cur_area equ 20 +sb_offs_position equ 24 +sb_offs_bckg_col equ 28 +sb_offs_frnt_col equ 32 +sb_offs_line_col equ 36 +sb_offs_redraw equ 40 +sb_offs_delta2 equ 46 +sb_offs_all_redraw equ 80 +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/branch/checkbox.asm b/programs/develop/libraries/box_lib/branch/checkbox.asm new file mode 100644 index 0000000000..4298d551aa --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/checkbox.asm @@ -0,0 +1,147 @@ +;***************************************************************************** +; Example for Box_lib: checkbox +; Copyright (c) 2007-2010, Alexey Teplov aka +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; * Neither the name of the nor the +; names of its contributors may be used to endorse or promote products +; derived from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY +; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +; DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +;****************************************************************************** + +use32 + org 0x0 +;------------ from kolibrios programm + db 'MENUET01' + dd 0x01 + dd START + dd MEM_END + dd PRIL_END + dd PRIL_END + dd 0x0 + dd cur_dir_path +;------------ +;------------ +include '../../../../macros.inc' +include '../load_lib.mac' +include 'box_lib.mac' +;include 'macros.inc' +;include 'load_lib.mac' +;------------ +;------------ +@use_library +;------------ +;--------------------------------------------------------------------- +;--- Start of program ---------------------------------------------- +;--------------------------------------------------------------------- +START: +sys_load_library library_name, cur_dir_path, library_path, system_path, \ +err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i + test eax,eax + jnz exit + +window: + call draw_window ;первоначально необходимо нарисовать окно +align 4 +still: ;основной обработчик + mcall 10 ;Ожидать события + dec eax + jz window + dec eax + jz key + dec eax + jz button + + push dword check1 + call [check_box_mouse] + + push dword check2 + call [check_box_mouse] + + jmp still ;если ничего из перечисленного то снова в цикл +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +button: + mcall 17 ;получить идентификатор нажатой клавиши + test ah,ah ;если в ah 0, то перейти на обработчик событий still + jz still +exit: mcall -1 +key: + mcall 2 ;загрузим значение 2 в регистор eax и получим код нажатой клавиши + + jmp still + +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +align 4 +draw_window: ;рисование окна приложения + mcall 12,1 + mcall 0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed + + push dword check1 + call [check_box_draw] + + push dword check2 + call [check_box_draw] + + mcall 12,2 + ret +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +;DATA данные +;Всегда соблюдать последовательность в имени. +system_path db '/sys/lib/' +library_name db 'box_lib.obj',0 +; Если есть желание разъединить, то нужно использовать следующию конструкцию +;system_path db '/sys/lib/box_lib.obj',0 +;... любая последовательность других команд и определений. +;library_name db 'box_lib.obj',0 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0 +head_f_i: +head_f_l db 'System error',0 +err_message_import db 'Error on load import library box_lib.obj',0 + +myimport: + +check_box_draw dd aCheck_box_draw +check_box_mouse dd aCheck_box_mouse +version_ch dd aVersion_ch + dd 0,0 + + +aCheck_box_draw db 'check_box_draw',0 +aCheck_box_mouse db 'check_box_mouse',0 +aVersion_ch db 'version_ch',0 +;--------------------------------------------------------------------- +check1 check_box (10 shr 16 + 12),(45 shr 16 + 12),6,0x80AABBCC,0,0,check_text,14,ch_flag_en +check2 check_box (10 shr 16 + 12),(60 shr 16 + 12),6,0x80AABBCC,0,0,check_text2,15 +;--------------------------------------------------------------------- +hed db 'CheckBox Exemples date 03.10.2010',0 +hed_end: +;--------------------------------------------------------------------- +check_text db 'First checkbox' +check_text2 db 'Second checkbox' +;--------------------------------------------------------------------- +MEM_END: +cur_dir_path rb 1024 +library_path rb 1024 + rb 1024 ;for stack +PRIL_END: + + diff --git a/programs/develop/libraries/box_lib/branch/checkbox.bat b/programs/develop/libraries/box_lib/branch/checkbox.bat new file mode 100644 index 0000000000..dd2ea3eaf2 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/checkbox.bat @@ -0,0 +1,2 @@ +@fasm -m 16384 checkbox.asm checkbox.kex +if exist checkbox.kex @kpack checkbox.kex \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/branch/checkbox.mac b/programs/develop/libraries/box_lib/branch/checkbox.mac new file mode 100644 index 0000000000..7d85d8bd61 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/checkbox.mac @@ -0,0 +1,136 @@ +;Последная модификация 03.10.2010 +;файл создан 13.02.2009 На код применена GPL2 лицензия +;Макрос для системной библиотеки box_lib.obj +;Checkbox + +macro use_checkbox_draw +{ +check_box_draw: + pusha ;сохраним все регистры +; mov edi,dword [esp+36] +; mov ebx,ch_left_s +; mov ecx,ch_top_s +; mov edx,dword ch_border_color +; mov eax,13 +; mcall ;рисуем рамку + mcall 13,ch_left_s,ch_top_s,ch_border_color + + mov edx,dword ch_color + add ebx,1 shl 16 - 2 + add ecx,1 shl 16 - 2 + mcall ;закрашиваем внутренности чекбокса + + test dword ch_flags,2 ;достать значение бита из переменной и поместить в флаг CF + jz @f ;в если CF=1, то выполним следующую процедуру иначе перейти на нижнюю @@ + call check_box_draw_ch ;нарисовать включенный чек бокс +@@: +;---------------------------- +;расчет куда будет произведен вывод текста +;---------------------------- + mov ebx,ch_left ;загрузить значение х для чек бокса + add ebx,dword ch_size + add ebx,dword ch_text_margin ;добавить размер стороны и расстояние на котором начнется вывод текста + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov bx,word ch_top ;загрузим значение по y + add ebx,ch_size + mov ecx,dword ch_text_color ;загрузим цвет надписи + flags + sub ebx,7 ;добавим значение длины стороны -9+2 + + mov edx,dword ch_text_ptr ;укажем адрес от куда нужно выводить строку + mov esi,dword ch_text_length + mov eax,4 ;внесем в eax значение вывода надписи на канву + mcall ;Вывод + popa ;восстановить значения регистров из стека + ret 4 ;выйдем из процедуры + +check_box_clear_ch: ;очистка чек бокса + mov edx,dword ch_color ;цвет внутри чек бокса + jmp @f ;безусловный прыжок на нижнюю метку @@ +check_box_draw_ch: ;нарисовать включенный чек бокс + mov edx,dword ch_border_color ;загрузить цвет +@@: + movzx ebx,word ch_left ;загрузить координату по х + mov eax,dword ch_size + mov di,ax + shr eax,2 + push ax + + push ax + add ebx,eax + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + pop ax + lea eax,[eax*2] + sub bp,ax ;сохраним регистр bx в регистре указателя базы + mov bx,bp + + movzx ecx,word ch_top ;загрузить координату по у + pop ax + add cx,ax + shl ecx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov cx,bp ;загрузим значения регистра указателя базы в cx + mov eax,13 ;в eax - значения функции для вывода полосы т.е. по сути прямоугольника, который отображает включенный компонент чек бокс + mcall ;вывод +ret ;выйти из процедуры +} + + +macro use_checkbox_mouse +{ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Обработчик mouse +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +check_box_mouse: ;обработка мыши +pusha + mov edi,dword [esp+36] + mov eax,37 ;будем что то делать если у нас что - нить нажато + mov ebx,2 ;внести в регистр значение 2 + mcall ;проверка не нажал ли пользователь кнопку мышки + test eax,eax ;проверка если у нас в eax=0, то установим флаг и выйдем + jnz @f ;перейти на нижнюю метку @@ + btr dword ch_flags,2 ;извлечение значения заданного бита в флаг cf и изменение его значения на нулевое. + jmp check_box_mouse_end + +@@: + bts dword ch_flags,2 ;проверка флага т.е. перенос в cf значение бита и установка бита в состояние включено + jc check_box_mouse_end ;если CF=1 то перейти в конец т.е. это выход + mov esi,dword ch_text_length ;загрузить кол-во символов в текстовой строке + ;Умножение на 6 Быстрое умножение можно воспользоваться любым мз методов, но на старых Процессорах (386,486,P1)быстрее будет с инструкцией Lea + lea esi,[eax*3] + shl esi,1 +; imul esi,6 ; или можно и так умножить на 6 + add esi,dword ch_text_margin ;добавить 3 - расстояние от чек бокса до надписи + + mov eax,37 ;получим координаты мышки + mov ebx,1 ;добавить 1 + mcall ;получить координаты курсора относительно окна + + movzx ebx,word ch_top ;загрузить в bx значение координаты у + cmp ax,bx ;сравнить с с координатой курсора + jl check_box_mouse_end ;SF <> OF если меньше + add ebx,dword ch_size ;добавить размер + cmp ax,bx ;сравнить + jg check_box_mouse_end ;ZF = 0 и SF = OF если больше + + shr eax,16 ;разделим на 65536 или просто сдвинем биты на 16 значений + movzx ebx,word ch_left ;произведем аналогичное сравнение + cmp ax,bx ;сравнить регистры + jl check_box_mouse_end ;если меньше + add ebx,dword ch_size ;добавить длину стороны прямоугольника + add ebx,esi ;Учесть в значении по х еще и длину надписи к чекбоксу + cmp ax,bx ;стравнить регистры + jg check_box_mouse_end ;если больше + + bts dword ch_flags,1 ;извлечение значения заданного бита в флаг cf и изменение его значения на 1. + jc @f ;CF=1 то перейти на нижнюю @@ + + call check_box_draw_ch ;отобразить включенный чек бокс +; mov dword [esp+24],1 ;дальнейшая проверка чек боксов бесмыслена, по этому в стек, где располагается ecx поместитм 0 + jmp check_box_mouse_end ;выйти +@@: + btr word ch_flags,1 ;извлечение значения заданного бита в флаг cf и изменение его значения на нулевое. + call check_box_clear_ch ;выключить чек бокс т.е. на месте закрашенного прямоугольника отобразить цвет фона. +check_box_mouse_end: +popa ;восстановить регистры из стека +ret 4 ;выйти +} \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/branch/readme.txt b/programs/develop/libraries/box_lib/branch/readme.txt new file mode 100644 index 0000000000..06dec920ca --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/readme.txt @@ -0,0 +1,5 @@ +# This is exeperemental source code for trunk, not stable. +# Это экспериментальные наброски, которые в дальнейшем будут включены в trunk. +# Причина появления: Мной была потеряна работа по изменению библиотеки box_lib, т.к. приходиться работать на разных ПК, +# в разное время, и в разных местах. +# , 03/10/2010. diff --git a/programs/develop/libraries/box_lib/branch/run.bat b/programs/develop/libraries/box_lib/branch/run.bat new file mode 100644 index 0000000000..551c174cc1 --- /dev/null +++ b/programs/develop/libraries/box_lib/branch/run.bat @@ -0,0 +1,4 @@ +if not exist bin mkdir bin +@fasm.exe -m 16384 box_lib.asm bin\box_lib.obj +@kpack bin\box_lib.obj +pause \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.mac b/programs/develop/libraries/box_lib/trunk/box_lib.mac index e56ef4a711..baf1448ce6 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.mac +++ b/programs/develop/libraries/box_lib/trunk/box_lib.mac @@ -103,49 +103,48 @@ macro edit_boxes_set_sys_color start,end,color_table } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Basic macros for use CheckBox ; +;Last change 25.09.2010 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -ch_struc_size=36 -ch_flag_en=10b ;н«Ґ¬Ґ­в ўлЎа ­ +ch_struc_size=36 ;а §¬Ґа бвагЄвгал +ch_flag_en=10b ;д« Ј гбв ­®ў«Ґ­­®Ј® 祪 Ў®Єб . -ch_left equ [edi] ;Є®®а¤Ё­ в  ­ з «  аЁб®ў ­Ёп Ї® е -ch_top equ [edi+2] ;Є®®а¤Ё­ в  ­ з «  аЁб®ў ­Ёп Ї® г -ch_text_margin equ [edi+4] ;=4 а ббв®п­ЁҐ ®в Їаאַ㣮«м­ЁЄ  祪 Ў®Єб  ¤® ­ ¤ЇЁбЁ -ch_size equ [edi+8] ;12 а §¬Ґа Єў ¤а в  祪 Ў®Єб  -ch_color equ [edi+12] ;梥⠢­гваЁ checkbox -ch_border_color equ [edi+16] ; or [edi+4] ;梥в а ¬ЄЁ checkbox ҐҐ ¬®¦­® § ¤ вм б ¬®бв®п⥫쭮 -ch_text_color equ [edi+20] ;[edi+4] ;梥в ⥪бв  -ch_text_ptr equ [edi+24] ;гЄ § вҐ«м ­  ­ з «® ⥪бв®ў®© бва®ЄЁ -ch_text_length equ [edi+28] -ch_flags equ [edi+32] ;д« ЈЁ +ch_left equ [ebp] ;Є®а¤Ё­ в  ­ з «  аЁб®ў ­Ёп Ї® е +ch_top equ [ebp+2] ;Є®®а¤Ё­ в  ­ з «  аЁб®ў ­Ёп Ї® г +ch_text_margin equ [ebp+4] ;=4 а ббв®п­ЁҐ ®в Їаאַ㣮«м­ЁЄ  祪 Ў®Єб  ¤® ­ ¤ЇЁбЁ +ch_size equ [ebp+8] ;12 а §¬Ґа Єў ¤а в  祪 Ў®Єб  +ch_color equ [ebp+12] ;梥⠢­гваЁ checkbox +ch_border_color equ [ebp+16] ; or [edi+4] ;梥в а ¬ЄЁ checkbox ҐҐ ¬®¦­® § ¤ вм б ¬®бв®п⥫쭮 +ch_text_color equ [ebp+20] ;[edi+4] ;梥в ⥪бв  +ch_text_ptr equ [ebp+24] ;гЄ § вҐ«м ­  ­ з «® ⥪бв®ў®© бва®ЄЁ +ch_text_length equ [ebp+28] ;¤«Ё­­  бва®ЄЁ +ch_flags equ [ebp+32] ;д« ЈЁ struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags -{ ;бвагЄвга  Ї а ¬Ґва®ў ¤«п 祪 Ў®Єб  -.left: dw left ;+0 Ї®«®¦Ґ­ЁҐ Ї® е -.top: dw top ;+2 Ї®«®¦Ґ­ЁҐ Ї® г +{ ;бвагЄвга  Ї а ¬Ґва®ў ¤«п 祪 Ў®Єб  +.left: dw left ;+0 Ї®«®¦Ґ­ЁҐ Ї® е +.top: dw top ;+2 Ї®«®¦Ґ­ЁҐ Ї® г .ch_text_margin: dd ch_text_margin ;а ббв®п­ЁҐ ®в Їаאַ㣮«м­ЁЄ  祪 Ў®Єб  ¤® ­ ¤ЇЁбЁ -.ch_size: dd ch_size ;а §¬Ґа Єў ¤а в  祪 Ў®Єб , ¤«п ЇаЁ¬Ґа  12 -.color: dd color ;梥⠢­гвਠ祪Ў®Єб  +.ch_size: dd ch_size ;а §¬Ґа Єў ¤а в  祪 Ў®Єб , ¤«п ЇаЁ¬Ґа  12 +.color: dd color ;梥⠢­гвਠ祪Ў®Єб  .border_color: dd border_color ;梥в а ¬ЄЁ .text_color: dd text_color ;梥⠭ ¤ЇЁбЁ .text: dd text ; ¤аҐб ў Є®¤Ґ Їа®Ја ¬¬л Ј¤Ґ а бЇ®«®¦Ґ­ ⥪бв .ch_text_length: dd ch_text_length ;¤«Ё­­  бва®ЄЁ б бЁ¬ў®« ¬Ё -.flags: dd flags+0 ; д« ЈЁ +.flags: dd flags+0 ; д« ЈЁ } macro check_boxes_set_sys_color start,end,color_table { - mov edi,start - mov ecx,((end-start)/ch_struc_size) - mov esi,color_table + mov edi,start + mov ecx,((end-start)/ch_struc_size) + mov esi,color_table @@: -; push dword [esi+20] ;梥в а Ў®зҐ© ®Ў« бвЁ ®Є­  -; pop dword ch_color - push dword [esi+32] ;梥в ⥪бв  ў а Ў®зҐ© ®Ў« бвЁ ®Є­  - pop dword ch_text_color - push dword [esi+36] ;梥⠣а дЁЄЁ ў ®Є­Ґ (а §¤Ґ«ЁвҐ«м­лҐ «Ё­ЁЁ Ё в.Ї.) - pop dword ch_border_color - add edi,ch_struc_size - loop @b + push dword [esi+32] ;梥в ⥪бв  ў а Ў®зҐ© ®Ў« бвЁ ®Є­  + pop dword ch_text_color + push dword [esi+36] ;梥⠣а дЁЄЁ ў ®Є­Ґ (а §¤Ґ«ЁвҐ«м­лҐ «Ё­ЁЁ Ё в.Ї.) + pop dword ch_border_color + add edi,ch_struc_size + loop @b } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/programs/develop/libraries/box_lib/trunk/checkbox.mac b/programs/develop/libraries/box_lib/trunk/checkbox.mac index 19424bccb5..b535d1fe50 100644 --- a/programs/develop/libraries/box_lib/trunk/checkbox.mac +++ b/programs/develop/libraries/box_lib/trunk/checkbox.mac @@ -6,45 +6,44 @@ macro use_checkbox_draw { check_box_draw: pusha ;сохраним все регистры - mov edi,dword [esp+36] - mov eax,13 - movzx ebx,word ch_left - shl ebx,16 - add ebx,ch_size - mov ecx,ch_top - shl ecx,16 - add ecx,dword ch_size - mov edx,dword ch_border_color - mcall ;рисуем рамку + mov edi,dword [esp+36] + mov eax,13 + movzx ebx,word ch_left + shl ebx,16 + add ebx,ch_size + mov ecx,ch_top + shl ecx,16 + add ecx,dword ch_size + mov edx,dword ch_border_color + mcall ;рисуем рамку - mov edx,dword ch_color - add ebx,1 shl 16 - 2 - add ecx,1 shl 16 - 2 - mcall ;закрашиваем внутренности чекбокса + mov edx,dword ch_color + add ebx,1 shl 16 - 2 + add ecx,1 shl 16 - 2 + mcall ;закрашиваем внутренности чекбокса test dword ch_flags,2 ;достать значение бита из переменной и поместить в флаг CF jz @f ;в если CF=1, то выполним следующую процедуру иначе перейти на нижнюю @@ - call check_box_draw_ch ;нарисовать включенный чек бокс + call check_box_draw_ch ;нарисовать включенный чек бокс @@: ;---------------------------- ;расчет куда будет произведен вывод текста ;---------------------------- - movzx ebx,word ch_left ;загрузить значение х для чек бокса - add ebx,dword ch_size - add ebx,dword ch_text_margin;добавить размер стороны и расстояние на котором начнется вывод текста - shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) - mov bx,word ch_top ;загрузим значение по y - add ebx,ch_size - mov ecx,dword ch_text_color ;загрузим цвет надписи + flags - sub ebx,7 ;добавим значение длины стороны -9+2 + movzx ebx,word ch_left ;загрузить значение х для чек бокса + add ebx,dword ch_size + add ebx,dword ch_text_margin ;добавить размер стороны и расстояние на котором начнется вывод текста + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov bx,word ch_top ;загрузим значение по y + add ebx,ch_size + mov ecx,dword ch_text_color ;загрузим цвет надписи + flags + sub ebx,7 ;добавим значение длины стороны -9+2 - mov edx,dword ch_text_ptr ;укажем адрес от куда нужно выводить строку - mov esi,dword ch_text_length - ;внесем в eax значение вывода надписи на канву - mov eax,4 - mcall ;Вывод -popa ;восстановить значения регистров из стека -ret 4 ;выйдем из процедуры + mov edx,dword ch_text_ptr ;укажем адрес от куда нужно выводить строку + mov esi,dword ch_text_length + mov eax,4 ;внесем в eax значение вывода надписи на канву + mcall ;Вывод + popa ;восстановить значения регистров из стека + ret 4 ;выйдем из процедуры check_box_clear_ch: ;очистка чек бокса mov edx,dword ch_color ;цвет внутри чек бокса @@ -54,7 +53,7 @@ check_box_draw_ch: ; @@: movzx ebx,word ch_left ;загрузить координату по х mov eax,dword ch_size - mov bp,ax + mov di,ax shr eax,2 push ax