Exemplo n.º 1
0
////////////////// Project Functions //////////////////////////////
int ProjectFrame::QuerySaveProject()
{
	int res = Verify("Project has unsaved changes. Save?", "Wait...");
	if (res == 1)
		return SaveProject();
	return res;
}
Exemplo n.º 2
0
static void OnSaveProject()
{
    if( AData().IsProjectSet() )
        SaveProject();
    else
        OnSaveAsProject();
}
Exemplo n.º 3
0
void CFileView::OnDestroy()
{
	CDockablePane::OnDestroy();

	// TODO: 在此处添加消息处理程序代码
	SaveProject();
}
Exemplo n.º 4
0
void ProjectFile::SetAttribute(QString parentTag, QString childTag, QString attribute, QString value)
{
	QDomElement parentTagElement = documentElement().namedItem(parentTag).toElement();
	if (parentTagElement.isNull())
	{
		parentTagElement = createElement(parentTag);
		documentElement().appendChild(parentTagElement);
	}

	QDomElement childTagElement = parentTagElement.namedItem(childTag).toElement();
	if (childTagElement.isNull())
	{
		childTagElement = createElement(childTag);
		parentTagElement.appendChild(childTagElement);
	}

	QDomNode attributeNode = childTagElement.namedItem(value);
	if (!attributeNode.isNull())
	{
		childTagElement.removeChild(attributeNode);
	}

	QDomElement attributeElement = createElement(attribute);
	attributeElement.appendChild(createTextNode(value));
	childTagElement.appendChild(attributeElement);

	SaveProject();
}
Exemplo n.º 5
0
void CPackageToolDoc::OnCloseDocument()
{
	// TODO: 在此添加专用代码和/或调用基类

	//保存缺省项目
	SaveProject(string(""));

	CDocument::OnCloseDocument();
}
Exemplo n.º 6
0
void CFileView::OnProjectClose()
{
	if(CGlobalVariable::m_bIsProjectExist == false)
		return;

	g_pMainFrame->OnFileCloseAll();
	SaveProject();
	m_wndFileView.DeleteAllItems();
	CGlobalVariable::m_bIsProjectExist = false;
}
Exemplo n.º 7
0
void ProjectFile::SetAttribute(QString attribute, QString value)
{
	QDomNode attributeNode = documentElement().namedItem(attribute);
	if (!attributeNode.isNull())
	{
		documentElement().removeChild(attributeNode);
	}

	QDomElement attributeElement = createElement(attribute);
	attributeElement.appendChild(createTextNode(value));
	documentElement().appendChild(attributeElement);

	SaveProject();
}
Exemplo n.º 8
0
bool ProjectManager::SaveAllProjects()
{
    m_ui->FreezeTree();
    int prjCount = m_pProjects->GetCount();
    int count = 0;
    for (int i = 0; i < prjCount; ++i)
    {
        cbProject* project = m_pProjects->Item(i);
        if (project)
        {
            bool isModified = project->GetModified();
            if (isModified && SaveProject(project))
                ++count;
        }
    }
    m_ui->UnfreezeTree(true);
    return count == prjCount;
}
Exemplo n.º 9
0
bool ProjectFile::AddSubdomain(QString newName)
{
	QDomElement currentSubdomain = documentElement().firstChildElement(TAG_SUB_DOMAIN);
	while (!currentSubdomain.isNull())
	{
		QDomElement nameElement = currentSubdomain.namedItem(ATTR_NAME).toElement();
		if (nameElement.text() == newName)
		{
			if (!WarnSubdomainExists(newName))
			{
				return false;
			} else {
				documentElement().removeChild(currentSubdomain);
				break;
			}
		}

		currentSubdomain = currentSubdomain.nextSiblingElement(TAG_SUB_DOMAIN);
//		{
//			QDomNode attributeNode = currentSubdomain.namedItem(attribute);
//			if (!attributeNode.isNull())
//			{
//				currentSubdomain.removeChild(attributeNode);
//			}

//			QDomElement attributeElement = createElement(attribute);
//			attributeElement.appendChild(createTextNode(value));
//			currentSubdomain.appendChild(attributeElement);
//			break;
//		}
	}

	QDomElement newSubdomain = createElement(TAG_SUB_DOMAIN);
	QDomElement newSubdomainName = createElement(ATTR_NAME);
	documentElement().appendChild(newSubdomain);
	newSubdomain.appendChild(newSubdomainName);
	newSubdomainName.appendChild(createTextNode(newName));

	SaveProject();

	return true;
}
Exemplo n.º 10
0
void ProjectFile::SetAttributeSubdomain(QString subdomainName, QString attribute, QString value)
{
	QDomElement currentSubdomain = documentElement().firstChildElement(TAG_SUB_DOMAIN);
	while (!currentSubdomain.isNull())
	{
		QDomElement nameElement = currentSubdomain.namedItem(ATTR_NAME).toElement();
		if (nameElement.text() == subdomainName)
		{
			QDomNode attributeNode = currentSubdomain.namedItem(attribute);
			if (!attributeNode.isNull())
			{
				currentSubdomain.removeChild(attributeNode);
			}

			QDomElement attributeElement = createElement(attribute);
			attributeElement.appendChild(createTextNode(value));
			currentSubdomain.appendChild(attributeElement);
			break;
		}
		currentSubdomain = currentSubdomain.nextSiblingElement(TAG_SUB_DOMAIN);
	}

	SaveProject();
}
Exemplo n.º 11
0
void CPackageToolDoc::OnSaveCurrProject()
{
	// TODO: 在此添加命令处理程序代码
	SaveProject(string(""));
}
Exemplo n.º 12
0
bool ProjectManager::SaveActiveProject()
{
    return SaveProject(m_pActiveProject);
}
Exemplo n.º 13
0
 void MdiEditor::createMenuBar()
 {
	pro_menu=menuBar()->addMenu("Project");
	new_pro=new QAction("&New Project", this);
	save_pro=new QAction("&Save Project", this);
	pro_menu->addAction(new_pro);
	pro_menu->addAction(save_pro);

	setting_menu=menuBar()->addMenu("Settings");
	mod_para=new QAction("&Parameters", this);
	setting_menu->addAction(mod_para);
	mod_mask=new QAction("&Masks", this);
	setting_menu->addAction(mod_mask);
	mod_layer=new QAction("&Layers", this);
	setting_menu->addAction(mod_layer);


	view_menu=menuBar()->addMenu("View");
	mask_view=view_menu->addMenu("Mask");
	show_mask=new QAction("&Show", this);
	mask_view->addAction(show_mask);
	hide_mask=new QAction("&Hide", this);
	mask_view->addAction(hide_mask);

	result_view=view_menu->addMenu("Results");
	show_halfway=new QAction("&Halfway Image", this);
	result_view->addAction(show_halfway);
	show_error=new QAction("&Error Image", this);
	result_view->addAction(show_error);

	color_view=view_menu->addMenu("Color from");
	show_image1=new QAction("&Image1", this);
	color_view->addAction(show_image1);
	show_image12=new QAction("&Both image1 & image2", this);
	color_view->addAction(show_image12);
	show_image2=new QAction("&Image2", this);
	color_view->addAction(show_image2);

	layer_view=view_menu->addMenu("Layer");
	show_multilayer=new QAction("&Multilayer", this);
	layer_view->addAction(show_multilayer);

	alg_menu=menuBar()->addMenu("Algorithm");
	cpu_alg=new QAction("&CPU", this);
	gpu_alg=new QAction("&GPU", this);
	alg_menu->addAction(cpu_alg);
	alg_menu->addAction(gpu_alg);


	show_mask->setCheckable(true);
	hide_mask->setCheckable(true);
	show_halfway->setCheckable(true);
	show_error->setCheckable(true);
	show_image1->setCheckable(true);
	show_image12->setCheckable(true);
	show_image2->setCheckable(true);
	show_multilayer->setCheckable(true);
	cpu_alg->setCheckable(true);
	gpu_alg->setCheckable(true);

	//right menu
	confirm=new QAction("&confirm",this);
	cancel=new QAction("&cancel",this);

	//signal
	connect(new_pro,SIGNAL(triggered()),this,SLOT(NewProject()));
	connect(save_pro,SIGNAL(triggered()),this,SLOT(SaveProject()));
	connect(mod_para,SIGNAL(triggered()),this,SLOT(ModifyPara()));
	connect(mod_mask,SIGNAL(triggered()),this,SLOT(ModifyMask()));
	connect(show_mask,SIGNAL(triggered()),this,SLOT(ShowMask()));
	connect(hide_mask,SIGNAL(triggered()),this,SLOT(HideMask()));
	connect(show_halfway,SIGNAL(triggered()),this,SLOT(ShowHalfway()));
	connect(show_error,SIGNAL(triggered()),this,SLOT(ShowError()));
	connect(show_image1,SIGNAL(triggered()),this,SLOT(ColorFromImage1()));
	connect(show_image12,SIGNAL(triggered()),this,SLOT(ColorFromImage12()));
	connect(show_image2,SIGNAL(triggered()),this,SLOT(ColorFromImage2()));
	connect(confirm,SIGNAL(triggered()),this,SLOT(Confirm()));
	connect(cancel,SIGNAL(triggered()),this,SLOT(Cancel()));
	connect(mod_layer,SIGNAL(triggered()),this,SLOT(ModifyLayer()));
	connect(show_multilayer,SIGNAL(triggered()),this,SLOT(MultyLayer()));
	connect(cpu_alg,SIGNAL(triggered()),this,SLOT(CPU_Alg()));
	connect(gpu_alg,SIGNAL(triggered()),this,SLOT(GPU_Alg()));


 }
Exemplo n.º 14
0
void Autosave::OnTimer(wxTimerEvent& e)
{
    if(e.GetId() == 10000)
    {
        int method = Manager::Get()->GetConfigManager(_T("autosave"))->ReadInt(_T("method"));
        bool allProjects = Manager::Get()->GetConfigManager(_T("autosave"))->ReadBool(_T("all_projects"), true);
        bool doWorkspace = Manager::Get()->GetConfigManager(_T("autosave"))->ReadBool(_T("do_workspace"), true);
        ProjectManager *pm = Manager::Get()->GetProjectManager();
        if(pm)// && pm->GetActiveProject())
        {
            if (allProjects)
            {
                ProjectsArray *projects = pm->GetProjects();
                for (size_t ii = 0; ii < projects->GetCount(); ++ii)
                    SaveProject((*projects)[ii], method);
            }
            else if(cbProject *p = pm->GetActiveProject())
                SaveProject(p, method);

            cbWorkspace *workspace = pm->GetWorkspace();
            if (doWorkspace && workspace && workspace->GetModified())
            {
                switch(method)
                {
                    case 0:
                        if(::wxRenameFile(workspace->GetFilename(), workspace->GetFilename() + _T(".bak")))
                            workspace->Save();
                        break;
                    case 1:
                        workspace->Save();
                        break;
                    case 2:
                    case 3:
                    {
                        WorkspaceLoader loader;
                        loader.Save(workspace->GetTitle(), workspace->GetFilename() + wxT(".save"));
                        workspace->SetModified(true);
                        break;
                    }
                    default:
                        break;
                }
            }
        }
    }
    else if(e.GetId() == 20000)
    {
        int method = Manager::Get()->GetConfigManager(_T("autosave"))->ReadInt(_T("method"));
        EditorManager* em = Manager::Get()->GetEditorManager();

        if(em)
        {
            for(int i = 0; i < em->GetEditorsCount(); ++i)
            {
                cbEditor* ed = em->GetBuiltinEditor(em->GetEditor(i));
                if(ed && ed->GetModified())
                {
                    wxFileName fn(ed->GetFilename());
                    switch(method)
                    {
                        case 0:
                        {
                            if(::wxRenameFile(fn.GetFullPath(), fn.GetFullPath() + _T(".bak")))
                                cbSaveToFile(fn.GetFullPath(), ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom());
                            break;
                        }
                        case 1:
                        {
                            ed->Save();
                            break;
                        }
                        case 2:
                        {
                            cbSaveToFile(fn.GetFullPath() + _T(".save"), ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom());
                            ed->SetModified(); // the "real" file has not been saved!
                            break;
                        }
                        case 3:
                        {
                            wxString tmp1;
                            wxString tmp2;

                            for(unsigned int revisions = 8; revisions; --revisions)
                            {
                                tmp1.Printf(_T("%s/%s.%u.%s"), fn.GetPath().c_str(), fn.GetName().c_str(), revisions,   fn.GetExt().c_str());
                                tmp2.Printf(_T("%s/%s.%u.%s"), fn.GetPath().c_str(), fn.GetName().c_str(), revisions+1, fn.GetExt().c_str());

                                if(::wxFileExists(tmp2))
                                    ::wxRemoveFile(tmp2);
                                if(::wxFileExists(tmp1))
                                    ::wxRenameFile(tmp1, tmp2);
                            }

                            tmp1.Printf(_T("%s/%s.1.%s"), fn.GetPath().c_str(), fn.GetName().c_str(), fn.GetExt().c_str());

                            cbSaveToFile(tmp1, ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom());
                            ed->SetModified(); // the "real" file has not been saved!
                            break;
                        }
                        default:
                            break;
                    }
                }

            }
        }
    }

}
Exemplo n.º 15
0
void filemenu(int mode)
{
	getstats(mode);
	if (button(100,100,170,120,"OPTIMIZE",9,13,base2,false,mode)==DDgui_LeftClick && mode!=DD_AfterCheck) { optimizeproject(); waitleftbutton=true; }
	if (button(100,121,170,141,"TextureO",9,13,base2,false,mode)==DDgui_LeftClick && mode!=DD_AfterCheck) { savetextureusefile(); waitleftbutton=true; }
	if (mode==DD_Draw)
	{
		glColor4f(buttontextlit);
		rectangle(661,120,775,264);
	}	  
	if (mode==DD_Check)
		if (leftclickinwindow(661,121,774,263) && mouseinwindow(661,121,774,260)) fscnselected=min(fscnbarpos+(my-121) / 10,filenum(prjlist)-1);
	if ((mode ==DD_Check) && mouseinwindow(661,121,774,263)) fscnbarpos-=wheel*4;
	scroller(775,120,790,264,15,15,filenum(prjlist),14,fscnbarpos,mode);
	if (mode==DD_Draw)
	{
		pf = prjlist;
		for (x=1;x<=fscnbarpos;x++) pf=pf->next;
		for (x=0;x<=13;x++)
		{
			if (pf!=NULL)
			{
				if (fscnbarpos+x==fscnselected) glColor4f(col4); else glColor4f(buttontextlit);
				glRasterPos2i(665,130+x*10);
				strcpy(st,pf->filedata.cFileName);
				glPrint(st,base2,18);
				pf=pf->next;
			}
		}

		glColor4f(buttontextlit);
		sprintf(s,"%d PROJECTS.",filenum(prjlist));
		glRasterPos2i(683,277);
		glPrint(s,base2);

	}
	glColor4f(1,1,1,1);
	if ((button(686,283,771,299,texbutton1,0,96.0/256.0,85.0/256.0,112.0/256.0,false,mode) == DDgui_LeftClick) && (mode!=DD_AfterCheck))
	{
		pf = prjlist;
		for (x=1;x<=fscnselected;x++) pf=pf->next;
		//sprintf(s,"%s%s",scenedir,pf->filedata.cFileName);
		memset(lastfilename,0,256);
		memcpy(lastfilename,pf->filedata.cFileName,strlen(pf->filedata.cFileName)-4);
		sprintf(s,"%s%s",projectdir,pf->filedata.cFileName);
		//loadaDDictscene(*actualscene,NULL,s,true,true,true,true,true);				
		LoadProject(s);
		modellviews[3].cam=actualscene->editview;
		modellviews[3].cam2=actualscene->editview;
		tTexture *tex=texturelist;
		while ((tex!=NULL) && (tex->number!=selectedtexture)) tex=tex->next;
		memcpy(generatedtexture.commands,tex->commands,sizeof(generatedtexture.commands));
		memcpy(generatedtexture.texts,tex->texts,sizeof(generatedtexture.texts));
		generatedtexture.commandnum=tex->commandnum;
		//memcpy(generatedtexture.layers,tex->layers,sizeof(generatedtexture.layers));
		for (y=0;y<=3;y++)
		{
			glBindTexture(GL_TEXTURE_2D, texlayers[y]);
			glTexImage2D(GL_TEXTURE_2D,0,3,256,256,0,GL_RGBA,GL_UNSIGNED_BYTE,generatedtexture.layers[y]);
		}				
		
		if (materiallist!=NULL)
		{
			matselected=0;
			material *mat=materiallist;
			for (x=1;x<=matselected;x++) mat=mat->next;
			mattexture=mat->handle;
		}				

		waitleftbutton=true;
	}

	if (button(685,300,770,316,texbutton1,0,144.0/256.0,85.0/256.0,160.0/256.0,false,mode) == DDgui_LeftClick) 
	{
		char *ss=readline("Enter Filename (.scn not needed)",210,0,base2,lastfilename);
		if (ss!="")
		{
			//sprintf(s,"%s%s.scn",scenedir,ss);
			//saveaDDictscene(*actualscene,NULL,s,scntexturesave, scncamerasave, scnselectionsave, scnlightsave, scnobjectsave);
			memset(lastfilename,0,256);
			memcpy(lastfilename,ss,strlen(ss));
			sprintf(s,"%s%s.64k",projectdir,ss);
			SaveProject(s);
		}
	}
	if (button(685,317,770,333,texbutton1,0,160.0/256.0,85.0/256.0,176.0/256.0,false,mode) == DDgui_LeftClick) 
	{
		char *ss=readline("Enter Filename (.scn not needed)",210,0,base2,"");
		if (ss!="")
		{
			sprintf(s,"%s%s.m64",minimaldir,ss);
			//SaveMinimalScene(*actualscene,NULL,s);
			saveminimalproject(s,2);
		}
	}
	/*RadioButton(681,341,scntexturesave,"TEXTURES",mode);
	RadioButton(681,355,scncamerasave,"CAMERAS",mode);
	RadioButton(681,369,scnselectionsave,"SELECTIONS",mode);
	RadioButton(681,383,scnlightsave,"LIGHTS",mode);
	RadioButton(681,397,scnobjectsave,"OBJECTS",mode);*/
}
Exemplo n.º 16
0
static void OnSaveAsProject()
{
    if( SaveProjectAs(Application().win) )
        SaveProject();
}