use of blue.score.layers.LayerGroup in project blue by kunstmusik.
the class ScoreManagerDialog method getAddLayerGroupMenu.
private JPopupMenu getAddLayerGroupMenu() {
if (addLayerGroupMenu == null) {
addLayerGroupMenu = new JPopupMenu();
ActionListener listener = (ActionEvent e) -> {
JMenuItem menuItem = (JMenuItem) e.getSource();
LayerGroupProvider provider = (LayerGroupProvider) menuItem.getClientProperty("provider");
LayerGroup layerGroup = provider.createLayerGroup();
LayerGroupTableModel model = getLayerGroupListModel();
int index = (layerGroupsTable.getSelectionModel().getMaxSelectionIndex());
if (index < 0 || index > model.getRowCount()) {
index = model.getRowCount();
model.addLayerGroup(index, layerGroup);
} else {
model.addLayerGroup(index, layerGroup);
}
ListSelectionModel selection = layerGroupsTable.getSelectionModel();
selection.setSelectionInterval(index, index);
};
LayerGroupProviderManager manager = LayerGroupProviderManager.getInstance();
for (LayerGroupProvider provider : manager) {
JMenuItem item = new JMenuItem("Add " + provider.getLayerGroupName() + " Layer Group");
item.putClientProperty("provider", provider);
item.addActionListener(listener);
addLayerGroupMenu.add(item);
}
}
return addLayerGroupMenu;
}
use of blue.score.layers.LayerGroup in project blue by kunstmusik.
the class ScoreManagerDialog method layerGroupsTableMouseClicked.
// GEN-LAST:event_layersMinusButtonActionPerformed
private void layerGroupsTableMouseClicked(java.awt.event.MouseEvent evt) {
// GEN-FIRST:event_layerGroupsTableMouseClicked
if (layerGroupsTable.isEditing()) {
return;
}
int rowIndex = layerGroupsTable.getSelectedRow();
if (rowIndex < 0) {
layersTable.setModel(emptyList);
propertiesScrollPane.setViewportView(null);
} else {
final LayerGroup layerGroup = score.get(rowIndex);
layersTable.setModel(new LayersTableModel(layerGroup));
TableColumn col = layersTable.getTableHeader().getColumnModel().getColumn(0);
col.setMaxWidth(50);
col.setMinWidth(50);
col.setPreferredWidth(50);
propertiesScrollPane.setViewportView(null);
LayerGroupUIProviderManager manager = LayerGroupUIProviderManager.getInstance();
JComponent comp = manager.getLayerGroupPropertiesPanel(layerGroup);
if (comp != null) {
propertiesScrollPane.setViewportView(comp);
}
}
// if (UiUtilities.isRightMouseButton(e)) {
// convertPopup.show(arrangementTable, e.getX(), e.getY());
// }
}
use of blue.score.layers.LayerGroup in project blue by kunstmusik.
the class ScoreTopComponent method listChanged.
@Override
public void listChanged(ObservableListEvent<LayerGroup<? extends Layer>> evt) {
if (evt.getType() == ObservableListEvent.DATA_ADDED) {
Score score = data.getScore();
for (int i = evt.getStartIndex(); i <= evt.getEndIndex(); i++) {
addPanelsForLayerGroup(i, score.get(i), score.getTimeState());
}
layerHeaderPanel.revalidate();
checkSize();
} else if (evt.getType() == ObservableListEvent.DATA_REMOVED) {
removePanelsForLayerGroups(evt.getStartIndex(), evt.getEndIndex());
} else if (evt.getType() == ObservableListEvent.DATA_CHANGED) {
List<LayerGroup<? extends Layer>> layerGroups = evt.getAffectedItems();
JComponent c = (JComponent) layerPanel.getComponent(evt.getStartIndex());
LayerGroup lGroup = (LayerGroup) c.getClientProperty("layerGroup");
if (layerGroups.get(1) == lGroup) {
// handle push down
Component comp = layerPanel.getComponent(evt.getEndIndex());
layerPanel.remove(comp);
layerPanel.add(comp, evt.getStartIndex());
Component comp2 = layerHeaderPanel.getComponent(evt.getEndIndex());
layerHeaderPanel.remove(comp2);
layerHeaderPanel.add(comp2, evt.getStartIndex());
layerPanel.revalidate();
layerHeaderPanel.revalidate();
layerPanel.repaint();
layerHeaderPanel.repaint();
} else {
// handle push up
Component comp = layerPanel.getComponent(evt.getStartIndex());
layerPanel.remove(comp);
layerPanel.add(comp, evt.getEndIndex());
Component comp2 = layerHeaderPanel.getComponent(evt.getStartIndex());
layerHeaderPanel.remove(comp2);
layerHeaderPanel.add(comp2, evt.getEndIndex());
layerPanel.revalidate();
layerHeaderPanel.revalidate();
layerPanel.repaint();
layerHeaderPanel.repaint();
}
}
}
use of blue.score.layers.LayerGroup in project blue by kunstmusik.
the class ScoreObjectBar method scorePathChanged.
@Override
public void scorePathChanged(ScorePath path) {
if (path != currentPath) {
for (int i = 0; i < getComponentCount(); i++) {
LayerGroupButton btn = (LayerGroupButton) getComponent(i);
btn.removeActionListener(this);
btn.removeMouseListener(popupListener);
}
this.removeAll();
LayerGroupButton btn = new LayerGroupButton(path.getScore());
btn.addActionListener(this);
btn.addMouseListener(popupListener);
this.add(btn);
for (LayerGroup layerGroup : path.getLayerGroups()) {
btn = new LayerGroupButton(layerGroup);
btn.addActionListener(this);
btn.addMouseListener(popupListener);
this.add(btn);
}
} else {
int layerGroupsCount = getComponentCount() - 1;
List<LayerGroup> layerGroups = path.getLayerGroups();
int pathSize = layerGroups.size();
if (layerGroupsCount > pathSize) {
while ((getComponentCount() - 1) > pathSize) {
this.remove(getComponentCount() - 1);
}
} else if (layerGroupsCount < pathSize) {
for (int i = layerGroupsCount; i < pathSize; i++) {
LayerGroupButton btn = new LayerGroupButton(layerGroups.get(i));
btn.addActionListener(this);
btn.addMouseListener(popupListener);
this.add(btn);
}
}
}
currentPath = path;
repaint();
}
use of blue.score.layers.LayerGroup in project blue by kunstmusik.
the class SoundObjectLibraryUtils method removeLibrarySoundObject.
public static void removeLibrarySoundObject(BlueData data, SoundObject sObj) {
SoundObjectLibrary library = data.getSoundObjectLibrary();
library.removeSoundObject(sObj);
for (SoundObject tempObj : library) {
if (tempObj instanceof PolyObject) {
removeSoundObjectInstances((PolyObject) tempObj, sObj);
}
}
Score score = data.getScore();
for (LayerGroup layerGroup : score) {
if (layerGroup instanceof PolyObject) {
PolyObject pObj = (PolyObject) layerGroup;
removeSoundObjectInstances(pObj, sObj);
}
}
}
Aggregations