Skip to content

Commit

Permalink
Requests #129 and #282 about Split and Merge feature for books
Browse files Browse the repository at this point in the history
  • Loading branch information
hbitteur committed Dec 10, 2021
1 parent 9910a09 commit 0b414c1
Show file tree
Hide file tree
Showing 33 changed files with 2,510 additions and 901 deletions.
Binary file added dev/icons/crystal/22x22/actions/edit_remove.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dev/icons/crystal/22x22/actions/editcopy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dev/icons/crystal/22x22/apps/aktion.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions res/system-actions.xml
Expand Up @@ -15,20 +15,21 @@

<actions>

<action domain="FILE" section="10" class="org.audiveris.omr.sheet.ui.BookActions" menu="inputHistory" button="javax.swing.JButton"/>
<action domain="FILE" section="10" class="org.audiveris.omr.sheet.ui.BookActions" method="openImageFile" button="javax.swing.JButton"/>
<action domain="FILE" section="10" class="org.audiveris.omr.sheet.ui.BookActions" menu="inputHistory" button="javax.swing.JButton"/>
<action domain="FILE" section="10" class="org.audiveris.omr.sheet.ui.BookActions" method="openImageFile" button="javax.swing.JButton"/>
<action domain="FILE" section="70" class="org.audiveris.omr.ui.GuiActions" method="exit"/>

<action domain="BOOK" section="05" class="org.audiveris.omr.sheet.ui.BookActions" menu="bookHistory" button="javax.swing.JButton"/>
<action domain="BOOK" section="05" class="org.audiveris.omr.sheet.ui.BookActions" menu="bookHistory" button="javax.swing.JButton"/>
<action domain="BOOK" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="openRecentBook"/>
<action domain="BOOK" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="openBook"/>
<action domain="BOOK" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="openBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="07" class="org.audiveris.omr.sheet.ui.BookActions" method="splitAndMerge"/>
<action domain="BOOK" section="10" class="org.audiveris.omr.sheet.ui.BookActions" method="resetBookToGray"/>
<action domain="BOOK" section="10" class="org.audiveris.omr.sheet.ui.BookActions" method="resetBookToBinary"/>
<action domain="BOOK" section="15" class="org.audiveris.omr.sheet.ui.BookActions" method="transcribeBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="20" class="org.audiveris.omr.sheet.ui.BookActions" method="defineParameters" button="javax.swing.JButton"/>
<action domain="BOOK" section="15" class="org.audiveris.omr.sheet.ui.BookActions" method="transcribeBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="20" class="org.audiveris.omr.sheet.ui.BookActions" method="defineParameters" button="javax.swing.JButton"/>
<action domain="BOOK" section="25" class="org.audiveris.omr.sheet.ui.BookActions" method="swapSheets"/>
<action domain="BOOK" section="25" class="org.audiveris.omr.sheet.ui.BookActions" method="selectSheets"/>
<action domain="BOOK" section="30" class="org.audiveris.omr.sheet.ui.BookActions" method="printBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="30" class="org.audiveris.omr.sheet.ui.BookActions" method="printBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="30" class="org.audiveris.omr.sheet.ui.BookActions" method="printBookAs"/>
<action domain="BOOK" section="40" class="org.audiveris.omr.sheet.ui.BookActions" method="exportBook"/>
<action domain="BOOK" section="40" class="org.audiveris.omr.sheet.ui.BookActions" method="exportBookAs"/>
Expand All @@ -37,12 +38,12 @@
<action domain="BOOK" section="45" class="org.audiveris.omr.sheet.ui.BookActions" method="saveBookRepository" topic="SAMPLES"/>
<action domain="BOOK" section="45" class="org.audiveris.omr.sheet.ui.BookActions" method="annotateBook" topic="ANNOTATIONS"/>
<action domain="BOOK" section="50" class="org.audiveris.omr.sheet.ui.BookActions" method="upgradeBook"/>
<action domain="BOOK" section="50" class="org.audiveris.omr.sheet.ui.BookActions" method="saveBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="50" class="org.audiveris.omr.sheet.ui.BookActions" method="saveBook" button="javax.swing.JButton"/>
<action domain="BOOK" section="50" class="org.audiveris.omr.sheet.ui.BookActions" method="saveBookAs"/>
<action domain="BOOK" section="60" class="org.audiveris.omr.sheet.ui.BookActions" method="closeBook"/>

<action domain="SHEET" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="undo" button="javax.swing.JButton"/>
<action domain="SHEET" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="redo" button="javax.swing.JButton"/>
<action domain="SHEET" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="undo" button="javax.swing.JButton"/>
<action domain="SHEET" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="redo" button="javax.swing.JButton"/>
<action domain="SHEET" section="05" class="org.audiveris.omr.sheet.ui.BookActions" method="toggleRepetitiveInput" item="javax.swing.JCheckBoxMenuItem" button="javax.swing.JToggleButton" />
<action domain="SHEET" section="15" class="org.audiveris.omr.sheet.ui.BookActions" method="transcribeSheet"/>
<action domain="SHEET" section="18" class="org.audiveris.omr.sheet.ui.BookActions" method="toggleSheetValidity"/>
Expand Down
3 changes: 2 additions & 1 deletion src/main/org/audiveris/omr/CLI.java
Expand Up @@ -65,6 +65,7 @@
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.Callable;
import org.audiveris.omr.sheet.ui.StubsController;

/**
* Class <code>CLI</code> parses and holds the parameters of the command line interface.
Expand Down Expand Up @@ -477,7 +478,7 @@ protected void processBook (Book book)

if (OMR.gui != null) {
Integer focus = (sheetIds != null) ? sheetIds.first() : null;
book.createStubsTabs(focus); // Tabs are now accessible
StubsController.getInstance().displayValidStubs(book, focus);
openBookDialog((focus != null) ? book.getStub(focus) : book.getFirstValidStub());
} else {
// Batch: Perform sheets upgrade?
Expand Down
43 changes: 34 additions & 9 deletions src/main/org/audiveris/omr/OmrEngine.java
Expand Up @@ -24,7 +24,8 @@
import org.audiveris.omr.sheet.Book;

import java.nio.file.Path;
import java.util.List;
import java.util.Collection;
import java.util.Map;

/**
* Interface <code>OmrEngine</code> defines the API of an OMR engine.
Expand All @@ -46,35 +47,59 @@ public interface OmrEngine
//~ Methods ------------------------------------------------------------------------------------

/**
* Report the list of all books handled.
* Insert the provided book in the collection of book instances.
*
* @return the non-mutable list of all books handled by the OMR service
* @param book the book to insert
*/
List<Book> getAllBooks ();
void addBook (Book book);

/**
* Report all books handled.
*
* @return the non-mutable collection of all books handled by the OMR service
*/
Collection<Book> getAllBooks ();

/**
* Report the live map of books, indexed by their path.
*
* @return the map path->book
*/
Map<Path, Book> getBookMap ();

/**
* Build a book out of a book file, which has previously been saved.
*
* @param path path to the book file
* @param bookPath path to the book file
* @return the allocated book
*/
Book loadBook (Path path);
Book loadBook (Path bookPath);

/**
* Build a book out of an input file.
*
* @param path path to the input file, which may contain several images
* @param inputPath path to the input file, which may contain several images
* @return the allocated book
*/
Book loadInput (Path path);
Book loadInput (Path inputPath);

/**
* Remove the provided book from OMR service.
*
* @param book the book to remove
* @param sheetNumber the current sheet number in book, if any, null otherwise
* @param sheetNumber the current sheet number in book, if any.
* sheet number is inserted in history, to enable reopening on same sheet
* @return true if book is actually removed
*/
boolean removeBook (Book book,
Integer sheetNumber);

/**
* Update book key in engine if needed.
*
* @param book the book to rename
* @param oldBookPath the previous book path or null
*/
public void renameBook (Book book,
Path oldBookPath);
}
1 change: 0 additions & 1 deletion src/main/org/audiveris/omr/score/PartwiseBuilder.java
Expand Up @@ -2347,7 +2347,6 @@ private void processScore ()

final Book book = score.getBook();
source.setFile(book.getInputPath().toString());
source.setOffset((book.getOffset() != null) ? book.getOffset() : 0);
source.encodeScore(scorePartwise);
}

Expand Down
31 changes: 0 additions & 31 deletions src/main/org/audiveris/omr/score/Source.java
Expand Up @@ -90,9 +90,6 @@ public class Source
/** Path to source image file, if any. */
private String file;

/** Sheet offset with respect to full work. */
private int offset;

/** Source image URI, if any. */
private URI uri;

Expand Down Expand Up @@ -177,12 +174,6 @@ public void encodeScore (ScorePartwise scorePartwise)
field.setName(SOURCE_PREFIX + "uri");
field.setValue(uri.toString());
}

if (offset != 0) {
misc.getMiscellaneousField().add(field = factory.createMiscellaneousField());
field.setName(SOURCE_PREFIX + "offset");
field.setValue("" + offset);
}
}

/**
Expand All @@ -201,22 +192,6 @@ public void setFile (String file)
this.file = file;
}

/**
* @return the offset
*/
public int getOffset ()
{
return offset;
}

/**
* @param offset the offset to set
*/
public void setOffset (int offset)
{
this.offset = offset;
}

/**
* @return the sheetSystems
*/
Expand Down Expand Up @@ -253,10 +228,6 @@ public String toString ()
sb.append("uri=").append(uri);
}

if (offset != 0) {
sb.append(" offset=").append(offset);
}

for (SheetSystems sheet : sheets) {
sb.append(" ").append(sheet);
}
Expand Down Expand Up @@ -303,8 +274,6 @@ public static Source decode (ScorePartwise scorePartwise)
source.file = value;
} else if (tail.equals("uri")) {
source.uri = URI.create(value);
} else if (tail.equals("offset")) {
source.offset = Integer.decode(value);
} else if (tail.startsWith(SHEET_PREFIX)) {
String numStr = tail.substring(SHEET_PREFIX.length());
int num = Integer.decode(numStr);
Expand Down

0 comments on commit 0b414c1

Please sign in to comment.