From: Leon W. <moo...@us...> - 2005-01-27 13:35:09
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6729 Modified Files: AnyEdit.rc DirextPref.cpp DirextPref.h resource.h Log Message: Preference options added to set the default file filter. The options are: 1. User selected filter. 2. The last selected filter. 3. The filter from the current file. Index: AnyEdit.rc =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.rc,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** AnyEdit.rc 23 Dec 2004 11:44:52 -0000 1.110 --- AnyEdit.rc 27 Jan 2005 13:34:55 -0000 1.111 *************** *** 1419,1437 **** END ! IDD_SAPREFS DIALOG DISCARDABLE 0, 0, 394, 234 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Prefs" FONT 8, "MS Sans Serif" BEGIN ! DEFPUSHBUTTON "&Ok",IDOK,158,215,53,15,BS_CENTER ! PUSHBUTTON "&Cancel",IDCANCEL,274,215,55,15 ! CONTROL "",IDC_DLG_FRAME,"Static",SS_GRAYFRAME,100,18,292,189 LTEXT "",IDC_CAPTION_BAR,100,5,291,12,SS_CENTERIMAGE CONTROL "Tree1",IDC_PAGE_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,4,5,91,201 ! PUSHBUTTON "&Help",IDC_PHELP,334,215,50,15 ! GROUPBOX "",IDC_STATIC,3,206,389,27 ! PUSHBUTTON "&Apply",IDC_APPLY,216,215,53,15,BS_CENTER END --- 1419,1437 ---- END ! IDD_SAPREFS DIALOG DISCARDABLE 0, 0, 418, 250 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Prefs" FONT 8, "MS Sans Serif" BEGIN ! DEFPUSHBUTTON "&Ok",IDOK,183,215,53,15,BS_CENTER ! PUSHBUTTON "&Cancel",IDCANCEL,299,215,55,15 ! CONTROL "",IDC_DLG_FRAME,"Static",SS_GRAYFRAME,109,18,307,189 LTEXT "",IDC_CAPTION_BAR,100,5,291,12,SS_CENTERIMAGE CONTROL "Tree1",IDC_PAGE_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,4,5,91,201 ! PUSHBUTTON "&Help",IDC_PHELP,359,215,50,15 ! GROUPBOX "",IDC_STATIC,4,206,412,27 ! PUSHBUTTON "&Apply",IDC_APPLY,241,215,53,15,BS_CENTER END *************** *** 1921,1939 **** IDD_PREF_EXTEN DIALOGEX 0, 0, 295, 192 STYLE WS_CHILD ! FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN ! LTEXT "File Filters",IDC_STATIC,7,7,269,10 CONTROL "List1",IDC_EXTENSIONS,"SysListView32",LVS_REPORT | ! LVS_SINGLESEL | WS_TABSTOP,7,17,281,82,WS_EX_CLIENTEDGE ! LTEXT "Filtername",IDC_STATIC,7,100,33,8 ! EDITTEXT IDC_DESCRIPTION,7,111,226,13,ES_AUTOHSCROLL ! LTEXT "Extensions",IDC_STATIC,7,127,35,8 ! EDITTEXT IDC_EXTENSION,7,139,226,13,ES_AUTOHSCROLL ! PUSHBUTTON "&Add",IDC_FILEFILTER_ADD,240,106,48,14 ! PUSHBUTTON "&Remove",IDC_FILEFILTER_REMOVE,239,142,49,14 ! CONTROL "Add Syntax File Extensions as File Filters", IDC_CHECK_LANUGUAGE_EXTENSIONS,"Button",BS_AUTOCHECKBOX | ! WS_TABSTOP,7,155,143,10 ! PUSHBUTTON "&Change",IDC_FILEFILTER_CHANGE,240,124,48,14 END --- 1921,1949 ---- IDD_PREF_EXTEN DIALOGEX 0, 0, 295, 192 STYLE WS_CHILD ! FONT 8, "MS Sans Serif" BEGIN ! LTEXT "File Filters",IDC_STATIC,7,7,131,10 CONTROL "List1",IDC_EXTENSIONS,"SysListView32",LVS_REPORT | ! LVS_SINGLESEL | WS_TABSTOP,7,17,281,66,WS_EX_CLIENTEDGE ! LTEXT "Filtername",IDC_STATIC,7,85,33,8 ! EDITTEXT IDC_DESCRIPTION,7,96,226,13,ES_AUTOHSCROLL ! LTEXT "Extensions",IDC_STATIC,7,112,35,8 ! EDITTEXT IDC_EXTENSION,7,124,226,13,ES_AUTOHSCROLL ! PUSHBUTTON "&Add",IDC_FILEFILTER_ADD,240,91,48,14 ! PUSHBUTTON "&Remove",IDC_FILEFILTER_REMOVE,239,127,49,14 ! CONTROL "Show Default File Filters", IDC_CHECK_LANUGUAGE_EXTENSIONS,"Button",BS_AUTOCHECKBOX | ! WS_TABSTOP,144,7,144,10,WS_EX_RIGHT ! PUSHBUTTON "&Change",IDC_FILEFILTER_CHANGE,240,109,48,14 ! CONTROL "Default Filter",IDC_RADIO_DEFFILTER_COMBO,"Button", ! BS_AUTORADIOBUTTON | WS_GROUP,7,145,55,10 ! CONTROL "Default Filter Last Selected", ! IDC_RADIO_DEFFILTER_LASTSELECTED,"Button", ! BS_AUTORADIOBUTTON,7,156,101,10 ! CONTROL "Default Filter Current File", ! IDC_RADIO_DEFFILTER_CURRENTFILE,"Button", ! BS_AUTORADIOBUTTON,7,167,93,10 ! COMBOBOX IDC_COMBO_DEFAULTFILTER,144,145,144,81,CBS_DROPDOWNLIST | ! WS_VSCROLL | WS_TABSTOP END *************** *** 2306,2312 **** BEGIN LEFTMARGIN, 4 ! RIGHTMARGIN, 392 TOPMARGIN, 5 ! BOTTOMMARGIN, 232 END --- 2316,2322 ---- BEGIN LEFTMARGIN, 4 ! RIGHTMARGIN, 416 TOPMARGIN, 5 ! BOTTOMMARGIN, 248 END Index: resource.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/resource.h,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** resource.h 3 Dec 2004 06:46:12 -0000 1.72 --- resource.h 27 Jan 2005 13:34:56 -0000 1.73 *************** *** 367,370 **** --- 367,374 ---- #define IDC_CHECK_TRIMTRAILINGSPACES 1251 #define IDC_PREFMCF_CARETCOLOR 1252 + #define IDC_RADIO_DEFFILTER_COMBO 1253 + #define IDC_RADIO_DEFFILTER_LASTSELECTED 1254 + #define IDC_RADIO_DEFFILTER_CURRENTFILE 1255 + #define IDC_COMBO_DEFAULTFILTER 1256 #define ID_AE_REFRESH_STARTUPPAGE 1340 #define ID_EDIT_FIRST 32768 *************** *** 650,654 **** #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 33043 ! #define _APS_NEXT_CONTROL_VALUE 1253 #define _APS_NEXT_SYMED_VALUE 1341 #endif --- 654,658 ---- #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 33043 ! #define _APS_NEXT_CONTROL_VALUE 1257 #define _APS_NEXT_SYMED_VALUE 1341 #endif Index: DirextPref.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/DirextPref.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DirextPref.cpp 3 Aug 2004 16:43:38 -0000 1.7 --- DirextPref.cpp 27 Jan 2005 13:34:56 -0000 1.8 *************** *** 1,26 **** ! /********************************************************************* ! Copyright (C) 2002 DeepSoft - M.Deepak ! 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 ! M.Deepak - de...@an... ! **********************************************************************/ // DirextPref.cpp : implementation file --- 1,25 ---- ! /**************************************************************************** ! 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 ! *****************************************************************************/ // DirextPref.cpp : implementation file *************** *** 45,50 **** { //{{AFX_DATA_INIT(CDirextPref) ! // NOTE: the ClassWizard will add member initialization here ! //}}AFX_DATA_INIT } --- 44,49 ---- { //{{AFX_DATA_INIT(CDirextPref) ! m_iDefaultFilter = -1; ! //}}AFX_DATA_INIT } *************** *** 54,57 **** --- 53,57 ---- CSAPrefsSubDlg::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDirextPref) + DDX_Control(pDX, IDC_COMBO_DEFAULTFILTER, m_cbbDefaultFilter); DDX_Control(pDX, IDC_CHECK_LANUGUAGE_EXTENSIONS, m_btnAddSyntaxFilters); DDX_Control(pDX, IDC_FILEFILTER_REMOVE, m_buttonRemove); *************** *** 59,64 **** DDX_Control(pDX, IDC_FILEFILTER_ADD, m_buttonAdd); DDX_Control(pDX, IDC_EXTENSIONS, m_listFilters); - DDX_Control(pDX, IDC_EXTENSION, m_editFilterExtensions); DDX_Control(pDX, IDC_DESCRIPTION, m_editFilterName); //}}AFX_DATA_MAP } --- 59,65 ---- DDX_Control(pDX, IDC_FILEFILTER_ADD, m_buttonAdd); DDX_Control(pDX, IDC_EXTENSIONS, m_listFilters); DDX_Control(pDX, IDC_DESCRIPTION, m_editFilterName); + DDX_Control(pDX, IDC_EXTENSION, m_editFilterExtensions); + DDX_Radio(pDX, IDC_RADIO_DEFFILTER_COMBO, m_iDefaultFilter); //}}AFX_DATA_MAP } *************** *** 72,75 **** --- 73,80 ---- ON_NOTIFY(LVN_ITEMCHANGED, IDC_EXTENSIONS, OnItemChangedInList) ON_BN_CLICKED(IDC_CHECK_LANUGUAGE_EXTENSIONS, OnCheckLanuguageExtensions) + ON_BN_CLICKED(IDC_RADIO_DEFFILTER_COMBO, OnRadioDefaultFilter) + ON_BN_CLICKED(IDC_RADIO_DEFFILTER_CURRENTFILE, OnRadioDefaultFilter) + ON_BN_CLICKED(IDC_RADIO_DEFFILTER_LASTSELECTED, OnRadioDefaultFilter) + ON_CBN_SELCHANGE(IDC_COMBO_DEFAULTFILTER, OnChangeComboDefaultFilter) //}}AFX_MSG_MAP END_MESSAGE_MAP() *************** *** 102,110 **** } ! m_btnAddSyntaxFilters.SetCheck( pConfigFile->GetUseSyntaxFileFilters() ? TRUE : FALSE ); // Fill the listbox LoadExtensions(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE --- 107,133 ---- } ! m_btnAddSyntaxFilters.SetCheck( TRUE ); // Fill the listbox LoadExtensions(); + // Fill the default combobox + FillDefaultFilterCombo(); + + if( pConfigFile->GetFileFilterDefault() > 0 ) + { + m_iDefaultFilter = 0; + m_cbbDefaultFilter.SetCurSel( pConfigFile->GetFileFilterDefault() - 1 ); + } + else + { + m_iDefaultFilter = pConfigFile->GetFileFilterDefault() * -1; + m_cbbDefaultFilter.SetCurSel( 0 ); + } + UpdateData( FALSE ); + + if( m_iDefaultFilter == 0 ) m_cbbDefaultFilter.EnableWindow( TRUE ); + else m_cbbDefaultFilter.EnableWindow( FALSE ); + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE *************** *** 170,173 **** --- 193,238 ---- } } + + // At last All Files + AddExtension( "All Files (*.*)", "*.*", m_listFilters.GetItemCount() ); + } + + void CDirextPref::FillDefaultFilterCombo() + { + int iPos; + int iCount; + int iSelectedItem; + CString szFilter; + + iSelectedItem = m_cbbDefaultFilter.GetCurSel(); + m_cbbDefaultFilter.ResetContent(); + if( !m_btnAddSyntaxFilters.GetCheck() ) + { + // First the Language Filters + for( iCount = 0; iCount < arSyntaxFilters.GetSize(); ++ iCount ) + { + szFilter = arSyntaxFilters.GetAt( iCount ); + iPos = szFilter.Find( '|' ); + if( -1 != iPos ) + { + m_cbbDefaultFilter.AddString( szFilter.Left( iPos ) ); + + } + } + } + + // Now the Config File Filters + for( iCount = 0; iCount < m_listFilters.GetItemCount(); ++ iCount ) + { + m_cbbDefaultFilter.AddString( m_listFilters.GetItemText( iCount, 0 ) ); + } + + if( !m_btnAddSyntaxFilters.GetCheck() ) + { + // All Files + m_cbbDefaultFilter.AddString( "All files (*.*)" ); + } + if( -1 != iSelectedItem && iSelectedItem < m_cbbDefaultFilter.GetCount() ) m_cbbDefaultFilter.SetCurSel( iSelectedItem ); + else m_cbbDefaultFilter.SetCurSel( 0 ); } *************** *** 186,192 **** } ! AddExtension( szFilterName, szFilterExtensions, m_listFilters.GetItemCount() ); m_editFilterName.SetWindowText( "" ); m_editFilterExtensions.SetWindowText( "" ); NotifyParentOfChange(); } --- 251,259 ---- } ! if( m_btnAddSyntaxFilters.GetCheck() ) AddExtension( szFilterName, szFilterExtensions, m_listFilters.GetItemCount() - 1 ); ! else AddExtension( szFilterName, szFilterExtensions, m_listFilters.GetItemCount() ); m_editFilterName.SetWindowText( "" ); m_editFilterExtensions.SetWindowText( "" ); + FillDefaultFilterCombo(); NotifyParentOfChange(); } *************** *** 209,212 **** --- 276,280 ---- m_listFilters.DeleteItem( iIndex ); AddExtension( szFilterName, szFilterExtensions, iIndex ); + FillDefaultFilterCombo(); NotifyParentOfChange(); } *************** *** 219,222 **** --- 287,291 ---- { m_listFilters.DeleteItem( iIndex ); + FillDefaultFilterCombo(); NotifyParentOfChange(); } *************** *** 237,245 **** m_editFilterExtensions.SetWindowText( szFilterExtensions ); ! if( m_btnAddSyntaxFilters.GetCheck() && itemNum < theApp.GetConfigFile()->GetLanguageCount() - 1 ) { - m_editFilterName.EnableWindow( FALSE ); - m_editFilterExtensions.EnableWindow( FALSE ); - m_buttonAdd.EnableWindow( FALSE ); m_buttonChange.EnableWindow( FALSE ); m_buttonRemove.EnableWindow( FALSE ); --- 306,311 ---- m_editFilterExtensions.SetWindowText( szFilterExtensions ); ! if( m_btnAddSyntaxFilters.GetCheck() && ( itemNum < theApp.GetConfigFile()->GetLanguageCount() - 1 || itemNum == m_listFilters.GetItemCount() - 1 ) ) { m_buttonChange.EnableWindow( FALSE ); m_buttonRemove.EnableWindow( FALSE ); *************** *** 247,253 **** else { - m_editFilterName.EnableWindow( TRUE ); - m_editFilterExtensions.EnableWindow( TRUE ); - m_buttonAdd.EnableWindow( TRUE ); m_buttonChange.EnableWindow( TRUE ); m_buttonRemove.EnableWindow( TRUE ); --- 313,316 ---- *************** *** 267,279 **** if( !m_hWnd ) return false; ! if( pConfigFile->GetUseSyntaxFileFilters() ? 1 : 0 != m_btnAddSyntaxFilters.GetCheck() ) { ! pConfigFile->SetUseSyntaxFileFilters( m_btnAddSyntaxFilters.GetCheck() ? true : false ); } ! if( m_listFilters.GetItemCount() > pConfigFile->GetLanguageCount() - 1 ) { ! pConfigFile->RemoveAllFileFilters(); ! for( iCount = pConfigFile->GetLanguageCount() - 1; iCount < m_listFilters.GetItemCount(); ++ iCount ) { szFilter = m_listFilters.GetItemText( iCount, 0 ); --- 330,348 ---- if( !m_hWnd ) return false; ! UpdateData( TRUE ); ! ! // Save the default file filter ! if( m_iDefaultFilter == 0 ) iCount = m_cbbDefaultFilter.GetCurSel() + 1; ! else iCount = m_iDefaultFilter * -1; ! if( pConfigFile->GetFileFilterDefault() != iCount ) { ! pConfigFile->SetFileFilterDefault( iCount ); } ! // Save the user added file filters. ! pConfigFile->RemoveAllFileFilters(); ! if( m_btnAddSyntaxFilters.GetCheck() ) { ! for( iCount = arSyntaxFilters.GetSize(); iCount < m_listFilters.GetItemCount() - 1; ++ iCount ) { szFilter = m_listFilters.GetItemText( iCount, 0 ); *************** *** 282,288 **** pConfigFile->AddFileFilter( szFilter ); } - return TRUE; } ! return FALSE; } --- 351,367 ---- pConfigFile->AddFileFilter( szFilter ); } } ! else ! { ! for( iCount = 0; iCount < m_listFilters.GetItemCount(); ++ iCount ) ! { ! szFilter = m_listFilters.GetItemText( iCount, 0 ); ! szFilter += "|"; ! szFilter += m_listFilters.GetItemText( iCount, 1 ); ! pConfigFile->AddFileFilter( szFilter ); ! } ! } ! ! return TRUE; } *************** *** 313,316 **** --- 392,413 ---- } } + if( m_btnAddSyntaxFilters.GetCheck() ) AddExtension( "All Files (*.*)", "*.*", m_listFilters.GetItemCount() ); + else m_listFilters.DeleteItem( m_listFilters.GetItemCount() -1 ); + FillDefaultFilterCombo(); + NotifyParentOfChange(); + } + + void CDirextPref::OnRadioDefaultFilter() + { + UpdateData( TRUE ); + + if( m_iDefaultFilter == 0 ) m_cbbDefaultFilter.EnableWindow( TRUE ); + else m_cbbDefaultFilter.EnableWindow( FALSE ); + + NotifyParentOfChange(); + } + + void CDirextPref::OnChangeComboDefaultFilter() + { NotifyParentOfChange(); } Index: DirextPref.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/DirextPref.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DirextPref.h 31 Jul 2004 15:57:30 -0000 1.3 --- DirextPref.h 27 Jan 2005 13:34:56 -0000 1.4 *************** *** 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 + *****************************************************************************/ + #if !defined(AFX_DIREXTPREF_H__31788A42_2089_11D6_B413_F5448EDB517A__INCLUDED_) #define AFX_DIREXTPREF_H__31788A42_2089_11D6_B413_F5448EDB517A__INCLUDED_ *************** *** 25,28 **** --- 49,53 ---- //{{AFX_DATA(CDirextPref) enum { IDD = IDD_PREF_EXTEN }; + CComboBox m_cbbDefaultFilter; CButton m_btnAddSyntaxFilters; CButton m_buttonRemove; *************** *** 32,35 **** --- 57,61 ---- CEdit m_editFilterName; CEdit m_editFilterExtensions; + int m_iDefaultFilter; //}}AFX_DATA *************** *** 38,42 **** void AddExtension( LPCSTR pszDescriptions, LPCSTR pszExtensions, int iPos ); ! // Overrides --- 64,68 ---- void AddExtension( LPCSTR pszDescriptions, LPCSTR pszExtensions, int iPos ); ! void FillDefaultFilterCombo(); // Overrides *************** *** 58,61 **** --- 84,89 ---- afx_msg void OnItemChangedInList(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnCheckLanuguageExtensions(); + afx_msg void OnRadioDefaultFilter(); + afx_msg void OnChangeComboDefaultFilter(); //}}AFX_MSG DECLARE_MESSAGE_MAP() |