void CSSE2Surface32Intrinsic::OnCreated() { ASSERT(GetBitDepth() == 32); ASSERT((GetPitch() & 0xF) == 0); ASSERT(GetVisibleWidth() && GetVisibleHeight()); ASSERT(sizeof(RGBQUAD) == 4); int width = GetVisibleWidth(); m_qwpl = GetPitch()/8; // qwords Per Line m_width = (width+3)/4; // 4 pixels at a time }
hsMatrix44 plDynamicTextMap::GetLayerTransform( void ) { hsMatrix44 xform; hsVector3 scale; scale.Set( (float)GetVisibleWidth() / (float)GetWidth(), (float)GetVisibleHeight() / (float)GetHeight(), 1.f ); xform.MakeScaleMat( &scale ); return xform; }
void ColumnManager::SetVisible(int column, bool visible) { size_t index = static_cast<size_t>(column); assert(index < columns.size()); if (columns[index].visible != visible) { columns[index].visible = visible; columns[index].relevant |= visible; if (!visible) columns[index].width = 0; control->SetColumnWidth(column, GetVisibleWidth(column, true)); ApplyColumnOrder(); control->Invalidate(FALSE); } }
void ColumnManager::ResetColumns(DWORD defaultColumns) { // update internal data std::sort(columnOrder.begin(), columnOrder.end()); for (size_t i = 0, count = columns.size(); i < count; ++i) { columns[i].width = 0; columns[i].visible = (i < 32) && (((defaultColumns >> i) & 1) != 0); columns[i].adjusted = false; } // update UI for (int i = 0, count = GetColumnCount(); i < count; ++i) control->SetColumnWidth(i, GetVisibleWidth(i, true)); ApplyColumnOrder(); control->Invalidate(FALSE); }
void ColumnManager::UpdateUserPropList (const std::vector<FileEntry*>& files) { // collect all user-defined props std::set<CString> aggregatedProps; for (size_t i = 0, count = files.size(); i < count; ++i) files[i]->present_props.GetPropertyNames (aggregatedProps); aggregatedProps.erase (_T("svn:needs-lock")); itemProps = aggregatedProps; // add new ones to the internal list std::set<CString> newProps = aggregatedProps; for (size_t i = 0, count = userProps.size(); i < count; ++i) newProps.erase (userProps[i].name); while (newProps.size() + userProps.size() > SVNSLC_MAXCOLUMNCOUNT - SVNSLC_USERPROPCOLOFFSET) newProps.erase (--newProps.end()); typedef std::set<CString>::const_iterator CIT; for ( CIT iter = newProps.begin(), end = newProps.end() ; iter != end ; ++iter) { int index = static_cast<int>(userProps.size()) + SVNSLC_USERPROPCOLOFFSET; columnOrder.push_back (index); UserProp userProp; userProp.name = *iter; userProp.width = 0; userProps.push_back (userProp); } // remove unused columns from control. // remove used ones from the set of aggregatedProps. for (size_t i = columns.size(); i > 0; --i) if ((columns[i-1].index >= SVNSLC_USERPROPCOLOFFSET) && (aggregatedProps.erase (GetName ((int)i-1)) == 0)) { // this user-prop has not been set on any item if (!columns[i-1].visible) { control->DeleteColumn (static_cast<int>(i-1)); columns.erase (columns.begin() + i-1); } } // aggregatedProps now contains new columns only. // we can't use newProps here because some props may have been used // earlier but were not in the recent list of used props. // -> they are neither in columns[] nor in newProps. for ( CIT iter = aggregatedProps.begin(), end = aggregatedProps.end() ; iter != end ; ++iter) { // get the logical column index / ID int index = -1; int width = 0; for (size_t i = 0, count = userProps.size(); i < count; ++i) if (userProps[i].name == *iter) { index = static_cast<int>(i) + SVNSLC_USERPROPCOLOFFSET; width = userProps[i].width; break; } assert (index != -1); // find insertion position std::vector<ColumnInfo>::iterator columnIter = columns.begin(); std::vector<ColumnInfo>::iterator end = columns.end(); for (; (columnIter != end) && columnIter->index < index; ++columnIter); int pos = static_cast<int>(columnIter - columns.begin()); ColumnInfo column; column.index = index; column.width = width; column.visible = false; columns.insert (columnIter, column); // update control int result = control->InsertColumn (pos, *iter, LVCFMT_LEFT, GetVisibleWidth(pos, false)); assert (result != -1); UNREFERENCED_PARAMETER(result); } // update column order ApplyColumnOrder(); }
void ColumnManager::ReadSettings ( DWORD defaultColumns , DWORD hideColumns , const CString& containerName , int maxsize , int * widthlist) { // defaults DWORD selectedStandardColumns = defaultColumns & ~hideColumns; m_dwDefaultColumns = defaultColumns & ~hideColumns; columns.resize (maxsize); int power = 1; for (size_t i = 0; i < maxsize; ++i) { columns[i].index = static_cast<int>(i); if(widthlist==NULL) columns[i].width = 0; else columns[i].width = widthlist[i]; columns[i].visible = true; columns[i].relevant = !(hideColumns & power); power *= 2; } // userProps.clear(); // where the settings are stored within the registry registryPrefix = _T("Software\\TortoiseGit\\StatusColumns\\") + containerName; // we accept settings of current version only bool valid = (DWORD)CRegDWORD (registryPrefix + _T("Version"), 0xff) == BLAME_COLUMN_VERSION; if (valid) { // read (possibly different) column selection selectedStandardColumns = CRegDWORD (registryPrefix, selectedStandardColumns) & ~hideColumns; // read user-prop lists CString userPropList = CRegString (registryPrefix + _T("UserProps")); CString shownUserProps = CRegString (registryPrefix + _T("ShownUserProps")); ParseUserPropSettings (userPropList, shownUserProps); // read column widths CString colWidths = CRegString (registryPrefix + _T("_Width")); ParseWidths (colWidths); } // process old-style visibility setting SetStandardColumnVisibility (selectedStandardColumns); // clear all previously set header columns int c = ((CHeaderCtrl*)(control->GetDlgItem(0)))->GetItemCount()-1; while (c>=0) control->DeleteColumn(c--); // create columns for (int i = 0, count = GetColumnCount(); i < count; ++i) control->InsertColumn (i, GetName(i), LVCFMT_LEFT, IsVisible(i)&&IsRelevant(i) ? -1 : GetVisibleWidth(i, false)); // restore column ordering if (valid) ParseColumnOrder (CRegString (registryPrefix + _T("_Order"))); else ParseColumnOrder (CString()); ApplyColumnOrder(); // auto-size the columns so we can see them while fetching status // (seems the same values will not take affect in InsertColumn) for (int i = 0, count = GetColumnCount(); i < count; ++i) if (IsVisible(i)) control->SetColumnWidth (i, GetVisibleWidth (i, true)); }
void CSVNStatusListCtrl::ColumnManager::ReadSettings ( DWORD defaultColumns , const CString& containerName) { // defaults DWORD selectedStandardColumns = defaultColumns; columns.resize (SVNSLC_NUMCOLUMNS); for (size_t i = 0; i < SVNSLC_NUMCOLUMNS; ++i) { columns[i].index = static_cast<int>(i); columns[i].width = 0; columns[i].visible = true; columns[i].relevant = true; } userProps.clear(); // where the settings are stored within the registry registryPrefix = L"Software\\TortoiseSVN\\StatusColumns\\" + containerName; // we accept only the current version bool valid = (DWORD)CRegDWORD (registryPrefix + L"Version", 0xff) == SVNSLC_COL_VERSION; if (valid) { // read (possibly different) column selection selectedStandardColumns = CRegDWORD (registryPrefix, selectedStandardColumns); // read user-prop lists CString userPropList = CRegString (registryPrefix + L"UserProps"); CString shownUserProps = CRegString (registryPrefix + L"ShownUserProps"); ParseUserPropSettings (userPropList, shownUserProps); // read column widths CString colWidths = CRegString (registryPrefix + L"_Width"); ParseWidths (colWidths); } // process old-style visibility setting SetStandardColumnVisibility (selectedStandardColumns); // clear all previously set header columns int c = ((CHeaderCtrl*)(control->GetDlgItem(0)))->GetItemCount()-1; while (c>=0) control->DeleteColumn(c--); // create columns for (int i = 0, count = GetColumnCount(); i < count; ++i) control->InsertColumn (i, GetName(i), LVCFMT_LEFT, IsVisible(i) ? -1 : GetVisibleWidth(i, false)); // restore column ordering if (valid) ParseColumnOrder (CRegString (registryPrefix + L"_Order")); else ParseColumnOrder (CString()); ApplyColumnOrder(); // auto-size the columns so we can see them while fetching status // (seems the same values will not take affect in InsertColumn) for (int i = 0, count = GetColumnCount(); i < count; ++i) if (IsVisible(i)) control->SetColumnWidth (i, GetVisibleWidth (i, true)); }