commit 52d9a22c1d5440c75a26276c3f8fccc628ca5009
parent 92d5775a4658249fb3e4e421c543431a49d51ca2
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Tue, 10 Feb 2015 21:49:08 -0500
Fix No UI Compile Linker Errors
Diffstat:
4 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -296,6 +296,15 @@ if(NtkGui)
add_subdirectory(UI)
endif()
+if(NOT FltkGui AND NOT NtkGui)
+ if(LibloEnable)
+ set(NSM_WORKAROUND UI/NSM.C UI/NSM/Client.C)
+ endif()
+ add_library(zynaddsubfx_gui_dummy STATIC UI/ConnectionDummy.cpp ${NSM_WORKAROUND})
+ set(GUI_LIBRARIES zynaddsubfx_gui_dummy)
+ add_definitions(-DNO_UI=1)
+endif()
+
########### General section ##############
# Following this should be only general compilation code, and no mention
# of module-specific variables
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -1139,6 +1139,7 @@ class UI_Interface:public Fl_Osc_Interface
//A very simplistic implementation of a UI agnostic refresh method
virtual void damage(const char *path)
{
+#ifndef NO_UI
//printf("\n\nDamage(\"%s\")\n", path);
for(auto pair:map) {
if(strstr(pair.first.c_str(), path)) {
@@ -1151,6 +1152,7 @@ class UI_Interface:public Fl_Osc_Interface
pair.second->update();
}
}
+#endif
}
void tryLink(const char *msg) override
diff --git a/src/UI/ConnectionDummy.cpp b/src/UI/ConnectionDummy.cpp
@@ -1,7 +1,9 @@
-
-ui_handle_t createUi(message_cb, void *Master, void *exit)
+#include "Connection.h"
+#include <unistd.h>
+namespace GUI {
+ui_handle_t createUi(Fl_Osc_Interface*, void *exit)
{
- return NULL;
+ return 0;
}
void destroyUi(ui_handle_t)
{
@@ -16,3 +18,4 @@ void tickUi(ui_handle_t)
{
usleep(100000);
}
+};
diff --git a/src/UI/NSM.C b/src/UI/NSM.C
@@ -22,7 +22,6 @@
#include "../Nio/Nio.h"
-#include "MasterUI.h"
#include <FL/Fl.H>
#include <stdio.h>
#include <sys/stat.h>
@@ -30,7 +29,10 @@
#include <unistd.h>
extern int Pexitprogram;
+#ifndef NO_UI
+#include "MasterUI.h"
extern MasterUI *ui;
+#endif
extern NSM_Client *nsm;
extern char *instance_name;
@@ -53,7 +55,9 @@ NSM_Client::command_save(char **out_msg)
(void) out_msg;
int r = ERR_OK;
+#ifndef NO_UI
ui->do_save_master(project_filename);
+#endif
return r;
}
@@ -81,6 +85,7 @@ NSM_Client::command_open(const char *name,
int r = ERR_OK;
+#ifndef NO_UI
if(0 == stat(new_filename, &st)) {
if(ui->do_load_master_unconditional(new_filename, display_name) < 0) {
*out_msg = strdup("Failed to load for unknown reason");
@@ -91,6 +96,7 @@ NSM_Client::command_open(const char *name,
}
else
ui->do_new_master_unconditional();
+#endif
if(project_filename)
free(project_filename);
@@ -107,13 +113,16 @@ NSM_Client::command_open(const char *name,
static void save_callback(Fl_Widget *, void *v)
{
+#ifndef NO_UI
MasterUI *ui = static_cast<MasterUI*>(v);
ui->do_save_master();
+#endif
}
void
NSM_Client::command_active(bool active)
{
+#ifndef NO_UI
if(active) {
Fl_Menu_Item *m;
//TODO see if there is a cleaner way of doing this without voiding
@@ -160,4 +169,5 @@ NSM_Client::command_active(bool active)
ui->sm_indicator1->tooltip(NULL);
ui->sm_indicator2->tooltip(NULL);
}
+#endif
}