void LineEdit::DragAndDrop(Point p, PasteClip& d) { if(IsReadOnly()) return; int c = GetMousePos(p); if(AcceptText(d)) { NextUndo(); int a = sb.y; int sell, selh; WString text = GetWString(d); if(GetSelection(sell, selh)) { if(c >= sell && c < selh) { RemoveSelection(); if(IsDragAndDropSource()) d.SetAction(DND_COPY); c = sell; } else if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) { if(c > sell) c -= selh - sell; RemoveSelection(); d.SetAction(DND_COPY); } } int count = Insert(c, text); sb.y = a; SetFocus(); SetSelection(c, c + count); Action(); return; } if(!d.IsAccepted()) return; if(!isdrag) { isdrag = true; ScrollIntoCursor(); } Point dc = Null; if(c >= 0) dc = GetColumnLine(c); if(dc != dropcaret) { RefreshDropCaret(); dropcaret = dc; RefreshDropCaret(); } }
void DocEdit::DragAndDrop(Point p, PasteClip& d) { if(IsReadOnly()) return; int c = GetMousePos(p); if(AcceptText(d)) { NextUndo(); int a = sb; int sell, selh; WString txt = GetWString(d); if(GetSelection(sell, selh)) { if(c >= sell && c < selh) { if(!IsReadOnly()) RemoveSelection(); if(IsDragAndDropSource()) d.SetAction(DND_COPY); c = sell; } else if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) { if(c > sell) c -= selh - sell; if(!IsReadOnly()) RemoveSelection(); d.SetAction(DND_COPY); } } int count = Insert(c, txt); sb = a; SetFocus(); SetSelection(c, c + count); Action(); return; } if(!d.IsAccepted()) return; Point dc = Null; if(c >= 0) { Point cr = GetCaret(c); dc = Point(cr.x + 1, cr.y); } if(dc != dropcaret) { RefreshDropCaret(); dropcaret = dc; RefreshDropCaret(); } }
//Does not save distance tables! This is //to save lightweight data!! ///Does not save R or buffers! void Bead_ParticleSet::RestoreOldData() { // for (int i=0;i<R.size();i++) // R[i]=R_saved[i]; for(int i=0; i<Gradients_saved.size(); i++) *Gradients[i] = *(Gradients_saved[i]); for(int i=0; i<Laplacians_saved.size(); i++) *Laplacians[i] = *(Laplacians_saved[i]); for(int i=0; i<DriftVectors_saved.size(); i++) *DriftVectors[i] = *(DriftVectors_saved[i]); // Action=Action_saved; for (int ipsi=0;ipsi<nPsi;ipsi++) for (int i=0;i<3;i++) Action(ipsi,i)=Action_saved(ipsi,i); BeadSignWgt=BeadSignWgt_saved; TransProb[0]=TransProb_saved[0]; TransProb[1]=TransProb_saved[1]; Properties=properties_saved; Drift=Drift_saved; }
void LineEdit::LeftDrag(Point p, dword flags) { int c = GetMousePos(p); int l, h; if(!HasCapture() && GetSelection(l, h) && c >= l && c < h) { WString sample = GetW(l, min(h - l, 3000)); Size sz = StdSampleSize(); ImageDraw iw(sz); iw.DrawRect(sz, Black()); iw.Alpha().DrawRect(sz, Black()); DrawTLText(iw.Alpha(), 0, 0, 9999, sample, font, White()); NextUndo(); if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE) { RemoveSelection(); Action(); } } }
void MemCheck::JitBefore(u32 addr, bool write, int size, u32 pc) { int mask = MEMCHECK_WRITE | MEMCHECK_WRITE_ONCHANGE; if (write && (cond & mask) == mask) { lastAddr = addr; lastPC = pc; lastSize = size; // We have to break to find out if it changed. Core_EnableStepping(true); } else { lastAddr = 0; Action(addr, write, size, pc); } }
DWORD PerformActionForDir(HWND hwnd, DWORD (*Action)(HWND,const char*), BOOL recursive) { HANDLE sh; char *name; DWORD sum; sum=0; name=pafDir+lstrlen(pafDir); lstrcat(pafDir,"*.*"); sh=FindFirstFile(pafDir,&pafdW32fd); *name=0; if (sh!=INVALID_HANDLE_VALUE) { do { if (IsAllCancelled()) break; if (pafdW32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if ((recursive) && (pafdW32fd.cFileName[0]!='.')) { name=pafDir+lstrlen(pafDir); lstrcat(pafDir,pafdW32fd.cFileName); lstrcat(pafDir,"\\"); sum+=PerformActionForDir(hwnd,Action,recursive); *name=0; } } else { name=pafDir+lstrlen(pafDir); lstrcat(pafDir,pafdW32fd.cFileName); ShowProgressHeaderMsg(pafDir); ResetCancelFlag(); sum+=Action(hwnd,pafDir); *name=0; } } while (FindNextFile(sh,&pafdW32fd)); FindClose(sh); } return sum; }
void start() { ClockWise(1,0,number[0][med]); ClockWise(1,0,number[0][med]); ClockWise(1,0,number[0][med]); ClockWise(3,0,number[1][med]); ClockWise(5,0,number[2][med]); ClockWise(7,0,number[3][med]); while(JudgeToGO(7,number[3][med])!=1); ClockWise(2,0,number[0][_high]); while(JudgeToGO(2,number[0][_high])!=1); REG_Write(4,0,number[1][_high]); REG_Write(8,0,number[3][_high]); Action(); while(JudgeToGO(8,number[3][_high])!=1); ClockWise(6,0,number[2][_high]); while(JudgeToGO(6,number[2][_high])!=1); }
// Gunner Constructor Gunner::Gunner(const GunnerTemplate &aTemplate, unsigned int aId) : Updatable(aId) { SetAction(Action(this, &Gunner::Update)); Entity *entity = Database::entity.Get(mId); #ifdef GUNNER_TRACK_DEQUE mTrackPos.push_back(entity->GetPosition()); mTrackPos.push_back(entity->GetPosition()); #else mTrackCount = xs_CeilToInt(aTemplate.mFollowLength/GUNNER_TRACK_GRANULARITY) + 2; mTrackPos = new Vector2[mTrackCount]; mTrackFirst = 0; mTrackLast = 1; mTrackPos[mTrackFirst] = entity->GetPosition(); mTrackPos[mTrackLast] = entity->GetPosition(); #endif mTrackLength = 0.0f; }
Action UCTAgent::UCB1(const State & state, const double exploration) { double max = -1.0e6; std::vector<int> ties; for (int i = 0; i < ActionSize; ++i) { double tmp = qtable_[state][i] + exploration * Confidence(state_counts_[state], state_action_counts_[state][i]); if (tmp >= max) { if (tmp > max) { max = tmp; ties.clear(); } ties.push_back(i); } } return Action(ties[rand() % ties.size()]); }
void HeaderCtrl::MouseMove(Point p, dword keyflags) { if(isdrag) { ti = GetLastVisibleTab() + 1; for(int i = 0; i < GetCount(); i++) if(col[i].visible) { Rect r = GetTabRect(i).OffsetedHorz(-sb); if(p.x < r.left + r.Width() / 2) { ti = i; break; } } dragx = p.x; Refresh(); return; } int q = GetSplit(p.x); int cx = ~q; if(cx >= 0 && cx < col.GetCount() && !IsNull(col[cx].tip)) Tip(col[cx].tip); if(mode == FIXED) return; q = IsNull(q) || q >= 0 ? -1 : -1 - q; if(q != light) Refresh(); if(!HasCapture()) return; Size sz = GetSize(); int x = mode == SCROLL ? p.x + sb : min(sz.cx, p.x); if(split >= 0) { int w = x - colRect.left; if(w < 0) w = 0; if(w != GetTabWidth(split)) { SetTabWidth0(split, w); Refresh(); if(track) { Sync(); Action(); WhenLayout(); } } } }
void HeaderCtrl::LeftUp(Point, dword) { if(isdrag) { if(li >= 0 && ti >= 0) MoveTab(li, ti); li = ti = -1; Refresh(); } else if(pushi >= 0 && push) col[pushi].WhenAction(); push = false; ti = li = pushi = -1; isdrag = false; Refresh(); if(split >= 0 && !track) { Action(); WhenLayout(); } DoSbTotal(); }
Weapon::Weapon(const WeaponTemplate &aTemplate, unsigned int aId) : Updatable(aId) , mControlId(0) , mChannel(aTemplate.mChannel) , mPrevFire(0.0f) , mTrack(0) , mBurst(0) , mTimer(0.0f) , mPhase(aTemplate.mPhase) , mAmmo(0) { SetAction(Action(this, &Weapon::Update)); // if the weapon uses ammo... if (aTemplate.mCost) { // find the specified resource mAmmo = FindResource(aId, aTemplate.mType); } }
TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) { VerifyEndCallback EndCallback; FixedCompilationDatabase Compilations("/", std::vector<std::string>()); std::vector<std::string> Sources; Sources.push_back("/a.cc"); Sources.push_back("/b.cc"); ClangTool Tool(Compilations, Sources); Tool.mapVirtualFile("/a.cc", "void a() {}"); Tool.mapVirtualFile("/b.cc", "void b() {}"); std::unique_ptr<FrontendActionFactory> Action( newFrontendActionFactory(&EndCallback, &EndCallback)); Tool.run(Action.get()); EXPECT_TRUE(EndCallback.Matched); EXPECT_EQ(2u, EndCallback.BeginCalled); EXPECT_EQ(2u, EndCallback.EndCalled); }
//========================================================================= void TaxNodeVisitor::VisitLeavesToRoot(TreeTaxNode *node) { if ( node->getGnode() == NULL ) { if ( createGraphNodes ) graphView->CreateGraphNode(node); else if ( !visitNullGnodes ) return; } bool visit_children = shouldVisitChildren(node); if ( visit_children ) { beforeVisitChildren(node); ThreadSafeListLocker<TreeTaxNode *> locker(&node->children); for ( TaxNodeIterator it = node->children.begin(); it != node->children.end(); it++ ) VisitLeavesToRoot(*it); afterVisitChildren(node); } Action(node); }
static std::error_code loadAction(ExecState& exec, const JSObject& ruleObject, Action& action, bool& validSelector) { VM& vm = exec.vm(); auto scope = DECLARE_THROW_SCOPE(vm); validSelector = true; const JSValue actionObject = ruleObject.get(&exec, Identifier::fromString(&exec, "action")); if (!actionObject || scope.exception() || !actionObject.isObject()) return ContentExtensionError::JSONInvalidAction; const JSValue typeObject = actionObject.get(&exec, Identifier::fromString(&exec, "type")); if (!typeObject || scope.exception() || !typeObject.isString()) return ContentExtensionError::JSONInvalidActionType; String actionType = typeObject.toWTFString(&exec); if (actionType == "block") action = ActionType::BlockLoad; else if (actionType == "ignore-previous-rules") action = ActionType::IgnorePreviousRules; else if (actionType == "block-cookies") action = ActionType::BlockCookies; else if (actionType == "css-display-none") { JSValue selector = actionObject.get(&exec, Identifier::fromString(&exec, "selector")); if (!selector || scope.exception() || !selector.isString()) return ContentExtensionError::JSONInvalidCSSDisplayNoneActionType; String s = selector.toWTFString(&exec); if (!isValidSelector(s)) { // Skip rules with invalid selectors to be backwards-compatible. validSelector = false; return { }; } action = Action(ActionType::CSSDisplayNoneSelector, s); } else if (actionType == "make-https") { action = ActionType::MakeHTTPS; } else return ContentExtensionError::JSONInvalidActionType; return { }; }
//************************************************************************************************************************************************ void chkForFingerPrint() { if (fps.IsPressFinger()) { wdt_reset(); //reset the watchdog timer for any normal op that may take time. fps.CaptureFinger(false); int id = fps.Identify1_N(); if (id < 200) { //Serial.print("Verified ID:"); //Serial.println(id); blink(OKLedPin, 100, 2); Action(1); //Open the Garage door } else { //Serial.println("Finger not found"); blink(NotOKLedPin, 100, 3); } } }
void EnumAll(char *buf, char *p, char *pattern, void(*Action)(char *path)) { HANDLE hFind; WIN32_FIND_DATA Data; *p = '\\'; strcpy(p + 1, pattern); if ((hFind = FindFirstFile(buf, &Data)) != INVALID_HANDLE_VALUE) { do { if (*(Data.cFileName) && strcmp(Data.cFileName, ".") && strcmp(Data.cFileName, "..")) { sprintf(p, "\\%s", Data.cFileName); Action(buf); } } while (FindNextFile(hFind, &Data)); FindClose(hFind); } }
void Resource::readAction(Common::File *file, ActionList &list) { list.clear(); while (file->readByte() == 1) { list.push_back(Action()); Action &action = list.back(); action._actionType = (ActionType)file->readSint16LE(); action._param1 = file->readSint16LE(); action._param2 = file->readSint16LE(); action._param3 = file->readSint16LE(); if (action._actionType == kActionShowMessages) { action._messages.reserve(action._param1); for (int i = 0; i < action._param1; i++) action._messages.push_back(readString(file)); } else { action._messages.push_back(readString(file)); } } }
ShellTitle::ShellTitle(unsigned int aId) : Overlay(aId) { titlefill = new unsigned short[(SDL_arraysize(titlemap) + 2) * (SDL_arraysize(titlemap[0]) + 1)]; SetAction(Action(this, &ShellTitle::Render)); // generate fill data unsigned short *titlefillptr = titlefill; for (int row = -1; row < (int)SDL_arraysize(titlemap) + 1; ++row) { for (int col = -1; col < (int)SDL_arraysize(titlemap[0]); ++col) { int phase = 0; int fill = 0; int c0 = std::max<int>(col - 1, 0); int c1 = std::min<int>(col + 1, SDL_arraysize(titlemap[0]) - 2); int r0 = std::max<int>(row - 1, 0); int r1 = std::min<int>(row + 1, SDL_arraysize(titlemap) - 1); for (int r = r0; r <= r1; ++r) { for (int c = c0; c <= c1; ++c) { if (titlemap[r][c] >= '0') { phase = titlemap[r][c] - '0'; fill |= mask[(r - row + 1) * 3 + (c - col + 1)]; } } } if (fill & (1<<4)) fill = (1<<4); *titlefillptr++ = unsigned short(fill | (phase << 9)); } } }
// .DefineTableReply -- Process Reply ------------------------------------------DdmSvcVirtualLoader- // ERC DdmSvcVirtualLoader::ProcessDefineTableReply(Message *_pReply) { TRACE_PROC(DdmSvcVirtualLoader::DefineTableReply); ERC erc = _pReply->DetailedStatusCode; delete _pReply; if (erc != OK) { // Skip all loading if VirtualDeviceTable already exists if (erc != ercTableExists) { TRACEF(TRACE_L3,("Define VirtualDeviceTable Reply; Erc=%u (DdmSvcVirtualLoader::ProcessDefineTableReply)\n",erc)); status = erc; } Action(pParentDdmSvs,callback,this); return OK; } VirtualEntry *pEntry; // Delete Class Config Tables just incase for (pEntry = VirtualTable::GetFirst(); pEntry != NULL; pEntry = pEntry->pNextEntry) { if (pEntry->pszTableName != NULL) { RqPtsDeleteTable *pDelete = new RqPtsDeleteTable(pEntry->pszTableName); Send(pDelete,REPLYCALLBACK(DdmSvcVirtualLoader,DiscardReply)); } } // Create Class Config Tables for (pEntry = VirtualTable::GetFirst(); pEntry != NULL; pEntry = pEntry->pNextEntry) { if (pEntry->pszTableName != NULL) { // Define Config Table for VirtualDevice class RqPtsDefineTable *pDefine = new RqPtsDefineTable(pEntry->pszTableName, Persistant_PT, 20, (fieldDef*)pEntry->pFieldDefs,pEntry->sFieldDefs); erc = Send(pDefine, REPLYCALLBACK(DdmSvcVirtualLoader,DiscardOkReply)); } } if (!LoadVirtualData(VirtualTable::GetFirst()) ) TRACEF(TRACE_L3,("No VirtualDevices to load!\n (DdmSvcVirtualLoader::Execute)\n")); return OK; }
void Event::GetEvents() { SDL_Event ev; while(SDL_PollEvent(&ev)) { if(ev.type == SDL_KEYDOWN) { KeyDown(ev.key.keysym.sym); } else if(ev.type == SDL_KEYUP) { KeyUp(ev.key.keysym.sym); } else if(ev.type == SDL_QUIT) { throw (Event*)nullptr; } } float sPast = (SDL_GetTicks() - _lastCallInTime) / 1000.f; _lastCallInTime = SDL_GetTicks(); Action(sPast); Singleton<Gui>::GetInstance().Action(); }
///////////////////////////////////////////////////////////////////////////// // GetData() ///////////////////////////////////////////////////////////////////////////// void clStormKilledPartitionedBiomass::GetData( xercesc::DOMDocument * p_oDoc ) { try { clTreePopulation * p_oPop = ( clTreePopulation * ) mp_oSimManager->GetPopulationObject( "treepopulation" ); int i; for (i = 0; i < m_iNumSpeciesTypeCombos; i++) { if (mp_whatSpeciesTypeCombos[i].iType != clTreePopulation::snag) { modelErr stcErr; stcErr.iErrorCode = BAD_DATA; stcErr.sMoreInfo = "Storm Killed Partitioned Biomass can only be applied to snags."; stcErr.sFunction = "clStormKilledPartitionedBiomass::GetData"; throw(stcErr); } } GetTreeCodes(p_oPop); GetParameterFileData(p_oDoc, p_oPop); FormatQueryString(p_oPop); SetupGrid(p_oPop); Action(); } catch ( modelErr & err ) { throw( err ); } catch ( modelMsg & msg ) { throw( msg ); } //non-fatal error catch ( ... ) { modelErr stcErr; stcErr.iErrorCode = UNKNOWN; stcErr.sFunction = "clStormKilledPartitionedBiomass::GetData" ; throw( stcErr ); } }
// .LoadVirtualData -- Insert all VirtualDevices and their Config Records ------DdmSvcVirtualLoader- // // Note that you may not have two VD of same class both without config records! // BOOL DdmSvcVirtualLoader::LoadVirtualData(VirtualEntry *_pEntry) { TRACE_PROC(DdmSvcVirtualLoader::LoadVirtualData); ERC erc; RowId ridNone; if (_pEntry != NULL) { if (_pEntry->sData > 0) { // On reply InsertDevice with RowId of config record erc = InsertConfigData(_pEntry, _pEntry, REPLYCALLBACK(DdmSvcVirtualLoader,ProcessCfgInsertReply)); } else { // InsertDevice without RowId of config record erc = InsertVirtualDevice(_pEntry, _pEntry, ridNone, REPLYCALLBACK(DdmSvcVirtualLoader,ProcessVdtInsertReply)); } return TRUE; } Action(pParentDdmSvs,callback,this); status = OK; return FALSE; }
/// Returns the default action for a given list of \a uris representing /// Tracker resources. If the URIs represent objects of different types /// (e.g. one is an image, other is an audio file), a default action cannot be /// constructed in this manner. In that case the \c nie:mimeType properties /// of all \a uris are checked and we attempt to construct a default action /// based on them (passing \c nie:url as argument) (\see /// Action::defaultAction(const QString& uri) also). If both ways fail, it /// falls back to the first action returned by actions(). If there are none, /// an invalid Action is returned. Action Action::defaultAction(const QStringList& uris) { if (uris.isEmpty()) return Action(); // FIXME: this function doesn't include the hack for nfo:Bookmark & // nfo:WebHistory. QList<QStringList> mimeTypes = mimeTypesForUris(uris); LCA_DEBUG << "pseudo mimes per uri" << mimeTypes; QSet<QString> defApps; for (int i = 0; i < mimeTypes.size(); ++i) { QSet<QString> defs; Q_FOREACH (const QString& mimeType, mimeTypes[i]) { QString def = defaultAppForContentType(mimeType); if (!def.isEmpty()) defs << def; } if (i == 0) defApps = defs; else defApps.intersect(defs); }
// used for adding/deleting previous and next joining events void FAGeneral::insert_new_merge_event(Group *newg, Group *neighbor_group,Groups::iterator g_it_down, Group *g_down){ // print_events(); if(g_down->nextFusionUp != NullEvent){ events.erase(g_down->nextFusionUp); // erase the event that will not happen } Group *g_up = *g_it_down; Events::iterator new_event; Action a = Action(g_it_down,'F'); Event e=Event(getlambda(neighbor_group,newg),a); if(newg->lambda - e.first <= epsilon){ // 2 things : new lambda >= old lambda and add a treshold to prevent round up errors new_event = events.insert(e); }else{ new_event=NullEvent; } g_up->nextFusionUp = new_event; // contains the lambda for which the group is fusing the one on top of him }
void Mover::execute(Player* player, const Action::UData& data) { bool moved; moved = player->move(); if (moved) { this->getServerData()->vsayToGraphicClients("PPO %s %d %d %d\n", player->getName(), player->getPosition().x, player->getPosition().y, player->getOrientation()); if (data.boolean == true) player->send("END true"); } else { this->getServerData()->clearForPlayer(player); this->getServerData()->insertAction(Action(player, Action::displace, 1, player->getObjective())); } }
//-----------------------------------------------------------------------------// // 키입력 처리 // Key : combo.h 에 정의된 키값을 가지며, OR연산 가능하다. // 0x01 이면 아무키도 누르지 않았다는 뜻이다. //-----------------------------------------------------------------------------// void CCharacter::KeyProc( int Key, int KeyTime ) { static int cnt = 0; ++cnt; static SCombo *pcombo = NULL; // debug용 int elapse = KeyTime - m_KeyDownTime; // g_Dbg.Console( "KeyProc %5d: %4x, %4x, %4d\n", cnt, Key, m_PrevKey, elapse ); if( (KEY_KEY & Key) && ((50 >= elapse) && ((Key == m_PrevKey) || (KEY_BTN & m_PrevKey))) ) { // Skip // g_Dbg.Console( "Skip %5d: %4x, %4x, %4d\n", cnt, Key, m_PrevKey, elapse ); return; } // g_Dbg.Console( "KeyProc %5d: %6x, %4x, %4x, %4d\n", cnt, m_State, Key, m_PrevKey, elapse ); SActInfo *pact = FindComboAnimation( m_pCurAct, Key, m_PrevKey, elapse ); g_Dbg.Console( "ComboTrace: %s\n", m_ComboTrace ); if( !pact ) return; m_KeyDownTime = KeyTime; if( KEY_NONE != Key ) m_PrevKey = Key; Action( Key, KeyTime, elapse, pact ); }
void MenuTalker::addAction(const std::string& label, int node_id, bool is_vendor) { if ((node_id != Action::NO_NODE && is_vendor) || (node_id == Action::NO_NODE && !is_vendor)) { Utils::logError("MenuTalker: addAction() parameters are incompatible, skipping action."); return; } actions.push_back(Action()); actions.back().btn = new WidgetButton(WidgetButton::NO_FILE); actions.back().btn->setLabel(label); if (node_id != Action::NO_NODE) { actions.back().node_id = node_id; actions.back().btn->setTextColor(WidgetButton::BUTTON_NORMAL, topic_color_normal); actions.back().btn->setTextColor(WidgetButton::BUTTON_HOVER, topic_color_hover); actions.back().btn->setTextColor(WidgetButton::BUTTON_PRESSED, topic_color_pressed); } else { actions.back().is_vendor = true; actions.back().btn->setTextColor(WidgetButton::BUTTON_NORMAL, trade_color_normal); actions.back().btn->setTextColor(WidgetButton::BUTTON_HOVER, trade_color_hover); actions.back().btn->setTextColor(WidgetButton::BUTTON_PRESSED, trade_color_pressed); } }
Action Player::getAction() { int attempts = 0; string in; while(attempts < 3) { printState(); cout << "Enter an action (h: hit, s: stand): "; in = getInput(); if(!in.compare("h") || !in.compare("hit") || !in.compare("s") || !in.compare("stand")) { break; } else { cout << "Incorrect input, attempt " << ++attempts << endl; } } printState(); // Too many bad inputs if(attempts > 2) { cout << "Too many failed attempts. Exiting game" << endl; exit(1); } return Action(in); }
bool LineEdit::InsertChar(dword key, int count, bool canow) { if(key == K_TAB && !processtab) return false; if(filter && key >= 32 && key < 65535) key = (*filter)(key); if(!IsReadOnly() && (key >= 32 && key < 65536 || key == '\t' || key == '\n' || key == K_ENTER && processenter || key == K_SHIFT_SPACE)) { if(key >= 128 && key < 65536 && (charset != CHARSET_UNICODE && charset != CHARSET_UTF8_BOM) && FromUnicode((wchar)key, charset) == DEFAULTCHAR) return true; if(!RemoveSelection() && overwrite && key != '\n' && key != K_ENTER && canow) { int q = cursor; int i = GetLinePos(q); if(q + count - 1 < GetLineLength(i)) Remove(cursor, count); } WString text(key == K_ENTER ? '\n' : key == K_SHIFT_SPACE ? ' ' : key, count); Insert(cursor, text, true); PlaceCaret(cursor + count); Action(); return true; } return false; }