本文整理汇总了C++中FileSel::ActiveDir方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSel::ActiveDir方法的具体用法?C++ FileSel::ActiveDir怎么用?C++ FileSel::ActiveDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSel
的用法示例。
在下文中一共展示了FileSel::ActiveDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFile
void WorkspaceWork::AddFile(ADDFILE af)
{
String active = GetActivePackage();
if(active.IsEmpty()) return;
FileSel *fs = &OutputFs();
RealizeDirectory(GetLocalDir());
switch(af)
{
case PACKAGE_FILE: fs = &BasedSourceFs(); fs->BaseDir(GetFileFolder(PackagePathA(active))); break;
case ANY_FILE: fs = &AnySourceFs(); break;
case OUTPUT_FILE: fs->ActiveDir(GetOutputDir()); break;
case CONFIG_FILE: fs->ActiveDir(GetConfigDir()); break;
case HOME_FILE: fs->ActiveDir(GetHomeDirectory()); break;
case LOCAL_FILE: fs->ActiveDir(GetLocalDir()); break;
default: ; // GCC warns otherwise
}
if(!fs->ExecuteOpen("Add files to package..")) return;
int fci = filelist.GetCursor();
int cs = filelist.GetSbPos();
int ci = fci >= 0 && fci < fileindex.GetCount() ? fileindex[fci] : -1;
for(int i = 0; i < fs->GetCount(); i++) {
Package::File& f = ci >= 0 ? actual.file.Insert(ci++) : actual.file.Add();
f = (*fs)[i];
f.readonly = fs->GetReadOnly();
}
SaveLoadPackage(false);
filelist.SetSbPos(cs);
filelist.SetCursor(fci >= 0 ? fci : filelist.GetCount() - 1);
FileSelected();
}
示例2: onOpenList
void bigmailer::onOpenList()
{
FileSel fs;
fs.ActiveDir(ConfigFile("")) ;
fs.Type("list files", "*.list") ;
if ( ! fs.ExecuteOpen(t_("select a list file") ) )
return;
onCloseList() ;
theDefList.Load(fs.Get()) ;
SetTitle() ;
}
示例3: LoadImage
void ImageMT::LoadImage()
{
FileSel dlg;
dlg.Type("Image files","*.bmp *.png *.tif *.jpg");
dlg.Type("Image: JPEG","*.jpg");
dlg.Type("Image: Portable Nework Graphics","*.png");
dlg.Type("Image: Tagged Image Format","*.tif");
dlg.Type("Image: Windows Bitmap (24bit)","*.bmp");
dlg.ActiveDir(GetCurrentDirectory());
if(!dlg.ExecuteOpen("Open Image"))return;
SetCurrentDirectory(dlg.GetActiveDir());
String path = ~dlg;
FileIn in(path);
if(in.IsError())
{
String s = Format("Error opening image file %s",path);
PromptOK(s);
return;
}
One<StreamRaster> r = StreamRaster::OpenAny(in);
if(!r)
{
String s = Format("Error opening streamraster file %s",path);
PromptOK(s);
return;
}
Layer* pLayer = new Layer;
Size sz = GetSize();
pLayer->m_img = r->GetImage();
pLayer->m_rc.left = 0;
pLayer->m_rc.right = 1;
pLayer->m_rc.top = 0;
pLayer->m_rc.bottom = 1;
m_pLayers.Add(pLayer);
}
示例4: OnBrowseUpp
void BaseSetupDlg::OnBrowseUpp()
{
String s = ~upp;
int b, e;
if(upp.HasFocus())
upp.GetSelection(b, e);
else
e = s.GetLength();
b = e;
while(b > 0 && s[b - 1] != ';')
b--;
while(e < s.GetLength() && s[e] != ';')
e++;
FileSel fsel;
String pre = s.Left(b), post = s.Mid(e);
fsel.ActiveDir(s.Mid(b, e - b));
if(fsel.ExecuteSelectDir()) {
String newdir = ~fsel;
upp <<= pre + newdir + Nvl(post, ";");
upp.SetWantFocus();
OnUpp();
}
}
示例5: imageSelCb
// image selection callback
void XMLBarEditor::imageSelCb(void)
{
static String lastPath = "";
// opens a file selector, allows selection of some
// kind of image formats
FileSel fs;
fs.ActiveDir(lastPath);
fs.Type(t_("Image files"), "*.png,*.jpg,*.ico,*.bmp");
if(!fs.ExecuteOpen(t_("Select icon file")))
return;
String path = fs.Get();
lastPath = GetFileFolder(path);
String ext = ToUpper(GetFileExt(path));
Image img;
if(ext != ".ICO")
img = StreamRaster::LoadFileAny(path);
else
{
String data = LoadFile(path);
Vector<Image> imgVec;
try
{
imgVec = ReadIcon(data);
}
catch(...)
{
}
if(imgVec.GetCount())
img = imgVec[0];
else
img = Null;
}
curIcon = img;
itemPane.icon.SetImage(img);
fieldsModCb();
}
示例6: DataPageImportCSV
void bigmailer::DataPageImportCSV()
{
FileSel fs ;
fs.ActiveDir(ConfigFile("")) ;
fs.Type("csv files", "*.csv") ;
if ( ! fs.ExecuteOpen(t_("")) )
return;
csvResult csv ;
if ( ! csv.ImportFrom(fs.Get()) )
return ;
WithcsvToDefLayout<TopWindow> dlg;
CtrlLayout(dlg, "Import From CSV");
for (int i = 0; i < csv.fields.GetCount(); i++)
{
dlg.dropName.Add( csv.fields[i] ) ;
dlg.dropEmail.Add( csv.fields[i] ) ;
}
dlg.dropName.SetIndex(0) ;
dlg.dropEmail.SetIndex(1) ;
dlg.btOk.WhenAction = Breaker(IDOK) ;
dlg.btCancel.WhenAction = Breaker( IDCANCEL ) ;
if (dlg.Execute() == IDOK)
{
if (PromptOKCancel("Con esta operación se van a eliminar [* TODOS]") == IDOK)
{
// añadimos la cabecera
theDefList.fields.Clear() ;
theDefList.fields.Add( dlg.dropName.GetValue() ) ;
theDefList.fields.Add( dlg.dropEmail.GetValue() ) ;
for (int i = 0; i < csv.fields.GetCount(); i++)
{
String f = csv.fields[i] ;
if (f != theDefList.fields[0] && f != theDefList.fields[1])
theDefList.fields.Add(f) ;
}
theDefList.data.Clear() ;
for (int i = 0; i < csv.values.GetCount(); i++) // para cada registro
{
Vector<String>& line = csv.values[i] ;
Vector<String>& record = theDefList.data.Add() ;
for (int j = 0; j < theDefList.fields.GetCount(); j++)
{
String fieldName = theDefList.fields[j] ;
for (int k = 0; k < csv.fields.GetCount(); k++)
{
if (fieldName == csv.fields[k])
{
record.Add( line[k] ) ;
break ;
}
}
}
}
theDefList.Save() ;
DataPageFill() ;
}
}
}