CCommandVar CActorTools::CommandSave(CCommandVar p1, CCommandVar p2) { if (p2==1){ xr_string temp_fn = ATools->m_LastFileName.c_str(); if (EFS.GetSaveName ( _objects_, temp_fn )){ temp_fn = EFS.ChangeFileExt(temp_fn,".object"); return ExecCommand(COMMAND_SAVE,temp_fn,0); } }else{ if (p1.IsInteger()) return ExecCommand(COMMAND_SAVE,xr_string(ATools->m_LastFileName.c_str()),0); xr_string temp_fn = xr_string(p1); if (temp_fn.empty()){ return ExecCommand(COMMAND_SAVE,temp_fn,1); }else{ xr_strlwr (temp_fn); EFS.UnlockFile (temp_fn.c_str()); CTimer T; T.Start(); CCommandVar res; if (Tools->Save(temp_fn.c_str())){ ELog.Msg (mtInformation,"Object '%s' successfully saved. Saving time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec()); m_LastFileName = temp_fn.c_str(); EPrefs->AppendRecentFile (m_LastFileName.c_str()); ExecCommand (COMMAND_UPDATE_CAPTION); res = TRUE; }else{ res = FALSE; } EFS.LockFile (temp_fn.c_str()); return res; } } return FALSE; }
CCommandVar CActorTools::CommandImport(CCommandVar p1, CCommandVar p2) { xr_string temp_fn = p1.IsString()?xr_string(p1):xr_string(""); if(p1.IsString()||EFS.GetOpenName(_import_,temp_fn)) { FS_Path* pp = FS.get_path(_import_); if (temp_fn.npos!=temp_fn.find(pp->m_Path)) { //. andy temp_fn = xr_string(temp_fn.c_str()+strlen(FS.get_path(_import_)->m_Path)); xr_strlwr(temp_fn); if (!Tools->IfModified()) return FALSE; ExecCommand( COMMAND_CLEAR ); CTimer T; T.Start(); if (!ATools->Import(NULL/*_import_*/,temp_fn.c_str())) return FALSE; m_LastFileName = temp_fn.c_str(); ELog.Msg(mtInformation,"Object '%s' successfully imported. Loading time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec()); if (ExecCommand( COMMAND_SAVE,temp_fn,1 )){ xr_string mfn; mfn = temp_fn; //. andy FS.update_path(mfn,_import_,temp_fn.c_str()); EFS.MarkFile(mfn.c_str(),true); }else{ ExecCommand( COMMAND_CLEAR ); } return TRUE; }else{ ELog.Msg (mtError,"Invalid file path. "); } } return FALSE; }
CCommandVar CActorTools::CommandExportCPP(CCommandVar p1, CCommandVar p2) { CCommandVar res = FALSE; xr_string fn=p1.IsString()?xr_string(p1):xr_string(""); if (p1.IsString()||EFS.GetSaveName(_import_,fn,0,7)){ if (0!=(res=ExportCPP(fn.c_str()))) ELog.Msg(mtInformation,"Export complete."); else ELog.Msg(mtError,"Export failed."); } return res; }
CCommandVar CActorTools::CommandExportOGF(CCommandVar p1, CCommandVar p2) { CCommandVar res = FALSE; xr_string fn=p1.IsString()?xr_string(p1):xr_string(""); if (p1.IsString()||EFS.GetSaveName("$game_meshes$",fn,0,0)){ if (0!=(res=ATools->ExportOGF(fn.c_str()))) ELog.Msg(mtInformation,"Export complete."); else ELog.Msg(mtError,"Export failed."); } return res; }
//--------------------------------------------------------------------------- // actor commands //--------------------------------------------------------------------------- CCommandVar CActorTools::CommandLoad(CCommandVar p1, CCommandVar p2) { xr_string temp_fn = p1.IsString()?xr_string(p1):xr_string(""); if(!p1.IsString()){ temp_fn = ChangeFileExt(m_LastFileName,"").c_str(); if (!EFS.GetOpenName ( _objects_, temp_fn )) return FALSE; } if( temp_fn.size() ){ xr_strlwr (temp_fn); if (!IfModified()) return FALSE; if (!FS.exist(temp_fn.c_str())){ Msg ("#!Can't load file: %s",temp_fn.c_str()); return FALSE; } ExecCommand (COMMAND_CLEAR); BOOL bReadOnly = !FS.can_modify_file(temp_fn.c_str()); m_Flags.set (flReadOnlyMode,bReadOnly); if (bReadOnly || EFS.CheckLocking(temp_fn.c_str(),false,true)) Msg ("#!Object '%s' opened in readonly mode.",temp_fn.c_str()); /* shared_str locker; if ((false==bReadOnly) && EFS.CheckLocking(_objects_,temp_fn.c_str(),false,true,&locker)){ Log ("#!Object opened in readonly mode. Locked by user:"******"#!You don't have permisions to modify object:",temp_fn.c_str()); } */ // set enable ... m_Props->SetReadOnly (bReadOnly); fraLeftBar->SetReadOnly (bReadOnly); CTimer T; T.Start(); if (!Load(temp_fn.c_str())){ return FALSE; } m_LastFileName = temp_fn.c_str(); ELog.Msg(mtInformation,"Object '%s' successfully loaded. Loading time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec()); EPrefs->AppendRecentFile(m_LastFileName.c_str()); ExecCommand (COMMAND_UPDATE_CAPTION); ExecCommand (COMMAND_UPDATE_PROPERTIES); // lock if (!bReadOnly) EFS.LockFile(m_LastFileName.c_str()); UndoClear(); UndoSave(); } return TRUE; }
void __fastcall TfraBottomBar::ebMacroMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { SECommand* CMD = GetEditorCommands()[COMMAND_RUN_MACRO]; VERIFY(CMD); // fill macroses pmMacro->Items->Clear(); TMenuItem* mi; for (u32 k=0; k<CMD->sub_commands.size(); ++k){ SESubCommand* SUB = CMD->sub_commands[k]; BOOL bValid = !xr_string(SUB->p0).empty(); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = AnsiString().sprintf("%d: %s",k+1,bValid?xr_string(SUB->p0).c_str():"<empty>"); TMenuItem* e = xr_new<TMenuItem>((TComponent*)0); e->Caption = "Execute"; e->OnClick = MacroExecuteClick; e->Enabled = bValid; e->Tag = k; e->ShortCut = SUB->shortcut.hotkey; TMenuItem* a = xr_new<TMenuItem>((TComponent*)0); a->Caption = "Assign"; a->OnClick = MacroAssignClick; a->Tag = k; TMenuItem* c = xr_new<TMenuItem>((TComponent*)0); c->Caption = "Clear"; c->OnClick = MacroClearClick; c->Tag = k; mi->Add (e); mi->Add (a); mi->Add (c); pmMacro->Items->Add(mi); } mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "-"; pmMacro->Items->Add(mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Edit Command List..."; mi->OnClick = MacroEditCommandListClick; pmMacro->Items->Add(mi); mi = xr_new<TMenuItem>((TComponent*)0); mi->Caption = "Log Commands"; mi->AutoCheck = true; mi->Checked = AllowLogCommands(); mi->OnClick = MacroLogCommandsClick; pmMacro->Items->Add(mi); // popup menu POINT pt; GetCursorPos (&pt); pmMacro->Popup (pt.x,pt.y); TExtBtn* btn = dynamic_cast<TExtBtn*>(Sender); VERIFY(btn); btn->MouseManualUp(); }
void SSceneSummary::SObjectInfo::Prepare() { bReady = true; if (object_name.size()){ CEditableObject* O = Lib.CreateEditObject(object_name.c_str()); xr_string pref = object_name.c_str(); if (O){ SPairInfo tmp; tmp.first = pref+"\\References"; tmp.second = _itoa(ref_count); info.push_back (tmp); tmp.first = pref+"\\Geometry\\Faces"; tmp.second = _itoa(O->GetFaceCount()); info.push_back (tmp); tmp.first = pref+"\\Geometry\\Vertices"; tmp.second = _itoa(O->GetVertexCount()); info.push_back (tmp); SurfaceVec& surfaces = O->Surfaces(); for (SurfaceIt it=surfaces.begin(); it!=surfaces.end(); it++){ xr_string pr= pref+xr_string("\\Materials\\")+(*it)->_Name(); tmp.first = pr+"\\Texture"; tmp.second = (*it)->_Texture(); info.push_back (tmp); tmp.first = pr+"\\Faces"; tmp.second = _itoa(O->GetSurfFaceCount((*it)->_Name()));info.push_back (tmp); } Lib.RemoveEditObject(O); } }else{ Msg("!Empty object name found."); } }
CCommandVar CActorTools::CommandSaveBackup(CCommandVar p1, CCommandVar p2) { string_path fn; strconcat (sizeof(fn), fn, Core.UserName, "_backup.object"); FS.update_path (fn,"$objects$",fn); ExecCommand (COMMAND_SAVE,xr_string(fn)); return TRUE; }
xr_string GameTypeValue::GetDrawText(TOnDrawTextEvent) { string512 str; xr_sprintf(str,sizeof(str),"%s%s%s%s%s", GetValue().MatchType(eGameIDSingle)?"Single ":"", GetValue().MatchType(eGameIDDeathmatch)?"DM ":"", GetValue().MatchType(eGameIDTeamDeathmatch)?"TDM ":"", GetValue().MatchType(eGameIDArtefactHunt)?"AH ":"", GetValue().MatchType(eGameIDCaptureTheArtefact)?"CTA":"" ); return xr_string(str); }
void ProcessFolder(xr_vector<char*>& list, LPCSTR path) { xr_vector<char*>* i_list = FS.file_list_open ("$target_folder$",path,FS_ListFiles|FS_RootOnly); if (!i_list){ Log ("ERROR: Unable to open file list:", path); return; } xr_vector<char*>::iterator it = i_list->begin(); xr_vector<char*>::iterator itE = i_list->end(); for (;it!=itE;++it){ xr_string tmp_path = xr_string(path)+xr_string(*it); if (!testSKIP(tmp_path.c_str())){ list.push_back (xr_strdup(tmp_path.c_str())); //. Msg ("+f: %s",tmp_path.c_str()); }else{ Msg ("-f: %s",tmp_path.c_str()); } } FS.file_list_close (i_list); }
xr_string _ListToSequence(const SStringVec& lst) { static xr_string out; out = ""; if (lst.size()){ out = lst.front(); for (SStringVec::const_iterator s_it=lst.begin()+1; s_it!=lst.end(); s_it++) out += xr_string(",")+(*s_it); } return out; }
void CActorMain::RegisterCommands() { inherited::RegisterCommands(); // tools REGISTER_CMD_CE (COMMAND_CLEAR, "File\\Clear Scene", ATools,CActorTools::CommandClear, true); REGISTER_CMD_CE (COMMAND_LOAD, "File\\Load", ATools,CActorTools::CommandLoad, true); REGISTER_CMD_C (COMMAND_SAVE_BACKUP, ATools, CActorTools::CommandSaveBackup); REGISTER_SUB_CMD_CE (COMMAND_SAVE, "File", ATools,CActorTools::CommandSave, true); APPEND_SUB_CMD ("Save", 0, 0); APPEND_SUB_CMD ("Save As", 0, 1); REGISTER_SUB_CMD_END; REGISTER_CMD_CE (COMMAND_IMPORT, "File\\Import", ATools,CActorTools::CommandImport, true); REGISTER_CMD_CE (COMMAND_EXPORT_DM, "File\\Export DM", ATools,CActorTools::CommandExportDM, true); REGISTER_CMD_CE (COMMAND_EXPORT_OBJ, "File\\Export OBJ", ATools,CActorTools::CommandExportOBJ, true); REGISTER_CMD_CE (COMMAND_EXPORT_OGF, "File\\Export OGF", ATools,CActorTools::CommandExportOGF, true); REGISTER_CMD_CE (COMMAND_EXPORT_OMF, "File\\Export OMF", ATools,CActorTools::CommandExportOMF, true); REGISTER_CMD_CE (COMMAND_EXPORT_CPP, "File\\Export CPP", ATools,CActorTools::CommandExportCPP, true); REGISTER_CMD_CE (COMMAND_UNDO, "Edit\\Undo", ATools,CActorTools::CommandUndo, false); REGISTER_CMD_CE (COMMAND_REDO, "Edit\\Redo", ATools,CActorTools::CommandRedo, false); REGISTER_CMD_C (COMMAND_OPTIMIZE_MOTIONS, ATools, CActorTools::CommandOptimizeMotions); REGISTER_CMD_CE (COMMAND_MAKE_THUMBNAIL, "Make Thumbnail", ATools,CActorTools::CommandMakeThumbnail, false); REGISTER_CMD_CE (COMMAND_BATCH_CONVERT, "File\\Batch Convert", ATools,CActorTools::CommandBatchConvert, false); // ui REGISTER_CMD_S (COMMAND_SHOW_CLIPMAKER, CommandShowClipMaker); REGISTER_CMD_S (COMMAND_MAKE_PREVIEW, CommandMakePreview); REGISTER_CMD_S (COMMAND_PREVIEW_OBJ_PREF, CommandPreviewObjPref); REGISTER_CMD_S (COMMAND_SELECT_PREVIEW_OBJ,CommandSelectPreviewObj); REGISTER_CMD_SE (COMMAND_LOAD_FIRSTRECENT, "File\\Load First Recent", CommandLoadFirstRecent, true); REGISTER_CMD_SE (COMMAND_FILE_MENU, "File Menu", CommandFileMenu, true); REGISTER_CMD_S (COMMAND_REFRESH_UI_BAR, CommandRefreshUIBar); REGISTER_CMD_S (COMMAND_RESTORE_UI_BAR, CommandRestoreUIBar); REGISTER_CMD_S (COMMAND_SAVE_UI_BAR, CommandSaveUIBar); REGISTER_CMD_S (COMMAND_UPDATE_TOOLBAR, CommandUpdateToolBar); REGISTER_CMD_S (COMMAND_UPDATE_CAPTION, CommandUpdateCaption); REGISTER_SUB_CMD_SE (COMMAND_CHANGE_TARGET, "Change Target", CommandChangeTarget, true); APPEND_SUB_CMD (BONES_PREFIX, xr_string(BONES_PREFIX), 0); APPEND_SUB_CMD (MOTIONS_PREFIX, xr_string(MOTIONS_PREFIX), 0); APPEND_SUB_CMD (OBJECT_PREFIX, xr_string(OBJECT_PREFIX), 0); APPEND_SUB_CMD (SURFACES_PREFIX, xr_string(SURFACES_PREFIX), 0); REGISTER_SUB_CMD_END; }
void xrCompressor::GatherFiles(LPCSTR path) { xr_vector<char*>* i_list = FS.file_list_open ("$target_folder$",path,FS_ListFiles|FS_RootOnly); if (!i_list){ Msg ("! ERROR: Unable to open file list:%s", path); return; } xr_vector<char*>::iterator it = i_list->begin(); xr_vector<char*>::iterator itE = i_list->end(); for (;it!=itE;++it) { xr_string tmp_path = xr_string(path)+xr_string(*it); if (!testSKIP(tmp_path.c_str())) { files_list->push_back (xr_strdup(tmp_path.c_str())); }else{ Msg ("* -f: %s",tmp_path.c_str()); } } FS.file_list_close (i_list); }
CCommandVar CommandChangeTarget(CCommandVar p1, CCommandVar p2) { if (p1.IsString()){ ATools->SelectListItem(xr_string(p1).c_str(), 0,true,false,true); }else{ switch (p1){ case 0: ATools->SelectListItem(BONES_PREFIX, 0,true,false,true); break; case 1: ATools->SelectListItem(MOTIONS_PREFIX, 0,true,false,true); break; case 2: ATools->SelectListItem(OBJECT_PREFIX, 0,true,false,true); break; case 3: ATools->SelectListItem(SURFACES_PREFIX, 0,true,false,true); break; } } return TRUE; }
xr_string EFS_Utils::ExcludeBasePath(LPCSTR full_path, LPCSTR excl_path) { LPCSTR sub = strstr(full_path, excl_path); if (0 != sub) return xr_string(sub + xr_strlen(excl_path)); else return xr_string(full_path); }
xr_string EFS_Utils::ExtractFileExt(LPCSTR src) { string_path ext; _splitpath(src, 0, 0, 0, ext); return xr_string(ext); }
xr_string EFS_Utils::ExtractFilePath(LPCSTR src) { string_path drive, dir; _splitpath(src, drive, dir, 0, 0); return xr_string(drive) + dir; }
//------------------------------------------------------------------------------ // возвращает список не синхронизированных (модифицированных) текстур // source_list - содержит список текстур с расширениями // sync_list - реально сохраненные файлы (после использования освободить) //------------------------------------------------------------------------------ void CSoundManager::SynchronizeSounds(bool sync_thm, bool sync_game, bool bForceGame, FS_FileSet* source_list, AStringVec* sync_list, FS_FileSet* modif_map) { FS_FileSet M_BASE; FS_FileSet M_THUM; FS_FileSet M_GAME; if (source_list) M_BASE = *source_list; else FS.file_list(M_BASE,_sounds_,FS_ListFiles|FS_ClampExt,"*.wav"); if (M_BASE.empty()) return; if (sync_thm) FS.file_list(M_THUM,_sounds_,FS_ListFiles|FS_ClampExt,"*.thm"); if (sync_game) FS.file_list(M_GAME,_game_sounds_,FS_ListFiles|FS_ClampExt,"*.ogg"); bool bProgress = M_BASE.size()>1; int m_age = time(NULL); SPBItem* pb = 0; if (bProgress) pb = UI->ProgressStart(M_BASE.size(),"Synchronize sounds..."); FS_FileSetIt it=M_BASE.begin(); FS_FileSetIt _E = M_BASE.end(); for (; it!=_E; it++){ BOOL bUpdated = FALSE; xr_string base_name = EFS.ChangeFileExt(it->name,""); xr_strlwr(base_name); string_path fn; FS.update_path (fn,_sounds_,EFS.ChangeFileExt(base_name,".wav").c_str()); if (!FS.exist(fn)) continue; FS_FileSetIt th = M_THUM.find(base_name); bool bThm = ((th==M_THUM.end()) || ((th!=M_THUM.end())&&(th->time_write!=it->time_write))); FS_FileSetIt gm = M_GAME.find(base_name); bool bGame = bThm || ((gm==M_GAME.end()) || ((gm!=M_GAME.end())&&(gm->time_write!=it->time_write))); ESoundThumbnail* THM = 0; // backup base sound // check thumbnail if (sync_thm&&bThm){ THM = xr_new<ESoundThumbnail>(it->name.c_str()); THM->Save (m_age); bUpdated = TRUE; } // check game sounds if (bForceGame||(sync_game&&bGame)){ if (!THM) THM = xr_new<ESoundThumbnail>(it->name.c_str()); R_ASSERT(THM); string_path src_name; strconcat (sizeof(src_name),src_name, base_name.c_str(), ".wav"); FS.update_path (src_name,_sounds_,src_name); string_path game_name; strconcat (sizeof(game_name),game_name, base_name.c_str(), ".ogg"); FS.update_path (game_name,_game_sounds_,game_name); MakeGameSound (THM,src_name,game_name); if (sync_list) sync_list->push_back(base_name.c_str()); if (modif_map) modif_map->insert(*it); bUpdated = TRUE; } if (THM) xr_delete(THM); if (UI->NeedAbort()) break; if (bProgress) pb->Inc (bUpdated?xr_string(base_name+" - UPDATED.").c_str():"",bUpdated); if (bUpdated){ string_path wav_fn,thm_fn,ogg_fn; FS.update_path (wav_fn,_sounds_, EFS.ChangeFileExt(base_name,".wav").c_str()); FS.update_path (thm_fn,_sounds_, EFS.ChangeFileExt(base_name,".thm").c_str()); FS.update_path (ogg_fn,_game_sounds_, EFS.ChangeFileExt(base_name,".ogg").c_str()); FS.set_file_age (wav_fn,m_age); FS.set_file_age (thm_fn,m_age); FS.set_file_age (ogg_fn,m_age); } } if (bProgress) UI->ProgressEnd(pb); }
xr_string EFS_Utils::ExtractFileName(LPCSTR src) { string_path name; _splitpath(src, 0, 0, name, 0); return xr_string(name); }
void ProcessLTX(LPCSTR tgt_name, LPCSTR params, BOOL bFast) { xr_string ltx_name; LPCSTR ltx_nm = strstr(params,".ltx"); VERIFY(ltx_nm!=0); string_path ltx_fn; string_path tmp; strncpy (tmp,params,ltx_nm-params); tmp[ltx_nm-params]=0; _Trim (tmp); strcat (tmp,".ltx"); strcpy (ltx_fn,tmp); // append ltx path (if exist) string_path fn,dr,di; _splitpath (ltx_fn,dr,di,0,0); strconcat (sizeof(fn),fn,dr,di); if (0!=fn[0]) FS.append_path ("ltx_path",fn,0,false); if (!FS.exist(ltx_fn)&&!FS.exist(ltx_fn,"$app_root$",tmp)) Debug.fatal (DEBUG_INFO,"ERROR: Can't find ltx file: '%s'",ltx_fn); CInifile ltx (ltx_fn); printf ("Processing LTX...\n"); BOOL make_pack = ltx.line_exist("options","make_pack") ? ltx.r_bool("options","make_pack") : true; LPCSTR copy_path= ltx.line_exist("options","copy_path") ? ltx.r_string("options","copy_path") : 0; if (ltx.line_exist("options","exclude_exts")) _SequenceToList(exclude_exts,ltx.r_string("options","exclude_exts")); xr_vector<char*> list; xr_vector<char*> fl_list; if(ltx.section_exist("include_folders")) { CInifile::Sect& if_sect = ltx.r_section("include_folders"); for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); if_it++) { BOOL ifRecurse = CInifile::IsBOOL(if_it->second.c_str()); u32 folder_mask = FS_ListFolders | (ifRecurse?0:FS_RootOnly); string_path path; LPCSTR _path = 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str(); strcpy (path,_path); u32 path_len = xr_strlen(path); if ((0!=path_len)&&(path[path_len-1]!='\\')) strcat(path,"\\"); Log (""); OUT_LOG ("Processing folder: '%s'",path); BOOL efRecurse; BOOL val = IsFolderAccepted(ltx,path,efRecurse); if (val || (!val&&!efRecurse)) { if (val) ProcessFolder (list,path); xr_vector<char*>* i_fl_list = FS.file_list_open ("$target_folder$",path,folder_mask); if (!i_fl_list) { Log ("ERROR: Unable to open folder list:", path); continue; } xr_vector<char*>::iterator it = i_fl_list->begin(); xr_vector<char*>::iterator itE = i_fl_list->end(); for (;it!=itE;++it){ xr_string tmp_path = xr_string(path)+xr_string(*it); bool val = IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse); if (val) { fl_list.push_back(xr_strdup(tmp_path.c_str())); Msg ("+F: %s",tmp_path.c_str()); // collect files if (ifRecurse) ProcessFolder (list,tmp_path.c_str()); }else { Msg ("-F: %s",tmp_path.c_str()); } } FS.file_list_close (i_fl_list); }else { Msg ("-F: %s",path); } } }//if(ltx.section_exist("include_folders")) // compress { if(ltx.section_exist("include_files")) { CInifile::Sect& if_sect = ltx.r_section("include_files"); for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); if_it++) { list.push_back (xr_strdup(if_it->first.c_str())); } } } CompressList (tgt_name,&list,&fl_list,bFast,make_pack,copy_path); // free xr_vector<char*>::iterator it = list.begin(); xr_vector<char*>::iterator itE = list.end(); for (;it!=itE;++it) xr_free(*it); it = fl_list.begin(); itE = fl_list.end(); for (;it!=itE;++it) xr_free(*it); exclude_exts.clear_and_free(); }
void xrCompressor::ProcessLTX(CInifile& ltx) { config_ltx =<x; if (ltx.line_exist("options","exclude_exts")) _SequenceToList(exclude_exts, ltx.r_string("options","exclude_exts")); files_list = xr_new< xr_vector<char*> >(); folders_list = xr_new< xr_vector<char*> >(); if(ltx.section_exist("include_folders")) { CInifile::Sect& if_sect = ltx.r_section("include_folders"); for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it) { BOOL ifRecurse = CInifile::IsBOOL(if_it->second.c_str()); u32 folder_mask = FS_ListFolders | (ifRecurse?0:FS_RootOnly); string_path path; LPCSTR _path = 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str(); xr_strcpy (path,_path); u32 path_len = xr_strlen(path); if ((0!=path_len)&&(path[path_len-1]!='\\')) xr_strcat(path,"\\"); Msg (""); Msg ("Processing folder: '%s'",path); BOOL efRecurse; BOOL val = IsFolderAccepted(ltx,path,efRecurse); if (val || (!val&&!efRecurse)) { if (val) GatherFiles (path); xr_vector<char*>* i_fl_list = FS.file_list_open ("$target_folder$",path,folder_mask); if (!i_fl_list) { Msg ("ERROR: Unable to open folder list:", path); continue; } xr_vector<char*>::iterator it = i_fl_list->begin(); xr_vector<char*>::iterator itE = i_fl_list->end(); for (;it!=itE;++it) { xr_string tmp_path = xr_string(path)+xr_string(*it); bool val = IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse); if (val) { folders_list->push_back(xr_strdup(tmp_path.c_str())); Msg ("+F: %s",tmp_path.c_str()); // collect files if (ifRecurse) GatherFiles (tmp_path.c_str()); }else { Msg ("-F: %s",tmp_path.c_str()); } } FS.file_list_close (i_fl_list); }else { Msg ("-F: %s",path); } } }//if(ltx.section_exist("include_folders")) if(ltx.section_exist("include_files")) { CInifile::Sect& if_sect = ltx.r_section("include_files"); for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it) { files_list->push_back (xr_strdup(if_it->first.c_str())); } } PerformWork (); // free xr_vector<char*>::iterator it = files_list->begin(); xr_vector<char*>::iterator itE = files_list->end(); for (;it!=itE;++it) xr_free(*it); xr_delete(files_list); it = folders_list->begin(); itE = folders_list->end(); for (;it!=itE;++it) xr_free(*it); xr_delete(folders_list); exclude_exts.clear_and_free(); }
void __fastcall TfraLeftBar::Save2Click(TObject *Sender) { ExecCommand( COMMAND_SAVE, xr_string(ATools->m_LastFileName.c_str()), 0 ); }
CCommandVar CommandLoadFirstRecent(CCommandVar p1, CCommandVar p2) { if (EPrefs->FirstRecentFile()) return ExecCommand(COMMAND_LOAD,xr_string(EPrefs->FirstRecentFile())); return FALSE; }
//--------------------------------------------------------------------------- void __fastcall TfraBottomBar::MacroClearClick(TObject *Sender) { ExecCommand(COMMAND_ASSIGN_MACRO,((TMenuItem*)Sender)->Tag,xr_string("")); }