void _Execute(void) { if(m_Execute) GetCtrl()->m_ColorMap.erase(m_fPos); if(m_bUpdate) GetCtrl()->OnDataChanged(); }
void Sugar::SetMode(EBuildingMode mode) { // odmazat if (mode == m_mode) return; // pri buildingu nastavit kolize switch (m_mode) { case EBM_Build: GetCtrl()->SetOverColor(0xffffffff); break; case EBM_Select: GetCtrl()->SetOverColor(0xffffffff); break; case EBM_Normal: CRR::Get()->Unregister(&m_sugar); break; }; m_mode = mode; switch (mode) { case EBM_Build: GetCtrl()->SetOverColor(0xffffff00); break; case EBM_Normal: Show(true); CRR::Get()->Register(&m_sugar); break; }; }
void ContextBase::OnUserTypedXChars(const wxString& word) { // user typed more than X chars // trigger code complete event (as if the user typed ctrl-space) // if no one handles this event, fire a word completion event if(IsCommentOrString(GetCtrl().GetCurrentPos())) { return; } const TagsOptionsData& options = TagsManagerST::Get()->GetCtagsOptions(); if(options.GetFlags() & CC_WORD_ASSIST) { // Try to call code completion clCodeCompletionEvent ccEvt(wxEVT_CC_CODE_COMPLETE); ccEvt.SetEditor(&GetCtrl()); ccEvt.SetPosition(GetCtrl().GetCurrentPos()); ccEvt.SetWord(word); if(!EventNotifier::Get()->ProcessEvent(ccEvt)) { // This is ugly, since CodeLite should not be calling // the plugins... we take comfort in the fact that it // merely fires an event and not calling it directly wxCommandEvent wordCompleteEvent(wxEVT_MENU, XRCID("word_complete_no_single_insert")); wxTheApp->ProcessEvent(wordCompleteEvent); } } }
void EqualizerViewContainer::OnEqualizerState6band() { GetCtrl()->SetBandState(MUSIK_EQUALIZER_CTRL_6BANDS); GetCtrl()->LayoutNewState(); GetCtrl()->DisplayChanged(); Globals::Preferences->SetEqualizerBandState(MUSIK_EQUALIZER_CTRL_6BANDS); }
void LuaSrcView::OnUpdateUI(SCNotification* notification) { long pos= GetCtrl().GetCurrentPos(); int line= GetCtrl().LineFromPosition(pos); int col= GetCtrl().GetColumn(pos); CMainFrame* main = (CMainFrame*) AfxGetApp()->m_pMainWnd; main->SetPositionText(line + 1, col + 1, !GetCtrl().GetOvertype()); }
LRESULT LoginDlg::OnDocumentComplete() { EEdit(GetCtrl("#TXT-NAME")).SetText(L"name"); EPassword(GetCtrl("#TXT-PSWD")).SetText(L"pswd"); ECheck(GetCtrl("#CHK-REMEBER")).SetCheck(TRUE); return 0; }
bool ContextBase::IsStringTriggerCodeComplete(const wxString& str) const { // default behavior is to check if 'str' exists in the m_completionTriggerStrings container if(GetCtrl().GetLexer() == wxSTC_LEX_XML) { return str == "<" || str == "</"; } else if(GetCtrl().GetLexer() == wxSTC_LEX_CSS) { return str == ":"; } else { return (m_completionTriggerStrings.count(str) > 0); } }
ColorDelCmd( CColorAnimImp* pCtrl, float pos ,bool update = false ) : CPropBaseCmd(pCtrl) { m_fPos = pos; m_Execute = true; m_bUpdate = update; if(GetCtrl()->m_ColorMap.find(pos) == GetCtrl()->m_ColorMap.end()) { m_Execute = false; } else m_cData = GetCtrl()->m_ColorMap[m_fPos]; }
void LuaSrcView::SetErrMark(int line) { if (actual_err_mark_line_ != -1) { GetCtrl().MarkerDelete(actual_err_mark_line_, MARKER_ERROR); } actual_err_mark_line_ = line; if (line != -1) { int h; ScrollToLine(line,h,TRUE); actual_err_mark_line_ = line; GetCtrl().MarkerAdd(line, MARKER_ERROR); } }
bool ContextPhp::IsStringTriggerCodeComplete(const wxString& str) const { int style = GetCtrl().GetStyleAt(GetCtrl().GetCurrentPos()); if(IS_BETWEEN(style, wxSTC_HJ_START, wxSTC_HJA_REGEX)) { // When in JS section, trigger CC if str is a dot return str == "."; } else if(IS_BETWEEN(style, wxSTC_H_DEFAULT, wxSTC_H_ENTITY)){ return str == "</" || str == "<"; } else { return (m_completionTriggerStrings.count(str) > 0); } }
void _UnExecute(void) { switch(m_Type) { case Edit_X: GetCtrl()->_SetImpXValue(m_bOld); break; case Edit_Y: GetCtrl()->_SetImpYValue(m_bOld); break; case Edit_Z: GetCtrl()->_SetImpZValue(m_bOld); break; } }
int BecherBuilding::StatusPlace(float *pos) { // pozice v mape #ifndef BECHER_EDITOR // type, model // vysku, destinaci od ostatnich ziskam z... v_sizzing float min,max; float x=pos[0]; float y=pos[1]; int type = GetType(); float height = v_sizzing.GetFloat(SIZZ(type,ESSZ_height)); float dobj = v_sizzing.GetFloat(SIZZ(type,ESSZ_dobj)); bool ok; THoeParameter par; IHoeModel * m = GetModel(); if (m) m->GetParameter("boundbox",&par); else memset(&par,0, sizeof(par)); max = min = 0.f; // 177 132 ok = GetLevel()->GetScene()->GetScenePhysics()->GetCamber( x+par.box.left,x+par.box.right,y+par.box.front,y+par.box.back,min,max); SetPosition(x,y,max); if (!ok || (max-min) > height) { GetCtrl()->SetOverColor(0xffff0000); return 1; } // zjistit zda muze byt cerveny nebo jiny for (int i=0; i < GetLevel()->GetNumObj();i++) { float x = GetLevel()->GetObj(i)->GetPosX(); float y = GetLevel()->GetObj(i)->GetPosY(); x -= GetPosX(); y -= GetPosY(); if (x*x+y*y < dobj) { GetCtrl()->SetOverColor(0xffff0000); return 2; } } GetCtrl()->SetOverColor(0xffffffff); #endif return 0; }
void DockCont::TabSelected() { int ix = tabbar.GetCursor(); if (ix >= 0) { DockableCtrl *dc = Get0(ix); if (!dc) return; Ctrl *ctrl = GetCtrl(ix); Ctrl *first = &handle; for (Ctrl *c = first->GetNext(); c; c = c->GetNext()) if (c != ctrl) c->Hide(); ctrl->Show(); Icon(dc->GetIcon()).Title(dc->GetTitle()); handle.dc = dc; SyncButtons(*dc); if (IsTabbed()) { DockCont *c = static_cast<DockCont *>(GetParent()); c->tabbar.SyncRepos(); c->TabSelected(); c->RefreshFrame(); } else RefreshLayout(); } }
// provide basic indentation void ContextBase::AutoIndent(const wxChar& ch) { LEditor& rCtrl = GetCtrl(); int prevpos(wxNOT_FOUND); int curpos = rCtrl.GetCurrentPos(); int line = rCtrl.LineFromPosition(curpos); if(ch == wxT('\n')) { wxChar prevCh = rCtrl.PreviousChar(curpos, prevpos); if(prevCh == '{') { // an enter was hit just after an open brace int prevLine = rCtrl.LineFromPosition(prevpos); rCtrl.SetLineIndentation(line, rCtrl.GetIndent() + rCtrl.GetLineIndentation(prevLine)); rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(line)); } else { // just copy the previous line indentation int line = rCtrl.LineFromPosition(rCtrl.GetCurrentPos()); rCtrl.SetLineIndentation(line, rCtrl.GetLineIndentation(line - 1)); // place the caret at the end of the line rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(line)); rCtrl.ChooseCaretX(); } } else if(ch == '}' && !IsCommentOrString(curpos)) { long matchPos = wxNOT_FOUND; if(!rCtrl.MatchBraceBack(wxT('}'), rCtrl.PositionBefore(curpos), matchPos)) return; int secondLine = rCtrl.LineFromPosition(matchPos); if(secondLine == line) return; rCtrl.SetLineIndentation(line, rCtrl.GetLineIndentation(secondLine)); } }
CControl* CGUI::EnableCtrl(int nID, BOOL bEnabled/* =TRUE */) { CControl *pCtrl=GetCtrl(nID); if (pCtrl!=NULL) pCtrl->m_bEnabled=bEnabled; return pCtrl; }
void AutoHideBar::TabHighlight() { Ctrl *c = NULL; int ix = TabBar::GetHighlight(); if (ix >= 0) c = GetCtrl(ix); if (!c || ctrl == c) return; else if (ctrl) { if (c) { if (popup.IsPopUp()) popup.Close(); ctrl->Remove(); ctrl = NULL; } else HideAnimate(ctrl); } if (c) { ASSERT(ix >= 0 && ix < GetCount()); // Clear WhenHighlight ot prevent stack overflow. Perhaps a better solution should be found... Callback cb = WhenHighlight; WhenHighlight = Callback(); SetCursor(ix); ShowAnimate(c); WhenHighlight = cb; } }
LRESULT QFrame::OnHtmlNotify( UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch(((NMHDR*)lParam)->code) { case HLN_DOCUMENT_COMPLETE: { if ( !_HasFlag(GetStyle(),WS_CHILD) ) { WTL::CRect r; GetWindowRect(&r); // 非子窗口,调整窗体为合适大小 int nWidth = max(HTMLayoutGetMinWidth(m_hWnd), (UINT)r.Width()); WTL::CRect rcNew; rcNew.SetRect(r.left, r.top, nWidth + r.left, r.top + max((UINT)r.Height(), HTMLayoutGetMinHeight(m_hWnd,nWidth))); AdjustWindowRectEx( &rcNew, GetStyle(), FALSE, GetExStyle()); // 调整大小,位置不变 SetWindowPos(NULL, 0, 0, rcNew.Width(), rcNew.Height(), SWP_NOZORDER | SWP_NOMOVE); size_min_ = rcNew.Size(); // 设置title ctl_title_ = GetCtrl("#wc-title"); if (ctl_title_.is_valid()) { SetWindowText(ctl_title_.GetText()); } } break; } } return QView::OnHtmlNotify(uMsg, wParam, lParam); }
int LuaSrcView::OnCreate(LPCREATESTRUCT create_struct) { if (CBaseView::OnCreate(create_struct) == -1) return -1; CScintillaCtrl& ctrl= GetCtrl(); ctrl.SetLexer(SCLEX_LUA); ctrl.StyleSetFont(STYLE_DEFAULT, "Verdana"); ctrl.StyleSetSize(STYLE_DEFAULT, 10); ctrl.SetKeyWords(0, LuaKeywords); ctrl.SetKeyWords(1, LuaFunctions); COLORREF comment= RGB(0,128,128); COLORREF string= RGB(128,128,0); ctrl.StyleSetFore(SCE_LUA_COMMENT, comment); ctrl.StyleSetFore(SCE_LUA_COMMENTLINE, comment); ctrl.StyleSetFore(SCE_LUA_COMMENTDOC, comment); ctrl.StyleSetFore(SCE_LUA_NUMBER, RGB(0,0,255)); ctrl.StyleSetFore(SCE_LUA_WORD, RGB(34,78,160)); ctrl.StyleSetFore(SCE_LUA_STRING, string); ctrl.StyleSetFore(SCE_LUA_CHARACTER, string); ctrl.StyleSetFore(SCE_LUA_LITERALSTRING, string); ctrl.StyleSetFore(SCE_LUA_WORD2, RGB(53,113,202)); ctrl.StyleSetFont(SCE_LUA_WORD, "Verdana"); ctrl.StyleSetSize(SCE_LUA_WORD, 10); ctrl.StyleSetBold(SCE_LUA_WORD, true); //#define SCE_LUA_PREPROCESSOR 9 //#define SCE_LUA_OPERATOR 10 //#define SCE_LUA_IDENTIFIER 11 //#define SCE_LUA_STRINGEOL 12 //#define SCE_LUA_WORD2 13 //#define SCE_LUA_WORD3 14 //#define SCE_LUA_WORD4 15 //#define SCE_LUA_WORD5 16 //#define SCE_LUA_WORD6 17 //#define SCE_LUA_WORD7 18 //#define SCE_LUA_WORD8 19 ctrl.Colourise(0, -1); ctrl.MarkerDefine(MARKER_POINTER, SC_MARK_ARROW); ctrl.MarkerSetBack(MARKER_POINTER, RGB(255,255,0)); ctrl.MarkerDefine(MARKER_BREAKPOINT, SC_MARK_ROUNDRECT); ctrl.MarkerSetBack(MARKER_BREAKPOINT, RGB(0,0,255)); ctrl.MarkerDefine(MARKER_ERROR, SC_MARK_ARROW); ctrl.MarkerSetBack(MARKER_ERROR, RGB(255,0,0)); ctrl.SetMarginWidthN(1, 18); //ctrl.SetMarginWidthN(2, 10); //ctrl.SetProperty("fold", "1"); return 0; }
ColorEditCmd( CColorAnimImp* pCtrl, float pos,ColorAnimNode& node ) : CPropBaseCmd(pCtrl) { m_fPos = pos; m_cOld = GetCtrl()->m_ColorMap[m_fPos]; m_cData = node; }
int LuaSrcView::ScrollToLine(int line, int &height, bool scroll) { ASSERT(line >= 0); GetCtrl().GotoLine(line); return 0; }
void CCppDocContentView::OnOptionsDeletemarker() { CScintillaCtrl& rCtrl = GetCtrl(); Sci_Position nPos = rCtrl.GetCurrentPos(); int nLine = rCtrl.LineFromPosition(nPos); rCtrl.MarkerDelete(nLine, 0); }
CControl* CGUI::ShowCtrl(int nID, BOOL bVisible/* =TRUE */) { CControl *pCtrl=GetCtrl(nID); if (pCtrl!=NULL) pCtrl->m_bVisible=bVisible; return pCtrl; }
void CCsgIdeView::OnCharAdded( SCNotification* pSCNotification ) { CScintillaCtrl& ctrl = GetCtrl(); if (/*pSCNotification->ch == '\r' ||*/ pSCNotification->ch == '\n') { char linebuf[1000]; int curLine = ctrl.LineFromPosition(ctrl.GetCurrentPos()); int lineLength = ctrl.LineLength(curLine); if (curLine > 0 && lineLength <= 2) { int prevLineLength = ctrl.LineLength(curLine - 1); if (prevLineLength < sizeof(linebuf)) { WORD buflen = sizeof(linebuf); memcpy(linebuf, &buflen, sizeof(buflen)); ctrl.GetLine(curLine - 1, static_cast<char *>(linebuf)); linebuf[prevLineLength] = '\0'; for (int pos = 0; linebuf[pos]; pos++) { if (linebuf[pos] != ' ' && linebuf[pos] != '\t') linebuf[pos] = '\0'; } ctrl.ReplaceSel(static_cast<char *>(linebuf)); } } } GetDocument()->SetModifiedFlag(TRUE); }
void ContextPhp::OnSciUpdateUI(wxStyledTextEvent& event) { LEditor& ctrl = GetCtrl(); if(ctrl.GetFunctionTip()->IsActive()) { ctrl.GetFunctionTip()->Highlight(DoGetCalltipParamterIndex()); } }
//A simple example of call tips void CCppDocContentView::OnDwellStart(_Inout_ SCNotification* pSCNotification) { CScintillaCtrl& rCtrl = GetCtrl(); //Only display the call tip if the scintilla window has focus CWnd* pFocusWnd = GetFocus(); if (pFocusWnd) { if (pFocusWnd->GetSafeHwnd() == rCtrl.GetSafeHwnd()) { //Get the previous 7 characters and next 7 characters around //the current dwell position and if it is "author " case insensitive //then display "PJ Naughter" as a call tip Sci_TextRange tr; tr.chrg.cpMin = max(0, pSCNotification->position - 7); tr.chrg.cpMax = min(pSCNotification->position + 7, rCtrl.GetLength()); char sText[15]; sText[0] = '\0'; tr.lpstrText = sText; rCtrl.GetTextRange(&tr); //Display the call tip _strupr_s(sText, sizeof(sText)); if (strstr(sText, "AUTHOR ")) rCtrl.CallTipShow(pSCNotification->position, _T("PJ Naughter")); } } }
void CCppDocContentView::OnUpdateInsert(CCmdUI* pCmdUI) { CString sText; if (GetCtrl().GetOvertype()) VERIFY(sText.LoadString(ID_INDICATOR_OVR)); pCmdUI->SetText(sText); }
void ContextPhp::SemicolonShift() { int foundPos(wxNOT_FOUND); int semiColonPos(wxNOT_FOUND); LEditor& ctrl = GetCtrl(); if(ctrl.NextChar(ctrl.GetCurrentPos(), semiColonPos) == wxT(')')) { // test to see if we are inside a 'for' statement long openBracePos(wxNOT_FOUND); int posWordBeforeOpenBrace(wxNOT_FOUND); if(ctrl.MatchBraceBack(wxT(')'), semiColonPos, openBracePos)) { ctrl.PreviousChar(openBracePos, posWordBeforeOpenBrace); if(posWordBeforeOpenBrace != wxNOT_FOUND) { wxString word = ctrl.PreviousWord(posWordBeforeOpenBrace, foundPos); // At the current pos, we got a ';' // at semiColonPos we got ; // switch ctrl.DeleteBack(); ctrl.SetCurrentPos(semiColonPos); ctrl.InsertText(semiColonPos, wxT(";")); ctrl.SetCaretAt(semiColonPos + 1); ctrl.GetFunctionTip()->Deactivate(); } } } }
Image DockCont::GetHighlightImage() { Ctrl *ctrl = GetCtrl(GetCursor()); ImageDraw img(ctrl->GetRect().GetSize()); ctrl->DrawCtrlWithParent(img); return img; }
CStrSetCmd( EStrMapEditCtrlImp* pCtrl, float pos, const char* str ) : CPropBaseCmd(pCtrl) { m_fPos = pos; m_strOld = GetCtrl()->GetEStrNode(m_fPos); m_strData = str; }
void hgeGUI::MoveCtrl(int id, float x, float y) { hgeGUIObject *ctrl=GetCtrl(id); ctrl->rect.x2=x + (ctrl->rect.x2 - ctrl->rect.x1); ctrl->rect.y2=y + (ctrl->rect.y2 - ctrl->rect.y1); ctrl->rect.x1=x; ctrl->rect.y1=y; }