ChordPro / chordpro

Reference implementation of the ChordPro standard for musical lead sheets.
Other
310 stars 51 forks source link

Update macOS SwiftUI wrapper #434

Closed Desbeers closed 3 days ago

Desbeers commented 3 days ago
sciurius commented 3 days ago

Nice! Have you any idea why the CI for macOS fails?

Desbeers commented 3 days ago

HarfBuzz-Shaper fails... It did on my macOS Sonoma as well, I think Github is using Sonoma too. See https://github.com/ChordPro/chordpro/issues/373#issuecomment-2140875586

Never tried again on Sonoma, only in a Ventura VM and that gave no problems.

For sure my PR has nothing to do with it; its SwiftUI stuff only...

sciurius commented 3 days ago

For sure my PR has nothing to do with it;

Sure.

sciurius commented 2 days ago

Interesting changes. When I do File > New, you start a new instance of the program. Is that intentional?

When I save a (new) song, can you provide a default extension (e.g., .cho)? Now the file is saved 'as is' which confuses ChordPro when loading the file.

Haven't tried yet, but do you also save folders in the recent list?

Desbeers commented 2 days ago

When I do File > New, you start a new instance of the program. Is that intentional?

It does not start a new instance; it is just showing the Welcome window again. It is intentional.

It also works when you still have a song-file open; you can open as many song-windows as you like.

The application does not quit when you close the last window and when you click on the icon on the dock it will show the Welcome window again (traditional Mac behaviour).

When I save a (new) song, can you provide a default extension (e.g., .cho)? Now the file is saved 'as is' which confuses ChordPro when loading the file.

It does add the ‘.chordpro’ extension by default but it is hidden. You can add any other known extension (cho, crd, chopro, chord, pro) and that will be visible. If you add an unknown extension, ‘.chordpro’ will be added as well (and hidden again). Standard Mac behaviour that is not in my control.

Screenshot 2024-09-29 at 21 13 39

Haven't tried yet, but do you also save folders in the recent list?

I don’t (have to) save anything. Because the application is ‘document-based’ I get a lot of standard stuff ‘for free’, like open, save (as), versions, recents in the File menu, drag/drop, full-screen, right-click on title or dock etc.

NSDocumentController.shared.recentDocumentURLs just gives me an array with the last 10 files; no other code needed.

Or do you mean folders for the Songbook? They are not saved.

sciurius commented 2 days ago

FWIW, the preferrred extension for ChordPro songs is .cho.

See e.g. https://en.wikipedia.org/wiki/List_of_filename_extensions_(A%E2%80%93E)#C

I only played briefly but what I did was:

The song is opened, but ChordPro can not preview it.

Desbeers commented 1 day ago

FWIW, the preferred extension for ChordPro songs is .cho.

I will change the default to ‘.cho’

The song is opened, but ChordPro can not preview it.

A new song with only the title does not produce an PDF unless it has a couple of extra newlines. No error but also no PDF file (same if run the CLI from the Terminal). ChordProMac should hide the preview and open the editor when it can’t make a PDF. I’ll fix that.

I will add an option as well to hide the welcome window when doing a ‘File > New’. When hidden, it will just create a new song window. I would prefer to have a ‘New Song’ and ‘New Songbook’ item in the main menu but fiddling with windows and the menu in SwiftUI is very buggy. Unfortunately, SwiftUI is very iStuff focused and that is why half of ChordProMac is already written in AppKit.

Screenshot 2024-09-30 at 10 52 33