2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *   qlo10k1  -  GUI  frontend  for  ld10k1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *   Copyright  ( c )  2004  by  Peter  Zubaj 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    This  program  is  free  software ;  you  can  redistribute  it  and / or  modify 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    it  under  the  terms  of  the  GNU  General  Public  License  as  published  by 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    the  Free  Software  Foundation ;  either  version  2  of  the  License ,  or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    GNU  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *    along  with  this  program ;  if  not ,  write  to  the  Free  Software 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-14 14:46:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *    Foundation ,  Inc . ,  51  Franklin  Street ,  Fifth  Floor ,  Boston ,  MA   02110 - 1301   USA 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <qpopupmenu.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <qmessagebox.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <qfiledialog.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "app_global.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "routingwidget.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "structure.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "structure_io.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "structure_link.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "structure_patch.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "strglobal.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "ld10k1file.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								extern  QString  gLastFileDir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								void  RoutingWidget : : openObjectMenuAt ( RSItemBaseWithType  * item ,  MenuMode  mm ,  int  xp ,  int  yp ,  int  mxp ,  int  myp ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QPopupMenu  * contextMenu  =  new  QPopupMenu ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									enum  Action  { Refresh ,  ClearDSP ,  Delete ,  Rename ,  Disconnect ,  DelPoint ,  AddPoint ,  Connect ,  Save } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  rn  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( mm  = =  MenuNone ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Refresh " ) ,  Refresh ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										//contextMenu->insertItem(tr("&AutoArange")/*, this, SLOT(menuQuitActivated(int))*/);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Clear DSP " ) ,  ClearDSP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( mm  = =  MenuObjects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Delete (Unload) " ) ,  Delete ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( mm  = =  MenuIO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										//contextMenu->insertItem(tr("&Rename"), Rename);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  isConnected  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( item - > type ( )  = =  RSItemBaseWithType : : Out ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											isConnected  =  item - > getIO ( false ,  0 ) - > getConnectedTo ( )  ! =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											isConnected  =  item - > getIO ( true ,  0 ) - > getConnectedTo ( )  ! =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( isConnected ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											contextMenu - > insertItem ( tr ( " D&isconnect " ) ,  Disconnect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertSeparator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Delete " ) ,  Delete ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( mm  = =  MenuLink ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  pn  =  item - > getHandlePointNum ( xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( pn  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											contextMenu - > insertItem ( tr ( " D&elete point " ) ,  DelPoint ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( pn  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											contextMenu - > insertItem ( tr ( " A&dd point " ) ,  AddPoint ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( item - > type ( )  = =  RSItemBaseWithType : : Link ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											StrLink  * lnk  =  ( StrLink  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rn  =  lnk - > getRouteNumFromPoint ( xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( rn  > =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												RSItemIO  * io  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												RSItemBaseWithType  * own  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												io  =  lnk - > getRoutePoint ( rn ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( io ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													own  =  ( RSItemBaseWithType * ) io - > getOwner ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( own  & &  ( own - > type ( )  = =  RSItemBaseWithType : : Patch ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													  contextMenu - > insertItem ( tr ( " D&isconnect " ) ,  Disconnect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertSeparator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Delete " ) ,  Delete ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( mm  = =  MenuPatch ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										//contextMenu->insertItem(tr("&Rename"), Rename);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RSItemIO  * io  =  item - > getIOAtPoint ( xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( io ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											//contextMenu->insertItem(tr("&IO Rename"), Rename);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( io - > getConnectedTo ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												contextMenu - > insertItem ( tr ( " D&isconnect " ) ,  Disconnect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												contextMenu - > insertItem ( tr ( " &Connect " ) ,  Connect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											contextMenu - > insertItem ( tr ( " &Save " ) ,  Save ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertSeparator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										contextMenu - > insertItem ( tr ( " &Unload " ) ,  Delete ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  id  =  contextMenu - > exec ( QPoint ( mxp ,  myp ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									delete  contextMenu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( id  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( id  = =  AddPoint ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										StrLink  * l  =  ( StrLink  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( l - > addSegmentPoint ( xp ,  yp ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											l - > updateContents ( drawing ,  getZoomLevel ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  DelPoint ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										StrLink  * l  =  ( StrLink  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// FIXME - update before del
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										l - > updateContents ( drawing ,  getZoomLevel ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										l - > delSegmentPoint ( l - > getHandlePointNum ( xp ,  yp ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										l - > calcSize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  Delete ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										drawing - > deleteAllSelected ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										structure - > loadFromLD ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  Connect ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										StrPatch  * p  =  ( StrPatch  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RSItemIO  * pio  =  p - > getIOAtPoint ( xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( pio ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											drawing - > startLinkDrag ( pio ,  xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  Disconnect ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RSItemIO  * io  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( item - > type ( )  = =  RSItemBaseWithType : : Patch ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											StrPatch  * p  =  ( StrPatch  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											io  =  p - > getIOAtPoint ( xp ,  yp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											StrLink  * l  =  io - > getConnectedTo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// FIXME - update before disconnect
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											l - > updateContents ( drawing ,  getZoomLevel ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( err  =  structure - > disconnectFromLink ( io ) )  <  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											  QMessageBox : : critical ( 0 ,  APP_NAME ,  QString ( " Couldn't disconnect ! \n (ld10k1 error:%1) " ) . arg ( structure - > errorStr ( err ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( item - > type ( )  = =  RSItemBaseWithType : : In ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												StrInput  * in  =  ( StrInput  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												io  =  in - > getIO ( true ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( item - > type ( )  = =  RSItemBaseWithType : : Out ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												StrOutput  * out  =  ( StrOutput  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												io  =  out - > getIO ( false ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( item - > type ( )  = =  RSItemBaseWithType : : FX ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												StrFX  * fx  =  ( StrFX  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												io  =  fx - > getIO ( true ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if ( io ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												StrLink  * l  =  io - > getConnectedTo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												structure - > deleteOneLink ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												structure - > loadFromLD ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												drawing - > updateContents ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( item - > type ( )  = =  RSItemBaseWithType : : Link ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												StrLink  * lnk  =  ( StrLink  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( rn  > =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												{   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													io  =  lnk - > getRoutePoint ( rn ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( io ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														RSItemBaseWithType  * own  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														own  =  ( RSItemBaseWithType * ) io - > getOwner ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														if ( own  & &  ( own - > type ( )  = =  RSItemBaseWithType : : Patch ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															if  ( ( err  =  structure - > disconnectFromLink ( io ) )  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																QMessageBox : : critical ( 0 ,  APP_NAME ,  QString ( " Couldn't disconnect ! \n (ld10k1 error:%1) " ) . arg ( structure - > errorStr ( err ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															drawing - > updateContents ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  ClearDSP ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										structure - > clearDSP ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										drawing - > updateContents ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  Refresh ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										structure - > loadFromLD ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										drawing - > updateContents ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( id  = =  Save ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										StrPatch  * p  =  ( StrPatch  * ) item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QFileDialog  * fd  =  new  QFileDialog ( this ,  " file dialog " ,  TRUE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fd - > setMode ( QFileDialog : : AnyFile ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fd - > setFilter ( " ld10k1 Native effect files (*.ld10k1) " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										fd - > setCaption ( " Save patch " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fd - > setDir ( gLastFileDir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QString  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( fd - > exec ( )  = =  QDialog : : Accepted ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fileName  =  fd - > selectedFile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											gLastFileDir  =  fd - > dirPath ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											delete  fd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! fileName . endsWith ( " .ld10k1 " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fileName  + =  " .ld10k1 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( QFile : : exists ( fileName ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-06-03 12:31:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( QMessageBox : : question ( 0 ,  APP_NAME ,  QString ( " File with name %1 exists. Overwrite ? " ) . arg ( fileName ) ,  QMessageBox : : Yes ,  QMessageBox : : Cancel )  ! =  QMessageBox : : Yes ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-18 16:42:48 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											LD10k1File  * pf  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( err  =  structure - > get ( p - > num ( ) ,  & pf ) )  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												QMessageBox : : critical ( 0 ,  APP_NAME ,  QString ( " Couldn't get patch ! \n (ld10k1 error:%1) " ) . arg ( structure - > errorStr ( err ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( err  =  pf - > SaveToFile ( fileName ) )  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												QMessageBox : : critical ( 0 ,  APP_NAME ,  QString ( " Couldn't save patch \n (ld10k1 error:%1) " ) . arg ( structure - > errorStr ( err ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											delete  pf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											delete  fd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}