Commit [429088] Maximize Restore History

checkin of historic release 1998-12-13-v0.29-pre2

svn-id: https://kwave.svn.sourceforge.net/svnroot/kwave/branches/historic-pre-0_5_x@1809 bbf32e5a-961d-0410-9e10-91f32741c31e

Martin Wilz Martin Wilz 1998-12-12

<< < 1 2 3 4 (Page 4 of 4)
added kwave/clipboard.cpp
added kwave/clipboard.h
added kwave/mainwidget.h
added kwave/markers.h
added kwave/menumanager.h
added kwave/overview.h
added kwave/signalview.h
changed GNU-LICENSE
changed History
changed Makefile.am
changed Makefile.dist
changed README
changed acconfig.h
changed acinclude.m4
changed aclocal.m4
changed config.guess
changed config.h.bot
changed config.h.in
changed config.sub
changed configure.in
changed install-sh
changed kwave
changed kwave.lsm
changed kwave/Makefile.am
changed kwave/about.cpp
changed kwave/about.h
changed kwave/addsynth.cpp
changed kwave/addsynth.h
changed kwave/configdialogs.cpp
changed kwave/configdialogs.h
changed kwave/curvewidget.cpp
changed kwave/curvewidget.h
changed kwave/dialogs.cpp
changed kwave/dialogs.h
changed kwave/doc
changed kwave/doc/index.html
changed kwave/doc/interpolation.html
changed kwave/doc/what.html
changed kwave/faderwidget.cpp
changed kwave/faderwidget.h
changed kwave/fftview.cpp
changed kwave/fftview.h
changed kwave/filter.cpp
changed kwave/filter.h
changed kwave/formantwidget.cpp
changed kwave/formantwidget.h
changed kwave/functions.cpp
changed kwave/functions.h
changed kwave/gsl_fft.cpp
changed kwave/gsl_fft.h
changed kwave/images
changed kwave/images/font.xpm
changed kwave/images/knob.xpm
changed kwave/images/kwave.xpm
changed kwave/images/light_off.xpm
changed kwave/images/light_on.xpm
changed kwave/images/logo.xpm
changed kwave/images/lspeaker.xpm
changed kwave/images/rspeaker.xpm
changed kwave/images/selectedknob.xpm
changed kwave/images/xspeaker.xpm
changed kwave/interpolation.cpp
changed kwave/interpolation.h
changed kwave/kwave.kdelnk
changed kwave/main.cpp
changed kwave/main.h
changed kwave/mainwidget.cpp
changed kwave/markers.cpp
changed kwave/mfilter.cpp
changed kwave/mmap.cpp
changed kwave/mmap.h
changed kwave/multistateimage.cpp
changed kwave/multistateimage.h
changed kwave/pitchwidget.cpp
changed kwave/pitchwidget.h
changed kwave/sample.cpp
changed kwave/sample.h
changed kwave/sampleedit.cpp
changed kwave/sampleio.cpp
changed kwave/sampleop.h
changed kwave/scale.cpp
changed kwave/scale.h
changed kwave/signalview.cpp
changed kwave/sonagram.cpp
changed kwave/sonagram.h
changed kwave/windowfunction.cpp
changed kwave/windowfunction.h
changed missing
changed mkinstalldirs
changed po
changed po/Makefile.am
changed stamp-h.in
copied kwave/classes.h -> kwave/menumanager.cpp
kwave/clipboard.cpp Diff Switch to side-by-side view
Loading...
kwave/clipboard.h Diff Switch to side-by-side view
Loading...
kwave/mainwidget.h Diff Switch to side-by-side view
Loading...
kwave/markers.h Diff Switch to side-by-side view
Loading...
kwave/menumanager.h Diff Switch to side-by-side view
Loading...
kwave/overview.h Diff Switch to side-by-side view
Loading...
kwave/signalview.h Diff Switch to side-by-side view
Loading...
GNU-LICENSE Diff Switch to side-by-side view
Loading...
History Diff Switch to side-by-side view
Loading...
Makefile.am Diff Switch to side-by-side view
Loading...
Makefile.dist Diff Switch to side-by-side view
Loading...
README Diff Switch to side-by-side view
Loading...
acconfig.h Diff Switch to side-by-side view
Loading...
acinclude.m4 Diff Switch to side-by-side view
Loading...
aclocal.m4 Diff Switch to side-by-side view
Loading...
config.guess Diff Switch to side-by-side view
Loading...
config.h.bot Diff Switch to side-by-side view
Loading...
config.h.in Diff Switch to side-by-side view
Loading...
config.sub Diff Switch to side-by-side view
Loading...
configure.in Diff Switch to side-by-side view
Loading...
install-sh Diff Switch to side-by-side view
Loading...
kwave
Directory.
kwave.lsm Diff Switch to side-by-side view
Loading...
kwave/Makefile.am Diff Switch to side-by-side view
Loading...
kwave/about.cpp Diff Switch to side-by-side view
Loading...
kwave/about.h Diff Switch to side-by-side view
Loading...
kwave/addsynth.cpp Diff Switch to side-by-side view
Loading...
kwave/addsynth.h Diff Switch to side-by-side view
Loading...
kwave/configdialogs.cpp Diff Switch to side-by-side view
Loading...
kwave/configdialogs.h Diff Switch to side-by-side view
Loading...
kwave/curvewidget.cpp Diff Switch to side-by-side view
Loading...
kwave/curvewidget.h Diff Switch to side-by-side view
Loading...
kwave/dialogs.cpp Diff Switch to side-by-side view
Loading...
kwave/dialogs.h Diff Switch to side-by-side view
Loading...
kwave/doc
Directory.
kwave/doc/index.html Diff Switch to side-by-side view
Loading...
kwave/doc/interpolation.html Diff Switch to side-by-side view
Loading...
kwave/doc/what.html Diff Switch to side-by-side view
Loading...
kwave/faderwidget.cpp Diff Switch to side-by-side view
Loading...
kwave/faderwidget.h Diff Switch to side-by-side view
Loading...
kwave/fftview.cpp Diff Switch to side-by-side view
Loading...
kwave/fftview.h Diff Switch to side-by-side view
Loading...
kwave/filter.cpp Diff Switch to side-by-side view
Loading...
kwave/filter.h Diff Switch to side-by-side view
Loading...
kwave/formantwidget.cpp Diff Switch to side-by-side view
Loading...
kwave/formantwidget.h Diff Switch to side-by-side view
Loading...
kwave/functions.cpp Diff Switch to side-by-side view
Loading...
kwave/functions.h Diff Switch to side-by-side view
Loading...
kwave/gsl_fft.cpp Diff Switch to side-by-side view
Loading...
kwave/gsl_fft.h Diff Switch to side-by-side view
Loading...
kwave/images
Directory.
kwave/images/font.xpm Diff Switch to side-by-side view
Loading...
kwave/images/knob.xpm Diff Switch to side-by-side view
Loading...
kwave/images/kwave.xpm Diff Switch to side-by-side view
Loading...
kwave/images/light_off.xpm Diff Switch to side-by-side view
Loading...
kwave/images/light_on.xpm Diff Switch to side-by-side view
Loading...
kwave/images/logo.xpm Diff Switch to side-by-side view
Loading...
kwave/images/lspeaker.xpm Diff Switch to side-by-side view
Loading...
kwave/images/rspeaker.xpm Diff Switch to side-by-side view
Loading...
kwave/images/selectedknob.xpm Diff Switch to side-by-side view
Loading...
kwave/images/xspeaker.xpm Diff Switch to side-by-side view
Loading...
kwave/interpolation.cpp Diff Switch to side-by-side view
Loading...
kwave/interpolation.h Diff Switch to side-by-side view
Loading...
kwave/kwave.kdelnk Diff Switch to side-by-side view
Loading...
kwave/main.cpp Diff Switch to side-by-side view
Loading...
kwave/main.h Diff Switch to side-by-side view
Loading...
kwave/mainwidget.cpp Diff Switch to side-by-side view
Loading...
kwave/markers.cpp Diff Switch to side-by-side view
Loading...
kwave/mfilter.cpp Diff Switch to side-by-side view
Loading...
kwave/mmap.cpp Diff Switch to side-by-side view
Loading...
kwave/mmap.h Diff Switch to side-by-side view
Loading...
kwave/multistateimage.cpp Diff Switch to side-by-side view
Loading...
kwave/multistateimage.h Diff Switch to side-by-side view
Loading...
kwave/pitchwidget.cpp Diff Switch to side-by-side view
Loading...
kwave/pitchwidget.h Diff Switch to side-by-side view
Loading...
kwave/sample.cpp Diff Switch to side-by-side view
Loading...
kwave/sample.h Diff Switch to side-by-side view
Loading...
kwave/sampleedit.cpp Diff Switch to side-by-side view
Loading...
kwave/sampleio.cpp Diff Switch to side-by-side view
Loading...
kwave/sampleop.h Diff Switch to side-by-side view
Loading...
kwave/scale.cpp Diff Switch to side-by-side view
Loading...
kwave/scale.h Diff Switch to side-by-side view
Loading...
kwave/signalview.cpp Diff Switch to side-by-side view
Loading...
kwave/sonagram.cpp Diff Switch to side-by-side view
Loading...
kwave/sonagram.h Diff Switch to side-by-side view
Loading...
kwave/windowfunction.cpp Diff Switch to side-by-side view
Loading...
kwave/windowfunction.h Diff Switch to side-by-side view
Loading...
missing Diff Switch to side-by-side view
Loading...
mkinstalldirs Diff Switch to side-by-side view
Loading...
po
Directory.
po/Makefile.am Diff Switch to side-by-side view
Loading...
stamp-h.in Diff Switch to side-by-side view
Loading...
kwave/classes.h to kwave/menumanager.cpp
--- a/kwave/classes.h
+++ b/kwave/menumanager.cpp
@@ -1,256 +1,410 @@
-#ifndef _KWAVECLASSES_H_
-#define _KWAVECLASSES_H_ 1
-
-#include <qapp.h>
-#include <qlayout.h>
-#include <qpushbt.h>
-#include <qfont.h>
-#include <qfile.h>
-#include <qscrbar.h>
-#include <qstring.h>
-#include <qfiledlg.h>
-#include <qwidget.h>
-#include <qcombo.h>
-#include <qpixmap.h>
-#include <qtimer.h>
-#include <qframe.h>
-#include <kapp.h>
-#include <kslider.h>
-#include <kselect.h>
-#include <ktopwidget.h>
-#include <kmenubar.h>
-#include <kbuttonbox.h>
-#include <kstatusbar.h>  
-#include <kbutton.h>
-#include "sample.h"
-#include "multistateimage.h"
-
-class MainWidget;
-//***********************************************************
-class MarkerType
-//Type Information for Markers mainly information concerning the outlook
-{
- public:
-  MarkerType ();
-  ~MarkerType();
-
-  QString*name;         //pointer to name
-  QColor *color;        //color
-  bool    named;         //boolean if named
-  bool    selected;
-};
-//***********************************************************
-class Marker
-//Marker Class is for marking positions in the signal
-{
- public:
-  Marker();
-  ~Marker();
-
-  int     pos;                         //position
-  QString *name;                       //pointer to name
-  struct  MarkerType *type;            //pointer to type
-};
-//***********************************************************
-class MarkerList:public QListT<Marker>
-//Class for list of Markers have to inherit from QList to implement own
-//compareItems method for sorting
-{
-  //  Q_OBJECT
- public:
-  MarkerList::MarkerList();
-  MarkerList::~MarkerList();
-  int MarkerList::compareItems (GCI,GCI);
-};
-//***********************************************************
-//OverviewWidget is the scrollbar in the main window
-//QScrollbar has proven to be unstable with high numbers.
-//this one also features a small overview of the part of the sample being
-//unseen
-class OverViewWidget : public QWidget
-{
- Q_OBJECT
- public:
-      OverViewWidget	(QWidget *parent=0,const char *name=0);
-      OverViewWidget	(MainWidget *parent=0,const char *name=0);
-      ~OverViewWidget	();
- void mousePressEvent		(QMouseEvent * );
- void mouseReleaseEvent	(QMouseEvent * );  
- void mouseMoveEvent		(QMouseEvent * );  
- void setSignal		(char *);
- void setValue                (int);
- void refresh                 ();
-
- public slots:
-
- void setRange		(int,int,int);
- void increase ();
-
- signals:
-
- void valueChanged (int);
-
- protected:
-
- void paintEvent(QPaintEvent *);
-
- private:
-
- int        width,height;
- int        grabbed;
- int        max;
- int        len;
- int        act;
- int        dir;        //addup for direction...
- int	    redraw;	//flag for redrawing pixmap
- MainWidget *mparent;
- QWidget    *parent;
- QTimer     *timer;     //to spare user repeated pressing of the widget...
- QPixmap    *pixmap;	//pixmap to be blitted to screen
-};
-//***********************************************************
-class SignalWidget : public QWidget
-//this class is mainly for responsible for displaying signals in the time-domain
-
-{
- Q_OBJECT
- public:
- 	SignalWidget	(QWidget *parent=0,const char *name=0);
- 	~SignalWidget	();
-
-
- void 	setSignal		(QString *filename);
- void 	saveSignal		(QString *filename,int,int=false);
- void 	saveBlocks		(int);
- void 	saveSelectedSignal	(QString *filename,int,int=false);
- void 	setSignal		(MSignal *signal);
- void	setZoom			(double);
- void	setRange		(int,int);
- unsigned char   *getOverview   (int);
- int    checkPosition	        (int);
- void 	drawSelection		(int,int);
-
- public slots:
-
- void 	refresh		();
- void	setOffset	(int);
- void	setRangeOp	(int);
- void	toggleChannel	(int);
- void	time		();
- void	zoomRange	();
- void	zoomIn		();
- void	zoomOut		();
- void	zoomNormal	();
-
- void   signalinserted (int,int);
- void   signaldeleted  (int,int);
-
- signals:
-
- void channelReset	();
- void playingfinished	();
- void viewInfo		(int,int,int);
- void lengthInfo	(int);
- void rateInfo		(int);
- void timeInfo		(int);
- void selectedtimeInfo	(int);
- void channelInfo       (int);
- void addMarkerType     (struct MarkerType *);
-
- protected:
-
- void	mousePressEvent		(QMouseEvent * );
- void	mouseReleaseEvent	(QMouseEvent * );  
- void	mouseMoveEvent		(QMouseEvent * );  
- void	paintEvent	(QPaintEvent *);
- void	deleteLastRange	();
- void	drawRange	();
- void	drawSignal	(int *,int,int);
- void	drawInterpolatedSignal	(int *,int,int);
- void	drawOverviewSignal	(int *,int,int);
- void	calcTimeInfo	();
- void   loadMarks       ();
- void   appendMarks     ();
- void   deleteMarks     ();
- void   convertMarkstoPitch ();
- void   saveMarks       ();
- void   addMark         ();
- void   markSignal      ();
- void   markPeriods     ();
- void   savePeriods     ();
-
- private:
- int	offset;
- int	width,height;		//of widget
- int	down,reset;		//flags for drawing
- double zoomy;
- double	zoom;			//number of samples represented by 1
-				//vertical line on the screen
- int	firstx,lastx,nextx;	//markers for mouse mark operation
- int    lasty;			//marker for mouse zoom...      
- int	playpointer,lastplaypointer;	 
- int	playing;		//flag if playing task is running...
- int	redraw;		        //flag for redrawing pixmap
- MSignal	*signal;
- QTimer		*timer;
- QPainter 	p;
- QPixmap	*pixmap;	//pixmap to be blitted to screen
- MarkerList     *markers;       //linked list of markers
- MarkerType     *markertype;    //selected marker type
-};
-//***********************************************************
-class MainWidget : public QWidget
-//mainwidget is parent for almost all widgets in the main window
-{
- Q_OBJECT
- public:
-
- 	MainWidget	(QWidget *parent=0,const char *name=0,KStatusBar *status=0);
- 	~MainWidget	();
- void	setSignal	(QString *filename);
- void	setSignal	(MSignal *);
- void 	saveSignal	(QString *filename,int,int=false);
- void	setRangeOp	(int);
- unsigned char *getOverView (int);
- MSignal *getSignalView	();
-
- public slots:
-
- void getChannelInfo	(int);
- void resetChannels	();
- void setRateInfo	(int);
- void setLengthInfo	(int);
- void setTimeInfo	(int);
- void parseKey	        (int);
- void setSelectedTimeInfo(int);
- void selectedZoom	(int);
- void play		();
- void stop		();
- void loop		();
-
- signals:
-
- void setOperation	(int);
- void channelInfo       (int);
-
- protected:
-
- void resizeEvent	(QResizeEvent *);
-
- private:
-
- KButtonBox	*buttons;
- OverViewWidget	*slider;
- SignalWidget 	*signalview;
- QPushButton	*plusbutton,*minusbutton;
- QPushButton	*zoombutton,*nozoombutton;
- QPushButton	*playbutton,*loopbutton;
- QComboBox	*zoomselect;
- KStatusBar	*status;
- MultiStateWidget **lamps;
- MultiStateWidget **speakers;
- QWidget        *parent;
- int 		numsignals;
- int            bsize;
-};
-#endif //_KWAVECLASSES_H_
+#include <qstack.h>
+#include "menumanager.h"
+#include <kapp.h>
+#include <klocale.h>
+
+int unique_menu_id=1<<16; //this should be greater than any id sampleop.h and other internal ids
+
+KWavePopMenu::KWavePopMenu (const char *name,int id ):QPopupMenu()
+{
+  this->name=new QString (name);
+  this->id=id;
+  this->memberId=0;
+}
+//*****************************************************************************
+const char *KWavePopMenu::getName ()
+{
+  return name->data();
+}
+//*****************************************************************************
+int KWavePopMenu::getId ()
+{
+  return id;
+}
+//*****************************************************************************
+void KWavePopMenu::insertMenu (KWavePopMenu *entry)
+{
+  children.append (entry);
+  this->insertItem (klocale->translate(entry->getName()),entry);
+}
+//*****************************************************************************
+void KWavePopMenu::setMemberId (int id)
+{
+  memberId=id;
+}
+//*****************************************************************************
+int KWavePopMenu::getMemberId ()
+{
+  return memberId;
+}
+//*****************************************************************************
+void KWavePopMenu::removeMenu (const char *name)
+{
+  KWavePopMenu *menu=findMenu(name);
+  if (menu)
+    {
+      int index=menu->getId();
+      removeItem(index);
+      children.removeRef (menu);
+      delete menu;
+    }
+}
+//*****************************************************************************
+KWavePopMenu *KWavePopMenu::findMenu (const char *name)
+{
+  KWavePopMenu *tmp=children.first();
+
+  while (tmp)
+    {
+      if (strcmp (tmp->getName(),name)==0) return tmp;
+      tmp=children.next();
+    }
+  return 0;
+}
+//*****************************************************************************
+KWavePopMenu::~KWavePopMenu ()
+{
+  delete name;
+}
+//*****************************************************************************
+NumberedMenu::NumberedMenu (char *name)
+{
+  objname=new QString (name);
+}
+//*****************************************************************************
+void NumberedMenu::clear ()
+{
+  entries.clear ();
+  refresh ();
+}
+//*****************************************************************************
+void NumberedMenu::notifyMenu (KWavePopMenu *menu)
+{
+  notifymenus.append (menu);
+}
+//*****************************************************************************
+void NumberedMenu::addEntry (char *entry)
+{
+  entries.append (new QString (entry));
+  refresh ();
+}
+//*****************************************************************************
+void NumberedMenu::refresh ()
+{
+  //refresh of menus already in menu tree
+  //printf ("refreshing numberedMenu %s\n",objname->data());
+
+  KWavePopMenu *tmp=notifymenus.first();
+
+  while (tmp)
+    {
+      //printf ("refreshing menu %s\n",tmp->getName());
+      tmp->clear();
+      int itemcnt=0;
+      int id=tmp->getMemberId();
+
+      QString *entry=entries.first();
+
+      while ((entry)&&(itemcnt<MENUMAX))
+	{
+	  tmp->insertItem (entry->data(),id+itemcnt);
+	  entry=entries.next();
+	  itemcnt++;
+	}
+
+      tmp=notifymenus.next();
+    }
+}
+//*****************************************************************************
+char *NumberedMenu::name ()
+{
+  return objname->data();
+}
+//*****************************************************************************
+NumberedMenu::~NumberedMenu ()
+{
+  entries.setAutoDelete (true);
+  entries.clear();
+  notifymenus.clear();
+  delete objname;
+}
+//*****************************************************************************
+MenuManager::MenuManager (QWidget *parent,KMenuBar *bar):QObject (parent)
+{
+  this->bar=bar;
+}
+//*****************************************************************************
+int MenuManager::getUniqueId ()
+{
+  int x=unique_menu_id;
+  unique_menu_id++;
+
+  return x;
+}
+//*****************************************************************************
+KWavePopMenu  *MenuManager::findMenu (const char *name)
+{
+  KWavePopMenu *tmp=menus.first();
+  while (tmp)
+    {
+      if (strcmp(tmp->getName(),name)==0) return tmp;
+      tmp=menus.next();
+    }
+  return 0;
+}
+//*****************************************************************************
+void MenuManager::deleteMenus (KWaveMenuItem *newmenus)
+{
+  int cnt=0;
+
+  KWavePopMenu *menu=0;
+  QStack <KWavePopMenu> *stack=new QStack<KWavePopMenu>();
+
+  while (newmenus[cnt].type!=0)
+    {
+      switch (newmenus[cnt].type)
+	{
+	case KMENU:
+	  {
+	    //deleting is only possible if exclusive rights are available
+	    if (newmenus[cnt].shortcut==KEXCLUSIVE)
+	      {
+		if (menu) menu->removeMenu (newmenus[cnt].name);
+		else
+		  {
+		    bar->removeItem(newmenus[cnt].id);
+
+		    KWavePopMenu *tmp=findMenu (newmenus[cnt].name);
+
+		    if (tmp)
+		      {
+			menus.removeRef (tmp);
+			delete tmp;	
+		      }
+		  }
+		//skip all submenus in KWaveMenuItems structure that belong to the deleted menu entry
+		    int dep=1;
+		    while (dep>0)
+		      {
+			cnt++;
+			if (newmenus[cnt].type==KMENU) dep++;
+			if (newmenus[cnt].type==KEND) dep--;
+			if (newmenus[cnt].type==0) break;
+		      }
+		    if (newmenus[cnt].type!=0) cnt--;
+	      }
+	    else
+	      {
+		//menu can't be deleted, but perhaps submenus need to be ->push menu.
+		KWavePopMenu *newmenu;
+
+		if (menu) newmenu =menu->findMenu (newmenus[cnt].name);
+		else newmenu=this->findMenu (newmenus[cnt].name);
+
+		if (newmenu)
+		  {
+		    stack->push(menu);
+		    menu=newmenu;
+		  }
+		else debug ("menu %s not found for deleting !\n",newmenus[cnt].name);
+	      }
+	  }
+	  break;
+	case KITEM:
+	  {
+	    if (menu) menu->removeItem(newmenus[cnt].id);	    
+	    else debug ("error : deleting Item %s at top level\n",newmenus[cnt].name);
+	  }
+	  break;
+	case KSEP:
+	  if (menu) //no separators at top level
+	    {
+	      int index=menu->indexOf (newmenus[cnt+1].id); 
+	      if (index>1) menu->removeItemAt (index-1);  //remove separator...
+	      //does there exist another way of deleting ?
+	      //I guess not, since separators may not have ID's
+	      //but as long as it works...
+	    }
+	  break;
+	case KEND:
+	  {
+	    if (stack->isEmpty()) menu=0;
+	    else menu=stack->pop();
+	  }
+	  break;
+	}
+      cnt++;
+    }
+}
+//*****************************************************************************
+void MenuManager::appendMenus (KWaveMenuItem *newmenus)
+{
+  int num=bar->count();
+  int cnt=0;
+
+  KWavePopMenu *menu=0;
+  QStack <KWavePopMenu> *stack=new QStack<KWavePopMenu>();
+
+  while (newmenus[cnt].type!=0)
+    {
+      switch (newmenus[cnt].type)
+	{
+	case KMENU:
+	  {
+	    KWavePopMenu *newmenu=0;
+
+	    if (menu) newmenu=menu->findMenu (newmenus[cnt].name);
+	    else newmenu=this->findMenu (newmenus[cnt].name);
+	      
+	    if (!newmenu) //if menu is not already known, create a new menu
+		newmenu=new KWavePopMenu (newmenus[cnt].name,getUniqueId());
+
+	    if (newmenu)
+	      {
+		if (newmenus[cnt].id==-1) newmenus[cnt].id=newmenu->getId();
+
+		if (menu) menu->insertMenu (newmenu);	
+		else
+		  {
+		    bar->insertItem (klocale->translate(newmenus[cnt].name),newmenu,newmenus[cnt].id,num-2);
+		    menus.append (newmenu); //append to known list of top-level menus
+		  }
+		connect (newmenu,SIGNAL(activated(int)),this,SLOT(map(int)));
+
+		stack->push(menu);
+		menu=newmenu;
+	      }
+	  }
+	  break;
+	case KREF:
+	  {
+	    if (menu)
+	      {
+		if (newmenus[cnt].id==-1) newmenus[cnt].id=getIdRange (MENUMAX);
+		NumberedMenu *nummenu=findNumberedMenu ((char *)newmenus[cnt].name);   //get known numberedMenu
+
+		if (nummenu)
+		  {
+		    //insert current Menu to list of menus to be notified, when changes occur...
+		    nummenu->notifyMenu (menu);
+		    menu->setMemberId (newmenus[cnt].id); //remember starting id 
+		    nummenu->refresh ();
+		  }
+		else debug ("menu structure error : unknown numbered menu !:%s\n",newmenus[cnt].name);
+	      }
+	    else debug ("Menu structure error : References may not be top level\n");
+	  }
+	  break;
+	case KSEP:
+	  if (menu) menu->insertSeparator ();	
+	  break;
+
+	case KITEM:
+	  {
+	    if (menu)
+	      {
+		if (newmenus[cnt].id==-1) newmenus[cnt].id=getUniqueId ();
+		menu->insertItem (klocale->translate(newmenus[cnt].name),newmenus[cnt].id);
+		printf ("inserting %s with id %d\n",newmenus[cnt].name,newmenus[cnt].id);
+		if (newmenus[cnt].shortcut!=-1)
+		  menu->setAccel (newmenus[cnt].shortcut,newmenus[cnt].id);
+	      }
+	    else debug ("Menu Structure Error : Items may not be top level\n");
+	  }
+	  break;
+
+	case KEND:
+	  {
+	    if (stack->isEmpty()) menu=0;
+	    else menu=stack->pop();
+	  }
+	  break;
+	}
+      cnt++; //increase index to get next menu item
+    }
+}
+//*****************************************************************************
+void MenuManager::clearNumberedMenu (char *name)
+{
+
+  NumberedMenu *menu=findNumberedMenu (name);
+
+  if (menu) menu->clear();
+}
+//*****************************************************************************
+bool MenuManager::addNumberedMenu (char *name)
+//returns true, if menu is created from scratch, and false if menu already exists
+{
+  NumberedMenu *newmenu=findNumberedMenu (name);
+  if (newmenu) return false;
+
+  newmenu=new NumberedMenu (name);
+  numberedMenus.append (newmenu);
+  return true; 
+}
+//*****************************************************************************
+void MenuManager::addNumberedMenuEntry (char *name,char *entry)
+{
+  NumberedMenu *menu=findNumberedMenu (name);
+  if (menu) menu->addEntry (entry);
+  else debug ("could not find numbered Menu %s\n",name);
+}
+//*****************************************************************************
+NumberedMenu *MenuManager::findNumberedMenu (char *name)
+{
+  NumberedMenu *tmp=numberedMenus.first();
+  while (tmp)
+    {
+      if (strcmp(tmp->name(),name)==0) return tmp;
+      tmp=numberedMenus.next();
+    }
+
+    return 0;
+}
+//*****************************************************************************
+void MenuManager::map (int op)
+{
+  printf ("menu:%d\n",op);
+  emit id(op);
+}
+//*****************************************************************************
+int MenuManager::translateId (KWaveMenuItem *menus,int id)
+{
+  int cnt=0;
+
+  while (menus[cnt].type!=0)
+    {
+      switch  (menus[cnt].type)
+	{
+	case KITEM:
+	  if (menus[cnt].id==id)
+	    {
+	      id=menus[cnt].internalID;
+	      break;
+	    }
+	  break;
+	case KREF:
+	  if ((menus[cnt].id<=id)&&(menus[cnt].id+MENUMAX>id))
+	    {
+	      id=menus[cnt].internalID+id-menus[cnt].id;
+	      break;
+	    }
+	  break;
+	}
+      cnt++;
+    }
+  return id;
+}
+//*****************************************************************************
+int MenuManager::getIdRange (int num)
+{
+  int x=unique_menu_id;
+  unique_menu_id+=num;
+
+  return x;
+}
+//*****************************************************************************
+MenuManager::~MenuManager ()
+{
+}
+
<< < 1 2 3 4 (Page 4 of 4)