[libgtkmusic] Documentation added and valadoc integrated into the build system.



commit 1591236df6976133c3d9f3ac6eba4af57ad85808
Author: Leandro Mattioli <leandro mattioli gmail com>
Date:   Mon Apr 2 01:11:23 2018 -0300

    Documentation added and valadoc integrated into the build system.

 CMakeLists.txt        |   16 ++++-
 src/GuitarWidget.vala |  189 +++++++++++++++++++++++++++++++++++++++---------
 src/MusicalNotes.vala |   46 +++++++-----
 src/PianoWidget.vala  |   75 +++++++++++++------
 4 files changed, 246 insertions(+), 80 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc9bea9..fdc1d31 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -151,6 +151,20 @@ if(CREATE_GLADE_CATALOG)
     endif(XMLLINT_FOUND)
 endif(CREATE_GLADE_CATALOG)
 
+# =============================================================================
+# Documentation
+# =============================================================================
+find_program(VALADOC valadoc)
+set(VALADOC_FOUND NO)
+if(VALADOC)
+  set(VALADOC_FOUND YES)
+  add_custom_target(doc ${VALADOC} --force 
+                        -b ${CMAKE_SOURCE_DIR}/src -o ${CMAKE_BINARY_DIR}/doc
+                        --pkg gee-0.8 --pkg cairo --pkg gdk-3.0 --pkg gtk+-3.0
+                        --package-name=gtkmusic --package-version=0.4
+                    COMMENT "Make API Reference with ValaDoc")
+endif()
+option(DOCUMENTATION "Whether to make API reference" ${VALADOC_FOUND})
 
 # =============================================================================
 # Test utilities
@@ -215,6 +229,6 @@ message("Main Library        ON (always)")
 message("GI Typelib          ${CREATE_GIR}")
 message("Glade Catalog       ${CREATE_GLADE_CATALOG}")
 message("Executables (Tests) ${BUILD_TESTS}")
-message("Documentation       OFF")
+message("Documentation       ${DOCUMENTATION}")
 message("------------------------------------------------------------------")
 message("")
diff --git a/src/GuitarWidget.vala b/src/GuitarWidget.vala
index 0eb91da..5a32d77 100644
--- a/src/GuitarWidget.vala
+++ b/src/GuitarWidget.vala
@@ -2,8 +2,6 @@ using Gtk;
 using Gee;
 
 //TODO Make a QCAD picture with all relevant dimensions and offsets
-//TODO API Documentation
-//TODO Library Makefile and installation instructions
 //TODO Labels font correction
 
 namespace GtkMusic {
@@ -12,11 +10,31 @@ namespace GtkMusic {
  * A guitar string with a particular tuning
  **/
 public class GuitarString {
-    public string note;
+    /**
+     * The note associated with this guitar string 
+     */
+    public string note; 
+    
+    /**
+     * Whether this note should be vibrating (sinusoidal movement animation) 
+     */
     public bool vibrate = false;
-    public double vibrateSeed;  //should be private with getter
+    
+    /**
+     * A random generator seed (vibration animation phase difference) 
+     */
+    public double vibrateSeed;  //should be private with getter ?
+    
+    /**
+     * Guitar string color as a RGBA array of floats 
+     */
     public float[] color = {0.1f, 0.1f, 0.1f, 1.0f};
+    
+    /**
+     * Label color as a RGBA array of floats 
+     */
     public float[] labelColor = {0.0f, 0.0f, 0.0f, 1.0f};
+    
     public GuitarString(string note) {
         this.note = note;
         vibrateSeed = Random.next_double();
@@ -27,15 +45,31 @@ public class GuitarString {
  * A fret mark used to highlight a fret
  **/
 public class GuitarFretMark {
+    /**
+     * The fret mark position 
+     */
     public ushort position;
+    
+    /**
+     * Available symbols to highlight a given position 
+     */
     public enum Style {
         NONE,
         SOLID_CIRCLE,
         RECTANGLE,
         FANCY
     }
+    
+    /**
+     * The current symbol to be used (defaults to NONE) 
+     */
     public Style style;
+    
+    /** 
+     * The fret mark color as an RGBA array of floats 
+     */
     public float[] color = {0.8f, 0.8f, 0.8f, 1.0f};
+    
     public GuitarFretMark(ushort position) {
         this.position = position;
     }
@@ -45,15 +79,26 @@ public class GuitarFretMark {
  * A guitar position, composed by the string index and the fret index
  **/
 public class GuitarPosition {
+
+    /** 
+     * The guitar string index [0,5] associated to this guitar position 
+     */
     public ushort stringIndex;
+    
+    /** 
+     * The fret index associated to this guitar position 
+     */
     public ushort fretIndex;
+    
     public GuitarPosition(ushort stringIndex, ushort fretIndex) {
         this.stringIndex = stringIndex;
         this.fretIndex = fretIndex;
-    }  
+    }
+      
     public static uint hash_func(GuitarPosition key) {
         return (13 + key.stringIndex) * 23 + key.fretIndex;
     }
+    
     public static bool equal_func(GuitarPosition a, GuitarPosition b) {
         if(a.stringIndex == b.stringIndex && a.fretIndex == b.fretIndex)
             return true;
@@ -63,15 +108,29 @@ public class GuitarPosition {
 
 /**
  * The Guitar widget
- **/
+ */
 public class Guitar : DrawingArea {
 
     //=========================================================================
     //Signals
     //=========================================================================
-    public signal void note_pressed (Gdk.EventButton event,
+    
+    /**
+     * Signal emitted when a note has been pressed with the mouse
+     * @param guitar The Guitar who trigerred the event
+     * @param event The Gdk low level event object
+     * @param pos The GuitarPosition (string and fret) of the pressed note
+     */
+    public signal void note_pressed (Guitar guitar, Gdk.EventButton event,
                                      GuitarPosition pos);
-    public signal void note_released (Gdk.EventButton event,
+                              
+    /**
+     * Signal emitted when a note has been released (mouse button released)
+     * @param guitar The Guitar who trigerred the event
+     * @param event The Gdk low level event object
+     * @param pos The GuitarPosition (string and fret) of the released note
+     */
+    public signal void note_released (Guitar guitar, Gdk.EventButton event,
                                       GuitarPosition pos);
     
     //=========================================================================
@@ -79,18 +138,59 @@ public class Guitar : DrawingArea {
     //=========================================================================
     
     //Behavior properties
-    public bool showLabels = true;      //Show string labels (e.g. EADGBE)
-    public bool detailedLabels = false; //Show octaves in labels (e.g. E4)
-    public bool highlightFirstFret = true; //Draw additional line in 1st fret
-    public bool autoUpdate = true; //Auto-redraw when a note is added
-    private bool shouldAnimate = false; //Whether the guitar should be animated
+    
+    /**
+     * Render string labels (e.g.: EADGBE) 
+     */
+    public bool showLabels = true;
+    
+    /**
+     * Show octaves in labels (e.g.: E4) 
+     */
+    public bool detailedLabels = false;
+    
+    /** 
+     * Draw additional line in 1st fret 
+     */
+    public bool highlightFirstFret = true;
+    
+    /** 
+     * Auto-redraw when a note is added (disable for manual management) 
+     */
+    public bool autoUpdate = true; 
+    
+    /** 
+     * Whether the guitar should be animated (string vibrations)
+     */
+    private bool shouldAnimate = false;
     
     //Grid properties
-    public ushort fretNumber = 17; //Number of frets
+
+    /** 
+     * Number of frets 
+     */
+    public ushort fretNumber = 17;
+
     //public float[] gridBgColor = {0.57f, 0.39f, 0.30f, 1.0f};
+
+    /**
+     * Grid background color as a RGBA array of floats
+     */
     public float[] gridBgColor = {0.486f, 0.309f, 0.251f, 1.0f};
+
+    /** 
+     * Fret color as a RGBA array of floats 
+     */
     public float[] fretColor = {0.6f, 0.6f, 0.6f, 1.0f};
+
+    /** 
+     * Collection of strings 
+     */
     public ArrayList<GuitarString> guitarStrings;
+
+    /**
+     * Collection of fret marks 
+     */
     public HashSet<GuitarFretMark> fretMarks;
     
     //Advanced style properties
@@ -100,12 +200,19 @@ public class Guitar : DrawingArea {
     //Marked Notes
     //=========================================================================
     
+    /** 
+     * Style for marked notes 
+     */
     public class MarkedNoteStyle {
         public float[] color = {0.0f, 0.0f, 0.0f, 1.0f};
         public MarkedNoteStyle(float[] color) {
             this.color = color;
         }
     }
+
+    /** 
+     * Marked notes dictionary (position and mark style) 
+     */
     public HashMap<GuitarPosition, MarkedNoteStyle> markedNotes;
     
     //=========================================================================
@@ -133,7 +240,7 @@ public class Guitar : DrawingArea {
     //=========================================================================
     
    /**
-    * Creates a new Guitar widget, which minimum size is defined to 170x60
+    * Create a new Guitar widget, which minimum size is defined to 170x60
     **/
     public Guitar () {
         //stdout.printf("Creating guitar [START]..."); stdout.flush();
@@ -156,16 +263,25 @@ public class Guitar : DrawingArea {
     //Animation related
     //=========================================================================
     
+    /**
+     * Start the animation on strings set to vibrate
+     */ 
     public void start_animation() {
         shouldAnimate = true;
         Timeout.add (10, update_animation);
     }
     
+    /**
+     * Stop the string vibration animation
+     */
     public void stop_animation() {
         shouldAnimate = false;
         animateInstant = 0;
     }
     
+    /**
+     * Draw a new frame of the vibration animation
+     */
     private bool update_animation() {
         animateInstant += 0.3f;
         redraw();
@@ -175,7 +291,7 @@ public class Guitar : DrawingArea {
     //====Marking-related======================================================
     
    /**
-    * Highlights a position (string and fret) in the instrument
+    * Highlight a position (string and fret) in the instrument
     * @param stringIndex The string number (top string equals to 0)
     * @param fretIndex The fret number
     **/
@@ -188,8 +304,8 @@ public class Guitar : DrawingArea {
     }
 
    /**
-    * Removes the mark of a position (string and fret) in the instrument
-    * @param stringIndex The string number (top string equals to 0)
+    * Remove the mark of a position (string and fret) in the instrument
+    * @param stringIndex The string number (topmost string equals to 0)
     * @param fretIndex The fret number
     **/    
     public void unmark_position(ushort stringIndex, ushort fretIndex) {
@@ -201,7 +317,7 @@ public class Guitar : DrawingArea {
     }
     
    /**
-    * Removes all marked notes in the Guitar view
+    * Remove all marked notes in the Guitar view
     **/ 
     public void unmark_all() {
         markedNotes.clear();
@@ -210,7 +326,7 @@ public class Guitar : DrawingArea {
     }
     
    /**
-    * Highlights all positions corresponding to a note
+    * Highlight all positions corresponding to a note
     * @param note A musical note in scientific notation (examples: F#4 , C)
     **/
     public void mark_note(string note, 
@@ -228,7 +344,7 @@ public class Guitar : DrawingArea {
     }
     
    /**
-    * Removes the marks in all positions corresponding to a note
+    * Remove the marks in all positions corresponding to a note
     * @param note A musical note in scientific notation (examples: F#4 , C)
     **/    
     public void unmark_note(string note) {
@@ -247,7 +363,7 @@ public class Guitar : DrawingArea {
     //=====Coordinates and units related (Note <--> GuitarPosition <--> x,y)===
     
     /**
-     * Computes the fret index to accomplish a given note in a given string
+     * Compute the fret index to accomplish a given note in a given string
      * @param stringIndex The guitar string index
      * @param note The musical note in scientific notation
      * @return The position where the note can be found or -1
@@ -263,7 +379,7 @@ public class Guitar : DrawingArea {
     }
     
    /**
-    * Finds all positions of a given note
+    * Find all positions of a given note
     * @param note The note with or without the octave component (e.g: A#, D4)
     **/
     public HashSet<GuitarPosition>? find_positions(string note) {
@@ -297,7 +413,7 @@ public class Guitar : DrawingArea {
     }
     
    /**
-    * Gets a MIDI code from a guitar position
+    * Get a MIDI code from a guitar position
     **/
     public ushort position_to_midi(GuitarPosition position) {
         string first_note = guitarStrings[position.stringIndex].note;
@@ -315,7 +431,7 @@ public class Guitar : DrawingArea {
     }
 
     /**
-     * Finds the guitar position associated to a point
+     * Find the guitar position associated to a point
      * @param x The x coordinate of the point
      * @param y The y coordinate of the point
      **/    
@@ -349,26 +465,26 @@ public class Guitar : DrawingArea {
    /**
     * Customized button_press_event
     *
-    * Adds the current position and note to the standard button-press event and
+    * Add the current position and note to the standard button-press event and
     * emits a note_pressed signal.
     **/
     public override bool button_press_event (Gdk.EventButton event) {
         GuitarPosition? pos = point_to_position(event.x, event.y);
         if(pos != null)
-            note_pressed(event, pos);
+            note_pressed(this, event, pos);
         return true;
     }
 
    /**
     * Customized button_released_event
     *
-    * Adds the current position and note to the standard button-release event 
+    * Add the current position and note to the standard button-release event 
     * and emits a note_released signal.
     **/
     public override bool button_release_event (Gdk.EventButton event) {
         GuitarPosition? pos = point_to_position(event.x, event.y);
         if(pos != null)
-            note_released(event, pos);
+            note_released(this, event, pos);
         return true;   
     }
 
@@ -376,7 +492,7 @@ public class Guitar : DrawingArea {
     //====Drawing methods======================================================
     
    /**
-    * Draws a guitar widget
+    * Draw the guitar widget
     *
     * @param cr The drawing context for the widget
     * @return Whether the event should be propagated (TODO Confirm this theory)
@@ -436,7 +552,6 @@ public class Guitar : DrawingArea {
     }
     
     
-    
    /**
     * Draw guitar strings according to its style properties
     * @param cr The drawing context for the widget
@@ -481,7 +596,7 @@ public class Guitar : DrawingArea {
    /**
     * Draw guitar frets
     * @param cr The drawing context for the widget
-    **/  
+    */  
     private void draw_frets(Cairo.Context cr) {
         cr.save();
         cr.set_source_rgba(fretColor[0], fretColor[1], 
@@ -506,7 +621,7 @@ public class Guitar : DrawingArea {
    /**
     * Draw fret marks
     * @param cr The drawing context for the widget
-    **/  
+    */  
     private void draw_fret_marks(Cairo.Context cr) {
         if(fretMarks.size == 0)
             return;
@@ -521,11 +636,12 @@ public class Guitar : DrawingArea {
         cr.fill();
         cr.restore();
     }
+
     
    /**
     * Draw marked notes
     * @param cr The drawing context for the widget
-    **/  
+    */  
     private void draw_marked_notes(Cairo.Context cr) {
         if(markedNotes.size == 0)
             return;
@@ -543,13 +659,14 @@ public class Guitar : DrawingArea {
         cr.restore();
     }
 
+
     /**
-    * Forces a complete redraw of the widget
+    * Force a complete redraw of the widget
     *
     * This function will invalidate all the region corresponding to the
     * widget's GDK window and ask for updates, forcing a complete redraw.
     *
-    **/
+    */
     public void redraw () {
         var window = get_window ();
         if (null == window) {
diff --git a/src/MusicalNotes.vala b/src/MusicalNotes.vala
index 66eae3b..483ca01 100644
--- a/src/MusicalNotes.vala
+++ b/src/MusicalNotes.vala
@@ -12,6 +12,9 @@ public errordomain MusicalNoteError {
     ALREADY_COMPLETE
 }
 
+/**
+ * Musical notes utilities
+ */
 public class MusicalNotes {
     /**
      * Musical notes, without octaves
@@ -40,7 +43,7 @@ public class MusicalNotes {
     }
     
    /**
-    * Checks whether a note is valid
+    * Check whether a note is valid
     * @param note The note in scientific notation (as in E3)
     * @return True if the note is valid or false otherwise
     **/
@@ -55,7 +58,7 @@ public class MusicalNotes {
     }
 
    /**
-    * Checks whether a string represents a note without octave
+    * Check whether a string represents a note without octave
     * @param needle The string to be checked
     * @return True if it's a note without octave or false otherwise
     **/
@@ -67,7 +70,7 @@ public class MusicalNotes {
     }
     
     /**
-     * Returns all notes with a given name (map C to => C0, C1, C2, ...);
+     * Return all notes with a given name (map C to => C0, C1, C2, ...);
      * @param incompleteNote A note without its octave component
      * @return A set of all possible notes with this name
      **/
@@ -94,19 +97,22 @@ public class MusicalNotes {
     }
     
    /**
-    * Gets the note's MIDI code
+    * Get the note's MIDI code
     *
     * Algorithm:
     * A note, such as C#3 is decomposed into:
-    *  - the octave (3)
-    *  - the note name (C#)
+    *
+    *  * the octave (3)
+    *  * the note name (C#)
+    *
     * Each note name receives an index in the range 0..11 .
-    * The index is used as the "LSB" part of the note number and the octave
-    * is used as the "MSB" part of the number.
-    * An offset (12) is added so that A0=21
-    * A constraint is added so that the note is between 21 (A0) and 108 (C8)
+    * The index is used as the lowest part of the note number and the octave
+    * is used as the most significant part of the number.
+    * An offset (12) is added so that A0=21.
+    * A constraint is added so that the note is between 21 (A0) and 108 (C8),
+    * resulting in valid MIDI codes.
     *
-    * @param note The note in scientific notation (with octave)
+    * @param note The note in musical notation (with octave, e.g.: C#3)
     * @return The associated MIDI code
     **/
     public static short get_note_as_midi_code(string note) 
@@ -146,17 +152,17 @@ public class MusicalNotes {
 
 
     /**
-    * Gets the note's string from its MIDI code
+    * Get the note's string from its MIDI code
     *
     * This functions performs the inverse procedure of getting a MIDI code from
     * a scientific notation note string:
     * 
-    * 1. Subtract 18 from the MIDI code
-    * 2. Get the integer part of the division by 12 as the octave
-    * 3. Get the modulus division as the note index
-    * 4. Construct note indexing the note_names list and adding the octave
+    *  1. Subtract 18 from the MIDI code
+    *  2. Get the integer part of the division by 12 as the octave
+    *  3. Get the modulus division as the note index
+    *  4. Construct note indexing the note_names list and adding the octave
     *
-    * @param note The note valid MIDI code
+    * @param midi The note valid MIDI code
     * @return The note as a string or ""
     **/
     public static string get_note_from_midi_code(ushort midi) 
@@ -172,9 +178,10 @@ public class MusicalNotes {
         note += octave.to_string();
         return note;
     }
+
     
     /**
-     * Checks whether a given MIDI code is an accidental note (C#, D#, ...)
+     * Check whether a given MIDI code is an accidental note (C#, D#, ...)
      * @param midi The MIDI code of a note
      * @return Whether the note has an accidental
      **/
@@ -190,9 +197,10 @@ public class MusicalNotes {
                     return false;
             }      
     }
+
     
     /**
-     * Checks whether a given MIDI code is different of E or B
+     * Check whether a given MIDI code is different of E or B
      * @param midi The MIDI code of a note
      * @return Whether the note can have an accident (thus, neither E nor B)
      **/
diff --git a/src/PianoWidget.vala b/src/PianoWidget.vala
index ea75562..43dc775 100644
--- a/src/PianoWidget.vala
+++ b/src/PianoWidget.vala
@@ -2,7 +2,6 @@ using Gtk;
 using Gee;
 
 //TODO Make a QCAD picture with all relevant dimensions and offsets
-//TODO API Documentation
 //TODO Library Makefile and installation instructions
 //TODO Labels
 
@@ -34,6 +33,9 @@ using Gee;
 
 namespace GtkMusic {
 
+/** 
+ * Piano widget custom errors 
+ */
 public errordomain PianoError {
     INVALID_COORDINATES
 }
@@ -47,10 +49,23 @@ public class Piano : DrawingArea {
     //Signals
     //=========================================================================
     
-    public signal void note_pressed (Gdk.EventButton event,
-                                     int midi_note); //ushort not supported
-    public signal void note_released (Gdk.EventButton event,
-                                      int midi_note); //ushort not supported
+    /**
+     * Signal emitted when a note has been pressed with the mouse
+     * @param piano The Piano who trigerred the event
+     * @param event The Gdk low level event object
+     * @param midi_note The MIDI value (number) of the pressed note
+     */
+    public signal void note_pressed (Piano widget, Gdk.EventButton event,
+                                     int midi_note); //ushort not supported?
+
+    /**
+     * Signal emitted when a note has been released (mouse button released)
+     * @param piano The Piano who trigerred the event
+     * @param event The Gdk low level event object
+     * @param midi_note The MIDI value (number) of the released note
+     */
+    public signal void note_released (Piano piano, Gdk.EventButton event,
+                                      int midi_note); //ushort not supported?
   
     //=========================================================================
     //Properties
@@ -100,7 +115,7 @@ public class Piano : DrawingArea {
     //=========================================================================
    
    /**
-    * Creates a new Piano widget, which minimum size is defined to 120x40
+    * Create a new Piano widget, which minimum size is defined to 120x40
     **/
     public Piano() {
         add_events (Gdk.EventMask.BUTTON_PRESS_MASK
@@ -112,7 +127,7 @@ public class Piano : DrawingArea {
     //====Marking-related======================================================
     
    /**
-    * Highlights a key corresponding to a MIDI code
+    * Highlight a key corresponding to a MIDI code
     * @param midi_note A valid MIDI code (in range: 21 .. 108)
     * @param color The color (in RGBA []) to fill the marked key (default: blue)
     **/
@@ -124,7 +139,7 @@ public class Piano : DrawingArea {
     }
     
    /**
-    * Removes the mark of a position (string and fret) in the instrument
+    * Remove the mark of a position in the instrument
     * @param midi_note A valid MIDI code (in range: 21 .. 108)
     **/
     public void unmark_midi(ushort midi_note) {
@@ -135,7 +150,7 @@ public class Piano : DrawingArea {
     }
     
    /**
-    * Highlights all positions corresponding to a note
+    * Highlight all positions corresponding to a note
     * @param note A musical note in scientific notation (examples: F#4 , C)
     **/
     public void mark_note(string note,
@@ -157,7 +172,7 @@ public class Piano : DrawingArea {
     }
 
    /**
-    * Removes the marks in all positions corresponding to a note
+    * Remove the marks in all positions corresponding to a note
     * @param note A musical note in scientific notation (examples: F#4 , C)
     **/
     public void unmark_note(string note) {
@@ -178,7 +193,7 @@ public class Piano : DrawingArea {
     }
     
    /**
-    * Removes all marked notes in the Piano view
+    * Remove all marked notes in the Piano view
     **/ 
     public void unmark_all() {
         markedNotes.clear();
@@ -189,7 +204,7 @@ public class Piano : DrawingArea {
     //====Coordinates or calculus related======================================
 
     /**
-     * Gets the MIDI code corresponding to a point (x,y) in the widget
+     * Get the MIDI code corresponding to a point (x,y) in the widget
      * @param x Valid x coordinate
      * @param y Valid y coordinate
      **/    
@@ -242,7 +257,7 @@ public class Piano : DrawingArea {
     }
     
     /**
-     * Gets the x coordinate of the key associated to a given MIDI code
+     * Get the x coordinate of the key associated to a given MIDI code
      * @param midi_code A valid MIDI code, present in the piano range
      **/
     public double midi_to_x(ushort midi_code) {
@@ -261,7 +276,7 @@ public class Piano : DrawingArea {
     }
     
    /**
-    * Finds all MIDI codes for a given note
+    * Find all MIDI codes for a given note
     * @param note The note with or without the octave component (e.g: A#, D4)
     **/
     public HashSet<ushort>? find_positions(string note) {
@@ -281,7 +296,7 @@ public class Piano : DrawingArea {
     }
     
     /**
-     * Returns the number of natural keys for the current instance parameters
+     * Return the number of natural keys for the current instance parameters
      * @return The number of natural keys
      **/
     private ushort get_natural_keys_count() {
@@ -301,24 +316,36 @@ public class Piano : DrawingArea {
     
     //====Events===============================================================
     
+   /**
+    * Customized button_press_event
+    *
+    * Add the current position and note to the standard button-press event and
+    * emits a note_pressed signal.
+    */
     public override bool button_press_event (Gdk.EventButton event) {
-        note_pressed(event, point_to_midi(event.x, event.y));
+        note_pressed(this, event, point_to_midi(event.x, event.y));
         return true;
     }
     
+   /**
+    * Customized button_released_event
+    *
+    * Add the current position and note to the standard button-release event 
+    * and emits a note_released signal.
+    */
     public override bool button_release_event (Gdk.EventButton event) {
-        note_released(event, point_to_midi(event.x, event.y));
+        note_released(this, event, point_to_midi(event.x, event.y));
         return true;
     }
     
     //====Drawing methods======================================================
     
    /**
-    * Draws a guitar widget
+    * Draw the piano widget
     *
     * @param cr The drawing context for the widget
     * @return Whether the event should be propagated (TODO Confirm this theory)
-    **/
+    */
     public override bool draw (Cairo.Context cr) {
         calculate_dimensions(cr);
         draw_natural_keys(cr);
@@ -327,12 +354,12 @@ public class Piano : DrawingArea {
     }
     
     /**
-    * Forces a complete redraw of the widget
+    * Force a complete redraw of the widget
     *
     * This function will invalidate all the region corresponding to the
     * widget's GDK window and ask for updates, forcing a complete redraw.
     *
-    **/
+    */
     public void redraw () {
         var window = get_window ();
         if (null == window) {
@@ -346,7 +373,7 @@ public class Piano : DrawingArea {
    /**
     * Calculate some drawing dimensions
     * @param cr The drawing context for the widget
-    **/
+    */
     private void calculate_dimensions(Cairo.Context cr) {
         width = get_allocated_width (); //total width for the widget
         height = get_allocated_height (); //total height for the widget
@@ -369,7 +396,7 @@ public class Piano : DrawingArea {
    /**
     * Draw natural notes (C, D, E, F, G, A, B)
     * @param cr The drawing context for the widget
-    **/
+    */
     private void draw_natural_keys(Cairo.Context cr) {
         double x = piano_x;
         double y = piano_y;
@@ -405,7 +432,7 @@ public class Piano : DrawingArea {
    /**
     * Draw natural notes (C#, D#, F#, G#, A#)
     * @param cr The drawing context for the widget
-    **/
+    */
     private void draw_accident_keys(Cairo.Context cr) {
         double x = piano_x;
         double y = piano_y;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]