00001 #ifndef GUIDOEngine_H
00002 #define GUIDOEngine_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <ostream>
00019 #include <string>
00020 #include <vector>
00021 #include "GUIDOExport.h"
00022
00023
00024 #ifdef WIN32
00025 #define GUIDOAPI_deprecated
00026 #else
00027 #define GUIDOAPI_deprecated __attribute__((deprecated))
00028 #endif
00029
00030
00031 class VGDevice;
00032
00033 struct NodeAR;
00034 struct NodeGR;
00035 typedef struct NodeAR * ARHandler;
00036 typedef struct NodeGR * GRHandler;
00037 typedef const struct NodeAR * CARHandler;
00038 typedef const struct NodeGR * CGRHandler;
00039
00043 struct GuidoInitDesc
00044 {
00046 VGDevice * graphicDevice;
00047
00048 void * reserved;
00049
00051 const char * musicFont;
00053 const char * textFont;
00054 };
00055
00058 struct GPaintStruct
00059 {
00061 bool erase;
00064 int left;
00065 int top;
00066 int right;
00067 int bottom;
00068 };
00069
00070
00077 typedef struct
00078 {
00080 int num;
00082 int denom;
00083
00084 } GuidoDate;
00085
00090 struct GuidoOnDrawDesc
00091 {
00093 GRHandler handle;
00094
00096 VGDevice * hdc;
00098 int page;
00100 GPaintStruct updateRegion;
00101
00107 int scrollx, scrolly;
00108
00112 float reserved;
00113
00114 int sizex, sizey;
00115
00118 int isprint;
00119 };
00120
00121
00124 enum { kNoBB, kPageBB,
00125 kSystemsBB = 2,
00126 kSystemsSliceBB = 4,
00127 kStavesBB = 8,
00128 kMeasureBB = 0x10,
00129 kEventsBB = 0x20,
00130 };
00131
00132
00133 enum GuidoInternalDevice
00134 {
00135 guido_svg_with_font_spec = 0,
00136 guido_abstract = 1,
00137 guido_binary = 2
00138 };
00139
00149 enum GuidoErrCode
00150 {
00152 guidoNoErr = 0,
00154 guidoErrParse = -1,
00156 guidoErrMemory = -2,
00158 guidoErrFileAccess = -3,
00160 guidoErrUserCancel = -4,
00162 guidoErrNoMusicFont = -5,
00164 guidoErrNoTextFont = -6,
00166 guidoErrBadParameter = -7,
00168 guidoErrInvalidHandle = -8,
00170 guidoErrNotInitialized = -9,
00172 guidoErrActionFailed = -10
00173 };
00179 enum {
00180 kNoMapping = 0,
00181 kVoiceMapping = 1,
00182 kStaffMapping = 1<<1,
00183 kSystemMapping = 1<<2
00184 };
00185
00186
00187 enum { kAutoDistrib = 1, kAlwaysDistrib = 2, kNeverDistrib = 3 };
00188
00192 typedef struct GuidoLayoutSettings
00193 {
00197 float systemsDistance;
00198
00202 int systemsDistribution;
00203
00208 float systemsDistribLimit;
00209
00213 float force;
00214
00218 float spring;
00219
00223 int neighborhoodSpacing;
00224
00228 int optimalPageFill;
00229
00233 int resizePage2Music;
00234
00239 float proportionalRenderingForceMultiplicator;
00240
00241 } GuidoLayoutSettings;
00242
00249 typedef struct
00250 {
00251 float width;
00252 float height;
00253 float marginleft;
00254 float margintop;
00255 float marginright;
00256 float marginbottom;
00257 } GuidoPageFormat;
00258
00259
00260 #ifdef __cplusplus
00261 extern "C" {
00262 #endif
00263
00287 GUIDOAPI(GuidoErrCode) GuidoInit(GuidoInitDesc * desc);
00288
00294 GUIDOAPI(GuidoErrCode) GuidoInitWithIndependentSVG();
00302 GUIDOAPI(void) GuidoShutdown();
00303
00313 #ifdef WIN32
00314 __declspec(deprecated("Deprecated function (will be erased soon) : use GUIDOAPI(ARHandler) GuidoFile2AR (GuidoParser *parser, const char * file) instead."))
00315 #endif
00316 GUIDOAPI(GuidoErrCode) GuidoParseFile(const char * filename, ARHandler* ar) GUIDOAPI_deprecated;
00317
00326 #ifdef WIN32
00327 __declspec(deprecated("Deprecated function (will be erased soon) : use GUIDOAPI(ARHandler) GuidoString2AR (GuidoParser *parser, const char * str) instead."))
00328 #endif
00329 GUIDOAPI(GuidoErrCode) GuidoParseString(const char * str, ARHandler* ar) GUIDOAPI_deprecated;
00330
00344 GUIDOAPI(GuidoErrCode) GuidoAR2GR(ARHandler ar, const GuidoLayoutSettings* settings, GRHandler* gr);
00345
00353 GUIDOAPI(GuidoErrCode) GuidoUpdateGR( GRHandler gr, const GuidoLayoutSettings* settings);
00354
00359 GUIDOAPI(void) GuidoFreeAR (ARHandler ar);
00360
00365 GUIDOAPI(void) GuidoFreeGR (GRHandler gr);
00366
00373 GUIDOAPI(const char *) GuidoGetErrorString( GuidoErrCode errCode );
00374
00380 #ifdef WIN32
00381 __declspec(deprecated("Deprecated function (will be erased soon) : use GUIDOAPI(GuidoErrCode) GuidoParserGetErrorCode (GuidoParser* p, int& line, int& col) instead."))
00382 #endif
00383 GUIDOAPI(int) GuidoGetParseErrorLine() GUIDOAPI_deprecated;
00384
00390 GUIDOAPI(void) GuidoGetDefaultLayoutSettings (GuidoLayoutSettings *settings);
00408 GUIDOAPI(int) GuidoCountVoices( CARHandler inHandleAR );
00409
00415 GUIDOAPI(int) GuidoGetPageCount( CGRHandler inHandleGR );
00416
00423 GUIDOAPI(int) GuidoGetSystemCount( CGRHandler inHandleGR, int page );
00424
00434 GUIDOAPI(GuidoErrCode) GuidoDuration( CGRHandler inHandleGR, GuidoDate * date );
00435
00444 GUIDOAPI(int) GuidoFindEventPage( CGRHandler inHandleGR, const GuidoDate& date );
00445
00454 GUIDOAPI(int) GuidoFindPageAt( CGRHandler inHandleGR, const GuidoDate& date );
00455
00463 GUIDOAPI(GuidoErrCode) GuidoGetPageDate( CGRHandler inHandleGR, int pageNum, GuidoDate* date);
00481 GUIDOAPI(GuidoErrCode) GuidoOnDraw( GuidoOnDrawDesc * desc );
00482
00494 GUIDOAPI(GuidoErrCode) GuidoGR2SVG( const GRHandler handle, int page, std::ostream& out, bool embedFont, const char* font, const int mappingMode = 0 );
00495
00505 #ifdef WIN32
00506 __declspec(deprecated("Deprecated function (will be erased soon) : use GUIDOAPI(GuidoErrCode) Guido2SVG( const GRHandler handle, int page, std::ostream& out, bool embedFont, const char* font, const int mappingMode = 0 ) instead."))
00507 #endif
00508 GUIDOAPI(GuidoErrCode) GuidoSVGExport( const GRHandler handle, int page, std::ostream& out, const char* fontfile, const int mappingMode = 0 ) GUIDOAPI_deprecated;
00509
00521 #ifdef WIN32
00522 __declspec(deprecated("Deprecated function (will be erased soon) : use GUIDOAPI(GuidoErrCode) Guido2SVG( const GRHandler handle, int page, std::ostream& out, bool embedFont, const char* font, const int mappingMode = 0 ) instead."))
00523 #endif
00524 GUIDOAPI(GuidoErrCode) GuidoSVGExportWithFontSpec( const GRHandler handle, int page, std::ostream& out, const char* fontfile, const char* fontspec, const int mappingMode = 0 ) GUIDOAPI_deprecated;
00525
00533 GUIDOAPI(GuidoErrCode) GuidoAbstractExport( const GRHandler handle, int page, std::ostream& out);
00534
00542 GUIDOAPI(GuidoErrCode) GuidoBinaryExport( const GRHandler handle, int page, std::ostream& out);
00543
00548 GUIDOAPI(void) GuidoDrawBoundingBoxes(int bbMap);
00549
00552 GUIDOAPI(int) GuidoGetDrawBoundingBoxes();
00553
00560 GUIDOAPI(void) GuidoGetPageFormat( CGRHandler inHandleGR, int pageNum, GuidoPageFormat* format );
00561
00575 GUIDOAPI(void) GuidoSetDefaultPageFormat( const GuidoPageFormat* format);
00576
00581 GUIDOAPI(void) GuidoGetDefaultPageFormat( GuidoPageFormat* format );
00582
00588 GUIDOAPI(float) GuidoUnit2CM(float val);
00589
00595 GUIDOAPI(float) GuidoCM2Unit(float val);
00596
00602 GUIDOAPI(float) GuidoUnit2Inches(float val);
00603
00609 GUIDOAPI(float) GuidoInches2Unit(float val);
00610
00611
00617 GUIDOAPI(GuidoErrCode) GuidoResizePageToMusic( GRHandler inHandleGR );
00618
00619
00637 GUIDOAPI(void) GuidoGetVersionNums(int * major, int * minor, int * sub);
00638
00642 GUIDOAPI(const char*) GuidoGetVersionStr();
00643
00644
00654 GUIDOAPI(GuidoErrCode) GuidoCheckVersionNums(int major, int minor, int sub);
00655
00656
00664 GUIDOAPI(float) GuidoGetLineSpace();
00665
00666
00681 GUIDOAPI(GuidoErrCode) GuidoMarkVoice( ARHandler inHandleAR, int voicenum,
00682 const GuidoDate & date, const GuidoDate & duration,
00683 unsigned char red, unsigned char green, unsigned char blue );
00684
00685
00693 GUIDOAPI(GuidoErrCode) GuidoSetSymbolPath(ARHandler inHandleAR, const std::vector<std::string> &inPaths);
00694
00695
00704 GUIDOAPI(GuidoErrCode) GuidoGetSymbolPath(const ARHandler inHandleAR, std::vector<std::string> &inPathVector);
00705
00719 GUIDOAPI(long) GuidoGetParsingTime (const ARHandler ar);
00720
00726 GUIDOAPI(long) GuidoGetAR2GRTime(const GRHandler gr);
00727
00733 GUIDOAPI(long) GuidoGetOnDrawTime(const GRHandler gr);
00734
00737 void AddGGSOutput(const char *s);
00738 void AddGuidoOutput(const char *s);
00739 #ifdef __cplusplus
00740 }
00741 #endif
00742
00743
00744 #endif