Skip to content

Commit

Permalink
Updated JUCE version, fixed some GUI related bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraen committed Feb 6, 2023
1 parent 13f7af7 commit bd3a696
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 22 deletions.
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ list(TRANSFORM SEQ64_GUI_ONLY_SOURCES PREPEND "Source/")
if(WIN32)
set(SEQ64_COMPILE_OPTIONS "/W2" "/O2")
else()
set(SEQ64_COMPILE_OPTIONS "-Wall" "-Wextra" "-Wno-sign-compare" "-Wno-sign-conversion" "-O3")
set(SEQ64_COMPILE_OPTIONS "-Wall" "-Wextra" "-Wno-sign-compare" "-Wno-sign-conversion" "-O2")
endif()

set(NAME_STR "SEQ64 V${PROJECT_VERSION}")
Expand All @@ -79,6 +79,10 @@ set(SEQ64_DEFINITIONS
JUCE_APPLICATION_VERSION_HEX=${VER_HEX}
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)

# Console version

add_executable(seq64_console
Expand All @@ -89,9 +93,6 @@ add_executable(seq64_console
"juce/modules/juce_audio_basics/juce_audio_basics.cpp"
"juce/modules/juce_data_structures/juce_data_structures.cpp"
)
if(APPLE)
set_target_properties(seq64_console PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE)
endif()
target_include_directories(seq64_console PRIVATE
"Source"
"juce/modules"
Expand All @@ -116,12 +117,10 @@ if(SEQ64_BUILD_GUI)
juce_add_gui_app(seq64_gui PRODUCT_NAME "seq64_gui" COMPANY_NAME "Sauraen")
juce_generate_juce_header(seq64_gui)
target_sources(seq64_gui PRIVATE ${SEQ64_SHARED_SOURCES} ${SEQ64_GUI_ONLY_SOURCES})
if(APPLE)
set_target_properties(seq64_gui PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED TRUE CXX_EXTENSIONS FALSE)
endif()
target_compile_definitions(seq64_gui PRIVATE
${SEQ64_DEFINITIONS}
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_MODAL_LOOPS_PERMITTED=1
)
target_link_libraries(seq64_gui PRIVATE
juce::juce_core
Expand Down
34 changes: 27 additions & 7 deletions Source/SeqEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)
//TODO default files
File f = File::getSpecialLocation(File::userHomeDirectory); //TODO SEQ64::readFolderProperty("midiimportfolder");
FileChooser box("Select a MIDI to load...", f, "*.mid;*.midi;*.rmi", true);
if(!box.browseForFileToOpen()) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToOpen();
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
f = box.getResult();
if(!f.existsAsFile()){
std::cout << "File " << f.getFullPathName() << " does not exist!";
Expand All @@ -814,7 +817,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)

File savelocation = File::getSpecialLocation(File::userHomeDirectory); //SEQ64::readFolderProperty("midifolder");
FileChooser box("Save MIDI", savelocation, "*.mid", true);
if(!box.browseForFileToSave(true)) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToSave(true);
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
savelocation = box.getResult();
startSeqOperation("MIDI export", &SeqFile::exportMIDI, savelocation, midiopts);
//[/UserButtonCode_btnExportMIDI]
Expand All @@ -827,7 +833,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)
if(!checkSeqPresence(false)) return;
File f = File::getSpecialLocation(File::userHomeDirectory); //TODO SEQ64::readFolderProperty("romfolder");
FileChooser box("Load .mus", f, "*.mus", true);
if(!box.browseForFileToOpen()) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToOpen();
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
f = box.getResult();
seq.reset(new SeqFile(abi));
startSeqOperation(".mus import", &SeqFile::importMus, f);
Expand All @@ -839,7 +848,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)
if(!checkSeqPresence(true)) return;
File savelocation = File::getSpecialLocation(File::userHomeDirectory); //SEQ64::readFolderProperty("comfolder");
FileChooser box("Save .mus", savelocation, "*.mus", true);
if(!box.browseForFileToSave(true)) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToSave(true);
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
savelocation = box.getResult();
int dialect = optMusCommunity->getToggleState() ? 0 : optMusCanon->getToggleState() ? 2 : 4;
dialect |= optStyleSFX->getToggleState() ? 1 : 0;
Expand All @@ -854,7 +866,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)
if(!checkSeqPresence(false)) return;
File f = File::getSpecialLocation(File::userHomeDirectory); //TODO SEQ64::readFolderProperty("romfolder");
FileChooser box("Load .com/.aseq", f, "*.com;*.aseq;*.seq;*.m64;*.bin;*.seq", true);
if(!box.browseForFileToOpen()) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToOpen();
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
f = box.getResult();
seq.reset(new SeqFile(abi));
startSeqOperation(".com/.aseq import", &SeqFile::importCom, f);
Expand All @@ -866,7 +881,10 @@ void SeqEditor::buttonClicked (juce::Button* buttonThatWasClicked)
if(!checkSeqPresence(true)) return;
File savelocation = File::getSpecialLocation(File::userHomeDirectory); //SEQ64::readFolderProperty("comfolder");
FileChooser box("Save .com/.aseq", savelocation, "*.com;*.aseq;*.seq;*.m64;*.bin;*.seq", true);
if(!box.browseForFileToSave(true)) return;
File oldwd = File::getCurrentWorkingDirectory();
bool hitokay = box.browseForFileToSave(true);
oldwd.setAsCurrentWorkingDirectory();
if(!hitokay) return;
savelocation = box.getResult();
startSeqOperation(".com/.aseq export", &SeqFile::exportCom, savelocation);
//[/UserButtonCode_btnExportCom]
Expand Down Expand Up @@ -957,7 +975,9 @@ void SeqEditor::timerCallback(){
}

ValueTree SeqEditor::getABI(){
ValueTree abi = SeqFile::loadABI(lstABI->get(lstABI->getLastRowSelected()));
int row = lstABI->getLastRowSelected();
String abistr = lstABI->get(row);
ValueTree abi = SeqFile::loadABI(abistr);
if(!abi.isValid()){
NativeMessageBox::showMessageBox(AlertWindow::WarningIcon, "seq64",
"Invalid ABI selected!");
Expand Down
10 changes: 5 additions & 5 deletions Source/SeqFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,30 @@ StringArray SeqFile::getAvailABIs(){
ValueTree SeqFile::loadABI(String name){
File abifile = findFile("abi/" + name + ".xml");
if(!abifile.existsAsFile()){
std::cout << "Could not find file " + abifile.getFullPathName() + "!";
std::cout << "Could not find file " + abifile.getFullPathName() + "!\n";
return ValueTree();
}
std::unique_ptr<XmlElement> xml = parseXML(abifile);
if(!xml){
std::cout << "Error parsing XML of " + abifile.getFullPathName() + "!";
std::cout << "Error parsing XML of " + abifile.getFullPathName() + "!\n";
return ValueTree();
}
return ValueTree::fromXml(*xml);
}
bool SeqFile::saveABI(String name, ValueTree abi_){
File abifile = findFile("abi/" + name + ".xml");
if(!abifile.existsAsFile()){
std::cout << "Could not find file " + abifile.getFullPathName() + "!";
std::cout << "Could not find file " + abifile.getFullPathName() + "!\n";
return false;
}
std::unique_ptr<XmlElement> xml = abi_.createXml();
if(!xml){
std::cout << "Error creating XML for currently loaded ABI!";
std::cout << "Error creating XML for currently loaded ABI!\n";
return false;
}
FileOutputStream fos(abifile);
if(fos.failedToOpen()){
std::cout << "Couldn't open file " + abifile.getFullPathName() + " for writing!";
std::cout << "Couldn't open file " + abifile.getFullPathName() + " for writing!\n";
return false;
}
fos.setPosition(0);
Expand Down
6 changes: 5 additions & 1 deletion Source/TextListBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ void TextListBox::Listener::rowDoubleClicked(TextListBox* parent, int row) {
}

TextListBox::TextListBox(Listener *l, String headerCaption)
: ListBox("TextListBox", this), listener(l), font(15.0f), selectonadd(true) {
: ListBoxModel(), // this must be constructed as a model before passing
ListBox("TextListBox", this), // itself to ListBox constructor
listener(l),
font(15.0f),
selectonadd(true) {
setMultipleSelectionEnabled(false);
setClickingTogglesRowSelection(false);
setRowSelectedOnMouseDown(true);
Expand Down
2 changes: 1 addition & 1 deletion Source/TextListBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "Common.hpp"

class TextListBox : public ListBox, ListBoxModel
class TextListBox : public ListBoxModel, public ListBox
{
public:
class Listener{
Expand Down
2 changes: 1 addition & 1 deletion juce
Submodule juce updated 2677 files

0 comments on commit bd3a696

Please sign in to comment.