moDirectorStatus moExplorerNotebook::ProjectUpdated( const moProjectDescriptor& p_ProjectDescriptor ) { int layer_height = 64; wxString cPath; moDirectorStatus status; ///pedimos todos los descriptores: cPath = moText2Wx( p_ProjectDescriptor.GetConfigPath() ); ///actualizamos el arbol if (m_pProjectTreeCtrl) status = m_pProjectTreeCtrl->ProjectUpdated( p_ProjectDescriptor ); ///actualizamos las paletas de efectos if (m_pEffectsPaletteCtrl) status = CHECK_DIRECTOR_STATUS_ERROR( status, m_pEffectsPaletteCtrl->ProjectUpdated( p_ProjectDescriptor ) ); ///actualizamos la paleta de visuales if (m_pVisualsPaletteCtrl) status = CHECK_DIRECTOR_STATUS_ERROR( status, m_pVisualsPaletteCtrl->ProjectUpdated( p_ProjectDescriptor ) ); ///actualizamos el arbol de archivos if (m_pFilesTreeCtrl) status = CHECK_DIRECTOR_STATUS_ERROR( status, m_pFilesTreeCtrl->SetRootPath( cPath, wxVDTC_DEFAULT) ); return status; }
MOboolean moDirectorChildConsole::Init( moText p_effectname, moText p_effectconfigname, moText p_apppath, moText p_datapath, moText p_consoleconfig, moIODeviceManager* p_pIODeviceManager, moResourceManager *p_pResourceManager, MOint p_render_to_texture_mode, MOint p_screen_width, MOint p_screen_height, MOint p_render_width, MOint p_render_height ) { wxFileName xfname( wxString(moText2Wx( p_effectconfigname )) ); wxString xstring; xstring = xfname.GetName(); const char *cfilename =(const char *) xstring.c_str(); m_EffectConfigName =(char*)cfilename; m_EffectName = p_effectname; return Init( p_apppath, p_datapath, p_consoleconfig, p_pIODeviceManager, p_pResourceManager, p_render_to_texture_mode, p_screen_width, p_screen_height, p_render_width, p_render_height); }
void moShaderCtrl::Inspect( moValueDescriptor p_ValueDescriptor ) { m_ValueDescriptor = p_ValueDescriptor; if (m_ValueDescriptor.GetValue().GetSubValueCount()==1) { TextCtrlShaderCfg->ChangeValue( wxT("") ); TextCtrlDestination->ChangeValue( wxT("") ); } else if (m_ValueDescriptor.GetValue().GetSubValueCount()>1) { TextCtrlShaderCfg->ChangeValue( moText2Wx( m_ValueDescriptor.GetValue().GetSubValue(1).Text() ) ); TextCtrlDestination->ChangeValue( moText2Wx( m_ValueDescriptor.GetValue().GetSubValue(2).Text() ) ); if (m_ValueDescriptor.GetValue().GetSubValueCount()==4) { moValueBase vB = m_ValueDescriptor.GetValue().GetSubValue(3); MOfloat alphaval = 1.0; if ( vB.GetType() == MO_VALUE_FUNCTION ) { moMathFunction* pFunc = vB.Fun(); if (pFunc) { alphaval = pFunc->Eval( 0 ); } else { alphaval = 1.0; LogError("Alpha Filter Function undefined"); } } else { alphaval = vB.Float(); } m_pLevelShaderAlphaCtrl->SetRange(0,100); m_pLevelShaderAlphaCtrl->ChangeValue( (MOint)(alphaval * 100 ) ); m_pLevelShaderAlphaCtrl->Refresh(); } else { m_pLevelShaderAlphaCtrl->SetRange(0,100); m_pLevelShaderAlphaCtrl->ChangeValue( (MOint)(100 ) ); m_pLevelShaderAlphaCtrl->Refresh(); } } }
void moShaderCtrl::OnBitmapButtonShaderImportClick(wxCommandEvent& event) { wxFileDialog* pFileDialog = new wxFileDialog( this ); moProjectDescriptor ProjectDescriptor; ProjectDescriptor = m_ValueDescriptor.GetParamDescriptor().GetMobDescriptor().GetProjectDescriptor(); wxString relativepath = moText2Wx( ProjectDescriptor.GetConfigPath() ); wxFileName ConfigPath = wxFileName::DirName( relativepath ); wxFileName absname = wxFileName::DirName( relativepath ); absname.MakeAbsolute(); wxString absolutepath = absname.GetPath(); if(pFileDialog) { pFileDialog->SetDirectory( absolutepath ); pFileDialog->SetWildcard(wxT("Cfg files (*.cfg)|*.cfg|All files (*.*)|*.*")); if( pFileDialog->ShowModal() == wxID_OK ) { wxFileName FileName( pFileDialog->GetPath() ); moProjectDescriptor ProjectDescriptor; ProjectDescriptor = m_ValueDescriptor.GetParamDescriptor().GetMobDescriptor().GetProjectDescriptor(); wxString relativepath = moText2Wx( ProjectDescriptor.GetConfigPath() ); FileName.MakeRelativeTo( relativepath ); wxString path = FileName.GetFullPath(); const char *cnamerelative = (char*)path.c_str(); TextCtrlShaderCfg->SetValue( path ); } } }
moDirectorStatus moLayerEffectCtrl::MobUpdated( moMobDescriptor p_MobDesc ) { ///asignamos los nuevos datos m_MobDescriptor = p_MobDesc; ///actualizamos los controles de esta ventana moMobDefinition &MobDefinition( m_MobDescriptor.GetMobDefinition() ); moEffectState &EffectState( m_MobDescriptor.GetState().GetEffectState() ); if (TextCtrlLabel) TextCtrlLabel->SetLabel( moText2Wx( MobDefinition.GetLabelName() ) ); if (BitmapButtonView) switch( EffectState.on ) { case MO_OFF: ///CheckBoxOnOff->SetValue(false); BitmapButtonView->SetBitmapLabel( m_BitmapViewOff ); break; case MO_ON: ///CheckBoxOnOff->SetValue(true); BitmapButtonView->SetBitmapLabel( m_BitmapViewOn ); break; } float alphaf = EffectState.alpha * 255.0; float tintf = EffectState.tint * 255.0; double deltaf = EffectState.tempo.delta; float tintr = EffectState.tintr * 255.0; float tintg = EffectState.tintg * 255.0; float tintb = EffectState.tintb * 255.0; wxColour m_actual_color; m_actual_color = wxColour( (int)tintr, (int)tintg, (int)tintb , (int)alphaf ); if (m_pLevelAlphaCtrl) m_pLevelAlphaCtrl->SetColourValue( m_actual_color, true ); /// deltaf, si es 1, va al medio (velocidad normal) -> 50 float deltafr = deltaf * 50.0f; int deltav = (int) deltafr; if (m_pLevelSpeedCtrl) m_pLevelSpeedCtrl->ChangeValue( deltav ); return MO_DIRECTOR_STATUS_OK; }
void moLogTextCtrl::LogError( moText p_message ) { wxString w = moText2Wx( p_message ); if (GetNumberOfLines()>10000) { Clear(); } SetDefaultStyle( wxTextAttr( wxColour(255,0,0) ) ); AppendText(w + wxT("\n")); ShowPosition( GetLastPosition() ); }
void moLogTextCtrl::Log( moText p_message ) { wxString w = moText2Wx( p_message ); ///cada 10000 lineas publicadas, limpia el buffer completo if (GetNumberOfLines()>10000) { Clear(); } SetDefaultStyle( wxTextAttr( wxColour( 50, 255, 50 )) ); AppendText(w + wxT("\n")); ShowPosition( GetLastPosition() ); }
// 'Main program' equivalent: the program execution "starts" here bool moDirectorApp::OnInit() { //(*AppInitialize bool wxsOK = true; //*) wxInitAllImageHandlers(); // Check next line: Gustavo 05/20/2009 // return wxsOK; guint major, minor, micro, nano; cout << "Gstreamer initializing..." << endl; gst_init(NULL,NULL); gst_version (&major, &minor, µ, &nano); cout << "Gstreamer initialized" << " version: " << major << "." << minor << "." << micro << "." << nano << endl; //** SET WORKING PATH CORRECTLY **/ #if wxMAJOR_VERSION<3 wxStandardPaths StdPaths; #else wxStandardPaths StdPaths = wxStandardPaths::Get(); #endif wxFileName exename(StdPaths.GetExecutablePath()); exename.MakeAbsolute(); //wxMessageBox(wxString("appdir:")+wxString(exename.GetPath())); wxSetWorkingDirectory( wxString(exename.GetPath()) ); //** EVERYTHING OK!!!**// moDirectorCore* m_pDirectorCore = NULL; moDirectorFrame* m_pDirectorFrame = NULL; SetAppName(wxString(_("Moldeo Director ")) + moText2Wx(moGetVersionStr()) ); // Check only one instance running m_checker = NULL; /* const wxString name = wxString::Format(wxT("MoldeoDirector-%s"), wxGetUserId().c_str()); // Use mb_str() m_checker = new wxSingleInstanceChecker(name); if (m_checker->IsAnotherRunning()) { wxLogError(_("Program already running, aborting.")); return false; } */ // Check configuration file /* wxString str; wxFileConfig configuration(wxT("MoldeoDirector"),wxT("Moldeo"),wxT(wxGetCwd())); configuration.Read(wxT("General/File1"), &str); wxMessageBox(wxT(str),wxT("Moldeo Director")); */ // created initially) cout << "Image Handlers..." << endl; #if wxUSE_SYSTEM_OPTIONS //wxSystemOptions::SetOption(wxT("no-maskblt"), 1); #endif wxInitAllImageHandlers(); #if wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS //wxFileSystem::AddHandler(new wxInternetFSHandler); #endif wxImageHandler* hndPNG = wxImage::FindHandler((long)wxBITMAP_TYPE_PNG); if (!hndPNG) cout << "Warning: PNG Image handler not loaded..." << endl; wxImageHandler* hndJPEG = wxImage::FindHandler((long)wxBITMAP_TYPE_JPEG); if (!hndJPEG) cout << "Warning: JPEG Image handler not loaded..." << endl; wxImageHandler* hndTGA = wxImage::FindHandler((long)wxBITMAP_TYPE_TGA); if (!hndTGA) cout << "Warning: TGA Image handler not loaded..." << endl; // create the main application window cout << "Director Frame..." << endl; m_pDirectorFrame = new moDirectorFrame(wxString(_("Moldeo Director ")) + moText2Wx(moGetVersionStr())); if (m_pDirectorFrame) { m_pDirectorFrame->SetIcon( wxIcon( wxIconLocation(wxT(MOLDEODATADIR "/icons/Moldeo32.ico")) ) ); m_pDirectorFrame->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); m_pDirectorFrame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); } else { exit(1); } cout << "m_pDirectorFrame:" << (m_pDirectorFrame!=NULL) << endl; cout << "Director Core..." << endl; m_pDirectorCore = new moDirectorCore(); cout << "m_pDirectorCore:" << (m_pDirectorCore!=NULL) << endl; cout << "Director Frame UI to Core..." << endl; m_pDirectorCore->SetUserInterface( m_pDirectorFrame ); m_pDirectorCore->SetPaths( moWx2Text(exename.GetPath()), moWx2Text(StdPaths.GetUserDataDir()), moWx2Text(wxString(wxT(MODULESDIR))), moWx2Text(wxString(wxT(MOLDEODATADIR))) ); m_pDirectorCore->Init(); //wxList ImageHandlerList = wxImage::GetHandlers(); cout << "appdir:" << moWx2Text( wxGetCwd() ) << endl; cout << "userdir:" << moWx2Text( StdPaths.GetUserDataDir() ) << endl; cout << "datadir:" << moWx2Text(wxString(_(MOLDEODATADIR))) << endl; cout << "modulesdir:" << moWx2Text(wxString(_(MODULESDIR))) << endl; cout << "Showing Frame..." << endl; m_pDirectorFrame->Show(true); cout << "Setting Top Window..." << endl; SetTopWindow(m_pDirectorFrame); m_pDirectorFrame->Maximize(); m_pDirectorFrame->Init(); cout << "Success!!! rock and roll!!" << endl; moText config; cout << "argc: " << argc << endl; /*minimo 2*/ while( argc >= 2 ) { --argc; wxString arglast(argv[argc]); wxString argprev; if (argc>0) argprev = argv[argc-1]; wxString arg0(argv[0]); cout << "Argument id" << (argc) << " : " << moWx2Text(arglast) << endl; if( argprev == wxString( _("-mol") ) ) { config = moWx2Text( arglast ); cout << "Argument -mol found! : " << config << endl; --argc; } else if ( arglast == wxString(_("--help")) ) { cout << "Usage: " << moWx2Text(arg0) << " [-mol]" << endl; } else { cout << "Usage: " << moWx2Text(arg0) << " [-mol]" << endl; /*wxMessageBox( wxString(wxT("Error opening:")) + wxString(wxT(" argc:")) + // wxString(IntToStr(argc)) + wxString(wxT(" argv[argc-1]:")) + argv[argc-1] + wxString(wxT(" argv[0]:")) + wxString(argv[0]) + wxString(wxT(" argv[1]:")) + wxString(argv[1]) + wxString(wxT(" argv[2]:")) + wxString(argv[2]) ); */ //exit(0); } } if (config!=moText("")) { moProjectDescriptor ProjectDescriptor; wxFileName FileName( moText2Wx(config) ); wxString path = FileName.GetPath(); #ifdef MO_WIN32 path+= _T("\\"); #else path+= _T("/"); #endif wxString name = FileName.GetFullName(); ProjectDescriptor.Set( moWx2Text(path), moWx2Text(name) ); moDirectorStatus mStatus = m_pDirectorFrame->OpenProject( ProjectDescriptor ); } // success: wxApp::OnRun() will be called which will enter the main message // loop and the application will run. If we returned false here, the // application would exit immediately. return true; }