From: Leon W. <moo...@us...> - 2005-01-27 13:29:34
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5691 Modified Files: ConfigFile.cpp ConfigFile.h Log Message: Added default file filter option for file dialogs Index: ConfigFile.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/ConfigFile.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ConfigFile.h 3 Dec 2004 06:46:12 -0000 1.19 --- ConfigFile.h 27 Jan 2005 13:29:20 -0000 1.20 *************** *** 1,2 **** --- 1,26 ---- + /**************************************************************************** + Copyright (C) AnyEdit Team + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + + http://www.anyedit.org + *****************************************************************************/ + // ConfigFile.h: interface for the CConfigFile class. // *************** *** 77,81 **** // File Filters #define TAG_FILTER "Filter" ! #define ATT_FILTER_SYNTAX_FILE "UseSFFilters" // File Associations --- 101,105 ---- // File Filters #define TAG_FILTER "Filter" ! #define ATT_FILTER_DEFAULT "default" // File Associations *************** *** 324,332 **** bool AddFileFilter( CString szFilter ); ! /// Do we want to use the Syntax File Filters in the Dialog? ! bool GetUseSyntaxFileFilters(); ! /// Set the use SyntxtFileFilters attribute. ! bool SetUseSyntaxFileFilters( bool bUse ); /// Get the number of File Associations. --- 348,356 ---- bool AddFileFilter( CString szFilter ); ! /// Get the default FileFilter for Open/Save Dialogs ! int GetFileFilterDefault(); ! /// Set the default FileFilter for Open/Save Dialogs ! bool SetFileFilterDefault( int iDefault ); /// Get the number of File Associations. Index: ConfigFile.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/ConfigFile.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ConfigFile.cpp 3 Dec 2004 06:46:12 -0000 1.20 --- ConfigFile.cpp 27 Jan 2005 13:29:20 -0000 1.21 *************** *** 1,2 **** --- 1,26 ---- + /**************************************************************************** + Copyright (C) AnyEdit Team + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + + http://www.anyedit.org + *****************************************************************************/ + // ConfigFile.cpp: implementation of the CConfigFile class. // *************** *** 625,657 **** } ! // Do we want to use the Syntax File Filters in the Dialog? ! // If we can't find the node we return true so we at least ! // use the syntax file filters. ! bool CConfigFile::GetUseSyntaxFileFilters() { if( !m_bParsed ) Parse(); pug::xml_node xnode( m_xml_parser.document().first_element_by_name( TAG_FILE_FILTERS ) ); ! if( xnode.empty() || !xnode.has_attributes() ) return true; ! return atoi( xnode.attribute( ATT_FILTER_SYNTAX_FILE ) ) ? true : false; } ! /// Set the use SyntxtFileFilters attribute. ! bool CConfigFile::SetUseSyntaxFileFilters( bool bUse ) { ! CString szUse; if( !m_bParsed ) Parse(); ! szUse.Format( "%i", bUse ); pug::xml_node xnode( m_xml_parser.document().first_element_by_name( TAG_FILE_FILTERS ) ); if( xnode.empty() ) return false; ! if( !xnode.has_attributes() ) { ! xnode.append_attribute( ATT_FILTER_SYNTAX_FILE, szUse ); } else { ! xnode.attribute( ATT_FILTER_SYNTAX_FILE ).value( szUse ); } return m_bModified = true; --- 649,680 ---- } ! // Get the default FileFilter for Open/Save Dialogs ! int CConfigFile::GetFileFilterDefault() { if( !m_bParsed ) Parse(); pug::xml_node xnode( m_xml_parser.document().first_element_by_name( TAG_FILE_FILTERS ) ); ! if( xnode.empty() || !xnode.has_attributes() ) return 0; ! return atoi( xnode.attribute( ATT_FILTER_DEFAULT ) ); } ! // Set the default FileFilter for Open/Save Dialogs ! bool CConfigFile::SetFileFilterDefault( int iDefault ) { ! CString szDefault; if( !m_bParsed ) Parse(); ! szDefault.Format( "%i", iDefault ); pug::xml_node xnode( m_xml_parser.document().first_element_by_name( TAG_FILE_FILTERS ) ); if( xnode.empty() ) return false; ! if( !xnode.has_attributes() || !xnode.has_attribute( ATT_FILTER_DEFAULT ) ) { ! xnode.append_attribute( ATT_FILTER_DEFAULT, szDefault ); } else { ! ! xnode.attribute( ATT_FILTER_DEFAULT ).value( szDefault ); } return m_bModified = true; |