Revision: 707
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=707&view=rev
Author: frlan
Date: 2009-06-11 21:31:32 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Update version string to an hard coded one - 0.4 - at GeanyLaTeX plugin
Modified Paths:
--------------
trunk/geany-plugins/geanylatex/src/geanylatex.c
Modified: trunk/geany-plugins/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geany-plugins/geanylatex/src/geanylatex.c 2009-06-11 21:30:17 UTC (rev 706)
+++ trunk/geany-plugins/geanylatex/src/geanylatex.c 2009-06-11 21:31:32 UTC (rev 707)
@@ -27,7 +27,7 @@
PLUGIN_VERSION_CHECK(136)
PLUGIN_SET_INFO(_("LaTeX"), _("Plugin to provide better LaTeX support"),
- VERSION,"Frank Lanitz <frank(a)frank.uvena.de>")
+ "0.4", "Frank Lanitz <frank(a)frank.uvena.de>")
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 706
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=706&view=rev
Author: frlan
Date: 2009-06-11 21:30:17 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Merge geanyLaTeX plugin to geany-plugins project. Documentation still missing. Keeping separate plugin structure for future separate releases
Modified Paths:
--------------
trunk/geany-plugins/po/POTFILES.in
trunk/geany-plugins/wscript
Added Paths:
-----------
trunk/geany-plugins/geanylatex/
trunk/geany-plugins/geanylatex/COPYING
trunk/geany-plugins/geanylatex/ChangeLog
trunk/geany-plugins/geanylatex/INSTALL
trunk/geany-plugins/geanylatex/NEWS
trunk/geany-plugins/geanylatex/TODO
trunk/geany-plugins/geanylatex/src/
trunk/geany-plugins/geanylatex/src/bibtex.c
trunk/geany-plugins/geanylatex/src/bibtex.h
trunk/geany-plugins/geanylatex/src/bibtexlabels.c
trunk/geany-plugins/geanylatex/src/datatypes.h
trunk/geany-plugins/geanylatex/src/formatpatterns.c
trunk/geany-plugins/geanylatex/src/formatutils.c
trunk/geany-plugins/geanylatex/src/formatutils.h
trunk/geany-plugins/geanylatex/src/geanylatex.c
trunk/geany-plugins/geanylatex/src/geanylatex.h
trunk/geany-plugins/geanylatex/src/latexencodings.c
trunk/geany-plugins/geanylatex/src/latexencodings.h
trunk/geany-plugins/geanylatex/src/latexenvironments.c
trunk/geany-plugins/geanylatex/src/latexenvironments.h
trunk/geany-plugins/geanylatex/src/latexkeybindings.c
trunk/geany-plugins/geanylatex/src/latexkeybindings.h
trunk/geany-plugins/geanylatex/src/latexutils.c
trunk/geany-plugins/geanylatex/src/latexutils.h
trunk/geany-plugins/geanylatex/src/letters.c
trunk/geany-plugins/geanylatex/src/letters.h
trunk/geany-plugins/geanylatex/src/reftex.c
trunk/geany-plugins/geanylatex/src/reftex.h
Copied: trunk/geany-plugins/geanylatex/COPYING (from rev 705, trunk/geanylatex/COPYING)
===================================================================
--- trunk/geany-plugins/geanylatex/COPYING (rev 0)
+++ trunk/geany-plugins/geanylatex/COPYING 2009-06-11 21:30:17 UTC (rev 706)
@@ -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.
Copied: trunk/geany-plugins/geanylatex/ChangeLog (from rev 705, trunk/geanylatex/ChangeLog)
===================================================================
--- trunk/geany-plugins/geanylatex/ChangeLog (rev 0)
+++ trunk/geany-plugins/geanylatex/ChangeLog 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,188 @@
+2009-05-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Some more clean up of code.
+ * Update of documentation for 0.4 release.
+
+
+2009-05-21 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added configuration dialog.
+
+
+2009-05-19 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make toolbar document sensitive.
+
+
+2009-05-17 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Adding some more items to toolbar for centerin, left and right formatted
+ text. Created LaTeX code based on needs still some improvement. Please
+ use with care.
+
+
+2009-05-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Adding a toolbar for common LaTeX format topics.
+
+
+2009-04-17 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Set undo points for better redo/undo on inserting formatings.
+ * Make reference type inside insert reference dialog accessible by
+ keyboard.
+
+
+2009-04-12 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added some new lines into latex beamer template.
+
+
+2009-04-10 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Sort entries on insert reference dialog by alphabet.
+
+
+2009-03-30 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Moved replacement functions into their own submenu.
+ * Added key bindings for formatting text with bold, italic and typewriter
+ font face.
+
+
+2009-03-28 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Use a text field with pull down instead of a normal combo box for
+ font size at LaTeX wizard.
+
+
+2009-03-27 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * doc/geanylatex.tex: Added documentation written in LaTeX.
+
+
+2009-03-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Replace \u-UTF-8 letters by octal coded chars. Huge thanks to
+ Dominic Hopf for providing patch and fighting that fight.
+ * Added a menu entry for bulk replace function and fixed a segfault at
+ replacing
+
+
+2009-03-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added a function to bulk replace special characters
+ inside marked text by keybinding
+
+
+2009-03-13 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Don't offer insert environment dialog in case of no document is open.
+
+
+2009-03-06 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Insert environment now supports selections by position \begin{} and
+ \end{} around
+
+
+2009-02-28 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Don't react on some keybindings in case of no document is open.
+ * Added a feature for easy inserting environments to document.
+ * Added keybinding to insert \item into document. Very useful at
+ e.g. writing lists
+
+
+2009-02-18 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Formating of selected text
+ * Added feature to replace special characters at input with LaTeX
+ replacment
+
+
+2009-02-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added a menu entry for easy formating of text
+
+
+2009-02-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Release of GeanyLaTeX 0.3
+
+
+2009-02-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added a keyboard shortcut for inserting a new line ( \\ ).
+ * Make cursor placed behind inserted text for most cases.
+ (Inserting BibTeX entries will not reset the cursor)
+
+
+2009-01-19 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Improved reference dialog to offer labels based on aux file
+
+
+2008-11-17 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added a submenu supporting inserting bibtex entries
+
+
+2008-11-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Enrico which corrects some spelling
+ mistakes and cleans up code a bit.
+
+
+2008-11-02 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make usage of Geany API v104 by using of Geany's plugin init
+ locale function.
+
+
+2008-10-29 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * GeanyLaTeX 0.2 release
+
+
+2008-10-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Updated to Geany Plugin API v100 (add_document_sensitive())
+
+
+2008-09-01 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * src/geanylatex.c: Added support for l10n.
+
+
+2008-09-01 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Ported build system of spellcheck plugin.
+
+
+2008-07-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make plugin work together with Geany plugin API v78.
+
+
+2008-07-11 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make plugin compile with Geany svn r2767.
+
+
+2008-06-26 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Update of used plugin API to v71.
+
+
+2008-06-17 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * configure.in:
+ Fix build using autogen.sh (Makefile.in was not created).
+ * latexencodings.h:
+ Fix multiple definition of latex_encodings array.
+
+
+2008-06-17 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Moved plugin to geany-plugin svn.
Copied: trunk/geany-plugins/geanylatex/INSTALL (from rev 705, trunk/geanylatex/INSTALL)
===================================================================
--- trunk/geany-plugins/geanylatex/INSTALL (rev 0)
+++ trunk/geany-plugins/geanylatex/INSTALL 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,15 @@
+These installation instructions are written for a Linux system.
+
+At the time of this writing, building the plugin requires a recent SVN
+checkout of the Geany sources (Geany Plugin API v130).
+
+You need for compliling the plugin the Geany header files installed.
+For configuring and installing just run
+
+ % configure
+ % make
+ % make install
+
+If you want to install geanyLaTeX to another directory, you should run
+configure with --prefix=/path/to/dir option. make install will install
+all files to your new target.
Copied: trunk/geany-plugins/geanylatex/NEWS (from rev 705, trunk/geanylatex/NEWS)
===================================================================
--- trunk/geany-plugins/geanylatex/NEWS (rev 0)
+++ trunk/geany-plugins/geanylatex/NEWS 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1 @@
+Please check ChangeLog for details.
\ No newline at end of file
Copied: trunk/geany-plugins/geanylatex/TODO (from rev 705, trunk/geanylatex/TODO)
===================================================================
--- trunk/geany-plugins/geanylatex/TODO (rev 0)
+++ trunk/geany-plugins/geanylatex/TODO 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,16 @@
+ TODO
+************
+
+* Improving support for bibTeX
+ * Parsing of *.bib
+ * Inserting of \cite
+ * Dialog for inserting bibTeX entries
+* Wizard:
+ * Adding support for diff. letter classes
+ * Make plugin use customisable templates
+* Replacing of environments
+* Parsing document for »TOC«
+ * Navigation throught document
+ * "Graphical" support while using \ref, \pageref ...
+* Code examples for very common problems
+* Make special characters extensible through files
Copied: trunk/geany-plugins/geanylatex/src/bibtex.c (from rev 705, trunk/geanylatex/src/bibtex.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/bibtex.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/bibtex.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,141 @@
+/*
+ * bibtex.c
+ *
+ * Copyright 2008-2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include "bibtex.h"
+#include "reftex.h"
+
+#define glatex_set_status(entry_number, flag) \
+ fields[entry_number] = flag;
+
+
+#if 0
+static int get_entry_pos(char *str)
+{
+ int i;
+
+ if(str != NULL) {
+ for (i = 0; i < N_ENTRIES; i++) {
+ if (utils_str_casecmp(str, label_entry[i]) == 0)
+ return i;
+ }
+ }
+ return -1;
+}
+#endif
+
+void glatex_insert_bibtex_entry(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ int doctype = GPOINTER_TO_INT(gdata);
+ gboolean fields[N_ENTRIES];
+ gchar *output = g_strdup("@");
+ int i;
+
+ for (i = 0; i < N_ENTRIES; i++)
+ {
+ glatex_set_status(i, FALSE);
+ }
+
+ switch(doctype) {
+ case ARTICLE:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(JOURNAL, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case BOOK:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(EDITOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(PUBLISHER, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case BOOKLET:
+ glatex_set_status(TITLE, TRUE);
+ break;
+ case CONFERENCE:
+ case INCOLLECTION:
+ case INPROCEEDINGS:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(BOOKTITLE, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case INBOOK:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(EDITOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(CHAPTER, TRUE);
+ glatex_set_status(PAGES, TRUE);
+ glatex_set_status(PUBLISHER, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case MANUAL:
+ glatex_set_status(TITLE, TRUE);
+ break;
+ case MASTERSTHESIS:
+ case PHDTHESIS:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(SCHOOL, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case MISC:
+ for (i = 0; i < N_ENTRIES; i++)
+ {
+ glatex_set_status(i, TRUE);
+ }
+ case TECHREPORT:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(INSTITUTION, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ case UNPUBLISHED:
+ glatex_set_status(AUTHOR, TRUE);
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(NOTE, TRUE);
+ break;
+ case PROCEEDINGS:
+ glatex_set_status(TITLE, TRUE);
+ glatex_set_status(YEAR, TRUE);
+ break;
+ default:
+ for (i = 0; i < N_ENTRIES; i++)
+ {
+ glatex_set_status(i, TRUE);
+ }
+ }
+
+ output = g_strconcat(output, glatex_label_types[doctype], "{ \n",NULL);
+ for (i = 0; i < N_ENTRIES; i++)
+ {
+ if (fields[i] == TRUE)
+ {
+ output = g_strconcat(output, glatex_label_entry_keywords[i], " = {},\n", NULL);
+ }
+ }
+
+ output = g_strconcat(output, "}\n", NULL);
+ glatex_insert_string(output, FALSE);
+
+ g_free(output);
+}
Copied: trunk/geany-plugins/geanylatex/src/bibtex.h (from rev 705, trunk/geanylatex/src/bibtex.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/bibtex.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/bibtex.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,91 @@
+ /*
+ * bibtex.h
+ *
+ * Copyright 2008 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#ifndef LATEXBIBTEX_H
+#define LATEXBIBTEX_H
+
+#include "geanylatex.h"
+
+
+/* Define generic stuff */
+enum {
+ ARTICLE = 0,
+ BOOK,
+ BOOKLET,
+ CONFERENCE,
+ INBOOK,
+ INCOLLECTION,
+ INPROCEEDINGS,
+ MANUAL,
+ MASTERSTHESIS,
+ MISC,
+ PHDTHESIS,
+ PROCEEDINGS,
+ TECHREPORT,
+ UNPUBLISHED,
+ N_TYPES
+};
+
+
+enum {
+ ADDRESS = 0,
+ ANNOTE,
+ AUTHOR,
+ BOOKTITLE,
+ CHAPTER,
+ CROSSREF,
+ EDITION,
+ EDITOR,
+ EPRINT,
+ HOWPUBLISHED,
+ INSTITUTION,
+ JOURNAL,
+ KEY,
+ MONTH,
+ NOTE,
+ NUMBER,
+ ORGANIZATION,
+ PAGES,
+ PUBLISHER,
+ SCHOOL,
+ SERIES,
+ TITLE,
+ TYPE,
+ URL,
+ VOLUME,
+ YEAR,
+ N_ENTRIES
+};
+
+extern gchar *glatex_label_types[];
+
+extern const gchar *glatex_label_tooltips[];
+
+extern const gchar *glatex_label_entry_keywords[];
+
+extern const gchar *glatex_label_entry[];
+
+int glatex_push_bibtex_entry(int style, GeanyDocument *doc);
+
+void glatex_insert_bibtex_entry(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+
+#endif
Copied: trunk/geany-plugins/geanylatex/src/bibtexlabels.c (from rev 705, trunk/geanylatex/src/bibtexlabels.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/bibtexlabels.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/bibtexlabels.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,126 @@
+ /*
+ * bibtexlabels.c
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include "geanylatex.h"
+#include "bibtex.h"
+
+gchar *glatex_label_types[] = {
+ N_("Article"),
+ N_("Book"),
+ N_("Booklet"),
+ N_("Conference"),
+ N_("Inbook"),
+ N_("Incollection"),
+ N_("Inproceedings"),
+ N_("Manual"),
+ N_("Mastersthesis"),
+ N_("Misc"),
+ N_("PhdThesis"),
+ N_("Proceedings"),
+ N_("Techreport"),
+ N_("Unpublished")};
+
+
+const gchar *glatex_label_entry[] = {
+ N_("Address"),
+ N_("Annote"),
+ N_("Author"),
+ N_("Booktitle"),
+ N_("Chapter"),
+ N_("Crossref"),
+ N_("Edition"),
+ N_("Editor"),
+ N_("E-print"),
+ N_("HowPublished"),
+ N_("Institution"),
+ N_("Journal"),
+ N_("Key"),
+ N_("Month"),
+ N_("Note"),
+ N_("Number"),
+ N_("Organization"),
+ N_("Pages"),
+ N_("Publisher"),
+ N_("School"),
+ N_("Series"),
+ N_("Title"),
+ N_("Type"),
+ N_("URL"),
+ N_("Volume"),
+ N_("Year")};
+
+const gchar *glatex_label_entry_keywords[] = {
+ ("Address"),
+ ("Annote"),
+ ("Author"),
+ ("Booktitle"),
+ ("Chapter"),
+ ("Crossref"),
+ ("Edition"),
+ ("Editor"),
+ ("E-print"),
+ ("HowPublished"),
+ ("Institution"),
+ ("Journal"),
+ ("Key"),
+ ("Month"),
+ ("Note"),
+ ("Number"),
+ ("Organization"),
+ ("Pages"),
+ ("Publisher"),
+ ("School"),
+ ("Series"),
+ ("Title"),
+ ("Type"),
+ ("URL"),
+ ("Volume"),
+ ("Year")};
+
+const gchar *glatex_label_tooltips[] = {
+ N_("Address of publisher"),
+ N_("Annotation for annotated bibliography styles"),
+ N_("Name(s) of the author(s), separated by 'and' if more than one"),
+ N_("Title of the book, if only part of it is being cited"),
+ N_("Chapter number"),
+ N_("Citation key of the cross-referenced entry"),
+ N_("Edition of the book (such as \"first\" or \"second\")"),
+ N_("Name(s) of the editor(s), separated by 'and' if more than one"),
+ N_("Specification of electronic publication"),
+ N_("Publishing method if the method is nonstandard"),
+ N_("Institution that was involved in the publishing"),
+ N_("Journal or magazine in which the work was published"),
+ N_("Hidden field used for specifying or overriding the alphabetical order of entries"),
+ N_("Month of publication or creation if unpublished"),
+ N_("Miscellaneous extra information"),
+ N_("Number of journal, magazine, or tech-report"),
+ N_("Sponsor of the conference"),
+ N_("Page numbers separated by commas or double-hyphens"),
+ N_("Name of publisher"),
+ N_("School where thesis was written"),
+ N_("Series of books in which the book was published"),
+ N_("Title of the work"),
+ N_("Type of technical report"),
+ N_("Internet address"),
+ N_("Number of the volume"),
+ N_("Year of publication or creation if unpublished")};
+
+
Copied: trunk/geany-plugins/geanylatex/src/datatypes.h (from rev 705, trunk/geanylatex/src/datatypes.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/datatypes.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/datatypes.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,40 @@
+/*
+ * datatypes.h
+ *
+ * Copyright 2008 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#ifndef DATATYPES_H
+#define DATATYPES_H
+
+typedef struct
+{
+ gint cat;
+ gchar *label;
+ gchar *latex;
+} SubMenuTemplate;
+
+
+typedef struct
+{
+ gint cat;
+ gchar *label;
+ gboolean sorted;
+} CategoryName;
+
+#endif
Copied: trunk/geany-plugins/geanylatex/src/formatpatterns.c (from rev 705, trunk/geanylatex/src/formatpatterns.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/formatpatterns.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/formatpatterns.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,48 @@
+/*
+ * formatpatterns.c
+ *
+ * Copyright 2009 Frank Lanitz <frank@Jupiter>
+ *
+ * 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.
+ */
+
+#include "geanylatex.h"
+
+gchar* glatex_format_pattern[] = {
+ "\\textit",
+ "\\textbf",
+ "\\underline",
+ "\\textsl",
+ "\\texttt",
+ "\\textsc",
+ "\\emph",
+ "\\centering",
+ "\\raggedleft",
+ "\\raggedright",
+};
+
+const gchar *glatex_format_labels[] = {
+ N_("Italic"),
+ N_("Boldfont"),
+ N_("Underline"),
+ N_("Slanted"),
+ N_("Typewriter"),
+ N_("Small Caps"),
+ N_("Emphasis"),
+ N_("Centered"),
+ N_("Left side oriented"),
+ N_("Right side oriented")
+};
Copied: trunk/geany-plugins/geanylatex/src/formatutils.c (from rev 705, trunk/geanylatex/src/formatutils.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/formatutils.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/formatutils.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,58 @@
+/*
+ * formatutils.c
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include "formatutils.h"
+
+
+void glatex_insert_latex_format(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ gint format = GPOINTER_TO_INT(gdata);
+ GeanyDocument *doc = NULL;
+ doc = document_get_current();
+
+ if (doc != NULL)
+ {
+ if (sci_has_selection(doc->editor->sci))
+ {
+ gchar *selection;
+ const gchar *replacement = NULL;
+
+ selection = sci_get_selection_contents(doc->editor->sci);
+
+ replacement = g_strconcat(glatex_format_pattern[format],"{",
+ selection, "}", NULL);
+
+ sci_replace_sel(doc->editor->sci, replacement);
+ g_free(selection);
+ }
+ else
+ {
+ sci_start_undo_action(doc->editor->sci);
+ glatex_insert_string(glatex_format_pattern[format], TRUE);
+ glatex_insert_string("{", TRUE);
+ glatex_insert_string("}", FALSE);
+ sci_end_undo_action(doc->editor->sci);
+ }
+ }
+}
+
+
Copied: trunk/geany-plugins/geanylatex/src/formatutils.h (from rev 705, trunk/geanylatex/src/formatutils.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/formatutils.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/formatutils.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,45 @@
+/*
+ * formatutils.h
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#ifndef LATEXFORMATUTILS_H
+#define LATEXFORMATUTILS_H
+
+#include "geanylatex.h"
+
+enum {
+ LATEX_ITALIC = 0,
+ LATEX_BOLD,
+ LATEX_UNDERLINE,
+ LATEX_SLANTED,
+ LATEX_TYPEWRITER,
+ LATEX_SMALLCAPS,
+ LATEX_EMPHASIS,
+ LATEX_CENTER,
+ LATEX_LEFT,
+ LATEX_RIGHT,
+ LATEX_STYLES_END
+};
+
+extern gchar* glatex_format_pattern[];
+extern const gchar *glatex_format_labels[];
+void glatex_insert_latex_format(GtkMenuItem * menuitem, gpointer gdata);
+
+#endif
Copied: trunk/geany-plugins/geanylatex/src/geanylatex.c (from rev 705, trunk/geanylatex/src/geanylatex.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/geanylatex.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/geanylatex.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,1309 @@
+/*
+ * geanylatex.c - Plugin to let Geany better work together with LaTeX
+ *
+ * Copyright 2007-2009 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+ * For long list of friendly supporters please have a look at THANKS.
+ *
+ * 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.
+ */
+
+/* LaTeX plugin */
+/* This plugin improves the work with LaTeX and Geany.*/
+
+#include "geanylatex.h"
+
+PLUGIN_VERSION_CHECK(136)
+
+PLUGIN_SET_INFO(_("LaTeX"), _("Plugin to provide better LaTeX support"),
+ VERSION,"Frank Lanitz <frank(a)frank.uvena.de>")
+
+GeanyPlugin *geany_plugin;
+GeanyData *geany_data;
+GeanyFunctions *geany_functions;
+
+
+static GtkWidget *menu_latex = NULL;
+static GtkWidget *menu_latex_menu = NULL;
+static GtkWidget *menu_latex_wizzard = NULL;
+static GtkWidget *menu_latex_menu_special_char = NULL;
+static GtkWidget *menu_latex_menu_special_char_submenu = NULL;
+static GtkWidget *menu_latex_ref = NULL;
+static GtkWidget *menu_latex_label = NULL;
+static GtkWidget *menu_latex_bibtex = NULL;
+static GtkWidget *menu_latex_bibtex_submenu = NULL;
+static GtkWidget *menu_latex_format_insert = NULL;
+static GtkWidget *menu_latex_format_insert_submenu = NULL;
+static GtkWidget *menu_latex_insert_environment = NULL;
+static GtkWidget *menu_latex_replacement = NULL;
+static GtkWidget *menu_latex_replacement_submenu = NULL;
+static GtkWidget *menu_latex_replace_selection = NULL;
+static GtkWidget *menu_latex_replace_toggle = NULL;
+
+/* Options for plugin */
+static gboolean glatex_set_koma_active = FALSE;
+static gboolean glatex_set_toolbar_active = FALSE;
+
+/* Function will be deactivated, when only loaded */
+static gboolean toggle_active = FALSE;
+
+static GtkWidget *main_menu_item = NULL;
+
+static GtkUIManager *uim;
+static GtkActionGroup *group;
+static GtkWidget *glatex_toolbar = NULL;
+static GtkWidget *box = NULL;
+
+/* Configuration file */
+static gchar *config_file = NULL;
+
+/* Doing some basic keybinding stuff */
+enum
+{
+ KB_LATEX_WIZZARD,
+ KB_LATEX_INSERT_LABEL,
+ KB_LATEX_INSERT_REF,
+ KB_LATEX_INSERT_NEWLINE,
+ KB_LATEX_TOGGLE_ACTIVE,
+ KB_LATEX_ENVIRONMENT_INSERT,
+ KB_LATEX_INSERT_NEWITEM,
+ KB_LATEX_REPLACE_SPECIAL_CHARS,
+ KB_LATEX_FORMAT_BOLD,
+ KB_LATEX_FORMAT_ITALIC,
+ KB_LATEX_FORMAT_TYPEWRITER,
+ KB_LATEX_FORMAT_CENTER,
+ KB_LATEX_FORMAT_LEFT,
+ KB_LATEX_FORMAT_RIGHT,
+ COUNT_KB
+};
+
+PLUGIN_KEY_GROUP(geanylatex, COUNT_KB)
+
+const GtkActionEntry format_icons[] =
+{
+ { "Italic", GTK_STOCK_ITALIC, NULL, NULL, N_("Marks selected text as italic"), G_CALLBACK(glatex_kb_format_bold) },
+ { "Bold", GTK_STOCK_BOLD, NULL, NULL, N_("Marks selected text as bold"), G_CALLBACK(glatex_kb_format_bold) },
+ { "Underline", GTK_STOCK_UNDERLINE, NULL, NULL, N_("Underlines selected text"), G_CALLBACK(glatex_kb_format_bold) },
+ { "Centered", GTK_STOCK_JUSTIFY_CENTER, NULL, NULL, NULL, G_CALLBACK(glatex_kb_format_centering) },
+ { "Left", GTK_STOCK_JUSTIFY_LEFT, NULL, NULL, NULL, G_CALLBACK(glatex_kb_format_left) },
+ { "Right", GTK_STOCK_JUSTIFY_RIGHT, NULL, NULL, NULL, G_CALLBACK(glatex_kb_format_right) },
+};
+
+const guint ui_entries_n = G_N_ELEMENTS(format_icons);
+
+
+/* fallback UI definition */
+const gchar *toolbar_markup =
+"<ui>"
+ "<toolbar name='glatex_format_toolbar'>"
+ "<toolitem action='Italic'/>"
+ "<toolitem action='Bold'/>"
+ "<toolitem action='Underline'/>"
+ "<separator/>"
+ "<toolitem action='Centered' />"
+ "<toolitem action='Left' />"
+ "<toolitem action='Right'/>"
+ "</toolbar>"
+"</ui>";
+
+static struct
+{
+ GtkWidget *koma_active;
+ GtkWidget *toolbar_active;
+}
+config_widgets;
+
+
+static GtkWidget *init_toolbar()
+{
+ GtkWidget *toolbar = NULL;
+
+ box = ui_lookup_widget(geany->main_widgets->window, "vbox1");
+ uim = gtk_ui_manager_new();
+ group = gtk_action_group_new("glatex_format_toolbar");
+ gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions(group, format_icons, ui_entries_n, NULL);
+ gtk_ui_manager_insert_action_group(uim, group, 0);
+ if (gtk_ui_manager_add_ui_from_string(uim, toolbar_markup, -1, NULL) > 0)
+ {
+ toolbar = gtk_ui_manager_get_widget(uim, "/ui/glatex_format_toolbar");
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(toolbar), FALSE, TRUE, 0);
+ gtk_box_reorder_child(GTK_BOX(box), toolbar, 2);
+ ui_add_document_sensitive(toolbar);
+ }
+ /* TODO maybe more error handling */
+
+ return toolbar;
+}
+
+
+static void
+on_configure_response(G_GNUC_UNUSED GtkDialog *dialog, gint response,
+ G_GNUC_UNUSED gpointer user_data)
+{
+ if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
+ {
+ GKeyFile *config = g_key_file_new();
+ gchar *data;
+ gchar *config_dir = g_path_get_dirname(config_file);
+
+ config_file = g_strconcat(geany->app->configdir,
+ G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
+ "geanyLaTeX", G_DIR_SEPARATOR_S, "general.conf", NULL);
+ glatex_set_koma_active =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(config_widgets.koma_active));
+ glatex_set_toolbar_active =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(config_widgets.toolbar_active));
+
+ /* write stuff to file */
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+
+ g_key_file_set_boolean(config, "general", "glatex_set_koma_active",
+ glatex_set_koma_active);
+ g_key_file_set_boolean(config, "general", "glatex_set_toolbar_active",
+ glatex_set_toolbar_active);
+
+ if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR)
+ && utils_mkdir(config_dir, TRUE) != 0)
+ {
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR,
+ _("Plugin configuration directory could not be created."));
+ }
+ else
+ {
+ /* write config to file */
+ data = g_key_file_to_data(config, NULL, NULL);
+ utils_write_file(config_file, data);
+ g_free(data);
+ }
+
+ g_free(config_dir);
+ g_key_file_free(config);
+
+ /* Apply changes to Geany */
+ /* Add toolbar if requested */
+ if (glatex_set_toolbar_active == TRUE)
+ {
+ if (glatex_toolbar == NULL)
+ {
+ glatex_toolbar = init_toolbar();
+ }
+ else
+ {
+ gtk_widget_show(glatex_toolbar);
+ }
+ }
+ /* Hide toolbar */
+ else if (glatex_set_toolbar_active == FALSE && glatex_toolbar != NULL)
+ {
+ gtk_widget_hide(glatex_toolbar);
+ }
+ }
+}
+
+GtkWidget *
+plugin_configure(GtkDialog * dialog)
+{
+ GtkWidget *vbox;
+
+ vbox = gtk_vbox_new(FALSE, 6);
+
+ config_widgets.koma_active = gtk_check_button_new_with_label(
+ _("Use KOMA script by default"));
+ config_widgets.toolbar_active = gtk_check_button_new_with_label(
+ _("Show extra plugin toolbar"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(config_widgets.koma_active),
+ glatex_set_koma_active);
+ gtk_box_pack_start(GTK_BOX(vbox), config_widgets.koma_active, FALSE, FALSE, 2);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(config_widgets.toolbar_active),
+ glatex_set_toolbar_active);
+ gtk_box_pack_start(GTK_BOX(vbox), config_widgets.toolbar_active, FALSE, FALSE, 2);
+
+ gtk_widget_show_all(vbox);
+ g_signal_connect(dialog, "response", G_CALLBACK(on_configure_response), NULL);
+ return vbox;
+}
+
+/* Functions to toggle the status of plugin */
+void glatex_set_latextoggle_status(gboolean new_status)
+{
+ /* No more function at the moment.*/
+ if (toggle_active != new_status)
+ toggle_active = new_status;
+}
+
+void glatex_toggle_status(G_GNUC_UNUSED GtkMenuItem * menuitem)
+{
+ if (toggle_active == TRUE)
+ glatex_set_latextoggle_status(FALSE);
+ else
+ glatex_set_latextoggle_status(TRUE);
+}
+
+
+static gboolean ht_editor_notify_cb(G_GNUC_UNUSED GObject *object, GeanyEditor *editor,
+ SCNotification *nt, G_GNUC_UNUSED gpointer data)
+{
+ g_return_val_if_fail(editor != NULL, FALSE);
+
+ if (toggle_active != TRUE)
+ return FALSE;
+
+ if (nt->nmhdr.code == SCN_CHARADDED)
+ {
+ gchar buf[7];
+ gint len;
+
+ len = g_unichar_to_utf8(nt->ch, buf);
+ if (len > 0)
+ {
+ const gchar *entity;
+
+ buf[len] = '\0';
+ entity = glatex_get_entity(buf);
+
+ if (entity != NULL)
+ {
+ gint pos = sci_get_current_position(editor->sci);
+
+ sci_set_selection_start(editor->sci, pos - len);
+ sci_set_selection_end(editor->sci, pos);
+
+ sci_replace_sel(editor->sci, entity);
+ }
+ }
+ }
+ return FALSE;
+}
+
+
+void glatex_replace_special_character()
+{
+ GeanyDocument *doc = NULL;
+ doc = document_get_current();
+
+ if (doc != NULL && sci_has_selection(doc->editor->sci))
+ {
+ guint selection_len;
+ gchar *selection = NULL;
+ GString *replacement = g_string_new(NULL);
+ guint i;
+ gchar *new = NULL;
+ const gchar *entity = NULL;
+ gchar buf[7];
+ gint len;
+
+ selection = sci_get_selection_contents(doc->editor->sci);
+
+ selection_len = strlen(selection);
+
+ for (i = 0; i < selection_len; i++)
+ {
+ len = g_unichar_to_utf8(g_utf8_get_char(selection + i), buf);
+ i = len - 1 + i;
+ buf[len] = '\0';
+ entity = glatex_get_entity(buf);
+
+ if (entity != NULL)
+ {
+ replacement = g_string_append(replacement, entity);
+ }
+ else
+ {
+ replacement = g_string_append(replacement, buf);
+ }
+ }
+ new = g_string_free(replacement, FALSE);
+ sci_replace_sel(doc->editor->sci, new);
+ g_free(selection);
+ g_free(new);
+ }
+}
+
+/* Called when keys were pressed */
+void glatex_kblatex_toggle(G_GNUC_UNUSED guint key_id)
+{
+ if (toggle_active == TRUE)
+ glatex_set_latextoggle_status(FALSE);
+ else
+ glatex_set_latextoggle_status(TRUE);
+}
+
+
+PluginCallback plugin_callbacks[] =
+{
+ { "editor-notify", (GCallback) &ht_editor_notify_cb, FALSE, NULL },
+ { NULL, NULL, FALSE, NULL }
+};
+
+void
+glatex_insert_string(gchar *string, gboolean reset_position)
+{
+ GeanyDocument *doc = NULL;
+
+ doc = document_get_current();
+
+ if (doc != NULL && string != NULL)
+ {
+ gint pos = sci_get_current_position(doc->editor->sci);
+ sci_insert_text(doc->editor->sci, pos, string);
+ if (reset_position == TRUE)
+ {
+ gint len = strlen(string);
+ sci_set_current_position(doc->editor->sci, pos + len, TRUE);
+ }
+ }
+}
+
+
+inline gchar*
+get_latex_command(gint tab_index)
+{
+ return glatex_char_array[tab_index].latex;
+}
+
+
+static void
+char_insert_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ glatex_insert_string(get_latex_command(GPOINTER_TO_INT(gdata)), TRUE);
+}
+
+
+void
+glatex_insert_label_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ GtkWidget *dialog = NULL;
+ GtkWidget *vbox = NULL;
+ GtkWidget *label = NULL;
+ GtkWidget *textbox_label = NULL;
+ GtkWidget *table = NULL;
+
+ dialog = gtk_dialog_new_with_buttons(_("Insert Label"),
+ GTK_WINDOW(geany->main_widgets->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+ vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
+ gtk_widget_set_name(dialog, "GeanyDialog");
+ gtk_box_set_spacing(GTK_BOX(vbox), 10);
+
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 6);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+
+ label = gtk_label_new(_("Label name:"));
+ textbox_label = gtk_entry_new();
+
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
+ gtk_table_attach_defaults(GTK_TABLE(table), textbox_label, 1, 2, 0, 1);
+ gtk_container_add(GTK_CONTAINER(vbox), table);
+
+ gtk_widget_show_all(vbox);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ gchar *label_str = NULL;
+ label_str = g_strconcat("\\label{",g_strdup(gtk_entry_get_text(
+ GTK_ENTRY(textbox_label))), "}", NULL);
+ glatex_insert_string(label_str, TRUE);
+ }
+
+ gtk_widget_destroy(dialog);
+}
+
+
+void
+glatex_insert_ref_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ GtkWidget *dialog;
+ GtkWidget *vbox = NULL;
+ GtkWidget *label_ref = NULL;
+ GtkWidget *textbox_ref = NULL;
+ GtkWidget *table = NULL;
+ GtkWidget *radio1 = NULL;
+ GtkWidget *radio2 = NULL;
+ GtkTreeModel *model = NULL;
+
+
+ dialog = gtk_dialog_new_with_buttons(_("Insert Reference"),
+ GTK_WINDOW(geany->main_widgets->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+ vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
+ gtk_widget_set_name(dialog, "GeanyDialog");
+ gtk_box_set_spacing(GTK_BOX(vbox), 10);
+
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 6);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+
+ label_ref = gtk_label_new(_("Reference name:"));
+ textbox_ref = gtk_combo_box_entry_new_text();
+ glatex_add_Labels(textbox_ref, glatex_get_aux_file());
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(textbox_ref));
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model),
+ 0, GTK_SORT_ASCENDING);
+
+ gtk_misc_set_alignment(GTK_MISC(label_ref), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_ref, 0, 1, 0, 1);
+ gtk_table_attach_defaults(GTK_TABLE(table), textbox_ref, 1, 2, 0, 1);
+ gtk_container_add(GTK_CONTAINER(vbox), table);
+
+ radio1 = gtk_radio_button_new_with_mnemonic(NULL,
+ _("_Standard Reference"));
+ gtk_button_set_focus_on_click(GTK_BUTTON(radio1), FALSE);
+ gtk_container_add(GTK_CONTAINER(vbox), radio1);
+
+ radio2 = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio1),
+ _("_Page Reference"));
+ gtk_button_set_focus_on_click(GTK_BUTTON(radio2), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2), FALSE);
+ gtk_container_add(GTK_CONTAINER(vbox), radio2);
+
+ gtk_widget_show_all(vbox);
+
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ gchar *ref_string = NULL;
+
+ ref_string = g_strdup(gtk_combo_box_get_active_text(
+ GTK_COMBO_BOX(textbox_ref)));
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio2)) == FALSE)
+ {
+ ref_string = g_strconcat("\\ref{", ref_string, "}", NULL);
+ }
+ else
+ {
+ ref_string = g_strconcat("\\pageref{", ref_string, "}", NULL);
+ }
+
+ if (ref_string != NULL)
+ {
+ glatex_insert_string(ref_string, TRUE);
+ g_free(ref_string);
+ }
+ }
+
+ gtk_widget_destroy(dialog);
+}
+
+
+void glatex_character_create_menu_item(GtkWidget *menu, const gchar *label,
+ gint letter, MenuCallback callback)
+{
+ GtkWidget *tmp;
+
+ tmp = gtk_menu_item_new_with_label(label);
+ gtk_widget_show(tmp);
+ gtk_container_add(GTK_CONTAINER(menu), tmp);
+ g_signal_connect(tmp, "activate",
+ G_CALLBACK(callback), GINT_TO_POINTER(letter));
+}
+
+
+/* returns -1, if there are more than gint can work with or any other error
+ * returns 0, if categorie is empty
+ * if gint categorie is -1, function will count every element.
+ * Useful, if there is no need for a categorie check.*/
+gint
+glatex_count_menu_entries(SubMenuTemplate *tmp, gint categorie)
+{
+ /* TODO: Reset max value to stop before it's too late */
+ gint i;
+ gint count = 0;
+
+ if (categorie == -1)
+ {
+ for (i =1; tmp[i].label != NULL; i++)
+ {
+ count = count + 1;
+ }
+ }
+ else
+ {
+ for (i = 1; tmp[i].label != NULL; i++)
+ {
+ if (tmp[i].cat == categorie)
+ {
+ count = count + 1;
+ }
+ if (i >= 256)
+ {
+ count = -1;
+ break;
+ }
+ }
+ }
+ return count + 1;
+}
+
+static gint
+count_menu_cat_entries(CategoryName *tmp)
+{
+ gint i;
+
+ for (i = 0; tmp[i].label != NULL; i++);
+ return i;
+}
+
+
+void glatex_sub_menu_init(GtkWidget *base_menu, SubMenuTemplate *menu_template,
+ CategoryName *category_name,
+ MenuCallback callback_function)
+{
+ gint i;
+ gint j;
+ gint categories = count_menu_cat_entries(category_name);
+ GtkWidget *sub_menu = NULL;
+ GtkWidget *sub_menu_cat[categories][2];
+ GtkWidget *active_submenu = NULL;
+
+ /* Creates sub menus based on information from letter.h */
+ for (i = 0; i < categories; i++)
+ {
+ if (glatex_count_menu_entries(menu_template, i) > 0)
+ {
+ create_sub_menu(base_menu, sub_menu_cat[i][0],
+ sub_menu_cat[i][1], category_name[i].label);
+ }
+ }
+
+ /* Searching for all categories */
+ for (i = 0; i < categories; i++)
+ {
+ gboolean split = FALSE;
+ gboolean last_sub_menu = FALSE;
+ gboolean sorted = category_name[i].sorted;
+ /* To check whether we need to build up a new sub sub menu. */
+ gint local_count = 0;
+ gint item_count = glatex_count_menu_entries(menu_template, i);
+
+ if (item_count < 1)
+ continue;
+
+ /* Default is, not to split anything to make menu not */
+ /* deeper than realy needed. */
+ if (item_count > MAX_MENU_ENTRIES)
+ {
+ split = TRUE;
+ }
+
+ /* Setting active sub menu to sub menu of category */
+ sub_menu = sub_menu_cat[i][0];
+ active_submenu = sub_menu;
+ /* Finding entries for each category */
+
+ for (j = 0; menu_template[j].latex != NULL; j++)
+ {
+ if (menu_template[j].cat == i)
+ {
+ /* Creates a new sub sub menu if needed */
+ if (split == TRUE && (local_count % MAX_MENU_ENTRIES) == 0)
+ {
+ gint next_split_point = 0;
+ GtkWidget *tmp = NULL;
+ GtkWidget *tmp_item = NULL;
+
+ sub_menu = active_submenu;
+
+ for (next_split_point = 0;
+ next_split_point < MAX_MENU_ENTRIES ; next_split_point ++)
+ {
+ if (menu_template[j+next_split_point].cat != i)
+ {
+ last_sub_menu = TRUE;
+ break;
+ }
+
+ }
+
+ if (sorted == TRUE)
+ {
+ create_sub_menu(sub_menu_cat[i][0], tmp, tmp_item,
+ g_strconcat(menu_template[j].label, " ... ",
+ menu_template[j + next_split_point-1].label, NULL));
+
+ sub_menu = tmp;
+ }
+ else if (sorted == FALSE)
+ {
+ if (last_sub_menu == FALSE)
+ {
+ create_sub_menu(sub_menu, tmp, tmp_item, _("More"));
+ sub_menu = active_submenu;
+ active_submenu = tmp;
+ }
+ }
+ }
+
+ /* Sets the counter to keep in track if a new ,,
+ * submenu needs to be build up */
+ local_count = local_count + 1;
+ glatex_character_create_menu_item(sub_menu, g_strconcat(
+ menu_template[j].label, "\t", menu_template[j].latex,
+ NULL), j, callback_function);
+ }
+ }
+ }
+}
+
+static int
+find_latex_enc(gint l_geany_enc)
+{
+ guint i;
+ for (i = 0; i < LATEX_ENCODINGS_MAX; i++)
+ {
+ if (latex_encodings[i].geany_enc == l_geany_enc)
+ return i;
+ }
+ return LATEX_ENCODING_NONE;
+}
+
+
+static void
+show_output(const gchar * output, const gchar * name, const gint local_enc)
+{
+ GeanyDocument *doc = NULL;
+ GeanyFiletype *ft = filetypes_lookup_by_name("LaTeX");
+
+ if (output)
+ {
+ doc = document_new_file(name, ft, output);
+ document_set_encoding(doc, encodings_get_charset_from_index
+ (latex_encodings[local_enc].geany_enc));
+ }
+}
+
+void
+glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ gint i;
+ GString *code = NULL;
+ gchar *author = NULL;
+ gchar *date = NULL;
+ gchar *output = NULL;
+ gchar *classoptions = NULL;
+ gchar *title = NULL;
+ gchar *enc_latex_char = NULL;
+ gchar *documentclass_str = NULL;
+ gchar *papersize = NULL;
+ gchar *draft = NULL;
+ gchar *fontsize = NULL;
+ gint documentclass_int;
+ gint encoding_int;
+ gint papersize_int;
+ GtkWidget *dialog = NULL;
+ GtkWidget *vbox = NULL;
+ GtkWidget *label_documentclass = NULL;
+ GtkWidget *documentclass_combobox = NULL;
+ GtkWidget *label_encoding = NULL;
+ GtkWidget *encoding_combobox = NULL;
+ GtkWidget *fontsize_combobox = NULL;
+ GtkWidget *label_fontsize = NULL;
+ GtkWidget *table = NULL;
+ GtkWidget *checkbox_KOMA = NULL;
+ GtkWidget *author_textbox = NULL;
+ GtkWidget *label_author = NULL;
+ GtkWidget *date_textbox = NULL;
+ GtkWidget *label_date = NULL;
+ GtkWidget *title_textbox = NULL;
+ GtkWidget *label_title = NULL;
+ GtkWidget *papersize_combobox = NULL;
+ GtkWidget *label_papersize = NULL;
+ GtkWidget *checkbox_draft = NULL;
+ gboolean KOMA_active;
+ gboolean draft_active = FALSE;
+
+ /* Creating and formatting table */
+ table = gtk_table_new(2, 6, FALSE);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 6);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+
+ /* Documentclass */
+ label_documentclass = gtk_label_new(_("Documentclass:"));
+ documentclass_combobox = gtk_combo_box_new_text();
+ ui_widget_set_tooltip_text(documentclass_combobox,
+ _("Choose the kind of document you want to write"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(documentclass_combobox), 0,
+ _("Book"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(documentclass_combobox), 1,
+ _("Article"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(documentclass_combobox), 2,
+ _("Report"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(documentclass_combobox), 3,
+ _("Letter"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(documentclass_combobox), 4,
+ _("Presentation"));
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(documentclass_combobox), 0);
+
+ gtk_misc_set_alignment(GTK_MISC(label_documentclass), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_documentclass, 0, 1, 0, 1);
+ gtk_table_attach_defaults(GTK_TABLE(table), documentclass_combobox, 1, 2, 0, 1);
+
+ /* Encoding */
+ label_encoding = gtk_label_new(_("Encoding:"));
+
+ encoding_combobox = gtk_combo_box_new_text();
+ ui_widget_set_tooltip_text(encoding_combobox,
+ _("Set the encoding for your new document"));
+ for (i = 0; i < LATEX_ENCODINGS_MAX; i++)
+ {
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(encoding_combobox), i,
+ latex_encodings[i].name);
+ }
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combobox), find_latex_enc(geany_data->file_prefs->default_new_encoding));
+
+ gtk_misc_set_alignment(GTK_MISC(label_encoding), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_encoding, 0, 1, 1, 2);
+ gtk_table_attach_defaults(GTK_TABLE(table), encoding_combobox, 1, 2, 1, 2);
+
+ /* fontsize */
+
+ label_fontsize = gtk_label_new(_("Font size:"));
+ fontsize_combobox = gtk_combo_box_entry_new_text();
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fontsize_combobox),"10pt");
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fontsize_combobox),"11pt");
+ gtk_combo_box_append_text(GTK_COMBO_BOX(fontsize_combobox),"12pt");
+ ui_widget_set_tooltip_text(fontsize_combobox,
+ _("Set the default font size of your new document"));
+
+ gtk_misc_set_alignment(GTK_MISC(label_fontsize), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_fontsize, 0, 1, 2, 3);
+ gtk_table_attach_defaults(GTK_TABLE(table), fontsize_combobox, 1, 2, 2, 3);
+
+ /* Author */
+ label_author = gtk_label_new(_("Author:"));
+ author_textbox = gtk_entry_new();
+ ui_widget_set_tooltip_text(author_textbox,
+ _("Sets the value of the \\author command. In most cases this should be your name"));
+ if (geany_data->template_prefs->developer != NULL)
+ {
+ author = geany_data->template_prefs->developer;
+ gtk_entry_set_text(GTK_ENTRY(author_textbox), author);
+ }
+ gtk_misc_set_alignment(GTK_MISC(label_author), 0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label_author, 0, 1, 3, 4);
+ gtk_table_attach_defaults(GTK_TABLE(table), author_textbox, 1, 2, 3, 4);
+
+ /* Date */
+ label_date = gtk_label_new(_("Date:"));
+ date_textbox = gtk_entry_new();
+ ui_widget_set_tooltip_text(date_textbox,
+ _("Sets the value of the \\date command inside header of your\
+ newly created LaTeX-document. Keeping it at \\today is a good \
+ decision if you don't need any fixed date."));
+ gtk_entry_set_text(GTK_ENTRY(date_textbox), "\\today");
+ gtk_misc_set_alignment(GTK_MISC(label_date), 0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label_date, 0, 1, 4, 5);
+ gtk_table_attach_defaults(GTK_TABLE(table), date_textbox, 1, 2, 4, 5);
+
+ /* Title of the new document */
+ label_title = gtk_label_new(_("Title:"));
+ title_textbox = gtk_entry_new();
+ ui_widget_set_tooltip_text(title_textbox,
+ _("Sets the title of your new document."));
+ gtk_misc_set_alignment(GTK_MISC(label_title), 0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label_title, 0, 1, 5, 6);
+ gtk_table_attach_defaults(GTK_TABLE(table), title_textbox, 1, 2, 5, 6);
+
+ /* Papersize */
+ label_papersize = gtk_label_new(_("Paper size:"));
+ papersize_combobox = gtk_combo_box_new_text();
+ ui_widget_set_tooltip_text(papersize_combobox,
+ _("Choose the paper format for the newly created document"));
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(papersize_combobox), 0, "A4");
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(papersize_combobox), 1, "A5");
+ gtk_combo_box_insert_text(GTK_COMBO_BOX(papersize_combobox), 2, "A6");
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(papersize_combobox), 0);
+
+ gtk_misc_set_alignment(GTK_MISC(label_papersize), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_papersize, 0, 1, 6, 7);
+ gtk_table_attach_defaults(GTK_TABLE(table), papersize_combobox, 1, 2, 6, 7);
+
+ gtk_widget_show_all(table);
+
+ /* Building the wizard-dialog and showing it */
+ dialog = gtk_dialog_new_with_buttons(_("LaTeX-Wizard"),
+ GTK_WINDOW(geany->main_widgets->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+ vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
+ gtk_widget_set_name(dialog, "GeanyDialog");
+ gtk_box_set_spacing(GTK_BOX(vbox), 10);
+ gtk_container_add(GTK_CONTAINER(vbox), table);
+
+ checkbox_KOMA = gtk_check_button_new_with_label(
+ _("Use KOMA-script classes if possible"));
+ ui_widget_set_tooltip_text(checkbox_KOMA,
+ _("Uses the KOMA-script classes by Markus Kohm.\n"
+ "Keep in mind: To compile your document these classes"
+ "have to be installed before."));
+ gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_KOMA), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_KOMA), glatex_set_koma_active);
+ gtk_box_pack_start(GTK_BOX(vbox), checkbox_KOMA, FALSE, FALSE, 5);
+
+ checkbox_draft = gtk_check_button_new_with_label(_("Use draft mode"));
+ ui_widget_set_tooltip_text(checkbox_draft,
+ _("Set the draft flag inside new created documents to get "
+ "documents with a number of debugging helpers"));
+ gtk_button_set_focus_on_click(GTK_BUTTON(checkbox_draft), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox_draft), draft_active);
+ gtk_box_pack_start(GTK_BOX(vbox), checkbox_draft, FALSE, FALSE, 5);
+
+ gtk_widget_show_all(vbox);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ KOMA_active = gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(checkbox_KOMA));
+ draft_active = gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(checkbox_draft));
+ documentclass_int = gtk_combo_box_get_active(
+ GTK_COMBO_BOX(documentclass_combobox));
+ encoding_int = gtk_combo_box_get_active(
+ GTK_COMBO_BOX(encoding_combobox));
+ enc_latex_char = g_strconcat("\\usepackage[",
+ latex_encodings[encoding_int].latex,"]{inputenc}\n", NULL);
+ author = g_strdup(gtk_entry_get_text(GTK_ENTRY(author_textbox)));
+ date = g_strdup(gtk_entry_get_text(GTK_ENTRY(date_textbox)));
+ title = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_textbox)));
+ papersize_int = gtk_combo_box_get_active(
+ GTK_COMBO_BOX(papersize_combobox));
+ switch (papersize_int)
+ {
+ case 0:
+ {
+ papersize = g_utf8_casefold("a4paper", -1);
+ break;
+ }
+ case 1:
+ {
+ papersize = g_utf8_casefold("a5paper", -1);
+ break;
+ }
+ case 2:
+ {
+ papersize = g_utf8_casefold("a6paper", -1);
+ break;
+ }
+ }
+
+ fontsize = gtk_combo_box_get_active_text(
+ GTK_COMBO_BOX(fontsize_combobox));
+
+ if (papersize != NULL)
+ {
+ classoptions = g_strdup(papersize);
+ g_free(papersize);
+ }
+ if (classoptions != NULL && draft_active == TRUE)
+ {
+ draft = g_utf8_casefold("draft", -1);
+ classoptions = g_strconcat(classoptions,",", draft, NULL);
+ g_free(draft);
+ }
+ else if (classoptions == NULL && draft_active == TRUE)
+ {
+ draft = g_utf8_casefold("draft", -1);
+ classoptions = g_strconcat(draft, NULL);
+ g_free(draft);
+ }
+ if (classoptions != NULL && NZV(fontsize))
+ {
+ classoptions = g_strconcat(classoptions, ",", fontsize, NULL);
+ }
+ else if (classoptions == NULL && NZV(fontsize))
+ {
+ classoptions = g_strdup(fontsize);
+ }
+ g_free(fontsize);
+
+
+ switch (documentclass_int)
+ {
+ case 0:
+ {
+ documentclass_str = g_utf8_casefold("book", -1);
+ break;
+ }
+ case 1:
+ {
+ documentclass_str = g_utf8_casefold("article", -1);
+ break;
+ }
+ case 2:
+ {
+ documentclass_str = g_utf8_casefold("report", -1);
+ break;
+ }
+ case 3:
+ {
+ documentclass_str = g_utf8_casefold("letter", -1);
+ break;
+ }
+ case 4:
+ {
+ documentclass_str = g_utf8_casefold("beamer", -1);
+ }
+ }
+
+ if (KOMA_active)
+ {
+ switch (documentclass_int)
+ {
+ case 0:
+ {
+ documentclass_str = g_utf8_casefold("scrbook", -1);
+ break;
+ }
+ case 1:
+ {
+ documentclass_str = g_utf8_casefold("scrartcl", -1);
+ break;
+ }
+ case 2:
+ {
+ documentclass_str = g_utf8_casefold("scrreprt", -1);
+ break;
+ }
+ }
+
+ }
+
+ if (documentclass_int == 3)
+ code = g_string_new(TEMPLATE_LATEX_LETTER);
+ else if (documentclass_int == 4)
+ code = g_string_new(TEMPLATE_LATEX_BEAMER);
+ else
+ code = g_string_new(TEMPLATE_LATEX);
+
+ if (classoptions != NULL)
+ {
+ utils_string_replace_all(code, "{CLASSOPTION}", classoptions);
+ g_free(classoptions);
+ }
+ if (documentclass_str != NULL)
+ {
+ utils_string_replace_all(code, "{DOCUMENTCLASS}", documentclass_str);
+ g_free(documentclass_str);
+ }
+ if (enc_latex_char != NULL)
+ {
+ utils_string_replace_all(code, "{ENCODING}", enc_latex_char);
+ g_free(enc_latex_char);
+ }
+ if (author != NULL)
+ {
+ if (author[0] != '\0')
+ {
+ if (documentclass_int == 3)
+ {
+ author = g_strconcat("\\signature{", author, "}\n", NULL);
+ }
+ else
+ {
+ author = g_strconcat("\\author{", author, "}\n", NULL);
+ }
+
+ utils_string_replace_all(code, "{AUTHOR}", author);
+ }
+ else
+ if (documentclass_int == 3)
+ {
+ utils_string_replace_all(code, "{AUTHOR}", "\% \\signature{}\n");
+ }
+ else
+ {
+ utils_string_replace_all(code, "{AUTHOR}", "\% \\author{}\n");
+ }
+
+ g_free(author);
+ }
+ if (date != NULL)
+ {
+ if (date[0] != '\0')
+ {
+ date = g_strconcat("\\date{", date, "}\n", NULL);
+ utils_string_replace_all(code, "{DATE}", date);
+ }
+ else
+ utils_string_replace_all(code, "{DATE}", "\% \\date{}\n");
+ g_free(date);
+ }
+ if (title != NULL)
+ {
+ if (title[0] != '\0')
+ {
+ if (documentclass_int == 3)
+ {
+ title = g_strconcat("\\subject{", title, "}\n", NULL);
+ }
+ else
+ {
+ title = g_strconcat("\\title{", title, "}\n", NULL);
+ }
+
+ utils_string_replace_all(code, "{TITLE}", title);
+ }
+ else
+ if (documentclass_int == 3)
+ {
+ utils_string_replace_all(code, "{TITLE}", "\% \\subject{} \n");
+ }
+ else
+ {
+ utils_string_replace_all(code, "{TITLE}", "\% \\title{} \n");
+ }
+
+ g_free(title);
+ }
+
+ utils_string_replace_all(code, "{OPENING}", _("Dear Sir or Madame"));
+ utils_string_replace_all(code, "{CLOSING}", _("With kind regards"));
+
+ output = g_string_free(code, FALSE);
+ show_output(output, NULL, encoding_int);
+ g_free(output);
+ }
+ gtk_widget_destroy(dialog);
+}
+
+
+void init_keybindings()
+{
+ /* init keybindins */
+ keybindings_set_item(plugin_key_group, KB_LATEX_WIZZARD, glatex_kbwizard,
+ 0, 0, "run_latex_wizard", _("Run LaTeX-Wizard"), menu_latex_wizzard);
+ keybindings_set_item(plugin_key_group, KB_LATEX_INSERT_LABEL, glatex_kblabel_insert,
+ 0, 0, "insert_latex_label", _("Insert \\label"), menu_latex_label);
+ keybindings_set_item(plugin_key_group, KB_LATEX_INSERT_REF, glatex_kbref_insert,
+ 0, 0, "insert_latex_ref", _("Insert \\ref"), menu_latex_ref);
+ keybindings_set_item(plugin_key_group, KB_LATEX_INSERT_NEWLINE, glatex_kb_insert_newline,
+ 0, 0, "insert_new_line", _("Insert linebreak \\\\ "), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_TOGGLE_ACTIVE, glatex_kblatex_toggle,
+ 0, 0, "latex_toggle_status", _("Turn input replacement on/off"),
+ menu_latex_replace_toggle);
+ keybindings_set_item(plugin_key_group, KB_LATEX_REPLACE_SPECIAL_CHARS,
+ glatex_kb_replace_special_chars, 0, 0, "latex_replace_chars",
+ _("Replace special characters"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_ENVIRONMENT_INSERT,
+ glatex_kbref_insert_environment, 0, 0, "latex_insert_environment",
+ _("Run insert environment dialog"), menu_latex_insert_environment);
+ keybindings_set_item(plugin_key_group, KB_LATEX_INSERT_NEWITEM,
+ glatex_kb_insert_newitem, 0, 0, "latex_insert_item", _("Insert \\item"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_BOLD, glatex_kb_format_bold,
+ 0, 0, "format_bold", _("Format selection in bold font face"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_ITALIC, glatex_kb_format_italic,
+ 0, 0, "format_italic", _("Format selection in italic font face"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_TYPEWRITER, glatex_kb_format_typewriter,
+ 0, 0, "format_typewriter", _("Format selection in typewriter font face"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_CENTER, glatex_kb_format_centering,
+ 0, 0, "format_center", _("Format selection centered"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_LEFT, glatex_kb_format_left,
+ 0, 0, "format_left", _("Format selection left-aligned"), NULL);
+ keybindings_set_item(plugin_key_group, KB_LATEX_FORMAT_RIGHT, glatex_kb_format_right,
+ 0, 0, "format_right", _("Format selection right-aligned "), NULL);
+}
+
+void plugin_help()
+{
+ dialogs_show_msgbox(GTK_MESSAGE_INFO,
+ _("GeanyLaTeX is a plugin to improve support for LaTeX in Geany."
+ "\n\nPlease report all bugs or feature requests to one of the "
+ "authors."));
+}
+
+void
+plugin_init(G_GNUC_UNUSED GeanyData * data)
+{
+ GtkWidget *tmp = NULL;
+ GKeyFile *config = g_key_file_new();
+ gint i;
+
+ /* loading configurations from file ...*/
+ config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S,
+ "plugins", G_DIR_SEPARATOR_S,
+ "geanyLaTeX", G_DIR_SEPARATOR_S, "general.conf", NULL);
+
+ /* ... and Initialising options from config file */
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+
+ glatex_set_koma_active = utils_get_setting_boolean(config, "general",
+ "glatex_set_koma_active", FALSE);
+
+ glatex_set_toolbar_active = utils_get_setting_boolean(config, "general",
+ "glatex_set_toolbar_active", FALSE);
+
+ main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
+
+ g_key_file_free(config);
+
+
+ glatex_init_encodings_latex();
+
+ menu_latex = gtk_menu_item_new_with_mnemonic(_("_LaTeX"));
+ gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_latex);
+
+ menu_latex_menu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex), menu_latex_menu);
+
+ menu_latex_wizzard = ui_image_menu_item_new(GTK_STOCK_NEW, _("LaTeX-_Wizard"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_wizzard);
+ ui_widget_set_tooltip_text(menu_latex_wizzard,
+ _("Starts a Wizard to easily create LaTeX-documents"));
+
+ g_signal_connect(menu_latex_wizzard, "activate",
+ G_CALLBACK(glatex_wizard_activated), NULL);
+
+ menu_latex_menu_special_char = gtk_menu_item_new_with_mnemonic(_("Insert _Special Character"));
+ ui_widget_set_tooltip_text(menu_latex_menu_special_char,
+ _("Helps to use some not very common letters and signs"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu),
+ menu_latex_menu_special_char);
+
+ menu_latex_menu_special_char_submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex_menu_special_char),
+ menu_latex_menu_special_char_submenu);
+ glatex_sub_menu_init(menu_latex_menu_special_char_submenu, glatex_char_array, glatex_cat_names,
+ char_insert_activated);
+
+ menu_latex_ref = gtk_menu_item_new_with_mnemonic(_("Insert _Reference"));
+ ui_widget_set_tooltip_text(menu_latex_ref,
+ _("Inserting references to the document"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_ref);
+ g_signal_connect(menu_latex_ref, "activate",
+ G_CALLBACK(glatex_insert_ref_activated), NULL);
+
+ menu_latex_label = gtk_menu_item_new_with_mnemonic(_("Insert _Label"));
+ ui_widget_set_tooltip_text(menu_latex_label,
+ _("Helps at inserting labels to a document"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_label);
+ g_signal_connect(menu_latex_label, "activate",
+ G_CALLBACK(glatex_insert_label_activated), NULL);
+
+ menu_latex_insert_environment = gtk_menu_item_new_with_mnemonic(
+ _("Insert _Environment"));
+ ui_widget_set_tooltip_text(menu_latex_insert_environment,
+ _("Helps at inserting an environment a document"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_insert_environment);
+ g_signal_connect(menu_latex_insert_environment, "activate",
+ G_CALLBACK(glatex_insert_environment_dialog), NULL);
+
+ menu_latex_bibtex = gtk_menu_item_new_with_mnemonic(_("_BibTeX"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_bibtex);
+
+ menu_latex_bibtex_submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex_bibtex),
+ menu_latex_bibtex_submenu);
+
+ for (i = 0; i < N_TYPES; i++)
+ {
+ tmp = NULL;
+ tmp = gtk_menu_item_new_with_mnemonic(_(glatex_label_types[i]));
+ gtk_container_add(GTK_CONTAINER(menu_latex_bibtex_submenu), tmp);
+ g_signal_connect(tmp, "activate",
+ G_CALLBACK(glatex_insert_bibtex_entry), GINT_TO_POINTER(i));
+ }
+
+ menu_latex_format_insert = gtk_menu_item_new_with_mnemonic(_("_Format"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_format_insert);
+
+ menu_latex_format_insert_submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex_format_insert),
+ menu_latex_format_insert_submenu);
+
+ for (i = 0; i < LATEX_STYLES_END; i++)
+ {
+ tmp = NULL;
+ tmp = gtk_menu_item_new_with_mnemonic(_(glatex_format_labels[i]));
+ gtk_container_add(GTK_CONTAINER(menu_latex_format_insert_submenu), tmp);
+ g_signal_connect(tmp, "activate",
+ G_CALLBACK(glatex_insert_latex_format), GINT_TO_POINTER(i));
+ }
+
+ /* Add menuitem for LaTeX replacement functions*/
+ menu_latex_replacement = gtk_menu_item_new_with_mnemonic(
+ _("_Special Character Replacement"));
+ menu_latex_replacement_submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_latex_replacement),
+ menu_latex_replacement_submenu);
+ gtk_container_add(GTK_CONTAINER(menu_latex_menu), menu_latex_replacement);
+
+ /* Add menuitem for bulk replacment */
+ menu_latex_replace_selection = gtk_menu_item_new_with_mnemonic(
+ _("Bulk _Replace Special Characters"));
+ ui_widget_set_tooltip_text(menu_latex_replace_selection,
+ _("_Replace selected special cahracters with TeX substitutes"));
+ gtk_container_add(GTK_CONTAINER(menu_latex_replacement_submenu),
+ menu_latex_replace_selection);
+ g_signal_connect(menu_latex_replace_selection, "activate",
+ G_CALLBACK(glatex_replace_special_character), NULL);
+
+ /* Add menu entry for toggling input replacment */
+ menu_latex_replace_toggle = gtk_check_menu_item_new_with_mnemonic(
+ _("Toggle _Special Character Replacement"));
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_latex_replace_toggle),
+ toggle_active);
+ gtk_container_add(GTK_CONTAINER(menu_latex_replacement_submenu),
+ menu_latex_replace_toggle);
+
+ g_signal_connect(menu_latex_replace_toggle, "activate",
+ G_CALLBACK(glatex_toggle_status), NULL);
+
+ init_keybindings();
+ if (glatex_set_toolbar_active == TRUE)
+ glatex_toolbar = init_toolbar();
+ else
+ glatex_toolbar = NULL;
+
+ ui_add_document_sensitive(menu_latex_menu_special_char);
+ ui_add_document_sensitive(menu_latex_ref);
+ ui_add_document_sensitive(menu_latex_label);
+ ui_add_document_sensitive(menu_latex_bibtex);
+ ui_add_document_sensitive(menu_latex_format_insert);
+ ui_add_document_sensitive(menu_latex_insert_environment);
+ ui_add_document_sensitive(menu_latex_replacement);
+
+ gtk_widget_show_all(menu_latex);
+ main_menu_item = menu_latex;
+}
+
+void
+plugin_cleanup()
+{
+ gtk_widget_destroy(main_menu_item);
+ if (glatex_toolbar != NULL)
+ gtk_widget_destroy(glatex_toolbar);
+
+ g_free(config_file);
+}
Copied: trunk/geany-plugins/geanylatex/src/geanylatex.h (from rev 705, trunk/geanylatex/src/geanylatex.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/geanylatex.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/geanylatex.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,124 @@
+ /*
+ * geanylatex.h
+ *
+ * Copyright 2008-2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+/* LaTeX plugin */
+/* This plugin improves the work with LaTeX and Geany.*/
+
+#ifndef GEANYLATEX_H
+#define GEANYLATEX_H
+
+
+#include "geany.h"
+#include "support.h"
+#include "document.h"
+#include "editor.h"
+#include "filetypes.h"
+#include "templates.h"
+#include "dialogs.h"
+#include "utils.h"
+#include "ui_utils.h"
+#include "keybindings.h"
+#include "prefs.h"
+#include "datatypes.h"
+#include "letters.h"
+#include "latexencodings.h"
+#include "bibtex.h"
+#include "latexutils.h"
+#include "reftex.h"
+#include "latexenvironments.h"
+#include "formatutils.h"
+#include "latexkeybindings.h"
+#include "Scintilla.h"
+#include "plugindata.h"
+#include "geanyfunctions.h"
+
+
+#include <gtk/gtk.h>
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#include <string.h>
+typedef void (*MenuCallback) (G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata);
+
+
+extern GeanyPlugin *geany_plugin;
+extern GeanyData *geany_data;
+extern GeanyFunctions *geany_functions;
+
+
+#define TEMPLATE_LATEX "\
+\\documentclass[{CLASSOPTION}]{{DOCUMENTCLASS}}\n\
+{ENCODING}\
+{TITLE}\
+{AUTHOR}\
+{DATE}\
+\\begin{document}\n\
+\n\
+\\end{document}\n"
+
+#define TEMPLATE_LATEX_LETTER "\
+\\documentclass[{CLASSOPTION}]{{DOCUMENTCLASS}}\n\
+{ENCODING}\
+\\address{}\n\
+{DATE}\
+{TITLE}\
+{AUTHOR}\
+\\begin{document}\n\
+\\begin{letter}{}\n\
+\\opening{{OPENING}}\n\n\
+\\closing{{CLOSING}}\n\
+\\end{letter}\n\
+\\end{document}\n"
+
+#define TEMPLATE_LATEX_BEAMER "\
+\\documentclass[]{{DOCUMENTCLASS}}\n\
+\\usetheme{default}\n\
+{ENCODING}\
+{TITLE}\
+{AUTHOR}\
+{DATE}\
+\\begin{document}\n\
+\\frame{\\titlepage}\n\
+\\begin{frame}\n\
+\\end{frame}\n\
+\\end{document}\n"
+
+#define create_sub_menu(base_menu, menu, item, title) \
+ (menu) = gtk_menu_new(); \
+ (item) = gtk_menu_item_new_with_mnemonic(_(title)); \
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM((item)), (menu)); \
+ gtk_container_add(GTK_CONTAINER(base_menu), (item)); \
+ gtk_widget_show((item));
+
+#define MAX_MENU_ENTRIES 20
+
+extern void glatex_insert_string(gchar *string, gboolean reset_position);
+gint glatex_count_menu_entries(SubMenuTemplate *tmp, gint categorie);
+void glatex_wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+void glatex_insert_label_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+void glatex_insert_ref_activated(G_GNUC_UNUSED GtkMenuItem * menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+void glatex_replace_special_character();
+#endif
Copied: trunk/geany-plugins/geanylatex/src/latexencodings.c (from rev 705, trunk/geanylatex/src/latexencodings.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/latexencodings.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/latexencodings.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,59 @@
+/*
+ * latexencodings.h
+ *
+ * Copyright 2008 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include <gtk/gtk.h>
+#include "support.h"
+#include "encodings.h"
+#include "latexencodings.h"
+
+LaTeXEncodings latex_encodings[LATEX_ENCODINGS_MAX];
+
+#define fill(Charset, Name, LaTeX, GeanyEnc) \
+ latex_encodings[Charset].charset = Charset; \
+ latex_encodings[Charset].name = Name; \
+ latex_encodings[Charset].latex = LaTeX; \
+ latex_encodings[Charset].geany_enc = GeanyEnc;
+
+void glatex_init_encodings_latex(void)
+{
+ fill(LATEX_ENCODING_UTF_8, _("UTF-8"), "utf8", GEANY_ENCODING_UTF_8);
+ fill(LATEX_ENCODING_ASCII, _("US-ASCII"), "ascii", GEANY_ENCODING_ISO_8859_1);
+ fill(LATEX_ENCODING_ISO_8859_1, _("ISO-8859-1 (Latin-1)"), "latin1",
+ GEANY_ENCODING_ISO_8859_1);
+ fill(LATEX_ENCODING_ISO_8859_2, _("ISO-8859-2 (Latin-2)"), "latin2",
+ GEANY_ENCODING_ISO_8859_2);
+ fill(LATEX_ENCODING_ISO_8859_3, _("ISO-8859-3 (Latin-3)"), "latin3",
+ GEANY_ENCODING_ISO_8859_3);
+ fill(LATEX_ENCODING_ISO_8859_4, _("ISO-8859-4 (Latin-4)"), "latin4",
+ GEANY_ENCODING_ISO_8859_4);
+ fill(LATEX_ENCODING_ISO_8859_5, _("ISO-8859-5 (Latin-5)"), "latin5",
+ GEANY_ENCODING_ISO_8859_5);
+ fill(LATEX_ENCODING_ISO_8859_9, _("ISO-8859-9 (Latin-9)"), "latin9",
+ GEANY_ENCODING_ISO_8859_9);
+ fill(LATEX_ENCODING_ISO_8859_10, _("ISO-8859-10 (Latin-10)"), "latin10",
+ GEANY_ENCODING_ISO_8859_10);
+ fill(LATEX_ENCODING_IBM_850, _("IBM 850 code page"), "cp850",
+ GEANY_ENCODING_IBM_850);
+ fill(LATEX_ENCODING_IBM_852, _("IBM 852 code page"), "cp852",
+ GEANY_ENCODING_IBM_852);
+ fill(LATEX_ENCODING_NONE, _("Misc"), NULL,
+ GEANY_ENCODING_NONE);
+}
Copied: trunk/geany-plugins/geanylatex/src/latexencodings.h (from rev 705, trunk/geanylatex/src/latexencodings.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/latexencodings.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/latexencodings.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,56 @@
+/*
+ * latexencodings.h
+ *
+ * Copyright 2008 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#ifndef LATEXEXCODINGS_H
+#define LATEXEXCODINGS_H
+
+
+typedef enum
+{
+ LATEX_ENCODING_UTF_8 = 0,
+ LATEX_ENCODING_ASCII,
+ LATEX_ENCODING_ISO_8859_1,
+ LATEX_ENCODING_ISO_8859_2,
+ LATEX_ENCODING_ISO_8859_3,
+ LATEX_ENCODING_ISO_8859_4,
+ LATEX_ENCODING_ISO_8859_5,
+ LATEX_ENCODING_ISO_8859_9,
+ LATEX_ENCODING_ISO_8859_10,
+ LATEX_ENCODING_IBM_850,
+ LATEX_ENCODING_IBM_852,
+ LATEX_ENCODING_NONE,
+ LATEX_ENCODINGS_MAX
+} LaTeXEncodingIndex;
+
+
+typedef struct
+{
+ LaTeXEncodingIndex charset;
+ gchar *name;
+ gchar *latex;
+ gint geany_enc;
+} LaTeXEncodings;
+
+extern LaTeXEncodings latex_encodings[LATEX_ENCODINGS_MAX];
+
+void glatex_init_encodings_latex(void);
+
+#endif
Copied: trunk/geany-plugins/geanylatex/src/latexenvironments.c (from rev 705, trunk/geanylatex/src/latexenvironments.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/latexenvironments.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/latexenvironments.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,168 @@
+/*
+ * latexenvironments.c
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include "latexenvironments.h"
+
+CategoryName glatex_environment_cat_names[] = {
+ { ENVIRONMENT_CAT_DUMMY, N_("Environments"), TRUE},
+ { ENVIRONMENT_CAT_FORMAT, N_("Formating"), TRUE},
+ { ENVIRONMENT_CAT_STRUCTURE, N_("Document Structure"), TRUE},
+ { ENVIRONMENT_CAT_LISTS, N_("Lists"), TRUE},
+ { ENVIRONMENT_CAT_MATH, N_("Math"), TRUE},
+ { 0, NULL, FALSE}
+};
+
+
+SubMenuTemplate glatex_environment_array[] = {
+ /* General document structure environments */
+ {ENVIRONMENT_CAT_STRUCTURE, "block", "block"},
+ {ENVIRONMENT_CAT_STRUCTURE, "document", "document"},
+ {ENVIRONMENT_CAT_STRUCTURE, "frame", "frame"},
+ {ENVIRONMENT_CAT_STRUCTURE, "table", "table"},
+ {ENVIRONMENT_CAT_STRUCTURE, "tabular", "tabular"},
+ {ENVIRONMENT_CAT_STRUCTURE, "figure", "figure"},
+ /* Lists */
+ {ENVIRONMENT_CAT_LISTS, "itemize", "itemize"},
+ {ENVIRONMENT_CAT_LISTS, "enumerate", "enumerate"},
+ {ENVIRONMENT_CAT_LISTS, "description", "description"},
+ /* Math stuff */
+ {ENVIRONMENT_CAT_MATH, "displaymath", "displaymath"},
+ {ENVIRONMENT_CAT_MATH, "equation", "equation"},
+ {ENVIRONMENT_CAT_MATH, "eqnarray", "eqnarray"},
+
+ {0, NULL, NULL},
+};
+
+
+void glatex_insert_environment(gchar *environment)
+{
+ GeanyDocument *doc = NULL;
+
+ doc = document_get_current();
+
+ /* Only do anything if it is realy needed to */
+ if (doc != NULL && environment != NULL)
+ {
+ if (sci_has_selection(doc->editor->sci))
+ {
+ gchar *selection = NULL;
+ const gchar *replacement = NULL;
+
+ selection = sci_get_selection_contents(doc->editor->sci);
+
+ replacement = g_strconcat("\\begin{", environment, "}\n",
+ selection,"\n\\end{", environment, "}\n", NULL);
+
+ sci_replace_sel(doc->editor->sci, replacement);
+ g_free(selection);
+ }
+ else
+ {
+ gint pos = sci_get_current_position(doc->editor->sci);
+ gint len = strlen(environment);
+ gchar *tmp = NULL;
+
+ tmp = g_strconcat("\\begin{", environment, "}\n\n\\end{",
+ environment, "}\n", NULL);
+
+ sci_insert_text(doc->editor->sci, pos, tmp);
+ sci_set_current_position(doc->editor->sci, pos + len + 9, TRUE);
+ g_free(tmp);
+ }
+ }
+}
+
+
+void
+glatex_environment_insert_activated (G_GNUC_UNUSED GtkMenuItem *menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ gint env = GPOINTER_TO_INT(gdata);
+
+ glatex_insert_environment(glatex_environment_array[env].latex);
+}
+
+
+void
+glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem,
+ G_GNUC_UNUSED gpointer gdata)
+{
+ GtkWidget *dialog = NULL;
+ GtkWidget *vbox = NULL;
+ GtkWidget *label_env = NULL;
+ GtkWidget *textbox_env = NULL;
+ GtkWidget *table = NULL;
+ GtkTreeModel *model = NULL;
+ gint i, max;
+
+ dialog = gtk_dialog_new_with_buttons(_("Insert Environment"),
+ GTK_WINDOW(geany->main_widgets->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
+ gtk_widget_set_name(dialog, "GeanyDialog");
+ gtk_box_set_spacing(GTK_BOX(vbox), 10);
+
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 6);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+
+ label_env = gtk_label_new(_("Environment:"));
+ textbox_env = gtk_combo_box_entry_new_text();
+
+ max = glatex_count_menu_entries(glatex_environment_array, -1);
+ for (i = 0; i < max; i++)
+ {
+ gtk_combo_box_append_text(GTK_COMBO_BOX(textbox_env),
+ glatex_environment_array[i].label);
+ }
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(textbox_env));
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model),
+ 0, GTK_SORT_ASCENDING);
+
+ gtk_misc_set_alignment(GTK_MISC(label_env), 0, 0.5);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label_env, 0, 1, 0, 1);
+ gtk_table_attach_defaults(GTK_TABLE(table), textbox_env, 1, 2, 0, 1);
+ gtk_container_add(GTK_CONTAINER(vbox), table);
+
+ gtk_widget_show_all(vbox);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ gchar *env_string = NULL;
+
+ env_string = g_strdup(gtk_combo_box_get_active_text(
+ GTK_COMBO_BOX(textbox_env)));
+
+ if (env_string != NULL)
+ {
+ glatex_insert_environment(env_string);
+ g_free(env_string);
+ }
+ }
+
+ gtk_widget_destroy(dialog);
+}
+
Copied: trunk/geany-plugins/geanylatex/src/latexenvironments.h (from rev 705, trunk/geanylatex/src/latexenvironments.h)
===================================================================
--- trunk/geany-plugins/geanylatex/src/latexenvironments.h (rev 0)
+++ trunk/geany-plugins/geanylatex/src/latexenvironments.h 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,51 @@
+/*
+ * latexenvironments.h
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#ifndef LATEXENVIRONMENTS_H
+#define LATEXENVIRONMENTS_H
+
+#include "geanylatex.h"
+#include <string.h>
+
+enum {
+ ENVIRONMENT_CAT_DUMMY = 0,
+ ENVIRONMENT_CAT_FORMAT,
+ ENVIRONMENT_CAT_STRUCTURE,
+ ENVIRONMENT_CAT_LISTS,
+ ENVIRONMENT_CAT_MATH,
+ ENVIRONMENT_CAT_MAX
+};
+
+extern SubMenuTemplate glatex_environment_array[];
+
+extern CategoryName glatex_environment_cat_names[];
+
+void glatex_insert_environment(gchar *environment);
+
+void
+glatex_insert_environment_dialog(G_GNUC_UNUSED GtkMenuItem *menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+
+void
+glatex_environment_insert_activated (G_GNUC_UNUSED GtkMenuItem *menuitem,
+ G_GNUC_UNUSED gpointer gdata);
+
+#endif
Copied: trunk/geany-plugins/geanylatex/src/latexkeybindings.c (from rev 705, trunk/geanylatex/src/latexkeybindings.c)
===================================================================
--- trunk/geany-plugins/geanylatex/src/latexkeybindings.c (rev 0)
+++ trunk/geany-plugins/geanylatex/src/latexkeybindings.c 2009-06-11 21:30:17 UTC (rev 706)
@@ -0,0 +1,112 @@
+/*
+ * latexkeybindings.c
+ *
+ * Copyright 2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+#include "latexkeybindings.h"
+
+void glatex_kblabel_insert(G_GNUC_UNUSED guint key_id)
+{
+ if (NULL == document_get_current())
+ return;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 705
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=705&view=rev
Author: frlan
Date: 2009-06-11 21:04:03 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Merge geanylipsum plugin into geany-plugins project. Keeping former directory and build system and postpone decision about to a later point
Modified Paths:
--------------
trunk/geany-plugins/po/POTFILES.in
trunk/geany-plugins/wscript
Added Paths:
-----------
trunk/geany-plugins/geanylipsum/
trunk/geany-plugins/geanylipsum/COPYING
trunk/geany-plugins/geanylipsum/ChangeLog
trunk/geany-plugins/geanylipsum/INSTALL
trunk/geany-plugins/geanylipsum/NEWS
trunk/geany-plugins/geanylipsum/src/
trunk/geany-plugins/geanylipsum/src/geanylipsum.c
Copied: trunk/geany-plugins/geanylipsum/COPYING (from rev 703, trunk/geanylipsum/COPYING)
===================================================================
--- trunk/geany-plugins/geanylipsum/COPYING (rev 0)
+++ trunk/geany-plugins/geanylipsum/COPYING 2009-06-11 21:04:03 UTC (rev 705)
@@ -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.
Copied: trunk/geany-plugins/geanylipsum/ChangeLog (from rev 703, trunk/geanylipsum/ChangeLog)
===================================================================
--- trunk/geany-plugins/geanylipsum/ChangeLog (rev 0)
+++ trunk/geany-plugins/geanylipsum/ChangeLog 2009-06-11 21:04:03 UTC (rev 705)
@@ -0,0 +1,22 @@
+2009-04-11 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Add not complete part of Lorem Ipsum text if there is any at end of
+ insertion.
+
+
+2009-04-01 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Preparation for 0.1.1 maintenance release
+
+
+2009-03-24 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Enrico to improve code and fix some memory
+ leaks
+
+
+2009-01-23 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Update to plugin API v128
+
+
Copied: trunk/geany-plugins/geanylipsum/INSTALL (from rev 703, trunk/geanylipsum/INSTALL)
===================================================================
--- trunk/geany-plugins/geanylipsum/INSTALL (rev 0)
+++ trunk/geany-plugins/geanylipsum/INSTALL 2009-06-11 21:04:03 UTC (rev 705)
@@ -0,0 +1 @@
+See README for details.
Copied: trunk/geany-plugins/geanylipsum/NEWS (from rev 703, trunk/geanylipsum/NEWS)
===================================================================
--- trunk/geany-plugins/geanylipsum/NEWS (rev 0)
+++ trunk/geany-plugins/geanylipsum/NEWS 2009-06-11 21:04:03 UTC (rev 705)
@@ -0,0 +1,4 @@
+0.1.1 (2009-04-01)
+
+ * Fixing some memory leaks
+ * Being more document sensitive
Copied: trunk/geany-plugins/geanylipsum/src/geanylipsum.c (from rev 703, trunk/geanylipsum/src/geanylipsum.c)
===================================================================
--- trunk/geany-plugins/geanylipsum/src/geanylipsum.c (rev 0)
+++ trunk/geany-plugins/geanylipsum/src/geanylipsum.c 2009-06-11 21:04:03 UTC (rev 705)
@@ -0,0 +1,190 @@
+/*
+ * geanylipsum.c
+ *
+ * Copyright 2008-2009 Frank Lanitz <frank(at)frank(dot)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.
+ */
+
+
+#include "geany.h"
+#include "ui_utils.h"
+#include "support.h"
+#include "plugindata.h"
+#include "document.h"
+#include "filetypes.h"
+#include "utils.h"
+#include "keybindings.h"
+#include "geanyfunctions.h"
+
+#include <string.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
+GeanyPlugin *geany_plugin;
+GeanyData *geany_data;
+GeanyFunctions *geany_functions;
+
+PLUGIN_VERSION_CHECK(130)
+PLUGIN_SET_INFO(_("Lipsum"), _("Creating dummy text with Geany"), "0.4.2", "Frank Lanitz <frank(a)frank.uvena.de>");
+
+static GtkWidget *main_menu_item = NULL;
+static gchar *lipsum = NULL;
+static const gchar *default_loremipsum = "\
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\
+eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\
+voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet \
+clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
+
+
+/* Doing some basic keybinding stuff */
+enum
+{
+ LIPSUM_KB_INSERT,
+ COUNT_KB
+};
+
+PLUGIN_KEY_GROUP(geanylipsum, COUNT_KB);
+
+
+
+static void
+insert_string(GeanyDocument *doc, const gchar *string)
+{
+ if (doc != NULL)
+ {
+ gint pos = sci_get_current_position(doc->editor->sci);
+ sci_insert_text(doc->editor->sci, pos, string);
+ }
+}
+
+
+static void
+lipsum_activated(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+{
+ GeanyDocument *doc = NULL;
+
+ /* Setting default length to 1500 characters */
+ gdouble value = 1500;
+
+ doc = document_get_current();
+
+ if (doc != NULL && dialogs_show_input_numeric(_("Lipsum-Generator"),
+ _("Enter the length of Lipsum text here"), &value, 1, 5000, 1))
+ {
+
+ int tmp = 0;
+ int x = 0;
+ int i = 0;
+ int missing = 0;
+
+ /* Checking what we have */
+ tmp = strlen(lipsum);
+
+ if (tmp > value)
+ {
+ x = 0;
+ missing = value - (x * tmp);
+ }
+ else if (tmp == (int)value)
+ {
+ x = 1;
+ }
+ else if (tmp > 0)
+ {
+ x = value / tmp;
+ missing = value - (x * tmp);
+ }
+
+ sci_start_undo_action(doc->editor->sci);
+
+ /* Insert lipsum snippet as often as needed ... */
+ if (missing > 0)
+ {
+ gchar *missing_text = g_strndup(lipsum, missing);
+ insert_string(doc, missing_text);
+ g_free(missing_text);
+ }
+ for (i = 0; i < x; i++)
+ insert_string(doc, lipsum);
+
+ sci_end_undo_action(doc->editor->sci);
+ }
+}
+
+
+/* Called when keystroke were pressed */
+static void kblipsum_insert(G_GNUC_UNUSED guint key_id)
+{
+ lipsum_activated(NULL, NULL);
+}
+
+
+/* Called by Geany to initialize the plugin */
+void
+plugin_init(G_GNUC_UNUSED GeanyData *data)
+{
+ GtkWidget *menu_lipsum = NULL;
+ GKeyFile *config = g_key_file_new();
+ GtkTooltips *tooltips = NULL;
+ gchar *config_file = NULL;
+
+ tooltips = gtk_tooltips_new();
+
+ main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
+
+ config_file = g_strconcat(geany->app->configdir,
+ G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
+ "geanylipsum", G_DIR_SEPARATOR_S, "lipsum.conf", NULL);
+
+ /* Initialising options from config file if there is any*/
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+ lipsum = utils_get_setting_string(config, "snippets", "lipsumtext", default_loremipsum);
+
+ g_key_file_free(config);
+ g_free(config_file);
+
+ /* Building menu entry */
+ menu_lipsum = gtk_image_menu_item_new_with_mnemonic(_("_Lipsum"));
+ gtk_tooltips_set_tip(tooltips, menu_lipsum,
+ _("Include Pseudotext to your code"), NULL);
+ gtk_widget_show(menu_lipsum);
+ g_signal_connect((gpointer) menu_lipsum, "activate",
+ G_CALLBACK(lipsum_activated), NULL);
+ gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_lipsum);
+
+
+ ui_add_document_sensitive(menu_lipsum);
+
+ main_menu_item = menu_lipsum;
+
+ /* init keybindings */
+ keybindings_set_item(plugin_key_group, LIPSUM_KB_INSERT, kblipsum_insert,
+ 0, 0, "inster_lipsum", _("Insert Lipsum text"), menu_lipsum);
+}
+
+/* Called by Geany before unloading the plugin. */
+void plugin_cleanup(void)
+{
+ /* remove the menu item added in plugin_init() */
+ gtk_widget_destroy(main_menu_item);
+
+ /* free lipsum snippet */
+ g_free(lipsum);
+}
+
Modified: trunk/geany-plugins/po/POTFILES.in
===================================================================
--- trunk/geany-plugins/po/POTFILES.in 2009-06-11 20:23:16 UTC (rev 704)
+++ trunk/geany-plugins/po/POTFILES.in 2009-06-11 21:04:03 UTC (rev 705)
@@ -7,6 +7,9 @@
addons/src/addons.c
addons/src/ao_doclist.c
+#geanylipsum
+geanylipsum/src/geanylipsum.c
+
# geanysendmail
geanysendmail/src/geanysendmail.c
Modified: trunk/geany-plugins/wscript
===================================================================
--- trunk/geany-plugins/wscript 2009-06-11 20:23:16 UTC (rev 704)
+++ trunk/geany-plugins/wscript 2009-06-11 21:04:03 UTC (rev 705)
@@ -64,11 +64,12 @@
# add a new element for your plugin
plugins = [
Plugin('addons', None, [ 'addons/src' ]),
- Plugin('shiftcolumn', None, [ 'shiftcolumn/src']),
- Plugin('spellcheck', None, [ 'spellcheck/src' ], [ [ 'enchant', '1.3', True ] ]),
Plugin('geanysendmail',
- [ 'geanysendmail/src/geanysendmail.c' ],
- [ 'geanysendmail/src' ])
+ [ 'geanysendmail/src/geanysendmail.c' ],
+ [ 'geanysendmail/src' ]),
+ Plugin('geanylipsum', None, [ 'geanylipsum/src']),
+ Plugin('shiftcolumn', None, [ 'shiftcolumn/src']),
+ Plugin('spellcheck', None, [ 'spellcheck/src' ], [ [ 'enchant', '1.3', True ] ])
]
'''
@@ -110,10 +111,6 @@
'geanyvc/vc_svk.c', 'geanyvc/vc_bzr.c', 'geanyvc/vc_hg.c' ],
[ 'geanyvc' ], # include dirs
[ [ 'gtkspell-2.0', '2.0', False ] ]),
- Plugin('geanylipsum',
- [ 'geanylipsum/src/geanylipsum.c' ], # source files
- [ 'geanylipsum', 'geanylipsum/src' ] # include dirs
- ),
Plugin('geany-mini-script',
[ 'geany-mini-script/src/gms.c', 'geany-mini-script/src/gms_gui.c' ], # source files
[ 'geany-mini-script', 'geany-mini-script/src' ] # include dirs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 704
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=704&view=rev
Author: eht16
Date: 2009-06-11 20:23:16 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Allow plugins to omit the list of source files, Waf will then search for source files.
Modified Paths:
--------------
trunk/geany-plugins/wscript
Modified: trunk/geany-plugins/wscript
===================================================================
--- trunk/geany-plugins/wscript 2009-06-11 10:10:43 UTC (rev 703)
+++ trunk/geany-plugins/wscript 2009-06-11 20:23:16 UTC (rev 704)
@@ -48,31 +48,27 @@
class Plugin:
- def __init__(self, n, s, i, l=[], g=None):
+ def __init__(self, n, s, i, l=[]):
+ # plugin name, must be the same as the corresponding subdirectory
self.name = n
+ # may be None to auto-detect source files in all directories specified in 'includes'
self.sources = s
- self.includes = i # do not include '.'
- self.libs = l # a list of lists of libs and their versions, e.g. [ [ 'enchant', '1.3' ],
- # [ 'gtkspell-2.0', '2.0', False ] ], the third argument defines whether
- # the dependency is mandatory
+ # do not include '.'
+ self.includes = i
+ # a list of lists of libs and their versions, e.g. [ [ 'enchant', '1.3' ],
+ # [ 'gtkspell-2.0', '2.0', False ] ], the third argument defines whether
+ # the dependency is mandatory
+ self.libs = l
# add a new element for your plugin
plugins = [
- Plugin('addons',
- [ 'addons/src/addons.c', 'addons/src/ao_doclist.c', 'addons/src/ao_openuri.c',
- 'addons/src/ao_systray.c', 'addons/src/tasks.c' ],
- [ 'addons', 'addons/src' ]),
- Plugin('shiftcolumn',
- [ 'shiftcolumn/src/shiftcolumn.c'],
- [ 'shiftcolumn', 'shiftcolumn/src']),
- Plugin('spellcheck',
- [ 'spellcheck/src/gui.c', 'spellcheck/src/scplugin.c', 'spellcheck/src/speller.c' ], # source files
- [ 'spellcheck', 'spellcheck/src' ], # include dirs
- [ [ 'enchant', '1.3', True ] ]),
+ Plugin('addons', None, [ 'addons/src' ]),
+ Plugin('shiftcolumn', None, [ 'shiftcolumn/src']),
+ Plugin('spellcheck', None, [ 'spellcheck/src' ], [ [ 'enchant', '1.3', True ] ]),
Plugin('geanysendmail',
[ 'geanysendmail/src/geanysendmail.c' ],
- [ 'geanysendmail', 'geanysendmail/src' ])
+ [ 'geanysendmail/src' ])
]
'''
@@ -406,7 +402,7 @@
if p.name == 'geanygdb':
build_debug(bld, p, libs) # build additional binary for the debug plugin
- bld.new_task_gen(
+ t = bld.new_task_gen(
features = 'cc cshlib',
source = p.sources,
includes = p.includes,
@@ -414,6 +410,9 @@
uselib = libs,
install_path = '${G_PREFIX}/lib' if is_win32 else '${LIBDIR}/geany/'
)
+ if not p.sources:
+ for dir in p.includes:
+ t.find_sources_in_dirs(dir)
install_docs(bld, p.name, 'AUTHORS ChangeLog COPYING NEWS README THANKS TODO'.split())
@@ -421,8 +420,8 @@
if bld.env['INTLTOOL']:
bld.new_task_gen(
features = 'intltool_po',
- podir = 'po',
- appname = APPNAME,
+ podir = 'po',
+ appname = APPNAME,
install_path = '${G_PREFIX}/share/locale' if is_win32 else '${LOCALEDIR}'
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 703
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=703&view=rev
Author: eht16
Date: 2009-06-11 10:10:43 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Overwrite installation prefix on Windows only if it wasn't specified explicitly. Fix DOCDIR path.
Modified Paths:
--------------
trunk/geany-plugins/wscript
Modified: trunk/geany-plugins/wscript
===================================================================
--- trunk/geany-plugins/wscript 2009-06-11 10:04:51 UTC (rev 702)
+++ trunk/geany-plugins/wscript 2009-06-11 10:10:43 UTC (rev 703)
@@ -37,7 +37,7 @@
import Build, Options, Utils, preproc
-import sys, os
+import os, sys, tempfile
APPNAME = 'geany-plugins'
@@ -255,8 +255,9 @@
if 'geanygdb' in enabled_plugins:
enabled_plugins.remove('geanygdb')
- prefix = os.path.splitdrive(conf.srcdir)[1]
- conf.env['PREFIX'] = os.path.join(prefix, '%s-%s' % (APPNAME, VERSION))
+ if conf.env['PREFIX'] == tempfile.gettempdir():
+ # overwrite default prefix on Windows (tempfile.gettempdir() is the Waf default)
+ conf.define('PREFIX', os.path.join(conf.srcdir, '%s-%s' % (APPNAME, VERSION)), 1)
# hack: we add the parent directory of the first include directory as this is missing in
# list returned from pkg-config
conf.env['CPPPATH_GTK'].insert(0, os.path.dirname(conf.env['CPPPATH_GTK'][0]))
@@ -286,8 +287,7 @@
conf.undefine('DATADIR')
else:
conf.define('PREFIX', conf.env['PREFIX'], 1)
- # fixme, DOCDIR is wrong
- conf.define('DOCDIR', '%s/doc/geany-plugins/' % conf.env['DATADIR'], 1)
+ conf.define('DOCDIR', '%s/doc/geany-plugins/', 1)
conf.define('VERSION', VERSION, 1)
conf.define('PACKAGE', APPNAME, 1)
conf.define('GETTEXT_PACKAGE', APPNAME, 1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 699
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=699&view=rev
Author: frlan
Date: 2009-06-10 23:23:06 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
Merge GeanySendMail into geany-plugins project
Modified Paths:
--------------
trunk/geany-plugins/po/POTFILES.in
trunk/geany-plugins/po/de.po
trunk/geany-plugins/po/geany-plugins.pot
trunk/geany-plugins/wscript
Added Paths:
-----------
trunk/geany-plugins/geanysendmail/
trunk/geany-plugins/geanysendmail/AUTHORS
trunk/geany-plugins/geanysendmail/COPYING
trunk/geany-plugins/geanysendmail/ChangeLog
trunk/geany-plugins/geanysendmail/INSTALL
trunk/geany-plugins/geanysendmail/NEWS
trunk/geany-plugins/geanysendmail/README
trunk/geany-plugins/geanysendmail/TODO
trunk/geany-plugins/geanysendmail/src/
trunk/geany-plugins/geanysendmail/src/geanysendmail.c
trunk/geany-plugins/geanysendmail/src/icon.h
Copied: trunk/geany-plugins/geanysendmail/AUTHORS (from rev 698, trunk/geanysendmail/AUTHORS)
===================================================================
--- trunk/geany-plugins/geanysendmail/AUTHORS (rev 0)
+++ trunk/geany-plugins/geanysendmail/AUTHORS 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1 @@
+Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Copied: trunk/geany-plugins/geanysendmail/COPYING (from rev 698, trunk/geanysendmail/COPYING)
===================================================================
--- trunk/geany-plugins/geanysendmail/COPYING (rev 0)
+++ trunk/geany-plugins/geanysendmail/COPYING 2009-06-10 23:23:06 UTC (rev 699)
@@ -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.
Copied: trunk/geany-plugins/geanysendmail/ChangeLog (from rev 698, trunk/geanysendmail/ChangeLog)
===================================================================
--- trunk/geany-plugins/geanysendmail/ChangeLog (rev 0)
+++ trunk/geany-plugins/geanysendmail/ChangeLog 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,103 @@
+2009-05-28 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make usage of Geany's ui_widget_set_tooltip_text() function.
+
+
+2009-04-24 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Timothy Boronczyk which allows aborting when inserting
+ recipient's email address.
+
+
+2008-10-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Nick to make use of Geany Plugin API r100 and the
+ add_document_sensitive() function from plugin API.
+
+
+2008-10-13 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Nick to make use of Geany Plugin API r99 and the
+ add item to toolbar function.
+
+
+2008-10-03 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Implement a %b placeholder for adding basename of file to mailer command.
+ Thanks to Timothy Boronczyk for idea.
+
+
+2008-09-28 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make configuration example copyable.
+
+
+2008-09-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Added a patch by Timothy Boronczyk to support creating a mail with
+ recipients email. Thanks for it.
+
+
+2008-09-01 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Build environment: Update of Makefiles to include icon.h into source
+ package
+ * Build environment: Added makefile for Windows (needs to be tested)
+ * configure.in: Update of version string
+
+
+2008-07-11 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make plugin compile with Geany svn r2767.
+
+
+2008-06-26 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Update of used plugin API to v71.
+
+
+2008-06-16 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Make plugin also work together with GTK-2.8. Thanks to Nick for
+ providing patch.
+
+
+2008-06-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Update of plugin API
+
+
+2008-05-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Ported build system from spellcheck plugin. Thanks for it.
+ * Updated Geany plugin API.
+ * Activating of i18n support and adding a first German translation.
+
+
+2008-05-13 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * Restart using ChangeLog.
+
+
+2007-11-29 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * geanysendmail.c: Applied a patch from Enrico to improve code;
+ Version 0.2b
+
+
+2007-11-23 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * geanysendmail.c, TODO: %f added Filename placeholder
+ Fixes a few segfaults and momory problems
+
+
+2007-11-23 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * geanysendmail.c: Added support configuration dialog called by
+ plugin manager and configuration file support to store mailer.
+ * TODO: Added list to keep in mind what is still missing
+
+
+2007-11-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * *: Initial commit
Copied: trunk/geany-plugins/geanysendmail/INSTALL (from rev 698, trunk/geanysendmail/INSTALL)
===================================================================
--- trunk/geany-plugins/geanysendmail/INSTALL (rev 0)
+++ trunk/geany-plugins/geanysendmail/INSTALL 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,16 @@
+These installation instructions are written for a Linux system.
+
+At the time of this writing, building the plugin requires a recent SVN checkout
+of the Geany sources (API version 104, Geany v0.16svn+).
+
+To compile and install just follow the typical three steps:
+
+ % configure
+ % make
+ % make install
+
+The plugin will be installed into your $prefix/lib/geany of your Geany
+installation. This should be in most cases /usr/ or /usr/local. So you will
+need in most cases to run make install under root. If you don't want to
+install it global, but on your own home dir, just --prefix option for configure.
+Please check README for more detailed information.
Copied: trunk/geany-plugins/geanysendmail/NEWS (from rev 698, trunk/geanysendmail/NEWS)
===================================================================
--- trunk/geany-plugins/geanysendmail/NEWS (rev 0)
+++ trunk/geany-plugins/geanysendmail/NEWS 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,17 @@
+GeanySendMail 0.4.2 (26. May 2009=:
+ * Added cancel button to recipient's address dialog
+ * Some minor code cleanup
+
+
+GeanySendMail 0.4.1 (16. February 2009):
+ * Update to Geany pugin API v116
+ * Minor improvments on wording and cleanup of code
+
+
+GeanySendMail 0.4 (22. October 2008):
+
+ * Adding support for creating a mail with recipients email
+ (Basic Patch by Timothy Boronczyk)
+ * Added placeholder for file's basename (Idea by Timothy Boronczyk)
+ * Added build support for Windows (not very well tested)
+ * Updates at translation, documentation and buildsystem
Copied: trunk/geany-plugins/geanysendmail/README (from rev 698, trunk/geanysendmail/README)
===================================================================
--- trunk/geany-plugins/geanysendmail/README (rev 0)
+++ trunk/geany-plugins/geanysendmail/README 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,134 @@
+GeanySendMail Plugin
+(0.4.2)
+
+
+About
+------
+
+GeanySendMail is a little plugin to send a document as attachment
+using the preferred mail client from inside Geany. It is similar to
+the envelope symbol of most office tools and requires a mail client
+that is supporting remote calls.
+
+
+Requirements
+------------
+
+For compiling the plugin yourself, you will need the GTK (>= 2.6.0)
+libraries and header files. You will also need its dependency
+libraries and header files, such as Pango, Glib and ATK. All these
+files are available at http://www.gtk.org.
+
+And obviously, you will need to have Geany installed. If you have Geany
+installed from the sources, you should be ready to go. If you used a
+prepared package e.g. from your distribution you probably need to
+install an additional package, this might be called geany-dev or
+geany-devel. Please note that in order to compile and use this plugin,
+you need Geany 0.16 or later (Geany Plugin API v116 or higher).
+
+Furthermore you need, of course, a C compiler and the Make tool. The
+GNU versions of these tools are recommended.
+
+
+Installation
+------------
+
+Compiling and installing the code is done by the following three
+commands:
+
+$ ./configure
+$ make
+$ make install
+
+For more configuration details run
+$ ./configure --help
+
+If there are any errors during compilation, check your build environment
+and try to find the error, otherwise contact one of the authors. (See below)
+
+
+Usage
+-----
+
+After installed successfully, load the plugin in Geany's plugin manager
+and a new menu item in the Tools menu will appear. Before you can start
+you need to configure your mail client. This can be done in the
+configuration dialog (details on it later). You can also assign a
+keyboard shortcut in Geany's preferences dialog to send your document.
+
+
+Configuration
+-------------
+
+In the configuration dialog you can set up a command that is called by the
+plugin to communicate with your mail client. Depending on what's
+your favorite mailer, the command will differ. A number of placeholders
+are available for doing this:
+
+* %s: Will be replaced by the complete path of the file that should be send.
+* %r: Will be replaced by one or more recipient's email address that can
+be entered inside a separate dialog. (Please remember during input,
+what your mail client is expecting here)
+* %b: Will be replace by the file name. For a file /tmp/foo.baa it will
+be replaced by foo.baa.
+
+Depending on how you like to use, you can combine all of the placeholders
+to build up your command. It is possible to use one placeholder
+several times. Examples could be:
+ sylpheed --attach "%f" --compose "%r"
+ mutt -s "Sending '%b'" -a "%f" "%r"
+ "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" \
+ -compose to="%r",subject="%b",attachment="%f"
+
+
+Development
+-----------
+
+You can checkout the current source code from the Subversion repository at
+Sourceforge.net. Get the code from:
+
+svn checkout
+http://geany-plugins.svn.sourceforge.net/svnroot/geany-plugins/trunk/geanysendmail
+
+If you want to create a patch, please respect the license of GeanySendMail
+as well as intellectual property of third. Patches that should be
+included to the default distribution must be licensed under the same conditions
+as GeanySendMail by the copyright owner.
+
+
+Known issues
+-----------
+
+During installation it might happen, that the plugin wants to install the
+files for localization to /usr/local as a prefix. This can be avoided by
+adding --prefix="/new/path" when running configure/autogen.sh.
+
+In case you are working with white spaces either in your path names,
+file names or at mail addresses (e.g. for separating two addresses) you
+should keep care of proper quoting since %s, %b and %r will be replaced
+without any quotes.
+
+For more recent information all reported issues will be tracked at
+http://sourceforge.net/tracker/?group_id=222729
+
+
+License
+-------
+
+GeanySendMail and all its parts 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. If not, you will be
+able to get a copy by contacting the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+Bugs, questions, bugs, homepage
+---------------------------------
+
+If you found any bugs or want to provide a patch, please contact Frank
+Lanitz (frank(at)geany(dot)org). Please also do so, if you got any
+questions and visiting http://frank.uvena.de/en/Geany/geanysendmail
+didn't help you to figure out the answer. Visiting the website is also
+a good start if you want to check for any update on this plugin.
Copied: trunk/geany-plugins/geanysendmail/TODO (from rev 698, trunk/geanysendmail/TODO)
===================================================================
--- trunk/geany-plugins/geanysendmail/TODO (rev 0)
+++ trunk/geany-plugins/geanysendmail/TODO 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,6 @@
+TODO
+----
+
+ * Buildsupport for Win32 (Needs some testing)
+ * Support for Inline-mailing (embedded text inside mail)
+ * Send mail directly (only UNIX like systems)
Copied: trunk/geany-plugins/geanysendmail/src/geanysendmail.c (from rev 698, trunk/geanysendmail/src/geanysendmail.c)
===================================================================
--- trunk/geany-plugins/geanysendmail/src/geanysendmail.c (rev 0)
+++ trunk/geany-plugins/geanysendmail/src/geanysendmail.c 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,434 @@
+/*
+ * geanysendmail.c
+ *
+ * Copyright 2007-2009 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+ * Copyright 2007 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+ * Copyright 2007, 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+ * Copyright 2008, 2009 Timothy Boronczyk <tboronczyk(at)gmail(dot)com>
+ *
+ * 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.
+ */
+
+/* A little plugin to send a document as attachment using the preferred mail client */
+
+#include "geany.h"
+#include "ui_utils.h"
+#include "support.h"
+#include "plugindata.h"
+#include "document.h"
+#include "filetypes.h"
+#include "utils.h"
+#include "keybindings.h"
+#include "icon.h"
+#include "geanyfunctions.h"
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+GeanyPlugin *geany_plugin;
+GeanyData *geany_data;
+GeanyFunctions *geany_functions;
+
+PLUGIN_VERSION_CHECK(116)
+
+PLUGIN_SET_INFO(_("GeanySendMail"), _("A little plugin to send the current \
+file as attachment by user's favorite mailer"), "0.4.2", "Frank Lanitz <frank(a)frank.uvena.de>")
+
+/* Keybinding(s) */
+enum
+{
+ SENDMAIL_KB,
+ COUNT_KB
+};
+
+PLUGIN_KEY_GROUP(sendmail, COUNT_KB)
+
+static gchar *config_file = NULL;
+static gchar *mailer = NULL;
+static gchar *address = NULL;
+gboolean icon_in_toolbar = FALSE;
+gboolean use_address_dialog = FALSE;
+/* Needed global to remove from toolbar again */
+GtkWidget *mailbutton = NULL;
+static GtkWidget *main_menu_item = NULL;
+
+/* Callback for sending file as attachment */
+static void
+send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer gdata)
+{
+ GeanyDocument *doc;
+ gchar *locale_filename = NULL;
+ gchar *command = NULL;
+ GError *error = NULL;
+ GString *cmd_str = NULL;
+ GtkWidget *dialog = NULL;
+ GtkWidget *label = NULL;
+ GtkWidget *entry = NULL;
+ GtkWidget *vbox = NULL;
+ GKeyFile *config = g_key_file_new();
+ gchar *config_dir = g_path_get_dirname(config_file);
+ gchar *data;
+
+ doc = document_get_current();
+
+ if (doc->file_name == NULL)
+ {
+ dialogs_show_save_as();
+ }
+ else
+ {
+ document_save_file(doc, FALSE);
+ }
+
+ if (doc->file_name != NULL)
+ {
+ if (mailer)
+ {
+ locale_filename = utils_get_locale_from_utf8(doc->file_name);
+ cmd_str = g_string_new(mailer);
+
+ if ((use_address_dialog == TRUE) && (g_strrstr(mailer, "%r") != NULL))
+ {
+ gint tmp;
+
+ dialog = gtk_dialog_new_with_buttons(_("Recipient's Address"),
+ GTK_WINDOW(geany->main_widgets->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
+ vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
+ gtk_widget_set_name(dialog, "GeanyDialog");
+ gtk_box_set_spacing(GTK_BOX(vbox), 10);
+
+ label = gtk_label_new(_("Enter the recipient's e-mail address:"));
+ gtk_widget_show(label);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ entry = gtk_entry_new();
+ gtk_widget_show(entry);
+ if (address != NULL)
+ gtk_entry_set_text(GTK_ENTRY(entry), address);
+
+ gtk_container_add(GTK_CONTAINER(vbox), label);
+ gtk_container_add(GTK_CONTAINER(vbox), entry);
+ gtk_widget_show(vbox);
+
+ tmp = gtk_dialog_run(GTK_DIALOG(dialog));
+
+ if (tmp != GTK_RESPONSE_ACCEPT)
+ {
+ gtk_widget_destroy(dialog);
+ return;
+ }
+ else
+ {
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+
+ g_free(address);
+ address = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+
+ g_key_file_set_string(config, "tools", "address", address);
+ }
+
+ if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) &&
+ utils_mkdir(config_dir, TRUE) != 0)
+ {
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR,
+ _("Plugin configuration directory could not be created."));
+ }
+ else
+ {
+ /* write config to file */
+ data = g_key_file_to_data(config, NULL, NULL);
+ utils_write_file(config_file, data);
+ g_free(data);
+ g_key_file_free(config);
+ g_free(config_dir);
+ }
+ }
+
+ if (! utils_string_replace_all(cmd_str, "%f", locale_filename))
+ ui_set_statusbar(FALSE,
+ _("Filename placeholder not found. The executed command might have failed."));
+
+ if (use_address_dialog == TRUE && address != NULL)
+ {
+ if (! utils_string_replace_all(cmd_str, "%r", address))
+ ui_set_statusbar(FALSE,
+ _("Recipient address placeholder not found. The executed command might have failed."));
+ }
+ else
+ /* Removes %r if option was not activ but was included into command */
+ utils_string_replace_all(cmd_str, "%r", NULL);
+
+ utils_string_replace_all(cmd_str, "%b", g_path_get_basename(locale_filename));
+
+ command = g_string_free(cmd_str, FALSE);
+ g_spawn_command_line_async(command, &error);
+ if (error != NULL)
+ {
+ ui_set_statusbar(FALSE, _("Could not execute mailer. Please check your configuration."));
+ g_error_free(error);
+ }
+
+ g_free(locale_filename);
+ g_free(command);
+
+ if (dialog != NULL)
+ gtk_widget_destroy(dialog);
+ }
+ else
+ {
+ ui_set_statusbar(FALSE, _("Please define a mail client first."));
+ }
+ }
+ else
+ {
+ ui_set_statusbar(FALSE, _("File has to be saved before sending."));
+ }
+}
+
+static void key_send_as_attachment(G_GNUC_UNUSED guint key_id)
+{
+ send_as_attachment(NULL, NULL);
+}
+
+#define GEANYSENDMAIL_STOCK_MAIL "geanysendmail-mail"
+
+static void add_stock_item(void)
+{
+ GtkIconSet *icon_set;
+ GtkIconFactory *factory = gtk_icon_factory_new();
+ GtkIconTheme *theme = gtk_icon_theme_get_default();
+ GtkStockItem item = { GEANYSENDMAIL_STOCK_MAIL, _("Mail"), 0, 0, GETTEXT_PACKAGE };
+
+ if (gtk_icon_theme_has_icon(theme, "mail-message-new"))
+ {
+ GtkIconSource *icon_source = gtk_icon_source_new();
+ icon_set = gtk_icon_set_new();
+ gtk_icon_source_set_icon_name(icon_source, "mail-message-new");
+ gtk_icon_set_add_source(icon_set, icon_source);
+ gtk_icon_source_free(icon_source);
+ }
+ else
+ {
+ GdkPixbuf *pb = gdk_pixbuf_new_from_inline(-1, mail_pixbuf, FALSE, NULL);
+ icon_set = gtk_icon_set_new_from_pixbuf(pb);
+ g_object_unref(pb);
+ }
+ gtk_icon_factory_add(factory, item.stock_id, icon_set);
+ gtk_stock_add(&item, 1);
+ gtk_icon_factory_add_default(factory);
+
+ g_object_unref(factory);
+ gtk_icon_set_unref(icon_set);
+}
+
+
+void show_icon()
+{
+ mailbutton = GTK_WIDGET(gtk_tool_button_new_from_stock(GEANYSENDMAIL_STOCK_MAIL));
+ plugin_add_toolbar_item(geany_plugin, GTK_TOOL_ITEM(mailbutton));
+ ui_add_document_sensitive(mailbutton);
+#if GTK_CHECK_VERSION(2, 12, 0)
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(mailbutton), _("Send by mail"));
+#endif
+ g_signal_connect (G_OBJECT(mailbutton), "clicked", G_CALLBACK(send_as_attachment), NULL);
+ gtk_widget_show_all (mailbutton);
+}
+
+void cleanup_icon()
+{
+ if (mailbutton != NULL)
+ {
+ gtk_container_remove(GTK_CONTAINER (geany->main_widgets->toolbar), mailbutton);
+ }
+}
+
+
+static struct
+{
+ GtkWidget *entry;
+ GtkWidget *checkbox_icon_to_toolbar;
+ GtkWidget *checkbox_use_addressdialog;
+}
+pref_widgets;
+
+static void
+on_configure_response(G_GNUC_UNUSED GtkDialog *dialog, gint response, G_GNUC_UNUSED gpointer user_data)
+{
+ if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
+ {
+ GKeyFile *config = g_key_file_new();
+ gchar *config_dir = g_path_get_dirname(config_file);
+
+ g_free(mailer);
+ mailer = g_strdup(gtk_entry_get_text(GTK_ENTRY(pref_widgets.entry)));
+
+ if (icon_in_toolbar == FALSE &&
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_icon_to_toolbar)) == TRUE)
+ {
+ icon_in_toolbar = TRUE;
+ show_icon();
+ }
+ else if (icon_in_toolbar == TRUE &&
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_icon_to_toolbar)) == FALSE)
+ {
+ cleanup_icon();
+ icon_in_toolbar = FALSE;
+ }
+ else
+ {
+ icon_in_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_icon_to_toolbar));
+ }
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_use_addressdialog)) == TRUE)
+ use_address_dialog = TRUE;
+ else
+ use_address_dialog = FALSE;
+
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+ g_key_file_set_string(config, "tools", "mailer", mailer);
+ g_key_file_set_boolean(config, "tools", "address_usage", use_address_dialog);
+ g_key_file_set_boolean(config, "icon", "show_icon", icon_in_toolbar);
+
+ if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils_mkdir(config_dir, TRUE) != 0)
+ {
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR,
+ _("Plugin configuration directory could not be created."));
+ }
+ else
+ {
+ /* write config to file */
+ gchar *data = g_key_file_to_data(config, NULL, NULL);
+ utils_write_file(config_file, data);
+ g_free(data);
+ }
+ g_key_file_free(config);
+ g_free(config_dir);
+ }
+}
+
+GtkWidget *plugin_configure(GtkDialog *dialog)
+{
+ GtkWidget *label1, *label2, *vbox;
+
+ vbox = gtk_vbox_new(FALSE, 6);
+
+ /* add a label and a text entry to the dialog */
+ label1 = gtk_label_new(_("Path and options for the mail client:"));
+ gtk_widget_show(label1);
+ gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
+ pref_widgets.entry = gtk_entry_new();
+ gtk_widget_show(pref_widgets.entry);
+ if (mailer != NULL)
+ gtk_entry_set_text(GTK_ENTRY(pref_widgets.entry), mailer);
+
+ label2 = gtk_label_new(_("Note: \n\t\%f will be replaced by your file."\
+ "\n\t\%r will be replaced by recipient's email address."\
+ "\n\t\%b will be replaced by basename of a file"\
+ "\n\tExamples:"\
+ "\n\tsylpheed --attach \"\%f\" --compose \"\%r\""\
+ "\n\tmutt -s \"Sending \'\%b\'\" -a \"\%f\" \"\%r\""));
+ gtk_label_set_selectable(GTK_LABEL(label2), TRUE);
+ gtk_widget_show(label2);
+ gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
+
+ pref_widgets.checkbox_icon_to_toolbar = gtk_check_button_new_with_label(_("Showing icon in toolbar"));
+ ui_widget_set_tooltip_text(pref_widgets.checkbox_icon_to_toolbar,
+ _("Shows a icon in the toolbar to send file more easy."));
+ gtk_button_set_focus_on_click(GTK_BUTTON(pref_widgets.checkbox_icon_to_toolbar), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_icon_to_toolbar), icon_in_toolbar);
+ gtk_widget_show(pref_widgets.checkbox_icon_to_toolbar);
+
+ pref_widgets.checkbox_use_addressdialog = gtk_check_button_new_with_label(_
+ ("Using dialog for entering email address of recipients"));
+
+ gtk_button_set_focus_on_click(GTK_BUTTON(pref_widgets.checkbox_use_addressdialog), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref_widgets.checkbox_use_addressdialog), use_address_dialog);
+ gtk_widget_show(pref_widgets.checkbox_use_addressdialog);
+
+ gtk_container_add(GTK_CONTAINER(vbox), label1);
+ gtk_container_add(GTK_CONTAINER(vbox), pref_widgets.entry);
+ gtk_container_add(GTK_CONTAINER(vbox), label2);
+ gtk_box_pack_start(GTK_BOX(vbox), pref_widgets.checkbox_icon_to_toolbar, TRUE, FALSE, 2);
+ gtk_box_pack_start(GTK_BOX(vbox), pref_widgets.checkbox_use_addressdialog, TRUE, FALSE, 2);
+
+ gtk_widget_show(vbox);
+
+ g_signal_connect(dialog, "response", G_CALLBACK(on_configure_response), NULL);
+ return vbox;
+}
+
+/* Called by Geany to initialize the plugin */
+void plugin_init(GeanyData G_GNUC_UNUSED *data)
+{
+ GtkTooltips *tooltips = NULL;
+
+ GKeyFile *config = g_key_file_new();
+
+ gchar *kb_label = _("Send file by mail");
+
+ GtkWidget *menu_mail = NULL;
+
+ main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
+
+ config_file = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
+ "geanysendmail", G_DIR_SEPARATOR_S, "mail.conf", NULL);
+
+ /* Initialising options from config file */
+ g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+ mailer = g_key_file_get_string(config, "tools", "mailer", NULL);
+ address = g_key_file_get_string(config, "tools", "address", NULL);
+ use_address_dialog = g_key_file_get_boolean(config, "tools", "address_usage", NULL);
+ icon_in_toolbar = g_key_file_get_boolean(config, "icon", "show_icon", NULL);
+
+ g_key_file_free(config);
+
+ tooltips = gtk_tooltips_new();
+
+ add_stock_item();
+ if (icon_in_toolbar == TRUE)
+ {
+ show_icon();
+ }
+
+ /* Build up menu entry */
+ menu_mail = gtk_menu_item_new_with_mnemonic(_("_Mail document"));
+ gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_mail);
+ ui_widget_set_tooltip_text(menu_mail,
+ _("Sends the opened file as unzipped attachment by any mailer from your $PATH"));
+ g_signal_connect(G_OBJECT(menu_mail), "activate", G_CALLBACK(send_as_attachment), NULL);
+
+ /* setup keybindings */
+ keybindings_set_item(plugin_key_group, SENDMAIL_KB, key_send_as_attachment,
+ 0, 0, "send_file_as_attachment", kb_label, menu_mail);
+
+ gtk_widget_show_all(menu_mail);
+ ui_add_document_sensitive(menu_mail);
+ main_menu_item = menu_mail;
+}
+
+
+void plugin_cleanup()
+{
+ gtk_widget_destroy(main_menu_item);
+ cleanup_icon();
+ g_free(mailer);
+ g_free(address);
+ g_free(config_file);
+}
Copied: trunk/geany-plugins/geanysendmail/src/icon.h (from rev 698, trunk/geanysendmail/src/icon.h)
===================================================================
--- trunk/geany-plugins/geanysendmail/src/icon.h (rev 0)
+++ trunk/geany-plugins/geanysendmail/src/icon.h 2009-06-10 23:23:06 UTC (rev 699)
@@ -0,0 +1,50 @@
+/* GdkPixbuf RGBA C-Source image dump */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (mail_pixbuf)
+#endif
+#ifdef __GNUC__
+static const guint8 mail_pixbuf[] __attribute__ ((__aligned__ (4))) =
+#else
+static const guint8 mail_pixbuf[] =
+#endif
+{ ""
+ /* Pixbuf magic (0x47646b50) */
+ "GdkP"
+ /* length: header (24) + pixel_data (520) */
+ "\0\0\2\40"
+ /* pixdata_type (0x1010002) */
+ "\1\1\0\2"
+ /* rowstride (52) */
+ "\0\0\0""4"
+ /* width (13) */
+ "\0\0\0\15"
+ /* height (10) */
+ "\0\0\0\12"
+ /* pixel_data: */
+ "\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+ "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\377"
+ "GGG\377\365\365\365\377\365\365\365\377\365\365\365\377\365\365\365\377"
+ "\365\365\365\377\365\365\365\377\365\365\365\377\365\365\365\377\365"
+ "\365\365\377222\377\0\0\0\377\0\0\0\377\365\365\365\377GGG\377\365\365"
+ "\365\377\365\365\365\377\365\365\365\377\364\364\364\377\365\365\365"
+ "\377\364\364\364\377\364\364\364\377GGG\377\301\301\301\377\0\0\0\377"
+ "\0\0\0\377\365\365\365\377\352\352\352\377GGG\377\365\365\365\377\365"
+ "\365\365\377\364\364\364\377\365\365\365\377\364\364\364\377GGG\377\353"
+ "\353\353\377\252\252\252\377\0\0\0\377\0\0\0\377\365\365\365\377\365"
+ "\365\365\377\365\365\365\377GGG\377\365\365\365\377\365\365\365\377\365"
+ "\365\365\377===\377\357\357\357\377\353\353\353\377\353\353\353\377\0"
+ "\0\0\377\0\0\0\377\363\363\363\377\365\365\365\377\357\357\357\377GG"
+ "G\377\77\77\77\377\365\365\365\377FFF\377GGG\377\365\365\365\377\363"
+ "\363\363\377\275\275\275\377\0\0\0\377\0\0\0\377\365\365\365\377\364"
+ "\364\364\377GGG\377\365\365\365\377\365\365\365\377GGG\377\365\365\365"
+ "\377\363\363\363\377GGG\377\326\326\326\377\240\240\240\377\0\0\0\377"
+ "\0\0\0\377\365\365\365\377GGG\377\364\364\364\377\365\365\365\377\365"
+ "\365\365\377\362\362\362\377\364\364\364\377\363\363\363\377\272\272"
+ "\272\377222\377\351\351\351\377\0\0\0\377\0\0\0\377GGG\377\240\240\240"
+ "\377\240\240\240\377\214\214\214\377\277\277\277\377\272\272\272\377"
+ "\332\332\332\377\315\315\315\377\247\247\247\377\323\323\323\377(((\377"
+ "\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+ "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0"};
+
+
Modified: trunk/geany-plugins/po/POTFILES.in
===================================================================
--- trunk/geany-plugins/po/POTFILES.in 2009-06-10 22:54:08 UTC (rev 698)
+++ trunk/geany-plugins/po/POTFILES.in 2009-06-10 23:23:06 UTC (rev 699)
@@ -7,6 +7,9 @@
addons/src/addons.c
addons/src/ao_doclist.c
+# geanysendmail
+geanysendmail/src/geanysendmail.c
+
# Spell Check
spellcheck/src/speller.c
spellcheck/src/scplugin.c
Modified: trunk/geany-plugins/po/de.po
===================================================================
--- trunk/geany-plugins/po/de.po 2009-06-10 22:54:08 UTC (rev 698)
+++ trunk/geany-plugins/po/de.po 2009-06-10 23:23:06 UTC (rev 699)
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: geany-plugins 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-06-10 23:55+0200\n"
+"POT-Creation-Date: 2009-06-11 01:07+0200\n"
"PO-Revision-Date: 2009-03-09 20:50+1000\n"
"Last-Translator: Andrew Janke <a.janke(a)gmail.com>\n"
"Language-Team: \n"
@@ -36,7 +36,8 @@
msgid "Various small addons for Geany."
msgstr ""
-#: ../addons/src/addons.c:176 ../spellcheck/src/scplugin.c:143
+#: ../addons/src/addons.c:176 ../geanysendmail/src/geanysendmail.c:151
+#: ../geanysendmail/src/geanysendmail.c:312 ../spellcheck/src/scplugin.c:143
msgid "Plugin configuration directory could not be created."
msgstr ""
@@ -69,6 +70,117 @@
msgid "Show Document List"
msgstr ""
+#: ../geanysendmail/src/geanysendmail.c:47
+msgid "GeanySendMail"
+msgstr "GeanySendMail"
+
+#: ../geanysendmail/src/geanysendmail.c:47
+msgid ""
+"A little plugin to send the current file as attachment by user's favorite "
+"mailer"
+msgstr ""
+"Ein Plugin zum Senden einer Datei als Anhang unter Verwendung eines "
+"Mailprogrammes."
+
+#: ../geanysendmail/src/geanysendmail.c:107
+msgid "Recipient's Address"
+msgstr "Emailadresse des Empfängers"
+
+#: ../geanysendmail/src/geanysendmail.c:118
+msgid "Enter the recipient's e-mail address:"
+msgstr "Emailadresse des Empfängers:"
+
+#: ../geanysendmail/src/geanysendmail.c:166
+msgid "Filename placeholder not found. The executed command might have failed."
+msgstr ""
+"Konnte den Platzhalter für den Dateinamen (\\%s) nicht finden. Das "
+"angegebene Kommando könnte nicht korrekt ausgeführt worden sein."
+
+#: ../geanysendmail/src/geanysendmail.c:172
+msgid ""
+"Recipient address placeholder not found. The executed command might have "
+"failed."
+msgstr ""
+"Konnte den Platzhalter für den Mailempfänger nicht finden. Das angegebene "
+"Kommando könnte nicht korrekt ausgeführt worden sein."
+
+#: ../geanysendmail/src/geanysendmail.c:184
+msgid "Could not execute mailer. Please check your configuration."
+msgstr ""
+"Konnte das Mailprogramm nicht aufrufen. Bitte überprüfen Sie Ihre "
+"Einstellungen"
+
+#: ../geanysendmail/src/geanysendmail.c:196
+msgid "Please define a mail client first."
+msgstr "Bitte ein Mailprogramm angeben!"
+
+#: ../geanysendmail/src/geanysendmail.c:201
+msgid "File has to be saved before sending."
+msgstr "Die Datei muss vor dem Senden gespeichert werden."
+
+#: ../geanysendmail/src/geanysendmail.c:217
+msgid "Mail"
+msgstr "Mail"
+
+#: ../geanysendmail/src/geanysendmail.c:248
+msgid "Send by mail"
+msgstr "Per Mail senden"
+
+#. add a label and a text entry to the dialog
+#: ../geanysendmail/src/geanysendmail.c:333
+msgid "Path and options for the mail client:"
+msgstr "Pfad und Optionen für das Mailprogramm:"
+
+#: ../geanysendmail/src/geanysendmail.c:341
+msgid ""
+"Note: \n"
+"\t\\%f will be replaced by your file.\n"
+"\t\\%r will be replaced by recipient's email address.\n"
+"\t\\%b will be replaced by basename of a file\n"
+"\tExamples:\n"
+"\tsylpheed --attach \"\\%f\" --compose \"\\%r\"\n"
+"\tmutt -s \"Sending '\\%b'\" -a \"\\%f\" \"\\%r\""
+msgstr ""
+"Anmerkung: \n"
+"\t\\%f wird mit der zu sendenden Datei ersetzt.\t\n"
+"\t\\%r wird mit der Emailadresse des Empfängers ersetzt.\t\n"
+"\t\\%b wird mit dem reinen Dateinamen der zu sendenen Datei ersetzt.\n"
+"\tEin Beispiel könnte sein:\t\n"
+"\tsylpheed --attach \"\\%f\" --compose \"\\%r\"\n"
+"\tmutt -s \"Sending '\\%b'\" -a \"\\%f\" \"\\%r\""
+
+#: ../geanysendmail/src/geanysendmail.c:351
+msgid "Showing icon in toolbar"
+msgstr "Symbol in der Werkzeugleiste anzeigen"
+
+#: ../geanysendmail/src/geanysendmail.c:353
+msgid "Shows a icon in the toolbar to send file more easy."
+msgstr ""
+"Zeigt ein Symbol in der Werkzeugleiste an, sodass eine Datei einfacher "
+"versendet werden kann."
+
+#: ../geanysendmail/src/geanysendmail.c:359
+msgid "Using dialog for entering email address of recipients"
+msgstr ""
+"Zeigt einen Dialog zum Eingeben der Emailadresse des Empfängers der zu "
+"sendenden Datei"
+
+#: ../geanysendmail/src/geanysendmail.c:384
+msgid "Send file by mail"
+msgstr "Per Mail senden"
+
+#. Build up menu entry
+#: ../geanysendmail/src/geanysendmail.c:411
+msgid "_Mail document"
+msgstr "_Dokument versenden"
+
+#: ../geanysendmail/src/geanysendmail.c:414
+msgid ""
+"Sends the opened file as unzipped attachment by any mailer from your $PATH"
+msgstr ""
+"Sendet ein geöffnetes Dokument als ungepackten Anhang unter Verwendung eines "
+"Mailprogrammes."
+
#: ../spellcheck/src/speller.c:101
msgid "Try: "
msgstr ""
@@ -194,3 +306,12 @@
#: ../shiftcolumn/src/shiftcolumn.c:382 ../shiftcolumn/src/shiftcolumn.c:397
msgid "Shift Right"
msgstr "Auswahl nach Rechts verschieben"
+
+#~ msgid "_Mail"
+#~ msgstr "_Mail"
+
+#~ msgid "Note: \\%f will be replaced by your filename."
+#~ msgstr "Anmerkung: \\%f wird durch den Dateinamen ersetzt."
+
+#~ msgid "Mail Configuration"
+#~ msgstr "Maileinstellungen"
Modified: trunk/geany-plugins/po/geany-plugins.pot
===================================================================
--- trunk/geany-plugins/po/geany-plugins.pot 2009-06-10 22:54:08 UTC (rev 698)
+++ trunk/geany-plugins/po/geany-plugins.pot 2009-06-10 23:23:06 UTC (rev 699)
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-06-10 23:55+0200\n"
+"POT-Creation-Date: 2009-06-11 01:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
@@ -36,7 +36,8 @@
msgid "Various small addons for Geany."
msgstr ""
-#: ../addons/src/addons.c:176 ../spellcheck/src/scplugin.c:143
+#: ../addons/src/addons.c:176 ../geanysendmail/src/geanysendmail.c:151
+#: ../geanysendmail/src/geanysendmail.c:312 ../spellcheck/src/scplugin.c:143
msgid "Plugin configuration directory could not be created."
msgstr ""
@@ -69,6 +70,96 @@
msgid "Show Document List"
msgstr ""
+#: ../geanysendmail/src/geanysendmail.c:47
+msgid "GeanySendMail"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:47
+msgid ""
+"A little plugin to send the current file as attachment by user's favorite "
+"mailer"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:107
+msgid "Recipient's Address"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:118
+msgid "Enter the recipient's e-mail address:"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:166
+msgid "Filename placeholder not found. The executed command might have failed."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:172
+msgid ""
+"Recipient address placeholder not found. The executed command might have "
+"failed."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:184
+msgid "Could not execute mailer. Please check your configuration."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:196
+msgid "Please define a mail client first."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:201
+msgid "File has to be saved before sending."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:217
+msgid "Mail"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:248
+msgid "Send by mail"
+msgstr ""
+
+#. add a label and a text entry to the dialog
+#: ../geanysendmail/src/geanysendmail.c:333
+msgid "Path and options for the mail client:"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:341
+msgid ""
+"Note: \n"
+"\t\\%f will be replaced by your file.\n"
+"\t\\%r will be replaced by recipient's email address.\n"
+"\t\\%b will be replaced by basename of a file\n"
+"\tExamples:\n"
+"\tsylpheed --attach \"\\%f\" --compose \"\\%r\"\n"
+"\tmutt -s \"Sending '\\%b'\" -a \"\\%f\" \"\\%r\""
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:351
+msgid "Showing icon in toolbar"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:353
+msgid "Shows a icon in the toolbar to send file more easy."
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:359
+msgid "Using dialog for entering email address of recipients"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:384
+msgid "Send file by mail"
+msgstr ""
+
+#. Build up menu entry
+#: ../geanysendmail/src/geanysendmail.c:411
+msgid "_Mail document"
+msgstr ""
+
+#: ../geanysendmail/src/geanysendmail.c:414
+msgid ""
+"Sends the opened file as unzipped attachment by any mailer from your $PATH"
+msgstr ""
+
#: ../spellcheck/src/speller.c:101
msgid "Try: "
msgstr ""
Modified: trunk/geany-plugins/wscript
===================================================================
--- trunk/geany-plugins/wscript 2009-06-10 22:54:08 UTC (rev 698)
+++ trunk/geany-plugins/wscript 2009-06-10 23:23:06 UTC (rev 699)
@@ -69,7 +69,10 @@
Plugin('spellcheck',
[ 'spellcheck/src/gui.c', 'spellcheck/src/scplugin.c', 'spellcheck/src/speller.c' ], # source files
[ 'spellcheck', 'spellcheck/src' ], # include dirs
- [ [ 'enchant', '1.3', True ] ])
+ [ [ 'enchant', '1.3', True ] ]),
+ Plugin('geanysendmail',
+ [ 'geanysendmail/src/geanysendmail.c' ],
+ [ 'geanysendmail', 'geanysendmail/src' ])
]
'''
@@ -86,10 +89,6 @@
'geanydebug.c']), # source files
[ 'geanygdb', 'geanygdb/src' ] # include dirs
),
- Plugin('geanysendmail',
- [ 'geanysendmail/src/geanysendmail.c' ], # source files
- [ 'geanysendmail', 'geanysendmail/src' ] # include dirs
- ),
Plugin('geanydoc',
[ 'geanydoc/src/config.c', 'geanydoc/src/geanydoc.c' ], # source files
[ 'geanydoc', 'geanydoc/src' ] # include dirs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.