From 7ccb22747f25e12b9acb903a9b9bab55f5a80f68 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 17 Feb 2009 08:59:04 +0000 Subject: [PATCH] Merge from BR_V5_DEV 17Feb09 --- LICENCE | 504 ------------------ LIGHT_version.h.in | 33 +- Makefile.am | 18 +- adm_local/Makefile.am | 38 +- adm_local/unix/Makefile.am | 37 +- adm_local/unix/config_files/Makefile.am | 38 +- adm_local/unix/config_files/check_LIGHT.m4 | 18 + adm_local/unix/make_common_starter.am | 65 ++- bin/Makefile.am | 52 +- build_configure | 22 +- clean_configure | 32 ++ configure.ac | 68 +-- resources/LIGHT.png | Bin 1435 -> 2579 bytes resources/LightApp.xml | 31 ++ resources/Makefile.am | 9 +- resources/SalomeApp.xml | 20 + src/LIGHTGUI/LIGHTGUI.cxx | 582 +++++++++++++-------- src/LIGHTGUI/LIGHTGUI.h | 68 ++- src/LIGHTGUI/LIGHTGUI.pro | 69 +++ src/LIGHTGUI/LIGHTGUI_DataModel.cxx | 440 +++++++++------- src/LIGHTGUI/LIGHTGUI_DataModel.h | 68 +-- src/LIGHTGUI/LIGHTGUI_DataObject.cxx | 205 +++----- src/LIGHTGUI/LIGHTGUI_DataObject.h | 50 +- src/LIGHTGUI/LIGHTGUI_DataOwner.cxx | 64 --- src/LIGHTGUI/LIGHTGUI_DataOwner.h | 44 -- src/LIGHTGUI/LIGHTGUI_OBSelector.cxx | 125 ----- src/LIGHTGUI/LIGHTGUI_OBSelector.h | 56 -- src/LIGHTGUI/LIGHTGUI_Selection.cxx | 158 ++++-- src/LIGHTGUI/LIGHTGUI_Selection.h | 31 +- src/LIGHTGUI/LIGHTGUI_TextPrs.cxx | 66 ++- src/LIGHTGUI/LIGHTGUI_TextPrs.hxx | 31 +- src/LIGHTGUI/LIGHT_images.po | 41 -- src/LIGHTGUI/LIGHT_msg_en.po | 168 ------ src/LIGHTGUI/Makefile.am | 21 +- src/LIGHTGUI/resources/LIGHT_images.ts | 37 ++ src/LIGHTGUI/resources/LIGHT_msg_en.ts | 208 ++++++++ src/Makefile.am | 35 +- 37 files changed, 1631 insertions(+), 1921 deletions(-) delete mode 100644 LICENCE create mode 100755 clean_configure create mode 100644 resources/LightApp.xml create mode 100644 src/LIGHTGUI/LIGHTGUI.pro delete mode 100644 src/LIGHTGUI/LIGHTGUI_DataOwner.cxx delete mode 100644 src/LIGHTGUI/LIGHTGUI_DataOwner.h delete mode 100644 src/LIGHTGUI/LIGHTGUI_OBSelector.cxx delete mode 100644 src/LIGHTGUI/LIGHTGUI_OBSelector.h delete mode 100644 src/LIGHTGUI/LIGHT_images.po delete mode 100644 src/LIGHTGUI/LIGHT_msg_en.po create mode 100644 src/LIGHTGUI/resources/LIGHT_images.ts create mode 100644 src/LIGHTGUI/resources/LIGHT_msg_en.ts diff --git a/LICENCE b/LICENCE deleted file mode 100644 index b1e3f5a..0000000 --- a/LICENCE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -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 and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, 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 library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete 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 distribute a copy of this License along with the -Library. - - 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 Library or any portion -of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -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 Library, 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 Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you 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. - - If distribution of 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 satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be 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. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library 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. - - 9. 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 Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -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 with -this License. - - 11. 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 Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library 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 Library. - -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. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library 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. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser 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 Library -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 Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -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 - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. 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 LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. 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) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/LIGHT_version.h.in b/LIGHT_version.h.in index 281bca0..d72108c 100644 --- a/LIGHT_version.h.in +++ b/LIGHT_version.h.in @@ -1,26 +1,25 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. +// Copyright (C) 2005-2008 OPEN CASCADE // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// See http://www.salome-platform.org/ +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : LIGHT_version.h // Author : Vadim SANDLER // Module : SALOME - +// #if !defined(__LIGHT_VERSION_H__) #define __LIGHT_VERSION_H__ diff --git a/Makefile.am b/Makefile.am index 28eb16c..e65ea04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +# Copyright (C) 2005-2008 OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -14,27 +14,27 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # -* Makefile *- -# # Author : # Modified by : Alexander BORODIN (OCN) - autotools usage # - include $(top_srcdir)/adm_local/unix/make_common_starter.am +ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files SUBDIRS = adm_local resources src bin -DIST_SUBDIRS = adm_local resources src bin - DISTCLEANFILES = a.out aclocal.m4 configure -EXTRA_DIST+= \ +salomeinclude_DATA = LIGHT_version.h + +EXTRA_DIST += \ build_configure \ - clean_configure \ - LICENCE + clean_configure dist-hook: rm -rf `find $(distdir) -name CVS` diff --git a/adm_local/Makefile.am b/adm_local/Makefile.am index 7ae83a6..9d4ddd6 100644 --- a/adm_local/Makefile.am +++ b/adm_local/Makefile.am @@ -1,19 +1,21 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + SUBDIRS = unix diff --git a/adm_local/unix/Makefile.am b/adm_local/unix/Makefile.am index facd4e6..16d9fdd 100644 --- a/adm_local/unix/Makefile.am +++ b/adm_local/unix/Makefile.am @@ -1,22 +1,21 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = config_files diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index b2cd2d4..7de4b1f 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -1,22 +1,22 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include $(top_srcdir)/adm_local/unix/make_common_starter.am -dist_admlocalm4_DATA= \ +dist_admlocalm4_DATA = \ check_LIGHT.m4 diff --git a/adm_local/unix/config_files/check_LIGHT.m4 b/adm_local/unix/config_files/check_LIGHT.m4 index fa969f5..43a7943 100755 --- a/adm_local/unix/config_files/check_LIGHT.m4 +++ b/adm_local/unix/config_files/check_LIGHT.m4 @@ -1,3 +1,21 @@ +dnl Copyright (C) 2005-2008 OPEN CASCADE +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl # Check availability of LIGHT module binary distribution # # Author : Marc Tajchman (CEA, 2002) diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index 5339413..4976b25 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -1,49 +1,80 @@ +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # ============================================================ # This file defines the common definitions used in several # Makefile. This file must be included, if needed, by the file # Makefile.am. # ============================================================ -# - # Standard directory for installation -salomeincludedir = $(includedir)/@PACKAGE@ -libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/@PACKAGE@ -bindir = $(prefix)/bin/@PACKAGE@ +# +salomeincludedir = $(includedir)/salome +libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome +bindir = $(prefix)/bin/salome salomescriptdir = $(bindir) +salomepythondir = $(pythondir)/salome +salomepyexecdir = $(pyexecdir)/salome # Directory for installing idl files -salomeidldir = $(prefix)/idl/@PACKAGE@ +salomeidldir = $(prefix)/idl/salome # Directory for installing resource files -salomeresdir = $(prefix)/share/@PACKAGE@/resources/@MODULE_NAME@ +salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@ # Directories for installing admin files -admlocaldir = $(prefix)/adm_local -admlocalunixdir = $(admlocaldir)/unix -admlocalm4dir = $(admlocaldir)/unix/config_files +admlocaldir = $(prefix)/adm_local +admlocalunixdir = $(admlocaldir)/unix +admlocalm4dir = $(admlocaldir)/unix/config_files # Shared modules installation directory -sharedpkgpythondir =$(pkgpythondir)/shared_modules +sharedpkgpythondir = $(salomepythondir)/shared_modules # Documentation directory -docdir = $(datadir)/doc/@PACKAGE@ +docdir = $(datadir)/doc/salome # common rules -# moc-files generation +# meta object implementation files generation (moc) %_moc.cxx: %.h $(MOC) $< -o $@ -# qm-files generation -%.qm: %.po - $(MSG2QM) $< $@ +# translation (*.qm) files generation (lrelease) +%.qm: resources/%.ts + $(LRELEASE) $< -qm $@ + +# resource files generation (qrcc) +qrc_%.cxx: %.qrc + $(QRCC) $< -o $@ -name $(*F) + +# qt forms files generation (uic) +ui_%.h: %.ui + $(UIC) -o $@ $< -EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=%.po) +# extra distributed files +EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cxx=%.qrc) \ + $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=resources/%.ts) +# customize clean operation mostlyclean-local: rm -f @builddir@/*_moc.cxx rm -f @builddir@/*.qm + rm -f @builddir@/ui_*.h + rm -f @builddir@/qrc_*.cxx # tests tests: unittest diff --git a/bin/Makefile.am b/bin/Makefile.am index ea73523..095aea0 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,37 +1,29 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -* Makefile *- +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. # +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# -* Makefile *- # Author : # Module : LIGHT # - include $(top_srcdir)/adm_local/unix/make_common_starter.am -# -# =============================================================== -# Files to be installed -# =============================================================== -# - -# These files are data, module or lib files - -nodist_salomescript_DATA= \ - VERSION +# non-distributed files +nodist_salomescript_DATA = VERSION -EXTRA_DIST+= VERSION.in +# distributed files +dist_salomescript_SCRIPTS = diff --git a/build_configure b/build_configure index 3c8e79e..6ed6e43 100755 --- a/build_configure +++ b/build_configure @@ -1,14 +1,28 @@ #!/bin/bash - +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # Tool for updating list of .in file for the SALOME project # and regenerating configure script -# # Author : # Modified by : Alexander BORODIN (OCN) - autotools usage # Date : 10/10/2002 - - +# ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` diff --git a/clean_configure b/clean_configure new file mode 100755 index 0000000..5e49ef4 --- /dev/null +++ b/clean_configure @@ -0,0 +1,32 @@ +#!/bin/sh +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +rm -rf autom4te.cache aclocal.m4 configure make_config +find . -name "*~" -print -exec rm {} \; +find . -name "*.pyc" -print -exec rm {} \; +#exit +# ==================== ON SORT AVANT + +find bin -name Makefile.in | xargs rm -f +find doc -name Makefile.in | xargs rm -f +find idl -name Makefile.in | xargs rm -f +find resources -name Makefile.in | xargs rm -f +find salome_adm -name Makefile.in | xargs rm -f +find src -name Makefile.in | xargs rm -f +rm -f Makefile.in diff --git a/configure.ac b/configure.ac index 65cdb61..eb3a543 100644 --- a/configure.ac +++ b/configure.ac @@ -1,21 +1,32 @@ +# Copyright (C) 2005-2008 OPEN CASCADE # -# PLEASE DO NOT MODIFY configure.in FILE +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. # -# ALL CHANGES WILL BE DISCARDED BY THE NEXT -# build_configure COMMAND +# This library 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 +# Lesser General Public License for more details. # -# CHANGES MUST BE MADE IN configure.in.base FILE +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# PLEASE DO NOT MODIFY configure.in FILE +# ALL CHANGES WILL BE DISCARDED BY THE NEXT +# build_configure COMMAND +# CHANGES MUST BE MADE IN configure.in.base FILE # Author : Marc Tajchman (CEA) # Date : 28/06/2001 # Modified by : Patrick GOLDBRONN (CEA) # Modified by : Marc Tajchman (CEA) -# # Created from configure.in.base # - -AC_INIT([Salome2 Project LIGHT module],[4.1.1], [webmaster.salome@opencascade.com], [salome]) +AC_INIT([Salome2 Project LIGHT module], [5.1.0], [webmaster.salome@opencascade.com], [SalomeLIGHT]) AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -201,35 +212,6 @@ echo ENABLE_PTHREADS -#echo -#echo --------------------------------------------- -#echo testing omniORB -#echo --------------------------------------------- -#echo -# -#CHECK_OMNIORB - -dnl echo -dnl echo --------------------------------------------- -dnl echo testing mico -dnl echo --------------------------------------------- -dnl echo - -dnl CHECK_MICO - -#echo -#echo --------------------------------------------- -#echo default ORB : omniORB -#echo --------------------------------------------- -#echo - -#DEFAULT_ORB=omniORB -#CHECK_CORBA - -#AC_SUBST_FILE(CORBA) -#corba=make_$ORB -#CORBA=adm_local/unix/$corba - echo echo --------------------------------------------- echo testing openGL @@ -246,14 +228,6 @@ echo CHECK_QT -echo -echo --------------------------------------------- -echo testing MSG2QM -echo --------------------------------------------- -echo - -CHECK_MSG2QM - echo echo --------------------------------------------- echo testing VTK @@ -309,7 +283,6 @@ echo --------------------------------------------- echo echo Configure -#variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok" variables="cc_ok lex_yacc_ok python_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok" for var in $variables @@ -318,10 +291,6 @@ do eval echo \$$var done -echo -echo "Default ORB : $DEFAULT_ORB" -echo - dnl We don t need to say when we re entering directories if we re using dnl GNU make becuase make does it for us. if test "X$GMAKE" = "Xyes"; then @@ -353,5 +322,6 @@ AC_OUTPUT([ \ ./src/Makefile \ ./src/LIGHTGUI/Makefile \ ./resources/Makefile \ + ./LIGHT_version.h \ Makefile \ ]) diff --git a/resources/LIGHT.png b/resources/LIGHT.png index ccd14fe202f45ee9c2c2951836209b0a59a995b5..b0ab8de67f0eea925f55b05dc173dd7422adb71f 100755 GIT binary patch literal 2579 zcmZWrX;_k38-4-B?KPPBT)+%zvPrEBFhwgB(lKo;9c#)K197cPtv+`J)B>zb&2h<6 z%W2WZQp>H$LdC7zv&BSIw8h-OEm4s7qxpW$kLNt+oFDgn-RC^#Ja>xc{yna`C5VmAT+I~f3$Ayxhg01+y*2|57m$OQnyuxqqt7ZqNLn=|!b^Z-KvL5>1XBmiq_ zA~eA$fNl&5Q0qxw0{%Tk>sV^JxVU(Ah!KoPJab=)Uz_=B7@T*p5lDwKOl)jy671A3 znnZ<)cBp@(X^d{}>0fo4!~mN3^0EqFI7OZJ#M#+7GAc5%PN7(yFS9=VUh$yhbnSzZ zk}9m(;nt3h5Uo2;i^T@<7(Cl`k&Q#=n46ogyT1M8XglO7U6j)Zt1BWow2j7+4Zjtw zHZ=5}H1s@UW=`C9RRe(Yyipj$**`NfdapNMHsmj-sdeS=Tw)0y37|s09QK)|n3X`C zt%b_4!Lzcpn>M|7xaHu4H-HChJ{k?+*_tu+2E4e3rKOf3qQ5`ccl1I^7?IEuHdMF7 zzh5SS{`^v?G_j9@poS+=P)_ATg=3iDA|zo!ki-z9R4?Wm@qSOtO*X)(^tv2>sqU>E zQ>+r!Rp?05ABUYt?;qxa;Qjsi^xB9?q?3CHT=2dS1o=!Tz?K=l6T#2b7W6HFVCfbJ z>#bx3jnL!U>sz+Y3P0?XU_4K+MHgy})=(5_d3VtiK>U{mv;V^ftwdwgIa$hoHev61 z+~|+rP=h{8kezi)B`<93! zom-|O*n!s(6?px<_8@?!$QZ!E>LprTw4IBG2ltGyD*;5hd^nHW%az z$=HKcsaPgc-WVSIMVsTuf{4-1{=|5BS3RNXd9HZn?L6qnvQjukgh0REI#R=yZ9qd! z;_N+?I-T)?{5$`g_9xhIPmh#)>%Wk0?o7^B+A{0ao3D_EPpk}5PC^jM*nSDpBus}5 zL`*zw*94$oQ5CV7F7k~*imUNIveBTt%ZU41Bw9GIP-&w))>Y1{*f^6XR;X8V+~`7hnCN-}@m zxv&_?Gb^4XmF5q>#9NlN)5kIG^MS!eGFsv9RR$i_-l`k7+X z8^n{K{kw_Vt?g0nf~INFZj5X>2J_~PwH-N36d<0N@LXJ{$u6)}w^)$cq48|#Cm7}c z#oODzx%Yfc{*kB4-Y1?bTcnfnJsb~{A);bszEDi=$ts#df?>D~e|+iBNi+$4ivTcIi22=I*>`;Z;PP4W~ynCTP<-oPfEPhiP|Qyif2MM#lluY@TXHa$}=S?K0Z7> z@tBA!7IHnn%!wlGx0%5X>7vG+k)YiV0D6e`Ptdp3O)4N0_5uoNxh4{6=jMRi=!T;| zpLJYomY_f0;!(TnJ7acx_ltOCWsG>r?&y)MjYZrjnm^t5i|*Os9E}L1<5g? zIg-lT`&IS5QYeA0$)1k|?P+tvtVI3L<=*<}i_ERNgc0=Z3c>&B=3ZtU!DN zswqTfj8w6-0Ge%=-S%!1#)+$&JGrIqe0~BD*y9MAm=p%k4Ltqm`Uibwixb9zvY=K> zzi9_H&^?6FUw%?Yph5Q=9cH;6g_cY*W_%grfT<=J(q9F12LACLWG?3*m6hI%<^UZyi*I6Di7RoV{xQ5|e0pX*8Yf_A@)~S*) zFC8@HPW8Ufp{Hj*y}W(qnSa$f5vFU<*MG!+ERg;=!&k*B(2Wc!*@kPnHVjZzZ|{KyB}2ID?z2GQQ5qR}LVq)-EGLJZmjO<_j-;fy zS}D{%!&*>F^;t%32uC(9y{ZdgcpqB{upYib<%TN6-G_Mi-m=X+W19FH{D2_m0Qtq zvIgncP#|*6Mw(tT&C)$^gxIFuHxB$&OPY;Qb*{El7`iQLNvnVm(`>}C-@_s(68=t2 zJhoLc_X5*O5nst&zj^4gB~exJe=MXMObeerof*pF?k0JWz-_ikm=`|BTBJ+zwH#>h z5{Ag${LwsBrK!jiNx5ZbORBi%H?)f*iYu^E#KvVMIt^q~Ph8J$IFOR@f5cdz|EPam z)X1DuL5^bp_Cgaoz}65Um=(z}k2mCtarOF$T1G3*8- z2TZVfM=H(jYYqQ8RY9iM{qWyb2153c2UA`2NszrZCMjt**_7?mIC;3t9yZqvn>~at zNHIp#?p+_U@dxwon%+o(V$u}S+KSQ{ihqGNROY9G(1X@Q$PeV5 zyW)J8`ti1g18#I$)!Or7DQ@fxuMOUs*0w6|lZ{IU7zf7vHFpl6M}MO~j#hIIJV&Xv zMz{O+LYcW(92;O5PyDJ2z=PYmz2N_HR%{rM?{jf_SzBjXW#9m}U-mmc+D%XTA3?0Z A5dZ)H delta 1430 zcmV;H1!?+|6q^e(iBL{Q4GJ0x0000DNk~Le0000O0000O2nGNE0N{5$_y7O^24YJ` zL;(K){{a7>y{D6rAsBxLbV*G`2h|1_3k4cL>0e|300k&XL_t(|oVAu;Op{j_#((Gg zzV_=MXp3S4N>P|hokBn;I2|2fYBHTSYGN{tqsvU@r7^~sEt$~^y~3GYY`ak7g)x~I zdNJLUteSqCscV_e2@I>Ft}Ug49R=1>kbb)`m=W<$vh2M)IXQp7JkR@{^Bnk}OZ4~m zzi`9j$BzkxLNqlsq3b$A2!s%?3{YlUymRLcH*Va}1AzdcP>8v6=dy0yI@YgWFP1G^ zhN37)l7u8lucjcGOrmL;9tZ>o27}C-H;?A#W;`Ab!C;W#;bAH(D+!0gOioUU&6_u~ zc=2KsMM0M37b<^J08XAf$?e;>*|lpIM~@!G<#IjUU@=>`c<~}zw{9hwOmgbfDShwW zy_`OMT3D@COePbGqC6KO0W>x?Qe0fj_U+qoxm@IOIl8;Mi9{mQH`LS9)6IqR=ecnH z0-;cdWHQOETetL7Dn&M%Wol~b#TJc>jNtKj^jIv$nKOT9Sh{p64<9~c<;s=JpFf|2 z2R~!#@e~$|l}t9n)vG=%7Av*2wKyCOQBY8Tq9|5c{y&kdxlpMfDi(= z+l{7a3=V$|a^S!Lu3fu^!{MO1dIfVFHd2EF3`8S@eh$#myc)aR&WRHzxP19CWo2dT z+qVy|*Gn)M)Sm%Jl0;Ke6Mny+%F0TP963U3Yb&a%a^*?~AGWpeqvpqKknp_O!2Eed zIE&{H4u{EPGMG(f_UzfirAwEdfhf}o8X6kJ-MfEx^>jMT=f{q*V8H@fTU%Ju)WDYa z){{;>B>a01zjOw17SCbjiY54bKI-b~P*o#=Kmd=&!~XsI@p`>PqftGbPK&1(O$b4K zeLb3{@yVy3GBKVd5sz{8Cynv3QI@?{hCVe(V_h}HMK?cU z2{M1#%(G3Nw#n^w#x4z^(9NFtE(fGO5yc-X9xUyT>XAO zJ9oU#SSmqgG|gx_O=K`h=dItk+11OF@7n!2kb~{F+k%@^3dV713Wf@75$md$~%^Zob|F_#ec1T044knIcXt3LI3~&07*qoM6N<$f(J39UH||9 diff --git a/resources/LightApp.xml b/resources/LightApp.xml new file mode 100644 index 0000000..fc6ef64 --- /dev/null +++ b/resources/LightApp.xml @@ -0,0 +1,31 @@ + + +
+ + + +
+
+ + +
+
diff --git a/resources/Makefile.am b/resources/Makefile.am index 12024b5..aa7ed4f 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -1,5 +1,4 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2005-2008 OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -15,19 +14,19 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # -* Makefile *- -# # Author : Patrick GOLDBRONN (CEA) # Date : 28/06/2001 # Modified by : Alexander BORODIN (OCN) - autotools usage - +# include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_salomeres_DATA = \ LIGHT.png \ line_icon.png \ paragraph_icon.png \ + LightApp.xml \ SalomeApp.xml \ queen.txt diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index dc9228e..fc6ef64 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -1,3 +1,23 @@ +
diff --git a/src/LIGHTGUI/LIGHTGUI.cxx b/src/LIGHTGUI/LIGHTGUI.cxx index 9bbc9a0..5bbd2ff 100644 --- a/src/LIGHTGUI/LIGHTGUI.cxx +++ b/src/LIGHTGUI/LIGHTGUI.cxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,66 +14,81 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI.cxx +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -using namespace std; - #include "LIGHTGUI.h" #include "LIGHTGUI_Selection.h" #include "LIGHTGUI_DataModel.h" #include "LightApp_DataOwner.h" +#include "LIGHTGUI_TextPrs.hxx" #include +#include #include #include -#include "LightApp_Selection.h" - -#include -#include - -#include +#include #include #include #include -//================================================================================= -// function : LIGHTGUI() -// purpose : Constructor : sets the default name for the module -//================================================================================= +#include +#include +#include +#include +#include + +/*! + \class LIGHTGUI + \brief Implementation of the sample light (no-CORBA-engine) + SALOME module. +*/ + +/*! + \brief Constructor. Sets the default name for the module. +*/ LIGHTGUI::LIGHTGUI() - : LightApp_Module( "LIGHTGUI" ) +: LightApp_Module( "LIGHTGUI" ) { } -//================================================================================= -// function : initialize() -// purpose : module intitialization: creates menus, prepares context menu, etc. -//================================================================================= -void LIGHTGUI::initialize ( CAM_Application* app ) +/*! + \brief Destructor. +*/ +LIGHTGUI::~LIGHTGUI() +{ +} + +/*! + \brief Initialize module. Creates menus, prepares context menu, etc. + \param app application instance +*/ +void LIGHTGUI::initialize( CAM_Application* app ) { LightApp_Module::initialize( app ); - QWidget* parent = application()->desktop(); - - createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIconSet(), tr( "MEN_LOAD_FILE" ), - tr( "STB_LOAD_FILE" ), 0, parent, false, this, SLOT( onLoadFile() ) ); - createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIconSet(), tr( "MEN_DISPLAY_LINE" ), - tr( "STB_DISPLAY_LINE" ), 0, parent, false, this, SLOT( onDisplayLine() ) ); - createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIconSet(), tr( "MEN_SAVE_FILE" ), - tr( "STB_SAVE_FILE" ), 0, parent, false, this, SLOT( onSaveFile() ) ); - createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIconSet(), tr( "MEN_EDIT_LINE" ), - tr( "STB_EDIT_LINE" ), 0, parent, false, this, SLOT( onEditLine() ) ); - createAction( lgAddLine, tr( "TOP_ADD_LINE" ), QIconSet(), tr( "MEN_ADD_LINE" ), - tr( "STB_ADD_LINE" ), 0, parent, false, this, SLOT( onAddLine() ) ); - createAction( lgDelLine, tr( "TOP_DEL_LINE" ), QIconSet(), tr( "MEN_DEL_LINE" ), - tr( "STB_DEL_LINE" ), 0, parent, false, this, SLOT( onDelLine() ) ); - createAction( lgClear, tr( "TOP_CLEAR_ALL" ), QIconSet(), tr( "MEN_CLEAR_ALL" ), - tr( "STB_CLEAR_ALL" ), 0, parent, false, this, SLOT( onClear() ) ); + SUIT_Desktop* desk = application()->desktop(); + + createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIcon(), tr( "MEN_LOAD_FILE" ), + tr( "STB_LOAD_FILE" ), 0, desk, false, this, SLOT( onLoadFile() ) ); + createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIcon(), tr( "MEN_DISPLAY_LINE" ), + tr( "STB_DISPLAY_LINE" ), 0, desk, false, this, SLOT( onDisplayLine() ) ); + createAction( lgEraseLine, tr( "TOP_ERASE_LINE" ), QIcon(), tr( "MEN_ERASE_LINE" ), + tr( "STB_ERASE_LINE" ), 0, desk, false, this, SLOT( onEraseLine() ) ); + createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIcon(), tr( "MEN_SAVE_FILE" ), + tr( "STB_SAVE_FILE" ), 0, desk, false, this, SLOT( onSaveFile() ) ); + createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIcon(), tr( "MEN_EDIT_LINE" ), + tr( "STB_EDIT_LINE" ), 0, desk, false, this, SLOT( onEditLine() ) ); + createAction( lgAddLine, tr( "TOP_ADD_LINE" ), QIcon(), tr( "MEN_ADD_LINE" ), + tr( "STB_ADD_LINE" ), 0, desk, false, this, SLOT( onAddLine() ) ); + createAction( lgDelLine, tr( "TOP_DEL_LINE" ), QIcon(), tr( "MEN_DEL_LINE" ), + tr( "STB_DEL_LINE" ), 0, desk, false, this, SLOT( onDelLine() ) ); + createAction( lgClear, tr( "TOP_CLEAR_ALL" ), QIcon(), tr( "MEN_CLEAR_ALL" ), + tr( "STB_CLEAR_ALL" ), 0, desk, false, this, SLOT( onClear() ) ); int aFileMnu = createMenu( tr( "MEN_FILE" ), -1, -1 ); createMenu( separator(), aFileMnu, -1, 10 ); @@ -84,85 +96,79 @@ void LIGHTGUI::initialize ( CAM_Application* app ) createMenu( lgSaveFile, aFileMnu, 10 ); int aLightMnu = createMenu( tr( "MEN_LIGHT" ), -1, -1, 50 ); - createMenu( lgDisplayLine, aLightMnu, 10 ); - createMenu( lgEditLine, aLightMnu, 10 ); - createMenu( lgAddLine, aLightMnu, 10 ); - createMenu( separator(), aLightMnu, -1, 10 ); - createMenu( lgDelLine, aLightMnu, 10 ); - createMenu( lgClear, aLightMnu, 10 ); + createMenu( lgAddLine, aLightMnu, 10 ); + createMenu( lgEditLine, aLightMnu, 10 ); + createMenu( lgDelLine, aLightMnu, 10 ); + createMenu( separator(), aLightMnu, -1, 10 ); + createMenu( lgClear, aLightMnu, 10 ); - // popup for object browser - int parentId = -1; - QString rule = "client='ObjectBrowser' and selcount=1 and type='TextLine'"; + QString rule = "(client='ObjectBrowser' or client='OCCViewer') and selcount=1 and type='TextLine' and !empty"; - popupMgr()->insert ( action( lgDisplayLine ), parentId, 0 ); - popupMgr()->setRule( action( lgDisplayLine ), rule, true ); + popupMgr()->insert ( action( lgDisplayLine ), -1, 0 ); + popupMgr()->setRule( action( lgDisplayLine ), rule + " and !visible" ); - popupMgr()->insert ( action( lgEditLine ), parentId, 0 ); - popupMgr()->setRule( action( lgEditLine ), rule, true ); + popupMgr()->insert ( action( lgEraseLine ), -1, 0 ); + popupMgr()->setRule( action( lgEraseLine ), rule + " and activeView='OCCViewer' and visible" ); - popupMgr()->insert ( action( lgAddLine ), parentId, 0 ); - popupMgr()->setRule( action( lgAddLine ), rule, true ); + rule = "client='ObjectBrowser' and selcount=1 and type='TextLine'"; - popupMgr()->insert ( separator(), parentId, 0 ); + popupMgr()->insert ( action( lgEditLine ), -1, 0 ); + popupMgr()->setRule( action( lgEditLine ), rule ); - popupMgr()->insert ( action( lgDelLine ), parentId, 0 ); - popupMgr()->setRule( action( lgDelLine ), rule, true ); + popupMgr()->insert ( action( lgAddLine ), -1, 0 ); + popupMgr()->setRule( action( lgAddLine ), rule ); - popupMgr()->insert ( action( lgClear ), parentId, 0 ); -} + popupMgr()->insert ( separator(), -1, 0 ); -//================================================================================= -// function : iconName() -// purpose : Module icon name -//================================================================================= -QString LIGHTGUI::iconName() const -{ - return QObject::tr( "ICON_LIGHT" ); + popupMgr()->insert ( action( lgDelLine ), -1, 0 ); + popupMgr()->setRule( action( lgDelLine ), rule ); + + rule = "client='ObjectBrowser'"; + + popupMgr()->insert ( action( lgClear ), -1, 0 ); + popupMgr()->setRule( action( lgClear ), rule ); } -//================================================================================= -// function : contextMenuPopup() -// purpose : defines context popup menu -//================================================================================= -void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QString& str) +/*! + \brief Get list of compliant dockable GUI elements + \param m map to be filled in ("type":"default_position") +*/ +void LIGHTGUI::windows( QMap& m ) const { - LIGHTGUI_Selection* sel = new LIGHTGUI_Selection(); - sel->init( client, getApp()->selectionMgr() ); - popupMgr()->updatePopup( menu, sel ); - delete sel; + m.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); + m.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); } -//================================================================================= -// function : windows() -// purpose : gets a list of compliant dockable GUI elements -//================================================================================= -void LIGHTGUI::windows ( QMap& aMap ) const +/*! + \brief Create custom popup menu selection object. + \return new selected object +*/ +LightApp_Selection* LIGHTGUI::createSelection() const { - aMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::DockLeft ); - aMap.insert( LightApp_Application::WT_PyConsole, Qt::DockBottom ); + return new LIGHTGUI_Selection(); } -//================================================================================= -// function : createDataModel() -// purpose : create data model -//================================================================================= +/*! + \brief Create data model. + \return module specific data model +*/ CAM_DataModel* LIGHTGUI::createDataModel() { return new LIGHTGUI_DataModel( this ); } -//================================================================================= -// function : selectedLine() -// purpose : get the number of selected line (multiple selection is not supported) -//================================================================================= +/*! + \brief Get the identifier of the currently selected object. + \return ID of the currently selected line or -1 if not appropriate + object (or multiple objects) is selected. +*/ int LIGHTGUI::selectedLine() { - int aPosition = 0; // bad value + int id = -1; // bad value // Look for selected lines LightApp_Application* app = getApp(); - LightApp_SelectionMgr* mgr = app ? app->selectionMgr() : NULL; + LightApp_SelectionMgr* mgr = app ? app->selectionMgr() : 0; if ( mgr ) { SUIT_DataOwnerPtrList anOwnersList; mgr->selected( anOwnersList ); @@ -172,18 +178,163 @@ int LIGHTGUI::selectedLine() const LightApp_DataOwner* owner = dynamic_cast( anOwnersList[0].get() ); QString anEntry = owner->entry(); - int anIndex = anEntry.find("_"); - aPosition = (anEntry.mid(anIndex+1, anEntry.length() - anIndex)).toInt();//lineNb(); + id = LIGHTGUI_DataModel::id( anEntry ); + } + } + return id; +} + +/*! + \brief Display the object with the specified identifier. + \param id object ID + \param allViewers if \c true the object is displayed in all existing viewers + (OCC viewers are supported only) + \param upd if \c true, update the viewer(s) +*/ +void LIGHTGUI::displayLine( const int id, const bool allViewers, const bool upd ) +{ + LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); + if ( dm && id > 0 ) { + ViewManagerList viewers; + if ( allViewers ) + getApp()->viewManagers( "OCCViewer", viewers ); + else + viewers.append( getApp()->getViewManager( "OCCViewer", true ) ); + + for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) { + OCCViewer_ViewManager* aMgr = dynamic_cast( *it ); + if ( !aMgr ) continue; + SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel(); + if ( !aViewer ) continue; + QString aLine = dm->getLineText( id ); + QString entry = LIGHTGUI_DataModel::entry( id ); + SOCC_Prs* prs = dynamic_cast( aViewer->CreatePrs( entry.toLatin1() ) ); + if ( prs ) { + double aX = 0, aY = dm->lineNb( id ) * LIGHTGUI_TextPrs::TextSize(), aZ = 0; + aViewer->Erase( prs, true ); + Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.toLatin1(), gp_Pnt( aX, aY, aZ ) ); + aPrs->SetOwner( new SALOME_InteractiveObject( entry.toLatin1(), "" ) ); + prs->Clear(); + prs->AddObject( aPrs ); + aViewer->Display( prs ); + if ( upd ) + aViewer->Repaint(); + } + } + } +} + +/*! + \brief Erase the object with the specified identifier. + \param id object ID + \param allViewers if \c true the object is erased in all existing viewers + (OCC viewers are supported only) + \param upd if \c true, update the viewer(s) +*/ +void LIGHTGUI::eraseLine( const int id, const bool allViewers, const bool upd ) +{ + LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); + if ( dm && id > 0 ) { + ViewManagerList viewers; + if ( allViewers ) + getApp()->viewManagers( "OCCViewer", viewers ); + else + viewers.append( getApp()->getViewManager( "OCCViewer", true ) ); + + for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) { + OCCViewer_ViewManager* aMgr = dynamic_cast( *it ); + if ( !aMgr ) continue; + SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel(); + if ( !aViewer ) continue; + QString entry = LIGHTGUI_DataModel::entry( id ); + SOCC_Prs* prs = dynamic_cast( aViewer->CreatePrs( entry.toLatin1() ) ); + if ( prs ) { + aViewer->Erase( prs, false ); + if ( upd ) + aViewer->Repaint(); + } } } - return aPosition; } -//================================================================================= -// function : activateModule() -// purpose : module's activation -//================================================================================= -bool LIGHTGUI::activateModule ( SUIT_Study* study ) +/*! + \brief Update the object presentation. + \param id object ID + \param allViewers if \c true the object is updated in all existing viewers + (OCC viewers are supported only) + \param upd if \c true, update the viewer(s) +*/ +void LIGHTGUI::updateLine( const int id, const bool allViewers, const bool upd ) +{ + LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); + if ( dm && id > 0 ) { + ViewManagerList viewers; + if ( allViewers ) + getApp()->viewManagers( "OCCViewer", viewers ); + else + viewers.append( getApp()->getViewManager( "OCCViewer", true ) ); + + for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) { + OCCViewer_ViewManager* aMgr = dynamic_cast( *it ); + if ( !aMgr ) continue; + SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel(); + if ( !aViewer ) continue; + QString aLine = dm->getLineText( id ); + QString entry = LIGHTGUI_DataModel::entry( id ); + if ( aViewer->isVisible( new SALOME_InteractiveObject( entry.toLatin1(), "" ) ) ) { + SOCC_Prs* prs = dynamic_cast( aViewer->CreatePrs( entry.toLatin1() ) ); + if ( prs ) { + if ( aLine.isEmpty() ) { + aViewer->Erase( prs, false ); + } + else { + double aX = 0, aY = dm->lineNb( id ) * LIGHTGUI_TextPrs::TextSize(), aZ = 0; + aViewer->Erase( prs, true ); + Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.toLatin1(), gp_Pnt( aX, aY, aZ ) ); + aPrs->SetOwner( new SALOME_InteractiveObject( entry.toLatin1(), "" ) ); + prs->Clear(); + prs->AddObject( aPrs ); + aViewer->Display( prs ); + } + if ( upd ) + aViewer->Repaint(); + } + } + } + } +} + +/*! + \brief Erase objects. + \param l objects IDs list + \param allViewers if \c true the objects are erased in all existing viewers + (OCC viewers are supported only) +*/ +void LIGHTGUI::eraseLines( const QList& l, const bool allViewers ) +{ + for ( QList::const_iterator it = l.begin(); it != l.end(); ++it ) + eraseLine( *it, allViewers ); +} + +/*! + \brief Update objects presentations. + \param l objects IDs list + \param allViewers if \c true the objects are updated in all existing viewers + (OCC viewers are supported only) +*/ +void LIGHTGUI::updateLines( const QList& l, const bool allViewers ) +{ + for ( QList::const_iterator it = l.begin(); it != l.end(); ++it ) + updateLine( *it, allViewers ); +} + +/*! + \brief Activate module. + \param study current study + \return \c true if activaion is done successfully or 0 to prevent + activation on error +*/ +bool LIGHTGUI::activateModule( SUIT_Study* study ) { bool isDone = LightApp_Module::activateModule( study ); if ( !isDone ) return false; @@ -193,11 +344,13 @@ bool LIGHTGUI::activateModule ( SUIT_Study* study ) return isDone; } -//================================================================================= -// function : deactivateModule() -// purpose : module's deactivation -//================================================================================= -bool LIGHTGUI::deactivateModule ( SUIT_Study* study ) +/*! + \brief Deactivate module. + \param study current study + \return \c true if deactivaion is done successfully or 0 to prevent + deactivation on error +*/ +bool LIGHTGUI::deactivateModule( SUIT_Study* study ) { // hide menus setMenuShown( false ); @@ -205,10 +358,9 @@ bool LIGHTGUI::deactivateModule ( SUIT_Study* study ) return LightApp_Module::deactivateModule( study ); } -//================================================================================= -// function : onLoadFile() -// purpose : "Load File" action slot -//================================================================================= +/*! + \brief Called when "load text file" action is activated. +*/ void LIGHTGUI::onLoadFile() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); @@ -219,25 +371,25 @@ void LIGHTGUI::onLoadFile() filtersList.append( tr( "LIGHTGUI_MEN_ALL_FILES" ) ); // Select a file to be loaded - QString aFileName = getApp()->getFileName( true, QString::null, filtersList.join( ";;" ), tr( "LIGHTGUI_MEN_LOAD" ), 0 ); + QString aFileName = getApp()->getFileName( true, QString(), filtersList.join( ";;" ), tr( "LIGHTGUI_MEN_LOAD" ), 0 ); if ( !aFileName.isEmpty() ) { // Load the file + QList l = dm->getIds(); if ( dm->loadFile( aFileName ) ) { + eraseLines( l, true ); updateObjBrowser( true ); } else { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_LOAD_FAILED" ), - tr( "BUT_OK" ) ); + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_LOAD_FAILED" ) ); } } } -//================================================================================= -// function : onSaveFile() -// purpose : "Save File" action slot -//================================================================================= +/*! + \brief Called when "save text file" action is activated. +*/ void LIGHTGUI::onSaveFile() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); @@ -252,174 +404,194 @@ void LIGHTGUI::onSaveFile() if ( !aFileName.isEmpty() ) { // Dump the file if ( !dm->dumpFile( aFileName ) ) { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_DUMP_FAILED" ), - tr( "BUT_OK" ) ); + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_DUMP_FAILED" ) ); } } } -//================================================================================= -// function : onDisplayLine() -// purpose : "Display Line" action slot -//================================================================================= +/*! + \brief Called when "display selected line" action is activated. +*/ void LIGHTGUI::onDisplayLine() { - OCCViewer_ViewManager* aMgr = (OCCViewer_ViewManager*)getApp()->getViewManager("OCCViewer", true); - SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel(); - if ( !aViewer ) + LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); + if ( !dm ) return; + + // Define position + int id = selectedLine(); + QString aLine = dm->getLineText( id ); + + // Check, that position is defined + if ( id == -1 || aLine.isEmpty() ) { + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_SELECT_LINE" ) ); return; + } + displayLine( id ); +} +/*! + \brief Called when "erase selected line" action is activated. +*/ +void LIGHTGUI::onEraseLine() +{ LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); if ( !dm ) return; - int aPosition = selectedLine(); - QString aLine = dm->getLineText( aPosition ); - double aX = 0, aY = 0, aZ = 0; - QString aStrId = QString("LIGHTGUI_%1").arg(aPosition); - - Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.isNull() ? "" : aLine, gp_Pnt( aX, aY, aZ ) ); - aPrs->SetOwner(new SALOME_InteractiveObject( aStrId, "" ) ); - SOCC_Prs* prs = dynamic_cast( aViewer->CreatePrs() ); // aStringID is an "entry" - if ( prs ) { - aViewer->EraseAll(); - prs->AddObject( aPrs ); - aViewer->Display( prs ); - aViewer->Repaint(); - } + + // Define position + int id = selectedLine(); + QString aLine = dm->getLineText( id ); + + // Check, that position is defined + if ( id == -1 || aLine.isEmpty() ) { + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_SELECT_LINE" ) ); + return; + } + eraseLine( id ); } -//================================================================================= -// function : onEditLine() -// purpose : "Edit Line" action slot -//================================================================================= +/*! + \brief Called when "edit selected line" action is activated. +*/ void LIGHTGUI::onEditLine() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); if ( !dm ) return; // Define position - int aPosition = selectedLine(); + int id = selectedLine(); // Check, that position is defined - if ( !aPosition ) { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_SELECT_LINE" ), - tr( "BUT_OK" ) ); + if ( id == -1 ) { + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_SELECT_LINE" ) ); return; } // Get new text bool isOk; - QString aText = QInputDialog::getText( tr( "LIGHTGUI_EDIT_LINE" ), - QString::null, + QString aText = QInputDialog::getText( application()->desktop(), + tr( "LIGHTGUI_EDIT_LINE" ), + QString(), QLineEdit::Normal, - dm->getLineText( aPosition ), - &isOk, - getApp()->desktop() ); + dm->getLineText( id ), + &isOk ); if ( !isOk ) return; // try to change a text of the selected line - isOk = dm->setLineText( aPosition, aText ); + + isOk = dm->setLineText( id, aText ); + if ( isOk ) { + updateLine( id, true ); updateObjBrowser( true ); } else { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_EDIT_FAILED" ), - tr( "BUT_OK") ); + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_EDIT_FAILED" ) ); } } -//================================================================================= -// function : onAddLine() -// purpose : "Insert Line" action slot -//================================================================================= +/*! + \brief Called when "insert new line" action is activated. +*/ void LIGHTGUI::onAddLine() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); if ( !dm ) return; // Define position - int aPosition = selectedLine(); + int id = selectedLine(); // Get new text bool isOk; - QString aText = QInputDialog::getText( tr( "LIGHTGUI_ADD_LINE" ), - QString::null, + QString aText = QInputDialog::getText( getApp()->desktop(), + tr( "LIGHTGUI_ADD_LINE" ), + QString(), QLineEdit::Normal, - QString::null, - &isOk, - getApp()->desktop() ); + QString(), + &isOk ); if ( !isOk ) return; + QList l = dm->getIds(); + // try to insert/add text line - isOk = dm->insertLineBefore( aPosition, aText ); + isOk = dm->insertLineBefore( id, aText ); if ( isOk ) { + updateLines( l, true ); updateObjBrowser( true ); } else { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_ADD_FAILED" ), - tr( "BUT_OK") ); + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_ADD_FAILED" ) ); } } -//================================================================================= -// function : onDelLine() -// purpose : "Delete Line" action slot -//================================================================================= +/*! + \brief Called when "delete selected line" action is activated. +*/ void LIGHTGUI::onDelLine() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); if ( !dm ) return; // Define position - int aPosition = selectedLine(); + int id = selectedLine(); // Check, that position is defined - if ( !aPosition ) { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_SELECT_LINE" ), - tr( "BUT_OK" ) ); + if ( id == -1 ) { + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_SELECT_LINE" ) ); return; } + QList l = dm->getIds(); + // try to delete line - bool isOk = dm->deleteTextLine( aPosition ); + bool isOk = dm->deleteTextLine( id ); if ( isOk ) { + updateLines( l, true ); updateObjBrowser( true ); } else { - SUIT_MessageBox::warn1 ( application()->desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_DELETE_FAILED" ), - tr( "BUT_OK") ); + SUIT_MessageBox::warning ( application()->desktop(), + tr( "WRN_WARNING" ), + tr( "WRN_DELETE_FAILED" ) ); } } -//================================================================================= -// function : onClear() -// purpose : "Clear Text" action slot -//================================================================================= +/*! + \brief Called when "clear all contents" action is activated. +*/ void LIGHTGUI::onClear() { LIGHTGUI_DataModel* dm = dynamic_cast( dataModel() ); if ( !dm ) return; + QList l = dm->getIds(); + eraseLines( l, true ); + dm->clearAll(); + updateObjBrowser( true ); } -//================================================================================= -// function : createModule() -// purpose : exports module object -//================================================================================= +/*! + \fn CAM_Module* createModule(); + \brief Export module instance (factory function). + \return new created instance of the module +*/ + #ifdef WNT #define LIGHTGUI_EXPORT __declspec(dllexport) #else // WNT diff --git a/src/LIGHTGUI/LIGHTGUI.h b/src/LIGHTGUI/LIGHTGUI.h index 0064ca9..a69b233 100644 --- a/src/LIGHTGUI/LIGHTGUI.h +++ b/src/LIGHTGUI/LIGHTGUI.h @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,47 +14,70 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI.h +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #ifndef LIGHTGUI_H #define LIGHTGUI_H #include +class QMenu; +class LightApp_Selection; +class LightApp_SelectionMgr; + class LIGHTGUI: public LightApp_Module { Q_OBJECT - enum { lgLoadFile = 931, lgSaveFile, lgDisplayLine, lgEditLine, lgAddLine, lgDelLine, lgClear }; + + //! Menu actions + enum { + lgLoadFile = 931, //!< load text file + lgSaveFile, //!< save text file + lgDisplayLine, //!< display selected line + lgEraseLine, //!< erase selected line + lgEditLine, //!< edit selected line + lgAddLine, //!< insert new line + lgDelLine, //!< delete selected line + lgClear //!< clear all contents + }; public: LIGHTGUI(); + ~LIGHTGUI(); + + void initialize( CAM_Application* ); - virtual void initialize ( CAM_Application* ); - virtual QString iconName() const; + void windows( QMap& ) const; - virtual void contextMenuPopup ( const QString&, QPopupMenu*, QString& ); - virtual void windows ( QMap& ) const; + LightApp_Selection* createSelection() const; protected: - virtual CAM_DataModel* createDataModel(); + CAM_DataModel* createDataModel(); int selectedLine(); + void displayLine( const int, const bool = false, const bool = true ); + void eraseLine( const int, const bool = false, const bool = true ); + void updateLine( const int, const bool = false, const bool = true ); + void eraseLines( const QList&, const bool = false ); + void updateLines( const QList&, const bool = false ); + public slots: - virtual bool activateModule ( SUIT_Study* ); - virtual bool deactivateModule ( SUIT_Study* ); + bool activateModule( SUIT_Study* ); + bool deactivateModule( SUIT_Study* ); private slots: - void onLoadFile(); - void onSaveFile(); - void onDisplayLine(); - void onEditLine(); - void onAddLine (); - void onDelLine (); - void onClear (); + void onLoadFile(); + void onSaveFile(); + void onDisplayLine(); + void onEraseLine(); + void onEditLine(); + void onAddLine(); + void onDelLine(); + void onClear(); }; #endif // LIGHTGUI_H diff --git a/src/LIGHTGUI/LIGHTGUI.pro b/src/LIGHTGUI/LIGHTGUI.pro new file mode 100644 index 0000000..97a7c69 --- /dev/null +++ b/src/LIGHTGUI/LIGHTGUI.pro @@ -0,0 +1,69 @@ +# Copyright (C) 2005-2008 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +TEMPLATE = lib +TARGET = LIGHT +DESTDIR = ../../lib +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +CASROOT = $$(CASROOT) +CAS_CPPFLAGS = $${CASROOT}/inc + +VTKHOME = $$(VTKHOME) +VTK_INCLUDES = $${VTKHOME}/include/vtk + +PYTHONVER=2.4 +PYTHONHOME=$$(PYTHONHOME) +PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER} + +INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $${VTK_INCLUDES} $${PYTHONINC} +INCLUDEPATH += ../LightApp +LIBS += -L../../lib -lLightApp + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += LIGHTGUI_EXPORTS + +HEADERS = LIGHTGUI.h +HEADERS += LIGHTGUI_Selection.h +HEADERS += LIGHTGUI_DataObject.h +HEADERS += LIGHTGUI_DataModel.h +HEADERS += LIGHTGUI_TextPrs.h +HEADERS += LIGHTGUI_TextPrs.h + +SOURCES = LIGHTGUI.cxx +SOURCES += LIGHTGUI_Selection.cxx +SOURCES += LIGHTGUI_DataObject.cxx +SOURCES += LIGHTGUI_DataModel.cxx +SOURCES += LIGHTGUI_TextPrs.cxx + +TRANSLATIONS = resources/LIGHTGUI_msg_en.ts \ + resources/LIGHTGUI_images.ts + +ICONS = resources/*.png + +includes.files = $$HEADERS +includes.path = ../../include + +resources.files = $$ICONS resources/*.qm +resources.path = ../../resources + +INSTALLS += includes resources diff --git a/src/LIGHTGUI/LIGHTGUI_DataModel.cxx b/src/LIGHTGUI/LIGHTGUI_DataModel.cxx index 0aa9a19..73653ba 100644 --- a/src/LIGHTGUI/LIGHTGUI_DataModel.cxx +++ b/src/LIGHTGUI/LIGHTGUI_DataModel.cxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,60 +14,64 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_DataModel.cxx +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #include "LIGHTGUI_DataModel.h" #include "LIGHTGUI_DataObject.h" #include -#include -#include #include #include +#include +#include -#include -#include - -#include -#include - -#include -#include - -//================================================================================= -// function : LIGHTGUI_DataModel() -// purpose : constructor -//================================================================================= -LIGHTGUI_DataModel::LIGHTGUI_DataModel ( CAM_Module* theModule ) - : LightApp_DataModel( theModule ), - myFileName( "" ), - myStudyURL( "" ) +#include +#include +#include +#include + +/*! + \class LIGHTGUI_DataModel + \brief LIGHT module data model. +*/ + +/*! + \brief Constructor + \param module parent module +*/ +LIGHTGUI_DataModel::LIGHTGUI_DataModel( CAM_Module* module ) +: LightApp_DataModel( module ), + myFileName( "" ), + myStudyURL( "" ), + myMaxId( 0 ) { } -//================================================================================= -// function : ~LIGHTGUI_DataModel() -// purpose : destructor -//================================================================================= +/*! + \brief Destructor. +*/ LIGHTGUI_DataModel::~LIGHTGUI_DataModel() { } -//================================================================================= -// function : open() -// purpose : Open data model operation -//================================================================================= -bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study, QStringList listOfFiles ) +/*! + \brief Open data model (read data from the files). + \param url study file path + \param study study pointer + \param listOfFiles list of the (temporary) files with data + \return operation status (\c true on success and \c false on error) +*/ +bool LIGHTGUI_DataModel::open( const QString& url, CAM_Study* study, QStringList listOfFiles ) { LightApp_Study* aDoc = dynamic_cast( study ); if ( !aDoc ) return false; - LightApp_DataModel::open( theURL, aDoc, listOfFiles ); + LightApp_DataModel::open( url, aDoc, listOfFiles ); // The first list item contains path to a temporary // directory, where the persistent files was placed @@ -79,7 +80,7 @@ bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study, QString // This module operates with a single persistent file if ( listOfFiles.size() == 2 ) { - myStudyURL = theURL; + myStudyURL = url; QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + listOfFiles[1]; loadFile( aFullPath, aDoc ); } @@ -88,106 +89,113 @@ bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study, QString return true; } -//================================================================================= -// function : save() -// purpose : Save data model operation -//================================================================================= +/*! + \brief Save data model (write data to the files). + \param listOfFiles returning list of the (temporary) files with saved data + \return operation status (\c true on success and \c false on error) +*/ bool LIGHTGUI_DataModel::save( QStringList& theListOfFiles ) { - // 1. Save data to temporary files bool isMultiFile = false; // TODO: decide, how to access this parameter - LightApp_DataModel::save(theListOfFiles); + LightApp_DataModel::save( theListOfFiles ); LightApp_Study* study = dynamic_cast( module()->application()->activeStudy() ); - QString aTmpDir = study->GetTmpDir( myStudyURL.latin1(), isMultiFile ); + QString aTmpDir = study->GetTmpDir( myStudyURL.toLatin1(), isMultiFile ).c_str(); QString aFileName = SUIT_Tools::file( myStudyURL, false ) + "_LIGHTGUI.txt"; QString aFullPath = aTmpDir + aFileName; dumpFile( aFullPath ); - theListOfFiles.append(aTmpDir); - theListOfFiles.append(aFileName); + theListOfFiles.append( aTmpDir ); + theListOfFiles.append( aFileName ); return true; } -//================================================================================= -// function : saveAs() -// purpose : SaveAs data model operation -//================================================================================= -bool LIGHTGUI_DataModel::saveAs ( const QString& theURL, CAM_Study* theStudy, QStringList& theListOfFiles) +/*! + \brief Save data model (write data to the files). + \param url study file path + \param study study pointer + \param listOfFiles returning list of the (temporary) files with saved data + \return operation status (\c true on success and \c false on error) +*/ +bool LIGHTGUI_DataModel::saveAs( const QString& url, CAM_Study* study, QStringList& theListOfFiles ) { - myStudyURL = theURL; - return save(theListOfFiles); + myStudyURL = url; + return save( theListOfFiles ); } -//================================================================================= -// function : close() -// purpose : Close data model operation -//================================================================================= +/*! + \brief Close data model (remove all relevant data). + \return operation status (\c true on success and \c false on error) +*/ bool LIGHTGUI_DataModel::close() { - LightApp_DataModel::close(); - return true; + return LightApp_DataModel::close(); } -//================================================================================= -// function : create() -// purpose : Create data model operation -//================================================================================= +/*! + \brief Create empty data model. + \param study study pointer + \return operation status (\c true on success and \c false on error) +*/ bool LIGHTGUI_DataModel::create( CAM_Study* study ) { - // buildTree( study->root(), QStringList() ); return true; } -//================================================================================= -// function : isModified() -// purpose : default implementation, always returns false so as not to mask study's isModified() -//================================================================================= +/*! + \brief Get 'modified' flag. + \return \c true if data is changed from the last saving +*/ bool LIGHTGUI_DataModel::isModified() const { + // return false to avoid masking study's isModified() return false; } -//================================================================================= -// function : isSaved() -// purpose : default implementation, always returns true so as not to mask study's isSaved() -//================================================================================= +/*! + \brief Get 'saved' flag. + \return \c true if data has been saved +*/ bool LIGHTGUI_DataModel::isSaved() const { + // return true to avoid masking study's isSaved() return true; } -//================================================================================= -// function : update() -// purpose : updates data model -//================================================================================= -void LIGHTGUI_DataModel::update ( LightApp_DataObject* theObj, LightApp_Study* theStudy ) +/*! + \brief Update data model. + \param obj data object (starting for the update) + \param study study pointer +*/ +void LIGHTGUI_DataModel::update( LightApp_DataObject* /*obj*/, LightApp_Study* /*study*/ ) { // Nothing to do here: we always keep the data tree in the up-to-date state // The only goal of this method is to hide default behavior from LightApp_DataModel return; } -//================================================================================= -// function : loadFile() -// purpose : loads text data from the file -//================================================================================= -bool LIGHTGUI_DataModel::loadFile ( const QString& theFileName, CAM_Study* study ) +/* + \brief Load text data from the file. + \param filename file path + \param study study pointer + \return \c true if data is loaded successfully +*/ +bool LIGHTGUI_DataModel::loadFile( const QString& filename, CAM_Study* study ) { - if ( theFileName.isEmpty() ) return false; + if ( filename.isEmpty() ) return false; - myFileName = theFileName; + myFileName = filename; QStringList lines; QFile file ( myFileName ); - if ( file.open( IO_ReadOnly ) ) { + if ( file.open( QIODevice::ReadOnly ) ) { QTextStream stream ( &file ); QString line; - while ( !stream.eof() ) { + while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n' lines += line; } @@ -203,13 +211,14 @@ bool LIGHTGUI_DataModel::loadFile ( const QString& theFileName, CAM_Study* study return false; } -//================================================================================= -// function : dumpFile() -// purpose : saves text data to the file -//================================================================================= -bool LIGHTGUI_DataModel::dumpFile ( const QString& theFileName ) +/*! + \brief Save text data to the file + \param filename file path + \return \c true if data is loaded successfully +*/ +bool LIGHTGUI_DataModel::dumpFile( const QString& filename ) { - QString aFileName = theFileName; + QString aFileName = filename; if ( aFileName.isEmpty() ) aFileName = myFileName; @@ -219,11 +228,11 @@ bool LIGHTGUI_DataModel::dumpFile ( const QString& theFileName ) for ( SUIT_DataObjectIterator it( root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { LIGHTGUI_DataObject* obj = dynamic_cast( it.current() ); if ( obj && obj->lineNb() > 0 ) - lines.insert( lines.at( obj->lineNb()-1 ), obj->lineText() ); + lines.insert( obj->lineNb()-1, obj->lineText() ); } QFile file ( aFileName ); - if ( file.open( IO_WriteOnly ) ) { + if ( file.open( QIODevice::WriteOnly ) ) { QTextStream stream ( &file ); QStringList::Iterator it = lines.begin(); for ( ; it != lines.end(); ++it ) { @@ -238,42 +247,45 @@ bool LIGHTGUI_DataModel::dumpFile ( const QString& theFileName ) return false; } -//================================================================================= -// function : fileName() -// purpose : gets a name of text file previously loaded or saved -//================================================================================= -QString LIGHTGUI_DataModel::fileName () const +/*! + \brief Get latest loaded or saved text file's name. + \return file name (empty string if file has not been loaded or saved) +*/ +QString LIGHTGUI_DataModel::fileName() const { return myFileName; } -//================================================================================= -// function : getLineText() -// purpose : gets text from the given line -//================================================================================= -QString LIGHTGUI_DataModel::getLineText ( const int thePosition ) const +/*! + \brief Get text for the specified line. + \param id line identifier + \return string text for the line with identifier \a id + (empty string is \a id is invalid) +*/ +QString LIGHTGUI_DataModel::getLineText( const int id ) const { QString aText; - LIGHTGUI_DataObject* obj = findObject( thePosition ); + LIGHTGUI_DataObject* obj = findObject( id ); if ( obj ) aText = obj->lineText(); return aText; } -//================================================================================= -// function : setLineText() -// purpose : sets new text to the given line -//================================================================================= -bool LIGHTGUI_DataModel::setLineText ( const int thePosition, const QString& theText ) +/*! + \brief Set text for the specified line. + \param id line identifier + \param txt new string text for the line + \return \c true on success or \c false if \a id is invalid +*/ +bool LIGHTGUI_DataModel::setLineText( const int id, const QString& txt ) { - if ( thePosition <= 0 ) return false; - LIGHTGUI_DataObject* obj = findObject( thePosition ); + LIGHTGUI_DataObject* obj = findObject( id ); if ( obj ) { - if ( theText.stripWhiteSpace().isEmpty() && !obj->lineText().stripWhiteSpace().isEmpty() || - !theText.stripWhiteSpace().isEmpty() && obj->lineText().stripWhiteSpace().isEmpty() ) { - if ( obj->lineText().stripWhiteSpace().isEmpty() ) { + if ( txt.trimmed().isEmpty() && !obj->lineText().trimmed().isEmpty() || + !txt.trimmed().isEmpty() && obj->lineText().trimmed().isEmpty() ) { + if ( obj->lineText().trimmed().isEmpty() ) { // paragraph becomes a text line SUIT_DataObject* newParent = obj->prevBrother(); if ( newParent ) { @@ -288,71 +300,74 @@ bool LIGHTGUI_DataModel::setLineText ( const int thePosition, const QString& the SUIT_DataObject* modelRoot = parent ? parent->parent() : 0; if ( modelRoot && parent ) { int pos = parent->childPos( obj ); - modelRoot->insertChild( obj, modelRoot->childPos( parent )+1 ); + modelRoot->insertChild( obj, modelRoot->childPos( parent ) + 1 ); while ( SUIT_DataObject* next = parent->childObject( pos ) ) obj->appendChild( next ); } } } - obj->setLineText( theText ); + obj->setLineText( txt ); return true; } return false; } -//================================================================================= -// function : insertLineBefore() -// purpose : inserts the text line before the given one or appends a new line -//================================================================================= -bool LIGHTGUI_DataModel::insertLineBefore ( const int thePosition, const QString& theText ) +/*! + \brief Insert new text line. + \param id identifier of the line after which new one should be inserted + (if <=0, new line is added to the end) + \param txt string text + \return \c true on success or \c false if \a id is invalid +*/ +bool LIGHTGUI_DataModel::insertLineBefore( const int id, const QString& txt ) { - // Insert new line before the item at thePosition in the list, - // or at the end() if thePosition is out of range - LIGHTGUI_ModuleObject* modelRoot = dynamic_cast( root() ); + // Insert new line before the item at position in the list, + // or at the end() if position is out of range + LightApp_ModuleObject* modelRoot = dynamic_cast( root() ); LightApp_Study* study = dynamic_cast( module()->application()->activeStudy() ); - if ( thePosition > 0 ) { + if ( id > 0 ) { if ( !modelRoot ) return false; - LIGHTGUI_DataObject* obj = findObject( thePosition ); + LIGHTGUI_DataObject* obj = findObject( id ); if ( !obj || !obj->parent() ) return false; SUIT_DataObject* parent = obj->parent(); - if ( theText.stripWhiteSpace().isEmpty() ) { + if ( txt.trimmed().isEmpty() ) { // insert new paragraph - if ( obj->lineText().stripWhiteSpace().isEmpty() ) { + if ( obj->lineText().trimmed().isEmpty() ) { int pos = modelRoot->childPos( obj ); - modelRoot->insertChild( new LIGHTGUI_DataObject( theText, 0 ), pos ); + modelRoot->insertChild( new LIGHTGUI_DataObject( generateId(), txt, 0 ), pos ); } else { int pos = parent->childPos( obj ); - LIGHTGUI_DataObject* newObj = new LIGHTGUI_DataObject( theText, 0 ); - modelRoot->insertChild( newObj, modelRoot->childPos( parent )+1 ); + LIGHTGUI_DataObject* newObj = new LIGHTGUI_DataObject( generateId(), txt, 0 ); + modelRoot->insertChild( newObj, modelRoot->childPos( parent ) + 1 ); while ( SUIT_DataObject* next = parent->childObject( pos ) ) newObj->appendChild( next ); } } else { // insert new text line - if ( obj->lineText().stripWhiteSpace().isEmpty() ) { + if ( obj->lineText().trimmed().isEmpty() ) { SUIT_DataObject* prevParent = obj->prevBrother(); if ( prevParent ) - prevParent->appendChild( new LIGHTGUI_DataObject( theText, prevParent ) ); + prevParent->appendChild( new LIGHTGUI_DataObject( generateId(), txt, prevParent ) ); } else { int pos = parent->childPos( obj ); - parent->insertChild( new LIGHTGUI_DataObject( theText, 0 ), pos ); + parent->insertChild( new LIGHTGUI_DataObject( generateId(), txt, 0 ), pos ); } } } else { // append new paragraph/line if ( modelRoot ) - theText.stripWhiteSpace().isEmpty() ? new LIGHTGUI_DataObject( theText, modelRoot ) : - new LIGHTGUI_DataObject( theText, modelRoot->lastChild() ); + txt.trimmed().isEmpty() ? new LIGHTGUI_DataObject( generateId(), txt, modelRoot ) : + new LIGHTGUI_DataObject( generateId(), txt, modelRoot->lastChild() ); else { QStringList lines; - if ( !theText.stripWhiteSpace().isEmpty() ) - lines.append( theText ); + if ( !txt.trimmed().isEmpty() ) + lines.append( txt ); buildTree( study->root(), lines ); } @@ -360,22 +375,23 @@ bool LIGHTGUI_DataModel::insertLineBefore ( const int thePosition, const QString return true; } -//================================================================================= -// function : deleteTextLine() -// purpose : remove text line at the given position -//================================================================================= -bool LIGHTGUI_DataModel::deleteTextLine( const int thePosition ) +/*! + \brief Remove text line. + \param id line identifier + \return \c true on success or \c false if \a id is invalid +*/ +bool LIGHTGUI_DataModel::deleteTextLine( const int id ) { - LIGHTGUI_ModuleObject* modelRoot = dynamic_cast( root() ); + LightApp_ModuleObject* modelRoot = dynamic_cast( root() ); + if ( !modelRoot ) return false; - if ( thePosition <= 0 ) - return false; - LIGHTGUI_DataObject* obj = findObject( thePosition ); + + LIGHTGUI_DataObject* obj = findObject( id ); if ( !obj || !obj->parent() ) return false; - if ( obj->lineText().stripWhiteSpace().isEmpty() ) { + if ( obj->lineText().trimmed().isEmpty() ) { // if paragraph : put all child lines to the previous paragraph SUIT_DataObject* newParent = obj->prevBrother(); if ( newParent ) { @@ -384,45 +400,118 @@ bool LIGHTGUI_DataModel::deleteTextLine( const int thePosition ) } } obj->parent()->removeChild( obj ); + return true; } -//================================================================================= -// function : clearAll() -// purpose : removes all text lines -//================================================================================= +/*! + \brief Remove all lines. +*/ void LIGHTGUI_DataModel::clearAll() { - LIGHTGUI_DataObject* obj = findObject( 0 ); - if ( obj ) { - CAM_Study* study = (CAM_Study*)module()->application()->activeStudy(); - buildTree( study->root(), QStringList() ); + CAM_Study* study = (CAM_Study*)module()->application()->activeStudy(); + buildTree( study->root(), QStringList() ); +} + +/*! + \brief Getnerate unique line identifier. +*/ +int LIGHTGUI_DataModel::generateId() +{ + return ++myMaxId; +} + +/*! + \brief Get line identifier from the object entry. + \param entry object entry + \return object ID or -1 if \a entry is invalid +*/ +int LIGHTGUI_DataModel::id( const QString& entry ) +{ + int id = -1; + QStringList ids = entry.split( ":", QString::SkipEmptyParts ); + if ( ids.count() == 2 && ids[0] == "LIGHTGUI" ) { + bool bOk; + int p = ids[1].toInt( &bOk ); + if ( bOk ) + id = p; + } + return id; +} + +/*! + \brief Get object entry for the line with sepcified identifier. + \param id object ID + \return object entry corresponding to the given \a id +*/ +QString LIGHTGUI_DataModel::entry( const int id ) +{ + QString entry; + if ( id > 0 ) + entry = QString( "LIGHTGUI:%1" ).arg( id ); + return entry; +} + +/*! + \brief Get line number for the object with the specified entry. + \param entry object entry + \return line number or 0 if \a entry is invalid +*/ +int LIGHTGUI_DataModel::lineNb( const QString& entry ) +{ + return lineNb( LIGHTGUI_DataModel::id( entry ) ); +} + +/*! + \brief Get line number for the specified identifier. + \param id line identifier + \return line number or 0 if \a id is invalid +*/ +int LIGHTGUI_DataModel::lineNb( const int id ) +{ + LIGHTGUI_DataObject* obj = findObject( id ); + return obj ? obj->lineNb() : 0; +} + +/*! + \brief Get all existing lines identifiers. + \return list of lines identifiers +*/ +QList LIGHTGUI_DataModel::getIds() const +{ + QList l; + for ( SUIT_DataObjectIterator it( root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { + LIGHTGUI_DataObject* obj = dynamic_cast( it.current() ); + if ( obj ) + l.append( obj->id() ); } + return l; } -//================================================================================= -// function : buildTree() -// purpose : rebuilds data tree -//================================================================================= -void LIGHTGUI_DataModel::buildTree ( SUIT_DataObject* studyRoot, const QStringList& lines ) +/*! + \brief Rebuild data tree. + \param studyRoot study root data object + \param lines string data +*/ +void LIGHTGUI_DataModel::buildTree( SUIT_DataObject* studyRoot, const QStringList& lines ) { if ( !studyRoot ) return; - LIGHTGUI_ModuleObject* modelRoot = new LIGHTGUI_ModuleObject( this, studyRoot ); + LightApp_ModuleObject* modelRoot = new LightApp_ModuleObject( this, studyRoot ); LIGHTGUI_DataObject* aParaObject; LIGHTGUI_DataObject* aLineObject; - aParaObject = new LIGHTGUI_DataObject ( "", modelRoot ); + aParaObject = new LIGHTGUI_DataObject ( generateId(), "", modelRoot ); QStringList::ConstIterator it1 = lines.begin(), it2 = lines.end(); for ( ; it1 != it2; ++it1 ) { - if ( (*it1).stripWhiteSpace().isEmpty() ) { - aParaObject = new LIGHTGUI_DataObject ( *it1, modelRoot ); + if ( (*it1).trimmed().isEmpty() ) { + aParaObject = new LIGHTGUI_DataObject ( generateId(), *it1, modelRoot ); } else { - aLineObject = new LIGHTGUI_DataObject ( *it1, aParaObject ); + aLineObject = new LIGHTGUI_DataObject ( generateId(), *it1, aParaObject ); } } @@ -430,15 +519,16 @@ void LIGHTGUI_DataModel::buildTree ( SUIT_DataObject* studyRoot, const QStringLi setRoot( modelRoot ); } -//================================================================================= -// function : findObject() -// purpose : finds a data object corresponding to the given line number -//================================================================================= -LIGHTGUI_DataObject* LIGHTGUI_DataModel::findObject( const int thePosition ) const +/*! + \brief Search data object corresponding to the specified line number. + \param id line identifier + \return data object or 0 if \a id is invalid +*/ +LIGHTGUI_DataObject* LIGHTGUI_DataModel::findObject( const int id ) const { for ( SUIT_DataObjectIterator it( root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { LIGHTGUI_DataObject* obj = dynamic_cast( it.current() ); - if ( obj && obj->lineNb() == thePosition ) + if ( obj && obj->id() == id ) return obj; } return 0; diff --git a/src/LIGHTGUI/LIGHTGUI_DataModel.h b/src/LIGHTGUI/LIGHTGUI_DataModel.h index 9e154b4..83ca6b4 100644 --- a/src/LIGHTGUI/LIGHTGUI_DataModel.h +++ b/src/LIGHTGUI/LIGHTGUI_DataModel.h @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,19 +14,15 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_DataModel.h +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #ifndef LIGHTGUI_DATAMODEL_H #define LIGHTGUI_DATAMODEL_H -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - #include class CAM_Module; @@ -42,38 +35,49 @@ class LIGHTGUI_DataModel : public LightApp_DataModel Q_OBJECT public: - LIGHTGUI_DataModel ( CAM_Module* theModule ); + LIGHTGUI_DataModel( CAM_Module* theModule ); virtual ~LIGHTGUI_DataModel(); - virtual bool open ( const QString&, CAM_Study*, QStringList ); - virtual bool save ( QStringList& ); - virtual bool saveAs ( const QString&, CAM_Study*, QStringList& ); - virtual bool close (); - virtual bool create ( CAM_Study* ); + virtual bool open( const QString&, CAM_Study*, QStringList ); + virtual bool save( QStringList& ); + virtual bool saveAs( const QString&, CAM_Study*, QStringList& ); + virtual bool close(); + virtual bool create( CAM_Study* ); + + virtual bool isModified() const; + virtual bool isSaved() const; + + virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 ); + + bool loadFile( const QString&, CAM_Study* = 0 ); + bool dumpFile( const QString& = QString() ); + QString fileName() const; + + QString getLineText( const int ) const; + bool setLineText( const int, const QString& ); + bool insertLineBefore( const int, const QString& ); + bool deleteTextLine( const int ); - virtual bool isModified () const; - virtual bool isSaved () const; + void clearAll(); - virtual void update ( LightApp_DataObject* = 0, LightApp_Study* = 0 ); + int generateId(); - bool loadFile ( const QString&, CAM_Study* study = 0 ); - bool dumpFile ( const QString& = QString::null ); - QString fileName () const; + static int id( const QString& ); + static QString entry( const int ); - QString getLineText ( const int thePosition ) const; - bool setLineText ( const int thePosition, const QString& theText ); - bool insertLineBefore ( const int thePosition, const QString& theText ); - bool deleteTextLine ( const int thePosition ); + int lineNb( const QString& ); + int lineNb( const int ); - void clearAll (); + QList getIds() const; private: - void buildTree ( SUIT_DataObject*, const QStringList& ); - LIGHTGUI_DataObject* findObject ( const int ) const; + void buildTree( SUIT_DataObject*, const QStringList& ); + LIGHTGUI_DataObject* findObject( const int ) const; private: QString myFileName; QString myStudyURL; + int myMaxId; }; #endif // LIGHTGUI_DATAMODEL_H diff --git a/src/LIGHTGUI/LIGHTGUI_DataObject.cxx b/src/LIGHTGUI/LIGHTGUI_DataObject.cxx index 16618f8..9659f0c 100644 --- a/src/LIGHTGUI/LIGHTGUI_DataObject.cxx +++ b/src/LIGHTGUI/LIGHTGUI_DataObject.cxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,116 +14,118 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_DataObject.cxx +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #include "LIGHTGUI_DataObject.h" +#include "LIGHTGUI_DataModel.h" + #include #include - -#include -#include +#include /*! - * Class: LIGHTGUI_DataObject - * Description: LIGHT module's data object - */ + \class LIGHTGUI_DataObject + \brief LIGHT module data object. +*/ -//================================================================================= -// function : LIGHTGUI_DataObject() -// purpose : default constructor -//================================================================================= -LIGHTGUI_DataObject::LIGHTGUI_DataObject ( SUIT_DataObject* parent ) -: LightApp_DataObject( parent ), - CAM_DataObject( parent ) -{ -} - -//================================================================================= -// function : LIGHTGUI_DataObject() -// purpose : constructor -//================================================================================= -LIGHTGUI_DataObject::LIGHTGUI_DataObject ( const QString& line_text, SUIT_DataObject* parent ) -: LightApp_DataObject( parent ), - myLineTxt( line_text ), - CAM_DataObject( parent) +/*! + \brief Constructor. + \param id line identifier + \param txt text line corresponding to the data object + \param parent parent data object +*/ +LIGHTGUI_DataObject::LIGHTGUI_DataObject( const int id, + const QString& txt, + SUIT_DataObject* parent ) +: CAM_DataObject( parent ), + LightApp_DataObject( parent ), + myLineTxt( txt ), + myId( id ) { } -//================================================================================= -// function : ~LIGHTGUI_DataObject() -// purpose : destructor -//================================================================================= +/*! + \brief Destructor. +*/ LIGHTGUI_DataObject::~LIGHTGUI_DataObject() { } -//================================================================================= -// function : entry() -// purpose : Gets object ID. retval QString -//================================================================================= -QString LIGHTGUI_DataObject::entry() const +/*! + \brief Get data object name. + \return data object name +*/ +QString LIGHTGUI_DataObject::name() const { - QString aStr = QString("LIGHTGUI_%1").arg(lineNb()); - return aStr; + return myLineTxt.trimmed().isEmpty() ? QObject::tr( "LIGHT_PARAGRAPH" ) : myLineTxt; } -//================================================================================= -// function : name() -// purpose : gets an name of the object -//================================================================================= -QString LIGHTGUI_DataObject::name() const +/*! + \brief Get data object entry. + \return data object entry +*/ +QString LIGHTGUI_DataObject::entry() const { - return myLineTxt.stripWhiteSpace().isEmpty() ? QObject::tr( "LIGHT_PARAGRAPH" ) : myLineTxt ; + return LIGHTGUI_DataModel::entry( id() ); } -//================================================================================= -// function : icon() -// purpose : gets an icon for the data object -//================================================================================= -QPixmap LIGHTGUI_DataObject::icon() const +/*! + \brief Get data object icon. + \param index data column index + \return data object icon for the specified column +*/ +QPixmap LIGHTGUI_DataObject::icon( const int index ) const { - static QPixmap pxp = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", QObject::tr( "ICON_PARAGRAPH" ), false ); - static QPixmap pxl = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", QObject::tr( "ICON_LINE" ), false ); - return myLineTxt.stripWhiteSpace().isEmpty() ? pxp : pxl; + if ( index == NameId ) { + // show icon only for the "Name" column + static QPixmap pxp = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", QObject::tr( "ICON_PARAGRAPH" ), false ); + static QPixmap pxl = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", QObject::tr( "ICON_LINE" ), false ); + return myLineTxt.trimmed().isEmpty() ? pxp : pxl; + } + return LightApp_DataObject::icon( index ); } -//================================================================================= -// function : toolTip() -// purpose : gets a tooltip for the object (to be displayed in the Object Browser) -//================================================================================= -QString LIGHTGUI_DataObject::toolTip() const +/*! + \brief Get data object tooltip. + \param index data column index + \return data object tooltip for the specified column +*/ +QString LIGHTGUI_DataObject::toolTip( const int /*index*/ ) const { - return lineText().stripWhiteSpace().isEmpty() ? + // show the same tooltip for all columns + return lineText().trimmed().isEmpty() ? QString( QObject::tr( "LIGHT_PARAGRAPH") + " %1" ).arg( parent()->childPos( this ) + 1 ) : QString( QObject::tr( "LIGHT_LINE" ) + " %1: %2" ).arg( lineNb() ).arg( lineText() ); } -//================================================================================= -// function : lineText() -// purpose : gets line text -//================================================================================= +/*! + \brief Get text line corresponding to the data object. + \return text line (empty lines means paragraph) + \sa setLineText() +*/ QString LIGHTGUI_DataObject::lineText() const { return myLineTxt; } -//================================================================================= -// function : setLineText() -// purpose : sets line text -//================================================================================= -void LIGHTGUI_DataObject::setLineText( const QString& text ) +/*! + \brief Set text line corresponding to the data object. + \param txt text line (empty lines means paragraph) + \sa lineText() +*/ +void LIGHTGUI_DataObject::setLineText( const QString& txt ) { - myLineTxt = text; + myLineTxt = txt; } -//================================================================================= -// function : lineNb() -// purpose : gets the line number -//================================================================================= +/*! + \brief Get line number. + \return line number +*/ int LIGHTGUI_DataObject::lineNb() const { if ( level() == 1 ) // root object @@ -148,50 +147,10 @@ int LIGHTGUI_DataObject::lineNb() const } /*! - * Class: LIGHTGUI_ModuleObject - * Description: LIGHT module's root data object - */ - -//================================================================================= -// function : LIGHTGUI_ModuleObject() -// purpose : one more constructor -//================================================================================= -LIGHTGUI_ModuleObject::LIGHTGUI_ModuleObject ( CAM_DataModel* dm, SUIT_DataObject* parent ) -: LIGHTGUI_DataObject( parent ), - LightApp_ModuleObject(dm, parent), - CAM_DataObject( parent ) -{ -} - -//================================================================================= -// function : name() -// purpose : gets an name of the root object -//================================================================================= -QString LIGHTGUI_ModuleObject::name() const -{ - return CAM_RootObject::name(); -} - -//================================================================================= -// function : icon() -// purpose : gets an icon for the root object -//================================================================================= -QPixmap LIGHTGUI_ModuleObject::icon() const -{ - QPixmap px; - if (dataModel()) { - QString anIconName = dataModel()->module()->iconName(); - if (!anIconName.isEmpty()) - px = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", anIconName, false ); - } - return px; -} - -//================================================================================= -// function : toolTip() -// purpose : gets a tootip for the root object -//================================================================================= -QString LIGHTGUI_ModuleObject::toolTip() const + \brief Get line identifier. + \return line identifier +*/ +int LIGHTGUI_DataObject::id() const { - return QObject::tr( "LIGHT_ROOT_TOOLTIP" ); + return myId; } diff --git a/src/LIGHTGUI/LIGHTGUI_DataObject.h b/src/LIGHTGUI/LIGHTGUI_DataObject.h index c44778d..77eac98 100644 --- a/src/LIGHTGUI/LIGHTGUI_DataObject.h +++ b/src/LIGHTGUI/LIGHTGUI_DataObject.h @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,57 +14,38 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_DataObject.h +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #ifndef LIGHTGUI_DATAOBJECT_H #define LIGHTGUI_DATAOBJECT_H #include -#include +#include -#include - -/*! - * LIGHTGUI_DataObject - LIGHT module's data object class - */ class LIGHTGUI_DataObject : public virtual LightApp_DataObject { public: - LIGHTGUI_DataObject ( SUIT_DataObject* = 0 ); - LIGHTGUI_DataObject ( const QString&, SUIT_DataObject* = 0 ); + LIGHTGUI_DataObject( const int, const QString&, SUIT_DataObject* = 0 ); virtual ~LIGHTGUI_DataObject(); - virtual QString entry() const; + QString name() const; + QString entry() const; - QString name() const; - QPixmap icon() const; - QString toolTip() const; + QPixmap icon( const int = NameId ) const; + QString toolTip( const int = NameId ) const; QString lineText() const; void setLineText( const QString& ); int lineNb() const; + int id() const; private: + int myId; QString myLineTxt; }; -/*! - * LIGHTGUI_ModuleObject - LIGHT module's root data object class - */ - -class LIGHTGUI_ModuleObject : public LIGHTGUI_DataObject, - public LightApp_ModuleObject -{ -public: - LIGHTGUI_ModuleObject ( CAM_DataModel*, SUIT_DataObject* = 0 ); - - virtual QString name() const; - QPixmap icon() const; - QString toolTip() const; -}; - #endif // LIGHTGUI_DATAOBJECT_H diff --git a/src/LIGHTGUI/LIGHTGUI_DataOwner.cxx b/src/LIGHTGUI/LIGHTGUI_DataOwner.cxx deleted file mode 100644 index 35f0449..0000000 --- a/src/LIGHTGUI/LIGHTGUI_DataOwner.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -#include "LIGHTGUI_DataOwner.h" - -//================================================================================= -// function : LIGHTGUI_DataOwner() -// purpose : constructor -//================================================================================= -LIGHTGUI_DataOwner::LIGHTGUI_DataOwner ( const int theLineNb ) - : myLineNb( theLineNb ) -{ -} - -//================================================================================= -// function : ~LIGHTGUI_DataOwner() -// purpose : destructor -//================================================================================= -LIGHTGUI_DataOwner::~LIGHTGUI_DataOwner() -{ -} - -//================================================================================= -// function : isEqual() -// purpose : compares two owners -//================================================================================= -bool LIGHTGUI_DataOwner::isEqual ( const SUIT_DataOwner& obj ) const -{ - const LIGHTGUI_DataOwner* other = - dynamic_cast( &obj ); - - return other && lineNb() == other->lineNb(); -} - -//================================================================================= -// function : lineNb() -// purpose : returns owner id -//================================================================================= -int LIGHTGUI_DataOwner::lineNb() const -{ - return myLineNb; -} diff --git a/src/LIGHTGUI/LIGHTGUI_DataOwner.h b/src/LIGHTGUI/LIGHTGUI_DataOwner.h deleted file mode 100644 index d540762..0000000 --- a/src/LIGHTGUI/LIGHTGUI_DataOwner.h +++ /dev/null @@ -1,44 +0,0 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -#ifndef LIGHTGUI_DATAOWNER_H -#define LIGHTGUI_DATAOWNER_H - -#include - -class LIGHTGUI_DataOwner : public SUIT_DataOwner -{ -public: - LIGHTGUI_DataOwner ( const int ); - virtual ~LIGHTGUI_DataOwner (); - - virtual bool isEqual ( const SUIT_DataOwner& ) const; - int lineNb () const; - -private: - int myLineNb; -}; - -#endif // LIGHTGUI_DATAOWNER_H diff --git a/src/LIGHTGUI/LIGHTGUI_OBSelector.cxx b/src/LIGHTGUI/LIGHTGUI_OBSelector.cxx deleted file mode 100644 index c8f8463..0000000 --- a/src/LIGHTGUI/LIGHTGUI_OBSelector.cxx +++ /dev/null @@ -1,125 +0,0 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -#include "LIGHTGUI_OBSelector.h" -#include "LIGHTGUI_DataOwner.h" -#include "LIGHTGUI_DataObject.h" - -#include - -#include - -//================================================================================= -// function : LIGHTGUI_OBSelector() -// purpose : constructor -//================================================================================= -LIGHTGUI_OBSelector::LIGHTGUI_OBSelector ( OB_Browser* ob, SUIT_SelectionMgr* mgr ) - : SUIT_Selector( mgr, ob ), - myBrowser( ob ) -{ - if ( myBrowser ) { - connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); - } -} - -//================================================================================= -// function : ~LIGHTGUI_OBSelector() -// purpose : destructor -//================================================================================= -LIGHTGUI_OBSelector::~LIGHTGUI_OBSelector() -{ -} - -//================================================================================= -// function : browser() -// purpose : gets object browser -//================================================================================= -OB_Browser* LIGHTGUI_OBSelector::browser() const -{ - return myBrowser; -} - -//================================================================================= -// function : getSelection() -// purpose : gets selection -//================================================================================= -void LIGHTGUI_OBSelector::getSelection ( SUIT_DataOwnerPtrList& aList ) const -{ - if ( !myBrowser ) - return; - - DataObjectList objlist; - myBrowser->getSelected( objlist ); - for ( DataObjectListIterator it ( objlist ); it.current(); ++it ) - { - LIGHTGUI_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) - aList.append( SUIT_DataOwnerPtr( new LIGHTGUI_DataOwner( obj->lineNb() ) ) ); - } -} - -//================================================================================= -// function : setSelection() -// purpose : sets selection -//================================================================================= -void LIGHTGUI_OBSelector::setSelection ( const SUIT_DataOwnerPtrList& aList ) -{ - if ( !myBrowser ) - return; - - // Fill map of all data objects - QMap aMap; - - SUIT_DataObjectIterator objit ( myBrowser->getRootObject(), - SUIT_DataObjectIterator::DepthLeft ); - for ( ; objit.current(); ++objit ) - { - LIGHTGUI_DataObject* obj = dynamic_cast( objit.current() ); - if ( obj ) - aMap.insert( obj->lineNb(), obj ); - } - - // Fill list with all selected data objects - DataObjectList objList; - SUIT_DataOwnerPtrList::const_iterator ownit = aList.begin(); - for ( ; ownit != aList.end(); ++ownit ) - { - const LIGHTGUI_DataOwner* owner = - dynamic_cast( (*ownit).get() ); - if ( owner && aMap.contains( owner->lineNb() ) ) - objList.append( aMap[owner->lineNb()] ); - } - - myBrowser->setSelected( objList ); -} - -//================================================================================= -// function : onSelectionChanged() -// purpose : called when selection is changed in the Object Browser -//================================================================================= -void LIGHTGUI_OBSelector::onSelectionChanged() -{ - selectionChanged(); -} diff --git a/src/LIGHTGUI/LIGHTGUI_OBSelector.h b/src/LIGHTGUI/LIGHTGUI_OBSelector.h deleted file mode 100644 index f0b778c..0000000 --- a/src/LIGHTGUI/LIGHTGUI_OBSelector.h +++ /dev/null @@ -1,56 +0,0 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -#ifndef LIGHTGUI_OBSELECTOR_H -#define LIGHTGUI_OBSELECTOR_H - -#include - -class OB_Browser; - -class LIGHTGUI_OBSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - LIGHTGUI_OBSelector ( OB_Browser*, SUIT_SelectionMgr* ); - virtual ~LIGHTGUI_OBSelector (); - - OB_Browser* browser () const; - - virtual QString type () const { return "ObjectBrowser"; } - -private slots: - void onSelectionChanged (); - -protected: - virtual void getSelection ( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection ( const SUIT_DataOwnerPtrList& ); - -private: - OB_Browser* myBrowser; -}; - -#endif // LIGHTGUI_OBSELECTOR_H diff --git a/src/LIGHTGUI/LIGHTGUI_Selection.cxx b/src/LIGHTGUI/LIGHTGUI_Selection.cxx index f8e63c7..d83eb8d 100644 --- a/src/LIGHTGUI/LIGHTGUI_Selection.cxx +++ b/src/LIGHTGUI/LIGHTGUI_Selection.cxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,77 +14,128 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_Selection.cxx +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #include "LIGHTGUI_Selection.h" -#include "LightApp_DataOwner.h" +#include "LIGHTGUI_DataModel.h" +#include "LIGHTGUI.h" +#include +#include +#include #include +#include +#include +#include + +/*! + \class LIGHTGUI_Selection + \brief Handles the data selection, builds the rules to be used in the + popup menu. +*/ -//================================================================================= -// function : LIGHTGUI_Selection() -// purpose : constructor -//================================================================================= -LIGHTGUI_Selection::LIGHTGUI_Selection () +/*! + \brief Constructor. +*/ +LIGHTGUI_Selection::LIGHTGUI_Selection() : LightApp_Selection() { } -//================================================================================= -// function : ~LIGHTGUI_Selection() -// purpose : destructor -//================================================================================= +/*! + \brief Destructor. +*/ LIGHTGUI_Selection::~LIGHTGUI_Selection() { } -//================================================================================= -// function : init() -// purpose : initialization -//================================================================================= -void LIGHTGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr) +/*! + \brief Get selection parameter value. + \param index selected object index + \param p parameter name + \return parameter value +*/ +QVariant LIGHTGUI_Selection::parameter( const int index, const QString& p ) const +{ + if ( p == "type" ) + return type( index ); + else if ( p == "empty" ) + return isEmpty( index ); + else if ( p == "visible" ) + return isVisible( index ); + return LightApp_Selection::parameter( p ); +} + +/*! + \brief Check if selected object is empty line (beginning of the paragraph) + \param index selected object index + \return \c true if selected object is empty line +*/ +bool LIGHTGUI_Selection::isEmpty( const int index ) const { - if ( mgr ) { - SUIT_DataOwnerPtrList sel; - mgr->selected( sel); - SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), - aLast = sel.end(); - for ( ; anIt != aLast; anIt++ ) { - SUIT_DataOwner* owner = (SUIT_DataOwner*)( (*anIt).get() ); - LightApp_DataOwner* sowner = dynamic_cast( owner ); - QString anEntry = sowner->entry(); - int anIndex = anEntry.find("_"); - int aPosition = (anEntry.mid(anIndex+1, anEntry.length() - anIndex)).toInt();//lineNb(); - if ( sowner && aPosition > 0 ) - myTypes.append( "TextLine" ); - else - myTypes.append( "Unknown" ); + bool empty = true; + LightApp_Application* app = dynamic_cast( study()->application() ); + if ( app ) { + LIGHTGUI_DataModel* dm = dynamic_cast( app->activeModule()->dataModel() ); + if ( dm ) { + QString line = dm->getLineText( LIGHTGUI_DataModel::id( entry( index ) ) ); + empty = line.isEmpty(); } } - LightApp_Selection::init(client, mgr); + return empty; } -//================================================================================= -// function : count() -// purpose : returns number of supported types -//================================================================================= -int LIGHTGUI_Selection::count() const +/*! + \brief Check if selected object is displayed in the active viewer. + \param index selected object index + \return \c true if selected object is displayed +*/ +bool LIGHTGUI_Selection::isVisible( const int index ) const { - return myTypes.count(); + bool visible = false; + LightApp_Application* app = dynamic_cast( study()->application() ); + if ( app ) { + SUIT_ViewManager* vm = app->activeViewManager(); + if ( vm && vm->getType() == "OCCViewer" ) { + SOCC_Viewer* v = (SOCC_Viewer*)vm->getViewModel(); + if ( v ) { + QString e = entry( index ); + int id = LIGHTGUI_DataModel::id( e ); + visible = id != -1 && v->isVisible( new SALOME_InteractiveObject( e.toLatin1(), "" ) ); + } + } + } + return visible; } -//================================================================================= -// function : param() -// purpose : returns selection parameter value -//================================================================================= -QtxValue LIGHTGUI_Selection::param ( const int ind, const QString& p ) const +/*! + \brief Get selected object type. + \param index selected object index + \return object type +*/ +QString LIGHTGUI_Selection::type( const int index ) const { - if ( p == "client" ) - return globalParam(p); - else - return myTypes[ind]; + return lineNb( entry( index ) ) > 0 ? "TextLine" : "Unknown"; +} + +/*! + \brief Get line number corresponding to the selected object. + \param index selected object index + \return line number or 0 if the pbject is not appropriate +*/ +int LIGHTGUI_Selection::lineNb( const QString& e ) const +{ + int pos = 0; // invalid position + LightApp_Application* app = dynamic_cast( study()->application() ); + if ( app ) { + LIGHTGUI_DataModel* dm = dynamic_cast( app->activeModule()->dataModel() ); + if ( dm ) { + pos = dm->lineNb( e ); + } + } + return pos; } diff --git a/src/LIGHTGUI/LIGHTGUI_Selection.h b/src/LIGHTGUI/LIGHTGUI_Selection.h index 97c8c30..3d7ac41 100644 --- a/src/LIGHTGUI/LIGHTGUI_Selection.h +++ b/src/LIGHTGUI/LIGHTGUI_Selection.h @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,32 +14,34 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_Selection.h +// Author : Julia DOROVSKIKH // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - #ifndef LIGHTGUI_SELECTION_H #define LIGHTGUI_SELECTION_H -#include #include +#include class LightApp_SelectionMgr; class LIGHTGUI_Selection : public LightApp_Selection { public: - LIGHTGUI_Selection (); - virtual ~LIGHTGUI_Selection (); + LIGHTGUI_Selection(); + virtual ~LIGHTGUI_Selection(); - virtual void init( const QString&, LightApp_SelectionMgr* ); - virtual int count () const; - virtual QtxValue param ( const int, const QString& ) const; + QVariant parameter( const int, const QString& ) const; private: - QStringList myTypes; + QString type( const int ) const; + bool isEmpty( const int ) const; + bool isVisible( const int ) const; + + int lineNb( const QString& ) const; }; #endif // LIGHTGUI_SELECTION_H diff --git a/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx b/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx index 4804be5..2839c21 100644 --- a/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx +++ b/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,13 +14,13 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Natalia DONIS -// Date : 01/09/2005 -// $Header$ - -#include +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_TextPrs.cxx +// Author : Natalia DONIS +// +#include "LIGHTGUI_TextPrs.hxx" #include #include @@ -31,28 +28,54 @@ #include #include #include -//#include + +/*! + \class LIGHTGUI_TextPrs + \brief Presentation object for the string line. +*/ IMPLEMENT_STANDARD_HANDLE( LIGHTGUI_TextPrs, AIS_InteractiveObject ) IMPLEMENT_STANDARD_RTTIEXT( LIGHTGUI_TextPrs, AIS_InteractiveObject ) -Standard_Integer aCharSize = 16; +const Standard_Integer aCharSize = 16; -LIGHTGUI_TextPrs::LIGHTGUI_TextPrs( const char* theString, const gp_Pnt& thePos) +/*! + \brief Contructor. + \param theString text string + \param thePos text position in the viewer +*/ +LIGHTGUI_TextPrs::LIGHTGUI_TextPrs( const char* theString, const gp_Pnt& thePos ) : myPos( thePos ) { - myString = new char[strlen( theString ) + 1]; - strcpy( myString, theString ); + myString = new char[strlen( theString ) + 1]; + strcpy( myString, theString ); } +/*! + \brief Destructor. +*/ LIGHTGUI_TextPrs::~LIGHTGUI_TextPrs() { - delete myString; + delete myString; +} + +/*! + \brief Get presentation text size. +*/ +int LIGHTGUI_TextPrs::TextSize() +{ + return aCharSize; } -void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)&, +/*! + \brief Compute the presentation. + \param prsMgr presentation manager (not used) + \param thePrs presentation + \param mode display mode +*/ +void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)& /*prsMgr*/, const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer ) + const Standard_Integer /*mode*/ ) { Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( thePrs ); aGroup->BeginPrimitives(); @@ -65,8 +88,13 @@ void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)&, aGroup->EndPrimitives(); } +/*! + \brief Compute selection of the presentation. + \param theSelection current selection object + \param mode display mode +*/ void LIGHTGUI_TextPrs::ComputeSelection( const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer ) + const Standard_Integer /*mode*/ ) { Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this); eown -> SelectBasics_EntityOwner::Set( aCharSize ); diff --git a/src/LIGHTGUI/LIGHTGUI_TextPrs.hxx b/src/LIGHTGUI/LIGHTGUI_TextPrs.hxx index c8dad5d..c1c0a6a 100644 --- a/src/LIGHTGUI/LIGHTGUI_TextPrs.hxx +++ b/src/LIGHTGUI/LIGHTGUI_TextPrs.hxx @@ -1,7 +1,4 @@ -// LIGHT : sample (no-corba-engine) SALOME module -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2005-2008 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -17,30 +14,30 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Julia DOROVSKIKH -// Date : 01/01/2005 -// $Header$ - -#ifndef LIGHTGUI_TEXTPRS_H -#define LIGHTGUI_TEXTPRS_H +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_TextPrs.hxx +// Author : Natalia DONIS +// +#ifndef LIGHTGUI_TEXTPRS_HXX +#define LIGHTGUI_TEXTPRS_HXX #include #include #include #include - #include - #include class LIGHTGUI_TextPrs: public AIS_InteractiveObject { public: - Standard_EXPORT LIGHTGUI_TextPrs( const char*, const gp_Pnt& ); + Standard_EXPORT LIGHTGUI_TextPrs( const char*, const gp_Pnt& ); Standard_EXPORT ~LIGHTGUI_TextPrs(); + static int TextSize(); + private: Standard_EXPORT void Compute( const Handle(PrsMgr_PresentationManager3d)&, const Handle(Prs3d_Presentation)&, @@ -50,13 +47,13 @@ private: const Standard_Integer ); private: - char* myString; + char* myString; gp_Pnt myPos; public: DEFINE_STANDARD_RTTI(LIGHTGUI_TextPrs) }; -DEFINE_STANDARD_HANDLE(LIGHTGUI_TextPrs, AIS_InteractiveObject) +DEFINE_STANDARD_HANDLE( LIGHTGUI_TextPrs, AIS_InteractiveObject ) -#endif // LIGHTGUI_TEXTPRS_H +#endif // LIGHTGUI_TEXTPRS_HXX diff --git a/src/LIGHTGUI/LIGHT_images.po b/src/LIGHTGUI/LIGHT_images.po deleted file mode 100644 index 10315a0..0000000 --- a/src/LIGHTGUI/LIGHT_images.po +++ /dev/null @@ -1,41 +0,0 @@ -# LIGHT : sample (no-corba-engine) SALOME component -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author : Julia DOROVSKIKH -# Date : 01/06/2005 -# $Header$ - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ICON_PARAGRAPH" -msgstr "paragraph_icon.png" - -msgid "ICON_LINE" -msgstr "line_icon.png" - -msgid "ICON_LIGHT" -msgstr "LIGHT.png" diff --git a/src/LIGHTGUI/LIGHT_msg_en.po b/src/LIGHTGUI/LIGHT_msg_en.po deleted file mode 100644 index 2d531be..0000000 --- a/src/LIGHTGUI/LIGHT_msg_en.po +++ /dev/null @@ -1,168 +0,0 @@ -# LIGHT : sample (no-corba-engine) SALOME module -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author : Julia DOROVSKIKH -# Date : 01/06/2005 -# $Header$ - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2001-09-21 14:31:28 METDST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - - -# Menu items - -msgid "TOP_LOAD_FILE" -msgstr "Load text file" - -msgid "MEN_LOAD_FILE" -msgstr "Load text file" - -msgid "STB_LOAD_FILE" -msgstr "Load text file" - - -msgid "TOP_SAVE_FILE" -msgstr "Save text file" - -msgid "MEN_SAVE_FILE" -msgstr "Save text file" - -msgid "STB_SAVE_FILE" -msgstr "Save text file" - -msgid "TOP_DISPLAY_LINE" -msgstr "Display line" - -msgid "MEN_DISPLAY_LINE" -msgstr "Display selected line" - -msgid "STB_DISPLAY_LINE" -msgstr "Display selected line" - -msgid "TOP_EDIT_LINE" -msgstr "Edit line" - -msgid "MEN_EDIT_LINE" -msgstr "Edit selected line" - -msgid "STB_EDIT_LINE" -msgstr "Edit selected line" - - -msgid "TOP_ADD_LINE" -msgstr "Add line" - -msgid "MEN_ADD_LINE" -msgstr "Insert new text line" - -msgid "STB_ADD_LINE" -msgstr "Insert new line before the selected one" - - -msgid "TOP_DEL_LINE" -msgstr "Remove line" - -msgid "MEN_DEL_LINE" -msgstr "Remove line" - -msgid "STB_DEL_LINE" -msgstr "Remove selected line" - - -msgid "TOP_CLEAR_ALL" -msgstr "Clear all" - -msgid "MEN_CLEAR_ALL" -msgstr "Clear all" - -msgid "STB_CLEAR_ALL" -msgstr "Remove all text lines" - - -msgid "MEN_FILE" -msgstr "&File" - -msgid "MEN_LIGHT" -msgstr "LIGHT" - -# File dialog - -msgid "LIGHTGUI::LIGHTGUI_MEN_TXT_FILES" -msgstr "Text Files ( *.txt )" - -msgid "LIGHTGUI::LIGHTGUI_MEN_ALL_FILES" -msgstr "All Files ( * )" - -msgid "LIGHTGUI::LIGHTGUI_MEN_LOAD" -msgstr "Load" - -msgid "LIGHTGUI::LIGHTGUI_MEN_DUMP" -msgstr "Dump" - -msgid "LIGHTGUI::LIGHTGUI_EDIT_LINE" -msgstr "Edit selected line" - -msgid "LIGHTGUI::LIGHTGUI_ADD_LINE" -msgstr "Add new line before the selected one" - -msgid "LIGHT_LIGHT" -msgstr "LIGHT" - -msgid "WRN_WARNING" -msgstr "Warning!" - -msgid "WRN_LOAD_FAILED" -msgstr "Loading file is failed!" - -msgid "BUT_OK" -msgstr "&OK" - -msgid "WRN_DUMP_FAILED" -msgstr "Dumping file is failed!" - -msgid "WRN_SELECT_LINE" -msgstr "Wrong selection!" - -msgid "WRN_EDIT_FAILED" -msgstr "Can't edit line!" - -msgid "WRN_ADD_FAILED" -msgstr "Can't insert line!" - -msgid "WRN_UNKNOWN_COMMAND" -msgstr "Unrecognized command!" - -msgid "WRN_DELETE_FAILED" -msgstr "Can't delete line" - -msgid "LIGHT_PARAGRAPH" -msgstr "Paragraph" - -msgid "LIGHT_LINE" -msgstr "Line" - -msgid "LIGHT_ROOT_TOOLTIP" -msgstr "LIGHT module root object" diff --git a/src/LIGHTGUI/Makefile.am b/src/LIGHTGUI/Makefile.am index 414184e..54eb60e 100644 --- a/src/LIGHTGUI/Makefile.am +++ b/src/LIGHTGUI/Makefile.am @@ -1,7 +1,4 @@ -# LIGHT : sample (no-corba-engine) SALOME module -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2005-2008 OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,23 +14,25 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# LIGHT : sample (no-corba-engine) SALOME module # Author : Julia DOROVSKIKH # Date : 01/06/2005 # Modified by : Alexander BORODIN (OCN) - autotools usage - +# include $(top_srcdir)/adm_local/unix/make_common_starter.am -# header files -salomeinclude_HEADERS = - - # Library target lib_LTLIBRARIES = libLIGHT.la # Library sources -dist_libLIGHT_la_SOURCES = \ +dist_libLIGHT_la_SOURCES = \ + LIGHTGUI.h \ + LIGHTGUI_Selection.h \ + LIGHTGUI_DataObject.h \ + LIGHTGUI_DataModel.h \ + LIGHTGUI_TextPrs.hxx \ LIGHTGUI.cxx \ LIGHTGUI_Selection.cxx \ LIGHTGUI_DataObject.cxx \ diff --git a/src/LIGHTGUI/resources/LIGHT_images.ts b/src/LIGHTGUI/resources/LIGHT_images.ts new file mode 100644 index 0000000..630e958 --- /dev/null +++ b/src/LIGHTGUI/resources/LIGHT_images.ts @@ -0,0 +1,37 @@ + + + + @default + + ICON_LIGHT + LIGHT.png + + + ICON_LINE + line_icon.png + + + ICON_PARAGRAPH + paragraph_icon.png + + + diff --git a/src/LIGHTGUI/resources/LIGHT_msg_en.ts b/src/LIGHTGUI/resources/LIGHT_msg_en.ts new file mode 100644 index 0000000..d635c19 --- /dev/null +++ b/src/LIGHTGUI/resources/LIGHT_msg_en.ts @@ -0,0 +1,208 @@ + + + + @default + + TOP_CLEAR_ALL + Clear all + + + STB_CLEAR_ALL + Remove all text lines + + + STB_SAVE_FILE + Save text file + + + TOP_SAVE_FILE + Save text file + + + MEN_LIGHT + LIGHT + + + MEN_LOAD_FILE + Load text file + + + WRN_UNKNOWN_COMMAND + Unrecognized command! + + + BUT_OK + &OK + + + WRN_ADD_FAILED + Can't insert line! + + + STB_DISPLAY_LINE + Display selected line + + + TOP_DISPLAY_LINE + Display line + + + MEN_DISPLAY_LINE + Display selected line + + + STB_ERASE_LINE + Erase selected line + + + TOP_ERASE_LINE + Erase line + + + MEN_ERASE_LINE + Erase selected line + + + STB_EDIT_LINE + Edit selected line + + + WRN_EDIT_FAILED + Can't edit line! + + + WRN_DUMP_FAILED + Dumping file is failed! + + + WRN_LOAD_FAILED + Loading file is failed! + + + TOP_EDIT_LINE + Edit line + + + MEN_CLEAR_ALL + Clear all + + + MEN_FILE + &File + + + LIGHT_ROOT_TOOLTIP + LIGHT module root object + + + LIGHT_LIGHT + LIGHT + + + MEN_SAVE_FILE + Save text file + + + WRN_WARNING + Warning! + + + WRN_DELETE_FAILED + Can't delete line + + + WRN_SELECT_LINE + Wrong selection! + + + TOP_LOAD_FILE + Load text file + + + TOP_ADD_LINE + Add line + + + MEN_DEL_LINE + Remove line + + + STB_LOAD_FILE + Load text file + + + STB_ADD_LINE + Insert new line before the selected one + + + LIGHT_PARAGRAPH + Paragraph + + + TOP_DEL_LINE + Remove line + + + MEN_ADD_LINE + Insert new text line + + + LIGHT_LINE + Line + + + STB_DEL_LINE + Remove selected line + + + MEN_EDIT_LINE + Edit selected line + + + + LIGHTGUI + + LIGHTGUI_ADD_LINE + Add new line before the selected one + + + LIGHTGUI_MEN_DUMP + Dump + + + LIGHTGUI_MEN_LOAD + Load + + + LIGHTGUI_MEN_TXT_FILES + Text Files ( *.txt ) + + + LIGHTGUI_EDIT_LINE + Edit selected line + + + LIGHTGUI_MEN_ALL_FILES + All Files ( * ) + + + diff --git a/src/Makefile.am b/src/Makefile.am index 1822656..ed87851 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,28 +1,25 @@ -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# Copyright (C) 2005-2008 OPEN CASCADE # +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. # +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # File : Makefile.in # Author : (CEA) # Modified by : Alexander BORODIN (OCN) - autotools usage - +# include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = LIGHTGUI -- 2.39.2