Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: Frank Lanitz frank@frank.uvena.de Date: Tue, 07 Feb 2012 19:57:45 Commit: 50948683f6fddde8127ff5de0dd7592246a6bca6 https://github.com/geany/geany-plugins/commit/50948683f6fddde8127ff5de0dd759...
Log Message: ----------- Added geanyminiscript
Modified Paths: -------------- MAINTAINERS Makefile.am README build/geanyminiscript.m4 configure.ac geanyminiscript/AUTHORS geanyminiscript/COPYING geanyminiscript/ChangeLog geanyminiscript/INSTALL geanyminiscript/Makefile.am geanyminiscript/NEWS geanyminiscript/README geanyminiscript/doc/Doxyfile_gms geanyminiscript/doc/gms_help.pdf geanyminiscript/src/Makefile.am geanyminiscript/src/gms.c geanyminiscript/src/gms.h geanyminiscript/src/gms_debug.h geanyminiscript/src/gms_gui.c geanyminiscript/src/gms_gui.h geanyminiscript/wscript_build geanyminiscript/wscript_configure po/POTFILES.in
Modified: MAINTAINERS 6 files changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -89,6 +89,12 @@ M: W: S:
+geanyminiscript +P: Eugene Arshinov earshinov@gmail.com +M: Eugene Arshinov earshinov@gmail.com +W: +S: Maintained + geanynumberedbookmarks P: M:
Modified: Makefile.am 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -12,6 +12,7 @@ plugins = \ geanylipsum \ geanylua \ geanymacro \ + geanyminiscript \ geanynumberedbookmarks \ geanypg \ geanyprj \
Modified: README 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -47,6 +47,7 @@ dependencies. --disable-<option> causes the feature to be forcefully disabled. * geanylatex -- the GeanyLaTeX plugin * geanylipsum -- the GeanyLipsum plugin * geanylua -- the GeanyLua plugin +* geanyminiscript -- the GeanyMiniScript plugin * geanypg -- the geanypg plugin * geanyprj -- the GeanyPrj plugin * geanysendmail -- the GeanySendmail plugin
Modified: build/geanyminiscript.m4 9 files changed, 9 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,9 @@ +AC_DEFUN([GP_CHECK_GEANYMINISCRIPT], +[ + GP_ARG_DISABLE([GeanyMiniScript], [yes]) + GP_STATUS_PLUGIN_ADD([GeanyMiniScript], [$enable_geanyminiscript]) + AC_CONFIG_FILES([ + geanyminiscript/Makefile + geanyminiscript/src/Makefile + ]) +])
Modified: configure.ac 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -37,6 +37,7 @@ GP_CHECK_GEANYLATEX GP_CHECK_GEANYLIPSUM GP_CHECK_GEANYLUA GP_CHECK_GEANYMACRO +GP_CHECK_GEANYMINISCRIPT GP_CHECK_GEANYNUMBEREDBOOKMARKS GP_CHECK_GEANYPRJ GP_CHECK_GEANYSENDMAIL
Modified: geanyminiscript/AUTHORS 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1 @@ +Pascal Burlot <prublot(at)users(dot)sourceforge(dot)net>
Modified: geanyminiscript/COPYING 340 files changed, 340 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License.
Modified: geanyminiscript/ChangeLog 22 files changed, 22 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,22 @@ +2009-03-02 v0.4 + + * config_dir (compatibility with geany 0.16) + + +2009-02-07 v0.3 + + * localization + * add Tips on each button + + +2009-01-03 v0.2 + + * using autotools + * adding a help document (./doc/gms_help.pdf) + * add a break if a error is happened in the session mode + * svn + + +2009-01-02 v0.1 + + * initial version
Modified: geanyminiscript/INSTALL 182 files changed, 182 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options.
Modified: geanyminiscript/Makefile.am 8 files changed, 8 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,8 @@ +if ENABLE_GEANYMINISCRIPT +include $(top_srcdir)/build/vars.auxfiles.mk +else +include $(top_srcdir)/build/vars.docs.mk +endif + +SUBDIRS = src +plugin = geanyminiscript
Modified: geanyminiscript/NEWS 0 files changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: geanyminiscript/README 100 files changed, 100 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,100 @@ +.. |(version)| replace:: 0.1 + +==== +gms +==== + +.. contents:: + +About +===== + +gms is a Geany Mini-Script filter plugin + +In order to use it you need Geany 0.15. + +Features +======== +This plugin is a tool to apply a script filter on :: + o the text selection, + o the current document, + o all documents of the current session. + +The filter type can be :: + o Unix shell script, + o perl script, + o python script, + o sed commands, + o awk script. + +The output can be :: + o the selection of the current document, + o all the current document, + o or a new document. + +Requirements +============ + +For compiling gms you need Geany,GTK2 includes, and GTK2 library. + +Furthermore you need, of course, a C compiler and the Make tool; The +GNU versions of these tools are recommended. + +Usage +===== + +After compiling and/or installing gms, start Geany and go to menu +Tools->Plugin Manager and set checkbox at gms plugin. + +You can configure the following options:: + o Shell path, + o Perl path, + o Python path, + o sed path, + o Awk path, + o user script . + +After configuring, go to menu Tools->Plugin Manager and click to "Mini-script". +Geany opens a gms dialog box:: + o With the combobox, you select the script type, + o In the text view, you write the filter script. + o In the input area, you select the filter input:: + * current selection + * current document + * all the session documents + o In the output area, you select the filter output:: + * current document + * new document + o and you click on the apply button. + +License +======= + +gms is distributed under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. A copy of this license +can be found in the file COPYING included with the source code of this +program. + +Ideas, questions, patches and bug reports +========================================= + +If you add something, or fix a bug, please send a patch (in 'diff -u' +format) to the author listed below. + +Coding +====== + +Use static functions where possible. +Try to use GLib types and functions - e.g. g_free instead of free and +try to use only GLib 2.6 and GTK 2.6 functions. At least for the moment, +we want to keep the minimum requirement for GTK at 2.6. + +Download +======== + +The current version is |(version)|, download it here http:// + +-- +2008-2009 by Pascal BURLOT +prublot(at)users(dot)sourceforge(dot)net
Modified: geanyminiscript/doc/Doxyfile_gms 297 files changed, 297 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,297 @@ +# Doxyfile 1.5.5 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = gms +PROJECT_NUMBER = 0.1 +OUTPUT_DIRECTORY = ./doc-doxygen/ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = ./ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = ../src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.PY \ + *.F90 \ + *.F \ + *.VHD \ + *.VHDL +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = YES +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO
Modified: geanyminiscript/doc/gms_help.pdf 0 files changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: geanyminiscript/src/Makefile.am 12 files changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,12 @@ +include $(top_srcdir)/build/vars.build.mk + +if ENABLE_GEANYMINISCRIPT +geanyplugins_LTLIBRARIES = geanyminiscript.la +else +EXTRA_LTLIBRARIES = geanyminiscript.la +endif + +geanyminiscript_la_SOURCES = gms.c gms_gui.c +geanyminiscript_la_LIBADD = $(COMMONLIBS) + +include $(top_srcdir)/build/cppcheck.mk
Modified: geanyminiscript/src/gms.c 312 files changed, 312 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,312 @@ +/* + * gms.c: miniscript plugin for geany editor + * Geany, a fast and lightweight IDE + * + * Copyright 2008 Pascal BURLOT <prublot(at)users(dot)sourceforge(dot)net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +/** + * gms is a tool to apply a script filter on a text selection, or on + * the whole document, or all opened documents. + * + * note: the script filter could be : Unix shell, perl , python , sed ,awk ... + */ + +#include <geanyplugin.h> + +/* headers */ +#include <stdlib.h> +#include <glib.h> +#include <glib/gstdio.h> + +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif + +/* user header */ +#include "gms.h" +#include "gms_gui.h" +#include "gms_debug.h" + + +GeanyPlugin *geany_plugin; +GeanyData *geany_data; +GeanyFunctions *geany_functions; + + +/* Check that the running Geany supports the plugin API used below, and check + * for binary compatibility. */ +PLUGIN_VERSION_CHECK(100) + +/* All plugins must set name, description, version and author. */ +PLUGIN_SET_INFO(_("Mini Script"), _("A tool to apply a script filter on a text selection or current document(s)"), + "0.1" , _("Pascal BURLOT, a Geany user")) + +static GtkWidget *gms_item = NULL ; +static gms_handle_t gms_hnd = NULL ; +static gchar *gms_command = NULL ; + + +/** + * \brief the function creates from the current selection to the input file + */ +static void create_selection_2_input_file( ScintillaObject *sci ) +{ + gchar *contents = NULL; + gint size_buf = sci_get_selected_text_length(sci); + + contents = GMS_G_MALLOC( gchar, size_buf + 1 ) ; + GMS_PNULL(contents) ; + + sci_get_selected_text( sci ,contents ); + + g_file_set_contents(gms_get_in_filename(gms_hnd), contents, -1 , NULL ); + GMS_G_FREE(contents); +} + +/** + * \brief the function reads the result file + */ +static gchar *read_result_file( gchar *filename ) +{ + gchar *utf8 = NULL; + gchar *contents = NULL; + GError *error = NULL ; + if (g_file_get_contents(filename, &contents, NULL, &error )) + { + if ( contents ) + { + utf8 = g_locale_to_utf8 (contents, -1, NULL, NULL, NULL); + GMS_G_FREE(contents); + } + } + return utf8 ; +} +/** + * \brief the function select entirely the document + */ +static void select_entirely_doc( ScintillaObject *sci ) +{ + gint size_buf = sci_get_length(sci); + + sci_set_selection_start( sci , 0 ) ; + sci_set_selection_end( sci , size_buf ) ; +} + +/** + * \brief the function updates the current document + */ +static void update_doc( ScintillaObject *sci, gchar * contents ) +{ + if (contents==NULL) return ; + sci_replace_sel( sci, contents ); +} +/** + * \brief the function deletes the tempory files + */ +static void delete_tmp_files() +{ + if( g_file_test( gms_get_in_filename(gms_hnd),G_FILE_TEST_EXISTS) == TRUE ) + g_unlink( gms_get_in_filename(gms_hnd) ) ; + if( g_file_test( gms_get_out_filename(gms_hnd),G_FILE_TEST_EXISTS) == TRUE ) + g_unlink( gms_get_out_filename(gms_hnd) ) ; + if( g_file_test( gms_get_filter_filename(gms_hnd),G_FILE_TEST_EXISTS) == TRUE ) + g_unlink( gms_get_filter_filename(gms_hnd) ) ; +} + +/** + * \brief the function updates the current document + */ +static gint run_filter( ScintillaObject *sci ) +{ + int r , ret = 0 ; + gchar *result = NULL ; + + gms_command = gms_get_str_command(gms_hnd); + r = system( gms_command ) ; + if ( r != 0 ) + { + GtkWidget *dlg ; + result = read_result_file( gms_get_error_filename(gms_hnd) ) ; + + dlg = gtk_message_dialog_new( GTK_WINDOW(geany->main_widgets->window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + result,NULL); + + gtk_dialog_run(GTK_DIALOG(dlg)); + gtk_widget_destroy(GTK_WIDGET(dlg)) ; + ret = -1 ; + } + else + { + result = read_result_file( gms_get_out_filename(gms_hnd) ) ; + + if ( gms_get_output_mode( gms_hnd) == OUT_CURRENT_DOC ) + { + if ( gms_get_input_mode( gms_hnd) != IN_SELECTION ) + select_entirely_doc( sci ) ; + + update_doc( sci, result ) ; + } + else + { + document_new_file( NULL, NULL, result ) ; + } + } + GMS_G_FREE( result ) ; + + return ret ; +} + +/** + * \brief Callback when the menu item is clicked. + */ +static void item_activate(GtkMenuItem *menuitem, gpointer gdata) +{ + GeanyDocument *doc = document_get_current(); + ScintillaObject *sci = doc->editor->sci ; + if ( gms_hnd == NULL ) + return ; + + if ( gms_dlg( gms_hnd ) == 0 ) + return ; + + gms_create_filter_file( gms_hnd ) ; + + switch ( gms_get_input_mode(gms_hnd) ) + { + case IN_CURRENT_DOC : + select_entirely_doc( sci ) ; + create_selection_2_input_file(sci) ; + run_filter( sci ) ; + delete_tmp_files() ; + break; + case IN_SELECTION : + create_selection_2_input_file(sci) ; + run_filter( sci ) ; + delete_tmp_files() ; + break; + case IN_DOCS_SESSION : + { + guint nb_doc = 0 , i=0; + + /* find the opened document in the geany session */ + while ( (doc = document_get_from_page(nb_doc))!=NULL ) nb_doc++; + + /* For each document */ + for( i=0; i<nb_doc;i++) + { + doc = document_get_from_page(i) ; + sci = doc->editor->sci ; + select_entirely_doc( sci ) ; + create_selection_2_input_file(sci) ; + if ( run_filter( sci ) ) + break ; // if error then stop the loop + } + } + delete_tmp_files() ; + break; + default: + delete_tmp_files() ; + return ; + } + +} + + /** + * \brief the function initializes the localization for the gms plugin + */ +static void locale_init(void) +{ +#ifdef ENABLE_NLS + gchar *locale_dir = NULL; + +#ifdef HAVE_LOCALE_H + setlocale(LC_ALL, ""); +#endif + +#ifdef G_OS_WIN32 + gchar *install_dir = g_win32_get_package_installation_directory("geany", NULL); + /* e.g. C:\Program Files\geany\lib\locale */ + locale_dir = g_strconcat(install_dir, "\share\locale", NULL); + g_free(install_dir); +#else + locale_dir = g_strdup(LOCALEDIR); +#endif + + bindtextdomain(GETTEXT_PACKAGE, locale_dir); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + g_free(locale_dir); +#endif +} + + +/** + * \brief Called by Geany to initialize the plugin. + * \note data is the same as geany_data. + */ +void plugin_init(GeanyData *data) +{ + locale_init(); + + gms_hnd = gms_new(geany->main_widgets->window, + data->interface_prefs->editor_font , + data->editor_prefs->indentation->width, + geany->app->configdir + ) ; + + /* Add an item to the Tools menu */ + gms_item = gtk_menu_item_new_with_mnemonic(_("_Mini-Script")); + gtk_widget_show(gms_item); + gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), gms_item); + g_signal_connect(gms_item, "activate", G_CALLBACK(item_activate), NULL); + + /* make the menu item sensitive only when documents are open */ + ui_add_document_sensitive(gms_item); + +} + + +/* Called by Geany to show the plugin's configure dialog. This function is always called after + * plugin_init() was called. + * You can omit this function if the plugin doesn't need to be configured. + * Note: parent is the parent window which can be used as the transient window for the created + * dialog. */ +#if 1 +GtkWidget *plugin_configure(GtkDialog *dialog) +{ + g_signal_connect(dialog, "response", G_CALLBACK(on_gms_configure_response), gms_hnd ); + return gms_configure_gui( gms_hnd ) ; +} +#endif + +/** + * \brief Called by Geany before unloading the plugin. + */ +void plugin_cleanup(void) +{ + if ( gms_hnd != NULL ) + gms_delete( &gms_hnd ) ; + + /* remove the menu item added in plugin_init() */ + gtk_widget_destroy(gms_item); +}
Modified: geanyminiscript/src/gms.h 33 files changed, 33 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,33 @@ +/* + * gms.h: miniscript plugin for geany editor + * Geany, a fast and lightweight IDE + * + * Copyright 2008 Pascal BURLOT <prublot(at)users(dot)sourceforge(dot)net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +#ifndef GMS_H +#define GMS_H + + +extern GeanyPlugin *geany_plugin; +extern GeanyData *geany_data; +extern GeanyFunctions *geany_functions; + + +#endif /* GMS_H */
Modified: geanyminiscript/src/gms_debug.h 137 files changed, 137 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,137 @@ +/* + * gms_debug.h: miniscript plugin for geany editor + * Geany, a fast and lightweight IDE + * + * Copyright 2008 Pascal BURLOT <prublot(at)users(dot)sourceforge(dot)net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +/******************************************************************************* + * \file gms_debug.h + * \brief macros used for debugging + */ + +#ifndef GMS_DEBUG_H +#define GMS_DEBUG_H + +#ifdef __cplusplus +extern "C" { +#endif + +//! \brief Macro to glib allocation (glib) +#define GMS_G_MALLOC(t,n) ((t *) g_malloc(sizeof(t)*n)) +//! \brief Macro to glib allocation (glib) with zero filling +#define GMS_G_MALLOC0(t,n) ((t *) g_malloc0(sizeof(t)*n)) + +//! \brief Macro to free (glib) +#define GMS_G_FREE(p) { g_free(p); p=NULL; } + +//! \brief Macro pour la liberation des PangoFontDescription +#define GMS_FREE_FONTDESC(p) if ( p != NULL ) { pango_font_description_free (p); p=NULL; } + +//! \brief Macro for freeing a GtkWidget structure +#define GMS_FREE_WIDGET(p) if ( p != NULL ) { gtk_widget_destroy(GTK_WIDGET(p)); p=NULL; } + + +#ifdef GMS_DEBUG + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#define GMS_CALL(f) \ + \ + if (((int)(f)) == -1) \ + { \ + int err = errno; \ + char *strerr = strerror(err); \ + \ + fprintf(stderr, \ + "GMS_CALL(%s): Error at line %u, file %s: %s (errno=%d)\n", \ + #f, __LINE__, __FILE__, \ + strerr == NULL ? "Bad error number" : strerr, \ + err); \ + abort(); \ + } + +#define GMS_PNULL(pp) \ + \ + if ( (pp) == NULL) \ + { \ + fprintf(stderr, \ + "GMS_PNULL(%s): null pointer => %s at line %u, file %s: \n",\ + #pp, __FUNCTION__, __LINE__, __FILE__ ); \ + abort(); \ + } + +#define GMS_FOPEN(pp,...) \ + pp=fopen(__VA_ARGS__) ; \ + if ( (pp) == NULL) \ + { \ + int err = errno; \ + char *strerr = strerror(err); \ + \ + fprintf(stderr, \ + "%s=fopen%s: \n\tError at line %u, file %s: %s (errno=%d)\n",\ + #pp, #__VA_ARGS__, __LINE__, __FILE__ , \ + strerr == NULL ? "Bad error number" : strerr, \ + err); \ + abort(); \ + } + +#define GMS_ASSERT(cc) \ + \ + if (!(cc)) \ + { \ + fprintf(stderr, \ + "GMS_ASSERT(%s): %s at line %u, file %s\n", \ + #cc, __FUNCTION__, __LINE__, __FILE__); \ + abort(); \ + } + +#define GMS_WARNING(cc) \ + \ + if ((cc)) \ + { \ + fprintf(stderr, \ + "GMS_WARNING(%s): %s at line %u, file %s\n", \ + #cc, __FUNCTION__, __LINE__, __FILE__); \ + } + +#define GMS_FINFO(fd,...) fprintf(fd, "INFO:"__VA_ARGS__) +#define GMS_INFO(...) printf("INFO:"__VA_ARGS__) + +#else + +#define GMS_CALL(f) (f) +#define GMS_ASSERT(cc) +#define GMS_WARNING(cc) +#define GMS_PNULL(pp) +#define GMS_FOPEN(pp,...) pp=fopen(__VA_ARGS__) +#define GMS_FINFO(fd,...) +#define GMS_INFO(...) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* GMS_DEBUG_H */
Modified: geanyminiscript/src/gms_gui.c 784 files changed, 784 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,784 @@ +/* + * gms_gui.c: miniscript plugin for geany editor + * Geany, a fast and lightweight IDE + * + * Copyright 2008 Pascal BURLOT <prublot(at)users(dot)sourceforge(dot)net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +/** + * \file gms_gui.c + * \brief it is the graphical user interface of the geany miniscript plugin + */ +#include "geany.h" + +#include <glib/gstdio.h> +#include <glib/gprintf.h> + +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include <pango/pango.h> + +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif + +/* geany headers */ +#include "support.h" +#include "plugindata.h" +#include "editor.h" +#include "document.h" +#include "prefs.h" +#include "utils.h" +#include "ui_utils.h" + +/* user header */ +#include "gms_debug.h" +#include "gms.h" +#include "gms_gui.h" + +/* + * ***************************************************************************** + * Local Macro and new local type definition + */ + +//! \brief Number of script type +#define GMS_NB_TYPE_SCRIPT 6 +//! \brief Number of char of the line buffer +#define GMS_MAX_LINE 127 + +//! \brief macro uset to cast a gms_handle_t to a gms_private_t pointer +#define GMS_PRIVATE(p) ((gms_private_t *) p) + +//! \brief definition of gui data structure +typedef struct { + GtkWidget *dlg ; //!< Dialog widget + GtkWidget *cb_st ; //!< Script type combobox + GtkWidget *t_script ; //!< script text + GtkWidget *rb_select ; //!< radio button : filtering the selection + GtkWidget *rb_doc ; //!< radio button : filtering the current document + GtkWidget *rb_session ; //!< radio button : filtering all documents of the current session + GtkWidget *rb_cdoc ; //!< radio button : the filter output is in the current document + GtkWidget *rb_ndoc ; //!< radio button : the filter output is in the current document + + GtkWidget *e_script[GMS_NB_TYPE_SCRIPT] ; //!< entry for script configuration + GtkTooltips *tips ; //!< tips of button of the top bar + PangoFontDescription *fontdesc; +} gms_gui_t ; + +//! \brief definition of mini-script data structure +typedef struct { + int id ; //!< ID of the instance + gchar *config_dir ; //!< path of configuration files + GString *cmd ; //!< Command string of filtering + GtkWidget *mw ; //!< MainWindow of Geany + gms_gui_t w ; //!< Widgets of minis-script gui + GString *input_name ; //!< filename of the filter input + GString *filter_name ; //!< filter filename + GString *output_name ; //!< filename of the filter output + GString *error_name ; //!< errors filename + GString *script_cmd[GMS_NB_TYPE_SCRIPT]; //!< array of script command names +} gms_private_t ; +/* + * ***************************************************************************** + * Global variables + */ + +/* + * ***************************************************************************** + * Local variables + */ +static unsigned char inst_cnt = 0 ; //!< counter of instance +static gchar bufline[GMS_MAX_LINE+1]; //!< buffer used to read the configuration file + +static const gchar pref_filename[] = "gms.rc" ; //!< preferences filename +static const gchar prefix_filename[] = "/tmp/gms" ; //!< prefix filename +static const gchar in_ext[] = ".in" ; //!< filename extension for the input file +static const gchar out_ext[] = ".out" ; //!< filename extension for the output file +static const gchar filter_ext[] = ".filter" ; //!< filename extension for the filter file +static const gchar error_ext[] = ".error" ; //!< filename extension for the error file + +///< \brief It's the default script command +static const gchar *default_script_cmd[GMS_NB_TYPE_SCRIPT] = { + "${SHELL} ", "perl ", "python ", "sed -f ", "awk -f ", "cat - " }; + +///< \brief It's the label for the script command combobox +const gchar *label_script_cmd[GMS_NB_TYPE_SCRIPT] = { + "Shell", "Perl", "Python", "Sed", "Awk", "User" }; + +///< \brief It's the information message about geany mini script +const char *geany_info = "<b>GMS : Geany Mini-Script filter Plugin</b>\n" +"This plugin is a tool to apply a script filter on :\n" +" o the text selection,\n" +" o the current document,\n" +" o all documents of the current session.\n" +"\n" +"The filter type can be : \n" +" o Unix shell script, \n" +" o perl script, \n" +" o python script, \n" +" o sed commands,\n" +" o awk script.\n" +"\n" +"<b>AUTHOR</b>\n" +" Written by Pascal BURLOT (December,2008)\n" +"\n" +"<b>LICENSE:</b>\n" +"This program is free software; you can redistribute\n" +"it and/or modify it under the terms of the GNU \n" +"General Public License as published by the Free\n" +"Software Foundation; either version 2 of the License,\n" +"or (at your option) any later version." ; + +/* + * ***************************************************************************** + * Local functions + */ + +/** + * \brief the function loads the preferences file + */ +static void load_prefs_file( + gms_private_t *this ///< pointer of mini-script data structure + ) +{ + GString *gms_pref = g_string_new("") ; + + g_string_printf(gms_pref , "%s/plugins/%s", this->config_dir,pref_filename ); + + if ( g_file_test( gms_pref->str, G_FILE_TEST_EXISTS ) == TRUE ) + { + FILE *fd = g_fopen( gms_pref->str, "r" ) ; + if ( fd != NULL ) + { + int ii ; + for ( ii = 0 ; ii <GMS_NB_TYPE_SCRIPT ;ii++ ) + { + if ( fgets(bufline,GMS_MAX_LINE,fd) == NULL ) + break ; + if ( fgets(bufline,GMS_MAX_LINE,fd) == NULL ) + break ; + bufline[strlen(bufline)-1] = 0 ; + g_string_assign(this->script_cmd[ii] , bufline ) ; + } + fclose(fd) ; + } + } + g_string_free( gms_pref , TRUE) ; +} + +/** + * \brief the function saves the preferences file + */ +static void save_prefs_file( + gms_private_t *this ///< pointer of mini-script data structure + ) +{ + GString *gms_pref = g_string_new(""); + + g_string_printf(gms_pref , "%s/plugins", this->config_dir ); + + if ( g_file_test( this->config_dir, G_FILE_TEST_EXISTS ) != TRUE ) + g_mkdir( this->config_dir, 0755 ) ; + + if ( g_file_test( gms_pref->str, G_FILE_TEST_EXISTS ) != TRUE ) + g_mkdir( gms_pref->str, 0755 ) ; + + if ( g_file_test( gms_pref->str, G_FILE_TEST_IS_DIR ) == TRUE ) + { + FILE *fd ; + g_string_append_c( gms_pref, '/' ); + g_string_append( gms_pref, pref_filename ); + + fd = g_fopen( gms_pref->str, "w" ) ; + if ( fd != NULL ) + { + int ii ; + for ( ii = 0 ; ii <GMS_NB_TYPE_SCRIPT ;ii++ ) + fprintf(fd,"# %s\n%s\n",label_script_cmd[ii],this->script_cmd[ii]->str); + + fclose(fd) ; + } + } + g_string_free( gms_pref , TRUE) ; +} + +/** + * \brief Callback associated to a button "new" + */ +static void gms_cb_new( + GtkWidget *w , + gpointer data + ) +{ + gms_private_t *this = GMS_PRIVATE(data) ; + GtkTextIter start; + GtkTextIter end; + GtkTextBuffer* text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW( this->w.t_script ) ); + gtk_text_buffer_get_start_iter(text_buffer,&start); + gtk_text_buffer_get_end_iter(text_buffer,&end); + gtk_text_buffer_delete( text_buffer ,&start , &end) ; +} + +/** + * \brief Callback associated to a button "load" + */ +static void gms_cb_load( + GtkWidget *w , + gpointer data + ) +{ + gms_private_t *this = GMS_PRIVATE(data) ; + GtkWidget *p_dialog ; + + p_dialog = gtk_file_chooser_dialog_new (_("Load Mini-Script File"), + GTK_WINDOW(this->mw) , + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + if ( p_dialog == NULL ) + return ; + + if (gtk_dialog_run (GTK_DIALOG (p_dialog)) == GTK_RESPONSE_ACCEPT) + { + gchar *filename = NULL; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (p_dialog)); + + if(filename != NULL) + { + gchar *contents = NULL; + GError *error = NULL ; + + if (g_file_get_contents(filename, &contents, NULL, &error )) + { + gchar *utf8 = NULL; + GtkTextIter start; + GtkTextIter end; + GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW( this->w.t_script ) ); + + /* destroy the old text of buffer */ + gtk_text_buffer_get_start_iter(text_buffer,&start); + gtk_text_buffer_get_end_iter(text_buffer,&end); + gtk_text_buffer_delete( text_buffer ,&start , &end) ; + + /* Copy file contents in GtkTextView */ + gtk_text_buffer_get_start_iter(text_buffer,&start); + utf8 = g_locale_to_utf8 (contents, -1, NULL, NULL, NULL); + GMS_G_FREE(contents); + gtk_text_buffer_insert (text_buffer, &start, utf8, -1); + GMS_G_FREE(utf8); + } + GMS_G_FREE(filename); + } + } + gtk_widget_destroy (p_dialog); +} + + +/** + * \brief Callback associated to a button "load" + */ +static void gms_cb_save( + GtkWidget *w , + gpointer data + ) +{ + gms_private_t *this = GMS_PRIVATE(data) ; + GtkWidget *p_dialog ; + + p_dialog = gtk_file_chooser_dialog_new (_("Save Mini-Script File"), + GTK_WINDOW(this->mw) , + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); + if ( p_dialog == NULL ) + return ; + + if (gtk_dialog_run (GTK_DIALOG (p_dialog)) == GTK_RESPONSE_ACCEPT) + { + gchar *filename = NULL; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (p_dialog)); + + if(filename != NULL) + { + gchar *contents = NULL; + GtkTextIter start; + GtkTextIter end; + GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW( this->w.t_script ) ); + gtk_text_buffer_get_start_iter(text_buffer,&start); + gtk_text_buffer_get_end_iter(text_buffer,&end); + contents=gtk_text_buffer_get_text(text_buffer,&start,&end,FALSE); + g_file_set_contents(filename, contents, -1 , NULL ); + GMS_G_FREE(contents); + GMS_G_FREE(filename); + } + } + gtk_widget_destroy (p_dialog); +} +/** + * \brief Callback associated to a button "load" + */ +static void gms_cb_info( + GtkWidget *w , + gpointer data + ) +{ + gms_private_t *this = GMS_PRIVATE(data) ; + + GtkWidget *dlg = gtk_message_dialog_new_with_markup( GTK_WINDOW(this->mw), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + _(geany_info),NULL ); + + gtk_dialog_run(GTK_DIALOG(dlg)); + GMS_FREE_WIDGET(dlg); +} + +/* + * ***************************************************************************** + * Global functions + */ + +static GtkWidget *new_button_from_stock( gboolean withtext, const gchar *stock_id ) +{ + GtkWidget *button ; + if ( withtext ) + button = gtk_button_new_from_stock( stock_id ) ; + else + { + button = gtk_button_new() ; + gtk_container_add( GTK_CONTAINER(button),gtk_image_new_from_stock(stock_id , GTK_ICON_SIZE_SMALL_TOOLBAR ) ); + } + return button ; +} + +/** + * \brief the function initializes the mini-script gui structure. + */ +gms_handle_t gms_new( + GtkWidget *mw , ///< Geany Main windows + gchar *font , ///< Geany editor font + gint tabs , ///< Geany editor tabstop + gchar *config_dir ///< Geany Configuration Path + ) +{ + gms_private_t *this = GMS_G_MALLOC0(gms_private_t,1); + + if ( this != NULL ) + { + GtkBox *vb_dlg ; //!< vbox of dialog box + GtkWidget *hb_st ; //!< Hbox for script type + GtkWidget *b_open ; //!< button for loading a existing script + GtkWidget *b_save ; //!< button for saving the current script + GtkWidget *b_new ; //!< button for erasing the script text box + GtkWidget *b_info ; //!< button for info box + GtkWidget *sb_script ; //!< Scroll box for script text + GtkWidget *hb_rb ; //!< Hbox for radio buttons + GtkWidget *f_rbi ; //!< frame for radio buttons : input filter + GtkWidget *hb_rbi ; //!< Hbox for radio buttons + GtkWidget *f_rbo ; //!< frame for radio buttons : input filter + GtkWidget *hb_rbo ; //!< Hbox for radio buttons + + PangoTabArray* tabsarray ; + GdkScreen *ecran = gdk_screen_get_default(); + gint width = gdk_screen_get_width(ecran) ; + gint height = gdk_screen_get_height(ecran) ; + gint i , size_pid ; + gboolean mode_txt_icon = FALSE ; + + this->mw = mw ; + this->cmd = g_string_new(""); + this->config_dir =config_dir ; + + this->w.dlg = gtk_dialog_new_with_buttons( + _("Mini-Script Filter"), + GTK_WINDOW( mw ), + GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, + GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL, + GTK_STOCK_EXECUTE,GTK_RESPONSE_APPLY, + NULL + ) ; + vb_dlg = GTK_BOX (GTK_DIALOG(this->w.dlg)->vbox) ; + + if ( width > 800 ) + width = 800 ; + + if ( height > 600 ) + height = 600 ; + + gtk_window_set_default_size( GTK_WINDOW(this->w.dlg) , width/2 , height/2 ) ; + + + this->w.tips = gtk_tooltips_new (); + + // Hbox : type de script + hb_st = gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hb_st), 0); + gtk_box_pack_start( vb_dlg , hb_st, FALSE, FALSE, 0); + + b_new = new_button_from_stock( mode_txt_icon, GTK_STOCK_CLEAR ) ; + gtk_box_pack_start( GTK_BOX (hb_st), b_new, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (b_new), "clicked",G_CALLBACK (gms_cb_new), (gpointer) this ); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), b_new, _("Clear the mini-script window") , ""); + + b_open = new_button_from_stock( mode_txt_icon, GTK_STOCK_OPEN ) ; + gtk_box_pack_start( GTK_BOX (hb_st), b_open, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (b_open), "clicked",G_CALLBACK (gms_cb_load), (gpointer) this ); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), b_open, _("Load a mini-script into this window"), ""); + + b_save = new_button_from_stock( mode_txt_icon, GTK_STOCK_SAVE_AS ) ; + gtk_box_pack_start( GTK_BOX (hb_st),b_save, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (b_save), "clicked",G_CALLBACK (gms_cb_save), (gpointer) this ); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), b_save, _("Save the mini-script into a file"), ""); + + b_info = new_button_from_stock( mode_txt_icon, GTK_STOCK_INFO ) ; + gtk_box_pack_end( GTK_BOX (hb_st), b_info, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (b_info), "clicked",G_CALLBACK (gms_cb_info), (gpointer) this ); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), b_info, _("Display a information about the mini-script plugin"), ""); + + this->w.cb_st = gtk_combo_box_new_text() ; + for ( i=0;i<GMS_NB_TYPE_SCRIPT ; i++ ) + gtk_combo_box_append_text( GTK_COMBO_BOX(this->w.cb_st), label_script_cmd[i] ) ; + gtk_combo_box_set_active(GTK_COMBO_BOX(this->w.cb_st), 0 ); + gtk_box_pack_start(GTK_BOX(hb_st), this->w.cb_st, FALSE, FALSE, 0); + GTK_WIDGET_SET_FLAGS (this->w.cb_st, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), this->w.cb_st, _("select the mini-script type"), ""); + + // Scroll Box : script + sb_script = gtk_scrolled_window_new (NULL,NULL); + gtk_container_set_border_width (GTK_CONTAINER (sb_script), 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sb_script), + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); + gtk_box_pack_start(vb_dlg, sb_script, TRUE, TRUE, 0); + + this->w.t_script = gtk_text_view_new(); + this->w.fontdesc = pango_font_description_from_string(font); + gtk_widget_modify_font( this->w.t_script, this->w.fontdesc ); + gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW (sb_script), this->w.t_script); + { // find the width of the space character + gint largeur,hauteur ; + PangoLayout *layout = gtk_widget_create_pango_layout (this->w.t_script, " "); + pango_layout_set_font_description (layout, this->w.fontdesc); + pango_layout_get_pixel_size(layout, &largeur, &hauteur); + tabs = tabs*largeur ; + g_object_unref (layout); + } + tabsarray = pango_tab_array_new_with_positions ( 1, TRUE , PANGO_TAB_LEFT, tabs ) ; + gtk_text_view_set_tabs(GTK_TEXT_VIEW(this->w.t_script),tabsarray); + + // Hbox : Radio bouttons for choosing the input/output: + hb_rb = gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hb_rb), 0); + gtk_box_pack_start( vb_dlg, hb_rb, FALSE, FALSE, 0); + + // Hbox : Radio bouttons for choosing the input: + // selection/current document/all documents of the current session + f_rbi = gtk_frame_new (_("filter input") ); + gtk_box_pack_start( GTK_BOX (hb_rb), f_rbi, FALSE, FALSE, 0); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), f_rbi, _("select the input of mini-script filter"), ""); + + hb_rbi = gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hb_rbi), 0); + gtk_container_add (GTK_CONTAINER (f_rbi), hb_rbi ); + + this->w.rb_select = gtk_radio_button_new_with_label( NULL, _("selection") ) ; + this->w.rb_doc = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON( this->w.rb_select) ,_("document") ) ; + this->w.rb_session = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON( this->w.rb_select) ,_("session") ) ; + gtk_box_pack_start(GTK_BOX(hb_rbi), this->w.rb_select, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hb_rbi), this->w.rb_doc, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hb_rbi), this->w.rb_session, TRUE, TRUE, 0); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(this->w.rb_doc) ,TRUE) ; + + + // Hbox : Radio bouttons for choosing the output: + // current document/ or new document + f_rbo = gtk_frame_new (_("filter output") ); + gtk_box_pack_start( GTK_BOX(hb_rb), f_rbo, FALSE, FALSE, 0); + gtk_tooltips_set_tip (GTK_TOOLTIPS (this->w.tips), f_rbo, _("select the output of mini-script filter"), ""); + + hb_rbo = gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER(hb_rbo), 0); + gtk_container_add (GTK_CONTAINER(f_rbo), hb_rbo ); + + this->w.rb_cdoc = gtk_radio_button_new_with_label( NULL, _("Current Doc.") ) ; + this->w.rb_ndoc = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON( this->w.rb_cdoc) ,_("New Doc.") ) ; + gtk_box_pack_start(GTK_BOX(hb_rbo), this->w.rb_cdoc, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hb_rbo), this->w.rb_ndoc, TRUE, TRUE, 0); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(this->w.rb_ndoc) ,TRUE) ; + + gtk_widget_show_all(GTK_WIDGET(vb_dlg)); + this->id = ++inst_cnt ; + + this->input_name = g_string_new(prefix_filename) ; + this->filter_name= g_string_new(prefix_filename) ; + this->output_name= g_string_new(prefix_filename) ; + this->error_name = g_string_new(prefix_filename) ; + + size_pid = (gint)(2*sizeof(pid_t)) ; + g_string_append_printf( this->input_name,"%02x_%0*x%s", + this->id,size_pid, getpid(), in_ext ) ; + + g_string_append_printf(this->filter_name,"%02x_%0*x%s", + this->id,size_pid, getpid(), filter_ext ) ; + + g_string_append_printf(this->output_name,"%02x_%0*x%s", + this->id,size_pid, getpid(), out_ext ) ; + + g_string_append_printf(this->error_name,"%02x_%0*x%s", + this->id,size_pid, getpid(), error_ext ) ; + + for ( i=0;i<GMS_NB_TYPE_SCRIPT ; i++ ) + { + this->script_cmd[i]=g_string_new(default_script_cmd[i] ) ; + this->w.e_script[i]=NULL; + } + load_prefs_file(this) ; + + } + + return GMS_HANDLE(this) ; +} +/** + * \brief the function destroys the mini-script gui structure. + */ + +void gms_delete( + gms_handle_t *hnd ///< handle of mini-script data structure + ) +{ + if ( hnd != NULL ) + { + gms_private_t *this = GMS_PRIVATE( *hnd ) ; + gint i ; + gboolean flag = TRUE ; + + GMS_FREE_FONTDESC(this->w.fontdesc ); + GMS_FREE_WIDGET(this->w.dlg); + + g_string_free( this->input_name ,flag) ; + g_string_free( this->output_name ,flag) ; + g_string_free( this->filter_name ,flag) ; + g_string_free( this->cmd ,flag) ; + + for ( i=0;i<GMS_NB_TYPE_SCRIPT ; i++ ) + g_string_free(this->script_cmd[i] ,flag) ; + + GMS_G_FREE( this ) ; + } +} + +/** + * \brief the function runs the mini-script dialog. + */ +int gms_dlg( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + gint ret = 0 ; + + if ( this == NULL ) + return 0 ; + + gtk_widget_show(this->w.dlg); + ret = gtk_dialog_run(GTK_DIALOG(this->w.dlg)); + gtk_widget_hide(this->w.dlg); + + if ( ret == GTK_RESPONSE_APPLY ) + return 1 ; + else + return 0 ; +} + +/** + * \brief the function get the input mode. + */ +gms_input_t gms_get_input_mode( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + gms_input_t mode = IN_CURRENT_DOC ; + + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(this->w.rb_select) ) == TRUE ) + mode = IN_SELECTION ; + else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(this->w.rb_session) ) == TRUE ) + mode = IN_DOCS_SESSION ; + + return mode ; +} + +/** + * \brief the function get the output mode. + */ +gms_output_t gms_get_output_mode( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + gms_output_t mode = OUT_CURRENT_DOC ; + + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(this->w.rb_ndoc) ) == TRUE ) + mode = OUT_NEW_DOC ; + + return mode ; +} + +/** + * \brief the function get the input filename for filter input. + */ +gchar *gms_get_in_filename( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + return this->input_name->str ; +} + +/** + * \brief the function get the output filename for filter result. + */ +gchar *gms_get_out_filename( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + return this->output_name->str ; +} + +/** + * \brief the function get the output filename for filter script. + */ +gchar *gms_get_filter_filename( gms_handle_t hnd ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + return this->filter_name->str ; +} + +/** + * \brief the function get the error filename for filter script. + */ +gchar *gms_get_error_filename( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + return this->error_name->str ; +} + +/** + * \brief the function creates the filter file. + */ +void gms_create_filter_file( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + gchar *contents = NULL; + GtkTextIter start; + GtkTextIter end; + GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW( this->w.t_script ) ); + + gtk_text_buffer_get_start_iter(text_buffer,&start); + gtk_text_buffer_get_end_iter(text_buffer,&end); + contents=gtk_text_buffer_get_text(text_buffer,&start,&end,FALSE); + g_file_set_contents(this->filter_name->str, contents, -1 , NULL ); + GMS_G_FREE(contents); +} + +/** + * \brief the function creates the command string. + */ +gchar *gms_get_str_command( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + gint ii_script = gtk_combo_box_get_active(GTK_COMBO_BOX(this->w.cb_st) ) ; + + g_string_printf( this->cmd,"cat %s | %s %s > %s 2> %s", + this->input_name->str, + this->script_cmd[ii_script]->str, + this->filter_name->str, + this->output_name->str, + this->error_name->str ); + return this->cmd->str ; +} + +/** + * \brief the function creates the configuration gui. + */ + +GtkWidget *gms_configure_gui( + gms_handle_t hnd ///< handle of mini-script data structure + ) +{ + gms_private_t *this = GMS_PRIVATE( hnd ) ; + + volatile gint ii ; + GtkWidget *vb_pref ; //!< vbox for mini-script configuration + GtkWidget *f_script ; //!< frame for configuration script + GtkWidget *t_script ; //!< table for configuration script + GtkWidget *w ; + + vb_pref= gtk_vbox_new(FALSE, 6); + f_script = gtk_frame_new (_("script configuration") ); + gtk_box_pack_start( GTK_BOX (vb_pref), f_script, FALSE, FALSE, 0); + + t_script = gtk_table_new( GMS_NB_TYPE_SCRIPT ,3,FALSE) ; + gtk_container_add (GTK_CONTAINER (f_script), t_script ); + + for ( ii = 0 ; ii <GMS_NB_TYPE_SCRIPT ;ii++ ) + { + w = gtk_label_new(label_script_cmd[ii]); + gtk_table_attach_defaults(GTK_TABLE(t_script),w, 0,1,ii,ii+1 ); + + this->w.e_script[ii] = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(this->w.e_script[ii]), this->script_cmd[ii]->str); + gtk_table_attach_defaults(GTK_TABLE(t_script),this->w.e_script[ii], 1,2,ii,ii+1 ); + } + + gtk_widget_show_all(vb_pref); + return vb_pref ; +} + +/** + * \brief Callback associated to a button "new" + */ +void on_gms_configure_response(GtkDialog *dialog, gint response, gpointer user_data ) +{ + if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) + { + int ii ; + gms_private_t *this = GMS_PRIVATE(user_data) ; + + for ( ii = 0 ; ii <GMS_NB_TYPE_SCRIPT ;ii++ ) + if (this->w.e_script[ii]!=NULL ) + g_string_assign( this->script_cmd[ii] , gtk_entry_get_text(GTK_ENTRY(this->w.e_script[ii]))); + save_prefs_file(this); + } +}
Modified: geanyminiscript/src/gms_gui.h 56 files changed, 56 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,56 @@ +/* + * gms_gui.h: miniscript plugin for geany editor + * Geany, a fast and lightweight IDE + * + * Copyright 2008 Pascal BURLOT <prublot(at)users(dot)sourceforge(dot)net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ +#ifndef GMS_GUI_H +#define GMS_GUI_H + +#define GMS_HANDLE(p) ((gms_handle_t *) p) +typedef void* gms_handle_t ; + +typedef enum { + IN_SELECTION =0, + IN_CURRENT_DOC =1, + IN_DOCS_SESSION =3 +} gms_input_t ; + +typedef enum { + OUT_CURRENT_DOC =0, + OUT_NEW_DOC =1 +} gms_output_t ; + +gms_handle_t gms_new( GtkWidget *mw, gchar *font, gint tabs, gchar *config_dir); +void gms_delete( gms_handle_t *hnd ); +int gms_dlg( gms_handle_t hnd ) ; +gchar *gms_get_in_filename( gms_handle_t hnd ) ; +gchar *gms_get_out_filename( gms_handle_t hnd ) ; +gchar *gms_get_filter_filename( gms_handle_t hnd ) ; +gchar *gms_get_error_filename( gms_handle_t hnd ) ; +void gms_create_filter_file( gms_handle_t hnd ) ; +gchar *gms_get_str_command( gms_handle_t hnd ) ; +gms_input_t gms_get_input_mode( gms_handle_t hnd ); +gms_output_t gms_get_output_mode( gms_handle_t hnd ); + +GtkWidget *gms_configure_gui( gms_handle_t hnd ); +void on_gms_configure_response( GtkDialog *dialog, gint response, gpointer user_data) ; + +#endif /* GMS_GUI_H */ +
Modified: geanyminiscript/wscript_build 29 files changed, 29 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# +# WAF build script for geany-plugins - Addons +# +# Copyright 2010-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# $Id$ + +from build.wafutils import build_plugin + + +name = 'GeanyMiniScript' +includes = ['geanyminiscript/src'] + +build_plugin(bld, name, includes=includes)
Modified: geanyminiscript/wscript_configure 0 files changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: po/POTFILES.in 7 files changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -127,6 +127,12 @@ geanylua/glspi_app.c # GeanyMacro geanymacro/src/geanymacro.c
+# GeanyMiniScript +geanyminiscript/src/gms_gui.c +geanyminiscript/src/gms_gui.h +geanyminiscript/src/gms.c +geanyminiscript/src/gms.h + # GeanyNumberedBookmarks geanynumberedbookmarks/src/geanynumberedbookmarks.c
@@ -205,4 +211,3 @@ xmlsnippets/src/plugin.c xmlsnippets/src/xmlsnippets.c xmlsnippets/src/tests.c xmlsnippets/src/test-stubs.c -
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).