[Cin] [WIP] connecting pluginprefs.C back to codebase

Andrew Randrianasulu randrianasulu at gmail.com
Mon Oct 11 06:13:10 CEST 2021


Basically just monkeying around (it does not do anything with local plugin
set) but I can try and push this a bit more so it will actually search
plugins  in second location

I think main idea was to alliw 'favorities' set of plugins somewhere in
user dir, if user can't change stuff in /usr. Today Cingg can look in
dufferent places for plugins depending on env. variables, still gui might
be handy for some users.

Also, it show how to add new category in oreferences, so we can offload few
things into new tab in the future (or just add them there)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211011/ff6a7cf9/attachment.htm>
-------------- next part --------------
diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
index c660ee37..cd4df41b 100644
--- a/cinelerra-5.1/cinelerra/Makefile
+++ b/cinelerra-5.1/cinelerra/Makefile
@@ -252,6 +252,7 @@ OBJS := $(OVERLAYS) \
 	$(OBJDIR)/pluginlv2client.o \
 	$(OBJDIR)/pluginlv2gui.o \
 	$(OBJDIR)/plugin.o \
+	$(OBJDIR)/pluginprefs.o \
 	$(OBJDIR)/pluginpopup.o \
 	$(OBJDIR)/pluginserver.o \
 	$(OBJDIR)/pluginset.o \
diff --git a/cinelerra-5.1/cinelerra/pluginprefs.C b/cinelerra-5.1/cinelerra/pluginprefs.C
index 2a3f7878..9bb52423 100644
--- a/cinelerra-5.1/cinelerra/pluginprefs.C
+++ b/cinelerra-5.1/cinelerra/pluginprefs.C
@@ -19,6 +19,7 @@
  *
  */
 
+#include "mwindow.h"
 #include "pluginprefs.h"
 #include "preferences.h"
 #include <string.h>
@@ -45,7 +46,7 @@ PluginPrefs::~PluginPrefs()
 
 void PluginPrefs::create_objects()
 {
-	char string[1024];
+	char string[BCTEXTLEN];
 	int xs5 = xS(5), xs10 = xS(10), xs20 = xS(20), xs30 = xS(30);
 	int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys30 = yS(30);
 	int x = xs5, y = ys5;
@@ -57,13 +58,13 @@ void PluginPrefs::create_objects()
 // 		get_resources()->get_bg_light1());
 
 	add_subwindow(new BC_Title(x, y, _("Plugin Set"), LARGEFONT, BLACK));
-	y += ys35;
+	y += ys30;
 	add_subwindow(new BC_Title(x, y, _("Look for global plugins here"), MEDIUMFONT, BLACK));
 	y += ys20;
 	add_subwindow(ipathtext = new PluginGlobalPathText(x, y,
-			pwindow, pwindow->thread->preferences->global_plugin_dir));
-	add_subwindow(ipath = new BrowseButton(mwindow, this, ipathtext,
-		xS(215), y, pwindow->thread->preferences->global_plugin_dir,
+			pwindow, pwindow->thread->preferences->plugin_dir));
+	add_subwindow(ipath = new BrowseButton(mwindow->theme, this, ipathtext,
+		xS(215), y, pwindow->thread->preferences->plugin_dir,
 		_("Global Plugin Path"), _("Select the directory for plugins"),
 		1));
 
@@ -72,7 +73,7 @@ void PluginPrefs::create_objects()
 	y += 20;
 	add_subwindow(lpathtext = new PluginLocalPathText(x, y,
 			pwindow, pwindow->thread->preferences->local_plugin_dir));
-	add_subwindow(lpath = new BrowseButton(mwindow, this, lpathtext,
+	add_subwindow(lpath = new BrowseButton(mwindow->theme, this, lpathtext,
 		xS(215), y, pwindow->thread->preferences->local_plugin_dir,
 		_("Personal Plugin Path"), _("Select the directory for plugins"),
 		1));
@@ -92,7 +93,8 @@ PluginGlobalPathText::~PluginGlobalPathText() {}
 
 int PluginGlobalPathText::handle_event()
 {
-	strcpy(pwindow->thread->preferences->global_plugin_dir, get_text());
+	strcpy(pwindow->thread->preferences->plugin_dir, get_text());
+	return 1;
 }
 
 
@@ -100,7 +102,7 @@ int PluginGlobalPathText::handle_event()
 
 
 PluginLocalPathText::PluginLocalPathText(int x, int y, PreferencesWindow *pwindow, char *text)
- : BC_TextBox(x, y, xs(200), 1, text)
+ : BC_TextBox(x, y, xS(200), 1, text)
 {
 	this->pwindow = pwindow;
 }
@@ -110,4 +112,5 @@ PluginLocalPathText::~PluginLocalPathText() {}
 int PluginLocalPathText::handle_event()
 {
 	strcpy(pwindow->thread->preferences->local_plugin_dir, get_text());
+	return 1;
 }
diff --git a/cinelerra-5.1/cinelerra/pluginprefs.h b/cinelerra-5.1/cinelerra/pluginprefs.h
index a6f46032..6cb96787 100644
--- a/cinelerra-5.1/cinelerra/pluginprefs.h
+++ b/cinelerra-5.1/cinelerra/pluginprefs.h
@@ -28,6 +28,7 @@ class PluginLocalPathText;
 #include "browsebutton.h"
 #include "preferencesthread.h"
 
+
 class PluginPrefs : public PreferencesDialog
 {
 public:
diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h
index 4f743975..d41865cb 100644
--- a/cinelerra-5.1/cinelerra/preferences.h
+++ b/cinelerra-5.1/cinelerra/preferences.h
@@ -199,6 +199,7 @@ public:
 
 // ====================================== Plugin Set ==============================
 	char plugin_dir[BCTEXTLEN];
+	char local_plugin_dir[BCTEXTLEN];
 	char lv2_path[BCTEXTLEN];
 	int autostart_lv2ui;
 	char nested_proxy_path[BCTEXTLEN];
diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C
index 3ca281e5..95691aa7 100644
--- a/cinelerra-5.1/cinelerra/preferencesthread.C
+++ b/cinelerra-5.1/cinelerra/preferencesthread.C
@@ -51,6 +51,7 @@
 #include "performanceprefs.h"
 #include "playbackengine.h"
 #include "playbackprefs.h"
+#include "pluginprefs.h"
 #include "preferences.h"
 #include "record.h"
 #include "recordprefs.h"
@@ -407,6 +408,8 @@ const char* PreferencesThread::category_to_text(int category)
 			return _("Interface");
 		case APPEARANCE:
 			return _("Appearance");
+		case PLUGINPREF:
+			return _("Plugin set");
 		case ABOUT:
 			return _("About");
 	}
@@ -585,6 +588,10 @@ int PreferencesWindow::set_current_dialog(int number)
 		case PreferencesThread::APPEARANCE:
 			add_subwindow(dialog = new AppearancePrefs(mwindow, this));
 			break;
+			
+		case PreferencesThread::PLUGINPREF:
+			add_subwindow(dialog = new PluginPrefs(mwindow, this));
+			break;
 
 		case PreferencesThread::ABOUT:
 			add_subwindow(dialog = new AboutPrefs(mwindow, this));
diff --git a/cinelerra-5.1/cinelerra/preferencesthread.h b/cinelerra-5.1/cinelerra/preferencesthread.h
index 653199b6..4070b8df 100644
--- a/cinelerra-5.1/cinelerra/preferencesthread.h
+++ b/cinelerra-5.1/cinelerra/preferencesthread.h
@@ -79,7 +79,7 @@ public:
 	EDL *edl;
 
 // Categories
-#define CATEGORIES 7
+#define CATEGORIES 8
 	enum
 	{
 		PLAYBACK_A,
@@ -88,6 +88,7 @@ public:
 		PERFORMANCE,
 		INTERFACE,
 		APPEARANCE,
+		PLUGINPREF,
 		ABOUT
 	};
 };


More information about the Cin mailing list