Permalink
Browse files

geanydoc added to common build system

  • Loading branch information...
Yurand committed Aug 20, 2009
1 parent 16a5e83 commit 2da2748c973a984ed652b77f0f041e2a05e781a9
View
@@ -0,0 +1,9 @@
+AC_DEFUN([GP_CHECK_GEANYDOC],
+[
+ GP_STATUS_PLUGIN_ADD([GeanyDoc], [yes])
+ AC_CONFIG_FILES([
+ geanydoc/Makefile
+ geanydoc/src/Makefile
+ geanydoc/tests/Makefile
+ ])
+])
View
@@ -21,6 +21,7 @@ GP_CHECK_UNITTESTS(0.9.4)
dnl plugin checks
GP_CHECK_ADDONS
GP_CHECK_CODENAV
+GP_CHECK_GEANYDOC
GP_CHECK_GEANYGDB
GP_CHECK_GEANYLATEX
GP_CHECK_GEANYLIPSUM
View
@@ -0,0 +1 @@
+Yura Siamashka <yurand2@gmail.com>
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
No changes.
View
@@ -0,0 +1,4 @@
+include $(top_srcdir)/build/vars.auxfiles.mk
+
+SUBDIRS = src tests
+plugin = geanydoc
View
@@ -0,0 +1 @@
+See "README"
View
@@ -0,0 +1,122 @@
+.. |(version)| replace:: 0.5
+
+========
+geanydoc
+========
+
+.. contents::
+
+About
+=====
+
+Geanydoc is plugin for Geany IDE that allow execute specified commands on the
+current word at the cursor position. This word is passed as an argument to these commands.
+It allow either place output of these commands in geany buffer \*DOC\* or just
+execute external program. Geanydoc is intended to be used for searching documentation
+API in different sources.
+
+In order to use it you need Geany >= 0.16 or svn version.
+
+Usage
+=====
+
+geanydoc define 2 keyboard shortcut "Document current word" and "Document interactive"
+First you need to assign key to them in "Edit->Preferences->Keybinding->Doc".
+
+"Document current word" search documentation on the current word near cursor position.
+"Document interactive" search documentation on word you enter in interactive dialog.
+
+Settings
+========
+
+geanydoc allow to execute different commands for different filetypes. Use combobox
+to select type you need.
+
+"Put output in buffer" if you check this checkbox geanydoc will execute command wait for
+it's exit and place it's output in geany buffer. If you have this button unchecked
+geanydoc will simply spawn command and forgot about it.
+
+NOTE: if you have multiple command all commands but last are treated as "Put output in buffer"
+true. This checkbox is used only for last command.
+
+If you specify several commands, second command will be called only if first one didn't return
+something in output.
+
+License
+=======
+
+geanydoc is distributed under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 3 of the
+License, or (at your option) any later version. A copy of this license
+can be found in the file COPYING included with the source code of this
+program.
+
+Ideas, questions, patches and bug reports
+=========================================
+
+If you add something, or fix a bug, please send a patch (in 'diff -u'
+format) to the geany mailing list or to one of the authors listed bellow.
+
+Coding
+======
+
+Use static functions where possible.
+Try to use GLib types and functions - e.g. g_free instead of free and
+try to use only GLib 2.6 and GTK 2.6 functions.
+
+Style
+=====
+
+The file indent-all.sh contains information about
+the current code style. Run this script before commit.
+
+Download
+========
+
+The current version is:
+
+============= ================ ============================================================
+Geany Version GeanyDoc Version Download
+============= ================ ============================================================
+0.16 |(version)| http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.4.tar.gz
+============= ================ ============================================================
+
+Up to date source code can be downloaded here::
+
+ svn checkout http://geany-plugins.svn.sourceforge.net/svnroot/geany-plugins/trunk/geanydoc
+
+If you have old version of Geany installed you need old version of plugin as well. These versions of plugin
+are no longer supported and if you find bug in one of them, it won't be fixed unless you do it yourself.
+
+============= ================ ============================================================
+Geany Version GeanyDoc Version Download
+============= ================ ============================================================
+0.16 0.4 http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.4.tar.gz
+
+0.15 0.3 http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.3.tar.gz
+
+0.14 0.2 http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.2.tar.gz
+
+0.13 0.1 http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.1.tar.gz
+============= ================ ============================================================
+
+
+Gentoo
+------
+
+Gentoo ebuild is available here: http://bugs.gentoo.org/show_bug.cgi?id=218493
+
+Arch linux
+----------
+
+A package for Arch Linux is available here: http://aur.archlinux.org/packages.php?ID=16475
+
+Windows
+-------
+
+A windows installer is available here: http://users.cosmostv.by/yurand/geanydoc/geanydoc-0.4_setup.exe
+
+Author
+======
+Yura Siamashka http://users.cosmostv.by/yurand/cv.html
+
View
No changes.
View
@@ -0,0 +1,10 @@
+include $(top_srcdir)/build/vars.build.mk
+
+geanyplugins_LTLIBRARIES = geanydoc.la
+geanydoc_la_SOURCES = \
+ config.c \
+ geanydoc.c \
+ geanydoc.h
+
+geanydoc_la_CFLAGS = $(AM_CFLAGS)
+geanydoc_la_LIBADD = $(COMMONLIBS)
View
@@ -0,0 +1,132 @@
+/*
+ * config.c
+ *
+ * Copyright 2008 Yura Siamashka <yurand2@gmail.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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+
+#include "geany.h"
+#include "support.h"
+#include "plugindata.h"
+#include "document.h"
+#include "filetypes.h"
+#include "utils.h"
+#include "project.h"
+#include "pluginmacros.h"
+
+#include "geanydoc.h"
+
+extern GeanyData *geany_data;
+extern GeanyFunctions *geany_functions;
+
+const gchar defaults[] =
+ "[C]\n"
+ "internal = false\n"
+ "command0 = man -P \"col -b\" -S 2:3:5 '%w'\n"
+ "command1 = devhelp -s '%w'\n"
+ "[C++]\n"
+ "internal = false\n"
+ "command0 = man -P \"col -b\" -S 2:3:5 '%w'\n"
+ "command1 = devhelp -s '%w'\n"
+ "[PHP]\n"
+ "internal = false\n"
+ "command0 = firefox \"http://www.php.net/%w\"\n"
+ "[Sh]\n"
+ "internal = true\n"
+ "command0 = man -P \"col -b\" -S 1:4:5:6:7:8:9 '%w'\n"
+ "[Python]\n"
+ "internal = true\n"
+ "command0 = pydoc '%w'\n"
+ "[None]\n"
+ "internal = false\n" "command0 = firefox \"http://www.google.com/search?q=%w\"\n";
+
+static GKeyFile *config = NULL;
+static gchar *config_file = NULL;
+
+void
+config_init()
+{
+ config_file = g_build_filename(geany->app->configdir, "plugins", "geanydoc", NULL);
+ p_utils->mkdir(config_file, TRUE);
+
+ setptr(config_file, g_build_filename(config_file, "geanydoc.conf", NULL));
+
+ config = g_key_file_new();
+ if (!g_key_file_load_from_file(config, config_file, G_KEY_FILE_KEEP_COMMENTS, NULL))
+ {
+ g_key_file_load_from_data(config, defaults, sizeof(defaults),
+ G_KEY_FILE_KEEP_COMMENTS, NULL);
+ }
+}
+
+void
+config_uninit()
+{
+ g_free(config_file);
+ config_file = NULL;
+ g_key_file_free(config);
+ config = NULL;
+}
+
+GKeyFile *
+config_clone()
+{
+ GKeyFile *ret;
+ gchar *txt = g_key_file_to_data(config, NULL, NULL);
+ ret = g_key_file_new();
+ g_key_file_load_from_data(ret, txt, strlen(txt), G_KEY_FILE_KEEP_COMMENTS, NULL);
+ g_free(txt);
+ return ret;
+}
+
+void
+config_set(GKeyFile * cfg)
+{
+ gchar *data;
+
+ g_key_file_free(config);
+ config = cfg;
+
+ data = g_key_file_to_data(config, NULL, NULL);
+ p_utils->write_file(config_file, data);
+ g_free(data);
+}
+
+gchar *
+config_get_command(const gchar * lang, gint cmd_num, gboolean * intern)
+{
+ gchar *ret, *tmp;
+ gchar *key = g_strdup_printf("command%d", cmd_num);
+ ret = p_utils->get_setting_string(config, lang, key, "");
+ g_free(key);
+ if (!NZV(ret))
+ return ret;
+ key = g_strdup_printf("command%d", cmd_num + 1);
+ tmp = p_utils->get_setting_string(config, lang, key, "");
+ g_free(key);
+ if (NZV(tmp))
+ *intern = TRUE;
+ else
+ *intern = p_utils->get_setting_boolean(config, lang, "internal", FALSE);
+ g_free(tmp);
+ return ret;
+}
Oops, something went wrong.

0 comments on commit 2da2748

Please sign in to comment.