Skip to content

Commit

Permalink
Implement/fix issue #506 Add a (simplified) score view in the notes e…
Browse files Browse the repository at this point in the history
…ditor, #501 Missing some grid vertical lines when scrolling velocity panel in Notes editor
  • Loading branch information
jjazzboss committed Dec 7, 2024
1 parent d2a3cdb commit 8750c4d
Show file tree
Hide file tree
Showing 18 changed files with 1,183 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ScoreChordViewer extends javax.swing.JPanel implements ChordViewer
final private static Icon ICON = new ImageIcon(ScoreChordViewer.class.getResource(ICON_PATH));

private CLI_ChordSymbol model;
private NotationGraphics ng;
private final NotationGraphics ng;
private static final Logger LOGGER = Logger.getLogger(ScoreChordViewer.class.getSimpleName());

/**
Expand Down Expand Up @@ -132,7 +132,7 @@ public void paintComponent(Graphics g)
Note previousNote = null;
for (Note n : ssi.getNotes())
{
Note nn = new Note(n.getPitch() + t, 1, 64, alt);
Note nn = new Note(n.getPitch() + t, 1f, 64, alt);
int line = nn.getGStaffLineNumber();
int accidental = 0;
if (!Note.isWhiteKey(nn.getPitch()))
Expand Down
5 changes: 5 additions & 0 deletions app/PianoRoll/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@
<artifactId>undomanager</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jjazzlab.app</groupId>
<artifactId>score</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jjazzlab.app</groupId>
<artifactId>upgrade</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="rb_velocity" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="rb_score" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sp_displayTransposition" min="-2" pref="52" max="-2" attributes="0"/>
<Component id="lbl_displayTransposition" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="57" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="rb_velocity" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="rb_score" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lbl_displayTransposition" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sp_displayTransposition" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="35" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="rb_velocity">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font component="rb_velocity" property="font" relativeSize="true" size="-1"/>
</FontInfo>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jjazz/pianoroll/Bundle.properties" key="BottomControlPanel.rb_velocity.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rb_velocityActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="rb_score">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font component="rb_score" property="font" relativeSize="true" size="-1"/>
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jjazz/pianoroll/Bundle.properties" key="BottomControlPanel.rb_score.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rb_scoreActionPerformed"/>
</Events>
</Component>
<Component class="org.jjazz.flatcomponents.api.WheelSpinner" name="sp_displayTransposition">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" maximum="24" minimum="-24" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jjazz/pianoroll/Bundle.properties" key="BottomControlPanel.sp_displayTransposition.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="columns" type="int" value="2"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font component="sp_displayTransposition" property="font" relativeSize="true" size="-1"/>
</FontInfo>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="sp_displayTranspositionStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lbl_displayTransposition">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font component="lbl_displayTransposition" property="font" relativeSize="true" size="-1"/>
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jjazz/pianoroll/Bundle.properties" key="BottomControlPanel.lbl_displayTransposition.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection component="sp_displayTransposition" name="getToolTipText" type="method"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
/*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright @2019 Jerome Lelasseux. All rights reserved.
*
* This file is part of the JJazzLab software.
*
* JJazzLab is free software: you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License (LGPLv3)
* as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* JJazzLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JJazzLab. If not, see <https://www.gnu.org/licenses/>
*
* Contributor(s):
*
*/
package org.jjazz.pianoroll;

/**
* The control panel to select which EditorPanel is shown in the bottom part of the editor.
*/
public class BottomControlPanel extends javax.swing.JPanel
{

public static final String VELOCITY_EDITOR_PANEL_STRING = "Velocity";
public static final String SCORE_EDITOR_PANEL_STRING = "Score";
/**
* Fired when user changed the selected editor panel.
* <p>
* oldValue=null, newValue=e.g. VELOCITY_EDITOR_PANEL_STRING
*/
public static final String PROP_EDITOR_PANEL_STRING = "PropEditorPanelString";
private final VelocityPanel velocityPanel;
private final ScorePanel scorePanel;

/**
* Creates new form BottomControlPanel
*
* @param vPanel
* @param sPanel
*/
public BottomControlPanel(VelocityPanel vPanel, ScorePanel sPanel)
{
this.velocityPanel = vPanel;
this.scorePanel = sPanel;
initComponents();

selectionChanged();
}

public String getSelectedPanelString()
{
return rb_velocity.isSelected() ? VELOCITY_EDITOR_PANEL_STRING : SCORE_EDITOR_PANEL_STRING;
}

private void selectionChanged()
{
firePropertyChange(PROP_EDITOR_PANEL_STRING, null, getSelectedPanelString());
boolean b = rb_score.isSelected();
lbl_displayTransposition.setEnabled(b);
sp_displayTransposition.setEnabled(b);
}

/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents()
{

buttonGroup1 = new javax.swing.ButtonGroup();
rb_velocity = new javax.swing.JRadioButton();
rb_score = new javax.swing.JRadioButton();
sp_displayTransposition = new org.jjazz.flatcomponents.api.WheelSpinner();
lbl_displayTransposition = new javax.swing.JLabel();

buttonGroup1.add(rb_velocity);
rb_velocity.setFont(rb_velocity.getFont().deriveFont(rb_velocity.getFont().getSize()-1f));
rb_velocity.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(rb_velocity, org.openide.util.NbBundle.getMessage(BottomControlPanel.class, "BottomControlPanel.rb_velocity.text")); // NOI18N
rb_velocity.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
rb_velocityActionPerformed(evt);
}
});

buttonGroup1.add(rb_score);
rb_score.setFont(rb_score.getFont().deriveFont(rb_score.getFont().getSize()-1f));
org.openide.awt.Mnemonics.setLocalizedText(rb_score, org.openide.util.NbBundle.getMessage(BottomControlPanel.class, "BottomControlPanel.rb_score.text")); // NOI18N
rb_score.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
rb_scoreActionPerformed(evt);
}
});

sp_displayTransposition.setModel(new javax.swing.SpinnerNumberModel(0, -24, 24, 1));
sp_displayTransposition.setToolTipText(org.openide.util.NbBundle.getMessage(BottomControlPanel.class, "BottomControlPanel.sp_displayTransposition.toolTipText")); // NOI18N
sp_displayTransposition.setColumns(2);
sp_displayTransposition.setFont(sp_displayTransposition.getFont().deriveFont(sp_displayTransposition.getFont().getSize()-1f));
sp_displayTransposition.addChangeListener(new javax.swing.event.ChangeListener()
{
public void stateChanged(javax.swing.event.ChangeEvent evt)
{
sp_displayTranspositionStateChanged(evt);
}
});

lbl_displayTransposition.setFont(lbl_displayTransposition.getFont().deriveFont(lbl_displayTransposition.getFont().getSize()-1f));
org.openide.awt.Mnemonics.setLocalizedText(lbl_displayTransposition, org.openide.util.NbBundle.getMessage(BottomControlPanel.class, "BottomControlPanel.lbl_displayTransposition.text")); // NOI18N
lbl_displayTransposition.setToolTipText(sp_displayTransposition.getToolTipText());

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rb_velocity)
.addComponent(rb_score)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sp_displayTransposition, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbl_displayTransposition))))
.addContainerGap(57, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(rb_velocity)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rb_score)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lbl_displayTransposition)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sp_displayTransposition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(35, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents

private void rb_velocityActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_rb_velocityActionPerformed
{//GEN-HEADEREND:event_rb_velocityActionPerformed
selectionChanged();
}//GEN-LAST:event_rb_velocityActionPerformed

private void rb_scoreActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_rb_scoreActionPerformed
{//GEN-HEADEREND:event_rb_scoreActionPerformed
selectionChanged();
}//GEN-LAST:event_rb_scoreActionPerformed

private void sp_displayTranspositionStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_sp_displayTranspositionStateChanged
{//GEN-HEADEREND:event_sp_displayTranspositionStateChanged
scorePanel.setDisplayTransposition((Integer)sp_displayTransposition.getValue());
}//GEN-LAST:event_sp_displayTranspositionStateChanged


// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JLabel lbl_displayTransposition;
private javax.swing.JRadioButton rb_score;
private javax.swing.JRadioButton rb_velocity;
private org.jjazz.flatcomponents.api.WheelSpinner sp_displayTransposition;
// End of variables declaration//GEN-END:variables
}
Loading

0 comments on commit 8750c4d

Please sign in to comment.