From: Leon W. <moo...@us...> - 2005-02-01 07:03:20
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7774 Modified Files: AnyEdit.rc AnyEditView.cpp Goto.cpp Goto.h resource.h Log Message: Updated Goto Dialog box. Made a more general approach to the usage, so we may use it in other situations. Also added license headers. Index: Goto.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/Goto.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Goto.h 27 Jul 2004 07:52:46 -0000 1.4 --- Goto.h 1 Feb 2005 07:03:03 -0000 1.5 *************** *** 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_GOTO_H__5FBC5F3B_F8C7_4030_BB27_67D7B4146CD3__INCLUDED_) #define AFX_GOTO_H__5FBC5F3B_F8C7_4030_BB27_67D7B4146CD3__INCLUDED_ *************** *** 7,11 **** // Goto.h : header file // ! #include "Misc.h" ///////////////////////////////////////////////////////////////////////////// // CGoto dialog --- 31,35 ---- // Goto.h : header file // ! ///////////////////////////////////////////////////////////////////////////// // CGoto dialog *************** *** 13,32 **** class CGoto : public CDialog { - protected: ! CMisc msc; ! int iCurLineNo; ! int iLastLineNo; ! // Construction ! public: ! CGoto(CWnd* pParent = NULL,int iCurLineNo=0,int iLastLineNo=0); // standard constructor // Dialog Data //{{AFX_DATA(CGoto) enum { IDD = IDD_GOTO }; ! CEdit m_lineminmax; ! CEdit m_edit; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides --- 37,57 ---- class CGoto : public CDialog { protected: ! int m_iCurrentLine; ! int m_iLastLine; // Dialog Data //{{AFX_DATA(CGoto) enum { IDD = IDD_GOTO }; ! CSpinButtonCtrl m_spinGoto; //}}AFX_DATA + public: + /// Constructor + CGoto(CWnd* pParent = NULL,int iCurrentLine=0,int iLastLine=0); // standard constructor + + /// Get the selected line number. + int GetSelectedLine(); + // Overrides // ClassWizard generated virtual function overrides *************** *** 43,47 **** virtual void OnOK(); virtual BOOL OnInitDialog(); ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; --- 68,76 ---- virtual void OnOK(); virtual BOOL OnInitDialog(); ! afx_msg void OnButtonAdd10(); ! afx_msg void OnButtonAdd100(); ! afx_msg void OnButtonSub100(); ! afx_msg void OnButtonSub10(); ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: Goto.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/Goto.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Goto.cpp 7 Sep 2004 19:55:54 -0000 1.5 --- Goto.cpp 1 Feb 2005 07:03:03 -0000 1.6 *************** *** 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 + *****************************************************************************/ + // Goto.cpp : implementation file // *************** *** 16,27 **** ! CGoto::CGoto(CWnd* pParent /*=NULL*/,int iCurLine,int iLastLine) ! : CDialog(CGoto::IDD, pParent) { //{{AFX_DATA_INIT(CGoto) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT ! iCurLineNo = iCurLine; ! iLastLineNo = iLastLine; } --- 40,50 ---- ! CGoto::CGoto( CWnd* pParent /*=NULL*/,int iCurrentLine, int iLastLine ) : CDialog(CGoto::IDD, pParent) { //{{AFX_DATA_INIT(CGoto) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT ! m_iCurrentLine = iCurrentLine; ! m_iLastLine = iLastLine; } *************** *** 31,36 **** CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CGoto) ! DDX_Control(pDX, IDC_EDIT_GOTO_LINEMINMAX, m_lineminmax); ! DDX_Control(pDX, IDC_EDIT_GOTO, m_edit); //}}AFX_DATA_MAP } --- 54,58 ---- CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CGoto) ! DDX_Control(pDX, IDC_SPIN_GOTO, m_spinGoto); //}}AFX_DATA_MAP } *************** *** 39,43 **** BEGIN_MESSAGE_MAP(CGoto, CDialog) //{{AFX_MSG_MAP(CGoto) ! //}}AFX_MSG_MAP END_MESSAGE_MAP() --- 61,69 ---- BEGIN_MESSAGE_MAP(CGoto, CDialog) //{{AFX_MSG_MAP(CGoto) ! ON_BN_CLICKED(IDC_BUTTON_ADD_10, OnButtonAdd10) ! ON_BN_CLICKED(IDC_BUTTON_ADD_100, OnButtonAdd100) ! ON_BN_CLICKED(IDC_BUTTON_SUB_100, OnButtonSub100) ! ON_BN_CLICKED(IDC_BUTTON_SUB_10, OnButtonSub10) ! //}}AFX_MSG_MAP END_MESSAGE_MAP() *************** *** 45,71 **** // CGoto message handlers - void CGoto::OnOK() - { - - CString str; - m_edit.GetWindowText(str); - int lno = msc.GetIntForString(str); - theApp.GotoFileAndLine(lno,NULL); - CDialog::OnOK(); - } - BOOL CGoto::OnInitDialog() { CDialog::OnInitDialog(); ! m_edit.SetWindowText(msc.GetStringForInt(iCurLineNo)); ! m_edit.SetSel(0,m_edit.GetWindowTextLength()); ! m_edit.SetFocus(); ! ! CString szMinMax = "(1 - "; ! szMinMax+= msc.GetStringForInt(iLastLineNo); ! szMinMax+= ")"; ! m_lineminmax.SetWindowText(szMinMax); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } --- 71,114 ---- // CGoto message handlers BOOL CGoto::OnInitDialog() { CDialog::OnInitDialog(); ! ! // Set the spin button ! m_spinGoto.SetRange( 1, m_iLastLine ); ! m_spinGoto.SetPos( m_iCurrentLine ); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } + + void CGoto::OnOK() + { + m_iCurrentLine = m_spinGoto.GetPos(); + CDialog::OnOK(); + } + + int CGoto::GetSelectedLine() + { + return m_iCurrentLine; + } + + void CGoto::OnButtonAdd10() + { + m_spinGoto.SetPos( m_spinGoto.GetPos() + 10 ); + } + + void CGoto::OnButtonAdd100() + { + m_spinGoto.SetPos( m_spinGoto.GetPos() + 100 ); + } + + void CGoto::OnButtonSub100() + { + m_spinGoto.SetPos( m_spinGoto.GetPos() - 100 ); + } + + void CGoto::OnButtonSub10() + { + m_spinGoto.SetPos( m_spinGoto.GetPos() - 10 ); + } Index: AnyEdit.rc =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.rc,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** AnyEdit.rc 31 Jan 2005 22:55:39 -0000 1.112 --- AnyEdit.rc 1 Feb 2005 07:02:55 -0000 1.113 *************** *** 2020,2034 **** END ! IDD_GOTO DIALOG DISCARDABLE 0, 0, 172, 55 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "Goto" FONT 8, "MS Sans Serif" BEGIN ! DEFPUSHBUTTON "Go",IDOK,115,7,50,14 ! PUSHBUTTON "Cancel",IDCANCEL,115,34,50,14 ! LTEXT "Goto Line :",IDC_STATIC,7,18,41,14 ! EDITTEXT IDC_EDIT_GOTO,50,16,56,13,ES_AUTOHSCROLL ! EDITTEXT IDC_EDIT_GOTO_LINEMINMAX,7,32,96,11,ES_RIGHT | ! ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER END --- 2020,2038 ---- END ! IDD_GOTO DIALOG DISCARDABLE 0, 0, 123, 73 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "Goto" FONT 8, "MS Sans Serif" BEGIN ! DEFPUSHBUTTON "Go",IDOK,7,52,50,14 ! PUSHBUTTON "Cancel",IDCANCEL,66,52,50,14 ! EDITTEXT IDC_EDIT_GOTO,39,28,41,14,ES_RIGHT | ES_AUTOHSCROLL ! CONTROL "Spin1",IDC_SPIN_GOTO,"msctls_updown32",UDS_SETBUDDYINT | ! UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,81,26,11, ! 19 ! PUSHBUTTON "+10",IDC_BUTTON_ADD_10,7,7,25,14 ! PUSHBUTTON "+100",IDC_BUTTON_ADD_100,35,7,25,14 ! PUSHBUTTON "-100",IDC_BUTTON_SUB_100,63,7,25,14 ! PUSHBUTTON "-10",IDC_BUTTON_SUB_10,91,7,25,14 END *************** *** 2485,2491 **** BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 165 TOPMARGIN, 7 ! BOTTOMMARGIN, 48 END --- 2489,2495 ---- BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 116 TOPMARGIN, 7 ! BOTTOMMARGIN, 66 END Index: resource.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/resource.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** resource.h 27 Jan 2005 13:34:56 -0000 1.73 --- resource.h 1 Feb 2005 07:03:03 -0000 1.74 *************** *** 371,374 **** --- 371,379 ---- #define IDC_RADIO_DEFFILTER_CURRENTFILE 1255 #define IDC_COMBO_DEFAULTFILTER 1256 + #define IDC_SPIN_GOTO 1257 + #define IDC_BUTTON_ADD_10 1258 + #define IDC_BUTTON_ADD_100 1259 + #define IDC_BUTTON_SUB_100 1260 + #define IDC_BUTTON_SUB_10 1261 #define ID_AE_REFRESH_STARTUPPAGE 1340 #define ID_EDIT_FIRST 32768 *************** *** 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 --- 659,663 ---- #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 33043 ! #define _APS_NEXT_CONTROL_VALUE 1261 #define _APS_NEXT_SYMED_VALUE 1341 #endif Index: AnyEditView.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditView.cpp,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** AnyEditView.cpp 27 Jan 2005 13:46:08 -0000 1.87 --- AnyEditView.cpp 1 Feb 2005 07:02:57 -0000 1.88 *************** *** 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 + *****************************************************************************/ + // AnyEditView.cpp : implementation of the CAnyEditView class // *************** *** 1392,1396 **** { CGoto cg(NULL,m_Scintilla.GetCurLineNumber(),m_Scintilla.GetLineCount()); ! cg.DoModal(); } --- 1416,1423 ---- { CGoto cg(NULL,m_Scintilla.GetCurLineNumber(),m_Scintilla.GetLineCount()); ! if( IDOK == cg.DoModal() ) ! { ! theApp.GotoFileAndLine( cg.GetSelectedLine(), NULL ); ! } } |