1 /* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU Library General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA 15 */ 16 17 #ifndef DENEMOTYPES_H 18 #define DENEMOTYPES_H 19 20 #include "denemo_objects.h" 21 #define EXT_MIDI 0 22 #define EXT_CSOUND 1 23 24 #define DENEMO_DEFAULT_ANON_FTP "ftp://www.denemo.org/download/" 25 26 #define DENEMO_TEXTEDITOR_TAG "texteditor" 27 28 #define DENEMO_CLICK_TRACK_NAME _("Click") 29 30 /* values for is_grace attribute of CHORD type */ 31 #define GRACED_NOTE (1<<1) /*Note is an (appogiatura) grace note */ 32 #define ENDGRACE (1<<2) /*Note is last grace note in a group */ 33 #define ACCIACCATURA (1<<3) /*Note is an acciacatura grace note */ 34 35 36 typedef void (*GActionCallback) (GtkAction *action, gpointer data); 37 #define G_ACTIONCALLBACK(f) ((GActionCallback)(f)) 38 /* and the following typedefs are basically here for so that it's 39 * possible to understand what my code is doing -- just as much for 40 * my sake as yours! 41 * 42 * What can I say; I've done a lot of programming in Java and 43 * SML/NJ; 44 * I like my type names to convey information. */ 45 46 /* The ->data part of each objnode presently points to a DenemoObject */ 47 48 typedef GList objnode; 49 50 51 typedef enum 52 { 53 NOT_UNDO_REDO = 0, 54 UNDO, 55 REDO 56 }unre_mode; 57 58 typedef enum 59 { 60 SAVE_NORMAL=0, 61 SAVE_TEMPLATE, 62 SAVE_COPY 63 } DenemoSaveType; 64 65 66 67 typedef enum DenemoGraphicType 68 { 69 DENEMO_BITMAP, 70 DENEMO_PATTERN, 71 DENEMO_FONT 72 } DenemoGraphicType; 73 74 typedef struct DenemoGlyph 75 { 76 gchar *fontname;/**< font to be used */ 77 gchar *utf; /**< utf8 char(s) to be placed as graphic */ 78 gdouble size; /**< font size to be used */ 79 gint slant, weight; /**< CAIRO_FONT_SLANT_xxx and WEIGHT_xxx values */ 80 } 81 DenemoGlyph; 82 83 typedef struct DenemoGraphic 84 { 85 DenemoGraphicType type; 86 gpointer graphic; /**< either a GdkBitmap, a cairo_pattern_t or a DenemoGlyph*/ 87 gint width, height; 88 } 89 DenemoGraphic; 90 91 92 typedef struct DenemoSelection 93 { 94 gint firststaffmarked; 95 gint laststaffmarked; 96 gint firstmeasuremarked; 97 gint lastmeasuremarked; 98 gint firstobjmarked; 99 gint lastobjmarked; 100 } 101 DenemoSelection; 102 103 typedef struct DenemoPalette 104 { 105 gchar *name; 106 GtkWidget *box; 107 GtkWidget *window; 108 gboolean rows; /* widgets should be packed row-wise or not */ 109 gint limit; /* how many widgets to pack in the chosen direction */ 110 gboolean docked; /**< whether this palette is displayed in the main display */ 111 GList *buttons; /**< the data are GtkWidget which have a script attached to be run when activated */ 112 } 113 DenemoPalette; 114 115 116 117 /* The idea here is to make everything recursive. The dominant 118 paradigm is a linked list. Handy that there's such a nice 119 precooked implementation of them in glib, eh? Note, however, that 120 the whole score isn't treated as a linked list of notes and other 121 objects as it is in, say Rosegarden; instead, the program has a 122 linked list of musical objects for each measure, and only then are 123 measures linked into staffs. That's my main beef with Rosegarden 124 -- I don't tend to compose my stuff in the order in which it will 125 eventually be played. As such, I like being able to start entering 126 music in the middle of my score, then the beginning, then the end, 127 or whatever, as appropriate. */ 128 129 typedef enum DenemoObjType 130 { 131 CHORD=0, 132 TUPOPEN, 133 TUPCLOSE, 134 CLEF, 135 TIMESIG, 136 KEYSIG, 137 BARLINE, 138 STEMDIRECTIVE, 139 MEASUREBREAK, 140 STAFFBREAK, 141 DYNAMIC, 142 GRACE_START, 143 GRACE_END, 144 LYRIC, 145 FIGURE, 146 LILYDIRECTIVE, 147 FAKECHORD, 148 PARTIAL 149 /* WARNING when adding to this list, add also to the type names 150 in denemo_types.c */ 151 }DenemoObjType; 152 153 extern gchar *DenemoObjTypeNames[18]; 154 155 #define DENEMO_OBJECT_TYPE_NAME(obj) ((obj)?(((obj)->type<G_N_ELEMENTS(DenemoObjTypeNames))?DenemoObjTypeNames[(obj)->type]:NULL):NULL) 156 157 158 /** 159 * Enumeration for Tuplets type 160 * 161 */ 162 typedef enum tuplet_type{ 163 DUPLET, 164 TRIPLET, 165 QUADTUPLET, 166 QUINTUPLET, 167 SEXTUPLET, 168 SEPTUPLET 169 }tuplet_type; 170 171 /** 172 * Enumeration for Denemo's input mode 173 */ 174 typedef enum input_mode { 175 #define MODE_MASK (~(INPUTCLASSIC|INPUTEDIT|INPUTINSERT)) 176 INPUTCLASSIC = 1<<0, /* classic mode */ 177 INPUTEDIT = 1<<1, /* edit mode */ 178 INPUTINSERT = 1<<2, /* insert mode */ 179 #define ENTRY_TYPE_MASK (~(INPUTNORMAL|INPUTREST|INPUTBLANK)) 180 INPUTNORMAL = 1<<3, /* entry type notes */ 181 INPUTREST = 1<<4, /* entry type rests */ 182 INPUTBLANK = 1<<5,/* entry type non-printing rests */ 183 TRAVERSE = 1<<6, /* read-only */ 184 #define ENTRY_FEEDBACK_MASK (~(INPUTRHYTHM)) 185 INPUTRHYTHM = 1<<7, /*Input rhythms gives feedback*/ 186 }input_mode; 187 188 /** 189 * Denemo Action type currently used for undo/redo 190 * 191 */ 192 typedef enum action_type { 193 ACTION_INSERT,//0 194 ACTION_DELETE,//1 195 ACTION_CHANGE,//2 196 ACTION_SNAPSHOT,//3 197 ACTION_STAGE_START,//4 198 ACTION_STAGE_END,//5 199 ACTION_SCRIPT_ERROR,//6 200 ACTION_MEASURE_REMOVE,//7 201 ACTION_MEASURE_CREATE,//8 202 ACTION_NOOP = -1// 203 }action_type; 204 205 /** 206 * Contains all the top-level information of an musical object 207 * the object pointer contains the actual object 208 */ 209 typedef struct 210 { 211 DenemoObjType type; /**< The type of object pointed to by the gpointer object field below */ 212 gchar *lilypond;/**< Holds lilypond generated to represent this object, empty until typesetting is called and out of date if the object has been modified since typesetting */ 213 gint basic_durinticks; /**< Duration of object including dotting but not tuplet/grace note effects. */ 214 gint durinticks; /**< Duration of object where 384 (PPQN) is a quarter note, includes any tuplet/grace note effects */ 215 gint starttick; /**< When the object occurs */ 216 gint starttickofnextnote; /**< When the next object occurs */ 217 gdouble earliest_time;/**< time in seconds from start of movement for the start of the note/rest */ 218 gdouble latest_time;/**< time in seconds from start of movement for the end of the note/rest */ 219 /**< Allots extra space for accidentals or reverse-aligned notes if 220 * the stem is down */ 221 gint space_before; /**< Used to specify how much space is needed before the object in display */ 222 gint minpixelsalloted; /**< horizontal space allowed for this object in display */ 223 gint x; /**< Holds x co-ordinate relative to the beginning of the measure. used in mousing.c */ 224 gboolean isstart_beamgroup; /**< TRUE if object is the start of a beam group */ 225 gboolean isend_beamgroup; /**< TRUE if this is the end of a beam group */ 226 gpointer object; /**< the structures pointed to are given in denemo_objects.h */ 227 gboolean isinvisible; /**< If TRUE it will be drawn in a distinctive color and will be printed transparent. */ 228 GList *directives; /* Directives attached to the object. These are transient */ 229 /* cached values of clef, keysignature and stemdir prevailing at the object */ 230 clef *clef; 231 keysig *keysig; 232 stemdirective *stemdir; 233 } DenemoObject; 234 235 236 /** 237 * Control of LilyPond context 238 * Allows for e.g. Piano context within staff group context by using bit fields 239 */ 240 typedef enum 241 { 242 DENEMO_NONE = 0, 243 DENEMO_PIANO_START = 1<<0, 244 DENEMO_PIANO_END = 1<<1, 245 DENEMO_GROUP_START = 1<<2, 246 DENEMO_GROUP_END = 1<<3, 247 DENEMO_CHOIR_START = 1<<4, 248 DENEMO_CHOIR_END = 1<<5 249 } DenemoContext; 250 251 /** 252 * Control of Voices 253 * 254 */ 255 typedef enum 256 { 257 DENEMO_PRIMARY = 1<<0, /**< If set this voice should have its own staff for display*/ 258 DENEMO_SECONDARY = 1<<1 /**< If set this is a secondary voice, but may still have PRIMARY set for display */ 259 } DenemoVoice; 260 261 /** 262 * The ->data part of each measurenode points to an objlist, which is 263 * a list of the musical objects in that measure. 264 */ 265 typedef GList measurenode; 266 267 268 /** 269 * DenemoStaff contains all the information relating to a musical staff 270 * 271 */ 272 typedef struct 273 { 274 GtkMenu *staffmenu; /**< a menu to popup up with the staff directives attached */ 275 GtkMenu *voicemenu; /**< a menu to popup up with the voice directives attached */ 276 GList *sources;/**< List of source pixbufs, one for each measure staff-view */ 277 measurenode *themeasures; /**< This is a GList of DenemoMeasure objects */ 278 clef clef; /**< The initial clef see denemo_objects.h clefs */ 279 keysig keysig; 280 timesig timesig; 281 keysig *leftmost_keysig; 282 timesig *leftmost_timesig; 283 284 /* we make leftmost_clefcontext a reference to a clef (a pointer) & re-validate leftmost clefcontext in the delete of CLEF object. */ 285 clef* leftmost_clefcontext; /**< The clef for the leftmost measure visible in the window*/ 286 287 gint leftmost_stem_directive; /**< Stem directive at start of leftmost visible measure */ 288 DenemoContext context; /**< The Lilypond context in which this staff appears */ 289 /* 290 * Staff Parameters 291 * Added Adam Tee 27/1/2000, 2001 292 */ 293 gint no_of_lines; /**< Number of lines on the staff */ 294 gint transposition; /**< Determines if the notes are to be played back at pitch or not */ 295 gint color; /**< color to display the staff */ 296 297 gint volume; /**< Master Volume used to scale midi playback */ 298 gboolean override_volume; /**< when true staff plays full Volume always */ 299 gboolean mute;/**< when true mutes regardless of override_volume */ 300 /* Back to Hiller stuff */ 301 // GString *staff_name; 302 303 GString *denemo_name; /**< partname gets transformed into legitimate lily_name */ 304 GString *subpart; /**< distinguishes staffs belonging to one part */ 305 GString *lily_name; /**< this is the name of the staff that is exported to lilypond */ 306 GString *midi_instrument; /**< midi instrument name used for the staff when exported via midi */ 307 GString *device_port; /**< Device name and Port name concatenated into one string */ 308 gint midi_prognum; /**< midi prognum assigned to the staff voice */ 309 gint midi_channel; /**< midi channel assigned to the staff voice */ 310 gint midi_port; /**< midi port assigned to the staff voice */ 311 gint space_above; /**< space above the staff used in the denemo gui */ 312 gint space_shorten; /**< space by the staff is shorter in height because of few staff lines */ 313 gint space_below; /**< space below the staff used in the denemo gui */ 314 gboolean range;/**<TRUE if range_hi,lo should be observed. */ 315 gint range_hi;/**< highest note playable by instrument, mid_c_offset */ 316 gint range_lo;/**< lowest note playable by instrument, mid_c_offset */ 317 GList *verse_views;/**< a list of text editor widgets each containing a verse */ 318 GList *current_verse_view;/**< verse to be displayed */ 319 GList *verses;/**< gchar of the verses, synchronized with GtkTextView buffers */ 320 gboolean hide_lyrics; /**< true if lyrics should not be typeset */ 321 gboolean hasfigures; /**<TRUE if the staff has had figures attached. Only one staff should have this set */ 322 gboolean hasfakechords; /**<TRUE if the staff has had chord symbols attached. Only one staff should have this set */ 323 DenemoVoice voicecontrol; /**< either controls whether this staff is displayed and printed separately or as a voice */ 324 gboolean hidden; /**< should this staff appear in the display? */ 325 measurenode ** is_parasite; /**< points to address of host staff's measures 326 field if measures are owned by another 327 staff */ 328 329 gint nummeasures; /**< Number of measures in the staff*/ 330 GList *tone_store; /**< list of pitches and durations used a source for 331 the notes in this staff 332 the data are tone* */ 333 334 GList *staff_directives;/**< List of DenemoDirective for the staff context, (only relevant for primary staff)*/ 335 GList *voice_directives;/**< List of DenemoDirective for the voice context */ 336 337 338 339 } DenemoStaff; 340 341 typedef struct DenemoMeasure { 342 GList *objects;/* list of DenemoObject */ 343 /* cached values of clef, timesignature, keysignature and stemdir prevailing at start of measure */ 344 clef *clef; 345 keysig *keysig; 346 timesig *timesig; 347 stemdirective *stemdir; 348 gint measure_number; //measure number to display 349 gint measure_numbering_offset;//measures from this one on should display numbers offset by this value from actual measure count. 350 } DenemoMeasure; 351 352 /* The ->data part of each staffnode points to a staff structure */ 353 354 typedef GList staffnode;/**< The ->data part of each staffnode points to a DenemoStaff structure */ 355 //typedef staffnode *score; 356 357 /* a pair of staffs, used to relate two staffs together */ 358 typedef struct staff_info 359 { 360 DenemoStaff *main_staff; /**< eg the bass line or the vocal part */ 361 DenemoStaff *related_staff; /**< eg the figures for the bass or the lyrics*/ 362 } 363 staff_info; 364 365 typedef enum 366 { 367 KeymapEntry, 368 KeymapToggleEntry, 369 KeymapRadioEntry 370 }KeymapCommandType; 371 372 typedef struct DenemoKeymap 373 { 374 GHashTable *commands; // hashtable for the commands 375 376 //reference for easy access 377 GHashTable *idx_from_name; //hashtable linking the name of a command to 378 //its index in the ListStore (values are guint *) 379 380 GHashTable *idx_from_keystring; //hashtable linking the string representing 381 //a keypress to the index of its command 382 //The keystring is the output of 383 //dnm_accelerator_name() 384 GHashTable *cursors;//hashtable linking GdkEvent state to a cursor that should be used in that state 385 386 GHashTable *continuations_table;//hashtable giving possible continuations for two-keybindings 387 388 }keymap; 389 390 /** @struct command_row 391 * @brief This structure represents commands in the keymap command list. 392 */ 393 typedef struct command_row 394 { 395 KeymapCommandType type; 396 gchar *name; 397 gchar *label; 398 gchar *tooltip; 399 gpointer callback; 400 GList *bindings; 401 gboolean hidden; 402 gboolean deleted; 403 gint script_type; 404 GList* locations; 405 gchar* after; 406 gchar* fallback; 407 gchar* menupath; 408 gchar* scheme; 409 } command_row; 410 411 typedef enum{ 412 COMMAND_BUILTIN, 413 COMMAND_SCHEME 414 } SCRIPT_TYPE; 415 416 //index of columns in the keymap command list store FIXME if you add columns you must add them in allocate_keymap !!!! 417 enum 418 { 419 COL_TYPE = 0, 420 COL_NAME, 421 COL_LABEL, 422 COL_TOOLTIP, 423 COL_CALLBACK, 424 COL_BINDINGS, 425 COL_HIDDEN, 426 COL_DELETED, 427 COL_SCRIPTTYPE, 428 COL_LOCATIONS, 429 COL_ROW, 430 COL_SCHEME, 431 N_COLUMNS 432 }; 433 434 typedef enum { TYPESET_EXCERPT, TYPESET_MOVEMENT, TYPESET_ALL_MOVEMENTS} typeset_type; 435 436 /** 437 * DenemoPrefs holds information on user preferences. 438 */ 439 typedef struct DenemoPrefs 440 { 441 // FIXME: the GStrings in here are never freed 442 443 GString *profile; /**< Which set of commands and shortcuts to load, and which initialization of scheme to run */ 444 GString *lilypath; /**< This is the executable or full path to the lilypond executable */ 445 GString *graphicseditor; /**< editing eps graphics files */ 446 GString *fontname; /**< Font name - usually Denemo as this has the required characters */ 447 gint fontsize; /**< Font size in points used for menus, help text etc */ 448 gboolean manualtypeset;/**< typeset on request, not continuously */ 449 gint typesetrefresh;/**< ms between re-trying typeset */ 450 gint typesettype;/**< what to re-typeset when not manual typeset */ 451 gint firstmeasure;/**< first measure to typeset relative to the cursor when not manual typset */ 452 gint firststaff;/**< first staff to typeset relative to the cursor when not manual typset */ 453 gint lastmeasure;/**< last measure to typeset relative to the cursor when not manual typset */ 454 gint laststaff;/**< last staff to typeset relative to the cursor when not manual typset */ 455 gboolean immediateplayback; /**< This options sends audio directly to synth as notes are being entered */ 456 gint measureswitchsound; /**< MIDI key to play on cursor move to new measure */ 457 gint pitchspellingchannel; /**< channel to use for feedback when entering extreme intervals via MIDI in, that may indicate an enharmonic error, 0 means no pitch spelling*/ 458 gint pitchspellingprogram; /**< program to set pitchspellingchannel to on startup */ 459 gboolean startmidiin; /**< try to start midi in on startup */ 460 gboolean applytoselection; /**< apply commands to selection */ 461 462 gboolean quickshortcuts;/**< TRUE if pressing a key while hovering over a menu item sets a shortcut */ 463 gboolean overlays; /*< whether overlays or insert should be used with pitch entry */ 464 gboolean continuous; /*< whether pitch entry overlays should cross barlines */ 465 gboolean spillover; /*< whether appending a note that does not fit the measure should cause a spillover to the next measure */ 466 gboolean createclones; 467 gint mode; /**< mode to start in */ 468 gboolean persistence;/**< whether Denemo should re-use settings over sessions */ 469 gint zoom; /**< percent zoom of score area display 1-100 */ 470 gint system_height; /**< percent of display height per system 1-100 */ 471 gboolean cursor_highlight; /** Should the cursor be highlighted */ 472 gboolean return_key_is_special; /** Should the Return key be treated as movable shortcut */ 473 gboolean newbie; /** Give maximum help */ 474 gboolean learning; /** Show which keypresses have been used */ 475 gboolean progressbardecorations; /** TRUE if you want window decorations on progressbar */ 476 gboolean toolbar; /**< makes the toolbar visible */ 477 gboolean playback_controls; /**< makes the playback controls visible */ 478 gboolean midi_in_controls; /**< makes the midi in controls visible */ 479 gboolean rhythm_palette; /**< makes the rhythm toolbar visable */ 480 gboolean object_palette; /**< makes the object menu toolbar visible */ 481 gboolean console_pane; /**< makes the console pane visible */ 482 gboolean lyrics_pane; /**< makes the lyrics pane visible */ 483 484 gboolean visible_directive_buttons; /**< This option makes the hbox containing score/movement directives visible */ 485 gboolean hide_windows; /**< whether to hide windows when a modal dialog is active */ 486 gboolean enable_thumbnails; 487 gboolean disable_undo; /**< Do not collect undo information */ 488 gboolean saveparts; /**< Automatically save parts*/ 489 gboolean autosave; /**< Auto save data */ 490 gint autosave_timeout; 491 gboolean autoupdate;/**< update command set from denemo.org */ 492 gint maxhistory;/**< how long a history of used files to retain */ 493 gint compression;/**< compression to be applied to .denemo files, suffix is unchanged */ 494 GString *browser; /**< Default browser string */ 495 496 497 // audio and MIDI driver 498 GString *audio_driver; /* the name of the audio driver to be used */ 499 GString *midi_driver; /* the name of the MIDI driver to be used */ 500 501 // JACK options 502 GString *jack_connect_ports_l; 503 GString *jack_connect_ports_r; 504 GString *jack_connect_midi_in_port; 505 GString *jack_connect_midi_out_port; 506 gboolean jacktransport; /**< toggle on and off jack transport */ 507 gboolean jacktransport_start_stopped; /**< toggle if you don't want transport to play immediately but rely on the transport controls */ 508 509 // PortAudio options 510 GString *portaudio_device; 511 unsigned int portaudio_sample_rate;/**< sample rate in Hz > */ 512 unsigned int portaudio_period_size;/**< The size of the audio buffers (in frames).> */ 513 unsigned int maxrecordingtime;/**< The maximum time a recording can be in seconds.> */ 514 515 // PortMidi options 516 GString *portmidi_input_device; 517 GString *portmidi_output_device; 518 519 // fluidsynth options 520 GString *fluidsynth_soundfont; /**< Default soundfont for fluidsynth */ 521 gboolean fluidsynth_reverb; /**< Toggle if reverb is applied to fluidsynth */ 522 gboolean fluidsynth_chorus; /**< Toggle if chorus is applied to fluidsynth */ 523 524 gint dynamic_compression;/**< percent compression of dynamic range desired when listening to MIDI-in */ 525 gboolean damping;/**< when true notes are re-sounded when left off at a lower velocity depending on their duration */ 526 gdouble display_refresh;/**< time in ms between refresh of display during playback */ 527 gint max_menu_size;/** < maximum number of menu entries allowed */ 528 gint animation_steps;/** < number of steps to use animating the page turns during playback */ 529 gint tooltip_timeout;/** < timeout before a tooltip appears */ 530 gint tooltip_browse_timeout;/** < timeout before a tooltip appears in tooltip browse mode */ 531 gint tooltip_browse_mode_timeout;/** < timeout before a tooltip browse mode is dropped*/ 532 533 GString *imageviewer; /**< Image Viewer */ 534 GString *username; /**< Username for use on denemo.org website */ 535 GString *password; /**< password for use on denemo.org website (blank means prompt for username) */ 536 GString *texteditor; /**< texteditor for editing scripts and lilypond files */ 537 GString *denemopath; /**< path were denemo files are saved */ 538 GQueue *history; /**< Queue to contain recently opened files */ 539 540 GString *lilyversion; /**< Lilypoind Version */ 541 GString *temperament; /**< Preferred temperament for tuning to */ 542 gboolean strictshortcuts; /**< Classic shortcut scheme, now deprecated */ 543 gboolean menunavigation; /**< arrows and Escape work for menu navigation*/ 544 gboolean verboseshortcuts; /**< whether shortcuts are known by their gdk name e.g. period for . */ 545 546 gint resolution; /**< Resolution of exported selection in dpi */ 547 }DenemoPrefs; 548 549 /* DenemoDirectives are attached to chords and to the individual notes of a chord. They attach LilyPond and MIDI directivees that add to the note information & describe how to display themselves in the Denemo display */ 550 typedef struct DenemoDirective 551 { 552 GString *tag; /**< tag identifying the owner of this directive, usually the denemo command that created it */ 553 GString *prefix; /**< LilyPond text to be inserted before the chord */ 554 GString *postfix;/**< LilyPond text to be inserted after the chord */ 555 GString *display; /**< some text to display to describe the LilyPond attached to the chord */ 556 gint tx,ty; /**< x and y offsets in pixels for the display text */ 557 gint minpixels;/**< horizontal space needed by the display */ 558 guint x /*only_for*/, y /*ignored_by*/; /**< ids of score layouts that are to enable/ignore this directive */ 559 DenemoGraphic *graphic; /**< what to draw for this directive */ 560 GtkWidget *widget; /**< a button or menu item for accessing the directive for editing or actioning */ 561 gint gx, gy; /**< x and y offsets in pixels for the graphic */ 562 GString *graphic_name; /**< name of the graphic to be drawn the suffixes .svg or .png will be searched for */ 563 GString *grob; /**<name of LilyPond grob which this directive creates. Use for tweaking positions, padding etc */ 564 565 /* warnings 566 1) these values cannot be changed without bumping the denemo file format version 567 2) if they are to be available to scheme scripts (normal) you must insert the code in view.c*/ 568 #define DENEMO_OVERRIDE_LILYPOND (1<<0) 569 #define DENEMO_ALT_OVERRIDE (1<<1) 570 #define DENEMO_OVERRIDE_GRAPHIC (1<<2) 571 #define DENEMO_OVERRIDE_EDITOR (1<<3) 572 #define DENEMO_OVERRIDE_AFFIX (1<<4) 573 #define DENEMO_OVERRIDE_TAGEDIT (1<<5) 574 575 576 577 #define DENEMO_OVERRIDE_VOLUME (1<<8) 578 #define DENEMO_OVERRIDE_DURATION (1<<9) 579 #define DENEMO_OVERRIDE_REPEAT (1<<10) 580 #define DENEMO_OVERRIDE_CHANNEL (1<<11) 581 #define DENEMO_OVERRIDE_TEMPO (1<<12) 582 #define DENEMO_OVERRIDE_TRANSPOSITION (1<<13) 583 584 #define DENEMO_MIDI_MASK (DENEMO_OVERRIDE_VOLUME | DENEMO_OVERRIDE_DURATION | DENEMO_OVERRIDE_REPEAT | DENEMO_OVERRIDE_CHANNEL | DENEMO_OVERRIDE_TEMPO | DENEMO_OVERRIDE_TRANSPOSITION) 585 586 #define DENEMO_OVERRIDE_ONCE (1<<16) 587 #define DENEMO_OVERRIDE_STEP (1<<17) 588 #define DENEMO_OVERRIDE_RAMP (1<<18) 589 590 #define DENEMO_MIDI_ACTION_MASK (DENEMO_OVERRIDE_ONCE | DENEMO_OVERRIDE_STEP | DENEMO_OVERRIDE_RAMP) 591 592 593 #define DENEMO_OVERRIDE_RELATIVE (1<<24) 594 #define DENEMO_OVERRIDE_PERCENT (1<<25) 595 596 #define DENEMO_MIDI_INTERPRETATION_MASK (DENEMO_OVERRIDE_RELATIVE | DENEMO_OVERRIDE_PERCENT) 597 598 #define DENEMO_OVERRIDE_DYNAMIC (1<<28) 599 #define DENEMO_OVERRIDE_HIDDEN (1<<29) 600 #define DENEMO_OVERRIDE_MARKUP (1<<30) //For score and movement widgets (which can display as buttons) this controls whether the button text uses markup 601 #define DENEMO_OVERRIDE_ABOVE DENEMO_OVERRIDE_MARKUP //For chord directives, makes the graphic display above rather than below the chord 602 603 604 guint32 override; /**< specifies what if anything of the built-in behaviour of the object the directive is attached to is to be overriden by this directive and values to use when overriding MIDI */ 605 GString *midibytes;/**< values to be used for MIDI generation; the meaning depends fields in override */ 606 gboolean locked;/**< If true the directive cannot be deleted easily */ 607 GString *data;/**< data used by scripts that manipulate the directive, typically scheme data */ 608 } DenemoDirective; 609 610 /** 611 * Contains the lilypond header information for the movements, plus markup between movements. 612 * 613 */ 614 615 typedef struct LilypondHeaderFields 616 { 617 /* LilyPond movement header and markup information */ 618 GString *title; 619 GString *subtitle; 620 GString *poet; 621 GString *composer; 622 GString *meter; 623 GString *opus; 624 GString *arranger; 625 GString *instrument; 626 GString *dedication; 627 GString *piece; 628 GString *head; 629 GString *copyright; 630 GString *footer; 631 GString *tagline; 632 //GString *extra; 633 /* lilypond before and after each \score block */ 634 GString *lilypond_before; 635 GString *lilypond_after; 636 /* preferences to go into \layout block */ 637 //GString *layout; 638 }LilypondHeaderFields; 639 640 641 642 typedef enum 643 { 644 REPLACE_SCORE, 645 ADD_STAFFS, 646 ADD_MOVEMENTS, 647 GUIDED_IMPORT, 648 SOURCE_PDF, 649 PROOFREAD 650 } ImportType; 651 652 typedef enum 653 { 654 WOODWIND, 655 BRASS, 656 STRINGS, 657 VOCALS, 658 PITCHEDPERCUSSION, 659 PLUCKEDSTRINGS, 660 KEYBOARDS, 661 NONE 662 }InstrumentType; 663 664 665 typedef enum InputSource { 666 INPUTKEYBOARD, 667 INPUTAUDIO, 668 INPUTMIDI 669 } InputSource; 670 671 typedef enum MidiDestination { 672 MIDITOSCORE = 0, 673 MIDITHRU = (1<<1), 674 MIDIRECORD = (1<<2), 675 MIDIPLAYALONG = (1<<5), 676 MIDICONDUCT = (1<<6), 677 678 } MidiDestination; 679 680 typedef enum DenemoViewType { 681 DENEMO_MENU_VIEW,//menus are visible 682 DENEMO_LINE_VIEW,//menus not visible, 683 DENEMO_PAGE_VIEW //menus not visible, defaults to full screen and several systems 684 } DenemoViewType; 685 686 687 /** 688 * Structure to contain the list of Instruments for the score 689 * configuration wizard 690 * 691 */ 692 typedef struct 693 { 694 GString *name; 695 GString *midiinstrument; 696 gint sclef; 697 gint transposition; 698 gint numstaffs; 699 700 }InstrumentConfig; 701 702 /** 703 * Stores global instrument type and a list of InstrumentConfig structures 704 */ 705 typedef struct 706 { 707 InstrumentType type; 708 GList *instruments; // List to contain a list of Instruments of given type 709 }InstrumentList; 710 711 typedef struct DenemoPosition { /**<Represents a position in a Score */ 712 gint movement; 713 gint staff; 714 gint measure; 715 gint object;/**< 0 means no object */ 716 gboolean appending;/**< if cursor is in appending position */ 717 gboolean offend;/**< cursor is shown red in this case, obscure connection with appending */ 718 gint leftmeasurenum; /**< start at 1 */ 719 } DenemoPosition; 720 721 722 typedef enum 723 { 724 STATE_NONE = 0, //not a background typeset 725 STATE_OFF = 1 << 0, //background typeset complete 726 STATE_ON = 1 << 1, //background typeset in progress 727 STATE_PAUSED = 1 << 2 //background typesetting turned off to allow printing 728 } background_state; 729 730 731 732 typedef struct DenemoPrintInfo 733 { 734 GPid printpid; 735 background_state background; 736 gint updating_id; //id of idle callback 737 gint first_measure; 738 gint last_measure; 739 gint first_staff; 740 gint last_staff; 741 typeset_type typeset_type; 742 gint invalid; //set 1 if lilypond reported problems or 2 if generating new pdf failed 743 gint cycle; //alternate 0 1 to switch print file names 744 gchar *printbasename[2]; 745 gchar *printname_pdf[2]; 746 gchar *printname_svg[2]; 747 gchar *printname_midi[2]; 748 gchar *printname_ly[2]; 749 gchar *error_file; 750 } DenemoPrintInfo; 751 /** 752 * Contains data required for undo/redo operation 753 * Borrowed idea from GScore 754 */ 755 typedef struct DenemoUndoData 756 { 757 enum action_type action; /*action type must come first*/ 758 759 DenemoObject* object; /* pointer to object to be undone/redone */ 760 DenemoPosition position; /* position where delete/insert took place */ 761 762 } DenemoUndoData; 763 764 765 /** 766 * Control of the LilyPond output for the whole musical score DenemoProject 767 * 768 */ 769 typedef struct DenemoLilyControl 770 { 771 GString *papersize; 772 GString *staffsize; 773 GString *lilyversion; 774 gboolean orientation; 775 gboolean excerpt; 776 GList *directives; /**< list of DenemoDirective for all music in the movements */ 777 778 } DenemoLilyControl; 779 780 781 typedef struct DenemoScriptParam { /**< commands called by scripts use one of these to pass in a string and return a boolean */ 782 GString *string;/**< input string to command */ 783 gboolean status;/**< return value - TRUE = normal case execution of command/FALSE = exceptional case*/ 784 } DenemoScriptParam; 785 786 787 typedef struct DenemoScoreblock { 788 GString *lilypond;/**< text of the scoreblock */ 789 gboolean visible;/**< Whether the scoreblock should be used by default */ 790 gboolean layout_sync;/**< Value of project->layout_sync when the scoreblock was created */ 791 GtkWidget *widget;/**< Widget to be placed in the Score Layout window for this scoreblock */ 792 GList *staff_list;/**< List of staff frames contained in widget */ 793 gchar *name;/**< name for this scoreblock */ 794 gchar *uri;/**< uri for the output from printing this scoreblock */ 795 guint32 id;/**< an id for this scoreblock generated from name, as a quick identifier */ 796 gint movement;/**< Which movement the scoreblock outputs, 0 = all movements. Only used for standard scoreblocks */ 797 gchar *partname; /**< Which part the scoreblock outputs, NULL = all parts. Only used for standard scoreblocks */ 798 gchar *instrumentation;/**< value for the instrumentation value for book titling, taken from the part name */ 799 gboolean text_only;/**< TRUE if only the lilypond text exists for this widget - no widget structure to be refreshed */ 800 } DenemoScoreblock; 801 802 //these typdefs are needed to make the macros that install all the directive functions work 803 typedef struct header 804 { 805 GList *directives; 806 } 807 header; 808 typedef struct scoreheader 809 { 810 GList *directives; 811 } 812 scoreheader; 813 typedef struct paper 814 { 815 GList *directives; 816 } 817 paper; 818 typedef struct layout 819 { 820 GList *directives; 821 } 822 layout; 823 824 typedef struct movementcontrol 825 { 826 GList *directives; 827 } 828 movementcontrol; 829 830 typedef enum DenemoRecordingType { 831 DENEMO_RECORDING_AUDIO,/**< Recording is an audio file represented by libsndfile handle */ 832 DENEMO_RECORDING_MIDI/**< Recording is an audio file stored in recorded_midi_track */ 833 } DenemoRecordingType; 834 835 typedef struct DenemoRecordedNote { 836 gint timing;/**< time in frames, (divide by samplerate to get to seconds) */ 837 gboolean noteoff; 838 gint mid_c_offset; 839 gint enshift; 840 gint octave; 841 gint duration;/**< guessed baseduration, 0 if not known */ 842 gint dots; /**<guessed number of dots */ 843 gpointer event;/**< midi event giving rise to the note */ 844 } DenemoRecordedNote; 845 846 typedef struct DenemoRecording { 847 DenemoRecordingType type; 848 gchar *filename; /**< audio file. Could be extended to take MIDI file too */ 849 gint samplerate; /**< frames per second */ 850 gint channels; /**< audio only */ 851 gint leadin;/**< number of frames to skip at start, silence to be emitted before play if negative */ 852 gdouble volume; 853 gint nframes;/**< number of frames in the audio */ 854 GList *notes; /**< data is DenemoRecordedNote* */ 855 gpointer sndfile; /**< sndfile handle */ 856 } DenemoRecording; 857 858 typedef enum DenemoTargetType { 859 TARGET_NONE = 0, 860 TARGET_OBJECT, 861 TARGET_CHORD, 862 TARGET_NOTE, 863 TARGET_SLUR, 864 TARGET_TIE, 865 TARGET_CRESC, 866 TARGET_DIM, 867 868 //TARGET_, 869 } DenemoTargetType; 870 871 typedef struct DenemoTarget { 872 DenemoTargetType type; 873 gint mid_c_offset; 874 gint directivenum; 875 gint staffnum; 876 gint measurenum; 877 gint objnum; 878 } DenemoTarget; 879 880 typedef struct DenemoBrace { 881 gint startstaff, endstaff;//count from 1 882 int starty, endy; 883 gboolean curly; 884 } DenemoBrace; 885 886 typedef struct DenemoScrollPoint { 887 gdouble time, adj; 888 gdouble x, y; 889 } DenemoScrollPoint; 890 891 /* 892 * DenemoScore structure representing a single movement of a piece of music. 893 * A movement corresponds with a single \score{} block in the LilyPond language 894 * that is, uninterrupted music on a set of staffs, preceded by a title. 895 */ 896 897 typedef struct DenemoMovement 898 { 899 gboolean readonly; /**< Indicates if the file is readonly or not (NOT USED)*/ 900 901 gint leftmeasurenum; /**< start at 1 */ 902 gint rightmeasurenum;/**< start at 1 */ 903 gint top_staff; 904 gint bottom_staff; 905 gint measurewidth; /**< List of all minimum measure widths */ 906 GList *measurewidths; 907 gint widthtoworkwith; 908 gint staffspace; 909 910 DenemoRecording *recording;/**< Audio or MIDI recording attached to movement */ 911 gint marked_onset_position;/**< horizontal position in display of note onset in audio marked by user */ 912 GList *marked_onset;/**< Note onset in audio selected by user */ 913 GList *sources; /**< List of source pixbufs, one for each measure score-view*/ 914 gdouble start_time; /**< time in seconds to start playing at */ 915 gdouble end_time; /**< time to end playing at */ 916 DenemoObject *playingnow; /**< the last object played via MIDI; it must not be dereferenced as it may no longer exist */ 917 gdouble playhead; /**< MIDI time in seconds of playhead, ie point when last MIDI event was processed for output */ 918 gdouble start_player;/**< system time when MIDI player started */ 919 gpointer recorded_midi_track;//will be a GList * eventually for now an smf_track_t 920 gdouble master_volume;/**< the volume (velocity) used is this times the nominal vol */ 921 gdouble master_tempo;/**< the tempo used is this times the nominal tempo */ 922 gdouble tempo_change_time;/**< system time from which the master_tempo is to be used */ 923 gdouble rightmost_time; /**< MIDI time of rightmost visible object */ 924 GList *scroll_points; /**< playback view scroll points for this movement */ 925 926 gdouble zoom;/**< zoom setting for this movement */ 927 gdouble preview_zoom; /**< zoom of print preview pane */ 928 gdouble system_height;/**< fraction of scorearea height allotted to one system (line) in this movement of the score, the same for all lines */ 929 //Settings for the views on this movement 930 931 gdouble page_zoom;/**< zoom for page view */ 932 gdouble page_system_height;/**< system height for page view */ 933 gint page_width;/**< width to use for window in page view. 0 means use full screen */ 934 gint page_height;/**< height to use for window in page view */ 935 gint stored_width;/**< width to use for window returning from page view */ 936 gint stored_height;/**< height to use for window returning from page view */ 937 938 /* Fields that have more to do with the data model and its manipulation, 939 * though they may be modified by side-effects of the drawing routines */ 940 // score thescore; 941 staffnode *thescore; 942 gint currentmovementnum;/**< position of this DenemoMovement in the project->movements list starting at 1 */ 943 staffnode *currentprimarystaff; 944 staffnode *currentstaff; 945 gint currentstaffnum;/**< start at 1 */ 946 measurenode *currentmeasure; 947 DenemoTarget target;/**< The target of a wysiwyg operation. This is currently only set by clicking on the print view window. */ 948 gint currentmeasurenum;/**< start at 1 */ 949 objnode *currentobject; /**< currentobject points to the note preceding the cursor when the 950 * cursor is appending. == NULL only when currentmeasure is empty. */ 951 gint highesty; /**< max value of highesty of chord in the staff */ 952 gint cursor_x; 953 gint cursor_y; 954 gint staffletter_y; 955 gint maxkeywidth; 956 gboolean cursor_appending; 957 958 gboolean cursoroffend; 959 //gint cursorclef; 960 //gint cursoraccs[7]; 961 //gint cursortime1; 962 //gint cursortime2; 963 //gint curmeasureclef; 964 //gint curmeasurekey; 965 //gint curmeasureaccs[7]; 966 //gint nextmeasureaccs[7]; 967 /* These are used for determining what accidentals should be there 968 * if the cursor advances to the next measure from the next "insert chord" 969 * operation */ 970 gint curmeasure_stem_directive; 971 gint pending_enshift;/**< accidental to be used for next inserted note, cleared on note insert */ 972 973 974 /* Is there a figured bass present, is so this relates the bass 975 * with its figures staff, if one is present */ 976 staff_info * has_figures; 977 staff_info *has_fakechords; 978 979 /* Now stuff that's used for marking areas */ 980 gint markstaffnum; 981 gint markmeasurenum; 982 gint markcursor_x; 983 DenemoSelection selection; 984 985 986 movementcontrol movementcontrol;/*< Directives for control of the whole movement */ 987 layout layout;/*< Directives for the layout block of the movement */ 988 header header;/*< Directives for the header block of the movement */ 989 990 991 guint changecount; 992 /* Fields used for MIDI playback */ 993 gpointer smf;/*< an smf_t structure for libsmf to work with */ 994 gint tempo; 995 gint start; 996 gint end; 997 gint stafftoplay; 998 guint smfsync;/**< value of changecount when the smf MIDI data was last refreshed */ 999 1000 1001 1002 GList *savebuffer; 1003 1004 1005 1006 1007 /*list of undo data */ 1008 GQueue *undodata; 1009 GQueue *redodata; 1010 gint undo_guard; 1011 gboolean redo_invalid;/*< the re-do queue is awaiting freeing and should not be used */ 1012 1013 1014 1015 GList *Instruments; 1016 GtkWidget *buttonbox;/*< box for buttons accessing DenemoDirectives attached to the this movement*/ 1017 GtkWidget *lyricsbox;/*< box for notebooks containing verses of lyrics for the movement */ 1018 } DenemoMovement; 1019 1020 /** 1021 * DenemoProject representing a musical score, with associated top level 1022 * GUI and a list of movements (DenemoMovement) and a pointer to the current 1023 * movement. 1024 */ 1025 #define DENEMO_MAX_SYSTEMS (100) /**< Number of lines of music that can be displayed */ 1026 typedef struct DenemoProject 1027 { 1028 gint id; /* A unique id, not repeated for this run of the Denemo program */ 1029 1030 DenemoViewType view;/**< The current view */ 1031 gint lefts[DENEMO_MAX_SYSTEMS];/**< an array to hold the leftmeasurenum of each system in the last-drawn score, used for determining the mouse position on the music */ 1032 gint rights[DENEMO_MAX_SYSTEMS];/**< an array to hold the rightmeasurenum of each system in the last-drawn score, used for determining the mouse position on the music */ 1033 gint scales[DENEMO_MAX_SYSTEMS];/**< an array to hold the percent horizontal scaling of each system in the last-drawn score, used for determining the mouse position on the music */ 1034 gint leftmargin; 1035 #define BASIC_LEFT_MARGIN (20) /**< margin in display for staff/voice tools */ 1036 GList *braces; 1037 #define BRACEWIDTH (20) /**< width of each brace in display */ 1038 GtkWidget *buttonboxes;/**< box for boxes showing directives */ 1039 GtkWidget *buttonbox;/**< box for buttons accessing DenemoDirectives attached to the whole score */ 1040 GtkWidget *movements_selector; /**< box for buttons to select movements */ 1041 1042 gchar *xbm; /**< xbm representation of graphic bitmap from selected rectangle in print preview area*/ 1043 gint xbm_width, xbm_height;/**< width and height of the xbm data */ 1044 1045 1046 gchar *namespec;/**< A spec of which parts/movements to print */ 1047 1048 1049 1050 InputSource input_source;/**< Where pitches are coming into Denemo (keyboard, audio, midi) */ 1051 InputSource last_source;/**< Where the last input came from */ 1052 MidiDestination midi_destination;/**< Where MIDI in should go */ 1053 GQueue *pending_midi;/**< a MIDI effect to be output with the next note */ 1054 gboolean audio_recording; 1055 input_mode mode; /**< Input mode for Score */ 1056 1057 1058 GList *movements; /**< a list of DenemoMovement, NULL if just one movement */ 1059 DenemoMovement *movement; /**< the (current) movement in the musical score controlled by this project */ 1060 DenemoLilyControl lilycontrol; /**< Directives for the start of the score and before every movement */ 1061 1062 scoreheader scoreheader;/*< Directives for the header block at the start of the score */ 1063 paper paper;/*< Directives for the paper block of the score */ 1064 1065 gboolean has_script;/*< true if there is a script to be run on loading the DenemoProject from disk */ 1066 GList *standard_scoreblocks; /**< List of automatically generated \score blocks for LilyPond output elements are DenemoScoreblock * */ 1067 GList *custom_scoreblocks; /**< List of customized \score blocks for LilyPond output, elements are DenemoScoreblock * */ 1068 GtkWidget *score_layout; /**< The window in which custom_scoreblock widgets are placed */ 1069 guint layout_id; /**< cached value of the currently selected layout id */ 1070 GList *callbacks;/**< scheme callbacks on deletion */ 1071 gpointer lilystart, lilyend; /**<range of lilytext */ 1072 GString **target; /**< pointer to target string for modification in lilytext */ 1073 GList *anchors;/**< anchors in the LilyPond text at points where that can be edited */ 1074 1075 GString *filename;/**< the filename to save to */ 1076 GString *tabname;/**< the name of windows tab */ 1077 GString *autosavename;/**< the filename to autosave to, full path */ 1078 DenemoSelection thumbnail; /**< the selection from which to create a thumbnail on exit */ 1079 1080 gint undo_level;/**< level of script nesting 0 = staging point for undo to return to */ 1081 gboolean notsaved;/**< edited since last save */ 1082 guint changecount;/**< number of edits since score loaded */ 1083 guint lilysync;/**< value of changecount when the Lily text was last refreshed */ 1084 1085 guint layout_sync;/**< value of changecount when the layout structure of the score was last changed, used to detect if a DenemoScoreblock is out of date */ 1086 /* support for rhythm patterns */ 1087 GList *rhythms;/**< list of RhythmPattern s */ 1088 GList *currhythm; /**< a pointer into rhythms, whose data is the RhythmPattern being followed */ 1089 GList *cstep; /**< step within RhythmPattern->clipboard, the a GList* holding the current DenemoObject of the current rhythm pattern in its clipboard 1090 the data field of cstep holds a DenemoObject*. Several of these csteps correspond to a single rstep if the objects are not pitched (ie not of type CHORD with at least one note) */ 1091 GList *rstep; /**< step within the circular list RhythmPattern->rsteps, the step that will be used for the next entered pitch 1092 when applying pitches to the pattern non pitched DenemoObjects on the clipboard are emitted at each step, moving cstep on for each object.*/ 1093 1094 struct RhythmPattern *prevailing_rhythm; /**< one of singleton_rhythms used for entering notes */ 1095 1096 /* support for positioning source views */ 1097 gint source_x; 1098 gint source_y; 1099 gint source_width; 1100 gint source_height; 1101 gint source_scale;/* scale is x1000 */ 1102 /* support for time spent editing the score */ 1103 gint total_edit_time;/* in seconds */ 1104 gchar* script; /**< The script, synchronized with the view buffer */ 1105 }DenemoProject; 1106 1107 1108 /** 1109 * RhythmPattern: a list of RhythmElements with a button to invoke it; 1110 */ 1111 1112 typedef struct RhythmPattern 1113 { 1114 GList *rsteps; /**< the data are RhythmElements */ 1115 GtkToolButton *button; /**< the button on the rhythm toolbar which invokes this rhythm. Its label is set to the highlightlabel field of the currently in use rstep */ 1116 GList *clipboard;/**< a Denemo clipboard, used to create this patttern. FIXME as with the DenemoClipboard there is a redundant layer: the data element of this field is the GList* of DenemoObjects */ 1117 gchar *name;/**< a user-facing name for this pattern */ 1118 GString *nickname;/**< a custom user name for this pattern */ 1119 GString *lilypond; /**< LilyPond syntax for this pattern, used to paste snippets into markup */ 1120 } RhythmPattern; 1121 1122 1123 /** 1124 * RhythmElement: information about one element of a RhythmPattern, 1125 * e.g. one RhythmElement could contain the actions "quarter-note,dotted,begin slur"; 1126 */ 1127 1128 typedef struct RhythmElement 1129 { 1130 GList* functions; /**< data in list are functions to be called including modifiers 1131 eg insert_chord_3key, add dot, slur ... */ 1132 gpointer highlightlabel; /**< a string, but displayed in music font, which labels the button when this RhythmElement is 1133 the current one*/ 1134 RhythmPattern *rhythm_pattern;/**< the rhythm pattern which this element belongs to */ 1135 } RhythmElement; 1136 1137 1138 struct cs_callback 1139 { 1140 GtkWidget *entry; 1141 GtkWidget *dialog; 1142 DenemoProject *project; 1143 }; 1144 1145 1146 /** 1147 * The (singleton) root object for the program 1148 * 1149 */ 1150 struct DenemoRoot 1151 { 1152 gboolean non_interactive; /* if TRUE denemo should not display project, receive or send sounds etc*/ 1153 gchar *scheme_file;/* filename for scheme code to run on startup */ 1154 gchar *scheme_commands;/* scheme code to run on startup after scheme_file */ 1155 /* Fields used fairly directly for drawing */ 1156 GtkWidget *page; 1157 GtkWidget *scorearea; 1158 GtkWidget *command_manager; 1159 GtkAdjustment *vadjustment; 1160 GtkWidget *vscrollbar; 1161 GtkAdjustment *hadjustment; 1162 GtkWidget *hscrollbar; 1163 DenemoPalette *currentpalette; 1164 GtkWidget *hpalettes;/**< hbox holding horizontal docked palettes */ 1165 GtkWidget *vpalettes;/**< vbox holding vertical docked palettes */ 1166 GtkWidget *printarea;/**< area holding a print preview */ 1167 GtkWidget *printvscrollbar;/**< scrollbar widget for printarea */ 1168 GtkWidget *printhscrollbar;/**< scrollbar widget for printarea */ 1169 GdkPixbuf *pixbuf;/**< print preview pixbuf */ 1170 GtkWidget *playbackview;/**< area holding svg typeset for animating playback */ 1171 DenemoPrintInfo *printstatus;/**< Information about the currenty typesetting activity */ 1172 GtkWidget *textwindow; /**< LilyPond output window */ 1173 GtkTextView *textview; /**< LilyPond output text view */ 1174 GtkTextBuffer *textbuffer; /**< buffer for LilyPond text */ 1175 /* window state */ 1176 gint width; 1177 gint height; 1178 gboolean maximized; 1179 gint color;/**< the color of the background */ 1180 keymap *map; /**< pointer to data describing each of the Denemo commands and their keyboard shortcuts */ 1181 gchar *last_merged_command;/**<filename of last command merged into the menu system */ 1182 gint last_keyval, last_keystate;/**< most recent keypress which successfully invoked a command */ 1183 GList *projects; /**< the list of DenemoProject objects, representing pieces of music simultaneously open */ 1184 DenemoProject *project; /**< The current project */ 1185 DenemoPrefs prefs; /**< Preferences stored on exit and re-loaded on startup */ 1186 gint autosaveid;/**< autosave timer id: only one musical score is being autosaved at present */ 1187 gint accelerator_status; /**< if the accelerators have been saved, or extra ones for special keys defined */ 1188 GtkUIManager *ui_manager; /**< UI manager */ 1189 GtkWidget *window; 1190 GtkWidget *console;/**< GtkTextView for console output */ 1191 GtkActionGroup *action_group;/*< The action group for the actions that are Denemo commands */ 1192 GtkWidget *notebook;/**< contains the project.page widgets */ 1193 GtkWidget *statuslabel;/**< label that appears at bottom left of main window to describe cursor position in score */ 1194 GtkWidget *playback_control;/**< frame containing controls for playback */ 1195 GtkWidget *midi_in_control;/**< frame containing controls for midi in */ 1196 GtkWidget *audio_vol_control;/**< hbox containing vol control for source audio */ 1197 GtkWidget *input_label; /**< A label widget advising of source of external input */ 1198 GString *input_filters; /**< Description of any filters operating on external input */ 1199 GtkWidget *menubar;/**< Main menubar to giving load/save play etc functionality */ 1200 1201 GList *continuations; 1202 1203 #define NB_SINGLETON_RHYTHMS 256 1204 struct RhythmPattern *singleton_rhythms[NB_SINGLETON_RHYTHMS]; /**< rhythm patterns for the EntryToolbar */ 1205 gboolean ScriptRecording;/**< TRUE when menuitems presses are being recorded as scheme script*/ 1206 gint keyboard_state;/**< state of last keypress/release controlling MIDI in*/ 1207 gboolean keyboard_state_locked;/**< lock against changes by shift and control keypresses */ 1208 1209 GtkWidget *script_view; /**< a GtkTextView containing a scheme script */ 1210 GList *palettes; /**< list of palettes of buttons for activating scripts */ 1211 gchar *old_user_data_dir; /**< set in case of upgrading denemo version */ 1212 gboolean *fatal_scheme_errors; /** Abort on scheme errors */ 1213 gboolean *silent; /** Don't log any message */ 1214 gboolean *verbose; /** Display every messages */ 1215 }; 1216 1217 extern struct DenemoRoot Denemo; /**< The root object. */ 1218 #endif 1219