本文整理汇总了C++中ProjectItem类的典型用法代码示例。如果您正苦于以下问题:C++ ProjectItem类的具体用法?C++ ProjectItem怎么用?C++ ProjectItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProjectItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_treeView_clicked
void MainWindow::on_treeView_clicked(const QModelIndex &index)
{
auto item = (ProjectItem*) Workspace::Instance.GetProjectsModel()->itemFromIndex(index);
std::string name = item->GetName();
if (item->IsDocument())
{
ProjectItem* parent = (ProjectItem*) item->parent();
if (Workspace::Instance.GetCurrentProject()->GetName() == parent->GetName() &&
Workspace::Instance.GetCurrentDocument()->GetName() == item->GetName())
return;
Workspace::Instance.SetCurrent(parent->GetName(), item->GetName());
}
else
{
if (Workspace::Instance.GetCurrentProject()->GetName() == name)
return;
Workspace::Instance.SetCurrent(item->GetName());
}
RefreshImage();
on_actionFit_to_Window_triggered();
}
开发者ID:imilos,项目名称:Application-of-pattern-recognition-algorithms-in-neutron-dosimetry,代码行数:27,代码来源:mainwindow.cpp
示例2: _T
//----------------------------------------------------------------
wxXmlNode* ProjectItemFile::WriteNode()
/**
* \brief Writes a 'projectitem' xml element node.
* See class description for more information.
* \return The 'projectitem' xml element node.
**/
{
wxXmlNode* node = PenvHelper::CreateXmlNode(_T("projectitem"));
node->AddProperty(_T("name"), m_name);
node->AddProperty(_T("type"), _T("file"));
node->AddProperty(_T("virtual"), PenvHelper::CreateBoolean(m_virtual));
wxString parentpath;
if (m_parent->GetProjectParent() == NULL) {
ProjectItem* item = m_parent->GetProjectItemParent();
parentpath = item->GetPathString();
} else {
Project* project = m_parent->GetProjectParent();
parentpath = project->GetFileNameString();
}
wxXmlNode* filename = PenvHelper::CreateXmlNode(_T("filename"),
Path::MakeRelative(parentpath, m_filename.GetPath()));
PenvHelper::AddXmlChildNode(node, filename);
wxXmlNode* propnode = m_properties->WriteNode();
PenvHelper::AddXmlChildNode(node, propnode);
return (node);
}
示例3: imageFileInfo
void Workspace::AddDocument(string projectName, QString& imageFullPath, ProcessingOptions& options)
{
QFileInfo imageFileInfo(imageFullPath);
// Get project.
Project* project = m_Projects[projectName].get();
m_ProjectsPersistentState[projectName] = false;
QString projectDirPath = QString(project->GetDocumentsPath().c_str());
QDir projectDir(projectDirPath);
// Copy image to project dir.
QString dstImageFullPath = projectDir.absoluteFilePath(imageFileInfo.fileName());
QFile::copy(imageFullPath, dstImageFullPath);
// Get image name.
QString docNameQ = imageFileInfo.baseName();
std::string docName = Utils::StringQ2W(docNameQ);
// Add image to project.
Document* document = project->AddDocument(
docName,
Utils::StringQ2W(dstImageFullPath),
options);
// Add image to view model.
auto projRowItem = m_ProjectsModel.findItems(Utils::StringW2Q(projectName));
ProjectItem* projectItem = (ProjectItem*) projRowItem.first();
ProjectItem* docItem = new ProjectItem(docName, true);
QList<QStandardItem*> docRowItem;
docRowItem << docItem;
projectItem->appendRow(docItem);
SetCurrent(project, projectItem, document, docItem);
}
开发者ID:imilos,项目名称:Application-of-pattern-recognition-algorithms-in-neutron-dosimetry,代码行数:35,代码来源:workspace.cpp
示例4: ItemProperties
void ProjectFrame::ItemProperties()
{
ProjectItem *itm = prjTree->GetSelectedNode();
if (itm)
{
if (itm->ItemProperties())
prjTree->UpdateNode(itm);
}
}
示例5: sizeHint
QSize IconViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
ProjectItem* item = static_cast<ProjectItem*>(index.internalPointer());
if (item) {
QRect r = option.fontMetrics.boundingRect(QString(item->toString()));
return QSize(128 + 16, 128 + r.height() + 8);
}
return QSize();
}
示例6: GetActiveEditor
int ProjectFrame::SaveFile()
{
EditorView *vw = GetActiveEditor();
if (vw)
{
ProjectItem *itm = vw->GetItem();
if (itm)
return itm->SaveItem();
}
return 0;
}
示例7: OnFileMvdn
void FilelistOrder::OnFileMvdn(wxCommandEvent& evt)
{
int sel = fileList->GetSelection();
if (sel == wxNOT_FOUND)
return;
ProjectItem *p = (ProjectItem *)fileList->GetClientData(sel);
fileList->Delete(sel);
sel++;
fileList->Insert(p->GetName(), (unsigned int)sel, reinterpret_cast<void*>(p));
fileList->SetSelection(sel);
EnableUpDn();
}
示例8: SetCurrent
void Workspace::SetCurrent(std::string projectName, std::string documentName)
{
Project* proj = nullptr;
ProjectItem* projItem = nullptr;
Document* doc = nullptr;
ProjectItem* docItem = nullptr;
// Get project;
proj = m_Projects[projectName].get();
// Get project view item.
auto projRowItem = m_ProjectsModel.findItems(Utils::StringW2Q(projectName));
projItem = (ProjectItem*) projRowItem.first();
// If document is not specified, use first doc.
auto docs = proj->GetDocuments();
if (documentName.empty() && !docs.empty())
{
documentName = docs.front()->GetName();
}
// If there is document, get document and document view item.
if (!documentName.empty())
{
// Get document.
for (auto d : docs)
{
if (d->GetName().compare(documentName) == 0)
{
doc = d;
break;
}
}
// Get document view item.
for (int i = 0; i < (int) docs.size(); i++)
{
ProjectItem* di = (ProjectItem*) projItem->child(i);
if(di->GetName().compare(documentName) == 0)
{
docItem = di;
break;
}
}
}
SetCurrent(proj, projItem, doc, docItem);
}
开发者ID:imilos,项目名称:Application-of-pattern-recognition-algorithms-in-neutron-dosimetry,代码行数:48,代码来源:workspace.cpp
示例9: while
void Project::RecursiveAdd(wxXmlNode *xmlNode, ProjectTreePtr &ptp, ProjectTreeNode *nodeParent)
{
// Build the key for this node
std::list<wxString> nameList;
wxXmlNode *parent = xmlNode->GetParent();
while ( parent ) {
nameList.push_front(parent->GetPropVal(wxT("Name"), wxEmptyString));
parent = parent->GetParent();
}
wxString key;
for (size_t i=0; i<nameList.size(); i++) {
key += nameList.front();
key += wxT(":");
nameList.pop_front();
}
key += xmlNode->GetPropVal(wxT("Name"), wxEmptyString);
// Create the tree node data
ProjectItem item;
if ( xmlNode->GetName() == wxT("Project") ) {
item = ProjectItem(key, xmlNode->GetPropVal(wxT("Name"), wxEmptyString), wxEmptyString, ProjectItem::TypeProject);
} else if ( xmlNode->GetName() == wxT("VirtualDirectory") ) {
item = ProjectItem(key, xmlNode->GetPropVal(wxT("Name"), wxEmptyString), wxEmptyString, ProjectItem::TypeVirtualDirectory);
} else if ( xmlNode->GetName() == wxT("File") ) {
wxFileName filename(xmlNode->GetPropVal(wxT("Name"), wxEmptyString));
//convert this file name to absolute path
DirSaver ds;
::wxSetWorkingDirectory(m_fileName.GetPath());
filename.MakeAbsolute();
item = ProjectItem(key, filename.GetFullName(), filename.GetFullPath(), ProjectItem::TypeFile);
} else {
// un-recognised or not viewable item in the tree,
// skip it and its children
return;
}
ProjectTreeNode *newNode = ptp->AddChild(item.Key(), item, nodeParent);
// This node has children, add them as well
wxXmlNode *children = xmlNode->GetChildren();
while ( children ) {
RecursiveAdd(children, ptp, newNode);
children = children->GetNext();
}
SetModified(true);
}
示例10: while
void FilelistOrder::OnOK(wxCommandEvent& evt)
{
ProjectItem *itm;
int count = (int)fileList->GetCount();
int index = 0;
while (index < count)
{
itm = (ProjectItem *) fileList->GetClientData(index);
itm->AddRef();
prjTree->RemoveNode(itm);
prjTree->AddNode(itm);
itm->Release();
index++;
}
theProject->SetChange(1);
EndModal(1);
}
示例11: Refresh
void ScoreErrorsDlg::Refresh()
{
itmSel.ResetContent();
ProjectItem *pi = prjTree->FirstChild(theProject->nlInfo);
while (pi)
{
if (pi->GetType() == PRJNODE_NOTEFILE)
{
int ndx = itmSel.AddString(pi->GetName());
itmSel.SetItemDataPtr(ndx, (void*)pi);
}
pi = prjTree->NextSibling(pi);
}
itmSel.SetCurSel(0);
ShowErrors();
}
示例12: Save
int InstrList::Save(XmlSynthElem *node)
{
XmlSynthElem *child = node->AddChild("instrlib");
ProjectItem *pi = prjTree->FirstChild(this);
while (pi)
{
if (pi->GetType() == PRJNODE_INSTR)
{
XmlSynthElem *instr = child->AddChild("instr");
InstrItem *ii = (InstrItem *) pi;
ii->Save(instr);
delete instr;
}
pi = prjTree->NextSibling(pi);
}
delete child;
return 0;
}
示例13: CenterOnParent
void FilelistOrder::OnInitDialog(wxInitDialogEvent& evt)
{
CenterOnParent();
if (pi)
{
ProjectItem *ch = prjTree->FirstChild(pi);
while (ch)
{
fileList->Append(ch->GetName(), reinterpret_cast<void*>(ch));
ch = prjTree->NextSibling(ch);
}
}
if (fileList->GetCount() > 0)
fileList->SetSelection(0);
EnableUpDn();
}
示例14: RemoveItem
void ProjectFrame::RemoveItem()
{
ProjectItem *itm = prjTree->GetSelectedNode();
if(itm)
{
bsString prompt;
prompt = "Remove item '";
prompt += itm->GetName();
prompt += "'?";
if (prjFrame->Verify(prompt, "Verify..."))
{
if (itm->RemoveItem())
{
CloseEditor(itm);
prjTree->RemoveNode(itm);
theProject->SetChange(1);
}
}
}
}
示例15: CenterOnParent
void WavetableSelectDlg::OnInitDialog(wxInitDialogEvent& evt)
{
CenterOnParent();
wxWindow *frm = FindWindow("IDC_WT_GRAPH");
if (!frm)
return;
wxPoint pos = frm->GetPosition();
wxSize siz = frm->GetSize();
frm->Destroy();
plotter = new WavetableDraw(this, 99, pos, siz);
plotter->index = initSelect;
lst = (wxListBox*)FindWindow("IDC_WT_LIST");
lst->Append("Sin", (void*)0);
lst->Append("Sawtooth (sum)", (void*)1);
lst->Append("Square (sum)", (void*)2);
lst->Append("Triangle (sum)", (void*)3);
lst->Append("Pulse (sum)", (void*)4);
lst->Append("Sawtooth (direct)", (void*)5);
lst->Append("Square (direct)", (void*)6);
lst->Append("Triangle (direct)", (void*)7);
lst->Append("Sawtooth (positive)", (void*)8);
lst->Append("Triangle (positive)", (void*)9);
int selected = initSelect;
ProjectItem *pi = prjTree->FirstChild(theProject->synthInfo);
while (pi)
{
if (pi->GetType() == PRJNODE_WVTABLE)
{
WavetableItem *wi = (WavetableItem*)pi;
int index = lst->Append(wi->GetName(), (void*)(long)wi->GetID());
if (wi->GetID() == initSelect)
selected = index;
}
pi = prjTree->NextSibling(pi);
}
if ((unsigned int)selected < lst->GetCount())
lst->SetSelection(selected);
}