Skip to content

Instantly share code, notes, and snippets.

@atg
Created May 18, 2012 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atg/2725546 to your computer and use it in GitHub Desktop.
Save atg/2725546 to your computer and use it in GitHub Desktop.
//
// CHSymbolButtonImageAdditions.m
// Chocolat
//
// Created by Alex Gordon on 15/03/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "CHSymbolButtonImageAdditions.h"
#import "CHSymbolButtonImage.h"
@implementation CHSymbolButtonImage (Additions)
+ (NSArray *)symbolButtonImageFromIndexClass:(NSString *)indexClass drawBorder:(BOOL)drawBorder
{
CHSymbolButtonImageMask m = 0;
if (!drawBorder)
m |= CHSymbolButtonDontDrawBorder;
NSMutableDictionary *mappings = [NSMutableDictionary dictionary];
#define IMAPP(a, b) else if ([indexClass isEqual:a]) m |= CHSymbolButton##b
if (0);
//IMAPP(@"augroup", asm); // autocommand groups
//IMAPP(@"block data", asm); // block data
//IMAPP(@"chapter", asm); // chapters
IMAPP(@"class", ObjcClass); // classes
//IMAPP(@"command", asm); // user-defined commands
//IMAPP(@"common", asm); // common blocks
IMAPP(@"component", Variable | CHSymbolButtonInstanceScope); // type and structure components
IMAPP(@"constant", Constant); // constants (define, parameter, specparam)
IMAPP(@"Constructor", ObjcMethod); // A constructor
//IMAPP(@"cursor", asm); // cursors
IMAPP(@"define", Define); // defines
//IMAPP(@"domain", asm); // domains
//IMAPP(@"entity", asm); // entity declarations
//IMAPP(@"entry", asm); // entry points
IMAPP(@"enum constant", Constant | CHSymbolButtonInstanceScope); // enum constants
IMAPP(@"enum", Enum); // enum types
IMAPP(@"enumerator", Constant | CHSymbolButtonInstanceScope); // enumerators (values inside an enumeration)
IMAPP(@"event", Notification); // events
//IMAPP(@"Exception", asm); // An exception
//IMAPP(@"exception", asm); // exception declarations
IMAPP(@"externvar", Variable | CHSymbolButtonGlobalScope); // external and forward variable declarations
//IMAPP(@"feature", asm); // features
IMAPP(@"field", Variable | CHSymbolButtonInstanceScope); // fields
//IMAPP(@"format", asm); // formats
//IMAPP(@"fragment", asm); // fragment definitions
IMAPP(@"function", Function); // function definitions
IMAPP(@"functor", Function); // functor definitions
//IMAPP(@"index", asm); // indexes
IMAPP(@"interface", ObjcInterface); // interface contents, generic names, and operators
//IMAPP(@"label", asm); // block label
IMAPP(@"local", Variable | CHSymbolButtonLocalScope); // local, common block, and namelist variables
IMAPP(@"macro", Macro); // macro definitions
//IMAPP(@"map", asm); // maps
IMAPP(@"member", Variable | CHSymbolButtonInstanceScope); // class, struct, and union members
IMAPP(@"method", ObjcMethod); // methods
IMAPP(@"module", CppNamespace); // modules
//IMAPP(@"mxtag", asm); // mxtags
//IMAPP(@"namelist", asm); // namelists
IMAPP(@"namespace", CppNamespace); // imports
//IMAPP(@"net", asm); // net data types
IMAPP(@"package", CppNamespace); // package definitions
//IMAPP(@"paragraph", asm); // paragraphs
//IMAPP(@"part", asm); // parts
//IMAPP(@"pattern", asm); // all patterns
//IMAPP(@"port", asm); // ports
IMAPP(@"procedure", Function); // procedure prototypes and declarations
IMAPP(@"program", Function); // programs
IMAPP(@"property", ObjcProperty); // properties
IMAPP(@"prototype", Function); // function prototypes
//IMAPP(@"publication", asm); // publications
IMAPP(@"Record field", Constant | CHSymbolButtonInstanceScope); // A 'structure' field
IMAPP(@"record", Constant | CHSymbolButtonInstanceScope); // record definitions
//IMAPP(@"register", asm); // register data types
//IMAPP(@"section", asm); // sections
//IMAPP(@"service", asm); // services
//IMAPP(@"set", asm); // sets
IMAPP(@"signature", ObjcInterface); // signature declarations
IMAPP(@"singleton method", ObjcMethod | CHSymbolButtonStaticScope); // singleton methods
//IMAPP(@"slot", asm); // slots (fragment uses)
IMAPP(@"struct", Struct); // structure names
IMAPP(@"structure", Struct); // structure declarations
//IMAPP(@"subparagraph", asm); // subparagraphs
IMAPP(@"subroutine declaration", Function); // subroutine declarations
IMAPP(@"subroutine", Function); // subroutines
//IMAPP(@"subsection", asm); // subsections
//IMAPP(@"subsubsection", asm); // subsubsections
IMAPP(@"subtype", Typedef); // subtype definitions
//IMAPP(@"synonym", asm); // synonyms
//IMAPP(@"table", asm); // tables
//IMAPP(@"task", asm); // tasks
//IMAPP(@"trigger", asm); // triggers
IMAPP(@"type", Typedef); // derived types and structures
IMAPP(@"typedef", Typedef); // typedefs
IMAPP(@"union", Union); // union names
IMAPP(@"value", Constant); // value bindings
IMAPP(@"var", Variable | CHSymbolButtonGlobalScope); // Global variable
IMAPP(@"variable", Variable | CHSymbolButtonGlobalScope); // global variables
//IMAPP(@"view", asm); // views
//IMAPP(@"virtual", asm); // patterns (virtual or rebound)
if (m)
return [self symbolImageWithMask:m];
return nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment