void wxTextEntry::Cut() { wxCHECK_RET( GetTextPeer(), "Must create the control first" ); if (CanCut()) GetTextPeer()->Cut() ; }
void wxTextCtrl::OnKeyDown(wxKeyEvent& event) { if ( event.GetModifiers() == wxMOD_CONTROL ) { switch( event.GetKeyCode() ) { case 'A': SelectAll(); return; case 'C': if ( CanCopy() ) Copy() ; return; case 'V': if ( CanPaste() ) Paste() ; return; case 'X': if ( CanCut() ) Cut() ; return; default: break; } } // no, we didn't process it event.Skip(); }
void wxTextCtrl::Cut() { if (CanCut()) { ::SendMessage(GetBuddyHwnd(), WM_CUT, 0, 0L); } }
void CPWL_Edit::CutText() { if (!CanCut()) return; CFX_WideString str = m_pEdit->GetSelText(); if (IFX_SystemHandler* pSH = GetSystemHandler()) pSH->SetClipboardText(GetAttachedHWnd(), str); m_pEdit->Clear(); }
void wxTextCtrl::Cut() { if (CanCut()) { HWND hWnd = GetHwnd(); if (m_bIsMLE) ::WinSendMsg(hWnd, MLM_CUT, 0, 0); else ::WinSendMsg(hWnd, EM_CUT, 0, 0); } } // end of wxTextCtrl::Cut
void wxTextCtrl::Cut() { if (CanCut()) { wxClipboardTextEvent evt(wxEVT_TEXT_CUT, GetId()); evt.SetEventObject(this); if (!GetEventHandler()->ProcessEvent(evt)) { wxTextEntry::Cut(); SendTextUpdatedEvent(); } } }
bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const { switch(command_id) { case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo(); case IDS_APP_CUT: return !textfield_->read_only() && !textfield_->IsPassword() && !!CanCut(); case IDS_APP_COPY: return !!CanCopy() && !textfield_->IsPassword(); case IDS_APP_PASTE: return !textfield_->read_only() && !!CanPaste(); case IDS_APP_SELECT_ALL: return !!CanSelectAll(); default: NOTREACHED(); return false; } }
void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event) { event.Enable( CanCut() ); }
mvec<Genome*> Genome::Split( float wanted_ratio, int impTh ) { /* % For each gene go and try to divide the genome after each gene, make % sure we do not cut any genes in the middle and select the ratio % closest to 0.5 */ float best_ratio = FLT_MAX; int best_position = 0; int n = genes.size(); int last_impI = 0; int last_impJ = 0; int i = (int)(n * wanted_ratio + 0.5f) - 1; int j = (int)(n * wanted_ratio + 0.5f); while ((i > 0 && last_impI < impTh) || (j < n && last_impJ < impTh)) { if (i > 0 && last_impI < impTh) { Feature* cur = genes(i); Feature* next = genes(i + 1); int cur_end = max(cur->indices); int next_start = min(next->indices); int middle = round(0.5 * (cur_end+next_start)); if (CanCut(middle)) { float ratio = CountGenes(1, middle) / (float)n; if (fabsf(ratio - wanted_ratio) < fabsf(best_ratio - wanted_ratio)) { best_ratio = ratio; d_trace("[+] (%d) New best ratio attained - %f\n", i, best_ratio); best_position = middle; last_impI = 0; } else { last_impI = last_impI + 1; } } } i--; if (j < n && last_impJ < impTh) { Feature* cur = genes(j); Feature* next = genes(j + 1); int cur_end = max(cur->indices); int next_start = min(next->indices); int middle = round(0.5 * (cur_end+next_start)); if (CanCut(middle)) { float ratio = CountGenes(1, middle) / (float) n; if (fabsf(ratio - wanted_ratio) < fabsf(best_ratio - wanted_ratio)) { best_ratio = ratio; d_trace("[+] (%d) New best ratio attained - %f\n", i, best_ratio); best_position = middle; last_impJ = 0; } else { last_impJ = last_impJ + 1; } } } j++; } // % BTW, this works only coz the genes are sorted in incresing order of // % their lower index (lower != first) d_trace("[i] Cutting sequence at %d\n", best_position); mvec<Genome*> r; r.push_back(GetSubset(1, best_position)); // train // train.Sequence = g.Sequence(1:best_position); //train.gene = get_all_genes(f, 1, best_position); r.push_back(GetSubset(best_position + 1, sequence.size())); // test.Sequence = g.Sequence(best_position + 1:seq_length); // test.gene = get_all_genes(f, best_position + 1, seq_length); // test.gene = shift_genes(test.gene, best_position); return r; }
void wxWebFrame::Cut() { if (CanCut()) m_impl->frame->editor()->cut(); }
void wxComboBox::OnUpdateCut(wxUpdateUIEvent& event) { event.Enable( CanCut() ); }
void wxTextCtrl::OnUpdateCut( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanCut()); } // end of wxTextCtrl::OnUpdateCut
bool CSimpleReport::doCutPaste(CPoint pt, int op) { CXTPReportSelectedRows* pRows = GetSelectedRows(); if (pRows == NULL) return false; CXTPReportRow* pRow = pRows->GetAt(0); int nRow = 0; if (pRow) nRow = pRows->GetAt(0)->GetIndex(); int n; CMenu menu; if (!menu.CreatePopupMenu()) return false; if ((op & DO_ADD) != 0) { menu.AppendMenu(MF_STRING, 10, "Add New"); menu.AppendMenu(MF_STRING, 13, "Insert"); } if (CanCopy() && (op & DO_COPY) != 0) menu.AppendMenu(MF_STRING, 11, "Copy"); if (CanCut() && (op & DO_CUT) != 0) menu.AppendMenu(MF_STRING, 12, "Delete"); n = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, pt.x, pt.y, this); menu.DestroyMenu(); switch (n) { case 10: // add case 13: // insert { CXTPReportRecord* pRec = newRec(); if (callback_add) { if (!callback_add(this, pRec)) { delete pRec; return false; } } RowInsert(pRec, (n == 10)); } break; case 11: // copy { pRow = GetFocusedRow(); if (!pRow) return false; CXTPReportRecord* pSource = pRow->GetRecord(); CXTPReportRecord* pTarget = newRec(); if (callback_copy) { if (!callback_copy(this, pSource, pTarget)) { delete pTarget; return false; } } RowInsert(pTarget); } break; case 12: // delete { n = pRows->GetCount(); for (int i = 0; i < n; i++) { if (callback_del) { CXTPReportRecord* pRec = pRows->GetAt(i)->GetRecord(); if (!callback_del(this, pRec)) { return false; } } } for (int i = n - 1; i >= 0; i--) { pRow = pRows->GetAt(i); GetRecords()->RemoveAt(pRow->GetRecord()->GetIndex()); } Populate(); RowSetFocused(nRow); } break; default: return false; } return true; }
void CPWL_Edit::CutText() { if (!CanCut()) return; m_pEdit->Clear(); }