commit 0134df8b4c08eacaed4a47d3cddfd88692313d8d
parent ea88fe598819e0c8936b9ffc65f8bb8030d2e32d
Author: Jonathan Moore Liles <j.liles@unix.net>
Date: Sun, 10 Jun 2012 15:11:49 -0700
Move NSM stuff to UI library to avoid cyclical dependency.
Diffstat:
9 files changed, 138 insertions(+), 141 deletions(-)
diff --git a/src/Misc/CMakeLists.txt b/src/Misc/CMakeLists.txt
@@ -19,16 +19,9 @@ set(zynaddsubfx_misc_SRCS
if(LashEnable)
set(zynaddsubfx_misc_SRCS ${zynaddsubfx_misc_SRCS} LASHClient.cpp)
endif()
-if(LibloEnable)
- set(zynaddsubfx_misc_SRCS ${zynaddsubfx_misc_SRCS} NSM.C NSM/Client.C)
-endif()
add_library(zynaddsubfx_misc STATIC
${zynaddsubfx_misc_SRCS}
)
-if(LibloEnable)
- add_dependencies(zynaddsubfx_misc zynaddsubfx_gui)
-endif()
-
target_link_libraries(zynaddsubfx_misc zynaddsubfx_nio)
diff --git a/src/Misc/NSM.C b/src/Misc/NSM.C
@@ -1,132 +0,0 @@
-
-/*******************************************************************************/
-/* Copyright (C) 2012 Jonathan Moore Liles */
-/* */
-/* This program is free software; you can redistribute it and/or modify it */
-/* under the terms of the GNU General Public License as published by the */
-/* Free Software Foundation; either version 2 of the License, or (at your */
-/* option) any later version. */
-/* */
-/* This program is distributed in the hope that it will be useful, but WITHOUT */
-/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
-/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
-/* more details. */
-/* */
-/* You should have received a copy of the GNU General Public License along */
-/* with This program; see the file COPYING. If not,write to the Free Software */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/*******************************************************************************/
-
-
-#include "NSM.H"
-
-#include <Nio/Nio.h>
-
-#include "../UI/MasterUI.h"
-#include <FL/Fl.H>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-extern int Pexitprogram;
-extern MasterUI *ui;
-
-extern NSM_Client *nsm;
-extern char *instance_name;
-
-NSM_Client::NSM_Client()
-{
- project_filename = 0;
- display_name = 0;
-}
-
-int command_open(const char *name,
- const char *display_name,
- const char *client_id,
- char **out_msg);
-int command_save(char **out_msg);
-
-int
-NSM_Client::command_save(char **out_msg)
-{
- int r = ERR_OK;
-
- ui->do_save_master(project_filename);
-
- return r;
-}
-
-int
-NSM_Client::command_open(const char *name,
- const char *display_name,
- const char *client_id,
- char **out_msg)
-{
- Nio::stop();
-
- if(instance_name)
- free(instance_name);
-
- instance_name = strdup(client_id);
-
- Nio::start();
-
- char *new_filename;
-
- asprintf(&new_filename, "%s.xmz", name);
-
- struct stat st;
-
- int r = ERR_OK;
-
- 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");
- r = ERR_GENERAL;
-
- return r;
- }
- }
- else
- ui->do_new_master_unconditional();
-
- if(project_filename)
- free(project_filename);
-
- if(this->display_name)
- free(this->display_name);
-
- project_filename = new_filename;
-
- this->display_name = strdup(display_name);
-
- return r;
-}
-
-void
-NSM_Client::command_active(bool active)
-{
- if(active) {
- const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item(
- "&File/&Open Parameters..."))->
- deactivate();
- const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item(
- "&File/&Open Parameters..."))->
- deactivate();
- ui->sm_indicator1->value(1);
- ui->sm_indicator2->value(1);
- ui->sm_indicator1->tooltip(session_manager_name());
- ui->sm_indicator2->tooltip(session_manager_name());
- }
- else {
- const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item(
- "&File/&Open Parameters..."))->activate();
- const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item(
- "&File/&Open Parameters..."))->activate();
- ui->sm_indicator1->value(0);
- ui->sm_indicator2->value(0);
- ui->sm_indicator1->tooltip(NULL);
- ui->sm_indicator2->tooltip(NULL);
- }
-}
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
@@ -22,6 +22,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
set_source_files_properties(UI/MasterUI.h PROPERTIES GENERATED 1)
fltk_wrap_ui(zynaddsubfx_gui ${UI_fl_files})
+if(LibloEnable)
+ set(zynaddsubfx_gui_FLTK_UI_SRCS ${zynaddsubfx_gui_FLTK_UI_SRCS} NSM.C NSM/Client.C)
+endif()
+
add_library(zynaddsubfx_gui STATIC
${UI_objs}
${zynaddsubfx_gui_FLTK_UI_SRCS}
diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl
@@ -58,7 +58,7 @@ decl {\#include "../Misc/Util.h"} {public
}
decl {\#if USE_NSM
-\#include "../Misc/NSM.H"
+\#include "NSM.H"
extern NSM_Client *nsm;
\#endif} {public
}
diff --git a/src/UI/NSM.C b/src/UI/NSM.C
@@ -0,0 +1,132 @@
+
+/*******************************************************************************/
+/* Copyright (C) 2012 Jonathan Moore Liles */
+/* */
+/* This program is free software; you can redistribute it and/or modify it */
+/* under the terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2 of the License, or (at your */
+/* option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, but WITHOUT */
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
+/* more details. */
+/* */
+/* You should have received a copy of the GNU General Public License along */
+/* with This program; see the file COPYING. If not,write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/*******************************************************************************/
+
+
+#include "NSM.H"
+
+#include "../Nio/Nio.h"
+
+#include "MasterUI.h"
+#include <FL/Fl.H>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+extern int Pexitprogram;
+extern MasterUI *ui;
+
+extern NSM_Client *nsm;
+extern char *instance_name;
+
+NSM_Client::NSM_Client()
+{
+ project_filename = 0;
+ display_name = 0;
+}
+
+int command_open(const char *name,
+ const char *display_name,
+ const char *client_id,
+ char **out_msg);
+int command_save(char **out_msg);
+
+int
+NSM_Client::command_save(char **out_msg)
+{
+ int r = ERR_OK;
+
+ ui->do_save_master(project_filename);
+
+ return r;
+}
+
+int
+NSM_Client::command_open(const char *name,
+ const char *display_name,
+ const char *client_id,
+ char **out_msg)
+{
+ Nio::stop();
+
+ if(instance_name)
+ free(instance_name);
+
+ instance_name = strdup(client_id);
+
+ Nio::start();
+
+ char *new_filename;
+
+ asprintf(&new_filename, "%s.xmz", name);
+
+ struct stat st;
+
+ int r = ERR_OK;
+
+ 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");
+ r = ERR_GENERAL;
+
+ return r;
+ }
+ }
+ else
+ ui->do_new_master_unconditional();
+
+ if(project_filename)
+ free(project_filename);
+
+ if(this->display_name)
+ free(this->display_name);
+
+ project_filename = new_filename;
+
+ this->display_name = strdup(display_name);
+
+ return r;
+}
+
+void
+NSM_Client::command_active(bool active)
+{
+ if(active) {
+ const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item(
+ "&File/&Open Parameters..."))->
+ deactivate();
+ const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item(
+ "&File/&Open Parameters..."))->
+ deactivate();
+ ui->sm_indicator1->value(1);
+ ui->sm_indicator2->value(1);
+ ui->sm_indicator1->tooltip(session_manager_name());
+ ui->sm_indicator2->tooltip(session_manager_name());
+ }
+ else {
+ const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item(
+ "&File/&Open Parameters..."))->activate();
+ const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item(
+ "&File/&Open Parameters..."))->activate();
+ ui->sm_indicator1->value(0);
+ ui->sm_indicator2->value(0);
+ ui->sm_indicator1->tooltip(NULL);
+ ui->sm_indicator2->tooltip(NULL);
+ }
+}
diff --git a/src/Misc/NSM.H b/src/UI/NSM.H
diff --git a/src/Misc/NSM/Client.C b/src/UI/NSM/Client.C
diff --git a/src/Misc/NSM/Client.H b/src/UI/NSM/Client.H
diff --git a/src/main.cpp b/src/main.cpp
@@ -73,7 +73,7 @@ LASHClient *lash = NULL;
#endif
#if USE_NSM
-#include "Misc/NSM.H"
+#include "UI/NSM.H"
NSM_Client *nsm = 0;
#endif