void ProjectWindow::AddNewFile(BString name, bool create_pair) { BMessage msg(M_ADD_FILES); DPath projfile(fProject->GetPath().GetFolder()); projfile << name; entry_ref ref = gFileFactory.CreateSourceFile(projfile.GetFolder(), projfile.GetFileName(), create_pair ? SOURCEFILE_PAIR : 0); if (!ref.name || strlen(ref.name) == 0) return; AddFile(ref); if (fSourceControl) fSourceControl->AddToRepository(projfile.GetFullPath()); msg.AddRef("refs",&ref); if (create_pair && fSourceControl) { entry_ref partnerRef = GetPartnerRef(ref); DPath partnerPath(partnerRef); fSourceControl->AddToRepository(projfile.GetFullPath()); msg.AddRef("refs",&partnerRef); if (!gDontManageHeaders) AddFile(partnerRef); fSourceControl->AddToRepository(partnerPath.GetFullPath()); } be_app->PostMessage(&msg); }
void MainWindow::slotNewProject() { NewProjectDialog npd(this); if (npd.exec() == QDialog::Accepted) { try { Project_sV *project = npd.buildProject(); // Save project XmlProjectRW_sV writer; //qDebug() << "Saving project as " << npd.filename; // check if directory exist ... QFileInfo projfile(npd.projectFilename()); QDir dir(projfile.absoluteDir()); if (!dir.exists()) { dir.mkpath("."); } try { writer.saveProject(project, npd.projectFilename()); statusBar()->showMessage(QString(tr("Saved project as: %1")).arg(npd.projectFilename())); setWindowModified(false); } catch (Error_sV &err) { QMessageBox(QMessageBox::Warning, tr("Error writing project file"), err.message()).exec(); } m_projectPath = npd.projectFilename(); project->preferences()->viewport_secRes() = QPointF(400, 400)/project->frameSource()->framesCount()*project->frameSource()->fps()->fps(); /* add a first (default) node */ Node_sV snode; snode.setX(0.0); snode.setY(0.0); project->nodes()->add(snode); loadProject(project); m_wCanvas->showHelp(true); setWindowModified(true); } catch (FrameSourceError &err) { QMessageBox(QMessageBox::Warning, "Frame source error", err.message()).exec(); } } }
int main( int argc, char *[] ) { if( argc < 2 || argc > 3 ) { HCWarning( USAGE ); return( -1 ); } // Parse the command line. char cmdline[80]; char *pfilename, *temp; int quiet = 0; getcmd( cmdline ); temp = cmdline; pfilename = NULL; while( *temp != '\0' && isspace( *temp ) ) { temp++; } if( *temp == '-' || *temp == '/' ) { temp++; if( (*temp != 'q' && *temp != 'Q') || !isspace( *(temp+1) ) ) { HCWarning( USAGE ); return( -1 ); } else { quiet = 1; temp++; while( *temp != '\0' && isspace( *temp ) ) { temp++; } if( *temp == '\0' ) { HCWarning( USAGE ); return( -1 ); } else { pfilename = temp; } } } else if( *temp != '\0' ) { pfilename = temp++; while( *temp != '\0' && *temp != '/' && *temp != '-' ) { temp++; } if( *temp != '\0' ) { *temp = '\0'; temp++; if( *temp != 'q' && *temp != 'Q' ) { HCWarning( USAGE ); return( -1 ); } else { temp++; while( *temp != '\0' && isspace( *temp ) ) { temp++; } if( *temp != '\0' ){ HCWarning( USAGE ); return( -1 ); } else { quiet = 1; } } } } SetQuiet( quiet ); // Parse the given filename. char path[_MAX_PATH]; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; _fullpath( path, pfilename, _MAX_PATH ); _splitpath( path, drive, dir, fname, ext ); if( stricmp( ext, PhExt ) == 0 || stricmp( ext, HlpExt ) == 0 ) { HCWarning( BAD_EXT ); return( -1 ); } if( ext[0] == '\0' ){ _makepath( path, drive, dir, fname, HpjExt ); } char destpath[_MAX_PATH]; _makepath( destpath, drive, dir, fname, HlpExt ); InFile input( path ); if( input.bad() ) { HCWarning( FILE_ERR, pfilename ); return( -1 ); } // Set up and start the help compiler. try { HFSDirectory helpfile( destpath ); HFFont fontfile( &helpfile ); HFContext contfile( &helpfile ); HFSystem sysfile( &helpfile, &contfile ); HFCtxomap ctxfile( &helpfile, &contfile ); HFTtlbtree ttlfile( &helpfile ); HFKwbtree keyfile( &helpfile ); HFBitmaps bitfiles( &helpfile ); Pointers my_files = { NULL, NULL, &sysfile, &fontfile, &contfile, &ctxfile, &keyfile, &ttlfile, &bitfiles, }; if( stricmp( ext, RtfExt ) == 0 ) { my_files._topFile = new HFTopic( &helpfile ); RTFparser rtfhandler( &my_files, &input ); rtfhandler.Go(); } else { HPJReader projfile( &helpfile, &my_files, &input ); projfile.parseFile(); } helpfile.dump(); if( my_files._topFile != NULL ) { delete my_files._topFile; } if( my_files._phrFile != NULL ) { delete my_files._phrFile; } } catch( HCException ) { HCWarning( PROGRAM_STOPPED ); return( -1 ); } return( 0 ); }