Vector3f Matrix3f::Solve(const Vector3f& constants) const{ float det = Determinate(); float x = SetColumn(0, constants).Determinate() / det; float y = SetColumn(1, constants).Determinate() / det; float z = SetColumn(2, constants).Determinate() / det; return(Vector3f(x, y, z)); }
//----------------------------------------------------------------------- void Matrix3x3::FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis) { SetColumn(0,xAxis); SetColumn(1,yAxis); SetColumn(2,zAxis); }
void mmAssetsListCtrl::OnColClick(wxListEvent& event) { int ColumnNr; if (event.GetId() != MENU_HEADER_SORT) ColumnNr = event.GetColumn(); else ColumnNr = m_ColumnHeaderNbr; if (0 > ColumnNr || ColumnNr >= m_panel->col_max() || ColumnNr == 0) return; if (m_selected_col == ColumnNr && event.GetId() != MENU_HEADER_SORT) m_asc = !m_asc; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(-1); SetColumn(m_selected_col, item); m_selected_col = ColumnNr; item.SetImage(m_asc ? 8 : 7); SetColumn(m_selected_col, item); Model_Setting::instance().Set("ASSETS_ASC", m_asc); Model_Setting::instance().Set("ASSETS_SORT_COL", m_selected_col); int trx_id = -1; if (m_selected_row>=0) trx_id = m_panel->m_assets[m_selected_row].ASSETID; doRefreshItems(trx_id); }
/*! Replaces *this with a matrix that represents reflection on the plane through 0 which is given by the normal vector norm. \warning If the vector norm has length zero, this method will generate the 0-matrix. If the length of the axis is close to zero, but not == 0.0, this method may behave in unexpected ways and return almost random results; details may depend on your particular floating point implementation. The use of this method is therefore highly discouraged, unless you are certain that the length is in a reasonable range, away from 0.0 (Stefan Kebekus) \deprecated This method will probably replaced by a safer algorithm in the future. \todo Replace this method with a more fool-proof version. @param norm specifies the normal to the plane */ void matrix3x3::PlaneReflection(const vector3 &norm) { //@@@ add a safety net vector3 normtmp = norm; normtmp.normalize(); SetColumn(0, vector3(1,0,0) - 2*normtmp.x()*normtmp); SetColumn(1, vector3(0,1,0) - 2*normtmp.y()*normtmp); SetColumn(2, vector3(0,0,1) - 2*normtmp.z()*normtmp); }
void StocksListCtrl::OnColClick(wxListEvent& event) { int ColumnNr; if (event.GetId() != MENU_HEADER_SORT) ColumnNr = event.GetColumn(); else ColumnNr = ColumnHeaderNr; if (0 >= ColumnNr || ColumnNr >= getColumnsNumber()) return; if (m_selected_col == ColumnNr && event.GetId() != MENU_HEADER_SORT) m_asc = !m_asc; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(-1); SetColumn(m_selected_col, item); m_selected_col = ColumnNr; Model_Setting::instance().Set("STOCKS_ASC", m_asc); Model_Setting::instance().Set("STOCKS_SORT_COL", m_selected_col); int trx_id = -1; if (m_selected_row>=0) trx_id = m_stocks[m_selected_row].STOCKID; doRefreshItems(trx_id); stock_panel_->OnListItemSelected(-1); }
void CMuleListCtrl::SetColumnImage(unsigned col, int image) { wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(image); SetColumn(col, item); }
void UUniformGridSlot::SynchronizeProperties() { SetRow(Row); SetColumn(Column); SetHorizontalAlignment(HorizontalAlignment); SetVerticalAlignment(VerticalAlignment); }
int StocksListCtrl::initVirtualListControl(int id, int col, bool asc) { stock_panel_->updateHeader(); /* Clear all the records */ DeleteAllItems(); wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(asc ? 3 : 2); SetColumn(col, item); m_stocks = Model_Stock::instance().find(Model_Stock::HELDAT(stock_panel_->accountID_)); sortTable(); int cnt = 0, selected_item = -1; for (const auto& stock: m_stocks) { if (id == stock.STOCKID) { selected_item = cnt; break; } ++cnt; } SetItemCount(m_stocks.size()); return selected_item; }
void billsDepositsListCtrl::OnColClick(wxListEvent& event) { int ColumnNr; if (event.GetId() != MENU_HEADER_SORT) ColumnNr = event.GetColumn(); else ColumnNr = m_ColumnHeaderNbr; if (0 > ColumnNr || ColumnNr >= m_bdp->getColumnsNumber() || ColumnNr == 0) return; if (m_selected_col == ColumnNr && event.GetId() != MENU_HEADER_SORT) m_asc = !m_asc; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(-1); SetColumn(m_selected_col, item); m_selected_col = ColumnNr; Model_Setting::instance().Set("BD_ASC", m_asc); Model_Setting::instance().Set("BD_SORT_COL", m_selected_col); if (m_selected_row >= 0) refreshVisualList(m_bdp->initVirtualListControl(m_bdp->bills_[m_selected_row].BDID)); else refreshVisualList(m_bdp->initVirtualListControl(-1)); }
void PoeditListCtrl::CreateColumns() { DeleteAllColumns(); int curr = 0; m_colSource = (int)InsertColumn(curr++, _("Source text")); if (m_catalog && m_catalog->HasCapability(Catalog::Cap::Translations)) m_colTrans = (int)InsertColumn(curr++, _("Translation")); else m_colTrans = -1; if (m_displayIDs) m_colId = (int)InsertColumn(curr++, _("ID"), wxLIST_FORMAT_RIGHT); else m_colId = -1; #ifdef __WXMSW__ if (m_appIsRTL) { // another wx quirk: if we truly need left alignment, we must lie under RTL locales wxListItem colInfoOrig; colInfoOrig.SetAlign(wxLIST_FORMAT_RIGHT); SetColumn(m_colSource, colInfoOrig); } #endif SizeColumns(); }
void MyListCtrl::SetColumnImage(int col, int image) { wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(image); SetColumn(col, item); }
void wxSortedListCtrl::SetSortImage(int col, SortType type) { wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(type); SetColumn(col, item); }
void CustomVirtListCtrl<T,L>::OnColClick( wxListEvent& event ) { if ( event.GetColumn() == -1 ) return; const int evt_col = event.GetColumn(); m_sort_timer.Stop();//otherwise sorting will be way delayed int old_sort_col = m_sortorder[0].col; wxListItem col; GetColumn( m_sortorder[0].col, col ); col.SetImage( icons().ICON_NONE ); SetColumn( m_sortorder[0].col, col ); unsigned int i = 0; SortOrder::const_iterator it = m_sortorder.begin(); for ( ; it != m_sortorder.begin(); ++i, ++it ) { if ( m_sortorder[i].col == evt_col ) break; } // for ( ; m_sortorder[i].col != event.GetColumn() && i < 4; ++i ) {} i = LSL::Util::Clamp( i, (unsigned int)0, m_sort_criteria_count ); for ( ; i > 0; i--) { m_sortorder[i] = m_sortorder[i-1]; } m_sortorder[0].col = evt_col; m_sortorder[0].direction *= -1; GetColumn( m_sortorder[0].col, col ); //col.SetImage( ( m_sortorder[0].direction )?ICON_UP:ICON_DOWN ); col.SetImage( ( m_sortorder[0].direction > 0 )?icons().ICON_UP:icons().ICON_DOWN ); SetColumn( m_sortorder[0].col, col ); if ( (old_sort_col != m_sortorder[0].col) || m_dirty_sort) { SortList( true ); } else { // O(n) instead of guaranteed worst case O(n*n) ReverseOrder(); } }
bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) { wxString strBaseConfigLocation = wxEmptyString; wxListItem liColumnInfo; wxInt32 iIndex = 0; wxInt32 iColumnCount = 0; wxInt32 iTempValue = 0; wxASSERT(pConfig); // Retrieve the base location to store configuration information // Should be in the following form: "/Projects/" strBaseConfigLocation = pConfig->GetPath() + wxT("/"); // Convert to a zero based index iColumnCount = GetColumnCount() - 1; // Which fields are we interested in? liColumnInfo.SetMask( wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT ); // Cycle through the columns recording anything interesting for (iIndex = 0; iIndex <= iColumnCount; iIndex++) { GetColumn(iIndex, liColumnInfo); pConfig->SetPath(strBaseConfigLocation + liColumnInfo.GetText()); pConfig->Read(wxT("Width"), &iTempValue, -1); if (-1 != iTempValue) { liColumnInfo.SetWidth(iTempValue); #if (defined(__WXMAC__) && wxCHECK_VERSION(2,8,0)) SetColumnWidth(iIndex,iTempValue); // Work around bug in wxMac-2.8.0 wxListCtrl::SetColumn() #endif } pConfig->Read(wxT("Format"), &iTempValue, -1); if (-1 != iTempValue) { liColumnInfo.SetAlign((wxListColumnFormat)iTempValue); } SetColumn(iIndex, liColumnInfo); } // Restore sorting column and direction pConfig->SetPath(strBaseConfigLocation); pConfig->Read(wxT("ReverseSortOrder"), &iTempValue,-1); if (-1 != iTempValue) { m_pParentView->m_bReverseSort = iTempValue != 0 ? true : false; } pConfig->Read(wxT("SortColumn"), &iTempValue,-1); if (-1 != iTempValue) { m_pParentView->m_iSortColumn = iTempValue; m_pParentView->InitSort(); } return true; }
void wxGxContentView::SetColumnImage(int col, int image) { if(col >= GetColumnCount()) return; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); //reset image item.SetImage(wxNOT_FOUND); for (int i = 0; i < GetColumnCount(); ++i) { SetColumn(i, item); } item.SetImage(image); SetColumn(col, item); }
//***************************************************************************** //* //* SetColumnMark //* //***************************************************************************** // Sets the mark state of a column. A marked column will be drawn darker. // nCol : is the number of the column // bOn : is the mark state // Returns TRUE if succesfull BOOL CTreeListCtrl::SetColumnMark(int nCol, BOOL bOn) { TV_COLUMN sData; sData.fmt = (bOn) ? TVCFMT_MARK : 0; sData.mask = TVCF_MARK; return SetColumn(nCol, &sData); }
void SelectorList::OnSize(UINT nType, int cx, int cy) { if (cx > 0 && cy > 0 && ::IsWindow(m_hWnd)) { LVCOLUMN column; column.mask = LVCF_WIDTH; column.cx = cx; SetColumn(0, &column); } CListCtrl::OnSize(nType, cx, cy); }
//***************************************************************************** //* //* SetColumnImage //* //***************************************************************************** // Sets the text of an item in the column header // nCol : is the number of the column // iImage : is the new image number // Retuns TRUE if succesfull BOOL CTreeListCtrl::SetColumnImage(int nCol, int iImage) { TV_COLUMN sData; sData.iImage = iImage; sData.mask = TVCF_IMAGE; return SetColumn(nCol, &sData); }
void wxAdvancedListCtrl::SetSortArrow(wxInt32 Column, wxInt32 ArrowState) { // nuke any previously set sort arrows ResetSortArrows(); wxListItem li; li.SetMask(wxLIST_MASK_IMAGE); li.SetImage(ArrowState); SetColumn(SortCol, li); }
void wxAdvancedListCtrl::ResetSortArrows(void) { wxListItem li; li.SetMask(wxLIST_MASK_IMAGE); li.SetImage(-1); for (wxInt32 i = 0; i < GetColumnCount(); ++i) { SetColumn(i, li); } }
//***************************************************************************** //* //* SetColumnText //* //***************************************************************************** // Sets the text of an item in the column header // nCol : is the number of the column // pText : is the new text // Retuns TRUE if succesfull BOOL CTreeListCtrl::SetColumnText(int nCol, LPCTSTR pText) { TV_COLUMN sData; sData.pszText = (LPTSTR)pText; sData.cchTextMax = (int)_tcslen(pText); sData.mask = TVCF_TEXT; return SetColumn(nCol, &sData); }
void CMyListCtrl::SetColumnTextAlign(int nCol, int fmt) { LV_COLUMN lvCol; lvCol.mask = LVCF_FMT; if (GetColumn(nCol, &lvCol)) { lvCol.fmt = fmt; SetColumn(nCol, &lvCol); } }
//***************************************************************************** //* //* FixColumnSize //* //***************************************************************************** // Fixes the size of a a column. The size of a fixed column can't be changed. // nCol : is the number of the column // bOn : is the fixed state // iWidth : is the new width for the column (-1 means don't change width) // TVCF_LASTSIZE restore precedent size // Returns TRUE if succesfull BOOL CTreeListCtrl::FixColumnSize(int nCol, BOOL bOn, int iWidth) { LV_COLUMN sData; sData.fmt = (bOn) ? TVCFMT_FIXED : 0; sData.mask = TVCF_FIXED; if(iWidth >= 0) { // set also the column width sData.mask |= TVCF_WIDTH; sData.cx = iWidth; } return SetColumn(nCol, &sData); }
void mmAssetsListCtrl::OnColClick(wxListEvent& event) { if (0 > event.GetColumn() || event.GetColumn() >= m_panel->col_max()) return; if (m_selected_col == event.GetColumn()) m_asc = !m_asc; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(-1); SetColumn(m_selected_col, item); m_selected_col = event.GetColumn(); item.SetImage(m_asc ? 8 : 7); SetColumn(m_selected_col, item); Model_Setting::instance().Set("ASSETS_ASC", m_asc); Model_Setting::instance().Set("ASSETS_SORT_COL", m_selected_col); int trx_id = -1; if (m_selected_row>=0) trx_id = m_panel->m_assets[m_selected_row].ASSETID; doRefreshItems(trx_id); }
void PoeditListCtrl::ReadCatalog() { wxWindowUpdateLocker no_updates(this); // clear the list and its sort order too: SetItemCount(0); m_mapListToCatalog.clear(); m_mapCatalogToList.clear(); if (m_catalog == NULL) { Refresh(); return; } auto lang = m_catalog->GetLanguage(); auto isRTL = lang.IsRTL(); #ifdef __WXMSW__ // a quirk of wx API: if the current locale is RTL, the meaning of L and R is reversed if (m_appIsRTL) isRTL = !isRTL; #endif m_isRTL = isRTL; wxString langname = lang.IsValid() ? lang.DisplayName() : _("unknown language"); wxListItem colInfo; colInfo.SetMask(wxLIST_MASK_TEXT); colInfo.SetText(wxString::Format(_(L"Translation — %s"), langname)); colInfo.SetAlign(isRTL ? wxLIST_FORMAT_RIGHT : wxLIST_FORMAT_LEFT); SetColumn(1, colInfo); // sort catalog items, create indexes mapping CreateSortMap(); // now that everything is prepared, we may set the item count SetItemCount(m_catalog->GetCount()); // scroll to the top and refresh everything: if ( m_catalog->GetCount() ) { SelectOnly(0); RefreshItems(0, m_catalog->GetCount()-1); } else { Refresh(); } }
AnimationSprite::AnimationSprite(ID2D1Bitmap *pTexture, int row, int column, float x, float y, float width, float height) : Sprite(pTexture, x, y) { SetRow(row); SetColumn(column); SetCX(0); SetCY(0); SetWidth(width); SetHeight(height); SetLocation(x, y); fps = column*1.f; isPlaying = false; totalTime = 0; }
BOOL CFolderListCtrl::SetColumnName() { LVCOLUMN lvc; CSCADString sColHeader; lvc.mask = LVCF_TEXT; for( int i = flcName; i < flcSize; i++ ) { sColHeader.LoadString( m_flciColumns[i].m_idStr ); lvc.pszText = sColHeader.GetBuffer( 0 ); SetColumn( i, &lvc ); } m_sModifiedFormat.LoadString( IDS_FL_MODIFIED_FORMAT ); UpdateFileCount(); return TRUE; }
void PoeditListCtrl::CreateColumns() { DeleteAllColumns(); InsertColumn(0, _("Source text")); InsertColumn(1, _("Translation")); if (m_displayIDs) InsertColumn(2, _("ID"), wxLIST_FORMAT_RIGHT); #ifdef __WXMSW__ if (m_appIsRTL) { // another wx quirk: if we truly need left alignment, we must lie under RTL locales wxListItem colInfoOrig; colInfoOrig.SetAlign(wxLIST_FORMAT_RIGHT); SetColumn(0, colInfoOrig); } #endif SizeColumns(); }
SMat4::SMat4(const SQuat &q) { // assume2(q.IsNormalized(1e-3f), q.ToString(), q.LengthSq()); const float x = q.X( ); const float y = q.Y( ); const float z = q.Z( ); const float w = q.W( ); m[ 0 ][ 0 ] = 1 - 2 * ( y * y + z * z ); m[ 0 ][ 1 ] = 2 * ( x * y - z * w ); m[ 0 ][ 2 ] = 2 * ( x * z + y * w ); m[ 1 ][ 0 ] = 2 * ( x * y + z * w ); m[ 1 ][ 1 ] = 1 - 2 * ( x * x + z * z ); m[ 1 ][ 2 ] = 2 * ( y * z - x * w ); m[ 2 ][ 0 ] = 2 * ( x * z - y * w ); m[ 2 ][ 1 ] = 2 * ( y * z + x * w ); m[ 2 ][ 2 ] = 1 - 2 * ( x * x + y * y ); SetRow( 3, { 0, 0, 0, 1 } ); SetColumn( 3, { 0, 0, 0, 1 } ); }
void StocksListCtrl::OnColClick(wxListEvent& event) { if(0 > event.GetColumn() || event.GetColumn() >= getColumnsNumber()) return; if (m_selected_col == event.GetColumn()) m_asc = !m_asc; wxListItem item; item.SetMask(wxLIST_MASK_IMAGE); item.SetImage(-1); SetColumn(m_selected_col, item); m_selected_col = event.GetColumn(); Model_Setting::instance().Set("STOCKS_ASC", m_asc); Model_Setting::instance().Set("STOCKS_SORT_COL", m_selected_col); int trx_id = -1; if (m_selected_row>=0) trx_id = m_stocks[m_selected_row].STOCKID; doRefreshItems(trx_id); stock_panel_->OnListItemSelected(-1); }