vprofile.C

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00027 
00028 #include <locale.h>
00029 #include <libintl.h>
00030 
00031 
00032 #include "view.h"
00033 #include "mem2d.h"
00034 #include "xsmmasks.h"
00035 #include "glbvars.h"
00036 #include "app_profile.h"
00037 
00038 // ============================== Class Profiles ==============================
00039 
00040 Profiles::Profiles(Scan *sc, int ChNo):View(sc, ChNo){
00041   XSM_DEBUG (DBG_L2, "Profiles::Profiles");
00042   profile = NULL;
00043 }
00044 
00045 Profiles::Profiles():View(){
00046   profile = NULL;
00047 }
00048 
00049 Profiles::~Profiles(){
00050   XSM_DEBUG (DBG_L2, "Profiles::~");
00051   hide();
00052 }
00053 
00054 void Profiles::hide(){
00055   XSM_DEBUG (DBG_L2, "Profiles::hide");
00056   if(profile)
00057     delete profile;
00058   profile=NULL;
00059 }
00060 
00061 int Profiles::update(int y1, int y2){
00062   if(!profile) 
00063     return 0;
00064 
00065   if(y2 < y1){
00066     if(ChanNo == gapp->xsm->ActiveChannel)
00067       profile->SetActive(TRUE);
00068     else
00069       profile->SetActive(FALSE);
00070    return 0;
00071   }
00072 
00073   mem2d->SetDataPktMode(data->display.ViewFlg);
00074 
00075   //  scan->Pkt2d[0].x=0;
00076   //  scan->Pkt2d[0].y=y1;
00077   //  scan->Pkt2d[1].x=mem2d->GetNx()-1;
00078   //  scan->Pkt2d[1].y=y1;
00079 
00080   profile->NewData(scan, y1, FALSE);
00081 
00082   //  profile->UpdateArea();
00083 
00084   return 0;
00085 }
00086 
00087 int Profiles::draw(int zoomoverride){
00088   gchar *titel=NULL;
00089 
00090   if(!mem2d) { 
00091     XSM_DEBUG (DBG_L2, "Profiles: no mem2d !"); 
00092     return 1; 
00093   }
00094 
00095   if(ChanNo > 0)
00096     titel = g_strdup_printf("Ch%d: %s %s", 
00097                             ChanNo+1,data->ui.name, mem2d->GetEname());
00098   else
00099     titel = g_strdup_printf("Probe: %s %s", 
00100                             data->ui.name, mem2d->GetEname());
00101 
00102   if(!profile){
00103     profile = new ProfileControl(titel);
00104     profile->NewData(scan, 0, FALSE);
00105     //    profile->SetMode(PROFILE_MODE_XGRID | PROFILE_MODE_YGRID | PROFILE_MODE_CONNECT);
00106     //    profile->SetScaling(PROFILE_SCALE_XAUTO | PROFILE_SCALE_YAUTO | PROFILE_SCALE_YEXPAND);
00107   }
00108 
00109   //  scan->Pkt2d[0].x=0;
00110   //  scan->Pkt2d[0].y=0;
00111   //  scan->Pkt2d[1].x=mem2d->GetNx()-1;
00112   //  scan->Pkt2d[1].y=0;
00113 
00114   //  profile->NewData(scan, 0, FALSE);
00115   profile->UpdateArea();
00116 
00117   profile->SetTitle(titel);  
00118   g_free(titel);
00119   profile->show();
00120 
00121   XSM_DEBUG (DBG_L5, "Profiles::draw ret");
00122 
00123   return 0;
00124 }

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