├── NAMESPACE ├── Win32 ├── lib32 │ └── libfreetype.a ├── lib64 │ └── libfreetype.a ├── README ├── freetype │ ├── config │ │ └── ftmodule.h │ ├── internal │ │ ├── services │ │ │ ├── svtteng.h │ │ │ ├── svwinfnt.h │ │ │ ├── svkern.h │ │ │ ├── svotval.h │ │ │ ├── svxf86nm.h │ │ │ ├── svpfr.h │ │ │ ├── svttglyf.h │ │ │ ├── svgxval.h │ │ │ ├── svbdf.h │ │ │ ├── svpostnm.h │ │ │ ├── svgldict.h │ │ │ ├── svpsinfo.h │ │ │ ├── svcid.h │ │ │ ├── svsfnt.h │ │ │ ├── svmm.h │ │ │ └── svttcmap.h │ │ ├── ftpic.h │ │ └── internal.h │ ├── ttunpat.h │ ├── ftsynth.h │ ├── ftlzw.h │ ├── ftgzip.h │ ├── ftbzip2.h │ ├── ftxf86.h │ ├── ftgasp.h │ └── tttags.h └── ft2build.h ├── src ├── Makevars └── Makevars.win ├── Cocoa ├── Resources │ ├── English.lproj │ │ └── InfoPlist.strings │ └── Info.plist ├── Acinonyx_Prefix.pch ├── CocoaApp.h ├── main.m ├── CocoaView.h ├── CocoaWindow.h ├── CocoaApp.mm ├── GLString.h └── CocoaView.mm ├── R ├── models.R ├── entry_points.R └── zzz.R ├── Acinonyx ├── RIF │ ├── REngine.cpp │ ├── RCalls.h │ ├── RObject.h │ ├── RValueHolder.h │ └── REngine.h ├── ATools.h ├── ACueMenu.h ├── ACueHotButton.h ├── ANotfier.h ├── AContainer.cpp ├── ACueBox.h ├── AOpenGL.h ├── ARMarker.h ├── AIndex.h ├── AValue.h ├── ACueButton.h ├── AVisualPrimitive.h ├── ALinearProjection.h ├── ATools.c ├── AQuery.h ├── APermutation.h ├── ATable.h ├── ARVector.h ├── ACueWidget.h ├── ASort.h ├── AObject.cpp ├── AStack.h ├── AVisual.h ├── ATypes.h └── AWidget.h ├── DESCRIPTION ├── man ├── itext.Rd ├── primitives.Rd ├── redraw.Rd ├── ilines.Rd ├── move.Rd ├── ipcp.Rd ├── ibar.Rd ├── ihist.Rd ├── iplot.Rd ├── add.Rd └── icontainer.Rd ├── GLUT ├── AGLUTWindow.h └── AGLUTWindow.cpp ├── X11 └── AX11Window.cpp └── Makefile /NAMESPACE: -------------------------------------------------------------------------------- 1 | useDynLib(Acinonyx) 2 | exportPattern("^[^\\.^A]+") 3 | -------------------------------------------------------------------------------- /Win32/lib32/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/att/iplots/master/Win32/lib32/libfreetype.a -------------------------------------------------------------------------------- /Win32/lib64/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/att/iplots/master/Win32/lib64/libfreetype.a -------------------------------------------------------------------------------- /src/Makevars: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -j8 -C .. Acinonyx.so && cp ../Acinonyx.so . && $(MAKE) -C .. clean 3 | -------------------------------------------------------------------------------- /src/Makevars.win: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C .. 'WINARCH=$(WIN)' Acinonyx.dll && cp ../Acinonyx.dll . && $(MAKE) -C .. clean 3 | -------------------------------------------------------------------------------- /Cocoa/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | NSHumanReadableCopyright = "© Simon Urbanek, 2008"; 4 | -------------------------------------------------------------------------------- /Cocoa/Acinonyx_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Acinonyx' target in the 'Acinonyx' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /R/models.R: -------------------------------------------------------------------------------- 1 | add.iPlot.lm <- function(x, obj, ...) { 2 | l <- iabline(obj, plot=x, col=4, ...) 3 | query(l) <- paste(c("y = ", " * x +"), format(coef(obj)[2:1], digits=3), collapse='') 4 | invisible(x) 5 | } 6 | 7 | -------------------------------------------------------------------------------- /Acinonyx/RIF/REngine.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * REngine.cpp 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/5/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "REngine.h" 11 | 12 | REngine * REngine::_main; 13 | -------------------------------------------------------------------------------- /Cocoa/CocoaApp.h: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaApp.h 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright 2008 Simon Urbanek. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CocoaApp : NSObject { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Cocoa/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright Simon Urbanek 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: Acinonyx 2 | Version: 3.0-0 3 | Title: iPlots eXtreme 4 | Author: Simon Urbanek 5 | Maintainer: Simon Urbanek 6 | Depends: R (>= 2.5.0) 7 | Description: iPlots eXtreme - high-performance interactive graphics for analysis of large data 8 | SystemRequirements: OpenGL, (X11 with GLX + GLU + FreeType | Windows | Mac OS X), GNU Make 9 | License: GPL-2 10 | URL: http://www.rforge.net/Acinonyx/ 11 | -------------------------------------------------------------------------------- /Cocoa/CocoaView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaView.h 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright 2008 Simon Urbanek. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AVisual.h" 11 | 12 | 13 | @interface CocoaView : NSOpenGLView { 14 | AVisual *visual; 15 | } 16 | 17 | - (id)initWithFrame:(NSRect)frame visual: (AVisual*) aVisual; 18 | - (void) drawRect: (NSRect) bounds; 19 | - (void) setAWindow: (AWindow*) aWin; // set the AWindow associated with this view 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /man/itext.Rd: -------------------------------------------------------------------------------- 1 | \name{itext} 2 | \alias{itext} 3 | \title{ 4 | Add text objects to an interactive plot 5 | } 6 | \description{ 7 | \code{itext} method adds text objects to an interactive plot. 8 | } 9 | \usage{ 10 | itext(x, ...) 11 | } 12 | \arguments{ 13 | \item{x}{objects representing the text} 14 | \item{\dots}{further optional arguments} 15 | } 16 | %\details{ 17 | %} 18 | \value{ 19 | undefined 20 | } 21 | \seealso{ 22 | \code{\link{ilines}} %, \code{\link{ipoints}} 23 | } 24 | %\examples{ 25 | %} 26 | \keyword{iplot} 27 | -------------------------------------------------------------------------------- /Cocoa/CocoaWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaWindow.h 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright 2008 Simon Urbanek. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CocoaView.h" 11 | 12 | //struct ACocoaWindow; 13 | 14 | class AVisual; 15 | 16 | @interface CocoaWindow : NSWindow 17 | { 18 | struct ACocoaWindow *aWindow; 19 | CocoaView *view; 20 | NSTimer *heartbeatTimer; 21 | } 22 | 23 | - (id) initWithContentRect: (NSRect) rect visual: (AVisual*) aVisual; 24 | - (void) redraw; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Acinonyx/RIF/RCalls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RCalls.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/18/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_RCALLS_H__ 11 | #define A_RCALLS_H__ 12 | 13 | #include "AObject.h" 14 | #include "RObject.h" 15 | 16 | extern "C" { 17 | void call_with_object(SEXP fun, AObject *o, const char *clazz); 18 | void call_notification(SEXP fun, AObject *dep, AObject *src, int nid); 19 | 20 | SEXP A2SEXP(AObject *o); 21 | AObject *SEXP2A(SEXP o); 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /man/primitives.Rd: -------------------------------------------------------------------------------- 1 | \name{primitives} 2 | \alias{primitives} 3 | \title{ 4 | Obtain interactive primitives from a plot. 5 | } 6 | \description{ 7 | \code{primitives} function retrieves the objects representing plot 8 | primitives in a plot. 9 | } 10 | \usage{ 11 | primitives(plot) 12 | } 13 | \arguments{ 14 | \item{plot}{plot to query} 15 | } 16 | \details{ 17 | Primitives are graphics objects added to an interactive plot 18 | explicitly using commands such as \code{\link{ilines}} or implicitly 19 | - e.g. by adding models to a plot. Primitives can be modified and 20 | interacted with. 21 | } 22 | \value{ 23 | list of primitives 24 | } 25 | %\seealso{ 26 | %} 27 | %\examples{ 28 | %} 29 | \keyword{iplot} 30 | -------------------------------------------------------------------------------- /GLUT/AGLUTWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GLUTWindow.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/18/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | #if __APPLE__ 11 | #include 12 | #else 13 | #include 14 | #endif 15 | 16 | #include "AWindow.h" 17 | 18 | class AGLUTWindow : public AWindow { 19 | protected: 20 | int win_id; 21 | public: 22 | AGLUTWindow(ARect frame); 23 | 24 | virtual void redraw() { 25 | glutSetWindow(win_id); 26 | glutPostRedisplay(); 27 | } 28 | 29 | virtual void glstring(APoint pt, APoint adj, const char *txt) { 30 | int len, i; 31 | //FIXME: implement adj, color? 32 | // all this doesn't really work - dunny why ... 33 | //glDisable(GL_LIGHTING); 34 | glRasterPos2f(pt.x, pt.y); 35 | len = (int) strlen(txt); 36 | for (i = 0; i < len; i++) { 37 | glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, txt[i]); 38 | } 39 | } 40 | 41 | }; 42 | -------------------------------------------------------------------------------- /Cocoa/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | info.urbanek.Acinonyx 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /man/redraw.Rd: -------------------------------------------------------------------------------- 1 | \name{redraw} 2 | \alias{redraw} 3 | \title{ 4 | Redraw an object 5 | } 6 | \description{ 7 | \code{redraw} method redraws an object to make sure its visual 8 | representation reflects its internal state. 9 | } 10 | \usage{ 11 | redraw(x, ...) 12 | } 13 | \arguments{ 14 | \item{x}{object to redraw} 15 | \item{\dots}{optional arguments} 16 | } 17 | \details{ 18 | Most object perform redraws implicitly, but sometimes is it more 19 | efficient to add or modify multiple objects without redrawing and 20 | issue a redraw at the end of such an operation. 21 | } 22 | \value{ 23 | \code{x} possibly (but not commonly) modified to reflect its current 24 | state. 25 | } 26 | %\seealso{ 27 | %% ~~objects to See Also as \code{\link{help}}, ~~~ 28 | %} 29 | \examples{ 30 | c = icontainer(frame=c(0, 0, 400, 300)) 31 | p = iplot(rnorm(100), rnorm(100), "x", "y", window=FALSE) 32 | 33 | # add the plot to the container and redraw the container 34 | redraw(c + p) 35 | } 36 | \keyword{iplot} 37 | -------------------------------------------------------------------------------- /man/ilines.Rd: -------------------------------------------------------------------------------- 1 | \name{ilines} 2 | \alias{ilines} 3 | \alias{ilines.default} 4 | \title{ 5 | Add lines to an interactive plot 6 | } 7 | \description{ 8 | \code{ilines} method adds lines objects to an interactive plot 9 | } 10 | \usage{ 11 | ilines(x, ...) 12 | \method{ilines}{default}(x, y, col, ..., plot = .Last.plot) 13 | } 14 | \arguments{ 15 | \item{x}{specification of the lines (generic) or numeric vector of the 16 | x coordinates (default method)} 17 | \item{y}{numeric vector of the y coordinates} 18 | \item{col}{color of the line} 19 | \item{\dots}{further optional arguments} 20 | \item{plot}{plot to add the lines to} 21 | } 22 | \details{ 23 | \code{ilines} is a shorthand for creating \code{iPolygon} object a and 24 | adding it to the plot. 25 | } 26 | \value{ 27 | object of the class \code{iPolygon} which has been added to the 28 | plot. The object can be used to subsequently modify the lines and 29 | their attributes. 30 | } 31 | %\seealso{ 32 | %% ~~objects to See Also as \code{\link{help}}, ~~~ 33 | %} 34 | %\examples{ 35 | %} 36 | \keyword{iplot} 37 | -------------------------------------------------------------------------------- /man/move.Rd: -------------------------------------------------------------------------------- 1 | \name{move} 2 | \alias{move} 3 | \alias{move.iVisual} 4 | \alias{move.iWindow} 5 | \title{ 6 | Move an object 7 | } 8 | \description{ 9 | \code{move} is a generic function to move an object. 10 | } 11 | \usage{ 12 | move(x, ...) 13 | \method{move}{iVisual}(x, xpos, ypos, redraw = TRUE, ...) 14 | \method{move}{iWindow}(x, xpos, ypos, ...) 15 | } 16 | \arguments{ 17 | \item{x}{object to move} 18 | \item{\dots}{argument specifying the nature of the move as applicable 19 | to the object and passed to its methods} 20 | \item{xpos}{x position} 21 | \item{ypos}{y position} 22 | \item{redraw}{if \code{TRUE} then \code{\link{redraw}}() is called 23 | implicitly after the move} 24 | } 25 | %\details{ 26 | %} 27 | \note{\code{iVisual} includes any visual object including plots, 28 | primitives and other graphics objects. The coordinates are interpreted 29 | with respect to the enclosing window (\code{iVisual}) or screen 30 | (\code{iWindow}). 31 | } 32 | \value{ 33 | \code{x} updated to reflect the move 34 | } 35 | %\seealso{ 36 | %} 37 | %\examples{ 38 | %} 39 | \keyword{iplot} 40 | -------------------------------------------------------------------------------- /Acinonyx/ATools.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ATools.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 3/2/08. 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_TOOLS_H 11 | #define A_TOOLS_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "ATypes.h" 18 | 19 | extern AColor backgroundColor, pointColor, hiliteColor, barColor, textColor, widgetColor, widgetHoverColor; 20 | 21 | extern long profilerTime, startupTime; 22 | 23 | extern unsigned int current_frame; 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | const char *value_printf(const char *fmt, ...); 30 | 31 | /*-- profiling support --*/ 32 | #ifdef PROFILE 33 | #define profStart() profilerTime=time_ms(); 34 | #define _prof(X) X; 35 | long time_ms(); 36 | void profReport(const char *fmt, ...); 37 | #else 38 | #define profStart() 39 | #define _prof(X) 40 | #endif 41 | 42 | #ifdef DEBUG 43 | void ALog(const char *fmt, ...); 44 | void AError(const char *fmt, ...); 45 | #else 46 | #define ALog(X, ...) 47 | #define AError(X, ...) 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* A_TOOLS_H */ 55 | -------------------------------------------------------------------------------- /R/entry_points.R: -------------------------------------------------------------------------------- 1 | .sym <- 2 | c("A_CONS", "A_ContainerAdd", "A_Describe", "A_EqualPtrs", "A_Init", 3 | "A_LineCreate", "A_MarkerAdd", "A_MarkerCallbacks", "A_MarkerCreate", 4 | "A_MarkerDependentCreate", "A_MarkerLength", "A_MarkerRemove", 5 | "A_MarkerRemoveAll", "A_MarkerSelect", "A_MarkerSelected", "A_MarkerSetValues", 6 | "A_MarkerSetVisible", "A_MarkerValues", "A_MarkerVisible", "A_PlotAddPrimitive", 7 | "A_PlotAddPrimitives", "A_PlotDoubleProperty", "A_PlotGetCaption", 8 | "A_PlotNewContext", "A_PlotPrimaryMarker", "A_PlotPrimitives", 9 | "A_PlotRedraw", "A_PlotRemoveAllPrimitives", "A_PlotRemovePrimitive", 10 | "A_PlotRemovePrimitives", "A_PlotSetCaption", "A_PlotSetDoubleProperty", 11 | "A_PlotSetValue", "A_PlotValue", "A_PolygonCreate", "A_PolygonSetPoints", 12 | "A_SegmentsCreate", "A_TextCreate", "A_VPGetCallback", "A_VPGetColor", 13 | "A_VPGetContext", "A_VPGetFill", "A_VPGetHidden", "A_VPGetQuery", 14 | "A_VPGetValue", "A_VPPlot", "A_VPRedraw", "A_VPSetCallback", 15 | "A_VPSetColor", "A_VPSetContext", "A_VPSetFill", "A_VPSetHidden", 16 | "A_VPSetQuery", "A_VPSetSelCallback", "A_VPSetValue", "A_VarRegister", 17 | "A_VisualGetFrame", "A_VisualSetFrame", "A_WindowCreate", "A_WindowMoveAndResize" 18 | ) 19 | -------------------------------------------------------------------------------- /man/ipcp.Rd: -------------------------------------------------------------------------------- 1 | \name{ipcp} 2 | \alias{ipcp} 3 | \alias{ipcp.default} 4 | \title{ 5 | Create an interactive parallel coordinates plot 6 | } 7 | \description{ 8 | \code{ipcp} creates an interactive parallel coordinates plot 9 | } 10 | \usage{ 11 | ipcp(x, ...) 12 | \method{ipcp}{default}(x, ..., window, frame, flags) 13 | } 14 | \arguments{ 15 | \item{x}{data frame, list of variables or the first column to plot} 16 | \item{\dots}{additional parameters or coordinates} 17 | \item{window}{window in which the plot will be placed or \code{FALSE} 18 | for off-screen plots. If not specified the plot will create a new 19 | window and fill it with itself.} 20 | \item{frame}{optional numeric vector with entries c(x, y, width, 21 | height)} 22 | \item{flags}{optional flags specifying the behavior when the 23 | enclosing window is resized - see \code{\link{icontainer}}} 24 | } 25 | %\details{ 26 | %} 27 | \value{ 28 | Object of the class \code{iPCP} (subclass of \code{iPlot}). 29 | } 30 | \section{Interaction}{ 31 | Left and right \code{Arrow} keys (aka cursor keys) can be used to 32 | control the opacity of the lines. 33 | } 34 | \seealso{ 35 | \code{\link{iplot}}, \code{\link{ihist}}, \code{\link{ibar}} 36 | } 37 | \examples{ 38 | data(mtcars) 39 | ipcp(mtcars) 40 | } 41 | \keyword{hplot} 42 | -------------------------------------------------------------------------------- /Acinonyx/ACueMenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACueMenu.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/1/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_CUE_MENU_H 11 | #define A_CUE_MENU_H 12 | 13 | #include "ACueBox.h" 14 | #include "ACueButton.h" 15 | 16 | // a box that will atuomatically create items to act as a menu 17 | class ACueMenu : public ACueBox { 18 | protected: 19 | AFloat next_line, line_height; 20 | public: 21 | 22 | #pragma mark --- constructor --- 23 | ACueMenu(AContainer *parent, ARect frame, unsigned int flags) : ACueBox(parent, frame, flags), next_line(0.0), line_height(14.0) { 24 | draw_background = false; 25 | OCLASS(ACueBox) 26 | } 27 | 28 | ACueButton *addItem(const char *name, const char *action) { 29 | _frame.y -= line_height; 30 | _frame.height += line_height; 31 | ARect f = _frame; 32 | ACueButton *b = new ACueButton(this, AMkRect(f.x, f.y + f.height - next_line - line_height, f.width, line_height - 1.0), AVF_DEFAULT|AVF_FIX_TOP|AVF_FIX_HEIGHT|AVF_XSPRING, name); 33 | b->click_action = action; 34 | b->centered_label = false; 35 | // b->cue_link_parent = true; 36 | b->setDelegate(delegate()); 37 | b->setManualCue(true); 38 | add(*b); 39 | b->release(); 40 | next_line += line_height; 41 | return b; 42 | } 43 | 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Acinonyx/RIF/RObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RObject.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 4/30/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_ROBJECT_H 11 | #define A_ROBJECT_H 12 | 13 | #include "AObject.h" 14 | 15 | #define R_NO_REMAP 1 16 | #define USE_RINTERNALS 1 17 | 18 | /*-- we need to re-map our DEBUG --*/ 19 | #ifdef DEBUG 20 | #define A_DEBUG 1 21 | #undef DEBUG 22 | #endif 23 | 24 | #include 25 | #include 26 | 27 | #ifdef DEBUG 28 | #undef DEBUG 29 | #ifdef A_DEBUG 30 | #define DEBUG 31 | #endif 32 | #endif 33 | 34 | class RObject : public AObject { 35 | SEXP ptr; 36 | public: 37 | RObject(SEXP rObj) : ptr(rObj) { 38 | R_PreserveObject(rObj); 39 | #ifdef ODEBUG 40 | printf("R %08x <- %08x (%d)\n", PTR2INT(this), PTR2INT(rObj), TYPEOF(rObj)); 41 | #endif 42 | OCLASS(RObject); 43 | } 44 | 45 | virtual ~RObject() { 46 | R_ReleaseObject(ptr); 47 | #ifdef ODEBUG 48 | printf("R %08x -> %08x\n", PTR2INT(this), PTR2INT(ptr)); 49 | #endif 50 | DCLASS(RObject) 51 | } 52 | 53 | vsize_t length() { return LENGTH(ptr); } 54 | int type() { return TYPEOF(ptr); } 55 | 56 | bool isNULL() { return (ptr == R_NilValue) || (ptr == NULL); } 57 | 58 | int *integers() { return INTEGER(ptr); } 59 | double *doubles() { return REAL(ptr); } 60 | 61 | SEXP value() { return ptr; } 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Acinonyx/RIF/RValueHolder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RValueHolder.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/24/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_RVALUEHOLDER_H__ 11 | #define A_RVALUEHOLDER_H__ 12 | 13 | #include "RObject.h" 14 | 15 | /** RValueHolder is just a simple class/interface that allows its subclasses to hold a R-side value. It manages the lifetime of the associate object to match the lifetime of the C++ object. */ 16 | class RValueHolder { 17 | protected: 18 | /** R object/value held in this object */ 19 | SEXP _value; 20 | public: 21 | /** create a new object that holds an R object/value - the value is protected from garbage collection until replaced or the value holder is freed. 22 | @param value value to hold (SEXP) */ 23 | RValueHolder(SEXP value = R_NilValue) : _value(value) { 24 | R_PreserveObject(_value); 25 | } 26 | 27 | virtual ~RValueHolder() { 28 | R_ReleaseObject(_value); 29 | } 30 | 31 | /** returns the SEXP value held by this object 32 | @return R object held by this object */ 33 | SEXP value() { return _value; } 34 | 35 | /** replaces the R value held by this object 36 | @param newValue value to replace the current value, the previously held value is released. */ 37 | void setValue(SEXP newValue) { 38 | R_PreserveObject(newValue); 39 | R_ReleaseObject(_value); 40 | _value = newValue; 41 | } 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /Win32/README: -------------------------------------------------------------------------------- 1 | iPlots eXtreme for Windows make use of the FreeType library to render 2 | text. FreeType is available from http://www.freetype.org/ 3 | 4 | Due to the complications involved in building FreeType binary and the 5 | general unavailability of such static build, this directory contains a 6 | full, static build of FreeType 2.4.6 library using Rtools 2.13 7 | toolchain for both 32-bit and 64-bit Windows. Since iPlots eXtreme are 8 | licensed under GPLv2 that makes those binaries also licensed under 9 | GPLv2 (otherwise FreeType has a choice of licenses). 10 | 11 | In order to build FreeType on Windows using the above toolchain, the 12 | "config.mk" file was created with the following content: 13 | 14 | include $(TOP_DIR)/builds/ansi/ansi-def.mk 15 | include $(TOP_DIR)/builds/compiler/gcc.mk 16 | include $(TOP_DIR)/builds/link_std.mk 17 | 18 | and the 32-bit build built simply by running "make" 19 | 20 | For the 64-bit build the file "builds/compiler/gcc.mk" was modified 21 | by replacing the line 22 | CC := gcc 23 | with 24 | CC := x86_64-w64-mingw32-gcc 25 | 26 | and the resulting libfreetype.a was post-processed by running 27 | x86_64-w64-mingw32-ranlib libfreetype.a 28 | 29 | The FreeType sources are available from the FreeType website and 30 | alternatively also from iPlots eXtreme files section on RForge.net: 31 | http://rforge.net/Acinonyx/files/freetype-2.4.6.tar.bz2 32 | 33 | --- 34 | Simon Urbanek 35 | Sep 2011 36 | -------------------------------------------------------------------------------- /Acinonyx/ACueHotButton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACueHotButton.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/1/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_CUE_HOTBUTTON_H 11 | #define A_CUE_HOTBUTTON_H 12 | 13 | #include "ACueButton.h" 14 | 15 | // A button that links to its cue children; its main purpose is to act as the cue surrogate for the children based on its hovering status. All its children must be cue widgets and they will be place in manual cue mode 16 | class ACueHotButton : public ACueButton { 17 | protected: 18 | virtual void setHovering(bool what) { 19 | if (hovering != what) { 20 | hovering = what; 21 | if (what) 22 | cueOn(); 23 | else 24 | cueOff(false, false, true); 25 | } 26 | ACueButton::setHovering(what); 27 | } 28 | 29 | public: 30 | #pragma mark --- constructor --- 31 | ACueHotButton(AContainer *parent, ARect frame, unsigned int flags, const char *label) : ACueButton(parent, frame, flags, label) { 32 | cue_link_children = true; 33 | OCLASS(ACueButton) 34 | } 35 | 36 | virtual void add(ACueWidget &obj) { 37 | obj.setManualCue(true); 38 | ACueButton::add(obj); 39 | } 40 | 41 | virtual bool cueOn() { 42 | if (!hovering) { // if not hovering, cue only this widget, no children 43 | cue_link_children = false; 44 | bool res = ACueButton::cueOn(); 45 | cue_link_children = true; 46 | return res; 47 | } 48 | return ACueButton::cueOn(); 49 | } 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Acinonyx/ANotfier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ANotfier.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/4/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_NOTIFIER_H 11 | #define A_NOTIFIER_H 12 | 13 | #include "AVector.h" 14 | 15 | class ANotifierInterface { 16 | protected: 17 | AMutableObjectVector *_dependents; 18 | 19 | public: 20 | ANotifierInterface(bool retain = false) : // do not retain dependents by default - we assume that they are registering themselves and thus retaning would prevent them from re-registering on dealloc 21 | _dependents(new AMutableObjectVector(16, retain)) { } 22 | 23 | virtual ~ANotifierInterface() { 24 | _dependents->release(); 25 | } 26 | 27 | virtual void add(AObject *obj) { 28 | ALog("%p: add %s", this, obj ? obj->describe() : ""); 29 | if (!_dependents->contains(obj)) 30 | _dependents->addObject(obj); 31 | } 32 | 33 | virtual void remove(AObject *obj) { 34 | ALog("%p: remove %s", this, obj ? obj->describe() : ""); 35 | _dependents->removeObject(obj); 36 | } 37 | 38 | virtual void removeAll() { 39 | ALog("%p: remove all", this); 40 | _dependents->removeAll(); 41 | } 42 | 43 | virtual void sendNotification(AObject *source, notifid_t nid) { 44 | vsize_t i = 0, n = _dependents->length(); 45 | while (i < n) { 46 | AObject *o = _dependents->objectAt(i++); 47 | ALog(" - notify: %s", o ? o->describe() : ""); 48 | if (o) o->notification(source, nid); 49 | } 50 | } 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Win32/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file registers the FreeType modules compiled into the library. 3 | * 4 | * If you use GNU make, this file IS NOT USED! Instead, it is created in 5 | * the objects directory (normally `/objs/') based on information 6 | * from `/modules.cfg'. 7 | * 8 | * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile 9 | * FreeType without GNU make. 10 | * 11 | */ 12 | 13 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 14 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 15 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 16 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 17 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 18 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 19 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 20 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 21 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 22 | FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 23 | FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 24 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 25 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 26 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 27 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 28 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) 29 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) 30 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 31 | 32 | /* EOF */ 33 | -------------------------------------------------------------------------------- /Acinonyx/AContainer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AContainer.cpp 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "AContainer.h" 11 | 12 | #include "AVisual.h" 13 | #include "AWindow.h" 14 | #include "ATools.h" 15 | 16 | void AWindow::draw() { 17 | AVisual *rv = (AVisual*) _rootVisual; 18 | if (rv) { 19 | // default font ("" stands for user/default font) 20 | // FIXME: 10.0 font size works well on OS X - check other platforms... 21 | rv->font("", 10.0); 22 | 23 | if (dirtyFlag && dirtyFlagLayer < _redraw_layer) 24 | _redraw_layer = dirtyFlagLayer; 25 | vsize_t layer = _redraw_layer; 26 | while (layer < _max_layers) { 27 | rv->clipOff(); 28 | setTextColor(::textColor); // default text color - black 29 | ALog(" - draw layer %d\n", layer); 30 | rv->draw(layer); 31 | freezeLayer(layer++); 32 | } 33 | ALog(" - draw layer %d (transient)\n", LAYER_TRANS); 34 | rv->draw(LAYER_TRANS); // the transient layer is not stored 35 | _redraw_layer = LAYER_TRANS; 36 | } 37 | } 38 | 39 | bool AWindow::event(AEvent event) 40 | { 41 | AVisual *rv = (AVisual*) _rootVisual; 42 | return rv ? rv->event(event) : false; 43 | } 44 | 45 | void AWindow::setFrame(ARect frame) { 46 | if (frame.width != _frame.width || frame.height != _frame.height) { 47 | _frame = frame; 48 | setRedrawLayer(LAYER_ROOT); 49 | AVisual *rv = (AVisual*) _rootVisual; 50 | if (rv) 51 | rv->moveAndResize(AMkRect(0.0, 0.0, frame.width, frame.height)); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Acinonyx/ACueBox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACueBox.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/1/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_CUE_BOX_H 11 | #define A_CUE_BOX_H 12 | 13 | #include "ACueWidget.h" 14 | 15 | // a simple box, mainly to be used for grouping of other widgets 16 | class ACueBox : public ACueWidget { 17 | protected: 18 | AFloat roundX, roundY; 19 | bool draw_border, draw_hover, draw_background; 20 | public: 21 | 22 | #pragma mark --- constructor --- 23 | ACueBox(AContainer *parent, ARect frame, unsigned int flags) : ACueWidget(parent, frame, flags, true), roundX(0.0), roundY(0.0), draw_border(true), draw_hover(false), draw_background(true) { OCLASS(ACueBox) } 24 | 25 | void setRoundCorners(AFloat cornerX = 8.0, AFloat cornerY = -1.0) { 26 | if (cornerY < 0.0) cornerY = cornerX; 27 | roundX = cornerX; 28 | roundY = cornerY; 29 | } 30 | 31 | void setDrawBorder(bool what) { 32 | draw_border = what; 33 | } 34 | 35 | void setDrawHover(bool what) { 36 | draw_hover = what; 37 | } 38 | 39 | void setDrawBackground(bool what) { 40 | draw_background = what; 41 | } 42 | 43 | virtual bool drawWidget() { 44 | if (ACueWidget::drawWidget()) { 45 | if (draw_background) { 46 | color((hovering && draw_hover) ? widgetHoverColor : widgetColor); 47 | roundRect(_frame, roundX, roundY); 48 | } 49 | if (draw_border) { 50 | color(0,0,0,0.5); 51 | roundRectO(_frame, roundX, roundY); 52 | } 53 | return true; 54 | } 55 | return false; 56 | } 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /Acinonyx/AOpenGL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AOpenGL.h 3 | * Acinonyx 4 | * This file is used to load OpenGL API in a centralized manner 5 | * 6 | * Created by Simon Urbanek on 9/1/11. 7 | * Copyright 2011 Simon Urbanek. All rights reserved. 8 | * 9 | * IMPORTANT: due to clashes is some headers files (w64-mingw) with R this 10 | * file must be included *before* any R header files! 11 | * 12 | */ 13 | 14 | #ifndef A_OPEN_GL 15 | #define A_OPEN_GL 16 | 17 | #if ( defined __APPLE__ ) && (! defined USE_X11 ) /* ACocoaWindow */ 18 | #include 19 | #include /* for polygon tessellation */ 20 | #else /* this includes X11 on OS X */ 21 | #include 22 | #ifndef WIN32 23 | #include 24 | #endif 25 | #include 26 | 27 | /* non-exact textures using AFreeType are currently broken so disable them for now */ 28 | #ifdef GL_TEXTURE_RECTANGLE_EXT 29 | #undef GL_TEXTURE_RECTANGLE_EXT 30 | #endif 31 | #ifdef GL_TEXTURE_RECTANGLE_ARB 32 | #undef GL_TEXTURE_RECTANGLE_ARB 33 | #endif 34 | 35 | #endif /* X11 or Win32 */ 36 | 37 | /* #define TEXTURE_RECTANGLE_ARB 0x84F5 (name "GL_ARB_texture_rectangle") -- it is equivalent to GL_TEXTURE_RECTANGLE_EXT (name "GL_EXT_texture_rectangle") on OS X */ 38 | 39 | #ifdef GL_TEXTURE_RECTANGLE_EXT 40 | #define A_TEXTURE_TYPE GL_TEXTURE_RECTANGLE_EXT 41 | #define A_EXACT_TEXTURE 1 42 | #elif defined GL_TEXTURE_RECTANGLE_ARB 43 | #define A_TEXTURE_TYPE GL_TEXTURE_RECTANGLE_ARB 44 | #define A_EXACT_TEXTURE 1 45 | #else 46 | #define A_TEXTURE_TYPE GL_TEXTURE_2D 47 | #define A_EXACT_TEXTURE 0 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Acinonyx/ARMarker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ARMarker.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 7/16/10. 6 | * Copyright 2010 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_R_MARKER 11 | #define A_R_MARKER 12 | 13 | #include "AMarker.h" 14 | 15 | /*** ARMarker is a marker with an additional list of R callbacks. Although those callbacks are also registered as notifiers the extra list is needed to filter out callbacks such that it is possible to remove them all without affecting other depenendents, find existing callbacks etc. */ 16 | class ARMarker : public AMarker { 17 | protected: 18 | AMutableObjectVector *callbacks_; 19 | 20 | public: 21 | ARMarker(vsize_t len) : AMarker(len) { 22 | callbacks_ = new AMutableObjectVector(8, true); 23 | OCLASS(ARMarker) 24 | } 25 | 26 | virtual ~ARMarker() { 27 | callbacks_->release(); 28 | } 29 | 30 | void addCallback(ARCallbackDependent *callback) { 31 | // add it to the dependents list 32 | add(callback); 33 | // but also tothe callbacks 34 | callbacks_->addObject(callback); 35 | } 36 | 37 | void removeCallback(ARCallbackDependent *callback) { 38 | if (callbacks_->contains(callback)) { 39 | callbacks_->removeObject(callback); 40 | remove(callback); 41 | } 42 | } 43 | 44 | AObjectVector *callbacks() { 45 | return (AObjectVector*) callbacks_; 46 | } 47 | 48 | void removeAllCallbacks() { 49 | vsize_t n = callbacks_->length(); 50 | if (n) { 51 | for (vsize_t i = 0; i < n; i++) 52 | remove(callbacks_->objectAt(i)); 53 | callbacks_->removeAll(); 54 | } 55 | } 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /man/ibar.Rd: -------------------------------------------------------------------------------- 1 | \name{ibar} 2 | \alias{ibar} 3 | \alias{ibar.factor} 4 | \title{ 5 | Create an interactive bar chart or spine plot 6 | } 7 | \description{ 8 | \code{ibar} method creates an interactive bar chart 9 | } 10 | \usage{ 11 | ibar(x, ...) 12 | \method{ibar}{factor}(x, xname = deparse(substitute(x)), ..., window, frame, flags) 13 | } 14 | %- maybe also 'usage' for other objects documented here. 15 | \arguments{ 16 | \item{x}{factor to plot} 17 | \item{xname}{name of the x variable} 18 | \item{\dots}{further optional arguments} 19 | \item{window}{window in which the plot will be placed. If not 20 | specified the plot will create a new window and fill it with 21 | itself.} 22 | \item{frame}{optional numeric vector with entries c(x, y, width, height)} 23 | \item{flags}{optional flags specifying the behavior when the 24 | enclosing window is resized} 25 | } 26 | %\details{ 27 | %} 28 | \value{ 29 | Returns an object of class \code{iBarchart} (a subclass of 30 | \code{iPlot}). This object it can be used to modify the parameters of 31 | the plot, to iteract with the plot and to add other components to the 32 | plot. 33 | } 34 | \note{It is possible to switch between barchart and spineplot using the 35 | \code{S} keyboard key or the \code{spines} virtual attribute 36 | (\code{TRUE} for spineplot, \code{FALSE} for barchart). 37 | } 38 | \seealso{ 39 | \code{\link{iplot}}, \code{\link{ihist}}, \code{\link{ipcp}} 40 | } 41 | \examples{ 42 | data(mtcars) 43 | attach(mtcars) 44 | iplot(hp, mpg) 45 | b = ibar(factor(cyl)) 46 | select(b, carb > 2) 47 | b$spines = TRUE 48 | } 49 | \keyword{hplot} 50 | -------------------------------------------------------------------------------- /Acinonyx/AIndex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AIndex.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 7/9/10. 6 | * Copyright 2010 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_INDEX_H 11 | #define A_INDEX_H 12 | 13 | #include "AObject.h" 14 | 15 | typedef int bmsrc_t; 16 | 17 | class ADenseBitmap : public AObject { 18 | protected: 19 | byte_t *bits; 20 | vsize_t vlen; 21 | public: 22 | ADenseBitmap(bmsrc_t *src, vsize_t n, bmsrc_t mask = 1) : vlen(n) { 23 | vsize_t bf_len = n >> 3, i = 0; 24 | if (n & 7) bf_len++; 25 | bits = (byte_t*) AAlloc(bf_len); 26 | AMEM(bits); 27 | byte_t cv = 0, *here = bits; 28 | for (; i < n; i++) { 29 | cv <<= 1; 30 | if (src[i] & mask) 31 | cv |= 1; 32 | if ((i & 7) == 7) { 33 | *(here++) = cv; 34 | cv = 0; 35 | } 36 | } 37 | if (i & 7) { 38 | while (i++ & 7) 39 | cv <<= 1; 40 | *here = cv; 41 | } 42 | OCLASS(ADenseBitmap) 43 | } 44 | 45 | virtual ~ADenseBitmap() { 46 | AFree(bits); 47 | DCLASS(ADenseBitmap) 48 | } 49 | 50 | vsize_t length() { 51 | return vlen; 52 | } 53 | 54 | bool at(vsize_t index) { 55 | if (index >= vlen) return false; 56 | vsize_t pos = index >> 3; 57 | byte_t bit = 1 << (index & 7); 58 | return ((bits[pos] & bit) != 0); 59 | } 60 | 61 | void restore(bmsrc_t *dst, bmsrc_t mask = 1) { 62 | vsize_t n = vlen; 63 | byte_t *here = bits, cv = 0x80; 64 | while (n--) { 65 | if (here[0] & cv) 66 | *(dst++) |= mask; 67 | else 68 | *(dst++) &= ~mask; 69 | cv >>= 1; 70 | if (!cv) { 71 | cv = 0x80; 72 | here++; 73 | } 74 | } 75 | } 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /man/ihist.Rd: -------------------------------------------------------------------------------- 1 | \name{ihist} 2 | \alias{ihist} 3 | \alias{ihist.default} 4 | \title{ 5 | Create an interactive histogram or spinogram 6 | } 7 | \description{ 8 | \code{ihist} creates an interactive histogram or spinogram 9 | } 10 | \usage{ 11 | ihist(x, ...) 12 | \method{ihist}{default}(x, xname = deparse(substitute(x)), ..., window, frame, flags) 13 | } 14 | \arguments{ 15 | \item{x}{a vector to create a histogram from} 16 | \item{xname}{name of the x variable} 17 | \item{\dots}{further optional arguments} 18 | \item{window}{window in which the plot will be placed or \code{FALSE} 19 | for off-screen plots. If not specified the plot will create a new 20 | window and fill it with itself.} 21 | \item{frame}{optional numeric vector with entries c(x, y, width, height)} 22 | \item{flags}{optional flags specifying the behavior when the 23 | enclosing window is resized - see \code{\link{icontainer}}} 24 | } 25 | %\details{ 26 | %} 27 | \value{ 28 | Object of the class \code{iHistogram}. Virtual attributes common to all 29 | plots are supported as well as additional ones mentioned below. 30 | } 31 | \section{Virtual Attributes}{ 32 | In addition ot the virutal attributes common to all plots histogram 33 | also support the following: 34 | \describe{ 35 | \item{bin.width}{bin width (scalar numeric} 36 | \item{bins}{number of bins} 37 | \item{anchor}{archor value fo the first bin} 38 | \item{spines}{\code{TRUE} for spinogram, \code{FALSE} for histogram 39 | (c.f. \code{\link{ibar}})} 40 | } 41 | } 42 | \seealso{ 43 | \code{\link{iplot}}, \code{\link{ibar}}, \code{\link{icontainer}} 44 | } 45 | \examples{ 46 | h = ihist(rnorm(1e5)) 47 | h$bin.width 48 | h$bins 49 | h$bin.width = 0.2 50 | } 51 | \keyword{hplot} 52 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onLoad <- function(libname, pkgname) { 2 | library.dynam("Acinonyx", pkgname, libname) 3 | 4 | ## resolve all known entry points (generated in R/entry_points.R) 5 | si <- getNativeSymbolInfo(.sym) 6 | env <- topenv() 7 | for (i in seq.int(.sym)) assign(.sym[[i]], si[[i]]$address, env) 8 | 9 | cfs <- is.loaded("A_SetCoreFontPath", PACKAGE = pkgname) 10 | 11 | # on Mac OS X without GUI start quartz() since is will initialize the app and event loop 12 | if (!cfs && length(grep("^darwin",R.version$os)) && !nzchar(Sys.getenv("R_GUI_APP_VERSION"))) 13 | try({require(grDevices);grDevices::quartz(); dev.off()}, silent=TRUE) 14 | 15 | # in order to avoid the mess involving linking to FontConfig, we jsut 16 | # try to use fc-match to get what we want - this may fail, though so we 17 | # ask for the "ix.core.font.path" option 18 | if (cfs) { 19 | fm <- getOption("ix.core.font.path") 20 | if (is.null(fm)) { 21 | fm <- try(system("fc-match -f '%{file}' Arial 2> /dev/null", intern = TRUE), silent=TRUE) 22 | if (inherits(fm, "try-error") && isTRUE(file.exists("/usr/X11/bin/fc-match"))) 23 | fm <- try(system("/usr/X11/bin/fc-match -f '%{file}' Arial 2> /dev/null", intern = TRUE), silent=TRUE) 24 | if (inherits(fm, "try-error") && isTRUE(file.exists("/usr/X11R6/bin/fc-match"))) 25 | fm <- try(system("/usr/X11R6/bin/fc-match -f '%{file}' Arial 2> /dev/null", intern = TRUE), silent=TRUE) 26 | if (inherits(fm, "try-error") || !length(fm)) Rf_error("Unable to find core font on your system. Try setting ix.core.font.path option to the full path of the TTF file or make sure Arial is installed and fc-match is accessible in your system.") 27 | } 28 | .Call("A_SetCoreFontPath", fm, PACKAGE = pkgname) 29 | } 30 | 31 | .Call(A_Init) 32 | } 33 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svtteng.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svtteng.h */ 4 | /* */ 5 | /* The FreeType TrueType engine query service (specification). */ 6 | /* */ 7 | /* Copyright 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVTTENG_H__ 20 | #define __SVTTENG_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_MODULE_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | /* 30 | * SFNT table loading service. 31 | */ 32 | 33 | #define FT_SERVICE_ID_TRUETYPE_ENGINE "truetype-engine" 34 | 35 | /* 36 | * Used to implement FT_Get_TrueType_Engine_Type 37 | */ 38 | 39 | FT_DEFINE_SERVICE( TrueTypeEngine ) 40 | { 41 | FT_TrueTypeEngineType engine_type; 42 | }; 43 | 44 | /* */ 45 | 46 | 47 | FT_END_HEADER 48 | 49 | 50 | #endif /* __SVTTENG_H__ */ 51 | 52 | 53 | /* END */ 54 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svwinfnt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svwinfnt.h */ 4 | /* */ 5 | /* The FreeType Windows FNT/FONT service (specification). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVWINFNT_H__ 20 | #define __SVWINFNT_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_WINFONTS_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_WINFNT "winfonts" 30 | 31 | typedef FT_Error 32 | (*FT_WinFnt_GetHeaderFunc)( FT_Face face, 33 | FT_WinFNT_HeaderRec *aheader ); 34 | 35 | 36 | FT_DEFINE_SERVICE( WinFnt ) 37 | { 38 | FT_WinFnt_GetHeaderFunc get_header; 39 | }; 40 | 41 | /* */ 42 | 43 | 44 | FT_END_HEADER 45 | 46 | 47 | #endif /* __SVWINFNT_H__ */ 48 | 49 | 50 | /* END */ 51 | -------------------------------------------------------------------------------- /Acinonyx/AValue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AValue.h - object wrapper around scalar values 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 3/2/08. 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "AObject.h" 11 | 12 | typedef enum { AVnull, AVchar, AVint, AVbool, AVfloat, AVdouble, AVlong, AVstr, AVptr, AVobj } AVtype_t; 13 | 14 | class AValue : public AObject { 15 | public: 16 | union AValue_u { 17 | int b; 18 | char c; 19 | int i; 20 | float f; 21 | double d; 22 | long l; 23 | char *s; 24 | void *v; 25 | AObject *o; 26 | } v; 27 | AVtype_t _type; 28 | 29 | AValue(int value) { v.i = value; _type = AVint; OCLASS(AValue) } 30 | AValue(AObject *obj) { v.o = obj; _type = AVobj; obj->retain(); OCLASS(AValue) } 31 | AValue(const char *str, bool copy) { v.s = (char*)(copy?strdup(str):str); _type = AVstr; OCLASS(AValue) } 32 | AValue(const char *str) { v.s = strdup(str); _type = AVstr; OCLASS(AValue) } 33 | AValue(float value) { v.f = value; _type = AVfloat; OCLASS(AValue) } 34 | AValue(double value) { v.d = value; _type = AVdouble; OCLASS(AValue) } 35 | AValue(bool value) { v.b = value; _type = AVbool; OCLASS(AValue) } 36 | virtual ~AValue() { 37 | switch (_type) { 38 | case AVobj: if (v.o) v.o->release(); break; 39 | case AVstr: if (v.s) AFree(v.s); break; 40 | } 41 | DCLASS(AValue); 42 | } 43 | 44 | // FIXME: to/from string conversions 45 | int asInt() { 46 | switch (_type) { 47 | case AVint: return v.i; 48 | case AVdouble: return (int)v.d; 49 | case AVfloat: return (int)v.f; 50 | case AVstr: return v.s?atoi(v.s):NA_int; 51 | } 52 | return NA_int; 53 | } 54 | 55 | float asFloat() { 56 | switch (_type) { 57 | case AVfloat: return v.f; 58 | case AVdouble: return (float)v.f; 59 | case AVint: return (float)v.i; 60 | } 61 | return 0.0f; 62 | } 63 | 64 | AObject *asObject() { 65 | return (_type == AVobj)?v.o:this; 66 | } 67 | }; 68 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svkern.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svkern.h */ 4 | /* */ 5 | /* The FreeType Kerning service (specification). */ 6 | /* */ 7 | /* Copyright 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVKERN_H__ 20 | #define __SVKERN_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_TRUETYPE_TABLES_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | #define FT_SERVICE_ID_KERNING "kerning" 29 | 30 | 31 | typedef FT_Error 32 | (*FT_Kerning_TrackGetFunc)( FT_Face face, 33 | FT_Fixed point_size, 34 | FT_Int degree, 35 | FT_Fixed* akerning ); 36 | 37 | FT_DEFINE_SERVICE( Kerning ) 38 | { 39 | FT_Kerning_TrackGetFunc get_track; 40 | }; 41 | 42 | /* */ 43 | 44 | 45 | FT_END_HEADER 46 | 47 | 48 | #endif /* __SVKERN_H__ */ 49 | 50 | 51 | /* END */ 52 | -------------------------------------------------------------------------------- /man/iplot.Rd: -------------------------------------------------------------------------------- 1 | \name{iplot} 2 | \alias{iplot} 3 | \alias{iplot.default} 4 | \title{ 5 | Creates an interactive plot 6 | } 7 | \description{ 8 | \code{iplot} method is called for its side-effect of creating an interactive 9 | plot. It is the interactive version of the well-known \code{\link{plot}} 10 | method. 11 | } 12 | \usage{ 13 | iplot(x, ...) 14 | \method{iplot}{default}(x, y, xname = deparse(substitute(x)), yname = deparse(substitute(y)), 15 | ..., window, frame, flags) 16 | } 17 | \arguments{ 18 | \item{x}{object to plot (in the generic) or the x coordinates for the 19 | default xy plot} 20 | \item{y}{y coordinates of the point to plot} 21 | \item{xname}{name of the x variable} 22 | \item{yname}{name of the y variable} 23 | \item{\dots}{further optional arguments} 24 | \item{window}{window in which the plot will be placed. If not 25 | spcieified the plot will create a new window and fill it with 26 | itself.} 27 | \item{frame}{optional numeric vector with entries c(x, y, width, height)} 28 | \item{flags}{optional flags specifying the behavior when the enclosing 29 | window is resized} 30 | } 31 | \details{ 32 | \code{iplot} is a generic method which can be implemented for 33 | numberous objects. 34 | 35 | \code{iplot.default} is the default implementation creating a 2d 36 | scatterplot. 37 | 38 | All plots of the class \code{iPlot} support virtual attributes. 39 | } 40 | \value{ 41 | Returns an object that is a subclass of \code{iPlot} (the actual class 42 | will depend on the type of plot created). This object it can be used to 43 | modify the parameters of the plot, to iteract with the plot and to add 44 | other components to the plot. 45 | } 46 | %\references{ 47 | %} 48 | %\author{ 49 | %} 50 | \seealso{ 51 | \code{\link{ihist}}, \code{\link{ibar}}, \code{\link{ipcp}} 52 | } 53 | \examples{ 54 | x = rnorm(1000) 55 | y = rnorm(1000)/4 + x 56 | p = iplot(x,y) 57 | p$xlim 58 | p$xlim=c(-3.5,3.5) 59 | m = lm(y ~ x) 60 | l = iabline(m) 61 | l$color = 2 62 | } 63 | \keyword{hplot} 64 | -------------------------------------------------------------------------------- /X11/AX11Window.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AX11Window.cpp 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 7/1/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifdef USE_X11 11 | 12 | #include "AX11Window.h" 13 | 14 | static int lastButtonState = 0; 15 | static APoint lastMousePos; 16 | 17 | AFreeType *sharedFT; 18 | AX11Display *mainDisplay; 19 | char *core_font_path; 20 | 21 | extern "C" { 22 | AX11Window *AX11_CreateWindow(AVisual *visual, APoint position); 23 | SEXP A_SetCoreFontPath(SEXP sPath); 24 | } 25 | 26 | AX11Window *AX11_CreateWindow(AVisual *visual, APoint position) 27 | { 28 | ARect frame = AMkRect(position.x, position.y, visual->frame().width, visual->frame().height); 29 | if (!mainDisplay) 30 | mainDisplay = new AX11Display(0); 31 | AX11Window *win = new AX11Window(frame, mainDisplay); 32 | win->setRootVisual(visual); 33 | visual->setWindow(win); 34 | return win; 35 | } 36 | 37 | void AX11Window::heartbeat() { 38 | if (dirtyFlag && dirtyFlag[0]) { 39 | dirtyFlag[0]++; 40 | if (dirtyFlag[0] > 2) 41 | redraw(); 42 | } 43 | } 44 | 45 | AX11Window* AX11Display::findWindow(Window w) { 46 | int i = 0; 47 | while (i < wins) { 48 | if (win_list[i] && win_list[i]->isXWindow(w)) 49 | return win_list[i]; 50 | i++; 51 | } 52 | return 0; 53 | } 54 | 55 | #if 0 56 | static DWORD WINAPI AWin32Heartbeat( LPVOID lpParam ) { 57 | AWin32Window *win = (AWin32Window*) lpParam; 58 | win->retain(); 59 | while (win->active()) { 60 | Sleep(200); 61 | win->heartbeat(); 62 | } 63 | } 64 | 65 | #endif 66 | 67 | /* -- this part must be last -- disable memory allocation tracking -- */ 68 | #ifdef strdup 69 | #undef strdup 70 | #endif 71 | #ifdef free 72 | #undef free 73 | #endif 74 | 75 | SEXP A_SetCoreFontPath(SEXP sPath) { 76 | if (TYPEOF(sPath) != STRSXP || LENGTH(sPath) < 1) 77 | Rf_error("invalid font path"); 78 | if (core_font_path) 79 | free(core_font_path); 80 | core_font_path = strdup(CHAR(STRING_ELT(sPath, 0))); 81 | return R_NilValue; 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /Acinonyx/ACueButton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACueButton.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/31/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_CUE_BUTTON_H 11 | #define A_CUE_BUTTON_H 12 | 13 | #include "ACueWidget.h" 14 | 15 | // A click-button 16 | class ACueButton : public ACueWidget { 17 | protected: 18 | char *label_; 19 | public: 20 | bool centered_label; // true if the label is to be placed in the center, otherwise it is left-aligned 21 | 22 | #pragma mark --- contructor --- 23 | ACueButton(AContainer *parent, ARect frame, unsigned int flags, const char *label) : ACueWidget(parent, frame, flags), label_(strdup(label ? label : "")), centered_label(true) { OCLASS(ACueButton) } 24 | 25 | virtual ~ACueButton() { 26 | AFree(label_); 27 | DCLASS(ACueButton); 28 | } 29 | 30 | const char *label() { return label_; } 31 | 32 | void setLabel(const char *newLabel) { 33 | if (newLabel == label_) return; 34 | AFree(label_); 35 | label_ = strdup(newLabel ? newLabel : ""); 36 | redrawWidget(); 37 | } 38 | 39 | virtual bool drawWidget() { 40 | if (ACueWidget::drawWidget()) { 41 | color(hovering ? widgetHoverColor : widgetColor); 42 | roundRect(_frame, 8.0); 43 | color(0,0,0,0.5); 44 | roundRectO(_frame, 8.0); 45 | if (*label_) { 46 | AColor orig_text = txtcolor(); 47 | if (hovering) 48 | txtcolor(0.0, 0.0, 0.0, 1.0); 49 | else 50 | txtcolor(1.0, 1.0, 1.0, 1.0); 51 | text(AMkPoint(_frame.x + (centered_label ? (_frame.width / 2) : 8.0), _frame.y + _frame.height / 2 + 1.5), label_, AMkPoint(centered_label ? 0.5: 0.0, 0.5)); 52 | txtcolor(orig_text); 53 | } 54 | return true; 55 | } 56 | return false; 57 | } 58 | 59 | virtual char *describe() { 60 | char *q = ACueWidget::describe(); 61 | if (strlen(q) + strlen(label_) + 5 >= sizeof(desc_buf)) return q; 62 | q[strlen(q) - 1] = 0; 63 | strcat(q, " '"); 64 | strcat(q, label_); 65 | strcat(q, "'>"); 66 | return q; 67 | } 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /man/add.Rd: -------------------------------------------------------------------------------- 1 | \name{add} 2 | \alias{add} 3 | \alias{add.default} 4 | \alias{add.iContainer} 5 | \alias{add.iPlot} 6 | \alias{add.primitive} 7 | \alias{delete} 8 | \title{ 9 | Add (or delete) objects into (or from) an enclosing object 10 | } 11 | \description{ 12 | \code{add} method adds objects into an enclosing object, \code{delete} 13 | removes objects from its parents. The exact semantics varies depending 14 | on the objects involved. 15 | } 16 | \usage{ 17 | add(x, ...) 18 | delete(x, ...) 19 | 20 | \method{add}{iPlot}(x, obj, ...) 21 | \method{add}{iContainer}(x, obj, ...) 22 | \method{add}{primitive}(x, obj, ...) 23 | \method{add}{default}(x, obj, ...) 24 | 25 | } 26 | %- maybe also 'usage' for other objects documented here. 27 | \arguments{ 28 | \item{x}{target object} 29 | \item{obj}{object to be added into the target} 30 | \item{\dots}{further optional arguments} 31 | } 32 | \details{ 33 | The add method is defined in a very general way. The actual 34 | implementatations usually forward the dispatch to the second argument 35 | (at least the one listed here do) such that \code{add} methods can be 36 | defined for any combination of classes for the \code{x} and \code{obj} 37 | objects. 38 | 39 | The use ranges from adding plots into containers, plot privitives to 40 | plots or even models to plots. The goal of this method (and its inverse 41 | \code{remove}) is to define the concept of adding or removing any kind 42 | of object or property that makes sense. 43 | } 44 | \value{ 45 | The value is \code{x} modified to accomodate the addition of 46 | \code{obj}. Depending on the semantics it may be (and often is) \code{x} 47 | itself. 48 | } 49 | \note{ 50 | The \code{+} and \code{-} operators are often dispatched to 51 | \code{add} and \code{delete} as a syntactic sugar for objects where 52 | such operation makes sense such that, for example, adding a model 53 | representation to a plot \code{p} can be done as \code{p + lm(y ~ x)}. 54 | 55 | (Also note that \code{remove} is a different non-generic function!) 56 | } 57 | %\seealso{ 58 | %} 59 | %\examples{ 60 | %} 61 | \keyword{iplot} 62 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svotval.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svotval.h */ 4 | /* */ 5 | /* The FreeType OpenType validation service (specification). */ 6 | /* */ 7 | /* Copyright 2004, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVOTVAL_H__ 20 | #define __SVOTVAL_H__ 21 | 22 | #include FT_OPENTYPE_VALIDATE_H 23 | #include FT_INTERNAL_VALIDATE_H 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | #define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate" 29 | 30 | 31 | typedef FT_Error 32 | (*otv_validate_func)( FT_Face volatile face, 33 | FT_UInt ot_flags, 34 | FT_Bytes *base, 35 | FT_Bytes *gdef, 36 | FT_Bytes *gpos, 37 | FT_Bytes *gsub, 38 | FT_Bytes *jstf ); 39 | 40 | 41 | FT_DEFINE_SERVICE( OTvalidate ) 42 | { 43 | otv_validate_func validate; 44 | }; 45 | 46 | /* */ 47 | 48 | 49 | FT_END_HEADER 50 | 51 | 52 | #endif /* __SVOTVAL_H__ */ 53 | 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Acinonyx/AVisualPrimitive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AVisualPrimitive.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 3/4/08. 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_VISUAL_PRIMITIVE_H 11 | #define A_VISUAL_PRIMITIVE_H 12 | 13 | #include "ARenderer.h" 14 | #include "AMarker.h" 15 | #include "AQuery.h" 16 | 17 | class APlot; 18 | 19 | #define FVP_HIDDEN 0x01 20 | 21 | typedef int sel_context_t; // selection context 22 | 23 | #define SEL_CONTEXT_NONE (-1) 24 | #define SEL_CONTEXT_DEFAULT (0) 25 | 26 | class AVisualPrimitive : public AObject { 27 | protected: 28 | AColor c, f; 29 | APlot *_plot; 30 | unsigned int flags; 31 | // selection context - the default context is the regular selection context 32 | sel_context_t selContext; 33 | public: 34 | AVisualPrimitive(APlot *plot) : _plot(plot), flags(0), selContext(SEL_CONTEXT_DEFAULT) { c = AMkColor(0.0, 0.0, 0.0, 1.0); f = AMkColor(0.0, 0.0, 0.0, 0.0); OCLASS(AVisualPrimitive) } 35 | void drawColor(AFloat r, AFloat g, AFloat b, AFloat a) { c = AMkColor(r,g,b,a); } 36 | void drawColor(AColor aColor) { c = aColor; } 37 | AColor drawColor() { return c; } 38 | void fillColor(AFloat r, AFloat g, AFloat b, AFloat a) { f = AMkColor(r,g,b,a); } 39 | void fillColor(AColor aColor) { f = aColor; } 40 | AColor fillColor() { return f; } 41 | void setAlpha(AFloat a) { 42 | if (a < 0.01) a = 0.01; 43 | if (c.a) c.a = a; 44 | if (f.a) f.a = a; 45 | } 46 | 47 | void setHidden(bool hf) { if (hf) flags |= FVP_HIDDEN; else flags &= ~FVP_HIDDEN; } 48 | bool hidden() { return (flags & FVP_HIDDEN) ? true : false; } 49 | 50 | APlot *plot() { return _plot; } 51 | void setPlot(APlot *aPlot) { _plot = aPlot; } // to be use inside APlot only! 52 | 53 | virtual void draw(ARenderer &renderer, vsize_t layer) = 0; 54 | 55 | virtual void update() { }; 56 | virtual void query(AQuery *query, int level) { } 57 | virtual bool containsPoint(APoint pt) { return false; } 58 | virtual bool intersects(ARect rect) { return false; } 59 | virtual bool select(AMarker *marker, int type) { return false; } 60 | 61 | sel_context_t context() { return selContext; } 62 | void setContext(sel_context_t newCtx) { selContext = newCtx; } 63 | 64 | 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svxf86nm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svxf86nm.h */ 4 | /* */ 5 | /* The FreeType XFree86 services (specification only). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVXF86NM_H__ 20 | #define __SVXF86NM_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* 29 | * A trivial service used to return the name of a face's font driver, 30 | * according to the XFree86 nomenclature. Note that the service data 31 | * is a simple constant string pointer. 32 | */ 33 | 34 | #define FT_SERVICE_ID_XF86_NAME "xf86-driver-name" 35 | 36 | #define FT_XF86_FORMAT_TRUETYPE "TrueType" 37 | #define FT_XF86_FORMAT_TYPE_1 "Type 1" 38 | #define FT_XF86_FORMAT_BDF "BDF" 39 | #define FT_XF86_FORMAT_PCF "PCF" 40 | #define FT_XF86_FORMAT_TYPE_42 "Type 42" 41 | #define FT_XF86_FORMAT_CID "CID Type 1" 42 | #define FT_XF86_FORMAT_CFF "CFF" 43 | #define FT_XF86_FORMAT_PFR "PFR" 44 | #define FT_XF86_FORMAT_WINFNT "Windows FNT" 45 | 46 | /* */ 47 | 48 | 49 | FT_END_HEADER 50 | 51 | 52 | #endif /* __SVXF86NM_H__ */ 53 | 54 | 55 | /* END */ 56 | -------------------------------------------------------------------------------- /Win32/ft2build.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ft2build.h */ 4 | /* */ 5 | /* FreeType 2 build and setup macros. */ 6 | /* (Generic version) */ 7 | /* */ 8 | /* Copyright 1996-2001, 2006 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /* */ 22 | /* This file corresponds to the default `ft2build.h' file for */ 23 | /* FreeType 2. It uses the `freetype' include root. */ 24 | /* */ 25 | /* Note that specific platforms might use a different configuration. */ 26 | /* See builds/unix/ft2unix.h for an example. */ 27 | /* */ 28 | /*************************************************************************/ 29 | 30 | 31 | #ifndef __FT2_BUILD_GENERIC_H__ 32 | #define __FT2_BUILD_GENERIC_H__ 33 | 34 | #include 35 | 36 | #endif /* __FT2_BUILD_GENERIC_H__ */ 37 | 38 | 39 | /* END */ 40 | -------------------------------------------------------------------------------- /Acinonyx/ALinearProjection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ALinearProjection.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/24/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | 11 | #include "AVector.h" 12 | 13 | typedef double coeff_t; 14 | 15 | // currently we're basing this on ADoubleVector because that's what we use for the final result, but is could as well be AFloatVector ... 16 | class ALinearProjection : public ADoubleVector { 17 | protected: 18 | vsize_t n_coeff; 19 | coeff_t *coeff; 20 | AObjectVector *vars; 21 | 22 | public: 23 | ALinearProjection(AMarker *m, AObjectVector *variables) : ADoubleVector(m, NULL, 0, false), n_coeff(0), coeff(0) { 24 | // FIXME: we should really make a copy of the vars vector since it might change while we use it 25 | vars = variables; 26 | if (vars) { 27 | vars->retain(); 28 | n_coeff = vars->length(); 29 | if (n_coeff) { 30 | coeff = (coeff_t*) AZAlloc(sizeof(coeff_t), n_coeff); 31 | AMEM(coeff); 32 | AVector *v = (AVector*) vars->objectAt(0); 33 | if (v) { 34 | _len = v->length(); 35 | _data = (double*) AAlloc(sizeof(double) * _len); 36 | AMEM(_data); 37 | } 38 | } 39 | } 40 | project(); 41 | OCLASS(ALinearProjection) 42 | } 43 | 44 | virtual ~ALinearProjection() { 45 | if (coeff) AFree(coeff); 46 | if (vars) vars->release(); 47 | DCLASS(ALinearProjection) 48 | } 49 | 50 | void project() { 51 | if (!n_coeff || !_len) return; 52 | memset(_data, 0, _len * sizeof(double)); // reset all to 0 53 | for(vsize_t i = 0; i < n_coeff; i++) { // each variable at a time add it to the _data 54 | AVector *v = (AVector*) vars->objectAt(i); 55 | if (v) { 56 | vsize_t n = _len; 57 | if (v->length() < n) n = v->length(); 58 | const double *d = v->asDoubles(); 59 | if (d) 60 | for (vsize_t j = 0; j < n; j++) 61 | _data[j] += coeff[i] * d[j]; 62 | } 63 | } 64 | } 65 | 66 | void setCoefficient(vsize_t i, coeff_t value, bool update=true) { 67 | if (i >= n_coeff) return; 68 | coeff[i] = value; 69 | if (update) project(); 70 | } 71 | 72 | void setCoefficients(coeff_t *c, bool update=true) { 73 | memcpy(coeff, c, sizeof(coeff_t) * n_coeff); 74 | if (update) project(); 75 | } 76 | 77 | vsize_t nCoefficients() { 78 | return n_coeff; 79 | } 80 | 81 | ADataVector *variable(vsize_t i) { 82 | return (ADataVector*) vars->objectAt(i); 83 | } 84 | }; 85 | -------------------------------------------------------------------------------- /Win32/freetype/ttunpat.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ttunpat.h */ 4 | /* */ 5 | /* Definitions for the unpatented TrueType hinting system */ 6 | /* */ 7 | /* Copyright 2003, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* Written by Graham Asher */ 11 | /* */ 12 | /* This file is part of the FreeType project, and may only be used, */ 13 | /* modified, and distributed under the terms of the FreeType project */ 14 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 15 | /* this file you indicate that you have read the license and */ 16 | /* understand and accept it fully. */ 17 | /* */ 18 | /***************************************************************************/ 19 | 20 | 21 | #ifndef __TTUNPAT_H__ 22 | #define __TTUNPAT_H__ 23 | 24 | 25 | #include 26 | #include FT_FREETYPE_H 27 | 28 | #ifdef FREETYPE_H 29 | #error "freetype.h of FreeType 1 has been loaded!" 30 | #error "Please fix the directory search order for header files" 31 | #error "so that freetype.h of FreeType 2 is found first." 32 | #endif 33 | 34 | 35 | FT_BEGIN_HEADER 36 | 37 | 38 | /*************************************************************************** 39 | * 40 | * @constant: 41 | * FT_PARAM_TAG_UNPATENTED_HINTING 42 | * 43 | * @description: 44 | * A constant used as the tag of an @FT_Parameter structure to indicate 45 | * that unpatented methods only should be used by the TrueType bytecode 46 | * interpreter for a typeface opened by @FT_Open_Face. 47 | * 48 | */ 49 | #define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) 50 | 51 | /* */ 52 | 53 | FT_END_HEADER 54 | 55 | 56 | #endif /* __TTUNPAT_H__ */ 57 | 58 | 59 | /* END */ 60 | -------------------------------------------------------------------------------- /Acinonyx/ATools.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ATools.c 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 3/2/08. 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #include /* for vsnprintf for value_printf() */ 11 | #include 12 | 13 | #include "ATools.h" 14 | 15 | // common color scheme 16 | AColor backgroundColor = { 1.0, 1.0, 0.7, 1.0 }; 17 | AColor pointColor = { 0.0, 0.0, 0.0, 1.0 }; 18 | AColor textColor = { 0.0, 0.0, 0.0, 1.0 }; 19 | AColor hiliteColor = { 1.0, 0.0, 0.0, 1.0 }; 20 | AColor barColor = { 0.8, 0.8, 0.8, 1.0 }; 21 | AColor widgetColor = { 0.0, 0.0, 0.0, 0.5 }; 22 | AColor widgetHoverColor= { 0.9, 0.9, 0.9, 0.5 }; 23 | 24 | /* FIXME: intitallize NA_xx values */ 25 | /* declared in ATypes.h */ 26 | double NA_double; 27 | float NA_float; 28 | 29 | char value_buf[128]; 30 | 31 | const char *value_printf(const char *fmt, ...) { 32 | va_list v; 33 | va_start(v, fmt); 34 | vsnprintf(value_buf, sizeof(value_buf), fmt, v); 35 | va_end(v); 36 | return (const char*) value_buf; 37 | } 38 | 39 | unsigned int current_frame; 40 | 41 | #ifdef DEBUG 42 | 43 | void AError(const char *fmt, ...) { 44 | va_list v; 45 | va_start(v, fmt); 46 | fprintf(stderr, "*** ERROR (set breakpoint on AError to trace)\n"); 47 | vfprintf(stderr, fmt, v); 48 | va_end(v); 49 | fprintf(stderr, "\n"); 50 | } 51 | 52 | void ALog(const char *fmt, ...) { 53 | #ifdef PROFILE 54 | long npt = time_ms(); 55 | if (startupTime == 0L) startupTime = npt; 56 | fprintf(stderr, "[%4ld.%03ld] ", (npt - startupTime) / 1000, (npt - startupTime) % 1000); 57 | #endif 58 | va_list v; 59 | va_start(v, fmt); 60 | vfprintf(stderr, fmt, v); 61 | va_end(v); 62 | fprintf(stderr, "\n"); 63 | } 64 | #endif 65 | 66 | #ifdef PROFILE 67 | #include 68 | #include 69 | 70 | long time_ms() { 71 | #ifdef Win32 72 | return 0; /* in Win32 we have no gettimeofday :( */ 73 | #else 74 | struct timeval tv; 75 | gettimeofday(&tv,0); 76 | return (tv.tv_usec/1000)+(tv.tv_sec*1000); 77 | #endif 78 | } 79 | 80 | long profilerTime, startupTime; 81 | 82 | void profReport(const char *fmt, ...) { 83 | long npt = time_ms(); 84 | if (startupTime == 0L) startupTime = profilerTime; 85 | fprintf(stderr, "[%4ld.%03ld] ", (npt - startupTime) / 1000, (npt - startupTime) % 1000); 86 | va_list v; 87 | va_start(v, fmt); 88 | vfprintf(stderr, fmt, v); 89 | va_end(v); 90 | fprintf(stderr, " %ld ms\n", npt - profilerTime); 91 | profilerTime = npt; 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /Acinonyx/AQuery.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AQuery.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 7/2/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_QUERY_H__ 11 | #define A_QUERY_H__ 12 | 13 | #include "AVisual.h" 14 | #include "AContainer.h" 15 | 16 | class AQuery : public AVisual { 17 | protected: 18 | char *q_text; 19 | ASize text_bbox; 20 | AFloat margins; 21 | public: 22 | AQuery(AContainer *parent) : AVisual(parent, AMkRect(0,0,0,0), 0), q_text(0), margins(5.0) { 23 | OCLASS(AQuery) 24 | } 25 | 26 | void setText(const char *txt) { 27 | if (q_text) AFree(q_text); 28 | if (txt) { 29 | q_text = strdup(txt); 30 | text_bbox = bbox(txt); 31 | _frame.width = text_bbox.width + 2.0 * margins; 32 | _frame.height = text_bbox.height + 2.0 * margins; 33 | redraw(); 34 | } else { 35 | q_text = 0; 36 | _frame.width = 0; 37 | _frame.height = 0; 38 | setHidden(true); 39 | } 40 | } 41 | 42 | /** resets the query by removing all content. This method should be called when building up a new query. Implicitly it sets the status of the query to hidden, but it doesn't cause a redraw. */ 43 | void reset() { 44 | setHidden(true); 45 | if (q_text) { AFree(q_text); q_text = 0; } 46 | } 47 | 48 | /** move the query to a given point. The point is adjusted based on its size if it would not fit in the window. This method causes a redraw. 49 | * @param pt point at which the query shall be displayed (if visible) */ 50 | void move(APoint pt) { 51 | _frame.x = pt.x; 52 | _frame.y = pt.y; 53 | if (window()) { // if there is a window, let's see if we fit in and adjust the position if we don't 54 | ARect wf = window()->frame(); 55 | if (_frame.x + _frame.width > wf.width - 2.0) _frame.x = wf.width - _frame.width - 2.0; 56 | if (_frame.y + _frame.height > wf.height - 2.0) _frame.y = wf.height - _frame.height - 2.0; 57 | } 58 | redraw(); 59 | } 60 | 61 | APoint point() { 62 | return AMkPoint(_frame.x, _frame.y); 63 | } 64 | 65 | const char *text() { 66 | return q_text; 67 | } 68 | 69 | virtual void draw(vsize_t layer) { 70 | if (layer != LAYER_TRANS) return; 71 | color(AMkColor(0,0,0,0.3)); 72 | ARect r = _frame; r.x += 5.0; r.y -= 5.0; // shadow 73 | rect(r); 74 | color(backgroundColor); 75 | rect(_frame); 76 | color(AMkColor(0,0,0,1)); 77 | rectO(_frame); 78 | ARenderer::text(AMkPoint(_frame.x + margins, _frame.y + margins), q_text, AMkPoint(0, 0), 0.0); 79 | } 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svpfr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svpfr.h */ 4 | /* */ 5 | /* Internal PFR service functions (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVPFR_H__ 20 | #define __SVPFR_H__ 21 | 22 | #include FT_PFR_H 23 | #include FT_INTERNAL_SERVICE_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_PFR_METRICS "pfr-metrics" 30 | 31 | 32 | typedef FT_Error 33 | (*FT_PFR_GetMetricsFunc)( FT_Face face, 34 | FT_UInt *aoutline, 35 | FT_UInt *ametrics, 36 | FT_Fixed *ax_scale, 37 | FT_Fixed *ay_scale ); 38 | 39 | typedef FT_Error 40 | (*FT_PFR_GetKerningFunc)( FT_Face face, 41 | FT_UInt left, 42 | FT_UInt right, 43 | FT_Vector *avector ); 44 | 45 | typedef FT_Error 46 | (*FT_PFR_GetAdvanceFunc)( FT_Face face, 47 | FT_UInt gindex, 48 | FT_Pos *aadvance ); 49 | 50 | 51 | FT_DEFINE_SERVICE( PfrMetrics ) 52 | { 53 | FT_PFR_GetMetricsFunc get_metrics; 54 | FT_PFR_GetKerningFunc get_kerning; 55 | FT_PFR_GetAdvanceFunc get_advance; 56 | 57 | }; 58 | 59 | /* */ 60 | 61 | FT_END_HEADER 62 | 63 | #endif /* __SVPFR_H__ */ 64 | 65 | 66 | /* END */ 67 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svttglyf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svttglyf.h */ 4 | /* */ 5 | /* The FreeType TrueType glyph service. */ 6 | /* */ 7 | /* Copyright 2007 by David Turner. */ 8 | /* */ 9 | /* This file is part of the FreeType project, and may only be used, */ 10 | /* modified, and distributed under the terms of the FreeType project */ 11 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 | /* this file you indicate that you have read the license and */ 13 | /* understand and accept it fully. */ 14 | /* */ 15 | /***************************************************************************/ 16 | 17 | #ifndef __SVTTGLYF_H__ 18 | #define __SVTTGLYF_H__ 19 | 20 | #include FT_INTERNAL_SERVICE_H 21 | #include FT_TRUETYPE_TABLES_H 22 | 23 | 24 | FT_BEGIN_HEADER 25 | 26 | 27 | #define FT_SERVICE_ID_TT_GLYF "tt-glyf" 28 | 29 | 30 | typedef FT_ULong 31 | (*TT_Glyf_GetLocationFunc)( FT_Face face, 32 | FT_UInt gindex, 33 | FT_ULong *psize ); 34 | 35 | FT_DEFINE_SERVICE( TTGlyf ) 36 | { 37 | TT_Glyf_GetLocationFunc get_location; 38 | }; 39 | 40 | #ifndef FT_CONFIG_OPTION_PIC 41 | 42 | #define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ 43 | static const FT_Service_TTGlyfRec class_ = \ 44 | { \ 45 | get_location_ \ 46 | }; 47 | 48 | #else /* FT_CONFIG_OPTION_PIC */ 49 | 50 | #define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ 51 | void \ 52 | FT_Init_Class_##class_( FT_Service_TTGlyfRec* clazz ) \ 53 | { \ 54 | clazz->get_location = get_location_; \ 55 | } 56 | 57 | #endif /* FT_CONFIG_OPTION_PIC */ 58 | 59 | /* */ 60 | 61 | 62 | FT_END_HEADER 63 | 64 | #endif /* __SVTTGLYF_H__ */ 65 | 66 | 67 | /* END */ 68 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ## a simple Makefile to build Acinonyx as an R dynamic library 2 | ## (requires GNU Make compatible due to ifeq/endif) 3 | ## 4 | ## Default configurations: 5 | ## Windows : Win32 graphapp UI (built-in FreeType) 6 | ## Mac OS X : Cocoa 7 | ## others : X11 + FreeType 8 | ## 9 | ## GLUT support is optional, unused and untested 10 | 11 | ASRC = Acinonyx/AContainer.cpp Acinonyx/AObject.cpp Acinonyx/RIF/RCalls.cpp Acinonyx/RIF/REngine.cpp Acinonyx/RIF/RGrDevice.cpp 12 | CSRC = Acinonyx/ATools.c 13 | MMSRC = Cocoa/CocoaApp.mm Cocoa/CocoaView.mm Cocoa/CocoaWindow.mm 14 | MSRC = Cocoa/GLString.m 15 | GLUTSRC = GLUT/AGLUTWindow.cpp 16 | X11SRC = X11/AX11Window.cpp 17 | WINSRC = Win32/AWin32Window.cpp 18 | RSRC=$(shell ls R/*.R | grep -v entry) 19 | 20 | REP=R/entry_points.R 21 | 22 | OBJ = $(ASRC:%.cpp=%.o) $(CSRC:%.c=%.o) $(MMSRC:%.mm=%.o) $(MSRC:%.m=%.o) $(WINSRC:%.cpp=%.o) $(X11SRC:%.cpp=%.o) 23 | 24 | FOBJ=AContainer.o AObject.o ATools.o CocoaApp.o CocoaView.o CocoaWindow.o RCalls.o REngine.o GLString.o AWin32Window.o AX11Window.o 25 | 26 | FTCF=`freetype-config --cflags` 27 | FTLIB=`freetype-config --libs` 28 | 29 | OS=$(shell uname || echo Windows) 30 | ifeq ($(R_HOME),) 31 | RBIN=R 32 | else 33 | RBIN=$(R_HOME)/bin/R 34 | endif 35 | 36 | ifeq ($(WINARCH),) 37 | WINARCH=32 38 | endif 39 | 40 | ifeq ($(OS),Darwin) 41 | ifeq ($(USE_X11),1) 42 | Acinonyx.so: $(ASRC) $(CSRC) $(X11SRC) 43 | PKG_MAKE_DSYM=1 PKG_LIBS='-L/usr/X11/lib -lX11 -lGLU -lGL $(FTLIB)' PKG_CPPFLAGS='$(DEBUGCPPFLAGS) -IAcinonyx -IAcinonyx/RIF -IX11 -I/usr/X11/include -DUSE_X11 $(FTCF)' R CMD SHLIB -o $@ $^ 44 | else 45 | Acinonyx.so: $(ASRC) $(CSRC) $(MMSRC) $(MSRC) 46 | PKG_MAKE_DSYM=1 PKG_CPPFLAGS='$(DEBUG) -IAcinonyx -IAcinonyx/RIF -ICocoa' PKG_LIBS='-framework Cocoa -framework OpenGL' R CMD SHLIB -o $@ $^ 47 | endif 48 | else 49 | Acinonyx.so: $(ASRC) $(CSRC) $(X11SRC) 50 | PKG_LIBS='-lX11 -lGLU -lGL $(FTLIB)' PKG_CPPFLAGS='-IAcinonyx -IAcinonyx/RIF -IX11 -DUSE_X11 $(FTCF)' R CMD SHLIB -o $@ $^ 51 | endif 52 | 53 | glut.so: $(ASRC) $(CSRC) $(GLUTSRC) 54 | PKG_LIBS='-framework GLUT -framework OpenGL' PKG_CPPFLAGS='-IAcinonyx -IAcinonyx/RIF -IGLUT -DGLUT' R CMD SHLIB -o $@ $^ 55 | 56 | Acinonyx.dll: $(ASRC) $(CSRC) $(WINSRC) 57 | PKG_CXXFLAGS='-fpermissive' PKG_LIBS='-lopengl32 -lglu32 -lrgraphapp -lgdi32 Win32/lib$(WINARCH)/libfreetype.a -static-libgcc -static-libstdc++' PKG_CPPFLAGS='$(DEBUG) -IAcinonyx -IAcinonyx/RIF -IWin32' $(RBIN) CMD SHLIB -o $@ $^ 58 | 59 | $(REP): $(RSRC) 60 | cat $(RSRC) | sed -n 's:.*\.Call("\{0,1\}\(A_[^" ,)]\{1,\}\).*:\1:p' | sort | uniq > /tmp/entry_points 61 | ( echo '.sym <- '; Rscript -e 'dput(readLines("/tmp/entry_points"))') > $@ 62 | rm -f /tmp/entry_points 63 | 64 | sym: $(REP) 65 | 66 | clean: 67 | rm -rf $(OBJ) $(FOBJ) Acinonyx.so Acinonyx.dll glut.so 68 | -------------------------------------------------------------------------------- /Win32/freetype/internal/ftpic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftpic.h */ 4 | /* */ 5 | /* The FreeType position independent code services (declaration). */ 6 | /* */ 7 | /* Copyright 2009 by */ 8 | /* Oran Agra and Mickey Gabel. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | /*************************************************************************/ 19 | /* */ 20 | /* Modules that ordinarily have const global data that need address */ 21 | /* can instead define pointers here. */ 22 | /* */ 23 | /*************************************************************************/ 24 | 25 | 26 | #ifndef __FTPIC_H__ 27 | #define __FTPIC_H__ 28 | 29 | 30 | FT_BEGIN_HEADER 31 | 32 | #ifdef FT_CONFIG_OPTION_PIC 33 | 34 | typedef struct FT_PIC_Container_ 35 | { 36 | /* pic containers for base */ 37 | void* base; 38 | /* pic containers for modules */ 39 | void* autofit; 40 | void* cff; 41 | void* pshinter; 42 | void* psnames; 43 | void* raster; 44 | void* sfnt; 45 | void* smooth; 46 | void* truetype; 47 | } FT_PIC_Container; 48 | 49 | /* Initialize the various function tables, structs, etc. stored in the container. */ 50 | FT_BASE( FT_Error ) 51 | ft_pic_container_init( FT_Library library ); 52 | 53 | 54 | /* Destroy the contents of the container. */ 55 | FT_BASE( void ) 56 | ft_pic_container_destroy( FT_Library library ); 57 | 58 | #endif /* FT_CONFIG_OPTION_PIC */ 59 | 60 | /* */ 61 | 62 | FT_END_HEADER 63 | 64 | #endif /* __FTPIC_H__ */ 65 | 66 | 67 | /* END */ 68 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svgxval.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svgxval.h */ 4 | /* */ 5 | /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ 6 | /* */ 7 | /* Copyright 2004, 2005 by */ 8 | /* Masatake YAMATO, Red Hat K.K., */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | /***************************************************************************/ 20 | /* */ 21 | /* gxvalid is derived from both gxlayout module and otvalid module. */ 22 | /* Development of gxlayout is supported by the Information-technology */ 23 | /* Promotion Agency(IPA), Japan. */ 24 | /* */ 25 | /***************************************************************************/ 26 | 27 | 28 | #ifndef __SVGXVAL_H__ 29 | #define __SVGXVAL_H__ 30 | 31 | #include FT_GX_VALIDATE_H 32 | #include FT_INTERNAL_VALIDATE_H 33 | 34 | FT_BEGIN_HEADER 35 | 36 | 37 | #define FT_SERVICE_ID_GX_VALIDATE "truetypegx-validate" 38 | #define FT_SERVICE_ID_CLASSICKERN_VALIDATE "classickern-validate" 39 | 40 | typedef FT_Error 41 | (*gxv_validate_func)( FT_Face face, 42 | FT_UInt gx_flags, 43 | FT_Bytes tables[FT_VALIDATE_GX_LENGTH], 44 | FT_UInt table_length ); 45 | 46 | 47 | typedef FT_Error 48 | (*ckern_validate_func)( FT_Face face, 49 | FT_UInt ckern_flags, 50 | FT_Bytes *ckern_table ); 51 | 52 | 53 | FT_DEFINE_SERVICE( GXvalidate ) 54 | { 55 | gxv_validate_func validate; 56 | }; 57 | 58 | FT_DEFINE_SERVICE( CKERNvalidate ) 59 | { 60 | ckern_validate_func validate; 61 | }; 62 | 63 | /* */ 64 | 65 | 66 | FT_END_HEADER 67 | 68 | 69 | #endif /* __SVGXVAL_H__ */ 70 | 71 | 72 | /* END */ 73 | -------------------------------------------------------------------------------- /Acinonyx/APermutation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * APermutation.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/2/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "ASort.h" 11 | #include "AObject.h" 12 | 13 | class APermutation : public AObject { 14 | protected: 15 | vsize_t n; 16 | vsize_t *perm; 17 | 18 | void initializePermutations() { 19 | if (!perm) { 20 | perm = (vsize_t*) AAlloc(sizeof(vsize_t) * n); 21 | AMEM(perm); 22 | } 23 | for (vsize_t i = 0; i < n; i++) perm[i] = i; 24 | } 25 | 26 | public: 27 | APermutation(vsize_t len) : n(len), perm(NULL) { 28 | OCLASS(APermutation) 29 | } 30 | 31 | virtual ~APermutation() { 32 | if (perm) AFree(perm); 33 | } 34 | 35 | vsize_t size() { 36 | return n; 37 | } 38 | 39 | vsize_t permutationOf(vsize_t index) { 40 | if (!perm) return index; 41 | return (index >= n) ? index : perm[index]; 42 | } 43 | 44 | vsize_t permutationAt(vsize_t index) { 45 | if (!perm) return index; 46 | for(vsize_t i = 0; i < n; i++) 47 | if (perm[i] == index) 48 | return i; 49 | return index; 50 | } 51 | 52 | const vsize_t *permutations() { return (const vsize_t*) perm; } 53 | 54 | void swap(vsize_t a, vsize_t b) { 55 | if (!perm) initializePermutations(); 56 | vsize_t h = perm[a]; perm[a] = perm[b]; perm[b] = h; 57 | } 58 | 59 | void moveToIndex(vsize_t a, vsize_t ix) { 60 | if (!perm) initializePermutations(); 61 | if (ix >= n) ix = n - 1; 62 | vsize_t prev = perm[a]; 63 | if (prev == ix) return; 64 | if (ix < prev) { 65 | for (vsize_t i = 0; i < n; i++) 66 | if (perm[i] >= ix && perm[i] < prev) 67 | perm[i]++; 68 | } else { /* prev < ix */ 69 | for (vsize_t i = 0; i < n; i++) 70 | if (perm[i] > prev && perm[i] <= ix) 71 | perm[i]--; 72 | } 73 | perm[a] = ix; 74 | } 75 | 76 | void reset() { 77 | if (!perm) return; 78 | AFree(perm); 79 | perm = NULL; 80 | } 81 | 82 | void orderAccordingToVSizes(const vsize_t *array) { 83 | if (!perm) initializePermutations(); 84 | vsize_t *iperm = (vsize_t*) AAlloc(sizeof(vsize_t) * n); 85 | for (vsize_t i = 0; i < n; i++) iperm[perm[i]] = i; 86 | quicksortVSizesPerm(array, perm, iperm, 0, n); 87 | for (vsize_t i = 0; i < n; i++) perm[iperm[i]] = i; 88 | AFree(iperm); 89 | } 90 | 91 | void orderLexicographically(const char **array) { 92 | if (!perm) initializePermutations(); 93 | vsize_t *iperm = (vsize_t*) AAlloc(sizeof(vsize_t) * n); 94 | for (vsize_t i = 0; i < n; i++) iperm[perm[i]] = i; 95 | quicksortStringsPerm(array, perm, iperm, 0, n); 96 | for (vsize_t i = 0; i < n; i++) perm[iperm[i]] = i; 97 | AFree(iperm); 98 | } 99 | 100 | void orderNumerically(const char **array) { 101 | if (!perm) initializePermutations(); 102 | vsize_t *iperm = (vsize_t*) AAlloc(sizeof(vsize_t) * n); 103 | for (vsize_t i = 0; i < n; i++) iperm[perm[i]] = i; 104 | quicksortNumericStringsPerm(array, perm, iperm, 0, n); 105 | for (vsize_t i = 0; i < n; i++) perm[iperm[i]] = i; 106 | AFree(iperm); 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /Acinonyx/ATable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ATable.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 7/8/10. 6 | * Copyright 2010 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_TABLE_H 11 | #define A_TABLE_H 12 | 13 | #include "AObject.h" 14 | 15 | class AUnivarTable : public AObject { 16 | protected: 17 | vsize_t *_counts; 18 | vsize_t _size; 19 | vsize_t _other; 20 | vsize_t _max; 21 | char **_names; 22 | public: 23 | AUnivarTable(vsize_t size, bool named=true) : _size(size), _names(NULL), _other(0), _max(0) { 24 | _counts = (vsize_t*) AZAlloc(_size, sizeof(vsize_t)); 25 | AMEM(_counts); 26 | OCLASS(AUnivarTable) 27 | } 28 | 29 | virtual ~AUnivarTable() { 30 | AFree(_counts); 31 | DCLASS(AUnivarTable); 32 | } 33 | 34 | virtual AUnivarTable *copy() { 35 | AUnivarTable *c = new AUnivarTable(_size, true); 36 | memcpy(c->_counts, _counts, sizeof(vsize_t) * _size); 37 | c->_other = _other; 38 | if (_names) 39 | for (vsize_t i = 0; i < _size; i++) 40 | c->setName(i, _names[i]); 41 | return c; 42 | } 43 | 44 | vsize_t size() { return _size; } 45 | 46 | const vsize_t *counts() { return _counts; } 47 | 48 | vsize_t other() { return _other; } 49 | 50 | vsize_t maxCount() { return _max; } 51 | 52 | vsize_t count(vsize_t index) { return (index < _size) ? _counts[index] : 0; } 53 | 54 | char **names() { return _names; } 55 | 56 | char *name(vsize_t index) { return (_names && index < _size) ? _names[index] : 0; } 57 | 58 | void setName(vsize_t index, const char *name) { 59 | if (!_names) 60 | _names = (char**) AZAlloc(_size, sizeof(char*)); 61 | AMEM(_names); 62 | if (index < _size) { 63 | if (_names[index] && !strcmp(name, _names[index])) return; 64 | if (_names[index]) AFree(_names[index]); 65 | _names[index] = strdup(name); 66 | } 67 | } 68 | 69 | void reset() { memset(_counts, 0, sizeof(vsize_t) * _size); _other = 0; _max = 0; } 70 | 71 | void add(vsize_t entry) { 72 | if (entry < _size) { 73 | vsize_t c = ++_counts[entry]; 74 | if (c > _max) _max = c; 75 | } else _other++; 76 | } 77 | }; 78 | 79 | #if 0 80 | 81 | typedef struct cross_level { 82 | struct cross_level *next; 83 | AFactorVector *factor; 84 | vsize_t n; 85 | void *ptr; 86 | } cross_level_t; 87 | 88 | class ACrossTable : public Object { 89 | protected: 90 | vsize_t n_factors; 91 | cross_level_t *levels; 92 | AFactorVector **factors; 93 | public: 94 | ACrossTable(AObjectVector *factors) { 95 | (factorVars = factors)->retain(); 96 | factors = (AFactorVector**) factors->asObjects(); 97 | n_factors = factors->length(); 98 | buildLevels(); 99 | OCLASS(ACrossTable) 100 | } 101 | 102 | virtual void buildLevels() {}; 103 | 104 | virtual vsize_t at(vsize_t i0, ...) { 105 | return 0; 106 | } 107 | }; 108 | 109 | class ADenseCrossTable : public ACrossTable { 110 | public: 111 | ADenseCrossTable(AObjectVector *factors) : ACrossTable(factors) { 112 | } 113 | 114 | virtual void buildLevels() { 115 | 116 | } 117 | }; 118 | 119 | #endif 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svbdf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svbdf.h */ 4 | /* */ 5 | /* The FreeType BDF services (specification). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVBDF_H__ 20 | #define __SVBDF_H__ 21 | 22 | #include FT_BDF_H 23 | #include FT_INTERNAL_SERVICE_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_BDF "bdf" 30 | 31 | typedef FT_Error 32 | (*FT_BDF_GetCharsetIdFunc)( FT_Face face, 33 | const char* *acharset_encoding, 34 | const char* *acharset_registry ); 35 | 36 | typedef FT_Error 37 | (*FT_BDF_GetPropertyFunc)( FT_Face face, 38 | const char* prop_name, 39 | BDF_PropertyRec *aproperty ); 40 | 41 | 42 | FT_DEFINE_SERVICE( BDF ) 43 | { 44 | FT_BDF_GetCharsetIdFunc get_charset_id; 45 | FT_BDF_GetPropertyFunc get_property; 46 | }; 47 | 48 | #ifndef FT_CONFIG_OPTION_PIC 49 | 50 | #define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ 51 | static const FT_Service_BDFRec class_ = \ 52 | { \ 53 | get_charset_id_, get_property_ \ 54 | }; 55 | 56 | #else /* FT_CONFIG_OPTION_PIC */ 57 | 58 | #define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ 59 | void \ 60 | FT_Init_Class_##class_( FT_Service_BDFRec* clazz ) \ 61 | { \ 62 | clazz->get_charset_id = get_charset_id_; \ 63 | clazz->get_property = get_property_; \ 64 | } 65 | 66 | #endif /* FT_CONFIG_OPTION_PIC */ 67 | 68 | /* */ 69 | 70 | 71 | FT_END_HEADER 72 | 73 | 74 | #endif /* __SVBDF_H__ */ 75 | 76 | 77 | /* END */ 78 | -------------------------------------------------------------------------------- /Acinonyx/RIF/REngine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * REngine.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/5/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_RENGINE_H 11 | #define A_RENGINE_H 12 | 13 | /* for getenv/setenv */ 14 | #include 15 | 16 | /* must come before R due to clash between GL in mingw-w64 and R */ 17 | #include "ARenderer.h" 18 | 19 | #ifdef __i386__ 20 | static const char *rarch = "/i386"; 21 | #elif defined __x86_64__ 22 | static const char *rarch = "/x86_64"; 23 | #elif defined __ppc__ 24 | static const char *rarch = "/ppc"; 25 | #elif defined __ppc64__ 26 | static const char *rarch = "/ppc64"; 27 | #elif defined __arm__ 28 | static const char *rarch = "/arm"; 29 | #else 30 | static const char *rarch = 0; 31 | #endif 32 | 33 | #include "RObject.h" 34 | #include 35 | #include 36 | #include 37 | 38 | #if R_VERSION < R_Version(2,5,0) 39 | #define RS_ParseVector R_ParseVector 40 | #else 41 | #define RS_ParseVector(A,B,C) R_ParseVector(A,B,C,R_NilValue) 42 | #endif 43 | 44 | 45 | class REngine : public AObject { 46 | static REngine *_main; 47 | 48 | public: 49 | REngine(bool init_new=true) { 50 | if (init_new) { 51 | const char *argv[] = { "R", "--no-save", "--vanilla", 0 }; 52 | if (!getenv("R_HOME")) { 53 | // FIXME: we use crude guesses for now 54 | #if __APPLE__ 55 | setenv("R_HOME", "/Library/Frameworks/R.framework/Resources", 1); 56 | if (rarch && !getenv("R_ARCH")) setenv("R_ARCH", rarch, 1); 57 | #else 58 | #ifndef WIN32 59 | setenv("R_HOME", "/usr/local/lib/R", 1); 60 | #endif 61 | #endif 62 | } 63 | int stat = Rf_initialize_R(3, (char**) argv); 64 | if (stat < 0) 65 | fprintf(stderr, "ERROR: cannot start R: %d\n", stat); 66 | setup_Rmainloop(); 67 | } 68 | if (!_main) _main = this; 69 | } 70 | 71 | virtual ~REngine() { 72 | } 73 | 74 | static REngine* mainEngine() { 75 | return _main ? _main : new REngine(); 76 | } 77 | 78 | RObject *parse(const char *text, int count, int *status) { 79 | ParseStatus ps; 80 | SEXP p = RS_ParseVector(Rf_mkString(text), count, &ps); 81 | if (status) status[0] = (int) ps; 82 | if (p == R_NilValue) return NULL; 83 | return new RObject(p); 84 | } 85 | 86 | RObject *eval(RObject *obj, int *status) { 87 | if (!obj) return NULL; 88 | SEXP res = NULL; 89 | int er = 0; 90 | SEXP exp = obj->value(); 91 | if (TYPEOF(exp) == EXPRSXP) { // vector - evaluate all 92 | unsigned int i = 0; 93 | while (i < LENGTH(exp)) { 94 | er = 0; 95 | res = R_tryEval(VECTOR_ELT(exp, i), R_GlobalEnv, &er); 96 | if (er != 0) break; 97 | i++; 98 | } 99 | } else 100 | res = R_tryEval(exp, R_GlobalEnv, &er); 101 | if (status) 102 | status[0] = er; 103 | return res ? new RObject(res) : NULL; 104 | } 105 | 106 | RObject *parseAndEval(const char *text) { 107 | RObject *o = parse(text, 1, NULL); 108 | if (o) { 109 | RObject *r = eval(o, NULL); 110 | o->release(); 111 | return r; 112 | } 113 | return NULL; 114 | } 115 | }; 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svpostnm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svpostnm.h */ 4 | /* */ 5 | /* The FreeType PostScript name services (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2007 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVPOSTNM_H__ 20 | #define __SVPOSTNM_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | /* 28 | * A trivial service used to retrieve the PostScript name of a given 29 | * font when available. The `get_name' field should never be NULL. 30 | * 31 | * The corresponding function can return NULL to indicate that the 32 | * PostScript name is not available. 33 | * 34 | * The name is owned by the face and will be destroyed with it. 35 | */ 36 | 37 | #define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name" 38 | 39 | 40 | typedef const char* 41 | (*FT_PsName_GetFunc)( FT_Face face ); 42 | 43 | 44 | FT_DEFINE_SERVICE( PsFontName ) 45 | { 46 | FT_PsName_GetFunc get_ps_font_name; 47 | }; 48 | 49 | #ifndef FT_CONFIG_OPTION_PIC 50 | 51 | #define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ 52 | static const FT_Service_PsFontNameRec class_ = \ 53 | { \ 54 | get_ps_font_name_ \ 55 | }; 56 | 57 | #else /* FT_CONFIG_OPTION_PIC */ 58 | 59 | #define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ 60 | void \ 61 | FT_Init_Class_##class_( FT_Library library, \ 62 | FT_Service_PsFontNameRec* clazz) \ 63 | { \ 64 | FT_UNUSED(library); \ 65 | clazz->get_ps_font_name = get_ps_font_name_; \ 66 | } 67 | 68 | #endif /* FT_CONFIG_OPTION_PIC */ 69 | 70 | /* */ 71 | 72 | 73 | FT_END_HEADER 74 | 75 | 76 | #endif /* __SVPOSTNM_H__ */ 77 | 78 | 79 | /* END */ 80 | -------------------------------------------------------------------------------- /Win32/freetype/internal/internal.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* internal.h */ 4 | /* */ 5 | /* Internal header files (specification only). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2002, 2003, 2004 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This file is automatically included by `ft2build.h'. */ 22 | /* Do not include it manually! */ 23 | /* */ 24 | /*************************************************************************/ 25 | 26 | 27 | #define FT_INTERNAL_OBJECTS_H 28 | #define FT_INTERNAL_PIC_H 29 | #define FT_INTERNAL_STREAM_H 30 | #define FT_INTERNAL_MEMORY_H 31 | #define FT_INTERNAL_DEBUG_H 32 | #define FT_INTERNAL_CALC_H 33 | #define FT_INTERNAL_DRIVER_H 34 | #define FT_INTERNAL_TRACE_H 35 | #define FT_INTERNAL_GLYPH_LOADER_H 36 | #define FT_INTERNAL_SFNT_H 37 | #define FT_INTERNAL_SERVICE_H 38 | #define FT_INTERNAL_RFORK_H 39 | #define FT_INTERNAL_VALIDATE_H 40 | 41 | #define FT_INTERNAL_TRUETYPE_TYPES_H 42 | #define FT_INTERNAL_TYPE1_TYPES_H 43 | 44 | #define FT_INTERNAL_POSTSCRIPT_AUX_H 45 | #define FT_INTERNAL_POSTSCRIPT_HINTS_H 46 | #define FT_INTERNAL_POSTSCRIPT_GLOBALS_H 47 | 48 | #define FT_INTERNAL_AUTOHINT_H 49 | 50 | 51 | /* END */ 52 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svgldict.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svgldict.h */ 4 | /* */ 5 | /* The FreeType glyph dictionary services (specification). */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVGLDICT_H__ 20 | #define __SVGLDICT_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* 29 | * A service used to retrieve glyph names, as well as to find the 30 | * index of a given glyph name in a font. 31 | * 32 | */ 33 | 34 | #define FT_SERVICE_ID_GLYPH_DICT "glyph-dict" 35 | 36 | 37 | typedef FT_Error 38 | (*FT_GlyphDict_GetNameFunc)( FT_Face face, 39 | FT_UInt glyph_index, 40 | FT_Pointer buffer, 41 | FT_UInt buffer_max ); 42 | 43 | typedef FT_UInt 44 | (*FT_GlyphDict_NameIndexFunc)( FT_Face face, 45 | FT_String* glyph_name ); 46 | 47 | 48 | FT_DEFINE_SERVICE( GlyphDict ) 49 | { 50 | FT_GlyphDict_GetNameFunc get_name; 51 | FT_GlyphDict_NameIndexFunc name_index; /* optional */ 52 | }; 53 | 54 | #ifndef FT_CONFIG_OPTION_PIC 55 | 56 | #define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ 57 | static const FT_Service_GlyphDictRec class_ = \ 58 | { \ 59 | get_name_, name_index_ \ 60 | }; 61 | 62 | #else /* FT_CONFIG_OPTION_PIC */ 63 | 64 | #define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ 65 | void \ 66 | FT_Init_Class_##class_( FT_Library library, \ 67 | FT_Service_GlyphDictRec* clazz) \ 68 | { \ 69 | FT_UNUSED(library); \ 70 | clazz->get_name = get_name_; \ 71 | clazz->name_index = name_index_; \ 72 | } 73 | 74 | #endif /* FT_CONFIG_OPTION_PIC */ 75 | 76 | /* */ 77 | 78 | 79 | FT_END_HEADER 80 | 81 | 82 | #endif /* __SVGLDICT_H__ */ 83 | -------------------------------------------------------------------------------- /man/icontainer.Rd: -------------------------------------------------------------------------------- 1 | \name{icontainer} 2 | \alias{icontainer} 3 | \title{ 4 | Creates a new interactive container 5 | } 6 | \description{ 7 | \code{icontainer} creates a new interactive container. Containers are 8 | used to group interactive visual objects (such as plots) and can be 9 | nested. 10 | } 11 | \usage{ 12 | icontainer(parent = NULL, window, frame, flags) 13 | } 14 | \arguments{ 15 | \item{parent}{parent container to register with. If \code{NULL} this 16 | container is created on its own.} 17 | \item{window}{window to place this container into. If not specified a 18 | window is created and filled with this container.} 19 | \item{frame}{numeric vector of the form c(x, y, with, height) 20 | specifying the size and location of the container} 21 | \item{flags}{flags defining the behavior of this container when the 22 | parent container of window are resized} 23 | } 24 | \details{ 25 | Containers can contain any visual object in the iPlots eXtreme graphics 26 | system. Most commonly such objects are plots, R graphics devices or 27 | further containers. The flags of each obejct define how it will respond 28 | to resize events. Containers automatically handle the resizing of their 29 | children. 30 | 31 | The model for resizing is that each object can choose to fix its borders 32 | with respect to any of the four sides of its parent. Any sides that are 33 | not fixed will grow proportinally. The default is to be fixed to all 34 | four sides (or from the other point of view full expansion in both 35 | directions) which simply fills all available space. 36 | 37 | The currently supported flags are: 38 | \describe{ 39 | \item{\code{"fix.top"}}{fixed at the top} 40 | \item{\code{"fix.bottom"}}{fixed at the bottom} 41 | \item{\code{"fix.left"}}{fixed at the left margin} 42 | \item{\code{"fix.right"}}{fixed at the right margin} 43 | \item{\code{"xspring"}}{expands along the x axis (by fixing both ends) - same as \code{c("fix.left","fix.right")}} 44 | \item{\code{"yspring"}}{expands along the y axis (by fixing both ends) - same as \code{c("fix.top","fix.bottom")}} 45 | \item{\code{"xyspring"}}{expands in all directions (by attaching all 46 | four margins) - same as the combination of all fix attributes above} 47 | } 48 | 49 | The \code{window} parameter can be either \code{NULL} is which case a 50 | new window is created and filled with the container (the size of the 51 | window is thus defined by the size of the container) or \code{FALSE} in 52 | which case an off-screen container is created to be attached to a window 53 | later or a window object (of the clas \code{iWindow}). 54 | } 55 | \value{ 56 | Object of the class \code{iContainer}. 57 | } 58 | \note{Operations on the container object are by default not followed by 59 | an implicit redraw (as is the case for plots) to allow contruction of 60 | complex layouts without unnecessary redraws. Please use 61 | \code{\link{redraw}} after all components have been added to a 62 | container. 63 | } 64 | \seealso{ 65 | \code{\link{iplot}}, \code{\link{redraw}} 66 | } 67 | \examples{ 68 | # create a container (implicitly creates a new window) 69 | a = icontainer(frame=c(0,0,400,300)) 70 | 71 | # create some random plots off-screen (window=FALSE) 72 | x = rnorm(1000) 73 | y = rnorm(1000) 74 | p = iplot(x, y, window=FALSE, frame=c(0,0,200,300), 75 | flags=c("fix.left","fix.top","fix.bottom")) 76 | q = iplot(y, x, window=FALSE, frame=c(200,0,200,300), 77 | flags=c("fix.right","fix.top","fix.bottom")) 78 | 79 | # add the plots to the container and redraw 80 | redraw(a + p + q) 81 | } 82 | \keyword{hplot} 83 | -------------------------------------------------------------------------------- /Cocoa/CocoaApp.mm: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaApp.m 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright 2008 Simon Urbanek. All rights reserved. 7 | // 8 | 9 | #import "CocoaApp.h" 10 | #import "CocoaWindow.h" 11 | 12 | #import "ATimeSeriesPlot.h" 13 | #import "AScatterPlot.h" 14 | #import "AParallelCoordPlot.h" 15 | #import "ABarChart.h" 16 | #import "AHistogram.h" 17 | #import "AMarkerValuesPlot.h" 18 | 19 | #import "REngine.h" 20 | #import "ARVector.h" 21 | 22 | #import "ALinearProjection.h" 23 | 24 | extern "C" { 25 | CocoaWindow *ACocoa_CreateWindow(AVisual *visual, APoint position); 26 | void ACocoa_Init(); 27 | } 28 | 29 | CocoaWindow *ACocoa_CreateWindow(AVisual *visual, APoint position) 30 | { 31 | ARect aFrame = visual->frame(); 32 | NSRect rect = NSMakeRect(position.x, position.y, aFrame.width, aFrame.height); 33 | 34 | CocoaWindow *window = [[CocoaWindow alloc] initWithContentRect:rect visual:visual]; 35 | 36 | [window setTitle:[NSString stringWithUTF8String:visual->caption()]]; 37 | [window makeKeyAndOrderFront:nil]; 38 | // [window setDelegate:self]; 39 | // no idea why, but the shadow is not there until you cycle the shadow setting... 40 | //[window setHasShadow:NO]; 41 | //[window setHasShadow:YES]; 42 | //[window setReleasedWhenClosed:YES]; 43 | 44 | return window; 45 | } 46 | 47 | static NSAutoreleasePool *staticPool; 48 | 49 | void ACocoa_Init() { 50 | NSApplicationLoad(); 51 | staticPool = [[NSAutoreleasePool alloc] init]; 52 | } 53 | 54 | @implementation CocoaApp 55 | 56 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 57 | { 58 | ALog("applicationDidFinishLaunching:"); 59 | REngine *eng = REngine::mainEngine(); 60 | RObject *o = eng->parseAndEval("as.double({n<-1e2; x<-rep(seq(1:(n/5)),5)})"); 61 | 62 | AMarker *mark = new AMarker(o->length()); 63 | mark->setColorMap(new ADefaultColorMap()); 64 | mark->enableUndo(16); 65 | 66 | ADataVector *vx = new ARDoubleVector(mark, o); 67 | vx->setName("x"); 68 | o->release(); 69 | o = eng->parseAndEval("y<-rnorm(n)*3+1"); 70 | ADataVector *vy = new ARDoubleVector(mark, o); 71 | vy->setName("y"); 72 | o->release(); 73 | 74 | o = eng->parseAndEval("factor(LETTERS[as.integer(y - min(y))+1L])"); 75 | ARFactorVector *fv = new ARFactorVector(mark, o->value()); 76 | fv->setName("letters"); 77 | o->release(); 78 | 79 | ARect aFrame = AMkRect(0, 0, 400, 300); 80 | 81 | AVisual *visual = new ATimeSeriesPlot(NULL, aFrame, 0, vx, vy, fv); 82 | ACocoa_CreateWindow(visual, AMkPoint(50, 100)); 83 | visual->release(); 84 | 85 | visual = new AScatterPlot(NULL, aFrame, 0, vx, vy); 86 | ACocoa_CreateWindow(visual, AMkPoint(500, 400)); 87 | // FIXME: we should assign the result or something ... 88 | visual->release(); 89 | 90 | ADataVector *pcv[] = { vx, vy, fv, vx, vx, vx, vy, vy }; 91 | 92 | visual = new AParallelCoordPlot(NULL, aFrame, 0, 8, pcv); 93 | ACocoa_CreateWindow(visual, AMkPoint(500, 100)); 94 | visual->release(); 95 | 96 | visual = new ABarChart(NULL, aFrame, 0, fv); 97 | ACocoa_CreateWindow(visual, AMkPoint(950, 100)); 98 | visual->release(); 99 | 100 | visual = new AMarkerValuesPlot(NULL, aFrame, 0, mark); 101 | ACocoa_CreateWindow(visual, AMkPoint(450, 100)); 102 | visual->release(); 103 | 104 | // visual = new AHistogram(NULL, aFrame, 0, vx); 105 | // ACocoa_CreateWindow(visual, AMkPoint(50, 600)); 106 | // visual->release(); 107 | // 108 | fv->release(); 109 | vx->release(); 110 | vy->release(); 111 | mark->release(); 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Acinonyx/ARVector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ARVector.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/26/09. 6 | * Copyright 2009 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_R_VECTOR_H__ 11 | #define A_R_VECTOR_H__ 12 | 13 | #include "AVector.h" 14 | #include "RObject.h" 15 | #include "ANotfier.h" 16 | 17 | class AContainsRObject { 18 | protected: 19 | RObject *ro; 20 | public: 21 | AContainsRObject(SEXP data) { 22 | ro = new RObject(data); 23 | } 24 | 25 | AContainsRObject(RObject *robj) { 26 | ro = robj; 27 | robj->retain(); 28 | } 29 | 30 | virtual ~AContainsRObject() { 31 | if (ro) ro->release(); 32 | } 33 | 34 | RObject *object() { return ro; } 35 | SEXP value() { return ro ? ro->value() : R_NilValue; } 36 | }; 37 | 38 | class ARDoubleVector : public ADoubleVector, public AContainsRObject { 39 | public: 40 | ARDoubleVector(AMarker *m, SEXP data) : ADoubleVector(m, REAL(data), LENGTH(data), false), AContainsRObject(data) { 41 | owned = false; // do not AFree the pointer since it's owned by R 42 | OCLASS(ARDoubleVector) 43 | } 44 | 45 | ARDoubleVector(AMarker *m, RObject *o) : ADoubleVector(m, REAL(o->value()), LENGTH(o->value()), false), AContainsRObject(o) { 46 | owned = false; // do not AFree the pointer since it's owned by R 47 | OCLASS(ARDoubleVector) 48 | } 49 | }; 50 | 51 | class ARTimeVector : public ATimeVector, public AContainsRObject { 52 | public: 53 | ARTimeVector(AMarker *m, SEXP data) : ATimeVector(m, REAL(data), LENGTH(data), false), AContainsRObject(data) { 54 | owned = false; // do not AFree the pointer since it's owned by R 55 | OCLASS(ARTimeVector) 56 | } 57 | 58 | ARTimeVector(AMarker *m, RObject *o) : ATimeVector(m, REAL(o->value()), LENGTH(o->value()), false), AContainsRObject(o) { 59 | owned = false; // do not AFree the pointer since it's owned by R 60 | OCLASS(ARTimeVector) 61 | } 62 | }; 63 | 64 | class ARIntVector : public AIntVector, public AContainsRObject { 65 | public: 66 | ARIntVector(AMarker *m, SEXP data) : AIntVector(m, INTEGER(data), LENGTH(data), false), AContainsRObject(data) { 67 | owned = false; // do not AFree the pointer since it's owned by R 68 | OCLASS(ARIntVector) 69 | } 70 | 71 | ARIntVector(AMarker *m, RObject *o) : AIntVector(m, INTEGER(o->value()), LENGTH(o->value()), false), AContainsRObject(o) { 72 | owned = false; // do not AFree the pointer since it's owned by R 73 | OCLASS(ARIntVector) 74 | } 75 | }; 76 | 77 | class ARFactorVector : public AFactorVector, public AContainsRObject { 78 | public: 79 | // we need to copy the data, because R factors are 1-based, but we are 0-based *sigh* - may need to rethink this ... 80 | ARFactorVector(AMarker *m, SEXP data) : AFactorVector(m, INTEGER(data), LENGTH(data), NULL, 0, true), AContainsRObject(data) { 81 | // owned = false; // do not AFree the pointer since it's owned by R 82 | for (vsize_t i = 0; i < _len; i++) _data[i]--; // decrement all ... 83 | SEXP sl = Rf_getAttrib(data, R_LevelsSymbol); 84 | if (TYPEOF(sl) == STRSXP) { 85 | _levels = LENGTH(sl); 86 | _names = (char**) AAlloc(sizeof(char*) * _levels); 87 | AMEM(_names); 88 | for (vsize_t i = 0; i < _levels; i++) 89 | _names[i] = (char*) CHAR(STRING_ELT(sl, i)); 90 | } 91 | OCLASS(ARFactorVector) 92 | } 93 | 94 | // we need a special descructor because we did not copy the names so we have to get rid of them before the super-destructor 95 | virtual ~ARFactorVector() { 96 | if (_names) 97 | memset(_names, 0, sizeof(*_names) * _levels); 98 | } 99 | }; 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svpsinfo.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svpsinfo.h */ 4 | /* */ 5 | /* The FreeType PostScript info service (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2004, 2009 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVPSINFO_H__ 20 | #define __SVPSINFO_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_INTERNAL_TYPE1_TYPES_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | #define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info" 30 | 31 | 32 | typedef FT_Error 33 | (*PS_GetFontInfoFunc)( FT_Face face, 34 | PS_FontInfoRec* afont_info ); 35 | 36 | typedef FT_Error 37 | (*PS_GetFontExtraFunc)( FT_Face face, 38 | PS_FontExtraRec* afont_extra ); 39 | 40 | typedef FT_Int 41 | (*PS_HasGlyphNamesFunc)( FT_Face face ); 42 | 43 | typedef FT_Error 44 | (*PS_GetFontPrivateFunc)( FT_Face face, 45 | PS_PrivateRec* afont_private ); 46 | 47 | 48 | FT_DEFINE_SERVICE( PsInfo ) 49 | { 50 | PS_GetFontInfoFunc ps_get_font_info; 51 | PS_GetFontExtraFunc ps_get_font_extra; 52 | PS_HasGlyphNamesFunc ps_has_glyph_names; 53 | PS_GetFontPrivateFunc ps_get_font_private; 54 | }; 55 | 56 | #ifndef FT_CONFIG_OPTION_PIC 57 | 58 | #define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ 59 | ps_get_font_extra_, has_glyph_names_, get_font_private_) \ 60 | static const FT_Service_PsInfoRec class_ = \ 61 | { \ 62 | get_font_info_, ps_get_font_extra_, has_glyph_names_, \ 63 | get_font_private_ \ 64 | }; 65 | 66 | #else /* FT_CONFIG_OPTION_PIC */ 67 | 68 | #define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ 69 | ps_get_font_extra_, has_glyph_names_, get_font_private_) \ 70 | void \ 71 | FT_Init_Class_##class_( FT_Library library, \ 72 | FT_Service_PsInfoRec* clazz) \ 73 | { \ 74 | FT_UNUSED(library); \ 75 | clazz->ps_get_font_info = get_font_info_; \ 76 | clazz->ps_get_font_extra = ps_get_font_extra_; \ 77 | clazz->ps_has_glyph_names = has_glyph_names_; \ 78 | clazz->ps_get_font_private = get_font_private_; \ 79 | } 80 | 81 | #endif /* FT_CONFIG_OPTION_PIC */ 82 | 83 | /* */ 84 | 85 | 86 | FT_END_HEADER 87 | 88 | 89 | #endif /* __SVPSINFO_H__ */ 90 | 91 | 92 | /* END */ 93 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svcid.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svcid.h */ 4 | /* */ 5 | /* The FreeType CID font services (specification). */ 6 | /* */ 7 | /* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */ 8 | /* */ 9 | /* This file is part of the FreeType project, and may only be used, */ 10 | /* modified, and distributed under the terms of the FreeType project */ 11 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 | /* this file you indicate that you have read the license and */ 13 | /* understand and accept it fully. */ 14 | /* */ 15 | /***************************************************************************/ 16 | 17 | 18 | #ifndef __SVCID_H__ 19 | #define __SVCID_H__ 20 | 21 | #include FT_INTERNAL_SERVICE_H 22 | 23 | 24 | FT_BEGIN_HEADER 25 | 26 | 27 | #define FT_SERVICE_ID_CID "CID" 28 | 29 | typedef FT_Error 30 | (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face, 31 | const char* *registry, 32 | const char* *ordering, 33 | FT_Int *supplement ); 34 | typedef FT_Error 35 | (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face, 36 | FT_Bool *is_cid ); 37 | typedef FT_Error 38 | (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face, 39 | FT_UInt glyph_index, 40 | FT_UInt *cid ); 41 | 42 | FT_DEFINE_SERVICE( CID ) 43 | { 44 | FT_CID_GetRegistryOrderingSupplementFunc get_ros; 45 | FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid; 46 | FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index; 47 | }; 48 | 49 | #ifndef FT_CONFIG_OPTION_PIC 50 | 51 | #define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ 52 | get_is_cid_, get_cid_from_glyph_index_ ) \ 53 | static const FT_Service_CIDRec class_ = \ 54 | { \ 55 | get_ros_, get_is_cid_, get_cid_from_glyph_index_ \ 56 | }; 57 | 58 | #else /* FT_CONFIG_OPTION_PIC */ 59 | 60 | #define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ 61 | get_is_cid_, get_cid_from_glyph_index_ ) \ 62 | void \ 63 | FT_Init_Class_##class_( FT_Library library, \ 64 | FT_Service_CIDRec* clazz) \ 65 | { \ 66 | FT_UNUSED(library); \ 67 | clazz->get_ros = get_ros_; \ 68 | clazz->get_is_cid = get_is_cid_; \ 69 | clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \ 70 | } 71 | 72 | #endif /* FT_CONFIG_OPTION_PIC */ 73 | 74 | /* */ 75 | 76 | 77 | FT_END_HEADER 78 | 79 | 80 | #endif /* __SVCID_H__ */ 81 | 82 | 83 | /* END */ 84 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svsfnt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svsfnt.h */ 4 | /* */ 5 | /* The FreeType SFNT table loading service (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2004 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVSFNT_H__ 20 | #define __SVSFNT_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | #include FT_TRUETYPE_TABLES_H 24 | 25 | 26 | FT_BEGIN_HEADER 27 | 28 | 29 | /* 30 | * SFNT table loading service. 31 | */ 32 | 33 | #define FT_SERVICE_ID_SFNT_TABLE "sfnt-table" 34 | 35 | 36 | /* 37 | * Used to implement FT_Load_Sfnt_Table(). 38 | */ 39 | typedef FT_Error 40 | (*FT_SFNT_TableLoadFunc)( FT_Face face, 41 | FT_ULong tag, 42 | FT_Long offset, 43 | FT_Byte* buffer, 44 | FT_ULong* length ); 45 | 46 | /* 47 | * Used to implement FT_Get_Sfnt_Table(). 48 | */ 49 | typedef void* 50 | (*FT_SFNT_TableGetFunc)( FT_Face face, 51 | FT_Sfnt_Tag tag ); 52 | 53 | 54 | /* 55 | * Used to implement FT_Sfnt_Table_Info(). 56 | */ 57 | typedef FT_Error 58 | (*FT_SFNT_TableInfoFunc)( FT_Face face, 59 | FT_UInt idx, 60 | FT_ULong *tag, 61 | FT_ULong *offset, 62 | FT_ULong *length ); 63 | 64 | 65 | FT_DEFINE_SERVICE( SFNT_Table ) 66 | { 67 | FT_SFNT_TableLoadFunc load_table; 68 | FT_SFNT_TableGetFunc get_table; 69 | FT_SFNT_TableInfoFunc table_info; 70 | }; 71 | 72 | #ifndef FT_CONFIG_OPTION_PIC 73 | 74 | #define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ 75 | static const FT_Service_SFNT_TableRec class_ = \ 76 | { \ 77 | load_, get_, info_ \ 78 | }; 79 | 80 | #else /* FT_CONFIG_OPTION_PIC */ 81 | 82 | #define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ 83 | void \ 84 | FT_Init_Class_##class_( FT_Service_SFNT_TableRec* clazz ) \ 85 | { \ 86 | clazz->load_table = load_; \ 87 | clazz->get_table = get_; \ 88 | clazz->table_info = info_; \ 89 | } 90 | 91 | #endif /* FT_CONFIG_OPTION_PIC */ 92 | 93 | /* */ 94 | 95 | 96 | FT_END_HEADER 97 | 98 | 99 | #endif /* __SVSFNT_H__ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /GLUT/AGLUTWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GLUTWindow.cpp 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/18/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "AGLUTWindow.h" 11 | #include "AVisual.h" 12 | 13 | static unsigned int gwin_max; 14 | 15 | static AGLUTWindow **gwin; 16 | 17 | static bool a_glut_init_f = false; 18 | 19 | static void a_glut_init() { 20 | char *argv[] = { "Acinonyx", NULL }; 21 | int argc = 1; 22 | gwin = (AGLUTWindow**) AZAlloc(sizeof(AGLUTWindow*), gwin_max=512); 23 | glutInit(&argc, argv); 24 | a_glut_init_f = true; 25 | } 26 | 27 | static void a_glut_draw() { 28 | int w = glutGetWindow(); 29 | if (w >=0 && w < gwin_max && gwin[w]) { 30 | gwin[w]->begin(); 31 | gwin[w]->draw(); 32 | gwin[w]->end(); 33 | } 34 | } 35 | 36 | static void a_glut_key(unsigned char c, int x, int y) { 37 | int w = glutGetWindow(); 38 | if (w >=0 && w < gwin_max && gwin[w]) { 39 | AVisual *v = static_cast (gwin[w]->rootVisual()); 40 | // if (v) v-> 41 | } 42 | } 43 | 44 | static void a_glut_mouse(int b, int st, int x, int y) { 45 | } 46 | 47 | static void a_glut_reshape(int w, int h) 48 | { 49 | glViewport(0,0,(GLsizei)w,(GLsizei)h); 50 | int wi = glutGetWindow(); 51 | if (wi >=0 && wi < gwin_max && gwin[wi]) { 52 | AVisual *v = static_cast (gwin[w]->rootVisual()); 53 | if (v) { 54 | ARect f = v->frame(); 55 | printf("change from %g,%g to %d,%d\n", f.width, f.height, w, h); 56 | f.width = w; f.height = h; 57 | v->moveAndResize(f); 58 | glutPostRedisplay(); 59 | } 60 | } 61 | } 62 | 63 | AGLUTWindow::AGLUTWindow(ARect frame) : AWindow(frame) { 64 | if (!a_glut_init_f) 65 | a_glut_init(); 66 | glutInitWindowSize(frame.width, frame.height); 67 | glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_ACCUM | GLUT_DOUBLE); 68 | win_id = glutCreateWindow("GLUT Acinonyx"); 69 | if (win_id < gwin_max) 70 | gwin[win_id] = this; 71 | else 72 | fprintf(stderr, "FATAL: too many GLUT windows\n"); 73 | glutDisplayFunc(a_glut_draw); 74 | glutKeyboardFunc(a_glut_key); 75 | glutMouseFunc(a_glut_mouse); 76 | glutReshapeFunc(a_glut_reshape); 77 | } 78 | 79 | //---- sample main function --- 80 | 81 | extern "C" { 82 | int main(int ac, char **av); 83 | } 84 | 85 | #include "REngine.h" 86 | #include "AScatterPlot.h" 87 | 88 | int main(int ac, char **av) { 89 | gwin = (AGLUTWindow**) AZAlloc(sizeof(AGLUTWindow*), gwin_max=512); 90 | glutInit(&ac, av); 91 | a_glut_init_f = true; 92 | 93 | REngine *eng = REngine::mainEngine(); 94 | RObject *o = eng->parseAndEval("{n<-1e4; x<-rnorm(n)}"); 95 | AMarker *mark = new AMarker(o->length()); 96 | ADataVector *vx = new ADoubleVector(mark, o->doubles(), o->length(), true); 97 | o->release(); 98 | o = eng->parseAndEval("y<-rnorm(n)"); 99 | ADataVector *vy = new ADoubleVector(mark, o->doubles(), o->length(), true); 100 | o->release(); 101 | 102 | o = eng->parseAndEval("as.integer(y - min(y))+1L"); 103 | AIntVector *iv = new AIntVector(mark, o->integers(), o->length(), true); 104 | vsize_t ls = iv->range().length; 105 | char ** levels = (char**) AAlloc(sizeof(char*) * ls); 106 | AMEM(levels); 107 | char *ln = (char*) AAlloc(2 * ls); 108 | AMEM(ln); 109 | for (vsize_t i = 0; i < ls; i++) { ln[i*2] = i + 'A'; ln[i*2+1] = 0; levels[i] = ln + (i*2); } 110 | AFactorVector *fv = new AFactorVector(mark, iv->asInts(), iv->length(), (const char**) levels, ls); 111 | iv->release(); 112 | AFree(levels); // we cannot AFree ln 113 | 114 | ARect aFrame = AMkRect(0, 0, 400, 300); 115 | AVisual *visual = new AScatterPlot(NULL, aFrame, 0, vx, vy); 116 | 117 | AGLUTWindow *win = new AGLUTWindow(aFrame); 118 | win->setRootVisual(visual); 119 | 120 | // FIXME: we should assign the result or something ... 121 | visual->release(); 122 | 123 | glutMainLoop(); 124 | 125 | return 0; 126 | } 127 | -------------------------------------------------------------------------------- /Cocoa/GLString.h: -------------------------------------------------------------------------------- 1 | // GLString is based on Apple's CocoaGL example 2 | 3 | #import 4 | #import 5 | #import 6 | #import 7 | #import 8 | 9 | @interface NSBezierPath (RoundRect) 10 | + (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius; 11 | 12 | - (void)appendBezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius; 13 | @end 14 | 15 | @interface GLString : NSObject { 16 | CGLContextObj cgl_ctx; // current context at time of texture creation 17 | GLuint texName; 18 | NSSize texSize; 19 | 20 | NSAttributedString * string; 21 | NSColor *textColor; // default is opaque white 22 | NSColor *boxColor; // default transparent or none 23 | NSColor *borderColor; // default transparent or none 24 | BOOL staticFrame; // default in NO 25 | BOOL antialias; // default to YES 26 | NSSize marginSize; // offset or frame size, default is 4 width 2 height 27 | NSSize frameSize; // offset or frame size, default is 4 width 2 height 28 | float cRadius; // Corner radius, if 0 just a rectangle. Defaults to 4.0f 29 | 30 | BOOL requiresUpdate; 31 | } 32 | 33 | // this API requires a current rendering context and all operations will be performed in regards to thar context 34 | // the same context should be current for all method calls for a particular object instance 35 | 36 | // designated initializer 37 | - (id) initWithAttributedString:(NSAttributedString *)attributedString withTextColor:(NSColor *)color withBoxColor:(NSColor *)color withBorderColor:(NSColor *)color; 38 | 39 | - (id) initWithString:(NSString *)aString withAttributes:(NSDictionary *)attribs withTextColor:(NSColor *)color withBoxColor:(NSColor *)color withBorderColor:(NSColor *)color; 40 | - (id) initWithString:(NSString *)aString withAttributes:(NSDictionary *)attribs color:(NSColor*)color; 41 | 42 | // basic methods that pick up defaults 43 | - (id) initWithString:(NSString *)aString withAttributes:(NSDictionary *)attribs; 44 | - (id) initWithAttributedString:(NSAttributedString *)attributedString; 45 | 46 | - (void) dealloc; 47 | 48 | - (GLuint) texName; // 0 if no texture allocated 49 | - (NSSize) texSize; // actually size of texture generated in texels, (0, 0) if no texture allocated 50 | 51 | - (NSColor *) textColor; // get the pre-multiplied default text color (includes alpha) string attributes could override this 52 | - (NSColor *) boxColor; // get the pre-multiplied box color (includes alpha) alpha of 0.0 means no background box 53 | - (NSColor *) borderColor; // get the pre-multiplied border color (includes alpha) alpha of 0.0 means no border 54 | - (BOOL) staticFrame; // returns whether or not a static frame will be used 55 | 56 | - (NSSize) frameSize; // returns either dynamc frame (text size + margins) or static frame size (switch with staticFrame) 57 | 58 | - (NSSize) marginSize; // current margins for text offset and pads for dynamic frame 59 | 60 | - (void) genTexture; // generates the texture without drawing texture to current context 61 | - (void) drawWithBounds:(NSRect)bounds; // will update the texture if required due to change in settings (note context should be setup to be orthographic scaled to per pixel scale) 62 | - (void) drawAtPoint:(NSPoint)point; 63 | - (void) drawAtPoint:(NSPoint)point withAdjustment: (NSPoint) adj rotation: (float) rot scale: (float) scale; 64 | 65 | // these will force the texture to be regenerated at the next draw 66 | - (void) setMargins:(NSSize)size; // set offset size and size to fit with offset 67 | - (void) useStaticFrame:(NSSize)size; // set static frame size and size to frame 68 | - (void) useDynamicFrame; // set static frame size and size to frame 69 | 70 | - (void) setString:(NSAttributedString *)attributedString; // set string after initial creation 71 | - (void) setString:(NSString *)aString withAttributes:(NSDictionary *)attribs; // set string after initial creation 72 | 73 | - (void) setTextColor:(NSColor *)color; // set default text color 74 | - (void) setBoxColor:(NSColor *)color; // set default text color 75 | - (void) setBorderColor:(NSColor *)color; // set default text color 76 | 77 | - (BOOL) antialias; 78 | - (void) setAntialias:(bool)request; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Win32/freetype/ftsynth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsynth.h */ 4 | /* */ 5 | /* FreeType synthesizing code for emboldening and slanting */ 6 | /* (specification). */ 7 | /* */ 8 | /* Copyright 2000-2001, 2003, 2006, 2008 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /*************************************************************************/ 22 | /*************************************************************************/ 23 | /*************************************************************************/ 24 | /*************************************************************************/ 25 | /********* *********/ 26 | /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ 27 | /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ 28 | /********* FREETYPE DEVELOPMENT TEAM *********/ 29 | /********* *********/ 30 | /*************************************************************************/ 31 | /*************************************************************************/ 32 | /*************************************************************************/ 33 | /*************************************************************************/ 34 | /*************************************************************************/ 35 | 36 | 37 | /* Main reason for not lifting the functions in this module to a */ 38 | /* `standard' API is that the used parameters for emboldening and */ 39 | /* slanting are not configurable. Consider the functions as a */ 40 | /* code resource which should be copied into the application and */ 41 | /* adapted to the particular needs. */ 42 | 43 | 44 | #ifndef __FTSYNTH_H__ 45 | #define __FTSYNTH_H__ 46 | 47 | 48 | #include 49 | #include FT_FREETYPE_H 50 | 51 | #ifdef FREETYPE_H 52 | #error "freetype.h of FreeType 1 has been loaded!" 53 | #error "Please fix the directory search order for header files" 54 | #error "so that freetype.h of FreeType 2 is found first." 55 | #endif 56 | 57 | 58 | FT_BEGIN_HEADER 59 | 60 | /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ 61 | /* taste). This function is actually a convenience function, providing */ 62 | /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ 63 | /* */ 64 | /* For emboldened outlines the metrics are estimates only; if you need */ 65 | /* precise values you should call @FT_Outline_Get_CBox. */ 66 | FT_EXPORT( void ) 67 | FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); 68 | 69 | /* Slant an outline glyph to the right by about 12 degrees. */ 70 | FT_EXPORT( void ) 71 | FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); 72 | 73 | /* */ 74 | 75 | FT_END_HEADER 76 | 77 | #endif /* __FTSYNTH_H__ */ 78 | 79 | 80 | /* END */ 81 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svmm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svmm.h */ 4 | /* */ 5 | /* The FreeType Multiple Masters and GX var services (specification). */ 6 | /* */ 7 | /* Copyright 2003, 2004 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __SVMM_H__ 20 | #define __SVMM_H__ 21 | 22 | #include FT_INTERNAL_SERVICE_H 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /* 29 | * A service used to manage multiple-masters data in a given face. 30 | * 31 | * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H). 32 | * 33 | */ 34 | 35 | #define FT_SERVICE_ID_MULTI_MASTERS "multi-masters" 36 | 37 | 38 | typedef FT_Error 39 | (*FT_Get_MM_Func)( FT_Face face, 40 | FT_Multi_Master* master ); 41 | 42 | typedef FT_Error 43 | (*FT_Get_MM_Var_Func)( FT_Face face, 44 | FT_MM_Var* *master ); 45 | 46 | typedef FT_Error 47 | (*FT_Set_MM_Design_Func)( FT_Face face, 48 | FT_UInt num_coords, 49 | FT_Long* coords ); 50 | 51 | typedef FT_Error 52 | (*FT_Set_Var_Design_Func)( FT_Face face, 53 | FT_UInt num_coords, 54 | FT_Fixed* coords ); 55 | 56 | typedef FT_Error 57 | (*FT_Set_MM_Blend_Func)( FT_Face face, 58 | FT_UInt num_coords, 59 | FT_Long* coords ); 60 | 61 | 62 | FT_DEFINE_SERVICE( MultiMasters ) 63 | { 64 | FT_Get_MM_Func get_mm; 65 | FT_Set_MM_Design_Func set_mm_design; 66 | FT_Set_MM_Blend_Func set_mm_blend; 67 | FT_Get_MM_Var_Func get_mm_var; 68 | FT_Set_Var_Design_Func set_var_design; 69 | }; 70 | 71 | #ifndef FT_CONFIG_OPTION_PIC 72 | 73 | #define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ 74 | set_mm_blend_, get_mm_var_, set_var_design_) \ 75 | static const FT_Service_MultiMastersRec class_ = \ 76 | { \ 77 | get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \ 78 | }; 79 | 80 | #else /* FT_CONFIG_OPTION_PIC */ 81 | 82 | #define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ 83 | set_mm_blend_, get_mm_var_, set_var_design_) \ 84 | void \ 85 | FT_Init_Class_##class_( FT_Service_MultiMastersRec* clazz ) \ 86 | { \ 87 | clazz->get_mm = get_mm_; \ 88 | clazz->set_mm_design = set_mm_design_; \ 89 | clazz->set_mm_blend = set_mm_blend_; \ 90 | clazz->get_mm_var = get_mm_var_; \ 91 | clazz->set_var_design = set_var_design_; \ 92 | } 93 | 94 | #endif /* FT_CONFIG_OPTION_PIC */ 95 | 96 | /* */ 97 | 98 | 99 | FT_END_HEADER 100 | 101 | #endif /* __SVMM_H__ */ 102 | 103 | 104 | /* END */ 105 | -------------------------------------------------------------------------------- /Acinonyx/ACueWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACueWidget.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/31/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_CUE_WIDGET_H 11 | #define A_CUE_WIDGET_H 12 | 13 | #include "AWidget.h" 14 | 15 | // A cue widget is a widget that is normally invisible unless the mouse it moved over the widget. 16 | // Pretty much all widgets implemented in Acinonyx are cue widgets, because we don't use any static widgets 17 | class ACueWidget : public AWidget { 18 | protected: 19 | int on_screen; // if != 0 then it was brought to screen, otherwise is it not visible (yet not hidden!) FIXME: on_screen is int because the plan was to support animation... 20 | bool cue_link_children; // determines whether this widget should also send cueOn message to its children when displaying 21 | bool cue_link_parent; // determines whether this widget should respect the parent before ending its visibility status - if true then the parent must be a cue widget as well 22 | bool manual_cue; // special case for a cue widget that is not activated by mouse (most commonly activated by its parent instead - see, e.g., ACueHotButton) 23 | 24 | public: 25 | #pragma mark --- contructor --- 26 | ACueWidget(AContainer *parent, ARect frame, unsigned int flags, bool link_children=false) : AWidget(parent, frame, flags), on_screen(0), cue_link_children(link_children), cue_link_parent(false), manual_cue(false) { 27 | OCLASS(ACueWidget) 28 | } 29 | 30 | void setManualCue(bool what) { manual_cue = what; } 31 | 32 | virtual bool mouseDown(AEvent event) { 33 | if (!on_screen) 34 | return false; 35 | return AWidget::mouseDown(event); 36 | } 37 | 38 | virtual bool mouseUp(AEvent event) { 39 | if (!on_screen) 40 | return false; 41 | return AWidget::mouseUp(event); 42 | } 43 | 44 | 45 | virtual void add(ACueWidget &obj) { 46 | ALog("ACueWidget: add %s (link=%s)", obj.describe(), cue_link_children ? "yes" : "no"); 47 | if (cue_link_children) 48 | obj.cue_link_parent = true; 49 | AWidget::add(obj); 50 | } 51 | 52 | virtual bool cueOn() { 53 | on_screen = 1; 54 | if (cue_link_children) { 55 | chList_t *c = chRoot; 56 | while (c) { 57 | ACueWidget *child = static_cast (c->o); 58 | if (child) 59 | child->cueOn(); 60 | c = c->next; 61 | } 62 | } 63 | if (cue_link_parent && _parent && !(static_cast (_parent))->on_screen) 64 | (static_cast (_parent))->cueOn(); 65 | // FIXME: no redraw is performend, we are relying on the redraw in mouseEnter/Leave! 66 | return true; 67 | } 68 | 69 | virtual bool cueOff(bool all = false, bool descent = false, bool excludeSelf = false) { 70 | //if (!all && cue_link_parent && _parent && (static_cast (_parent))->on_screen) { 71 | // ALog("%s: cueOff denied", describe()); 72 | // return false; 73 | //} 74 | if (descent) { 75 | if (cue_link_parent && _parent) 76 | return (static_cast (_parent))->cueOff(all, true); 77 | ALog("%s: cueOff descent reached root", describe()); 78 | } 79 | if (!all && inHoveringMode(true)) { 80 | ALog("%s: cueOff rejected, at least one widget is hovering", describe()); 81 | return false; 82 | } 83 | ALog("%s: cueOff allowed", describe()); 84 | if (!excludeSelf) 85 | on_screen = 0; 86 | if (all || cue_link_children) { 87 | chList_t *c = chRoot; 88 | while (c) { 89 | (static_cast (c->o))->cueOff(all); 90 | c = c->next; 91 | } 92 | } 93 | return true; 94 | } 95 | 96 | virtual bool mouseEnter(AEvent event) { 97 | ALog("ACueWidget %s: mouseEnter", describe()); 98 | AWidget::mouseEnter(event); 99 | if (!manual_cue) cueOn(); 100 | redrawWidget(); 101 | return false; // FIXME: we want to allow everyone to access move since it may be pertinent even to visuals that are not in the region - but maybe we should shift this back down to mouseMove 102 | } 103 | 104 | virtual bool mouseLeave(AEvent event) { 105 | ALog("ACueWidget %s: mouseLeave", describe()); 106 | AWidget::mouseLeave(event); 107 | if (!mouse_locked) { 108 | cueOff(false, cue_link_parent); 109 | redrawWidget(); 110 | } 111 | return false; // see comment in mouseEnter 112 | } 113 | 114 | virtual bool drawWidget() { 115 | return on_screen ? true : false; // subclasses won't draw if not on screen 116 | } 117 | }; 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /Acinonyx/ASort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASort.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 6/2/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_SORT_H 11 | #define A_SORT_H 12 | 13 | #include "ATypes.h" 14 | #include 15 | #include 16 | 17 | //--- sorting tools 18 | 19 | static void swapVSize(vsize_t *array, vsize_t a, vsize_t b) { 20 | vsize_t h = array[a]; 21 | array[a] = array[b]; 22 | array[b] = h; 23 | } 24 | 25 | /** Quicksort on a vsize_t array using permutation array to break ties (essentially secondary vsize_t array) 26 | @param array values to sort 27 | @param perm permutation array (if two array elements have the same value, the order is defined by perm values) 28 | @param iperm array of positions, will be perturbed accordingly to the sort order (must be initialized to some order 1:n) 29 | @param iFrom start index of the subarray to sort 30 | @param len length of the subarray to sort */ 31 | static void quicksortVSizesPerm(const vsize_t *array, const vsize_t *perm, vsize_t *iperm, vsize_t iFrom, vsize_t len) { 32 | if (len < 2) return; 33 | if (len == 2) { 34 | if (array[iperm[iFrom]] > array[iperm[iFrom + 1]] || 35 | (array[iperm[iFrom]] == array[iperm[iFrom + 1]] && perm[iperm[iFrom]] > perm[iperm[iFrom + 1]])) 36 | swapVSize(iperm, iFrom, iFrom + 1); 37 | return; 38 | } 39 | vsize_t pivot = iFrom + len / 2, ipivot = iperm[pivot]; 40 | vsize_t val = array[ipivot]; 41 | vsize_t pos = perm[ipivot]; 42 | vsize_t first = iFrom; 43 | swapVSize(iperm, iFrom + len - 1, pivot); 44 | for (vsize_t i = iFrom; i < iFrom + len - 1; i++) 45 | if (array[iperm[i]] < val || (array[iperm[i]] == val && perm[iperm[i]] < pos)) 46 | swapVSize(iperm, i, first++); 47 | swapVSize(iperm, first, iFrom + len - 1); 48 | quicksortVSizesPerm(array, perm, iperm, iFrom, first - iFrom); 49 | quicksortVSizesPerm(array, perm, iperm, first + 1, len + iFrom - first - 1); 50 | } 51 | 52 | #define str_compare(A,B) ::strcmp((A)?(A):"", (B)?(B):"") 53 | 54 | static void quicksortStringsPerm(const char **array, const vsize_t *perm, vsize_t *iperm, vsize_t iFrom, vsize_t len) { 55 | if (len < 2) return; 56 | if (len == 2) { 57 | int res = str_compare(array[iperm[iFrom]], array[iperm[iFrom + 1]]); 58 | if (res > 0 || (res == 0 && perm[iperm[iFrom]] > perm[iperm[iFrom + 1]])) 59 | swapVSize(iperm, iFrom, iFrom + 1); 60 | return; 61 | } 62 | vsize_t pivot = iFrom + len / 2, ipivot = iperm[pivot]; 63 | const char* val = array[ipivot]; 64 | vsize_t pos = perm[ipivot]; 65 | vsize_t first = iFrom; 66 | swapVSize(iperm, iFrom + len - 1, pivot); 67 | for (vsize_t i = iFrom; i < iFrom + len - 1; i++) { 68 | int res = str_compare(array[iperm[i]], val); 69 | if (res < 0 || (res == 0 && perm[iperm[i]] < pos)) 70 | swapVSize(iperm, i, first++); 71 | } 72 | swapVSize(iperm, first, iFrom + len - 1); 73 | quicksortStringsPerm(array, perm, iperm, iFrom, first - iFrom); 74 | quicksortStringsPerm(array, perm, iperm, first + 1, len + iFrom - first - 1); 75 | } 76 | 77 | // compare strings numerically by using the first part as a fp number and in equality compare the rest of the strings. 78 | static int nstr_compare(const char *A, const char *B) { 79 | char *endA, *endB; 80 | double a = ::strtod(A, &endA); 81 | double b = ::strtod(B, &endB); 82 | if (a < b) return -1; 83 | if (a > b) return 1; 84 | return ::strcmp(endA, endB); 85 | } 86 | 87 | static void quicksortNumericStringsPerm(const char **array, const vsize_t *perm, vsize_t *iperm, vsize_t iFrom, vsize_t len) { 88 | if (len < 2) return; 89 | if (len == 2) { 90 | int res = nstr_compare(array[iperm[iFrom]], array[iperm[iFrom + 1]]); 91 | if (res > 0 || (res == 0 && perm[iperm[iFrom]] > perm[iperm[iFrom + 1]])) 92 | swapVSize(iperm, iFrom, iFrom + 1); 93 | return; 94 | } 95 | vsize_t pivot = iFrom + len / 2, ipivot = iperm[pivot]; 96 | const char* val = array[ipivot]; 97 | vsize_t pos = perm[ipivot]; 98 | vsize_t first = iFrom; 99 | swapVSize(iperm, iFrom + len - 1, pivot); 100 | for (vsize_t i = iFrom; i < iFrom + len - 1; i++) { 101 | int res = nstr_compare(array[iperm[i]], val); 102 | if (res < 0 || (res == 0 && perm[iperm[i]] < pos)) 103 | swapVSize(iperm, i, first++); 104 | } 105 | swapVSize(iperm, first, iFrom + len - 1); 106 | quicksortNumericStringsPerm(array, perm, iperm, iFrom, first - iFrom); 107 | quicksortNumericStringsPerm(array, perm, iperm, first + 1, len + iFrom - first - 1); 108 | } 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /Win32/freetype/ftlzw.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftlzw.h */ 4 | /* */ 5 | /* LZW-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2004, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTLZW_H__ 20 | #define __FTLZW_H__ 21 | 22 | #include 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /*
*/ 37 | /* lzw */ 38 | /* */ 39 | /* */ 40 | /* LZW Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using LZW-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of LZW-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | /************************************************************************ 51 | * 52 | * @function: 53 | * FT_Stream_OpenLZW 54 | * 55 | * @description: 56 | * Open a new stream to parse LZW-compressed font files. This is 57 | * mainly used to support the compressed `*.pcf.Z' fonts that come 58 | * with XFree86. 59 | * 60 | * @input: 61 | * stream :: The target embedding stream. 62 | * 63 | * source :: The source stream. 64 | * 65 | * @return: 66 | * FreeType error code. 0~means success. 67 | * 68 | * @note: 69 | * The source stream must be opened _before_ calling this function. 70 | * 71 | * Calling the internal function `FT_Stream_Close' on the new stream will 72 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 73 | * objects will be released to the heap. 74 | * 75 | * The stream implementation is very basic and resets the decompression 76 | * process each time seeking backwards is needed within the stream 77 | * 78 | * In certain builds of the library, LZW compression recognition is 79 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 80 | * This means that if no font driver is capable of handling the raw 81 | * compressed file, the library will try to open a LZW stream from it 82 | * and re-open the face with it. 83 | * 84 | * This function may return `FT_Err_Unimplemented_Feature' if your build 85 | * of FreeType was not compiled with LZW support. 86 | */ 87 | FT_EXPORT( FT_Error ) 88 | FT_Stream_OpenLZW( FT_Stream stream, 89 | FT_Stream source ); 90 | 91 | /* */ 92 | 93 | 94 | FT_END_HEADER 95 | 96 | #endif /* __FTLZW_H__ */ 97 | 98 | 99 | /* END */ 100 | -------------------------------------------------------------------------------- /Win32/freetype/ftgzip.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgzip.h */ 4 | /* */ 5 | /* Gzip-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTGZIP_H__ 20 | #define __FTGZIP_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* gzip */ 38 | /* */ 39 | /* <Title> */ 40 | /* GZIP Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using gzip-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Gzip-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenGzip 55 | * 56 | * @description: 57 | * Open a new stream to parse gzip-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.gz' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, gzip compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a gzipped stream from 85 | * it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with zlib support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenGzip( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* __FTGZIP_H__ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /Win32/freetype/ftbzip2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbzip2.h */ 4 | /* */ 5 | /* Bzip2-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2010 by */ 8 | /* Joel Klinghed. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTBZIP2_H__ 20 | #define __FTBZIP2_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* bzip2 */ 38 | /* */ 39 | /* <Title> */ 40 | /* BZIP2 Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using bzip2-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Bzip2-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenBzip2 55 | * 56 | * @description: 57 | * Open a new stream to parse bzip2-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.bz2' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, bzip2 compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a bzip2 compressed stream 85 | * from it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with bzip2 support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenBzip2( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* __FTBZIP2_H__ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /Acinonyx/AObject.cpp: -------------------------------------------------------------------------------- 1 | #include "AObject.h" 2 | 3 | #ifdef AUTORELEASE_SUPPORT 4 | /* simple autorelease pool implementation - static list */ 5 | int AObject::arpe; 6 | AObject *AObject::arp[1024]; 7 | #endif 8 | 9 | /* buffer for describe() */ 10 | char AObject::desc_buf[512]; 11 | 12 | #ifdef ODEBUG 13 | /* global serial number - increased for each created object to uniquely 14 | identify it in the app */ 15 | object_serial_t _globalObjectSerial = 1; 16 | 17 | #define A_alloc_sentinel0 0x55aa33cc 18 | #define A_alloc_sentinel1 0x6699a55a 19 | 20 | 21 | 22 | // NOTE: we can't use describe() in A_alloc since the owner may not be initialized! Must use _ptr_describe instead! 23 | void* A_alloc(vsize_t size, vsize_t elt_size, AObject *owner) { 24 | vsize_t len = size * elt_size; 25 | void *mem = malloc(64 + len); 26 | if (!mem) { 27 | AError("***ERROR: alloc of %ld bytes failed!", (long) (len + 64)); 28 | return NULL; 29 | } 30 | char *memc = (char*) mem; 31 | void **memO = (void**) mem; 32 | int *memI = (int*) mem; 33 | vsize_t *memV = (vsize_t*) mem; 34 | int s1 = A_alloc_sentinel1; 35 | memI[0] = A_alloc_sentinel0; 36 | memV[1] = len; 37 | memO[2] = owner; 38 | memcpy(memc + 32 + len, &s1, sizeof(s1)); 39 | ALog("A_alloc:%p (%d) for %s", mem, len, owner ? owner->_ptr_describe() : "<unassigned>"); 40 | return memc + 32; 41 | } 42 | 43 | // this is less efficient than the usual AZAlloc since it actually accesses the memory, but it's for debugging after all .. 44 | void* A_calloc(vsize_t size, vsize_t elt_size, AObject *owner) { 45 | void *mem = A_alloc(size, elt_size, owner); 46 | memset(mem, 0, size * elt_size); 47 | return mem; 48 | } 49 | 50 | void* A_realloc(void *ptr, vsize_t size, AObject *owner) { 51 | char *memc = ((char*) ptr) - 32; 52 | vsize_t *memV = (vsize_t*) memc; 53 | // void **memO = (void**) memc; 54 | int *memI = (int*) memc; 55 | if (*memI != A_alloc_sentinel0) 56 | fprintf(stderr, "ERROR: A_realloc(%p) - pointer has no head sentinel! Possible memory corruption!", ptr); 57 | void *tail = memc + 32 + memV[1]; 58 | int s1 = A_alloc_sentinel1; 59 | if (memcmp(tail, &s1, sizeof(s1))) 60 | AError("ERROR: A_realloc(%p) - tail sentinel (size=%ld) missing or corrupted!", ptr, (long) memV[1]); 61 | void *mem = realloc(memc, size + 64); 62 | if (!mem) { 63 | AError("***ERROR: realloc (for %p to %ld) failed!", ptr, (long) (size + 64)); 64 | return NULL; 65 | } 66 | memc = (char*) mem; 67 | tail = memc + 32 + size; 68 | memcpy(tail, &s1, sizeof(s1)); 69 | return memc + 32; 70 | } 71 | 72 | void A_free(void *ptr) { 73 | char *memc = ((char*) ptr) - 32; 74 | vsize_t *memV = (vsize_t*) memc; 75 | // void **memO = (void**) memc; 76 | int *memI = (int*) memc; 77 | if (*memI != A_alloc_sentinel0) 78 | AError("ERROR: Afree(%p) - pointer has no head sentinel! Possible memory corruption!", ptr); 79 | void *tail = memc + 32 + memV[1]; 80 | int s1 = A_alloc_sentinel1; 81 | if (memcmp(tail, &s1, sizeof(s1))) 82 | AError("ERROR: Afree(%p) - tail sentinel missing or corrupted!", ptr); 83 | ALog("A_free:%x (%ld)", ptr, (long) memV[1]); 84 | free(memc); 85 | } 86 | 87 | void A_transfer(void *ptr, AObject *obj) { 88 | char *memc = ((char*) ptr) - 32; 89 | vsize_t *memV = (vsize_t*) memc; 90 | AObject **memO = (AObject**) memc; 91 | int *memI = (int*) memc; 92 | if (*memI != A_alloc_sentinel0) 93 | AError("ERROR: A_transfer(%p) - pointer has no head sentinel! Possible memory corruption!", ptr); 94 | void *tail = memc + 32 + memV[1]; 95 | int s1 = A_alloc_sentinel1; 96 | if (memcmp(tail, &s1, sizeof(s1))) 97 | AError("ERROR: A_transfer(%p) - tail sentinel missing or corrupted!", ptr); 98 | // AObject *prev = memO[2]; 99 | memO[2] = obj; 100 | ALog("A_transfer:%x (%d) transfer to %s", ptr, *memI, obj ? obj->_ptr_describe() : "<undefined>"); 101 | } 102 | 103 | void* A_memdup(const void *ptr, vsize_t len, AObject *owner) { 104 | void *mem = A_alloc(len, 1, owner); 105 | AMEM(mem); 106 | memcpy(mem, ptr, len); 107 | return mem; 108 | } 109 | 110 | char* A_strdup(const char *str, AObject *owner) { 111 | vsize_t len = strlen(str); 112 | char *ns = (char*) A_alloc(len + 1, 1, owner); 113 | AMEM(ns); 114 | strcpy(ns, str); 115 | return ns; 116 | } 117 | 118 | #else 119 | 120 | void* A_memdup(const void *ptr, vsize_t len, AObject *owner) { 121 | void *mem = malloc(len); 122 | AMEM(mem); 123 | memcpy(mem, ptr, len); 124 | return mem; 125 | } 126 | 127 | char* A_strdup(const char *str, AObject *owner) { 128 | vsize_t len = strlen(str); 129 | char *ns = (char*) malloc(len + 1); 130 | AMEM(ns); 131 | strcpy(ns, str); 132 | return ns; 133 | } 134 | 135 | #endif 136 | 137 | void AObject_retain(void *o) 138 | { 139 | ((AObject*)o)->retain(); 140 | } 141 | 142 | void AObject_release(void *o) 143 | { 144 | ((AObject*)o)->release(); 145 | } 146 | -------------------------------------------------------------------------------- /Win32/freetype/ftxf86.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftxf86.h */ 4 | /* */ 5 | /* Support functions for X11. */ 6 | /* */ 7 | /* Copyright 2002, 2003, 2004, 2006, 2007 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __FTXF86_H__ 20 | #define __FTXF86_H__ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* font_formats */ 39 | /* */ 40 | /* <Title> */ 41 | /* Font Formats */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* Getting the font format. */ 45 | /* */ 46 | /* <Description> */ 47 | /* The single function in this section can be used to get the font */ 48 | /* format. Note that this information is not needed normally; */ 49 | /* however, there are special cases (like in PDF devices) where it is */ 50 | /* important to differentiate, in spite of FreeType's uniform API. */ 51 | /* */ 52 | /* This function is in the X11/xf86 namespace for historical reasons */ 53 | /* and in no way depends on that windowing system. */ 54 | /* */ 55 | /*************************************************************************/ 56 | 57 | 58 | /*************************************************************************/ 59 | /* */ 60 | /* <Function> */ 61 | /* FT_Get_X11_Font_Format */ 62 | /* */ 63 | /* <Description> */ 64 | /* Return a string describing the format of a given face, using values */ 65 | /* which can be used as an X11 FONT_PROPERTY. Possible values are */ 66 | /* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */ 67 | /* `PFR', and `Windows~FNT'. */ 68 | /* */ 69 | /* <Input> */ 70 | /* face :: */ 71 | /* Input face handle. */ 72 | /* */ 73 | /* <Return> */ 74 | /* Font format string. NULL in case of error. */ 75 | /* */ 76 | FT_EXPORT( const char* ) 77 | FT_Get_X11_Font_Format( FT_Face face ); 78 | 79 | /* */ 80 | 81 | FT_END_HEADER 82 | 83 | #endif /* __FTXF86_H__ */ 84 | -------------------------------------------------------------------------------- /Acinonyx/AStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AStack.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/5/09. 6 | * Copyright 2009 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | 10 | /** Important note! All stack implementations transfer ownership on pop() so it becomes the responsibility of the caller to release the returned object! */ 11 | 12 | #ifndef A_STACK_H_ 13 | #define A_STACK_H_ 14 | 15 | 16 | /** General interface for all stack implementations */ 17 | class AStack : public AObject { 18 | public: 19 | virtual void push(AObject* obj) = 0; 20 | virtual AObject *pop() = 0; 21 | virtual void popAll() = 0; 22 | virtual AObject *peek() = 0; 23 | virtual bool isEmpty() = 0; 24 | virtual bool isLast() = 0; 25 | }; 26 | 27 | typedef struct AStackBlock { 28 | vsize_t capacity, length; 29 | struct AStackBlock *prev; 30 | AObject *o[1]; 31 | } AStackBlock_t; 32 | 33 | 34 | class ABlockStack : public AStack { 35 | protected: 36 | AStackBlock_t *top; 37 | vsize_t default_capacity; 38 | 39 | public: 40 | ABlockStack(vsize_t increments = 128) { 41 | default_capacity = increments; 42 | if (default_capacity < 16) default_capacity = 16; 43 | top = (AStackBlock_t*) AAlloc(sizeof(AStackBlock_t) + sizeof(AObject*) * default_capacity); 44 | AMEM(top); 45 | top->capacity = default_capacity; 46 | top->length = 0; 47 | top->prev = 0; 48 | OCLASS(ABlockStack) 49 | } 50 | 51 | virtual ~ABlockStack() { 52 | popAll(); 53 | AFree(top); 54 | DCLASS(ABlockStack) 55 | } 56 | 57 | virtual void push(AObject* obj) { 58 | if (!obj) return; 59 | if (top->length >= top->capacity) { 60 | AStackBlock_t *new_block = (AStackBlock_t*) AAlloc(sizeof(AStackBlock_t) + sizeof(AObject*) * default_capacity); 61 | AMEM(new_block); 62 | new_block->capacity = default_capacity; 63 | new_block->length = 0; 64 | new_block->prev = top; 65 | top = new_block; 66 | } 67 | top->o[top->length++] = obj->retain(); 68 | } 69 | 70 | virtual AObject *pop() { 71 | if (top->length == 0) return NULL; 72 | AObject *o = top->o[--(top->length)]; 73 | if (top->length == 0 && top->prev) { 74 | void *last = top; 75 | top = top->prev; 76 | AFree(last); 77 | } 78 | return o; 79 | } 80 | 81 | virtual void popAll() { 82 | while (top->length) { 83 | vsize_t n = top->length; 84 | for (vsize_t i = 0; i < n; i++) 85 | top->o[i]->release(); 86 | if (top->prev) { 87 | void *last = top; 88 | top = top->prev; 89 | AFree(last); 90 | } else top->length = 0; 91 | } 92 | } 93 | 94 | virtual AObject *peek() { 95 | return (top->length == 0) ? NULL : top->o[top->length - 1]; 96 | } 97 | 98 | virtual bool isEmpty() { 99 | return (top->length == 0); 100 | } 101 | 102 | virtual bool isLast() { 103 | return (top->length == 1 && top->prev == NULL); 104 | } 105 | 106 | virtual char *describe() { 107 | vsize_t n = 0, b = 0; 108 | AStackBlock_t *cb = top; 109 | while (cb) { 110 | n += cb -> length; 111 | cb = cb -> prev; 112 | b++; 113 | } 114 | #ifdef ODEBUG 115 | snprintf(desc_buf, 512, "<%p/%d %04x %s [%d] %d elements, %d blocks>", this, refcount, _objectSerial, _className, _classSize, n, b); 116 | #else 117 | snprintf(desc_buf, 512, "<ABlockStack %p %d elements (%d blocks)>", this, n, b); 118 | #endif 119 | return desc_buf; 120 | } 121 | 122 | }; 123 | 124 | class AForgetfulStack : public AStack { 125 | protected: 126 | AObject **stack; 127 | vsize_t top_, size_; 128 | public: 129 | AForgetfulStack(vsize_t size) : size_(size) { 130 | top_ = 0; 131 | if (size_ < 1) size_ = 1; 132 | stack = (AObject**) AAlloc(sizeof(AObject*) * size_); 133 | AMEM(stack); 134 | OCLASS(AForgetfulStack) 135 | } 136 | 137 | virtual ~AForgetfulStack() { 138 | popAll(); 139 | AFree(stack); 140 | DCLASS(AForgetfulStack) 141 | } 142 | 143 | virtual void popAll() { 144 | while (top_) { 145 | if (stack[top_]) 146 | stack[top_]->release(); 147 | top_--; 148 | } 149 | } 150 | 151 | virtual bool isEmpty() { 152 | return (top_ == 0); 153 | } 154 | 155 | virtual bool isLast() { 156 | return (top_ == 1); 157 | } 158 | 159 | virtual AObject* peek() { 160 | return top_ ? stack[top_ - 1] : 0; 161 | } 162 | 163 | virtual void push(AObject *obj) { 164 | if (top_ == size_) { 165 | if (stack[0]) 166 | stack[0]->release(); 167 | memmove(stack, stack + 1, sizeof(AObject*) * size_); 168 | top_--; 169 | } 170 | if (obj) 171 | obj->retain(); 172 | stack[top_++] = obj; 173 | } 174 | 175 | virtual AObject* pop() { 176 | if (top_) 177 | return stack[--top_]; 178 | return 0; 179 | } 180 | 181 | virtual char *describe() { 182 | #ifdef ODEBUG 183 | snprintf(desc_buf, 512, "<%p/%d %04x %s [%d] %d/%d elements>", this, refcount, _objectSerial, _className, _classSize, top_, size_); 184 | #else 185 | snprintf(desc_buf, 512, "<AForgetfulStack %p %d/%d>", this, top_, size_); 186 | #endif 187 | return desc_buf; 188 | } 189 | 190 | }; 191 | 192 | #endif 193 | -------------------------------------------------------------------------------- /Win32/freetype/ftgasp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgasp.h */ 4 | /* */ 5 | /* Access of TrueType's `gasp' table (specification). */ 6 | /* */ 7 | /* Copyright 2007, 2008, 2011 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef _FT_GASP_H_ 20 | #define _FT_GASP_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | /*************************************************************************** 33 | * 34 | * @section: 35 | * gasp_table 36 | * 37 | * @title: 38 | * Gasp Table 39 | * 40 | * @abstract: 41 | * Retrieving TrueType `gasp' table entries. 42 | * 43 | * @description: 44 | * The function @FT_Get_Gasp can be used to query a TrueType or OpenType 45 | * font for specific entries in its `gasp' table, if any. This is 46 | * mainly useful when implementing native TrueType hinting with the 47 | * bytecode interpreter to duplicate the Windows text rendering results. 48 | */ 49 | 50 | /************************************************************************* 51 | * 52 | * @enum: 53 | * FT_GASP_XXX 54 | * 55 | * @description: 56 | * A list of values and/or bit-flags returned by the @FT_Get_Gasp 57 | * function. 58 | * 59 | * @values: 60 | * FT_GASP_NO_TABLE :: 61 | * This special value means that there is no GASP table in this face. 62 | * It is up to the client to decide what to do. 63 | * 64 | * FT_GASP_DO_GRIDFIT :: 65 | * Grid-fitting and hinting should be performed at the specified ppem. 66 | * This *really* means TrueType bytecode interpretation. If this bit 67 | * is not set, no hinting gets applied. 68 | * 69 | * FT_GASP_DO_GRAY :: 70 | * Anti-aliased rendering should be performed at the specified ppem. 71 | * If not set, do monochrome rendering. 72 | * 73 | * FT_GASP_SYMMETRIC_SMOOTHING :: 74 | * If set, smoothing along multiple axes must be used with ClearType. 75 | * 76 | * FT_GASP_SYMMETRIC_GRIDFIT :: 77 | * Grid-fitting must be used with ClearType's symmetric smoothing. 78 | * 79 | * @note: 80 | * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be 81 | * used for standard font rasterization only. Independently of that, 82 | * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to 83 | * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and 84 | * `FT_GASP_DO_GRAY' are consequently ignored). 85 | * 86 | * `ClearType' is Microsoft's implementation of LCD rendering, partly 87 | * protected by patents. 88 | * 89 | * @since: 90 | * 2.3.0 91 | */ 92 | #define FT_GASP_NO_TABLE -1 93 | #define FT_GASP_DO_GRIDFIT 0x01 94 | #define FT_GASP_DO_GRAY 0x02 95 | #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 96 | #define FT_GASP_SYMMETRIC_GRIDFIT 0x10 97 | 98 | 99 | /************************************************************************* 100 | * 101 | * @func: 102 | * FT_Get_Gasp 103 | * 104 | * @description: 105 | * Read the `gasp' table from a TrueType or OpenType font file and 106 | * return the entry corresponding to a given character pixel size. 107 | * 108 | * @input: 109 | * face :: The source face handle. 110 | * ppem :: The vertical character pixel size. 111 | * 112 | * @return: 113 | * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no 114 | * `gasp' table in the face. 115 | * 116 | * @since: 117 | * 2.3.0 118 | */ 119 | FT_EXPORT( FT_Int ) 120 | FT_Get_Gasp( FT_Face face, 121 | FT_UInt ppem ); 122 | 123 | /* */ 124 | 125 | #endif /* _FT_GASP_H_ */ 126 | 127 | 128 | /* END */ 129 | -------------------------------------------------------------------------------- /Acinonyx/AVisual.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AVisual.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_VISUAL_H_ 11 | #define A_VISUAL_H_ 12 | 13 | #include "AObject.h" 14 | #include "ARenderer.h" 15 | 16 | class AContainer; 17 | 18 | #define AVF_CONTAINER 0x0001 19 | 20 | /* flags related to resizing in containers */ 21 | #define AVF_FIX_TOP 0x0100 22 | #define AVF_FIX_LEFT 0x0200 23 | #define AVF_FIX_BOTTOM 0x0400 24 | #define AVF_FIX_RIGHT 0x0800 25 | #define AVF_FIX_WIDTH 0x1000 26 | #define AVF_FIX_HEIGHT 0x2000 27 | 28 | #define AVF_XSPRING (AVF_FIX_RIGHT|AVF_FIX_LEFT) 29 | #define AVF_YSPRING (AVF_FIX_TOP|AVF_FIX_BOTTOM) 30 | 31 | /* clipping */ 32 | #define AVF_CLIPPED 0x10000 33 | 34 | /* hide/show */ 35 | #define AVF_HIDDEN 0x20000 36 | 37 | /* events (children may want to request those via requestFlags()) // NOTE: currently ignored? */ 38 | #define AVFE_MOUSE_MOVE 0x100000 39 | #define AVFE_MOUSE_DRAG 0x200000 40 | 41 | #define AVF_DEFAULT (AVF_CLIPPED) 42 | 43 | class AQuery; 44 | 45 | class AVisual : public ARenderer { 46 | protected: 47 | AContainer *_parent; 48 | ASize _min_size, _max_size; 49 | unsigned int _flags; 50 | 51 | void setParent(AContainer *parent) { _parent = parent; } 52 | public: 53 | AVisual(AContainer *parent, ARect frame, unsigned int flags = AVF_DEFAULT) : ARenderer(parent?((ARenderer*)parent)->window():NULL, frame), _parent(parent), _flags(flags), 54 | _min_size(AUndefSize), _max_size(AUndefSize) { OCLASS(AVisual) }; 55 | 56 | virtual const char *caption() { 57 | return describe(); 58 | } 59 | 60 | AContainer *parent() { return _parent; } 61 | unsigned int flags() { return _flags; } 62 | 63 | // child requests propagation of given flags up the parent chain - currently only AVFE_MOUSE_DRAG and AVFE_MOUSE_MOVE are allowed 64 | void requestFlags(unsigned int mask) { 65 | mask &= AVFE_MOUSE_DRAG | AVFE_MOUSE_MOVE; 66 | if (mask) { 67 | _flags |= mask; 68 | if (_parent) 69 | ((AVisual*)_parent)->requestFlags(mask); 70 | } 71 | } 72 | 73 | bool isContainer() { return (_flags & AVF_CONTAINER) ? true : false; } 74 | bool isHidden() { return (_flags & AVF_HIDDEN) ? true : false ; } 75 | 76 | /** this method should be overridden by subclasses to implement the actual drawing of individual layers. Note that although layers will be draw in sequential order, lower layer can be cached, so all necessary data processing shoul dbe done in update() instead. 77 | * @param layer layer to draw (see LAYER_xx constants for default layers) */ 78 | virtual void draw(vsize_t layer) { } 79 | 80 | /** this method should be overridden by subclasses to provide query information. 81 | * @param query current query object that can be modified to display the desired information. 82 | * @param level level of the query */ 83 | virtual void query(AQuery *query, int level) { 84 | } 85 | 86 | virtual void setHidden(bool hf) { 87 | // FIXME: we should do a redraw or something ... 88 | if (hf && (_flags & AVF_HIDDEN) == 0) 89 | _flags |= AVF_HIDDEN; 90 | if (!hf && (_flags & AVF_HIDDEN)) 91 | _flags ^= AVF_HIDDEN; 92 | } 93 | 94 | virtual bool event(AEvent event) { 95 | #ifdef EDEBUG 96 | if (event.event != AE_MOUSE_MOVE || (event.event & (AEF_BUTTON1|AEF_BUTTON2|AEF_BUTTON3))) 97 | ELog("%s: event(%x,%x,%d,(%g,%g))", describe(), event.event, event.flags, event.key, event.location.x, event.location.y); 98 | #endif 99 | switch (event.event) { // dispatch to virtual event methods 100 | case AE_MOUSE_UP: return mouseUp(event); 101 | case AE_MOUSE_DOWN: return mouseDown(event); 102 | case AE_MOUSE_MOVE: return mouseMove(event); 103 | case AE_KEY_UP: return keyUp(event); 104 | case AE_KEY_DOWN: return keyDown(event); 105 | } 106 | return false; 107 | } 108 | 109 | // we split up events for convenience when overriding - this may go to another class or not 110 | virtual bool mouseDown(AEvent event) { return false; } 111 | virtual bool mouseUp(AEvent event) { return false; } 112 | virtual bool mouseMove(AEvent event) { return false; } 113 | virtual bool keyDown(AEvent event) { return false; } 114 | virtual bool keyUp(AEvent event) { return false; } 115 | 116 | // NOTE: setFrame inherited from ARenderer is non-virtual, defined in window coordinates and specific for rendering 117 | virtual void moveAndResize(ARect frame) { setFrame(frame); } 118 | virtual void move(APoint where) { ARect f = _frame; f.x = where.x; f.y = where.y; setFrame(f); } 119 | }; 120 | 121 | /** This is asimple visual box - it is used mainly for debugging */ 122 | class AVisualBox : public AVisual { 123 | protected: 124 | AColor color_; 125 | public: 126 | AVisualBox(AContainer *parent, ARect frame, unsigned int flags, AColor color) : AVisual(parent, frame, flags), color_(color) { OCLASS(AVisualBox) } 127 | 128 | virtual void draw(vsize_t layer) { 129 | if (layer == LAYER_ROOT) { 130 | color(color_); 131 | rect(_frame); 132 | rectO(_frame); 133 | } 134 | } 135 | }; 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /Cocoa/CocoaView.mm: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaView.m 3 | // Acinonyx 4 | // 5 | // Created by Simon Urbanek 6 | // Copyright 2008 Simon Urbanek. All rights reserved. 7 | // 8 | 9 | #import "CocoaView.h" 10 | 11 | #include "ATypes.h" 12 | #include "AScatterPlot.h" 13 | 14 | /* for pre-10.5 compatibility */ 15 | #ifndef NSINTEGER_DEFINED 16 | #if __LP64__ || NS_BUILD_32_LIKE_64 17 | typedef long NSInteger; 18 | typedef unsigned long NSUInteger; 19 | #else 20 | typedef int NSInteger; 21 | typedef unsigned int NSUInteger; 22 | #endif 23 | #define NSINTEGER_DEFINED 1 24 | #endif 25 | 26 | // conversion between Cocoa events and AEvents 27 | static int NSEvent2AEFlags(NSEvent *e) { 28 | int flags = 0; 29 | NSUInteger ef = [e modifierFlags]; 30 | if (ef & NSShiftKeyMask) flags |= AEF_SHIFT; 31 | if (ef & NSControlKeyMask) flags |= AEF_CTRL; 32 | if (ef & NSAlternateKeyMask) flags |= AEF_ALT; 33 | if (ef & NSCommandKeyMask) flags |= AEF_META; 34 | return flags; 35 | } 36 | 37 | static APoint NSEventLoc2AEPoint(NSEvent *e) { 38 | NSPoint pt = [e locationInWindow]; 39 | return AMkPoint(pt.x, pt.y); 40 | } 41 | 42 | @implementation CocoaView 43 | 44 | - (id)initWithFrame:(NSRect)frame visual: (AVisual*) aVisual { 45 | unsigned int attrs[] = { 46 | NSOpenGLPFAAccelerated, 47 | // NSOpenGLPFAColorSize, 24, 48 | // NSOpenGLPFAAlphaSize, 16, 49 | NSOpenGLPFANoRecovery, 50 | #ifdef PFA 51 | NSOpenGLPFASampleBuffers, 1, NSOpenGLPFASamples, 4, 52 | #endif 53 | /* <- anti-aliasing */ 54 | 0 }; 55 | self = [super initWithFrame:frame pixelFormat:[[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*)attrs]]; 56 | if (self) { 57 | #ifdef RETINA_SUPPORT 58 | // Should we use hi-res on Retina? 59 | [self setWantsBestResolutionOpenGLSurface:YES]; 60 | #endif 61 | // visual = new MyVisual(AMkRect(frame.origin.x,frame.origin.y,frame.size.width,frame.size.height)); 62 | visual = (AVisual*) aVisual->retain(); 63 | } 64 | return self; 65 | } 66 | 67 | - (void)drawRect:(NSRect)rect { 68 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 69 | NSRect frame = [self frame]; 70 | // NSLog(@" frame = %f,%f - %f x %f\n", frame.origin.x,frame.origin.y,frame.size.width,frame.size.height); 71 | 72 | /*NSLog(@"OpenGL:\n - vendor = '%s'\n - renderer = '%s'\n - version = '%s'\n - exts = '%s'", 73 | glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION), glGetString(GL_EXTENSIONS)); */ 74 | 75 | ARect nvframe = AMkRect(frame.origin.x,frame.origin.y,frame.size.width,frame.size.height); 76 | /* 77 | ARect vframe = visual->frame(); 78 | if (!ARectsAreEqual(nvframe, vframe)) 79 | visual->moveAndResize(nvframe); 80 | */ 81 | 82 | AWindow *win = visual->window(); 83 | if (win) { 84 | ARect wframe = win->frame(); 85 | if (!ARectsAreEqual(nvframe, wframe)) 86 | win->setFrame(nvframe); 87 | win->begin(); 88 | win->draw(); 89 | win->end(); 90 | } 91 | 92 | [pool release]; 93 | } 94 | 95 | - (void) setAWindow: (AWindow*) aWin 96 | { 97 | if (visual) visual->setWindow(aWin); 98 | } 99 | 100 | - (void)mouseDown:(NSEvent *)theEvent 101 | { 102 | visual->event(AMkEvent(AE_MOUSE_DOWN, NSEvent2AEFlags(theEvent) | AEF_BUTTON1, 0, NSEventLoc2AEPoint(theEvent))); 103 | } 104 | 105 | - (void)rightMouseDown:(NSEvent *)theEvent 106 | { 107 | visual->event(AMkEvent(AE_MOUSE_DOWN, NSEvent2AEFlags(theEvent) | AEF_BUTTON2, 0, NSEventLoc2AEPoint(theEvent))); 108 | } 109 | 110 | - (void)mouseMoved:(NSEvent *)theEvent 111 | { 112 | visual->event(AMkEvent(AE_MOUSE_MOVE, NSEvent2AEFlags(theEvent), 0, NSEventLoc2AEPoint(theEvent))); 113 | } 114 | 115 | - (void)mouseDragged:(NSEvent *)theEvent 116 | { 117 | visual->event(AMkEvent(AE_MOUSE_MOVE, NSEvent2AEFlags(theEvent) | AEF_BUTTON1, 0, NSEventLoc2AEPoint(theEvent))); 118 | } 119 | 120 | - (void)rightMouseDragged:(NSEvent *)theEvent 121 | { 122 | visual->event(AMkEvent(AE_MOUSE_MOVE, NSEvent2AEFlags(theEvent) | AEF_BUTTON2, 0, NSEventLoc2AEPoint(theEvent))); 123 | } 124 | 125 | - (void)mouseUp:(NSEvent *)theEvent 126 | { 127 | visual->event(AMkEvent(AE_MOUSE_UP, NSEvent2AEFlags(theEvent) | AEF_BUTTON1, 0, NSEventLoc2AEPoint(theEvent))); 128 | } 129 | 130 | - (void)rightMouseUp:(NSEvent *)theEvent 131 | { 132 | visual->event(AMkEvent(AE_MOUSE_UP, NSEvent2AEFlags(theEvent) | AEF_BUTTON2, 0, NSEventLoc2AEPoint(theEvent))); 133 | } 134 | 135 | - (void)keyDown:(NSEvent *)theEvent 136 | { 137 | visual->event(AMkEvent(AE_KEY_DOWN, NSEvent2AEFlags(theEvent), [theEvent keyCode], NSEventLoc2AEPoint(theEvent))); 138 | } 139 | 140 | - (void)keyUp:(NSEvent *)theEvent 141 | { 142 | visual->event(AMkEvent(AE_KEY_UP, NSEvent2AEFlags(theEvent), [theEvent keyCode], NSEventLoc2AEPoint(theEvent))); 143 | } 144 | 145 | - (BOOL)isOpaque { return YES; } 146 | 147 | /* 148 | - (BOOL) performKeyEquivalent: (NSEvent*) event 149 | { 150 | NSLog(@"%@: performKeyEquivalent: %@", self, event); 151 | return NO; 152 | }*/ 153 | 154 | - (void) dealloc 155 | { 156 | NSLog(@"%@: dealloc", self); 157 | if (visual) visual->release(); 158 | [super dealloc]; 159 | } 160 | 161 | @end 162 | -------------------------------------------------------------------------------- /Win32/freetype/internal/services/svttcmap.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* svttcmap.h */ 4 | /* */ 5 | /* The FreeType TrueType/sfnt cmap extra information service. */ 6 | /* */ 7 | /* Copyright 2003 by */ 8 | /* Masatake YAMATO, Redhat K.K. */ 9 | /* */ 10 | /* Copyright 2003, 2008 by */ 11 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 12 | /* */ 13 | /* This file is part of the FreeType project, and may only be used, */ 14 | /* modified, and distributed under the terms of the FreeType project */ 15 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 16 | /* this file you indicate that you have read the license and */ 17 | /* understand and accept it fully. */ 18 | /* */ 19 | /***************************************************************************/ 20 | 21 | /* Development of this service is support of 22 | Information-technology Promotion Agency, Japan. */ 23 | 24 | #ifndef __SVTTCMAP_H__ 25 | #define __SVTTCMAP_H__ 26 | 27 | #include FT_INTERNAL_SERVICE_H 28 | #include FT_TRUETYPE_TABLES_H 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | #define FT_SERVICE_ID_TT_CMAP "tt-cmaps" 35 | 36 | 37 | /*************************************************************************/ 38 | /* */ 39 | /* <Struct> */ 40 | /* TT_CMapInfo */ 41 | /* */ 42 | /* <Description> */ 43 | /* A structure used to store TrueType/sfnt specific cmap information */ 44 | /* which is not covered by the generic @FT_CharMap structure. This */ 45 | /* structure can be accessed with the @FT_Get_TT_CMap_Info function. */ 46 | /* */ 47 | /* <Fields> */ 48 | /* language :: */ 49 | /* The language ID used in Mac fonts. Definitions of values are in */ 50 | /* freetype/ttnameid.h. */ 51 | /* */ 52 | /* format :: */ 53 | /* The cmap format. OpenType 1.5 defines the formats 0 (byte */ 54 | /* encoding table), 2~(high-byte mapping through table), 4~(segment */ 55 | /* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */ 56 | /* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */ 57 | /* coverage), and 14 (Unicode Variation Sequences). */ 58 | /* */ 59 | typedef struct TT_CMapInfo_ 60 | { 61 | FT_ULong language; 62 | FT_Long format; 63 | 64 | } TT_CMapInfo; 65 | 66 | 67 | typedef FT_Error 68 | (*TT_CMap_Info_GetFunc)( FT_CharMap charmap, 69 | TT_CMapInfo *cmap_info ); 70 | 71 | 72 | FT_DEFINE_SERVICE( TTCMaps ) 73 | { 74 | TT_CMap_Info_GetFunc get_cmap_info; 75 | }; 76 | 77 | #ifndef FT_CONFIG_OPTION_PIC 78 | 79 | #define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ 80 | static const FT_Service_TTCMapsRec class_ = \ 81 | { \ 82 | get_cmap_info_ \ 83 | }; 84 | 85 | #else /* FT_CONFIG_OPTION_PIC */ 86 | 87 | #define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ 88 | void \ 89 | FT_Init_Class_##class_( FT_Library library, \ 90 | FT_Service_TTCMapsRec* clazz) \ 91 | { \ 92 | FT_UNUSED(library); \ 93 | clazz->get_cmap_info = get_cmap_info_; \ 94 | } 95 | 96 | #endif /* FT_CONFIG_OPTION_PIC */ 97 | 98 | /* */ 99 | 100 | 101 | FT_END_HEADER 102 | 103 | #endif /* __SVTTCMAP_H__ */ 104 | 105 | 106 | /* END */ 107 | -------------------------------------------------------------------------------- /Acinonyx/ATypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ATypes.h - basic Acinonyx types 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek 6 | * Copyright 2008 Simon Urbanek. All rights reserved. 7 | * 8 | * lang: C 9 | */ 10 | 11 | #ifndef A_TYPES_H 12 | #define A_TYPES_H 13 | 14 | #define PFA 1 15 | 16 | #define LAYER_ROOT 0 17 | #define LAYER_HILITE 1 18 | #define LAYER_OBJECTS 2 19 | #define LAYER_WIDGETS 3 /* widgets layer (currently we fold trans and widgets since we use currently cue-widgets but it may change...) */ 20 | #define LAYER_TRANS 3 /* transient layer - topmost */ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* basic types */ 27 | 28 | typedef double AFloat; /**< basic floating point type used throughout Acinonyx for graphics purposes */ 29 | 30 | typedef unsigned int vsize_t; /**< basic unsigned type for iterations and sized in Acinonyx */ 31 | 32 | typedef unsigned int notifid_t; /**< notification ID type */ 33 | 34 | typedef unsigned char byte_t; /**< unsigend 8-bit type for general storage */ 35 | 36 | typedef struct ARect_s { AFloat x,y,width,height; } ARect; /**< structure representing a rectangular region by progin and size */ 37 | typedef struct APoint_s { AFloat x,y; } APoint; /**< structure describing a point */ 38 | typedef struct ASize_s { AFloat width, height; } ASize; /**< structure describing size */ 39 | 40 | typedef struct ADataRange_s { double begin, length; } ADataRange; /**< structure describing a range of data points */ 41 | typedef struct ARange_s { AFloat begin, length; } ARange; /**< structure describing a range of graphics points */ 42 | 43 | typedef struct AColor_s { AFloat r,g,b,a; } AColor; /**< structure describing RGBA color */ 44 | 45 | /** strcture describing an event in Acinonyx */ 46 | typedef struct AEvent_s { 47 | int event; 48 | int flags; 49 | int key; 50 | APoint location; 51 | } AEvent; 52 | 53 | #define AMkRect(x,y,w,h) ((ARect) { (x),(y),(w),(h) }) 54 | #define AMkPoint(x,y) ((APoint) { (x),(y) }) 55 | #define AMkSize(w,h) ((ASize) { (w),(h) }) 56 | #define AMkRange(b,l) ((ARange) { (b),(l) }) 57 | #define AMkDataRange(b,l) ((ADataRange) { (b),(l) }) 58 | #define AMkEvent(e,f,k,l) ((AEvent) { (e),(f),(k),(l) }) 59 | #define AMkColor(r,g,b,a) ((AColor) { (r),(g),(b),(a) }) 60 | 61 | #define AMAX(X,Y) (((X) > (Y))?(X):(Y)) 62 | #define AMIN(X,Y) (((X) < (Y))?(X):(Y)) 63 | 64 | #define AUndefSize AMkSize(-1.0f, -1.0f) 65 | // FIXME: AUndefRange needs a more reasonable definition 66 | #define AUndefRange AMkRange(0.0f, -1.0f) 67 | #define AUndefDataRange AMkDataRange(0.0, -1.0) 68 | 69 | #define ANotFound ((vsize_t) -1) 70 | 71 | #define APointsAreEqual(A,B) (((A).x == (B).x) && ((A).y == (B).y)) 72 | #define ASizesAreEqual(A,B) (((A).width == (B).width) && ((A).height == (B).height)) 73 | #define ARectsAreEqual(A,B) (APointsAreEqual(A,B) && ASizesAreEqual(A,B)) 74 | #define ADataRangesAreEqual(A,B) (((A).begin == (B).begin) && ((A).length == (B).length)) 75 | #define ARectContains(A,B) (((B).x >= (A).x) && ((B).x <= (A).x + (A).width) && ((B).y >= (A).y) && ((B).y <= (A).y + (A).height)) 76 | #define ARectsIntersect(A,B) (!(((A).x + (A).width < (B).x) || ((A).x > (B).x + (B).width) || ((A).y + (A).height < (B).y) || ((A).y > (B).y + (B).height))) 77 | #define ARect4(X) (X).x, (X).y, (X).width, (X).height 78 | #define AColorsAreEqual(A,B) (((A).r == (B).r) && ((A).g == (B).g) && ((A).b == (B).b) && ((A).a == (B).a)) 79 | 80 | #define AEF_BUTTON1 0x001 81 | #define AEF_BUTTON2 0x002 82 | #define AEF_BUTTON3 0x004 83 | #define AEF_BUTTONS 0x007 84 | #define AEF_SHIFT 0x010 85 | #define AEF_CTRL 0x020 86 | #define AEF_ALT 0x040 87 | #define AEF_META 0x080 88 | #define AEF_MKEYS 0x0f0 89 | 90 | #define AE_MOUSE_DOWN 0x0101 91 | #define AE_MOUSE_UP 0x0102 92 | #define AE_MOUSE_CLICK 0x0103 93 | #define AE_MOUSE_2CLICK 0x0104 94 | 95 | #define AE_MOUSE_IN 0x0106 96 | #define AE_MOUSE_OUT 0x0107 97 | 98 | #define AE_MOUSE_MOVE 0x0108 99 | 100 | #define AE_KEY_DOWN 0x0201 101 | #define AE_KEY_UP 0x0202 102 | #define AE_KEY_TYPED 0x0203 103 | 104 | #define KEY_LEFT 123 105 | #define KEY_RIGHT 124 106 | #define KEY_DOWN 125 107 | #define KEY_UP 126 108 | 109 | #define KEY_A 0 110 | #define KEY_S 1 111 | #define KEY_H 4 112 | #define KEY_C 8 113 | #define KEY_X 7 114 | #define KEY_0 29 115 | #define KEY_L 37 116 | #define KEY_U 32 117 | #define KEY_I 34 118 | #define KEY_1 18 119 | #define KEY_2 19 120 | #define KEY_3 20 121 | #define KEY_4 21 122 | #define KEY_5 23 123 | 124 | /** This macro is used after memory allocation to check for out of memory issues */ 125 | #define AMEM(x) // FIXME: replace with some error handling if x is NULL 126 | 127 | #include <limits.h> 128 | 129 | extern double NA_double; 130 | extern float NA_float; 131 | #define NA_int INT_MIN 132 | 133 | #ifdef EDEBUG 134 | #ifdef DEBUG 135 | #define ELog ALog 136 | #else 137 | #define ELog printf 138 | #endif 139 | #endif 140 | 141 | int R_IsNA(double x); 142 | 143 | /* AinNA should be used to check for the presence of NA in the data */ 144 | #define AisNA(X) R_IsNA(X) 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | 150 | #endif 151 | -------------------------------------------------------------------------------- /Win32/freetype/tttags.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* tttags.h */ 4 | /* */ 5 | /* Tags for TrueType and OpenType tables (specification only). */ 6 | /* */ 7 | /* Copyright 1996-2001, 2004, 2005, 2007, 2008 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef __TTAGS_H__ 20 | #define __TTAGS_H__ 21 | 22 | 23 | #include <ft2build.h> 24 | #include FT_FREETYPE_H 25 | 26 | #ifdef FREETYPE_H 27 | #error "freetype.h of FreeType 1 has been loaded!" 28 | #error "Please fix the directory search order for header files" 29 | #error "so that freetype.h of FreeType 2 is found first." 30 | #endif 31 | 32 | 33 | FT_BEGIN_HEADER 34 | 35 | 36 | #define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) 37 | #define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) 38 | #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) 39 | #define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) 40 | #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) 41 | #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) 42 | #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) 43 | #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) 44 | #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) 45 | #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) 46 | #define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) 47 | #define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) 48 | #define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) 49 | #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) 50 | #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) 51 | #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) 52 | #define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) 53 | #define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) 54 | #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) 55 | #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) 56 | #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) 57 | #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) 58 | #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) 59 | #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) 60 | #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) 61 | #define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) 62 | #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) 63 | #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) 64 | #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) 65 | #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) 66 | #define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) 67 | #define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) 68 | #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) 69 | #define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) 70 | #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) 71 | #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) 72 | #define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) 73 | #define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) 74 | #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) 75 | #define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) 76 | #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) 77 | #define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) 78 | #define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) 79 | #define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) 80 | #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) 81 | #define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) 82 | #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) 83 | #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) 84 | #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) 85 | #define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) 86 | #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) 87 | #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) 88 | #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) 89 | #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) 90 | #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) 91 | #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) 92 | #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) 93 | #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) 94 | #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) 95 | #define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) 96 | #define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) 97 | #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) 98 | #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) 99 | #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) 100 | 101 | 102 | FT_END_HEADER 103 | 104 | #endif /* __TTAGS_H__ */ 105 | 106 | 107 | /* END */ 108 | -------------------------------------------------------------------------------- /Acinonyx/AWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWidget.h 3 | * Acinonyx 4 | * 5 | * Created by Simon Urbanek on 5/31/11. 6 | * Copyright 2011 Simon Urbanek. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef A_WIDGET_H 11 | #define A_WIDGET_H 12 | 13 | #include "ATypes.h" 14 | #include "AVisual.h" 15 | #include "APlot.h" // for delegation 16 | 17 | #define AIsAction(X, name) ((X) == (name)) 18 | // #define AIsAction(X, name) (name && !strcmp(X, name)) 19 | 20 | 21 | class AWidget : public AContainer { 22 | protected: 23 | APlot *delegate_; 24 | // the following flags can be used to track the behavior of the widget 25 | bool mouse_inside; // this flag monitors enter/leave 26 | bool mouse_locked; // if this flag is set, then moving the mouse outside doesn't trigger dismissal 27 | bool mouse_down_inside; // true if the last mouseDown even was inside the widget 28 | bool hovering; // true if the mouse is currently hovering over the widget 29 | 30 | virtual void setHovering(bool what) { 31 | if (hovering != what) { 32 | hovering = what; 33 | redrawWidget(); 34 | } 35 | } 36 | 37 | public: 38 | const char *click_action; 39 | #pragma mark --- contructor --- 40 | AWidget(AContainer *parent, ARect frame, unsigned int flags) : AContainer(parent, frame, flags), mouse_inside(false), mouse_locked(false), mouse_down_inside(false), hovering(false), delegate_(NULL), click_action("clicked") { OCLASS(AWidget) } 41 | 42 | #pragma mark --- delegation --- 43 | APlot *delegate() { return delegate_; } 44 | 45 | void setDelegate(APlot *new_delegate) { delegate_ = new_delegate; } // FIXME: we currently don't use retain to avoid loops for common use of objects owned by the plot 46 | 47 | void delegateAction(const char *action, AObject *aux = NULL) { 48 | if (delegate_) 49 | delegate_->delegateAction(this, action, aux); 50 | } 51 | 52 | #pragma mark --- mouse handling --- 53 | virtual bool mouseEnter(AEvent event) { 54 | setHovering(true); 55 | return false; 56 | } 57 | 58 | virtual bool mouseLeave(AEvent event) { 59 | setHovering(false); 60 | return false; 61 | } 62 | 63 | virtual void setHidden(bool hf) { 64 | if (hf && !isHidden()) { 65 | // when hiding, we need to remove hovering status 66 | if (hovering) setHovering(false); 67 | } else if (!hf && isHidden()) { 68 | // when showing, we have to check the mouse status 69 | if (mouse_inside) setHovering(true); 70 | } 71 | AContainer::setHidden(hf); 72 | } 73 | 74 | virtual bool mouseMove(AEvent event) { 75 | // ALog("mouseMove: %g,%g -> %g,%g-%g,%g", event.location.x, event.location.y, _frame.x, _frame.y, _frame.width, _frame.height); 76 | if (isHidden()) return false; 77 | if (!mouse_inside && containsPoint(event.location)) { 78 | mouse_inside = true; 79 | if (!isHidden()) return mouseEnter(event); 80 | } else if (mouse_inside && !containsPoint(event.location)) { 81 | mouse_inside = false; 82 | if (!isHidden()) return mouseLeave(event); 83 | } 84 | return false; 85 | } 86 | 87 | // this method is called when the widget is clicked on (as in both up and down clicks are inside; chain into mouseDown if you want to allow drag-click) 88 | virtual bool clicked(AEvent event) { 89 | ALog("%s clicked: %g,%g [%g,%g-%g,%g] -> %s", describe(), event.location.x, event.location.y, _frame.x, _frame.y, _frame.width, _frame.height, click_action ? click_action : "<no action>"); 90 | if (click_action) 91 | delegateAction(click_action, NULL); 92 | return false; 93 | } 94 | 95 | virtual bool mouseDown(AEvent event) { 96 | ALog("%s mouseDown: %g,%g [%g,%g-%g,%g]", describe(), event.location.x, event.location.y, _frame.x, _frame.y, _frame.width, _frame.height); 97 | if ((mouse_down_inside = containsPoint(event.location))) 98 | if (!isHidden()) return true; 99 | return AContainer::mouseDown(event); 100 | } 101 | 102 | virtual bool mouseUp(AEvent event) { 103 | ALog("%s mouseUp: %g,%g [%g,%g-%g,%g]", describe(), event.location.x, event.location.y, _frame.x, _frame.y, _frame.width, _frame.height); 104 | if (containsPoint(event.location) && mouse_down_inside) { 105 | mouse_down_inside = false; 106 | if (!isHidden()) return clicked(event); 107 | } 108 | mouse_down_inside = false; 109 | return AContainer::mouseUp(event); 110 | } 111 | 112 | bool inHoveringMode(bool askChildren=true, bool excludeSelf=false) { 113 | ALog("%s inHoveringMode [hover=%s]", describe(), hovering ? "yes" : "no"); 114 | if (!askChildren || (hovering && !excludeSelf)) return hovering; 115 | chList_t *c = chRoot; 116 | while (c) { 117 | AWidget *child = static_cast <AWidget*> (c->o); 118 | if (child && child->inHoveringMode(askChildren)) return true; 119 | c = c->next; 120 | } 121 | return false; 122 | } 123 | 124 | // for speed redraw() is not virtual, so widgets use thier own method 125 | // FIXME: we could make redraw layer IV of each renderer such that redraw() could account for it automatically ... 126 | void redrawWidget() { 127 | if (_window) { 128 | _window->setRedrawLayer(LAYER_WIDGETS); 129 | _window->redraw(); 130 | } 131 | } 132 | 133 | virtual bool drawWidget() { return true; } // widgets drawing chain -- each subclass should call super.drawWidget() and only draw if it returns true; widgets have no layers, they are in their own layer 134 | 135 | virtual void draw(vsize_t layer) { 136 | if (layer == LAYER_WIDGETS) drawWidget(); 137 | AContainer::draw(layer); 138 | } 139 | }; 140 | 141 | #endif 142 | --------------------------------------------------------------------------------