void EditCoursesSongMenu::LoadFromCourseEntry( const CourseEntry *pEntry ) { ZERO( m_iSelection ); if( pEntry->pSong ) { /* Set this song's group. */ SetGroupByName( pEntry->pSong->m_sGroupName ); unsigned i; for( i = 0; i < m_aSongs.size(); ++i ) if( m_aSongs[i] == pEntry->pSong ) break; ASSERT_M( i < m_aSongs.size(), ssprintf("%s", pEntry->pSong->GetTranslitMainTitle().c_str()) ); m_iSelection[ROW_SONG] = i; } else if( pEntry->group_name != "" ) { SetGroupByName( pEntry->group_name ); } m_iSelection[ROW_TYPE] = pEntry->type; m_iSelection[ROW_DIFFICULTY] = (pEntry->difficulty == DIFFICULTY_INVALID)? 0:pEntry->difficulty+1; m_iSelection[ROW_LOW_METER] = (pEntry->low_meter == -1)? 0:pEntry->low_meter; m_iSelection[ROW_HIGH_METER] = (pEntry->high_meter == -1)? 0:pEntry->high_meter; m_iSelection[ROW_BEST_WORST_VALUE] = pEntry->players_index; /* Make sure we're on an active row. */ if( !g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ) ChangeRow( -1 ); if( !g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ) ChangeRow( +1 ); ASSERT( g_bRowEnabledForType[GetSelectedType()][m_SelectedRow] ); ChangeToRow( m_SelectedRow ); OnRowValueChanged( (Row)0 ); }
//--------------------------------------------------------------- // pt_ModPeriodic button event //--------------------------------------------------------------- void PeriodicalTranDialog::pt_ModPeriodic_clicked(wxCommandEvent &event) { if (dbperiod.GetCount() == 0) { wxMessageBox(_("Periodical transaction not found."),APPTITLE,wxOK|wxICON_EXCLAMATION,this); return; } ipt_dialog->BindData_Periodical(dbperiod.Item(listselect)); ipt_dialog->CenterOnParent(); if (ipt_dialog->ShowModal() == input_ptran_ok) { dbperiod.Item(listselect) = ipt_dialog->GetData_Periodical(); dbperiod.Item(listselect).SetFlag(mod_mt); //for Control wxString arr[5]; //---set timing if (dbperiod.Item(listselect).GetTiming() < 2) { arr[0] = GetTimingString(dbperiod.Item(listselect).GetTiming()) + StrF(_T(": %d %s"),dbperiod.Item(listselect).GetTimingDay(),_("-th day")); }else{ arr[0] = GetTimingString(dbperiod.Item(listselect).GetTiming()); } //---set account arr[1] = wxGetApp().AppDB.GetAccount(dbperiod.Item(listselect).GetBudget().GetHandling()).GetName(); //---set expense and item of expense wxString sql = StrF(_T("select ex_name, it_name from db_expense, db_items where ex_id = %d and it_id = %d and ex_id = it_expense;"), dbperiod.Item(listselect).GetBudget().GetExpense(),dbperiod.Item(listselect).GetBudget().GetItems()); wxSQLite3ResultSet rset = wxGetApp().SQLDB().ExecuteQuery(sql); while (rset.NextRow()) { arr[2] = rset.GetString(0) + _T(", ") + rset.GetString(1); } //---set income or expenditure if (dbperiod.Item(listselect).GetBudget().GetIncome() > 0) { arr[3] = IntToStr(dbperiod.Item(listselect).GetBudget().GetIncome()); }else if (dbperiod.Item(listselect).GetBudget().GetExpenditure() > 0) { arr[3] = IntToStr(dbperiod.Item(listselect).GetBudget().GetExpenditure()); }else{ arr[3] = _T("0"); } //---set memo arr[4] = dbperiod.Item(listselect).GetBudget().GetMemo(); ChangeRow(pt_PeriodicalList,listselect,arr,5); } }
void EditCoursesSongMenu::Down() { if( ChangeRow( +1 ) ) m_soundChangeRow.Play(); }
void EditCoursesSongMenu::Up() { if( ChangeRow( -1 ) ) m_soundChangeRow.Play(); }