void ServerListItem::DrawItem (BView * parent, BRect frame, bool complete) { parent->SetHighColor (GetItemColor ()); BStringItem::DrawItem (parent, frame, complete); }
// Création d'une fiche d'item void CreateSheet( int numMP, const CSString& nomMP, const CSString& code, char eco, int level, const MPCraftStats& craftStats, bool specialItem = false, int variation = 1 ) { CSString output, directory, itemName, craftInfo, color; CSString outputFileName, ecoStr; char chaineNum[5]; bool creature = ( code != "dxa" ) && ( code != "cxx" ) && ( code != "ixx" ); // Creation du nom de fichier sprintf( chaineNum, "%04d", numMP ); switch ( eco ) { case 'd' : directory = "desert"; ecoStr = "Desert"; break; case 'f' : directory = "forest"; ecoStr = "Forest"; break; case 'j' : directory = "jungle"; ecoStr = "Jungle"; break; case 'l' : directory = "lacustre"; ecoStr = "Lacustre"; break; case 'p' : directory = "prime_roots"; ecoStr = "PrimeRoots"; break; default : directory = "common"; ecoStr = "Common"; eco = 'c'; break; } if ( ( eco == 'c' ) && creature && ( craftStats.Craft == "" ) ) return; outputFileName = toString( "m%04d%s%c%c%02d.sitem", numMP, code.c_str(), eco, 'a' + level, variation ); if ( craftStats.Craft == "" ) { CSString levelZone = toString( "%c", 'a' + level ); currentDocItem.push( DtLevelZone, levelZone.toUpper() ); } else currentDocItem.push( DtLevelZone, "-" ); // remplissage des informations de la fiche output = "<?xml version=\"1.0\"?>\n<FORM Version=\"0.0\" State=\"modified\">\n"; output += " <PARENT Filename=\"_m"; output += eco; output += ".sitem\"/>\n <PARENT Filename=\"_m"; output += chaineNum; output += ".sitem\"/>\n"; // le code est celui d'une créature, on doit donc rajouter le parent if ( creature ) { output += " <PARENT Filename=\"_m"; output += code; output += ".sitem\"/>\n"; creature = true; } output += " <STRUCT>\n"; output += " <STRUCT Name=\"mp\">\n"; output += " <ATOM Name=\"MpColor\" Value=\""; // materiaux de missions toujours Beige if ( craftStats.Craft == "" ) { output += "Beige\"/>\n"; if(craftStats.UsedAsCraftRequirement) output += " <ATOM Name=\"UsedAsCraftRequirement\" Value=\"true\"/>\n"; } else { // on récupère la couleur GetItemColor( craftStats.color, eco, level, color ); output += color; output += "\"/>\n"; currentDocItem.push( DtColor, color ); // on ajoute les données de craft output += " <STRUCT Name=\"MpParam\">\n"; for ( uint i=0; i<craftStats.Craft.size(); i++ ) { int bestStat, worstStat1, worstStat2; if ( i == 0 ) { bestStat = craftStats.bestStatA; worstStat1 = craftStats.worstStatA1; worstStat2 = craftStats.worstStatA2; } else if ( i == 1 ) { bestStat = craftStats.bestStatB; worstStat1 = craftStats.worstStatB1; worstStat2 = craftStats.worstStatB2; } else { bestStat = -1; worstStat1 = -1; worstStat2 = -1; } currentDocItem.push( DtProp, toString( "%c", craftStats.Craft.c_str()[i] ).c_str() ); FillCraftData( craftStats.Craft.c_str()[i], eco, level, creature, bestStat, worstStat1, worstStat2, craftInfo ); output += craftInfo; } output += " </STRUCT>\n"; } output += " <ATOM Name=\"MaxQuality\" Value=\""; if ( creature || specialItem || ( code == "cxx" ) ) { CSString maxQuality = toString( "%d", 250 ); output += maxQuality; currentDocItem.push( DtMaxLevel, maxQuality ); } else { CSString maxQuality = toString( "%d", GetMaxQuality( level ) ); output += maxQuality; currentDocItem.push( DtMaxLevel, maxQuality ); } output += "\"/>\n <ATOM Name=\"StatEnergy\" Value=\""; CSString statEnergy; if ( ( variation == 2 ) && ( numMP == 695 ) ) // cas particulier pour le kitin trophy (beurk) statEnergy = "0"; else if ( !creature || ( craftStats.Craft == "" ) ) statEnergy = toString( "%d", GetStatEnergy( level ) ); else if ( variation < 2 ) statEnergy = toString( "%d", GetStatEnergy( level + 1 ) ); output += statEnergy; currentDocItem.push( DtAverageEnergy, statEnergy ); output += "\"/>\n </STRUCT>\n </STRUCT>\n <STRUCT/>\n <STRUCT/>\n <STRUCT/>\n <STRUCT/>\n</FORM>\n"; output.writeToFile( toString( "%s%s\\%s", MP_DIRECTORY.c_str(), directory.c_str(), outputFileName.c_str() ) ); // Génération des noms if ( !specialItem ) { outputFileName = toString( "m%04d%s%c%c%02d", numMP, code.c_str(), eco, 'a' + level, variation ); output = outputFileName; GenerateItemNames( nomMP, eco, level, ( craftStats.Craft == "" ), creature, itemName ); output += "\t" + itemName; itemNames.insert( output ); } currentDocItem.push( DtEcosystem, ecoStr ); currentDocItem.push( DtName, outputFileName ); SortableData.updateItemAppend( currentDocItem, DtName ); currentDocItem.reset( DtName ); currentDocItem.reset( DtEcosystem ); currentDocItem.reset( DtMaxLevel ); currentDocItem.reset( DtAverageEnergy ); currentDocItem.reset( DtTitle ); currentDocItem.reset( DtLevelZone ); currentDocItem.reset( DtStatQuality ); currentDocItem.reset( DtCraftSlotName ); currentDocItem.reset( DtCraftCivSpec ); currentDocItem.reset( DtColor ); }
void CNewTstatSchedulesDlg::Fresh_List() { ListCtrlEx::CStrList strlist; strlist.clear(); strlist.push_back(L""); strlist.push_back(L"Home"); strlist.push_back(L"Work"); strlist.push_back(L"Sleep"); list<Schedule_Node>::iterator it; int index=0; for (it = m_ScheduleList.begin();it!=m_ScheduleList.end();++it) { CString strTime; int Item=index+1; strTime.Format(_T("%d"),Item); WeeeklyList.SetItemText(index,0,strTime); WeeeklyList.SetItemBkColor(index,0,RGB(255,255,255),0); strTime.Format(_T("%02d:%02d"),it->Hour,it->Minite); /*WeeeklyList.InsertItem(index++,L"");*/ WeeeklyList.SetItemText(index,1,strTime); WeeeklyList.SetItemBkColor(index,1,RGB(255,255,255),0); WeeeklyList.SetWhetherShowBkCol(false); //设置Combox for (int col = 2;col<10;col++) { WeeeklyList.SetCellStringList(index, col, strlist); } WeeeklyList.SetItemText(index,2,m_strScheduleMode[it->Monday]); WeeeklyList.SetItemBkColor(index,2,m_COLScheduleMode[it->Monday],0); it->Col_Monday = m_COLScheduleMode[it->Monday]; if (it->Monday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,2); WeeeklyList.SetItemBkColor(index,2,PreviousScheduleColor,0); it->Col_Monday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,3,m_strScheduleMode[it->Tuesday]); WeeeklyList.SetItemBkColor(index,3,m_COLScheduleMode[it->Tuesday],0); it->Col_Tuesday = m_COLScheduleMode[it->Tuesday]; if (it->Tuesday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,3); WeeeklyList.SetItemBkColor(index,3,PreviousScheduleColor,0); it->Col_Tuesday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,4,m_strScheduleMode[it->Wednesday]); WeeeklyList.SetItemBkColor(index,4,m_COLScheduleMode[it->Wednesday],0); it->Col_Wednesday = m_COLScheduleMode[it->Wednesday]; if (it->Wednesday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,4); WeeeklyList.SetItemBkColor(index,4,PreviousScheduleColor,0); it->Col_Wednesday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,5,m_strScheduleMode[it->Thursday]); WeeeklyList.SetItemBkColor(index,5,m_COLScheduleMode[it->Thursday],0); it->Col_Thursday = m_COLScheduleMode[it->Thursday]; if (it->Thursday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,5); WeeeklyList.SetItemBkColor(index,5,PreviousScheduleColor,0); it->Col_Thursday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,6,m_strScheduleMode[it->Friday]); WeeeklyList.SetItemBkColor(index,6,m_COLScheduleMode[it->Friday],0); it->Col_Friday = m_COLScheduleMode[it->Friday]; if (it->Friday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,6); WeeeklyList.SetItemBkColor(index,6,PreviousScheduleColor,0); it->Col_Friday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,7,m_strScheduleMode[it->Saturday]); WeeeklyList.SetItemBkColor(index,7,m_COLScheduleMode[it->Saturday],0); it->Col_Saturday = m_COLScheduleMode[it->Saturday]; if (it->Saturday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,7); WeeeklyList.SetItemBkColor(index,7,PreviousScheduleColor,0); it->Col_Saturday = PreviousScheduleColor; } WeeeklyList.SetItemText(index,8,m_strScheduleMode[it->Sunday]); WeeeklyList.SetItemBkColor(index,8,m_COLScheduleMode[it->Sunday],0); it->Col_Sunday = m_COLScheduleMode[it->Sunday]; if (it->Sunday == 0&&index!=0) { COLORREF PreviousScheduleColor=GetItemColor(index-1,8); WeeeklyList.SetItemBkColor(index,8,PreviousScheduleColor,0); it->Col_Sunday = PreviousScheduleColor; } WeeeklyList.SetItemText(index, 9, m_strScheduleMode[it->Holiday]); WeeeklyList.SetItemBkColor(index, 9, m_COLScheduleMode[it->Holiday], 0); it->Col_Holiday = m_COLScheduleMode[it->Holiday]; if (it->Holiday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 9); WeeeklyList.SetItemBkColor(index, 9, PreviousScheduleColor, 0); it->Col_Holiday = PreviousScheduleColor; } index++; } }
void CNewTstatSchedulesDlg::LoadSheduleDataAndColor() { Read_Multi(g_tstat_id, m_SchduleBuffer, 813, 104, 5); for (int i=0;i<48;i++) { Schedule_Node SN; WeeklyEvent[i].Day = i / 6; if (m_SchduleBuffer[2 * i]>23|| m_SchduleBuffer[2 * i + 1]>59) { continue; } if (m_SchduleBuffer[2*i] == 0 && m_SchduleBuffer[2 * i + 1]==0) { continue; } WeeklyEvent[i].Hour = m_SchduleBuffer[2 * i]; WeeklyEvent[i].Minite = m_SchduleBuffer[2 * i + 1]; WeeklyEvent[i].Event_Number = GetEventNumber(i); SN.Hour = m_SchduleBuffer[2 * i]; SN.Minite = m_SchduleBuffer[2 * i + 1]; if (WeeklyEvent[i].Day == 0) { SN.Monday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 1) { SN.Tuesday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 2) { SN.Wednesday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 3) { SN.Thursday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 4) { SN.Friday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 5) { SN.Saturday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 6) { SN.Sunday = WeeklyEvent[i].Event_Number; } else if (WeeklyEvent[i].Day == 7) { SN.Holiday = WeeklyEvent[i].Event_Number; } InsertAndUpdate_Schdule(SN); } m_ScheduleList.sort(); list<Schedule_Node>::iterator it; int index = 0; for (it = m_ScheduleList.begin(); it != m_ScheduleList.end(); ++it) { it->Col_Monday = m_COLScheduleMode[it->Monday]; if (it->Monday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 2); it->Col_Monday = PreviousScheduleColor; } it->Col_Tuesday = m_COLScheduleMode[it->Tuesday]; if (it->Tuesday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 3); it->Col_Tuesday = PreviousScheduleColor; } it->Col_Wednesday = m_COLScheduleMode[it->Wednesday]; if (it->Wednesday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 4); it->Col_Wednesday = PreviousScheduleColor; } it->Col_Thursday = m_COLScheduleMode[it->Thursday]; if (it->Thursday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 5); it->Col_Thursday = PreviousScheduleColor; } it->Col_Friday = m_COLScheduleMode[it->Friday]; if (it->Friday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 6); it->Col_Friday = PreviousScheduleColor; } it->Col_Saturday = m_COLScheduleMode[it->Saturday]; if (it->Saturday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 7); it->Col_Saturday = PreviousScheduleColor; } it->Col_Sunday = m_COLScheduleMode[it->Sunday]; if (it->Sunday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 8); it->Col_Sunday = PreviousScheduleColor; } it->Col_Holiday = m_COLScheduleMode[it->Holiday]; if (it->Holiday == 0 && index != 0) { COLORREF PreviousScheduleColor = GetItemColor(index - 1, 9); it->Col_Holiday = PreviousScheduleColor; } index++; } }
void ListBox::DrawContent(const Rect& ctrl_rect) { SizeColumns(); Rect item_rect = ctrl_rect; item_rect.h = line_height; int h = rect.h; // draw headings at top, if needed: if (show_headings) { Color save_color = back_color; back_color = ShadeColor(back_color, 1.3); font->SetColor(fore_color); int max_column = columns.size()-1; item_rect.h += HEADING_EXTRA; page_size = (h-item_rect.h) / (line_height + leading); for (int column = 0; column <= max_column; column++) { item_rect.w = GetColumnWidth(column); // draw heading button FillRect(item_rect, back_color); DrawStyleRect(item_rect, WIN_RAISED_FRAME); Rect title_rect = item_rect; title_rect.Deflate(3,3); DrawText(GetColumnTitle(column), 0, title_rect, DT_CENTER|DT_SINGLELINE); item_rect.x += item_rect.w; } item_rect.y += item_rect.h; back_color = save_color; item_rect.h = line_height; } int index = 0; ListIter<ListBoxItem> iter = items; while (++iter && item_rect.y < h) { ListBoxItem* item = iter.value(); if (index++ >= top_index) { // draw main item: int column = 0; item_rect.x = ctrl_rect.x; item_rect.w = GetColumnWidth(column) - 2; if (item_rect.y + item_rect.h > h) { item_rect.h = h - item_rect.y - 1; } Color item_color = GetItemColor(index-1, 0); if (item->selected) { font->SetColor(selected_color); if (seln_style == LIST_ITEM_STYLE_FILLED_BOX) FillRect(item_rect, selected_color * 0.25); if (seln_style >= LIST_ITEM_STYLE_BOX) DrawRect(item_rect, selected_color); } else { font->SetColor(item_color); if (item_style == LIST_ITEM_STYLE_FILLED_BOX) FillRect(item_rect, item_color * 0.25); if (item_style >= LIST_ITEM_STYLE_BOX) DrawRect(item_rect, item_color); } Rect text_rect = item_rect; if (item->image && item->image->Width() > 0 && item->image->Height() > 0) { DrawBitmap(text_rect.x, text_rect.y, text_rect.x + text_rect.w, text_rect.y + line_height, item->image); } else { text_rect.Deflate(2,0); DrawText(item->text.data(), item->text.length(), text_rect, GetColumnAlign(column)|DT_SINGLELINE); } // draw subitems: ListIter<ListBoxCell> sub_iter = item->subitems; while (++sub_iter) { ListBoxCell* sub = sub_iter.value(); column++; item_rect.x += item_rect.w + 2; item_rect.w = GetColumnWidth(column) - 2; if (item->selected) { if (seln_style == LIST_ITEM_STYLE_FILLED_BOX) FillRect(item_rect, selected_color * 0.25); if (seln_style >= LIST_ITEM_STYLE_BOX) DrawRect(item_rect, selected_color); } else { if (item_style == LIST_ITEM_STYLE_FILLED_BOX) FillRect(item_rect, item_color * 0.25); if (item_style >= LIST_ITEM_STYLE_BOX) DrawRect(item_rect, item_color); } if (item->selected) font->SetColor(selected_color); else font->SetColor(GetItemColor(index-1, column)); Rect text_rect = item_rect; if (sub->image && sub->image->Width() > 0 && sub->image->Height() > 0) { DrawBitmap(text_rect.x, text_rect.y, text_rect.x + text_rect.w, text_rect.y + line_height, sub->image); } else { text_rect.Deflate(2,0); DrawText(sub->text.data(), sub->text.length(), text_rect, GetColumnAlign(column)|DT_SINGLELINE); } } item_rect.y += line_height + leading; } } }