00001
00002
00003
00004
00005
00006
00007
00008
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
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
00039
00040
00041
00042
00043
00044
00045
00046
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"