Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
@codebrainz
codebrainz / gist:2341387
Created April 9, 2012 04:15
Convert newlines to \n and strip extra trailing whitespace
#include <stdio.h>
#include <string.h>
#define MAXLINE 16484
int main(void)
{
int c;
size_t len;
char line[MAXLINE] = { 0 };
@codebrainz
codebrainz / gist:2223810
Created March 28, 2012 05:11
Allow writing Geany plugins in C++
diff --git a/src/build.h b/src/build.h
index 4e92290..543c329 100644
--- a/src/build.h
+++ b/src/build.h
@@ -24,6 +24,8 @@
#ifndef GEANY_BUILD_H
#define GEANY_BUILD_H 1
+G_BEGIN_DECLS
+
@codebrainz
codebrainz / gist:2153795
Created March 21, 2012 22:29
CTAGS - Add D, GLSL, Ferite and Vala support (untested)
Index: parsers.h
===================================================================
--- parsers.h (revision 781)
+++ parsers.h (working copy)
@@ -26,11 +26,14 @@
CppParser, \
CsharpParser, \
CobolParser, \
+ DParser, \
DosBatchParser, \
@codebrainz
codebrainz / gist:2038371
Created March 14, 2012 18:15
Color scheme dialog view border and scrollbars
diff --git a/src/highlighting.c b/src/highlighting.c
index b87c18b..bf4ef1e 100644
--- a/src/highlighting.c
+++ b/src/highlighting.c
@@ -1339,6 +1339,9 @@ static void show_color_scheme_dialog(void)
GEANY_DEFAULT_DIALOG_HEIGHT * 7/4, GEANY_DEFAULT_DIALOG_HEIGHT);
swin = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin), GTK_SHADOW_ETCHED_IN);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
@codebrainz
codebrainz / gist:2016617
Created March 11, 2012 14:29
Color scheme and filedef version checking
diff --git a/data/colorschemes/alt.conf b/data/colorschemes/alt.conf
index 6d0e3dd..a4e8ae8 100644
--- a/data/colorschemes/alt.conf
+++ b/data/colorschemes/alt.conf
@@ -1,9 +1,10 @@
[theme_info]
name=Alternate
description=Alternate Geany color scheme with styles like the Geany <= 0.19 Python/script defaults with gray comments.
-version=0.01
-author=
@codebrainz
codebrainz / gist:1991520
Created March 7, 2012 06:45
Simple Mac application
/*
* A very basic Cocoa application.
*
* Save as "main.m" and compile in Terminal.app with:
* clang -o test main.m -framework AppKit -fobj-c-arc
*/
#import <AppKit/AppKit.h>
@interface TestView : NSView <NSWindowDelegate>
- (void)drawRect:(NSRect)rect;
@codebrainz
codebrainz / gist:1815807
Created February 13, 2012 10:22
Plugin to highlight escape sequences in Geany
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <geanyplugin.h>
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
GeanyFunctions *geany_functions;
PLUGIN_VERSION_CHECK(147)
@codebrainz
codebrainz / sci-shadow.patch
Created February 7, 2012 09:52
Scintilla GTK patch to add drop shadow below text
diff --git a/scintilla/gtk/PlatGTK.cxx b/scintilla/gtk/PlatGTK.cxx
index 90f5c07..2206847 100644
--- a/scintilla/gtk/PlatGTK.cxx
+++ b/scintilla/gtk/PlatGTK.cxx
@@ -45,6 +45,8 @@
#define USE_CAIRO 1
+static double shadow_colour;
+
@codebrainz
codebrainz / gist:1562301
Created January 4, 2012 21:39
Simple bounded queue
/*
* A very basic (and fast) fixed-sized queue data structure.
*
* Author: Matthew Brush <mbrush@codebrainz.ca>
* License: GNU Lesser General Public License, version 2.1
* Edit Date: January 4th, 2011
*/
#include <stdlib.h>
#include "fixedqueue.h"
@codebrainz
codebrainz / gist:1556120
Created January 3, 2012 18:08
Re-highlight type keywords on tab page switch
diff --git a/src/callbacks.c b/src/callbacks.c
index 7abd6b0..78c1023 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -621,6 +621,7 @@ G_MODULE_EXPORT void on_notebook1_switch_page_after(GtkNotebook *notebook, GtkNo
ui_document_show_hide(doc); /* update the document menu */
build_menu_update(doc);
sidebar_update_tag_list(doc, FALSE);
+ document_highlight_tags(doc);