mirror_x.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  *
00005  * plugin_helper reports your answers as
00006 author          =Percy Zahl
00007 email                   =zahl@users.sf.net
00008 pluginname              =mirror_x
00009 pluginmenuentry         =Mirror X
00010 menupath                =Math/Transformations/
00011 entryplace              =Transformations
00012 shortentryplace =TR
00013 abouttext               =Mirror scan along X.
00014 smallhelp               =Mirror scan along X.
00015 longhelp                =This is a detailed help for my Plugin.
00016  * 
00017  * Gxsm Plugin Name: mirror_x.C
00018  * ========================================
00019  * 
00020  * Copyright (C) 1999 The Free Software Foundation
00021  *
00022  * Authors: Percy Zahl <zahl@fkp.uni-hannover.de>
00023  * additional features: Andreas Klust <klust@fkp.uni-hannover.de>
00024  *
00025  * This program is free software; you can redistribute it and/or modify
00026  * it under the terms of the GNU General Public License as published by
00027  * the Free Software Foundation; either version 2 of the License, or
00028  * (at your option) any later version.
00029  *
00030  * This program is distributed in the hope that it will be useful,
00031  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00032  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00033  * GNU General Public License for more details.
00034  *
00035  * You should have received a copy of the GNU General Public License
00036  * along with this program; if not, write to the Free Software
00037  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00038  */
00039 
00040 
00041 /* Please do not change the Begin/End lines of this comment section!
00042  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00043  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00044  * All "% PlugInXXX" commentary tags are mandatory
00045  * All "% OptPlugInXXX" tags are optional and can be removed or commented in
00046  * --------------------------------------------------------------------------------
00047 % BeginPlugInDocuSection
00048 % PlugInDocuCaption: Mirror X
00049 % PlugInName: mirror_x
00050 % PlugInAuthor:  A. Klust, P. Zahl
00051 % PlugInAuthorEmail: zahl@users.sf.net
00052 % PlugInMenuPath: Math/Transformations/Mirror X
00053 
00054 % PlugInDescription
00055 Mirrors a image along X.
00056 
00057 % PlugInUsage
00058 Call \GxsmMenu{Math/Transformations/Mirror X}.
00059 
00060 % OptPlugInSources
00061 The active channel is used as data source.
00062 
00063 %% OptPlugInObjects
00064 %A optional rectangle is used for data extraction...
00065 
00066 % OptPlugInDest
00067 The computation result is placed into an existing math channel, else into a new created math channel.
00068 
00069 %% OptPlugInConfig
00070 %describe the configuration options of your plug in here!
00071 
00072 %% OptPlugInFiles
00073 %Does it uses, needs, creates any files? Put info here!
00074 
00075 % EndPlugInDocuSection
00076  * -------------------------------------------------------------------------------- 
00077  */
00078 
00079 #include <gtk/gtk.h>
00080 #include "config.h"
00081 #include "gxsm/plugin.h"
00082 
00083 // Plugin Prototypes
00084 static void mirror_x_init( void );
00085 static void mirror_x_about( void );
00086 static void mirror_x_configure( void );
00087 static void mirror_x_cleanup( void );
00088 
00089 // Define Type of math plugin here, only one line should be commented in!!
00090 #define GXSM_ONE_SRC_PLUGIN__DEF
00091 // #define GXSM_TWO_SRC_PLUGIN__DEF
00092 
00093 // Math-Run-Function, use only one of (automatically done :=)
00094 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00095 // "OneSrc" Prototype
00096 static gboolean mirror_x_run( Scan *Src, Scan *Dest );
00097 #else
00098 // "TwoSrc" Prototype
00099 static gboolean mirror_x_run( Scan *Src1, Scan *Src2, Scan *Dest );
00100 #endif
00101 
00102 // Fill in the GxsmPlugin Description here
00103 GxsmPlugin mirror_x_pi = {
00104         NULL,                   // filled in and used by Gxsm, don't touch !
00105         NULL,                   // filled in and used by Gxsm, don't touch !
00106         0,                      // filled in and used by Gxsm, don't touch !
00107         NULL,                   // The Gxsm-App Class Ref.pointer (called "gapp" in Gxsm) is 
00108         // filled in here by Gxsm on Plugin load, 
00109         // just after init() is called !!!
00110         // ----------------------------------------------------------------------
00111         // Plugins Name, CodeStly is like: Name-M1S|M2S-BG|F1D|F2D|ST|TR|Misc
00112         "mirror_x-"
00113 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00114         "M1S"
00115 #else
00116         "M2S"
00117 #endif
00118         "-TR",
00119         // Plugin's Category - used to autodecide on Pluginloading or ignoring
00120         // NULL: load, else
00121         // example: "+noHARD +STM +AFM"
00122         // load only, if "+noHARD: no hardware" and Instrument is STM or AFM
00123         // +/-xxxHARD und (+/-INST or ...)
00124         NULL,
00125         // Description, is shown by PluginViewer (Plugin: listplugin, Tools->Plugin Details)
00126         "This is a detailed help for my Plugin.",                   
00127         // Author(s)
00128         "Percy Zahl",
00129         // Menupath to position where it is appendet to
00130         N_("_Math/_Transformations/"),
00131         // Menuentry
00132         N_("Mirror X"),
00133         // help text shown on menu
00134         N_("This is a detailed help for my Plugin."),
00135         // more info...
00136         "Mirror scan along X.",
00137         NULL,          // error msg, plugin may put error status msg here later
00138         NULL,          // Plugin Status, managed by Gxsm, plugin may manipulate it too
00139         // init-function pointer, can be "NULL", 
00140         // called if present at plugin load
00141         mirror_x_init,  
00142         // query-function pointer, can be "NULL", 
00143         // called if present after plugin init to let plugin manage it install itself
00144         NULL, // query should be "NULL" for Gxsm-Math-Plugin !!!
00145         // about-function, can be "NULL"
00146         // can be called by "Plugin Details"
00147         mirror_x_about,
00148         // configure-function, can be "NULL"
00149         // can be called by "Plugin Details"
00150         mirror_x_configure,
00151         // run-function, can be "NULL", if non-Zero and no query defined, 
00152         // it is called on menupath->"plugin"
00153         NULL, // run should be "NULL" for Gxsm-Math-Plugin !!!
00154         // cleanup-function, can be "NULL"
00155         // called if present at plugin removeal
00156         mirror_x_cleanup
00157 };
00158 
00159 // special math Plugin-Strucure, use
00160 // GxsmMathOneSrcPlugin mirror_x_m1s_pi -> "OneSrcMath"
00161 // GxsmMathTwoSrcPlugin mirror_x_m2s_pi -> "TwoSrcMath"
00162 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00163 GxsmMathOneSrcPlugin mirror_x_m1s_pi
00164 #else
00165 GxsmMathTwoSrcPlugin mirror_x_m2s_pi
00166 #endif
00167 = {
00168         // math-function to run, see prototype(s) above!!
00169         mirror_x_run
00170 };
00171 
00172 // Text used in Aboutbox, please update!!
00173 static const char *about_text = N_("Gxsm mirror_x Plugin\n\n"
00174                                    "Mirror scan along X.");
00175 
00176 // Symbol "get_gxsm_plugin_info" is resolved by dlsym from Gxsm, used to get Plugin's info!! 
00177 // Essential Plugin Function!!
00178 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00179         mirror_x_pi.description = g_strdup_printf(N_("Gxsm MathOneArg mirror_x plugin %s"), VERSION);
00180         return &mirror_x_pi; 
00181 }
00182 
00183 // Symbol "get_gxsm_math_one|two_src_plugin_info" is resolved by dlsym from Gxsm, 
00184 // used to find out which Math Type the Plugin is!! 
00185 // Essential Plugin Function!!
00186 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00187 GxsmMathOneSrcPlugin *get_gxsm_math_one_src_plugin_info( void ) {
00188         return &mirror_x_m1s_pi; 
00189 }
00190 #else
00191 GxsmMathTwoSrcPlugin *get_gxsm_math_two_src_plugin_info( void ) { 
00192         return &mirror_x_m2s_pi; 
00193 }
00194 #endif
00195 
00196 /* Here we go... */
00197 // init-Function
00198 static void mirror_x_init(void)
00199 {
00200         PI_DEBUG (DBG_L2, "mirror_x Plugin Init");
00201 }
00202 
00203 // about-Function
00204 static void mirror_x_about(void)
00205 {
00206         const gchar *authors[] = { mirror_x_pi.authors, NULL};
00207         gtk_widget_show(gnome_about_new ( mirror_x_pi.name,
00208                                           VERSION,
00209                                     N_("(C) 2000 the Free Software Foundation"),
00210                                     about_text,
00211                                     authors,
00212                                     NULL, NULL, NULL
00213                                     ));
00214 }
00215 
00216 // configure-Function
00217 static void mirror_x_configure(void)
00218 {
00219         if(mirror_x_pi.app)
00220                 mirror_x_pi.app->message("mirror_x Plugin Configuration");
00221 }
00222 
00223 // cleanup-Function
00224 static void mirror_x_cleanup(void)
00225 {
00226         PI_DEBUG (DBG_L2, "mirror_x Plugin Cleanup");
00227 }
00228 
00229 // run-Function
00230 static gboolean mirror_x_run(Scan *Src, Scan *Dest)
00231 {
00232         for (int line = 0; line < Src->mem2d->GetNy(); line++)
00233                 Dest->mem2d->CopyFrom(Src->mem2d, 0,
00234                                       line, 0,
00235                                       Src->mem2d->GetNy()-line-1, Dest->mem2d->GetNx());
00236         return MATH_OK;
00237 }
00238 
00239 

Generated on Sat Apr 1 09:04:23 2006 for GXSM by  doxygen 1.4.6