bool CButton::ProcessInput( const TInputMsg & tData ) { if ( IsMouseOver( g_pUIManager->GetMousePos() ) ) SetText( "Over" ); else SetText( "OK" ); switch ( tData.eType ) { case IMT_MOUSE_MOVE_X: case IMT_MOUSE_MOVE_Y: { if ( IsMouseOver( g_pUIManager->GetMousePos() ) ) { if ( this == g_pUIManager->GetActiveControl() ) { m_bPressed = true; } } else { m_bPressed = false; } } break; case IMT_MOUSE_LKEY: { if ( IsMouseOver( g_pUIManager->GetMousePos() ) ) { if ( tData.dwData & 0x80 ) { Press(); g_pUIManager->SetActiveControl( this ); } else { if ( this == g_pUIManager->GetActiveControl() ) { g_pUIManager->SetActiveControl( NULL ); MessageBeep( MB_OK ); //if ( m_pParent ) // m_pParent->OnChildEvent( this ); Press( false ); } } return true; } else if ( this == g_pUIManager->GetActiveControl() ) { if ( !( tData.dwData & 0x80 ) ) g_pUIManager->SetActiveControl( NULL ); } } break; } return false; }
void cMenuEditItem::SetValue(const char *Value) { cString buffer = cString::sprintf("%s:\t%s", name, Value); SetText(buffer); cStatus::MsgOsdCurrentItem(buffer); }
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry) { // 0 1 2 3 4 5 6 7 8 9 10 //result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid); // create item before any checks for store correct guid // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB Object::_Create(guid, 0, HIGHGUID_ITEM); // Set entry, MUST be before proto check SetEntry(entry); SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); ItemPrototype const* proto = GetProto(); if (!proto) return false; // set owner (not if item is only loaded for gbank/auction/mail if (owner_guid != 0) SetOwnerGUID(owner_guid); bool need_save = false; // need explicit save data at load fixes SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER)); SetCount(fields[2].GetUInt32()); uint32 duration = fields[3].GetUInt32(); SetUInt32Value(ITEM_FIELD_DURATION, duration); // update duration if need, and remove if not need if ((proto->Duration == 0) != (duration == 0)) { SetUInt32Value(ITEM_FIELD_DURATION, abs(proto->Duration)); need_save = true; } Tokens tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS); if (tokens.size() == MAX_ITEM_PROTO_SPELLS) for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) SetSpellCharges(i, atoi(tokens[i])); SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32()); // Remove bind flag for items vs NO_BIND set if (IsSoulBound() && proto->Bonding == NO_BIND) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, false); need_save = true; } std::string enchants = fields[6].GetString(); _LoadIntoDataField(enchants.c_str(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET); SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt32()); // recalculate suffix factor if (GetItemRandomPropertyId() < 0) UpdateItemSuffixFactor(); uint32 durability = fields[8].GetUInt32(); SetUInt32Value(ITEM_FIELD_DURABILITY, durability); // update max durability (and durability) if need SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability); if (durability > proto->MaxDurability) { SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability); need_save = true; } SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32()); SetText(fields[10].GetString()); if (need_save) // normal item changed state set not work at loading { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ITEM_INSTANCE_ON_LOAD); stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION)); stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS)); stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY)); stmt->setUInt32(3, guid); CharacterDatabase.Execute(stmt); } return true; }
bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid) { // create item before any checks for store correct guid // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB Object::_Create(guidLow, 0, HIGHGUID_ITEM); if (!LoadValues(fields[0].GetString())) { sLog.outError("Item #%d have broken data in `data` field. Can't be loaded.", guidLow); return false; } SetText(fields[1].GetCppString()); bool need_save = false; // need explicit save data at load fixes // overwrite possible wrong/corrupted guid ObjectGuid new_item_guid = ObjectGuid(HIGHGUID_ITEM, guidLow); if (GetGuidValue(OBJECT_FIELD_GUID) != new_item_guid) { SetGuidValue(OBJECT_FIELD_GUID, new_item_guid); need_save = true; } ItemPrototype const* proto = GetProto(); if(!proto) return false; // update max durability (and durability) if need if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) { SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability); if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability) SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability); need_save = true; } // recalculate suffix factor if(GetItemRandomPropertyId() < 0) { if(UpdateItemSuffixFactor()) need_save = true; } // Remove bind flag for items vs NO_BIND set if (IsSoulBound() && proto->Bonding == NO_BIND) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED, false); need_save = true; } // update duration if need, and remove if not need if ((proto->Duration == 0) != (GetUInt32Value(ITEM_FIELD_DURATION) == 0)) { SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration); need_save = true; } // set correct owner if (!ownerGuid.IsEmpty() && GetOwnerGuid() != ownerGuid) { SetOwnerGuid(ownerGuid); need_save = true; } // Insert to Refundable map if(GetPlayedtimeField()) { std::pair< uint64, uint32 > insertpair; insertpair.first = GetGUID(); insertpair.second = 0; sObjectMgr.mItemRefundableMap.insert(insertpair); } // set correct wrapped state if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED)) { // wrapped item must be wrapper (used version that not stackable) if (!(proto->Flags & ITEM_FLAG_WRAPPER) || GetMaxStackCount() > 1) { RemoveFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED); need_save = true; static SqlStatementID delGifts ; // also cleanup for sure gift table SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?"); stmt.PExecute(GetGUIDLow()); } } if (need_save) // normal item changed state set not work at loading { static SqlStatementID updItem ; SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?"); std::ostringstream ss; for(uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; stmt.addString(ss); stmt.addUInt32(GetOwnerGuid().GetCounter()); stmt.addUInt32(guidLow); stmt.Execute(); } return true; }
bool MythUIText::ParseElement( const QString &filename, QDomElement &element, bool showWarnings) { if (element.tagName() == "area") { SetArea(parseRect(element)); m_OrigDisplayRect = m_Area; } // else if (element.tagName() == "altarea") // Unused, but maybe in future? // m_AltDisplayRect = parseRect(element); else if (element.tagName() == "font") { QString fontname = getFirstText(element); MythFontProperties *fp = GetFont(fontname); if (!fp) fp = GetGlobalFontMap()->GetFont(fontname); if (fp) { MythFontProperties font = *fp; int screenHeight = GetMythMainWindow()->GetUIScreenRect().height(); font.Rescale(screenHeight); int fontStretch = GetMythUI()->GetFontStretch(); font.AdjustStretch(fontStretch); QString state = element.attribute("state",""); if (!state.isEmpty()) { m_FontStates.insert(state, font); } else { m_FontStates.insert("default", font); *m_Font = m_FontStates["default"]; } } } else if (element.tagName() == "value") { if (element.attribute("lang","").isEmpty()) { m_Message = qApp->translate("ThemeUI", parseText(element).toUtf8(), NULL, QCoreApplication::UnicodeUTF8); } #if 0 else if (element.attribute("lang","").toLower() == gCoreContext->GetLanguageAndVariant()) #else else if (element.attribute("lang","").toLower() == "en_us") #endif { m_Message = parseText(element); } #if 0 else if (element.attribute("lang","").toLower() == gCoreContext->GetLanguage()) #else else if (element.attribute("lang","").toLower() == "en") #endif { m_Message = parseText(element); } m_DefaultMessage = m_Message; SetText(m_Message); } else if (element.tagName() == "template")
void UIStaticText::LoadFromYamlNode(const YamlNode * node, UIYamlLoader * loader) { UIControl::LoadFromYamlNode(node, loader); const YamlNode * fontNode = node->Get("font"); const YamlNode * textNode = node->Get("text"); const YamlNode * multilineNode = node->Get("multiline"); const YamlNode * multilineBySymbolNode = node->Get("multilineBySymbol"); const YamlNode * fittingNode = node->Get("fitting"); const YamlNode * textColorNode = node->Get("textcolor"); const YamlNode * shadowColorNode = node->Get("shadowcolor"); const YamlNode * shadowOffsetNode = node->Get("shadowoffset"); const YamlNode * textAlignNode = node->Get("textalign"); const YamlNode * textColorInheritTypeNode = node->Get("textcolorInheritType"); const YamlNode * shadowColorInheritTypeNode = node->Get("shadowcolorInheritType"); if (fontNode) { const String & fontName = fontNode->AsString(); Font * font = loader->GetFontByName(fontName); SetFont(font); } bool multiline = loader->GetBoolFromYamlNode(multilineNode, false); bool multilineBySymbol = loader->GetBoolFromYamlNode(multilineBySymbolNode, false); SetMultiline(multiline, multilineBySymbol); if(fittingNode) { SetFittingOption(loader->GetFittingOptionFromYamlNode(fittingNode)); } if(textColorNode) { SetTextColor(textColorNode->AsColor()); } if(shadowColorNode) { SetShadowColor(shadowColorNode->AsColor()); } if(shadowOffsetNode) { SetShadowOffset(shadowOffsetNode->AsVector2()); } if (textAlignNode) { SetTextAlign(loader->GetAlignFromYamlNode(textAlignNode)); } if (textNode) { SetText(LocalizedString(textNode->AsWString())); } if (textColorInheritTypeNode) { GetTextBackground()->SetColorInheritType((UIControlBackground::eColorInheritType)loader->GetColorInheritTypeFromNode(textColorInheritTypeNode)); } if (shadowColorInheritTypeNode) { GetShadowBackground()->SetColorInheritType((UIControlBackground::eColorInheritType)loader->GetColorInheritTypeFromNode(shadowColorInheritTypeNode)); } }
void MythUITextEdit::Reset() { SetText(""); }
/**************************************************************************** * KeyDlgProc * * - Redefines keys by processing WM_CHAR's and assigning the key to the * * selected radiobutton (game key) * * - Standard dialog window I/O * ****************************************************************************/ MRESULT EXPENTRY KeyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { int i; static KEY keyTmp[KEYS]; static SHORT id; switch (msg) { case WM_INITDLG: /* Set the associated text for each of the radio buttons */ for (i=0;i<KEYS;i++) { keyTmp[i] = prfProfile.keyDEFS[i]; SetText(hwnd, TEXT_LEFT+i, &prfProfile.keyDEFS[i]); } /* Check the first radio button and let it set up id */ WinSendDlgItemMsg(hwnd, KEY_LEFT, BM_CLICK, MPFROMSHORT(TRUE), MPVOID); return (MRESULT) TRUE; case WM_HELP: i = IDH_KEYS; WinSendMsg(hwndHelp, HM_DISPLAY_HELP, MPFROMP(&i), MPFROMSHORT(HM_RESOURCEID)); return 0; case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: for (i=0;i<KEYS;i++) prfProfile.keyDEFS[i] = keyTmp[i]; case DID_CANCEL: WinDismissDlg(hwnd, 0); return 0; } return 0; case WM_CONTROL: if (SHORT2FROMMP(mp1) == BN_CLICKED) { switch (SHORT1FROMMP(mp1)) { case KEY_LEFT: id = TEXT_LEFT; break; case KEY_RIGHT: id = TEXT_RIGHT; break; case KEY_THRUST: id = TEXT_THRUST; break; case KEY_HYPER: id = TEXT_HYPER; break; case KEY_FIRE: id = TEXT_FIRE; break; case KEY_SHIELD: id = TEXT_SHIELD; } WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd,id)); } return 0; case WM_CHAR: if (!(CHARMSG(&msg)->fs & KC_KEYUP)) { if ((CHARMSG(&msg)->fs & KC_VIRTUALKEY) && (CHARMSG(&msg)->vkey != VK_SHIFT) && (CHARMSG(&msg)->vkey != VK_CTRL) && (CHARMSG(&msg)->vkey != VK_ALT) && (CHARMSG(&msg)->vkey != VK_F1) && (CHARMSG(&msg)->vkey-1 < MAXVKEY)) { if (CHARMSG(&msg)->vkey == VK_F3) { WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_CANCEL, 0), MPVOID); return 0; } keyTmp[id-TEXT_LEFT].vk = (CHAR) (CHARMSG(&msg)->vkey - 1); keyTmp[id-TEXT_LEFT].chr = 0; } else if ((CHARMSG(&msg)->fs & KC_CHAR) && (CHARMSG(&msg)->chr > 32) && (CHARMSG(&msg)->chr < 127)) { keyTmp[id-TEXT_LEFT].vk = 0; keyTmp[id-TEXT_LEFT].chr = (CHAR) CHARMSG(&msg)->chr; } else { keyTmp[id-TEXT_LEFT].vk = 0; keyTmp[id-TEXT_LEFT].chr = 0; } } SetText(hwnd, id, &keyTmp[id-TEXT_LEFT]); return 0; } return WinDefDlgProc(hwnd, msg, mp1, mp2); }
void OPFResource::AutoFixWellFormedErrors() { QWriteLocker locker(&GetLock()); QString source = CleanSource::ProcessXML(GetText(),"application/oebps-package+xml"); SetText(source); }
void TimeConfigPanel::SetLocalTime(RoughTimeDelta utc_offset) { SetText(LocalTime, FormatLocalTimeHHMM((int)CommonInterface::Basic().time, utc_offset)); }
void DataListCtrl::OnSave(wxCommandEvent& event) { long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item != -1) { wxString name = GetText(item, 1); if (GetItemText(item) == "Volume") { wxFileDialog *fopendlg = new wxFileDialog( m_frame, "Save Volume Data", "", "", "Muti-page Tiff file (*.tif, *.tiff)|*.tif;*.tiff|"\ "Single-page Tiff sequence (*.tif)|*.tif;*.tiff|"\ "Nrrd file (*.nrrd)|*.nrrd", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); fopendlg->SetExtraControlCreator(CreateExtraControl); int rval = fopendlg->ShowModal(); if (rval == wxID_OK) { wxString filename = fopendlg->GetPath(); VRenderFrame* vr_frame = (VRenderFrame*)m_frame; if (vr_frame) { VolumeData* vd = vr_frame->GetDataManager()->GetVolumeData(name); if (vd) { vd->Save(filename, fopendlg->GetFilterIndex(), false, VRenderFrame::GetCompression()); wxString str = vd->GetPath(); SetText(item, 2, str); } } } delete fopendlg; } else if (GetItemText(item) == "Mesh") { wxFileDialog *fopendlg = new wxFileDialog( m_frame, "Save Mesh Data", "", "", "OBJ file (*.obj)|*.obj", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); int rval = fopendlg->ShowModal(); if (rval == wxID_OK) { wxString filename = fopendlg->GetPath(); VRenderFrame* vr_frame = (VRenderFrame*)m_frame; if(vr_frame) { MeshData* md = vr_frame->GetDataManager()->GetMeshData(name); if (md) { md->Save(filename); wxString str = md->GetPath(); SetText(item, 2, str); } } } delete fopendlg; } else if (GetItemText(item) == "Annotations") { wxFileDialog *fopendlg = new wxFileDialog( m_frame, "Save Annotations", "", "", "Text file (*.txt)|*.txt", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); int rval = fopendlg->ShowModal(); if (rval == wxID_OK) { wxString filename = fopendlg->GetPath(); VRenderFrame* vr_frame = (VRenderFrame*)m_frame; if(vr_frame) { Annotations* ann = vr_frame->GetDataManager()->GetAnnotations(name); if (ann) { ann->Save(filename); wxString str = ann->GetPath(); SetText(item, 2, str); } } } delete fopendlg; } } }
void SetText(const tstring& s) {SetText(s.c_str());}
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message) { CGUIDialog::OnMessage(message); switch ( message.GetMessage() ) { case GUI_MSG_CLICKED: { int iControl = message.GetSenderId(); switch (iControl) { case CTL_BUTTON_DONE: OnOK(); break; case CTL_BUTTON_CANCEL: Close(); break; case CTL_BUTTON_SHIFT: OnShift(); break; case CTL_BUTTON_CAPS: OnCapsLock(); break; case CTL_BUTTON_SYMBOLS: OnSymbols(); break; case CTL_BUTTON_LEFT: MoveCursor( -1); break; case CTL_BUTTON_RIGHT: MoveCursor(1); break; case CTL_BUTTON_IP_ADDRESS: OnIPAddress(); break; case CTL_BUTTON_CLEAR: SetText(""); break; default: m_lastRemoteKeyClicked = 0; OnClickButton(iControl); break; } } break; case GUI_MSG_SET_TEXT: SetText(message.GetLabel()); // close the dialog if requested if (message.GetParam1() > 0) OnOK(); break; case GUI_MSG_INPUT_TEXT: InputText(message.GetLabel()); break; case GUI_MSG_INPUT_TEXT_EDIT: InputTextEditing(message.GetLabel(), message.GetParam1(), message.GetParam2()); break; } return true; }
void CBSObject::SetWindowText(UINT uiTextResID) { SetText(uiTextResID); }
void TorrentDialog::RefreshList() { if (!IsWindow()) return; Feed* feed = Aggregator.Get(FEED_CATEGORY_LINK); if (!feed) return; // Hide list to avoid visual defects and gain performance list_.Hide(); list_.DeleteAllItems(); // Add items for (auto it = feed->items.begin(); it != feed->items.end(); ++it) { // Skip item if it was discarded and hidden if (it->state == FEEDITEM_DISCARDED_HIDDEN) continue; wstring title, number, video; int group = TORRENT_ANIME, icon = StatusToIcon(0); if (it->category == L"Batch" || InStr(it->title, L"Vol.") > -1) { group = TORRENT_BATCH; } if (!IsNumeric(it->episode_data.number)) { if (it->episode_data.format.empty() || IsEpisodeRange(it->episode_data.number)) { group = TORRENT_BATCH; } else { group = TORRENT_OTHER; } } auto anime_item = AnimeDatabase.FindItem(it->episode_data.anime_id); if (anime_item) { icon = StatusToIcon(anime_item->GetAiringStatus()); title = anime_item->GetTitle(); } else if (!it->episode_data.title.empty()) { title = it->episode_data.title; } else { group = TORRENT_OTHER; title = it->title; } vector<int> numbers; SplitEpisodeNumbers(it->episode_data.number, numbers); number = JoinEpisodeNumbers(numbers); if (!it->episode_data.version.empty()) { number += L"v" + it->episode_data.version; } video = it->episode_data.video_type; if (!it->episode_data.resolution.empty()) { if (!video.empty()) video += L" "; video += it->episode_data.resolution; } int index = list_.InsertItem(it - feed->items.begin(), group, icon, 0, NULL, title.c_str(), reinterpret_cast<LPARAM>(&(*it))); list_.SetItem(index, 1, number.c_str()); list_.SetItem(index, 2, it->episode_data.group.c_str()); list_.SetItem(index, 3, it->episode_data.file_size.c_str()); list_.SetItem(index, 4, video.c_str()); list_.SetItem(index, 5, it->description.c_str()); list_.SetItem(index, 6, it->episode_data.file.c_str()); list_.SetCheckState(index, it->state == FEEDITEM_SELECTED); } // Show again list_.Show(); // Set title wstring title = L"Torrents"; if (!feed->title.empty()) { title = feed->title; } else if (!feed->link.empty()) { win32::Url url(feed->link); title += L" (" + url.Host + L")"; } if (!feed->description.empty()) { title += L" - " + feed->description; } SetText(title.c_str()); }
void Field::HistoryNext() { std::string current = Str::UTF32To8(GetText()); NextLine(hist, current); SetText(Str::UTF8To32(current)); }
void Socket::ParseData(int bytes) { Reader.Reset(); while(Reader.GetOffset() < bytes) { unsigned short opcode = Reader.ReadWord(); switch(opcode) { case C_MESSAGE: //text message { unsigned char *msg; unsigned char *nick; unsigned short size_nick = Reader.ReadByte(); //read nick nick = new unsigned char[size_nick]; Reader.ReadString(nick, size_nick); //read nick string unsigned short size_text = Reader.ReadByte(); //read text size msg = new unsigned char[size_text]; Reader.ReadString(msg, size_text); //read text ShowMessage((char*)msg, size_text, (char*)nick, size_nick); delete [] nick; delete [] msg; break; } case C_CONNECT: //connected { unsigned char *nick; unsigned short size = Reader.ReadByte(); nick = new unsigned char[size]; Reader.ReadString(nick, size); MemberNotice((char*)nick, size, 0); //notice everyone //AddNick((char*)nick, size); delete [] nick; break; } case C_DISCONNECT: //disconnected { unsigned char *nick; unsigned short size = Reader.ReadByte(); nick = new unsigned char[size]; Reader.ReadString(nick, size); MemberNotice((char*)nick, size, 1); delete [] nick; break; } case S_SEND_NICK_LIST: //got from server { for(int x = 0; x < 20; x++) //delete old list ZeroMemory(&NickPar[x], sizeof(Nick)); for(int x = 0; x < 20; x++) //delete nick list SendMessage(NickList, LB_DELETESTRING, 0, 0); int TotalMembers = Reader.ReadByte(); //get total members cur_chatters = TotalMembers; //used for deleting list for(int x = 0; x < TotalMembers; x++) { unsigned int size = Reader.ReadByte(); //get size unsigned char *nick; nick = new unsigned char[size]; Reader.ReadString(nick, size); //get nick if(FindNick((char*)nick, size) > -1) { //nick found do nothing... } else { AddNick((char*)nick, size); UpdateWindow(NickList); } } break; } case S_WHO_ARE_YOU: { Writer.WriteWord(C_WHO_I_AM); // Writer.WriteByte(MyNick.nick_size); //size Writer.WriteString((unsigned char*)MyNick.nick, MyNick.nick_size); //nick Send((char*)Writer.Buffer, Writer.offset); break; } default: { SetText("Unknown opcode"); Reader.SetOffset(1000); break; } } } }
void CDebugProgress::SetPos(int pos, const char*text) { SetPos(pos); SetText(text); }
bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code) { if(id == IDC_BROWSE && code == BN_CLICKED) { char buff[MAX_PATH] = {0}; OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = m_hWnd; ofn.lpstrFile = buff; ofn.nMaxFile = countof(buff); ofn.lpstrFilter = "Avi files (*.avi)\0*.avi\0"; ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; strcpy(ofn.lpstrFile, m_filename.c_str()); if(GetSaveFileName(&ofn)) { m_filename = ofn.lpstrFile; SetText(IDC_FILENAME, m_filename.c_str()); } return true; } else if(id == IDC_CONFIGURE && code == BN_CLICKED) { Codec c; if(GetSelCodec(c) == 1) { if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.filter) { CAUUID caGUID; memset(&caGUID, 0, sizeof(caGUID)); if(SUCCEEDED(pSPP->GetPages(&caGUID))) { IUnknown* lpUnk = NULL; pSPP.QueryInterface(&lpUnk); OleCreatePropertyFrame(m_hWnd, 0, 0, c.FriendlyName.c_str(), 1, (IUnknown**)&lpUnk, caGUID.cElems, caGUID.pElems, 0, 0, NULL); lpUnk->Release(); if(caGUID.pElems) CoTaskMemFree(caGUID.pElems); } } else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.filter) { if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK) { pAMVfWCD->ShowDialog(VfwCompressDialog_Config, m_hWnd); } } } return true; } else if(id == IDOK) { m_width = GetTextAsInt(IDC_WIDTH); m_height = GetTextAsInt(IDC_HEIGHT); m_filename = GetText(IDC_FILENAME); Codec c; int ris = GetSelCodec(c); if(ris == 0) { return false; } m_enc = c.filter; theApp.SetConfig("CaptureWidth", m_width); theApp.SetConfig("CaptureHeight", m_height); theApp.SetConfig("CaptureFileName", m_filename.c_str()); if (ris != 2) { wstring s = wstring(c.DisplayName.m_str); theApp.SetConfig("CaptureVideoCodecDisplayName", string(s.begin(), s.end()).c_str()); } else { theApp.SetConfig("CaptureVideoCodecDisplayName", ""); } } return __super::OnCommand(hWnd, id, code); }
void CDebugProgress::Step(const char*text) { Step(); SetText(text); }
MultiLineText *MultiLineText::AppendText(const std::string &text) { return SetText(m_text + text); }
void NCXResource::SetMainID(const QString &main_id) { SetText(GetText().replace("ID_UNKNOWN", main_id)); }
bool CPUTGUIElement::Load(CPUTConfigBlock* pBlock, int* pParent) { CPUTConfigEntry* pEntry = NULL; pEntry = pBlock->GetValueByName(NAME); if (pEntry->IsValid()) mName= pEntry->ValueAsString(); pEntry = pBlock->GetValueByName(PARENT); if(pEntry->IsValid()) *pParent = pEntry->ValueAsInt(); pEntry = pBlock->GetValueByName(WIDTH); if(pEntry->IsValid()) mWidth = pEntry->ValueAsInt(); pEntry = pBlock->GetValueByName(HEIGHT); if(pEntry->IsValid()) mHeight = pEntry->ValueAsInt(); pEntry = pBlock->GetValueByName(POS_X); if(pEntry->IsValid()) mRelX = pEntry->ValueAsInt(); pEntry = pBlock->GetValueByName(POS_Y); if(pEntry->IsValid()) mRelY = pEntry->ValueAsInt(); pEntry = pBlock->GetValueByName(PARENT_RELATIVE); if(pEntry->IsValid()) mParentRelative = pEntry->ValueAsBool(); pEntry = pBlock->GetValueByName(VISIBLE); if(pEntry->IsValid()) mVisible = pEntry->ValueAsBool(); pEntry = pBlock->GetValueByName(FOREGROUND_COLOR); if(pEntry->IsValid()) { pEntry->ValueAsFloatArray((float*)&mForegroundColor, 4); mForegroundHighlightColor = mForegroundColor; } pEntry = pBlock->GetValueByName(BACKGROUND_COLOR); if(pEntry->IsValid()) { pEntry->ValueAsFloatArray((float*)&mBackgroundColor, 4); mBackgroundHighlightColor = mBackgroundColor; } pEntry = pBlock->GetValueByName(FOREGROUND_HIGHLIGHT_COLOR); if(pEntry->IsValid()) pEntry->ValueAsFloatArray((float*)&mForegroundHighlightColor, 4); pEntry = pBlock->GetValueByName(BACKGROUND_HIGHLIGHT_COLOR); if(pEntry->IsValid()) pEntry->ValueAsFloatArray((float*)&mBackgroundHighlightColor, 4); pEntry = pBlock->GetValueByName(MATERIAL); if(pEntry->IsValid()) { cString materialName = pEntry->ValueAsString(); mpSprite = CPUTSprite::CreateSprite(0.0, 0.0, 1.0, 1.0, materialName); } pEntry = pBlock->GetValueByName(TEXT_MATERIAL); if(pEntry->IsValid()) { cString materialName = pEntry->ValueAsString(); mpTextMaterial = CPUTAssetLibrary::GetAssetLibrary()->GetMaterial(materialName); } const cString FONT = _L("font"); pEntry = pBlock->GetValueByName(FONT); if(pEntry->IsValid()) { cString fontName; pEntry->ValueAsString(&fontName); mpFont = (CPUTFont*)CPUTAssetLibrary::GetAssetLibrary()->GetFontByName(fontName); if(mpFont == NULL) { DEBUG_PRINT(_L("Failed to load font: %s"), fontName.c_str()); } } pEntry = pBlock->GetValueByName(TEXT); cString string; if(pEntry->IsValid()) { pEntry->ValueAsString(&string); SetText(string); } pEntry = pBlock->GetValueByName(HIGHLIGHT); if(pEntry->IsValid()) { mHighlighted = pEntry->ValueAsBool(); } pEntry = pBlock->GetValueByName(MOUSE_CLICK); if(pEntry->IsValid()) { pEntry->ValueAsString(&mClick.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(MOUSE_UP); if(pEntry->IsValid()) { pEntry->ValueAsString(&mUp.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(MOUSE_DOWN); if(pEntry->IsValid()) { pEntry->ValueAsString(&mDown.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(MOUSE_OUT); if(pEntry->IsValid()) { pEntry->ValueAsString(&mOut.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(MOUSE_IN); if(pEntry->IsValid()) { pEntry->ValueAsString(&mIn.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(HOTKEY); if(pEntry->IsValid()) { cString key; pEntry->ValueAsString(&key); mHotkey = MapKey(key); mEventHandler = true; } pEntry = pBlock->GetValueByName(HOTKEY_UP); if(pEntry->IsValid()) { pEntry->ValueAsString(&mKeyUp.key); mEventHandler = true; } pEntry = pBlock->GetValueByName(HOTKEY_DOWN); if(pEntry->IsValid()) { pEntry->ValueAsString(&mKeyDown.key); mEventHandler = true; } mParentMatrix = float4x4Translation((float)mPosX, (float)mPosY, 0.0); return true; }
/// Move forward the simulation of this sim object by a time delta /// @param dt the amount of time to simulate forward void SceneObject::ProcessTick( float32_t dt ) { Assert( mSharedData ); // set the position and rotation of our object if( mSceneNode ) { // Note: jsheblak 28July2007 // Setting the position of some large meshes in irrlicht every frame // causes them to flicker or disappear. Compare the position first and // update if necessary. if( mSharedData->IsDirty(SimEntityData::kDB_Position) ) { // convert from open nero's coordinate system to irrlicht's SetPosition( mSharedData->GetPosition() ); // the position is set here, but it might change after drawAll because of collisions etc // thus, the next time we see this sceneNode, we should make sure to get the position back // to the state. } if( mSharedData->IsDirty(SimEntityData::kDB_Rotation) ) { // Irrlicht expects a left handed basis with the x-z plane being horizontal and y being up // OpenNero uses a right handed basis with x-y plane being horizontal and z being up SetRotation( mSharedData->GetRotation() ); } if ( mSharedData->IsDirty(SimEntityData::kDB_Scale) ) { // set the node scale Vector3f scale = mSceneObjectTemplate->mScale; /// we can optionally multiply by a custom scale scale.X = scale.X * mSharedData->GetScale().X; scale.Y = scale.Y * mSharedData->GetScale().Y; scale.Z = scale.Z * mSharedData->GetScale().Z; // convert from open nero's coordinate system to irrlicht's mSceneNode->setScale( ConvertNeroToIrrlichtPosition(scale) ); } if ( mSharedData->IsDirty(SimEntityData::kDB_Label) && mSceneObjectTemplate->mDrawLabel ) { SetText(mSharedData->GetLabel()); } if ( mSharedData->IsDirty(SimEntityData::kDB_Color) ) { if (mAniSceneNode) { // The above workaround is not necessary anymore in Irrlicht 1.5 mAniSceneNode->getMaterial(0).DiffuseColor = mSharedData->GetColor(); } } // add our bounding box to the lineset if( mSceneNode && mSceneObjectTemplate->mDrawBoundingBox ) { BBoxf bbox = getTransformedBoundingBox(); DrawBBox(bbox, LineSet::LineColor(255,0,255,0)); } if (mFPSCamera && !mCamera) { Kernel::GetSimContext()->getActiveCamera()->attach(this->GetEntity(), mFPSCamera); } mSharedData->ClearDirtyBits(); } }
void charter_selete() {//인간,마법사,요정,카라스텐구,백랑텐구,캇파,반요,츠구모가미,흡혈귀,오니,사신, 달토끼, 천인, 용궁의사자, 유 령, 망령, 소령 for(int i = 0; i<MAXLEVEL; i++) env[i].floor = i; WaitForSingleObject(mutx, INFINITE); SetText() = "touhou crawl "; SetText() += version_string; SetText() += "\n동방프로젝트와 던전크롤의 동인게임\n\n"; if(load_name(user_name_file.c_str())) { SetText() += "당신의 이름은 \""; SetText() += you.user_name.name; SetText() += "\" 이다.\n"; } else { SetText() += "당신의 이름은 \""; SetText() += you.user_name.name; SetText() += "\" 이다.\n"; SetText() += "user_name.txt에서 당신의 이름을 바꿀 수 있어.\n"; } SetDisplayTexture(&img_title); ReleaseMutex(mutx); waitkeyinput(); WaitForSingleObject(mutx, INFINITE); SetText() += "시작한다!\n"; ReleaseMutex(mutx); Sleep(500); SetDisplayTexture(NULL); { ReplayClass.init_class(); ReplayClass.SaveReplayStart(); } init_state(); map_list.tutorial = GM_TITLE; start_mainmenu(); if(!saveexit) { init_identify(); init_monster(); initMap(); wiz_list.wizard_mode = 0; } if(map_list.tutorial == GM_TITLE) map_list.tutorial = GM_NORMAL; if(isNormalGame() && !saveexit) { char temp[200]; sprintf_s(temp,200,"%s, %s %s %s. 던전의 탐험을 시작했다.", you.user_name.name.c_str(),tribe_type_string[you.tribe],job_type_string[you.job],you.GetCharNameString()->c_str()); AddNote(you.turn,CurrentLevelString(),temp,CL_normal); SetTribe(you.tribe); TouhouPlayerble(you.char_name.name, true); SetJob(you.job,you.char_name.name); TouhouPlayerble(you.char_name.name, false); /*Test_char_init(item_, bonus);*/ you.CalcuHP(); Initialize(); } else if(map_list.tutorial == GM_TUTORIAL) { you.image = &img_play_sanae; you.char_name.name = "사나에"; you.tribe = TRI_HUMAN; you.job = JOB_SHAMAN; SetTribe(you.tribe); you.CalcuHP(); env[current_level].EnterMap(0,deque<monster*>()); printlog("카나코는 말했다 : 환영한다, 사나에! 이번 튜토리얼은 내가 담당하지.",true,false,false,CL_warning); printlog("카나코는 말했다 : 지나간 말은 컨트롤+P로 로그를 확인하고 궁금한건 ?를 눌러.",true,false,false,CL_warning); printlog("카나코는 말했다 : 일단 h j k l나 방향키로 움직일 수 있어. 대소문자에 조심해.",true,false,false,CL_warning); } else if(map_list.tutorial == GM_TUTORIAL2) { you.image = &img_play_sanae; you.char_name.name = "사나에"; you.tribe = TRI_HUMAN; you.job = JOB_SHAMAN; SetTribe(you.tribe); you.CalcuHP(); env[current_level].EnterMap(0,deque<monster*>()); printlog("안녕하세요. Dungeon Crawl Stone Soup (이하 돌죽) 팬게임 동방크롤입니다.",true,false,false,CL_warning); printlog("여기에선 돌죽 경험자분을 위한 튜토리얼입니다.",true,false,false,CL_warning); } else if(map_list.tutorial == GM_SPRINT1_AREANA) { you.image = &img_play_sanae; you.char_name.name = "사나에"; you.tribe = TRI_HUMAN; you.job = JOB_SHAMAN; SetTribe(you.tribe); you.CalcuHP(); env[current_level].EnterMap(0,deque<monster*>()); item_infor t; item *it; it = env[current_level].MakeItem(you.position,makeitem(ITM_RING,1,&t,RGT_SEE_INVISIBLE)); it->Identify(); you.additem(it,false); you.equip('a',ET_LEFT,false); env[current_level].DeleteItem(it); printlog("아레나에 온걸 환영한다! 승리할 것 같은 팀의 방향에 서있어라!",true,false,false,CL_help); printlog("만약 승자를 맞추게되면 레벨이 1 오른다. 틀리면 게임 오버! 기회는 3번...",true,false,false,CL_help); } changedisplay(DT_GAME); saveexit = true; }
void GridViewValueCell::SetNullStr() { SetText("---"); }
BOOL UIIMEdit::GetContent(OUT MixedMsg& mixMsg) { mixMsg.m_strTextData = GetTextRange(0, GetTextLength()); if (mixMsg.m_strTextData.IsEmpty()) return FALSE; mixMsg.ReplaceReturnKey(); IRichEditOle *pRichEditOle = m_pRichEditOle; if (NULL == pRichEditOle) { return FALSE; } UInt32 nImageCount = pRichEditOle->GetObjectCount(); if (nImageCount == 0)//纯文字 { CString strContent = mixMsg.m_strTextData; strContent.Trim(); if (strContent.IsEmpty()) { LOG__(DEBG, _T("After trimed,is empty msg"));//日志干扰 return FALSE; } } else//图文混排 { CString strEmotionFilesDir = module::getMiscModule()->getEmotionFilesDir(); int nPosAdd = 0; for (UInt32 i = 0; i < nImageCount; i++) { ST_picData picData; if (GetPicPosAndPathbyOrder(i, picData.nPos, picData.strLocalPicPath)) { TCHAR fullPath[MAX_PATH] = { 0 }; LPTSTR* pStart = nullptr; if (!GetFullPathName(picData.strLocalPicPath, MAX_PATH, fullPath, pStart)) { continue; } CString strFullPath = fullPath; int nPos = strFullPath.Find(strEmotionFilesDir); if (-1 != nPos) { //是表情,不用上传图片 int nLen = picData.strLocalPicPath.GetLength(); CString fileName = strFullPath.Mid(strEmotionFilesDir.GetLength(), nLen - strEmotionFilesDir.GetLength() + 1); CString fileID; if (!module::getEmotionModule()->getEmotionIDByName(fileName, fileID)) { return FALSE; } mixMsg.m_strTextData.Insert(nPosAdd + picData.nPos, fileID); mixMsg.m_strTextData.Delete(nPosAdd + picData.nPos + fileID.GetLength(), 1); //nPosAdd += picData.nPos + fileID.GetLength(); nPosAdd += fileID.GetLength() - 1; } else { picData.nPos += nPosAdd; mixMsg.m_picDataVec.push_back(picData); } } } } SetText(_T("")); return TRUE; }
static void UpdateWidget(WidgetData *data) { GtkWidget *widget; g_return_if_fail(data != NULL); widget = GetWidgetByLongName(data->name); if (widget == NULL) { MessagePrintf("widget [%s] is not found", data->name); return; } switch (data->type) { // gtk+panda case WIDGET_TYPE_NUMBER_ENTRY: SetNumberEntry(widget, data,(_NumberEntry *)data->attrs); break; case WIDGET_TYPE_PANDA_COMBO: SetPandaCombo(widget, data,(_Combo *)data->attrs); break; case WIDGET_TYPE_PANDA_CLIST: SetPandaCList(widget, data,(_CList *)data->attrs); break; case WIDGET_TYPE_PANDA_ENTRY: SetEntry(widget, data,(_Entry *)data->attrs); break; case WIDGET_TYPE_PANDA_TEXT: SetText(widget, data,(_Text *)data->attrs); break; case WIDGET_TYPE_PANDA_PREVIEW: SetPandaPreview(widget, data,(_PREVIEW *)data->attrs); break; case WIDGET_TYPE_PANDA_TIMER: SetPandaTimer(widget, data,(_Timer *)data->attrs); break; case WIDGET_TYPE_PANDA_DOWNLOAD: SetPandaDownload(widget, data,(_Download *)data->attrs); break; case WIDGET_TYPE_PANDA_HTML: SetPandaHTML(widget, data,(_HTML *)data->attrs); break; case WIDGET_TYPE_PANDA_TABLE: SetPandaTable(widget, data,(_Table *)data->attrs); break; // gtk+ case WIDGET_TYPE_ENTRY: SetEntry(widget, data,(_Entry *)data->attrs); break; case WIDGET_TYPE_TEXT: SetText(widget, data,(_Text *)data->attrs); break; case WIDGET_TYPE_LABEL: SetLabel(widget, data,(_Label *)data->attrs); break; case WIDGET_TYPE_BUTTON: case WIDGET_TYPE_TOGGLE_BUTTON: case WIDGET_TYPE_CHECK_BUTTON: case WIDGET_TYPE_RADIO_BUTTON: SetButton(widget, data,(_Button *)data->attrs); break; case WIDGET_TYPE_CALENDAR: SetCalendar(widget, data,(_Calendar*)data->attrs); break; case WIDGET_TYPE_NOTEBOOK: SetNotebook(widget, data,(_Notebook*)data->attrs); break; case WIDGET_TYPE_PROGRESS_BAR: SetProgressBar(widget, data,(_ProgressBar*)data->attrs); break; case WIDGET_TYPE_WINDOW: SetWindow(widget, data,(_Window*)data->attrs); break; case WIDGET_TYPE_FRAME: SetFrame(widget, data,(_Frame *)data->attrs); break; case WIDGET_TYPE_SCROLLED_WINDOW: SetScrolledWindow(widget, data,(_ScrolledWindow *)data->attrs); break; case WIDGET_TYPE_FILE_CHOOSER_BUTTON: SetFileChooserButton(widget, data,(_FileChooserButton *)data->attrs); break; case WIDGET_TYPE_COLOR_BUTTON: SetColorButton(widget, data,(_ColorButton *)data->attrs); break; // Gnome case WIDGET_TYPE_FILE_ENTRY: SetFileEntry(widget, data,(_FileEntry *)data->attrs); break; case WIDGET_TYPE_PIXMAP: SetPixmap(widget, data,(_Pixmap *)data->attrs); break; default: //MessageLogPrintf("invalid widget [%s]", data->name); break; } }
TTextLayout::~TTextLayout() { fFont->RemoveRef(); SetText(NULL); }
void CMainWindow::UpdateUI() { CPS2OS& os = *m_virtualMachine.m_os; //Fix the file menu { HMENU hMenu = GetSubMenu(GetMenu(m_hWnd), FILEMENUPOS); ModifyMenu(hMenu, ID_MAIN_FILE_RECORDAVI, MF_BYCOMMAND | MF_STRING, ID_MAIN_FILE_RECORDAVI, m_recordingAvi ? _T("Stop Recording AVI") : _T("Record AVI...")); } //Fix the virtual machine sub menu { HMENU hMenu = GetSubMenu(GetMenu(m_hWnd), VMMENUPOS); bool hasElf = (os.GetELF() != NULL); EnableMenuItem(hMenu, ID_MAIN_VM_RESUME, (!hasElf ? MF_GRAYED : 0) | MF_BYCOMMAND); EnableMenuItem(hMenu, ID_MAIN_VM_RESET, (!hasElf ? MF_GRAYED : 0) | MF_BYCOMMAND); CheckMenuItem(hMenu, ID_MAIN_VM_PAUSEFOCUS, (m_pauseFocusLost ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND); EnableMenuItem(hMenu, ID_MAIN_VM_SAVESTATE, (!hasElf ? MF_GRAYED : 0) | MF_BYCOMMAND); EnableMenuItem(hMenu, ID_MAIN_VM_LOADSTATE, (!hasElf ? MF_GRAYED : 0) | MF_BYCOMMAND); //Get state slot sub-menu MENUITEMINFO MenuItem; memset(&MenuItem, 0, sizeof(MENUITEMINFO)); MenuItem.cbSize = sizeof(MENUITEMINFO); MenuItem.fMask = MIIM_SUBMENU; GetMenuItemInfo(hMenu, ID_MAIN_VM_STATESLOT, FALSE, &MenuItem); hMenu = MenuItem.hSubMenu; //Change state slot number checkbox for(unsigned int i = 0; i < MAX_STATESLOTS; i++) { memset(&MenuItem, 0, sizeof(MENUITEMINFO)); MenuItem.cbSize = sizeof(MENUITEMINFO); MenuItem.fMask = MIIM_STATE; MenuItem.fState = (m_stateSlot == i) ? MFS_CHECKED : MFS_UNCHECKED; SetMenuItemInfo(hMenu, ID_MAIN_VM_STATESLOT_0 + i, FALSE, &MenuItem); } } //Fix the view menu { auto presentationMode = static_cast<CGSHandler::PRESENTATION_MODE>(CAppConfig::GetInstance().GetPreferenceInteger(PREF_CGSHANDLER_PRESENTATION_MODE)); HMENU viewMenu = GetSubMenu(GetMenu(m_hWnd), VIEWMENUPOS); CheckMenuItem(viewMenu, ID_MAIN_VIEW_FITTOSCREEN, ((presentationMode == CGSHandler::PRESENTATION_MODE_FIT) ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND); CheckMenuItem(viewMenu, ID_MAIN_VIEW_FILLSCREEN, ((presentationMode == CGSHandler::PRESENTATION_MODE_FILL) ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND); CheckMenuItem(viewMenu, ID_MAIN_VIEW_ACTUALSIZE, ((presentationMode == CGSHandler::PRESENTATION_MODE_ORIGINAL) ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND); } TCHAR sTitle[256]; const char* sExec = os.GetExecutableName(); if(strlen(sExec)) { _sntprintf(sTitle, countof(sTitle), _T("%s - [ %s ]"), APP_NAME, string_cast<std::tstring>(sExec).c_str()); } else { _sntprintf(sTitle, countof(sTitle), _T("%s"), APP_NAME); } SetText(sTitle); }