flowcodeview.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include "flowcodedocument.h"
00012 #include "flowcodeview.h"
00013 #include "ktechlab.h"
00014 #include "viewiface.h"
00015 
00016 #include <kiconloader.h>
00017 #include <klocale.h>
00018 #include <kpopupmenu.h>
00019 #include <qwhatsthis.h>
00020 
00021 FlowCodeView::FlowCodeView( FlowCodeDocument * flowCodeDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name )
00022         : ICNView( flowCodeDocument, viewContainer, viewAreaId, name )
00023 {
00024         KActionCollection * ac = actionCollection();
00025         
00026         //BEGIN Convert To * Actions
00027         KToolBarPopupAction * pa = new KToolBarPopupAction( i18n("Convert to ..."), "fork", 0, 0, 0, ac, "program_convert" );
00028         pa->setDelayed(false);
00029         
00030         KPopupMenu * m = pa->popupMenu();
00031         
00032         m->insertTitle( i18n("Convert to") );
00033         m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_microbe", KIcon::Small ), i18n("Microbe"), FlowCodeDocument::MicrobeOutput );
00034         m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_assembly", KIcon::Small ), i18n("Assembly"), FlowCodeDocument::AssemblyOutput );
00035         m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_hex", KIcon::Small ), i18n("Hex"), FlowCodeDocument::HexOutput );
00036         m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_pic", KIcon::Small ), i18n("PIC (upload)"), FlowCodeDocument::PICOutput );
00037         connect( m, SIGNAL(activated(int)), flowCodeDocument, SLOT(slotConvertTo(int)) );
00038         //END Convert To * Actions
00039         
00040         
00041         
00042         
00043 //      new KAction( i18n("Convert to Microbe"), "convert_to_microbe", Qt::Key_F7, flowCodeDocument, SLOT(convertToMicrobe()), ac, "tools_to_microbe" );
00044 //      new KAction( i18n("Convert to Assembly"), "convert_to_assembly", Qt::Key_F8, flowCodeDocument, SLOT(convertToAssembly()), ac, "tools_to_assembly" );
00045 //      new KAction( i18n("Convert to Hex"), "convert_to_hex", Qt::Key_F9, flowCodeDocument, SLOT(convertToHex()), ac, "tools_to_hex" );
00046 //      new KAction( i18n("Upload PIC Program"), "convert_to_pic", 0, flowCodeDocument, SLOT(convertToPIC()), ac, "tools_to_pic" );
00047         
00048         
00049         
00050         
00051         setXMLFile( "ktechlabflowcodeui.rc", true );
00052         
00053         QWhatsThis::add( this, i18n(
00054                         "Construct a FlowCode document by dragging FlowParts from the list on the left. All FlowCharts require an initial \"Start\" part, of which there can only be one.<br><br>"
00055                                         
00056                         "Some FlowParts, such as Subroutines, act as a container element for other FlowParts. Drag the items in or out of a container as appropritate. The container that will become the parent of the part being dragged is indicated by being selected.<br><br>"
00057                                         
00058                         "Note that connections cannot be made between FlowParts in different containers, or at different levels."
00059                                                            ) );
00060         
00061         m_pViewIface = new FlowCodeViewIface(this);
00062 }
00063 
00064 FlowCodeView::~FlowCodeView()
00065 {
00066         delete m_pViewIface;
00067 }
00068 
00069 void FlowCodeView::dragEnterEvent( QDragEnterEvent * e )
00070 {
00071         ICNView::dragEnterEvent(e);
00072         if ( e->isAccepted() )
00073                 return;
00074         
00075         e->accept( e->provides("ktechlab/flowpart") );
00076 }
00077 
00078 #include "flowcodeview.moc"

Generated on Tue May 8 17:05:29 2007 for KTechLab by  doxygen 1.5.1