void SettingsWindow::SaveValues() { auto appSettings(GetAppSettings().lock()); assert(appSettings); GetDieFace(); appSettings->DeathThreshold ( GetValue ( f_table, DeathThreshold ) ); appSettings->CombatantListFont ( GetFontName( f_table, CharListFont ) ); appSettings->AltCombatantListFont( GetFontName( f_table, AltCharListFont ) ); Gtk::TreeModel::iterator iter = f_model->children().begin(); const Gtk::TreeModel::iterator end = f_model->children().end(); // for( ; iter != end; ++iter ) { Gtk::TreeModel::Row row = *iter; const mo_name_t id = row[f_columns.f_id]; const bool active = row[f_columns.f_active]; if( id == (mo_name_t) moName(UltraInit) ) { appSettings->UltraInit( active ); } if( id == (mo_name_t) moName(BleedOut) ) { appSettings->BleedOutDying( active ); } if( id == (mo_name_t) moName(SkipDead) ) { appSettings->SkipDead( active ); } if( id == (mo_name_t) moName(AltDeathRule)) { appSettings->AlternateDeathRule( active ); } if( id == (mo_name_t) moName(NotifyExpiredEffects)) { appSettings->NotifyExpiredEffects( active );} if( id == (mo_name_t) moName(InitOnStart) ) { appSettings->InitOnStart( active ); } if( id == (mo_name_t) moName(ManualInit) ) { appSettings->ManualInit( active ); } if( id == (mo_name_t) moName(GetDC) ) { appSettings->GetDC( active ); } } appSettings->signal_changed().emit(); }
void SettingsWindow::InitTreeView() { auto appSettings(GetAppSettings().lock()); assert(appSettings); f_model = Gtk::ListStore::create( f_columns ); f_treeView.set_model( f_model ); f_treeView.append_column( gettext("Name"), f_columns.f_name ); f_treeView.append_column_editable( gettext("Active"), f_columns.f_active ); Gtk::TreeModel::Row row; // row = *(f_model->append()); row[f_columns.f_id] = moName(UltraInit); row[f_columns.f_name] = gettext("Use Ulta Initiative (roll initiative each round)"); row[f_columns.f_active] = appSettings->UltraInit(); // row = *(f_model->append()); row[f_columns.f_id] = moName(BleedOut); row[f_columns.f_name] = gettext("Bleed Out Dying Combatants"); row[f_columns.f_active] = appSettings->BleedOutDying(); // row = *(f_model->append()); row[f_columns.f_id] = moName(SkipDead); row[f_columns.f_name] = gettext("Skip Dead Combatants"); row[f_columns.f_active] = appSettings->SkipDead(); // row = *(f_model->append()); row[f_columns.f_id] = moName(AltDeathRule); row[f_columns.f_name] = gettext("Use Alternate Death Rule (death at threshold minus character level)"); row[f_columns.f_active] = appSettings->AlternateDeathRule(); // row = *(f_model->append()); row[f_columns.f_id] = moName(NotifyExpiredEffects); row[f_columns.f_name] = gettext("Notify when effects expire on combatant's turn"); row[f_columns.f_active] = appSettings->NotifyExpiredEffects(); // row = *(f_model->append()); row[f_columns.f_id] = moName(InitOnStart); row[f_columns.f_name] = gettext("Roll Initiative on Start"); row[f_columns.f_active] = appSettings->InitOnStart(); // row = *(f_model->append()); row[f_columns.f_id] = moName(ManualInit); row[f_columns.f_name] = gettext("Manual Initiative Entry"); row[f_columns.f_active] = appSettings->ManualInit(); // row = *(f_model->append()); row[f_columns.f_id] = moName(GetDC); row[f_columns.f_name] = gettext("Get DC on Rolls"); row[f_columns.f_active] = appSettings->GetDC(); }
/*************************************************************** ** 作 者: Songyimiao ** 官 网:http://www.miaowlabs.com ** 淘 宝:http://miaowlabs.taobao.com ** 日 期: 2015年11月29日 ** 函数名称: main() ** 功能描述: 主函数 ** 输 入: ** 输 出: ** 备 注: ********************喵呜实验室版权所有************************** ***************************************************************/ void main() { DisableInterrupts;//禁止总中断 DriversInit(); //MCU底层驱动初始化 MPU6050Init(); //MPU6050配置初始化 CarStandInit(); //应用程序变量初始化 UltraInit(); //超声波配置初始化 Delaynms(50); //延时50ms ON_LED0; //指示灯亮起,表示初始化完毕 EnableInterrupts; //使能总中断 while(1) { STC_ISP(); Delaynms(50); //延时50ms if(g_ucUart2Flag>=1) { BluetoothControl(); //蓝牙遥控函数 g_ucUart2Flag = 0; } BatteryChecker(); //电池电量检测(电量不足时,亮红灯) if(EchoFlag) //判断是否测距完成 { g_ucUltraDis=UltraDis();//读取超声波测距结果 } #if DEBUG_UART //调试启用 预编译命令 //若要观察波形进行调试,需将DEBUG_UART设置成1,该版本不需要注释蓝牙控制函数 OutData[0] = g_fCarAngle; OutData[1] = g_fGyroAngleSpeed; OutData[2] = g_fLeftMotorOut ; OutData[3] = g_fAngleControlOut; OutPut_Data(); #endif } }