diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/app_templates/noatunvisual | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/app_templates/noatunvisual')
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/.kdev_ignore | 0 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/Makefile.am | 18 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/noatunvisual | 8 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in | 36 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate | 205 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/noatunvisual.png | bin | 0 -> 68585 bytes | |||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin.kdevelop | 118 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin.plugin | 8 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin_app.cpp | 58 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin_app.h | 36 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin_impl.cpp | 276 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/plugin_impl.h | 77 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/src-Makefile.am | 19 | ||||
-rw-r--r-- | languages/cpp/app_templates/noatunvisual/subdirs | 3 |
14 files changed, 862 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/noatunvisual/.kdev_ignore b/languages/cpp/app_templates/noatunvisual/.kdev_ignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/.kdev_ignore diff --git a/languages/cpp/app_templates/noatunvisual/Makefile.am b/languages/cpp/app_templates/noatunvisual/Makefile.am new file mode 100644 index 00000000..0d6a43eb --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = src-Makefile.am plugin_app.cpp plugin_app.h plugin_impl.cpp \ + plugin_impl.h noatunvisual.png plugin.plugin plugin.kdevelop \ + subdirs noatunvisual-configure.in.in +templateName = noatunvisual + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz
\ No newline at end of file diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual b/languages/cpp/app_templates/noatunvisual/noatunvisual new file mode 100644 index 00000000..e0d0f7e0 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual @@ -0,0 +1,8 @@ +# KDE Config File +[General] +Name=Noatun visualization plugin +Icon=noatunvisual.png +Category=C++/KDE +Comment=Generates a visualization plugin for noatun using SDL +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=src/plugin_APPNAMELC_impl.cpp diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in b/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in new file mode 100644 index 00000000..b973abe8 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual-configure.in.in @@ -0,0 +1,36 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION}) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CHECK_HEADERS([noatun/plugin.h]) +KDE_CHECK_LIB([noatun],main, + [LIB_NOAUTUN="-lnoautun"]) +AC_SUBST(LIB_NOAUTUN) + +KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find libsdl anywhere, check http://www.sdl.org]) +]) + +if test -n "$LIBSDL_CONFIG"; then + LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`" + LIBSDL_RPATH= + for args in $LIBSDL_LIBS; do + case $args in + -L*) + LIBSDL_RPATH="$LIBSDL_RPATH $args" + ;; + esac + done + LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"` + LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`" + + AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, [Defines if your system has the LIBSDL library]) +fi + + +AC_SUBST(LIBSDL_LIBS) +AC_SUBST(LIBSDL_CFLAGS) +AC_SUBST(LIBSDL_RPATH) + diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate b/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate new file mode 100644 index 00000000..4c726194 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual.kdevtemplate @@ -0,0 +1,205 @@ +# KDE Config File +[General] +Name=Noatun visualization plugin +Name[ca]=Connector de visualització per a Noatun +Name[da]=Noatun visualiserings-plugin +Name[de]=Noatun-Visualisierungs-Modul +Name[el]=Οπτικό πρόσθετο Noatun +Name[en_GB]=Noatun visualisation plugin +Name[es]=Complemento de visualización para Noatun +Name[et]=Noatuni visualiseerimisplugin +Name[eu]=Noatun bistaratze-plugina +Name[fa]=وصلۀ تجسم Noatun +Name[fr]=Module externe de visualisation pour Noatun +Name[ga]=Breiseán amharcléirithe Noatun +Name[gl]=Extensión de visualización para Noatun +Name[hu]=Noatun vizualizációs modul +Name[it]=Plugin di visualizzazione per noatun +Name[ja]=Noatun ビジュアライゼーションプラグイン +Name[nds]=Noatun-Filmmakermoduul +Name[ne]=नोअटन भिजुलाइजेसन प्लगइन +Name[nl]=Noatun visualisatieplugin +Name[pl]=Wtyczka wizualizacji do Noatun +Name[pt]='Plugin' de visualização do Noatun +Name[pt_BR]='Plugin' de visualização do Noatun +Name[ru]=Модуль визуализации Noatun +Name[sk]=Noatun vizualizačný modul +Name[sr]=Визуелизациони прикључак за Noatun +Name[sr@Latn]=Vizuelizacioni priključak za Noatun +Name[sv]=Noatun-insticksprogram för visningar +Name[tr]=Noatun görsellik eklentisi +Name[zh_CN]=Noatun 可视化插件 +Name[zh_TW]=Noatun 視覺化外掛程式 +Icon=noatunvisual.png +Category=C++/KDE +Comment=Generates a visualization plugin for noatun using SDL +Comment[ca]=Genera un connector de visualització per a Noatun usant SDL +Comment[da]=Generere et visualiserings-plugin for noatun ved brug af SDL +Comment[de]=Erstellt ein Visualisierungs-Modul für Noatun unter Verwendung der SDL. +Comment[el]=Δημιουργεί ένα οπτικό πρόσθετο για το noatun χρησιμοποιώντας το SDL +Comment[en_GB]=Generates a visualisation plugin for noatun using SDL +Comment[es]=Genera un complemento de visualización para Noatun que usa SDL +Comment[et]=Noatuni visualiseerimisplugina loomine SDL-i abil +Comment[eu]=SDL erabiliz, bistaratze-plugin bat sortzen du noatun-entzat +Comment[fa]=یک وصلۀ تجسم برای noatun با استفاده از SDL تولید میکند +Comment[fr]=Génère un module externe de visualisation pour Noatun utilisant SDL +Comment[ga]=Cruthaíonn sé seo breiseán amharcléirithe noatun le SDL +Comment[gl]=Xera unha extensión de visualización para noatun usando SDL +Comment[hu]=Létrehoz egy vizualizációs modult a Noatunhoz, SDL-ben +Comment[it]=Genera un plugin di visualizzazione per noatun usando SDL +Comment[nds]=Stellt mit SDL en Filmmakermoduul för Noatun op +Comment[ne]=SDL प्रयोग गरेर नोअटनका लागि भिजुलाइजेसन प्लगइन उत्पन्न गर्दछ +Comment[nl]=Genereert een visualisatieplugin voor Noatun met behulp van SDL +Comment[pl]=Generuje wtyczkę wizualizacji do Noatun. Używany jest SDL. +Comment[pt]=Gera um 'plugin' de visualização para o Noatun, que usa o SDL +Comment[pt_BR]=Gera um 'plugin' de visualização para o Noatun, que usa o SDL +Comment[ru]=Создание модуля визуализации для Noatun на основе SDL +Comment[sk]=Vygeneruje vizualizačný modul pre Noatun s použitím SDL +Comment[sr]=Прави визуелизациони прикључак за Noatun користећи SDL +Comment[sr@Latn]=Pravi vizuelizacioni priključak za Noatun koristeći SDL +Comment[sv]=Skapar ett Noatun-insticksprogram för visningar som använder SDL +Comment[tr]=SDL kullanarak noatun için bir görsellik eklentisi yaratır. +Comment[zh_CN]=使用 SDL 生成 noatun 的可视化插件 +Comment[zh_TW]=產生一個使用 SDL 的 Noatun 視覺化外掛程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp +Archive=noatunvisual.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[MKDIR_DOCBOOK1] +Type=mkdir +Dir=%{dest}/doc + +[MKDIR_DOCBOOK2] +Type=mkdir +Dir=%{dest}/doc/en + +[FILE1] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-doc-Makefile.am +Dest=%{dest}/doc/Makefile.am + +[FILE2] +Type=install +Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am +Dest=%{dest}/doc/en/Makefile.am + +[FILE3] +Type=install +EscapeXML=true +Source=%{kdevelop}/template-common/kde-index.docbook +Dest=%{dest}/doc/en/index.docbook + +[FILE4] +Type=install +Source=%{src}/plugin.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE7] +Type=install +Source=%{src}/noatunvisual-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE10] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE11] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE12] +Type=install +Source=%{src}/plugin_app.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}.cpp + +[FILE13] +Type=install +Source=%{src}/plugin_app.h +Dest=%{dest}/src/plugin_%{APPNAMELC}.h + +[FILE14] +Type=install +Source=%{src}/plugin_impl.cpp +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.cpp + +[FILE15] +Type=install +Source=%{src}/plugin_impl.h +Dest=%{dest}/src/plugin_%{APPNAMELC}_impl.h + +[FILE16] +Type=install +Source=%{src}/plugin.plugin +Dest=%{dest}/src/%{APPNAMELC}.plugin + +[MSG] +Type=message +Comment=A Noatun visualization plugin was created in %{dest} +Comment[ca]=Un connector de visualització per a Noatun ha estat creat en %{dest} +Comment[da]=Et Noatun visualiserings-plugin blev oprettet i %{dest} +Comment[de]=Ein Visualisierungs-Modul für Noatun wurde in %{dest} erstellt. +Comment[el]=Ένα οπτικό πρόσθετο Noatun δημιουργήθηκε στο %{dest} +Comment[en_GB]=A Noatun visualisation plugin was created in %{dest} +Comment[es]=Un complemento de visualización para Noatun ha sido creado en %{dest} +Comment[et]=Noatuni visualiseerimisplugin loodi asukohta %{dest} +Comment[eu]=Noatun-en bistaratze-plugin bat sortu da hemen: %{dest} +Comment[fa]=یک وصلۀ تجسم Noatun در %{dest} ایجاد شد +Comment[fr]=Un module externe de visualisation pour Noatun a été créé dans %{dest} +Comment[ga]=Cruthaíodh breiseán amharcléirithe Noatun i %{dest} +Comment[gl]=Creouse unha extensión de visualización para Noatun en %{dest} +Comment[hu]=Létrejött egy Noatun vizualizációs modul itt: %{dest} +Comment[it]=È stato creato un plugin di visualizzazione per noatun in %{dest} +Comment[ja]=Noatun ビジュアライゼーションプラグインを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Noatun-Filmmakermoduul opstellt +Comment[ne]=नोअटन भिजुलाइजेसन प्लगइन %{dest} मा सिर्जना गरियो +Comment[nl]=Een Noatun-visualisatieplugin is aangemaakt in %{dest} +Comment[pl]=Wtyczka wizualizacji została utworzona w %{dest} +Comment[pt]=Foi criado um 'plugin' de visualização do Noatun em %{dest} +Comment[pt_BR]=Foi criado um 'plugin' de visualização do Noatun em %{dest} +Comment[ru]=Модуль визуализации Noatun создан в %{dest} +Comment[sk]=Noatun vizualizačný modul bol vytvorený v %{dest} +Comment[sr]=Визуелизациони прикључак за Noatun направљен је у %{dest} +Comment[sr@Latn]=Vizuelizacioni priključak za Noatun napravljen je u %{dest} +Comment[sv]=Ett Noatun-insticksprogram för visningar skapades i %{dest} +Comment[tr]=Bir Noatun görsellik eklentisi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了 Noatun 可视化插件 +Comment[zh_TW]=一個 Noatun 視覺化外掛程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/noatunvisual/noatunvisual.png b/languages/cpp/app_templates/noatunvisual/noatunvisual.png Binary files differnew file mode 100644 index 00000000..4dcfce3d --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/noatunvisual.png diff --git a/languages/cpp/app_templates/noatunvisual/plugin.kdevelop b/languages/cpp/app_templates/noatunvisual/plugin.kdevelop new file mode 100644 index 00000000..281d095e --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin.kdevelop @@ -0,0 +1,118 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevKDEAutoProject</projectmanagement> + <primarylanguage>C++</primarylanguage> + <keywords> + <keyword>C++</keyword> + <keyword>Code</keyword> + <keyword>Qt</keyword> + <keyword>KDE</keyword> + </keywords> + </general> + <kdevcppsupport> + <qt> + <version>3</version> + <used>true</used> + <includestyle>3</includestyle> + <designerintegration>EmbeddedKDevDesigner</designerintegration> + </qt> + </kdevcppsupport> + +<kdevautoproject> + <general> + <activetarget>src/noatun_%{APPNAMELC}plugin.la</activetarget> + <useconfiguration>debug</useconfiguration> + </general> + <configurations> + <optimized> + <builddir>optimized</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O2 -g0</cxxflags> + </optimized> + <debug> + <configargs>--enable-debug=full</configargs> + <builddir>debug</builddir> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <cxxflags>-O0 -g3</cxxflags> + </debug> + </configurations> + <configurations> + <default> + <ldflags>-lSDL</ldflags> + </default> + </configurations> + </kdevautoproject> + <kdevfileview> + <groups> + <group pattern="*.cpp;*.cxx;*.h" name="Sources" /> + <group pattern="*.ui" name="User Interface" /> + <group pattern="*.png" name="Icons" /> + <group pattern="*.po;*.ts" name="Translations" /> + <group pattern="*" name="Others" /> + </groups> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>clanlib</toc> + <toc>w3c-dom-level2-html</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>java_bugs_gcc</toc> + <toc>java_bugs_sun</toc> + <toc>kde2book</toc> + <toc>opengl</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>qt-kdev3</toc> + <toc>ruby</toc> + <toc>ruby_bugs</toc> + <toc>stl</toc> + <toc>w3c-svg</toc> + <toc>sw</toc> + <toc>w3c-uaag10</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + </kdevdoctreeview> + <kdevdebugger> + <general> + <dbgshell>libtool</dbgshell> + </general> + </kdevdebugger> + <kdevfilecreate> + <filetypes/> + <useglobaltypes> + <type ext="ui" /> + <type ext="cpp" /> + <type ext="h" /> + </useglobaltypes> + </kdevfilecreate> + <kdevdocumentation> + <projectdoc> + <docsystem>Doxygen Documentation Collection</docsystem> + <docurl>%{APPNAMELC}.tag</docurl> + </projectdoc> + </kdevdocumentation> +</kdevelop> diff --git a/languages/cpp/app_templates/noatunvisual/plugin.plugin b/languages/cpp/app_templates/noatunvisual/plugin.plugin new file mode 100644 index 00000000..9dc32648 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin.plugin @@ -0,0 +1,8 @@ +Filename=noatun_%{APPNAMELC}plugin.la +Author=%{AUTHOR} +Site=http://noatun.kde.org/ +Email=%{EMAIL} +Type=visualization +License=$LICENSE$ +Name=%{APPNAME} +Comment=My scope visualization plugin diff --git a/languages/cpp/app_templates/noatunvisual/plugin_app.cpp b/languages/cpp/app_templates/noatunvisual/plugin_app.cpp new file mode 100644 index 00000000..442bdefd --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_app.cpp @@ -0,0 +1,58 @@ + +#include <sys/wait.h> +#include <sys/types.h> + +#include "plugin_%{APPNAMELC}.h" +#include "plugin_%{APPNAMELC}_impl.h" + +#include <kglobal.h> +#include <klocale.h> + +extern "C" +{ + Plugin *create_plugin() + { + KGlobal::locale()->insertCatalogue("%{APPNAMELC}"); + return new %{APPNAME}Scope(); + } +} + +%{APPNAME}Scope::%{APPNAME}Scope() + : MonoScope(50), Plugin() +{ + setSamples(320); +} + +%{APPNAME}Scope::~%{APPNAME}Scope() +{ + ::close(mOutFd); + wait(0); +} + +void %{APPNAME}Scope::init() +{ + int pipes[2]; + ::pipe(pipes); + mOutFd=pipes[1]; + if (!fork()) + { + ::close(pipes[1]); + new %{APPNAME}View(pipes[0]); + exit(0); + } + else + { + fcntl(mOutFd, F_SETFL, fcntl(mOutFd, F_GETFL) & ~O_NONBLOCK); + ::close(pipes[0]); + MonoScope::start(); + } +} + +void %{APPNAME}Scope::scopeEvent(float *d, int size) +{ + if (::write(mOutFd, (char *)d, size * sizeof(float))==-1) + { + MonoScope::stop(); + unload(); + } +} diff --git a/languages/cpp/app_templates/noatunvisual/plugin_app.h b/languages/cpp/app_templates/noatunvisual/plugin_app.h new file mode 100644 index 00000000..a3cf91ea --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_app.h @@ -0,0 +1,36 @@ + +/** Note: You only have to change plugin_%{APPNAMELC}_impl.[h,cpp] */ + +#ifndef _PLUGIN_%{APPNAMEUC}_H_ +#define _PLUGIN_%{APPNAMEUC}_H_ + +#include <noatun/plugin.h> +#include <string.h> + +extern "C" +{ + #include <SDL.h> + #include <fcntl.h> + #include <unistd.h> +} + +class %{APPNAME}Scope : public MonoScope, public Plugin +{ +NOATUNPLUGIND + +public: + %{APPNAME}Scope(); + virtual ~%{APPNAME}Scope(); + + /** @short create a new child process (using fork) with %{APPNAME}View */ + void init(); + +protected: + virtual void scopeEvent(float *data, int bands); + +private: + int mOutFd; +}; + +#endif // _PLUGIN_%{APPNAMEUC}_H_ + diff --git a/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp b/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp new file mode 100644 index 00000000..a25f1fd2 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_impl.cpp @@ -0,0 +1,276 @@ + +#include "plugin_%{APPNAMELC}_impl.h" + +#include <string.h> +#include <stdlib.h> + +extern "C" +{ + #include <SDL.h> + #include <fcntl.h> + #include <unistd.h> +} + +#if 0 +#define TEST() cout << "At line " << __LINE__ << endl +#else +#define TEST() if(0) +#endif + +#define output ((unsigned char*)data) +template <class Type> +inline void Bitmap<Type>::addPixel(int x, int y, int br1, int br2) +{ + if (x < 0 || x >= width || y < 0 || y >= height) return; + + register unsigned char *p = output+x*2+y*width*2; + if (p[0] < 255-br1) p[0] += br1; else p[0] = 255; + if (p[1] < 255-br2) p[1] += br2; else p[1] = 255; +} + +template <class Type> +void Bitmap<Type>::addVertLine(int x, int y1, int y2, int br1, int br2) +{ + if(y1 < y2) + { + for(int y = y1; y <= y2; y++) + addPixel(x,y, br1, br2); + } + else if(y2 < y1) + { + for(int y = y2; y <= y1; y++) + addPixel(x, y, br1, br2); + } + else + { + addPixel(x, y1, br1, br2); + } +} + +template <class Type> +void Bitmap<Type>::fadeStar() +{ + register unsigned long *ptr = (unsigned long*)output; + int i = width*height*2/4; + do + { + if (*ptr) + *(ptr++) -= ((*ptr & 0xf0f0f0f0ul) >> 4) + ((*ptr & 0xe0e0e0e0ul) >> 5); + else + ptr++; + } while(--i > 0); +} + +%{APPNAME}View::%{APPNAME}View(int in) : mFd(in), outputBmp(0), fullscreen(false) +{ + surface = 0; + width = 320; + height = width*6/8; + outputBmp.size(width, height); + TEST(); + + TEST(); + fcntl(mFd, F_SETFL, fcntl(mFd, F_GETFL) & ~O_NONBLOCK); + TEST(); + + + float *data = new float[width]; + TEST(); + + startVideo(); + setupPalette(); + TEST(); + + while(true) + { + checkInput(); + + if(!surface) exit(0); + + int bytestoread = width * sizeof(float); + int pos = 0; + while(pos < bytestoread) + { + char *d = (char *)data; + int r = read(mFd, d + pos, bytestoread - pos); + if(r > 0) pos += r; + else if (r==0) exit(0); + } + + outputBmp.fadeStar(); + outputBmp.fadeStar(); + + float *d = data; + float *end = data + width; + float heightHalf = height / 4.0; + int y = height / 2; + int x=0; + int oldy=(int)(*d * heightHalf); + while(d <= end) + { + int amp = (int)(*d * heightHalf); + amp+=y; + + outputBmp.addVertLine(x, oldy, amp, 255, 255); + oldy=amp; + + d++; + x++; + } + repaint(); + } +} + +static SDL_Surface *CreateScreen(Uint16 w, Uint16 h, Uint8 bpp, Uint32 flags) +{ + SDL_Surface *screen; + + // Set the video mode + screen = SDL_SetVideoMode(w, h, bpp, flags); + return screen; +} + +void %{APPNAME}View::startVideo() +{ + if(surface) + { + SDL_FreeSurface(surface); + surface = 0; + } + + Uint32 videoflags; + + /* Initialize SDL */ + if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) + exit(0); + + SDL_WM_SetCaption("%{APPNAME}","%{APPNAMELC}"); + + /* See if we try to get a hardware colormap */ + videoflags = SDL_SWSURFACE | (fullscreen?SDL_FULLSCREEN:0); + + surface = CreateScreen(width, height, 8, videoflags); + if (!surface) + exit(0); + + SDL_ShowCursor(0); + + if(!surface) + SDL_Quit(); + + SDL_WM_SetCaption("%{APPNAME}", 0); + SDL_ShowCursor(0); + +} + +void %{APPNAME}View::setupPalette(double) +{ +#define BOUND(x) ((x) > 255 ? 255 : (x)) +#define PEAKIFY(x) int(BOUND((x) - (x)*(255-(x))/255/2)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) + + int redMax=136; + int greenMax=136; + int blueMax=255; + + SDL_Color sdlPalette[256]; + + for(int i=0;i<256;i++) + { + // i + // 255 136 + sdlPalette[i].r = i*redMax/255; + sdlPalette[i].g = i*greenMax/255; + sdlPalette[i].b = i*blueMax/255; + } + + SDL_SetColors(surface, sdlPalette, 0, 256); + +#undef BOUND +#undef PEAKIFY +#undef MAX +} + +void %{APPNAME}View::checkInput() +{ + SDL_Event myEvent; + + while(SDL_PollEvent(&myEvent)) + { + switch(myEvent.type) + { + case SDL_KEYDOWN: + switch(myEvent.key.keysym.sym) + { + case SDLK_SPACE: +// fullscreen ^= true; +// startVideo(); + break; + default: + break; + } + break; + + case SDL_QUIT: + exit(0); + break; + } + } +} + +#define output2 ((unsigned char*)outputBmp.data) + +void %{APPNAME}View::repaint() +{ + SDL_LockSurface(surface); + TEST(); + + register unsigned long *ptr2 = (unsigned long*)output2; + unsigned long *ptr1 = (unsigned long*)( surface->pixels ); + int i = width*height/4; + TEST(); + + do { + // Asger Alstrup Nielsen's (alstrup@diku.dk) + // optimized 32 bit screen loop + register unsigned int const r1 = *(ptr2++); + register unsigned int const r2 = *(ptr2++); + + //if (r1 || r2) { +#ifdef LITTLEENDIAN + register unsigned int const v = + ((r1 & 0x000000f0ul) >> 4) + | ((r1 & 0x0000f000ul) >> 8) + | ((r1 & 0x00f00000ul) >> 12) + | ((r1 & 0xf0000000ul) >> 16); + *(ptr1++) = v | + ( ((r2 & 0x000000f0ul) << 12) + | ((r2 & 0x0000f000ul) << 8) + | ((r2 & 0x00f00000ul) << 4) + | ((r2 & 0xf0000000ul))); +#else + register unsigned int const v = + ((r2 & 0x000000f0ul) >> 4) + | ((r2 & 0x0000f000ul) >> 8) + | ((r2 & 0x00f00000ul) >> 12) + | ((r2 & 0xf0000000ul) >> 16); + *(ptr1++) = v | + ( ((r1 & 0x000000f0ul) << 12) + | ((r1 & 0x0000f000ul) << 8) + | ((r1 & 0x00f00000ul) << 4) + | ((r1 & 0xf0000000ul))); +#endif + //} else ptr1++; + } while (--i); + TEST(); + + SDL_UnlockSurface(surface); + SDL_UpdateRect(surface, 0, 0, 0, 0); + TEST(); + +} + +%{APPNAME}View::~%{APPNAME}View() +{ + ::close(mFd); +} diff --git a/languages/cpp/app_templates/noatunvisual/plugin_impl.h b/languages/cpp/app_templates/noatunvisual/plugin_impl.h new file mode 100644 index 00000000..2a7de7b1 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/plugin_impl.h @@ -0,0 +1,77 @@ + +#ifndef %{APPNAMEUC}_IMPL_H +#define %{APPNAMEUC}_IMPL_H + +struct SDL_Surface; + +/** + * @short This class is used for painting and supports some effects. + * Note: This is used in Blurscope. Feel free to remove this and + * implement your own drawing routines! + */ +template<class Pixel> class Bitmap +{ +public: + int width, height, extra; + Pixel *data; + + Bitmap(int e=0) : extra(e), data(0) { } + ~Bitmap() { delete[] data; } + + inline void addPixel(int x, int y, int bright1, int bright2); + void addVertLine(int x, int y, int y2, int br1, int br2); + + void fadeStar(); + + void size(int w,int h) + { + delete[] data; + width = w; + height = h; + data = new Pixel[w*h+extra]; + clear(); + } + + void clear() + { + memset(data,0,sizeof(Pixel)*(width*height+extra)); + } +}; + +/** + * @short This class does: + * o set up view + * o drawing routines. + */ +class %{APPNAME}View +{ +public: + %{APPNAME}View(int in); + ~%{APPNAME}View(); + +protected: + /** Screen initialization with SDL. Note, that you can initialize OpenGL with SDL! */ + void startVideo(); + /** SDL event queue */ + void checkInput(); + /** Used in Blurscope. Feel free to implement your own drawing routines! */ + void setupPalette(double dummy=0.0); + + /** Draw everything. */ + void repaint(); + +private: + /** used for pipelining */ + int mFd; + + /** SDL screen surface */ + SDL_Surface *surface; + Bitmap<unsigned short> outputBmp; + + bool fullscreen; + int width; + int height; +}; + +#endif // %{APPNAMEUC}_IMPL_H + diff --git a/languages/cpp/app_templates/noatunvisual/src-Makefile.am b/languages/cpp/app_templates/noatunvisual/src-Makefile.am new file mode 100644 index 00000000..207fd8a8 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/src-Makefile.am @@ -0,0 +1,19 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = noatun_%{APPNAMELC}plugin.la + +noatun_%{APPNAMELC}plugin_la_SOURCES = plugin_%{APPNAMELC}.cpp plugin_%{APPNAMELC}_impl.cpp +noatun_%{APPNAMELC}plugin_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined $(LIBSDL_RPATH) +noatun_%{APPNAMELC}plugin_la_CXXFLAGS = $(LIBSDL_CFLAGS) +noatun_%{APPNAMELC}plugin_la_LIBADD = $(LIB_KFILE) $(LIBSDL_LIBS) -lnoatun -lm + +pluginsdir = $(kde_datadir)/noatun +plugins_DATA = %{APPNAMELC}.plugin + +# kde_services_DATA = %{APPNAMELC}.desktop + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/%{APPNAMELC}.pot diff --git a/languages/cpp/app_templates/noatunvisual/subdirs b/languages/cpp/app_templates/noatunvisual/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/cpp/app_templates/noatunvisual/subdirs @@ -0,0 +1,3 @@ +doc +po +src |