2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) DIGITEO - 2010-2010 - Clément DAVID <clement.david@scilab.org>
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
16 #include "Palette.hxx"
17 #include "Controller.hxx"
18 #include "GiwsException.hxx"
19 #include "xcosUtilities.hxx"
20 #include "loadStatus.hxx"
25 #include "api_scilab.h"
26 #include "localization.h"
28 #include "sci_malloc.h"
29 #include "getScilabJavaVM.h"
32 using namespace org_scilab_modules_xcos_palette;
33 using namespace org_scilab_modules_scicos;
35 int sci_xcosPalGenerateIcon(char *fname, void* pvApiCtx)
40 char *iconPath = NULL;
43 if (readSingleString(pvApiCtx, 1, &iconPath, fname))
48 /* Call the java implementation */
49 set_loaded_status(XCOS_CALLED);
52 Controller controller;
53 Palette::generatePaletteIcon(getScilabJavaVM(), controller.createObject(DIAGRAM), iconPath);
55 catch (GiwsException::JniCallMethodException &exception)
57 Scierror(999, "%s: %s\n", fname, exception.getJavaDescription().c_str());
59 catch (GiwsException::JniException &exception)
61 Scierror(999, "%s: %s\n", fname, exception.whatStr().c_str());