QMimeSource* UMLClipboard::copy(bool fromView/*=false*/) { //Clear previous copied data m_AssociationList.clear(); m_ItemList.clear(); m_ObjectList.clear(); m_ViewList.clear(); UMLDrag *data = 0; QPixmap* png = 0; UMLListView * listView = UMLApp::app()->getListView(); UMLListViewItemList selectedItems; selectedItems.setAutoDelete(false); if(fromView) { m_type = clip4; UMLView *view = UMLApp::app()->getCurrentView(); view->checkSelections(); if(!view->getSelectedWidgets(m_WidgetList)) { return 0; } //if there is no selected widget then there is no copy action if(!m_WidgetList.count()) { return 0; } m_AssociationList = view->getSelectedAssocs(); view->copyAsImage(png); } else { //if the copy action is being performed from the ListView if(!listView->getSelectedItems(selectedItems)) { return 0; } //Set What type of copy operation are we performing and //also fill m_ViewList with all the selected Diagrams setCopyType(selectedItems); //if we are copying a diagram or part of a diagram, select the items //on the ListView that correspond to a UseCase, Actor or Concept //in the Diagram if(m_type == clip2) { //Fill the member lists with all the object and stuff to be copied //to the clipboard selectedItems.clear(); //For each selected view select all the Actors, USe Cases and Concepts //widgets in the ListView for (UMLViewListIt vit(m_ViewList); vit.current(); ++vit) { UMLObjectList objects = vit.current()->getUMLObjects(); for (UMLObjectListIt oit(objects); oit.current(); ++oit) { UMLObject *o = oit.current(); UMLListViewItem *item = listView->findUMLObject(o); if(item) { listView->setSelected(item, true); } } } if(!listView->getSelectedItems(selectedItems)) { return 0; } } if(!fillSelectionLists(selectedItems)) { return 0; } } int i =0; switch(m_type) { case clip1: data = new UMLDrag(m_ObjectList); break; case clip2: data = new UMLDrag(m_ObjectList, m_ItemList, m_ViewList); break; case clip3: data = new UMLDrag(m_ItemList); break; case clip4: if(png) { UMLView *view = UMLApp::app()->getCurrentView(); data = new UMLDrag(m_ObjectList, m_WidgetList, m_AssociationList, *png, view->getType()); } else { return 0; } break; case clip5: data = new UMLDrag(m_ObjectList, i); // The int i is used to differentiate // which UMLDrag constructor gets called. break; } return (QMimeSource*)data; }
//============================================================================== AnalysisSelectionComponent::AnalysisSelectionComponent(ValueTree& analyserTree_,AudioAnalysisManager *analyser_) : analyser(analyser_), analyserTree(analyserTree_) { setSize(500,300); collectionList.addChangeListener(this); analysisList.addChangeListener(this); addAndMakeVisible(&collectionList); addAndMakeVisible(&analysisList); Font f(14,Font::bold); analysisNameLabel.setFont(f); technicalDescriptionText.setFont(12); simpleDescriptionText.setFont(12); technicalDescriptionText.setMinimumHorizontalScale(1.0); simpleDescriptionText.setMinimumHorizontalScale(1.0); simpleDescriptionText.setJustificationType(Justification::topLeft); technicalDescriptionText.setJustificationType(Justification::topLeft); addressPatternLabel.setText("Address Pattern:", dontSendNotification); addressPatternLabel.setFont(Font(11,Font::bold)); authorNameLabel.setText("Written by:", dontSendNotification); authorNameLabel.setFont(Font(11,Font::bold)); technicalDescriptionLabel.setText("Technical Description:", dontSendNotification); technicalDescriptionLabel.setFont(Font(11,Font::bold)); simpleDescriptionLabel.setText("Simple Description:", dontSendNotification); simpleDescriptionLabel.setFont(Font(11,Font::bold)); collectionLabel.setText("Collection:", dontSendNotification); collectionLabel.setFont(Font(11,Font::bold)); authorNameText.setFont(Font(11)); addressPatternText.setFont(Font(11)); technicalDescriptionText.setFont(Font(11)); simpleDescriptionText.setFont(Font(11)); collectionText.setFont(Font(10,Font::italic)); addAndMakeVisible(&analysisNameLabel); addAndMakeVisible(&authorNameLabel); addAndMakeVisible(&addressPatternLabel); addAndMakeVisible(&technicalDescriptionLabel); addAndMakeVisible(&simpleDescriptionLabel); addAndMakeVisible(&collectionLabel); addAndMakeVisible(&authorNameText); addAndMakeVisible(&addressPatternText); addAndMakeVisible(&technicalDescriptionText); addAndMakeVisible(&simpleDescriptionText); addAndMakeVisible(&collectionText); fillSelectionLists(); }