mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Merge pull request #502 from Mateos81/ModelBrowsingTweak
Model browsing: move "All supported types" to top
This commit is contained in:
commit
7cdf4a24cb
2 changed files with 20 additions and 18 deletions
|
@ -1330,17 +1330,6 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
|
||||||
CFileType typelist;
|
CFileType typelist;
|
||||||
if ( pattern != NULL ) {
|
if ( pattern != NULL ) {
|
||||||
GetFileTypeRegistry()->getTypeList( pattern, &typelist );
|
GetFileTypeRegistry()->getTypeList( pattern, &typelist );
|
||||||
|
|
||||||
// kaz - viewing all file types at once is really convenient for model selection
|
|
||||||
if ( !strcmp( "Open Model", title ) ) {
|
|
||||||
CString allTypesFilter;
|
|
||||||
for( int i = 0; i < typelist.GetNumTypes(); i++ ) {
|
|
||||||
allTypesFilter += typelist.GetTypeForIndex(i).pattern;
|
|
||||||
if ( i < typelist.GetNumTypes() - 1 )
|
|
||||||
allTypesFilter += ";";
|
|
||||||
}
|
|
||||||
typelist.addType(filetype_t("All supported types", allTypesFilter.GetBuffer()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -1360,12 +1349,6 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
|
||||||
// "select the first filter as default".
|
// "select the first filter as default".
|
||||||
if ( pattern ) {
|
if ( pattern ) {
|
||||||
ofn.lpstrFilter = typelist.m_strWin32Filters;
|
ofn.lpstrFilter = typelist.m_strWin32Filters;
|
||||||
|
|
||||||
// kaz - the "all supported types" will be at bottom of list
|
|
||||||
// ...idiomatically uncouth but not worth fixing
|
|
||||||
if ( !strcmp( "Open Model", title ) ) {
|
|
||||||
ofn.nFilterIndex = typelist.GetNumTypes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,8 +91,27 @@ virtual void addType( const char* key, filetype_t type ){
|
||||||
}
|
}
|
||||||
virtual void getTypeList( const char* key, IFileTypeList* typelist ){
|
virtual void getTypeList( const char* key, IFileTypeList* typelist ){
|
||||||
filetype_list_t& list_ref = m_typelists[key];
|
filetype_list_t& list_ref = m_typelists[key];
|
||||||
for ( unsigned int i = 0; i < list_ref.size(); ++i )
|
|
||||||
|
if (key == "model") {
|
||||||
|
// Get the list of all supported types (adapted from kaz)
|
||||||
|
CString allTypesFilter;
|
||||||
|
for (unsigned int i = 0; i < list_ref.size(); ++i) {
|
||||||
|
allTypesFilter += list_ref[i].getType().pattern;
|
||||||
|
if (i < list_ref.size() - 1) {
|
||||||
|
allTypesFilter += ";";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the item on top
|
||||||
|
// TODO: Make is translatable
|
||||||
|
typelist->addType(filetype_t("All supported types", allTypesFilter.GetBuffer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then add the supported types one by one
|
||||||
|
// TODO: Sort them alphabetically (have them sorted in m_typelists[key])
|
||||||
|
for ( unsigned int i = 0; i < list_ref.size(); ++i ) {
|
||||||
typelist->addType( list_ref[i].getType() );
|
typelist->addType( list_ref[i].getType() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
struct filetype_copy_t
|
struct filetype_copy_t
|
||||||
|
|
Loading…
Reference in a new issue