Skip to content

Commit 6423bc9

Browse files
authored
Merge pull request #83 from d3cod3/0.7.0-pre-release
publishing 0.7.0 pre release
2 parents f8b2fe5 + 2e82707 commit 6423bc9

File tree

14 files changed

+329
-54
lines changed

14 files changed

+329
-54
lines changed

Mosaic.qbs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Project{
1010

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

1416
files: [
1517
"profiler/tracy/TracyClient.cpp",
@@ -35,7 +37,17 @@ Project{
3537
// flags by default to add the core libraries, search paths...
3638
// this flags can be augmented through the following properties:
3739
of.pkgConfigs: [] // list of additional system pkgs to include
38-
of.includePaths: ['profiler/tracy'] // include search paths
40+
of.includePaths: {
41+
var paths = ['profiler/tracy'];
42+
if(qbs.hostOS.contains("osx")){
43+
paths = paths.concat([of_root+'/addons/ofxFft/src']);
44+
}else if(qbs.hostOS.contains("windows")){
45+
paths = paths.concat([]);
46+
}else if(qbs.hostOS.contains("linux")){
47+
paths = paths.concat([]);
48+
}
49+
return paths;
50+
}
3951
of.cFlags: [] // flags passed to the c compiler
4052

4153

@@ -54,7 +66,20 @@ Project{
5466
}
5567

5668
// flags passed to the linker
57-
of.linkerFlags: []
69+
of.linkerFlags: {
70+
var lFlags = [];
71+
if(qbs.hostOS.contains("osx")){
72+
lFlags = lFlags.concat([
73+
'-L'+of_root+'/addons/ofxFFt/libs/fftw/lib', // for ofxFft
74+
'-lopendht', '-lgnutls', '-lnettle', '-lfmt', // for openDHT
75+
]);
76+
}else if(qbs.hostOS.contains("windows")){
77+
lFlags = lFlags.concat([]);
78+
}else if(qbs.hostOS.contains("linux")){
79+
lFlags = lFlags.concat([]);
80+
}
81+
return lFlags;
82+
}
5883

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

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

116-
// add QTKit support on osx 10.12
117-
Properties {
118-
condition: qbs.hostOS.contains("osx") && qbs.hostOS.contains("10.12")
119-
of.frameworks: outer.concat(['QTKit']);
120-
}
121-
122141
// Include ofxSyphon on osx
123142
Properties {
124143
// osx only, additional frameworks to link with the project
125144
condition: qbs.targetOS.contains("osx") || qbs.targetOS.contains("macos")
126145
of.addons: outer.concat(['ofxSyphon'])
127146
of.frameworks: outer.concat(['Syphon'])
128-
cpp.frameworkPaths: ['../../../addons/ofxSyphon/libs/Syphon/lib/osx/']
147+
cpp.frameworkPaths: [of_root+'/addons/ofxSyphon/libs/Syphon/lib/osx/']
129148
// dirty fix for compiling .mm files (not auto-detected on qt)
130149
files: outer.concat([
131-
'../../../addons/ofxSyphon/src/ofxSyphonClient.mm',
132-
'../../../addons/ofxSyphon/src/ofxSyphonServer.mm',
133-
'../../../addons/ofxSyphon/src/ofxSyphonServerDirectory.mm',
134-
'../../../addons/ofxSyphon/libs/Syphon/src/SyphonNameboundClient.m',
150+
of_root + '/addons/ofxSyphon/src/ofxSyphonClient.mm',
151+
of_root + '/addons/ofxSyphon/src/ofxSyphonServer.mm',
152+
of_root + '/addons/ofxSyphon/src/ofxSyphonServerDirectory.mm',
153+
of_root + '/addons/ofxSyphon/libs/Syphon/src/SyphonNameboundClient.m',
135154
])
136155
}
137156

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ Mosaic, ofxVisualProgramming, openframeworks, linux, macOS, windows, creative-co
9393

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

96-
#### [ofxChromaKeyShader](https://github.com/d3cod3/ofxChromaKeyShader) -- Fork
97-
9896
#### [ofxCv](https://github.com/kylemcdonald/ofxCv)
9997

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

162160
git clone https://github.com/d3cod3/ofxAudioFile
163161
git clone https://github.com/d3cod3/ofxBTrack
164-
git clone https://github.com/d3cod3/ofxChromaKeyShader
165162
git clone https://github.com/kylemcdonald/ofxCv
166163
git clone https://github.com/arturoc/ofxEasing
167164
git clone https://github.com/d3cod3/ofxFFmpegRecorder

addons.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
ofxAudioFile https://github.com/d3cod3/ofxAudioFile master
1212
ofxBTrack https://github.com/d3cod3/ofxBTrack master
13-
ofxChromaKeyShader https://github.com/d3cod3/ofxChromaKeyShader master
1413
ofxCv https://github.com/kylemcdonald/ofxCv master
1514
ofxEasing https://github.com/arturoc/ofxEasing master
1615
ofxFFmpegRecorder https://github.com/d3cod3/ofxFFmpegRecorder master

bin/data/empty_patch.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<github>https://github.com/d3cod3/mosaic</github>
33
<www>https://mosaic.d3cod3.org</www>
4-
<release>069</release>
4+
<release>070</release>
55
<settings>
66
<output_width>1280</output_width>
77
<output_height>720</output_height>

bin/data/ffmpeg/win/ffmpeg.exe

-60 MB
Binary file not shown.

bin/data/release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.9
1+
0.7.0

bin/data/scripts/empty.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- ----------------------------------------------------------
44
-- Mosaic | OF Visual Patching Developer Platform
55
--
6-
-- Copyright (c) 2020 Emanuele Mazza aka n3m3da
6+
-- Copyright (c) 2024 Emanuele Mazza aka n3m3da
77
--
88
-- Mosaic is distributed under the MIT License.
99
-- This gives everyone the freedoms to use Mosaic in any context:

src/MosaicTheme.h

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
#include "BaseTheme.h"
3636
#include "ofMain.h"
3737

38+
#include "TextEditor.h"
39+
#include "imgui_stdlib.h"
40+
41+
struct MosaicCommand{
42+
std::string command;
43+
std::string description;
44+
};
45+
3846
class MosaicTheme : public ofxImGui::BaseTheme{
3947

4048
public:
@@ -60,17 +68,44 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
6068
{
6169
public:
6270

63-
ImVector<char*> Items;
64-
bool scrollToBottom;
71+
ImVector<char*> Items;
72+
TextEditor console;
73+
74+
bool scrollToBottom;
75+
bool recoverFocus;
76+
std::string log_command;
77+
float retinaScale;
78+
79+
ofEvent<std::string> commandEvent;
6580

6681
MosaicLoggerChannel() {
6782
scrollToBottom = true;
83+
recoverFocus = false;
84+
log_command = "";
85+
retinaScale = 1.0f;
86+
87+
console.SetShowWhitespaces(false);
88+
console.SetText("");
89+
console.SetReadOnly(true);
90+
console.SetShowLineNumbers(false);
91+
console.SetPalette(TextEditor::GetConsolePalette());
92+
console.SetLanguageDefinition(TextEditor::LanguageDefinition::SimpleConsole());
93+
}
94+
95+
void setRetinaScale(float s){
96+
retinaScale = s;
97+
}
98+
99+
void setCommand(string comm){
100+
log_command = comm;
68101
}
69102

70103
void log( ofLogLevel level, const std::string & module, const std::string & message ){
71104
std::ostringstream oss;
72105
oss << ofGetTimestampString("%H:%M:%S:%i") << " ";
73-
oss << "[" << ofGetLogLevelName(level, true) << "] ";
106+
if(ofGetLogLevelName(level, true) != "notice "){
107+
oss << "[" << ofGetLogLevelName(level, true) << "] ";
108+
}
74109
if (module != "") {
75110
oss << module << ": ";
76111
}
@@ -88,7 +123,9 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
88123
// Compose the message.
89124
std::ostringstream oss;
90125
oss << ofGetTimestampString("%H:%M:%S:%i") << " ";
91-
oss << "[" << ofGetLogLevelName(level, true) << "] ";
126+
if(ofGetLogLevelName(level, true) != "notice "){
127+
oss << "[" << ofGetLogLevelName(level, true) << "] ";
128+
}
92129
if (module != "") {
93130
oss << module << ": ";
94131
}
@@ -103,6 +140,8 @@ class MosaicLoggerChannel : public ofBaseLoggerChannel
103140
free(Items[i]);
104141
}
105142
Items.clear();
143+
144+
console.SetText("");
106145
}
107146

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

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

140180
ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text);
141-
for (int i = 0; i < Items.Size; i++){
142-
const char* item = Items[i];
143-
ImVec4 col = col_default_text;
144-
if (strstr(item, "[notice")) col = ImGui::GetStyleColorVec4(ImGuiCol_Text);
145-
else if (strstr(item, "[warning")) col = ImColor(1.0f,0.5f,0.0f,1.0f);
146-
else if (strstr(item, "[ error")) col = ImColor(1.0f,0.176f,0.176f,1.0f);
147-
else if (strstr(item, "[silent")) col = ImColor(1.0f,0.78f,0.58f,1.0f);
148-
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);
149-
150-
// force verbose
151-
if(strstr(item, "[verbose]")){
152-
col = ImColor(0.235f,1.0f,0.235f,1.0f);
153-
}
154181

155-
ImGui::PushStyleColor(ImGuiCol_Text, col);
156-
ImGui::TextUnformatted(item);
157-
ImGui::PopStyleColor();
182+
console.Render("Console",ImVec2(-1.0, -36*retinaScale));
183+
ImGui::Spacing();
184+
ImGui::Separator();
185+
ImGui::Spacing();
186+
187+
if(recoverFocus){
188+
recoverFocus = false;
189+
ImGui::SetKeyboardFocusHere();
190+
}
191+
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg,ImVec4(1,1,1,0.05));
192+
ImGui::PushItemWidth(-1);
193+
if(ImGui::InputTextWithHint("###command","Send a command...",&log_command,ImGuiInputTextFlags_EnterReturnsTrue)){
194+
if(log_command != ""){
195+
ofNotifyEvent(commandEvent,log_command);
196+
}
197+
// clear previuos command
198+
log_command = "";
199+
// focus on input command again
200+
ImGui::SetKeyboardFocusHere(-1);
158201
}
202+
ImGui::PopItemWidth();
203+
ImGui::PopStyleColor();
204+
159205

160206
if(scrollToBottom){
161207
scrollToBottom = false;

src/TextEditor.cpp

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,7 @@ const TextEditor::Palette & TextEditor::GetMosaicPalette()
23662366
0xff5f5758, // Comment (multi line)
23672367
0xaa2b2b2b, // Background
23682368
0xffe0e0e0, // Cursor
2369-
0x604f423b, // Selection
2369+
0x80a06020, // Selection
23702370
0x800020ff, // ErrorMarker
23712371
0x40f08000, // Breakpoint
23722372
0xff666666, // Line number
@@ -2461,6 +2461,34 @@ const TextEditor::Palette & TextEditor::GetRetroBluePalette()
24612461
return p;
24622462
}
24632463

2464+
const TextEditor::Palette & TextEditor::GetConsolePalette()
2465+
{
2466+
const static Palette p = { {
2467+
0xffafafaf, // Default
2468+
0xff3cff3c, // Keyword <--
2469+
0xffe6b496, // Number
2470+
0xff7070e0, // String
2471+
0xff70a0e0, // Char literal
2472+
0xffffffff, // Punctuation
2473+
0xff408080, // Preprocessor
2474+
0xffaaaaaa, // Identifier
2475+
0xff2d2dff, // Known identifier <--
2476+
0xff007fff, // Preproc identifier <--
2477+
0xff3cff3c, // Comment (single line) <--
2478+
0xff406020, // Comment (multi line)
2479+
0x88101010, // Background
2480+
0xffe0e0e0, // Cursor
2481+
0x80a06020, // Selection
2482+
0x800020ff, // ErrorMarker
2483+
0x40f08000, // Breakpoint
2484+
0xff707000, // Line number
2485+
0x404f423b, // Current line fill
2486+
0x304f423b, // Current line fill (inactive)
2487+
0x00a0a0a0, // Current line edge
2488+
} };
2489+
return p;
2490+
}
2491+
24642492

24652493
std::string TextEditor::GetText() const
24662494
{
@@ -4003,6 +4031,59 @@ const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::AngelScrip
40034031
return langDef;
40044032
}
40054033

4034+
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::SimpleConsole()
4035+
{
4036+
static bool inited = false;
4037+
static LanguageDefinition langDef;
4038+
if (!inited)
4039+
{
4040+
static const char* const keywords[] = {
4041+
"pdsp","opendht","help","newpatch","patchfiles","exit"
4042+
};
4043+
4044+
for (auto& k : keywords){
4045+
langDef.mKeywords.insert(k);
4046+
}
4047+
4048+
static const char* const ppkeywords[] = {
4049+
"warning"
4050+
};
4051+
4052+
for (auto& pk : ppkeywords){
4053+
Identifier id;
4054+
id.mDeclaration = "warning";
4055+
langDef.mPreprocIdentifiers.insert(std::make_pair(std::string(pk), id));
4056+
}
4057+
4058+
static const char* const identifiers[] = {
4059+
"error", "fatal"
4060+
};
4061+
for (auto& k : identifiers)
4062+
{
4063+
Identifier id;
4064+
id.mDeclaration = "error";
4065+
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
4066+
}
4067+
4068+
4069+
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
4070+
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Identifier));
4071+
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
4072+
4073+
langDef.mCommentStart = "/*";
4074+
langDef.mCommentEnd = "*/";
4075+
langDef.mSingleLineComment = "--";
4076+
4077+
langDef.mCaseSensitive = true;
4078+
langDef.mAutoIndentation = true;
4079+
4080+
langDef.mName = "SimpleConsole";
4081+
4082+
inited = true;
4083+
}
4084+
return langDef;
4085+
}
4086+
40064087
static bool TokenizeLuaStyleString(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end)
40074088
{
40084089
const char * p = in_begin;

0 commit comments

Comments
 (0)