本文整理汇总了C++中SetDefaults函数的典型用法代码示例。如果您正苦于以下问题:C++ SetDefaults函数的具体用法?C++ SetDefaults怎么用?C++ SetDefaults使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetDefaults函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDefaults
CAnimationItem::CAnimationItem( CAnimationEngine* pAE )
{
SetDefaults();
m_pAE = pAE;
}
示例2: SetDefaults
vtEdgeFeature::vtEdgeFeature()
{
SetDefaults();
}
示例3: Init
CMapChecker::CMapChecker()
{
Init();
SetDefaults();
}
示例4: fopen
bool Options::Load (int argc_, char* argv_[])
{
FILE* hfOptions = fopen(OSD::MakeFilePath(MFP_SETTINGS, OPTIONS_FILE), "r");
if (hfOptions)
{
char szLine[256];
while (fgets(szLine, sizeof(szLine), hfOptions))
{
char *pszValue = strchr(szLine, '=');
char *pszName = strtok(szLine, " \t=");
if (!pszName || !pszValue)
continue;
// Skip delimiters up to the value, and take the value up to a <CR> or <LF>
pszValue++;
strtok(pszValue += strspn(pszValue, " \t=\r\n"), "\r\n");
// Look for the option in the list
for (OPTION* p = aOptions ; p->pcszName ; p++)
{
if (!strcasecmp(pszName, p->pcszName))
{
// Remember that a value has been found for this option
p->fSpecified = true;
// Extract the appropriate value type from the string
switch (p->nType)
{
case OT_BOOL: *p->pf = *pszValue ? IsTrue(pszValue) : p->fDefault; break;
case OT_INT: *p->pn = *pszValue ? atoi(pszValue) : p->nDefault; break;
case OT_STRING: strcpy(p->ppsz, *pszValue ? pszValue : p->pcszDefault); break;
}
}
}
}
// We're done with the file
fclose(hfOptions);
}
// Set the default values for any missing options, or all if the config version has changed
bool fIncompatible = GetOption(cfgversion) != CFG_VERSION;
SetDefaults(fIncompatible);
// Process any commmand-line arguments to look for options
while (argc_ && --argc_)
{
const char* pcszOption = *++argv_;
if (*pcszOption == '-')
{
// Find the option in the list of known options
OPTION* p = FindOption(pcszOption+1);
if (p)
{
switch (p->nType)
{
case OT_BOOL: *p->pf = (argv_[1] && *argv_[1] == '-') || (argc_-- && IsTrue(*++argv_)); continue;
case OT_INT: *p->pn = atoi(*++argv_); break;
case OT_STRING: strcpy(p->ppsz, *++argv_); break;
}
argc_--;
}
else
TRACE("Unknown command-line option: %s\n", pcszOption);
}
else
{
static int nDrive = 1;
// Bare filenames will be inserted into drive 1 then 2
switch (nDrive++)
{
case 1:
SetOption(disk1, pcszOption);
SetOption(drive1,drvFloppy);
g_nAutoLoad = AUTOLOAD_DISK;
break;
case 2:
SetOption(disk2, pcszOption);
SetOption(drive2,drvFloppy);
break;
default:
TRACE("Unexpected command-line parameter: %s\n", pcszOption);
break;
}
}
}
return true;
}
示例5: ParseArgs
int ParseArgs(int argc, char *argv[], user_settings *set)
{
if (argv == NULL || set == NULL)
return USR_PTR_PASS_FAIL;
if (argc < 2) {
DisplayHelp(argv[0]);
return USR_HELP;
}
// Detecting Help Requried
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-help") == 0) {
DisplayHelp(argv[0]);
return USR_HELP;
}
else if (strcmp(argv[i], "-exthelp") == 0) {
DisplayExtendedHelp(argv[0]);
return USR_HELP;
}
}
// Allocating Memory for Content Path Ptrs
set->common.contentPath = calloc(CIA_MAX_CONTENT, sizeof(char*));
if (set->common.contentPath == NULL) {
fprintf(stderr, "[SETTING ERROR] Not Enough Memory\n");
return USR_MEM_ERROR;
}
// Initialise Keys
InitKeys(&set->common.keys);
// Setting Defaults
SetDefaults(set);
// Parsing Arguments
int set_result;
for (int i = 1; i < argc; i += set_result) {
set_result = SetArgument(argc, i, argv, set);
if (set_result < 1) {
fprintf(stderr, "[RESULT] Invalid arguments, see '%s -help'\n", argv[0]);
return set_result;
}
}
// Checking arguments
if ((set_result = CheckArgumentCombination(set)) != 0)
return set_result;
// Setting Keys
if ((set_result = SetKeys(&set->common.keys)) != 0)
return set_result;
// Generating outpath if required
if (!set->common.outFileName) {
char *source_path = NULL;
if (set->ncch.buildNcch0)
source_path = set->common.rsfPath;
else if (set->common.workingFileType == infile_ncsd || set->common.workingFileType == infile_cia || set->common.workingFileType == infile_srl)
source_path = set->common.workingFilePath;
else
source_path = set->common.contentPath[0];
set->common.outFileName_mallocd = true;
set->common.outFileName = replace_filextention(source_path, GetOutputExtention(set->common.outFormat));
}
return 0;
}
示例6: main
//.........这里部分代码省略.........
#endif
pMono->Out("Attempting connection...\n");
int1 = (int)pCommMgr->Connect();
errVal = (TComm::ERROR)int1;
if(errVal != TComm::ALL_OK)
{
pMono->Out("Main() - error, commMgr->Connect() failed\n");
sleep(1);
pBam->fNetworkTest = FALSE;
}
else
{
pMono->Out("Main() - connection established\n");
pBam->playerTypes[(pBam->playerSide == SIDE1)? SIDE2: SIDE1] = pCommMgr->GetUserID();
pMono->Out("User ID==%d\n", pCommMgr->GetUserID());
// sleep(2);
}
}
pMono->Out("TIGRE engine initialized\n");
ReportFreeMem();
// side1 and side2 MUST have a player setting of some kind
if(pBam->playerTypes[SIDE1] == PLAYER_NONE)
pBam->playerTypes[SIDE1] = PLAYER_COMPUTER;
if(pBam->playerTypes[SIDE2] == PLAYER_NONE)
pBam->playerTypes[SIDE2] = PLAYER_COMPUTER;
// initial room
if(pBam->fDefaultScenario)
{
SetDefaults(pBam->scenarioName);
bGlobal.roomMgr.NewRoom(BR_WORLD); // skip everything, go to game
}
else if(bGlobal.storyLine == SHOW_OFF)
{
bGlobal.roomMgr.NewRoom(BR_WORLD); // skip everything, go to game
}
else if(pBam->fNoIntro)
bGlobal.roomMgr.NewRoom(BR_MENU); // skip intro, go to story selector
else bGlobal.roomMgr.NewRoom(BR_CINE); // skip nothing
bGlobal.roomMgr.CheckRoomChange();
#ifdef OS_MAC
#include "menubar.hpp"
DS9MenuBar *pMenuBar;
TRACK_MEM("menuBar"); MenuBar.Init();
#endif
ticks_t currTicks = ATicks();
int snapShot = 0;
// anti-piracy stuff
pFile = fopen("HMICARDS.386", "rb");
if(!pFile)
bGlobal.antiPiracyCrashFlag &= 0xFFFFF0FF;
else
{
for(loop1 = 0; loop1 < 5; loop1++)
{
char string1[128];
unsigned long lineCheck1, lineCheck2;
示例7: SetDefaults
bool Params::SetParams( int argvT, char* argcT[] )
{
string option, value;
string::size_type i1, i2;
string cfgfile = CONFIGFILE;
bool showconf = false;
SetDefaults();
while ( --argvT )
{
value = *++argcT;
i1 = value.find_first_not_of("-");
//No GNU options
if ( i1 == 1 )
{
option = value.substr(i1, 1);
if ( option == "c" )
{
--argvT;
if ( argvT == 0 )
{
Usage();
return false;
}
value = *++argcT;
}
else if ( option == "s" ) //
{
showconf = true;
}
else
{
Usage();
return false;
}
}
//GNU options
else if ( i1 == 2 )
{
if ( (i2 = value.find("=")) != string::npos )
{
option = value.substr(i1, i2 - i1);
if ( value.size() > i2 + 1 )
{
value = value.substr(i2 + 1);
}
else
{
Usage();
return false;
}
}
else
{
option = value.substr(i1);
value = "";
}
}
else
{
Usage();
return false;
}
if ( option == "help" )
{
Usage();
return false;
}
else if ( option == "conf-file" || option == "c" )
{
if (value == "")
{
Usage();
return false;
}
cfgfile = value;
}
else
{
Usage();
return false;
}
}
if ( ReadConfig( cfgfile ) == false )
{
return false;
}
return TestConfig();
}
示例8: SetDefaults
SynfireParameters::SynfireParameters( int argc, char *argv[] ) {
SetDefaults();
std::string cmd;
for (int i = 1; i < argc; ++i) {
cmd = argv[i];
if (cmd[0] != '-') continue;
switch (cmd[1]) {
case 'L': // Synapses are static
plasticity = false;
break;
//OUTPUT & ANALYSIS FLAGS
case 'd': // '-d' outputs various statistics after each trial for diagnostic purposes (i.e. spk count, avg volt, etc)
stats_on = 1;
//~ PARAMETER FLAGS
case 'A': // '-A <int>' sets the numbers of trials before termination of the run (default is 200000)
trials = atoi(argv[++i]);
break;
case 'C': // '-C <float>' sets the number of ms per trial (default is 2000)
trial_duration = atof(argv[++i]);
break;
case 'B': // '-B <int>' sets the number of training neurons (default is 10)
ntrain = atoi(argv[++i]);
break;
case 'D': // '-D <int>' sets the max number of supersynapses a neuron may have
tempNSS = atoi(argv[++i]);
break;
case 'c': // '-c <double>' sets the decay rate of the synapses (default is .999996)
syndec = atof(argv[++i]);
break;
case 'f': // '-f <double>' sets the fraction of synapses initially active (default is .1)
frac = atof(argv[++i]);
if (frac >= 1 || frac < 0) {
std::cerr << "Command line input -f is invalid, must be <1 and >=0" << std::endl;
exit(1);
}
break;
case 'g': // '-g <float>' sets GLTP
eq_syn = atof(argv[++i]);
break;
case 'i': // '-i <double>' sets the amplitude of the global inhibition (default is .3)
global_i = atof(argv[++i]);
break;
case 'j': // '-j <float>' sets the inhibition delay
inh_d = atof(argv[++i]);
break;
case 'm': // '-m <double>' sets the excitatory spontaneous frequency (default is 40Hz)
exfreq = atof(argv[++i]);
break;
case 'n':// '-n <double>' sets the inhibitory spontaneous frequency (default is 200Hz)
infreq = atof(argv[++i]);
break;
case 'o':// '-o <double>' sets the amplitude of the spontaneous excitation (default is 1.3)
examp = atof(argv[++i]);
break;
case 'p':// '-p <double>' sets the amplitude of the spontaneous inhibition (default is .1)
inamp = atof(argv[++i]);
break;
case 'q':// '-q <double>' sets the active syn threshold (default is .2)
act = atof(argv[++i]);
break;
case 'r':// '-r <double>' sets the super syn threshold (default is .4)
sup = atof(argv[++i]);
break;
case 's':// '-s <double>' sets the synapse maximum (default is .6)
cap = atof(argv[++i]);
break;
case 'u': // '-u <double>' set maximum inhibitory synaptic strength
isynmax = atof(argv[++i]);
break;
case 'x': // '-x <double>' sets spike rate of training excitation (default is 1500 Hz)
training_f = atof(argv[++i]) * 0.001;
//convert to (ms)^(-1)
break;
case 'y': // '-y <double>' sets amplitude of training excitation (default is .7)
training_amp = atof(argv[++i]);
break;
case 'z': // '-z <double>' sets the training excitation duration (default is 8 ms)
//.........这里部分代码省略.........
示例9: AssetImporter
/// Node + Model (static or animated)
ModelImporter::ModelImporter(Context* context, Asset *asset) : AssetImporter(context, asset)
{
SetDefaults();
}
示例10: SetDefaults
//------------------------------------------------------
CRectTracker::CRectTracker( POINT const& Begin, POINT const& End )
{
SetDefaults();
CurPos.Begin = Begin;
CurPos.End = End;
};
示例11: wxFrame
//.........这里部分代码省略.........
grid->SetRowSize( 0, 60 );
grid->SetCellValue( 0, 0, _T("Ctrl+Home\nwill go to\nthis cell") );
grid->SetCellValue( 0, 1, _T("A long piece of text to demonstrate wrapping.") );
grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer);
grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor);
grid->SetCellValue( 0, 2, _T("Blah") );
grid->SetCellValue( 0, 3, _T("Read only") );
grid->SetReadOnly( 0, 3 );
grid->SetCellValue( 0, 4, _T("Can veto edit this cell") );
grid->SetCellValue( 0, 5, _T("Press\nCtrl+arrow\nto skip over\ncells") );
grid->SetRowSize( 99, 60 );
grid->SetCellValue( 99, 99, _T("Ctrl+End\nwill go to\nthis cell") );
grid->SetCellValue( 1, 0, _T("This default cell will overflow into neighboring cells, but not if you turn overflow off."));
grid->SetCellTextColour(1, 2, *wxRED);
grid->SetCellBackgroundColour(1, 2, *wxGREEN);
grid->SetCellValue( 1, 4, _T("I'm in the middle"));
grid->SetCellValue(2, 2, _T("red"));
grid->SetCellTextColour(2, 2, *wxRED);
grid->SetCellValue(3, 3, _T("green on grey"));
grid->SetCellTextColour(3, 3, *wxGREEN);
grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
grid->SetCellValue(4, 4, _T("a weird looking cell"));
grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellRenderer(4, 4, new MyGridCellRenderer);
grid->SetCellValue(3, 0, _T("0"));
grid->SetCellRenderer(3, 0, new wxGridCellBoolRenderer);
grid->SetCellEditor(3, 0, new wxGridCellBoolEditor);
wxGridCellAttr *attr;
attr = new wxGridCellAttr;
attr->SetTextColour(*wxBLUE);
grid->SetColAttr(5, attr);
attr = new wxGridCellAttr;
attr->SetBackgroundColour(*wxRED);
grid->SetRowAttr(5, attr);
grid->SetCellValue(2, 4, _T("a wider column"));
grid->SetColSize(4, 120);
grid->SetColMinimalWidth(4, 120);
grid->SetCellTextColour(5, 8, *wxGREEN);
grid->SetCellValue(5, 8, _T("Bg from row attr\nText col from cell attr"));
grid->SetCellValue(5, 5, _T("Bg from row attr Text col from col attr and this text is so long that it covers over many many empty cells but is broken by one that isn't"));
grid->SetColFormatFloat(6);
grid->SetCellValue(0, 6, _T("3.1415"));
grid->SetCellValue(1, 6, _T("1415"));
grid->SetCellValue(2, 6, _T("12345.67890"));
grid->SetColFormatFloat(7, 6, 2);
grid->SetCellValue(0, 7, _T("3.1415"));
grid->SetCellValue(1, 7, _T("1415"));
grid->SetCellValue(2, 7, _T("12345.67890"));
const wxString choices[] =
{
_T("Please select a choice"),
_T("This takes two cells"),
_T("Another choice"),
};
grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices));
grid->SetCellSize(4, 0, 1, 2);
grid->SetCellValue(4, 0, choices[0]);
grid->SetCellOverflow(4, 0, false);
grid->SetCellSize(7, 1, 3, 4);
grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellValue(7, 1, _T("Big box!"));
wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
topSizer->Add( grid,
1,
wxEXPAND );
#if wxUSE_LOG
topSizer->Add( logWin,
0,
wxEXPAND );
#endif // wxUSE_LOG
SetAutoLayout(true);
SetSizer( topSizer );
topSizer->Fit( this );
Centre();
SetDefaults();
}
示例12: GetIRollup
void ModifierPanelUI::Setup(HINSTANCE hInstance, HWND rollupHWND, const MCHAR *iniFile)
{
//setup rollup
mRollupHwnd = rollupHWND;
IRollupWindow *irollup = GetIRollup(rollupHWND);
if (mMod->GetUIManager()->LoadSingle(iniFile,200,mMod->hSelParams,GetDlgItem(mMod->hSelParams,IDC_SELPARAM1_TOOLBAR)) == 0)
SetDefaults(200,mMod->hSelParams);
else
LoadInActions(200);
if (mMod->GetUIManager()->LoadSingle(iniFile,201,mMod->hSelParams,GetDlgItem(mMod->hSelParams,IDC_SELPARAM2_TOOLBAR)) == 0)
SetDefaults(201,mMod->hSelParams);
else
LoadInActions(201);
if (mMod->GetUIManager()->LoadSingle(iniFile,202,mMod->hSelParams,GetDlgItem(mMod->hSelParams,IDC_SELPARAM3_TOOLBAR)) == 0)
SetDefaults(202,mMod->hSelParams);
else
LoadInActions(202);
if (mMod->GetUIManager()->LoadSingle(iniFile,203,mMod->hSelParams,GetDlgItem(mMod->hSelParams,IDC_SELPARAM4_TOOLBAR)) == 0)
SetDefaults(203,mMod->hSelParams);
else
LoadInActions(203);
if (mMod->GetUIManager()->LoadSingle(iniFile,210,mMod->hEditUVParams,GetDlgItem(mMod->hEditUVParams,IDC_EDITPARAM1_TOOLBAR)) == 0)
SetDefaults(210,mMod->hEditUVParams);
else
LoadInActions(210);
if (mMod->GetUIManager()->LoadSingle(iniFile,211,mMod->hEditUVParams,GetDlgItem(mMod->hEditUVParams,IDC_EDITPARAM2_TOOLBAR)) == 0)
SetDefaults(211,mMod->hEditUVParams);
else
LoadInActions(211);
if (mMod->GetUIManager()->LoadSingle(iniFile,212,mMod->hEditUVParams,GetDlgItem(mMod->hEditUVParams,IDC_EDITPARAM3_TOOLBAR)) == 0)
SetDefaults(212,mMod->hEditUVParams);
else
LoadInActions(212);
if (mMod->GetUIManager()->LoadSingle(iniFile,230,mMod->hPeelParams,GetDlgItem(mMod->hPeelParams,IDC_PEELPARAM1_TOOLBAR)) == 0)
SetDefaults(230,mMod->hPeelParams);
else
LoadInActions(230);
if (mMod->GetUIManager()->LoadSingle(iniFile,231,mMod->hPeelParams,GetDlgItem(mMod->hPeelParams,IDC_PEELPARAM2_TOOLBAR)) == 0)
SetDefaults(231,mMod->hPeelParams);
else
LoadInActions(231);
if (mMod->GetUIManager()->LoadSingle(iniFile,240,mMod->hMapParams,GetDlgItem(mMod->hMapParams,IDC_MAPPARAM1_TOOLBAR)) == 0)
SetDefaults(240,mMod->hMapParams);
else
LoadInActions(240);
if (mMod->GetUIManager()->LoadSingle(iniFile,241,mMod->hMapParams,GetDlgItem(mMod->hMapParams,IDC_MAPPARAM2_TOOLBAR)) == 0)
SetDefaults(241,mMod->hMapParams);
else
LoadInActions(241);
if (mMod->GetUIManager()->LoadSingle(iniFile,242,mMod->hMapParams,GetDlgItem(mMod->hMapParams,IDC_MAPPARAM3_TOOLBAR)) == 0)
SetDefaults(242,mMod->hMapParams);
else
LoadInActions(242);
if (mMod->GetUIManager()->LoadSingle(iniFile,250,mMod->hWrapParams,GetDlgItem(mMod->hWrapParams,IDC_WRAPPARAM1_TOOLBAR)) == 0)
SetDefaults(250,mMod->hWrapParams);
else
LoadInActions(250);
ReleaseIRollup(irollup);
mMod->GetUIManager()->UpdateCheckButtons();
//add the toolbars
}
示例13: SetDefaults
Environment::Environment()
{
SetDefaults();
}
示例14: GetCOREInterface
void SideBarUI::Setup(HINSTANCE hInstance, HWND rollupHWND, const MCHAR *iniFile)
{
//setup rollup
mRollupHwnd = rollupHWND;
GetCOREInterface()->RegisterDlgWnd ( mRollupHwnd );
IRollupWindow *irollup = GetIRollup(rollupHWND);
if(NULL == irollup)
{
return;
}
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP1),SideBar1RollupDialogProc, GetString(IDS_QUICKTRANSFORM),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP2),SideBar1RollupDialogProc, GetString(IDS_RESHAPEELEMENTS),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP3),SideBar1RollupDialogProc, GetString(IDS_STITCH),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP4),SideBar1RollupDialogProc, GetString(IDS_EXPLODE),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP5),SideBar1RollupDialogProc, GetString(IDS_PEEL),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP6),SideBar1RollupDialogProc, GetString(IDS_ARRANGEELEMENTS),(LPARAM)mMod );
irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_SIDEBAR_ROLLUP7),SideBar1RollupDialogProc, GetString(IDS_ELEMENTPROPERTIES),(LPARAM)mMod );
for (int i = 0; i < 7; i++)
irollup->Show(i);
UnwrapCustomUI* pUIManager = mMod->GetUIManager();
if(NULL == pUIManager)
{
return;
}
bool bResult = pUIManager->GetIniFileCache().InitCacheFromIniFile(TSTR(iniFile));
//quick transform
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,100,irollup->GetPanelDlg(0),GetDlgItem(irollup->GetPanelDlg(0),IDC_S1_1_TOOLBAR)) > 0)
LoadInActions(100);
else
SetDefaults(100,irollup->GetPanelDlg(0));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,101,irollup->GetPanelDlg(0),GetDlgItem(irollup->GetPanelDlg(0),IDC_S1_2_TOOLBAR)) > 0)
LoadInActions(101);
else
SetDefaults(101,irollup->GetPanelDlg(0));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,102,irollup->GetPanelDlg(0),GetDlgItem(irollup->GetPanelDlg(0),IDC_S1_3_TOOLBAR)) > 0)
LoadInActions(102);
else
SetDefaults(102,irollup->GetPanelDlg(0));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,103,irollup->GetPanelDlg(0),GetDlgItem(irollup->GetPanelDlg(0),IDC_S1_4_TOOLBAR)) > 0)
LoadInActions(103);
else
SetDefaults(103,irollup->GetPanelDlg(0));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,104,irollup->GetPanelDlg(0),GetDlgItem(irollup->GetPanelDlg(0),IDC_S1_5_TOOLBAR)) > 0)
LoadInActions(104);
else
SetDefaults(104,irollup->GetPanelDlg(0));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,110,irollup->GetPanelDlg(1),GetDlgItem(irollup->GetPanelDlg(1),IDC_S2_1_TOOLBAR)) > 0)
LoadInActions(110);
else
SetDefaults(110,irollup->GetPanelDlg(1));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,120,irollup->GetPanelDlg(2),GetDlgItem(irollup->GetPanelDlg(2),IDC_S3_1_TOOLBAR)) > 0)
LoadInActions(120);
else
SetDefaults(120,irollup->GetPanelDlg(2));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,130,irollup->GetPanelDlg(3),GetDlgItem(irollup->GetPanelDlg(3),IDC_S4_1_TOOLBAR)) > 0)
LoadInActions(130);
else
SetDefaults(130,irollup->GetPanelDlg(3));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,131,irollup->GetPanelDlg(3),GetDlgItem(irollup->GetPanelDlg(3),IDC_S4_2_TOOLBAR)) > 0)
LoadInActions(131);
else
SetDefaults(131,irollup->GetPanelDlg(3));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,132,irollup->GetPanelDlg(3),GetDlgItem(irollup->GetPanelDlg(3),IDC_S4_3_TOOLBAR)) > 0)
LoadInActions(132);
else
SetDefaults(132,irollup->GetPanelDlg(3));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,140,irollup->GetPanelDlg(4),GetDlgItem(irollup->GetPanelDlg(4),IDC_S5_1_TOOLBAR)) > 0)
LoadInActions(140);
else
SetDefaults(140,irollup->GetPanelDlg(4));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,141,irollup->GetPanelDlg(4),GetDlgItem(irollup->GetPanelDlg(4),IDC_S5_2_TOOLBAR)) > 0)
LoadInActions(141);
else
SetDefaults(141,irollup->GetPanelDlg(4));
if (bResult && pUIManager->LoadSingleFromIniFile(iniFile,142,irollup->GetPanelDlg(4),GetDlgItem(irollup->GetPanelDlg(4),IDC_S5_0_TOOLBAR)) > 0)
LoadInActions(142);
else
SetDefaults(142,irollup->GetPanelDlg(4));
//.........这里部分代码省略.........
示例15: Device
/*
* Create a new device
*/
SPIDevice::SPIDevice(SPIPlugin *owner,
Preferences *prefs,
PluginAdaptor *plugin_adaptor,
const string &spi_device,
ola::rdm::UIDAllocator *uid_allocator)
: Device(owner, SPI_DEVICE_NAME),
m_preferences(prefs),
m_plugin_adaptor(plugin_adaptor),
m_spi_device_name(spi_device) {
size_t pos = spi_device.find_last_of("/");
if (pos != string::npos)
m_spi_device_name = spi_device.substr(pos + 1);
SetDefaults();
unsigned int port_count = 0;
string backend_type = m_preferences->GetValue(SPIBackendKey());
SPIWriter::Options writer_options;
PopulateWriterOptions(&writer_options);
m_writer.reset(new SPIWriter(spi_device, writer_options,
plugin_adaptor->GetExportMap()));
if (backend_type == HARDWARE_BACKEND) {
HardwareBackend::Options options;
PopulateHardwareBackendOptions(&options);
m_backend.reset(
new HardwareBackend(options, m_writer.get(),
plugin_adaptor->GetExportMap()));
port_count = 1 << options.gpio_pins.size();
OLA_INFO << m_spi_device_name << ", Hardware backend, " << port_count
<< " ports";
} else {
if (backend_type != SOFTWARE_BACKEND) {
OLA_WARN << "Unknown backend_type '" << backend_type
<< "' for SPI device " << m_spi_device_name;
}
SoftwareBackend::Options options;
PopulateSoftwareBackendOptions(&options);
m_backend.reset(
new SoftwareBackend(options, m_writer.get(),
plugin_adaptor->GetExportMap()));
port_count = options.outputs;
OLA_INFO << m_spi_device_name << ", Software backend, " << port_count
<< " ports";
}
for (uint8_t i = 0; i < port_count; i++) {
SPIOutput::Options spi_output_options(i);
uint8_t pixel_count;
if (StringToInt(m_preferences->GetValue(PixelCountKey(i)), &pixel_count)) {
spi_output_options.pixel_count = pixel_count;
}
auto_ptr<UID> uid(uid_allocator->AllocateNext());
if (!uid.get()) {
OLA_WARN << "Insufficient UIDs remaining to allocate a UID for SPI port "
<< static_cast<int>(i);
continue;
}
m_spi_ports.push_back(
new SPIOutputPort(this, m_backend.get(), *uid.get(),
spi_output_options));
}
}