本文整理汇总了C++中Filename::FileSelect方法的典型用法代码示例。如果您正苦于以下问题:C++ Filename::FileSelect方法的具体用法?C++ Filename::FileSelect怎么用?C++ Filename::FileSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filename
的用法示例。
在下文中一共展示了Filename::FileSelect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveResult
/*********************************************************************\
Function name : CCompareTableDialog::SaveResult
Description :
Created at : 10.10.01, @ 22:16:07
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CCompareTableDialog::SaveResult()
{
Filename fn;
if (!fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, String())) return;
Int32 lMaxLen = 0;
Int32 a, lNumItems;
lNumItems = m_wndOutputList.GetItemCount();
for (a = 0; a < lNumItems; a++)
{
BaseContainer data;
m_wndOutputList.GetItem(a, &data);
lMaxLen = LMax(lMaxLen, data.GetString(COMPARE_LIST_NAME).GetLength());
}
lMaxLen += 2;
AutoAlloc <BaseFile> pFile;
if (!pFile)
return;
pFile->Open(fn, FILEOPEN_WRITE);
for (a = 0; a < lNumItems; a++)
{
BaseContainer data;
m_wndOutputList.GetItem(a, &data);
String str = data.GetString(COMPARE_LIST_NAME);
WriteString(pFile, str);
Int32 b = lMaxLen - str.GetLength();
while (b--) WriteString(pFile, " ");
WriteString(pFile, data.GetString(COMPARE_LIST_DATA));
LineBreak(pFile, "");
}
}
示例2: Command
Bool DiffDistriDialog::Command(Int32 id, const BaseContainer &msg)
{
switch (id)
{
case IDC_DIFF_DISTRI_NEW_BTN:
{
Filename fn;
if (fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, GeLoadString(IDS_DIFF_DISTRI_CHOOSE)))
{
if (!fn.CheckSuffix("zip"))
{
GeOutString(GeLoadString(IDS_DIFF_DISTRI_INVALID_SUFFIX), GEMB_OK | GEMB_ICONSTOP);
}
else
{
g_pResEditPrefs->arOldFiles.AddFilename(fn);
m_pTreeView->Refresh();
}
}
}
break;
case IDC_DIFF_DISTRI_REMOVE_BTN:
if (m_fnSelection.Content())
{
g_pResEditPrefs->arOldFiles.RemoveFilename(m_fnSelection);
m_fnSelection = Filename();
m_pTreeView->Refresh();
}
break;
case IDC_DIFF_DISTRI_NEWZIP_EDIT:
g_pResEditPrefs->fnNewZip = m_pNewZipEdit->GetData().GetValue().GetFilename();
break;
case IDC_DIFF_DISTRI_DESTPATH_EDIT:
{
Filename fnDestZip = m_pDestPathEdit->GetData().GetValue().GetFilename();
g_pResEditPrefs->fnDestZip = fnDestZip;
g_pResEditPrefs->fnDestZip.SetSuffix("zip");
if (fnDestZip.Content() && g_pResEditPrefs->fnDestZip != fnDestZip)
m_pDestPathEdit->SetData(TriState<GeData>(g_pResEditPrefs->fnDestZip));
}
break;
case IDC_OK:
{
GeData d;
String strPassword;
Int32 lLen = 0;
char* pchPassword = nullptr;
Filename fnDestZip = m_pDestPathEdit->GetData().GetValue().GetFilename();
g_pResEditPrefs->fnNewZip = m_pNewZipEdit->GetData().GetValue().GetFilename();
g_pResEditPrefs->fnDestZip = fnDestZip;
g_pResEditPrefs->fnDestZip.SetSuffix("zip");
if (fnDestZip.Content() && g_pResEditPrefs->fnDestZip != fnDestZip)
m_pDestPathEdit->SetData(TriState<GeData>(g_pResEditPrefs->fnDestZip));
GetString(IDC_DIFF_DISTRI_PASSWORD_EDIT, strPassword);
lLen = strPassword.GetCStringLen(STRINGENCODING_8BIT);
if (lLen)
{
pchPassword = NewMemClear(Char,lLen + 2);
if (pchPassword)
strPassword.GetCString(pchPassword, lLen + 1, STRINGENCODING_8BIT);
}
if (!g_pResEditPrefs->arOldFiles.GetElementCount())
{
GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_OLD), GEMB_ICONSTOP);
DeleteMem(pchPassword);
break;
}
if (!g_pResEditPrefs->fnNewZip.Content())
{
GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_NEW), GEMB_ICONSTOP);
DeleteMem(pchPassword);
break;
}
if (!g_pResEditPrefs->fnDestZip.Content())
{
GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_DEST), GEMB_ICONSTOP);
DeleteMem(pchPassword);
break;
}
if (!DiffZipFiles(g_pResEditPrefs->arOldFiles, g_pResEditPrefs->fnNewZip, g_pResEditPrefs->fnDestZip, pchPassword))
GeOutString(GeLoadString(IDS_DIFF_DISTRI_FAILED, g_pResEditPrefs->fnNewZip.GetString(), g_pResEditPrefs->fnDestZip.GetString()), GEMB_OK | GEMB_ICONEXCLAMATION);
DeleteMem(pchPassword);
}
break;
case IDC_CANCEL:
Close();
break;
default:
break;
}
//.........这里部分代码省略.........
示例3: Command
Bool PaletteSubDialog::Command(Int32 id,const BaseContainer &msg)
{
GeDynamicArray<Palette> pals;
Palette pal;
Filename fn;
switch (id)
{
case 3:
switch(msg.GetInt32(BFM_ACTION_VALUE)){
case ACTION_NEW:
pal.SetColor(0, Color(0.f, 0.f, 0.f).SetSource(COLOR_SOURCE_DISPLAY));
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
return TRUE;
case ACTION_LOAD:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, "Load")){
String s = fn.GetString();
if(Palette::LoadASEFile(s, pal)){
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
}
}
return TRUE;
case ACTION_SAVE:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, "Save", "ase")){
String s = fn.GetString();
Palette::SaveASEFile(s, m_palette);
}
return TRUE;
case ACTION_LABEL:
ShowControls(!m_showControls);
return TRUE;
}
if(msg.GetInt32(BFM_ACTION_VALUE) >= ACTION_COUNT){
m_controlsShown = FALSE;
LoadPalette(msg.GetInt32(BFM_ACTION_VALUE)-ACTION_COUNT);
SaveSettings();
}
return TRUE;
case IDC_LAYOUT_DIRECTION:
m_controlsShown = FALSE;
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_ROWS:
PaletteLayout();
SaveSettings();
break;
case IDC_LABELCHECKBOX:
GetBool(m_labelCheckArea, m_showLabel);
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_NAME:
if(m_nameArea != NULL){
GetString(m_nameArea, m_palette.m_name);
Palette::SetPaletteName(m_paletteID, m_palette.m_name);
LoadPalette(m_paletteID);
}
break;
case IDC_HIDE:
ShowControls(FALSE);
break;
case IDC_SEARCHTEXT:
PaletteLayout();
SaveSettings();
break;
case IDC_CREATEMATERIAL:
{
Bool linkColors;
GetBool(m_linkColor,linkColors);
for(Int32 i=m_palette.m_colors.GetCount()-1;i>=0;--i){
BaseMaterial *mat = BaseMaterial::Alloc(Mmaterial);
String name = "PaletteMaterial";
if(m_palette[i].m_name != ""){
name = m_palette[i].m_name;
}
mat->SetName(name);
if(mat != nullptr){
BaseChannel *chan = mat->GetChannel(CHANNEL_COLOR);
if(chan != nullptr){
BaseContainer bc;
if(linkColors){
bc.SetInt32(BASECHANNEL_SHADERID, PALETTE_SHADER_ID);
chan->SetData(bc);
BaseShader *bs = chan->GetShader();
BaseContainer* data = bs->GetDataInstance();
data->SetInt32(PALETTESHADER_PALETTE_ID, 1+m_paletteID);
data->SetInt32(PALETTESHADER_COLOR_ID, 1+i);
} else {
// Color Shader ID: 5832
bc.SetInt32(BASECHANNEL_SHADERID, 5832);
chan->SetData(bc);
//.........这里部分代码省略.........
示例4: Command
/*********************************************************************\
Function name : CResEditBrowser::Command
Description :
Created at : 25.09.01, @ 22:33:39
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
Bool CResEditBrowser::Command(Int32 lID, const BaseContainer &msg)
{
switch (lID)
{
case IDC_BROWSE_BUTTON: {
Filename fn = m_strPath;
AutoAlloc <BrowseFiles> pFiles;
pFiles->Init(Filename("\\"), false);
if (!m_strPath.Content())
fn = GeGetStartupPath() + String("resource");
if (fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_DIRECTORY, GeLoadString(IDS_SPECIFY_RES_PATH)))
{
m_strPath = fn;
FillList();
}
break;
}
case IDC_DIRECTORY_TREE: {
TreeViewItem* pSelItem = (TreeViewItem*)msg.GetVoid(TREEVIEW_MESSAGE_ITEM);
Int32 lType = msg.GetInt32(TREEVIEW_MESSAGE_TYPE);
if (!pSelItem) break;
if (lType == TREEVIEW_DOUBLECLICK)
{
Filename fn = pSelItem->GetData()->GetString(ITEM_PATH_NAME);
if (fn.CheckSuffix("res"))
{
// open the resource file
if (!g_bWasActive)
{ CResEditMenu m; m.Execute(nullptr); }
if (!g_pTreeDialog) break;
g_pTreeDialog->OpenDialog(fn);
}
else if (fn.CheckSuffix("str"))
{
CDialogDoc tempDoc;
tempDoc.LoadGlobalStringTable(m_strPath, pSelItem->GetData()->GetString(TREEVIEW_TEXT));
CStringtableDialog dlg(&tempDoc, true);
if (dlg.Open())
{
if (GeOutString(GeLoadString(IDS_SAVE_STRINGTABLE), GEMB_YESNO | GEMB_ICONQUESTION) == GEMB_R_YES)
{
tempDoc.SaveGlobalStringTable();
}
}
}
else if (fn.Content())
{
// open the file (it may be an image)
GeExecuteFile(fn);
}
return true;
}
else if (lType == TREEVIEW_SELCHANGE)
{
m_dirText = pSelItem->GetData()->GetString(ITEM_PATH_NAME);
}
break;
}
};
return GeDialog::Command(lID, msg);
}