X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginserver.C;h=94912ea51c6106752175216d39f808f8b99374fd;hp=0c72a3582d145d324ce94784001807911ace3bef;hb=3ac8199743f244669cc87ceef9c3cd23710552f3;hpb=77815ec03df6a03ed75433e8cf8ae1e83fb76d6e diff --git a/cinelerra-5.1/cinelerra/pluginserver.C b/cinelerra-5.1/cinelerra/pluginserver.C index 0c72a358..94912ea5 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.C +++ b/cinelerra-5.1/cinelerra/pluginserver.C @@ -79,6 +79,7 @@ void PluginServer::init() plugin_obj = new PluginObj(); modules = new ArrayList; nodes = new ArrayList; + tip = 0; } PluginServer::PluginServer() @@ -107,6 +108,7 @@ PluginServer::PluginServer(PluginServer &that) plugin_obj = that.plugin_obj; plugin_obj->add_user(); title = !that.title ? 0 : cstrdup(that.title); + tip = !that.tip ? 0 : cstrdup(that.tip); path = !that.path ? 0 : cstrdup(that.path); ff_name = !that.ff_name ? 0 : cstrdup(that.ff_name); modules = new ArrayList; @@ -137,6 +139,7 @@ PluginServer::~PluginServer() delete [] path; delete [] ff_name; delete [] title; + delete [] tip; delete modules; delete nodes; delete picon; @@ -175,6 +178,7 @@ int PluginServer::reset_parameters() uses_gui = 0; transition = 0; title = 0; + tip = 0; path = 0; data_text = 0; for( int i=sizeof(args)/sizeof(args[0]); --i>=0; ) args[i] = 0; @@ -1218,16 +1222,20 @@ Theme* PluginServer::get_theme() } -int PluginServer::get_theme_png_path(char *png_path, const char *theme_dir) +int PluginServer::get_plugin_png_path(char *png_path, const char *plugin_icons) { - char *bp = strrchr(path, '/'); - if( !bp ) bp = path; else ++bp; - char *sp = strrchr(bp,'.'); - if( !sp ) sp = bp + strlen(bp); - char *cp = png_path, *dp = bp; - cp += sprintf(cp,"%s/%s/", mwindow->preferences->plugin_dir, theme_dir); - while( dp < sp ) *cp++ = *dp++; - strcpy(cp, ".png"); + char *pp = png_path, *ep = pp + BCTEXTLEN-1; + pp += snprintf(pp, ep-pp, "%s/picon", File::get_plugin_path()); + if( strcmp(DEFAULT_PICON, plugin_icons) ) + pp += snprintf(pp, ep-pp, "_%s", plugin_icons); + if( pp < ep ) *pp++ = '/'; + char *cp = strrchr(path, '/'); + cp = !cp ? path : cp+1; + char *sp = strrchr(cp, '.'); + if( !sp ) sp = cp+strlen(cp); + while( pp < ep && cp < sp ) *pp++ = *cp++; + pp += snprintf(pp, ep-pp, ".png"); + *pp = 0; struct stat st; if( stat(png_path, &st) ) return 0; if( !S_ISREG(st.st_mode) ) return 0; @@ -1235,23 +1243,10 @@ int PluginServer::get_theme_png_path(char *png_path, const char *theme_dir) return st.st_size; } -int PluginServer::get_theme_png_path(char *png_path, Theme *theme) -{ - char *bp = strrchr(theme->path, '/'); - if( !bp ) bp = theme->path; else ++bp; - char *sp = strrchr(bp,'.'); - if( !sp || ( strcmp(sp, ".plugin") && strcmp(sp,".so") ) ) return 0; - char theme_dir[BCTEXTLEN], *cp = theme_dir; - while( bp < sp ) *cp++ = *bp++; - *cp = 0; - return get_theme_png_path(png_path, theme_dir); -} - int PluginServer::get_plugin_png_path(char *png_path) { - int len = get_theme_png_path(png_path, mwindow->theme); - if( !len ) - len = get_theme_png_path(png_path, "picon"); + int len = get_plugin_png_path(png_path, mwindow->preferences->plugin_icons); + if( !len ) len = get_plugin_png_path(png_path, DEFAULT_PICON); return len; }