Skip to content

Commit

Permalink
Merge pull request #83 from d3cod3/0.7.0-pre-release
Browse files Browse the repository at this point in the history
publishing 0.7.0 pre release
  • Loading branch information
d3cod3 authored Dec 14, 2024
2 parents f8b2fe5 + 2e82707 commit 6423bc9
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 54 deletions.
47 changes: 33 additions & 14 deletions Mosaic.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Project{

ofApp {
name: { return FileInfo.baseName(sourceDirectory) }
cpp.minimumMacosVersion: '10.15'
cpp.cxxLanguageVersion: 'c++17'

files: [
"profiler/tracy/TracyClient.cpp",
Expand All @@ -35,7 +37,17 @@ Project{
// flags by default to add the core libraries, search paths...
// this flags can be augmented through the following properties:
of.pkgConfigs: [] // list of additional system pkgs to include
of.includePaths: ['profiler/tracy'] // include search paths
of.includePaths: {
var paths = ['profiler/tracy'];
if(qbs.hostOS.contains("osx")){
paths = paths.concat([of_root+'/addons/ofxFft/src']);
}else if(qbs.hostOS.contains("windows")){
paths = paths.concat([]);
}else if(qbs.hostOS.contains("linux")){
paths = paths.concat([]);
}
return paths;
}
of.cFlags: [] // flags passed to the c compiler


Expand All @@ -54,7 +66,20 @@ Project{
}

// flags passed to the linker
of.linkerFlags: []
of.linkerFlags: {
var lFlags = [];
if(qbs.hostOS.contains("osx")){
lFlags = lFlags.concat([
'-L'+of_root+'/addons/ofxFFt/libs/fftw/lib', // for ofxFft
'-lopendht', '-lgnutls', '-lnettle', '-lfmt', // for openDHT
]);
}else if(qbs.hostOS.contains("windows")){
lFlags = lFlags.concat([]);
}else if(qbs.hostOS.contains("linux")){
lFlags = lFlags.concat([]);
}
return lFlags;
}

// defines are passed as -D to the compiler, and can be checked with #ifdef or #if in the code
of.defines: {
Expand Down Expand Up @@ -109,29 +134,23 @@ Project{

// add CoreMIDI for osx before big sur
Properties {
condition: qbs.hostOS.contains("10.12") || qbs.hostOS.contains("10.13") || qbs.hostOS.contains("10.14") || qbs.hostOS.contains("10.15")
condition: qbs.hostOS.contains("10.15")
of.frameworks: outer.concat(['/System/Library/Frameworks/CoreMIDI.framework']);
}

// add QTKit support on osx 10.12
Properties {
condition: qbs.hostOS.contains("osx") && qbs.hostOS.contains("10.12")
of.frameworks: outer.concat(['QTKit']);
}

// Include ofxSyphon on osx
Properties {
// osx only, additional frameworks to link with the project
condition: qbs.targetOS.contains("osx") || qbs.targetOS.contains("macos")
of.addons: outer.concat(['ofxSyphon'])
of.frameworks: outer.concat(['Syphon'])
cpp.frameworkPaths: ['../../../addons/ofxSyphon/libs/Syphon/lib/osx/']
cpp.frameworkPaths: [of_root+'/addons/ofxSyphon/libs/Syphon/lib/osx/']
// dirty fix for compiling .mm files (not auto-detected on qt)
files: outer.concat([
'../../../addons/ofxSyphon/src/ofxSyphonClient.mm',
'../../../addons/ofxSyphon/src/ofxSyphonServer.mm',
'../../../addons/ofxSyphon/src/ofxSyphonServerDirectory.mm',
'../../../addons/ofxSyphon/libs/Syphon/src/SyphonNameboundClient.m',
of_root + '/addons/ofxSyphon/src/ofxSyphonClient.mm',
of_root + '/addons/ofxSyphon/src/ofxSyphonServer.mm',
of_root + '/addons/ofxSyphon/src/ofxSyphonServerDirectory.mm',
of_root + '/addons/ofxSyphon/libs/Syphon/src/SyphonNameboundClient.m',
])
}

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ Mosaic, ofxVisualProgramming, openframeworks, linux, macOS, windows, creative-co

#### [ofxBTrack](https://github.com/d3cod3/ofxBTrack) -- Fork

#### [ofxChromaKeyShader](https://github.com/d3cod3/ofxChromaKeyShader) -- Fork

#### [ofxCv](https://github.com/kylemcdonald/ofxCv)

#### [ofxEasing](https://github.com/arturoc/ofxEasing)
Expand Down Expand Up @@ -161,7 +159,6 @@ cd <your_openframeworks_release_folder>/addons

git clone https://github.com/d3cod3/ofxAudioFile
git clone https://github.com/d3cod3/ofxBTrack
git clone https://github.com/d3cod3/ofxChromaKeyShader
git clone https://github.com/kylemcdonald/ofxCv
git clone https://github.com/arturoc/ofxEasing
git clone https://github.com/d3cod3/ofxFFmpegRecorder
Expand Down
1 change: 0 additions & 1 deletion addons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

ofxAudioFile https://github.com/d3cod3/ofxAudioFile master
ofxBTrack https://github.com/d3cod3/ofxBTrack master
ofxChromaKeyShader https://github.com/d3cod3/ofxChromaKeyShader master
ofxCv https://github.com/kylemcdonald/ofxCv master
ofxEasing https://github.com/arturoc/ofxEasing master
ofxFFmpegRecorder https://github.com/d3cod3/ofxFFmpegRecorder master
Expand Down
2 changes: 1 addition & 1 deletion bin/data/empty_patch.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<github>https://github.com/d3cod3/mosaic</github>
<www>https://mosaic.d3cod3.org</www>
<release>069</release>
<release>070</release>
<settings>
<output_width>1280</output_width>
<output_height>720</output_height>
Expand Down
Binary file removed bin/data/ffmpeg/win/ffmpeg.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/data/release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.9
0.7.0
2 changes: 1 addition & 1 deletion bin/data/scripts/empty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- ----------------------------------------------------------
-- Mosaic | OF Visual Patching Developer Platform
--
-- Copyright (c) 2020 Emanuele Mazza aka n3m3da
-- Copyright (c) 2024 Emanuele Mazza aka n3m3da
--
-- Mosaic is distributed under the MIT License.
-- This gives everyone the freedoms to use Mosaic in any context:
Expand Down
2 changes: 1 addition & 1 deletion bin/examples
86 changes: 66 additions & 20 deletions src/MosaicTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
#include "BaseTheme.h"
#include "ofMain.h"

#include "TextEditor.h"
#include "imgui_stdlib.h"

struct MosaicCommand{
std::string command;
std::string description;
};

class MosaicTheme : public ofxImGui::BaseTheme{

public:
Expand All @@ -60,17 +68,44 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
{
public:

ImVector<char*> Items;
bool scrollToBottom;
ImVector<char*> Items;
TextEditor console;

bool scrollToBottom;
bool recoverFocus;
std::string log_command;
float retinaScale;

ofEvent<std::string> commandEvent;

MosaicLoggerChannel() {
scrollToBottom = true;
recoverFocus = false;
log_command = "";
retinaScale = 1.0f;

console.SetShowWhitespaces(false);
console.SetText("");
console.SetReadOnly(true);
console.SetShowLineNumbers(false);
console.SetPalette(TextEditor::GetConsolePalette());
console.SetLanguageDefinition(TextEditor::LanguageDefinition::SimpleConsole());
}

void setRetinaScale(float s){
retinaScale = s;
}

void setCommand(string comm){
log_command = comm;
}

void log( ofLogLevel level, const std::string & module, const std::string & message ){
std::ostringstream oss;
oss << ofGetTimestampString("%H:%M:%S:%i") << " ";
oss << "[" << ofGetLogLevelName(level, true) << "] ";
if(ofGetLogLevelName(level, true) != "notice "){
oss << "[" << ofGetLogLevelName(level, true) << "] ";
}
if (module != "") {
oss << module << ": ";
}
Expand All @@ -88,7 +123,9 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
// Compose the message.
std::ostringstream oss;
oss << ofGetTimestampString("%H:%M:%S:%i") << " ";
oss << "[" << ofGetLogLevelName(level, true) << "] ";
if(ofGetLogLevelName(level, true) != "notice "){
oss << "[" << ofGetLogLevelName(level, true) << "] ";
}
if (module != "") {
oss << module << ": ";
}
Expand All @@ -103,6 +140,8 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
free(Items[i]);
}
Items.clear();

console.SetText("");
}

void AddLog(const char* fmt, ...) IM_FMTARGS(2){
Expand All @@ -113,6 +152,7 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
buf[IM_ARRAYSIZE(buf)-1] = 0;
va_end(args);
Items.push_back(strdup(buf));
console.InsertText(strdup(buf));
scrollToBottom = true;
}

Expand All @@ -138,24 +178,30 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing

ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text);
for (int i = 0; i < Items.Size; i++){
const char* item = Items[i];
ImVec4 col = col_default_text;
if (strstr(item, "[notice")) col = ImGui::GetStyleColorVec4(ImGuiCol_Text);
else if (strstr(item, "[warning")) col = ImColor(1.0f,0.5f,0.0f,1.0f);
else if (strstr(item, "[ error")) col = ImColor(1.0f,0.176f,0.176f,1.0f);
else if (strstr(item, "[silent")) col = ImColor(1.0f,0.78f,0.58f,1.0f);
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);

// force verbose
if(strstr(item, "[verbose]")){
col = ImColor(0.235f,1.0f,0.235f,1.0f);
}

ImGui::PushStyleColor(ImGuiCol_Text, col);
ImGui::TextUnformatted(item);
ImGui::PopStyleColor();
console.Render("Console",ImVec2(-1.0, -36*retinaScale));
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();

if(recoverFocus){
recoverFocus = false;
ImGui::SetKeyboardFocusHere();
}
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg,ImVec4(1,1,1,0.05));
ImGui::PushItemWidth(-1);
if(ImGui::InputTextWithHint("###command","Send a command...",&log_command,ImGuiInputTextFlags_EnterReturnsTrue)){
if(log_command != ""){
ofNotifyEvent(commandEvent,log_command);
}
// clear previuos command
log_command = "";
// focus on input command again
ImGui::SetKeyboardFocusHere(-1);
}
ImGui::PopItemWidth();
ImGui::PopStyleColor();


if(scrollToBottom){
scrollToBottom = false;
Expand Down
83 changes: 82 additions & 1 deletion src/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ const TextEditor::Palette & TextEditor::GetMosaicPalette()
0xff5f5758, // Comment (multi line)
0xaa2b2b2b, // Background
0xffe0e0e0, // Cursor
0x604f423b, // Selection
0x80a06020, // Selection
0x800020ff, // ErrorMarker
0x40f08000, // Breakpoint
0xff666666, // Line number
Expand Down Expand Up @@ -2461,6 +2461,34 @@ const TextEditor::Palette & TextEditor::GetRetroBluePalette()
return p;
}

const TextEditor::Palette & TextEditor::GetConsolePalette()
{
const static Palette p = { {
0xffafafaf, // Default
0xff3cff3c, // Keyword <--
0xffe6b496, // Number
0xff7070e0, // String
0xff70a0e0, // Char literal
0xffffffff, // Punctuation
0xff408080, // Preprocessor
0xffaaaaaa, // Identifier
0xff2d2dff, // Known identifier <--
0xff007fff, // Preproc identifier <--
0xff3cff3c, // Comment (single line) <--
0xff406020, // Comment (multi line)
0x88101010, // Background
0xffe0e0e0, // Cursor
0x80a06020, // Selection
0x800020ff, // ErrorMarker
0x40f08000, // Breakpoint
0xff707000, // Line number
0x404f423b, // Current line fill
0x304f423b, // Current line fill (inactive)
0x00a0a0a0, // Current line edge
} };
return p;
}


std::string TextEditor::GetText() const
{
Expand Down Expand Up @@ -4003,6 +4031,59 @@ const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::AngelScrip
return langDef;
}

const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::SimpleConsole()
{
static bool inited = false;
static LanguageDefinition langDef;
if (!inited)
{
static const char* const keywords[] = {
"pdsp","opendht","help","newpatch","patchfiles","exit"
};

for (auto& k : keywords){
langDef.mKeywords.insert(k);
}

static const char* const ppkeywords[] = {
"warning"
};

for (auto& pk : ppkeywords){
Identifier id;
id.mDeclaration = "warning";
langDef.mPreprocIdentifiers.insert(std::make_pair(std::string(pk), id));
}

static const char* const identifiers[] = {
"error", "fatal"
};
for (auto& k : identifiers)
{
Identifier id;
id.mDeclaration = "error";
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
}


langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Identifier));
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));

langDef.mCommentStart = "/*";
langDef.mCommentEnd = "*/";
langDef.mSingleLineComment = "--";

langDef.mCaseSensitive = true;
langDef.mAutoIndentation = true;

langDef.mName = "SimpleConsole";

inited = true;
}
return langDef;
}

static bool TokenizeLuaStyleString(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end)
{
const char * p = in_begin;
Expand Down
2 changes: 2 additions & 0 deletions src/TextEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class IMGUI_API TextEditor
static const LanguageDefinition& SQL();
static const LanguageDefinition& AngelScript();
static const LanguageDefinition& Lua();
static const LanguageDefinition& SimpleConsole();

bool mCaseSensitive;
bool mAutoIndentation;
Expand Down Expand Up @@ -291,6 +292,7 @@ class IMGUI_API TextEditor
static const Palette& GetDarkPalette();
static const Palette& GetLightPalette();
static const Palette& GetRetroBluePalette();
static const Palette& GetConsolePalette();

private:
typedef std::vector<std::pair<std::regex, PaletteIndex>> RegexList;
Expand Down
Loading

0 comments on commit 6423bc9

Please sign in to comment.